Skip to content

Commit 009086c

Browse files
committed
feat: release react-awesome-button 8.1.0
1 parent 2ab11de commit 009086c

23 files changed

Lines changed: 1989 additions & 83 deletions

README.md

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- **`AwesomeButtonProgress`** — progress flow wrapper on top of `AwesomeButton`
77
- **`AwesomeButtonSocial`** — social/share wrapper on top of `AwesomeButton`
88

9-
This README is updated for the current v8 build outputs (including theme CSS + theme module mappings).
9+
This README is updated for the current `8.1.0` release outputs (including theme CSS + theme module mappings).
1010

1111
---
1212

@@ -196,6 +196,29 @@ export default function Example() {
196196
}
197197
```
198198

199+
### Text transition (string labels only)
200+
201+
Use `textTransition` when the button label is a plain string and you want label changes to animate.
202+
203+
```jsx
204+
import React from 'react';
205+
import { AwesomeButton } from '@rcaferati/react-awesome-button';
206+
import '@rcaferati/react-awesome-button/styles.css';
207+
208+
export default function Example() {
209+
const [expanded, setExpanded] = React.useState(false);
210+
211+
return (
212+
<AwesomeButton
213+
type="primary"
214+
textTransition
215+
onPress={() => setExpanded((value) => !value)}>
216+
{expanded ? 'Processing settlement report' : 'Generate report'}
217+
</AwesomeButton>
218+
);
219+
}
220+
```
221+
199222
---
200223

201224
## `AwesomeButton` Props
@@ -208,6 +231,7 @@ export default function Example() {
208231
| `disabled` | `boolean` | `false` | Disables interactions |
209232
| `visible` | `boolean` | `true` | Toggles visible state class |
210233
| `placeholder` | `boolean` | `false` | If `true` and `children` is empty, renders placeholder/disabled state |
234+
| `textTransition` | `boolean` | `false` | Animates string-only label changes with a scrambling transition |
211235
| `between` | `boolean` | `false` | Uses `space-between` layout for content (useful with icons) |
212236
| `ripple` | `boolean` | `false` | Enables ripple effect on successful press release |
213237
| `moveEvents` | `boolean` | `true` | Enables pointer move position classes (`left/middle/right`) |
@@ -291,6 +315,36 @@ export default function Example() {
291315
}
292316
```
293317

318+
### Spinner/text-only mode and custom bar timing
319+
320+
Use `showProgressBar={false}` to keep the loading/result text flow while hiding the dark loading bar.
321+
Use `progressLoadingTime` to control how long the progress bar takes to advance during the loading phase.
322+
323+
```jsx
324+
import React from 'react';
325+
import { AwesomeButtonProgress } from '@rcaferati/react-awesome-button';
326+
import '@rcaferati/react-awesome-button/styles.css';
327+
328+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
329+
330+
export default function Example() {
331+
return (
332+
<AwesomeButtonProgress
333+
type="primary"
334+
loadingLabel="Syncing…"
335+
resultLabel="Synced!"
336+
showProgressBar={false}
337+
progressLoadingTime={1500}
338+
onPress={async (_event, next) => {
339+
await sleep(900);
340+
next(true);
341+
}}>
342+
Sync account
343+
</AwesomeButtonProgress>
344+
);
345+
}
346+
```
347+
294348
### With icon (`before`)
295349

296350
```jsx
@@ -325,12 +379,14 @@ export default function Example() {
325379

326380
> `AwesomeButtonProgress` accepts all `AwesomeButton` props **except** `active` and replaces `onPress` with the progress version below.
327381
328-
| Prop | Type | Default | Description |
329-
| -------------- | ----------------------- | ------------ | ------------------------------------------------------------ |
330-
| `onPress` | `(event, next) => void` | `null` | Progress handler. Call `next(true)` or `next(false, label?)` |
331-
| `loadingLabel` | `string` | `'Wait…'` | Loading phase label |
332-
| `resultLabel` | `string` | `'Success!'` | Success label |
333-
| `releaseDelay` | `number` | `500` | Delay before reset after progress end |
382+
| Prop | Type | Default | Description |
383+
| --------------------- | ----------------------- | ------------ | ------------------------------------------------------------------------- |
384+
| `onPress` | `(event, next) => void` | `null` | Progress handler. Call `next(true)` or `next(false, label?)` |
385+
| `loadingLabel` | `string` | `'Wait…'` | Loading phase label |
386+
| `resultLabel` | `string` | `'Success!'` | Success label |
387+
| `releaseDelay` | `number` | `500` | Delay before reset after progress end |
388+
| `showProgressBar` | `boolean` | `true` | Hides the dark loading bar when `false`, while keeping the progress flow |
389+
| `progressLoadingTime` | `number` | `6000` | Loading-phase progress bar duration in milliseconds |
334390

335391
---
336392

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rcaferati/react-awesome-button",
3-
"version": "8.0.2",
3+
"version": "8.1.0",
44
"description": "Performant, extendable, highly customisable, production ready React Component that renders an animated basic set of UI buttons",
55
"author": "Rafael Caferati",
66
"license": "MIT",
@@ -173,6 +173,6 @@
173173
"javascript"
174174
],
175175
"volta": {
176-
"node": "24.13.1"
176+
"node": "24.15.0"
177177
}
178178
}

src/__tests__/__snapshots__/component.test.tsx.snap

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ exports[`Public API smoke tests renders AwesomeButtonProgress without crashing 1
8686
onPointerLeave={[Function]}
8787
onPointerMove={[Function]}
8888
onPointerUp={[Function]}
89-
style={{}}
89+
style={
90+
{
91+
"--loading-transition-end-speed": "300ms",
92+
"--loading-transition-speed": "6000ms",
93+
}
94+
}
9095
type="button"
9196
>
9297
<span
@@ -252,7 +257,12 @@ exports[`Public API smoke tests renders a progress button with explicit success
252257
onPointerLeave={[Function]}
253258
onPointerMove={[Function]}
254259
onPointerUp={[Function]}
255-
style={{}}
260+
style={
261+
{
262+
"--loading-transition-end-speed": "300ms",
263+
"--loading-transition-speed": "6000ms",
264+
}
265+
}
256266
type="button"
257267
>
258268
<span

0 commit comments

Comments
 (0)