@coinbase/cds-web-visualization 3.4.0-beta.2 → 3.4.0-beta.21

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 (198) hide show
  1. package/CHANGELOG.md +122 -0
  2. package/dts/chart/CartesianChart.d.ts +56 -3
  3. package/dts/chart/CartesianChart.d.ts.map +1 -1
  4. package/dts/chart/ChartProvider.d.ts +3 -0
  5. package/dts/chart/ChartProvider.d.ts.map +1 -1
  6. package/dts/chart/Path.d.ts +64 -7
  7. package/dts/chart/Path.d.ts.map +1 -1
  8. package/dts/chart/PeriodSelector.d.ts +5 -15
  9. package/dts/chart/PeriodSelector.d.ts.map +1 -1
  10. package/dts/chart/area/Area.d.ts +50 -25
  11. package/dts/chart/area/Area.d.ts.map +1 -1
  12. package/dts/chart/area/AreaChart.d.ts +46 -6
  13. package/dts/chart/area/AreaChart.d.ts.map +1 -1
  14. package/dts/chart/area/DottedArea.d.ts +21 -44
  15. package/dts/chart/area/DottedArea.d.ts.map +1 -1
  16. package/dts/chart/area/GradientArea.d.ts +21 -12
  17. package/dts/chart/area/GradientArea.d.ts.map +1 -1
  18. package/dts/chart/area/SolidArea.d.ts +16 -1
  19. package/dts/chart/area/SolidArea.d.ts.map +1 -1
  20. package/dts/chart/axis/Axis.d.ts +109 -63
  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 +50 -12
  31. package/dts/chart/bar/Bar.d.ts.map +1 -1
  32. package/dts/chart/bar/BarChart.d.ts +20 -8
  33. package/dts/chart/bar/BarChart.d.ts.map +1 -1
  34. package/dts/chart/bar/BarPlot.d.ts +3 -1
  35. package/dts/chart/bar/BarPlot.d.ts.map +1 -1
  36. package/dts/chart/bar/BarStack.d.ts +41 -46
  37. package/dts/chart/bar/BarStack.d.ts.map +1 -1
  38. package/dts/chart/bar/BarStackGroup.d.ts +2 -0
  39. package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
  40. package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
  41. package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
  42. package/dts/chart/gradient/Gradient.d.ts +35 -0
  43. package/dts/chart/gradient/Gradient.d.ts.map +1 -0
  44. package/dts/chart/gradient/index.d.ts +2 -0
  45. package/dts/chart/gradient/index.d.ts.map +1 -0
  46. package/dts/chart/index.d.ts +3 -1
  47. package/dts/chart/index.d.ts.map +1 -1
  48. package/dts/chart/legend/DefaultLegendEntry.d.ts +21 -0
  49. package/dts/chart/legend/DefaultLegendEntry.d.ts.map +1 -0
  50. package/dts/chart/legend/DefaultLegendShape.d.ts +7 -0
  51. package/dts/chart/legend/DefaultLegendShape.d.ts.map +1 -0
  52. package/dts/chart/legend/Legend.d.ts +169 -0
  53. package/dts/chart/legend/Legend.d.ts.map +1 -0
  54. package/dts/chart/legend/index.d.ts +4 -0
  55. package/dts/chart/legend/index.d.ts.map +1 -0
  56. package/dts/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
  57. package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
  58. package/dts/chart/line/DottedLine.d.ts +15 -3
  59. package/dts/chart/line/DottedLine.d.ts.map +1 -1
  60. package/dts/chart/line/Line.d.ts +84 -28
  61. package/dts/chart/line/Line.d.ts.map +1 -1
  62. package/dts/chart/line/LineChart.d.ts +28 -8
  63. package/dts/chart/line/LineChart.d.ts.map +1 -1
  64. package/dts/chart/line/ReferenceLine.d.ts +99 -44
  65. package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
  66. package/dts/chart/line/SolidLine.d.ts +14 -3
  67. package/dts/chart/line/SolidLine.d.ts.map +1 -1
  68. package/dts/chart/line/index.d.ts +1 -1
  69. package/dts/chart/line/index.d.ts.map +1 -1
  70. package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
  71. package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
  72. package/dts/chart/point/Point.d.ts +217 -0
  73. package/dts/chart/point/Point.d.ts.map +1 -0
  74. package/dts/chart/point/index.d.ts +3 -0
  75. package/dts/chart/point/index.d.ts.map +1 -0
  76. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +41 -0
  77. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
  78. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
  79. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
  80. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +10 -0
  81. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
  82. package/dts/chart/scrubber/Scrubber.d.ts +303 -70
  83. package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
  84. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +80 -0
  85. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
  86. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +56 -0
  87. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
  88. package/dts/chart/scrubber/index.d.ts +3 -0
  89. package/dts/chart/scrubber/index.d.ts.map +1 -1
  90. package/dts/chart/text/ChartText.d.ts +46 -43
  91. package/dts/chart/text/ChartText.d.ts.map +1 -1
  92. package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
  93. package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
  94. package/dts/chart/text/index.d.ts +1 -1
  95. package/dts/chart/text/index.d.ts.map +1 -1
  96. package/dts/chart/utils/axis.d.ts +25 -1
  97. package/dts/chart/utils/axis.d.ts.map +1 -1
  98. package/dts/chart/utils/bar.d.ts +34 -0
  99. package/dts/chart/utils/bar.d.ts.map +1 -1
  100. package/dts/chart/utils/chart.d.ts +45 -7
  101. package/dts/chart/utils/chart.d.ts.map +1 -1
  102. package/dts/chart/utils/context.d.ts +6 -0
  103. package/dts/chart/utils/context.d.ts.map +1 -1
  104. package/dts/chart/utils/gradient.d.ts +104 -0
  105. package/dts/chart/utils/gradient.d.ts.map +1 -0
  106. package/dts/chart/utils/index.d.ts +4 -0
  107. package/dts/chart/utils/index.d.ts.map +1 -1
  108. package/dts/chart/utils/interpolate.d.ts +112 -0
  109. package/dts/chart/utils/interpolate.d.ts.map +1 -0
  110. package/dts/chart/utils/path.d.ts +30 -1
  111. package/dts/chart/utils/path.d.ts.map +1 -1
  112. package/dts/chart/utils/point.d.ts +40 -7
  113. package/dts/chart/utils/point.d.ts.map +1 -1
  114. package/dts/chart/utils/scale.d.ts +11 -0
  115. package/dts/chart/utils/scale.d.ts.map +1 -1
  116. package/dts/chart/utils/scrubber.d.ts +40 -0
  117. package/dts/chart/utils/scrubber.d.ts.map +1 -0
  118. package/dts/chart/utils/transition.d.ts +101 -0
  119. package/dts/chart/utils/transition.d.ts.map +1 -0
  120. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -1
  121. package/esm/chart/CartesianChart.js +170 -83
  122. package/esm/chart/ChartProvider.js +2 -2
  123. package/esm/chart/Path.js +59 -54
  124. package/esm/chart/PeriodSelector.js +36 -32
  125. package/esm/chart/area/Area.js +26 -34
  126. package/esm/chart/area/AreaChart.js +29 -15
  127. package/esm/chart/area/DottedArea.js +39 -89
  128. package/esm/chart/area/GradientArea.js +37 -80
  129. package/esm/chart/area/SolidArea.js +32 -11
  130. package/esm/chart/axis/Axis.js +4 -39
  131. package/esm/chart/axis/DefaultAxisTickLabel.js +15 -0
  132. package/esm/chart/axis/XAxis.js +184 -63
  133. package/esm/chart/axis/YAxis.js +190 -57
  134. package/esm/chart/axis/index.js +1 -0
  135. package/esm/chart/bar/Bar.js +7 -1
  136. package/esm/chart/bar/BarChart.js +17 -32
  137. package/esm/chart/bar/BarPlot.js +5 -2
  138. package/esm/chart/bar/BarStack.js +74 -22
  139. package/esm/chart/bar/BarStackGroup.js +8 -18
  140. package/esm/chart/bar/DefaultBar.js +23 -28
  141. package/esm/chart/bar/DefaultBarStack.js +24 -20
  142. package/esm/chart/gradient/Gradient.js +104 -0
  143. package/esm/chart/gradient/index.js +1 -0
  144. package/esm/chart/index.js +3 -1
  145. package/esm/chart/legend/DefaultLegendEntry.css +1 -0
  146. package/esm/chart/legend/DefaultLegendEntry.js +50 -0
  147. package/esm/chart/legend/DefaultLegendShape.css +5 -0
  148. package/esm/chart/legend/DefaultLegendShape.js +47 -0
  149. package/esm/chart/legend/Legend.js +76 -0
  150. package/esm/chart/legend/index.js +3 -0
  151. package/esm/chart/line/DefaultReferenceLineLabel.js +81 -0
  152. package/esm/chart/line/DottedLine.js +41 -17
  153. package/esm/chart/line/Line.js +87 -75
  154. package/esm/chart/line/LineChart.js +24 -8
  155. package/esm/chart/line/ReferenceLine.js +45 -43
  156. package/esm/chart/line/SolidLine.js +39 -15
  157. package/esm/chart/line/index.js +1 -1
  158. package/esm/chart/{line/GradientLine.js → point/DefaultPointLabel.js} +31 -45
  159. package/esm/chart/point/Point.css +2 -0
  160. package/esm/chart/{Point.js → point/Point.js} +87 -62
  161. package/esm/chart/point/index.js +2 -0
  162. package/esm/chart/scrubber/DefaultScrubberBeacon.js +154 -0
  163. package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +57 -0
  164. package/esm/chart/scrubber/{ScrubberBeaconLabel.js → DefaultScrubberLabel.js} +15 -18
  165. package/esm/chart/scrubber/Scrubber.js +101 -392
  166. package/esm/chart/scrubber/ScrubberBeaconGroup.js +174 -0
  167. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +209 -0
  168. package/esm/chart/scrubber/index.js +3 -1
  169. package/esm/chart/text/ChartText.js +15 -20
  170. package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +4 -3
  171. package/esm/chart/text/index.js +1 -1
  172. package/esm/chart/utils/axis.js +47 -31
  173. package/esm/chart/utils/bar.js +48 -0
  174. package/esm/chart/utils/chart.js +42 -3
  175. package/esm/chart/utils/gradient.js +257 -0
  176. package/esm/chart/utils/index.js +4 -0
  177. package/esm/chart/utils/interpolate.js +644 -0
  178. package/esm/chart/utils/path.js +41 -9
  179. package/esm/chart/utils/point.js +99 -12
  180. package/esm/chart/utils/scale.js +13 -2
  181. package/esm/chart/utils/scrubber.js +137 -0
  182. package/esm/chart/utils/transition.js +133 -0
  183. package/esm/sparkline/__figma__/Sparkline.figma.js +1 -1
  184. package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +8 -4
  185. package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +1 -1
  186. package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +1 -1
  187. package/package.json +12 -11
  188. package/dts/chart/Point.d.ts +0 -153
  189. package/dts/chart/Point.d.ts.map +0 -1
  190. package/dts/chart/line/GradientLine.d.ts +0 -42
  191. package/dts/chart/line/GradientLine.d.ts.map +0 -1
  192. package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -93
  193. package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
  194. package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts +0 -7
  195. package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts.map +0 -1
  196. package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
  197. package/esm/chart/Point.css +0 -2
  198. package/esm/chart/scrubber/ScrubberBeacon.js +0 -195
@@ -1,4 +1,4 @@
1
- const _excluded = ["d", "fill", "fillOpacity", "peakColor", "baselineColor", "peakOpacity", "baselineOpacity", "baseline", "yAxisId"];
1
+ const _excluded = ["d", "fill", "fillOpacity", "peakOpacity", "baselineOpacity", "baseline", "yAxisId", "gradient", "animate", "transitions", "transition"];
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -6,106 +6,63 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
6
6
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
8
8
  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; }
9
- import { memo, useId } from 'react';
9
+ import { memo, useId, useMemo } from 'react';
10
10
  import { useCartesianChartContext } from '../ChartProvider';
11
+ import { Gradient } from '../gradient';
11
12
  import { Path } from '../Path';
13
+ import { createGradient, getBaseline } from '../utils';
12
14
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
15
  /**
14
- * A customizable gradient area component which uses Path.
16
+ * A customizable gradient area component which uses Path with SVG linearGradient.
17
+ *
18
+ * When no gradient is provided, automatically creates an appropriate gradient:
19
+ * - For data crossing zero: Creates a diverging gradient with peak opacity at both extremes
20
+ * and baseline opacity at zero (or the specified baseline).
21
+ * - For all-positive or all-negative data: Creates a simple gradient from baseline to peak.
15
22
  */
16
23
  export const GradientArea = /*#__PURE__*/memo(_ref => {
24
+ var _transitions$update;
17
25
  let {
18
26
  d,
19
27
  fill = 'var(--color-fgPrimary)',
20
28
  fillOpacity = 1,
21
- peakColor,
22
- baselineColor,
23
29
  peakOpacity = 0.3,
24
30
  baselineOpacity = 0,
25
31
  baseline,
26
- yAxisId
32
+ yAxisId,
33
+ gradient: gradientProp,
34
+ animate,
35
+ transitions,
36
+ transition
27
37
  } = _ref,
28
38
  pathProps = _objectWithoutProperties(_ref, _excluded);
29
- const context = useCartesianChartContext();
39
+ const {
40
+ getYAxis
41
+ } = useCartesianChartContext();
30
42
  const patternId = useId();
31
-
32
- // Get the y-scale for the specified axis (or default)
33
- const yScale = context.getYScale(yAxisId);
34
- const yRange = yScale === null || yScale === void 0 ? void 0 : yScale.range();
35
- const yDomain = yScale === null || yScale === void 0 ? void 0 : yScale.domain();
36
-
37
- // Use chart range if available, otherwise fall back to percentage
38
- const useUserSpaceUnits = yRange !== undefined;
39
- const gradientY1 = useUserSpaceUnits ? yRange[1] : '0%';
40
- const gradientY2 = useUserSpaceUnits ? yRange[0] : '100%';
41
-
42
- // Auto-calculate baseline position based on domain
43
- let baselinePosition;
44
- let baselinePercentage;
45
- if (yScale && yDomain) {
46
- const [minValue, maxValue] = yDomain;
47
- let dataBaseline;
48
- if (minValue >= 0) {
49
- // All positive: baseline at min
50
- dataBaseline = minValue;
51
- } else if (maxValue <= 0) {
52
- // All negative: baseline at max
53
- dataBaseline = maxValue;
54
- } else {
55
- // Crosses zero: baseline at 0
56
- dataBaseline = 0;
57
- }
58
- if (useUserSpaceUnits) {
59
- // Get the actual y coordinate for the baseline
60
- const scaledValue = yScale(baseline !== null && baseline !== void 0 ? baseline : dataBaseline);
61
- if (typeof scaledValue === 'number') {
62
- baselinePosition = scaledValue;
63
- }
64
- } else {
65
- // Calculate percentage position
66
- baselinePercentage = "".concat((maxValue - (baseline !== null && baseline !== void 0 ? baseline : dataBaseline)) / (maxValue - minValue) * 100, "%");
67
- }
68
- }
69
- const effectivePeakColor = peakColor !== null && peakColor !== void 0 ? peakColor : fill;
70
- const effectiveBaselineColor = baselineColor !== null && baselineColor !== void 0 ? baselineColor : fill;
43
+ const yAxisConfig = getYAxis(yAxisId);
44
+ const gradient = useMemo(() => {
45
+ if (gradientProp) return gradientProp;
46
+ if (!yAxisConfig) return;
47
+ const baselineValue = getBaseline(yAxisConfig.domain, baseline);
48
+ return createGradient(yAxisConfig.domain, baselineValue, fill, peakOpacity, baselineOpacity);
49
+ }, [gradientProp, yAxisConfig, fill, baseline, peakOpacity, baselineOpacity]);
71
50
  return /*#__PURE__*/_jsxs(_Fragment, {
72
- children: [/*#__PURE__*/_jsx("defs", {
73
- children: /*#__PURE__*/_jsx("linearGradient", {
74
- gradientUnits: useUserSpaceUnits ? 'userSpaceOnUse' : 'objectBoundingBox',
51
+ children: [gradient && /*#__PURE__*/_jsx("defs", {
52
+ children: /*#__PURE__*/_jsx(Gradient, {
53
+ animate: animate,
54
+ gradient: gradient,
75
55
  id: patternId,
76
- x1: useUserSpaceUnits ? 0 : '0%',
77
- x2: useUserSpaceUnits ? 0 : '0%',
78
- y1: gradientY1,
79
- y2: gradientY2,
80
- children: baselinePosition !== undefined || baselinePercentage !== undefined ? /*#__PURE__*/_jsxs(_Fragment, {
81
- children: [/*#__PURE__*/_jsx("stop", {
82
- offset: "0%",
83
- stopColor: effectivePeakColor,
84
- stopOpacity: peakOpacity
85
- }), /*#__PURE__*/_jsx("stop", {
86
- offset: baselinePercentage !== null && baselinePercentage !== void 0 ? baselinePercentage : "".concat((baselinePosition - yRange[1]) / (yRange[0] - yRange[1]) * 100, "%"),
87
- stopColor: effectiveBaselineColor,
88
- stopOpacity: baselineOpacity
89
- }), /*#__PURE__*/_jsx("stop", {
90
- offset: "100%",
91
- stopColor: effectivePeakColor,
92
- stopOpacity: peakOpacity
93
- })]
94
- }) : /*#__PURE__*/_jsxs(_Fragment, {
95
- children: [/*#__PURE__*/_jsx("stop", {
96
- offset: "0%",
97
- stopColor: effectivePeakColor,
98
- stopOpacity: peakOpacity
99
- }), /*#__PURE__*/_jsx("stop", {
100
- offset: "100%",
101
- stopColor: effectiveBaselineColor,
102
- stopOpacity: baselineOpacity
103
- })]
104
- })
56
+ transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
57
+ yAxisId: yAxisId
105
58
  })
106
59
  }), /*#__PURE__*/_jsx(Path, _objectSpread({
60
+ animate: animate,
107
61
  d: d,
108
- fill: "url(#".concat(patternId, ")")
62
+ fill: gradient ? "url(#".concat(patternId, ")") : fill,
63
+ fillOpacity: fillOpacity,
64
+ transition: transition,
65
+ transitions: transitions
109
66
  }, pathProps))]
110
67
  });
111
68
  });
@@ -1,4 +1,4 @@
1
- const _excluded = ["d", "fill", "fillOpacity", "yAxisId", "baseline"];
1
+ const _excluded = ["d", "fill", "fillOpacity", "yAxisId", "animate", "transitions", "transition", "gradient"];
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -6,24 +6,45 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
6
6
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
8
8
  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; }
9
- import { memo } from 'react';
9
+ import { memo, useId } from 'react';
10
+ import { Gradient } from '../gradient';
10
11
  import { Path } from '../Path';
11
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
12
13
  /**
13
14
  * A customizable solid area component which uses Path.
15
+ * When a gradient is provided, renders with gradient fill.
16
+ * Otherwise, renders with solid fill.
14
17
  */
15
18
  export const SolidArea = /*#__PURE__*/memo(_ref => {
19
+ var _transitions$update;
16
20
  let {
17
21
  d,
18
- fill,
22
+ fill = 'var(--color-fgPrimary)',
19
23
  fillOpacity = 1,
20
24
  yAxisId,
21
- baseline
25
+ animate,
26
+ transitions,
27
+ transition,
28
+ gradient
22
29
  } = _ref,
23
- props = _objectWithoutProperties(_ref, _excluded);
24
- return /*#__PURE__*/_jsx(Path, _objectSpread({
25
- d: d,
26
- fill: fill,
27
- fillOpacity: fillOpacity
28
- }, props));
30
+ pathProps = _objectWithoutProperties(_ref, _excluded);
31
+ const patternId = useId();
32
+ return /*#__PURE__*/_jsxs(_Fragment, {
33
+ children: [gradient && /*#__PURE__*/_jsx("defs", {
34
+ children: /*#__PURE__*/_jsx(Gradient, {
35
+ animate: animate,
36
+ gradient: gradient,
37
+ id: patternId,
38
+ transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
39
+ yAxisId: yAxisId
40
+ })
41
+ }), /*#__PURE__*/_jsx(Path, _objectSpread({
42
+ animate: animate,
43
+ d: d,
44
+ fill: gradient ? "url(#".concat(patternId, ")") : fill,
45
+ fillOpacity: fillOpacity,
46
+ transition: transition,
47
+ transitions: transitions
48
+ }, pathProps))]
49
+ });
29
50
  });
@@ -1,46 +1,11 @@
1
+ import { accessoryFadeTransitionDuration } from '../utils';
1
2
  export const axisLineStyles = "\n stroke: var(--color-fg);\n stroke-linecap: square;\n stroke-width: 1px;\n";
2
3
  export const axisTickMarkStyles = "\n stroke: var(--color-fg);\n stroke-linecap: square;\n stroke-width: 1px;\n";
3
4
 
4
- /**
5
- * Animation variants for grouped axis tick labels - initial mount
6
- */
7
- export const axisTickLabelsInitialAnimationVariants = {
8
- initial: {
9
- opacity: 0
10
- },
11
- animate: {
12
- opacity: 1,
13
- transition: {
14
- duration: 0.15,
15
- delay: 0.85 // Initial animation: wait 850ms then fade in over 150ms
16
- }
17
- },
18
- exit: {
19
- opacity: 0,
20
- transition: {
21
- duration: 0.15
22
- }
23
- }
24
- };
25
-
26
5
  /**
27
6
  * Animation variants for axis elements - updates (used for both grid lines and tick labels)
28
7
  */
29
- export const axisUpdateAnimationVariants = {
30
- initial: {
31
- opacity: 0
32
- },
33
- animate: {
34
- opacity: 1,
35
- transition: {
36
- duration: 0.15,
37
- delay: 0.15 // For updates: fade out 150ms, then fade in 150ms
38
- }
39
- },
40
- exit: {
41
- opacity: 0,
42
- transition: {
43
- duration: 0.15
44
- }
45
- }
8
+ export const axisUpdateAnimationTransition = {
9
+ duration: accessoryFadeTransitionDuration,
10
+ ease: 'easeOut'
46
11
  };
@@ -0,0 +1,15 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ import { memo } from 'react';
7
+ import { ChartText } from '../text';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ /**
10
+ * DefaultAxisTickLabel is the default label component for axis tick labels.
11
+ * Provides standard styling for both X and Y axis tick labels.
12
+ */
13
+ export const DefaultAxisTickLabel = /*#__PURE__*/memo(props => {
14
+ return /*#__PURE__*/_jsx(ChartText, _objectSpread({}, props));
15
+ });
@@ -1,4 +1,4 @@
1
- const _excluded = ["position", "showGrid", "requestedTickCount", "ticks", "tickLabelFormatter", "style", "className", "styles", "classNames", "GridLineComponent", "tickMarkLabelGap", "height", "minTickLabelGap", "showTickMarks", "showLine", "tickMarkSize", "tickInterval", "tickMinStep", "tickMaxStep"];
1
+ const _excluded = ["position", "showGrid", "requestedTickCount", "ticks", "tickLabelFormatter", "TickLabelComponent", "style", "className", "styles", "classNames", "GridLineComponent", "LineComponent", "TickMarkLineComponent", "tickMarkLabelGap", "minTickLabelGap", "showTickMarks", "showLine", "tickMarkSize", "tickInterval", "tickMinStep", "tickMaxStep", "label", "labelGap", "height", "testID", "bandGridLinePlacement", "bandTickMarkPlacement"];
2
2
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
3
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -8,14 +8,18 @@ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i
8
8
  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; }
9
9
  import { memo, useCallback, useEffect, useId, useMemo } from 'react';
10
10
  import { cx } from '@coinbase/cds-web';
11
- import { AnimatePresence, m as motion } from 'framer-motion';
11
+ import { m as motion } from 'framer-motion';
12
12
  import { useCartesianChartContext } from '../ChartProvider';
13
13
  import { DottedLine } from '../line/DottedLine';
14
- import { ReferenceLine } from '../line/ReferenceLine';
15
- import { SmartChartTextGroup } from '../text/SmartChartTextGroup';
16
- import { getAxisTicksData, isCategoricalScale } from '../utils';
17
- import { axisLineStyles, axisTickLabelsInitialAnimationVariants, axisTickMarkStyles, axisUpdateAnimationVariants } from './Axis';
14
+ import { SolidLine } from '../line/SolidLine';
15
+ import { ChartText } from '../text/ChartText';
16
+ import { ChartTextGroup } from '../text/ChartTextGroup';
17
+ import { getAxisTicksData, getPointOnScale, isCategoricalScale, lineToPath, toPointAnchor } from '../utils';
18
+ import { axisLineStyles, axisTickMarkStyles, axisUpdateAnimationTransition } from './Axis';
19
+ import { DefaultAxisTickLabel } from './DefaultAxisTickLabel';
18
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
+ const AXIS_HEIGHT = 32;
22
+ const LABEL_SIZE = 20;
19
23
  const axisTickMarkCss = "cds-axisTickMarkCss-a6j4s2q";
20
24
  const axisLineCss = "cds-axisLineCss-a12llxjj";
21
25
  export const XAxis = /*#__PURE__*/memo(_ref => {
@@ -25,20 +29,28 @@ export const XAxis = /*#__PURE__*/memo(_ref => {
25
29
  requestedTickCount,
26
30
  ticks,
27
31
  tickLabelFormatter,
32
+ TickLabelComponent = DefaultAxisTickLabel,
28
33
  style,
29
34
  className,
30
35
  styles,
31
36
  classNames,
32
37
  GridLineComponent = DottedLine,
38
+ LineComponent = SolidLine,
39
+ TickMarkLineComponent = SolidLine,
33
40
  tickMarkLabelGap = 2,
34
- height = 32,
35
41
  minTickLabelGap = 4,
36
42
  showTickMarks,
37
43
  showLine,
38
44
  tickMarkSize = 4,
39
45
  tickInterval = 32,
40
46
  tickMinStep = 1,
41
- tickMaxStep
47
+ tickMaxStep,
48
+ label,
49
+ labelGap = 4,
50
+ height = label ? AXIS_HEIGHT + LABEL_SIZE : AXIS_HEIGHT,
51
+ testID = 'x-axis',
52
+ bandGridLinePlacement = 'edges',
53
+ bandTickMarkPlacement = 'middle'
42
54
  } = _ref,
43
55
  props = _objectWithoutProperties(_ref, _excluded);
44
56
  const registrationId = useId();
@@ -48,7 +60,8 @@ export const XAxis = /*#__PURE__*/memo(_ref => {
48
60
  getXAxis,
49
61
  registerAxis,
50
62
  unregisterAxis,
51
- getAxisBounds
63
+ getAxisBounds,
64
+ drawingArea
52
65
  } = useCartesianChartContext();
53
66
  const xScale = getXScale();
54
67
  const xAxis = getXAxis();
@@ -89,12 +102,6 @@ export const XAxis = /*#__PURE__*/memo(_ref => {
89
102
  const domain = xScale.domain();
90
103
  categories = domain.map(String);
91
104
  }
92
- let possibleTickValues;
93
-
94
- // If we have discrete data, we can use the indices as possible tick values
95
- if (axisData && Array.isArray(axisData) && (typeof axisData[0] === 'string' || typeof axisData[0] === 'number' && isCategoricalScale(xScale))) possibleTickValues = Array.from({
96
- length: axisData.length
97
- }, (_, i) => i);
98
105
  return getAxisTicksData({
99
106
  scaleFunction: xScale,
100
107
  ticks,
@@ -110,13 +117,79 @@ export const XAxis = /*#__PURE__*/memo(_ref => {
110
117
  }
111
118
  });
112
119
  }, [ticks, xScale, requestedTickCount, tickInterval, tickMinStep, tickMaxStep, xAxis === null || xAxis === void 0 ? void 0 : xAxis.data]);
120
+ const isBandScale = useMemo(() => {
121
+ if (!xScale) return false;
122
+ return isCategoricalScale(xScale);
123
+ }, [xScale]);
124
+
125
+ // Compute grid line positions (including bounds closing line for band scales)
126
+ const gridLinePositions = useMemo(() => {
127
+ if (!xScale) return [];
128
+ return ticksData.flatMap((tick, index) => {
129
+ if (!isBandScale) {
130
+ return [{
131
+ x: tick.position,
132
+ key: "grid-".concat(tick.tick, "-").concat(index)
133
+ }];
134
+ }
135
+ const bandScale = xScale;
136
+ const isLastTick = index === ticksData.length - 1;
137
+ const isEdges = bandGridLinePlacement === 'edges';
138
+ const startX = getPointOnScale(tick.tick, bandScale, toPointAnchor(bandGridLinePlacement));
139
+ const positions = [{
140
+ x: startX,
141
+ key: "grid-".concat(tick.tick, "-").concat(index)
142
+ }];
143
+
144
+ // For edges on last tick, add the closing line at stepEnd
145
+ if (isLastTick && isEdges) {
146
+ const endX = getPointOnScale(tick.tick, bandScale, 'stepEnd');
147
+ positions.push({
148
+ x: endX,
149
+ key: "grid-".concat(tick.tick, "-").concat(index, "-end")
150
+ });
151
+ }
152
+ return positions;
153
+ });
154
+ }, [ticksData, xScale, isBandScale, bandGridLinePlacement]);
155
+
156
+ // Compute tick mark positions (including bounds closing tick mark for band scales)
157
+ const tickMarkPositions = useMemo(() => {
158
+ if (!xScale) return [];
159
+ return ticksData.flatMap((tick, index) => {
160
+ if (!isBandScale) {
161
+ return [{
162
+ x: tick.position,
163
+ key: "tick-mark-".concat(tick.tick, "-").concat(index)
164
+ }];
165
+ }
166
+ const bandScale = xScale;
167
+ const isLastTick = index === ticksData.length - 1;
168
+ const isEdges = bandTickMarkPlacement === 'edges';
169
+ const startX = getPointOnScale(tick.tick, bandScale, toPointAnchor(bandTickMarkPlacement));
170
+ const positions = [{
171
+ x: startX,
172
+ key: "tick-mark-".concat(tick.tick, "-").concat(index)
173
+ }];
174
+
175
+ // For edges on last tick, add the closing tick mark at stepEnd
176
+ if (isLastTick && isEdges) {
177
+ const endX = getPointOnScale(tick.tick, bandScale, 'stepEnd');
178
+ positions.push({
179
+ x: endX,
180
+ key: "tick-mark-".concat(tick.tick, "-").concat(index, "-end")
181
+ });
182
+ }
183
+ return positions;
184
+ });
185
+ }, [ticksData, xScale, isBandScale, bandTickMarkPlacement]);
113
186
  const chartTextData = useMemo(() => {
114
187
  if (!axisBounds) return null;
115
188
  return ticksData.map(tick => {
116
189
  const tickOffset = tickMarkLabelGap + (showTickMarks ? tickMarkSize : 0);
117
- const availableSpace = axisBounds.height - tickOffset;
190
+ const availableSpace = AXIS_HEIGHT - tickOffset;
118
191
  const labelOffset = availableSpace / 2;
119
- const labelY = position === 'top' ? axisBounds.y + labelOffset - tickOffset : axisBounds.y + labelOffset + tickOffset;
192
+ const labelY = position === 'top' ? axisBounds.y + axisBounds.height - tickOffset - labelOffset : axisBounds.y + labelOffset + tickOffset;
120
193
  return {
121
194
  x: tick.position,
122
195
  y: labelY,
@@ -131,64 +204,112 @@ export const XAxis = /*#__PURE__*/memo(_ref => {
131
204
  };
132
205
  });
133
206
  }, [axisBounds, ticksData, tickMarkLabelGap, showTickMarks, tickMarkSize, position, formatTick, classNames === null || classNames === void 0 ? void 0 : classNames.tickLabel, styles === null || styles === void 0 ? void 0 : styles.tickLabel]);
134
- if (!xScale) return;
207
+ if (!xScale || !axisBounds || !drawingArea) return;
208
+ const labelX = axisBounds.x + axisBounds.width / 2;
209
+ const labelY = position === 'bottom' ? axisBounds.y + axisBounds.height - LABEL_SIZE / 2 : axisBounds.y + LABEL_SIZE / 2;
210
+ const tickYTop = axisBounds.y;
211
+ const tickYBottom = axisBounds.y + axisBounds.height;
212
+ const tickYStart = position === 'bottom' ? tickYTop : tickYBottom;
213
+ const tickYEnd = position === 'bottom' ? tickYTop + tickMarkSize : tickYBottom - tickMarkSize;
135
214
  return /*#__PURE__*/_jsxs("g", _objectSpread(_objectSpread({
136
215
  className: cx(className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
137
216
  "data-axis": "x",
138
217
  "data-position": position,
139
218
  style: _objectSpread(_objectSpread({}, style), styles === null || styles === void 0 ? void 0 : styles.root)
140
219
  }, props), {}, {
141
- children: [showGrid && /*#__PURE__*/_jsx(AnimatePresence, {
142
- initial: false,
143
- children: ticksData.map((tick, index) => {
144
- const verticalLine = /*#__PURE__*/_jsx(ReferenceLine, {
145
- LineComponent: GridLineComponent,
146
- dataX: tick.tick
147
- });
220
+ children: [showGrid && /*#__PURE__*/_jsx("g", {
221
+ "data-testid": "".concat(testID, "-grid"),
222
+ children: gridLinePositions.map(_ref2 => {
223
+ let {
224
+ x,
225
+ key
226
+ } = _ref2;
148
227
  return animate ? /*#__PURE__*/_jsx(motion.g, {
149
- animate: "animate",
150
- exit: "exit",
151
- initial: "initial",
152
- variants: axisUpdateAnimationVariants,
153
- children: verticalLine
154
- }, "grid-".concat(tick.tick, "-").concat(index)) : /*#__PURE__*/_jsx("g", {
155
- children: verticalLine
156
- }, "grid-".concat(tick.tick, "-").concat(index));
157
- })
158
- }), chartTextData && /*#__PURE__*/_jsx(AnimatePresence, {
159
- children: /*#__PURE__*/_jsx(motion.g, {
160
- animate: "animate",
161
- exit: "exit",
162
- initial: "initial",
163
- variants: animate ? axisTickLabelsInitialAnimationVariants : undefined,
164
- children: /*#__PURE__*/_jsx(SmartChartTextGroup, {
165
- prioritizeEndLabels: true,
166
- labels: chartTextData,
167
- minGap: minTickLabelGap
168
- })
228
+ animate: {
229
+ opacity: 1
230
+ },
231
+ initial: {
232
+ opacity: 0
233
+ },
234
+ transition: axisUpdateAnimationTransition,
235
+ children: /*#__PURE__*/_jsx(GridLineComponent, {
236
+ animate: false,
237
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.gridLine,
238
+ clipRect: null,
239
+ d: lineToPath(x, drawingArea.y, x, drawingArea.y + drawingArea.height),
240
+ stroke: "var(--color-bgLine)",
241
+ style: styles === null || styles === void 0 ? void 0 : styles.gridLine
242
+ })
243
+ }, key) : /*#__PURE__*/_jsx(GridLineComponent, {
244
+ animate: false,
245
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.gridLine,
246
+ clipRect: null,
247
+ d: lineToPath(x, drawingArea.y, x, drawingArea.y + drawingArea.height),
248
+ stroke: "var(--color-bgLine)",
249
+ style: styles === null || styles === void 0 ? void 0 : styles.gridLine
250
+ }, key);
169
251
  })
252
+ }), chartTextData && /*#__PURE__*/_jsx(ChartTextGroup, {
253
+ prioritizeEndLabels: true,
254
+ LabelComponent: TickLabelComponent,
255
+ labels: chartTextData,
256
+ minGap: minTickLabelGap
170
257
  }), axisBounds && showTickMarks && /*#__PURE__*/_jsx("g", {
171
- "data-testid": "tick-marks",
172
- children: ticksData.map((tick, index) => {
173
- const tickY = position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height;
174
- const tickMarkSizePixels = tickMarkSize;
175
- const tickY2 = position === 'bottom' ? axisBounds.y + tickMarkSizePixels : axisBounds.y + axisBounds.height - tickMarkSizePixels;
176
- return /*#__PURE__*/_jsx("line", {
258
+ "data-testid": "".concat(testID, "-tick-marks"),
259
+ children: tickMarkPositions.map(_ref3 => {
260
+ let {
261
+ x,
262
+ key
263
+ } = _ref3;
264
+ return animate ? /*#__PURE__*/_jsx(motion.g, {
265
+ animate: {
266
+ opacity: 1
267
+ },
268
+ initial: {
269
+ opacity: 0
270
+ },
271
+ transition: axisUpdateAnimationTransition,
272
+ children: /*#__PURE__*/_jsx(TickMarkLineComponent, {
273
+ animate: false,
274
+ className: cx(axisTickMarkCss, classNames === null || classNames === void 0 ? void 0 : classNames.tickMark),
275
+ clipRect: null,
276
+ d: lineToPath(x, tickYEnd, x, tickYStart),
277
+ stroke: "var(--color-fg)",
278
+ strokeLinecap: "square",
279
+ strokeWidth: 1,
280
+ style: styles === null || styles === void 0 ? void 0 : styles.tickMark
281
+ })
282
+ }, key) : /*#__PURE__*/_jsx(TickMarkLineComponent, {
283
+ animate: false,
177
284
  className: cx(axisTickMarkCss, classNames === null || classNames === void 0 ? void 0 : classNames.tickMark),
178
- style: styles === null || styles === void 0 ? void 0 : styles.tickMark,
179
- x1: tick.position,
180
- x2: tick.position,
181
- y1: tickY,
182
- y2: tickY2
183
- }, "tick-mark-".concat(tick.tick, "-").concat(index));
285
+ clipRect: null,
286
+ d: lineToPath(x, tickYEnd, x, tickYStart),
287
+ stroke: "var(--color-fg)",
288
+ strokeLinecap: "square",
289
+ strokeWidth: 1,
290
+ style: styles === null || styles === void 0 ? void 0 : styles.tickMark
291
+ }, key);
184
292
  })
185
- }), axisBounds && showLine && /*#__PURE__*/_jsx("line", {
293
+ }), showLine && /*#__PURE__*/_jsx(LineComponent, {
294
+ animate: false,
186
295
  className: cx(axisLineCss, classNames === null || classNames === void 0 ? void 0 : classNames.line),
187
- style: styles === null || styles === void 0 ? void 0 : styles.line,
188
- x1: axisBounds.x,
189
- x2: axisBounds.x + axisBounds.width,
190
- y1: position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height,
191
- y2: position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height
296
+ clipRect: null,
297
+ d: lineToPath(axisBounds.x, position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height, axisBounds.x + axisBounds.width, position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height),
298
+ "data-testid": "".concat(testID, "-line"),
299
+ stroke: "var(--color-fg)",
300
+ strokeLinecap: "square",
301
+ strokeWidth: 1,
302
+ style: styles === null || styles === void 0 ? void 0 : styles.line
303
+ }), label && /*#__PURE__*/_jsx(ChartText, {
304
+ disableRepositioning: true,
305
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.label,
306
+ horizontalAlignment: "center",
307
+ style: styles === null || styles === void 0 ? void 0 : styles.label,
308
+ testID: "".concat(testID, "-label"),
309
+ verticalAlignment: "middle",
310
+ x: labelX,
311
+ y: labelY,
312
+ children: label
192
313
  })]
193
314
  }));
194
315
  });