@coinbase/cds-mobile-visualization 3.4.0-beta.9 → 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 (167) hide show
  1. package/CHANGELOG.md +132 -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 +20 -5
  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 +5 -1
  104. package/esm/chart/__stories__/CartesianChart.stories.js +16 -80
  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 +99 -1
  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 +236 -590
  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/sparkline-interactive/SparklineInteractive.js +2 -1
  163. package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
  164. package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
  165. package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +2 -0
  166. package/package.json +5 -6
  167. 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({
@@ -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', {
@@ -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', {
@@ -453,11 +453,13 @@ const SparklineInteractiveHeaderScreen = () => {
453
453
  gap: 1,
454
454
  children: [/*#__PURE__*/_jsx(IconButton, {
455
455
  active: true,
456
+ accessibilityLabel: "Star",
456
457
  feedback: "heavy",
457
458
  name: "star",
458
459
  onPress: handlePress,
459
460
  variant: "secondary"
460
461
  }), /*#__PURE__*/_jsx(IconButton, {
462
+ accessibilityLabel: "Share",
461
463
  feedback: "heavy",
462
464
  name: "share",
463
465
  onPress: handlePress,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-mobile-visualization",
3
- "version": "3.4.0-beta.9",
3
+ "version": "3.4.0",
4
4
  "description": "Coinbase Design System - Mobile Visualization Native",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,9 +36,9 @@
36
36
  "CHANGELOG"
37
37
  ],
38
38
  "peerDependencies": {
39
- "@coinbase/cds-common": "^8.32.3",
39
+ "@coinbase/cds-common": "^8.62.1",
40
40
  "@coinbase/cds-lottie-files": "^3.3.4",
41
- "@coinbase/cds-mobile": "^8.32.3",
41
+ "@coinbase/cds-mobile": "^8.62.1",
42
42
  "@coinbase/cds-utils": "^2.3.5",
43
43
  "@shopify/react-native-skia": "^1.12.4 || ^2.0.0",
44
44
  "react": "^18.3.1",
@@ -57,11 +57,10 @@
57
57
  "@babel/preset-env": "^7.28.0",
58
58
  "@babel/preset-react": "^7.27.1",
59
59
  "@babel/preset-typescript": "^7.27.1",
60
- "@coinbase/cds-common": "^8.32.3",
60
+ "@coinbase/cds-common": "^8.62.1",
61
61
  "@coinbase/cds-lottie-files": "^3.3.4",
62
- "@coinbase/cds-mobile": "^8.32.3",
62
+ "@coinbase/cds-mobile": "^8.62.1",
63
63
  "@coinbase/cds-utils": "^2.3.5",
64
- "@figma/code-connect": "^1.3.4",
65
64
  "@shopify/react-native-skia": "1.12.4",
66
65
  "@types/react": "^18.3.12",
67
66
  "react-native-gesture-handler": "2.16.2",
@@ -1,77 +0,0 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
3
- import { CartesianChart, DottedArea, Line, LineChart, SolidLine } from '../';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- const defaultChartHeight = 250;
6
- const BasicLineChart = () => {
7
- const chartData = [65, 78, 45, 88, 92, 73, 69];
8
- return /*#__PURE__*/_jsx(LineChart, {
9
- showYAxis: true,
10
- height: defaultChartHeight,
11
- series: [{
12
- id: 'monthly-growth',
13
- data: chartData,
14
- label: 'Monthly Growth',
15
- color: '#2ca02c'
16
- }],
17
- yAxis: {
18
- requestedTickCount: 2,
19
- tickLabelFormatter: value => "$" + value,
20
- showGrid: true
21
- }
22
- });
23
- };
24
- const LineStyles = () => {
25
- const topChartData = [15, 28, 32, 44, 46, 36, 40, 45, 48, 38];
26
- const upperMiddleChartData = [12, 23, 21, 29, 34, 28, 31, 38, 42, 35];
27
- const lowerMiddleChartData = [8, 15, 14, 25, 20, 18, 22, 28, 24, 30];
28
- const bottomChartData = [4, 8, 11, 15, 16, 14, 16, 10, 12, 14];
29
- return /*#__PURE__*/_jsxs(CartesianChart, {
30
- height: defaultChartHeight,
31
- series: [{
32
- id: 'top',
33
- data: topChartData
34
- }, {
35
- id: 'upperMiddle',
36
- data: upperMiddleChartData,
37
- color: '#ef4444'
38
- }, {
39
- id: 'lowerMiddle',
40
- data: lowerMiddleChartData,
41
- color: '#f59e0b'
42
- }, {
43
- id: 'bottom',
44
- data: bottomChartData,
45
- color: '#800080'
46
- }],
47
- children: [/*#__PURE__*/_jsx(Line, {
48
- seriesId: "top"
49
- }), /*#__PURE__*/_jsx(Line, {
50
- seriesId: "upperMiddle",
51
- type: "dotted"
52
- }), /*#__PURE__*/_jsx(Line, {
53
- LineComponent: props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
54
- strokeWidth: 4
55
- })),
56
- curve: "natural",
57
- seriesId: "lowerMiddle"
58
- }), /*#__PURE__*/_jsx(Line, {
59
- showArea: true,
60
- AreaComponent: DottedArea,
61
- curve: "step",
62
- seriesId: "bottom"
63
- })]
64
- });
65
- };
66
- const ChartStories = () => {
67
- return /*#__PURE__*/_jsxs(ExampleScreen, {
68
- children: [/*#__PURE__*/_jsx(Example, {
69
- title: "Basic Line Chart",
70
- children: /*#__PURE__*/_jsx(BasicLineChart, {})
71
- }), /*#__PURE__*/_jsx(Example, {
72
- title: "Line Styles",
73
- children: /*#__PURE__*/_jsx(LineStyles, {})
74
- })]
75
- });
76
- };
77
- export default ChartStories;