@coinbase/cds-mcp-server 8.21.8 → 8.22.2

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/mcp-docs/mobile/components/AreaChart.txt +39 -37
  3. package/mcp-docs/mobile/components/Avatar.txt +18 -18
  4. package/mcp-docs/mobile/components/AvatarButton.txt +19 -19
  5. package/mcp-docs/mobile/components/Banner.txt +62 -23
  6. package/mcp-docs/mobile/components/BarChart.txt +37 -35
  7. package/mcp-docs/mobile/components/Box.txt +18 -18
  8. package/mcp-docs/mobile/components/BrowserBar.txt +18 -18
  9. package/mcp-docs/mobile/components/Button.txt +19 -19
  10. package/mcp-docs/mobile/components/Carousel.txt +18 -18
  11. package/mcp-docs/mobile/components/CartesianChart.txt +75 -44
  12. package/mcp-docs/mobile/components/CheckboxCell.txt +19 -19
  13. package/mcp-docs/mobile/components/Chip.txt +20 -20
  14. package/mcp-docs/mobile/components/Coachmark.txt +18 -18
  15. package/mcp-docs/mobile/components/ContentCard.txt +18 -18
  16. package/mcp-docs/mobile/components/ContentCardBody.txt +18 -18
  17. package/mcp-docs/mobile/components/ContentCardFooter.txt +18 -18
  18. package/mcp-docs/mobile/components/ContentCardHeader.txt +18 -18
  19. package/mcp-docs/mobile/components/ContentCell.txt +18 -18
  20. package/mcp-docs/mobile/components/ControlGroup.txt +18 -18
  21. package/mcp-docs/mobile/components/DatePicker.txt +1 -1
  22. package/mcp-docs/mobile/components/Divider.txt +18 -18
  23. package/mcp-docs/mobile/components/DotCount.txt +1 -1
  24. package/mcp-docs/mobile/components/DotSymbol.txt +2 -2
  25. package/mcp-docs/mobile/components/Fallback.txt +18 -18
  26. package/mcp-docs/mobile/components/HStack.txt +18 -18
  27. package/mcp-docs/mobile/components/Icon.txt +6 -0
  28. package/mcp-docs/mobile/components/IconButton.txt +19 -19
  29. package/mcp-docs/mobile/components/InputChip.txt +20 -20
  30. package/mcp-docs/mobile/components/Interactable.txt +19 -19
  31. package/mcp-docs/mobile/components/LineChart.txt +1608 -898
  32. package/mcp-docs/mobile/components/Link.txt +18 -18
  33. package/mcp-docs/mobile/components/ListCell.txt +37 -19
  34. package/mcp-docs/mobile/components/Lottie.txt +18 -18
  35. package/mcp-docs/mobile/components/MediaChip.txt +20 -20
  36. package/mcp-docs/mobile/components/MultiContentModule.txt +18 -18
  37. package/mcp-docs/mobile/components/NavigationTitle.txt +18 -18
  38. package/mcp-docs/mobile/components/NavigationTitleSelect.txt +18 -18
  39. package/mcp-docs/mobile/components/Numpad.txt +18 -18
  40. package/mcp-docs/mobile/components/Overlay.txt +18 -18
  41. package/mcp-docs/mobile/components/PageFooter.txt +17 -17
  42. package/mcp-docs/mobile/components/PageHeader.txt +17 -17
  43. package/mcp-docs/mobile/components/PeriodSelector.txt +26 -26
  44. package/mcp-docs/mobile/components/Point.txt +203 -98
  45. package/mcp-docs/mobile/components/Pressable.txt +19 -19
  46. package/mcp-docs/mobile/components/ProgressBar.txt +1 -1
  47. package/mcp-docs/mobile/components/ProgressBarWithFixedLabels.txt +1 -1
  48. package/mcp-docs/mobile/components/ProgressBarWithFloatLabel.txt +1 -1
  49. package/mcp-docs/mobile/components/ProgressCircle.txt +1 -1
  50. package/mcp-docs/mobile/components/RadioCell.txt +19 -19
  51. package/mcp-docs/mobile/components/ReferenceLine.txt +197 -54
  52. package/mcp-docs/mobile/components/RollingNumber.txt +18 -18
  53. package/mcp-docs/mobile/components/Scrubber.txt +597 -79
  54. package/mcp-docs/mobile/components/SegmentedTabs.txt +18 -18
  55. package/mcp-docs/mobile/components/SelectAlpha.txt +1 -1
  56. package/mcp-docs/mobile/components/SelectChip.txt +20 -20
  57. package/mcp-docs/mobile/components/SlideButton.txt +19 -19
  58. package/mcp-docs/mobile/components/Spacer.txt +6 -6
  59. package/mcp-docs/mobile/components/SparklineInteractive.txt +3 -3
  60. package/mcp-docs/mobile/components/Spinner.txt +1 -1
  61. package/mcp-docs/mobile/components/Stepper.txt +18 -18
  62. package/mcp-docs/mobile/components/TabLabel.txt +18 -18
  63. package/mcp-docs/mobile/components/TabNavigation.txt +18 -18
  64. package/mcp-docs/mobile/components/TabbedChips.txt +18 -18
  65. package/mcp-docs/mobile/components/TabbedChipsAlpha.txt +1 -1
  66. package/mcp-docs/mobile/components/Tabs.txt +18 -18
  67. package/mcp-docs/mobile/components/Tag.txt +18 -18
  68. package/mcp-docs/mobile/components/Text.txt +18 -18
  69. package/mcp-docs/mobile/components/Toast.txt +18 -18
  70. package/mcp-docs/mobile/components/Tooltip.txt +17 -1
  71. package/mcp-docs/mobile/components/TopNavBar.txt +18 -18
  72. package/mcp-docs/mobile/components/VStack.txt +18 -18
  73. package/mcp-docs/mobile/components/XAxis.txt +86 -24
  74. package/mcp-docs/mobile/components/YAxis.txt +75 -17
  75. package/mcp-docs/mobile/routes.txt +1 -1
  76. package/mcp-docs/web/components/AreaChart.txt +523 -301
  77. package/mcp-docs/web/components/Avatar.txt +27 -27
  78. package/mcp-docs/web/components/AvatarButton.txt +28 -28
  79. package/mcp-docs/web/components/Banner.txt +71 -32
  80. package/mcp-docs/web/components/BarChart.txt +182 -313
  81. package/mcp-docs/web/components/Box.txt +28 -28
  82. package/mcp-docs/web/components/Button.txt +28 -28
  83. package/mcp-docs/web/components/Calendar.txt +27 -27
  84. package/mcp-docs/web/components/Carousel.txt +27 -27
  85. package/mcp-docs/web/components/CartesianChart.txt +62 -309
  86. package/mcp-docs/web/components/CheckboxCell.txt +25 -25
  87. package/mcp-docs/web/components/Chip.txt +27 -27
  88. package/mcp-docs/web/components/Coachmark.txt +27 -27
  89. package/mcp-docs/web/components/ContainedAssetCard.txt +27 -27
  90. package/mcp-docs/web/components/ContentCard.txt +28 -28
  91. package/mcp-docs/web/components/ContentCardBody.txt +28 -28
  92. package/mcp-docs/web/components/ContentCardFooter.txt +28 -28
  93. package/mcp-docs/web/components/ContentCardHeader.txt +28 -28
  94. package/mcp-docs/web/components/ContentCell.txt +28 -28
  95. package/mcp-docs/web/components/ControlGroup.txt +27 -27
  96. package/mcp-docs/web/components/Divider.txt +27 -27
  97. package/mcp-docs/web/components/Fallback.txt +28 -28
  98. package/mcp-docs/web/components/FloatingAssetCard.txt +27 -27
  99. package/mcp-docs/web/components/Grid.txt +28 -28
  100. package/mcp-docs/web/components/GridColumn.txt +27 -27
  101. package/mcp-docs/web/components/HStack.txt +28 -28
  102. package/mcp-docs/web/components/Icon.txt +27 -27
  103. package/mcp-docs/web/components/IconButton.txt +28 -28
  104. package/mcp-docs/web/components/InputChip.txt +27 -27
  105. package/mcp-docs/web/components/Interactable.txt +28 -28
  106. package/mcp-docs/web/components/LineChart.txt +1598 -1116
  107. package/mcp-docs/web/components/Link.txt +28 -28
  108. package/mcp-docs/web/components/ListCell.txt +48 -30
  109. package/mcp-docs/web/components/Lottie.txt +27 -27
  110. package/mcp-docs/web/components/MediaChip.txt +27 -27
  111. package/mcp-docs/web/components/Modal.txt +27 -27
  112. package/mcp-docs/web/components/ModalBody.txt +27 -27
  113. package/mcp-docs/web/components/ModalFooter.txt +27 -27
  114. package/mcp-docs/web/components/ModalHeader.txt +27 -27
  115. package/mcp-docs/web/components/MultiContentModule.txt +28 -28
  116. package/mcp-docs/web/components/NavigationBar.txt +5 -5
  117. package/mcp-docs/web/components/NudgeCard.txt +27 -27
  118. package/mcp-docs/web/components/Overlay.txt +27 -27
  119. package/mcp-docs/web/components/PageFooter.txt +26 -26
  120. package/mcp-docs/web/components/PageHeader.txt +26 -26
  121. package/mcp-docs/web/components/Pagination.txt +27 -27
  122. package/mcp-docs/web/components/PeriodSelector.txt +49 -49
  123. package/mcp-docs/web/components/Point.txt +228 -79
  124. package/mcp-docs/web/components/Pressable.txt +28 -28
  125. package/mcp-docs/web/components/RadioCell.txt +25 -25
  126. package/mcp-docs/web/components/ReferenceLine.txt +208 -60
  127. package/mcp-docs/web/components/RemoteImage.txt +26 -26
  128. package/mcp-docs/web/components/RollingNumber.txt +28 -28
  129. package/mcp-docs/web/components/Scrubber.txt +463 -68
  130. package/mcp-docs/web/components/SectionHeader.txt +27 -27
  131. package/mcp-docs/web/components/SegmentedTabs.txt +27 -27
  132. package/mcp-docs/web/components/SelectChip.txt +27 -27
  133. package/mcp-docs/web/components/SelectOption.txt +27 -27
  134. package/mcp-docs/web/components/Sidebar.txt +27 -27
  135. package/mcp-docs/web/components/SidebarItem.txt +27 -27
  136. package/mcp-docs/web/components/Spacer.txt +34 -34
  137. package/mcp-docs/web/components/SparklineInteractive.txt +1 -1
  138. package/mcp-docs/web/components/Spinner.txt +27 -27
  139. package/mcp-docs/web/components/Stepper.txt +27 -27
  140. package/mcp-docs/web/components/TabLabel.txt +27 -27
  141. package/mcp-docs/web/components/TabNavigation.txt +26 -26
  142. package/mcp-docs/web/components/TabbedChips.txt +26 -26
  143. package/mcp-docs/web/components/TabbedChipsAlpha.txt +1 -1
  144. package/mcp-docs/web/components/Tabs.txt +27 -27
  145. package/mcp-docs/web/components/Tag.txt +27 -27
  146. package/mcp-docs/web/components/Text.txt +28 -28
  147. package/mcp-docs/web/components/TileButton.txt +28 -28
  148. package/mcp-docs/web/components/Toast.txt +27 -27
  149. package/mcp-docs/web/components/Tooltip.txt +17 -1
  150. package/mcp-docs/web/components/VStack.txt +28 -28
  151. package/mcp-docs/web/components/XAxis.txt +86 -22
  152. package/mcp-docs/web/components/YAxis.txt +133 -89
  153. package/package.json +1 -1
@@ -10,13 +10,15 @@ import { Scrubber } from '@coinbase/cds-web-visualization'
10
10
 
11
11
  ## Examples
12
12
 
13
- ### Basic Example
13
+ ### Basics
14
14
 
15
- 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.
15
+ Scrubber can be used to provide horizontal interaction with a chart. As your mouse hovers over the chart, you will see a line and scrubber beacon following.
16
16
 
17
17
  ```jsx live
18
18
  <LineChart
19
19
  enableScrubbing
20
+ showArea
21
+ showYAxis
20
22
  height={{ base: 150, tablet: 200, desktop: 250 }}
21
23
  series={[
22
24
  {
@@ -24,20 +26,19 @@ Scrubber can be used to provide horizontal interaction with a chart. As your mou
24
26
  data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
25
27
  },
26
28
  ]}
27
- curve="monotone"
28
- showYAxis
29
- showArea
29
+ xAxis={{
30
+ /* Give space between the scrubber and the axis */
31
+ range: ({ min, max }) => ({ min, max: max - 8 }),
32
+ }}
30
33
  yAxis={{
31
34
  showGrid: true,
32
35
  }}
33
36
  >
34
- <Scrubber />
37
+ <Scrubber idlePulse />
35
38
  </LineChart>
36
39
  ```
37
40
 
38
- ### Multiple Series
39
-
40
- All series will be scrubbed by default. You can set the `seriesIds` prop to restrict the scrubbing to specific series.
41
+ All series will be scrubbed by default. You can set `seriesIds` to show only specific series.
41
42
 
42
43
  ```jsx live
43
44
  <LineChart
@@ -59,9 +60,14 @@ All series will be scrubbed by default. You can set the `seriesIds` prop to rest
59
60
  data: [8, 15, 14, 25, 20, 18, 22, 28, 24, 30],
60
61
  color: '#f59e0b',
61
62
  curve: 'natural',
62
- LineComponent: (props) => (
63
- <GradientLine {...props} endColor="#F7931A" startColor="#E3D74D" strokeWidth={4} />
64
- ),
63
+ gradient: {
64
+ axis: 'y',
65
+ stops: [
66
+ { offset: 0, color: '#E3D74D' },
67
+ { offset: 100, color: '#F7931A' },
68
+ ],
69
+ },
70
+ LineComponent: (props) => <SolidLine {...props} strokeWidth={4} />,
65
71
  },
66
72
  {
67
73
  id: 'bottom',
@@ -79,7 +85,8 @@ All series will be scrubbed by default. You can set the `seriesIds` prop to rest
79
85
 
80
86
  ### Labels
81
87
 
82
- Setting the `label` prop for a series will display a label above the scrubber head.
88
+ Setting `label` on a series will display a label to the side of the scrubber beacon, and
89
+ setting `label` on Scrubber displays a label above the scrubber line.
83
90
 
84
91
  ```jsx live
85
92
  <LineChart
@@ -92,37 +99,39 @@ Setting the `label` prop for a series will display a label above the scrubber he
92
99
  label: 'Price',
93
100
  },
94
101
  ]}
95
- curve="monotone"
96
102
  showArea
97
103
  >
98
- <Scrubber />
104
+ <Scrubber label={(dataIndex: number) => `Day ${dataIndex + 1}`} />
99
105
  </LineChart>
100
106
  ```
101
107
 
102
108
  ### Pulsing
103
109
 
104
- Setting the `idlePulse` prop will cause the scrubber heads to pulse when the user is not actively scrubbing.
110
+ Setting `idlePulse` to `true` will cause the scrubber beacons to pulse when the user is not actively scrubbing.
105
111
 
106
112
  ```jsx live
107
113
  <LineChart
108
114
  enableScrubbing
115
+ showArea
109
116
  height={{ base: 150, tablet: 200, desktop: 250 }}
110
117
  series={[
111
118
  {
112
119
  id: 'prices',
113
120
  data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
121
+ color: 'var(--color-fgPositive)',
114
122
  },
115
123
  ]}
116
- curve="monotone"
117
- showArea
118
124
  >
125
+ <ReferenceLine
126
+ LineComponent={(props) => <DottedLine {...props} strokeDasharray="0 16" strokeWidth={3} />}
127
+ dataY={10}
128
+ stroke="var(--color-fg)"
129
+ />
119
130
  <Scrubber idlePulse />
120
131
  </LineChart>
121
132
  ```
122
133
 
123
- #### With Imperative Handle
124
-
125
- You can also use the imperative handle to pulse the scrubber heads programmatically.
134
+ You can also use the imperative handle to pulse the scrubber beacons programmatically.
126
135
 
127
136
  ```jsx live
128
137
  function ImperativeHandle() {
@@ -134,57 +143,236 @@ function ImperativeHandle() {
134
143
  height={{ base: 150, tablet: 200, desktop: 250 }}
135
144
  series={[
136
145
  {
137
- id: 'priceA',
138
- data: [2400, 1398, 9800, 3908, 4800, 3800, 4300],
139
- label: 'Price A',
140
- color: 'var(--color-accentBoldBlue)',
141
- curve: 'natural',
142
- },
143
- {
144
- id: 'priceB',
145
- data: [2000, 2491, 4501, 6049, 5019, 4930, 5910],
146
- label: 'Price B',
147
- color: 'var(--color-accentBoldGreen)',
148
- curve: 'natural',
149
- },
150
- {
151
- id: 'priceC',
152
- data: [1000, 4910, 2300, 5910, 3940, 2940, 1940],
153
- label: 'Price C',
154
- color: 'var(--color-accentBoldPurple)',
155
- curve: 'natural',
146
+ id: 'prices',
147
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
156
148
  },
149
+ ]}
150
+ showArea
151
+ >
152
+ <Scrubber ref={scrubberRef} />
153
+ </LineChart>
154
+ <Button onClick={() => scrubberRef.current?.pulse()}>Pulse</Button>
155
+ </VStack>
156
+ );
157
+ }
158
+ ```
159
+
160
+ ### Styling
161
+
162
+ #### Beacons
163
+
164
+ You can use `BeaconComponent` to customize the visual appearance of scrubber beacons.
165
+
166
+ ```jsx live
167
+ function OutlineBeacon() {
168
+ // Simple outline beacon with no pulse animation
169
+ const OutlineBeaconComponent = memo(({ dataX, dataY, seriesId, color, isIdle }: ScrubberBeaconProps) => {
170
+ const { getSeries, getXScale, getYScale } = useCartesianChartContext();
171
+ const targetSeries = getSeries(seriesId);
172
+ const xScale = getXScale();
173
+ const yScale = getYScale(targetSeries?.yAxisId);
174
+
175
+ const pixelCoordinate = useMemo(() => {
176
+ if (!xScale || !yScale) return;
177
+ return projectPoint({ x: dataX, y: dataY, xScale, yScale });
178
+ }, [dataX, dataY, xScale, yScale]);
179
+
180
+ if (!pixelCoordinate) return;
181
+
182
+ if (isIdle) {
183
+ return (
184
+ <>
185
+ <m.circle
186
+ animate={{ cx: pixelCoordinate.x, cy: pixelCoordinate.y }}
187
+ cx={pixelCoordinate.x}
188
+ cy={pixelCoordinate.y}
189
+ transition={defaultTransition}
190
+ r={6}
191
+ fill={color}
192
+ />
193
+ <m.circle
194
+ animate={{ cx: pixelCoordinate.x, cy: pixelCoordinate.y }}
195
+ cx={pixelCoordinate.x}
196
+ cy={pixelCoordinate.y}
197
+ transition={defaultTransition}
198
+ r={3}
199
+ fill="var(--color-bg)"
200
+ />
201
+ </>
202
+ );
203
+ }
204
+
205
+ return (
206
+ <>
207
+ <circle cx={pixelCoordinate.x} cy={pixelCoordinate.y} r={6} fill={color} />
208
+ <circle cx={pixelCoordinate.x} cy={pixelCoordinate.y} r={3} fill="var(--color-bg)" />
209
+ </>
210
+ );
211
+ });
212
+
213
+ const dataCount = 14;
214
+ const minDataValue = 0;
215
+ const maxDataValue = 100;
216
+ const minStepOffset = 5;
217
+ const maxStepOffset = 20;
218
+ const updateInterval = 2000;
219
+
220
+ function generateNextValue(previousValue) {
221
+ const range = maxStepOffset - minStepOffset;
222
+ const offset = Math.random() * range + minStepOffset;
223
+
224
+ let direction;
225
+ if (previousValue >= maxDataValue) {
226
+ direction = -1;
227
+ } else if (previousValue <= minDataValue) {
228
+ direction = 1;
229
+ } else {
230
+ direction = Math.random() < 0.5 ? -1 : 1;
231
+ }
232
+
233
+ let newValue = previousValue + offset * direction;
234
+ return Math.max(minDataValue, Math.min(maxDataValue, newValue));
235
+ }
236
+
237
+ function generateInitialData() {
238
+ const data = [];
239
+ let previousValue = Math.random() * (maxDataValue - minDataValue) + minDataValue;
240
+ data.push(previousValue);
241
+
242
+ for (let i = 1; i < dataCount; i++) {
243
+ const newValue = generateNextValue(previousValue);
244
+ data.push(newValue);
245
+ previousValue = newValue;
246
+ }
247
+ return data;
248
+ }
249
+
250
+
251
+ const OutlineBeaconChart = memo(() => {
252
+ const [data, setData] = useState(generateInitialData);
253
+
254
+ useEffect(() => {
255
+ const intervalId = setInterval(() => {
256
+ setData((currentData) => {
257
+ const lastValue = currentData[currentData.length - 1] ?? 50;
258
+ const newValue = generateNextValue(lastValue);
259
+ return [...currentData.slice(1), newValue];
260
+ });
261
+ }, updateInterval);
262
+
263
+ return () => clearInterval(intervalId);
264
+ }, []);
265
+
266
+ return (
267
+ <LineChart
268
+ enableScrubbing
269
+ showArea
270
+ showYAxis
271
+ height={{ base: 150, tablet: 200, desktop: 250 }}
272
+ series={[
157
273
  {
158
- id: 'priceD',
159
- data: [4810, 2030, 5810, 3940, 2940, 1940, 940],
160
- label: 'Price D',
161
- color: 'var(--color-accentBoldYellow)',
162
- curve: 'natural',
274
+ id: 'prices',
275
+ data,
276
+ color: 'var(--color-fg)',
163
277
  },
164
278
  ]}
165
279
  xAxis={{
166
- range: ({ min, max }) => ({ min, max: max - 32 }),
280
+ range: ({ min, max }) => ({ min, max: max - 16 }),
167
281
  }}
168
- showYAxis
169
282
  yAxis={{
170
- domain: {
171
- min: 0,
172
- },
173
283
  showGrid: true,
174
- tickLabelFormatter: (value) => value.toLocaleString(),
284
+ domain: { min: 0, max: 100 }
175
285
  }}
176
286
  >
177
- <Scrubber ref={scrubberRef} />
287
+ <Scrubber BeaconComponent={OutlineBeaconComponent} />
178
288
  </LineChart>
179
- <Button onClick={() => scrubberRef.current?.pulse()}>Pulse</Button>
180
- </VStack>
181
- );
289
+ );
290
+ });
291
+
292
+ return <OutlineBeaconChart />;
182
293
  }
183
294
  ```
184
295
 
185
- ### Disable Overlay When Scrubbing
296
+ #### Labels
186
297
 
187
- By default, the scrubber will show an overlay to de-emphasize future data. You can hide this by setting the `hideOverlay` prop to `true`.
298
+ You can use `BeaconLabelComponent` to customize the labels for each scrubber beacon.
299
+
300
+ ```jsx live
301
+ function CustomBeaconLabel() {
302
+ // This custom component label shows the percentage value of the data at the scrubber position.
303
+ const MyScrubberBeaconLabel = memo(({ seriesId, color, label, ...props}: ScrubberBeaconLabelProps) => {
304
+ const { getSeriesData, dataLength } = useCartesianChartContext();
305
+ const { scrubberPosition } = useScrubberContext();
306
+
307
+ const seriesData = useMemo(() => getLineData(getSeriesData(seriesId)), [getSeriesData, seriesId]);
308
+
309
+ const dataIndex = useMemo(() => {
310
+ return scrubberPosition ?? Math.max(0, dataLength - 1);
311
+ }, [scrubberPosition, dataLength]);
312
+
313
+ const percentageLabel = useMemo(() => {
314
+ if (seriesData !== undefined) {
315
+ const dataAtPosition = seriesData[dataIndex];
316
+ return `${label} · ${dataAtPosition}%`;
317
+ }
318
+ return label;
319
+ }, [label, seriesData, dataIndex])
320
+
321
+ return (
322
+ <DefaultScrubberBeaconLabel
323
+ {...props}
324
+ seriesId={seriesId}
325
+ color="rgb(var(--gray0))"
326
+ background={color}
327
+ label={percentageLabel}
328
+ />
329
+ );
330
+ });
331
+
332
+ return (
333
+ <LineChart
334
+ enableScrubbing
335
+ height={{ base: 150, tablet: 200, desktop: 250 }}
336
+ series={[
337
+ {
338
+ id: 'Boston',
339
+ data: [25, 30, 35, 45, 60, 100],
340
+ color: 'rgb(var(--green40))',
341
+ label: 'Boston',
342
+ },
343
+ {
344
+ id: 'Miami',
345
+ data: [20, 25, 30, 35, 20, 0],
346
+ color: 'rgb(var(--blue40))',
347
+ label: 'Miami',
348
+ },
349
+ {
350
+ id: 'Denver',
351
+ data: [10, 15, 20, 25, 40, 0],
352
+ color: 'rgb(var(--orange40))',
353
+ label: 'Denver',
354
+ },
355
+ {
356
+ id: 'Phoenix',
357
+ data: [15, 10, 5, 0, 0, 0],
358
+ color: 'rgb(var(--red40))',
359
+ label: 'Phoenix',
360
+ },
361
+ ]}
362
+ showYAxis
363
+ showArea
364
+ areaType="dotted"
365
+ yAxis={{
366
+ showGrid: true,
367
+ }}
368
+ >
369
+ <Scrubber BeaconLabelComponent={MyScrubberBeaconLabel} />
370
+ </LineChart>
371
+ );
372
+ }
373
+ ```
374
+
375
+ Using `labelElevated` will elevate the Scrubber's reference line label with a shadow.
188
376
 
189
377
  ```jsx live
190
378
  <LineChart
@@ -196,12 +384,211 @@ By default, the scrubber will show an overlay to de-emphasize future data. You c
196
384
  data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
197
385
  },
198
386
  ]}
199
- curve="monotone"
200
- showYAxis
201
387
  showArea
388
+ inset={{ top: 60 }}
389
+ >
390
+ <Scrubber label={(dataIndex: number) => `Day ${dataIndex + 1}`} labelElevated />
391
+ </LineChart>
392
+ ```
393
+
394
+ You can use `LabelComponent` to customize this label even further.
395
+
396
+ ```jsx live
397
+ function CustomLabelComponent() {
398
+ const CustomLabelComponent = memo((props: ScrubberLabelProps) => {
399
+ const { drawingArea } = useCartesianChartContext();
400
+
401
+ if (!drawingArea) return;
402
+
403
+ return (
404
+ <DefaultScrubberLabel
405
+ {...props}
406
+ background="var(--color-bgPrimary)"
407
+ color="var(--color-bgPrimaryWash)"
408
+ dy={32}
409
+ elevated
410
+ fontWeight="label1"
411
+ y={drawingArea.y + drawingArea.height}
412
+ />
413
+ );
414
+ });
415
+ return (
416
+ <LineChart
417
+ enableScrubbing
418
+ showArea
419
+ height={{ base: 150, tablet: 200, desktop: 250 }}
420
+ inset={{ top: 16, bottom: 64 }}
421
+ series={[
422
+ {
423
+ id: 'prices',
424
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
425
+ },
426
+ ]}
427
+ >
428
+ <Scrubber
429
+ LabelComponent={CustomLabelComponent}
430
+ label={(dataIndex: number) => `Day ${dataIndex + 1}`}
431
+ />
432
+ </LineChart>
433
+ );
434
+ }
435
+ ```
436
+
437
+ ##### Fonts
438
+
439
+ You can use `labelFont` to customize the font of the scrubber line label and `beaconLabelFont` to customize the font of the beacon labels.
440
+
441
+ ```jsx live
442
+ <LineChart
443
+ enableScrubbing
444
+ showArea
445
+ showYAxis
446
+ height={{ base: 150, tablet: 200, desktop: 250 }}
447
+ series={[
448
+ {
449
+ id: 'btc',
450
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
451
+ label: 'BTC',
452
+ color: assets.btc.color,
453
+ },
454
+ {
455
+ id: 'eth',
456
+ data: [5, 15, 18, 30, 65, 30, 15, 35, 15, 2, 45, 12, 15, 40],
457
+ label: 'ETH',
458
+ color: assets.eth.color,
459
+ },
460
+ ]}
202
461
  yAxis={{
203
462
  showGrid: true,
204
463
  }}
464
+ >
465
+ <Scrubber
466
+ label={(dataIndex: number) => `Day ${dataIndex + 1}`}
467
+ labelFont="legal"
468
+ beaconLabelFont="legal"
469
+ />
470
+ </LineChart>
471
+ ```
472
+
473
+ ##### Bounds
474
+
475
+ Use `labelBoundsInset` to prevent the scrubber line label from getting too close to chart edges.
476
+
477
+ ```jsx live
478
+ <Box style={{ marginLeft: 'calc(-1 * var(--space-3))', marginRight: 'calc(-1 * var(--space-3))' }}>
479
+ <LineChart
480
+ enableScrubbing
481
+ showArea
482
+ height={{ base: 150, tablet: 200, desktop: 250 }}
483
+ inset={{ left: 0, right: 0 }}
484
+ series={[
485
+ {
486
+ id: 'prices',
487
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
488
+ },
489
+ ]}
490
+ >
491
+ <Scrubber label="Without bounds - text touches edge" labelBoundsInset={0} />
492
+ </LineChart>
493
+ </Box>
494
+ ```
495
+
496
+ ```jsx live
497
+ <Box style={{ marginLeft: 'calc(-1 * var(--space-3))', marginRight: 'calc(-1 * var(--space-3))' }}>
498
+ <LineChart
499
+ enableScrubbing
500
+ showArea
501
+ height={{ base: 150, tablet: 200, desktop: 250 }}
502
+ inset={{ left: 0, right: 0 }}
503
+ series={[
504
+ {
505
+ id: 'prices',
506
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
507
+ },
508
+ ]}
509
+ >
510
+ <Scrubber
511
+ label="With bounds inset - text has space"
512
+ labelBoundsInset={{ left: 12, right: 12 }}
513
+ />
514
+ </LineChart>
515
+ </Box>
516
+ ```
517
+
518
+ #### Line
519
+
520
+ You can use `LineComponent` to customize Scrubber's line. In this case, as a user scrubs, they will see a solid line instead of dotted.
521
+
522
+ ```jsx live
523
+ <LineChart
524
+ enableScrubbing
525
+ height={{ base: 150, tablet: 200, desktop: 250 }}
526
+ series={[
527
+ {
528
+ id: 'prices',
529
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
530
+ },
531
+ ]}
532
+ showArea
533
+ >
534
+ <Scrubber LineComponent={SolidLine} />
535
+ </LineChart>
536
+ ```
537
+
538
+ #### Opacity
539
+
540
+ You can use `BeaconComponent` and `BeaconLabelComponent` with the `opacity` prop to hide scrubber beacons and labels when idle.
541
+
542
+ ```jsx live
543
+ function HiddenScrubberWhenIdle() {
544
+ const MyScrubberBeacon = memo((props: ScrubberBeaconProps) => {
545
+ const { scrubberPosition } = useScrubberContext();
546
+ const isScrubbing = scrubberPosition !== undefined;
547
+
548
+ return <DefaultScrubberBeacon {...props} opacity={isScrubbing ? 1 : 0} />;
549
+ });
550
+
551
+ const MyScrubberBeaconLabel = memo((props: ScrubberBeaconLabelProps) => {
552
+ const { scrubberPosition } = useScrubberContext();
553
+ const isScrubbing = scrubberPosition !== undefined;
554
+
555
+ return <DefaultScrubberBeaconLabel {...props} opacity={isScrubbing ? 1 : 0} />;
556
+ });
557
+
558
+ return (
559
+ <LineChart
560
+ enableScrubbing
561
+ showArea
562
+ height={{ base: 150, tablet: 200, desktop: 250 }}
563
+ series={[
564
+ {
565
+ id: 'prices',
566
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
567
+ label: 'Price',
568
+ },
569
+ ]}
570
+ >
571
+ <Scrubber BeaconComponent={MyScrubberBeacon} BeaconLabelComponent={MyScrubberBeaconLabel} />
572
+ </LineChart>
573
+ );
574
+ }
575
+ ```
576
+
577
+ #### Overlay
578
+
579
+ By default, Scrubber will show an overlay to de-emphasize future data. You can hide this by setting `hideOverlay` to `true`.
580
+
581
+ ```jsx live
582
+ <LineChart
583
+ enableScrubbing
584
+ height={{ base: 150, tablet: 200, desktop: 250 }}
585
+ series={[
586
+ {
587
+ id: 'prices',
588
+ data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20, 21, 58],
589
+ },
590
+ ]}
591
+ showArea
205
592
  >
206
593
  <Scrubber hideOverlay />
207
594
  </LineChart>
@@ -211,20 +598,28 @@ By default, the scrubber will show an overlay to de-emphasize future data. You c
211
598
 
212
599
  | Prop | Type | Required | Default | Description |
213
600
  | --- | --- | --- | --- | --- |
214
- | `BeaconComponent` | `ComponentClass<ScrubberBeaconProps, any> \| FunctionComponent<ScrubberBeaconProps>` | No | `-` | Custom component for the scrubber beacon. |
215
- | `BeaconLabelComponent` | `ComponentClass<ChartTextProps, any> \| FunctionComponent<ChartTextProps>` | No | `-` | Custom component for the scrubber beacon label. |
216
- | `LineComponent` | `FunctionComponent<ReferenceLineProps> \| ComponentClass<ReferenceLineProps, any>` | No | `-` | Custom component for the scrubber line. |
601
+ | `BeaconComponent` | `ScrubberBeaconComponent` | No | `DefaultScrubberBeacon` | Custom component for the scrubber beacon. |
602
+ | `BeaconLabelComponent` | `ScrubberBeaconLabelComponent` | No | `DefaultScrubberBeaconLabel` | Custom component to render as a scrubber beacon label. |
603
+ | `LabelComponent` | `ReferenceLineLabelComponent` | No | `DefaultReferenceLineLabel` | Component to render the label. |
604
+ | `LineComponent` | `LineComponent` | No | `DottedLine` | Component to render the line. |
605
+ | `accessibilityLabel` | `string \| ((dataIndex: number) => string)` | No | `-` | Accessibility label for the scrubber. Can be a static string or a function that receives the current dataIndex. If not provided, label will be used if it resolves to a string. |
606
+ | `beaconLabelFont` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | Font style for the beacon labels. |
607
+ | `beaconLabelHorizontalOffset` | `number` | No | `-` | Horizontal offset for beacon labels from their beacon position. Measured in pixels. |
608
+ | `beaconLabelMinGap` | `number` | No | `-` | Minimum gap between beacon labels to prevent overlap. Measured in pixels. |
609
+ | `beaconTransitions` | `{ update?: Transition$1; pulse?: Transition$1 \| undefined; pulseRepeatDelay?: number \| undefined; } \| undefined` | No | `-` | Transition configuration for the scrubber beacon. |
217
610
  | `classNames` | `{ overlay?: string; beacon?: string \| undefined; line?: string \| undefined; beaconLabel?: string \| undefined; } \| undefined` | No | `-` | Custom class names for scrubber elements. |
218
611
  | `hideLine` | `boolean` | No | `-` | Hides the scrubber line |
219
- | `hideOverlay` | `boolean` | No | `-` | Whether to hide the overlay rect which obscures future data. |
220
- | `idlePulse` | `boolean` | No | `-` | Pulse the scrubber beacon while it is at rest. |
612
+ | `hideOverlay` | `boolean` | No | `-` | Hides the overlay rect which obscures data beyond the scrubber position. |
613
+ | `idlePulse` | `boolean` | No | `-` | Pulse the beacons while at rest. |
221
614
  | `key` | `Key \| null` | No | `-` | - |
222
- | `label` | `ChartTextChildren \| ((dataIndex: number) => ChartTextChildren)` | No | `-` | Label text displayed above the scrubber line. |
223
- | `labelProps` | `ReferenceLineLabelProps` | No | `-` | Props passed to the scrubber lines label. |
615
+ | `label` | `ChartTextChildren \| ((dataIndex: number) => ChartTextChildren)` | No | `-` | Label text displayed above the scrubber line. Can be a static string or a function that receives the current dataIndex. |
616
+ | `labelBoundsInset` | `number \| ChartInset` | No | `{ top: 4, bottom: 20, left: 12, right: 12 } when labelElevated is true, otherwise none` | Bounds inset for the scrubber line label to prevent cutoff at chart edges. |
617
+ | `labelElevated` | `boolean` | No | `-` | Whether to elevate the label with a shadow. When true, applies elevation and automatically adds bounds to keep label within chart area. |
618
+ | `labelFont` | `ResponsiveProp<FontFamily \| inherit>` | No | `-` | Font style for the scrubber line label. |
224
619
  | `lineStroke` | `string` | No | `-` | Stroke color for the scrubber line. |
225
620
  | `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. |
226
- | `ref` | `((instance: ScrubberBeaconRef \| null) => void) \| RefObject<ScrubberBeaconRef> \| null` | No | `-` | - |
227
- | `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. |
621
+ | `ref` | `((instance: ScrubberBeaconGroupRef \| null) => void) \| RefObject<ScrubberBeaconGroupRef> \| null` | No | `-` | - |
622
+ | `seriesIds` | `string[]` | No | `-` | Array of series IDs to highlight when scrubbing with scrubber beacons. By default, all series will be highlighted. |
228
623
  | `styles` | `{ overlay?: CSSProperties; beacon?: CSSProperties \| undefined; line?: CSSProperties \| undefined; beaconLabel?: CSSProperties \| undefined; } \| undefined` | No | `-` | Custom styles for scrubber elements. |
229
624
  | `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 |
230
625