@coinbase/cds-mobile-visualization 3.4.0-beta.8 → 3.4.0

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 (170) hide show
  1. package/CHANGELOG.md +142 -0
  2. package/dts/chart/CartesianChart.d.ts +92 -7
  3. package/dts/chart/CartesianChart.d.ts.map +1 -1
  4. package/dts/chart/ChartContextBridge.d.ts.map +1 -1
  5. package/dts/chart/ChartProvider.d.ts +3 -0
  6. package/dts/chart/ChartProvider.d.ts.map +1 -1
  7. package/dts/chart/Path.d.ts +36 -13
  8. package/dts/chart/Path.d.ts.map +1 -1
  9. package/dts/chart/PeriodSelector.d.ts +21 -6
  10. package/dts/chart/PeriodSelector.d.ts.map +1 -1
  11. package/dts/chart/area/Area.d.ts +14 -11
  12. package/dts/chart/area/Area.d.ts.map +1 -1
  13. package/dts/chart/area/AreaChart.d.ts +33 -9
  14. package/dts/chart/area/AreaChart.d.ts.map +1 -1
  15. package/dts/chart/area/DottedArea.d.ts.map +1 -1
  16. package/dts/chart/area/GradientArea.d.ts.map +1 -1
  17. package/dts/chart/area/SolidArea.d.ts.map +1 -1
  18. package/dts/chart/axis/Axis.d.ts +22 -42
  19. package/dts/chart/axis/Axis.d.ts.map +1 -1
  20. package/dts/chart/axis/XAxis.d.ts +6 -0
  21. package/dts/chart/axis/XAxis.d.ts.map +1 -1
  22. package/dts/chart/axis/YAxis.d.ts +1 -0
  23. package/dts/chart/axis/YAxis.d.ts.map +1 -1
  24. package/dts/chart/bar/Bar.d.ts +51 -51
  25. package/dts/chart/bar/Bar.d.ts.map +1 -1
  26. package/dts/chart/bar/BarChart.d.ts +56 -11
  27. package/dts/chart/bar/BarChart.d.ts.map +1 -1
  28. package/dts/chart/bar/BarPlot.d.ts +2 -1
  29. package/dts/chart/bar/BarPlot.d.ts.map +1 -1
  30. package/dts/chart/bar/BarStack.d.ts +45 -20
  31. package/dts/chart/bar/BarStack.d.ts.map +1 -1
  32. package/dts/chart/bar/BarStackGroup.d.ts +2 -1
  33. package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
  34. package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
  35. package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
  36. package/dts/chart/gradient/Gradient.d.ts +5 -0
  37. package/dts/chart/gradient/Gradient.d.ts.map +1 -1
  38. package/dts/chart/index.d.ts +1 -0
  39. package/dts/chart/index.d.ts.map +1 -1
  40. package/dts/chart/legend/DefaultLegendEntry.d.ts +5 -0
  41. package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
  42. package/dts/chart/legend/DefaultLegendShape.d.ts +5 -0
  43. package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
  44. package/dts/chart/legend/Legend.d.ts +168 -0
  45. package/dts/chart/legend/Legend.d.ts.map +1 -0
  46. package/dts/chart/legend/index.d.ts +4 -0
  47. package/dts/chart/legend/index.d.ts.map +1 -0
  48. package/dts/chart/line/DottedLine.d.ts.map +1 -1
  49. package/dts/chart/line/Line.d.ts +23 -19
  50. package/dts/chart/line/Line.d.ts.map +1 -1
  51. package/dts/chart/line/LineChart.d.ts +26 -9
  52. package/dts/chart/line/LineChart.d.ts.map +1 -1
  53. package/dts/chart/line/ReferenceLine.d.ts +1 -0
  54. package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
  55. package/dts/chart/line/SolidLine.d.ts.map +1 -1
  56. package/dts/chart/point/Point.d.ts +26 -2
  57. package/dts/chart/point/Point.d.ts.map +1 -1
  58. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +32 -2
  59. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -1
  60. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +2 -1
  61. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -1
  62. package/dts/chart/scrubber/Scrubber.d.ts +86 -17
  63. package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
  64. package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts +12 -0
  65. package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts.map +1 -0
  66. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +10 -0
  67. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -1
  68. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +16 -1
  69. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -1
  70. package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
  71. package/dts/chart/utils/axis.d.ts +45 -10
  72. package/dts/chart/utils/axis.d.ts.map +1 -1
  73. package/dts/chart/utils/bar.d.ts +190 -0
  74. package/dts/chart/utils/bar.d.ts.map +1 -1
  75. package/dts/chart/utils/chart.d.ts +32 -0
  76. package/dts/chart/utils/chart.d.ts.map +1 -1
  77. package/dts/chart/utils/context.d.ts +21 -6
  78. package/dts/chart/utils/context.d.ts.map +1 -1
  79. package/dts/chart/utils/gradient.d.ts +3 -1
  80. package/dts/chart/utils/gradient.d.ts.map +1 -1
  81. package/dts/chart/utils/path.d.ts +26 -0
  82. package/dts/chart/utils/path.d.ts.map +1 -1
  83. package/dts/chart/utils/point.d.ts +24 -12
  84. package/dts/chart/utils/point.d.ts.map +1 -1
  85. package/dts/chart/utils/scale.d.ts +11 -0
  86. package/dts/chart/utils/scale.d.ts.map +1 -1
  87. package/dts/chart/utils/scrubber.d.ts +2 -1
  88. package/dts/chart/utils/scrubber.d.ts.map +1 -1
  89. package/dts/chart/utils/transition.d.ts +63 -22
  90. package/dts/chart/utils/transition.d.ts.map +1 -1
  91. package/dts/sparkline/Sparkline.d.ts +2 -1
  92. package/dts/sparkline/Sparkline.d.ts.map +1 -1
  93. package/dts/sparkline/SparklineArea.d.ts +2 -1
  94. package/dts/sparkline/SparklineArea.d.ts.map +1 -1
  95. package/dts/sparkline/SparklineGradient.d.ts +2 -1
  96. package/dts/sparkline/SparklineGradient.d.ts.map +1 -1
  97. package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +2 -1
  98. package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +1 -1
  99. package/esm/chart/CartesianChart.js +176 -82
  100. package/esm/chart/ChartContextBridge.js +14 -3
  101. package/esm/chart/ChartProvider.js +2 -2
  102. package/esm/chart/Path.js +34 -29
  103. package/esm/chart/PeriodSelector.js +6 -2
  104. package/esm/chart/__stories__/CartesianChart.stories.js +27 -86
  105. package/esm/chart/__stories__/ChartAccessibility.stories.js +721 -0
  106. package/esm/chart/__stories__/ChartTransitions.stories.js +625 -0
  107. package/esm/chart/__stories__/PeriodSelector.stories.js +102 -4
  108. package/esm/chart/area/Area.js +21 -9
  109. package/esm/chart/area/AreaChart.js +18 -13
  110. package/esm/chart/area/DottedArea.js +28 -18
  111. package/esm/chart/area/GradientArea.js +14 -7
  112. package/esm/chart/area/SolidArea.js +6 -2
  113. package/esm/chart/area/__stories__/AreaChart.stories.js +47 -5
  114. package/esm/chart/axis/Axis.js +5 -41
  115. package/esm/chart/axis/XAxis.js +116 -47
  116. package/esm/chart/axis/YAxis.js +105 -26
  117. package/esm/chart/axis/__stories__/Axis.stories.js +324 -48
  118. package/esm/chart/bar/Bar.js +17 -15
  119. package/esm/chart/bar/BarChart.js +38 -33
  120. package/esm/chart/bar/BarPlot.js +40 -45
  121. package/esm/chart/bar/BarStack.js +92 -475
  122. package/esm/chart/bar/BarStackGroup.js +37 -27
  123. package/esm/chart/bar/DefaultBar.js +27 -18
  124. package/esm/chart/bar/DefaultBarStack.js +25 -9
  125. package/esm/chart/bar/__stories__/BarChart.stories.js +728 -54
  126. package/esm/chart/gradient/Gradient.js +2 -1
  127. package/esm/chart/index.js +1 -0
  128. package/esm/chart/legend/DefaultLegendEntry.js +42 -0
  129. package/esm/chart/legend/DefaultLegendShape.js +64 -0
  130. package/esm/chart/legend/Legend.js +59 -0
  131. package/esm/chart/legend/__stories__/Legend.stories.js +574 -0
  132. package/esm/chart/legend/index.js +3 -0
  133. package/esm/chart/line/DottedLine.js +6 -2
  134. package/esm/chart/line/Line.js +42 -38
  135. package/esm/chart/line/LineChart.js +36 -12
  136. package/esm/chart/line/SolidLine.js +6 -2
  137. package/esm/chart/line/__stories__/LineChart.stories.js +241 -594
  138. package/esm/chart/line/__stories__/ReferenceLine.stories.js +95 -1
  139. package/esm/chart/point/Point.js +35 -36
  140. package/esm/chart/scrubber/DefaultScrubberBeacon.js +41 -38
  141. package/esm/chart/scrubber/DefaultScrubberLabel.js +26 -10
  142. package/esm/chart/scrubber/Scrubber.js +67 -35
  143. package/esm/chart/scrubber/ScrubberAccessibilityView.js +177 -0
  144. package/esm/chart/scrubber/ScrubberBeaconGroup.js +30 -22
  145. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +35 -8
  146. package/esm/chart/scrubber/ScrubberProvider.js +29 -24
  147. package/esm/chart/scrubber/__stories__/Scrubber.stories.js +946 -0
  148. package/esm/chart/utils/axis.js +88 -44
  149. package/esm/chart/utils/bar.js +820 -0
  150. package/esm/chart/utils/chart.js +34 -7
  151. package/esm/chart/utils/context.js +7 -0
  152. package/esm/chart/utils/gradient.js +8 -4
  153. package/esm/chart/utils/path.js +91 -61
  154. package/esm/chart/utils/point.js +92 -39
  155. package/esm/chart/utils/scale.js +13 -2
  156. package/esm/chart/utils/scrubber.js +12 -5
  157. package/esm/chart/utils/transition.js +108 -60
  158. package/esm/sparkline/Sparkline.js +2 -1
  159. package/esm/sparkline/SparklineArea.js +2 -1
  160. package/esm/sparkline/SparklineGradient.js +2 -1
  161. package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
  162. package/esm/sparkline/__stories__/Sparkline.stories.js +11 -7
  163. package/esm/sparkline/__stories__/SparklineGradient.stories.js +7 -4
  164. package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +2 -1
  165. package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
  166. package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +51 -26
  167. package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
  168. package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +19 -9
  169. package/package.json +13 -10
  170. package/esm/chart/__stories__/Chart.stories.js +0 -77
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useMemo, useRef } from 'react';
2
- import { useAnimatedReaction, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
2
+ import { useAnimatedReaction, useSharedValue, withDelay, withSpring, withTiming } from 'react-native-reanimated';
3
3
  import { notifyChange, Skia } from '@shopify/react-native-skia';
4
4
  import { interpolatePath } from 'd3-interpolate-path';
5
5
 
@@ -18,7 +18,8 @@ import { interpolatePath } from 'd3-interpolate-path';
18
18
  */
19
19
 
20
20
  /**
21
- * Default transition configuration used across all chart components.
21
+ * Default update transition used across all chart components.
22
+ * `{ type: 'spring', stiffness: 900, damping: 120 }`
22
23
  */
23
24
  export const defaultTransition = {
24
25
  type: 'spring',
@@ -26,6 +27,15 @@ export const defaultTransition = {
26
27
  damping: 120
27
28
  };
28
29
 
30
+ /**
31
+ * Instant transition that completes immediately with no animation.
32
+ * Used when a transition is set to `null`.
33
+ */
34
+ export const instantTransition = {
35
+ type: 'timing',
36
+ duration: 0
37
+ };
38
+
29
39
  /**
30
40
  * Duration in milliseconds for accessory elements to fade in.
31
41
  */
@@ -37,41 +47,28 @@ export const accessoryFadeTransitionDuration = 150;
37
47
  export const accessoryFadeTransitionDelay = 350;
38
48
 
39
49
  /**
40
- * Custom hook that uses d3-interpolate-path for more robust path interpolation.
41
- * then use Skia's native interpolation in the worklet.
42
- *
43
- * @param progress - Shared value between 0 and 1
44
- * @param fromPath - Starting path as SVG string
45
- * @param toPath - Ending path as SVG string
46
- * @returns Interpolated SkPath as a shared value
50
+ * Default enter transition for accessory elements (Point, Scrubber beacons).
51
+ * `{ type: 'timing', duration: 150, delay: 350 }`
47
52
  */
48
- export const useD3PathInterpolation = (progress, fromPath, toPath) => {
49
- // Pre-compute intermediate paths on JS thread using d3-interpolate-path
50
- const {
51
- fromSkiaPath,
52
- i0,
53
- i1,
54
- toSkiaPath
55
- } = useMemo(() => {
56
- var _Skia$Path$MakeFromSV, _Skia$Path$MakeFromSV2, _Skia$Path$MakeFromSV3, _Skia$Path$MakeFromSV4;
57
- const pathInterpolator = interpolatePath(fromPath, toPath);
58
- const d = 1e-3;
59
- return {
60
- fromSkiaPath: (_Skia$Path$MakeFromSV = Skia.Path.MakeFromSVGString(fromPath)) != null ? _Skia$Path$MakeFromSV : Skia.Path.Make(),
61
- i0: (_Skia$Path$MakeFromSV2 = Skia.Path.MakeFromSVGString(pathInterpolator(d))) != null ? _Skia$Path$MakeFromSV2 : Skia.Path.Make(),
62
- i1: (_Skia$Path$MakeFromSV3 = Skia.Path.MakeFromSVGString(pathInterpolator(1 - d))) != null ? _Skia$Path$MakeFromSV3 : Skia.Path.Make(),
63
- toSkiaPath: (_Skia$Path$MakeFromSV4 = Skia.Path.MakeFromSVGString(toPath)) != null ? _Skia$Path$MakeFromSV4 : Skia.Path.Make()
64
- };
65
- }, [fromPath, toPath]);
66
- const result = useSharedValue(fromSkiaPath);
67
- useAnimatedReaction(() => progress.value, t => {
68
- 'worklet';
53
+ export const defaultAccessoryEnterTransition = {
54
+ type: 'timing',
55
+ duration: accessoryFadeTransitionDuration,
56
+ delay: accessoryFadeTransitionDelay
57
+ };
69
58
 
70
- var _i1$interpolate;
71
- result.value = (_i1$interpolate = i1.interpolate(i0, t)) != null ? _i1$interpolate : toSkiaPath;
72
- notifyChange(result);
73
- }, [fromSkiaPath, i0, i1, toSkiaPath]);
74
- return result;
59
+ // Avoid exact endpoint samples, which can intermittently produce non-interpolatable
60
+ // path pairs for SkPath.interpolate on complex morphs.
61
+ // See https://github.com/wcandillon/can-it-be-done-in-react-native/blob/db8d6ee7024e37e8f8d2cb237c0b953b5fc766fe/season5/src/Headspace/Play.tsx
62
+ const pathInterpolationEpsilon = 1e-3;
63
+
64
+ /**
65
+ * Resolves a transition value based on the animation state and a default.
66
+ * @note Passing in null will disable an animation.
67
+ * @note Passing in undefined will use the provided default.
68
+ */
69
+ export const getTransition = (value, animate, defaultValue) => {
70
+ if (!animate || value === null) return null;
71
+ return value != null ? value : defaultValue;
75
72
  };
76
73
 
77
74
  // Interpolator and useInterpolator are brought over from non exported code in @shopify/react-native-skia
@@ -114,21 +111,30 @@ export const useInterpolator = (factory, value, interpolator, input, output, opt
114
111
  export const buildTransition = (targetValue, transition) => {
115
112
  'worklet';
116
113
 
114
+ if (transition === null) return targetValue;
115
+ const delayMs = transition.delay;
116
+ let animation;
117
117
  switch (transition.type) {
118
118
  case 'timing':
119
119
  {
120
- return withTiming(targetValue, transition);
120
+ animation = withTiming(targetValue, transition);
121
+ break;
121
122
  }
122
123
  case 'spring':
123
124
  {
124
- return withSpring(targetValue, transition);
125
+ animation = withSpring(targetValue, transition);
126
+ break;
125
127
  }
126
128
  default:
127
129
  {
128
- // Fallback to default transition config
129
- return withSpring(targetValue, defaultTransition);
130
+ animation = withSpring(targetValue, defaultTransition);
131
+ break;
130
132
  }
131
133
  }
134
+ if (delayMs && delayMs > 0) {
135
+ return withDelay(delayMs, animation);
136
+ }
137
+ return animation;
132
138
  };
133
139
 
134
140
  /**
@@ -136,15 +142,16 @@ export const buildTransition = (targetValue, transition) => {
136
142
  *
137
143
  * @param currentPath - Current target path to animate to
138
144
  * @param initialPath - Initial path for enter animation. When provided, the first animation will go from initialPath to currentPath.
139
- * @param transition - Transition configuration
145
+ * @param transitions - Transition configuration for enter and update animations
140
146
  * @returns Animated SkPath as a shared value
141
147
  *
142
148
  * @example
143
149
  * // Simple path transition
144
150
  * const path = usePathTransition({
145
151
  * currentPath: d ?? '',
146
- * animate: shouldAnimate,
147
- * transition: { type: 'timing', duration: 3000 }
152
+ * transitions: {
153
+ * update: { type: 'timing', duration: 3000 },
154
+ * },
148
155
  * });
149
156
  *
150
157
  * @example
@@ -152,34 +159,75 @@ export const buildTransition = (targetValue, transition) => {
152
159
  * const path = usePathTransition({
153
160
  * currentPath: targetPath,
154
161
  * initialPath: baselinePath,
155
- * animate: true,
156
- * transition: { type: 'timing', duration: 300 }
162
+ * transitions: {
163
+ * enter: { type: 'tween', duration: 500 },
164
+ * update: { type: 'spring', stiffness: 900, damping: 120 },
165
+ * },
157
166
  * });
158
167
  */
159
168
  export const usePathTransition = _ref => {
169
+ var _Skia$Path$MakeFromSV;
160
170
  let {
161
171
  currentPath,
162
172
  initialPath,
173
+ transitions,
163
174
  transition = defaultTransition
164
175
  } = _ref;
165
- // Track the previous path - updated in useEffect AFTER render,
166
- // so during render it naturally holds the "from" path value
167
- const previousPathRef = useRef(initialPath != null ? initialPath : currentPath);
176
+ const updateTransition = (transitions == null ? void 0 : transitions.update) !== undefined ? transitions.update : transition;
177
+ const enterTransition = transitions == null ? void 0 : transitions.enter;
178
+ const targetPathRef = useRef(initialPath != null ? initialPath : currentPath);
179
+ const isFirstAnimation = useRef(!!initialPath);
180
+ const interpolatorRef = useRef(null);
168
181
  const progress = useSharedValue(0);
169
-
170
- // During render: previousPathRef still has old value, currentPath is new
171
- const fromPath = previousPathRef.current;
172
- const toPath = currentPath;
182
+ const initialSkiaPath = (_Skia$Path$MakeFromSV = Skia.Path.MakeFromSVGString(initialPath != null ? initialPath : currentPath)) != null ? _Skia$Path$MakeFromSV : Skia.Path.Make();
183
+ const normalizedStartShared = useSharedValue(initialSkiaPath);
184
+ const normalizedEndShared = useSharedValue(initialSkiaPath);
185
+ const fallbackPathShared = useSharedValue(initialSkiaPath);
186
+ const result = useSharedValue(initialSkiaPath);
173
187
  useEffect(() => {
174
- const shouldAnimate = previousPathRef.current !== currentPath;
175
- if (shouldAnimate) {
176
- // Update ref for next path change (happens after this render)
177
- previousPathRef.current = currentPath;
178
-
179
- // Animate from old path to new path
188
+ if (targetPathRef.current !== currentPath) {
189
+ var _Skia$Path$MakeFromSV3, _Skia$Path$MakeFromSV4, _Skia$Path$MakeFromSV5;
190
+ let fromPath = targetPathRef.current;
191
+ if (interpolatorRef.current) {
192
+ const p = Math.min(Math.max(progress.value, 0), 1);
193
+ fromPath = interpolatorRef.current(p);
194
+ }
195
+ targetPathRef.current = currentPath;
196
+ const activeTransition = isFirstAnimation.current && enterTransition !== undefined ? enterTransition : updateTransition;
197
+ isFirstAnimation.current = false;
198
+ if (activeTransition === null) {
199
+ var _Skia$Path$MakeFromSV2;
200
+ const targetPath = (_Skia$Path$MakeFromSV2 = Skia.Path.MakeFromSVGString(currentPath)) != null ? _Skia$Path$MakeFromSV2 : Skia.Path.Make();
201
+ interpolatorRef.current = null;
202
+ normalizedStartShared.value = targetPath;
203
+ normalizedEndShared.value = targetPath;
204
+ fallbackPathShared.value = targetPath;
205
+ progress.value = 1;
206
+ result.value = targetPath;
207
+ notifyChange(result);
208
+ return;
209
+ }
210
+ const pathInterpolator = interpolatePath(fromPath, currentPath);
211
+ interpolatorRef.current = pathInterpolator;
212
+ normalizedStartShared.value = (_Skia$Path$MakeFromSV3 = Skia.Path.MakeFromSVGString(pathInterpolator(pathInterpolationEpsilon))) != null ? _Skia$Path$MakeFromSV3 : Skia.Path.Make();
213
+ normalizedEndShared.value = (_Skia$Path$MakeFromSV4 = Skia.Path.MakeFromSVGString(pathInterpolator(1 - pathInterpolationEpsilon))) != null ? _Skia$Path$MakeFromSV4 : Skia.Path.Make();
214
+ fallbackPathShared.value = (_Skia$Path$MakeFromSV5 = Skia.Path.MakeFromSVGString(currentPath)) != null ? _Skia$Path$MakeFromSV5 : Skia.Path.Make();
180
215
  progress.value = 0;
181
- progress.value = buildTransition(1, transition);
216
+ progress.value = buildTransition(1, activeTransition);
182
217
  }
183
- }, [currentPath, transition, progress]);
184
- return useD3PathInterpolation(progress, fromPath, toPath);
218
+ }, [currentPath, updateTransition, enterTransition, progress, normalizedStartShared, normalizedEndShared, fallbackPathShared, result]);
219
+ useAnimatedReaction(() => ({
220
+ p: progress.value,
221
+ to: fallbackPathShared.value
222
+ }), _ref2 => {
223
+ 'worklet';
224
+
225
+ var _normalizedEndShared$;
226
+ let {
227
+ p
228
+ } = _ref2;
229
+ result.value = (_normalizedEndShared$ = normalizedEndShared.value.interpolate(normalizedStartShared.value, p)) != null ? _normalizedEndShared$ : fallbackPathShared.value;
230
+ notifyChange(result);
231
+ }, []);
232
+ return result;
185
233
  };
@@ -12,7 +12,8 @@ import { generateSparklineAreaWithId } from './generateSparklineWithId';
12
12
  import { SparklineAreaPattern } from './SparklineAreaPattern';
13
13
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
14
14
  /**
15
- * @deprecated Use LineChart instead.
15
+ * @deprecated Use LineChart instead. This will be removed in a future major release.
16
+ * @deprecationExpectedRemoval v4
16
17
  */
17
18
  export const Sparkline = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
18
19
  let {
@@ -2,7 +2,8 @@ import React, { forwardRef, memo } from 'react';
2
2
  import { Path } from 'react-native-svg';
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
4
  /**
5
- * @deprecated Use AreaChart instead.
5
+ * @deprecated Use AreaChart instead. This will be removed in a future major release.
6
+ * @deprecationExpectedRemoval v4
6
7
  */
7
8
  export const SparklineArea = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
8
9
  let {
@@ -11,7 +11,8 @@ import { generateSparklineAreaWithId } from './generateSparklineWithId';
11
11
  import { SparklineAreaPattern } from './SparklineAreaPattern';
12
12
 
13
13
  /**
14
- * @deprecated Use LineChart instead.
14
+ * @deprecated Use LineChart instead. This will be removed in a future major release.
15
+ * @deprecationExpectedRemoval v4
15
16
  */
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  export const SparklineGradient = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
@@ -4,7 +4,7 @@ import { figma } from '@figma/code-connect';
4
4
  import { Sparkline } from '../Sparkline';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  figma.connect(Sparkline, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=320%3A15040', {
7
- imports: ["import { Sparkline } from '@coinbase/cds-mobile-visualization';", "import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath';"],
7
+ imports: ["import { Sparkline } from '@coinbase/cds-mobile-visualization'", "import { useSparklinePath } from '@coinbase/cds-common/visualizations/useSparklinePath'"],
8
8
  example: function Example() {
9
9
  const data = [20, 30, 5, 45, 0];
10
10
  const path = useSparklinePath({
@@ -12,8 +12,7 @@ import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScr
12
12
  import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
13
13
  import { HStack } from '@coinbase/cds-mobile/layout/HStack';
14
14
  import { VStack } from '@coinbase/cds-mobile/layout/VStack';
15
- import { TextBody } from '@coinbase/cds-mobile/typography/TextBody';
16
- import { TextHeadline } from '@coinbase/cds-mobile/typography/TextHeadline';
15
+ import { Text } from '@coinbase/cds-mobile/typography';
17
16
  import { Sparkline } from '../Sparkline';
18
17
  import { SparklineArea } from '../SparklineArea';
19
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -42,13 +41,15 @@ const SparklineExample = _ref => {
42
41
  alignItems: "flex-end",
43
42
  justifyContent: "center",
44
43
  paddingStart: 2,
45
- children: [/*#__PURE__*/_jsx(TextBody, {
44
+ children: [/*#__PURE__*/_jsx(Text, {
46
45
  align: "end",
46
+ font: "body",
47
47
  numberOfLines: 1,
48
48
  children: "$2,874.49"
49
- }), /*#__PURE__*/_jsx(TextBody, {
49
+ }), /*#__PURE__*/_jsx(Text, {
50
50
  align: "end",
51
51
  color: "fgMuted",
52
+ font: "body",
52
53
  numberOfLines: 1,
53
54
  children: "+36.08%"
54
55
  })]
@@ -61,12 +62,14 @@ const SparklineExample = _ref => {
61
62
  }),
62
63
  children: /*#__PURE__*/_jsxs(VStack, {
63
64
  justifyContent: "center",
64
- children: [/*#__PURE__*/_jsx(TextHeadline, {
65
+ children: [/*#__PURE__*/_jsx(Text, {
65
66
  ellipsize: "tail",
67
+ font: "headline",
66
68
  numberOfLines: 1,
67
69
  children: name
68
- }), /*#__PURE__*/_jsx(TextBody, {
70
+ }), /*#__PURE__*/_jsx(Text, {
69
71
  ellipsize: "tail",
72
+ font: "body",
70
73
  numberOfLines: 1,
71
74
  children: symbol
72
75
  })]
@@ -84,8 +87,9 @@ const SparklineScalingExample = props => {
84
87
  const path = useSparklinePath(_extends({}, dimensions, props));
85
88
  const area = useSparklineArea(_extends({}, dimensions, props));
86
89
  return /*#__PURE__*/_jsxs(VStack, {
87
- children: [/*#__PURE__*/_jsxs(TextHeadline, {
90
+ children: [/*#__PURE__*/_jsxs(Text, {
88
91
  ellipsize: "tail",
92
+ font: "headline",
89
93
  numberOfLines: 1,
90
94
  children: ["Scale: ", props.yAxisScalingFactor]
91
95
  }), /*#__PURE__*/_jsx(Sparkline, _extends({}, dimensions, {
@@ -11,7 +11,7 @@ import { CellMedia } from '@coinbase/cds-mobile/cells/CellMedia';
11
11
  import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
12
12
  import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
13
13
  import { VStack } from '@coinbase/cds-mobile/layout';
14
- import { TextBody, TextHeadline } from '@coinbase/cds-mobile/typography';
14
+ import { Text } from '@coinbase/cds-mobile/typography';
15
15
  import { SparklineArea } from '../SparklineArea';
16
16
  import { SparklineGradient } from '../SparklineGradient';
17
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -45,12 +45,14 @@ const SparklineGradientExample = _ref => {
45
45
  }),
46
46
  children: /*#__PURE__*/_jsxs(VStack, {
47
47
  justifyContent: "center",
48
- children: [/*#__PURE__*/_jsx(TextHeadline, {
48
+ children: [/*#__PURE__*/_jsx(Text, {
49
49
  ellipsize: "tail",
50
+ font: "headline",
50
51
  numberOfLines: 1,
51
52
  children: name
52
- }), /*#__PURE__*/_jsx(TextBody, {
53
+ }), /*#__PURE__*/_jsx(Text, {
53
54
  ellipsize: "tail",
55
+ font: "body",
54
56
  numberOfLines: 1,
55
57
  children: symbol
56
58
  })]
@@ -75,8 +77,9 @@ const SparklineScalingExample = props => {
75
77
  const path = useSparklinePath(_extends({}, dimensions, props));
76
78
  const area = useSparklineArea(_extends({}, dimensions, props));
77
79
  return /*#__PURE__*/_jsxs(VStack, {
78
- children: [/*#__PURE__*/_jsxs(TextHeadline, {
80
+ children: [/*#__PURE__*/_jsxs(Text, {
79
81
  ellipsize: "tail",
82
+ font: "headline",
80
83
  numberOfLines: 1,
81
84
  children: ["Scale: ", props.yAxisScalingFactor]
82
85
  }), /*#__PURE__*/_jsx(SparklineGradient, _extends({}, dimensions, {
@@ -302,6 +302,7 @@ function SparklineInteractiveWithGeneric(_ref4) {
302
302
  }
303
303
 
304
304
  /**
305
- * @deprecated Use LineChart instead.
305
+ * @deprecated Use LineChart instead. This will be removed in a future major release.
306
+ * @deprecationExpectedRemoval v4
306
307
  */
307
308
  export const SparklineInteractive = /*#__PURE__*/memo(SparklineInteractiveWithGeneric);
@@ -4,7 +4,7 @@ import { figma } from '@figma/code-connect';
4
4
  import { SparklineInteractive } from '../SparklineInteractive';
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  figma.connect(SparklineInteractive, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=320-14858&m=dev', {
7
- imports: ["import { SparklineInteractive } from '@coinbase/cds-web-visualization';"],
7
+ imports: ["import { SparklineInteractive } from '@coinbase/cds-mobile-visualization'"],
8
8
  props: {
9
9
  compact: figma.boolean('compact'),
10
10
  disableScrubbing: figma.boolean('scrubbing', {
@@ -3,7 +3,7 @@ import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
3
3
  import { sparklineInteractiveData, sparklineInteractiveHoverData, strokeColor } from '@coinbase/cds-common/internal/visualizations/SparklineInteractiveData';
4
4
  import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
5
5
  import { Box } from '@coinbase/cds-mobile/layout';
6
- import { TextTitle3 } from '@coinbase/cds-mobile/typography/TextTitle3';
6
+ import { Text } from '@coinbase/cds-mobile/typography';
7
7
  import { SparklineInteractiveHeader } from '../../sparkline-interactive-header/SparklineInteractiveHeader';
8
8
  import { SparklineInteractive } from '../SparklineInteractive';
9
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -175,7 +175,8 @@ const SparklineInteractiveScreen = () => {
175
175
  children: [/*#__PURE__*/_jsx(Example, {
176
176
  padding: 0,
177
177
  children: /*#__PURE__*/_jsxs(Box, {
178
- children: [/*#__PURE__*/_jsx(TextTitle3, {
178
+ children: [/*#__PURE__*/_jsx(Text, {
179
+ font: "title3",
179
180
  paddingX: 3,
180
181
  paddingY: 3,
181
182
  children: "Default"
@@ -187,7 +188,8 @@ const SparklineInteractiveScreen = () => {
187
188
  }), /*#__PURE__*/_jsx(Example, {
188
189
  padding: 0,
189
190
  children: /*#__PURE__*/_jsxs(Box, {
190
- children: [/*#__PURE__*/_jsx(TextTitle3, {
191
+ children: [/*#__PURE__*/_jsx(Text, {
192
+ font: "title3",
191
193
  paddingX: 3,
192
194
  paddingY: 3,
193
195
  children: "Compact"
@@ -200,7 +202,8 @@ const SparklineInteractiveScreen = () => {
200
202
  }), /*#__PURE__*/_jsx(Example, {
201
203
  padding: 0,
202
204
  children: /*#__PURE__*/_jsxs(Box, {
203
- children: [/*#__PURE__*/_jsx(TextTitle3, {
205
+ children: [/*#__PURE__*/_jsx(Text, {
206
+ font: "title3",
204
207
  paddingX: 3,
205
208
  paddingY: 3,
206
209
  children: "Disable Scrubbing"
@@ -213,7 +216,8 @@ const SparklineInteractiveScreen = () => {
213
216
  }), /*#__PURE__*/_jsx(Example, {
214
217
  padding: 0,
215
218
  children: /*#__PURE__*/_jsxs(Box, {
216
- children: [/*#__PURE__*/_jsx(TextTitle3, {
219
+ children: [/*#__PURE__*/_jsx(Text, {
220
+ font: "title3",
217
221
  paddingX: 3,
218
222
  paddingY: 3,
219
223
  children: "Hide period selector"
@@ -226,7 +230,8 @@ const SparklineInteractiveScreen = () => {
226
230
  }), /*#__PURE__*/_jsx(Example, {
227
231
  padding: 0,
228
232
  children: /*#__PURE__*/_jsxs(Box, {
229
- children: [/*#__PURE__*/_jsx(TextTitle3, {
233
+ children: [/*#__PURE__*/_jsx(Text, {
234
+ font: "title3",
230
235
  paddingX: 3,
231
236
  paddingY: 3,
232
237
  children: "Hide min/max label"
@@ -239,7 +244,8 @@ const SparklineInteractiveScreen = () => {
239
244
  }), /*#__PURE__*/_jsx(Example, {
240
245
  padding: 0,
241
246
  children: /*#__PURE__*/_jsxs(Box, {
242
- children: [/*#__PURE__*/_jsx(TextTitle3, {
247
+ children: [/*#__PURE__*/_jsx(Text, {
248
+ font: "title3",
243
249
  paddingX: 3,
244
250
  paddingY: 3,
245
251
  children: "Default period All"
@@ -252,7 +258,8 @@ const SparklineInteractiveScreen = () => {
252
258
  }), /*#__PURE__*/_jsx(Example, {
253
259
  padding: 0,
254
260
  children: /*#__PURE__*/_jsxs(Box, {
255
- children: [/*#__PURE__*/_jsx(TextTitle3, {
261
+ children: [/*#__PURE__*/_jsx(Text, {
262
+ font: "title3",
256
263
  paddingX: 3,
257
264
  paddingY: 3,
258
265
  children: "Fill Disabled"
@@ -265,7 +272,8 @@ const SparklineInteractiveScreen = () => {
265
272
  }), /*#__PURE__*/_jsx(Example, {
266
273
  padding: 0,
267
274
  children: /*#__PURE__*/_jsxs(Box, {
268
- children: [/*#__PURE__*/_jsx(TextTitle3, {
275
+ children: [/*#__PURE__*/_jsx(Text, {
276
+ font: "title3",
269
277
  paddingX: 3,
270
278
  paddingY: 3,
271
279
  children: "Y axis scaling"
@@ -278,7 +286,8 @@ const SparklineInteractiveScreen = () => {
278
286
  }), /*#__PURE__*/_jsx(Example, {
279
287
  padding: 0,
280
288
  children: /*#__PURE__*/_jsxs(Box, {
281
- children: [/*#__PURE__*/_jsx(TextTitle3, {
289
+ children: [/*#__PURE__*/_jsx(Text, {
290
+ font: "title3",
282
291
  paddingX: 3,
283
292
  paddingY: 3,
284
293
  children: "Fallback"
@@ -289,7 +298,8 @@ const SparklineInteractiveScreen = () => {
289
298
  }), /*#__PURE__*/_jsx(Example, {
290
299
  padding: 0,
291
300
  children: /*#__PURE__*/_jsxs(Box, {
292
- children: [/*#__PURE__*/_jsx(TextTitle3, {
301
+ children: [/*#__PURE__*/_jsx(Text, {
302
+ font: "title3",
293
303
  paddingX: 3,
294
304
  paddingY: 3,
295
305
  children: "Fallback Negative"
@@ -301,7 +311,8 @@ const SparklineInteractiveScreen = () => {
301
311
  }), /*#__PURE__*/_jsx(Example, {
302
312
  padding: 0,
303
313
  children: /*#__PURE__*/_jsxs(Box, {
304
- children: [/*#__PURE__*/_jsx(TextTitle3, {
314
+ children: [/*#__PURE__*/_jsx(Text, {
315
+ font: "title3",
305
316
  paddingX: 3,
306
317
  paddingY: 3,
307
318
  children: "Fallback Compact"
@@ -313,7 +324,8 @@ const SparklineInteractiveScreen = () => {
313
324
  }), /*#__PURE__*/_jsx(Example, {
314
325
  padding: 0,
315
326
  children: /*#__PURE__*/_jsxs(Box, {
316
- children: [/*#__PURE__*/_jsx(TextTitle3, {
327
+ children: [/*#__PURE__*/_jsx(Text, {
328
+ font: "title3",
317
329
  paddingX: 3,
318
330
  paddingY: 3,
319
331
  children: "No Hover Date"
@@ -326,7 +338,8 @@ const SparklineInteractiveScreen = () => {
326
338
  }), /*#__PURE__*/_jsx(Example, {
327
339
  padding: 0,
328
340
  children: /*#__PURE__*/_jsxs(Box, {
329
- children: [/*#__PURE__*/_jsx(TextTitle3, {
341
+ children: [/*#__PURE__*/_jsx(Text, {
342
+ font: "title3",
330
343
  paddingX: 3,
331
344
  paddingY: 3,
332
345
  children: "With Header Node"
@@ -338,7 +351,8 @@ const SparklineInteractiveScreen = () => {
338
351
  }), /*#__PURE__*/_jsx(Example, {
339
352
  padding: 0,
340
353
  children: /*#__PURE__*/_jsxs(Box, {
341
- children: [/*#__PURE__*/_jsx(TextTitle3, {
354
+ children: [/*#__PURE__*/_jsx(Text, {
355
+ font: "title3",
342
356
  paddingX: 3,
343
357
  paddingY: 3,
344
358
  children: "No padding"
@@ -352,7 +366,8 @@ const SparklineInteractiveScreen = () => {
352
366
  }), /*#__PURE__*/_jsx(Example, {
353
367
  padding: 4,
354
368
  children: /*#__PURE__*/_jsxs(Box, {
355
- children: [/*#__PURE__*/_jsx(TextTitle3, {
369
+ children: [/*#__PURE__*/_jsx(Text, {
370
+ font: "title3",
356
371
  paddingY: 3,
357
372
  children: "In Container With 4 padding"
358
373
  }), /*#__PURE__*/_jsx(SparklineInteractiveWithHeaderBuild, {
@@ -365,7 +380,8 @@ const SparklineInteractiveScreen = () => {
365
380
  }), /*#__PURE__*/_jsx(Example, {
366
381
  padding: 0,
367
382
  children: /*#__PURE__*/_jsxs(Box, {
368
- children: [/*#__PURE__*/_jsx(TextTitle3, {
383
+ children: [/*#__PURE__*/_jsx(Text, {
384
+ font: "title3",
369
385
  paddingX: 3,
370
386
  paddingY: 3,
371
387
  children: "Custom screen padding 6"
@@ -378,7 +394,8 @@ const SparklineInteractiveScreen = () => {
378
394
  }), /*#__PURE__*/_jsx(Example, {
379
395
  padding: 0,
380
396
  children: /*#__PURE__*/_jsxs(Box, {
381
- children: [/*#__PURE__*/_jsx(TextTitle3, {
397
+ children: [/*#__PURE__*/_jsx(Text, {
398
+ font: "title3",
382
399
  paddingX: 3,
383
400
  paddingY: 3,
384
401
  children: "Hover data"
@@ -391,7 +408,8 @@ const SparklineInteractiveScreen = () => {
391
408
  }), /*#__PURE__*/_jsx(Example, {
392
409
  padding: 0,
393
410
  children: /*#__PURE__*/_jsxs(Box, {
394
- children: [/*#__PURE__*/_jsx(TextTitle3, {
411
+ children: [/*#__PURE__*/_jsx(Text, {
412
+ font: "title3",
395
413
  paddingX: 3,
396
414
  paddingY: 3,
397
415
  children: "Auto Stoke Color"
@@ -403,7 +421,8 @@ const SparklineInteractiveScreen = () => {
403
421
  }), /*#__PURE__*/_jsx(Example, {
404
422
  padding: 0,
405
423
  children: /*#__PURE__*/_jsxs(Box, {
406
- children: [/*#__PURE__*/_jsx(TextTitle3, {
424
+ children: [/*#__PURE__*/_jsx(Text, {
425
+ font: "title3",
407
426
  paddingX: 3,
408
427
  paddingY: 3,
409
428
  children: "Custom RGB Stoke Color"
@@ -415,7 +434,8 @@ const SparklineInteractiveScreen = () => {
415
434
  }), /*#__PURE__*/_jsx(Example, {
416
435
  padding: 0,
417
436
  children: /*#__PURE__*/_jsxs(Box, {
418
- children: [/*#__PURE__*/_jsx(TextTitle3, {
437
+ children: [/*#__PURE__*/_jsx(Text, {
438
+ font: "title3",
419
439
  paddingX: 3,
420
440
  paddingY: 3,
421
441
  children: "Custom RGBA Stoke Color"
@@ -427,7 +447,8 @@ const SparklineInteractiveScreen = () => {
427
447
  }), /*#__PURE__*/_jsx(Example, {
428
448
  padding: 0,
429
449
  children: /*#__PURE__*/_jsxs(Box, {
430
- children: [/*#__PURE__*/_jsx(TextTitle3, {
450
+ children: [/*#__PURE__*/_jsx(Text, {
451
+ font: "title3",
431
452
  paddingX: 3,
432
453
  paddingY: 3,
433
454
  children: "No Data In SelectedPeriod"
@@ -441,7 +462,8 @@ const SparklineInteractiveScreen = () => {
441
462
  }), /*#__PURE__*/_jsx(Example, {
442
463
  padding: 0,
443
464
  children: /*#__PURE__*/_jsxs(Box, {
444
- children: [/*#__PURE__*/_jsx(TextTitle3, {
465
+ children: [/*#__PURE__*/_jsx(Text, {
466
+ font: "title3",
445
467
  paddingX: 3,
446
468
  paddingY: 3,
447
469
  children: "Enable Interaction When Outside"
@@ -454,7 +476,8 @@ const SparklineInteractiveScreen = () => {
454
476
  }), /*#__PURE__*/_jsx(Example, {
455
477
  padding: 0,
456
478
  children: /*#__PURE__*/_jsxs(Box, {
457
- children: [/*#__PURE__*/_jsx(TextTitle3, {
479
+ children: [/*#__PURE__*/_jsx(Text, {
480
+ font: "title3",
458
481
  paddingX: 3,
459
482
  paddingY: 3,
460
483
  children: "Custom Node Header Styles"
@@ -471,7 +494,8 @@ const SparklineInteractiveScreen = () => {
471
494
  }), /*#__PURE__*/_jsx(Example, {
472
495
  padding: 0,
473
496
  children: /*#__PURE__*/_jsxs(Box, {
474
- children: [/*#__PURE__*/_jsx(TextTitle3, {
497
+ children: [/*#__PURE__*/_jsx(Text, {
498
+ font: "title3",
475
499
  paddingX: 3,
476
500
  paddingY: 3,
477
501
  children: "Dotted Fill Type"
@@ -484,7 +508,8 @@ const SparklineInteractiveScreen = () => {
484
508
  }), /*#__PURE__*/_jsx(Example, {
485
509
  padding: 0,
486
510
  children: /*#__PURE__*/_jsxs(Box, {
487
- children: [/*#__PURE__*/_jsx(TextTitle3, {
511
+ children: [/*#__PURE__*/_jsx(Text, {
512
+ font: "title3",
488
513
  paddingX: 3,
489
514
  paddingY: 3,
490
515
  children: "Y Scale Custom"
@@ -5,7 +5,7 @@ import { SparklineInteractive } from '../../sparkline-interactive/SparklineInter
5
5
  import { SparklineInteractiveHeader } from '../SparklineInteractiveHeader';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  figma.connect(SparklineInteractiveHeader, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/✨-CDS-Components?node-id=320-14931&m=dev', {
8
- imports: ["import { SparklineInteractiveHeader } from '@coinbase/cds-web-visualization';", "import { SparklineInteractive } from '@coinbase/cds-web-visualization';"],
8
+ imports: ["import { SparklineInteractiveHeader } from '@coinbase/cds-mobile-visualization'", "import { SparklineInteractive } from '@coinbase/cds-mobile-visualization'"],
9
9
  props: {
10
10
  compact: figma.boolean('compact'),
11
11
  disableScrubbing: figma.boolean('scrubbing', {