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

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 +115 -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 +91 -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 +287 -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 +47 -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 +41 -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 +97 -392
  166. package/esm/chart/scrubber/ScrubberBeaconGroup.js +174 -0
  167. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +201 -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,13 +1,15 @@
1
- const _excluded = ["as", "color", "label", "display", "alignItems", "font", "hideDot", "disablePulse"],
2
- _excluded2 = ["background", "activeBackground", "width", "justifyContent", "TabComponent", "TabsActiveIndicatorComponent"];
3
- 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; }
4
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
1
+ const _excluded = ["activeTabRect", "background", "position", "borderRadius", "style"],
2
+ _excluded2 = ["as", "color", "label", "display", "alignItems", "font", "hideDot"],
3
+ _excluded3 = ["background", "activeBackground", "width", "justifyContent", "TabComponent", "TabsActiveIndicatorComponent", "className", "classNames", "style", "styles"];
5
4
  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; }
6
5
  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; }
7
6
  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
7
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
9
8
  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); }
9
+ 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; }
10
+ 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; }
10
11
  import React, { forwardRef, memo, useMemo } from 'react';
12
+ import { cx } from '@coinbase/cds-web';
11
13
  import { Box } from '@coinbase/cds-web/layout';
12
14
  import { SegmentedTabs, tabsTransitionConfig } from '@coinbase/cds-web/tabs';
13
15
  import { SegmentedTab } from '@coinbase/cds-web/tabs/SegmentedTab';
@@ -15,21 +17,17 @@ import { Text } from '@coinbase/cds-web/typography';
15
17
  import { m as motion } from 'framer-motion';
16
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
19
  const MotionBox = motion(Box);
18
- const pulseTransitionConfig = {
19
- duration: 2,
20
- repeat: Infinity,
21
- ease: 'easeInOut'
22
- };
23
20
 
24
21
  // Animated active indicator to support smooth transition of background color
25
22
  export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
26
23
  let {
27
- activeTabRect,
28
- background = 'bgPrimaryWash',
29
- position = 'absolute',
30
- borderRadius = 1000,
31
- style
32
- } = _ref;
24
+ activeTabRect,
25
+ background = 'bgPrimaryWash',
26
+ position = 'absolute',
27
+ borderRadius = 1000,
28
+ style
29
+ } = _ref,
30
+ props = _objectWithoutProperties(_ref, _excluded);
33
31
  const {
34
32
  width,
35
33
  height,
@@ -40,12 +38,13 @@ export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
40
38
  x
41
39
  }), [width, x]);
42
40
  if (!width) return null;
43
- return /*#__PURE__*/_jsx(MotionBox, {
41
+ return /*#__PURE__*/_jsx(MotionBox, _objectSpread({
44
42
  animate: activeAnimation,
45
43
  borderRadius: borderRadius,
46
44
  "data-testid": "period-selector-active-indicator",
47
45
  height: height,
48
46
  initial: false,
47
+ left: 0,
49
48
  position: position,
50
49
  role: "none",
51
50
  style: _objectSpread({
@@ -53,7 +52,7 @@ export const PeriodSelectorActiveIndicator = /*#__PURE__*/memo(_ref => {
53
52
  transition: 'background-color 0.2s ease'
54
53
  }, style),
55
54
  transition: tabsTransitionConfig
56
- });
55
+ }, props));
57
56
  });
58
57
  export const liveTabLabelDefaultElement = 'span';
59
58
  // is this bad to use var(--space-1) for height and width?
@@ -66,15 +65,10 @@ export const LiveTabLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, re
66
65
  display = 'inline-flex',
67
66
  alignItems = 'center',
68
67
  font = 'label1',
69
- hideDot,
70
- disablePulse
68
+ hideDot
71
69
  } = _ref2,
72
- props = _objectWithoutProperties(_ref2, _excluded);
70
+ props = _objectWithoutProperties(_ref2, _excluded2);
73
71
  const Component = as !== null && as !== void 0 ? as : liveTabLabelDefaultElement;
74
- const pulseAnimation = !disablePulse ? {
75
- opacity: [1, 0, 1],
76
- transition: pulseTransitionConfig
77
- } : undefined;
78
72
  return /*#__PURE__*/_jsxs(Text, _objectSpread(_objectSpread({
79
73
  ref: ref,
80
74
  alignItems: alignItems,
@@ -83,12 +77,8 @@ export const LiveTabLabel = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref2, re
83
77
  display: display,
84
78
  font: font
85
79
  }, props), {}, {
86
- children: [!hideDot && /*#__PURE__*/_jsx(motion.span, {
87
- animate: !disablePulse && pulseAnimation,
88
- className: dotBaseCss,
89
- initial: {
90
- opacity: 1
91
- }
80
+ children: [!hideDot && /*#__PURE__*/_jsx("span", {
81
+ className: dotBaseCss
92
82
  }), label]
93
83
  }));
94
84
  }));
@@ -110,16 +100,30 @@ export const PeriodSelector = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref3,
110
100
  width = '100%',
111
101
  justifyContent = 'space-between',
112
102
  TabComponent = PeriodSelectorTab,
113
- TabsActiveIndicatorComponent = PeriodSelectorActiveIndicator
103
+ TabsActiveIndicatorComponent = PeriodSelectorActiveIndicator,
104
+ className,
105
+ classNames,
106
+ style,
107
+ styles
114
108
  } = _ref3,
115
- props = _objectWithoutProperties(_ref3, _excluded2);
109
+ props = _objectWithoutProperties(_ref3, _excluded3);
116
110
  return /*#__PURE__*/_jsx(SegmentedTabs, _objectSpread({
117
111
  ref: ref,
118
112
  TabComponent: TabComponent,
119
113
  TabsActiveIndicatorComponent: TabsActiveIndicatorComponent,
120
114
  activeBackground: activeBackground,
121
115
  background: background,
116
+ className: cx(className, classNames === null || classNames === void 0 ? void 0 : classNames.root),
117
+ classNames: {
118
+ tab: classNames === null || classNames === void 0 ? void 0 : classNames.tab,
119
+ activeIndicator: classNames === null || classNames === void 0 ? void 0 : classNames.activeIndicator
120
+ },
122
121
  justifyContent: justifyContent,
122
+ style: styles !== null && styles !== void 0 && styles.root ? _objectSpread(_objectSpread({}, style), styles.root) : style,
123
+ styles: {
124
+ tab: styles === null || styles === void 0 ? void 0 : styles.tab,
125
+ activeIndicator: styles === null || styles === void 0 ? void 0 : styles.activeIndicator
126
+ },
123
127
  width: width
124
128
  }, props));
125
129
  }));
@@ -6,17 +6,19 @@ import { GradientArea } from './GradientArea';
6
6
  import { SolidArea } from './SolidArea';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
8
  export const Area = /*#__PURE__*/memo(_ref => {
9
- var _ref2;
10
9
  let {
11
10
  seriesId,
12
- curve = 'linear',
11
+ curve = 'bump',
13
12
  type = 'solid',
14
- AreaComponent: SelectedAreaComponent,
15
- fill: specifiedFill,
13
+ AreaComponent: AreaComponentProp,
14
+ fill: fillProp,
16
15
  fillOpacity = 1,
17
- stroke,
18
- strokeWidth,
19
- baseline
16
+ baseline,
17
+ connectNulls,
18
+ gradient: gradientProp,
19
+ transitions,
20
+ transition,
21
+ animate
20
22
  } = _ref;
21
23
  const {
22
24
  getSeries,
@@ -25,20 +27,10 @@ export const Area = /*#__PURE__*/memo(_ref => {
25
27
  getYScale,
26
28
  getXAxis
27
29
  } = useCartesianChartContext();
28
-
29
- // Get sourceData from series (using stacked data if available)
30
30
  const matchedSeries = useMemo(() => getSeries(seriesId), [seriesId, getSeries]);
31
-
32
- // Check for stacked data first, then fall back to raw data
33
- const sourceData = useMemo(() => {
34
- const stackedData = getSeriesData(seriesId);
35
- if (stackedData) {
36
- return stackedData;
37
- }
38
- return getSeriesData(seriesId) || null;
39
- }, [seriesId, getSeriesData]);
40
-
41
- // Get scales and axes for this series
31
+ const gradient = useMemo(() => gradientProp !== null && gradientProp !== void 0 ? gradientProp : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.gradient, [gradientProp, matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.gradient]);
32
+ const fill = useMemo(() => fillProp !== null && fillProp !== void 0 ? fillProp : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.color, [fillProp, matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.color]);
33
+ const sourceData = useMemo(() => getSeriesData(seriesId), [seriesId, getSeriesData]);
42
34
  const xAxis = getXAxis();
43
35
  const xScale = getXScale();
44
36
  const yScale = getYScale(matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId);
@@ -52,34 +44,34 @@ export const Area = /*#__PURE__*/memo(_ref => {
52
44
  xScale,
53
45
  yScale,
54
46
  curve,
55
- xData
47
+ xData,
48
+ connectNulls
56
49
  });
57
- }, [sourceData, xScale, yScale, curve, xAxis === null || xAxis === void 0 ? void 0 : xAxis.data]);
50
+ }, [sourceData, xScale, yScale, curve, xAxis === null || xAxis === void 0 ? void 0 : xAxis.data, connectNulls]);
58
51
  const AreaComponent = useMemo(() => {
59
- if (SelectedAreaComponent) {
60
- return SelectedAreaComponent;
52
+ if (AreaComponentProp) {
53
+ return AreaComponentProp;
61
54
  }
62
55
  switch (type) {
63
- case 'solid':
64
- return SolidArea;
65
56
  case 'dotted':
66
57
  return DottedArea;
67
58
  case 'gradient':
68
- default:
69
59
  return GradientArea;
60
+ case 'solid':
61
+ default:
62
+ return SolidArea;
70
63
  }
71
- }, [SelectedAreaComponent, type]);
72
- if (!xScale || !yScale || !sourceData || !area) {
73
- return null;
74
- }
75
- const fill = (_ref2 = specifiedFill !== null && specifiedFill !== void 0 ? specifiedFill : matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.color) !== null && _ref2 !== void 0 ? _ref2 : 'var(--color-fgPrimary)';
64
+ }, [AreaComponentProp, type]);
65
+ if (!xScale || !yScale || !sourceData || !area) return;
76
66
  return /*#__PURE__*/_jsx(AreaComponent, {
67
+ animate: animate,
77
68
  baseline: baseline,
78
69
  d: area,
79
70
  fill: fill,
80
71
  fillOpacity: fillOpacity,
81
- stroke: stroke,
82
- strokeWidth: strokeWidth,
72
+ gradient: gradient,
73
+ transition: transition,
74
+ transitions: transitions,
83
75
  yAxisId: matchedSeries === null || matchedSeries === void 0 ? void 0 : matchedSeries.yAxisId
84
76
  });
85
77
  });
@@ -1,8 +1,8 @@
1
- const _excluded = ["series", "stacked", "AreaComponent", "curve", "fillOpacity", "type", "LineComponent", "strokeWidth", "showXAxis", "showYAxis", "showLines", "lineType", "xAxis", "yAxis", "inset", "children"],
1
+ const _excluded = ["series", "stacked", "AreaComponent", "curve", "fillOpacity", "type", "connectNulls", "transitions", "transition", "LineComponent", "strokeWidth", "showXAxis", "showYAxis", "showLines", "lineType", "xAxis", "yAxis", "inset", "children"],
2
2
  _excluded2 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range"],
3
3
  _excluded3 = ["scaleType", "data", "categoryPadding", "domain", "domainLimit", "range", "id"],
4
- _excluded4 = ["id", "data", "label", "color", "yAxisId", "opacity", "LineComponent", "stackId"],
5
- _excluded5 = ["id", "data", "label", "color", "yAxisId", "fill", "fillOpacity", "stackId"];
4
+ _excluded4 = ["id", "data", "label", "color", "yAxisId", "opacity", "LineComponent", "stackId", "legendShape", "transition"],
5
+ _excluded5 = ["id", "data", "label", "color", "yAxisId", "fill", "fillOpacity", "stackId", "legendShape", "type", "lineType", "transition"];
6
6
  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; }
7
7
  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; }
8
8
  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; }
@@ -25,6 +25,9 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
25
25
  curve,
26
26
  fillOpacity,
27
27
  type,
28
+ connectNulls,
29
+ transitions,
30
+ transition,
28
31
  LineComponent,
29
32
  strokeWidth,
30
33
  showXAxis,
@@ -33,11 +36,11 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
33
36
  lineType = 'solid',
34
37
  xAxis,
35
38
  yAxis,
36
- inset: userInset,
39
+ inset,
37
40
  children
38
41
  } = _ref,
39
42
  chartProps = _objectWithoutProperties(_ref, _excluded);
40
- const calculatedInset = useMemo(() => getChartInset(userInset, defaultChartInset), [userInset]);
43
+ const calculatedInset = useMemo(() => getChartInset(inset, defaultChartInset), [inset]);
41
44
 
42
45
  // Convert AreaSeries to Series for Chart context
43
46
  const chartSeries = useMemo(() => {
@@ -47,7 +50,8 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
47
50
  label: s.label,
48
51
  color: s.color,
49
52
  yAxisId: s.yAxisId,
50
- stackId: s.stackId
53
+ stackId: s.stackId,
54
+ gradient: s.gradient
51
55
  }));
52
56
  }, [series]);
53
57
  const transformedSeries = useMemo(() => {
@@ -127,14 +131,19 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
127
131
  yAxisId,
128
132
  opacity,
129
133
  LineComponent,
130
- stackId
134
+ stackId,
135
+ legendShape,
136
+ transition: seriesTransition
131
137
  } = _ref4,
132
138
  areaPropsFromSeries = _objectWithoutProperties(_ref4, _excluded4);
133
139
  return /*#__PURE__*/_jsx(Area, _objectSpread({
134
140
  AreaComponent: AreaComponent,
141
+ connectNulls: connectNulls,
135
142
  curve: curve,
136
143
  fillOpacity: fillOpacity,
137
144
  seriesId: id,
145
+ transition: seriesTransition !== null && seriesTransition !== void 0 ? seriesTransition : transition,
146
+ transitions: transitions,
138
147
  type: type
139
148
  }, areaPropsFromSeries), id);
140
149
  }), showLines && (series === null || series === void 0 ? void 0 : series.map(_ref5 => {
@@ -146,19 +155,24 @@ export const AreaChart = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) =
146
155
  yAxisId,
147
156
  fill,
148
157
  fillOpacity,
149
- stackId
158
+ stackId,
159
+ legendShape,
160
+ type,
161
+ // Area type (don't pass to Line)
162
+ lineType: seriesLineType,
163
+ transition: seriesTransition
150
164
  } = _ref5,
151
- linePropsFromSeries = _objectWithoutProperties(_ref5, _excluded5);
165
+ otherPropsFromSeries = _objectWithoutProperties(_ref5, _excluded5);
152
166
  return /*#__PURE__*/_jsx(Line, _objectSpread({
153
167
  LineComponent: LineComponent,
168
+ connectNulls: connectNulls,
154
169
  curve: curve,
155
- seriesId: id // Line component now handles stacked data automatically
156
- ,
157
- stroke: color // Default to series color
158
- ,
170
+ seriesId: id,
159
171
  strokeWidth: strokeWidth,
160
- type: lineType
161
- }, linePropsFromSeries), "".concat(id, "-line"));
172
+ transition: seriesTransition !== null && seriesTransition !== void 0 ? seriesTransition : transition,
173
+ transitions: transitions,
174
+ type: seriesLineType !== null && seriesLineType !== void 0 ? seriesLineType : lineType
175
+ }, otherPropsFromSeries), id);
162
176
  })), children]
163
177
  }));
164
178
  }));
@@ -1,4 +1,4 @@
1
- const _excluded = ["d", "fill", "className", "style", "patternSize", "dotSize", "peakOpacity", "baselineOpacity", "baseline", "yAxisId", "classNames", "styles", "animate"];
1
+ const _excluded = ["d", "fill", "patternSize", "dotSize", "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,136 +6,86 @@ 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';
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { createGradient, getBaseline } from '../utils';
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ /**
16
+ * A customizable dotted area gradient component.
17
+ * When no gradient is provided, renders a default gradient based
18
+ * on the fill color and peak/baseline opacities.
19
+ */
13
20
  export const DottedArea = /*#__PURE__*/memo(_ref => {
21
+ var _transitions$update;
14
22
  let {
15
23
  d,
16
- fill,
17
- className,
18
- style,
24
+ fill = 'var(--color-fgPrimary)',
19
25
  patternSize = 4,
20
26
  dotSize = 1,
21
27
  peakOpacity = 1,
22
28
  baselineOpacity = 0,
23
29
  baseline,
24
30
  yAxisId,
25
- classNames,
26
- styles,
27
- animate
31
+ gradient: gradientProp,
32
+ animate,
33
+ transitions,
34
+ transition
28
35
  } = _ref,
29
36
  pathProps = _objectWithoutProperties(_ref, _excluded);
30
- const context = useCartesianChartContext();
37
+ const {
38
+ getYAxis
39
+ } = useCartesianChartContext();
31
40
  const patternId = useId();
32
41
  const gradientId = useId();
33
42
  const maskId = useId();
34
43
  const dotCenterPosition = patternSize / 2;
35
-
36
- // Get the y-scale for the specified axis (or default)
37
- const yScale = context.getYScale(yAxisId);
38
- const yRange = yScale === null || yScale === void 0 ? void 0 : yScale.range();
39
- const yDomain = yScale === null || yScale === void 0 ? void 0 : yScale.domain();
40
-
41
- // Use chart range if available, otherwise fall back to percentage
42
- const useUserSpaceUnits = yRange !== undefined;
43
-
44
- // Auto-calculate baseline position based on domain
45
- let baselinePosition;
46
- let baselinePercentage;
47
- if (yScale && yDomain) {
48
- const [minValue, maxValue] = yDomain;
49
- let dataBaseline;
50
- if (minValue >= 0) {
51
- // All positive: baseline at min
52
- dataBaseline = minValue;
53
- } else if (maxValue <= 0) {
54
- // All negative: baseline at max
55
- dataBaseline = maxValue;
56
- } else {
57
- // Crosses zero: baseline at 0
58
- dataBaseline = 0;
59
- }
60
- if (useUserSpaceUnits) {
61
- // Get the actual y coordinate for the baseline
62
- const scaledValue = yScale(baseline !== null && baseline !== void 0 ? baseline : dataBaseline);
63
- if (typeof scaledValue === 'number') {
64
- baselinePosition = scaledValue;
65
- }
66
- } else {
67
- // Calculate percentage position
68
- baselinePercentage = "".concat((maxValue - (baseline !== null && baseline !== void 0 ? baseline : dataBaseline)) / (maxValue - minValue) * 100, "%");
69
- }
70
- }
71
- const gradientY1 = useUserSpaceUnits ? yRange[1] : '0%';
72
- const gradientY2 = useUserSpaceUnits ? yRange[0] : '100%';
44
+ const yAxisConfig = getYAxis(yAxisId);
45
+ const gradient = useMemo(() => {
46
+ if (gradientProp) return gradientProp;
47
+ if (!yAxisConfig) return;
48
+ const baselineValue = getBaseline(yAxisConfig.domain, baseline);
49
+ return createGradient(yAxisConfig.domain, baselineValue, fill, peakOpacity, baselineOpacity);
50
+ }, [gradientProp, yAxisConfig, fill, baseline, peakOpacity, baselineOpacity]);
73
51
  return /*#__PURE__*/_jsxs("g", {
74
- className: className !== null && className !== void 0 ? className : classNames === null || classNames === void 0 ? void 0 : classNames.root,
75
- style: style !== null && style !== void 0 ? style : styles === null || styles === void 0 ? void 0 : styles.root,
76
52
  children: [/*#__PURE__*/_jsxs("defs", {
77
53
  children: [/*#__PURE__*/_jsx("pattern", {
78
- className: classNames === null || classNames === void 0 ? void 0 : classNames.pattern,
79
54
  height: patternSize,
80
55
  id: patternId,
81
56
  patternUnits: "userSpaceOnUse",
82
- style: styles === null || styles === void 0 ? void 0 : styles.pattern,
83
57
  width: patternSize,
84
58
  x: "0",
85
59
  y: "0",
86
60
  children: /*#__PURE__*/_jsx("circle", {
87
61
  cx: dotCenterPosition,
88
62
  cy: dotCenterPosition,
89
- fill: fill,
63
+ fill: "white",
90
64
  r: dotSize
91
65
  })
92
- }), /*#__PURE__*/_jsx("linearGradient", {
93
- gradientUnits: useUserSpaceUnits ? 'userSpaceOnUse' : 'objectBoundingBox',
94
- id: gradientId,
95
- x1: useUserSpaceUnits ? 0 : '0%',
96
- x2: useUserSpaceUnits ? 0 : '0%',
97
- y1: gradientY1,
98
- y2: gradientY2,
99
- children: baselinePosition !== undefined || baselinePercentage !== undefined ? /*#__PURE__*/_jsxs(_Fragment, {
100
- children: [/*#__PURE__*/_jsx("stop", {
101
- offset: "0%",
102
- stopColor: "white",
103
- stopOpacity: peakOpacity
104
- }), /*#__PURE__*/_jsx("stop", {
105
- offset: baselinePercentage !== null && baselinePercentage !== void 0 ? baselinePercentage : "".concat((baselinePosition - yRange[1]) / (yRange[0] - yRange[1]) * 100, "%"),
106
- stopColor: "white",
107
- stopOpacity: baselineOpacity
108
- }), /*#__PURE__*/_jsx("stop", {
109
- offset: "100%",
110
- stopColor: "white",
111
- stopOpacity: peakOpacity
112
- })]
113
- }) : /*#__PURE__*/_jsxs(_Fragment, {
114
- children: [/*#__PURE__*/_jsx("stop", {
115
- offset: "0%",
116
- stopColor: "white",
117
- stopOpacity: peakOpacity
118
- }), /*#__PURE__*/_jsx("stop", {
119
- offset: "100%",
120
- stopColor: "white",
121
- stopOpacity: baselineOpacity
122
- })]
123
- })
124
66
  }), /*#__PURE__*/_jsx("mask", {
125
67
  id: maskId,
126
68
  children: /*#__PURE__*/_jsx(Path, {
127
69
  animate: animate,
128
70
  d: d,
129
- fill: "url(#".concat(gradientId, ")")
71
+ fill: "url(#".concat(patternId, ")"),
72
+ transition: transition,
73
+ transitions: transitions
130
74
  })
75
+ }), gradient && /*#__PURE__*/_jsx(Gradient, {
76
+ animate: animate,
77
+ gradient: gradient,
78
+ id: gradientId,
79
+ transition: (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : transition,
80
+ yAxisId: yAxisId
131
81
  })]
132
82
  }), /*#__PURE__*/_jsx(Path, _objectSpread({
133
83
  animate: animate,
134
- className: classNames === null || classNames === void 0 ? void 0 : classNames.path,
135
84
  d: d,
136
- fill: "url(#".concat(patternId, ")"),
85
+ fill: gradient ? "url(#".concat(gradientId, ")") : fill,
137
86
  mask: "url(#".concat(maskId, ")"),
138
- style: styles === null || styles === void 0 ? void 0 : styles.path
87
+ transition: transition,
88
+ transitions: transitions
139
89
  }, pathProps))]
140
90
  });
141
91
  });