Skip to content

Commit e6e8478

Browse files
authored
Merge pull request #167 from rcaferati/release/8.1.0
Release 8.1.0
2 parents 756a194 + 009086c commit e6e8478

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

@@ -202,6 +202,29 @@ export default function Example() {
202202
}
203203
```
204204

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

207230
## `AwesomeButton` Props
@@ -214,6 +237,7 @@ export default function Example() {
214237
| `disabled` | `boolean` | `false` | Disables interactions |
215238
| `visible` | `boolean` | `true` | Toggles visible state class |
216239
| `placeholder` | `boolean` | `false` | If `true` and `children` is empty, renders placeholder/disabled state |
240+
| `textTransition` | `boolean` | `false` | Animates string-only label changes with a scrambling transition |
217241
| `between` | `boolean` | `false` | Uses `space-between` layout for content (useful with icons) |
218242
| `ripple` | `boolean` | `false` | Enables ripple effect on successful press release |
219243
| `moveEvents` | `boolean` | `true` | Enables pointer move position classes (`left/middle/right`) |
@@ -297,6 +321,36 @@ export default function Example() {
297321
}
298322
```
299323

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

302356
```jsx
@@ -331,12 +385,14 @@ export default function Example() {
331385

332386
> `AwesomeButtonProgress` accepts all `AwesomeButton` props **except** `active` and replaces `onPress` with the progress version below.
333387
334-
| Prop | Type | Default | Description |
335-
| -------------- | ----------------------- | ------------ | ------------------------------------------------------------ |
336-
| `onPress` | `(event, next) => void` | `null` | Progress handler. Call `next(true)` or `next(false, label?)` |
337-
| `loadingLabel` | `string` | `'Wait…'` | Loading phase label |
338-
| `resultLabel` | `string` | `'Success!'` | Success label |
339-
| `releaseDelay` | `number` | `500` | Delay before reset after progress end |
388+
| Prop | Type | Default | Description |
389+
| --------------------- | ----------------------- | ------------ | ------------------------------------------------------------------------- |
390+
| `onPress` | `(event, next) => void` | `null` | Progress handler. Call `next(true)` or `next(false, label?)` |
391+
| `loadingLabel` | `string` | `'Wait…'` | Loading phase label |
392+
| `resultLabel` | `string` | `'Success!'` | Success label |
393+
| `releaseDelay` | `number` | `500` | Delay before reset after progress end |
394+
| `showProgressBar` | `boolean` | `true` | Hides the dark loading bar when `false`, while keeping the progress flow |
395+
| `progressLoadingTime` | `number` | `6000` | Loading-phase progress bar duration in milliseconds |
340396

341397
---
342398

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)