@coinbase/cds-mcp-server 8.17.3 → 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 +4 -0
- package/mcp-docs/mobile/components/Accordion.txt +11 -12
- package/mcp-docs/mobile/components/AccordionItem.txt +5 -6
- package/mcp-docs/mobile/components/Alert.txt +21 -22
- package/mcp-docs/mobile/components/AreaChart.txt +118 -119
- package/mcp-docs/mobile/components/Avatar.txt +82 -83
- package/mcp-docs/mobile/components/AvatarButton.txt +103 -104
- package/mcp-docs/mobile/components/Banner.txt +100 -101
- package/mcp-docs/mobile/components/BarChart.txt +120 -121
- package/mcp-docs/mobile/components/Box.txt +65 -66
- package/mcp-docs/mobile/components/BrowserBar.txt +38 -39
- package/mcp-docs/mobile/components/Button.txt +78 -79
- package/mcp-docs/mobile/components/ButtonGroup.txt +10 -11
- package/mcp-docs/mobile/components/Carousel.txt +103 -104
- package/mcp-docs/mobile/components/CartesianChart.txt +107 -108
- package/mcp-docs/mobile/components/CellMedia.txt +15 -16
- package/mcp-docs/mobile/components/Checkbox.txt +35 -36
- package/mcp-docs/mobile/components/CheckboxCell.txt +73 -74
- package/mcp-docs/mobile/components/CheckboxGroup.txt +24 -25
- package/mcp-docs/mobile/components/Chip.txt +67 -68
- package/mcp-docs/mobile/components/Coachmark.txt +42 -43
- package/mcp-docs/mobile/components/Collapsible.txt +15 -16
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +16 -17
- package/mcp-docs/mobile/components/ContentCard.txt +99 -100
- package/mcp-docs/mobile/components/ContentCardBody.txt +23 -24
- package/mcp-docs/mobile/components/ContentCardFooter.txt +19 -20
- package/mcp-docs/mobile/components/ContentCardHeader.txt +33 -34
- package/mcp-docs/mobile/components/ContentCell.txt +102 -103
- package/mcp-docs/mobile/components/ControlGroup.txt +106 -107
- package/mcp-docs/mobile/components/DatePicker.txt +121 -122
- package/mcp-docs/mobile/components/Divider.txt +31 -32
- package/mcp-docs/mobile/components/DotCount.txt +15 -16
- package/mcp-docs/mobile/components/DotStatusColor.txt +12 -13
- package/mcp-docs/mobile/components/DotSymbol.txt +21 -22
- package/mcp-docs/mobile/components/Fallback.txt +49 -50
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +13 -14
- package/mcp-docs/mobile/components/HStack.txt +99 -100
- package/mcp-docs/mobile/components/HeroSquare.txt +11 -12
- package/mcp-docs/mobile/components/Icon.txt +16 -17
- package/mcp-docs/mobile/components/IconButton.txt +104 -105
- package/mcp-docs/mobile/components/InputChip.txt +62 -63
- package/mcp-docs/mobile/components/Interactable.txt +72 -73
- package/mcp-docs/mobile/components/LineChart.txt +117 -118
- package/mcp-docs/mobile/components/Link.txt +113 -114
- package/mcp-docs/mobile/components/ListCell.txt +149 -128
- package/mcp-docs/mobile/components/LogoMark.txt +8 -9
- package/mcp-docs/mobile/components/LogoWordMark.txt +7 -8
- package/mcp-docs/mobile/components/Lottie.txt +39 -40
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +11 -12
- package/mcp-docs/mobile/components/Modal.txt +36 -37
- package/mcp-docs/mobile/components/ModalBody.txt +5 -6
- package/mcp-docs/mobile/components/ModalFooter.txt +5 -6
- package/mcp-docs/mobile/components/ModalHeader.txt +5 -6
- package/mcp-docs/mobile/components/MultiContentModule.txt +107 -108
- package/mcp-docs/mobile/components/NavigationTitle.txt +13 -14
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +20 -21
- package/mcp-docs/mobile/components/NudgeCard.txt +20 -21
- package/mcp-docs/mobile/components/Numpad.txt +108 -109
- package/mcp-docs/mobile/components/Overlay.txt +45 -46
- package/mcp-docs/mobile/components/PageFooter.txt +57 -58
- package/mcp-docs/mobile/components/PageHeader.txt +79 -80
- package/mcp-docs/mobile/components/PeriodSelector.txt +98 -99
- package/mcp-docs/mobile/components/Pictogram.txt +11 -12
- package/mcp-docs/mobile/components/Point.txt +21 -22
- package/mcp-docs/mobile/components/PortalProvider.txt +7 -8
- package/mcp-docs/mobile/components/Pressable.txt +67 -68
- package/mcp-docs/mobile/components/ProgressBar.txt +18 -19
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +13 -14
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +13 -14
- package/mcp-docs/mobile/components/ProgressCircle.txt +22 -23
- package/mcp-docs/mobile/components/Radio.txt +35 -36
- package/mcp-docs/mobile/components/RadioCell.txt +73 -74
- package/mcp-docs/mobile/components/RadioGroup.txt +35 -36
- package/mcp-docs/mobile/components/ReferenceLine.txt +15 -16
- package/mcp-docs/mobile/components/RemoteImage.txt +47 -48
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +11 -12
- package/mcp-docs/mobile/components/RollingNumber.txt +130 -131
- package/mcp-docs/mobile/components/Scrubber.txt +19 -20
- package/mcp-docs/mobile/components/SearchInput.txt +77 -78
- package/mcp-docs/mobile/components/SectionHeader.txt +16 -17
- package/mcp-docs/mobile/components/SegmentedTabs.txt +105 -106
- package/mcp-docs/mobile/components/Select.txt +35 -36
- package/mcp-docs/mobile/components/SelectChip.txt +143 -144
- package/mcp-docs/mobile/components/SelectOption.txt +26 -27
- package/mcp-docs/mobile/components/SlideButton.txt +128 -129
- package/mcp-docs/mobile/components/Spacer.txt +27 -28
- package/mcp-docs/mobile/components/Sparkline.txt +18 -19
- package/mcp-docs/mobile/components/SparklineGradient.txt +18 -19
- package/mcp-docs/mobile/components/SparklineInteractive.txt +37 -38
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +12 -13
- package/mcp-docs/mobile/components/Spinner.txt +15 -16
- package/mcp-docs/mobile/components/SpotIcon.txt +11 -12
- package/mcp-docs/mobile/components/SpotRectangle.txt +11 -12
- package/mcp-docs/mobile/components/SpotSquare.txt +11 -12
- package/mcp-docs/mobile/components/Stepper.txt +113 -114
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +8 -9
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +8 -9
- package/mcp-docs/mobile/components/Switch.txt +35 -36
- package/mcp-docs/mobile/components/TabIndicator.txt +12 -13
- package/mcp-docs/mobile/components/TabLabel.txt +28 -29
- package/mcp-docs/mobile/components/TabNavigation.txt +41 -42
- package/mcp-docs/mobile/components/TabbedChips.txt +38 -39
- package/mcp-docs/mobile/components/Tabs.txt +76 -77
- package/mcp-docs/mobile/components/Tag.txt +102 -103
- package/mcp-docs/mobile/components/Text.txt +91 -92
- package/mcp-docs/mobile/components/TextInput.txt +107 -108
- package/mcp-docs/mobile/components/ThemeProvider.txt +8 -9
- package/mcp-docs/mobile/components/Toast.txt +82 -83
- package/mcp-docs/mobile/components/Tooltip.txt +20 -21
- package/mcp-docs/mobile/components/TopNavBar.txt +55 -56
- package/mcp-docs/mobile/components/Tour.txt +18 -19
- package/mcp-docs/mobile/components/Tray.txt +43 -44
- package/mcp-docs/mobile/components/UpsellCard.txt +16 -17
- package/mcp-docs/mobile/components/VStack.txt +99 -100
- package/mcp-docs/mobile/components/XAxis.txt +25 -26
- package/mcp-docs/mobile/components/YAxis.txt +26 -27
- package/mcp-docs/mobile/getting-started/{mcp-server.txt → ai-overview.txt} +51 -37
- package/mcp-docs/mobile/getting-started/installation.txt +57 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +3 -0
- package/mcp-docs/mobile/getting-started/playground.txt +3 -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 +27 -2
- 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 +67 -2
- 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 +213 -2
- package/mcp-docs/mobile/routes.txt +8 -1
- package/mcp-docs/web/components/Accordion.txt +12 -13
- package/mcp-docs/web/components/AccordionItem.txt +5 -6
- package/mcp-docs/web/components/Alert.txt +24 -25
- package/mcp-docs/web/components/AreaChart.txt +137 -138
- package/mcp-docs/web/components/Avatar.txt +91 -92
- package/mcp-docs/web/components/AvatarButton.txt +113 -114
- package/mcp-docs/web/components/Banner.txt +101 -102
- package/mcp-docs/web/components/BarChart.txt +367 -368
- package/mcp-docs/web/components/Box.txt +65 -66
- package/mcp-docs/web/components/Button.txt +81 -82
- package/mcp-docs/web/components/ButtonGroup.txt +10 -11
- package/mcp-docs/web/components/Calendar.txt +56 -57
- package/mcp-docs/web/components/Carousel.txt +116 -117
- package/mcp-docs/web/components/CartesianChart.txt +357 -358
- package/mcp-docs/web/components/CellMedia.txt +14 -15
- package/mcp-docs/web/components/Checkbox.txt +22 -23
- package/mcp-docs/web/components/CheckboxCell.txt +70 -71
- package/mcp-docs/web/components/CheckboxGroup.txt +15 -16
- package/mcp-docs/web/components/Chip.txt +67 -68
- package/mcp-docs/web/components/Coachmark.txt +69 -70
- package/mcp-docs/web/components/Collapsible.txt +15 -16
- package/mcp-docs/web/components/ContainedAssetCard.txt +108 -109
- package/mcp-docs/web/components/ContentCard.txt +101 -102
- package/mcp-docs/web/components/ContentCardBody.txt +23 -24
- package/mcp-docs/web/components/ContentCardFooter.txt +19 -20
- package/mcp-docs/web/components/ContentCardHeader.txt +33 -34
- package/mcp-docs/web/components/ContentCell.txt +85 -86
- package/mcp-docs/web/components/ControlGroup.txt +108 -109
- package/mcp-docs/web/components/DatePicker.txt +59 -60
- package/mcp-docs/web/components/Divider.txt +31 -32
- package/mcp-docs/web/components/DotCount.txt +17 -18
- package/mcp-docs/web/components/DotStatusColor.txt +12 -13
- package/mcp-docs/web/components/DotSymbol.txt +24 -25
- package/mcp-docs/web/components/Dropdown.txt +31 -32
- package/mcp-docs/web/components/Fallback.txt +49 -50
- package/mcp-docs/web/components/FloatingAssetCard.txt +108 -109
- package/mcp-docs/web/components/FullscreenAlert.txt +20 -21
- package/mcp-docs/web/components/FullscreenModal.txt +28 -29
- package/mcp-docs/web/components/FullscreenModalLayout.txt +19 -20
- package/mcp-docs/web/components/Grid.txt +106 -107
- package/mcp-docs/web/components/GridColumn.txt +96 -97
- package/mcp-docs/web/components/HStack.txt +101 -102
- package/mcp-docs/web/components/HeroSquare.txt +12 -13
- package/mcp-docs/web/components/Icon.txt +27 -28
- package/mcp-docs/web/components/IconButton.txt +117 -118
- package/mcp-docs/web/components/InputChip.txt +62 -63
- package/mcp-docs/web/components/Interactable.txt +75 -76
- package/mcp-docs/web/components/LineChart.txt +366 -367
- package/mcp-docs/web/components/Link.txt +114 -115
- package/mcp-docs/web/components/ListCell.txt +157 -136
- package/mcp-docs/web/components/LogoMark.txt +8 -9
- package/mcp-docs/web/components/LogoWordMark.txt +7 -8
- package/mcp-docs/web/components/Lottie.txt +44 -45
- package/mcp-docs/web/components/LottieStatusAnimation.txt +11 -12
- package/mcp-docs/web/components/MediaQueryProvider.txt +7 -8
- package/mcp-docs/web/components/Modal.txt +69 -66
- package/mcp-docs/web/components/ModalBody.txt +5 -6
- package/mcp-docs/web/components/ModalFooter.txt +5 -6
- package/mcp-docs/web/components/ModalHeader.txt +5 -6
- package/mcp-docs/web/components/MultiContentModule.txt +109 -110
- package/mcp-docs/web/components/NavigationBar.txt +18 -19
- package/mcp-docs/web/components/NavigationTitle.txt +7 -8
- package/mcp-docs/web/components/NavigationTitleSelect.txt +9 -10
- package/mcp-docs/web/components/NudgeCard.txt +61 -62
- package/mcp-docs/web/components/Overlay.txt +57 -58
- package/mcp-docs/web/components/PageFooter.txt +77 -78
- package/mcp-docs/web/components/PageHeader.txt +107 -108
- package/mcp-docs/web/components/Pagination.txt +115 -116
- package/mcp-docs/web/components/PeriodSelector.txt +158 -159
- package/mcp-docs/web/components/Pictogram.txt +13 -14
- package/mcp-docs/web/components/Point.txt +169 -170
- package/mcp-docs/web/components/PortalProvider.txt +6 -7
- package/mcp-docs/web/components/Pressable.txt +73 -74
- package/mcp-docs/web/components/ProgressBar.txt +20 -21
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +15 -16
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +15 -16
- package/mcp-docs/web/components/ProgressCircle.txt +24 -25
- package/mcp-docs/web/components/Radio.txt +22 -23
- package/mcp-docs/web/components/RadioCell.txt +83 -84
- package/mcp-docs/web/components/RadioGroup.txt +22 -23
- package/mcp-docs/web/components/ReferenceLine.txt +22 -23
- package/mcp-docs/web/components/RemoteImage.txt +49 -50
- package/mcp-docs/web/components/RemoteImageGroup.txt +11 -12
- package/mcp-docs/web/components/RollingNumber.txt +131 -132
- package/mcp-docs/web/components/Scrubber.txt +22 -23
- package/mcp-docs/web/components/SearchInput.txt +29 -30
- package/mcp-docs/web/components/SectionHeader.txt +98 -99
- package/mcp-docs/web/components/SegmentedTabs.txt +109 -110
- package/mcp-docs/web/components/Select.txt +22 -23
- package/mcp-docs/web/components/SelectChip.txt +134 -135
- package/mcp-docs/web/components/SelectOption.txt +31 -32
- package/mcp-docs/web/components/Sidebar.txt +109 -110
- package/mcp-docs/web/components/SidebarItem.txt +6 -7
- package/mcp-docs/web/components/SidebarMoreMenu.txt +5 -6
- package/mcp-docs/web/components/Spacer.txt +57 -58
- package/mcp-docs/web/components/Sparkline.txt +18 -19
- package/mcp-docs/web/components/SparklineGradient.txt +18 -19
- package/mcp-docs/web/components/SparklineInteractive.txt +34 -35
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +12 -13
- package/mcp-docs/web/components/Spinner.txt +15 -16
- package/mcp-docs/web/components/SpotIcon.txt +12 -13
- package/mcp-docs/web/components/SpotRectangle.txt +12 -13
- package/mcp-docs/web/components/SpotSquare.txt +12 -13
- package/mcp-docs/web/components/Stepper.txt +119 -120
- package/mcp-docs/web/components/SubBrandLogoMark.txt +8 -9
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +8 -9
- package/mcp-docs/web/components/Switch.txt +23 -24
- package/mcp-docs/web/components/TabIndicator.txt +12 -13
- package/mcp-docs/web/components/TabLabel.txt +28 -29
- package/mcp-docs/web/components/TabNavigation.txt +41 -42
- package/mcp-docs/web/components/TabbedChips.txt +38 -39
- package/mcp-docs/web/components/Table.txt +17 -18
- package/mcp-docs/web/components/TableBody.txt +9 -10
- package/mcp-docs/web/components/TableCaption.txt +13 -14
- package/mcp-docs/web/components/TableCell.txt +21 -22
- package/mcp-docs/web/components/TableCellFallback.txt +16 -17
- package/mcp-docs/web/components/TableFooter.txt +9 -10
- package/mcp-docs/web/components/TableHeader.txt +10 -11
- package/mcp-docs/web/components/TableRow.txt +13 -14
- package/mcp-docs/web/components/Tabs.txt +94 -95
- package/mcp-docs/web/components/Tag.txt +106 -107
- package/mcp-docs/web/components/Text.txt +110 -111
- package/mcp-docs/web/components/TextInput.txt +32 -33
- package/mcp-docs/web/components/ThemeProvider.txt +27 -28
- package/mcp-docs/web/components/TileButton.txt +37 -38
- package/mcp-docs/web/components/Toast.txt +82 -83
- package/mcp-docs/web/components/Tooltip.txt +22 -23
- package/mcp-docs/web/components/Tour.txt +21 -22
- package/mcp-docs/web/components/Tray.txt +23 -24
- package/mcp-docs/web/components/UpsellCard.txt +16 -17
- package/mcp-docs/web/components/VStack.txt +101 -102
- package/mcp-docs/web/components/XAxis.txt +25 -26
- package/mcp-docs/web/components/YAxis.txt +26 -27
- package/mcp-docs/web/getting-started/{mcp-server.txt → ai-overview.txt} +51 -37
- package/mcp-docs/web/getting-started/installation.txt +103 -0
- package/mcp-docs/web/getting-started/introduction.txt +3 -0
- package/mcp-docs/web/getting-started/playground.txt +3 -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 +30 -2
- package/mcp-docs/web/hooks/useDimensions.txt +61 -2
- package/mcp-docs/web/hooks/useEventHandler.txt +120 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +22 -2
- package/mcp-docs/web/hooks/useIsoEffect.txt +18 -2
- package/mcp-docs/web/hooks/useMediaQuery.txt +22 -2
- package/mcp-docs/web/hooks/useMergeRefs.txt +116 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +64 -2
- 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 +21 -2
- package/mcp-docs/web/hooks/useTheme.txt +261 -2
- package/mcp-docs/web/routes.txt +9 -1
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# usePreviousValue
|
|
2
|
+
|
|
3
|
+
Returns the previous value of a given variable, useful for comparing current and previous states in effects or for tracking changes over time.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { usePreviousValue } from '@coinbase/cds-common/hooks/usePreviousValue'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### Parameters
|
|
14
|
+
|
|
15
|
+
The `usePreviousValue` hook accepts a single parameter:
|
|
16
|
+
|
|
17
|
+
- `value: T` - The value to track. Can be of any type.
|
|
18
|
+
|
|
19
|
+
### Returns
|
|
20
|
+
|
|
21
|
+
Returns the previous value of type `T | undefined`:
|
|
22
|
+
|
|
23
|
+
- Returns `undefined` on the first render
|
|
24
|
+
- Returns the previous value of the tracked value on subsequent renders
|
|
25
|
+
|
|
26
|
+
:::tip
|
|
27
|
+
This hook is useful for comparing the current value with its previous state, such as in animations, transitions, or when you need to react to value changes. The hook uses a ref to store the previous value, ensuring it persists between renders.
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Basic usage
|
|
33
|
+
|
|
34
|
+
```tsx live
|
|
35
|
+
function Example() {
|
|
36
|
+
const [count, setCount] = useState(0);
|
|
37
|
+
const previousCount = usePreviousValue(count);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<VStack gap={3} alignItems="start">
|
|
41
|
+
<VStack gap={1}>
|
|
42
|
+
<TextHeadline>Current count: {count}</TextHeadline>
|
|
43
|
+
<TextHeadline>Previous count: {previousCount ?? 'None'}</TextHeadline>
|
|
44
|
+
</VStack>
|
|
45
|
+
<Button onClick={() => setCount(count + 1)}>Increment</Button>
|
|
46
|
+
</VStack>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### With Complex Values
|
|
52
|
+
|
|
53
|
+
```tsx live
|
|
54
|
+
function Example() {
|
|
55
|
+
const [user, setUser] = useState({ name: 'John', age: 25 });
|
|
56
|
+
const previousUser = usePreviousValue(user);
|
|
57
|
+
|
|
58
|
+
const updateAge = () => {
|
|
59
|
+
setUser((prev) => ({ ...prev, age: prev.age + 1 }));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<VStack gap={3} alignItems="start">
|
|
64
|
+
<VStack gap={1}>
|
|
65
|
+
<TextHeadline>Name: {user.name}</TextHeadline>
|
|
66
|
+
<TextHeadline>Age: {user.age}</TextHeadline>
|
|
67
|
+
<TextHeadline>Previous age: {previousUser?.age ?? 'None'}</TextHeadline>
|
|
68
|
+
</VStack>
|
|
69
|
+
<Button onClick={updateAge}>Add Year</Button>
|
|
70
|
+
</VStack>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# useRefMap
|
|
2
|
+
|
|
3
|
+
Manages a collection of refs using a key-value map structure, allowing dynamic registration and retrieval of refs by their unique identifiers. Commonly used in components that need to track multiple DOM elements, such as tabs, tours, or complex navigation systems.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { useRefMap } from '@coinbase/cds-common/hooks/useRefMap'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### Parameters
|
|
14
|
+
|
|
15
|
+
The `useRefMap` hook accepts an optional configuration object:
|
|
16
|
+
|
|
17
|
+
- `options?: RefMapOptions<RefValue>` - Configuration options for the ref map
|
|
18
|
+
- `initialRefMap?: Record<string, RefValue>` - Optional initial map of refs
|
|
19
|
+
|
|
20
|
+
The generic type `RefValue` represents the type of values stored in the ref map (typically `HTMLElement` or a specific element type).
|
|
21
|
+
|
|
22
|
+
### Returns
|
|
23
|
+
|
|
24
|
+
Returns a `RefMapApi<RefValue>` object with the following properties:
|
|
25
|
+
|
|
26
|
+
- `refs: Record<string, RefValue>` - The current map of all registered refs
|
|
27
|
+
- `getRef: (id: string) => RefValue | null` - Function to retrieve a ref by its ID
|
|
28
|
+
- `registerRef: (id: string, ref: RefValue) => void` - Function to register a new ref with an ID
|
|
29
|
+
|
|
30
|
+
:::tip
|
|
31
|
+
This hook is particularly useful when working with components that need to manage multiple refs, such as in tour guides where elements need to be highlighted, or in tab systems where tab panels need to be referenced. The hook maintains a stable reference to the ref map and its utility functions across renders.
|
|
32
|
+
:::
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Basic usage
|
|
37
|
+
|
|
38
|
+
```tsx live
|
|
39
|
+
function Example() {
|
|
40
|
+
const { registerRef, getRef } = useRefMap<HTMLDivElement>();
|
|
41
|
+
const toast = useToast();
|
|
42
|
+
|
|
43
|
+
const handleClick = () => {
|
|
44
|
+
// Get the element by its ID and log its dimensions
|
|
45
|
+
const element = getRef('box1');
|
|
46
|
+
if (element) {
|
|
47
|
+
toast.show(`Box dimensions: ${element.offsetWidth}x${element.offsetHeight}`);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<VStack gap={2}>
|
|
53
|
+
<Box
|
|
54
|
+
ref={(el) => el && registerRef('box1', el)}
|
|
55
|
+
padding={3}
|
|
56
|
+
background="bgAlternate"
|
|
57
|
+
borderRadius={300}
|
|
58
|
+
>
|
|
59
|
+
<TextBody>This box is registered with ID 'box1'</TextBody>
|
|
60
|
+
</Box>
|
|
61
|
+
<Button onClick={handleClick}>Get Box Dimensions</Button>
|
|
62
|
+
</VStack>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With Multiple Elements
|
|
68
|
+
|
|
69
|
+
```tsx live
|
|
70
|
+
function Example() {
|
|
71
|
+
const { registerRef, getRef } = useRefMap<HTMLDivElement>();
|
|
72
|
+
const [activeId, setActiveId] = useState<string | null>(null);
|
|
73
|
+
|
|
74
|
+
const highlightElement = (id: string) => {
|
|
75
|
+
// Reset previous highlight
|
|
76
|
+
if (activeId) {
|
|
77
|
+
const prevElement = getRef(activeId);
|
|
78
|
+
if (prevElement) {
|
|
79
|
+
prevElement.style.outline = 'none';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Highlight new element
|
|
84
|
+
const element = getRef(id);
|
|
85
|
+
if (element) {
|
|
86
|
+
element.style.outline = '2px solid var(--color-fgPrimary)';
|
|
87
|
+
setActiveId(id);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<VStack gap={3}>
|
|
93
|
+
<HStack gap={2}>
|
|
94
|
+
<Button onClick={() => highlightElement('box1')}>Highlight Box 1</Button>
|
|
95
|
+
<Button onClick={() => highlightElement('box2')}>Highlight Box 2</Button>
|
|
96
|
+
<Button onClick={() => highlightElement('box3')}>Highlight Box 3</Button>
|
|
97
|
+
</HStack>
|
|
98
|
+
|
|
99
|
+
<VStack gap={2}>
|
|
100
|
+
<Box
|
|
101
|
+
ref={(el) => el && registerRef('box1', el)}
|
|
102
|
+
padding={3}
|
|
103
|
+
background="bgAlternate"
|
|
104
|
+
borderRadius={300}
|
|
105
|
+
>
|
|
106
|
+
<TextBody>Box 1</TextBody>
|
|
107
|
+
</Box>
|
|
108
|
+
|
|
109
|
+
<Box
|
|
110
|
+
ref={(el) => el && registerRef('box2', el)}
|
|
111
|
+
padding={3}
|
|
112
|
+
background="bgAlternate"
|
|
113
|
+
borderRadius={300}
|
|
114
|
+
>
|
|
115
|
+
<TextBody>Box 2</TextBody>
|
|
116
|
+
</Box>
|
|
117
|
+
|
|
118
|
+
<Box
|
|
119
|
+
ref={(el) => el && registerRef('box3', el)}
|
|
120
|
+
padding={3}
|
|
121
|
+
background="bgAlternate"
|
|
122
|
+
borderRadius={300}
|
|
123
|
+
>
|
|
124
|
+
<TextBody>Box 3</TextBody>
|
|
125
|
+
</Box>
|
|
126
|
+
</VStack>
|
|
127
|
+
</VStack>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### With Initial Refs
|
|
133
|
+
|
|
134
|
+
```tsx live
|
|
135
|
+
function Example() {
|
|
136
|
+
// Create initial refs map
|
|
137
|
+
const box1Ref = useRef<HTMLDivElement>(null);
|
|
138
|
+
const box2Ref = useRef<HTMLDivElement>(null);
|
|
139
|
+
|
|
140
|
+
const initialRefs = {
|
|
141
|
+
box1: box1Ref.current,
|
|
142
|
+
box2: box2Ref.current,
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const { refs, registerRef } = useRefMap<HTMLDivElement>({
|
|
146
|
+
initialRefMap: initialRefs,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const logRefs = () => {
|
|
150
|
+
console.log('Current refs:', refs);
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<VStack gap={2}>
|
|
155
|
+
<Box
|
|
156
|
+
ref={(el) => el && registerRef('box1', el)}
|
|
157
|
+
padding={3}
|
|
158
|
+
background="bgAlternate"
|
|
159
|
+
borderRadius={300}
|
|
160
|
+
>
|
|
161
|
+
<TextBody>Box 1</TextBody>
|
|
162
|
+
</Box>
|
|
163
|
+
|
|
164
|
+
<Box
|
|
165
|
+
ref={(el) => el && registerRef('box2', el)}
|
|
166
|
+
padding={3}
|
|
167
|
+
background="bgAlternate"
|
|
168
|
+
borderRadius={300}
|
|
169
|
+
>
|
|
170
|
+
<TextBody>Box 2</TextBody>
|
|
171
|
+
</Box>
|
|
172
|
+
|
|
173
|
+
<Button onClick={logRefs}>Log Refs</Button>
|
|
174
|
+
</VStack>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
# useTheme
|
|
2
|
+
|
|
3
3
|
Returns the currently active theme including color schemes, spacing, typography, and other design tokens.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
@@ -8,6 +8,218 @@ Returns the currently active theme including color schemes, spacing, typography,
|
|
|
8
8
|
import { useTheme } from '@coinbase/cds-mobile'
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## API
|
|
12
|
+
|
|
13
|
+
### Overview
|
|
14
|
+
|
|
15
|
+
The `useTheme` hook returns the currently active theme based on the `ThemeProvider's` active color scheme. All values are optimized for React Native usage, with numeric values in points rather than rem units.
|
|
16
|
+
|
|
17
|
+
### Parameters
|
|
18
|
+
|
|
19
|
+
None. The hook takes no parameters.
|
|
20
|
+
|
|
21
|
+
### Returns
|
|
22
|
+
|
|
23
|
+
Returns a `Theme` object containing the following categories of design tokens:
|
|
24
|
+
|
|
25
|
+
#### Color Tokens
|
|
26
|
+
|
|
27
|
+
##### Color Scheme
|
|
28
|
+
|
|
29
|
+
- `colorScheme`: `'light' | 'dark'`
|
|
30
|
+
- `spectrum`: Raw color values in RGB format (e.g., `'245,248,255'` for `blue0`)
|
|
31
|
+
|
|
32
|
+
##### Semantic Colors
|
|
33
|
+
|
|
34
|
+
- Text Colors
|
|
35
|
+
- `color.fg`: Primary text color (RGB format)
|
|
36
|
+
- `color.fgMuted`: Secondary text color
|
|
37
|
+
- `color.fgInverse`: Inverted text color
|
|
38
|
+
- `color.fgPrimary`: Primary brand text color
|
|
39
|
+
- `color.fgWarning`: Warning text color
|
|
40
|
+
- `color.fgPositive`: Success text color
|
|
41
|
+
- `color.fgNegative`: Error text color
|
|
42
|
+
|
|
43
|
+
- Background Colors
|
|
44
|
+
- `color.bg`: Primary background color
|
|
45
|
+
- `color.bgAlternate`: Secondary background color
|
|
46
|
+
- `color.bgInverse`: Inverted background color
|
|
47
|
+
- `color.bgOverlay`: Semi-transparent overlay
|
|
48
|
+
- `color.bgPrimary`: Primary brand background
|
|
49
|
+
- `color.bgPrimaryWash`: Light primary background
|
|
50
|
+
- `color.bgSecondary`: Secondary background
|
|
51
|
+
- `color.bgTertiary`: Tertiary background
|
|
52
|
+
- `color.bgSecondaryWash`: Light secondary background
|
|
53
|
+
- `color.bgNegative`: Error background
|
|
54
|
+
- `color.bgNegativeWash`: Light error background
|
|
55
|
+
- `color.bgPositive`: Success background
|
|
56
|
+
- `color.bgPositiveWash`: Light success background
|
|
57
|
+
- `color.bgWarning`: Warning background
|
|
58
|
+
- `color.bgWarningWash`: Light warning background
|
|
59
|
+
- `color.currentColor`: Current color context
|
|
60
|
+
- `color.bgElevation1`: First level elevation background
|
|
61
|
+
- `color.bgElevation2`: Second level elevation background
|
|
62
|
+
|
|
63
|
+
- Line Colors
|
|
64
|
+
- `color.bgLine`: Default line color (semi-transparent)
|
|
65
|
+
- `color.bgLineHeavy`: Emphasized line color
|
|
66
|
+
- `color.bgLineInverse`: Inverted line color
|
|
67
|
+
- `color.bgLinePrimary`: Primary brand line color
|
|
68
|
+
- `color.bgLinePrimarySubtle`: Subtle primary line color
|
|
69
|
+
|
|
70
|
+
- Accent Colors
|
|
71
|
+
- `color.accentSubtleGreen`: Subtle green accent
|
|
72
|
+
- `color.accentBoldGreen`: Bold green accent
|
|
73
|
+
- `color.accentSubtleBlue`: Subtle blue accent
|
|
74
|
+
- `color.accentBoldBlue`: Bold blue accent
|
|
75
|
+
- `color.accentSubtlePurple`: Subtle purple accent
|
|
76
|
+
- `color.accentBoldPurple`: Bold purple accent
|
|
77
|
+
- `color.accentSubtleYellow`: Subtle yellow accent
|
|
78
|
+
- `color.accentBoldYellow`: Bold yellow accent
|
|
79
|
+
- `color.accentSubtleRed`: Subtle red accent
|
|
80
|
+
- `color.accentBoldRed`: Bold red accent
|
|
81
|
+
- `color.accentSubtleGray`: Subtle gray accent
|
|
82
|
+
- `color.accentBoldGray`: Bold gray accent
|
|
83
|
+
- `color.transparent`: Transparent color
|
|
84
|
+
|
|
85
|
+
#### Layout Tokens
|
|
86
|
+
|
|
87
|
+
##### Spacing
|
|
88
|
+
|
|
89
|
+
- `space`: Object containing spacing values from `0` to `10` in points
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
{
|
|
93
|
+
0: 0,
|
|
94
|
+
1: 8,
|
|
95
|
+
2: 16,
|
|
96
|
+
3: 24,
|
|
97
|
+
// ...up to 10
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
##### Component Sizes
|
|
102
|
+
|
|
103
|
+
- `iconSize`: `{ xs: 8, s: 12, m: 16, l: 24 }`
|
|
104
|
+
- `avatarSize`: `{ s: 16, m: 20, l: 24, xl: 36, xxl: 44, xxxl: 48 }`
|
|
105
|
+
- `controlSize`: Form control sizes
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
{
|
|
109
|
+
checkboxSize: 16,
|
|
110
|
+
radioSize: 16,
|
|
111
|
+
switchWidth: 42,
|
|
112
|
+
switchHeight: 24,
|
|
113
|
+
switchThumbSize: 22,
|
|
114
|
+
tileSize: 92
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
##### Borders
|
|
119
|
+
|
|
120
|
+
- `borderWidth`: Values from `0` to `500` in points
|
|
121
|
+
- `borderRadius`: Values from `0` to `1000` in points
|
|
122
|
+
|
|
123
|
+
#### Typography Tokens
|
|
124
|
+
|
|
125
|
+
##### Font Families
|
|
126
|
+
|
|
127
|
+
- `fontFamily`: Base font families for each text style
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
{
|
|
131
|
+
display1: 'CoinbaseDisplay-Regular',
|
|
132
|
+
display2: 'CoinbaseDisplay-Regular',
|
|
133
|
+
display3: 'CoinbaseDisplay-Regular',
|
|
134
|
+
title1: 'CoinbaseDisplay-Medium',
|
|
135
|
+
// ...and more variants
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
- `fontFamilyMono`: Monospace font families (optional)
|
|
140
|
+
|
|
141
|
+
```tsx
|
|
142
|
+
{
|
|
143
|
+
display1: 'CoinbaseMono-Regular',
|
|
144
|
+
display2: 'CoinbaseMono-Regular',
|
|
145
|
+
// ...and more variants
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
##### Text Styles
|
|
150
|
+
|
|
151
|
+
- `fontSize`: Font sizes in points (not rem)
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
{
|
|
155
|
+
display1: 64,
|
|
156
|
+
display2: 48,
|
|
157
|
+
display3: 40,
|
|
158
|
+
// ...and more variants
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
- `fontWeight`: Font weights as React Native TextStyle values
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
{
|
|
166
|
+
display1: '400',
|
|
167
|
+
title1: '600',
|
|
168
|
+
// ...and more variants
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
- `lineHeight`: Line heights in points (not rem)
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
{
|
|
176
|
+
display1: 72,
|
|
177
|
+
display2: 56,
|
|
178
|
+
// ...and more variants
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
- `textTransform`: Text transformations as React Native TextStyle values
|
|
183
|
+
|
|
184
|
+
```tsx
|
|
185
|
+
{
|
|
186
|
+
caption: 'uppercase',
|
|
187
|
+
body: 'none',
|
|
188
|
+
// ...and more variants
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### Effect Tokens
|
|
193
|
+
|
|
194
|
+
##### Shadows
|
|
195
|
+
|
|
196
|
+
- `shadow`: React Native shadow styles
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
{
|
|
200
|
+
elevation1: {
|
|
201
|
+
shadowColor: '#000000',
|
|
202
|
+
shadowOffset: { width: 0, height: 8 },
|
|
203
|
+
shadowOpacity: 0.02,
|
|
204
|
+
shadowRadius: 12
|
|
205
|
+
},
|
|
206
|
+
elevation2: {
|
|
207
|
+
shadowColor: '#000000',
|
|
208
|
+
shadowOffset: { width: 0, height: 8 },
|
|
209
|
+
shadowOpacity: 0.12,
|
|
210
|
+
shadowRadius: 24
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Notes
|
|
216
|
+
|
|
217
|
+
1. The hook must be used within a `ThemeProvider` component, or it will throw an error.
|
|
218
|
+
2. All numeric values are in points (pt) rather than rem units, optimized for React Native.
|
|
219
|
+
3. Colors are provided in RGB format for text and background colors, allowing for opacity adjustments.
|
|
220
|
+
4. Shadow values are provided as React Native shadow style objects, including platform-specific implementations.
|
|
221
|
+
5. Font families are platform-specific font names that should be properly linked in your React Native project.
|
|
222
|
+
|
|
11
223
|
## Examples
|
|
12
224
|
|
|
13
225
|
### `useTheme` hook
|
|
@@ -107,4 +319,3 @@ function Example() {
|
|
|
107
319
|
}
|
|
108
320
|
```
|
|
109
321
|
|
|
110
|
-
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
## Getting Started
|
|
5
5
|
|
|
6
|
+
- [theming](mobile/getting-started/theming.txt): The theme contains design tokens like colors, fonts, spacing, and more. The ThemeProvider provides access to these values via CSS Variables for web, and React Context for both web and React Native.
|
|
7
|
+
- [styling](mobile/getting-started/styling.txt): CDS includes powerful and flexible APIs for styling components. Easily access values from the theme, or go rogue with full customization.
|
|
6
8
|
- [playground](mobile/getting-started/playground.txt)
|
|
7
|
-
- [mcp-server](mobile/getting-started/mcp-server.txt)
|
|
8
9
|
- [introduction](mobile/getting-started/introduction.txt)
|
|
10
|
+
- [installation](mobile/getting-started/installation.txt): This guide will help you get started with installing CDS in your React Native project. Follow the instructions below to set up CDS and start building with our cross-platform components.
|
|
11
|
+
- [ai-overview](mobile/getting-started/ai-overview.txt)
|
|
9
12
|
|
|
10
13
|
## Components
|
|
11
14
|
|
|
@@ -128,5 +131,9 @@
|
|
|
128
131
|
## Hooks
|
|
129
132
|
|
|
130
133
|
- [useTheme](mobile/hooks/useTheme.txt): Returns the currently active theme including color schemes, spacing, typography, and other design tokens.
|
|
134
|
+
- [useRefMap](mobile/hooks/useRefMap.txt): Manages a collection of refs using a key-value map structure, allowing dynamic registration and retrieval of refs by their unique identifiers. Commonly used in components that need to track multiple DOM elements, such as tabs, tours, or complex navigation systems.
|
|
135
|
+
- [usePreviousValue](mobile/hooks/usePreviousValue.txt): Returns the previous value of a given variable, useful for comparing current and previous states in effects or for tracking changes over time.
|
|
131
136
|
- [useOverlayContentContext](mobile/hooks/useOverlayContentContext.txt): A React context and hook for detecting if components are rendered inside overlay containers like modals, drawers, tours, and trays.
|
|
137
|
+
- [useMergeRefs](mobile/hooks/useMergeRefs.txt): Combines multiple refs into a single ref callback, allowing a component to work with multiple ref instances simultaneously. Useful when you need to combine refs from different sources, such as forwarded refs and internal component state.
|
|
138
|
+
- [useEventHandler](mobile/hooks/useEventHandler.txt): Creates event handlers for components based on the EventHandlerProvider configuration. It enables centralized event handling and analytics tracking by mapping component actions to configured handlers.
|
|
132
139
|
- [useDimensions](mobile/hooks/useDimensions.txt): Measures the screen dimensions and status bar height.
|
|
@@ -4,22 +4,10 @@ A collapsible component for displaying auxiliary content.
|
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```tsx
|
|
8
8
|
import { Accordion } from '@coinbase/cds-web/accordion/Accordion'
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Props
|
|
12
|
-
|
|
13
|
-
| Prop | Type | Required | Default | Description |
|
|
14
|
-
| --- | --- | --- | --- | --- |
|
|
15
|
-
| `activeKey` | `string \| null` | No | `-` | - |
|
|
16
|
-
| `defaultActiveKey` | `string` | No | `-` | Default active accordion item key. If not specified or does not exist in the accordion items, all items will be closed on mount |
|
|
17
|
-
| `onChange` | `((activeKey: string \| null) => void)` | No | `-` | Callback function fired when any of accordion items is pressed |
|
|
18
|
-
| `setActiveKey` | `((activeKey: string \| null) => void)` | No | `-` | - |
|
|
19
|
-
| `style` | `CSSProperties` | No | `-` | - |
|
|
20
|
-
| `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 |
|
|
21
|
-
|
|
22
|
-
|
|
23
11
|
## Examples
|
|
24
12
|
|
|
25
13
|
Check [here](/components/layout/AccordionItem) for AccordionItem Props.
|
|
@@ -187,4 +175,15 @@ Check [here](/components/layout/AccordionItem) for AccordionItem Props.
|
|
|
187
175
|
</Accordion>
|
|
188
176
|
```
|
|
189
177
|
|
|
178
|
+
## Props
|
|
179
|
+
|
|
180
|
+
| Prop | Type | Required | Default | Description |
|
|
181
|
+
| --- | --- | --- | --- | --- |
|
|
182
|
+
| `activeKey` | `string \| null` | No | `-` | - |
|
|
183
|
+
| `defaultActiveKey` | `string` | No | `-` | Default active accordion item key. If not specified or does not exist in the accordion items, all items will be closed on mount |
|
|
184
|
+
| `onChange` | `((activeKey: string \| null) => void)` | No | `-` | Callback function fired when any of accordion items is pressed |
|
|
185
|
+
| `setActiveKey` | `((activeKey: string \| null) => void)` | No | `-` | - |
|
|
186
|
+
| `style` | `CSSProperties` | No | `-` | - |
|
|
187
|
+
| `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 |
|
|
188
|
+
|
|
190
189
|
|
|
@@ -4,10 +4,14 @@ An individual collapsible item within an Accordion.
|
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```tsx
|
|
8
8
|
import { AccordionItem } from '@coinbase/cds-web/accordion/AccordionItem'
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
Check [Accordion](/components/layout/Accordion) for usage examples.
|
|
14
|
+
|
|
11
15
|
## Props
|
|
12
16
|
|
|
13
17
|
| Prop | Type | Required | Default | Description |
|
|
@@ -25,8 +29,3 @@ import { AccordionItem } from '@coinbase/cds-web/accordion/AccordionItem'
|
|
|
25
29
|
| `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 |
|
|
26
30
|
|
|
27
31
|
|
|
28
|
-
## Examples
|
|
29
|
-
|
|
30
|
-
Check [Accordion](/components/layout/Accordion) for usage examples.
|
|
31
|
-
|
|
32
|
-
|
|
@@ -4,34 +4,10 @@ A dialog that communicates critical information and blocks user interaction.
|
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```tsx
|
|
8
8
|
import { Alert } from '@coinbase/cds-web/overlays/Alert'
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Props
|
|
12
|
-
|
|
13
|
-
| Prop | Type | Required | Default | Description |
|
|
14
|
-
| --- | --- | --- | --- | --- |
|
|
15
|
-
| `body` | `string` | Yes | `-` | Alert body/description |
|
|
16
|
-
| `onRequestClose` | `() => void` | Yes | `-` | Callback function fired when modal is closed. |
|
|
17
|
-
| `preferredActionLabel` | `string` | Yes | `-` | Label of the preferred action |
|
|
18
|
-
| `title` | `string` | Yes | `-` | Alert title |
|
|
19
|
-
| `visible` | `boolean` | Yes | `false false` | Controls visibility of the Modal |
|
|
20
|
-
| `accessibilityLabelledBy` | `string` | No | `-` | On web, maps to aria-labelledby and lists the id(s) of the element(s) that label the element on which the attribute is set. On mobile (Android only), a reference to another element nativeID used to build complex forms. |
|
|
21
|
-
| `actionLayout` | `horizontal \| vertical` | No | `horizontal` | Layout of the actions |
|
|
22
|
-
| `disablePortal` | `boolean` | No | `-` | Disable React portal integration |
|
|
23
|
-
| `dismissActionLabel` | `string` | No | `-` | Label of the dismiss action |
|
|
24
|
-
| `key` | `Key \| null` | No | `-` | - |
|
|
25
|
-
| `onDidClose` | `((() => void) & (() => void))` | No | `-` | Callback fired after the component is closed. |
|
|
26
|
-
| `onDismissActionPress` | `(() => void)` | No | `-` | Callback function fired when the dismiss action is pressed |
|
|
27
|
-
| `onPreferredActionPress` | `(() => void)` | No | `-` | Callback function fired when the preferred action is pressed |
|
|
28
|
-
| `pictogram` | `key \| done \| cardSuccess \| warning \| error \| add \| browser \| calculator \| calendar \| checkmark \| clock \| coinbaseOneLogo \| derivativesProduct \| email \| gasFees \| identityCard \| instantUnstakingClock \| laptop \| learningRewardsProduct \| lock \| passport \| paypal \| phone \| planet \| safe \| securityKey \| settings \| shield \| support \| taxes \| trading \| verifiedPools \| wallet \| 2fa \| accountsNavigation \| accreditedInvestor \| addCard \| addPayment \| addPhone \| addressBook \| addToWatchlist \| addWallet \| advancedTradingDesktop \| advancedTradingNavigation \| advancedTradingRebates \| agent \| alerts \| alertsCoinbaseOne \| analyticsNavigation \| apartOfDropsNft \| applyForHigherLimits \| apyInterest \| assetEncryption \| assetHubNavigation \| assetManagement \| assetManagementNavigation \| assetMeasurements \| assetMovement \| authenticationApp \| authenticator \| authenticatorAlt \| authenticatorProgress \| avatarAa \| avatarAb \| avatarAc \| avatarAd \| avatarAe \| avatarAf \| avatarAg \| avatarAh \| avatarAi \| avatarAj \| avatarBa \| avatarBb \| avatarBc \| avatarBd \| avatarBe \| avatarBf \| avatarBg \| avatarBh \| avatarBi \| avatarBj \| avatarCa \| avatarCb \| avatarCc \| avatarCd \| avatarCe \| avatarCf \| avatarCg \| avatarCh \| avatarCi \| avatarCj \| avatarDa \| avatarDb \| avatarDc \| avatarDd \| avatarDe \| avatarDf \| avatarDg \| avatarDh \| avatarDi \| avatarDj \| avatarEa \| avatarEb \| avatarEc \| avatarEd \| avatarEe \| avatarEf \| avatarEg \| avatarEh \| avatarEi \| avatarEj \| avatarFa \| avatarFb \| avatarFc \| avatarFd \| avatarFe \| avatarFf \| avatarFg \| avatarFh \| avatarFi \| avatarFj \| avatarGa \| avatarGb \| avatarGc \| avatarGd \| avatarGe \| avatarGf \| avatarGg \| avatarGh \| avatarGi \| avatarGj \| avatarHa \| avatarHb \| avatarHc \| avatarHd \| avatarHe \| avatarHf \| avatarHg \| avatarHh \| avatarHi \| avatarHj \| avatarIa \| avatarIb \| avatarIc \| avatarId \| avatarIe \| avatarIf \| avatarIg \| avatarIh \| avatarIi \| avatarIj \| avatarJa \| avatarJb \| avatarJc \| avatarJd \| avatarJe \| avatarJf \| avatarJg \| avatarJh \| avatarJi \| avatarJj \| barChart \| baseChartSmall \| baseCheckSmall \| baseCoinCryptoSmall \| baseCoinNetworkSmall \| baseCoinStack \| baseConnectApps \| baseConnectSmall \| baseDecentralizationSmall \| baseDiamondSmall \| baseDiamondTrophy \| baseEmptySmall \| baseErrorButterflySmall \| baseErrorSmall \| baseLoadingSmall \| baseLocationSmall \| baseLogo \| baseLogoNavigation \| baseMessaging \| baseMintNftSmall \| baseNetworkSmall \| baseNftSmall \| basePaycoinSmall \| basePeopleSmall \| basePiechartSmall \| baseSecuritySmall \| baseSendSmall \| baseSignin \| baseTargetSmall \| bitcoin \| bitcoinPizza \| bitcoinRewards \| bitcoinWhitePaper \| blockchainConnection \| bonusFivePercent \| bonusTwoPercent \| borrowCoins \| borrowingLending \| borrowNavigation \| browserMultiPlatform \| browserTransaction \| bundle \| businessProduct \| calendarCaution \| candleSticksGraph \| cardBlocked \| cardDeclined \| cardNavigation \| cb1BankTransfers \| chart \| chat \| cloudNavigation \| coinbaseLogoAdvancedBrand \| coinbaseLogoNavigation \| coinbaseOneAuthenticator \| coinbaseOneChat \| coinbaseOneEarn \| coinbaseOneEarnCoins \| coinbaseOneEarnCoinsLogo \| coinbaseOneFiat \| coinbaseOneProductIcon \| coinbaseOneProductInvestWeekly \| coinbaseOneRefreshed \| coinbaseOneShield \| coinbaseOneTrade \| coinbaseOneTrusted \| coinbaseOneUnlimitedRewards \| coinbaseUnlockOffers \| coinbaseWalletApp \| coinFocus \| coinShare \| coldStorageCheck \| collectionOfAssets \| commerceCheckout \| commerceInvoice \| commerceNavigation \| completeQuiz \| complianceNavigation \| congratulations \| connectNavigation \| contactInfo \| controlWalletStorage \| creative \| creditCard \| crypto101 \| cryptoCard \| cryptoFolder \| custodialJourney \| custodyNavigation \| dataMarketplaceNavigation \| decentralizationEverything \| decentralizedExchange \| decentralizedIdentity \| decentralizedWeb3 \| defiEarnMoment \| delegate \| delegateNavigation \| derivativesNavigation \| developerPlatformNavigation \| developerSDKNavigation \| directDepositNavigation \| dollarShowcase \| driversLicense \| driversLicenseWheel \| earnCoins \| earnGraph \| earnNavigation \| easyToUse \| economyGlobal \| emailAndMessages \| enableVoting \| envelope \| ethereumFocus \| ethRewards \| ethStaking \| ethStakingChart \| ethStakingRewards \| ethToken \| exchangeNavigation \| explore \| fast \| faucetNavigation \| feesRestriction \| fiat \| finance \| findYourSelection \| formDownload \| futures \| futuresCoinbaseOne \| gem \| genericCountryIDCard \| getStarted \| giftbox \| globalConnections \| globalPayments \| globalTransactions \| googleAuthenticator \| governance \| hardwareWallet \| helpCenterNavigation \| higherLimits \| holdingCoin \| idBlock \| idError \| idVerification \| increaseLimits \| institutionalNavigation \| institutions \| internationalExchangeNavigation \| internet \| investGraph \| laptopCharts \| laptopVideo \| layerNetworks \| leadGraph \| learn \| learningRewardsNavigation \| lightbulbLearn \| lightningNetworkSend \| linkYourAccount \| listingFees \| locationUsa \| lowFees \| manageWeb3SignersAcct \| miningCoins \| mintedNft \| mobileCharts \| mobileError \| mobileNotifcation \| mobileSuccess \| mobileWarning \| moneyEarn \| moneySwift \| monitoringPerformance \| moreThanBitcoin \| multiAccountsAndCards \| multiPlatform \| multipleAssets \| musicAndSounds \| myNumberCard \| newUserChecklistBuyCrypto \| newUserChecklistCompleteAccount \| newUserChecklistVerifyId \| nftAvatar \| nftLibrary \| nftNavigation \| noAnnualFee \| noNftFound \| notificationHubAnalysis \| notificationHubNews \| notificationHubPortfolio \| notificationHubSocial \| notifications \| noVisibility \| noWiFi \| orders \| outage \| partialCoins \| participateNavigation \| passwordWalletLocked \| payNavigation \| peerToPeer \| pieChart \| pizza \| pluginBrowser \| positiveReviews \| predictionMarkets \| premiumInvestor \| priceTracking \| primeMobileApp \| primeNavigation \| privateClientNavigation \| proNavigation \| protectionPlan \| queryTransactNavigation \| receipt \| recurringPurchases \| restaking \| reviewAndAdd \| rewardsNavigation \| riskStaking \| rosettaNavigation \| securedAssets \| security \| securityCoinShield \| seedPhrase \| selectAddNft \| selfCustodyWallet \| selfServe \| sellSendAnytime \| sendPaymentToOthers \| settled \| sideChainSide \| signInNavigation \| smsAuthenticate \| sparkleCoinbaseOne \| ssnCard \| stableCoinMetaphor \| stacking \| stakingGraph \| standWithCryptoLogoNavigation \| startToday \| strongInfo \| strongWarning \| successPhone \| supportChat \| takeQuiz \| target \| taxBeta \| taxCenterNavigation \| taxesArrangement \| taxSeason \| timingCheck \| tokenBaskets \| tokenSales \| transferSend \| transistor \| trendingAssets \| trusted \| tryAgainLater \| twoBonus \| typeScript \| ubiKey \| usaProduct \| usdcEarn \| usdcInterest \| usdcLoan \| usdcLogo \| usdcRewards \| usdcRewardsRibbon \| usdcToken \| venturesNavigation \| videoCalendar \| videoContent \| waiting \| waitingForConsensus \| walletAsServiceNavigation \| walletDeposit \| walletError \| walletExchange \| walletLinkNavigation \| walletLogoNavigation \| walletNavigation \| walletPassword \| walletSuccess \| walletWarning \| winBTC \| worldwide \| wrapEth` | No | `-` | Illustration pictogram name for alert |
|
|
29
|
-
| `preferredActionVariant` | `primary \| negative` | No | `primary` | Button variant of the preferred action |
|
|
30
|
-
| `ref` | `((instance: ModalRefBaseProps \| null) => void) \| RefObject<ModalRefBaseProps> \| null` | No | `-` | - |
|
|
31
|
-
| `stacked` | `boolean` | No | `-` | Indicating if Alert is stacked on top of Modal |
|
|
32
|
-
| `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 |
|
|
33
|
-
|
|
34
|
-
|
|
35
11
|
## Examples
|
|
36
12
|
|
|
37
13
|
:::tip Accessibility tip (Web only)
|
|
@@ -162,4 +138,27 @@ function AlertOnModalExample() {
|
|
|
162
138
|
}
|
|
163
139
|
```
|
|
164
140
|
|
|
141
|
+
## Props
|
|
142
|
+
|
|
143
|
+
| Prop | Type | Required | Default | Description |
|
|
144
|
+
| --- | --- | --- | --- | --- |
|
|
145
|
+
| `body` | `string` | Yes | `-` | Alert body/description |
|
|
146
|
+
| `onRequestClose` | `() => void` | Yes | `-` | Callback function fired when modal is closed. |
|
|
147
|
+
| `preferredActionLabel` | `string` | Yes | `-` | Label of the preferred action |
|
|
148
|
+
| `title` | `string` | Yes | `-` | Alert title |
|
|
149
|
+
| `visible` | `boolean` | Yes | `false false` | Controls visibility of the Modal |
|
|
150
|
+
| `accessibilityLabelledBy` | `string` | No | `-` | On web, maps to aria-labelledby and lists the id(s) of the element(s) that label the element on which the attribute is set. On mobile (Android only), a reference to another element nativeID used to build complex forms. |
|
|
151
|
+
| `actionLayout` | `horizontal \| vertical` | No | `horizontal` | Layout of the actions |
|
|
152
|
+
| `disablePortal` | `boolean` | No | `-` | Disable React portal integration |
|
|
153
|
+
| `dismissActionLabel` | `string` | No | `-` | Label of the dismiss action |
|
|
154
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
155
|
+
| `onDidClose` | `((() => void) & (() => void))` | No | `-` | Callback fired after the component is closed. |
|
|
156
|
+
| `onDismissActionPress` | `(() => void)` | No | `-` | Callback function fired when the dismiss action is pressed |
|
|
157
|
+
| `onPreferredActionPress` | `(() => void)` | No | `-` | Callback function fired when the preferred action is pressed |
|
|
158
|
+
| `pictogram` | `key \| done \| cardSuccess \| warning \| error \| add \| browser \| calculator \| calendar \| checkmark \| clock \| coinbaseOneLogo \| derivativesProduct \| email \| gasFees \| identityCard \| instantUnstakingClock \| laptop \| learningRewardsProduct \| lock \| passport \| paypal \| phone \| planet \| safe \| securityKey \| settings \| shield \| support \| taxes \| tokenSales \| trading \| verifiedPools \| wallet \| 2fa \| accountsNavigation \| accreditedInvestor \| addCard \| addPayment \| addPhone \| addressBook \| addToWatchlist \| addWallet \| advancedTradingDesktop \| advancedTradingNavigation \| advancedTradingRebates \| agent \| alerts \| alertsCoinbaseOne \| analyticsNavigation \| apartOfDropsNft \| applyForHigherLimits \| apyInterest \| assetEncryption \| assetHubNavigation \| assetManagement \| assetManagementNavigation \| assetMeasurements \| assetMovement \| authenticationApp \| authenticator \| authenticatorAlt \| authenticatorProgress \| avatarAa \| avatarAb \| avatarAc \| avatarAd \| avatarAe \| avatarAf \| avatarAg \| avatarAh \| avatarAi \| avatarAj \| avatarBa \| avatarBb \| avatarBc \| avatarBd \| avatarBe \| avatarBf \| avatarBg \| avatarBh \| avatarBi \| avatarBj \| avatarCa \| avatarCb \| avatarCc \| avatarCd \| avatarCe \| avatarCf \| avatarCg \| avatarCh \| avatarCi \| avatarCj \| avatarDa \| avatarDb \| avatarDc \| avatarDd \| avatarDe \| avatarDf \| avatarDg \| avatarDh \| avatarDi \| avatarDj \| avatarEa \| avatarEb \| avatarEc \| avatarEd \| avatarEe \| avatarEf \| avatarEg \| avatarEh \| avatarEi \| avatarEj \| avatarFa \| avatarFb \| avatarFc \| avatarFd \| avatarFe \| avatarFf \| avatarFg \| avatarFh \| avatarFi \| avatarFj \| avatarGa \| avatarGb \| avatarGc \| avatarGd \| avatarGe \| avatarGf \| avatarGg \| avatarGh \| avatarGi \| avatarGj \| avatarHa \| avatarHb \| avatarHc \| avatarHd \| avatarHe \| avatarHf \| avatarHg \| avatarHh \| avatarHi \| avatarHj \| avatarIa \| avatarIb \| avatarIc \| avatarId \| avatarIe \| avatarIf \| avatarIg \| avatarIh \| avatarIi \| avatarIj \| avatarJa \| avatarJb \| avatarJc \| avatarJd \| avatarJe \| avatarJf \| avatarJg \| avatarJh \| avatarJi \| avatarJj \| barChart \| baseChartSmall \| baseCheckSmall \| baseCoinCryptoSmall \| baseCoinNetworkSmall \| baseCoinStack \| baseConnectApps \| baseConnectSmall \| baseDecentralizationSmall \| baseDiamondSmall \| baseDiamondTrophy \| baseEmptySmall \| baseErrorButterflySmall \| baseErrorSmall \| baseLoadingSmall \| baseLocationSmall \| baseLogo \| baseLogoNavigation \| baseMessaging \| baseMintNftSmall \| baseNetworkSmall \| baseNftSmall \| basePaycoinSmall \| basePeopleSmall \| basePiechartSmall \| baseSecuritySmall \| baseSendSmall \| baseSignin \| baseTargetSmall \| bitcoin \| bitcoinPizza \| bitcoinRewards \| bitcoinWhitePaper \| blockchainConnection \| bonusFivePercent \| bonusTwoPercent \| borrowCoins \| borrowingLending \| borrowNavigation \| browserMultiPlatform \| browserTransaction \| bundle \| businessProduct \| calendarCaution \| candleSticksGraph \| cardBlocked \| cardDeclined \| cardNavigation \| cb1BankTransfers \| chart \| chat \| cloudNavigation \| coinbaseLogoAdvancedBrand \| coinbaseLogoNavigation \| coinbaseOneAuthenticator \| coinbaseOneChat \| coinbaseOneEarn \| coinbaseOneEarnCoins \| coinbaseOneEarnCoinsLogo \| coinbaseOneFiat \| coinbaseOneProductIcon \| coinbaseOneProductInvestWeekly \| coinbaseOneRefreshed \| coinbaseOneShield \| coinbaseOneTrade \| coinbaseOneTrusted \| coinbaseOneUnlimitedRewards \| coinbaseUnlockOffers \| coinbaseWalletApp \| coinFocus \| coinShare \| coldStorageCheck \| collectionOfAssets \| commerceCheckout \| commerceInvoice \| commerceNavigation \| completeQuiz \| complianceNavigation \| congratulations \| connectNavigation \| contactInfo \| controlWalletStorage \| creative \| creditCard \| crypto101 \| cryptoCard \| cryptoFolder \| custodialJourney \| custodyNavigation \| dataMarketplaceNavigation \| decentralizationEverything \| decentralizedExchange \| decentralizedIdentity \| decentralizedWeb3 \| defiEarnMoment \| delegate \| delegateNavigation \| derivativesNavigation \| developerPlatformNavigation \| developerSDKNavigation \| directDepositNavigation \| dollarShowcase \| driversLicense \| driversLicenseWheel \| earnCoins \| earnGraph \| earnNavigation \| easyToUse \| economyGlobal \| emailAndMessages \| enableVoting \| envelope \| ethereumFocus \| ethRewards \| ethStaking \| ethStakingChart \| ethStakingRewards \| ethToken \| exchangeNavigation \| explore \| fast \| faucetNavigation \| feesRestriction \| fiat \| finance \| findYourSelection \| formDownload \| futures \| futuresCoinbaseOne \| gem \| genericCountryIDCard \| getStarted \| giftbox \| globalConnections \| globalPayments \| globalTransactions \| googleAuthenticator \| governance \| hardwareWallet \| helpCenterNavigation \| higherLimits \| holdingCoin \| idBlock \| idError \| idVerification \| increaseLimits \| institutionalNavigation \| institutions \| internationalExchangeNavigation \| internet \| investGraph \| laptopCharts \| laptopVideo \| layerNetworks \| leadGraph \| learn \| learningRewardsNavigation \| lightbulbLearn \| lightningNetworkSend \| linkYourAccount \| listingFees \| locationUsa \| lowFees \| manageWeb3SignersAcct \| miningCoins \| mintedNft \| mobileCharts \| mobileError \| mobileNotifcation \| mobileSuccess \| mobileWarning \| moneyEarn \| moneySwift \| monitoringPerformance \| moreThanBitcoin \| multiAccountsAndCards \| multiPlatform \| multipleAssets \| musicAndSounds \| myNumberCard \| newUserChecklistBuyCrypto \| newUserChecklistCompleteAccount \| newUserChecklistVerifyId \| nftAvatar \| nftLibrary \| nftNavigation \| noAnnualFee \| noNftFound \| notificationHubAnalysis \| notificationHubNews \| notificationHubPortfolio \| notificationHubSocial \| notifications \| noVisibility \| noWiFi \| orders \| outage \| partialCoins \| participateNavigation \| passwordWalletLocked \| payNavigation \| peerToPeer \| pieChart \| pizza \| pluginBrowser \| positiveReviews \| predictionMarkets \| premiumInvestor \| priceTracking \| primeMobileApp \| primeNavigation \| privateClientNavigation \| proNavigation \| protectionPlan \| queryTransactNavigation \| receipt \| recurringPurchases \| restaking \| reviewAndAdd \| rewardsNavigation \| riskStaking \| rosettaNavigation \| securedAssets \| security \| securityCoinShield \| seedPhrase \| selectAddNft \| selfCustodyWallet \| selfServe \| sellSendAnytime \| sendPaymentToOthers \| settled \| sideChainSide \| signInNavigation \| smsAuthenticate \| sparkleCoinbaseOne \| ssnCard \| stableCoinMetaphor \| stacking \| stakingGraph \| standWithCryptoLogoNavigation \| startToday \| strongInfo \| strongWarning \| successPhone \| supportChat \| takeQuiz \| target \| taxBeta \| taxCenterNavigation \| taxesArrangement \| taxSeason \| timingCheck \| tokenBaskets \| transferSend \| transistor \| trendingAssets \| trusted \| tryAgainLater \| twoBonus \| typeScript \| ubiKey \| usaProduct \| usdcEarn \| usdcInterest \| usdcLoan \| usdcLogo \| usdcRewards \| usdcRewardsRibbon \| usdcToken \| venturesNavigation \| videoCalendar \| videoContent \| waiting \| waitingForConsensus \| walletAsServiceNavigation \| walletDeposit \| walletError \| walletExchange \| walletLinkNavigation \| walletLogoNavigation \| walletNavigation \| walletPassword \| walletSuccess \| walletWarning \| winBTC \| worldwide \| wrapEth` | No | `-` | Illustration pictogram name for alert |
|
|
159
|
+
| `preferredActionVariant` | `primary \| negative` | No | `primary` | Button variant of the preferred action |
|
|
160
|
+
| `ref` | `((instance: ModalRefBaseProps \| null) => void) \| RefObject<ModalRefBaseProps> \| null` | No | `-` | - |
|
|
161
|
+
| `stacked` | `boolean` | No | `-` | Indicating if Alert is stacked on top of Modal |
|
|
162
|
+
| `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 |
|
|
163
|
+
|
|
165
164
|
|