@coinbase/cds-mobile-visualization 3.4.0-beta.1 → 3.4.0-beta.11

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 (187) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/dts/chart/CartesianChart.d.ts +57 -33
  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/Path.d.ts +77 -34
  7. package/dts/chart/Path.d.ts.map +1 -1
  8. package/dts/chart/PeriodSelector.d.ts +2 -2
  9. package/dts/chart/PeriodSelector.d.ts.map +1 -1
  10. package/dts/chart/area/Area.d.ts +42 -27
  11. package/dts/chart/area/Area.d.ts.map +1 -1
  12. package/dts/chart/area/AreaChart.d.ts +51 -10
  13. package/dts/chart/area/AreaChart.d.ts.map +1 -1
  14. package/dts/chart/area/DottedArea.d.ts +21 -2
  15. package/dts/chart/area/DottedArea.d.ts.map +1 -1
  16. package/dts/chart/area/GradientArea.d.ts +19 -13
  17. package/dts/chart/area/GradientArea.d.ts.map +1 -1
  18. package/dts/chart/area/SolidArea.d.ts +17 -2
  19. package/dts/chart/area/SolidArea.d.ts.map +1 -1
  20. package/dts/chart/axis/Axis.d.ts +86 -118
  21. package/dts/chart/axis/Axis.d.ts.map +1 -1
  22. package/dts/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
  23. package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
  24. package/dts/chart/axis/XAxis.d.ts +1 -1
  25. package/dts/chart/axis/XAxis.d.ts.map +1 -1
  26. package/dts/chart/axis/YAxis.d.ts +2 -2
  27. package/dts/chart/axis/YAxis.d.ts.map +1 -1
  28. package/dts/chart/axis/index.d.ts +1 -0
  29. package/dts/chart/axis/index.d.ts.map +1 -1
  30. package/dts/chart/bar/Bar.d.ts +16 -13
  31. package/dts/chart/bar/Bar.d.ts.map +1 -1
  32. package/dts/chart/bar/BarChart.d.ts +36 -20
  33. package/dts/chart/bar/BarChart.d.ts.map +1 -1
  34. package/dts/chart/bar/BarPlot.d.ts +2 -1
  35. package/dts/chart/bar/BarPlot.d.ts.map +1 -1
  36. package/dts/chart/bar/BarStack.d.ts +39 -48
  37. package/dts/chart/bar/BarStack.d.ts.map +1 -1
  38. package/dts/chart/bar/BarStackGroup.d.ts +1 -0
  39. package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
  40. package/dts/chart/bar/DefaultBar.d.ts +1 -1
  41. package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
  42. package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
  43. package/dts/chart/gradient/Gradient.d.ts +25 -0
  44. package/dts/chart/gradient/Gradient.d.ts.map +1 -0
  45. package/dts/chart/gradient/index.d.ts +2 -0
  46. package/dts/chart/gradient/index.d.ts.map +1 -0
  47. package/dts/chart/index.d.ts +3 -1
  48. package/dts/chart/index.d.ts.map +1 -1
  49. package/dts/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
  50. package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
  51. package/dts/chart/line/DottedLine.d.ts +13 -5
  52. package/dts/chart/line/DottedLine.d.ts.map +1 -1
  53. package/dts/chart/line/Line.d.ts +64 -25
  54. package/dts/chart/line/Line.d.ts.map +1 -1
  55. package/dts/chart/line/LineChart.d.ts +43 -9
  56. package/dts/chart/line/LineChart.d.ts.map +1 -1
  57. package/dts/chart/line/ReferenceLine.d.ts +68 -20
  58. package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
  59. package/dts/chart/line/SolidLine.d.ts +8 -5
  60. package/dts/chart/line/SolidLine.d.ts.map +1 -1
  61. package/dts/chart/line/index.d.ts +1 -1
  62. package/dts/chart/line/index.d.ts.map +1 -1
  63. package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
  64. package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
  65. package/dts/chart/point/Point.d.ts +120 -0
  66. package/dts/chart/point/Point.d.ts.map +1 -0
  67. package/dts/chart/point/index.d.ts +3 -0
  68. package/dts/chart/point/index.d.ts.map +1 -0
  69. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +8 -0
  70. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
  71. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
  72. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
  73. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +11 -0
  74. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
  75. package/dts/chart/scrubber/Scrubber.d.ts +172 -43
  76. package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
  77. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +44 -0
  78. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
  79. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +31 -0
  80. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
  81. package/dts/chart/scrubber/ScrubberProvider.d.ts +6 -3
  82. package/dts/chart/scrubber/ScrubberProvider.d.ts.map +1 -1
  83. package/dts/chart/scrubber/index.d.ts +3 -0
  84. package/dts/chart/scrubber/index.d.ts.map +1 -1
  85. package/dts/chart/text/ChartText.d.ts +151 -77
  86. package/dts/chart/text/ChartText.d.ts.map +1 -1
  87. package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
  88. package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
  89. package/dts/chart/text/index.d.ts +1 -1
  90. package/dts/chart/text/index.d.ts.map +1 -1
  91. package/dts/chart/utils/axis.d.ts +25 -1
  92. package/dts/chart/utils/axis.d.ts.map +1 -1
  93. package/dts/chart/utils/chart.d.ts +34 -7
  94. package/dts/chart/utils/chart.d.ts.map +1 -1
  95. package/dts/chart/utils/context.d.ts +28 -7
  96. package/dts/chart/utils/context.d.ts.map +1 -1
  97. package/dts/chart/utils/gradient.d.ts +117 -0
  98. package/dts/chart/utils/gradient.d.ts.map +1 -0
  99. package/dts/chart/utils/index.d.ts +3 -0
  100. package/dts/chart/utils/index.d.ts.map +1 -1
  101. package/dts/chart/utils/path.d.ts +53 -0
  102. package/dts/chart/utils/path.d.ts.map +1 -1
  103. package/dts/chart/utils/point.d.ts +71 -7
  104. package/dts/chart/utils/point.d.ts.map +1 -1
  105. package/dts/chart/utils/scale.d.ts +102 -0
  106. package/dts/chart/utils/scale.d.ts.map +1 -1
  107. package/dts/chart/utils/scrubber.d.ts +39 -0
  108. package/dts/chart/utils/scrubber.d.ts.map +1 -0
  109. package/dts/chart/utils/transition.d.ts +140 -0
  110. package/dts/chart/utils/transition.d.ts.map +1 -0
  111. package/esm/chart/CartesianChart.js +164 -70
  112. package/esm/chart/ChartContextBridge.js +148 -0
  113. package/esm/chart/Path.js +198 -113
  114. package/esm/chart/PeriodSelector.js +2 -2
  115. package/esm/chart/__stories__/CartesianChart.stories.js +378 -131
  116. package/esm/chart/__stories__/Chart.stories.js +2 -4
  117. package/esm/chart/__stories__/PeriodSelector.stories.js +103 -75
  118. package/esm/chart/area/Area.js +25 -35
  119. package/esm/chart/area/AreaChart.js +17 -12
  120. package/esm/chart/area/DottedArea.js +61 -109
  121. package/esm/chart/area/GradientArea.js +35 -91
  122. package/esm/chart/area/SolidArea.js +22 -8
  123. package/esm/chart/area/__stories__/AreaChart.stories.js +1 -1
  124. package/esm/chart/axis/Axis.js +5 -39
  125. package/esm/chart/axis/DefaultAxisTickLabel.js +11 -0
  126. package/esm/chart/axis/XAxis.js +148 -66
  127. package/esm/chart/axis/YAxis.js +149 -65
  128. package/esm/chart/axis/__stories__/Axis.stories.js +259 -1
  129. package/esm/chart/axis/index.js +1 -0
  130. package/esm/chart/bar/Bar.js +3 -1
  131. package/esm/chart/bar/BarChart.js +15 -37
  132. package/esm/chart/bar/BarPlot.js +41 -35
  133. package/esm/chart/bar/BarStack.js +75 -38
  134. package/esm/chart/bar/BarStackGroup.js +6 -16
  135. package/esm/chart/bar/DefaultBar.js +26 -48
  136. package/esm/chart/bar/DefaultBarStack.js +23 -58
  137. package/esm/chart/bar/__stories__/BarChart.stories.js +502 -77
  138. package/esm/chart/gradient/Gradient.js +53 -0
  139. package/esm/chart/gradient/index.js +1 -0
  140. package/esm/chart/index.js +3 -1
  141. package/esm/chart/line/DefaultReferenceLineLabel.js +66 -0
  142. package/esm/chart/line/DottedLine.js +29 -14
  143. package/esm/chart/line/Line.js +106 -67
  144. package/esm/chart/line/LineChart.js +20 -14
  145. package/esm/chart/line/ReferenceLine.js +80 -63
  146. package/esm/chart/line/SolidLine.js +25 -10
  147. package/esm/chart/line/__stories__/LineChart.stories.js +2101 -1977
  148. package/esm/chart/line/__stories__/ReferenceLine.stories.js +83 -28
  149. package/esm/chart/line/index.js +1 -1
  150. package/esm/chart/point/DefaultPointLabel.js +39 -0
  151. package/esm/chart/point/Point.js +188 -0
  152. package/esm/chart/point/index.js +2 -0
  153. package/esm/chart/scrubber/DefaultScrubberBeacon.js +179 -0
  154. package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +43 -0
  155. package/esm/chart/scrubber/DefaultScrubberLabel.js +28 -0
  156. package/esm/chart/scrubber/Scrubber.js +126 -146
  157. package/esm/chart/scrubber/ScrubberBeaconGroup.js +161 -0
  158. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +185 -0
  159. package/esm/chart/scrubber/ScrubberProvider.js +46 -54
  160. package/esm/chart/scrubber/index.js +3 -1
  161. package/esm/chart/text/ChartText.js +242 -174
  162. package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +6 -5
  163. package/esm/chart/text/index.js +1 -1
  164. package/esm/chart/utils/axis.js +45 -29
  165. package/esm/chart/utils/chart.js +44 -3
  166. package/esm/chart/utils/gradient.js +305 -0
  167. package/esm/chart/utils/index.js +3 -0
  168. package/esm/chart/utils/path.js +76 -8
  169. package/esm/chart/utils/point.js +171 -17
  170. package/esm/chart/utils/scale.js +242 -2
  171. package/esm/chart/utils/scrubber.js +139 -0
  172. package/esm/chart/utils/transition.js +185 -0
  173. package/esm/sparkline/__stories__/Sparkline.stories.js +11 -7
  174. package/esm/sparkline/__stories__/SparklineGradient.stories.js +7 -4
  175. package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +51 -26
  176. package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +17 -9
  177. package/package.json +15 -9
  178. package/dts/chart/Point.d.ts +0 -103
  179. package/dts/chart/Point.d.ts.map +0 -1
  180. package/dts/chart/line/GradientLine.d.ts +0 -45
  181. package/dts/chart/line/GradientLine.d.ts.map +0 -1
  182. package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -75
  183. package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
  184. package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
  185. package/esm/chart/Point.js +0 -111
  186. package/esm/chart/line/GradientLine.js +0 -62
  187. package/esm/chart/scrubber/ScrubberBeacon.js +0 -199
package/esm/chart/Path.js CHANGED
@@ -1,133 +1,218 @@
1
- const _excluded = ["clipRect", "clipOffset", "d", "fill", "stroke", "strokeWidth", "strokeOpacity", "fillOpacity", "strokeDasharray", "testID", "animate"];
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; }
1
+ const _excluded = ["d", "initialPath", "fill", "fillOpacity", "stroke", "strokeOpacity", "strokeWidth", "strokeCap", "strokeJoin", "children", "transition"],
2
+ _excluded2 = ["animate", "clipRect", "clipPath", "clipOffset", "d", "initialPath", "fill", "fillOpacity", "stroke", "strokeOpacity", "strokeWidth", "strokeCap", "strokeJoin", "children", "transition"];
3
3
  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); }
4
- import { memo, useCallback, useEffect, useId, useMemo, useRef } from 'react';
5
- import Reanimated, { runOnJS, useAnimatedProps, useAnimatedReaction, useSharedValue, withTiming } from 'react-native-reanimated';
6
- import { ClipPath, Defs, G, Path as SvgPath, Rect } from 'react-native-svg';
7
- import { usePreviousValue } from '@coinbase/cds-common/hooks/usePreviousValue';
8
- import * as interpolate from 'd3-interpolate-path';
4
+ 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; }
5
+ import { memo, useEffect, useMemo } from 'react';
6
+ import { useDerivedValue, useSharedValue, withTiming } from 'react-native-reanimated';
7
+ import { Group, Path as SkiaPath, Skia, usePathInterpolation } from '@shopify/react-native-skia';
8
+ import { usePathTransition } from './utils/transition';
9
9
  import { useCartesianChartContext } from './ChartProvider';
10
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
- const AnimatedRect = Reanimated.createAnimatedComponent(Rect);
12
- const AnimatedSvgRect = /*#__PURE__*/memo(_ref => {
10
+ import { unwrapAnimatedValue } from './utils';
11
+
12
+ /**
13
+ * Duration in milliseconds for path enter transition.
14
+ */
15
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
16
+ export const pathEnterTransitionDuration = 500;
17
+ const AnimatedPath = /*#__PURE__*/memo(_ref => {
13
18
  let {
14
- width,
15
- totalOffset,
16
- rectProps
17
- } = _ref;
18
- const animatedWidth = useSharedValue(width + totalOffset);
19
- const animatedProps = useAnimatedProps(() => {
20
- return {
21
- width: animatedWidth.value
22
- };
19
+ d = '',
20
+ initialPath,
21
+ fill,
22
+ fillOpacity,
23
+ stroke,
24
+ strokeOpacity,
25
+ strokeWidth,
26
+ strokeCap,
27
+ strokeJoin,
28
+ children,
29
+ transition
30
+ } = _ref,
31
+ pathProps = _objectWithoutPropertiesLoose(_ref, _excluded);
32
+ const isDAnimated = typeof d !== 'string';
33
+
34
+ // When d is animated, usePathTransition handles static path transitions.
35
+ // For animated d values, we skip usePathTransition and use useDerivedValue directly.
36
+ const animatedPath = usePathTransition({
37
+ currentPath: isDAnimated ? '' : d,
38
+ initialPath,
39
+ transition
40
+ });
41
+ const isFilled = fill !== undefined && fill !== 'none';
42
+ const isStroked = stroke !== undefined && stroke !== 'none';
43
+ const activePath = useDerivedValue(() => {
44
+ if (isDAnimated) {
45
+ var _d$value;
46
+ return (_d$value = d.value) != null ? _d$value : Skia.Path.Make();
47
+ }
48
+ return animatedPath.value;
49
+ });
50
+ return /*#__PURE__*/_jsxs(_Fragment, {
51
+ children: [isFilled && /*#__PURE__*/_jsx(SkiaPath, _extends({
52
+ color: fill,
53
+ opacity: fillOpacity,
54
+ path: activePath,
55
+ style: "fill"
56
+ }, pathProps, {
57
+ children: children
58
+ })), isStroked && /*#__PURE__*/_jsx(SkiaPath, _extends({
59
+ color: stroke,
60
+ opacity: strokeOpacity,
61
+ path: activePath,
62
+ strokeCap: strokeCap,
63
+ strokeJoin: strokeJoin,
64
+ strokeWidth: strokeWidth,
65
+ style: "stroke"
66
+ }, pathProps, {
67
+ children: children
68
+ }))]
23
69
  });
24
- useEffect(() => {
25
- animatedWidth.value = withTiming(width + totalOffset, {
26
- duration: 1000
27
- });
28
- }, [animatedWidth, width, totalOffset]);
29
- return /*#__PURE__*/_jsx(AnimatedRect, _extends({
30
- animatedProps: animatedProps
31
- }, rectProps));
32
70
  });
33
- export const Path = /*#__PURE__*/memo(_ref2 => {
34
- let {
71
+ export const Path = /*#__PURE__*/memo(props => {
72
+ const {
73
+ animate: animateProp,
35
74
  clipRect,
36
- clipOffset,
75
+ clipPath: clipPathProp,
76
+ clipOffset = 0,
37
77
  d = '',
78
+ initialPath,
38
79
  fill,
80
+ fillOpacity,
39
81
  stroke,
40
- strokeWidth,
41
82
  strokeOpacity,
42
- fillOpacity,
43
- strokeDasharray,
44
- testID,
45
- animate: animateProp
46
- } = _ref2,
47
- pathProps = _objectWithoutPropertiesLoose(_ref2, _excluded);
48
- const pathRef = useRef(null);
49
- const {
50
- animate: animateContext,
51
- drawingArea: contextRect
52
- } = useCartesianChartContext();
53
- const rect = clipRect != null ? clipRect : contextRect;
54
- const animate = animateProp != null ? animateProp : animateContext;
55
- const clipPathId = useId();
56
- const animationProgress = useSharedValue(0);
57
- const targetPath = useMemo(() => d, [d]);
58
- const previousPath = usePreviousValue(targetPath);
59
- const fromPath = useMemo(() => {
60
- if (!animate) return targetPath;
61
- return previousPath != null ? previousPath : targetPath;
62
- }, [animate, previousPath, targetPath]);
63
- const pathInterpolator = useMemo(() => interpolate.interpolatePath(fromPath, targetPath), [fromPath, targetPath]);
64
- const updatePath = useCallback(progress => {
65
- var _pathRef$current;
66
- if (!pathInterpolator) return;
67
- const val = Number(progress.toFixed(4));
68
- (_pathRef$current = pathRef.current) == null || _pathRef$current.setNativeProps({
69
- d: pathInterpolator(val)
70
- });
71
- }, [pathInterpolator]);
72
- useAnimatedReaction(() => animationProgress.value, progress => {
73
- 'worklet';
83
+ strokeWidth,
84
+ strokeCap,
85
+ strokeJoin,
86
+ children,
87
+ transition
88
+ } = props,
89
+ pathProps = _objectWithoutPropertiesLoose(props, _excluded2);
90
+ const context = useCartesianChartContext();
91
+ const rect = clipRect != null ? clipRect : context.drawingArea;
92
+ const animate = animateProp != null ? animateProp : context.animate;
93
+
94
+ // The clip offset provides extra padding to prevent path from being cut off
95
+ // Area charts typically use offset=0 for exact clipping, while lines use offset=2 for breathing room
96
+ const totalOffset = clipOffset * 2; // Applied on both sides
97
+
98
+ // Animation progress for clip path reveal
99
+ const clipProgress = useSharedValue(animate ? 0 : 1);
74
100
 
75
- runOnJS(updatePath)(progress);
76
- }, [updatePath]);
101
+ // Trigger clip path animation when component mounts and animate is true
77
102
  useEffect(() => {
78
- if (!pathRef.current) return;
79
- if (!animate || !pathInterpolator) {
80
- pathRef.current.setNativeProps({
81
- d: targetPath
103
+ if (animate) {
104
+ clipProgress.value = withTiming(1, {
105
+ duration: pathEnterTransitionDuration
82
106
  });
83
- animationProgress.value = 1;
84
- return;
85
107
  }
86
- animationProgress.value = 0;
87
- animationProgress.value = withTiming(1, {
88
- duration: 200
108
+ }, [animate, clipProgress]);
109
+
110
+ // Create initial and target clip paths for animation
111
+ const {
112
+ initialClipPath,
113
+ targetClipPath
114
+ } = useMemo(() => {
115
+ if (!rect) return {
116
+ initialClipPath: null,
117
+ targetClipPath: null
118
+ };
119
+
120
+ // Initial clip path (width = 0)
121
+ const initial = Skia.Path.Make();
122
+ initial.addRect({
123
+ x: rect.x - clipOffset,
124
+ y: rect.y - clipOffset,
125
+ width: 0,
126
+ height: rect.height + totalOffset
89
127
  });
90
- }, [animate, animationProgress, targetPath, pathInterpolator]);
91
- if (!d || !rect) return;
92
128
 
93
- // The clip offset provides extra padding to prevent path from being cut off
94
- // Area charts typically use offset=0 for exact clipping, while lines use offset=2 for breathing room
95
- const totalOffset = (clipOffset != null ? clipOffset : 0) * 2; // Applied on both sides
129
+ // Target clip path (full width)
130
+ const target = Skia.Path.Make();
131
+ target.addRect({
132
+ x: rect.x - clipOffset,
133
+ y: rect.y - clipOffset,
134
+ width: rect.width + totalOffset,
135
+ height: rect.height + totalOffset
136
+ });
137
+ return {
138
+ initialClipPath: initial,
139
+ targetClipPath: target
140
+ };
141
+ }, [rect, clipOffset, totalOffset]);
142
+
143
+ // Use usePathInterpolation for animated clip path
144
+ const animatedClipPath = usePathInterpolation(clipProgress, [0, 1], animate && initialClipPath && targetClipPath ? [initialClipPath, targetClipPath] : targetClipPath ? [targetClipPath, targetClipPath] : [Skia.Path.Make(), Skia.Path.Make()]);
145
+
146
+ // Resolve the final clip path:
147
+ // 1. If clipPath prop was explicitly provided, use it (even if null = no clipping)
148
+ // 2. If animating, use the interpolated clip path
149
+ // 3. Otherwise, use static target clip path
150
+ const resolvedClipPath = useMemo(() => {
151
+ // If clipPath was explicitly provided (null or string), use it directly
152
+ if (clipPathProp !== undefined) {
153
+ return clipPathProp;
154
+ }
96
155
 
97
- return /*#__PURE__*/_jsxs(G, {
98
- children: [/*#__PURE__*/_jsx(Defs, {
99
- children: animate ? /*#__PURE__*/_jsx(ClipPath, {
100
- id: clipPathId,
101
- children: /*#__PURE__*/_jsx(AnimatedSvgRect, {
102
- rectProps: {
103
- height: rect.height + totalOffset,
104
- x: rect.x - (clipOffset != null ? clipOffset : 0),
105
- y: rect.y - (clipOffset != null ? clipOffset : 0)
106
- },
107
- totalOffset: totalOffset,
108
- width: rect.width
109
- })
110
- }) : /*#__PURE__*/_jsx(ClipPath, {
111
- id: clipPathId,
112
- children: /*#__PURE__*/_jsx(Rect, {
113
- height: contextRect.height + totalOffset,
114
- width: contextRect.width + totalOffset,
115
- x: contextRect.x - (clipOffset != null ? clipOffset : 0),
116
- y: contextRect.y - (clipOffset != null ? clipOffset : 0)
117
- })
118
- })
119
- }), /*#__PURE__*/_jsx(SvgPath, _extends({
120
- ref: pathRef,
121
- clipPath: "url(#" + clipPathId + ")",
122
- clipRule: "nonzero",
123
- d: fromPath,
124
- fill: fill,
125
- fillOpacity: fillOpacity,
126
- stroke: stroke,
127
- strokeDasharray: strokeDasharray,
128
- strokeOpacity: strokeOpacity,
156
+ // If not animating or paths are null, return target clip path
157
+ if (!animate || !targetClipPath) {
158
+ return targetClipPath;
159
+ }
160
+
161
+ // Return undefined here since we'll use animatedClipPath directly
162
+ return undefined;
163
+ }, [clipPathProp, animate, targetClipPath]);
164
+
165
+ // Convert SVG path string to SkPath for static rendering
166
+ const staticPath = useDerivedValue(() => {
167
+ var _Skia$Path$MakeFromSV;
168
+ const dValue = unwrapAnimatedValue(d);
169
+ if (!dValue) return Skia.Path.Make();
170
+ return (_Skia$Path$MakeFromSV = Skia.Path.MakeFromSVGString(dValue)) != null ? _Skia$Path$MakeFromSV : Skia.Path.Make();
171
+ }, [d]);
172
+ const isFilled = fill !== undefined && fill !== 'none';
173
+ const isStroked = stroke !== undefined && stroke !== 'none';
174
+ const content = !animate ? /*#__PURE__*/_jsxs(_Fragment, {
175
+ children: [isFilled && /*#__PURE__*/_jsx(SkiaPath, _extends({
176
+ color: fill,
177
+ opacity: fillOpacity,
178
+ path: staticPath,
179
+ style: "fill"
180
+ }, pathProps, {
181
+ children: children
182
+ })), isStroked && /*#__PURE__*/_jsx(SkiaPath, _extends({
183
+ color: stroke,
184
+ opacity: strokeOpacity,
185
+ path: staticPath,
186
+ strokeCap: strokeCap,
187
+ strokeJoin: strokeJoin,
129
188
  strokeWidth: strokeWidth,
130
- testID: testID
131
- }, pathProps))]
189
+ style: "stroke"
190
+ }, pathProps, {
191
+ children: children
192
+ }))]
193
+ }) : /*#__PURE__*/_jsx(AnimatedPath, {
194
+ d: d,
195
+ fill: fill,
196
+ fillOpacity: fillOpacity,
197
+ initialPath: initialPath,
198
+ stroke: stroke,
199
+ strokeCap: strokeCap,
200
+ strokeJoin: strokeJoin,
201
+ strokeOpacity: strokeOpacity,
202
+ strokeWidth: strokeWidth,
203
+ transition: transition,
204
+ children: children
205
+ });
206
+
207
+ // Determine which clip path to use
208
+ const finalClipPath = animate && resolvedClipPath === undefined ? animatedClipPath : resolvedClipPath;
209
+
210
+ // If finalClipPath is null, render without clipping
211
+ if (finalClipPath === null) {
212
+ return content;
213
+ }
214
+ return /*#__PURE__*/_jsx(Group, {
215
+ clip: finalClipPath,
216
+ children: content
132
217
  });
133
218
  });
@@ -9,7 +9,7 @@ import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
9
9
  import { SegmentedTabs } from '@coinbase/cds-mobile/tabs';
10
10
  import { SegmentedTab } from '@coinbase/cds-mobile/tabs/SegmentedTab';
11
11
  import { tabsSpringConfig } from '@coinbase/cds-mobile/tabs/Tabs';
12
- import { Text } from '@coinbase/cds-mobile/typography/Text';
12
+ import { Text } from '@coinbase/cds-mobile/typography';
13
13
 
14
14
  // Animated active indicator to support smooth transition of background color
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -55,7 +55,7 @@ export const PeriodSelectorActiveIndicator = _ref => {
55
55
  width: animatedValues.value.width,
56
56
  backgroundColor: animatedValues.value.backgroundColor
57
57
  }), [animatedValues]);
58
- if (!width) return null;
58
+ if (!width) return;
59
59
  return /*#__PURE__*/_jsx(Animated.View, {
60
60
  style: [{
61
61
  position: position,