@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,173 @@
|
|
|
1
|
+
# Spacer
|
|
2
|
+
|
|
3
|
+
Creates space between elements.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Spacer } from '@coinbase/cds-web/layout/Spacer'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Vertical Spacer
|
|
14
|
+
|
|
15
|
+
```tsx live
|
|
16
|
+
<VStack>
|
|
17
|
+
<Box padding={2} background="bgAlternate" borderRadius="300">
|
|
18
|
+
Box 1
|
|
19
|
+
</Box>
|
|
20
|
+
<Spacer vertical={2} />
|
|
21
|
+
<Box padding={2} background="bgAlternate" borderRadius="300">
|
|
22
|
+
Box 2
|
|
23
|
+
</Box>
|
|
24
|
+
<Spacer vertical={4} />
|
|
25
|
+
<Box padding={2} background="bgAlternate" borderRadius="300">
|
|
26
|
+
Box 3
|
|
27
|
+
</Box>
|
|
28
|
+
<Spacer vertical={6} />
|
|
29
|
+
<Box padding={2} background="bgAlternate" borderRadius="300">
|
|
30
|
+
Box 4
|
|
31
|
+
</Box>
|
|
32
|
+
</VStack>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Horizontal Spacer
|
|
36
|
+
|
|
37
|
+
```tsx live
|
|
38
|
+
<HStack>
|
|
39
|
+
<Box padding={2} background="bgAlternate" borderRadius="300">
|
|
40
|
+
Box 1
|
|
41
|
+
</Box>
|
|
42
|
+
<Spacer horizontal={2} />
|
|
43
|
+
<Box padding={2} background="bgAlternate" borderRadius="300">
|
|
44
|
+
Box 2
|
|
45
|
+
</Box>
|
|
46
|
+
<Spacer horizontal={4} display={{ base: 'none', tablet: 'block', desktop: 'block' }} />
|
|
47
|
+
<Box
|
|
48
|
+
padding={2}
|
|
49
|
+
background="bgAlternate"
|
|
50
|
+
borderRadius="300"
|
|
51
|
+
display={{ base: 'none', tablet: 'block', desktop: 'block' }}
|
|
52
|
+
>
|
|
53
|
+
Box 3
|
|
54
|
+
</Box>
|
|
55
|
+
<Spacer horizontal={6} display={{ base: 'none', tablet: 'block', desktop: 'block' }} />
|
|
56
|
+
<Box
|
|
57
|
+
padding={2}
|
|
58
|
+
background="bgAlternate"
|
|
59
|
+
borderRadius="300"
|
|
60
|
+
display={{ base: 'none', tablet: 'block', desktop: 'block' }}
|
|
61
|
+
>
|
|
62
|
+
Box 4
|
|
63
|
+
</Box>
|
|
64
|
+
</HStack>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Props
|
|
68
|
+
|
|
69
|
+
| Prop | Type | Required | Default | Description |
|
|
70
|
+
| --- | --- | --- | --- | --- |
|
|
71
|
+
| `alignContent` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
72
|
+
| `alignItems` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
73
|
+
| `alignSelf` | `ResponsiveProp<center \| normal \| auto \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
74
|
+
| `as` | `symbol \| object \| style \| svg \| a \| abbr \| address \| area \| article \| aside \| audio \| b \| base \| bdi \| bdo \| big \| blockquote \| body \| br \| button \| canvas \| caption \| center \| cite \| code \| col \| colgroup \| data \| datalist \| dd \| del \| details \| dfn \| dialog \| div \| dl \| dt \| em \| embed \| fieldset \| figcaption \| figure \| footer \| form \| h1 \| h2 \| h3 \| h4 \| h5 \| h6 \| head \| header \| hgroup \| hr \| html \| i \| iframe \| img \| input \| ins \| kbd \| keygen \| label \| legend \| li \| link \| main \| map \| mark \| menu \| menuitem \| meta \| meter \| nav \| noindex \| noscript \| ol \| optgroup \| option \| output \| p \| param \| picture \| pre \| progress \| q \| rp \| rt \| ruby \| s \| samp \| search \| slot \| script \| section \| select \| small \| source \| span \| strong \| sub \| summary \| sup \| table \| template \| tbody \| td \| textarea \| tfoot \| th \| thead \| time \| title \| tr \| track \| u \| ul \| var \| video \| wbr \| webview \| animate \| animateMotion \| animateTransform \| circle \| clipPath \| defs \| desc \| ellipse \| feBlend \| feColorMatrix \| feComponentTransfer \| feComposite \| feConvolveMatrix \| feDiffuseLighting \| feDisplacementMap \| feDistantLight \| feDropShadow \| feFlood \| feFuncA \| feFuncB \| feFuncG \| feFuncR \| feGaussianBlur \| feImage \| feMerge \| feMergeNode \| feMorphology \| feOffset \| fePointLight \| feSpecularLighting \| feSpotLight \| feTile \| feTurbulence \| filter \| foreignObject \| g \| image \| line \| linearGradient \| marker \| mask \| metadata \| mpath \| path \| pattern \| polygon \| polyline \| radialGradient \| rect \| set \| stop \| switch \| text \| textPath \| tspan \| use \| view \| ComponentClass<any, any> \| FunctionComponent<any>` | No | `-` | - |
|
|
75
|
+
| `aspectRatio` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
76
|
+
| `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 | `-` | - |
|
|
77
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
78
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
79
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
80
|
+
| `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 | `-` | - |
|
|
81
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
82
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
83
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
84
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
85
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
86
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
87
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
88
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
89
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
90
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
91
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
92
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
93
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
94
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
95
|
+
| `bottom` | `ResponsiveProp<Bottom<string \| number>>` | No | `-` | - |
|
|
96
|
+
| `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 | `-` | - |
|
|
97
|
+
| `columnGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
98
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
99
|
+
| `display` | `ResponsiveProp<grid \| revert \| none \| block \| inline \| inline-block \| flex \| inline-flex \| inline-grid \| contents \| flow-root \| list-item>` | No | `-` | - |
|
|
100
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | - |
|
|
101
|
+
| `flexBasis` | `ResponsiveProp<FlexBasis<string \| number>>` | No | `-` | - |
|
|
102
|
+
| `flexDirection` | `ResponsiveProp<column \| row \| row-reverse \| column-reverse>` | No | `-` | - |
|
|
103
|
+
| `flexGrow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
104
|
+
| `flexShrink` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
105
|
+
| `flexWrap` | `ResponsiveProp<nowrap \| wrap \| wrap-reverse>` | No | `-` | - |
|
|
106
|
+
| `font` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
107
|
+
| `fontFamily` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
108
|
+
| `fontSize` | `ResponsiveProp<FontSize \| inherit>` | No | `-` | - |
|
|
109
|
+
| `fontWeight` | `ResponsiveProp<FontWeight \| inherit>` | No | `-` | - |
|
|
110
|
+
| `gap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
111
|
+
| `grid` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
112
|
+
| `gridArea` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
113
|
+
| `gridAutoColumns` | `ResponsiveProp<GridAutoColumns<string \| number>>` | No | `-` | - |
|
|
114
|
+
| `gridAutoFlow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| row \| column \| dense` | No | `-` | - |
|
|
115
|
+
| `gridAutoRows` | `ResponsiveProp<GridAutoRows<string \| number>>` | No | `-` | - |
|
|
116
|
+
| `gridColumn` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
117
|
+
| `gridColumnEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
118
|
+
| `gridColumnStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
119
|
+
| `gridRow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
120
|
+
| `gridRowEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
121
|
+
| `gridRowStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
122
|
+
| `gridTemplate` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
123
|
+
| `gridTemplateAreas` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
124
|
+
| `gridTemplateColumns` | `ResponsiveProp<GridTemplateColumns<string \| number>>` | No | `-` | - |
|
|
125
|
+
| `gridTemplateRows` | `ResponsiveProp<GridTemplateRows<string \| number>>` | No | `-` | - |
|
|
126
|
+
| `height` | `ResponsiveProp<Height<string \| number>>` | No | `-` | - |
|
|
127
|
+
| `horizontal` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Space in the horizontal direction |
|
|
128
|
+
| `justifyContent` | `ResponsiveProp<left \| right \| center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
129
|
+
| `left` | `ResponsiveProp<Left<string \| number>>` | No | `-` | - |
|
|
130
|
+
| `lineHeight` | `ResponsiveProp<LineHeight \| inherit>` | No | `-` | - |
|
|
131
|
+
| `margin` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
132
|
+
| `marginBottom` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
133
|
+
| `marginEnd` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
134
|
+
| `marginStart` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
135
|
+
| `marginTop` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
136
|
+
| `marginX` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
137
|
+
| `marginY` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
138
|
+
| `maxHeight` | `ResponsiveProp<MaxHeight<string \| number>>` | No | `-` | - |
|
|
139
|
+
| `maxHorizontal` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Max space in the horizontal direction |
|
|
140
|
+
| `maxVertical` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Max space in the vertical direction |
|
|
141
|
+
| `maxWidth` | `ResponsiveProp<MaxWidth<string \| number>>` | No | `-` | - |
|
|
142
|
+
| `minHeight` | `ResponsiveProp<MinHeight<string \| number>>` | No | `-` | - |
|
|
143
|
+
| `minHorizontal` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Min space in the horizontal direction |
|
|
144
|
+
| `minVertical` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Min space in the vertical direction |
|
|
145
|
+
| `minWidth` | `ResponsiveProp<MinWidth<string \| number>>` | No | `-` | - |
|
|
146
|
+
| `opacity` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
147
|
+
| `overflow` | `ResponsiveProp<hidden \| auto \| visible \| clip \| scroll>` | No | `-` | - |
|
|
148
|
+
| `padding` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
149
|
+
| `paddingBottom` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
150
|
+
| `paddingEnd` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
151
|
+
| `paddingStart` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
152
|
+
| `paddingTop` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
153
|
+
| `paddingX` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
154
|
+
| `paddingY` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
155
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
156
|
+
| `position` | `ResponsiveProp<fixed \| static \| relative \| absolute \| sticky>` | No | `-` | - |
|
|
157
|
+
| `ref` | `any` | No | `-` | - |
|
|
158
|
+
| `right` | `ResponsiveProp<Right<string \| number>>` | No | `-` | - |
|
|
159
|
+
| `rowGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
160
|
+
| `style` | `CSSProperties` | No | `-` | - |
|
|
161
|
+
| `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 |
|
|
162
|
+
| `textAlign` | `ResponsiveProp<center \| start \| end \| justify>` | No | `-` | - |
|
|
163
|
+
| `textDecoration` | `ResponsiveProp<none \| underline \| overline \| line-through \| underline overline \| underline double>` | No | `-` | - |
|
|
164
|
+
| `textTransform` | `ResponsiveProp<capitalize \| lowercase \| none \| uppercase>` | No | `-` | - |
|
|
165
|
+
| `top` | `ResponsiveProp<Top<string \| number>>` | No | `-` | - |
|
|
166
|
+
| `transform` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
167
|
+
| `userSelect` | `ResponsiveProp<text \| none \| auto \| all>` | No | `-` | - |
|
|
168
|
+
| `vertical` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Space in the vertical direction |
|
|
169
|
+
| `visibility` | `ResponsiveProp<hidden \| visible>` | No | `-` | - |
|
|
170
|
+
| `width` | `ResponsiveProp<Width<string \| number>>` | No | `-` | - |
|
|
171
|
+
| `zIndex` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
172
|
+
|
|
173
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Sparkline
|
|
2
|
+
|
|
3
|
+
A small line chart component for displaying data trends.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Sparkline } from '@coinbase/cds-web-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Basic Example
|
|
14
|
+
|
|
15
|
+
The global warning banner is used to communicate important alerts or warnings to users across the entire platform, ensuring universal visibility and building trust.
|
|
16
|
+
|
|
17
|
+
```jsx live
|
|
18
|
+
function Example() {
|
|
19
|
+
const dimensions = { width: 64, height: 20 };
|
|
20
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
21
|
+
return (
|
|
22
|
+
<ListCell
|
|
23
|
+
media={<CellMedia type="image" source={assets.btc.imageUrl} title="BTC" />}
|
|
24
|
+
intermediary={<Sparkline {...dimensions} path={path} color={assets.btc.color} />}
|
|
25
|
+
title={assets.btc.name}
|
|
26
|
+
description={assets.btc.symbol}
|
|
27
|
+
detail={prices[0]}
|
|
28
|
+
subdetail="+4.55%"
|
|
29
|
+
variant="positive"
|
|
30
|
+
onClick={() => console.log('clicked')}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Dynamic path colors
|
|
37
|
+
|
|
38
|
+
```jsx live
|
|
39
|
+
function Example() {
|
|
40
|
+
const dimensions = { width: 400, height: 200 };
|
|
41
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
42
|
+
return (
|
|
43
|
+
<VStack gap={2}>
|
|
44
|
+
{assetColors.map((color) => (
|
|
45
|
+
<Sparkline key={color} {...dimensions} path={path} color={color} />
|
|
46
|
+
))}
|
|
47
|
+
</VStack>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Dynamic background colors
|
|
53
|
+
|
|
54
|
+
```jsx live
|
|
55
|
+
function Example() {
|
|
56
|
+
const dimensions = { width: 400, height: 200 };
|
|
57
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
58
|
+
return (
|
|
59
|
+
<VStack gap={2}>
|
|
60
|
+
{assetColors.map((background) => (
|
|
61
|
+
<VStack key={background} dangerouslySetBackground={background}>
|
|
62
|
+
<Sparkline {...dimensions} path={path} background={background} color="auto" />
|
|
63
|
+
</VStack>
|
|
64
|
+
))}
|
|
65
|
+
</VStack>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### y axis scaling
|
|
71
|
+
|
|
72
|
+
```jsx live
|
|
73
|
+
function Example() {
|
|
74
|
+
const yAxisScalingFactor = 0.2;
|
|
75
|
+
const dimensions = { width: 400, height: 200 };
|
|
76
|
+
const path = useSparklinePath({ ...dimensions, data: prices, yAxisScalingFactor });
|
|
77
|
+
return (
|
|
78
|
+
<VStack gap={2}>
|
|
79
|
+
<TextLabel1 as="p">Scale {yAxisScalingFactor}</TextLabel1>
|
|
80
|
+
<Sparkline {...dimensions} path={path} color="auto" yAxisScalingFactor={yAxisScalingFactor} />
|
|
81
|
+
</VStack>
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Sparkline fill
|
|
87
|
+
|
|
88
|
+
```jsx live
|
|
89
|
+
function Example() {
|
|
90
|
+
const dimensions = { width: 400, height: 200 };
|
|
91
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
92
|
+
const area = useSparklineArea({ ...dimensions, data: prices });
|
|
93
|
+
return (
|
|
94
|
+
<VStack gap={2}>
|
|
95
|
+
{assetColors.map((color) => (
|
|
96
|
+
<Sparkline key={color} {...dimensions} path={path} color={color}>
|
|
97
|
+
<SparklineArea area={area} />
|
|
98
|
+
</Sparkline>
|
|
99
|
+
))}
|
|
100
|
+
</VStack>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Props
|
|
106
|
+
|
|
107
|
+
| Prop | Type | Required | Default | Description |
|
|
108
|
+
| --- | --- | --- | --- | --- |
|
|
109
|
+
| `color` | `string` | Yes | `-` | The color of the Sparkline graphs line. Accepts any raw color value (hex, rgba, hsl, etc) or auto. Using auto dynamically selects black or white for optimal accessibility. Does not work with CDS theme color names like fgPrimary or CSS variables. |
|
|
110
|
+
| `height` | `number` | Yes | `-` | Height of the Sparkline |
|
|
111
|
+
| `width` | `number` | Yes | `-` | Width of the Sparkline |
|
|
112
|
+
| `background` | `string` | No | `-` | - |
|
|
113
|
+
| `children` | `null \| false \| ReactElement<SparklineAreaBaseProps, string \| JSXElementConstructor<any>> \| OptionalElement<SparklineAreaBaseProps>[]` | No | `-` | an optional SparklineArea that can be used to fill in the Sparkline |
|
|
114
|
+
| `fillType` | `dotted \| gradient \| gradientDotted` | No | `'dotted'` | Type of fill to use for the area |
|
|
115
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
116
|
+
| `path` | `string` | No | `-` | Svg path as string. CDS offers a useSparklinePath which is useful to generate this string. This is accessible via import { useSparklinePath } from @coinbase/cds-common/visualizations/useSparklinePath;. Alternatively, you can use product tailored tooling to generate the SVG path. This component only requires a valid path string is provided. |
|
|
117
|
+
| `ref` | `((instance: SparklinePathRef) => void) \| RefObject<SparklinePathRef> \| null` | No | `-` | - |
|
|
118
|
+
| `strokeType` | `solid \| gradient` | No | `'solid'` | Type of stroke to use for the line |
|
|
119
|
+
| `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 |
|
|
120
|
+
| `yAxisScalingFactor` | `number` | No | `-` | Scales the sparkline to show more or less variance. Use a number less than 1 for less variance and a number greater than 1 for more variance. If you use a number greater than 1 it may clip the boundaries of the sparkline. |
|
|
121
|
+
|
|
122
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# SparklineGradient
|
|
2
|
+
|
|
3
|
+
A small line chart component with gradient fill below the line.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { SparklineGradient } from '@coinbase/cds-web-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
Expands upon the [Sparkline](/components/graphs/Sparkline) component to provide a gradient stroke. However, for dark mode we disable the gradient effect. These are typically used at a larger size for portfolio charts or on detail Asset pages.
|
|
14
|
+
|
|
15
|
+
### Dynamic path colors
|
|
16
|
+
|
|
17
|
+
```jsx live
|
|
18
|
+
function Example() {
|
|
19
|
+
const dimensions = { width: 400, height: 200 };
|
|
20
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
21
|
+
return (
|
|
22
|
+
<VStack gap={2}>
|
|
23
|
+
{assetColors.map((color) => (
|
|
24
|
+
<SparklineGradient key={color} {...dimensions} path={path} color={color} />
|
|
25
|
+
))}
|
|
26
|
+
</VStack>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Dynamic background colors
|
|
32
|
+
|
|
33
|
+
```jsx live
|
|
34
|
+
function Example() {
|
|
35
|
+
const dimensions = { width: 400, height: 200 };
|
|
36
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
37
|
+
return (
|
|
38
|
+
<VStack gap={2}>
|
|
39
|
+
{assetColors.map((background) => (
|
|
40
|
+
<VStack key={background} dangerouslySetBackground={background}>
|
|
41
|
+
<SparklineGradient {...dimensions} path={path} background={background} color="auto" />
|
|
42
|
+
</VStack>
|
|
43
|
+
))}
|
|
44
|
+
</VStack>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### y axis scaling
|
|
50
|
+
|
|
51
|
+
```jsx live
|
|
52
|
+
function Example() {
|
|
53
|
+
const yAxisScalingFactor = 0.2;
|
|
54
|
+
const dimensions = { width: 400, height: 200 };
|
|
55
|
+
const path = useSparklinePath({ ...dimensions, data: prices, yAxisScalingFactor });
|
|
56
|
+
return (
|
|
57
|
+
<VStack gap={2}>
|
|
58
|
+
<TextLabel1 as="p">Scale {yAxisScalingFactor}</TextLabel1>
|
|
59
|
+
<SparklineGradient
|
|
60
|
+
{...dimensions}
|
|
61
|
+
path={path}
|
|
62
|
+
color="auto"
|
|
63
|
+
yAxisScalingFactor={yAxisScalingFactor}
|
|
64
|
+
/>
|
|
65
|
+
</VStack>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Sparkline fill
|
|
71
|
+
|
|
72
|
+
```jsx live
|
|
73
|
+
function Example() {
|
|
74
|
+
const dimensions = { width: 400, height: 200 };
|
|
75
|
+
const path = useSparklinePath({ ...dimensions, data: prices });
|
|
76
|
+
const area = useSparklineArea({ ...dimensions, data: prices });
|
|
77
|
+
return (
|
|
78
|
+
<VStack gap={2}>
|
|
79
|
+
{assetColors.map((color) => (
|
|
80
|
+
<SparklineGradient key={color} {...dimensions} path={path} color={color}>
|
|
81
|
+
<SparklineArea area={area} />
|
|
82
|
+
</SparklineGradient>
|
|
83
|
+
))}
|
|
84
|
+
</VStack>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Props
|
|
90
|
+
|
|
91
|
+
| Prop | Type | Required | Default | Description |
|
|
92
|
+
| --- | --- | --- | --- | --- |
|
|
93
|
+
| `color` | `string` | Yes | `-` | The color of the Sparkline graphs line. Accepts any raw color value (hex, rgba, hsl, etc) or auto. Using auto dynamically selects black or white for optimal accessibility. Does not work with CDS theme color names like fgPrimary or CSS variables. |
|
|
94
|
+
| `height` | `number` | Yes | `-` | Height of the Sparkline |
|
|
95
|
+
| `width` | `number` | Yes | `-` | Width of the Sparkline |
|
|
96
|
+
| `background` | `string` | No | `-` | - |
|
|
97
|
+
| `children` | `null \| false \| ReactElement<SparklineAreaBaseProps, string \| JSXElementConstructor<any>> \| OptionalElement<SparklineAreaBaseProps>[]` | No | `-` | an optional SparklineArea that can be used to fill in the Sparkline |
|
|
98
|
+
| `fillType` | `dotted \| gradient \| gradientDotted` | No | `'dotted'` | Type of fill to use for the area |
|
|
99
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
100
|
+
| `path` | `string` | No | `-` | Svg path as string. CDS offers a useSparklinePath which is useful to generate this string. This is accessible via import { useSparklinePath } from @coinbase/cds-common/visualizations/useSparklinePath;. Alternatively, you can use product tailored tooling to generate the SVG path. This component only requires a valid path string is provided. |
|
|
101
|
+
| `ref` | `((instance: SparklinePathRef) => void) \| RefObject<SparklinePathRef> \| null` | No | `-` | - |
|
|
102
|
+
| `strokeType` | `solid \| gradient` | No | `'solid'` | Type of stroke to use for the line |
|
|
103
|
+
| `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 |
|
|
104
|
+
| `yAxisScalingFactor` | `number` | No | `-` | Scales the sparkline to show more or less variance. Use a number less than 1 for less variance and a number greater than 1 for more variance. If you use a number greater than 1 it may clip the boundaries of the sparkline. |
|
|
105
|
+
|
|
106
|
+
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# SparklineInteractive
|
|
2
|
+
|
|
3
|
+
The SparklineInteractive is used to display a Sparkline that has multiple time periods
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { SparklineInteractive } from '@coinbase/cds-web-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Default usage
|
|
14
|
+
|
|
15
|
+
```jsx live
|
|
16
|
+
<Box padding={3} width="100%">
|
|
17
|
+
<SparklineInteractivePrice data={sparklineInteractiveData} strokeColor="#F7931A" />
|
|
18
|
+
</Box>
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Fill Type
|
|
22
|
+
|
|
23
|
+
The fill will be added by default with a gradient style. You can set `fillType="dotted"` to get a dotted gradient fill.
|
|
24
|
+
|
|
25
|
+
```jsx live
|
|
26
|
+
<Box padding={3} width="100%">
|
|
27
|
+
<SparklineInteractivePrice
|
|
28
|
+
fill
|
|
29
|
+
data={sparklineInteractiveData}
|
|
30
|
+
fillType="dotted"
|
|
31
|
+
strokeColor="#F7931A"
|
|
32
|
+
/>
|
|
33
|
+
</Box>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Compact
|
|
37
|
+
|
|
38
|
+
```jsx live
|
|
39
|
+
<Box padding={3} width="100%">
|
|
40
|
+
<SparklineInteractivePrice data={sparklineInteractiveData} compact strokeColor="#F7931A" />
|
|
41
|
+
</Box>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Hide period selector
|
|
45
|
+
|
|
46
|
+
```jsx live
|
|
47
|
+
<Box padding={3} width="100%">
|
|
48
|
+
<SparklineInteractivePrice
|
|
49
|
+
data={sparklineInteractiveData}
|
|
50
|
+
hidePeriodSelector
|
|
51
|
+
strokeColor="#F7931A"
|
|
52
|
+
/>
|
|
53
|
+
</Box>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Scaling Factor
|
|
57
|
+
|
|
58
|
+
The scaling factor is usually used when you want to show less variance in the chart. An example of this is a stable coin that doesn't change price by more than a few cents.
|
|
59
|
+
|
|
60
|
+
```jsx live
|
|
61
|
+
<Box padding={3} width="100%">
|
|
62
|
+
<SparklineInteractivePrice
|
|
63
|
+
data={sparklineInteractiveData}
|
|
64
|
+
strokeColor="#F7931A"
|
|
65
|
+
yAxisScalingFactor={0.1}
|
|
66
|
+
/>
|
|
67
|
+
</Box>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### With header
|
|
71
|
+
|
|
72
|
+
```jsx live
|
|
73
|
+
<Box padding={3} width="100%">
|
|
74
|
+
<SparklineInteractivePriceWithHeader data={sparklineInteractiveData} fill strokeColor="#F7931A" />
|
|
75
|
+
</Box>
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Custom hover data
|
|
79
|
+
|
|
80
|
+
```jsx live
|
|
81
|
+
<Box padding={3} width="100%">
|
|
82
|
+
<SparklineInteractivePrice
|
|
83
|
+
fill
|
|
84
|
+
data={sparklineInteractiveData}
|
|
85
|
+
hoverData={sparklineInteractiveHoverData}
|
|
86
|
+
strokeColor="#F7931A"
|
|
87
|
+
/>
|
|
88
|
+
</Box>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Period selector placement
|
|
92
|
+
|
|
93
|
+
`periodSelectorPlacement` can be used to place the period selector in different positions (`above` or `below`).
|
|
94
|
+
|
|
95
|
+
```jsx live
|
|
96
|
+
<Box padding={3} width="100%">
|
|
97
|
+
<SparklineInteractivePrice
|
|
98
|
+
data={sparklineInteractiveData}
|
|
99
|
+
strokeColor="#F7931A"
|
|
100
|
+
periodSelectorPlacement="below"
|
|
101
|
+
/>
|
|
102
|
+
</Box>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Custom styles
|
|
106
|
+
|
|
107
|
+
You can also provide custom styles, such as to remove any horizontal padding from the header.
|
|
108
|
+
|
|
109
|
+
```jsx live
|
|
110
|
+
<Box padding={3} width="100%">
|
|
111
|
+
<SparklineInteractivePriceWithHeader
|
|
112
|
+
data={sparklineInteractiveData}
|
|
113
|
+
fill
|
|
114
|
+
strokeColor="#F7931A"
|
|
115
|
+
styles={{ header: { paddingLeft: 0, paddingRight: 0 } }}
|
|
116
|
+
/>
|
|
117
|
+
</Box>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Props
|
|
121
|
+
|
|
122
|
+
| Prop | Type | Required | Default | Description |
|
|
123
|
+
| --- | --- | --- | --- | --- |
|
|
124
|
+
| `defaultPeriod` | `string` | Yes | `-` | default period value that the chart will use |
|
|
125
|
+
| `formatDate` | `ChartFormatDate<Period>` | Yes | `-` | function used to format the date that is shown in the bottom of the chart as the user scrubs |
|
|
126
|
+
| `periods` | `{ label: string; value: Period; }[]` | Yes | `-` | A list of periods that the chart will use. label is what is shown in the bottom of the chart and the value is the key. |
|
|
127
|
+
| `strokeColor` | `string` | Yes | `-` | Color of the line* |
|
|
128
|
+
| `className` | `string` | No | `-` | Custom class name for the root element. |
|
|
129
|
+
| `classNames` | `{ header?: string; root?: string \| undefined; } \| undefined` | No | `-` | Custom class names for the component. |
|
|
130
|
+
| `compact` | `boolean` | No | `false` | Show the chart in compact height |
|
|
131
|
+
| `data` | `Record<Period, ChartData>` | No | `-` | Chart data bucketed by Period. Period is a string key |
|
|
132
|
+
| `disableScrubbing` | `boolean` | No | `false` | Disables the scrub user interaction from the chart |
|
|
133
|
+
| `fallback` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Fallback shown in the chart when data is not available. This is usually a loading state. |
|
|
134
|
+
| `fallbackType` | `positive \| negative` | No | `-` | If you use the default fallback then this specifies if the fallback line is decreasing or increasing |
|
|
135
|
+
| `fill` | `boolean` | No | `true` | Adds an area fill to the Sparkline |
|
|
136
|
+
| `fillType` | `dotted \| gradient` | No | `'gradient'` | Type of fill to use for the area |
|
|
137
|
+
| `formatHoverDate` | `((date: Date, period: Period) => string)` | No | `-` | Formats the date above the chart as you scrub. Omit this if you dont want to show the date as the user scrubs |
|
|
138
|
+
| `formatHoverPrice` | `((price: number) => string)` | No | `-` | Formats the price above the chart as you scrub. Omit this if you dont want to show the price as the user scrubs |
|
|
139
|
+
| `headerNode` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | Adds a header node above the chart. It will be placed next to the period selector on web. |
|
|
140
|
+
| `headerTestID` | `string` | No | `-` | Test ID for the header |
|
|
141
|
+
| `hidePeriodSelector` | `boolean` | No | `false` | Hides the period selector at the bottom of the chart |
|
|
142
|
+
| `hoverData` | `Record<Period, ChartTimeseries[]>` | No | `-` | Optional data to show on hover/scrub instead of the original sparkline. This allows multiple timeseries lines. Period => timeseries list |
|
|
143
|
+
| `onPeriodChanged` | `((period: Period) => void)` | No | `-` | Callback when the user selects a new period. |
|
|
144
|
+
| `onScrub` | `((params: ChartScrubParams<Period>) => void)` | No | `-` | Callback used when the user is scrubbing. This will be called for every data point change. |
|
|
145
|
+
| `onScrubEnd` | `(() => void)` | No | `-` | Callback when a user finishes scrubbing |
|
|
146
|
+
| `onScrubStart` | `(() => void)` | No | `-` | Callback when the user starts scrubbing |
|
|
147
|
+
| `periodSelectorPlacement` | `above \| below` | No | `-` | Optional placement prop that position the period selector component above or below the chart |
|
|
148
|
+
| `style` | `CSSProperties` | No | `-` | Custom styles for the root element. |
|
|
149
|
+
| `styles` | `{ header?: CSSProperties; root?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for the component. |
|
|
150
|
+
| `timePeriodGutter` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | Optional gutter to add to the Period selector. This is useful if you choose to use the full screen width for the chart |
|
|
151
|
+
| `yAxisScalingFactor` | `number` | No | `-` | Scales the sparkline to show more or less variance. Use a number less than 1 for less variance and a number greater than 1 for more variance. If you use a number greater than 1 it may clip the boundaries of the sparkline. |
|
|
152
|
+
|
|
153
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# SparklineInteractiveHeader
|
|
2
|
+
|
|
3
|
+
The SparklineInteractiveHeader is used to display chart information that changes over time
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { SparklineInteractiveHeader } from '@coinbase/cds-web-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
:::tip Accessibility tip
|
|
14
|
+
When possible combining content that is contextually related benefits screen reader users. The interactive header within Sparkline is one of these moments. Use an accessibilityLabel prop or aria-label to set the entire context of the interactive header. This way screen reader users will hear the asset name, price, and direction all in one sentence.
|
|
15
|
+
:::
|
|
16
|
+
|
|
17
|
+
### Default usage
|
|
18
|
+
|
|
19
|
+
```jsx live
|
|
20
|
+
<Box padding={3} width="100%">
|
|
21
|
+
<SparklineInteractivePriceWithHeader data={sparklineInteractiveData} strokeColor="#F7931A" />
|
|
22
|
+
</Box>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Fill
|
|
26
|
+
|
|
27
|
+
The fill will be added by default
|
|
28
|
+
|
|
29
|
+
```jsx live
|
|
30
|
+
<Box padding={3} width="100%">
|
|
31
|
+
<SparklineInteractivePriceWithHeader data={sparklineInteractiveData} fill strokeColor="#F7931A" />
|
|
32
|
+
</Box>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Compact
|
|
36
|
+
|
|
37
|
+
```jsx live
|
|
38
|
+
<Box padding={3} width="100%">
|
|
39
|
+
<SparklineInteractivePriceWithHeader
|
|
40
|
+
compact
|
|
41
|
+
fill
|
|
42
|
+
strokeColor="#F7931A"
|
|
43
|
+
data={sparklineInteractiveData}
|
|
44
|
+
/>
|
|
45
|
+
</Box>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Custom Label
|
|
49
|
+
|
|
50
|
+
```jsx live
|
|
51
|
+
<Box padding={3} width="100%">
|
|
52
|
+
<SparklineInteractivePriceWithHeader
|
|
53
|
+
data={sparklineInteractiveData}
|
|
54
|
+
strokeColor="#F7931A"
|
|
55
|
+
labelNode={
|
|
56
|
+
<HStack gap={1} alignItems="center">
|
|
57
|
+
<Icon active name="wallet" size="s" />
|
|
58
|
+
<TextTitle3 as="span">CustomHeader</TextTitle3>
|
|
59
|
+
</HStack>
|
|
60
|
+
}
|
|
61
|
+
/>
|
|
62
|
+
</Box>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Props
|
|
66
|
+
|
|
67
|
+
| Prop | Type | Required | Default | Description |
|
|
68
|
+
| --- | --- | --- | --- | --- |
|
|
69
|
+
| `percent` | `string` | Yes | `-` | Free form percentage change |
|
|
70
|
+
| `sign` | ` \| positive \| negative \| upwardTrend \| downwardTrend` | Yes | `-` | Sign to denote the change in price |
|
|
71
|
+
| `variant` | `positive \| negative \| foregroundMuted` | Yes | `-` | The variant to use for the price and percentage change |
|
|
72
|
+
| `accessibilityLabel` | `string` | No | `-` | The accessibilityLabel to show for the price and / or percentage change. This should be localized |
|
|
73
|
+
| `accessoryText` | `string` | No | `-` | The accessoryText to show after the price and / or percentage change. An example is All time |
|
|
74
|
+
| `priceChange` | `string` | No | `-` | Show the dollar amount of price change |
|
|
75
|
+
|
|
76
|
+
|