@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,204 @@
|
|
|
1
|
+
# Scrubber
|
|
2
|
+
|
|
3
|
+
An interactive scrubber component for exploring individual data points in charts. Displays values on hover or drag and supports custom labels and formatting.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { Scrubber } from '@coinbase/cds-mobile-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
|
+
| `LineComponent` | `FunctionComponent<ReferenceLineProps> \| ComponentClass<ReferenceLineProps, any>` | No | `-` | Custom component for the scrubber line. |
|
|
17
|
+
| `hideLine` | `boolean` | No | `-` | Hides the scrubber line |
|
|
18
|
+
| `hideOverlay` | `boolean` | No | `-` | Whether to hide the overlay rect which obscures future data. |
|
|
19
|
+
| `idlePulse` | `boolean` | No | `-` | Pulse the scrubber beacon while it is at rest. |
|
|
20
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
21
|
+
| `label` | `ChartTextChildren \| ((dataIndex: number) => ChartTextChildren)` | No | `-` | Label text displayed above the scrubber line. |
|
|
22
|
+
| `labelProps` | `ReferenceLineLabelProps` | No | `-` | Props passed to the scrubber lines label. |
|
|
23
|
+
| `lineStroke` | `string` | No | `-` | Stroke color for the scrubber line. |
|
|
24
|
+
| `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. |
|
|
25
|
+
| `ref` | `((instance: ScrubberBeaconRef \| null) => void) \| RefObject<ScrubberBeaconRef> \| null` | No | `-` | - |
|
|
26
|
+
| `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. |
|
|
27
|
+
| `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 |
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Basic Example
|
|
33
|
+
|
|
34
|
+
Scrubber can be used to provide horizontal interaction with a chart. As your mouse hovers over the chart, you will see a reference line and scrubber head following your cursor.
|
|
35
|
+
|
|
36
|
+
```jsx
|
|
37
|
+
<LineChart
|
|
38
|
+
enableScrubbing
|
|
39
|
+
height={150}
|
|
40
|
+
series={[
|
|
41
|
+
{
|
|
42
|
+
id: 'prices',
|
|
43
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
44
|
+
},
|
|
45
|
+
]}
|
|
46
|
+
curve="monotone"
|
|
47
|
+
showYAxis
|
|
48
|
+
showArea
|
|
49
|
+
yAxis={{
|
|
50
|
+
showGrid: true,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<Scrubber />
|
|
54
|
+
</LineChart>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Multiple Series
|
|
58
|
+
|
|
59
|
+
All series will be scrubbed by default. You can set the `seriesIds` prop to restrict the scrubbing to specific series.
|
|
60
|
+
|
|
61
|
+
```jsx
|
|
62
|
+
<LineChart
|
|
63
|
+
enableScrubbing
|
|
64
|
+
height={150}
|
|
65
|
+
series={[
|
|
66
|
+
{
|
|
67
|
+
id: 'top',
|
|
68
|
+
data: [15, 28, 32, 44, 46, 36, 40, 45, 48, 38],
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'upperMiddle',
|
|
72
|
+
data: [12, 23, 21, 29, 34, 28, 31, 38, 42, 35],
|
|
73
|
+
color: '#ef4444',
|
|
74
|
+
type: 'dotted',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'lowerMiddle',
|
|
78
|
+
data: [8, 15, 14, 25, 20, 18, 22, 28, 24, 30],
|
|
79
|
+
color: '#f59e0b',
|
|
80
|
+
curve: 'natural',
|
|
81
|
+
LineComponent: (props) => (
|
|
82
|
+
<GradientLine {...props} endColor="#F7931A" startColor="#E3D74D" strokeWidth={4} />
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: 'bottom',
|
|
87
|
+
data: [4, 8, 11, 15, 16, 14, 16, 10, 12, 14],
|
|
88
|
+
color: '#800080',
|
|
89
|
+
curve: 'step',
|
|
90
|
+
AreaComponent: DottedArea,
|
|
91
|
+
showArea: true,
|
|
92
|
+
},
|
|
93
|
+
]}
|
|
94
|
+
>
|
|
95
|
+
<Scrubber seriesIds={['top', 'lowerMiddle']} />
|
|
96
|
+
</LineChart>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Pulsing
|
|
100
|
+
|
|
101
|
+
Setting the `idlePulse` prop will cause the scrubber heads to pulse when the user is not actively scrubbing.
|
|
102
|
+
|
|
103
|
+
```jsx
|
|
104
|
+
<LineChart
|
|
105
|
+
enableScrubbing
|
|
106
|
+
height={250}
|
|
107
|
+
series={[
|
|
108
|
+
{
|
|
109
|
+
id: 'prices',
|
|
110
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
111
|
+
},
|
|
112
|
+
]}
|
|
113
|
+
curve="monotone"
|
|
114
|
+
showArea
|
|
115
|
+
>
|
|
116
|
+
<Scrubber idlePulse />
|
|
117
|
+
</LineChart>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### With Imperative Handle
|
|
121
|
+
|
|
122
|
+
You can also use the imperative handle to pulse the scrubber heads programmatically.
|
|
123
|
+
|
|
124
|
+
```jsx
|
|
125
|
+
function ImperativeHandle() {
|
|
126
|
+
const theme = useTheme();
|
|
127
|
+
const scrubberRef = useRef(null);
|
|
128
|
+
return (
|
|
129
|
+
<VStack gap={2}>
|
|
130
|
+
<LineChart
|
|
131
|
+
enableScrubbing
|
|
132
|
+
height={150}
|
|
133
|
+
series={[
|
|
134
|
+
{
|
|
135
|
+
id: 'priceA',
|
|
136
|
+
data: [2400, 1398, 9800, 3908, 4800, 3800, 4300],
|
|
137
|
+
color: theme.color.accentBoldBlue,
|
|
138
|
+
curve: 'natural',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: 'priceB',
|
|
142
|
+
data: [2000, 2491, 4501, 6049, 5019, 4930, 5910],
|
|
143
|
+
color: theme.color.accentBoldGreen,
|
|
144
|
+
curve: 'natural',
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
id: 'priceC',
|
|
148
|
+
data: [1000, 4910, 2300, 5910, 3940, 2940, 1940],
|
|
149
|
+
color: theme.color.accentBoldPurple,
|
|
150
|
+
curve: 'natural',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
id: 'priceD',
|
|
154
|
+
data: [4810, 2030, 5810, 3940, 2940, 1940, 940],
|
|
155
|
+
color: theme.color.accentBoldYellow,
|
|
156
|
+
curve: 'natural',
|
|
157
|
+
},
|
|
158
|
+
]}
|
|
159
|
+
xAxis={{
|
|
160
|
+
range: ({ min, max }) => ({ min, max: max - 32 }),
|
|
161
|
+
}}
|
|
162
|
+
showYAxis
|
|
163
|
+
yAxis={{
|
|
164
|
+
domain: {
|
|
165
|
+
min: 0,
|
|
166
|
+
},
|
|
167
|
+
showGrid: true,
|
|
168
|
+
tickLabelFormatter: (value) => value.toLocaleString(),
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
<Scrubber ref={scrubberRef} />
|
|
172
|
+
</LineChart>
|
|
173
|
+
<Button onClick={() => scrubberRef.current?.pulse()}>Pulse</Button>
|
|
174
|
+
</VStack>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Disable Overlay When Scrubbing
|
|
180
|
+
|
|
181
|
+
By default, the scrubber will show an overlay to de-emphasize future data. You can hide this by setting the `hideOverlay` prop to `true`.
|
|
182
|
+
|
|
183
|
+
```jsx
|
|
184
|
+
<LineChart
|
|
185
|
+
enableScrubbing
|
|
186
|
+
height={250}
|
|
187
|
+
series={[
|
|
188
|
+
{
|
|
189
|
+
id: 'prices',
|
|
190
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
|
|
191
|
+
},
|
|
192
|
+
]}
|
|
193
|
+
curve="monotone"
|
|
194
|
+
showYAxis
|
|
195
|
+
showArea
|
|
196
|
+
yAxis={{
|
|
197
|
+
showGrid: true,
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<Scrubber hideOverlay />
|
|
201
|
+
</LineChart>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# SearchInput
|
|
2
|
+
|
|
3
|
+
A control for searching a dataset.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { SearchInput } from '@coinbase/cds-mobile/controls/SearchInput'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `allowFontScaling` | `boolean` | No | `-` | Specifies whether fonts should scale to respect Text Size accessibility settings. The default is true. |
|
|
16
|
+
| `autoCapitalize` | `none \| sentences \| words \| characters` | No | `-` | Can tell TextInput to automatically capitalize certain characters. characters: all characters, words: first letter of each word sentences: first letter of each sentence (default) none: dont auto capitalize anything https://reactnative.dev/docs/textinput#autocapitalize |
|
|
17
|
+
| `autoComplete` | `email \| off \| name \| additional-name \| address-line1 \| address-line2 \| birthdate-day \| birthdate-full \| birthdate-month \| birthdate-year \| cc-csc \| cc-exp \| cc-exp-day \| cc-exp-month \| cc-exp-year \| cc-number \| cc-name \| cc-given-name \| cc-middle-name \| cc-family-name \| cc-type \| country \| current-password \| family-name \| gender \| given-name \| honorific-prefix \| honorific-suffix \| name-family \| name-given \| name-middle \| name-middle-initial \| name-prefix \| name-suffix \| new-password \| nickname \| one-time-code \| organization \| organization-title \| password \| password-new \| postal-address \| postal-address-country \| postal-address-extended \| postal-address-extended-postal-code \| postal-address-locality \| postal-address-region \| postal-code \| street-address \| sms-otp \| tel \| tel-country-code \| tel-national \| tel-device \| url \| username \| username-new` | No | `-` | Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content. To disable autocomplete, set autoComplete to off. The following values work across platforms: - additional-name - address-line1 - address-line2 - cc-number - country - current-password - email - family-name - given-name - honorific-prefix - honorific-suffix - name - new-password - off - one-time-code - postal-code - street-address - tel - username The following values work on iOS only: - nickname - organization - organization-title - url The following values work on Android only: - birthdate-day - birthdate-full - birthdate-month - birthdate-year - cc-csc - cc-exp - cc-exp-day - cc-exp-month - cc-exp-year - gender - name-family - name-given - name-middle - name-middle-initial - name-prefix - name-suffix - password - password-new - postal-address - postal-address-country - postal-address-extended - postal-address-extended-postal-code - postal-address-locality - postal-address-region - sms-otp - tel-country-code - tel-national - tel-device - username-new |
|
|
18
|
+
| `autoCorrect` | `boolean` | No | `-` | If false, disables auto-correct. The default value is true. |
|
|
19
|
+
| `autoFocus` | `boolean` | No | `-` | If true, focuses the input on componentDidMount. The default value is false. |
|
|
20
|
+
| `blurOnSubmit` | `boolean` | No | `-` | If true, the text field will blur when submitted. The default value is true. |
|
|
21
|
+
| `caretHidden` | `boolean` | No | `-` | If true, caret is hidden. The default value is false. |
|
|
22
|
+
| `clearButtonMode` | `never \| while-editing \| unless-editing \| always` | No | `-` | enum(never, while-editing, unless-editing, always) When the clear button should appear on the right side of the text view |
|
|
23
|
+
| `clearIconAccessibilityLabel` | `string` | No | `-` | Set the a11y label for the clear icon |
|
|
24
|
+
| `clearTextOnFocus` | `boolean` | No | `-` | If true, clears the text field automatically when editing begins |
|
|
25
|
+
| `compact` | `boolean` | No | `false` | Enables compact variation |
|
|
26
|
+
| `contextMenuHidden` | `boolean` | No | `-` | If true, context menu is hidden. The default value is false. |
|
|
27
|
+
| `cursorColor` | `ColorValue \| null` | No | `-` | When provided it will set the color of the cursor (or caret) in the component. Unlike the behavior of selectionColor the cursor color will be set independently from the color of the text selection box. |
|
|
28
|
+
| `dataDetectorTypes` | `DataDetectorTypes \| DataDetectorTypes[]` | No | `-` | Determines the types of data converted to clickable URLs in the text input. Only valid if multiline={true} and editable={false}. By default no data types are detected. You can provide one type or an array of many types. Possible values for dataDetectorTypes are: - phoneNumber - link - address - calendarEvent - none - all |
|
|
29
|
+
| `defaultValue` | `string` | No | `-` | Provides an initial value that will change when the user starts typing. Useful for simple use-cases where you dont want to deal with listening to events and updating the value prop to keep the controlled state in sync. |
|
|
30
|
+
| `disableBackArrow` | `boolean` | No | `false` | If this is set to true, the start icon wont toggle between backArrow and Search. The start icon will always be a search icon |
|
|
31
|
+
| `disableFullscreenUI` | `boolean` | No | `-` | When false, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone), the OS may choose to have the user edit the text inside of a full screen text input mode. When true, this feature is disabled and users will always edit the text directly inside of the text input. Defaults to false. |
|
|
32
|
+
| `disabled` | `boolean` | No | `false` | Toggles input interactability and opacity |
|
|
33
|
+
| `editable` | `boolean` | No | `-` | If false, text is not editable. The default value is true. |
|
|
34
|
+
| `enableColorSurge` | `boolean` | No | `-` | Enable Color Surge motion |
|
|
35
|
+
| `enablesReturnKeyAutomatically` | `boolean` | No | `-` | If true, the keyboard disables the return key when there is no text and automatically enables it when there is text. The default value is false. |
|
|
36
|
+
| `end` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `undefined` | Set the end node |
|
|
37
|
+
| `enterKeyHint` | `search \| done \| go \| next \| send \| previous \| enter` | No | `-` | Determines what text should be shown to the return key on virtual keyboards. Has precedence over the returnKeyType prop. |
|
|
38
|
+
| `helperTextErrorIconAccessibilityLabel` | `string` | No | `'error'` | Accessibility label for helper text error icon when variant=negative |
|
|
39
|
+
| `hideEndIcon` | `boolean` | No | `undefined` | hide the end icon |
|
|
40
|
+
| `hideStartIcon` | `boolean` | No | `false` | hide the start icon |
|
|
41
|
+
| `importantForAutofill` | `auto \| yes \| no \| noExcludeDescendants \| yesExcludeDescendants` | No | `-` | Determines whether the individual fields in your app should be included in a view structure for autofill purposes on Android API Level 26+. Defaults to auto. To disable auto complete, use off. *Android Only* The following values work on Android only: - auto - let Android decide - no - not important for autofill - noExcludeDescendants - this view and its children arent important for autofill - yes - is important for autofill - yesExcludeDescendants - this view is important for autofill but its children arent |
|
|
42
|
+
| `inlineImageLeft` | `string` | No | `-` | If defined, the provided image resource will be rendered on the left. |
|
|
43
|
+
| `inlineImagePadding` | `number` | No | `-` | Padding between the inline image, if any, and the text input itself. |
|
|
44
|
+
| `inputAccessoryViewID` | `string` | No | `-` | Used to connect to an InputAccessoryView. Not part of react-natives documentation, but present in examples and code. See https://reactnative.dev/docs/inputaccessoryview for more information. |
|
|
45
|
+
| `inputMode` | `search \| none \| text \| email \| tel \| url \| numeric \| decimal` | No | `-` | Works like the inputmode attribute in HTML, it determines which keyboard to open, e.g. numeric and has precedence over keyboardType. |
|
|
46
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
47
|
+
| `keyboardAppearance` | `light \| default \| dark` | No | `-` | Determines the color of the keyboard. |
|
|
48
|
+
| `keyboardType` | `default \| url \| number-pad \| decimal-pad \| numeric \| email-address \| phone-pad \| visible-password \| ascii-capable \| numbers-and-punctuation \| name-phone-pad \| twitter \| web-search` | No | `-` | enum(default, numeric, email-address, ascii-capable, numbers-and-punctuation, url, number-pad, phone-pad, name-phone-pad, decimal-pad, twitter, web-search, visible-password) Determines which keyboard to open, e.g.numeric. The following values work across platforms: - default - numeric - email-address - phone-pad The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search The following values work on Android: - visible-password |
|
|
49
|
+
| `lineBreakStrategyIOS` | `none \| standard \| hangul-word \| push-out` | No | `-` | Set line break strategy on iOS. |
|
|
50
|
+
| `maxFontSizeMultiplier` | `number \| null` | No | `-` | Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values: - null/undefined (default): inherit from the parent node or the global default (0) - 0: no max, ignore parent/global default - >= 1: sets the maxFontSizeMultiplier of this node to this value |
|
|
51
|
+
| `maxLength` | `number` | No | `-` | Limits the maximum number of characters that can be entered. Use this instead of implementing the logic in JS to avoid flicker. |
|
|
52
|
+
| `multiline` | `boolean` | No | `-` | If true, the text input can be multiple lines. The default value is false. |
|
|
53
|
+
| `numberOfLines` | `number` | No | `-` | Sets the number of lines for a TextInput. Use it with multiline set to true to be able to fill the lines. |
|
|
54
|
+
| `onBack` | `((event: GestureResponderEvent) => void)` | No | `-` | Callback is fired when backArrow is pressed. If disableBackArrow is true, this will do nothing |
|
|
55
|
+
| `onBlur` | `((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)` | No | `-` | Callback that is called when the text input is blurred |
|
|
56
|
+
| `onChange` | `((e: NativeSyntheticEvent<TextInputChangeEventData>) => void)` | No | `-` | Callback that is called when the text inputs text changes. |
|
|
57
|
+
| `onChangeText` | `(text: string) => void` | No | `-` | Callback that is called when the text inputs text changes. Changed text is passed as an argument to the callback handler. |
|
|
58
|
+
| `onClear` | `((event: GestureResponderEvent) => void)` | No | `-` | Callback is fired when the clear icon is pressed |
|
|
59
|
+
| `onContentSizeChange` | `((e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => void)` | No | `-` | Callback that is called when the text inputs content size changes. This will be called with { nativeEvent: { contentSize: { width, height } } }. Only called for multiline text inputs. |
|
|
60
|
+
| `onEndEditing` | `((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void)` | No | `-` | Callback that is called when text input ends. |
|
|
61
|
+
| `onFocus` | `((e: NativeSyntheticEvent<TextInputFocusEventData>) => void)` | No | `-` | Callback that is called when the text input is focused |
|
|
62
|
+
| `onKeyPress` | `((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void)` | No | `-` | Callback that is called when a key is pressed. This will be called with { nativeEvent: { key: keyValue } } where keyValue is Enter or Backspace for respective keys and the typed-in character otherwise including for space. Fires before onChange callbacks. Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs. |
|
|
63
|
+
| `onPointerCancel` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
64
|
+
| `onPointerCancelCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
65
|
+
| `onPointerDown` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
66
|
+
| `onPointerDownCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
67
|
+
| `onPointerEnter` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
68
|
+
| `onPointerEnterCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
69
|
+
| `onPointerLeave` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
70
|
+
| `onPointerLeaveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
71
|
+
| `onPointerMove` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
72
|
+
| `onPointerMoveCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
73
|
+
| `onPointerUp` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
74
|
+
| `onPointerUpCapture` | `((event: PointerEvent) => void)` | No | `-` | - |
|
|
75
|
+
| `onPress` | `((e: NativeSyntheticEvent<NativeTouchEvent>) => void)` | No | `-` | Called when a single tap gesture is detected. |
|
|
76
|
+
| `onPressIn` | `((e: NativeSyntheticEvent<NativeTouchEvent>) => void)` | No | `-` | Callback that is called when a touch is engaged. |
|
|
77
|
+
| `onPressOut` | `((e: NativeSyntheticEvent<NativeTouchEvent>) => void)` | No | `-` | Callback that is called when a touch is released. |
|
|
78
|
+
| `onScroll` | `((e: NativeSyntheticEvent<TextInputScrollEventData>) => void)` | No | `-` | Invoked on content scroll with { nativeEvent: { contentOffset: { x, y } } }. May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons. |
|
|
79
|
+
| `onSearch` | `((str: string) => void)` | No | `-` | Callback is fired when a user hits enter on the keyboard. Can obtain the query through str parameter |
|
|
80
|
+
| `onSelectionChange` | `((e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void)` | No | `-` | Callback that is called when the text input selection is changed. |
|
|
81
|
+
| `onSubmitEditing` | `((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void)` | No | `-` | Callback that is called when the text inputs submit button is pressed. |
|
|
82
|
+
| `onTextInput` | `((e: NativeSyntheticEvent<TextInputTextInputEventData>) => void)` | No | `-` | Callback that is called on new text input with the argument { nativeEvent: { text, previousText, range: { start, end } } }. This prop requires multiline={true} to be set. |
|
|
83
|
+
| `passwordRules` | `string \| null` | No | `-` | Provide rules for your password. For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters. required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8; |
|
|
84
|
+
| `placeholder` | `string` | No | `-` | Placeholder text displayed inside of the input. Will be replaced if there is a value. The string that will be rendered before text input has been entered |
|
|
85
|
+
| `placeholderTextColor` | `string \| OpaqueColorValue` | No | `-` | The text color of the placeholder string |
|
|
86
|
+
| `readOnly` | `boolean` | No | `-` | If true, text is not editable. The default value is false. |
|
|
87
|
+
| `ref` | `((instance: TextInput \| null) => void) \| RefObject<TextInput> \| null` | No | `-` | - |
|
|
88
|
+
| `rejectResponderTermination` | `boolean \| null` | No | `-` | If true, allows TextInput to pass touch events to the parent component. This allows components to be swipeable from the TextInput on iOS, as is the case on Android by default. If false, TextInput always asks to handle the input (except when disabled). |
|
|
89
|
+
| `returnKeyLabel` | `string` | No | `-` | Sets the return key to the label. Use it instead of returnKeyType. |
|
|
90
|
+
| `returnKeyType` | `search \| join \| done \| none \| default \| go \| next \| send \| previous \| google \| route \| yahoo \| emergency-call` | No | `-` | enum(default, go, google, join, next, route, search, send, yahoo, done, emergency-call) Determines how the return key should look. |
|
|
91
|
+
| `scrollEnabled` | `boolean` | No | `-` | If false, scrolling of the text view will be disabled. The default value is true. Only works with multiline={true} |
|
|
92
|
+
| `secureTextEntry` | `boolean` | No | `-` | If true, the text input obscures the text entered so that sensitive text like passwords stay secure. The default value is false. |
|
|
93
|
+
| `selectTextOnFocus` | `boolean` | No | `-` | If true, all text will automatically be selected on focus |
|
|
94
|
+
| `selection` | `{ start: number; end?: number; } \| undefined` | No | `-` | The start and end of the text inputs selection. Set start and end to the same value to position the cursor. |
|
|
95
|
+
| `selectionColor` | `string \| OpaqueColorValue` | No | `-` | The highlight (and cursor on ios) color of the text input |
|
|
96
|
+
| `selectionHandleColor` | `ColorValue \| null` | No | `-` | When provided it will set the color of the selection handles when highlighting text. Unlike the behavior of selectionColor the handle color will be set independently from the color of the text selection box. |
|
|
97
|
+
| `selectionState` | `DocumentSelectionState` | No | `-` | See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document |
|
|
98
|
+
| `showSoftInputOnFocus` | `boolean` | No | `-` | When false, it will prevent the soft keyboard from showing when the field is focused. The default value is true |
|
|
99
|
+
| `smartInsertDelete` | `boolean` | No | `-` | If false, the iOS system will not insert an extra space after a paste operation neither delete one or two spaces after a cut or delete operation. The default value is true. |
|
|
100
|
+
| `spellCheck` | `boolean` | No | `-` | If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect |
|
|
101
|
+
| `startIcon` | `search \| backArrow` | No | `search` | Set the start icon. You can only set it to search \| backArrow icon. If you set this, the icon would not toggle between search and backArrow depending on the focus state |
|
|
102
|
+
| `startIconAccessibilityLabel` | `string` | No | `-` | Set the a11y label for the start icon |
|
|
103
|
+
| `style` | `null \| false \| TextStyle \| RegisteredStyle<TextStyle> \| RecursiveArray<Falsy \| TextStyle \| RegisteredStyle<TextStyle>>` | No | `-` | Styles |
|
|
104
|
+
| `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 Used to locate this view in end-to-end tests |
|
|
105
|
+
| `testIDMap` | `{ start?: string; end?: string \| undefined; label?: string \| undefined; helperText?: string \| undefined; } \| undefined` | No | `-` | Add ability to test individual parts of the input |
|
|
106
|
+
| `textAlign` | `left \| right \| center` | No | `-` | Align the input text to the left, center, or right sides of the input field. |
|
|
107
|
+
| `textAlignVertical` | `top \| bottom \| auto \| center` | No | `-` | Vertically align text when multiline is set to true |
|
|
108
|
+
| `textBreakStrategy` | `simple \| highQuality \| balanced` | No | `-` | Set text break strategy on Android API Level 23+, possible values are simple, highQuality, balanced The default value is simple. |
|
|
109
|
+
| `textContentType` | `none \| location \| name \| nickname \| password \| username \| URL \| addressCity \| addressCityAndState \| addressState \| countryName \| creditCardNumber \| creditCardExpiration \| creditCardExpirationMonth \| creditCardExpirationYear \| creditCardSecurityCode \| creditCardType \| creditCardName \| creditCardGivenName \| creditCardMiddleName \| creditCardFamilyName \| emailAddress \| familyName \| fullStreetAddress \| givenName \| jobTitle \| middleName \| namePrefix \| nameSuffix \| organizationName \| postalCode \| streetAddressLine1 \| streetAddressLine2 \| sublocality \| telephoneNumber \| newPassword \| oneTimeCode \| birthdate \| birthdateDay \| birthdateMonth \| birthdateYear` | No | `-` | Give the keyboard and the system information about the expected semantic meaning for the content that users enter. To disable autofill, set textContentType to none. Possible values for textContentType are: - none - URL - addressCity - addressCityAndState - addressState - countryName - creditCardNumber - creditCardExpiration (iOS 17+) - creditCardExpirationMonth (iOS 17+) - creditCardExpirationYear (iOS 17+) - creditCardSecurityCode (iOS 17+) - creditCardType (iOS 17+) - creditCardName (iOS 17+) - creditCardGivenName (iOS 17+) - creditCardMiddleName (iOS 17+) - creditCardFamilyName (iOS 17+) - emailAddress - familyName - fullStreetAddress - givenName - jobTitle - location - middleName - name - namePrefix - nameSuffix - nickname - organizationName - postalCode - streetAddressLine1 - streetAddressLine2 - sublocality - telephoneNumber - username - password - newPassword - oneTimeCode - birthdate (iOS 17+) - birthdateDay (iOS 17+) - birthdateMonth (iOS 17+) - birthdateYear (iOS 17+) |
|
|
110
|
+
| `underlineColorAndroid` | `string \| OpaqueColorValue` | No | `-` | The color of the textInput underline. |
|
|
111
|
+
| `value` | `string` | No | `-` | The value to show for the text input. TextInput is a controlled component, which means the native value will be forced to match this value prop if provided. For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same. In addition to simply setting the same value, either set editable={false}, or set/update maxLength to prevent unwanted edits without flicker. |
|
|
112
|
+
| `verticalAlign` | `top \| bottom \| auto \| middle` | No | `-` | Vertically align text when multiline is set to true |
|
|
113
|
+
| `width` | `string \| number` | No | `100%` | Width of input as a percentage string. |
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
## Examples
|
|
117
|
+
|
|
118
|
+
### Basic usage
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
function BasicSearchInput() {
|
|
122
|
+
const [value, setValue] = useState('');
|
|
123
|
+
return (
|
|
124
|
+
<VStack gap={2}>
|
|
125
|
+
<SearchInput
|
|
126
|
+
value={value}
|
|
127
|
+
onChangeText={setValue}
|
|
128
|
+
onClear={() => setValue('')}
|
|
129
|
+
onSearch={(searchTerm) => console.log('Searching for:', searchTerm)}
|
|
130
|
+
placeholder="Search..."
|
|
131
|
+
/>
|
|
132
|
+
<Text color="foregroundMuted" font="caption">
|
|
133
|
+
Submit on keyboard or tap search icon
|
|
134
|
+
</Text>
|
|
135
|
+
</VStack>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### With Back Navigation
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
function SearchInputWithBack() {
|
|
144
|
+
const [value, setValue] = useState('');
|
|
145
|
+
return (
|
|
146
|
+
<VStack gap={2}>
|
|
147
|
+
<SearchInput
|
|
148
|
+
value={value}
|
|
149
|
+
onChangeText={setValue}
|
|
150
|
+
onClear={() => setValue('')}
|
|
151
|
+
onBack={() => console.log('Navigating back')}
|
|
152
|
+
onSearch={(searchTerm) => console.log('Searching for:', searchTerm)}
|
|
153
|
+
placeholder="Focus to see back arrow..."
|
|
154
|
+
/>
|
|
155
|
+
<Text color="foregroundMuted" font="caption">
|
|
156
|
+
Search icon changes to back arrow on focus
|
|
157
|
+
</Text>
|
|
158
|
+
</VStack>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Variants
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
function SearchInputVariants() {
|
|
167
|
+
const [value1, setValue1] = useState('');
|
|
168
|
+
const [value2, setValue2] = useState('');
|
|
169
|
+
|
|
170
|
+
return (
|
|
171
|
+
<VStack gap={2}>
|
|
172
|
+
<SearchInput
|
|
173
|
+
value={value1}
|
|
174
|
+
onChangeText={setValue1}
|
|
175
|
+
onClear={() => setValue1('')}
|
|
176
|
+
placeholder="Always show search icon..."
|
|
177
|
+
disableBackArrow
|
|
178
|
+
/>
|
|
179
|
+
<SearchInput
|
|
180
|
+
value={value2}
|
|
181
|
+
onChangeText={setValue2}
|
|
182
|
+
onClear={() => setValue2('')}
|
|
183
|
+
placeholder="No icons..."
|
|
184
|
+
hideStartIcon
|
|
185
|
+
hideEndIcon
|
|
186
|
+
/>
|
|
187
|
+
</VStack>
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# SectionHeader
|
|
2
|
+
|
|
3
|
+
A header component used to organize and label sections of content, with support for icons, descriptions, and additional content, optimized for mobile platforms.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import { SectionHeader } from '@coinbase/cds-mobile/section-header/SectionHeader'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Required | Default | Description |
|
|
14
|
+
| --- | --- | --- | --- | --- |
|
|
15
|
+
| `title` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | Yes | `-` | Text or ReactNode to be displayed in Title |
|
|
16
|
+
| `balance` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | ReactNode or UiIconName to present balances wherever it is necessary |
|
|
17
|
+
| `description` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | ReactNode to display up to 2 lines of copy that frames the sections purpose and relevance |
|
|
18
|
+
| `end` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | - |
|
|
19
|
+
| `icon` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null` | No | `-` | - |
|
|
20
|
+
| `iconActive` | `boolean` | No | `-` | Whether the icon is active |
|
|
21
|
+
| `key` | `Key \| null` | No | `-` | - |
|
|
22
|
+
| `ref` | `((instance: View \| null) => void) \| RefObject<View> \| null` | No | `-` | - |
|
|
23
|
+
| `start` | `null \| string \| number \| false \| true \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal` | No | `-` | - |
|
|
24
|
+
| `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 |
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
### Basic usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
function BasicSectionHeader() {
|
|
33
|
+
return (
|
|
34
|
+
<SectionHeader
|
|
35
|
+
title="Basic Section Header"
|
|
36
|
+
testID="basic-section-header"
|
|
37
|
+
accessibilityLabel="Basic section header example"
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### With Description and Icons
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
function SectionHeaderWithDetails() {
|
|
47
|
+
return (
|
|
48
|
+
<VStack gap={2}>
|
|
49
|
+
<SectionHeader
|
|
50
|
+
title="With Description"
|
|
51
|
+
description="This is a helpful description that will wrap on mobile devices"
|
|
52
|
+
testID="description-header"
|
|
53
|
+
/>
|
|
54
|
+
|
|
55
|
+
<SectionHeader
|
|
56
|
+
title="With Icons"
|
|
57
|
+
start={<Icon name="star" />}
|
|
58
|
+
icon="info-circle"
|
|
59
|
+
description="Shows both start and info icons"
|
|
60
|
+
testID="icons-header"
|
|
61
|
+
/>
|
|
62
|
+
</VStack>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### With Balance and Actions
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
function SectionHeaderWithActions() {
|
|
71
|
+
return (
|
|
72
|
+
<VStack gap={2}>
|
|
73
|
+
<SectionHeader
|
|
74
|
+
title="Account Balance"
|
|
75
|
+
balance="$1,234.56"
|
|
76
|
+
end={
|
|
77
|
+
<Button
|
|
78
|
+
variant="secondary"
|
|
79
|
+
compact
|
|
80
|
+
onPress={() => console.log('View history')}
|
|
81
|
+
testID="view-history-button"
|
|
82
|
+
>
|
|
83
|
+
History
|
|
84
|
+
</Button>
|
|
85
|
+
}
|
|
86
|
+
testID="balance-header"
|
|
87
|
+
/>
|
|
88
|
+
|
|
89
|
+
<SectionHeader
|
|
90
|
+
title="Actions Example"
|
|
91
|
+
description="Shows multiple actions that will wrap on mobile"
|
|
92
|
+
end={
|
|
93
|
+
<HStack gap={1} flexWrap="wrap">
|
|
94
|
+
<Button
|
|
95
|
+
variant="secondary"
|
|
96
|
+
compact
|
|
97
|
+
onPress={() => console.log('Export')}
|
|
98
|
+
testID="export-button"
|
|
99
|
+
>
|
|
100
|
+
Export
|
|
101
|
+
</Button>
|
|
102
|
+
<Button
|
|
103
|
+
variant="primary"
|
|
104
|
+
compact
|
|
105
|
+
onPress={() => console.log('Details')}
|
|
106
|
+
testID="details-button"
|
|
107
|
+
>
|
|
108
|
+
Details
|
|
109
|
+
</Button>
|
|
110
|
+
</HStack>
|
|
111
|
+
}
|
|
112
|
+
testID="actions-header"
|
|
113
|
+
/>
|
|
114
|
+
</VStack>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Custom Styling
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
function StyledSectionHeader() {
|
|
123
|
+
return (
|
|
124
|
+
<SectionHeader
|
|
125
|
+
title="Custom Style"
|
|
126
|
+
description="With custom padding and background"
|
|
127
|
+
padding={3}
|
|
128
|
+
background="bgSecondary"
|
|
129
|
+
testID="styled-header"
|
|
130
|
+
/>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
# With Start Icon
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
<SectionHeader title="Section with Start Icon" start={<Icon name="star" />} />
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
# With Icon After Title
|
|
142
|
+
|
|
143
|
+
```tsx
|
|
144
|
+
<SectionHeader title="Section with Icon" icon="info-circle" />
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
# With Balance
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<SectionHeader title="Account Balance" balance="$1,234.56" />
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
# With End Content
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
<SectionHeader
|
|
157
|
+
title="Section with Actions"
|
|
158
|
+
description="This section header includes a button in the end content area."
|
|
159
|
+
end={
|
|
160
|
+
<Button variant="secondary" size="sm">
|
|
161
|
+
Action
|
|
162
|
+
</Button>
|
|
163
|
+
}
|
|
164
|
+
/>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
# Full Example
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
<VStack gap={4}>
|
|
171
|
+
<SectionHeader
|
|
172
|
+
title="Complete Example"
|
|
173
|
+
start={<Icon name="star" />}
|
|
174
|
+
icon="info-circle"
|
|
175
|
+
description="This example shows all the main features of the SectionHeader component."
|
|
176
|
+
balance="$1,234.56"
|
|
177
|
+
end={
|
|
178
|
+
<Button variant="secondary" size="sm">
|
|
179
|
+
Learn More
|
|
180
|
+
</Button>
|
|
181
|
+
}
|
|
182
|
+
/>
|
|
183
|
+
<Text>Content below the section header...</Text>
|
|
184
|
+
</VStack>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
# With Accessibility
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<SectionHeader
|
|
191
|
+
title="Accessible Header"
|
|
192
|
+
description="This header includes accessibility props."
|
|
193
|
+
accessibilityLabel="Section header with description"
|
|
194
|
+
testID="section-header-example"
|
|
195
|
+
/>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
Note: The mobile version of SectionHeader is optimized for touch interactions and mobile screen sizes while maintaining the same core functionality as the web version. The main differences are:
|
|
199
|
+
|
|
200
|
+
- Uses React Native's View component underneath
|
|
201
|
+
- Includes mobile-specific props like `testID` and `accessibilityLabel`
|
|
202
|
+
- Default padding is adjusted for mobile screens
|
|
203
|
+
- Wraps content appropriately for mobile viewports
|
|
204
|
+
|
|
205
|
+
|