@coinbase/cds-mobile-visualization 3.4.0-beta.2 → 3.4.0-beta.20

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 (211) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dts/chart/CartesianChart.d.ts +92 -34
  3. package/dts/chart/CartesianChart.d.ts.map +1 -1
  4. package/dts/chart/ChartContextBridge.d.ts +28 -0
  5. package/dts/chart/ChartContextBridge.d.ts.map +1 -0
  6. package/dts/chart/ChartProvider.d.ts +3 -0
  7. package/dts/chart/ChartProvider.d.ts.map +1 -1
  8. package/dts/chart/Path.d.ts +97 -32
  9. package/dts/chart/Path.d.ts.map +1 -1
  10. package/dts/chart/PeriodSelector.d.ts +6 -13
  11. package/dts/chart/PeriodSelector.d.ts.map +1 -1
  12. package/dts/chart/area/Area.d.ts +39 -28
  13. package/dts/chart/area/Area.d.ts.map +1 -1
  14. package/dts/chart/area/AreaChart.d.ts +51 -10
  15. package/dts/chart/area/AreaChart.d.ts.map +1 -1
  16. package/dts/chart/area/DottedArea.d.ts +21 -2
  17. package/dts/chart/area/DottedArea.d.ts.map +1 -1
  18. package/dts/chart/area/GradientArea.d.ts +19 -13
  19. package/dts/chart/area/GradientArea.d.ts.map +1 -1
  20. package/dts/chart/area/SolidArea.d.ts +17 -2
  21. package/dts/chart/area/SolidArea.d.ts.map +1 -1
  22. package/dts/chart/axis/Axis.d.ts +86 -118
  23. package/dts/chart/axis/Axis.d.ts.map +1 -1
  24. package/dts/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
  25. package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
  26. package/dts/chart/axis/XAxis.d.ts +1 -1
  27. package/dts/chart/axis/XAxis.d.ts.map +1 -1
  28. package/dts/chart/axis/YAxis.d.ts +2 -2
  29. package/dts/chart/axis/YAxis.d.ts.map +1 -1
  30. package/dts/chart/axis/index.d.ts +1 -0
  31. package/dts/chart/axis/index.d.ts.map +1 -1
  32. package/dts/chart/bar/Bar.d.ts +49 -12
  33. package/dts/chart/bar/Bar.d.ts.map +1 -1
  34. package/dts/chart/bar/BarChart.d.ts +40 -19
  35. package/dts/chart/bar/BarChart.d.ts.map +1 -1
  36. package/dts/chart/bar/BarPlot.d.ts +3 -1
  37. package/dts/chart/bar/BarPlot.d.ts.map +1 -1
  38. package/dts/chart/bar/BarStack.d.ts +41 -46
  39. package/dts/chart/bar/BarStack.d.ts.map +1 -1
  40. package/dts/chart/bar/BarStackGroup.d.ts +2 -0
  41. package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
  42. package/dts/chart/bar/DefaultBar.d.ts +1 -1
  43. package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
  44. package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
  45. package/dts/chart/gradient/Gradient.d.ts +25 -0
  46. package/dts/chart/gradient/Gradient.d.ts.map +1 -0
  47. package/dts/chart/gradient/index.d.ts +2 -0
  48. package/dts/chart/gradient/index.d.ts.map +1 -0
  49. package/dts/chart/index.d.ts +4 -1
  50. package/dts/chart/index.d.ts.map +1 -1
  51. package/dts/chart/legend/DefaultLegendEntry.d.ts +5 -0
  52. package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
  53. package/dts/chart/legend/DefaultLegendShape.d.ts +5 -0
  54. package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
  55. package/dts/chart/legend/Legend.d.ts +168 -0
  56. package/dts/chart/legend/Legend.d.ts.map +1 -0
  57. package/dts/chart/legend/index.d.ts +4 -0
  58. package/dts/chart/legend/index.d.ts.map +1 -0
  59. package/dts/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
  60. package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
  61. package/dts/chart/line/DottedLine.d.ts +13 -5
  62. package/dts/chart/line/DottedLine.d.ts.map +1 -1
  63. package/dts/chart/line/Line.d.ts +61 -27
  64. package/dts/chart/line/Line.d.ts.map +1 -1
  65. package/dts/chart/line/LineChart.d.ts +43 -9
  66. package/dts/chart/line/LineChart.d.ts.map +1 -1
  67. package/dts/chart/line/ReferenceLine.d.ts +68 -20
  68. package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
  69. package/dts/chart/line/SolidLine.d.ts +8 -5
  70. package/dts/chart/line/SolidLine.d.ts.map +1 -1
  71. package/dts/chart/line/index.d.ts +1 -1
  72. package/dts/chart/line/index.d.ts.map +1 -1
  73. package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
  74. package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
  75. package/dts/chart/point/Point.d.ts +136 -0
  76. package/dts/chart/point/Point.d.ts.map +1 -0
  77. package/dts/chart/point/index.d.ts +3 -0
  78. package/dts/chart/point/index.d.ts.map +1 -0
  79. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +38 -0
  80. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
  81. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
  82. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
  83. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +11 -0
  84. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
  85. package/dts/chart/scrubber/Scrubber.d.ts +230 -42
  86. package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
  87. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +54 -0
  88. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
  89. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +46 -0
  90. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
  91. package/dts/chart/scrubber/ScrubberProvider.d.ts +6 -3
  92. package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
  93. package/dts/chart/scrubber/index.d.ts +3 -0
  94. package/dts/chart/scrubber/index.d.ts.map +1 -1
  95. package/dts/chart/text/ChartText.d.ts +151 -77
  96. package/dts/chart/text/ChartText.d.ts.map +1 -1
  97. package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
  98. package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
  99. package/dts/chart/text/index.d.ts +1 -1
  100. package/dts/chart/text/index.d.ts.map +1 -1
  101. package/dts/chart/utils/axis.d.ts +25 -1
  102. package/dts/chart/utils/axis.d.ts.map +1 -1
  103. package/dts/chart/utils/bar.d.ts +34 -0
  104. package/dts/chart/utils/bar.d.ts.map +1 -1
  105. package/dts/chart/utils/chart.d.ts +52 -7
  106. package/dts/chart/utils/chart.d.ts.map +1 -1
  107. package/dts/chart/utils/context.d.ts +28 -7
  108. package/dts/chart/utils/context.d.ts.map +1 -1
  109. package/dts/chart/utils/gradient.d.ts +117 -0
  110. package/dts/chart/utils/gradient.d.ts.map +1 -0
  111. package/dts/chart/utils/index.d.ts +3 -0
  112. package/dts/chart/utils/index.d.ts.map +1 -1
  113. package/dts/chart/utils/path.d.ts +59 -0
  114. package/dts/chart/utils/path.d.ts.map +1 -1
  115. package/dts/chart/utils/point.d.ts +71 -7
  116. package/dts/chart/utils/point.d.ts.map +1 -1
  117. package/dts/chart/utils/scale.d.ts +102 -0
  118. package/dts/chart/utils/scale.d.ts.map +1 -1
  119. package/dts/chart/utils/scrubber.d.ts +40 -0
  120. package/dts/chart/utils/scrubber.d.ts.map +1 -0
  121. package/dts/chart/utils/transition.d.ts +178 -0
  122. package/dts/chart/utils/transition.d.ts.map +1 -0
  123. package/esm/chart/CartesianChart.js +199 -75
  124. package/esm/chart/ChartContextBridge.js +159 -0
  125. package/esm/chart/ChartProvider.js +2 -2
  126. package/esm/chart/Path.js +200 -114
  127. package/esm/chart/PeriodSelector.js +7 -3
  128. package/esm/chart/__stories__/CartesianChart.stories.js +307 -134
  129. package/esm/chart/__stories__/ChartTransitions.stories.js +629 -0
  130. package/esm/chart/__stories__/PeriodSelector.stories.js +201 -75
  131. package/esm/chart/area/Area.js +27 -35
  132. package/esm/chart/area/AreaChart.js +17 -12
  133. package/esm/chart/area/DottedArea.js +64 -108
  134. package/esm/chart/area/GradientArea.js +37 -91
  135. package/esm/chart/area/SolidArea.js +24 -8
  136. package/esm/chart/area/__stories__/AreaChart.stories.js +1 -1
  137. package/esm/chart/axis/Axis.js +5 -39
  138. package/esm/chart/axis/DefaultAxisTickLabel.js +11 -0
  139. package/esm/chart/axis/XAxis.js +148 -66
  140. package/esm/chart/axis/YAxis.js +149 -65
  141. package/esm/chart/axis/__stories__/Axis.stories.js +259 -1
  142. package/esm/chart/axis/index.js +1 -0
  143. package/esm/chart/bar/Bar.js +7 -1
  144. package/esm/chart/bar/BarChart.js +17 -37
  145. package/esm/chart/bar/BarPlot.js +43 -35
  146. package/esm/chart/bar/BarStack.js +84 -37
  147. package/esm/chart/bar/BarStackGroup.js +7 -17
  148. package/esm/chart/bar/DefaultBar.js +29 -51
  149. package/esm/chart/bar/DefaultBarStack.js +34 -58
  150. package/esm/chart/bar/__stories__/BarChart.stories.js +948 -88
  151. package/esm/chart/gradient/Gradient.js +53 -0
  152. package/esm/chart/gradient/index.js +1 -0
  153. package/esm/chart/index.js +4 -1
  154. package/esm/chart/legend/DefaultLegendEntry.js +42 -0
  155. package/esm/chart/legend/DefaultLegendShape.js +64 -0
  156. package/esm/chart/legend/Legend.js +59 -0
  157. package/esm/chart/legend/__stories__/Legend.stories.js +574 -0
  158. package/esm/chart/legend/index.js +3 -0
  159. package/esm/chart/line/DefaultReferenceLineLabel.js +66 -0
  160. package/esm/chart/line/DottedLine.js +31 -14
  161. package/esm/chart/line/Line.js +96 -68
  162. package/esm/chart/line/LineChart.js +21 -14
  163. package/esm/chart/line/ReferenceLine.js +80 -63
  164. package/esm/chart/line/SolidLine.js +27 -10
  165. package/esm/chart/line/__stories__/LineChart.stories.js +1748 -2048
  166. package/esm/chart/line/__stories__/ReferenceLine.stories.js +177 -28
  167. package/esm/chart/line/index.js +1 -1
  168. package/esm/chart/point/DefaultPointLabel.js +39 -0
  169. package/esm/chart/point/Point.js +186 -0
  170. package/esm/chart/point/index.js +2 -0
  171. package/esm/chart/scrubber/DefaultScrubberBeacon.js +180 -0
  172. package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +43 -0
  173. package/esm/chart/scrubber/DefaultScrubberLabel.js +28 -0
  174. package/esm/chart/scrubber/Scrubber.js +130 -144
  175. package/esm/chart/scrubber/ScrubberBeaconGroup.js +165 -0
  176. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +208 -0
  177. package/esm/chart/scrubber/ScrubberProvider.js +46 -54
  178. package/esm/chart/scrubber/__stories__/Scrubber.stories.js +760 -0
  179. package/esm/chart/scrubber/index.js +3 -1
  180. package/esm/chart/text/ChartText.js +242 -174
  181. package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +6 -5
  182. package/esm/chart/text/index.js +1 -1
  183. package/esm/chart/utils/axis.js +47 -31
  184. package/esm/chart/utils/bar.js +43 -0
  185. package/esm/chart/utils/chart.js +57 -3
  186. package/esm/chart/utils/gradient.js +305 -0
  187. package/esm/chart/utils/index.js +3 -0
  188. package/esm/chart/utils/path.js +84 -8
  189. package/esm/chart/utils/point.js +171 -17
  190. package/esm/chart/utils/scale.js +242 -2
  191. package/esm/chart/utils/scrubber.js +146 -0
  192. package/esm/chart/utils/transition.js +220 -0
  193. package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
  194. package/esm/sparkline/__stories__/Sparkline.stories.js +11 -7
  195. package/esm/sparkline/__stories__/SparklineGradient.stories.js +7 -4
  196. package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
  197. package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +51 -26
  198. package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
  199. package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +17 -9
  200. package/package.json +15 -10
  201. package/dts/chart/Point.d.ts +0 -103
  202. package/dts/chart/Point.d.ts.map +0 -1
  203. package/dts/chart/line/GradientLine.d.ts +0 -45
  204. package/dts/chart/line/GradientLine.d.ts.map +0 -1
  205. package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -75
  206. package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
  207. package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
  208. package/esm/chart/Point.js +0 -111
  209. package/esm/chart/__stories__/Chart.stories.js +0 -79
  210. package/esm/chart/line/GradientLine.js +0 -62
  211. package/esm/chart/scrubber/ScrubberBeacon.js +0 -199
@@ -0,0 +1,220 @@
1
+ const _excluded = ["delay"];
2
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
3
+ import { useEffect, useMemo, useRef } from 'react';
4
+ import { useAnimatedReaction, useSharedValue, withDelay, withSpring, withTiming } from 'react-native-reanimated';
5
+ import { notifyChange, Skia } from '@shopify/react-native-skia';
6
+ import { interpolatePath } from 'd3-interpolate-path';
7
+
8
+ /**
9
+ * Transition for animations.
10
+ * Supports timing and spring animation types.
11
+ * Used for paths, positions, opacity, and any other animated properties.
12
+ *
13
+ * @example
14
+ * // Spring animation
15
+ * { type: 'spring', damping: 10, stiffness: 100 }
16
+ *
17
+ * @example
18
+ * // Timing animation
19
+ * { type: 'timing', duration: 500, easing: Easing.inOut(Easing.ease) }
20
+ */
21
+
22
+ /**
23
+ * Default update transition used across all chart components.
24
+ * `{ type: 'spring', stiffness: 900, damping: 120 }`
25
+ */
26
+ export const defaultTransition = {
27
+ type: 'spring',
28
+ stiffness: 900,
29
+ damping: 120
30
+ };
31
+
32
+ /**
33
+ * Instant transition that completes immediately with no animation.
34
+ * Used when a transition is set to `null`.
35
+ */
36
+ export const instantTransition = {
37
+ type: 'timing',
38
+ duration: 0
39
+ };
40
+
41
+ /**
42
+ * Duration in milliseconds for accessory elements to fade in.
43
+ */
44
+ export const accessoryFadeTransitionDuration = 150;
45
+
46
+ /**
47
+ * Delay in milliseconds before accessory elements fade in.
48
+ */
49
+ export const accessoryFadeTransitionDelay = 350;
50
+
51
+ /**
52
+ * Default enter transition for accessory elements (Point, Scrubber beacons).
53
+ * `{ type: 'timing', duration: 150, delay: 350 }`
54
+ */
55
+ export const defaultAccessoryEnterTransition = {
56
+ type: 'timing',
57
+ duration: accessoryFadeTransitionDuration,
58
+ delay: accessoryFadeTransitionDelay
59
+ };
60
+
61
+ /**
62
+ * Resolves a transition value based on the animation state and a default.
63
+ * @note Passing in null will disable an animation.
64
+ * @note Passing in undefined will use the provided default.
65
+ */
66
+ export const getTransition = (value, animate, defaultValue) => {
67
+ if (!animate || value === null) return instantTransition;
68
+ return value != null ? value : defaultValue;
69
+ };
70
+
71
+ // Interpolator and useInterpolator are brought over from non exported code in @shopify/react-native-skia
72
+ /**
73
+ * @worklet
74
+ */
75
+
76
+ export const useInterpolator = (factory, value, interpolator, input, output, options) => {
77
+ // eslint-disable-next-line react-hooks/exhaustive-deps
78
+ const init = useMemo(() => factory(), []);
79
+ const result = useSharedValue(init);
80
+ useAnimatedReaction(() => value.value, val => {
81
+ result.value = interpolator(val, input, output, options, result.value);
82
+ notifyChange(result);
83
+ }, [input, output, options]);
84
+ return result;
85
+ };
86
+
87
+ /**
88
+ * Builds a react-native-reanimated animation based on the configuration.
89
+ *
90
+ * @param targetValue - The target value to animate to
91
+ * @param config - The transition configuration
92
+ * @returns The animation value to assign to a shared value
93
+ *
94
+ * @example
95
+ * // Use directly for animation
96
+ * progress.value = 0;
97
+ * progress.value = buildTransition(1, { type: 'spring', damping: 10, stiffness: 100 });
98
+ *
99
+ * @example
100
+ * // Coordinate animations
101
+ * animatedX.value = buildTransition(100, { type: 'spring', damping: 10, stiffness: 100 });
102
+ * animatedY.value = buildTransition(200, { type: 'spring', damping: 10, stiffness: 100 });
103
+ *
104
+ * @example
105
+ * // Timing animation
106
+ * progress.value = buildTransition(1, { type: 'timing', duration: 500 });
107
+ */
108
+ export const buildTransition = (targetValue, transition) => {
109
+ 'worklet';
110
+
111
+ const {
112
+ delay: delayMs
113
+ } = transition,
114
+ config = _objectWithoutPropertiesLoose(transition, _excluded);
115
+ let animation;
116
+ switch (config.type) {
117
+ case 'timing':
118
+ {
119
+ animation = withTiming(targetValue, config);
120
+ break;
121
+ }
122
+ case 'spring':
123
+ {
124
+ animation = withSpring(targetValue, config);
125
+ break;
126
+ }
127
+ default:
128
+ {
129
+ animation = withSpring(targetValue, defaultTransition);
130
+ break;
131
+ }
132
+ }
133
+ if (delayMs && delayMs > 0) {
134
+ return withDelay(delayMs, animation);
135
+ }
136
+ return animation;
137
+ };
138
+
139
+ /**
140
+ * Hook for path animation state and transitions.
141
+ *
142
+ * @param currentPath - Current target path to animate to
143
+ * @param initialPath - Initial path for enter animation. When provided, the first animation will go from initialPath to currentPath.
144
+ * @param transitions - Transition configuration for enter and update animations
145
+ * @returns Animated SkPath as a shared value
146
+ *
147
+ * @example
148
+ * // Simple path transition
149
+ * const path = usePathTransition({
150
+ * currentPath: d ?? '',
151
+ * transitions: {
152
+ * update: { type: 'timing', duration: 3000 },
153
+ * },
154
+ * });
155
+ *
156
+ * @example
157
+ * // Enter animation with different initial config (like DefaultBar)
158
+ * const path = usePathTransition({
159
+ * currentPath: targetPath,
160
+ * initialPath: baselinePath,
161
+ * transitions: {
162
+ * enter: { type: 'tween', duration: 500 },
163
+ * update: { type: 'spring', stiffness: 900, damping: 120 },
164
+ * },
165
+ * });
166
+ */
167
+ export const usePathTransition = _ref => {
168
+ var _transitions$update, _Skia$Path$MakeFromSV;
169
+ let {
170
+ currentPath,
171
+ initialPath,
172
+ transitions,
173
+ transition = defaultTransition
174
+ } = _ref;
175
+ const updateTransition = (_transitions$update = transitions == null ? void 0 : transitions.update) != null ? _transitions$update : transition;
176
+ const enterTransition = transitions == null ? void 0 : transitions.enter;
177
+ const targetPathRef = useRef(initialPath != null ? initialPath : currentPath);
178
+ const isFirstAnimation = useRef(!!initialPath);
179
+ const interpolatorRef = useRef(null);
180
+ const progress = useSharedValue(0);
181
+ const initialSkiaPath = (_Skia$Path$MakeFromSV = Skia.Path.MakeFromSVGString(initialPath != null ? initialPath : currentPath)) != null ? _Skia$Path$MakeFromSV : Skia.Path.Make();
182
+ const normalizedStartShared = useSharedValue(initialSkiaPath);
183
+ const normalizedEndShared = useSharedValue(initialSkiaPath);
184
+ const fallbackPathShared = useSharedValue(initialSkiaPath);
185
+ const result = useSharedValue(initialSkiaPath);
186
+ useEffect(() => {
187
+ if (targetPathRef.current !== currentPath) {
188
+ var _Skia$Path$MakeFromSV2, _Skia$Path$MakeFromSV3, _Skia$Path$MakeFromSV4;
189
+ let fromPath = targetPathRef.current;
190
+ if (interpolatorRef.current) {
191
+ const p = Math.min(Math.max(progress.value, 0), 1);
192
+ fromPath = interpolatorRef.current(p);
193
+ }
194
+ targetPathRef.current = currentPath;
195
+ const pathInterpolator = interpolatePath(fromPath, currentPath);
196
+ interpolatorRef.current = pathInterpolator;
197
+ normalizedStartShared.value = (_Skia$Path$MakeFromSV2 = Skia.Path.MakeFromSVGString(pathInterpolator(0))) != null ? _Skia$Path$MakeFromSV2 : Skia.Path.Make();
198
+ normalizedEndShared.value = (_Skia$Path$MakeFromSV3 = Skia.Path.MakeFromSVGString(pathInterpolator(1))) != null ? _Skia$Path$MakeFromSV3 : Skia.Path.Make();
199
+ fallbackPathShared.value = (_Skia$Path$MakeFromSV4 = Skia.Path.MakeFromSVGString(currentPath)) != null ? _Skia$Path$MakeFromSV4 : Skia.Path.Make();
200
+ const activeTransition = isFirstAnimation.current && enterTransition !== undefined ? enterTransition : updateTransition;
201
+ isFirstAnimation.current = false;
202
+ progress.value = 0;
203
+ progress.value = buildTransition(1, activeTransition);
204
+ }
205
+ }, [currentPath, updateTransition, enterTransition, progress, normalizedStartShared, normalizedEndShared, fallbackPathShared]);
206
+ useAnimatedReaction(() => ({
207
+ p: progress.value,
208
+ to: fallbackPathShared.value
209
+ }), _ref2 => {
210
+ 'worklet';
211
+
212
+ var _normalizedEndShared$;
213
+ let {
214
+ p
215
+ } = _ref2;
216
+ result.value = (_normalizedEndShared$ = normalizedEndShared.value.interpolate(normalizedStartShared.value, p)) != null ? _normalizedEndShared$ : fallbackPathShared.value;
217
+ notifyChange(result);
218
+ }, []);
219
+ return result;
220
+ };
@@ -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, {
@@ -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', {