@coinbase/cds-web-visualization 3.4.0-beta.1 → 3.4.0-beta.10

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 (169) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dts/chart/CartesianChart.d.ts +38 -2
  3. package/dts/chart/CartesianChart.d.ts.map +1 -1
  4. package/dts/chart/Path.d.ts +27 -7
  5. package/dts/chart/Path.d.ts.map +1 -1
  6. package/dts/chart/PeriodSelector.d.ts +0 -4
  7. package/dts/chart/PeriodSelector.d.ts.map +1 -1
  8. package/dts/chart/area/Area.d.ts +54 -24
  9. package/dts/chart/area/Area.d.ts.map +1 -1
  10. package/dts/chart/area/AreaChart.d.ts +33 -6
  11. package/dts/chart/area/AreaChart.d.ts.map +1 -1
  12. package/dts/chart/area/DottedArea.d.ts +21 -44
  13. package/dts/chart/area/DottedArea.d.ts.map +1 -1
  14. package/dts/chart/area/GradientArea.d.ts +21 -12
  15. package/dts/chart/area/GradientArea.d.ts.map +1 -1
  16. package/dts/chart/area/SolidArea.d.ts +16 -1
  17. package/dts/chart/area/SolidArea.d.ts.map +1 -1
  18. package/dts/chart/axis/Axis.d.ts +92 -45
  19. package/dts/chart/axis/Axis.d.ts.map +1 -1
  20. package/dts/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
  21. package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
  22. package/dts/chart/axis/XAxis.d.ts +1 -1
  23. package/dts/chart/axis/XAxis.d.ts.map +1 -1
  24. package/dts/chart/axis/YAxis.d.ts +1 -1
  25. package/dts/chart/axis/YAxis.d.ts.map +1 -1
  26. package/dts/chart/axis/index.d.ts +1 -0
  27. package/dts/chart/axis/index.d.ts.map +1 -1
  28. package/dts/chart/bar/Bar.d.ts +16 -13
  29. package/dts/chart/bar/Bar.d.ts.map +1 -1
  30. package/dts/chart/bar/BarChart.d.ts +17 -8
  31. package/dts/chart/bar/BarChart.d.ts.map +1 -1
  32. package/dts/chart/bar/BarPlot.d.ts +2 -1
  33. package/dts/chart/bar/BarPlot.d.ts.map +1 -1
  34. package/dts/chart/bar/BarStack.d.ts +40 -48
  35. package/dts/chart/bar/BarStack.d.ts.map +1 -1
  36. package/dts/chart/bar/BarStackGroup.d.ts +1 -0
  37. package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
  38. package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
  39. package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
  40. package/dts/chart/gradient/Gradient.d.ts +35 -0
  41. package/dts/chart/gradient/Gradient.d.ts.map +1 -0
  42. package/dts/chart/gradient/index.d.ts +2 -0
  43. package/dts/chart/gradient/index.d.ts.map +1 -0
  44. package/dts/chart/index.d.ts +2 -1
  45. package/dts/chart/index.d.ts.map +1 -1
  46. package/dts/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
  47. package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
  48. package/dts/chart/line/DottedLine.d.ts +15 -3
  49. package/dts/chart/line/DottedLine.d.ts.map +1 -1
  50. package/dts/chart/line/Line.d.ts +70 -28
  51. package/dts/chart/line/Line.d.ts.map +1 -1
  52. package/dts/chart/line/LineChart.d.ts +26 -8
  53. package/dts/chart/line/LineChart.d.ts.map +1 -1
  54. package/dts/chart/line/ReferenceLine.d.ts +91 -44
  55. package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
  56. package/dts/chart/line/SolidLine.d.ts +14 -3
  57. package/dts/chart/line/SolidLine.d.ts.map +1 -1
  58. package/dts/chart/line/index.d.ts +1 -1
  59. package/dts/chart/line/index.d.ts.map +1 -1
  60. package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
  61. package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
  62. package/dts/chart/point/Point.d.ts +201 -0
  63. package/dts/chart/point/Point.d.ts.map +1 -0
  64. package/dts/chart/point/index.d.ts +3 -0
  65. package/dts/chart/point/index.d.ts.map +1 -0
  66. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +24 -0
  67. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
  68. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
  69. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
  70. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +10 -0
  71. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
  72. package/dts/chart/scrubber/Scrubber.d.ts +207 -66
  73. package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
  74. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +70 -0
  75. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
  76. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +32 -0
  77. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
  78. package/dts/chart/scrubber/index.d.ts +3 -0
  79. package/dts/chart/scrubber/index.d.ts.map +1 -1
  80. package/dts/chart/text/ChartText.d.ts +46 -43
  81. package/dts/chart/text/ChartText.d.ts.map +1 -1
  82. package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
  83. package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
  84. package/dts/chart/text/index.d.ts +1 -1
  85. package/dts/chart/text/index.d.ts.map +1 -1
  86. package/dts/chart/utils/chart.d.ts +27 -7
  87. package/dts/chart/utils/chart.d.ts.map +1 -1
  88. package/dts/chart/utils/context.d.ts +6 -0
  89. package/dts/chart/utils/context.d.ts.map +1 -1
  90. package/dts/chart/utils/gradient.d.ts +104 -0
  91. package/dts/chart/utils/gradient.d.ts.map +1 -0
  92. package/dts/chart/utils/index.d.ts +4 -0
  93. package/dts/chart/utils/index.d.ts.map +1 -1
  94. package/dts/chart/utils/interpolate.d.ts +112 -0
  95. package/dts/chart/utils/interpolate.d.ts.map +1 -0
  96. package/dts/chart/utils/path.d.ts +24 -1
  97. package/dts/chart/utils/path.d.ts.map +1 -1
  98. package/dts/chart/utils/point.d.ts +29 -0
  99. package/dts/chart/utils/point.d.ts.map +1 -1
  100. package/dts/chart/utils/scrubber.d.ts +39 -0
  101. package/dts/chart/utils/scrubber.d.ts.map +1 -0
  102. package/dts/chart/utils/transition.d.ts +65 -0
  103. package/dts/chart/utils/transition.d.ts.map +1 -0
  104. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -1
  105. package/esm/chart/CartesianChart.js +140 -85
  106. package/esm/chart/Path.js +53 -47
  107. package/esm/chart/PeriodSelector.js +4 -18
  108. package/esm/chart/area/Area.js +24 -34
  109. package/esm/chart/area/AreaChart.js +24 -15
  110. package/esm/chart/area/DottedArea.js +35 -89
  111. package/esm/chart/area/GradientArea.js +34 -80
  112. package/esm/chart/area/SolidArea.js +29 -11
  113. package/esm/chart/axis/Axis.js +4 -25
  114. package/esm/chart/axis/DefaultAxisTickLabel.js +15 -0
  115. package/esm/chart/axis/XAxis.js +76 -52
  116. package/esm/chart/axis/YAxis.js +80 -49
  117. package/esm/chart/axis/index.js +1 -0
  118. package/esm/chart/bar/Bar.js +3 -1
  119. package/esm/chart/bar/BarChart.js +15 -32
  120. package/esm/chart/bar/BarPlot.js +3 -2
  121. package/esm/chart/bar/BarStack.js +65 -23
  122. package/esm/chart/bar/BarStackGroup.js +7 -17
  123. package/esm/chart/bar/DefaultBar.js +4 -7
  124. package/esm/chart/bar/DefaultBarStack.js +5 -7
  125. package/esm/chart/gradient/Gradient.js +104 -0
  126. package/esm/chart/gradient/index.js +1 -0
  127. package/esm/chart/index.js +2 -1
  128. package/esm/chart/line/DefaultReferenceLineLabel.js +81 -0
  129. package/esm/chart/line/DottedLine.js +38 -17
  130. package/esm/chart/line/Line.js +96 -70
  131. package/esm/chart/line/LineChart.js +18 -6
  132. package/esm/chart/line/ReferenceLine.js +41 -43
  133. package/esm/chart/line/SolidLine.js +36 -15
  134. package/esm/chart/line/index.js +1 -1
  135. package/esm/chart/{line/GradientLine.js → point/DefaultPointLabel.js} +31 -45
  136. package/esm/chart/point/Point.css +2 -0
  137. package/esm/chart/{Point.js → point/Point.js} +66 -57
  138. package/esm/chart/point/index.js +2 -0
  139. package/esm/chart/scrubber/DefaultScrubberBeacon.js +155 -0
  140. package/esm/chart/scrubber/{ScrubberBeaconLabel.js → DefaultScrubberBeaconLabel.js} +23 -10
  141. package/esm/chart/scrubber/DefaultScrubberLabel.js +30 -0
  142. package/esm/chart/scrubber/Scrubber.js +98 -392
  143. package/esm/chart/scrubber/ScrubberBeaconGroup.js +166 -0
  144. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +186 -0
  145. package/esm/chart/scrubber/index.js +3 -1
  146. package/esm/chart/text/ChartText.js +13 -19
  147. package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +4 -3
  148. package/esm/chart/text/index.js +1 -1
  149. package/esm/chart/utils/chart.js +29 -3
  150. package/esm/chart/utils/gradient.js +257 -0
  151. package/esm/chart/utils/index.js +4 -0
  152. package/esm/chart/utils/interpolate.js +644 -0
  153. package/esm/chart/utils/path.js +32 -9
  154. package/esm/chart/utils/point.js +69 -0
  155. package/esm/chart/utils/scrubber.js +132 -0
  156. package/esm/chart/utils/transition.js +111 -0
  157. package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +8 -4
  158. package/package.json +9 -9
  159. package/dts/chart/Point.d.ts +0 -153
  160. package/dts/chart/Point.d.ts.map +0 -1
  161. package/dts/chart/line/GradientLine.d.ts +0 -42
  162. package/dts/chart/line/GradientLine.d.ts.map +0 -1
  163. package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -93
  164. package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
  165. package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts +0 -7
  166. package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts.map +0 -1
  167. package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
  168. package/esm/chart/Point.css +0 -2
  169. package/esm/chart/scrubber/ScrubberBeacon.js +0 -195
@@ -1,42 +0,0 @@
1
- import type { SharedProps } from '@coinbase/cds-common/types';
2
- import { type PathProps } from '../Path';
3
- import type { LineComponentProps } from './Line';
4
- export type GradientLineProps = SharedProps &
5
- Omit<PathProps, 'stroke' | 'strokeOpacity' | 'strokeWidth'> &
6
- Pick<LineComponentProps, 'strokeWidth'> & {
7
- /**
8
- * The color of the line.
9
- * @default 'var(--color-bgLine)'
10
- */
11
- stroke?: string;
12
- /**
13
- * Opacity of the line.
14
- * @default 1
15
- */
16
- strokeOpacity?: number;
17
- /**
18
- * The color of the start of the gradient.
19
- * @default stroke or 'var(--color-bgLine)'
20
- */
21
- startColor?: string;
22
- /**
23
- * The color of the end of the gradient.
24
- * @default stroke or 'var(--color-bgLine)'
25
- */
26
- endColor?: string;
27
- /**
28
- * Opacity of the start color.
29
- * @default strokeOpacity
30
- */
31
- startOpacity?: number;
32
- /**
33
- * Opacity of the end color.
34
- * @default strokeOpacity
35
- */
36
- endOpacity?: number;
37
- };
38
- /**
39
- * A gradient line component which uses path element.
40
- */
41
- export declare const GradientLine: import('react').NamedExoticComponent<GradientLineProps>;
42
- //# sourceMappingURL=GradientLine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GradientLine.d.ts","sourceRoot":"","sources":["../../../src/chart/line/GradientLine.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,MAAM,MAAM,iBAAiB,GAAG,WAAW,GACzC,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,eAAe,GAAG,aAAa,CAAC,GAC3D,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,GAAG;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,YAAY,yDAqCxB,CAAC"}
@@ -1,93 +0,0 @@
1
- import type { SharedProps } from '@coinbase/cds-common/types';
2
- export type ScrubberBeaconRef = {
3
- /**
4
- * Triggers a single pulse animation.
5
- * Only works when the scrubber is in idle state (not actively scrubbing).
6
- */
7
- pulse: () => void;
8
- };
9
- export type ScrubberBeaconProps = SharedProps & {
10
- /**
11
- * Optional data X coordinate to position the beacon.
12
- * If not provided, uses the scrubber position from context.
13
- */
14
- dataX?: number;
15
- /**
16
- * Optional data Y coordinate to position the beacon.
17
- * If not provided, looks up the Y value from series data at scrubber position.
18
- */
19
- dataY?: number;
20
- /**
21
- * Filter to only show dot for specific series (used for hover-based positioning).
22
- */
23
- seriesId?: string;
24
- /**
25
- * Color of the beacon point.
26
- * If not provided, uses the series color.
27
- */
28
- color?: string;
29
- /**
30
- * Opacity of the beacon.
31
- * @default 1
32
- */
33
- opacity?: number;
34
- /**
35
- * Pulse the scrubber beacon while it is at rest.
36
- */
37
- idlePulse?: boolean;
38
- /**
39
- * Custom className for styling.
40
- */
41
- className?: string;
42
- /**
43
- * Custom inline styles.
44
- */
45
- style?: React.CSSProperties;
46
- };
47
- /**
48
- * The ScrubberBeacon is a special instance of a Point used to mark the scrubber's position on a specific series.
49
- * It renders a glow effect around the point to highlight the scrubber position.
50
- */
51
- export declare const ScrubberBeacon: import('react').MemoExoticComponent<
52
- import('react').ForwardRefExoticComponent<
53
- SharedProps & {
54
- /**
55
- * Optional data X coordinate to position the beacon.
56
- * If not provided, uses the scrubber position from context.
57
- */
58
- dataX?: number;
59
- /**
60
- * Optional data Y coordinate to position the beacon.
61
- * If not provided, looks up the Y value from series data at scrubber position.
62
- */
63
- dataY?: number;
64
- /**
65
- * Filter to only show dot for specific series (used for hover-based positioning).
66
- */
67
- seriesId?: string;
68
- /**
69
- * Color of the beacon point.
70
- * If not provided, uses the series color.
71
- */
72
- color?: string;
73
- /**
74
- * Opacity of the beacon.
75
- * @default 1
76
- */
77
- opacity?: number;
78
- /**
79
- * Pulse the scrubber beacon while it is at rest.
80
- */
81
- idlePulse?: boolean;
82
- /**
83
- * Custom className for styling.
84
- */
85
- className?: string;
86
- /**
87
- * Custom inline styles.
88
- */
89
- style?: React.CSSProperties;
90
- } & import('react').RefAttributes<ScrubberBeaconRef>
91
- >
92
- >;
93
- //# sourceMappingURL=ScrubberBeacon.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScrubberBeacon.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeacon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAiB9D,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAMF,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc;IA1CzB;;;OAGG;YACK,MAAM;IACd;;;OAGG;YACK,MAAM;IACd;;OAEG;eACQ,MAAM;IACjB;;;OAGG;YACK,MAAM;IACd;;;OAGG;cACO,MAAM;IAChB;;OAEG;gBACS,OAAO;IACnB;;OAEG;gBACS,MAAM;IAClB;;OAEG;YACK,KAAK,CAAC,aAAa;sDAqM5B,CAAC"}
@@ -1,7 +0,0 @@
1
- import { type ChartTextProps } from '../text';
2
- export type ScrubberBeaconLabelProps = ChartTextProps;
3
- /**
4
- * The ScrubberBeaconLabel is a special instance of ChartText used to label a series' scrubber beacon (i.e. a point on the series pinned to the scrubber position).
5
- */
6
- export declare const ScrubberBeaconLabel: import('react').NamedExoticComponent<ChartTextProps>;
7
- //# sourceMappingURL=ScrubberBeaconLabel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScrubberBeaconLabel.d.ts","sourceRoot":"","sources":["../../../src/chart/scrubber/ScrubberBeaconLabel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC;AAEtD;;GAEG;AACH,eAAO,MAAM,mBAAmB,sDAsB/B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"SmartChartTextGroup.d.ts","sourceRoot":"","sources":["../../../src/chart/text/SmartChartTextGroup.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAa,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAErF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,CAAC,EAAE,MAAM,CAAC;IACV;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;CAC1C,CAAC;AAiBF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,gEAoM/B,CAAC"}
@@ -1,2 +0,0 @@
1
- .cds-containerCss-c137x6qr{outline:none;}
2
- .cds-innerPointCss-i1qyub1f{border-radius:var(--borderRadius-1000);outline:none;}.cds-innerPointCss-i1qyub1f:focus{outline:none;}.cds-innerPointCss-i1qyub1f:focus-visible{outline:2px solid var(--color-fgPrimary);outline-offset:2px;}
@@ -1,195 +0,0 @@
1
- import { forwardRef, memo, useImperativeHandle, useMemo } from 'react';
2
- import { m as motion, useAnimate } from 'framer-motion';
3
- import { useCartesianChartContext } from '../ChartProvider';
4
- import { projectPoint, useScrubberContext } from '../utils';
5
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- const pulseTransitionConfig = {
7
- duration: 2,
8
- repeat: Infinity,
9
- ease: 'easeInOut'
10
- };
11
- const singlePulseTransitionConfig = {
12
- duration: 1,
13
- ease: 'easeInOut'
14
- };
15
- const radius = 5;
16
- const glowRadius = 10;
17
- const pulseRadius = 15;
18
- /**
19
- * The ScrubberBeacon is a special instance of a Point used to mark the scrubber's position on a specific series.
20
- * It renders a glow effect around the point to highlight the scrubber position.
21
- */
22
- export const ScrubberBeacon = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
23
- var _ref2;
24
- let {
25
- seriesId,
26
- dataX: dataXProp,
27
- dataY: dataYProp,
28
- color,
29
- testID,
30
- idlePulse,
31
- opacity = 1,
32
- className,
33
- style
34
- } = _ref;
35
- const [scope, animate] = useAnimate();
36
- const {
37
- getSeries,
38
- getXScale,
39
- getYScale,
40
- getSeriesData,
41
- animate: animationEnabled
42
- } = useCartesianChartContext();
43
- const {
44
- scrubberPosition
45
- } = useScrubberContext();
46
- const targetSeries = getSeries(seriesId);
47
- const sourceData = getSeriesData(seriesId);
48
- const xScale = getXScale();
49
- const yScale = getYScale(targetSeries === null || targetSeries === void 0 ? void 0 : targetSeries.yAxisId);
50
- const isIdleState = scrubberPosition === undefined;
51
-
52
- // Expose imperative handle for triggering pulse animations
53
- useImperativeHandle(ref, () => ({
54
- pulse: () => {
55
- // Only pulse when idle
56
- if (isIdleState && scope.current) {
57
- animate(scope.current, {
58
- opacity: [0.1, 0]
59
- }, singlePulseTransitionConfig);
60
- }
61
- }
62
- }));
63
- const {
64
- dataX,
65
- dataY
66
- } = useMemo(() => {
67
- let x;
68
- let y;
69
- if (xScale && yScale) {
70
- if (dataXProp !== undefined && dataYProp !== undefined && !isNaN(dataYProp) && !isNaN(dataXProp)) {
71
- // Use direct coordinates if provided
72
- x = dataXProp;
73
- y = dataYProp;
74
- } else if (sourceData && scrubberPosition != null && scrubberPosition >= 0 && scrubberPosition < sourceData.length) {
75
- // Use series data at highlight index
76
- x = scrubberPosition;
77
- const dataValue = sourceData[scrubberPosition];
78
- if (typeof dataValue === 'number') {
79
- y = dataValue;
80
- } else if (Array.isArray(dataValue)) {
81
- const validValues = dataValue.filter(val => val !== null);
82
- if (validValues.length >= 2) {
83
- y = validValues[1];
84
- }
85
- }
86
- }
87
- }
88
- return {
89
- dataX: x,
90
- dataY: y
91
- };
92
- }, [dataXProp, dataYProp, sourceData, scrubberPosition, xScale, yScale]);
93
- const pixelCoordinate = useMemo(() => {
94
- if (!xScale || !yScale || dataX === undefined || dataY === undefined) {
95
- return null;
96
- }
97
- return projectPoint({
98
- x: dataX,
99
- y: dataY,
100
- xScale,
101
- yScale
102
- });
103
- }, [xScale, yScale, dataX, dataY]);
104
- if (!pixelCoordinate) {
105
- return null;
106
- }
107
- const pointColor = (_ref2 = color !== null && color !== void 0 ? color : targetSeries === null || targetSeries === void 0 ? void 0 : targetSeries.color) !== null && _ref2 !== void 0 ? _ref2 : 'var(--color-fgPrimary)';
108
- const shouldPulse = animationEnabled && isIdleState && idlePulse;
109
- if (animationEnabled && isIdleState) {
110
- return /*#__PURE__*/_jsxs("g", {
111
- "data-testid": testID,
112
- opacity: opacity,
113
- children: [/*#__PURE__*/_jsx(motion.circle, {
114
- animate: {
115
- cx: pixelCoordinate.x,
116
- cy: pixelCoordinate.y
117
- },
118
- cx: pixelCoordinate.x,
119
- cy: pixelCoordinate.y,
120
- fill: pointColor,
121
- initial: false,
122
- opacity: 0.15,
123
- r: glowRadius,
124
- transition: {
125
- duration: 0.3,
126
- ease: 'easeInOut'
127
- }
128
- }), /*#__PURE__*/_jsx(motion.g, {
129
- animate: {
130
- x: pixelCoordinate.x,
131
- y: pixelCoordinate.y
132
- },
133
- initial: false,
134
- transition: {
135
- duration: 0.3,
136
- ease: 'easeInOut'
137
- },
138
- children: /*#__PURE__*/_jsx(motion.circle, {
139
- ref: scope,
140
- animate: shouldPulse ? {
141
- opacity: [0.1, 0, 0.1],
142
- transition: pulseTransitionConfig
143
- } : {
144
- opacity: 0
145
- },
146
- cx: 0,
147
- cy: 0,
148
- fill: pointColor,
149
- initial: {
150
- opacity: shouldPulse ? 0.1 : 0
151
- },
152
- r: pulseRadius
153
- })
154
- }), /*#__PURE__*/_jsx(motion.circle, {
155
- animate: {
156
- cx: pixelCoordinate.x,
157
- cy: pixelCoordinate.y
158
- },
159
- className: className,
160
- cx: pixelCoordinate.x,
161
- cy: pixelCoordinate.y,
162
- fill: pointColor,
163
- initial: false,
164
- r: radius,
165
- stroke: "var(--color-bg)",
166
- strokeWidth: 2,
167
- style: style,
168
- transition: {
169
- duration: 0.3,
170
- ease: 'easeInOut'
171
- }
172
- })]
173
- });
174
- }
175
- return /*#__PURE__*/_jsxs("g", {
176
- "data-testid": testID,
177
- opacity: opacity,
178
- children: [/*#__PURE__*/_jsx("circle", {
179
- cx: pixelCoordinate.x,
180
- cy: pixelCoordinate.y,
181
- fill: pointColor,
182
- opacity: 0.15,
183
- r: glowRadius
184
- }), /*#__PURE__*/_jsx("circle", {
185
- className: className,
186
- cx: pixelCoordinate.x,
187
- cy: pixelCoordinate.y,
188
- fill: pointColor,
189
- r: radius,
190
- stroke: "var(--color-bg)",
191
- strokeWidth: 2,
192
- style: style
193
- })]
194
- });
195
- }));