@coinbase/cds-mcp-server 8.17.2 → 8.17.4
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 +8 -0
- package/mcp-docs/mobile/components/Accordion.txt +188 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +29 -0
- package/mcp-docs/mobile/components/Alert.txt +155 -0
- package/mcp-docs/mobile/components/AreaChart.txt +265 -0
- package/mcp-docs/mobile/components/Avatar.txt +195 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +225 -0
- package/mcp-docs/mobile/components/Banner.txt +221 -0
- package/mcp-docs/mobile/components/BarChart.txt +815 -0
- package/mcp-docs/mobile/components/Box.txt +173 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +146 -0
- package/mcp-docs/mobile/components/Button.txt +198 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +79 -0
- package/mcp-docs/mobile/components/Carousel.txt +1083 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +825 -0
- package/mcp-docs/mobile/components/CellMedia.txt +70 -0
- package/mcp-docs/mobile/components/Checkbox.txt +245 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +201 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +284 -0
- package/mcp-docs/mobile/components/Chip.txt +194 -0
- package/mcp-docs/mobile/components/Coachmark.txt +157 -0
- package/mcp-docs/mobile/components/Collapsible.txt +104 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +134 -0
- package/mcp-docs/mobile/components/ContentCard.txt +365 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +135 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +127 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +145 -0
- package/mcp-docs/mobile/components/ContentCell.txt +226 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +443 -0
- package/mcp-docs/mobile/components/DatePicker.txt +496 -0
- package/mcp-docs/mobile/components/Divider.txt +138 -0
- package/mcp-docs/mobile/components/DotCount.txt +145 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +58 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +134 -0
- package/mcp-docs/mobile/components/Fallback.txt +157 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +155 -0
- package/mcp-docs/mobile/components/HStack.txt +234 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +47 -0
- package/mcp-docs/mobile/components/Icon.txt +51 -0
- package/mcp-docs/mobile/components/IconButton.txt +268 -0
- package/mcp-docs/mobile/components/InputChip.txt +187 -0
- package/mcp-docs/mobile/components/Interactable.txt +186 -0
- package/mcp-docs/mobile/components/LineChart.txt +1324 -0
- package/mcp-docs/mobile/components/Link.txt +291 -0
- package/mcp-docs/mobile/components/ListCell.txt +412 -0
- package/mcp-docs/mobile/components/LogoMark.txt +84 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +93 -0
- package/mcp-docs/mobile/components/Lottie.txt +138 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +46 -0
- package/mcp-docs/mobile/components/Modal.txt +83 -0
- package/mcp-docs/mobile/components/ModalBody.txt +33 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +24 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +27 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +379 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +131 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +141 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +89 -0
- package/mcp-docs/mobile/components/Numpad.txt +340 -0
- package/mcp-docs/mobile/components/Overlay.txt +151 -0
- package/mcp-docs/mobile/components/PageFooter.txt +160 -0
- package/mcp-docs/mobile/components/PageHeader.txt +185 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +407 -0
- package/mcp-docs/mobile/components/Pictogram.txt +47 -0
- package/mcp-docs/mobile/components/Point.txt +204 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +78 -0
- package/mcp-docs/mobile/components/Pressable.txt +210 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +129 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +160 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +137 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +236 -0
- package/mcp-docs/mobile/components/Radio.txt +241 -0
- package/mcp-docs/mobile/components/RadioCell.txt +201 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +281 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +152 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +105 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +60 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +788 -0
- package/mcp-docs/mobile/components/Scrubber.txt +203 -0
- package/mcp-docs/mobile/components/SearchInput.txt +191 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +204 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +315 -0
- package/mcp-docs/mobile/components/Select.txt +211 -0
- package/mcp-docs/mobile/components/SelectChip.txt +323 -0
- package/mcp-docs/mobile/components/SelectOption.txt +84 -0
- package/mcp-docs/mobile/components/SlideButton.txt +330 -0
- package/mcp-docs/mobile/components/Spacer.txt +83 -0
- package/mcp-docs/mobile/components/Sparkline.txt +122 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +106 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +156 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +72 -0
- package/mcp-docs/mobile/components/Spinner.txt +48 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +47 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +47 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +47 -0
- package/mcp-docs/mobile/components/Stepper.txt +527 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/mobile/components/Switch.txt +97 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +48 -0
- package/mcp-docs/mobile/components/TabLabel.txt +153 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +146 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +142 -0
- package/mcp-docs/mobile/components/Tabs.txt +190 -0
- package/mcp-docs/mobile/components/Tag.txt +300 -0
- package/mcp-docs/mobile/components/Text.txt +211 -0
- package/mcp-docs/mobile/components/TextInput.txt +717 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +132 -0
- package/mcp-docs/mobile/components/Toast.txt +196 -0
- package/mcp-docs/mobile/components/Tooltip.txt +59 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +161 -0
- package/mcp-docs/mobile/components/Tour.txt +158 -0
- package/mcp-docs/mobile/components/Tray.txt +252 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +321 -0
- package/mcp-docs/mobile/components/VStack.txt +222 -0
- package/mcp-docs/mobile/components/XAxis.txt +621 -0
- package/mcp-docs/mobile/components/YAxis.txt +567 -0
- package/mcp-docs/mobile/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/mobile/getting-started/installation.txt +57 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +102 -0
- package/mcp-docs/mobile/getting-started/playground.txt +28 -0
- package/mcp-docs/mobile/getting-started/styling.txt +84 -0
- package/mcp-docs/mobile/getting-started/theming.txt +286 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +72 -0
- package/mcp-docs/mobile/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/mobile/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +280 -0
- package/mcp-docs/mobile/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/mobile/hooks/useRefMap.txt +178 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +321 -0
- package/mcp-docs/mobile/routes.txt +139 -0
- package/mcp-docs/web/components/Accordion.txt +189 -0
- package/mcp-docs/web/components/AccordionItem.txt +31 -0
- package/mcp-docs/web/components/Alert.txt +164 -0
- package/mcp-docs/web/components/AreaChart.txt +510 -0
- package/mcp-docs/web/components/Avatar.txt +211 -0
- package/mcp-docs/web/components/AvatarButton.txt +240 -0
- package/mcp-docs/web/components/Banner.txt +226 -0
- package/mcp-docs/web/components/BarChart.txt +1267 -0
- package/mcp-docs/web/components/Box.txt +175 -0
- package/mcp-docs/web/components/Button.txt +212 -0
- package/mcp-docs/web/components/ButtonGroup.txt +79 -0
- package/mcp-docs/web/components/Calendar.txt +181 -0
- package/mcp-docs/web/components/Carousel.txt +1575 -0
- package/mcp-docs/web/components/CartesianChart.txt +1044 -0
- package/mcp-docs/web/components/CellMedia.txt +56 -0
- package/mcp-docs/web/components/Checkbox.txt +188 -0
- package/mcp-docs/web/components/CheckboxCell.txt +202 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +219 -0
- package/mcp-docs/web/components/Chip.txt +196 -0
- package/mcp-docs/web/components/Coachmark.txt +188 -0
- package/mcp-docs/web/components/Collapsible.txt +119 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +232 -0
- package/mcp-docs/web/components/ContentCard.txt +367 -0
- package/mcp-docs/web/components/ContentCardBody.txt +137 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +129 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +147 -0
- package/mcp-docs/web/components/ContentCell.txt +219 -0
- package/mcp-docs/web/components/ControlGroup.txt +436 -0
- package/mcp-docs/web/components/DatePicker.txt +505 -0
- package/mcp-docs/web/components/Divider.txt +143 -0
- package/mcp-docs/web/components/DotCount.txt +149 -0
- package/mcp-docs/web/components/DotStatusColor.txt +58 -0
- package/mcp-docs/web/components/DotSymbol.txt +137 -0
- package/mcp-docs/web/components/Dropdown.txt +119 -0
- package/mcp-docs/web/components/Fallback.txt +163 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +250 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +69 -0
- package/mcp-docs/web/components/FullscreenModal.txt +145 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +187 -0
- package/mcp-docs/web/components/Grid.txt +236 -0
- package/mcp-docs/web/components/GridColumn.txt +209 -0
- package/mcp-docs/web/components/HStack.txt +236 -0
- package/mcp-docs/web/components/HeroSquare.txt +48 -0
- package/mcp-docs/web/components/Icon.txt +145 -0
- package/mcp-docs/web/components/IconButton.txt +390 -0
- package/mcp-docs/web/components/InputChip.txt +187 -0
- package/mcp-docs/web/components/Interactable.txt +193 -0
- package/mcp-docs/web/components/LineChart.txt +1576 -0
- package/mcp-docs/web/components/Link.txt +243 -0
- package/mcp-docs/web/components/ListCell.txt +418 -0
- package/mcp-docs/web/components/LogoMark.txt +84 -0
- package/mcp-docs/web/components/LogoWordMark.txt +93 -0
- package/mcp-docs/web/components/Lottie.txt +157 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +57 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +108 -0
- package/mcp-docs/web/components/Modal.txt +196 -0
- package/mcp-docs/web/components/ModalBody.txt +117 -0
- package/mcp-docs/web/components/ModalFooter.txt +119 -0
- package/mcp-docs/web/components/ModalHeader.txt +123 -0
- package/mcp-docs/web/components/MultiContentModule.txt +381 -0
- package/mcp-docs/web/components/NavigationBar.txt +102 -0
- package/mcp-docs/web/components/NavigationTitle.txt +25 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +45 -0
- package/mcp-docs/web/components/NudgeCard.txt +181 -0
- package/mcp-docs/web/components/Overlay.txt +171 -0
- package/mcp-docs/web/components/PageFooter.txt +184 -0
- package/mcp-docs/web/components/PageHeader.txt +243 -0
- package/mcp-docs/web/components/Pagination.txt +499 -0
- package/mcp-docs/web/components/PeriodSelector.txt +703 -0
- package/mcp-docs/web/components/Pictogram.txt +48 -0
- package/mcp-docs/web/components/Point.txt +460 -0
- package/mcp-docs/web/components/PortalProvider.txt +76 -0
- package/mcp-docs/web/components/Pressable.txt +193 -0
- package/mcp-docs/web/components/ProgressBar.txt +163 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +212 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +181 -0
- package/mcp-docs/web/components/ProgressCircle.txt +443 -0
- package/mcp-docs/web/components/Radio.txt +219 -0
- package/mcp-docs/web/components/RadioCell.txt +215 -0
- package/mcp-docs/web/components/RadioGroup.txt +288 -0
- package/mcp-docs/web/components/ReferenceLine.txt +451 -0
- package/mcp-docs/web/components/RemoteImage.txt +165 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +86 -0
- package/mcp-docs/web/components/RollingNumber.txt +1021 -0
- package/mcp-docs/web/components/Scrubber.txt +231 -0
- package/mcp-docs/web/components/SearchInput.txt +117 -0
- package/mcp-docs/web/components/SectionHeader.txt +217 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +324 -0
- package/mcp-docs/web/components/Select.txt +224 -0
- package/mcp-docs/web/components/SelectChip.txt +314 -0
- package/mcp-docs/web/components/SelectOption.txt +165 -0
- package/mcp-docs/web/components/Sidebar.txt +349 -0
- package/mcp-docs/web/components/SidebarItem.txt +131 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +30 -0
- package/mcp-docs/web/components/Spacer.txt +173 -0
- package/mcp-docs/web/components/Sparkline.txt +122 -0
- package/mcp-docs/web/components/SparklineGradient.txt +106 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +153 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +76 -0
- package/mcp-docs/web/components/Spinner.txt +128 -0
- package/mcp-docs/web/components/SpotIcon.txt +48 -0
- package/mcp-docs/web/components/SpotRectangle.txt +48 -0
- package/mcp-docs/web/components/SpotSquare.txt +48 -0
- package/mcp-docs/web/components/Stepper.txt +682 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +125 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +125 -0
- package/mcp-docs/web/components/Switch.txt +85 -0
- package/mcp-docs/web/components/TabIndicator.txt +48 -0
- package/mcp-docs/web/components/TabLabel.txt +158 -0
- package/mcp-docs/web/components/TabNavigation.txt +159 -0
- package/mcp-docs/web/components/TabbedChips.txt +155 -0
- package/mcp-docs/web/components/Table.txt +367 -0
- package/mcp-docs/web/components/TableBody.txt +83 -0
- package/mcp-docs/web/components/TableCaption.txt +102 -0
- package/mcp-docs/web/components/TableCell.txt +165 -0
- package/mcp-docs/web/components/TableCellFallback.txt +97 -0
- package/mcp-docs/web/components/TableFooter.txt +83 -0
- package/mcp-docs/web/components/TableHeader.txt +100 -0
- package/mcp-docs/web/components/TableRow.txt +140 -0
- package/mcp-docs/web/components/Tabs.txt +212 -0
- package/mcp-docs/web/components/Tag.txt +304 -0
- package/mcp-docs/web/components/Text.txt +232 -0
- package/mcp-docs/web/components/TextInput.txt +652 -0
- package/mcp-docs/web/components/ThemeProvider.txt +199 -0
- package/mcp-docs/web/components/TileButton.txt +158 -0
- package/mcp-docs/web/components/Toast.txt +203 -0
- package/mcp-docs/web/components/Tooltip.txt +89 -0
- package/mcp-docs/web/components/Tour.txt +179 -0
- package/mcp-docs/web/components/Tray.txt +288 -0
- package/mcp-docs/web/components/UpsellCard.txt +319 -0
- package/mcp-docs/web/components/VStack.txt +224 -0
- package/mcp-docs/web/components/XAxis.txt +619 -0
- package/mcp-docs/web/components/YAxis.txt +548 -0
- package/mcp-docs/web/getting-started/ai-overview.txt +108 -0
- package/mcp-docs/web/getting-started/installation.txt +103 -0
- package/mcp-docs/web/getting-started/introduction.txt +102 -0
- package/mcp-docs/web/getting-started/playground.txt +28 -0
- package/mcp-docs/web/getting-started/styling.txt +161 -0
- package/mcp-docs/web/getting-started/templates.txt +121 -0
- package/mcp-docs/web/getting-started/theming.txt +426 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +61 -0
- package/mcp-docs/web/hooks/useDimensions.txt +114 -0
- package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +75 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +58 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +114 -0
- package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +279 -0
- package/mcp-docs/web/hooks/usePreviousValue.txt +74 -0
- package/mcp-docs/web/hooks/useRefMap.txt +178 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +82 -0
- package/mcp-docs/web/hooks/useTheme.txt +364 -0
- package/mcp-docs/web/routes.txt +163 -0
- package/package.json +1 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# ProgressBarWithFloatLabel
|
|
2
|
+
|
|
3
|
+
A ProgressBar with a floating label that moves with progress.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { ProgressBarWithFloatLabel } from '@coinbase/cds-mobile/visualizations/ProgressBarWithFloatLabel'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Label Above
|
|
14
|
+
|
|
15
|
+
```jsx live
|
|
16
|
+
<VStack gap={2}>
|
|
17
|
+
<ProgressBarWithFloatLabel label={0} progress={0} labelPlacement="above">
|
|
18
|
+
<ProgressBar progress={0} />
|
|
19
|
+
</ProgressBarWithFloatLabel>
|
|
20
|
+
<ProgressBarWithFloatLabel label={20} progress={0.2} labelPlacement="above">
|
|
21
|
+
<ProgressBar progress={0.2} />
|
|
22
|
+
</ProgressBarWithFloatLabel>
|
|
23
|
+
</VStack>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Label Below
|
|
27
|
+
|
|
28
|
+
```jsx live
|
|
29
|
+
<VStack gap={2}>
|
|
30
|
+
<ProgressBarWithFloatLabel label={0} progress={0} labelPlacement="below">
|
|
31
|
+
<ProgressBar progress={0} />
|
|
32
|
+
</ProgressBarWithFloatLabel>
|
|
33
|
+
<ProgressBarWithFloatLabel label={20} progress={0.2} labelPlacement="below">
|
|
34
|
+
<ProgressBar progress={0.2} />
|
|
35
|
+
</ProgressBarWithFloatLabel>
|
|
36
|
+
</VStack>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Disabled
|
|
40
|
+
|
|
41
|
+
```jsx live
|
|
42
|
+
<VStack gap={2}>
|
|
43
|
+
<ProgressBarWithFloatLabel label={70} progress={0.7} disabled>
|
|
44
|
+
<ProgressBar progress={0.7} disabled />
|
|
45
|
+
</ProgressBarWithFloatLabel>
|
|
46
|
+
</VStack>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Custom Labels
|
|
50
|
+
|
|
51
|
+
```jsx live
|
|
52
|
+
function Example() {
|
|
53
|
+
const renderLabelNumStr = useCallback((num) => {
|
|
54
|
+
return `$${num.toLocaleString()}`;
|
|
55
|
+
}, []);
|
|
56
|
+
|
|
57
|
+
const renderLabelNum = useCallback((num, disabled) => {
|
|
58
|
+
return (
|
|
59
|
+
<TextTitle3 as="span" disabled={disabled}>
|
|
60
|
+
${num.toLocaleString()}
|
|
61
|
+
</TextTitle3>
|
|
62
|
+
);
|
|
63
|
+
}, []);
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<VStack gap={2}>
|
|
67
|
+
<ProgressBarWithFloatLabel
|
|
68
|
+
progress={0.6}
|
|
69
|
+
label={{ value: 12500, render: renderLabelNumStr }}
|
|
70
|
+
labelPlacement="above"
|
|
71
|
+
>
|
|
72
|
+
<ProgressBar progress={0.6} />
|
|
73
|
+
</ProgressBarWithFloatLabel>
|
|
74
|
+
<ProgressBarWithFloatLabel
|
|
75
|
+
progress={0.6}
|
|
76
|
+
label={{ value: 12500, render: renderLabelNum }}
|
|
77
|
+
labelPlacement="above"
|
|
78
|
+
>
|
|
79
|
+
<ProgressBar progress={0.6} />
|
|
80
|
+
</ProgressBarWithFloatLabel>
|
|
81
|
+
<ProgressBarWithFloatLabel
|
|
82
|
+
progress={0.6}
|
|
83
|
+
label={{ value: 12500, render: renderLabelNumStr }}
|
|
84
|
+
labelPlacement="above"
|
|
85
|
+
disabled
|
|
86
|
+
>
|
|
87
|
+
<ProgressBar disabled progress={0.6} />
|
|
88
|
+
</ProgressBarWithFloatLabel>
|
|
89
|
+
<ProgressBarWithFloatLabel
|
|
90
|
+
progress={0.6}
|
|
91
|
+
label={{ value: 12500, render: renderLabelNum }}
|
|
92
|
+
labelPlacement="above"
|
|
93
|
+
disabled
|
|
94
|
+
>
|
|
95
|
+
<ProgressBar disabled progress={0.6} />
|
|
96
|
+
</ProgressBarWithFloatLabel>
|
|
97
|
+
</VStack>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Custom Styles
|
|
103
|
+
|
|
104
|
+
You can customize the appearance of the progress bar and float label using the `styles` prop.
|
|
105
|
+
|
|
106
|
+
```tsx live
|
|
107
|
+
<ProgressContainerWithButtons>
|
|
108
|
+
{({ calculateProgress }) => (
|
|
109
|
+
<VStack gap={2}>
|
|
110
|
+
<ProgressBarWithFloatLabel
|
|
111
|
+
label={Math.round(calculateProgress(0.4) * 100)}
|
|
112
|
+
labelPlacement="above"
|
|
113
|
+
progress={calculateProgress(0.4)}
|
|
114
|
+
styles={{
|
|
115
|
+
label: { color: 'blue' },
|
|
116
|
+
}}
|
|
117
|
+
>
|
|
118
|
+
<ProgressBar progress={calculateProgress(0.4)} />
|
|
119
|
+
</ProgressBarWithFloatLabel>
|
|
120
|
+
</VStack>
|
|
121
|
+
)}
|
|
122
|
+
</ProgressContainerWithButtons>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Props
|
|
126
|
+
|
|
127
|
+
| Prop | Type | Required | Default | Description |
|
|
128
|
+
| --- | --- | --- | --- | --- |
|
|
129
|
+
| `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. |
|
|
130
|
+
| `progress` | `number` | Yes | `-` | Number between 0-1 representing the progress percentage |
|
|
131
|
+
| `disabled` | `boolean` | No | `false` | Toggle used to show a disabled progress visualization |
|
|
132
|
+
| `labelPlacement` | `above \| below` | No | `above` | Position of label relative to the bar |
|
|
133
|
+
| `style` | `null \| false \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>>` | No | `-` | Custom styles for the progress bar with float label root. |
|
|
134
|
+
| `styles` | `{ root?: StyleProp<ViewStyle>; labelContainer?: StyleProp<ViewStyle>; label?: StyleProp<TextStyle>; }` | No | `-` | Custom styles for the progress bar with float label. |
|
|
135
|
+
| `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 |
|
|
136
|
+
|
|
137
|
+
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# ProgressCircle
|
|
2
|
+
|
|
3
|
+
A circular visual indicator of completion progress.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { ProgressCircle } from '@coinbase/cds-mobile/visualizations/ProgressCircle'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Default
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
<HStack gap={2}>
|
|
17
|
+
<ProgressCircle progress={0} size={100} />
|
|
18
|
+
<ProgressCircle progress={0.5} size={100} />
|
|
19
|
+
<ProgressCircle progress={1} size={100} />
|
|
20
|
+
</HStack>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Thin
|
|
24
|
+
|
|
25
|
+
```jsx
|
|
26
|
+
<HStack gap={2}>
|
|
27
|
+
<ProgressCircle progress={0} weight="thin" size={100} />
|
|
28
|
+
<ProgressCircle progress={0.5} weight="thin" size={100} />
|
|
29
|
+
<ProgressCircle progress={1} weight="thin" size={100} />
|
|
30
|
+
</HStack>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Semiheavy
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
<HStack gap={2}>
|
|
37
|
+
<ProgressCircle progress={0} weight="semiheavy" size={100} />
|
|
38
|
+
<ProgressCircle progress={0.5} weight="semiheavy" size={100} />
|
|
39
|
+
<ProgressCircle progress={1} weight="semiheavy" size={100} />
|
|
40
|
+
</HStack>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Heavy
|
|
44
|
+
|
|
45
|
+
```jsx
|
|
46
|
+
<HStack gap={2}>
|
|
47
|
+
<ProgressCircle progress={0} weight="heavy" size={100} />
|
|
48
|
+
<ProgressCircle progress={0.5} weight="heavy" size={100} />
|
|
49
|
+
<ProgressCircle progress={1} weight="heavy" size={100} />
|
|
50
|
+
</HStack>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### No Text
|
|
54
|
+
|
|
55
|
+
```jsx
|
|
56
|
+
<HStack gap={2}>
|
|
57
|
+
<ProgressCircle progress={0} hideContent size={25} />
|
|
58
|
+
<ProgressCircle progress={0.5} hideContent size={25} />
|
|
59
|
+
<ProgressCircle progress={1} hideContent size={25} />
|
|
60
|
+
</HStack>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Disabled
|
|
64
|
+
|
|
65
|
+
```jsx
|
|
66
|
+
<HStack gap={2}>
|
|
67
|
+
<ProgressCircle progress={0} disabled size={100} />
|
|
68
|
+
<ProgressCircle progress={0.5} disabled size={100} />
|
|
69
|
+
<ProgressCircle progress={1} disabled size={100} />
|
|
70
|
+
</HStack>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Colors
|
|
74
|
+
|
|
75
|
+
```jsx
|
|
76
|
+
<HStack gap={2}>
|
|
77
|
+
<ProgressCircle progress={0.5} color="fgPositive" size={100} />
|
|
78
|
+
<ProgressCircle progress={0.5} color="bgNegative" size={100} />
|
|
79
|
+
<ProgressCircle progress={0.5} color="bgPrimary" size={100} />
|
|
80
|
+
<ProgressCircle progress={0.5} color="fg" size={100} />
|
|
81
|
+
</HStack>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Fill Parent
|
|
85
|
+
|
|
86
|
+
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.
|
|
87
|
+
|
|
88
|
+
```jsx
|
|
89
|
+
<HStack gap={2} flexWrap="wrap">
|
|
90
|
+
<div style={{ height: '15vw', width: '15vw', minWidth: '60px', minHeight: '60px' }}>
|
|
91
|
+
<ProgressCircle progress={1} />
|
|
92
|
+
</div>
|
|
93
|
+
<div style={{ height: '10vw', width: '10vw', minWidth: '60px', minHeight: '60px' }}>
|
|
94
|
+
<ProgressCircle progress={1} />
|
|
95
|
+
</div>
|
|
96
|
+
<div style={{ height: '5vw', width: '5vw', minWidth: '60px', minHeight: '60px' }}>
|
|
97
|
+
<ProgressCircle progress={1} />
|
|
98
|
+
</div>
|
|
99
|
+
</HStack>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Content Node Customization
|
|
103
|
+
|
|
104
|
+
You can override the default content node to display a custom node. Note that the content node is clipped to the circle.
|
|
105
|
+
|
|
106
|
+
#### With Asset
|
|
107
|
+
|
|
108
|
+
You can provide an image, such as an asset, as the content node.
|
|
109
|
+
|
|
110
|
+
```jsx
|
|
111
|
+
<ProgressCircle
|
|
112
|
+
progress={1}
|
|
113
|
+
size={56}
|
|
114
|
+
styles={{
|
|
115
|
+
progress: {
|
|
116
|
+
stroke: assets.eth.color,
|
|
117
|
+
},
|
|
118
|
+
}}
|
|
119
|
+
contentNode={
|
|
120
|
+
<Box height="100%" padding={0.25} width="100%">
|
|
121
|
+
<RemoteImage
|
|
122
|
+
alt={assets.eth.name}
|
|
123
|
+
shape="circle"
|
|
124
|
+
source={assets.eth.imageUrl}
|
|
125
|
+
style={{ width: '100%', height: '100%' }}
|
|
126
|
+
/>
|
|
127
|
+
</Box>
|
|
128
|
+
}
|
|
129
|
+
weight="thin"
|
|
130
|
+
/>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Custom Text Color
|
|
134
|
+
|
|
135
|
+
The progress circle's default content can be customized to display a custom text color.
|
|
136
|
+
|
|
137
|
+
```jsx
|
|
138
|
+
<HStack gap={2}>
|
|
139
|
+
<ProgressCircle
|
|
140
|
+
color="fgPrimary"
|
|
141
|
+
progress={0.2}
|
|
142
|
+
size={100}
|
|
143
|
+
contentNode={<DefaultProgressCircleContent color="fgPrimary" progress={0.2} />}
|
|
144
|
+
/>
|
|
145
|
+
<ProgressCircle
|
|
146
|
+
color="fgPositive"
|
|
147
|
+
progress={0.4}
|
|
148
|
+
size={100}
|
|
149
|
+
contentNode={<DefaultProgressCircleContent color="fgPositive" progress={0.4} />}
|
|
150
|
+
/>
|
|
151
|
+
</HStack>
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Custom Styles
|
|
155
|
+
|
|
156
|
+
The progress circle can be customized with styles.
|
|
157
|
+
|
|
158
|
+
```jsx
|
|
159
|
+
<HStack gap={2}>
|
|
160
|
+
<ProgressCircle
|
|
161
|
+
progress={0.4}
|
|
162
|
+
size={100}
|
|
163
|
+
styles={{
|
|
164
|
+
circle: {
|
|
165
|
+
stroke: 'transparent',
|
|
166
|
+
},
|
|
167
|
+
}}
|
|
168
|
+
contentNode={<TextTitle1 color="fgPrimary">40%</TextTitle1>}
|
|
169
|
+
weight="semiheavy"
|
|
170
|
+
/>
|
|
171
|
+
<ProgressCircle
|
|
172
|
+
color="fgPositive"
|
|
173
|
+
progress={0.6}
|
|
174
|
+
size={100}
|
|
175
|
+
styles={{
|
|
176
|
+
progress: {
|
|
177
|
+
strokeLinecap: 'square',
|
|
178
|
+
},
|
|
179
|
+
}}
|
|
180
|
+
contentNode={<Icon color="fgPositive" name="circleCheckmark" size="l" />}
|
|
181
|
+
/>
|
|
182
|
+
</HStack>
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### Animation Callbacks
|
|
186
|
+
|
|
187
|
+
You can use the `onAnimationStart` and `onAnimationEnd` callbacks to track the progress of the animation.
|
|
188
|
+
|
|
189
|
+
```jsx
|
|
190
|
+
function Example() {
|
|
191
|
+
const [animationStatus, setAnimationStatus] = React.useState('Ready');
|
|
192
|
+
|
|
193
|
+
const handleAnimationStart = useCallback(() => {
|
|
194
|
+
setAnimationStatus('Animating...');
|
|
195
|
+
}, []);
|
|
196
|
+
|
|
197
|
+
const handleAnimationEnd = useCallback(() => {
|
|
198
|
+
setAnimationStatus('Animation Ended');
|
|
199
|
+
}, []);
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<VStack gap={2}>
|
|
203
|
+
<Text>Animation Status: {animationStatus}</Text>
|
|
204
|
+
<ProgressCircle
|
|
205
|
+
onAnimationEnd={handleAnimationEnd}
|
|
206
|
+
onAnimationStart={handleAnimationStart}
|
|
207
|
+
progress={calculateProgress(0.2)}
|
|
208
|
+
size={100}
|
|
209
|
+
/>
|
|
210
|
+
</VStack>
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Props
|
|
216
|
+
|
|
217
|
+
| Prop | Type | Required | Default | Description |
|
|
218
|
+
| --- | --- | --- | --- | --- |
|
|
219
|
+
| `progress` | `number` | Yes | `-` | Number between 0-1 representing the progress percentage |
|
|
220
|
+
| `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. |
|
|
221
|
+
| `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. |
|
|
222
|
+
| `disableAnimateOnMount` | `boolean` | No | `false` | Disable animation on component mount |
|
|
223
|
+
| `disabled` | `boolean` | No | `false` | Toggle used to show a disabled progress visualization |
|
|
224
|
+
| `hideContent` | `boolean` | No | `-` | Toggle used to hide the content node rendered inside the circle. |
|
|
225
|
+
| `hideText` | `boolean` | No | `-` | - |
|
|
226
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
227
|
+
| `onAnimationEnd` | `(() => void)` | No | `-` | Callback fired when the progress animation ends. |
|
|
228
|
+
| `onAnimationStart` | `(() => void)` | No | `-` | Callback fired when the progress animation starts. |
|
|
229
|
+
| `ref` | `((instance: View \| null) => void) \| RefObject<View> \| null` | No | `-` | - |
|
|
230
|
+
| `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 |
|
|
231
|
+
| `style` | `null \| false \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>>` | No | `-` | Custom styles for the progress circle root. |
|
|
232
|
+
| `styles` | `{ root?: StyleProp<ViewStyle>; svgContainer?: StyleProp<ViewStyle>; svg?: StyleProp<ViewStyle>; textContainer?: StyleProp<ViewStyle>; progress?: Partial<CircleProps>; circle?: Partial<CircleProps> \| undefined; } \| undefined` | No | `-` | Custom styles for the progress circle. |
|
|
233
|
+
| `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 |
|
|
234
|
+
| `weight` | `normal \| heavy \| thin \| semiheavy` | No | `normal` | Toggle used to change thickness of progress visualization |
|
|
235
|
+
|
|
236
|
+
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Radio
|
|
2
|
+
|
|
3
|
+
Radio is a control component that allows users to select one option from a set of mutually exclusive options.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Radio } from '@coinbase/cds-mobile/controls/Radio'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic Usage
|
|
14
|
+
|
|
15
|
+
Radio components are typically used individually as part of a radio group. Each radio represents a single option in a mutually exclusive set.
|
|
16
|
+
|
|
17
|
+
```jsx
|
|
18
|
+
function BasicRadio() {
|
|
19
|
+
const [selectedValue, setSelectedValue] = useState('option1');
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<VStack gap={2}>
|
|
23
|
+
<Radio
|
|
24
|
+
name="basic-radio"
|
|
25
|
+
value="option1"
|
|
26
|
+
checked={selectedValue === 'option1'}
|
|
27
|
+
onChange={(value) => setSelectedValue(value)}
|
|
28
|
+
>
|
|
29
|
+
Option 1
|
|
30
|
+
</Radio>
|
|
31
|
+
<Radio
|
|
32
|
+
name="basic-radio"
|
|
33
|
+
value="option2"
|
|
34
|
+
checked={selectedValue === 'option2'}
|
|
35
|
+
onChange={(value) => setSelectedValue(value)}
|
|
36
|
+
>
|
|
37
|
+
Option 2
|
|
38
|
+
</Radio>
|
|
39
|
+
<Radio
|
|
40
|
+
name="basic-radio"
|
|
41
|
+
value="option3"
|
|
42
|
+
checked={selectedValue === 'option3'}
|
|
43
|
+
onChange={(value) => setSelectedValue(value)}
|
|
44
|
+
>
|
|
45
|
+
Option 3
|
|
46
|
+
</Radio>
|
|
47
|
+
</VStack>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Radio Groups
|
|
53
|
+
|
|
54
|
+
The recommended way to use Radio components is with a ControlGroup for better accessibility and easier state management.
|
|
55
|
+
|
|
56
|
+
```jsx
|
|
57
|
+
function RadioGroupExample() {
|
|
58
|
+
const options = [
|
|
59
|
+
{ value: 'btc', children: 'Bitcoin' },
|
|
60
|
+
{ value: 'eth', children: 'Ethereum' },
|
|
61
|
+
{ value: 'ltc', children: 'Litecoin' },
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
const [selectedCurrency, setSelectedCurrency] = useState('btc');
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<ControlGroup
|
|
68
|
+
accessibilityRole="radiogroup"
|
|
69
|
+
ControlComponent={Radio}
|
|
70
|
+
label="Choose a cryptocurrency"
|
|
71
|
+
options={options}
|
|
72
|
+
value={selectedCurrency}
|
|
73
|
+
onChange={setSelectedCurrency}
|
|
74
|
+
name="currency-radio-group"
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Custom Colors
|
|
81
|
+
|
|
82
|
+
You can customize the radio's color using the `controlColor` prop.
|
|
83
|
+
|
|
84
|
+
```jsx
|
|
85
|
+
function CustomColorRadio() {
|
|
86
|
+
const [selectedColor, setSelectedColor] = useState('default');
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<VStack gap={2}>
|
|
90
|
+
<Radio
|
|
91
|
+
name="color-radio"
|
|
92
|
+
value="default"
|
|
93
|
+
checked={selectedColor === 'default'}
|
|
94
|
+
onChange={(value) => setSelectedColor(value)}
|
|
95
|
+
>
|
|
96
|
+
Default Color
|
|
97
|
+
</Radio>
|
|
98
|
+
<Radio
|
|
99
|
+
name="color-radio"
|
|
100
|
+
value="green"
|
|
101
|
+
checked={selectedColor === 'green'}
|
|
102
|
+
onChange={(value) => setSelectedColor(value)}
|
|
103
|
+
controlColor="accentBoldGreen"
|
|
104
|
+
>
|
|
105
|
+
Custom Green
|
|
106
|
+
</Radio>
|
|
107
|
+
<Radio
|
|
108
|
+
name="color-radio"
|
|
109
|
+
value="purple"
|
|
110
|
+
checked={selectedColor === 'purple'}
|
|
111
|
+
onChange={(value) => setSelectedColor(value)}
|
|
112
|
+
controlColor="accentBoldPurple"
|
|
113
|
+
>
|
|
114
|
+
Custom Purple
|
|
115
|
+
</Radio>
|
|
116
|
+
</VStack>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Disabled State
|
|
122
|
+
|
|
123
|
+
Radio components can be disabled to prevent user interaction.
|
|
124
|
+
|
|
125
|
+
```jsx
|
|
126
|
+
function DisabledRadio() {
|
|
127
|
+
const [selectedValue, setSelectedValue] = useState('enabled');
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<VStack gap={2}>
|
|
131
|
+
<Radio
|
|
132
|
+
name="disabled-radio"
|
|
133
|
+
value="enabled"
|
|
134
|
+
checked={selectedValue === 'enabled'}
|
|
135
|
+
onChange={(value) => setSelectedValue(value)}
|
|
136
|
+
>
|
|
137
|
+
Enabled Radio
|
|
138
|
+
</Radio>
|
|
139
|
+
<Radio
|
|
140
|
+
name="disabled-radio"
|
|
141
|
+
value="disabled-unchecked"
|
|
142
|
+
checked={false}
|
|
143
|
+
disabled
|
|
144
|
+
onChange={(value) => setSelectedValue(value)}
|
|
145
|
+
>
|
|
146
|
+
Disabled & Unchecked
|
|
147
|
+
</Radio>
|
|
148
|
+
<Radio
|
|
149
|
+
name="disabled-radio"
|
|
150
|
+
value="disabled-checked"
|
|
151
|
+
checked={true}
|
|
152
|
+
disabled
|
|
153
|
+
onChange={(value) => setSelectedValue(value)}
|
|
154
|
+
>
|
|
155
|
+
Disabled & Checked
|
|
156
|
+
</Radio>
|
|
157
|
+
</VStack>
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Accessibility
|
|
163
|
+
|
|
164
|
+
Radio components on mobile should always include proper accessibility labels and hints.
|
|
165
|
+
|
|
166
|
+
```jsx
|
|
167
|
+
function AccessibleRadio() {
|
|
168
|
+
const [selectedPayment, setSelectedPayment] = useState('credit');
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<VStack gap={2}>
|
|
172
|
+
<Radio
|
|
173
|
+
name="payment-radio"
|
|
174
|
+
value="credit"
|
|
175
|
+
checked={selectedPayment === 'credit'}
|
|
176
|
+
onChange={(value) => setSelectedPayment(value)}
|
|
177
|
+
accessibilityLabel="Credit Card"
|
|
178
|
+
accessibilityHint="Pay with credit card"
|
|
179
|
+
>
|
|
180
|
+
Credit Card
|
|
181
|
+
</Radio>
|
|
182
|
+
<Radio
|
|
183
|
+
name="payment-radio"
|
|
184
|
+
value="debit"
|
|
185
|
+
checked={selectedPayment === 'debit'}
|
|
186
|
+
onChange={(value) => setSelectedPayment(value)}
|
|
187
|
+
accessibilityLabel="Debit Card"
|
|
188
|
+
accessibilityHint="Pay with debit card"
|
|
189
|
+
>
|
|
190
|
+
Debit Card
|
|
191
|
+
</Radio>
|
|
192
|
+
<Radio
|
|
193
|
+
name="payment-radio"
|
|
194
|
+
value="crypto"
|
|
195
|
+
checked={selectedPayment === 'crypto'}
|
|
196
|
+
onChange={(value) => setSelectedPayment(value)}
|
|
197
|
+
accessibilityLabel="Cryptocurrency"
|
|
198
|
+
accessibilityHint="Pay with cryptocurrency"
|
|
199
|
+
>
|
|
200
|
+
Cryptocurrency
|
|
201
|
+
</Radio>
|
|
202
|
+
</VStack>
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Props
|
|
208
|
+
|
|
209
|
+
| Prop | Type | Required | Default | Description |
|
|
210
|
+
| --- | --- | --- | --- | --- |
|
|
211
|
+
| `background` | `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 | `bg` | Background color of the overlay (element being interacted with). |
|
|
212
|
+
| `borderColor` | `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 | `checked ? controlColor : 'bgLineHeavy'` | - |
|
|
213
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `1000` | - |
|
|
214
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
215
|
+
| `checked` | `boolean` | No | `-` | Set the control to selected/on. |
|
|
216
|
+
| `children` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Label for the control option. |
|
|
217
|
+
| `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 | `black` | - |
|
|
218
|
+
| `controlColor` | `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 | `bgPrimary` | Sets the checked/active color of the control. |
|
|
219
|
+
| `disabled` | `boolean` | No | `-` | Disable user interaction. |
|
|
220
|
+
| `indeterminate` | `boolean` | No | `-` | Enable indeterminate state. Useful when you want to indicate that sub-items of a control are partially filled. |
|
|
221
|
+
| `onChange` | `((value: T, checked?: boolean \| undefined) => void) \| undefined` | No | `-` | Toggle control selected state. |
|
|
222
|
+
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
223
|
+
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
224
|
+
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
225
|
+
| `onPointerDownCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
226
|
+
| `onPointerEnter` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
227
|
+
| `onPointerEnterCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
228
|
+
| `onPointerLeave` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
229
|
+
| `onPointerLeaveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
230
|
+
| `onPointerMove` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
231
|
+
| `onPointerMoveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
232
|
+
| `onPointerUp` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
233
|
+
| `onPointerUpCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
234
|
+
| `onPress` | `((event: GestureResponderEvent) => void) \| null` | No | `-` | Called when a single tap gesture is detected. |
|
|
235
|
+
| `readOnly` | `boolean` | No | `-` | Set the control to ready-only. Similar effect as disabled. |
|
|
236
|
+
| `ref` | `null \| (instance: View \| null) => void \| RefObject<View>` | No | `-` | - |
|
|
237
|
+
| `style` | `ViewStyle` | No | `-` | - |
|
|
238
|
+
| `testID` | `string` | No | `-` | Used to locate this view in end-to-end tests. |
|
|
239
|
+
| `value` | `string` | No | `-` | Value of the option. Useful for multiple choice. |
|
|
240
|
+
|
|
241
|
+
|