@coinbase/cds-mcp-server 8.17.2 → 8.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/mcp-docs/mobile/components/Accordion.txt +189 -0
- package/mcp-docs/mobile/components/AccordionItem.txt +30 -0
- package/mcp-docs/mobile/components/Alert.txt +156 -0
- package/mcp-docs/mobile/components/AreaChart.txt +266 -0
- package/mcp-docs/mobile/components/Avatar.txt +196 -0
- package/mcp-docs/mobile/components/AvatarButton.txt +226 -0
- package/mcp-docs/mobile/components/Banner.txt +222 -0
- package/mcp-docs/mobile/components/BarChart.txt +816 -0
- package/mcp-docs/mobile/components/Box.txt +174 -0
- package/mcp-docs/mobile/components/BrowserBar.txt +147 -0
- package/mcp-docs/mobile/components/Button.txt +199 -0
- package/mcp-docs/mobile/components/ButtonGroup.txt +80 -0
- package/mcp-docs/mobile/components/Carousel.txt +1084 -0
- package/mcp-docs/mobile/components/CartesianChart.txt +826 -0
- package/mcp-docs/mobile/components/CellMedia.txt +71 -0
- package/mcp-docs/mobile/components/Checkbox.txt +246 -0
- package/mcp-docs/mobile/components/CheckboxCell.txt +202 -0
- package/mcp-docs/mobile/components/CheckboxGroup.txt +285 -0
- package/mcp-docs/mobile/components/Chip.txt +195 -0
- package/mcp-docs/mobile/components/Coachmark.txt +158 -0
- package/mcp-docs/mobile/components/Collapsible.txt +105 -0
- package/mcp-docs/mobile/components/ContainedAssetCard.txt +135 -0
- package/mcp-docs/mobile/components/ContentCard.txt +366 -0
- package/mcp-docs/mobile/components/ContentCardBody.txt +136 -0
- package/mcp-docs/mobile/components/ContentCardFooter.txt +128 -0
- package/mcp-docs/mobile/components/ContentCardHeader.txt +146 -0
- package/mcp-docs/mobile/components/ContentCell.txt +227 -0
- package/mcp-docs/mobile/components/ControlGroup.txt +444 -0
- package/mcp-docs/mobile/components/DatePicker.txt +497 -0
- package/mcp-docs/mobile/components/Divider.txt +139 -0
- package/mcp-docs/mobile/components/DotCount.txt +146 -0
- package/mcp-docs/mobile/components/DotStatusColor.txt +59 -0
- package/mcp-docs/mobile/components/DotSymbol.txt +135 -0
- package/mcp-docs/mobile/components/Fallback.txt +158 -0
- package/mcp-docs/mobile/components/FloatingAssetCard.txt +156 -0
- package/mcp-docs/mobile/components/HStack.txt +235 -0
- package/mcp-docs/mobile/components/HeroSquare.txt +48 -0
- package/mcp-docs/mobile/components/Icon.txt +52 -0
- package/mcp-docs/mobile/components/IconButton.txt +269 -0
- package/mcp-docs/mobile/components/InputChip.txt +188 -0
- package/mcp-docs/mobile/components/Interactable.txt +187 -0
- package/mcp-docs/mobile/components/LineChart.txt +1325 -0
- package/mcp-docs/mobile/components/Link.txt +292 -0
- package/mcp-docs/mobile/components/ListCell.txt +391 -0
- package/mcp-docs/mobile/components/LogoMark.txt +85 -0
- package/mcp-docs/mobile/components/LogoWordMark.txt +94 -0
- package/mcp-docs/mobile/components/Lottie.txt +139 -0
- package/mcp-docs/mobile/components/LottieStatusAnimation.txt +47 -0
- package/mcp-docs/mobile/components/Modal.txt +84 -0
- package/mcp-docs/mobile/components/ModalBody.txt +34 -0
- package/mcp-docs/mobile/components/ModalFooter.txt +25 -0
- package/mcp-docs/mobile/components/ModalHeader.txt +28 -0
- package/mcp-docs/mobile/components/MultiContentModule.txt +380 -0
- package/mcp-docs/mobile/components/NavigationTitle.txt +132 -0
- package/mcp-docs/mobile/components/NavigationTitleSelect.txt +142 -0
- package/mcp-docs/mobile/components/NudgeCard.txt +90 -0
- package/mcp-docs/mobile/components/Numpad.txt +341 -0
- package/mcp-docs/mobile/components/Overlay.txt +152 -0
- package/mcp-docs/mobile/components/PageFooter.txt +161 -0
- package/mcp-docs/mobile/components/PageHeader.txt +186 -0
- package/mcp-docs/mobile/components/PeriodSelector.txt +408 -0
- package/mcp-docs/mobile/components/Pictogram.txt +48 -0
- package/mcp-docs/mobile/components/Point.txt +205 -0
- package/mcp-docs/mobile/components/PortalProvider.txt +79 -0
- package/mcp-docs/mobile/components/Pressable.txt +211 -0
- package/mcp-docs/mobile/components/ProgressBar.txt +130 -0
- package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +161 -0
- package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +138 -0
- package/mcp-docs/mobile/components/ProgressCircle.txt +237 -0
- package/mcp-docs/mobile/components/Radio.txt +242 -0
- package/mcp-docs/mobile/components/RadioCell.txt +202 -0
- package/mcp-docs/mobile/components/RadioGroup.txt +282 -0
- package/mcp-docs/mobile/components/ReferenceLine.txt +153 -0
- package/mcp-docs/mobile/components/RemoteImage.txt +106 -0
- package/mcp-docs/mobile/components/RemoteImageGroup.txt +61 -0
- package/mcp-docs/mobile/components/RollingNumber.txt +789 -0
- package/mcp-docs/mobile/components/Scrubber.txt +204 -0
- package/mcp-docs/mobile/components/SearchInput.txt +192 -0
- package/mcp-docs/mobile/components/SectionHeader.txt +205 -0
- package/mcp-docs/mobile/components/SegmentedTabs.txt +316 -0
- package/mcp-docs/mobile/components/Select.txt +212 -0
- package/mcp-docs/mobile/components/SelectChip.txt +324 -0
- package/mcp-docs/mobile/components/SelectOption.txt +85 -0
- package/mcp-docs/mobile/components/SlideButton.txt +331 -0
- package/mcp-docs/mobile/components/Spacer.txt +84 -0
- package/mcp-docs/mobile/components/Sparkline.txt +123 -0
- package/mcp-docs/mobile/components/SparklineGradient.txt +107 -0
- package/mcp-docs/mobile/components/SparklineInteractive.txt +157 -0
- package/mcp-docs/mobile/components/SparklineInteractiveHeader.txt +73 -0
- package/mcp-docs/mobile/components/Spinner.txt +49 -0
- package/mcp-docs/mobile/components/SpotIcon.txt +48 -0
- package/mcp-docs/mobile/components/SpotRectangle.txt +48 -0
- package/mcp-docs/mobile/components/SpotSquare.txt +48 -0
- package/mcp-docs/mobile/components/Stepper.txt +528 -0
- package/mcp-docs/mobile/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/mobile/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/mobile/components/Switch.txt +98 -0
- package/mcp-docs/mobile/components/TabIndicator.txt +49 -0
- package/mcp-docs/mobile/components/TabLabel.txt +154 -0
- package/mcp-docs/mobile/components/TabNavigation.txt +147 -0
- package/mcp-docs/mobile/components/TabbedChips.txt +143 -0
- package/mcp-docs/mobile/components/Tabs.txt +191 -0
- package/mcp-docs/mobile/components/Tag.txt +301 -0
- package/mcp-docs/mobile/components/Text.txt +212 -0
- package/mcp-docs/mobile/components/TextInput.txt +718 -0
- package/mcp-docs/mobile/components/ThemeProvider.txt +133 -0
- package/mcp-docs/mobile/components/Toast.txt +197 -0
- package/mcp-docs/mobile/components/Tooltip.txt +60 -0
- package/mcp-docs/mobile/components/TopNavBar.txt +162 -0
- package/mcp-docs/mobile/components/Tour.txt +159 -0
- package/mcp-docs/mobile/components/Tray.txt +253 -0
- package/mcp-docs/mobile/components/UpsellCard.txt +322 -0
- package/mcp-docs/mobile/components/VStack.txt +223 -0
- package/mcp-docs/mobile/components/XAxis.txt +622 -0
- package/mcp-docs/mobile/components/YAxis.txt +568 -0
- package/mcp-docs/mobile/getting-started/introduction.txt +99 -0
- package/mcp-docs/mobile/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/mobile/getting-started/playground.txt +25 -0
- package/mcp-docs/mobile/hooks/useDimensions.txt +47 -0
- package/mcp-docs/mobile/hooks/useOverlayContentContext.txt +215 -0
- package/mcp-docs/mobile/hooks/useTheme.txt +110 -0
- package/mcp-docs/mobile/routes.txt +132 -0
- package/mcp-docs/web/components/Accordion.txt +190 -0
- package/mcp-docs/web/components/AccordionItem.txt +32 -0
- package/mcp-docs/web/components/Alert.txt +165 -0
- package/mcp-docs/web/components/AreaChart.txt +511 -0
- package/mcp-docs/web/components/Avatar.txt +212 -0
- package/mcp-docs/web/components/AvatarButton.txt +241 -0
- package/mcp-docs/web/components/Banner.txt +227 -0
- package/mcp-docs/web/components/BarChart.txt +1268 -0
- package/mcp-docs/web/components/Box.txt +176 -0
- package/mcp-docs/web/components/Button.txt +213 -0
- package/mcp-docs/web/components/ButtonGroup.txt +80 -0
- package/mcp-docs/web/components/Calendar.txt +182 -0
- package/mcp-docs/web/components/Carousel.txt +1576 -0
- package/mcp-docs/web/components/CartesianChart.txt +1045 -0
- package/mcp-docs/web/components/CellMedia.txt +57 -0
- package/mcp-docs/web/components/Checkbox.txt +189 -0
- package/mcp-docs/web/components/CheckboxCell.txt +203 -0
- package/mcp-docs/web/components/CheckboxGroup.txt +220 -0
- package/mcp-docs/web/components/Chip.txt +197 -0
- package/mcp-docs/web/components/Coachmark.txt +189 -0
- package/mcp-docs/web/components/Collapsible.txt +120 -0
- package/mcp-docs/web/components/ContainedAssetCard.txt +233 -0
- package/mcp-docs/web/components/ContentCard.txt +368 -0
- package/mcp-docs/web/components/ContentCardBody.txt +138 -0
- package/mcp-docs/web/components/ContentCardFooter.txt +130 -0
- package/mcp-docs/web/components/ContentCardHeader.txt +148 -0
- package/mcp-docs/web/components/ContentCell.txt +220 -0
- package/mcp-docs/web/components/ControlGroup.txt +437 -0
- package/mcp-docs/web/components/DatePicker.txt +506 -0
- package/mcp-docs/web/components/Divider.txt +144 -0
- package/mcp-docs/web/components/DotCount.txt +150 -0
- package/mcp-docs/web/components/DotStatusColor.txt +59 -0
- package/mcp-docs/web/components/DotSymbol.txt +138 -0
- package/mcp-docs/web/components/Dropdown.txt +120 -0
- package/mcp-docs/web/components/Fallback.txt +164 -0
- package/mcp-docs/web/components/FloatingAssetCard.txt +251 -0
- package/mcp-docs/web/components/FullscreenAlert.txt +70 -0
- package/mcp-docs/web/components/FullscreenModal.txt +146 -0
- package/mcp-docs/web/components/FullscreenModalLayout.txt +188 -0
- package/mcp-docs/web/components/Grid.txt +237 -0
- package/mcp-docs/web/components/GridColumn.txt +210 -0
- package/mcp-docs/web/components/HStack.txt +237 -0
- package/mcp-docs/web/components/HeroSquare.txt +49 -0
- package/mcp-docs/web/components/Icon.txt +146 -0
- package/mcp-docs/web/components/IconButton.txt +391 -0
- package/mcp-docs/web/components/InputChip.txt +188 -0
- package/mcp-docs/web/components/Interactable.txt +194 -0
- package/mcp-docs/web/components/LineChart.txt +1577 -0
- package/mcp-docs/web/components/Link.txt +244 -0
- package/mcp-docs/web/components/ListCell.txt +397 -0
- package/mcp-docs/web/components/LogoMark.txt +85 -0
- package/mcp-docs/web/components/LogoWordMark.txt +94 -0
- package/mcp-docs/web/components/Lottie.txt +158 -0
- package/mcp-docs/web/components/LottieStatusAnimation.txt +58 -0
- package/mcp-docs/web/components/MediaQueryProvider.txt +109 -0
- package/mcp-docs/web/components/Modal.txt +193 -0
- package/mcp-docs/web/components/ModalBody.txt +118 -0
- package/mcp-docs/web/components/ModalFooter.txt +120 -0
- package/mcp-docs/web/components/ModalHeader.txt +124 -0
- package/mcp-docs/web/components/MultiContentModule.txt +382 -0
- package/mcp-docs/web/components/NavigationBar.txt +103 -0
- package/mcp-docs/web/components/NavigationTitle.txt +26 -0
- package/mcp-docs/web/components/NavigationTitleSelect.txt +46 -0
- package/mcp-docs/web/components/NudgeCard.txt +182 -0
- package/mcp-docs/web/components/Overlay.txt +172 -0
- package/mcp-docs/web/components/PageFooter.txt +185 -0
- package/mcp-docs/web/components/PageHeader.txt +244 -0
- package/mcp-docs/web/components/Pagination.txt +500 -0
- package/mcp-docs/web/components/PeriodSelector.txt +704 -0
- package/mcp-docs/web/components/Pictogram.txt +49 -0
- package/mcp-docs/web/components/Point.txt +461 -0
- package/mcp-docs/web/components/PortalProvider.txt +77 -0
- package/mcp-docs/web/components/Pressable.txt +194 -0
- package/mcp-docs/web/components/ProgressBar.txt +164 -0
- package/mcp-docs/web/components/ProgressBarWithFixedLabels.txt +213 -0
- package/mcp-docs/web/components/ProgressBarWithFloatLabel.txt +182 -0
- package/mcp-docs/web/components/ProgressCircle.txt +444 -0
- package/mcp-docs/web/components/Radio.txt +220 -0
- package/mcp-docs/web/components/RadioCell.txt +216 -0
- package/mcp-docs/web/components/RadioGroup.txt +289 -0
- package/mcp-docs/web/components/ReferenceLine.txt +452 -0
- package/mcp-docs/web/components/RemoteImage.txt +166 -0
- package/mcp-docs/web/components/RemoteImageGroup.txt +87 -0
- package/mcp-docs/web/components/RollingNumber.txt +1022 -0
- package/mcp-docs/web/components/Scrubber.txt +232 -0
- package/mcp-docs/web/components/SearchInput.txt +118 -0
- package/mcp-docs/web/components/SectionHeader.txt +218 -0
- package/mcp-docs/web/components/SegmentedTabs.txt +325 -0
- package/mcp-docs/web/components/Select.txt +225 -0
- package/mcp-docs/web/components/SelectChip.txt +315 -0
- package/mcp-docs/web/components/SelectOption.txt +166 -0
- package/mcp-docs/web/components/Sidebar.txt +350 -0
- package/mcp-docs/web/components/SidebarItem.txt +132 -0
- package/mcp-docs/web/components/SidebarMoreMenu.txt +31 -0
- package/mcp-docs/web/components/Spacer.txt +174 -0
- package/mcp-docs/web/components/Sparkline.txt +123 -0
- package/mcp-docs/web/components/SparklineGradient.txt +107 -0
- package/mcp-docs/web/components/SparklineInteractive.txt +154 -0
- package/mcp-docs/web/components/SparklineInteractiveHeader.txt +77 -0
- package/mcp-docs/web/components/Spinner.txt +129 -0
- package/mcp-docs/web/components/SpotIcon.txt +49 -0
- package/mcp-docs/web/components/SpotRectangle.txt +49 -0
- package/mcp-docs/web/components/SpotSquare.txt +49 -0
- package/mcp-docs/web/components/Stepper.txt +683 -0
- package/mcp-docs/web/components/SubBrandLogoMark.txt +126 -0
- package/mcp-docs/web/components/SubBrandLogoWordMark.txt +126 -0
- package/mcp-docs/web/components/Switch.txt +86 -0
- package/mcp-docs/web/components/TabIndicator.txt +49 -0
- package/mcp-docs/web/components/TabLabel.txt +159 -0
- package/mcp-docs/web/components/TabNavigation.txt +160 -0
- package/mcp-docs/web/components/TabbedChips.txt +156 -0
- package/mcp-docs/web/components/Table.txt +368 -0
- package/mcp-docs/web/components/TableBody.txt +84 -0
- package/mcp-docs/web/components/TableCaption.txt +103 -0
- package/mcp-docs/web/components/TableCell.txt +166 -0
- package/mcp-docs/web/components/TableCellFallback.txt +98 -0
- package/mcp-docs/web/components/TableFooter.txt +84 -0
- package/mcp-docs/web/components/TableHeader.txt +101 -0
- package/mcp-docs/web/components/TableRow.txt +141 -0
- package/mcp-docs/web/components/Tabs.txt +213 -0
- package/mcp-docs/web/components/Tag.txt +305 -0
- package/mcp-docs/web/components/Text.txt +233 -0
- package/mcp-docs/web/components/TextInput.txt +653 -0
- package/mcp-docs/web/components/ThemeProvider.txt +200 -0
- package/mcp-docs/web/components/TileButton.txt +159 -0
- package/mcp-docs/web/components/Toast.txt +204 -0
- package/mcp-docs/web/components/Tooltip.txt +90 -0
- package/mcp-docs/web/components/Tour.txt +180 -0
- package/mcp-docs/web/components/Tray.txt +289 -0
- package/mcp-docs/web/components/UpsellCard.txt +320 -0
- package/mcp-docs/web/components/VStack.txt +225 -0
- package/mcp-docs/web/components/XAxis.txt +620 -0
- package/mcp-docs/web/components/YAxis.txt +549 -0
- package/mcp-docs/web/getting-started/introduction.txt +99 -0
- package/mcp-docs/web/getting-started/mcp-server.txt +94 -0
- package/mcp-docs/web/getting-started/playground.txt +25 -0
- package/mcp-docs/web/hooks/useBreakpoints.txt +33 -0
- package/mcp-docs/web/hooks/useDimensions.txt +55 -0
- package/mcp-docs/web/hooks/useHasMounted.txt +55 -0
- package/mcp-docs/web/hooks/useIsoEffect.txt +42 -0
- package/mcp-docs/web/hooks/useMediaQuery.txt +94 -0
- package/mcp-docs/web/hooks/useOverlayContentContext.txt +217 -0
- package/mcp-docs/web/hooks/useScrollBlocker.txt +63 -0
- package/mcp-docs/web/hooks/useTheme.txt +105 -0
- package/mcp-docs/web/routes.txt +155 -0
- package/package.json +1 -1
|
@@ -0,0 +1,408 @@
|
|
|
1
|
+
# PeriodSelector
|
|
2
|
+
|
|
3
|
+
A selector component for choosing time periods in charts.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { PeriodSelector } from '@coinbase/cds-mobile-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `activeTabRect` | `Rect` | Yes | `-` | - |
|
|
16
|
+
| `alignContent` | `flex-start \| flex-end \| center \| stretch \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
17
|
+
| `alignItems` | `flex-start \| flex-end \| center \| stretch \| baseline` | No | `-` | - |
|
|
18
|
+
| `alignSelf` | `auto \| FlexAlignType` | No | `-` | - |
|
|
19
|
+
| `animated` | `boolean` | No | `-` | - |
|
|
20
|
+
| `aspectRatio` | `string \| number` | No | `-` | - |
|
|
21
|
+
| `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 | `bgPrimaryWash` | - |
|
|
22
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
23
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
24
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
25
|
+
| `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 | `-` | - |
|
|
26
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
27
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `1000` | - |
|
|
28
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
29
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
30
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
31
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
32
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
33
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
34
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
35
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
36
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
37
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
38
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
39
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
40
|
+
| `bottom` | `string \| number` | No | `-` | - |
|
|
41
|
+
| `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 | `-` | - |
|
|
42
|
+
| `columnGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
43
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
44
|
+
| `display` | `flex \| none` | No | `-` | - |
|
|
45
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | Determines box shadow styles. Parent should have overflow set to visible to ensure styles are not clipped. |
|
|
46
|
+
| `flexBasis` | `string \| number` | No | `-` | - |
|
|
47
|
+
| `flexDirection` | `row \| column \| row-reverse \| column-reverse` | No | `-` | - |
|
|
48
|
+
| `flexGrow` | `number` | No | `-` | - |
|
|
49
|
+
| `flexShrink` | `number` | No | `-` | - |
|
|
50
|
+
| `flexWrap` | `wrap \| nowrap \| wrap-reverse` | No | `-` | - |
|
|
51
|
+
| `font` | `inherit \| FontFamily` | No | `-` | - |
|
|
52
|
+
| `fontFamily` | `inherit \| FontFamily` | No | `-` | - |
|
|
53
|
+
| `fontSize` | `inherit \| FontSize` | No | `-` | - |
|
|
54
|
+
| `fontWeight` | `inherit \| FontWeight` | No | `-` | - |
|
|
55
|
+
| `gap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
56
|
+
| `height` | `string \| number` | No | `-` | - |
|
|
57
|
+
| `justifyContent` | `flex-start \| flex-end \| center \| space-between \| space-around \| space-evenly` | No | `-` | - |
|
|
58
|
+
| `left` | `string \| number` | No | `-` | - |
|
|
59
|
+
| `lineHeight` | `inherit \| LineHeight` | No | `-` | - |
|
|
60
|
+
| `margin` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
61
|
+
| `marginBottom` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
62
|
+
| `marginEnd` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
63
|
+
| `marginStart` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
64
|
+
| `marginTop` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
65
|
+
| `marginX` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
66
|
+
| `marginY` | `0 \| -1 \| -2 \| -3 \| -4 \| -5 \| -6 \| -7 \| -8 \| -9 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1.5` | No | `-` | - |
|
|
67
|
+
| `maxHeight` | `string \| number` | No | `-` | - |
|
|
68
|
+
| `maxWidth` | `string \| number` | No | `-` | - |
|
|
69
|
+
| `minHeight` | `string \| number` | No | `-` | - |
|
|
70
|
+
| `minWidth` | `string \| number` | No | `-` | - |
|
|
71
|
+
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
72
|
+
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
73
|
+
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
74
|
+
| `onPointerDownCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
75
|
+
| `onPointerEnter` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
76
|
+
| `onPointerEnterCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
77
|
+
| `onPointerLeave` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
78
|
+
| `onPointerLeaveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
79
|
+
| `onPointerMove` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
80
|
+
| `onPointerMoveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
81
|
+
| `onPointerUp` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
82
|
+
| `onPointerUpCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
83
|
+
| `opacity` | `number \| AnimatedNode` | No | `-` | - |
|
|
84
|
+
| `overflow` | `visible \| hidden \| scroll` | No | `-` | - |
|
|
85
|
+
| `padding` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
86
|
+
| `paddingBottom` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
87
|
+
| `paddingEnd` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
88
|
+
| `paddingStart` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
89
|
+
| `paddingTop` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
90
|
+
| `paddingX` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
91
|
+
| `paddingY` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
92
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
93
|
+
| `position` | `absolute \| relative \| static \| fixed \| sticky` | No | `absolute` | - |
|
|
94
|
+
| `right` | `string \| number` | No | `-` | - |
|
|
95
|
+
| `rowGap` | `0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1.5` | No | `-` | - |
|
|
96
|
+
| `style` | `false \| RegisteredStyle<ViewStyle> \| Value \| AnimatedInterpolation<string \| number> \| WithAnimatedObject<ViewStyle> \| WithAnimatedArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle> \| RecursiveArray<Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>> \| readonly (Falsy \| ViewStyle \| RegisteredStyle<ViewStyle>)[]> \| null` | No | `-` | - |
|
|
97
|
+
| `testID` | `string` | No | `-` | Used to locate this element in unit and end-to-end tests. Used to locate this view in end-to-end tests. |
|
|
98
|
+
| `textAlign` | `auto \| left \| right \| center \| justify` | No | `-` | - |
|
|
99
|
+
| `textDecorationLine` | `none \| underline \| line-through \| underline line-through` | No | `-` | - |
|
|
100
|
+
| `textDecorationStyle` | `solid \| dotted \| dashed \| double` | No | `-` | - |
|
|
101
|
+
| `textTransform` | `none \| capitalize \| uppercase \| lowercase` | No | `-` | - |
|
|
102
|
+
| `top` | `string \| number` | No | `-` | - |
|
|
103
|
+
| `transform` | `string \| (({ scaleX: AnimatableNumericValue; } & { scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scaleY: AnimatableNumericValue; } & { scaleX?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateX: AnimatableNumericValue \| ${number}%; } & { scaleX?: undefined; scaleY?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ translateY: AnimatableNumericValue \| ${number}%; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ perspective: AnimatableNumericValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotate: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateX: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateY: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ rotateZ: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ scale: AnimatableNumericValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; skewX?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewX: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewY?: undefined; matrix?: undefined; }) \| ({ skewY: AnimatableStringValue; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; matrix?: undefined; }) \| ({ matrix: AnimatableNumericValue[]; } & { scaleX?: undefined; scaleY?: undefined; translateX?: undefined; translateY?: undefined; perspective?: undefined; rotate?: undefined; rotateX?: undefined; rotateY?: undefined; rotateZ?: undefined; scale?: undefined; skewX?: undefined; skewY?: undefined; }))[]` | No | `-` | - |
|
|
104
|
+
| `userSelect` | `auto \| none \| text \| contain \| all` | No | `-` | - |
|
|
105
|
+
| `width` | `string \| number` | No | `-` | - |
|
|
106
|
+
| `zIndex` | `number` | No | `-` | - |
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## Examples
|
|
110
|
+
|
|
111
|
+
### Basic Example
|
|
112
|
+
|
|
113
|
+
```jsx
|
|
114
|
+
function BasicExample() {
|
|
115
|
+
const tabs = [
|
|
116
|
+
{ id: '1H', label: '1H' },
|
|
117
|
+
{ id: '1D', label: '1D' },
|
|
118
|
+
{ id: '1W', label: '1W' },
|
|
119
|
+
{ id: '1M', label: '1M' },
|
|
120
|
+
{ id: '1Y', label: '1Y' },
|
|
121
|
+
{ id: 'All', label: 'All' },
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
125
|
+
|
|
126
|
+
return <PeriodSelector activeTab={activeTab} onChange={setActiveTab} tabs={tabs} />;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Minimum Width
|
|
131
|
+
|
|
132
|
+
You can set the `width` prop to `fit-content` to make the period selector as small as possible.
|
|
133
|
+
|
|
134
|
+
```jsx
|
|
135
|
+
function MinimumWidthExample() {
|
|
136
|
+
const tabs = [
|
|
137
|
+
{ id: '1W', label: '1W' },
|
|
138
|
+
{ id: '1M', label: '1M' },
|
|
139
|
+
{ id: 'YTD', label: 'YTD' },
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<PeriodSelector
|
|
146
|
+
activeTab={activeTab}
|
|
147
|
+
onChange={setActiveTab}
|
|
148
|
+
tabs={tabs}
|
|
149
|
+
width="fit-content"
|
|
150
|
+
gap={0.5}
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Many Periods with Overflow
|
|
157
|
+
|
|
158
|
+
```jsx
|
|
159
|
+
function ManyPeriodsExample() {
|
|
160
|
+
const tabs = useMemo(
|
|
161
|
+
() => [
|
|
162
|
+
{
|
|
163
|
+
id: '1H',
|
|
164
|
+
label: <LiveTabLabel />,
|
|
165
|
+
},
|
|
166
|
+
{ id: '1D', label: '1D' },
|
|
167
|
+
{ id: '1W', label: '1W' },
|
|
168
|
+
{ id: '1M', label: '1M' },
|
|
169
|
+
{ id: 'YTD', label: 'YTD' },
|
|
170
|
+
{ id: '1Y', label: '1Y' },
|
|
171
|
+
{ id: '5Y', label: '5Y' },
|
|
172
|
+
{ id: 'All', label: 'All' },
|
|
173
|
+
],
|
|
174
|
+
[],
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
178
|
+
const isLive = useMemo(() => activeTab?.id === '1H', [activeTab]);
|
|
179
|
+
|
|
180
|
+
const activeBackground = useMemo(() => (!isLive ? 'bgPrimaryWash' : 'bgNegativeWash'), [isLive]);
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<HStack alignItems="center" justifyContent="space-between" maxWidth="100%" width="100%">
|
|
184
|
+
<ScrollView
|
|
185
|
+
horizontal
|
|
186
|
+
contentContainerStyle={{ paddingEnd: 8, flexGrow: 1 }}
|
|
187
|
+
showsHorizontalScrollIndicator={false}
|
|
188
|
+
>
|
|
189
|
+
<PeriodSelector
|
|
190
|
+
activeBackground={activeBackground}
|
|
191
|
+
activeTab={activeTab}
|
|
192
|
+
gap={1}
|
|
193
|
+
justifyContent="flex-start"
|
|
194
|
+
onChange={setActiveTab}
|
|
195
|
+
tabs={tabs}
|
|
196
|
+
width="fit-content"
|
|
197
|
+
/>
|
|
198
|
+
</ScrollView>
|
|
199
|
+
<IconButton
|
|
200
|
+
compact
|
|
201
|
+
accessibilityLabel="Configure chart"
|
|
202
|
+
flexShrink={0}
|
|
203
|
+
name="filter"
|
|
204
|
+
variant="secondary"
|
|
205
|
+
/>
|
|
206
|
+
</HStack>
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Live Indicator
|
|
212
|
+
|
|
213
|
+
```jsx
|
|
214
|
+
function LiveExample() {
|
|
215
|
+
const tabs = useMemo(
|
|
216
|
+
() => [
|
|
217
|
+
// LiveTabLabel is exported from PeriodSelector
|
|
218
|
+
{ id: '1H', label: <LiveTabLabel /> },
|
|
219
|
+
{ id: '1D', label: '1D' },
|
|
220
|
+
{ id: '1W', label: '1W' },
|
|
221
|
+
{ id: '1M', label: '1M' },
|
|
222
|
+
{ id: '1Y', label: '1Y' },
|
|
223
|
+
{ id: 'All', label: 'All' },
|
|
224
|
+
],
|
|
225
|
+
[],
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
229
|
+
const isLive = useMemo(() => activeTab?.id === '1H', [activeTab]);
|
|
230
|
+
|
|
231
|
+
const activeBackground = useMemo(() => (isLive ? 'bgNegativeWash' : 'bgPrimaryWash'), [isLive]);
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<PeriodSelector
|
|
235
|
+
activeBackground={activeBackground}
|
|
236
|
+
activeTab={activeTab}
|
|
237
|
+
onChange={setActiveTab}
|
|
238
|
+
tabs={tabs}
|
|
239
|
+
/>
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Customization
|
|
245
|
+
|
|
246
|
+
#### Custom Colors
|
|
247
|
+
|
|
248
|
+
```jsx
|
|
249
|
+
function ColoredBTCExample() {
|
|
250
|
+
const btcColor = assets.btc.color;
|
|
251
|
+
|
|
252
|
+
// Custom active indicator with BTC color
|
|
253
|
+
const BTCActiveIndicator = memo((props) => {
|
|
254
|
+
const theme = useTheme();
|
|
255
|
+
const { activeTab } = useTabsContext();
|
|
256
|
+
const isLive = useMemo(() => activeTab?.id === '1H', [activeTab]);
|
|
257
|
+
|
|
258
|
+
const backgroundColor = useMemo(
|
|
259
|
+
() => (isLive ? theme.color.bgNegativeWash : `${btcColor}1A`),
|
|
260
|
+
[isLive, theme.color.bgNegativeWash],
|
|
261
|
+
);
|
|
262
|
+
|
|
263
|
+
return <PeriodSelectorActiveIndicator {...props} background={backgroundColor} />;
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
// Custom tab component with BTC color
|
|
267
|
+
const BTCTab = memo(
|
|
268
|
+
forwardRef(({ label, ...props }, ref) => {
|
|
269
|
+
const { activeTab } = useTabsContext();
|
|
270
|
+
const isActive = activeTab?.id === props.id;
|
|
271
|
+
const theme = useTheme();
|
|
272
|
+
|
|
273
|
+
const wrappedLabel =
|
|
274
|
+
typeof label === 'string' ? (
|
|
275
|
+
<TextLabel1 dangerouslySetColor={isActive ? btcColor : theme.color.fg}>
|
|
276
|
+
{label}
|
|
277
|
+
</TextLabel1>
|
|
278
|
+
) : (
|
|
279
|
+
label
|
|
280
|
+
);
|
|
281
|
+
|
|
282
|
+
return <SegmentedTab ref={ref} label={wrappedLabel} {...props} />;
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
// Custom live label with BTC color
|
|
287
|
+
const BTCLiveLabel = memo(
|
|
288
|
+
forwardRef(({ label = 'LIVE', font = 'label1', hideDot, style, ...props }, ref) => {
|
|
289
|
+
const theme = useTheme();
|
|
290
|
+
|
|
291
|
+
const dotStyle = useMemo(
|
|
292
|
+
() => ({
|
|
293
|
+
width: theme.space[1],
|
|
294
|
+
height: theme.space[1],
|
|
295
|
+
borderRadius: 1000,
|
|
296
|
+
marginRight: theme.space[0.75],
|
|
297
|
+
backgroundColor: btcColor,
|
|
298
|
+
}),
|
|
299
|
+
[theme.space],
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
return (
|
|
303
|
+
<View
|
|
304
|
+
ref={ref}
|
|
305
|
+
style={[
|
|
306
|
+
{
|
|
307
|
+
flexDirection: 'row',
|
|
308
|
+
alignItems: 'center',
|
|
309
|
+
},
|
|
310
|
+
style,
|
|
311
|
+
]}
|
|
312
|
+
>
|
|
313
|
+
{!hideDot && <View style={dotStyle} />}
|
|
314
|
+
<Text font={font} style={{ color: btcColor }} {...props}>
|
|
315
|
+
{label}
|
|
316
|
+
</Text>
|
|
317
|
+
</View>
|
|
318
|
+
);
|
|
319
|
+
}),
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
const tabs = [
|
|
323
|
+
{ id: '1H', label: <BTCLiveLabel /> },
|
|
324
|
+
{ id: '1D', label: '1D' },
|
|
325
|
+
{ id: '1W', label: '1W' },
|
|
326
|
+
{ id: '1M', label: '1M' },
|
|
327
|
+
{ id: '1Y', label: '1Y' },
|
|
328
|
+
{ id: 'All', label: 'All' },
|
|
329
|
+
];
|
|
330
|
+
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
<PeriodSelector
|
|
334
|
+
TabComponent={BTCTab}
|
|
335
|
+
TabsActiveIndicatorComponent={BTCActiveIndicator}
|
|
336
|
+
activeTab={activeTab}
|
|
337
|
+
onChange={setActiveTab}
|
|
338
|
+
tabs={tabs}
|
|
339
|
+
/>
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### Custom Colors Excluding Live
|
|
345
|
+
|
|
346
|
+
Customize colors for regular periods while keeping the default red styling for live periods.
|
|
347
|
+
|
|
348
|
+
```jsx
|
|
349
|
+
function ColoredExcludingLiveExample() {
|
|
350
|
+
const btcColor = assets.btc.color;
|
|
351
|
+
|
|
352
|
+
// Custom active indicator that only applies BTC color to non-live periods
|
|
353
|
+
const BTCActiveExcludingLiveIndicator = memo((props) => {
|
|
354
|
+
const theme = useTheme();
|
|
355
|
+
const { activeTab } = useTabsContext();
|
|
356
|
+
const isLive = useMemo(() => activeTab?.id === '1H', [activeTab]);
|
|
357
|
+
|
|
358
|
+
const backgroundColor = useMemo(
|
|
359
|
+
() => (isLive ? theme.color.bgNegativeWash : `${btcColor}1A`),
|
|
360
|
+
[isLive, theme.color.bgNegativeWash],
|
|
361
|
+
);
|
|
362
|
+
|
|
363
|
+
return <PeriodSelectorActiveIndicator {...props} background={backgroundColor} />;
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
// Custom tab component with BTC color
|
|
367
|
+
const BTCTab = memo(
|
|
368
|
+
forwardRef(({ label, ...props }, ref) => {
|
|
369
|
+
const { activeTab } = useTabsContext();
|
|
370
|
+
const isActive = activeTab?.id === props.id;
|
|
371
|
+
const theme = useTheme();
|
|
372
|
+
|
|
373
|
+
const wrappedLabel =
|
|
374
|
+
typeof label === 'string' ? (
|
|
375
|
+
<TextLabel1 dangerouslySetColor={isActive ? btcColor : theme.color.fg}>
|
|
376
|
+
{label}
|
|
377
|
+
</TextLabel1>
|
|
378
|
+
) : (
|
|
379
|
+
label
|
|
380
|
+
);
|
|
381
|
+
|
|
382
|
+
return <SegmentedTab ref={ref} label={wrappedLabel} {...props} />;
|
|
383
|
+
}),
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
const tabs = [
|
|
387
|
+
{ id: '1H', label: <LiveTabLabel /> },
|
|
388
|
+
{ id: '1D', label: '1D' },
|
|
389
|
+
{ id: '1W', label: '1W' },
|
|
390
|
+
{ id: '1M', label: '1M' },
|
|
391
|
+
{ id: '1Y', label: '1Y' },
|
|
392
|
+
{ id: 'All', label: 'All' },
|
|
393
|
+
];
|
|
394
|
+
const [activeTab, setActiveTab] = useState(tabs[0]);
|
|
395
|
+
|
|
396
|
+
return (
|
|
397
|
+
<PeriodSelector
|
|
398
|
+
TabComponent={BTCTab}
|
|
399
|
+
TabsActiveIndicatorComponent={BTCActiveExcludingLiveIndicator}
|
|
400
|
+
activeTab={activeTab}
|
|
401
|
+
onChange={setActiveTab}
|
|
402
|
+
tabs={tabs}
|
|
403
|
+
/>
|
|
404
|
+
);
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Pictogram
|
|
2
|
+
|
|
3
|
+
Displays elevated product icons.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { Pictogram } from '@coinbase/cds-mobile/illustrations/Pictogram'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `name` | `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` | Yes | `-` | Name of illustration as defined in Figma |
|
|
16
|
+
| `dimension` | `48x48 \| 64x64` | No | `-` | HeroSquare Default: 240x240 SpotSquare Default: 96x96 Pictogram Default: 48x48 SpotRectangle Default: 240x120 |
|
|
17
|
+
| `fallback` | `ReactElement<any, string \| JSXElementConstructor<any>> \| null` | No | `null` | Fallback element to render if unable to find an illustration with the matching name |
|
|
18
|
+
| `scaleMultiplier` | `number` | No | `-` | Multiply the width & height while maintaining aspect ratio |
|
|
19
|
+
| `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 |
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
### Basic example
|
|
25
|
+
|
|
26
|
+
```jsx
|
|
27
|
+
<Pictogram name="shield" dimension="64x64" />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### `scaleMultiplier` prop
|
|
31
|
+
|
|
32
|
+
If no predefined dimensions fit your use case, you can use the `scaleMultiplier` prop to scale the illustration.
|
|
33
|
+
|
|
34
|
+
Use `scaleMultiplier` sparingly and with caution. We have predefined dimensions to ensure that illustrations scale elegantly.
|
|
35
|
+
|
|
36
|
+
```jsx
|
|
37
|
+
<Pictogram name="shield" scaleMultiplier={1.5} />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Scaling with dimension
|
|
41
|
+
|
|
42
|
+
If `dimension` and `scaleMultiplier` are both provided the component will scale based on the provided dimension.
|
|
43
|
+
|
|
44
|
+
```jsx
|
|
45
|
+
<Pictogram name="shield" dimension="48x48" scaleMultiplier={2.5} />
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# Point
|
|
2
|
+
|
|
3
|
+
Visual markers that highlight specific data values on a chart. Points can be customized with different colors, sizes, and interactivity.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { Point } from '@coinbase/cds-mobile-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `dataX` | `number` | Yes | `-` | X coordinate in data space (not pixel coordinates). |
|
|
16
|
+
| `dataY` | `number` | Yes | `-` | Y coordinate in data space (not pixel coordinates). |
|
|
17
|
+
| `accessibilityLabel` | `string` | No | `-` | Accessibility label for screen readers to describe the point. If not provided, a default label will be generated using the data coordinates. |
|
|
18
|
+
| `fill` | `string` | No | `-` | The fill color of the point. |
|
|
19
|
+
| `label` | `null \| string \| number \| ReactElement<TSpanProps, TSpan> \| ReactElement<TextPathProps, TextPath> \| ValidChartTextChildElements[]` | No | `-` | Simple text label to display at the point position. If provided, a ChartText will be automatically rendered. |
|
|
20
|
+
| `labelProps` | `Omit<ChartTextProps, children \| x \| y>` | No | `-` | Configuration for the automatically rendered label. Only used when label prop is provided. |
|
|
21
|
+
| `onPress` | `((point: { x: number; y: number; dataX: number; dataY: number; }) => void)` | No | `-` | Handler for when the point is clicked. |
|
|
22
|
+
| `onScrubberEnter` | `((point: { x: number; y: number; }) => void)` | No | `-` | Handler for when the scrubber enters this point. |
|
|
23
|
+
| `opacity` | `number` | No | `-` | Opacity of the point. |
|
|
24
|
+
| `pixelCoordinates` | `{ x: number; y: number; }` | No | `-` | Optional pixel coordinates to use instead of calculating from dataX/dataY. Useful for performance when coordinates are already calculated. |
|
|
25
|
+
| `radius` | `number` | No | `4` | Radius of the point. |
|
|
26
|
+
| `stroke` | `string` | No | `theme.color.bg` | Color of the outer stroke around the point. |
|
|
27
|
+
| `strokeWidth` | `number` | No | `2` | Outer stroke width of the point. Set to 0 to remove the stroke. |
|
|
28
|
+
| `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 |
|
|
29
|
+
| `yAxisId` | `string` | No | `-` | Optional Y-axis id to specify which axis to plot along. Defaults to the first y-axis |
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Basic Example
|
|
35
|
+
|
|
36
|
+
Points are visual markers that highlight specific data values on a chart. They can be used to emphasize important data points, show discrete values, or provide interactive elements.
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
<LineChart
|
|
40
|
+
enableScrubbing
|
|
41
|
+
height={{ base: 150, tablet: 200, desktop: 250 }}
|
|
42
|
+
series={[
|
|
43
|
+
{
|
|
44
|
+
id: 'prices',
|
|
45
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
curve="monotone"
|
|
49
|
+
showYAxis
|
|
50
|
+
showArea
|
|
51
|
+
yAxis={{
|
|
52
|
+
showGrid: true,
|
|
53
|
+
}}
|
|
54
|
+
renderPoints={() => true}
|
|
55
|
+
>
|
|
56
|
+
<Scrubber />
|
|
57
|
+
</LineChart>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Conditional Points
|
|
61
|
+
|
|
62
|
+
You can conditionally render points to highlight specific values in your data, such as maximum/minimum values or outliers.
|
|
63
|
+
|
|
64
|
+
```jsx
|
|
65
|
+
function AssetPriceWithMinMax() {
|
|
66
|
+
const data = sparklineInteractiveData.hour.map((d) => d.value);
|
|
67
|
+
|
|
68
|
+
const minPrice = Math.min(...data);
|
|
69
|
+
const maxPrice = Math.max(...data);
|
|
70
|
+
|
|
71
|
+
const formatPrice = useCallback((price: number) => {
|
|
72
|
+
return new Intl.NumberFormat('en-US', {
|
|
73
|
+
style: 'currency',
|
|
74
|
+
currency: 'USD',
|
|
75
|
+
}).format(price);
|
|
76
|
+
}, []);
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<LineChart
|
|
80
|
+
series={[
|
|
81
|
+
{
|
|
82
|
+
id: 'btc',
|
|
83
|
+
data: data,
|
|
84
|
+
color: assets.btc.color,
|
|
85
|
+
},
|
|
86
|
+
]}
|
|
87
|
+
showArea
|
|
88
|
+
areaType="dotted"
|
|
89
|
+
height={{ base: 150, tablet: 200, desktop: 250 }}
|
|
90
|
+
style={{ outlineColor: assets.btc.color }}
|
|
91
|
+
renderPoints={({ dataX, dataY }) => {
|
|
92
|
+
const isMin = dataY === minPrice;
|
|
93
|
+
const isMax = dataY === maxPrice;
|
|
94
|
+
|
|
95
|
+
if (isMin) {
|
|
96
|
+
return { label: formatPrice(dataY), labelProps: { dy: 6, verticalAlignment: 'top' } };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (isMax) {
|
|
100
|
+
return { label: formatPrice(dataY), labelProps: { dy: -6, verticalAlignment: 'bottom' } };
|
|
101
|
+
}
|
|
102
|
+
}}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Interactive Points
|
|
109
|
+
|
|
110
|
+
Points can be made interactive by adding click handlers, allowing users to explore data in more detail.
|
|
111
|
+
|
|
112
|
+
```jsx
|
|
113
|
+
<LineChart
|
|
114
|
+
height={{ base: 150, tablet: 200, desktop: 250 }}
|
|
115
|
+
series={[
|
|
116
|
+
{
|
|
117
|
+
id: 'sales',
|
|
118
|
+
data: [120, 132, 101, 134, 90, 230, 210, 120, 180, 190, 210, 176],
|
|
119
|
+
},
|
|
120
|
+
]}
|
|
121
|
+
curve="monotone"
|
|
122
|
+
showYAxis
|
|
123
|
+
showArea
|
|
124
|
+
yAxis={{
|
|
125
|
+
showGrid: true,
|
|
126
|
+
label: 'Sales (units)',
|
|
127
|
+
}}
|
|
128
|
+
renderPoints={({ dataX, dataY }) => {
|
|
129
|
+
const months = [
|
|
130
|
+
'Jan',
|
|
131
|
+
'Feb',
|
|
132
|
+
'Mar',
|
|
133
|
+
'Apr',
|
|
134
|
+
'May',
|
|
135
|
+
'Jun',
|
|
136
|
+
'Jul',
|
|
137
|
+
'Aug',
|
|
138
|
+
'Sep',
|
|
139
|
+
'Oct',
|
|
140
|
+
'Nov',
|
|
141
|
+
'Dec',
|
|
142
|
+
];
|
|
143
|
+
return {
|
|
144
|
+
radius: 4,
|
|
145
|
+
onClick: () => alert(`${months[dataX]}: ${dataY} units sold`),
|
|
146
|
+
accessibilityLabel: `${months[dataX]} sales: ${dataY} units`,
|
|
147
|
+
};
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Customization
|
|
153
|
+
|
|
154
|
+
Points support extensive customization through various properties including colors, sizes, animations, and labels.
|
|
155
|
+
|
|
156
|
+
```jsx
|
|
157
|
+
function CustomizedPoints() {
|
|
158
|
+
const theme = useTheme();
|
|
159
|
+
return (
|
|
160
|
+
<LineChart
|
|
161
|
+
height={{ base: 150, tablet: 200, desktop: 250 }}
|
|
162
|
+
series={[
|
|
163
|
+
{
|
|
164
|
+
id: 'performance',
|
|
165
|
+
data: [65, 70, 72, 85, 88, 92, 78, 82, 90, 95, 91, 94],
|
|
166
|
+
},
|
|
167
|
+
]}
|
|
168
|
+
curve="monotone"
|
|
169
|
+
showYAxis
|
|
170
|
+
showArea
|
|
171
|
+
yAxis={{
|
|
172
|
+
showGrid: true,
|
|
173
|
+
label: 'Performance Score',
|
|
174
|
+
}}
|
|
175
|
+
renderPoints={({ dataX, dataY }) => {
|
|
176
|
+
const isHighPerformance = dataY >= 90;
|
|
177
|
+
const isLowPerformance = dataY < 75;
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
fill: isHighPerformance
|
|
181
|
+
? theme.color.bgPositive
|
|
182
|
+
: isLowPerformance
|
|
183
|
+
? theme.color.bgNegative
|
|
184
|
+
: theme.color.fgPrimary,
|
|
185
|
+
radius: isHighPerformance ? 6 : 4,
|
|
186
|
+
strokeWidth: 2,
|
|
187
|
+
stroke: theme.color.bg,
|
|
188
|
+
label: isHighPerformance || isLowPerformance ? `${dataY}%` : undefined,
|
|
189
|
+
labelProps: {
|
|
190
|
+
verticalAlignment: isHighPerformance ? 'bottom' : 'top',
|
|
191
|
+
dy: isHighPerformance ? -10 : 10,
|
|
192
|
+
color: isHighPerformance
|
|
193
|
+
? theme.color.fgPositive
|
|
194
|
+
: isLowPerformance
|
|
195
|
+
? theme.color.fgNegative
|
|
196
|
+
: undefined,
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
}}
|
|
200
|
+
/>
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
|