@coinbase/cds-mcp-server 8.17.2 → 8.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/mcp-docs/mobile/components/Accordion.txt +189 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +30 -0
- package/mcp-docs/mobile/components/Alert.txt +156 -0
- package/mcp-docs/mobile/components/AreaChart.txt +266 -0
- package/mcp-docs/mobile/components/Avatar.txt +196 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +226 -0
- package/mcp-docs/mobile/components/Banner.txt +222 -0
- package/mcp-docs/mobile/components/BarChart.txt +816 -0
- package/mcp-docs/mobile/components/Box.txt +174 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +147 -0
- package/mcp-docs/mobile/components/Button.txt +199 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +80 -0
- package/mcp-docs/mobile/components/Carousel.txt +1084 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +826 -0
- package/mcp-docs/mobile/components/CellMedia.txt +71 -0
- package/mcp-docs/mobile/components/Checkbox.txt +246 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +202 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +285 -0
- package/mcp-docs/mobile/components/Chip.txt +195 -0
- package/mcp-docs/mobile/components/Coachmark.txt +158 -0
- package/mcp-docs/mobile/components/Collapsible.txt +105 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +135 -0
- package/mcp-docs/mobile/components/ContentCard.txt +366 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +136 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +128 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +146 -0
- package/mcp-docs/mobile/components/ContentCell.txt +227 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +444 -0
- package/mcp-docs/mobile/components/DatePicker.txt +497 -0
- package/mcp-docs/mobile/components/Divider.txt +139 -0
- package/mcp-docs/mobile/components/DotCount.txt +146 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +59 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +135 -0
- package/mcp-docs/mobile/components/Fallback.txt +158 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +156 -0
- package/mcp-docs/mobile/components/HStack.txt +235 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +48 -0
- package/mcp-docs/mobile/components/Icon.txt +52 -0
- package/mcp-docs/mobile/components/IconButton.txt +269 -0
- package/mcp-docs/mobile/components/InputChip.txt +188 -0
- package/mcp-docs/mobile/components/Interactable.txt +187 -0
- package/mcp-docs/mobile/components/LineChart.txt +1325 -0
- package/mcp-docs/mobile/components/Link.txt +292 -0
- package/mcp-docs/mobile/components/ListCell.txt +391 -0
- package/mcp-docs/mobile/components/LogoMark.txt +85 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +94 -0
- package/mcp-docs/mobile/components/Lottie.txt +139 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +47 -0
- package/mcp-docs/mobile/components/Modal.txt +84 -0
- package/mcp-docs/mobile/components/ModalBody.txt +34 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +25 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +28 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +380 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +132 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +142 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +90 -0
- package/mcp-docs/mobile/components/Numpad.txt +341 -0
- package/mcp-docs/mobile/components/Overlay.txt +152 -0
- package/mcp-docs/mobile/components/PageFooter.txt +161 -0
- package/mcp-docs/mobile/components/PageHeader.txt +186 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +408 -0
- package/mcp-docs/mobile/components/Pictogram.txt +48 -0
- package/mcp-docs/mobile/components/Point.txt +205 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +79 -0
- package/mcp-docs/mobile/components/Pressable.txt +211 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +130 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +161 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +138 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +237 -0
- package/mcp-docs/mobile/components/Radio.txt +242 -0
- package/mcp-docs/mobile/components/RadioCell.txt +202 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +282 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +153 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +106 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +61 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +789 -0
- package/mcp-docs/mobile/components/Scrubber.txt +204 -0
- package/mcp-docs/mobile/components/SearchInput.txt +192 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +205 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +316 -0
- package/mcp-docs/mobile/components/Select.txt +212 -0
- package/mcp-docs/mobile/components/SelectChip.txt +324 -0
- package/mcp-docs/mobile/components/SelectOption.txt +85 -0
- package/mcp-docs/mobile/components/SlideButton.txt +331 -0
- package/mcp-docs/mobile/components/Spacer.txt +84 -0
- package/mcp-docs/mobile/components/Sparkline.txt +123 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +107 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +157 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +73 -0
- package/mcp-docs/mobile/components/Spinner.txt +49 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +48 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +48 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +48 -0
- package/mcp-docs/mobile/components/Stepper.txt +528 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/mobile/components/Switch.txt +98 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +49 -0
- package/mcp-docs/mobile/components/TabLabel.txt +154 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +147 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +143 -0
- package/mcp-docs/mobile/components/Tabs.txt +191 -0
- package/mcp-docs/mobile/components/Tag.txt +301 -0
- package/mcp-docs/mobile/components/Text.txt +212 -0
- package/mcp-docs/mobile/components/TextInput.txt +718 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +133 -0
- package/mcp-docs/mobile/components/Toast.txt +197 -0
- package/mcp-docs/mobile/components/Tooltip.txt +60 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +162 -0
- package/mcp-docs/mobile/components/Tour.txt +159 -0
- package/mcp-docs/mobile/components/Tray.txt +253 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +322 -0
- package/mcp-docs/mobile/components/VStack.txt +223 -0
- package/mcp-docs/mobile/components/XAxis.txt +622 -0
- package/mcp-docs/mobile/components/YAxis.txt +568 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +99 -0
- package/mcp-docs/mobile/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/mobile/getting-started/playground.txt +25 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +47 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +215 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +110 -0
- package/mcp-docs/mobile/routes.txt +132 -0
- package/mcp-docs/web/components/Accordion.txt +190 -0
- package/mcp-docs/web/components/AccordionItem.txt +32 -0
- package/mcp-docs/web/components/Alert.txt +165 -0
- package/mcp-docs/web/components/AreaChart.txt +511 -0
- package/mcp-docs/web/components/Avatar.txt +212 -0
- package/mcp-docs/web/components/AvatarButton.txt +241 -0
- package/mcp-docs/web/components/Banner.txt +227 -0
- package/mcp-docs/web/components/BarChart.txt +1268 -0
- package/mcp-docs/web/components/Box.txt +176 -0
- package/mcp-docs/web/components/Button.txt +213 -0
- package/mcp-docs/web/components/ButtonGroup.txt +80 -0
- package/mcp-docs/web/components/Calendar.txt +182 -0
- package/mcp-docs/web/components/Carousel.txt +1576 -0
- package/mcp-docs/web/components/CartesianChart.txt +1045 -0
- package/mcp-docs/web/components/CellMedia.txt +57 -0
- package/mcp-docs/web/components/Checkbox.txt +189 -0
- package/mcp-docs/web/components/CheckboxCell.txt +203 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +220 -0
- package/mcp-docs/web/components/Chip.txt +197 -0
- package/mcp-docs/web/components/Coachmark.txt +189 -0
- package/mcp-docs/web/components/Collapsible.txt +120 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +233 -0
- package/mcp-docs/web/components/ContentCard.txt +368 -0
- package/mcp-docs/web/components/ContentCardBody.txt +138 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +130 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +148 -0
- package/mcp-docs/web/components/ContentCell.txt +220 -0
- package/mcp-docs/web/components/ControlGroup.txt +437 -0
- package/mcp-docs/web/components/DatePicker.txt +506 -0
- package/mcp-docs/web/components/Divider.txt +144 -0
- package/mcp-docs/web/components/DotCount.txt +150 -0
- package/mcp-docs/web/components/DotStatusColor.txt +59 -0
- package/mcp-docs/web/components/DotSymbol.txt +138 -0
- package/mcp-docs/web/components/Dropdown.txt +120 -0
- package/mcp-docs/web/components/Fallback.txt +164 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +251 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +70 -0
- package/mcp-docs/web/components/FullscreenModal.txt +146 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +188 -0
- package/mcp-docs/web/components/Grid.txt +237 -0
- package/mcp-docs/web/components/GridColumn.txt +210 -0
- package/mcp-docs/web/components/HStack.txt +237 -0
- package/mcp-docs/web/components/HeroSquare.txt +49 -0
- package/mcp-docs/web/components/Icon.txt +146 -0
- package/mcp-docs/web/components/IconButton.txt +391 -0
- package/mcp-docs/web/components/InputChip.txt +188 -0
- package/mcp-docs/web/components/Interactable.txt +194 -0
- package/mcp-docs/web/components/LineChart.txt +1577 -0
- package/mcp-docs/web/components/Link.txt +244 -0
- package/mcp-docs/web/components/ListCell.txt +397 -0
- package/mcp-docs/web/components/LogoMark.txt +85 -0
- package/mcp-docs/web/components/LogoWordMark.txt +94 -0
- package/mcp-docs/web/components/Lottie.txt +158 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +58 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +109 -0
- package/mcp-docs/web/components/Modal.txt +193 -0
- package/mcp-docs/web/components/ModalBody.txt +118 -0
- package/mcp-docs/web/components/ModalFooter.txt +120 -0
- package/mcp-docs/web/components/ModalHeader.txt +124 -0
- package/mcp-docs/web/components/MultiContentModule.txt +382 -0
- package/mcp-docs/web/components/NavigationBar.txt +103 -0
- package/mcp-docs/web/components/NavigationTitle.txt +26 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +46 -0
- package/mcp-docs/web/components/NudgeCard.txt +182 -0
- package/mcp-docs/web/components/Overlay.txt +172 -0
- package/mcp-docs/web/components/PageFooter.txt +185 -0
- package/mcp-docs/web/components/PageHeader.txt +244 -0
- package/mcp-docs/web/components/Pagination.txt +500 -0
- package/mcp-docs/web/components/PeriodSelector.txt +704 -0
- package/mcp-docs/web/components/Pictogram.txt +49 -0
- package/mcp-docs/web/components/Point.txt +461 -0
- package/mcp-docs/web/components/PortalProvider.txt +77 -0
- package/mcp-docs/web/components/Pressable.txt +194 -0
- package/mcp-docs/web/components/ProgressBar.txt +164 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +213 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +182 -0
- package/mcp-docs/web/components/ProgressCircle.txt +444 -0
- package/mcp-docs/web/components/Radio.txt +220 -0
- package/mcp-docs/web/components/RadioCell.txt +216 -0
- package/mcp-docs/web/components/RadioGroup.txt +289 -0
- package/mcp-docs/web/components/ReferenceLine.txt +452 -0
- package/mcp-docs/web/components/RemoteImage.txt +166 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +87 -0
- package/mcp-docs/web/components/RollingNumber.txt +1022 -0
- package/mcp-docs/web/components/Scrubber.txt +232 -0
- package/mcp-docs/web/components/SearchInput.txt +118 -0
- package/mcp-docs/web/components/SectionHeader.txt +218 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +325 -0
- package/mcp-docs/web/components/Select.txt +225 -0
- package/mcp-docs/web/components/SelectChip.txt +315 -0
- package/mcp-docs/web/components/SelectOption.txt +166 -0
- package/mcp-docs/web/components/Sidebar.txt +350 -0
- package/mcp-docs/web/components/SidebarItem.txt +132 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +31 -0
- package/mcp-docs/web/components/Spacer.txt +174 -0
- package/mcp-docs/web/components/Sparkline.txt +123 -0
- package/mcp-docs/web/components/SparklineGradient.txt +107 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +154 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +77 -0
- package/mcp-docs/web/components/Spinner.txt +129 -0
- package/mcp-docs/web/components/SpotIcon.txt +49 -0
- package/mcp-docs/web/components/SpotRectangle.txt +49 -0
- package/mcp-docs/web/components/SpotSquare.txt +49 -0
- package/mcp-docs/web/components/Stepper.txt +683 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/web/components/Switch.txt +86 -0
- package/mcp-docs/web/components/TabIndicator.txt +49 -0
- package/mcp-docs/web/components/TabLabel.txt +159 -0
- package/mcp-docs/web/components/TabNavigation.txt +160 -0
- package/mcp-docs/web/components/TabbedChips.txt +156 -0
- package/mcp-docs/web/components/Table.txt +368 -0
- package/mcp-docs/web/components/TableBody.txt +84 -0
- package/mcp-docs/web/components/TableCaption.txt +103 -0
- package/mcp-docs/web/components/TableCell.txt +166 -0
- package/mcp-docs/web/components/TableCellFallback.txt +98 -0
- package/mcp-docs/web/components/TableFooter.txt +84 -0
- package/mcp-docs/web/components/TableHeader.txt +101 -0
- package/mcp-docs/web/components/TableRow.txt +141 -0
- package/mcp-docs/web/components/Tabs.txt +213 -0
- package/mcp-docs/web/components/Tag.txt +305 -0
- package/mcp-docs/web/components/Text.txt +233 -0
- package/mcp-docs/web/components/TextInput.txt +653 -0
- package/mcp-docs/web/components/ThemeProvider.txt +200 -0
- package/mcp-docs/web/components/TileButton.txt +159 -0
- package/mcp-docs/web/components/Toast.txt +204 -0
- package/mcp-docs/web/components/Tooltip.txt +90 -0
- package/mcp-docs/web/components/Tour.txt +180 -0
- package/mcp-docs/web/components/Tray.txt +289 -0
- package/mcp-docs/web/components/UpsellCard.txt +320 -0
- package/mcp-docs/web/components/VStack.txt +225 -0
- package/mcp-docs/web/components/XAxis.txt +620 -0
- package/mcp-docs/web/components/YAxis.txt +549 -0
- package/mcp-docs/web/getting-started/introduction.txt +99 -0
- package/mcp-docs/web/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/web/getting-started/playground.txt +25 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +33 -0
- package/mcp-docs/web/hooks/useDimensions.txt +55 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +55 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +42 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +94 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +217 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +63 -0
- package/mcp-docs/web/hooks/useTheme.txt +105 -0
- package/mcp-docs/web/routes.txt +155 -0
- package/package.json +1 -1
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# ProgressBarWithFloatLabel
|
|
2
|
+
|
|
3
|
+
A ProgressBar with a floating label that moves with progress.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { ProgressBarWithFloatLabel } from '@coinbase/cds-web/visualizations/ProgressBarWithFloatLabel'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `label` | `number \| { value: number; render: (num: number, disabled?: boolean \| undefined) => ReactNode; }` | Yes | `-` | Label that is floated at the end of the filled in bar. If a number is used then it will format it as a percentage. |
|
|
16
|
+
| `progress` | `number` | Yes | `-` | Number between 0-1 representing the progress percentage |
|
|
17
|
+
| `className` | `string` | No | `-` | Custom class name for the progress bar with float label root. |
|
|
18
|
+
| `classNames` | `{ root?: string; labelContainer?: string \| undefined; label?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the progress bar with float label. |
|
|
19
|
+
| `disabled` | `boolean` | No | `false` | Toggle used to show a disabled progress visualization |
|
|
20
|
+
| `labelPlacement` | `above \| below` | No | `above` | Position of label relative to the bar |
|
|
21
|
+
| `style` | `CSSProperties` | No | `-` | Custom styles for the progress bar with float label root. |
|
|
22
|
+
| `styles` | `{ root?: CSSProperties; labelContainer?: CSSProperties \| undefined; label?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the progress bar with float label. |
|
|
23
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID |
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Examples
|
|
27
|
+
|
|
28
|
+
### Label Above
|
|
29
|
+
|
|
30
|
+
```jsx live
|
|
31
|
+
<VStack gap={2}>
|
|
32
|
+
<ProgressBarWithFloatLabel label={0} progress={0} labelPlacement="above">
|
|
33
|
+
<ProgressBar progress={0} />
|
|
34
|
+
</ProgressBarWithFloatLabel>
|
|
35
|
+
<ProgressBarWithFloatLabel label={20} progress={0.2} labelPlacement="above">
|
|
36
|
+
<ProgressBar progress={0.2} />
|
|
37
|
+
</ProgressBarWithFloatLabel>
|
|
38
|
+
</VStack>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Label Below
|
|
42
|
+
|
|
43
|
+
```jsx live
|
|
44
|
+
<VStack gap={2}>
|
|
45
|
+
<ProgressBarWithFloatLabel label={0} progress={0} labelPlacement="below">
|
|
46
|
+
<ProgressBar progress={0} />
|
|
47
|
+
</ProgressBarWithFloatLabel>
|
|
48
|
+
<ProgressBarWithFloatLabel label={20} progress={0.2} labelPlacement="below">
|
|
49
|
+
<ProgressBar progress={0.2} />
|
|
50
|
+
</ProgressBarWithFloatLabel>
|
|
51
|
+
</VStack>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Disabled
|
|
55
|
+
|
|
56
|
+
```jsx live
|
|
57
|
+
<VStack gap={2}>
|
|
58
|
+
<ProgressBarWithFloatLabel label={70} progress={0.7} disabled>
|
|
59
|
+
<ProgressBar progress={0.7} disabled />
|
|
60
|
+
</ProgressBarWithFloatLabel>
|
|
61
|
+
</VStack>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Custom Labels
|
|
65
|
+
|
|
66
|
+
```jsx live
|
|
67
|
+
function Example() {
|
|
68
|
+
const renderLabelNumStr = useCallback((num) => {
|
|
69
|
+
return `$${num.toLocaleString()}`;
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
const renderLabelNum = useCallback((num, disabled) => {
|
|
73
|
+
return (
|
|
74
|
+
<TextTitle3 as="span" disabled={disabled}>
|
|
75
|
+
${num.toLocaleString()}
|
|
76
|
+
</TextTitle3>
|
|
77
|
+
);
|
|
78
|
+
}, []);
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<VStack gap={2}>
|
|
82
|
+
<ProgressBarWithFloatLabel
|
|
83
|
+
progress={0.6}
|
|
84
|
+
label={{ value: 12500, render: renderLabelNumStr }}
|
|
85
|
+
labelPlacement="above"
|
|
86
|
+
>
|
|
87
|
+
<ProgressBar progress={0.6} />
|
|
88
|
+
</ProgressBarWithFloatLabel>
|
|
89
|
+
<ProgressBarWithFloatLabel
|
|
90
|
+
progress={0.6}
|
|
91
|
+
label={{ value: 12500, render: renderLabelNum }}
|
|
92
|
+
labelPlacement="above"
|
|
93
|
+
>
|
|
94
|
+
<ProgressBar progress={0.6} />
|
|
95
|
+
</ProgressBarWithFloatLabel>
|
|
96
|
+
<ProgressBarWithFloatLabel
|
|
97
|
+
progress={0.6}
|
|
98
|
+
label={{ value: 12500, render: renderLabelNumStr }}
|
|
99
|
+
labelPlacement="above"
|
|
100
|
+
disabled
|
|
101
|
+
>
|
|
102
|
+
<ProgressBar disabled progress={0.6} />
|
|
103
|
+
</ProgressBarWithFloatLabel>
|
|
104
|
+
<ProgressBarWithFloatLabel
|
|
105
|
+
progress={0.6}
|
|
106
|
+
label={{ value: 12500, render: renderLabelNum }}
|
|
107
|
+
labelPlacement="above"
|
|
108
|
+
disabled
|
|
109
|
+
>
|
|
110
|
+
<ProgressBar disabled progress={0.6} />
|
|
111
|
+
</ProgressBarWithFloatLabel>
|
|
112
|
+
</VStack>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Custom Styles
|
|
118
|
+
|
|
119
|
+
You can customize the appearance of the progress bar and float label using the `styles` prop.
|
|
120
|
+
|
|
121
|
+
```tsx live
|
|
122
|
+
<ProgressContainerWithButtons>
|
|
123
|
+
{({ calculateProgress }) => (
|
|
124
|
+
<VStack gap={2}>
|
|
125
|
+
<ProgressBarWithFloatLabel
|
|
126
|
+
label={Math.round(calculateProgress(0.4) * 100)}
|
|
127
|
+
labelPlacement="above"
|
|
128
|
+
progress={calculateProgress(0.4)}
|
|
129
|
+
styles={{
|
|
130
|
+
label: {
|
|
131
|
+
color: 'var(--color-bgPrimary)',
|
|
132
|
+
fontWeight: 'bold',
|
|
133
|
+
},
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
<ProgressBar
|
|
137
|
+
color="bgPrimary"
|
|
138
|
+
progress={calculateProgress(0.4)}
|
|
139
|
+
styles={{
|
|
140
|
+
container: {
|
|
141
|
+
height: 'var(--space-8)',
|
|
142
|
+
borderRadius: 'var(--borderRadius-1000)',
|
|
143
|
+
},
|
|
144
|
+
progress: {
|
|
145
|
+
borderRadius: 'var(--borderRadius-1000)',
|
|
146
|
+
},
|
|
147
|
+
}}
|
|
148
|
+
/>
|
|
149
|
+
</ProgressBarWithFloatLabel>
|
|
150
|
+
</VStack>
|
|
151
|
+
)}
|
|
152
|
+
</ProgressContainerWithButtons>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Interactive Demo
|
|
156
|
+
|
|
157
|
+
This is for demo purposes. ProgressContainerWithButtons isn't designed for production usage.
|
|
158
|
+
|
|
159
|
+
```jsx live
|
|
160
|
+
<ProgressContainerWithButtons>
|
|
161
|
+
{({ calculateProgress }) => (
|
|
162
|
+
<VStack gap={2}>
|
|
163
|
+
<ProgressBarWithFloatLabel
|
|
164
|
+
label={Math.round(calculateProgress(0) * 100)}
|
|
165
|
+
progress={calculateProgress(0)}
|
|
166
|
+
labelPlacement="above"
|
|
167
|
+
>
|
|
168
|
+
<ProgressBar progress={calculateProgress(0)} />
|
|
169
|
+
</ProgressBarWithFloatLabel>
|
|
170
|
+
<ProgressBarWithFloatLabel
|
|
171
|
+
label={Math.round(calculateProgress(0.2) * 100)}
|
|
172
|
+
progress={calculateProgress(0.2)}
|
|
173
|
+
labelPlacement="above"
|
|
174
|
+
>
|
|
175
|
+
<ProgressBar progress={calculateProgress(0.2)} />
|
|
176
|
+
</ProgressBarWithFloatLabel>
|
|
177
|
+
</VStack>
|
|
178
|
+
)}
|
|
179
|
+
</ProgressContainerWithButtons>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
# ProgressCircle
|
|
2
|
+
|
|
3
|
+
A circular visual indicator of completion progress.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { ProgressCircle } from '@coinbase/cds-web/visualizations/ProgressCircle'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `progress` | `number` | Yes | `-` | Number between 0-1 representing the progress percentage |
|
|
16
|
+
| `className` | `string` | No | `-` | Custom class name for the progress circle root. |
|
|
17
|
+
| `classNames` | `{ root?: string; svg?: string \| undefined; circle?: string \| undefined; progress?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the progress circle. |
|
|
18
|
+
| `color` | `currentColor \| fg \| fgMuted \| fgInverse \| fgPrimary \| fgWarning \| fgPositive \| fgNegative \| bg \| bgAlternate \| bgInverse \| bgOverlay \| bgElevation1 \| bgElevation2 \| bgPrimary \| bgPrimaryWash \| bgSecondary \| bgTertiary \| bgSecondaryWash \| bgNegative \| bgNegativeWash \| bgPositive \| bgPositiveWash \| bgWarning \| bgWarningWash \| bgLine \| bgLineHeavy \| bgLineInverse \| bgLinePrimary \| bgLinePrimarySubtle \| accentSubtleRed \| accentBoldRed \| accentSubtleGreen \| accentBoldGreen \| accentSubtleBlue \| accentBoldBlue \| accentSubtlePurple \| accentBoldPurple \| accentSubtleYellow \| accentBoldYellow \| accentSubtleGray \| accentBoldGray \| transparent` | No | `primary` | Custom progress color. |
|
|
19
|
+
| `contentNode` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Optional component to override the default content rendered inside the circle. |
|
|
20
|
+
| `disableAnimateOnMount` | `boolean` | No | `false` | Disable animation on component mount |
|
|
21
|
+
| `disabled` | `boolean` | No | `false` | Toggle used to show a disabled progress visualization |
|
|
22
|
+
| `hideContent` | `boolean` | No | `-` | Toggle used to hide the content node rendered inside the circle. |
|
|
23
|
+
| `hideText` | `boolean` | No | `-` | - |
|
|
24
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
25
|
+
| `onAnimationEnd` | `(() => void)` | No | `-` | Callback fired when the progress animation ends. |
|
|
26
|
+
| `onAnimationStart` | `(() => void)` | No | `-` | Callback fired when the progress animation starts. |
|
|
27
|
+
| `ref` | `RefObject<HTMLDivElement> \| ((instance: HTMLDivElement \| null) => void) \| null` | No | `-` | - |
|
|
28
|
+
| `size` | `number` | No | `-` | Optional size in px for the visualization. This is useful if the visualization is used in an HStack. If this is omitted the visualization will fill the parent width or height. Since its a circular visualization it will fill the smaller of the parent width or height |
|
|
29
|
+
| `style` | `CSSProperties` | No | `-` | Custom styles for the progress circle root. |
|
|
30
|
+
| `styles` | `{ root?: CSSProperties; svg?: CSSProperties \| undefined; circle?: CSSProperties \| undefined; progress?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the progress circle. |
|
|
31
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Under the hood, testID translates to data-testid on Web. On Mobile, testID stays the same - testID |
|
|
32
|
+
| `weight` | `normal \| heavy \| thin \| semiheavy` | No | `normal` | Toggle used to change thickness of progress visualization |
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Default
|
|
38
|
+
|
|
39
|
+
```jsx live
|
|
40
|
+
<HStack gap={2}>
|
|
41
|
+
<ProgressCircle progress={0} size={100} />
|
|
42
|
+
<ProgressCircle progress={0.5} size={100} />
|
|
43
|
+
<ProgressCircle progress={1} size={100} />
|
|
44
|
+
</HStack>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Thin
|
|
48
|
+
|
|
49
|
+
```jsx live
|
|
50
|
+
<HStack gap={2}>
|
|
51
|
+
<ProgressCircle progress={0} weight="thin" size={100} />
|
|
52
|
+
<ProgressCircle progress={0.5} weight="thin" size={100} />
|
|
53
|
+
<ProgressCircle progress={1} weight="thin" size={100} />
|
|
54
|
+
</HStack>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Semiheavy
|
|
58
|
+
|
|
59
|
+
```jsx live
|
|
60
|
+
<HStack gap={2}>
|
|
61
|
+
<ProgressCircle progress={0} weight="semiheavy" size={100} />
|
|
62
|
+
<ProgressCircle progress={0.5} weight="semiheavy" size={100} />
|
|
63
|
+
<ProgressCircle progress={1} weight="semiheavy" size={100} />
|
|
64
|
+
</HStack>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Heavy
|
|
68
|
+
|
|
69
|
+
```jsx live
|
|
70
|
+
<HStack gap={2}>
|
|
71
|
+
<ProgressCircle progress={0} weight="heavy" size={100} />
|
|
72
|
+
<ProgressCircle progress={0.5} weight="heavy" size={100} />
|
|
73
|
+
<ProgressCircle progress={1} weight="heavy" size={100} />
|
|
74
|
+
</HStack>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### No Text
|
|
78
|
+
|
|
79
|
+
```jsx live
|
|
80
|
+
<HStack gap={2}>
|
|
81
|
+
<ProgressCircle progress={0} hideContent size={25} />
|
|
82
|
+
<ProgressCircle progress={0.5} hideContent size={25} />
|
|
83
|
+
<ProgressCircle progress={1} hideContent size={25} />
|
|
84
|
+
</HStack>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Disabled
|
|
88
|
+
|
|
89
|
+
```jsx live
|
|
90
|
+
<HStack gap={2}>
|
|
91
|
+
<ProgressCircle progress={0} disabled size={100} />
|
|
92
|
+
<ProgressCircle progress={0.5} disabled size={100} />
|
|
93
|
+
<ProgressCircle progress={1} disabled size={100} />
|
|
94
|
+
</HStack>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Colors
|
|
98
|
+
|
|
99
|
+
```jsx live
|
|
100
|
+
<HStack gap={2}>
|
|
101
|
+
<ProgressCircle progress={0.5} color="bgPositive" size={100} />
|
|
102
|
+
<ProgressCircle progress={0.5} color="bgNegative" size={100} />
|
|
103
|
+
<ProgressCircle progress={0.5} color="bgPrimary" size={100} />
|
|
104
|
+
<ProgressCircle progress={0.5} color="fg" size={100} />
|
|
105
|
+
</HStack>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Fill Parent
|
|
109
|
+
|
|
110
|
+
The progress circle can be dynamically sized to fit its parent. If you drag the browser window smaller or larger then the ProgressCircle will resize accordingly.
|
|
111
|
+
|
|
112
|
+
```jsx live
|
|
113
|
+
<HStack gap={2} flexWrap="wrap">
|
|
114
|
+
<div style={{ height: '15vw', width: '15vw', minWidth: '60px', minHeight: '60px' }}>
|
|
115
|
+
<ProgressCircle progress={1} />
|
|
116
|
+
</div>
|
|
117
|
+
<div style={{ height: '10vw', width: '10vw', minWidth: '60px', minHeight: '60px' }}>
|
|
118
|
+
<ProgressCircle progress={1} />
|
|
119
|
+
</div>
|
|
120
|
+
<div style={{ height: '5vw', width: '5vw', minWidth: '60px', minHeight: '60px' }}>
|
|
121
|
+
<ProgressCircle progress={1} />
|
|
122
|
+
</div>
|
|
123
|
+
</HStack>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Content Node Customization
|
|
127
|
+
|
|
128
|
+
You can override the default content node to display a custom node. Note that the content node is clipped to the circle.
|
|
129
|
+
|
|
130
|
+
#### With Asset
|
|
131
|
+
|
|
132
|
+
You can provide an image, such as an asset, as the content node.
|
|
133
|
+
|
|
134
|
+
```jsx live
|
|
135
|
+
<VStack gap={2}>
|
|
136
|
+
<HStack gap={2}>
|
|
137
|
+
<ProgressCircle
|
|
138
|
+
progress={1}
|
|
139
|
+
size={56}
|
|
140
|
+
styles={{
|
|
141
|
+
progress: {
|
|
142
|
+
stroke: assets.eth.color,
|
|
143
|
+
},
|
|
144
|
+
}}
|
|
145
|
+
contentNode={
|
|
146
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
147
|
+
<RemoteImage
|
|
148
|
+
alt={assets.eth.name}
|
|
149
|
+
shape="circle"
|
|
150
|
+
source={assets.eth.imageUrl}
|
|
151
|
+
style={{ width: '100%', height: '100%' }}
|
|
152
|
+
/>
|
|
153
|
+
</Box>
|
|
154
|
+
}
|
|
155
|
+
weight="thin"
|
|
156
|
+
/>
|
|
157
|
+
|
|
158
|
+
<ProgressCircle
|
|
159
|
+
progress={0.75}
|
|
160
|
+
size={56}
|
|
161
|
+
styles={{
|
|
162
|
+
progress: {
|
|
163
|
+
stroke: assets.ltc.color,
|
|
164
|
+
},
|
|
165
|
+
}}
|
|
166
|
+
contentNode={
|
|
167
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
168
|
+
<RemoteImage
|
|
169
|
+
alt={assets.ltc.name}
|
|
170
|
+
shape="circle"
|
|
171
|
+
source={assets.ltc.imageUrl}
|
|
172
|
+
style={{ width: '100%', height: '100%' }}
|
|
173
|
+
/>
|
|
174
|
+
</Box>
|
|
175
|
+
}
|
|
176
|
+
weight="thin"
|
|
177
|
+
/>
|
|
178
|
+
<ProgressCircle
|
|
179
|
+
progress={0.5}
|
|
180
|
+
size={56}
|
|
181
|
+
styles={{
|
|
182
|
+
progress: {
|
|
183
|
+
stroke: assets.dai.color,
|
|
184
|
+
},
|
|
185
|
+
}}
|
|
186
|
+
contentNode={
|
|
187
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
188
|
+
<RemoteImage
|
|
189
|
+
shape="circle"
|
|
190
|
+
source={assets.dai.imageUrl}
|
|
191
|
+
style={{ width: '100%', height: '100%' }}
|
|
192
|
+
/>
|
|
193
|
+
</Box>
|
|
194
|
+
}
|
|
195
|
+
weight="thin"
|
|
196
|
+
/>
|
|
197
|
+
<ProgressCircle
|
|
198
|
+
progress={0.25}
|
|
199
|
+
size={56}
|
|
200
|
+
styles={{
|
|
201
|
+
progress: {
|
|
202
|
+
stroke: assets.sushi.color,
|
|
203
|
+
},
|
|
204
|
+
}}
|
|
205
|
+
contentNode={
|
|
206
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
207
|
+
<RemoteImage
|
|
208
|
+
alt={assets.sushi.name}
|
|
209
|
+
shape="circle"
|
|
210
|
+
source={assets.sushi.imageUrl}
|
|
211
|
+
style={{ width: '100%', height: '100%' }}
|
|
212
|
+
/>
|
|
213
|
+
</Box>
|
|
214
|
+
}
|
|
215
|
+
weight="thin"
|
|
216
|
+
/>
|
|
217
|
+
<ProgressCircle
|
|
218
|
+
progress={0}
|
|
219
|
+
size={56}
|
|
220
|
+
styles={{
|
|
221
|
+
progress: {
|
|
222
|
+
stroke: assets.xrp.color,
|
|
223
|
+
},
|
|
224
|
+
}}
|
|
225
|
+
contentNode={
|
|
226
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
227
|
+
<RemoteImage
|
|
228
|
+
alt={assets.xrp.name}
|
|
229
|
+
shape="circle"
|
|
230
|
+
source={assets.xrp.imageUrl}
|
|
231
|
+
style={{ width: '100%', height: '100%' }}
|
|
232
|
+
/>
|
|
233
|
+
</Box>
|
|
234
|
+
}
|
|
235
|
+
weight="thin"
|
|
236
|
+
/>
|
|
237
|
+
</HStack>
|
|
238
|
+
<HStack gap={2}>
|
|
239
|
+
<ProgressCircle
|
|
240
|
+
styles={{
|
|
241
|
+
progress: {
|
|
242
|
+
stroke: assets.btc.color,
|
|
243
|
+
},
|
|
244
|
+
}}
|
|
245
|
+
progress={0.24}
|
|
246
|
+
size={24}
|
|
247
|
+
contentNode={
|
|
248
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
249
|
+
<RemoteImage
|
|
250
|
+
alt={assets.btc.name}
|
|
251
|
+
shape="circle"
|
|
252
|
+
source={assets.btc.imageUrl}
|
|
253
|
+
style={{ width: '100%', height: '100%' }}
|
|
254
|
+
/>
|
|
255
|
+
</Box>
|
|
256
|
+
}
|
|
257
|
+
weight="thin"
|
|
258
|
+
/>
|
|
259
|
+
<ProgressCircle
|
|
260
|
+
styles={{
|
|
261
|
+
progress: {
|
|
262
|
+
stroke: assets.btc.color,
|
|
263
|
+
},
|
|
264
|
+
}}
|
|
265
|
+
progress={0.24}
|
|
266
|
+
size={32}
|
|
267
|
+
contentNode={
|
|
268
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
269
|
+
<RemoteImage
|
|
270
|
+
alt={assets.btc.name}
|
|
271
|
+
shape="circle"
|
|
272
|
+
source={assets.btc.imageUrl}
|
|
273
|
+
style={{ width: '100%', height: '100%' }}
|
|
274
|
+
/>
|
|
275
|
+
</Box>
|
|
276
|
+
}
|
|
277
|
+
weight="thin"
|
|
278
|
+
/>
|
|
279
|
+
<ProgressCircle
|
|
280
|
+
styles={{
|
|
281
|
+
progress: {
|
|
282
|
+
stroke: assets.btc.color,
|
|
283
|
+
},
|
|
284
|
+
}}
|
|
285
|
+
progress={0.24}
|
|
286
|
+
size={40}
|
|
287
|
+
contentNode={
|
|
288
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
289
|
+
<RemoteImage
|
|
290
|
+
alt={assets.btc.name}
|
|
291
|
+
shape="circle"
|
|
292
|
+
source={assets.btc.imageUrl}
|
|
293
|
+
style={{ width: '100%', height: '100%' }}
|
|
294
|
+
/>
|
|
295
|
+
</Box>
|
|
296
|
+
}
|
|
297
|
+
weight="thin"
|
|
298
|
+
/>
|
|
299
|
+
<ProgressCircle
|
|
300
|
+
styles={{
|
|
301
|
+
progress: {
|
|
302
|
+
stroke: assets.btc.color,
|
|
303
|
+
},
|
|
304
|
+
}}
|
|
305
|
+
progress={0.24}
|
|
306
|
+
size={48}
|
|
307
|
+
contentNode={
|
|
308
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
309
|
+
<RemoteImage
|
|
310
|
+
alt={assets.btc.name}
|
|
311
|
+
shape="circle"
|
|
312
|
+
source={assets.btc.imageUrl}
|
|
313
|
+
style={{ width: '100%', height: '100%' }}
|
|
314
|
+
/>
|
|
315
|
+
</Box>
|
|
316
|
+
}
|
|
317
|
+
weight="thin"
|
|
318
|
+
/>
|
|
319
|
+
<ProgressCircle
|
|
320
|
+
styles={{
|
|
321
|
+
progress: {
|
|
322
|
+
stroke: assets.btc.color,
|
|
323
|
+
},
|
|
324
|
+
}}
|
|
325
|
+
progress={0.24}
|
|
326
|
+
size={56}
|
|
327
|
+
contentNode={
|
|
328
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
329
|
+
<RemoteImage
|
|
330
|
+
alt={assets.btc.name}
|
|
331
|
+
shape="circle"
|
|
332
|
+
source={assets.btc.imageUrl}
|
|
333
|
+
style={{ width: '100%', height: '100%' }}
|
|
334
|
+
/>
|
|
335
|
+
</Box>
|
|
336
|
+
}
|
|
337
|
+
weight="thin"
|
|
338
|
+
/>
|
|
339
|
+
</HStack>
|
|
340
|
+
</VStack>
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
#### Custom Text Color
|
|
344
|
+
|
|
345
|
+
The progress circle's default content can be customized to display a custom text color.
|
|
346
|
+
|
|
347
|
+
```jsx live
|
|
348
|
+
<HStack gap={2}>
|
|
349
|
+
<ProgressCircle
|
|
350
|
+
color="fgPrimary"
|
|
351
|
+
progress={0.2}
|
|
352
|
+
size={100}
|
|
353
|
+
contentNode={<DefaultProgressCircleContent color="fgPrimary" progress={0.2} />}
|
|
354
|
+
/>
|
|
355
|
+
<ProgressCircle
|
|
356
|
+
color="fgPositive"
|
|
357
|
+
progress={0.4}
|
|
358
|
+
size={100}
|
|
359
|
+
contentNode={<DefaultProgressCircleContent color="fgPositive" progress={0.4} />}
|
|
360
|
+
/>
|
|
361
|
+
</HStack>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Custom Styles
|
|
365
|
+
|
|
366
|
+
The progress circle can be customized with styles and class names.
|
|
367
|
+
|
|
368
|
+
```jsx live
|
|
369
|
+
<HStack gap={2}>
|
|
370
|
+
<ProgressCircle
|
|
371
|
+
progress={0.4}
|
|
372
|
+
size={100}
|
|
373
|
+
styles={{
|
|
374
|
+
circle: {
|
|
375
|
+
stroke: 'transparent',
|
|
376
|
+
},
|
|
377
|
+
}}
|
|
378
|
+
contentNode={<TextTitle1 color="fgPrimary">40%</TextTitle1>}
|
|
379
|
+
weight="semiheavy"
|
|
380
|
+
/>
|
|
381
|
+
<ProgressCircle
|
|
382
|
+
color="fgPositive"
|
|
383
|
+
progress={0.6}
|
|
384
|
+
size={100}
|
|
385
|
+
styles={{
|
|
386
|
+
progress: {
|
|
387
|
+
strokeLinecap: 'square',
|
|
388
|
+
},
|
|
389
|
+
}}
|
|
390
|
+
contentNode={<Icon color="fgPositive" name="circleCheckmark" size="l" />}
|
|
391
|
+
/>
|
|
392
|
+
</HStack>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Interactive Demo
|
|
396
|
+
|
|
397
|
+
This is for demo purposes. ProgressContainerWithButtons isn't designed for production usage.
|
|
398
|
+
|
|
399
|
+
```jsx live
|
|
400
|
+
<ProgressContainerWithButtons>
|
|
401
|
+
{({ calculateProgress }) => (
|
|
402
|
+
<HStack gap={2}>
|
|
403
|
+
<ProgressCircle progress={calculateProgress(0)} size={100} />
|
|
404
|
+
<ProgressCircle progress={calculateProgress(0.2)} size={100} />
|
|
405
|
+
</HStack>
|
|
406
|
+
)}
|
|
407
|
+
</ProgressContainerWithButtons>
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Animation Callbacks
|
|
411
|
+
|
|
412
|
+
You can use the `onAnimationStart` and `onAnimationEnd` callbacks to track the progress of the animation.
|
|
413
|
+
|
|
414
|
+
```jsx live
|
|
415
|
+
function Example() {
|
|
416
|
+
const [animationStatus, setAnimationStatus] = React.useState('Ready');
|
|
417
|
+
|
|
418
|
+
const handleAnimationStart = useCallback(() => {
|
|
419
|
+
setAnimationStatus('Animating...');
|
|
420
|
+
}, []);
|
|
421
|
+
|
|
422
|
+
const handleAnimationEnd = useCallback(() => {
|
|
423
|
+
setAnimationStatus('Animation Ended');
|
|
424
|
+
}, []);
|
|
425
|
+
|
|
426
|
+
return (
|
|
427
|
+
<ProgressContainerWithButtons>
|
|
428
|
+
{({ calculateProgress }) => (
|
|
429
|
+
<VStack gap={2}>
|
|
430
|
+
<Text>Animation Status: {animationStatus}</Text>
|
|
431
|
+
<ProgressCircle
|
|
432
|
+
onAnimationEnd={handleAnimationEnd}
|
|
433
|
+
onAnimationStart={handleAnimationStart}
|
|
434
|
+
progress={calculateProgress(0.2)}
|
|
435
|
+
size={100}
|
|
436
|
+
/>
|
|
437
|
+
</VStack>
|
|
438
|
+
)}
|
|
439
|
+
</ProgressContainerWithButtons>
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
|