@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,452 @@
|
|
|
1
|
+
# ReferenceLine
|
|
2
|
+
|
|
3
|
+
A horizontal or vertical reference line to mark important values on a chart, such as targets, thresholds, or baseline values.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { ReferenceLine } from '@coinbase/cds-web-visualization'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `BeaconComponent` | `ComponentClass<ScrubberBeaconProps, any> \| FunctionComponent<ScrubberBeaconProps>` | No | `-` | Custom component for the scrubber beacon. |
|
|
16
|
+
| `BeaconLabelComponent` | `ComponentClass<ChartTextProps, any> \| FunctionComponent<ChartTextProps>` | No | `-` | Custom component for the scrubber beacon label. |
|
|
17
|
+
| `LineComponent` | `FunctionComponent<ReferenceLineProps> \| ComponentClass<ReferenceLineProps, any>` | No | `-` | Custom component for the scrubber line. |
|
|
18
|
+
| `classNames` | `{ overlay?: string; beacon?: string \| undefined; line?: string \| undefined; beaconLabel?: string \| undefined; } \| undefined` | No | `-` | Custom class names for scrubber elements. |
|
|
19
|
+
| `hideLine` | `boolean` | No | `-` | Hides the scrubber line |
|
|
20
|
+
| `hideOverlay` | `boolean` | No | `-` | Whether to hide the overlay rect which obscures future data. |
|
|
21
|
+
| `idlePulse` | `boolean` | No | `-` | Pulse the scrubber beacon while it is at rest. |
|
|
22
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
23
|
+
| `label` | `ChartTextChildren \| ((dataIndex: number) => ChartTextChildren)` | No | `-` | Label text displayed above the scrubber line. |
|
|
24
|
+
| `labelProps` | `ReferenceLineLabelProps` | No | `-` | Props passed to the scrubber lines label. |
|
|
25
|
+
| `lineStroke` | `string` | No | `-` | Stroke color for the scrubber line. |
|
|
26
|
+
| `overlayOffset` | `number` | No | `2` | Offset of the overlay rect relative to the drawing area. Useful for when scrubbing over lines, where the stroke width would cause part of the line to be visible. |
|
|
27
|
+
| `ref` | `((instance: ScrubberBeaconRef \| null) => void) \| RefObject<ScrubberBeaconRef> \| null` | No | `-` | - |
|
|
28
|
+
| `seriesIds` | `string[]` | No | `-` | An array of series IDs that will receive visual emphasis as the user scrubs through the chart. Use this prop to restrict the scrubbing visual behavior to specific series. By default, all series will be highlighted by the Scrubber. |
|
|
29
|
+
| `styles` | `{ overlay?: CSSProperties; beacon?: CSSProperties \| undefined; line?: CSSProperties \| undefined; beaconLabel?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for scrubber elements. |
|
|
30
|
+
| `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 |
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Examples
|
|
34
|
+
|
|
35
|
+
### Basic Example
|
|
36
|
+
|
|
37
|
+
ReferenceLine can be used to add important details to a chart, such as a reference price or date.
|
|
38
|
+
|
|
39
|
+
```jsx live
|
|
40
|
+
<LineChart
|
|
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
|
+
inset={0}
|
|
49
|
+
curve="monotone"
|
|
50
|
+
showArea
|
|
51
|
+
>
|
|
52
|
+
<ReferenceLine
|
|
53
|
+
dataX={5}
|
|
54
|
+
label="Vertical Reference Line"
|
|
55
|
+
labelProps={{ horizontalAlignment: 'left', dx: 8 }}
|
|
56
|
+
/>
|
|
57
|
+
<ReferenceLine
|
|
58
|
+
dataY={50}
|
|
59
|
+
label="Horizontal Reference Line"
|
|
60
|
+
labelProps={{ verticalAlignment: 'bottom', dy: -8, horizontalAlignment: 'right' }}
|
|
61
|
+
/>
|
|
62
|
+
</LineChart>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Data Values
|
|
66
|
+
|
|
67
|
+
ReferenceLine relies on `dataX` or `dataY` to position the line. Passing in `dataY` will create a horizontal line across the y axis at that value, and passing in `dataX` will do the same along the x axis.
|
|
68
|
+
|
|
69
|
+
```jsx live
|
|
70
|
+
<LineChart
|
|
71
|
+
showArea
|
|
72
|
+
curve="natural"
|
|
73
|
+
height={{ base: 150, tablet: 200, desktop: 250 }}
|
|
74
|
+
series={[
|
|
75
|
+
{
|
|
76
|
+
id: 'growth',
|
|
77
|
+
data: [
|
|
78
|
+
2, 4, 8, 15, 30, 65, 140, 280, 580, 1200, 2400, 4800, 9500, 19000, 38000, 75000, 150000,
|
|
79
|
+
],
|
|
80
|
+
color: 'var(--color-fgPositive)',
|
|
81
|
+
},
|
|
82
|
+
]}
|
|
83
|
+
>
|
|
84
|
+
<ReferenceLine
|
|
85
|
+
dataY={10000}
|
|
86
|
+
label="10,000"
|
|
87
|
+
labelPosition="left"
|
|
88
|
+
labelProps={{ verticalAlignment: 'bottom', dy: -4 }}
|
|
89
|
+
/>
|
|
90
|
+
<ReferenceLine
|
|
91
|
+
dataY={100000}
|
|
92
|
+
label="100,000"
|
|
93
|
+
labelPosition="left"
|
|
94
|
+
labelProps={{ verticalAlignment: 'bottom', dy: -4 }}
|
|
95
|
+
/>
|
|
96
|
+
</LineChart>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Customization
|
|
100
|
+
|
|
101
|
+
#### Label Style
|
|
102
|
+
|
|
103
|
+
You can adjust the style of the label using the `labelProps` prop.
|
|
104
|
+
|
|
105
|
+
```jsx live
|
|
106
|
+
<LineChart
|
|
107
|
+
curve="monotone"
|
|
108
|
+
height={{ base: 150, tablet: 200, desktop: 250 }}
|
|
109
|
+
inset={{ right: 4 }}
|
|
110
|
+
series={[
|
|
111
|
+
{
|
|
112
|
+
id: 'prices',
|
|
113
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
114
|
+
},
|
|
115
|
+
]}
|
|
116
|
+
>
|
|
117
|
+
<ReferenceLine
|
|
118
|
+
dataY={25}
|
|
119
|
+
label="Liquidation"
|
|
120
|
+
labelPosition="left"
|
|
121
|
+
labelProps={{
|
|
122
|
+
horizontalAlignment: 'left',
|
|
123
|
+
dx: 12,
|
|
124
|
+
borderRadius: 4,
|
|
125
|
+
inset: { top: 4, bottom: 4, left: 8, right: 8 },
|
|
126
|
+
color: 'rgb(var(--yellow70))',
|
|
127
|
+
background: 'var(--color-accentSubtleYellow)',
|
|
128
|
+
font: 'label1',
|
|
129
|
+
}}
|
|
130
|
+
stroke="var(--color-bgWarning)"
|
|
131
|
+
/>
|
|
132
|
+
<ReferenceLine
|
|
133
|
+
dataY={25}
|
|
134
|
+
label="$25"
|
|
135
|
+
labelPosition="right"
|
|
136
|
+
labelProps={{
|
|
137
|
+
horizontalAlignment: 'right',
|
|
138
|
+
dx: -12,
|
|
139
|
+
borderRadius: 4,
|
|
140
|
+
inset: { top: 2, bottom: 2, left: 4, right: 4 },
|
|
141
|
+
color: 'rgb(var(--yellow70))',
|
|
142
|
+
background: 'var(--color-bg)',
|
|
143
|
+
font: 'label1',
|
|
144
|
+
}}
|
|
145
|
+
stroke="transparent"
|
|
146
|
+
/>
|
|
147
|
+
</LineChart>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### Draggable Price Target
|
|
151
|
+
|
|
152
|
+
You can pair a ReferenceLine with a custom drag component to create a draggable price target.
|
|
153
|
+
|
|
154
|
+
```jsx live
|
|
155
|
+
function DraggablePriceTarget() {
|
|
156
|
+
const DragIcon = ({ x, y }: { x: number; y: number }) => {
|
|
157
|
+
const DragCircle = (props: React.SVGProps<SVGCircleElement>) => (
|
|
158
|
+
<circle {...props} fill="var(--color-fg)" r="1.5" />
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<g transform={`translate(${x}, ${y})`}>
|
|
163
|
+
<g transform="translate(0, -8)">
|
|
164
|
+
<DragCircle cx="2" cy="2" />
|
|
165
|
+
<DragCircle cx="2" cy="8" />
|
|
166
|
+
<DragCircle cx="2" cy="14" />
|
|
167
|
+
<DragCircle cx="9" cy="2" />
|
|
168
|
+
<DragCircle cx="9" cy="8" />
|
|
169
|
+
<DragCircle cx="9" cy="14" />
|
|
170
|
+
</g>
|
|
171
|
+
</g>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const TrendArrowIcon = ({
|
|
176
|
+
x,
|
|
177
|
+
y,
|
|
178
|
+
isPositive,
|
|
179
|
+
color,
|
|
180
|
+
}: {
|
|
181
|
+
x: number;
|
|
182
|
+
y: number;
|
|
183
|
+
isPositive: boolean;
|
|
184
|
+
color: string;
|
|
185
|
+
}) => {
|
|
186
|
+
return (
|
|
187
|
+
<g transform={`translate(${x - 8}, ${y - 8})`}>
|
|
188
|
+
<g
|
|
189
|
+
style={{
|
|
190
|
+
// Flip horizontally and vertically for positive trend (pointing top-right)
|
|
191
|
+
transform: isPositive ? 'scale(-1, -1)' : 'scale(-1, 1)',
|
|
192
|
+
transformOrigin: '8px 8px',
|
|
193
|
+
}}
|
|
194
|
+
>
|
|
195
|
+
<path
|
|
196
|
+
d="M4.88574 12.7952L14.9887 2.69223L13.2916 0.995178L3.18883 11.098V4.84898L0.988831 7.04898V14.9952H8.99974L11.1997 12.7952H4.88574Z"
|
|
197
|
+
fill={color}
|
|
198
|
+
/>
|
|
199
|
+
</g>
|
|
200
|
+
</g>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const DraggableReferenceLine = memo(
|
|
205
|
+
({
|
|
206
|
+
baselineAmount,
|
|
207
|
+
startAmount,
|
|
208
|
+
chartRef,
|
|
209
|
+
}: {
|
|
210
|
+
baselineAmount: number;
|
|
211
|
+
startAmount: number;
|
|
212
|
+
chartRef: RefObject<SVGSVGElement>;
|
|
213
|
+
}) => {
|
|
214
|
+
const theme = useTheme();
|
|
215
|
+
const { isPhone } = useBreakpoints();
|
|
216
|
+
|
|
217
|
+
const formatPrice = useCallback((value: number) => {
|
|
218
|
+
return `$${value.toLocaleString('en-US', {
|
|
219
|
+
minimumFractionDigits: 2,
|
|
220
|
+
maximumFractionDigits: 2,
|
|
221
|
+
})}`;
|
|
222
|
+
}, []);
|
|
223
|
+
|
|
224
|
+
const { getYScale, drawingArea } = useCartesianChartContext();
|
|
225
|
+
const [amount, setAmount] = useState(startAmount);
|
|
226
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
227
|
+
const [textDimensions, setTextDimensions] = useState({ width: 0, height: 0 });
|
|
228
|
+
const color = amount >= baselineAmount ? 'var(--color-bgPositive)' : 'var(--color-bgNegative)';
|
|
229
|
+
|
|
230
|
+
const yScale = getYScale();
|
|
231
|
+
|
|
232
|
+
// Set up persistent event listeners on the chart SVG element
|
|
233
|
+
useEffect(() => {
|
|
234
|
+
const element = chartRef.current;
|
|
235
|
+
|
|
236
|
+
if (!element || !yScale || !('invert' in yScale && typeof yScale.invert === 'function')) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const updatePosition = (clientX: number, clientY: number) => {
|
|
241
|
+
const point = element.createSVGPoint();
|
|
242
|
+
point.x = clientX;
|
|
243
|
+
point.y = clientY;
|
|
244
|
+
|
|
245
|
+
const svgPoint = point.matrixTransform(element.getScreenCTM()?.inverse());
|
|
246
|
+
|
|
247
|
+
// Clamp the Y position to the chart area
|
|
248
|
+
const clampedY = Math.max(
|
|
249
|
+
drawingArea.y,
|
|
250
|
+
Math.min(drawingArea.y + drawingArea.height, svgPoint.y),
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
const rawAmount = yScale.invert(clampedY);
|
|
254
|
+
|
|
255
|
+
const rawPercentage = ((rawAmount - baselineAmount) / baselineAmount) * 100;
|
|
256
|
+
|
|
257
|
+
let targetPercentage = Math.round(rawPercentage);
|
|
258
|
+
|
|
259
|
+
if (targetPercentage === 0) {
|
|
260
|
+
targetPercentage = rawPercentage >= 0 ? 1 : -1;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const newAmount = baselineAmount * (1 + targetPercentage / 100);
|
|
264
|
+
setAmount(newAmount);
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
const handleMouseMove = (event: MouseEvent) => {
|
|
268
|
+
if (!isDragging) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
updatePosition(event.clientX, event.clientY);
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
const handleTouchMove = (event: TouchEvent) => {
|
|
275
|
+
if (!isDragging || event.touches.length === 0) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const touch = event.touches[0];
|
|
279
|
+
updatePosition(touch.clientX, touch.clientY);
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const handleMouseUp = () => {
|
|
283
|
+
setIsDragging(false);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const handleTouchEnd = () => {
|
|
287
|
+
setIsDragging(false);
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
const handleMouseLeave = () => {
|
|
291
|
+
setIsDragging(false);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
element.addEventListener('mousemove', handleMouseMove);
|
|
295
|
+
element.addEventListener('mouseup', handleMouseUp);
|
|
296
|
+
element.addEventListener('mouseleave', handleMouseLeave);
|
|
297
|
+
element.addEventListener('touchmove', handleTouchMove);
|
|
298
|
+
element.addEventListener('touchend', handleTouchEnd);
|
|
299
|
+
element.addEventListener('touchcancel', handleTouchEnd);
|
|
300
|
+
|
|
301
|
+
return () => {
|
|
302
|
+
element.removeEventListener('mousemove', handleMouseMove);
|
|
303
|
+
element.removeEventListener('mouseup', handleMouseUp);
|
|
304
|
+
element.removeEventListener('mouseleave', handleMouseLeave);
|
|
305
|
+
element.removeEventListener('touchmove', handleTouchMove);
|
|
306
|
+
element.removeEventListener('touchend', handleTouchEnd);
|
|
307
|
+
element.removeEventListener('touchcancel', handleTouchEnd);
|
|
308
|
+
};
|
|
309
|
+
}, [isDragging, yScale, chartRef, baselineAmount, drawingArea.y, drawingArea.height]);
|
|
310
|
+
|
|
311
|
+
if (!yScale) return null;
|
|
312
|
+
|
|
313
|
+
const yPixel = yScale(amount);
|
|
314
|
+
|
|
315
|
+
if (yPixel === undefined || yPixel === null) return null;
|
|
316
|
+
|
|
317
|
+
const difference = amount - baselineAmount;
|
|
318
|
+
const percentageChange = Math.round((difference / baselineAmount) * 100);
|
|
319
|
+
const isPositive = difference > 0;
|
|
320
|
+
|
|
321
|
+
const percentageLabel = isPhone
|
|
322
|
+
? `${Math.abs(percentageChange)}%`
|
|
323
|
+
: `${Math.abs(percentageChange)}% (${formatPrice(Math.abs(difference))})`;
|
|
324
|
+
const dollarLabel = formatPrice(amount);
|
|
325
|
+
|
|
326
|
+
const handleMouseDown = (e: React.MouseEvent) => {
|
|
327
|
+
e.preventDefault();
|
|
328
|
+
setIsDragging(true);
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const handleTouchStart = (e: React.TouchEvent) => {
|
|
332
|
+
e.preventDefault();
|
|
333
|
+
setIsDragging(true);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const padding = 16;
|
|
337
|
+
const dragIconSize = 16;
|
|
338
|
+
const trendArrowIconSize = 16;
|
|
339
|
+
const iconGap = 8;
|
|
340
|
+
const totalPadding = padding * 2 + iconGap;
|
|
341
|
+
|
|
342
|
+
const rectWidth = textDimensions.width + totalPadding + dragIconSize + trendArrowIconSize;
|
|
343
|
+
|
|
344
|
+
return (
|
|
345
|
+
<>
|
|
346
|
+
<ReferenceLine
|
|
347
|
+
dataY={amount}
|
|
348
|
+
label={dollarLabel}
|
|
349
|
+
labelPosition="right"
|
|
350
|
+
labelProps={{
|
|
351
|
+
background: color,
|
|
352
|
+
borderRadius: 4,
|
|
353
|
+
color: 'white',
|
|
354
|
+
dx: -12,
|
|
355
|
+
font: 'label1',
|
|
356
|
+
horizontalAlignment: 'right',
|
|
357
|
+
inset: { top: 5, bottom: 5, left: 10, right: 10 },
|
|
358
|
+
}}
|
|
359
|
+
/>
|
|
360
|
+
<g
|
|
361
|
+
onMouseDown={handleMouseDown}
|
|
362
|
+
onTouchStart={handleTouchStart}
|
|
363
|
+
style={{
|
|
364
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
365
|
+
opacity: textDimensions.width === 0 ? 0 : 1,
|
|
366
|
+
}}
|
|
367
|
+
>
|
|
368
|
+
<rect
|
|
369
|
+
fill="var(--color-bgSecondary)"
|
|
370
|
+
height={32}
|
|
371
|
+
rx={theme.borderRadius['400']}
|
|
372
|
+
ry={theme.borderRadius['400']}
|
|
373
|
+
width={rectWidth}
|
|
374
|
+
x={drawingArea.x}
|
|
375
|
+
y={yPixel - 16}
|
|
376
|
+
/>
|
|
377
|
+
<DragIcon x={drawingArea.x + padding} y={yPixel} />
|
|
378
|
+
<TrendArrowIcon
|
|
379
|
+
color={color}
|
|
380
|
+
isPositive={isPositive}
|
|
381
|
+
x={drawingArea.x + padding + dragIconSize + iconGap}
|
|
382
|
+
y={yPixel}
|
|
383
|
+
/>
|
|
384
|
+
<ChartText
|
|
385
|
+
disableRepositioning
|
|
386
|
+
color={color}
|
|
387
|
+
font="label1"
|
|
388
|
+
horizontalAlignment="left"
|
|
389
|
+
onDimensionsChange={(dimensions) => setTextDimensions(dimensions)}
|
|
390
|
+
verticalAlignment="middle"
|
|
391
|
+
x={drawingArea.x + padding + dragIconSize + iconGap + trendArrowIconSize}
|
|
392
|
+
y={yPixel + 1}
|
|
393
|
+
>
|
|
394
|
+
{percentageLabel}
|
|
395
|
+
</ChartText>
|
|
396
|
+
</g>
|
|
397
|
+
</>
|
|
398
|
+
);
|
|
399
|
+
},
|
|
400
|
+
);
|
|
401
|
+
|
|
402
|
+
const PriceTargetChart = () => {
|
|
403
|
+
const priceData = useMemo(() => sparklineInteractiveData.year.map((d) => d.value), []);
|
|
404
|
+
const { isPhone } = useBreakpoints();
|
|
405
|
+
|
|
406
|
+
const chartRef = useRef<SVGSVGElement>(null);
|
|
407
|
+
|
|
408
|
+
const formatPrice = useCallback((value: number) => {
|
|
409
|
+
return `$${value.toLocaleString('en-US', {
|
|
410
|
+
minimumFractionDigits: 2,
|
|
411
|
+
maximumFractionDigits: 2,
|
|
412
|
+
})}`;
|
|
413
|
+
}, []);
|
|
414
|
+
|
|
415
|
+
return (
|
|
416
|
+
<LineChart
|
|
417
|
+
ref={chartRef}
|
|
418
|
+
showArea
|
|
419
|
+
animate={false}
|
|
420
|
+
curve="monotone"
|
|
421
|
+
height={250}
|
|
422
|
+
inset={isPhone ? { top: 16, bottom: 16, left: 0, right: 0 } : { top: 16, bottom: 16, left: 8, right: 80 }}
|
|
423
|
+
series={[
|
|
424
|
+
{
|
|
425
|
+
id: 'prices',
|
|
426
|
+
data: priceData,
|
|
427
|
+
color: assets.btc.color,
|
|
428
|
+
},
|
|
429
|
+
]}
|
|
430
|
+
yAxis={{ domain: ({ min, max }) => ({ min: min * 0.7, max: max * 1.3 }) }}
|
|
431
|
+
>
|
|
432
|
+
{!isPhone && (
|
|
433
|
+
<ReferenceLine
|
|
434
|
+
LineComponent={SolidLine}
|
|
435
|
+
dataY={priceData[priceData.length - 1]}
|
|
436
|
+
label={formatPrice(priceData[priceData.length - 1])}
|
|
437
|
+
labelProps={{ dx: 8, horizontalAlignment: 'left' }}
|
|
438
|
+
/>
|
|
439
|
+
)}
|
|
440
|
+
<DraggableReferenceLine
|
|
441
|
+
baselineAmount={priceData[priceData.length - 1]}
|
|
442
|
+
chartRef={chartRef}
|
|
443
|
+
startAmount={priceData[priceData.length - 1] * 1.3}
|
|
444
|
+
/>
|
|
445
|
+
</LineChart>
|
|
446
|
+
);
|
|
447
|
+
};
|
|
448
|
+
return <PriceTargetChart />
|
|
449
|
+
}
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# RemoteImage
|
|
2
|
+
|
|
3
|
+
A React component for displaying different types of images, including network images, static resources, temporary local images, and images from local disk, such as the camera roll.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { RemoteImage } from '@coinbase/cds-web/media/RemoteImage'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `alignContent` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| baseline \| first baseline \| last baseline \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
16
|
+
| `alignItems` | `ResponsiveProp<center \| normal \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
17
|
+
| `alignSelf` | `ResponsiveProp<center \| normal \| auto \| start \| end \| flex-start \| flex-end \| self-start \| self-end \| stretch \| baseline \| first baseline \| last baseline>` | No | `-` | - |
|
|
18
|
+
| `as` | `img` | No | `-` | - |
|
|
19
|
+
| `aspectRatio` | `auto \| inherit \| string & {} \| -moz-initial \| initial \| revert \| revert-layer \| unset \| number & {}` | No | `-` | - |
|
|
20
|
+
| `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 | `-` | - |
|
|
21
|
+
| `borderBottomLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
22
|
+
| `borderBottomRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
23
|
+
| `borderBottomWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
24
|
+
| `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 | `-` | - |
|
|
25
|
+
| `borderEndWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
26
|
+
| `borderRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
27
|
+
| `borderStartWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
28
|
+
| `borderTopLeftRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
29
|
+
| `borderTopRightRadius` | `0 \| 100 \| 200 \| 300 \| 400 \| 500 \| 600 \| 700 \| 800 \| 900 \| 1000` | No | `-` | - |
|
|
30
|
+
| `borderTopWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
31
|
+
| `borderWidth` | `0 \| 100 \| 200 \| 300 \| 400 \| 500` | No | `-` | - |
|
|
32
|
+
| `bordered` | `boolean` | No | `-` | Add a border around all sides of the box. |
|
|
33
|
+
| `borderedBottom` | `boolean` | No | `-` | Add a border to the bottom side of the box. |
|
|
34
|
+
| `borderedEnd` | `boolean` | No | `-` | Add a border to the trailing side of the box. |
|
|
35
|
+
| `borderedHorizontal` | `boolean` | No | `-` | Add a border to the leading and trailing sides of the box. |
|
|
36
|
+
| `borderedStart` | `boolean` | No | `-` | Add a border to the leading side of the box. |
|
|
37
|
+
| `borderedTop` | `boolean` | No | `-` | Add a border to the top side of the box. |
|
|
38
|
+
| `borderedVertical` | `boolean` | No | `-` | Add a border to the top and bottom sides of the box. |
|
|
39
|
+
| `bottom` | `ResponsiveProp<Bottom<string \| number>>` | No | `-` | - |
|
|
40
|
+
| `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 | `-` | - |
|
|
41
|
+
| `columnGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
42
|
+
| `dangerouslySetBackground` | `string` | No | `-` | - |
|
|
43
|
+
| `display` | `ResponsiveProp<grid \| revert \| none \| block \| inline \| inline-block \| flex \| inline-flex \| inline-grid \| contents \| flow-root \| list-item>` | No | `-` | - |
|
|
44
|
+
| `elevation` | `0 \| 1 \| 2` | No | `-` | - |
|
|
45
|
+
| `flexBasis` | `ResponsiveProp<FlexBasis<string \| number>>` | No | `-` | - |
|
|
46
|
+
| `flexDirection` | `ResponsiveProp<column \| row \| row-reverse \| column-reverse>` | No | `-` | - |
|
|
47
|
+
| `flexGrow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
48
|
+
| `flexShrink` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
49
|
+
| `flexWrap` | `ResponsiveProp<nowrap \| wrap \| wrap-reverse>` | No | `-` | - |
|
|
50
|
+
| `font` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
51
|
+
| `fontFamily` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | - |
|
|
52
|
+
| `fontSize` | `ResponsiveProp<FontSize \| inherit>` | No | `-` | - |
|
|
53
|
+
| `fontWeight` | `ResponsiveProp<FontWeight \| inherit>` | No | `-` | - |
|
|
54
|
+
| `gap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
55
|
+
| `grid` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
56
|
+
| `gridArea` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
57
|
+
| `gridAutoColumns` | `ResponsiveProp<GridAutoColumns<string \| number>>` | No | `-` | - |
|
|
58
|
+
| `gridAutoFlow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| row \| column \| dense` | No | `-` | - |
|
|
59
|
+
| `gridAutoRows` | `ResponsiveProp<GridAutoRows<string \| number>>` | No | `-` | - |
|
|
60
|
+
| `gridColumn` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
61
|
+
| `gridColumnEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
62
|
+
| `gridColumnStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
63
|
+
| `gridRow` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
64
|
+
| `gridRowEnd` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
65
|
+
| `gridRowStart` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
66
|
+
| `gridTemplate` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
67
|
+
| `gridTemplateAreas` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
68
|
+
| `gridTemplateColumns` | `ResponsiveProp<GridTemplateColumns<string \| number>>` | No | `-` | - |
|
|
69
|
+
| `gridTemplateRows` | `ResponsiveProp<GridTemplateRows<string \| number>>` | No | `-` | - |
|
|
70
|
+
| `height` | `ResponsiveProp<Height<string \| number>>` | No | `-` | - |
|
|
71
|
+
| `justifyContent` | `ResponsiveProp<left \| right \| center \| normal \| start \| end \| flex-start \| flex-end \| stretch \| space-between \| space-around \| space-evenly>` | No | `-` | - |
|
|
72
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
73
|
+
| `left` | `ResponsiveProp<Left<string \| number>>` | No | `-` | - |
|
|
74
|
+
| `lineHeight` | `ResponsiveProp<LineHeight \| inherit>` | No | `-` | - |
|
|
75
|
+
| `margin` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
76
|
+
| `marginBottom` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
77
|
+
| `marginEnd` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
78
|
+
| `marginStart` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
79
|
+
| `marginTop` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
80
|
+
| `marginX` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
81
|
+
| `marginY` | `ResponsiveProp<0 \| -5 \| -10 \| -0.25 \| -0.5 \| -0.75 \| -1 \| -1.5 \| -2 \| -3 \| -4 \| -6 \| -7 \| -8 \| -9>` | No | `-` | - |
|
|
82
|
+
| `maxHeight` | `ResponsiveProp<MaxHeight<string \| number>>` | No | `-` | - |
|
|
83
|
+
| `maxWidth` | `ResponsiveProp<MaxWidth<string \| number>>` | No | `-` | - |
|
|
84
|
+
| `minHeight` | `ResponsiveProp<MinHeight<string \| number>>` | No | `-` | - |
|
|
85
|
+
| `minWidth` | `ResponsiveProp<MinWidth<string \| number>>` | No | `-` | - |
|
|
86
|
+
| `onChange` | `FormEventHandler<HTMLImageElement>` | No | `-` | - |
|
|
87
|
+
| `opacity` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset` | No | `-` | - |
|
|
88
|
+
| `overflow` | `ResponsiveProp<hidden \| auto \| visible \| clip \| scroll>` | No | `-` | - |
|
|
89
|
+
| `padding` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
90
|
+
| `paddingBottom` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
91
|
+
| `paddingEnd` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
92
|
+
| `paddingStart` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
93
|
+
| `paddingTop` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
94
|
+
| `paddingX` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
95
|
+
| `paddingY` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
96
|
+
| `pin` | `top \| bottom \| left \| right \| all` | No | `-` | Direction in which to absolutely pin the box. |
|
|
97
|
+
| `position` | `ResponsiveProp<fixed \| static \| relative \| absolute \| sticky>` | No | `-` | - |
|
|
98
|
+
| `ref` | `((instance: HTMLImageElement \| null) => void) \| RefObject<HTMLImageElement> \| null` | No | `-` | - |
|
|
99
|
+
| `resizeMode` | `cover \| contain` | No | `-` | - |
|
|
100
|
+
| `right` | `ResponsiveProp<Right<string \| number>>` | No | `-` | - |
|
|
101
|
+
| `rowGap` | `0 \| 5 \| 10 \| 0.25 \| 0.5 \| 0.75 \| 1 \| 1.5 \| 2 \| 3 \| 4 \| 6 \| 7 \| 8 \| 9` | No | `-` | - |
|
|
102
|
+
| `shape` | `rectangle \| circle \| squircle \| square \| hexagon` | No | `square` | Shape of RemoteImage |
|
|
103
|
+
| `size` | `s \| l \| m \| xl \| xxl \| xxxl` | No | `m` | Size for a given RemoteImage. If width or height is not defined, it will set size = m as default |
|
|
104
|
+
| `source` | `string` | No | `-` | Absolute url to the image that should be shown in the RemoteImage. If no source is provided then a generic fallback image is used. |
|
|
105
|
+
| `style` | `CSSProperties` | No | `-` | - |
|
|
106
|
+
| `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 |
|
|
107
|
+
| `textAlign` | `ResponsiveProp<center \| start \| end \| justify>` | No | `-` | - |
|
|
108
|
+
| `textDecoration` | `ResponsiveProp<none \| underline \| overline \| line-through \| underline overline \| underline double>` | No | `-` | - |
|
|
109
|
+
| `textTransform` | `ResponsiveProp<capitalize \| lowercase \| none \| uppercase>` | No | `-` | - |
|
|
110
|
+
| `top` | `ResponsiveProp<Top<string \| number>>` | No | `-` | - |
|
|
111
|
+
| `transform` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| none` | No | `-` | - |
|
|
112
|
+
| `userSelect` | `ResponsiveProp<text \| none \| auto \| all>` | No | `-` | - |
|
|
113
|
+
| `visibility` | `ResponsiveProp<hidden \| visible>` | No | `-` | - |
|
|
114
|
+
| `width` | `ResponsiveProp<Width<string \| number>>` | No | `-` | - |
|
|
115
|
+
| `zIndex` | `-moz-initial \| inherit \| initial \| revert \| revert-layer \| unset \| auto` | No | `-` | - |
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## Examples
|
|
119
|
+
|
|
120
|
+
### Border Color
|
|
121
|
+
|
|
122
|
+
Adjust the borderColor of RemoteImages
|
|
123
|
+
|
|
124
|
+
```jsx live
|
|
125
|
+
<RemoteImage source={assets.eth.imageUrl} shape="circle" size="xxxl" borderColor="secondary" />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### size
|
|
129
|
+
|
|
130
|
+
Adjust size of RemoteImage using AvatarSizes
|
|
131
|
+
|
|
132
|
+
```jsx live
|
|
133
|
+
<HStack gap={1}>
|
|
134
|
+
<RemoteImage source={assets.ada.imageUrl} size="m" shape="circle" />
|
|
135
|
+
<RemoteImage source={assets.eth.imageUrl} size="l" shape="circle" />
|
|
136
|
+
<RemoteImage source={assets.ltc.imageUrl} size="xl" shape="circle" />
|
|
137
|
+
<RemoteImage source={assets.sushi.imageUrl} size="xxl" shape="circle" />
|
|
138
|
+
<RemoteImage source={assets.uni.imageUrl} size="xxxl" shape="circle" />
|
|
139
|
+
</HStack>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### Shape
|
|
143
|
+
|
|
144
|
+
```jsx live
|
|
145
|
+
<VStack gap={2}>
|
|
146
|
+
<RemoteImage source={assets.ada.imageUrl} size="xxxl" shape="circle" />
|
|
147
|
+
<RemoteImage source={squareAssets.human1} size="xxxl" shape="squircle" />
|
|
148
|
+
<RemoteImage source={squareAssets.human2} size="xxxl" shape="square" />
|
|
149
|
+
<RemoteImage source={squareAssets.human3} width={40} height={60} shape="rectangle" />
|
|
150
|
+
</VStack>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Default fallback
|
|
154
|
+
|
|
155
|
+
If no images are shown, RemoteImage will show a default Fallback. Be aware that a rectangular fallback will truncate content from the fallback to fit the rectangle.
|
|
156
|
+
|
|
157
|
+
```jsx live
|
|
158
|
+
<VStack gap={2}>
|
|
159
|
+
<RemoteImage size="m" shape="squircle" />
|
|
160
|
+
<RemoteImage size="l" shape="circle" />
|
|
161
|
+
<RemoteImage size="xl" shape="square" />
|
|
162
|
+
<RemoteImage width={50} height={80} shape="rectangle" />
|
|
163
|
+
</VStack>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
|