@@ -170,7 +170,6 @@ Make sure to internationalize the `aria-label` you pass to the [ProgressBar](Pro
170
170
171
171
``` tsx example
172
172
import {useState } from ' react' ;
173
- import {ProgressBar , Text } from ' react-aria-components' ;
174
173
175
174
function PendingButton(props ) {
176
175
let [isPending, setPending] = useState (false );
@@ -189,13 +188,10 @@ function PendingButton(props) {
189
188
onPress = { handlePress } >
190
189
{ ({isPending }) => (
191
190
<>
192
- { ! isPending && <Text >Save</Text >}
191
+ { ! isPending && <span >Save</span >}
193
192
{ isPending && (
194
- <ProgressBar aria-label = " Saving..." isIndeterminate >
195
- <svg width = " 16" height = " 16" style = { {display: ' block' }} >
196
- <use href = " #spinner" />
197
- </svg >
198
- </ProgressBar >
193
+ // See below
194
+ <MyProgressCircle aria-label = " Saving..." isIndeterminate />
199
195
)}
200
196
</>
201
197
)}
@@ -204,19 +200,29 @@ function PendingButton(props) {
204
200
}
205
201
```
206
202
207
- ``` tsx snippet hidden
208
- <svg >
209
- <defs >
210
- <g id = " spinner" transform = " scale(0.66)" >
211
- <path fill = " currentColor" d = " M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity = " .25" />
212
- <path fill = " currentColor" d = " M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" >
213
- <animateTransform attributeName = " transform" type = " rotate" dur = " 0.75s" values = " 0 12 12;360 12 12" repeatCount = " indefinite" />
214
- </path >
215
- </g >
216
- </defs >
217
- </svg >
203
+ <details >
204
+ <summary style = { {fontWeight: ' bold' }} ><ChevronRight size = " S" /> MyProgressCircle</summary >
205
+
206
+ ``` tsx example render=false export=true
207
+ import {ProgressBar } from ' react-aria-components' ;
208
+ import type {ProgressBarProps } from ' react-aria-components' ;
209
+
210
+ function MyProgressCircle(props : ProgressBarProps ) {
211
+ return (
212
+ <ProgressBar { ... props } >
213
+ <svg width = " 16" height = " 16" viewBox = " 0 0 24 24" style = { {display: ' block' }} >
214
+ <path fill = " currentColor" d = " M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity = " .25" />
215
+ <path fill = " currentColor" d = " M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z" >
216
+ <animateTransform attributeName = " transform" type = " rotate" dur = " 0.75s" values = " 0 12 12;360 12 12" repeatCount = " indefinite" />
217
+ </path >
218
+ </svg >
219
+ </ProgressBar >
220
+ );
221
+ }
218
222
```
219
223
224
+ </details >
225
+
220
226
### Accessibility
221
227
222
228
** Note:**
@@ -252,13 +258,9 @@ function PendingDelayed(props) {
252
258
style = { {position: ' relative' }} >
253
259
{ ({isPending }) => (
254
260
<>
255
- <Text className = { isPending ? ' pending' : undefined } >Save</Text >
261
+ <span className = { isPending ? ' pending' : undefined } >Save</span >
256
262
{ isPending && (
257
- <ProgressBar aria-label = " in progress" isIndeterminate className = " spinner" >
258
- <svg width = " 16" height = " 16" style = { {display: ' block' }} >
259
- <use href = " #spinner" />
260
- </svg >
261
- </ProgressBar >
263
+ <MyProgressCircle aria-label = " in progress" isIndeterminate className = " spinner" />
262
264
)}
263
265
</>
264
266
)}
0 commit comments