@ledgerhq/lumen-ui-rnative-visualization 0.1.17 → 0.1.19

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 (219) hide show
  1. package/dist/module/lib/Components/Axis/XAxis/XAxis.js +4 -3
  2. package/dist/module/lib/Components/Axis/XAxis/XAxis.js.map +1 -1
  3. package/dist/module/lib/Components/Axis/XAxis/XAxis.test.js +14 -0
  4. package/dist/module/lib/Components/Axis/XAxis/XAxis.test.js.map +1 -1
  5. package/dist/module/lib/Components/Axis/YAxis/YAxis.js +4 -3
  6. package/dist/module/lib/Components/Axis/YAxis/YAxis.js.map +1 -1
  7. package/dist/module/lib/Components/Axis/YAxis/YAxis.test.js +14 -0
  8. package/dist/module/lib/Components/Axis/YAxis/YAxis.test.js.map +1 -1
  9. package/dist/module/lib/Components/CartesianChart/CartesianChart.js +30 -23
  10. package/dist/module/lib/Components/CartesianChart/CartesianChart.js.map +1 -1
  11. package/dist/module/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js +61 -0
  12. package/dist/module/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js.map +1 -0
  13. package/dist/module/lib/Components/CartesianChart/ChartEmptyLabel/index.js +4 -0
  14. package/dist/module/lib/Components/CartesianChart/ChartEmptyLabel/index.js.map +1 -0
  15. package/dist/module/lib/Components/CartesianChart/{RevealClip/RevealClipDefs.js → RevealAnimation/RevealAnimationProvider.js} +13 -13
  16. package/dist/module/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.js.map +1 -0
  17. package/dist/module/lib/Components/CartesianChart/{RevealClip/RevealClipDefs.test.js → RevealAnimation/RevealAnimationProvider.test.js} +51 -12
  18. package/dist/module/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.test.js.map +1 -0
  19. package/dist/module/lib/Components/CartesianChart/RevealAnimation/context.js +35 -0
  20. package/dist/module/lib/Components/CartesianChart/RevealAnimation/context.js.map +1 -0
  21. package/dist/module/lib/Components/CartesianChart/RevealAnimation/index.js +5 -0
  22. package/dist/module/lib/Components/CartesianChart/RevealAnimation/index.js.map +1 -0
  23. package/dist/module/lib/Components/CartesianChart/RevealAnimation/types.js.map +1 -0
  24. package/dist/module/lib/Components/CartesianChart/RevealAnimation/utils.js +64 -0
  25. package/dist/module/lib/Components/CartesianChart/RevealAnimation/utils.js.map +1 -0
  26. package/dist/module/lib/Components/CartesianChart/hooks/useShimmerAnimation.js +37 -0
  27. package/dist/module/lib/Components/CartesianChart/hooks/useShimmerAnimation.js.map +1 -0
  28. package/dist/module/lib/Components/CartesianChart/utils.js +1 -1
  29. package/dist/module/lib/Components/CartesianChart/utils.js.map +1 -1
  30. package/dist/module/lib/Components/Line/Line.js +18 -11
  31. package/dist/module/lib/Components/Line/Line.js.map +1 -1
  32. package/dist/module/lib/Components/Line/constants.js +5 -0
  33. package/dist/module/lib/Components/Line/constants.js.map +1 -0
  34. package/dist/module/lib/Components/Line/types.js +2 -0
  35. package/dist/module/lib/Components/Line/utils.js +38 -11
  36. package/dist/module/lib/Components/Line/utils.js.map +1 -1
  37. package/dist/module/lib/Components/Line/utils.test.js +49 -3
  38. package/dist/module/lib/Components/Line/utils.test.js.map +1 -1
  39. package/dist/module/lib/Components/LineChart/LineChart.js +131 -27
  40. package/dist/module/lib/Components/LineChart/LineChart.js.map +1 -1
  41. package/dist/module/lib/Components/LineChart/LineChart.test.js +147 -0
  42. package/dist/module/lib/Components/LineChart/LineChart.test.js.map +1 -1
  43. package/dist/module/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.js +72 -0
  44. package/dist/module/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.js.map +1 -0
  45. package/dist/module/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.test.js +47 -0
  46. package/dist/module/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.test.js.map +1 -0
  47. package/dist/module/lib/Components/LineChart/LineChartEmptyState/index.js +4 -0
  48. package/dist/module/lib/Components/LineChart/LineChartEmptyState/index.js.map +1 -0
  49. package/dist/module/lib/Components/LineChart/LineChartEmptyState/types.js +4 -0
  50. package/dist/module/lib/Components/LineChart/LineChartEmptyState/types.js.map +1 -0
  51. package/dist/module/lib/Components/LineChart/LineChartEmptyState/utils.js +22 -0
  52. package/dist/module/lib/Components/LineChart/LineChartEmptyState/utils.js.map +1 -0
  53. package/dist/module/lib/Components/LineChart/LineChartEmptyState/utils.test.js +21 -0
  54. package/dist/module/lib/Components/LineChart/LineChartEmptyState/utils.test.js.map +1 -0
  55. package/dist/module/lib/Components/LineChart/utils.js +83 -0
  56. package/dist/module/lib/Components/LineChart/utils.js.map +1 -0
  57. package/dist/module/lib/Components/LineChart/utils.test.js +174 -0
  58. package/dist/module/lib/Components/LineChart/utils.test.js.map +1 -0
  59. package/dist/module/lib/Components/Point/Point.js +6 -4
  60. package/dist/module/lib/Components/Point/Point.js.map +1 -1
  61. package/dist/module/lib/Components/ReferenceLine/ReferenceLine.js +4 -4
  62. package/dist/module/lib/Components/ReferenceLine/ReferenceLine.js.map +1 -1
  63. package/dist/module/lib/Components/ReferenceLine/constants.js +2 -2
  64. package/dist/module/lib/Components/ReferenceLine/constants.js.map +1 -1
  65. package/dist/module/lib/Components/ReferenceLine/utils.js +2 -1
  66. package/dist/module/lib/Components/ReferenceLine/utils.js.map +1 -1
  67. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/utils.js +2 -1
  68. package/dist/module/lib/Components/Scrubber/DefaultScrubberTooltip/utils.js.map +1 -1
  69. package/dist/module/lib/Components/Scrubber/Scrubber.js +2 -2
  70. package/dist/module/lib/Components/Scrubber/Scrubber.js.map +1 -1
  71. package/dist/module/lib/Components/Scrubber/ScrubberProvider.js +10 -2
  72. package/dist/module/lib/Components/Scrubber/ScrubberProvider.js.map +1 -1
  73. package/dist/module/lib/Components/Scrubber/ScrubberProvider.test.js +79 -1
  74. package/dist/module/lib/Components/Scrubber/ScrubberProvider.test.js.map +1 -1
  75. package/dist/module/lib/Components/Scrubber/utils.js +3 -2
  76. package/dist/module/lib/Components/Scrubber/utils.js.map +1 -1
  77. package/dist/module/lib/utils/numbers.js +16 -0
  78. package/dist/module/lib/utils/numbers.js.map +1 -0
  79. package/dist/module/lib/utils/ticks/ticks.js +0 -16
  80. package/dist/module/lib/utils/ticks/ticks.js.map +1 -1
  81. package/dist/typescript/src/lib/Components/Axis/Axis.types.d.ts +6 -0
  82. package/dist/typescript/src/lib/Components/Axis/Axis.types.d.ts.map +1 -1
  83. package/dist/typescript/src/lib/Components/Axis/XAxis/XAxis.d.ts +1 -1
  84. package/dist/typescript/src/lib/Components/Axis/XAxis/XAxis.d.ts.map +1 -1
  85. package/dist/typescript/src/lib/Components/Axis/YAxis/YAxis.d.ts +1 -1
  86. package/dist/typescript/src/lib/Components/Axis/YAxis/YAxis.d.ts.map +1 -1
  87. package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts +1 -1
  88. package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
  89. package/dist/typescript/src/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts +18 -0
  90. package/dist/typescript/src/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts.map +1 -0
  91. package/dist/typescript/src/lib/Components/CartesianChart/ChartEmptyLabel/index.d.ts +2 -0
  92. package/dist/typescript/src/lib/Components/CartesianChart/ChartEmptyLabel/index.d.ts.map +1 -0
  93. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts +3 -0
  94. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts.map +1 -0
  95. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/context.d.ts +22 -0
  96. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/context.d.ts.map +1 -0
  97. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/index.d.ts +3 -0
  98. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/index.d.ts.map +1 -0
  99. package/dist/typescript/src/lib/Components/CartesianChart/{RevealClip → RevealAnimation}/types.d.ts +15 -2
  100. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/types.d.ts.map +1 -0
  101. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/utils.d.ts +33 -0
  102. package/dist/typescript/src/lib/Components/CartesianChart/RevealAnimation/utils.d.ts.map +1 -0
  103. package/dist/typescript/src/lib/Components/CartesianChart/hooks/useShimmerAnimation.d.ts +13 -0
  104. package/dist/typescript/src/lib/Components/CartesianChart/hooks/useShimmerAnimation.d.ts.map +1 -0
  105. package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts +12 -0
  106. package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts.map +1 -1
  107. package/dist/typescript/src/lib/Components/CartesianChart/utils.d.ts +1 -1
  108. package/dist/typescript/src/lib/Components/CartesianChart/utils.d.ts.map +1 -1
  109. package/dist/typescript/src/lib/Components/Line/Line.d.ts +1 -1
  110. package/dist/typescript/src/lib/Components/Line/Line.d.ts.map +1 -1
  111. package/dist/typescript/src/lib/Components/Line/constants.d.ts +3 -0
  112. package/dist/typescript/src/lib/Components/Line/constants.d.ts.map +1 -0
  113. package/dist/typescript/src/lib/Components/Line/index.d.ts +1 -1
  114. package/dist/typescript/src/lib/Components/Line/index.d.ts.map +1 -1
  115. package/dist/typescript/src/lib/Components/Line/types.d.ts +15 -0
  116. package/dist/typescript/src/lib/Components/Line/types.d.ts.map +1 -1
  117. package/dist/typescript/src/lib/Components/Line/utils.d.ts +11 -6
  118. package/dist/typescript/src/lib/Components/Line/utils.d.ts.map +1 -1
  119. package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts +1 -1
  120. package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts.map +1 -1
  121. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts +9 -0
  122. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts.map +1 -0
  123. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/index.d.ts +3 -0
  124. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/index.d.ts.map +1 -0
  125. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/types.d.ts +3 -0
  126. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/types.d.ts.map +1 -0
  127. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/utils.d.ts +14 -0
  128. package/dist/typescript/src/lib/Components/LineChart/LineChartEmptyState/utils.d.ts.map +1 -0
  129. package/dist/typescript/src/lib/Components/LineChart/types.d.ts +41 -1
  130. package/dist/typescript/src/lib/Components/LineChart/types.d.ts.map +1 -1
  131. package/dist/typescript/src/lib/Components/LineChart/utils.d.ts +43 -0
  132. package/dist/typescript/src/lib/Components/LineChart/utils.d.ts.map +1 -0
  133. package/dist/typescript/src/lib/Components/Point/Point.d.ts.map +1 -1
  134. package/dist/typescript/src/lib/Components/ReferenceLine/ReferenceLine.d.ts.map +1 -1
  135. package/dist/typescript/src/lib/Components/ReferenceLine/constants.d.ts +2 -2
  136. package/dist/typescript/src/lib/Components/ReferenceLine/constants.d.ts.map +1 -1
  137. package/dist/typescript/src/lib/Components/ReferenceLine/utils.d.ts.map +1 -1
  138. package/dist/typescript/src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.d.ts.map +1 -1
  139. package/dist/typescript/src/lib/Components/Scrubber/Scrubber.d.ts.map +1 -1
  140. package/dist/typescript/src/lib/Components/Scrubber/ScrubberProvider.d.ts.map +1 -1
  141. package/dist/typescript/src/lib/Components/Scrubber/utils.d.ts.map +1 -1
  142. package/dist/typescript/src/lib/utils/index.d.ts +1 -1
  143. package/dist/typescript/src/lib/utils/index.d.ts.map +1 -1
  144. package/dist/typescript/src/lib/utils/numbers.d.ts +13 -0
  145. package/dist/typescript/src/lib/utils/numbers.d.ts.map +1 -0
  146. package/dist/typescript/src/lib/utils/ticks/ticks.d.ts +1 -11
  147. package/dist/typescript/src/lib/utils/ticks/ticks.d.ts.map +1 -1
  148. package/dist/typescript/src/lib/utils/types.d.ts +27 -2
  149. package/dist/typescript/src/lib/utils/types.d.ts.map +1 -1
  150. package/package.json +3 -3
  151. package/src/lib/Components/Axis/Axis.types.ts +6 -0
  152. package/src/lib/Components/Axis/XAxis/XAxis.test.tsx +12 -0
  153. package/src/lib/Components/Axis/XAxis/XAxis.tsx +29 -32
  154. package/src/lib/Components/Axis/YAxis/YAxis.test.tsx +12 -0
  155. package/src/lib/Components/Axis/YAxis/YAxis.tsx +29 -32
  156. package/src/lib/Components/CartesianChart/CartesianChart.tsx +30 -24
  157. package/src/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.tsx +68 -0
  158. package/src/lib/Components/CartesianChart/ChartEmptyLabel/index.ts +1 -0
  159. package/src/lib/Components/CartesianChart/{RevealClip/RevealClipDefs.test.tsx → RevealAnimation/RevealAnimationProvider.test.tsx} +60 -17
  160. package/src/lib/Components/CartesianChart/{RevealClip/RevealClipDefs.tsx → RevealAnimation/RevealAnimationProvider.tsx} +11 -11
  161. package/src/lib/Components/CartesianChart/RevealAnimation/context.ts +39 -0
  162. package/src/lib/Components/CartesianChart/RevealAnimation/index.ts +2 -0
  163. package/src/lib/Components/CartesianChart/{RevealClip → RevealAnimation}/types.ts +16 -2
  164. package/src/lib/Components/CartesianChart/RevealAnimation/utils.ts +87 -0
  165. package/src/lib/Components/CartesianChart/hooks/useShimmerAnimation.ts +52 -0
  166. package/src/lib/Components/CartesianChart/types.ts +12 -0
  167. package/src/lib/Components/CartesianChart/utils.ts +2 -1
  168. package/src/lib/Components/Line/Line.tsx +26 -14
  169. package/src/lib/Components/Line/constants.ts +2 -0
  170. package/src/lib/Components/Line/index.ts +1 -1
  171. package/src/lib/Components/Line/types.ts +17 -0
  172. package/src/lib/Components/Line/utils.test.ts +77 -3
  173. package/src/lib/Components/Line/utils.ts +63 -12
  174. package/src/lib/Components/LineChart/LineChart.test.tsx +135 -0
  175. package/src/lib/Components/LineChart/LineChart.tsx +157 -38
  176. package/src/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.test.tsx +39 -0
  177. package/src/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.tsx +72 -0
  178. package/src/lib/Components/LineChart/LineChartEmptyState/index.ts +2 -0
  179. package/src/lib/Components/LineChart/LineChartEmptyState/types.ts +3 -0
  180. package/src/lib/Components/LineChart/LineChartEmptyState/utils.test.ts +22 -0
  181. package/src/lib/Components/LineChart/LineChartEmptyState/utils.ts +24 -0
  182. package/src/lib/Components/LineChart/types.ts +49 -1
  183. package/src/lib/Components/LineChart/utils.test.ts +196 -0
  184. package/src/lib/Components/LineChart/utils.ts +107 -0
  185. package/src/lib/Components/Point/Point.tsx +7 -4
  186. package/src/lib/Components/ReferenceLine/ReferenceLine.tsx +8 -4
  187. package/src/lib/Components/ReferenceLine/constants.ts +2 -2
  188. package/src/lib/Components/ReferenceLine/utils.ts +2 -1
  189. package/src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.ts +2 -1
  190. package/src/lib/Components/Scrubber/Scrubber.tsx +13 -2
  191. package/src/lib/Components/Scrubber/ScrubberProvider.test.tsx +83 -1
  192. package/src/lib/Components/Scrubber/ScrubberProvider.tsx +17 -2
  193. package/src/lib/Components/Scrubber/utils.ts +3 -5
  194. package/src/lib/utils/index.ts +1 -0
  195. package/src/lib/utils/numbers.ts +15 -0
  196. package/src/lib/utils/ticks/ticks.ts +1 -23
  197. package/src/lib/utils/types.ts +35 -2
  198. package/dist/module/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js.map +0 -1
  199. package/dist/module/lib/Components/CartesianChart/RevealClip/RevealClipDefs.test.js.map +0 -1
  200. package/dist/module/lib/Components/CartesianChart/RevealClip/context.js +0 -8
  201. package/dist/module/lib/Components/CartesianChart/RevealClip/context.js.map +0 -1
  202. package/dist/module/lib/Components/CartesianChart/RevealClip/index.js +0 -5
  203. package/dist/module/lib/Components/CartesianChart/RevealClip/index.js.map +0 -1
  204. package/dist/module/lib/Components/CartesianChart/RevealClip/types.js.map +0 -1
  205. package/dist/module/lib/Components/CartesianChart/RevealClip/utils.js +0 -32
  206. package/dist/module/lib/Components/CartesianChart/RevealClip/utils.js.map +0 -1
  207. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts +0 -3
  208. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts.map +0 -1
  209. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/context.d.ts +0 -7
  210. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/context.d.ts.map +0 -1
  211. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/index.d.ts +0 -3
  212. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/index.d.ts.map +0 -1
  213. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/types.d.ts.map +0 -1
  214. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/utils.d.ts +0 -17
  215. package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/utils.d.ts.map +0 -1
  216. package/src/lib/Components/CartesianChart/RevealClip/context.ts +0 -13
  217. package/src/lib/Components/CartesianChart/RevealClip/index.ts +0 -2
  218. package/src/lib/Components/CartesianChart/RevealClip/utils.ts +0 -51
  219. /package/dist/module/lib/Components/CartesianChart/{RevealClip → RevealAnimation}/types.js +0 -0
@@ -0,0 +1,107 @@
1
+ import { isFiniteNumber } from '../../utils/numbers';
2
+ import type { ChartInset, Series } from '../../utils/types';
3
+ import { DEFAULT_AXIS_HEIGHT } from '../Axis/XAxis';
4
+ import type { XAxisProps } from '../Axis/XAxis';
5
+ import { DEFAULT_AXIS_WIDTH } from '../Axis/YAxis';
6
+ import type { YAxisProps } from '../Axis/YAxis';
7
+
8
+ /**
9
+ * Minimum number of finite points a series needs to be drawable as a line.
10
+ */
11
+ const MIN_DRAWABLE_POINTS = 2;
12
+ const LOADING_ARIA_LABEL = 'Loading chart';
13
+
14
+ type ComputeAxisPaddingParams = {
15
+ showXAxis: boolean;
16
+ showYAxis: boolean;
17
+ xAxisPosition: XAxisProps['position'];
18
+ yAxisPosition: YAxisProps['position'];
19
+ yAxisWidth: YAxisProps['width'];
20
+ };
21
+
22
+ type ChartDisplayStateParams = {
23
+ loading: boolean;
24
+ hasData: boolean;
25
+ emptyLabel: string;
26
+ };
27
+
28
+ type ChartStatus = 'initial-loading' | 'empty' | 'transition-loading' | 'ready';
29
+
30
+ type ChartDisplayState = {
31
+ status: ChartStatus;
32
+ ariaLabel: string | undefined;
33
+ };
34
+
35
+ /**
36
+ * Reserves space on the relevant sides of the drawing area for visible axes.
37
+ * Returns `undefined` when no axis is shown so the chart keeps its full area.
38
+ */
39
+ export const computeAxisPadding = ({
40
+ showXAxis,
41
+ showYAxis,
42
+ xAxisPosition,
43
+ yAxisPosition,
44
+ yAxisWidth,
45
+ }: ComputeAxisPaddingParams): Partial<ChartInset> | undefined => {
46
+ if (!showXAxis && !showYAxis) {
47
+ return undefined;
48
+ }
49
+
50
+ const resolvedYAxisWidth = yAxisWidth ?? DEFAULT_AXIS_WIDTH;
51
+
52
+ return {
53
+ top: showXAxis && xAxisPosition === 'top' ? DEFAULT_AXIS_HEIGHT : 0,
54
+ bottom: showXAxis && xAxisPosition === 'bottom' ? DEFAULT_AXIS_HEIGHT : 0,
55
+ left: showYAxis && yAxisPosition === 'start' ? resolvedYAxisWidth : 0,
56
+ right: showYAxis && yAxisPosition === 'end' ? resolvedYAxisWidth : 0,
57
+ };
58
+ };
59
+
60
+ /**
61
+ * Derives the chart's {@link ChartStatus} from its loading flag and whether it
62
+ * has drawable data, along with the matching accessibility label.
63
+ */
64
+ export const getChartDisplayState = ({
65
+ loading,
66
+ hasData,
67
+ emptyLabel,
68
+ }: ChartDisplayStateParams): ChartDisplayState => {
69
+ if (loading) {
70
+ return {
71
+ status: hasData ? 'transition-loading' : 'initial-loading',
72
+ ariaLabel: LOADING_ARIA_LABEL,
73
+ };
74
+ }
75
+
76
+ if (!hasData) {
77
+ return { status: 'empty', ariaLabel: emptyLabel };
78
+ }
79
+
80
+ return { status: 'ready', ariaLabel: undefined };
81
+ };
82
+
83
+ /**
84
+ * Whether any series has at least {@link MIN_DRAWABLE_POINTS} finite points,
85
+ * i.e. enough to actually draw a line. Drives the empty / loading / data states
86
+ * of the chart.
87
+ *
88
+ * When `xData` (the x-axis domain) is provided, only the first `xData.length`
89
+ * points of each series are considered — mirroring the cap in `toScaledPoints`
90
+ * (Line/utils.ts) — so a series longer than the axis cannot report drawable
91
+ * points that would never be plotted.
92
+ */
93
+ export const canRenderLine = (
94
+ series: Series[] | undefined,
95
+ xData?: readonly (string | number)[],
96
+ ): boolean => {
97
+ return (series ?? []).some((s) => {
98
+ const data = s.data ?? [];
99
+ const limit = xData ? Math.min(data.length, xData.length) : data.length;
100
+ let drawablePoints = 0;
101
+ for (let i = 0; i < limit; i++) {
102
+ if (isFiniteNumber(data[i])) drawablePoints++;
103
+ if (drawablePoints >= MIN_DRAWABLE_POINTS) return true;
104
+ }
105
+ return false;
106
+ });
107
+ };
@@ -1,10 +1,11 @@
1
1
  import { useTheme } from '@ledgerhq/lumen-ui-rnative';
2
2
  import { useMemo } from 'react';
3
+ import Animated from 'react-native-reanimated';
3
4
  import { Circle, G, Polygon, Text as SvgText } from 'react-native-svg';
4
5
 
5
6
  import { projectPoint } from '../../utils/scales/scales';
6
7
  import { useCartesianChartContext } from '../CartesianChart/context';
7
- import { useRevealClip } from '../CartesianChart/RevealClip';
8
+ import { useRevealFadeProps } from '../CartesianChart/RevealAnimation';
8
9
  import { DEFAULT_SIZE, STROKE_WIDTH } from './constants';
9
10
  import { useMagneticPointsContext } from './pointContext';
10
11
 
@@ -17,6 +18,8 @@ import {
17
18
  useMagneticRegistration,
18
19
  } from './utils';
19
20
 
21
+ const AnimatedG = Animated.createAnimatedComponent(G);
22
+
20
23
  export function PointLabel({
21
24
  textAnchor = 'middle',
22
25
  ...props
@@ -50,7 +53,7 @@ export function Point({
50
53
  }: Readonly<PointProps>) {
51
54
  const { getXScale, getYScale, getXAxisConfig, drawingArea } =
52
55
  useCartesianChartContext();
53
- const clipPath = useRevealClip();
56
+ const fadeProps = useRevealFadeProps();
54
57
  const magneticContext = useMagneticPointsContext();
55
58
 
56
59
  useMagneticRegistration(magnetic, dataX, getXAxisConfig, magneticContext);
@@ -79,7 +82,7 @@ export function Point({
79
82
  const Label = LabelComponent ?? PointLabel;
80
83
 
81
84
  return (
82
- <G testID='point-group' clipPath={clipPath} onPress={onPress}>
85
+ <AnimatedG testID='point-group' onPress={onPress} animatedProps={fadeProps}>
83
86
  {!hidePoint && (
84
87
  <Circle
85
88
  testID='point-circle'
@@ -103,6 +106,6 @@ export function Point({
103
106
  {resolvedLabel}
104
107
  </Label>
105
108
  )}
106
- </G>
109
+ </AnimatedG>
107
110
  );
108
111
  }
@@ -3,7 +3,10 @@ import { G, Line as SvgLine, Text as SvgText } from 'react-native-svg';
3
3
 
4
4
  import { useCartesianChartContext } from '../CartesianChart/context';
5
5
 
6
- import { DASH_ARRAY, STROKE_WIDTH } from './constants';
6
+ import {
7
+ REFERENCE_LINE_DASH_ARRAY,
8
+ REFERENCE_LINE_STROKE_WIDTH,
9
+ } from './constants';
7
10
  import type { ReferenceLineProps } from './types';
8
11
  import {
9
12
  computeHorizontalLabelCoordinates,
@@ -28,7 +31,8 @@ export function ReferenceLine({
28
31
  const { theme } = useTheme();
29
32
 
30
33
  const resolvedStroke = stroke ?? theme.colors.border.muted;
31
- const dashArray = lineStyle === 'dashed' ? DASH_ARRAY : undefined;
34
+ const dashArray =
35
+ lineStyle === 'dashed' ? REFERENCE_LINE_DASH_ARRAY : undefined;
32
36
  const fontSize = theme.typographies.body4.fontSize;
33
37
 
34
38
  if (props.dataY !== undefined) {
@@ -65,7 +69,7 @@ export function ReferenceLine({
65
69
  x2={drawingArea.x + drawingArea.width}
66
70
  y2={yPixel}
67
71
  stroke={resolvedStroke}
68
- strokeWidth={STROKE_WIDTH}
72
+ strokeWidth={REFERENCE_LINE_STROKE_WIDTH}
69
73
  strokeDasharray={dashArray}
70
74
  strokeLinecap='round'
71
75
  />
@@ -122,7 +126,7 @@ export function ReferenceLine({
122
126
  x2={xPixel}
123
127
  y2={drawingArea.y + drawingArea.height}
124
128
  stroke={resolvedStroke}
125
- strokeWidth={STROKE_WIDTH}
129
+ strokeWidth={REFERENCE_LINE_STROKE_WIDTH}
126
130
  strokeDasharray={dashArray}
127
131
  strokeLinecap='round'
128
132
  />
@@ -1,2 +1,2 @@
1
- export const STROKE_WIDTH = 2;
2
- export const DASH_ARRAY = '0.1 6';
1
+ export const REFERENCE_LINE_STROKE_WIDTH = 2;
2
+ export const REFERENCE_LINE_DASH_ARRAY = '0.1 6';
@@ -1,3 +1,4 @@
1
+ import { isFiniteNumber } from '../../utils/numbers';
1
2
  import { getPointOnScale, isCategoricalScale } from '../../utils/scales/scales';
2
3
  import type { ChartScaleFunction, DrawingArea } from '../../utils/types';
3
4
  import type { BaseAxisProps } from '../Axis';
@@ -127,7 +128,7 @@ export const resolvePixel = ({
127
128
 
128
129
  const p = getPointOnScale(resolved, scale);
129
130
 
130
- if (!Number.isFinite(p) || !isPixelWithinDrawingArea(p, axis, drawingArea)) {
131
+ if (!isFiniteNumber(p) || !isPixelWithinDrawingArea(p, axis, drawingArea)) {
131
132
  return undefined;
132
133
  }
133
134
  return p;
@@ -1,6 +1,7 @@
1
1
  import type { RefObject } from 'react';
2
2
  import { useEffect, useMemo, useRef, useState } from 'react';
3
3
 
4
+ import { clamp } from '../../../utils/numbers';
4
5
  import type { DrawingArea } from '../../../utils/types';
5
6
  import type { ChartTooltipItemData, SvgBBoxElement } from '../types';
6
7
  import {
@@ -77,7 +78,7 @@ export const computeTooltipX = (
77
78
  drawingArea.x,
78
79
  drawingArea.x + drawingArea.width - tooltipWidth,
79
80
  );
80
- return Math.min(maxTooltipX, Math.max(drawingArea.x, preferredTooltipX));
81
+ return clamp(preferredTooltipX, drawingArea.x, maxTooltipX);
81
82
  };
82
83
 
83
84
  /**
@@ -80,12 +80,23 @@ export function Scrubber({
80
80
  const seriesData = seriesMap.get(s.id)?.data;
81
81
  const pixelY = resolvePixelY(scrubberPosition, seriesData, getYScale);
82
82
  if (pixelY === undefined) return null;
83
- return { id: s.id, stroke: s.stroke, pixelY };
83
+ return {
84
+ id: s.id,
85
+ stroke: s.stroke ?? theme.colors.border.muted,
86
+ pixelY,
87
+ };
84
88
  })
85
89
  .filter(
86
90
  (b): b is { id: string; stroke: string; pixelY: number } => b !== null,
87
91
  );
88
- }, [scrubberPosition, showBeacons, series, seriesMap, getYScale]);
92
+ }, [
93
+ scrubberPosition,
94
+ showBeacons,
95
+ series,
96
+ seriesMap,
97
+ getYScale,
98
+ theme.colors.border.muted,
99
+ ]);
89
100
 
90
101
  const tooltipPayload = useMemo(() => {
91
102
  if (scrubberPosition === undefined || !tooltip) {
@@ -1,13 +1,16 @@
1
- import { describe, expect, it, jest } from '@jest/globals';
1
+ import { beforeEach, describe, expect, it, jest } from '@jest/globals';
2
2
  import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
3
  import { ThemeProvider } from '@ledgerhq/lumen-ui-rnative';
4
4
  import { fireEvent, render } from '@testing-library/react-native';
5
+ import * as Haptics from 'expo-haptics';
5
6
  import type { ReactNode } from 'react';
6
7
  import { Pressable, Text } from 'react-native';
7
8
 
8
9
  import { CartesianChart } from '../CartesianChart';
9
10
  import { useScrubberContext } from './context';
10
11
 
12
+ const impactAsyncMock = jest.mocked(Haptics.impactAsync);
13
+
11
14
  const sampleSeries = [
12
15
  { id: 's1', stroke: '#7B61FF', data: [10, 20, 30, 40, 50] },
13
16
  ];
@@ -220,4 +223,83 @@ describe('ScrubberProvider', () => {
220
223
  fireEvent.press(getByTestId('set-position'));
221
224
  expect(onScrubberPositionChange).not.toHaveBeenCalled();
222
225
  });
226
+
227
+ describe('haptic feedback', () => {
228
+ const ContextTrigger = () => {
229
+ const { onScrubberPositionChange: updatePosition } = useScrubberContext();
230
+ return (
231
+ <>
232
+ <Pressable testID='enter' onPress={() => updatePosition(2)} />
233
+ <Pressable testID='move' onPress={() => updatePosition(3)} />
234
+ <Pressable testID='exit' onPress={() => updatePosition(undefined)} />
235
+ </>
236
+ );
237
+ };
238
+
239
+ const renderTrigger = (series = sampleSeries) =>
240
+ render(
241
+ <Wrapper>
242
+ <CartesianChart
243
+ series={series}
244
+ width={400}
245
+ height={200}
246
+ enableScrubbing={true}
247
+ >
248
+ <ContextTrigger />
249
+ </CartesianChart>
250
+ </Wrapper>,
251
+ );
252
+
253
+ beforeEach(() => {
254
+ impactAsyncMock.mockClear();
255
+ });
256
+
257
+ it('triggers light haptic feedback once when entering from idle', () => {
258
+ const { getByTestId } = renderTrigger();
259
+
260
+ fireEvent.press(getByTestId('enter'));
261
+
262
+ expect(impactAsyncMock).toHaveBeenCalledTimes(1);
263
+ expect(impactAsyncMock).toHaveBeenCalledWith('light');
264
+ });
265
+
266
+ it('does not re-trigger haptic feedback while moving between indices', () => {
267
+ const { getByTestId } = renderTrigger();
268
+
269
+ fireEvent.press(getByTestId('enter'));
270
+ fireEvent.press(getByTestId('move'));
271
+
272
+ expect(impactAsyncMock).toHaveBeenCalledTimes(1);
273
+ });
274
+
275
+ it('does not trigger haptic feedback when exiting the scrubber', () => {
276
+ const { getByTestId } = renderTrigger();
277
+
278
+ fireEvent.press(getByTestId('enter'));
279
+ fireEvent.press(getByTestId('exit'));
280
+
281
+ expect(impactAsyncMock).toHaveBeenCalledTimes(1);
282
+ });
283
+
284
+ it('re-triggers haptic feedback when re-entering after an exit', () => {
285
+ const { getByTestId } = renderTrigger();
286
+
287
+ fireEvent.press(getByTestId('enter'));
288
+ fireEvent.press(getByTestId('exit'));
289
+ fireEvent.press(getByTestId('move'));
290
+
291
+ expect(impactAsyncMock).toHaveBeenCalledTimes(2);
292
+ });
293
+
294
+ it('does not trigger haptic feedback when dataLength is 0', () => {
295
+ const emptySeries = [
296
+ { id: 's1', stroke: '#7B61FF', data: [] as number[] },
297
+ ];
298
+ const { getByTestId } = renderTrigger(emptySeries);
299
+
300
+ fireEvent.press(getByTestId('enter'));
301
+
302
+ expect(impactAsyncMock).not.toHaveBeenCalled();
303
+ });
304
+ });
223
305
  });
@@ -1,9 +1,11 @@
1
+ import { triggerHapticFeedback } from '@ledgerhq/lumen-ui-rnative';
1
2
  import { useCallback, useMemo, useRef, useState } from 'react';
2
3
  import { StyleSheet, View } from 'react-native';
3
4
  import { Gesture, GestureDetector } from 'react-native-gesture-handler';
4
5
  import Animated, { useSharedValue } from 'react-native-reanimated';
5
6
  import { scheduleOnRN } from 'react-native-worklets';
6
7
 
8
+ import { clamp } from '../../utils/numbers';
7
9
  import { useCartesianChartContext } from '../CartesianChart/context';
8
10
  import { useMagneticPointsContext } from '../Point/pointContext';
9
11
  import { ScrubberContextProvider } from './context';
@@ -77,19 +79,32 @@ export function ScrubberProvider({
77
79
  latest.current.magnetRadius = magnetRadius;
78
80
  latest.current.sortedMagnets = sortedMagnets;
79
81
 
82
+ const handleHapticFeedback = useCallback(
83
+ (ref: typeof latest.current, clamped: number | undefined) => {
84
+ if (ref.lastIndex === undefined && clamped !== undefined) {
85
+ triggerHapticFeedback('light');
86
+ }
87
+ },
88
+ [],
89
+ );
90
+
80
91
  const setScrubberPositionAndNotify = useCallback(
81
92
  (index: number | undefined) => {
82
93
  const ref = latest.current;
83
94
  const clamped =
84
95
  index === undefined || ref.dataLength <= 0
85
96
  ? undefined
86
- : Math.max(0, Math.min(index, ref.dataLength - 1));
97
+ : clamp(index, 0, ref.dataLength - 1);
87
98
  if (clamped === ref.lastIndex) return;
99
+
100
+ handleHapticFeedback(ref, clamped);
101
+
88
102
  ref.lastIndex = clamped;
103
+
89
104
  setScrubberPosition(clamped);
90
105
  ref.onChange?.(clamped);
91
106
  },
92
- [],
107
+ [handleHapticFeedback],
93
108
  );
94
109
 
95
110
  const handlePositionChange = useCallback(
@@ -1,3 +1,4 @@
1
+ import { clamp } from '../../utils/numbers';
1
2
  import {
2
3
  getPointOnScale,
3
4
  isCategoricalScale,
@@ -71,7 +72,7 @@ export const getDataIndexFromPosition = (
71
72
  const offset =
72
73
  rangeStart + scale.paddingOuter() * step + scale.bandwidth() / 2;
73
74
  const index = Math.round((pixelX - offset) / step);
74
- return Math.max(0, Math.min(index, dataLength - 1));
75
+ return clamp(index, 0, dataLength - 1);
75
76
  }
76
77
 
77
78
  if (isNumericScale(scale)) {
@@ -84,10 +85,7 @@ export const getDataIndexFromPosition = (
84
85
  }
85
86
 
86
87
  const inverted = scale.invert(pixelX);
87
- return Math.max(
88
- 0,
89
- Math.min(Math.round(inverted as number), dataLength - 1),
90
- );
88
+ return clamp(Math.round(inverted as number), 0, dataLength - 1);
91
89
  }
92
90
 
93
91
  return 0;
@@ -3,6 +3,7 @@ export type {
3
3
  CategoricalScale,
4
4
  ChartInset,
5
5
  ChartScaleFunction,
6
+ CurveType,
6
7
  DrawingArea,
7
8
  NumericScale,
8
9
  Series,
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Type guard for a finite number. Narrows out `null`, `undefined`, `NaN` and
3
+ * `Infinity`, i.e. any value that cannot be projected to a valid coordinate or
4
+ * counted as a drawable data point.
5
+ */
6
+ export const isFiniteNumber = (value: unknown): value is number =>
7
+ Number.isFinite(value);
8
+
9
+ /**
10
+ * Constrains `value` to the inclusive `[min, max]` range. For a degenerate
11
+ * range where `min > max` (e.g. an index range `[0, length - 1]` for empty
12
+ * data), `min` takes precedence and is returned — matching `lodash.clamp`.
13
+ */
14
+ export const clamp = (value: number, min: number, max: number): number =>
15
+ Math.max(Math.min(value, max), min);
@@ -1,6 +1,6 @@
1
1
  import type { BaseAxisProps } from '../../Components/Axis';
2
2
  import { isCategoricalScale, isNumericScale } from '../scales/scales';
3
- import type { ChartScaleFunction, DrawingArea } from '../types';
3
+ import type { ChartScaleFunction } from '../types';
4
4
 
5
5
  export const APPROXIMATE_TICK_COUNT = 5;
6
6
 
@@ -94,25 +94,3 @@ export const buildTicksData = (
94
94
  label: getTickLabel(tick, axisData, formatter),
95
95
  }));
96
96
  };
97
-
98
- /**
99
- * Excludes the X grid line at the Y-axis origin (left edge)
100
- * to prevent overlap with the Y-axis solid line.
101
- */
102
- export const isTickOnXAxisDomainEdge = (
103
- tick: TickData,
104
- drawingArea: DrawingArea,
105
- ): boolean => {
106
- return tick.position !== drawingArea.x;
107
- };
108
-
109
- /**
110
- * Excludes the Y grid line at the X-axis origin (bottom edge)
111
- * to prevent overlap with the X-axis solid line.
112
- */
113
- export const isTickOnYAxisDomainEdge = (
114
- tick: TickData,
115
- drawingArea: DrawingArea,
116
- ): boolean => {
117
- return tick.position !== drawingArea.y + drawingArea.height;
118
- };
@@ -19,6 +19,26 @@ export type DrawingArea = {
19
19
  height: number;
20
20
  };
21
21
 
22
+ /**
23
+ * Interpolation used to draw a line (and its area) between data points.
24
+ * Each value maps to a [d3-shape](https://d3js.org/d3-shape/curve) curve:
25
+ * - `'bump'` — smooth cubic curve with horizontal tangents (`curveBumpX`).
26
+ * - `'natural'` — natural cubic spline through every point (`curveNatural`).
27
+ * - `'monotone'` — smooth curve that preserves monotonicity (`curveMonotoneX`).
28
+ * - `'linear'` — straight segments between points (`curveLinear`).
29
+ * - `'step'` — stepped, piecewise-constant line (`curveStep`).
30
+ * - `'stepAfter'` — stepped line where changes occur after the x-coordinate (`curveStepAfter`).
31
+ * - `'stepBefore'` — stepped line where changes occur before the x-coordinate (`curveStepBefore`).
32
+ */
33
+ export type CurveType =
34
+ | 'bump'
35
+ | 'natural'
36
+ | 'monotone'
37
+ | 'linear'
38
+ | 'step'
39
+ | 'stepAfter'
40
+ | 'stepBefore';
41
+
22
42
  export type Series = {
23
43
  /**
24
44
  * Unique identifier for the series.
@@ -33,9 +53,22 @@ export type Series = {
33
53
  */
34
54
  label?: string;
35
55
  /**
36
- * CSS color applied to the series line/mark.
56
+ * Color applied to the series line/mark.
57
+ * @default border-muted
58
+ */
59
+ stroke?: string;
60
+ /**
61
+ * Interpolation used to draw the line between data points.
62
+ * @default 'bump'
63
+ */
64
+ curve?: CurveType;
65
+ /**
66
+ * When true, skips null values and draws a continuous line across gaps.
67
+ * When false (default), null values create gaps in the line.
68
+ * Overridden by the chart-level `connectNulls` prop when that is set.
69
+ * @default false
37
70
  */
38
- stroke: string;
71
+ connectNulls?: boolean;
39
72
  };
40
73
 
41
74
  export type NumericScale =
@@ -1 +0,0 @@
1
- {"version":3,"names":["RuntimeConstants","useMemo","Animated","ClipPath","Defs","Rect","OVERFLOW_BUFFER","RevealClipContext","useComputeDataFingerprint","useRevealClipAnimation","jsx","_jsx","jsxs","_jsxs","DEFAULT_DURATION_IN_SECONDS","AnimatedRect","createAnimatedComponent","RevealClipDefs","children","drawingArea","series","animate","transitions","isDisabled","isAndroid","durationMs","enter","duration","dataFingerprint","clipId","animatedRectProps","contextValue","clipPathAttr","Provider","value","id","x","left","y","top","height","bottom","animatedProps"],"sourceRoot":"../../../../../../src","sources":["lib/Components/CartesianChart/RevealClip/RevealClipDefs.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,OAAO,QAAQ,OAAO;AAE/B,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,QAAQ,EAAEC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAEvD,SAASC,eAAe,QAAQ,aAAU;AAE1C,SAASC,iBAAiB,QAAQ,cAAW;AAE7C,SAASC,yBAAyB,EAAEC,sBAAsB,QAAQ,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE5E,MAAMC,2BAA2B,GAAG,GAAG;AAEvC,MAAMC,YAAY,GAAGb,QAAQ,CAACc,uBAAuB,CAACX,IAAI,CAAC;AAE3D,OAAO,SAASY,cAAcA,CAAC;EAC7BC,QAAQ;EACRC,WAAW;EACXC,MAAM;EACNC,OAAO,GAAG,IAAI;EACdC;AACmB,CAAC,EAAE;EACtB;AACF;AACA;AACA;EACE,MAAMC,UAAU,GAAG,CAACF,OAAO,IAAIrB,gBAAgB,CAACwB,SAAS;EACzD,MAAMC,UAAU,GACd,CAACH,WAAW,EAAEI,KAAK,EAAEC,QAAQ,IAAIb,2BAA2B,IAAI,IAAI;EAEtE,MAAMc,eAAe,GAAGpB,yBAAyB,CAAC;IAAEY;EAAO,CAAC,CAAC;EAC7D,MAAM;IAAES,MAAM;IAAEC;EAAkB,CAAC,GAAGrB,sBAAsB,CAAC;IAC3DgB,UAAU;IACVN,WAAW;IACXS;EACF,CAAC,CAAC;EAEF,MAAMG,YAAY,GAAG9B,OAAO,CAC1B,OAAO;IAAE+B,YAAY,EAAE,QAAQH,MAAM;EAAI,CAAC,CAAC,EAC3C,CAACA,MAAM,CACT,CAAC;EAED,IAAIN,UAAU,EAAE;IACd,OAAOL,QAAQ;EACjB;EAEA,oBACEL,KAAA,CAACN,iBAAiB,CAAC0B,QAAQ;IAAuBC,KAAK,EAAEH,YAAa;IAAAb,QAAA,gBACpEP,IAAA,CAACP,IAAI;MAAAc,QAAA,eACHP,IAAA,CAACR,QAAQ;QAACgC,EAAE,EAAEN,MAAO;QAAAX,QAAA,eACnBP,IAAA,CAACI,YAAY;UACXqB,CAAC,EAAEjB,WAAW,CAACiB,CAAC,GAAG9B,eAAe,CAAC+B,IAAK;UACxCC,CAAC,EAAEnB,WAAW,CAACmB,CAAC,GAAGhC,eAAe,CAACiC,GAAI;UACvCC,MAAM,EACJrB,WAAW,CAACqB,MAAM,GAAGlC,eAAe,CAACiC,GAAG,GAAGjC,eAAe,CAACmC,MAC5D;UACDC,aAAa,EAAEZ;QAAkB,CAClC;MAAC,CACM;IAAC,CACP,CAAC,EACNZ,QAAQ;EAAA,GAbsBU,eAcL,CAAC;AAEjC","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":["describe","it","expect","ledgerLiveThemes","ThemeProvider","render","Svg","OVERFLOW_BUFFER","useRevealClip","RevealClipDefs","jsx","_jsx","drawingArea","x","y","width","height","series","id","stroke","data","ClipConsumer","clipPath","testID","renderInSvg","ui","themes","colorScheme","children","getByTestId","transitions","enter","duration","toBeTruthy","UNSAFE_root","clipPaths","findAllByType","length","toBeGreaterThan","rects","rect","props","toBe","left","top","bottom","consumer","findByProps","toMatch","animate","toHaveLength","toBeUndefined"],"sourceRoot":"../../../../../../src","sources":["lib/Components/CartesianChart/RevealClip/RevealClipDefs.test.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ,eAAe;AACpD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,MAAM,QAAQ,+BAA+B;AACtD,SAASC,GAAG,QAAQ,kBAAkB;AAGtC,SAASC,eAAe,QAAQ,aAAU;AAE1C,SAASC,aAAa,QAAQ,cAAW;AACzC,SAASC,cAAc,QAAQ,qBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAElD,MAAMC,WAAwB,GAAG;EAC/BC,CAAC,EAAE,EAAE;EACLC,CAAC,EAAE,EAAE;EACLC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE;AACV,CAAC;AAED,MAAMC,MAAgB,GAAG,CAAC;EAAEC,EAAE,EAAE,GAAG;EAAEC,MAAM,EAAE,MAAM;EAAEC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAAE,CAAC,CAAC;AAEvE,SAASC,YAAYA,CAAA,EAAG;EACtB,MAAMC,QAAQ,GAAGd,aAAa,CAAC,CAAC;EAChC,oBAAOG,IAAA,CAACL,GAAG;IAACiB,MAAM,EAAC,UAAU;IAACD,QAAQ,EAAEA;EAAS,CAAE,CAAC;AACtD;AAEA,MAAME,WAAW,GAAIC,EAAsB,IACzCpB,MAAM,cACJM,IAAA,CAACP,aAAa;EAACsB,MAAM,EAAEvB,gBAAiB;EAACwB,WAAW,EAAC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AACC,eAAe,CAAC,CAAC,CAAC;EAC7C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- import { createContext, useContext } from 'react';
4
- export const RevealClipContext = /*#__PURE__*/createContext(undefined);
5
- export const useRevealClip = () => {
6
- return useContext(RevealClipContext)?.clipPathAttr;
7
- };
8
- //# sourceMappingURL=context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["createContext","useContext","RevealClipContext","undefined","useRevealClip","clipPathAttr"],"sourceRoot":"../../../../../../src","sources":["lib/Components/CartesianChart/RevealClip/context.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,UAAU,QAAQ,OAAO;AAMjD,OAAO,MAAMC,iBAAiB,gBAAGF,aAAa,CAE5CG,SAAS,CAAC;AAEZ,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAA0B;EACrD,OAAOH,UAAU,CAACC,iBAAiB,CAAC,EAAEG,YAAY;AACpD,CAAC","ignoreList":[]}
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- export { RevealClipDefs } from "./RevealClipDefs.js";
4
- export { useRevealClip } from "./context.js";
5
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["RevealClipDefs","useRevealClip"],"sourceRoot":"../../../../../../src","sources":["lib/Components/CartesianChart/RevealClip/index.ts"],"mappings":";;AAAA,SAASA,cAAc,QAAQ,qBAAkB;AACjD,SAASC,aAAa,QAAQ,cAAW","ignoreList":[]}
@@ -1 +0,0 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../../../../src","sources":["lib/Components/CartesianChart/RevealClip/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,32 +0,0 @@
1
- "use strict";
2
-
3
- import { useEffect, useId } from 'react';
4
- import { useAnimatedProps, useSharedValue, withTiming } from 'react-native-reanimated';
5
- import { OVERFLOW_BUFFER } from "../utils.js";
6
- export const useRevealClipAnimation = ({
7
- durationMs,
8
- drawingArea,
9
- dataFingerprint
10
- }) => {
11
- const clipId = useId();
12
- const width = useSharedValue(0);
13
- useEffect(() => {
14
- width.value = 0;
15
- width.value = withTiming(drawingArea.width + OVERFLOW_BUFFER.left + OVERFLOW_BUFFER.right, {
16
- duration: durationMs
17
- });
18
- }, [drawingArea.width, durationMs, width, dataFingerprint]);
19
- const animatedRectProps = useAnimatedProps(() => ({
20
- width: width.value
21
- }));
22
- return {
23
- clipId,
24
- animatedRectProps
25
- };
26
- };
27
- export const useComputeDataFingerprint = ({
28
- series
29
- }) => {
30
- return series.map(s => s.data?.join(',') ?? '').join('|');
31
- };
32
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["useEffect","useId","useAnimatedProps","useSharedValue","withTiming","OVERFLOW_BUFFER","useRevealClipAnimation","durationMs","drawingArea","dataFingerprint","clipId","width","value","left","right","duration","animatedRectProps","useComputeDataFingerprint","series","map","s","data","join"],"sourceRoot":"../../../../../../src","sources":["lib/Components/CartesianChart/RevealClip/utils.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,KAAK,QAAQ,OAAO;AACxC,SACEC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,QACL,yBAAyB;AAGhC,SAASC,eAAe,QAAQ,aAAU;AAa1C,OAAO,MAAMC,sBAAsB,GAAGA,CAAC;EACrCC,UAAU;EACVC,WAAW;EACXC;AACyB,CAAC,KAAgC;EAC1D,MAAMC,MAAM,GAAGT,KAAK,CAAC,CAAC;EACtB,MAAMU,KAAK,GAAGR,cAAc,CAAC,CAAC,CAAC;EAE/BH,SAAS,CAAC,MAAM;IACdW,KAAK,CAACC,KAAK,GAAG,CAAC;IACfD,KAAK,CAACC,KAAK,GAAGR,UAAU,CACtBI,WAAW,CAACG,KAAK,GAAGN,eAAe,CAACQ,IAAI,GAAGR,eAAe,CAACS,KAAK,EAChE;MAAEC,QAAQ,EAAER;IAAW,CACzB,CAAC;EACH,CAAC,EAAE,CAACC,WAAW,CAACG,KAAK,EAAEJ,UAAU,EAAEI,KAAK,EAAEF,eAAe,CAAC,CAAC;EAE3D,MAAMO,iBAAiB,GAAGd,gBAAgB,CAAC,OAAO;IAChDS,KAAK,EAAEA,KAAK,CAACC;EACf,CAAC,CAAC,CAAC;EAEH,OAAO;IAAEF,MAAM;IAAEM;EAAkB,CAAC;AACtC,CAAC;AAED,OAAO,MAAMC,yBAAyB,GAAGA,CAAC;EACxCC;AAGF,CAAC,KAAa;EACZ,OAAOA,MAAM,CAACC,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,IAAI,EAAEC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAACA,IAAI,CAAC,GAAG,CAAC;AAC7D,CAAC","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- import type { RevealClipDefsProps } from './types';
2
- export declare function RevealClipDefs({ children, drawingArea, series, animate, transitions, }: RevealClipDefsProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
3
- //# sourceMappingURL=RevealClipDefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RevealClipDefs.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAOnD,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAc,EACd,WAAW,GACZ,EAAE,mBAAmB,2WA0CrB"}
@@ -1,7 +0,0 @@
1
- type RevealClipContextValue = {
2
- clipPathAttr: string;
3
- };
4
- export declare const RevealClipContext: import("react").Context<RevealClipContextValue | undefined>;
5
- export declare const useRevealClip: () => string | undefined;
6
- export {};
7
- //# sourceMappingURL=context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/CartesianChart/RevealClip/context.ts"],"names":[],"mappings":"AAEA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,6DAElB,CAAC;AAEb,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,SAEzC,CAAC"}
@@ -1,3 +0,0 @@
1
- export { RevealClipDefs } from './RevealClipDefs';
2
- export { useRevealClip } from './context';
3
- //# sourceMappingURL=index.d.ts.map