@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
@@ -0,0 +1,155 @@
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 { forwardRef, memo, useImperativeHandle, useMemo } from 'react';
7
+ import { m as motion, useAnimate } from 'framer-motion';
8
+ import { useCartesianChartContext } from '../ChartProvider';
9
+ import { defaultTransition, projectPoint } from '../utils';
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ const radius = 5;
12
+ const strokeWidth = 2;
13
+ const pulseOpacityStart = 0.5;
14
+ const pulseOpacityEnd = 0;
15
+ const pulseRadiusStart = 10;
16
+ const pulseRadiusEnd = 15;
17
+ const defaultPulseTransition = {
18
+ duration: 1.6,
19
+ ease: [0.0, 0.0, 0.0, 1.0]
20
+ };
21
+ const defaultPulseRepeatDelay = 0.4;
22
+ export const DefaultScrubberBeacon = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
23
+ let {
24
+ seriesId,
25
+ color: colorProp,
26
+ dataX,
27
+ dataY,
28
+ isIdle,
29
+ idlePulse,
30
+ transitions,
31
+ opacity = 1,
32
+ className,
33
+ style,
34
+ testID
35
+ } = _ref;
36
+ const [scope, animate] = useAnimate();
37
+ const {
38
+ getSeries,
39
+ getXScale,
40
+ getYScale,
41
+ drawingArea
42
+ } = useCartesianChartContext();
43
+ const targetSeries = getSeries(seriesId);
44
+ const xScale = getXScale();
45
+ const yScale = getYScale(targetSeries === null || targetSeries === void 0 ? void 0 : targetSeries.yAxisId);
46
+ const color = useMemo(() => {
47
+ var _ref2;
48
+ return (_ref2 = colorProp !== null && colorProp !== void 0 ? colorProp : targetSeries === null || targetSeries === void 0 ? void 0 : targetSeries.color) !== null && _ref2 !== void 0 ? _ref2 : 'var(--color-fgPrimary)';
49
+ }, [colorProp, targetSeries]);
50
+ const updateTransition = useMemo(() => {
51
+ var _transitions$update;
52
+ return (_transitions$update = transitions === null || transitions === void 0 ? void 0 : transitions.update) !== null && _transitions$update !== void 0 ? _transitions$update : defaultTransition;
53
+ }, [transitions === null || transitions === void 0 ? void 0 : transitions.update]);
54
+ const pulseTransition = useMemo(() => {
55
+ var _transitions$pulse;
56
+ return (_transitions$pulse = transitions === null || transitions === void 0 ? void 0 : transitions.pulse) !== null && _transitions$pulse !== void 0 ? _transitions$pulse : defaultPulseTransition;
57
+ }, [transitions === null || transitions === void 0 ? void 0 : transitions.pulse]);
58
+ const pulseRepeatDelay = useMemo(() => {
59
+ var _transitions$pulseRep;
60
+ return (_transitions$pulseRep = transitions === null || transitions === void 0 ? void 0 : transitions.pulseRepeatDelay) !== null && _transitions$pulseRep !== void 0 ? _transitions$pulseRep : defaultPulseRepeatDelay;
61
+ }, [transitions === null || transitions === void 0 ? void 0 : transitions.pulseRepeatDelay]);
62
+ const pixelCoordinate = useMemo(() => {
63
+ if (!xScale || !yScale) return;
64
+ return projectPoint({
65
+ x: dataX,
66
+ y: dataY,
67
+ xScale,
68
+ yScale
69
+ });
70
+ }, [dataX, dataY, xScale, yScale]);
71
+ useImperativeHandle(ref, () => ({
72
+ pulse: () => {
73
+ // Only pulse when idle and idlePulse is not enabled
74
+ if (isIdle && !idlePulse && scope.current) {
75
+ animate(scope.current, {
76
+ opacity: [pulseOpacityStart, pulseOpacityEnd],
77
+ r: [pulseRadiusStart, pulseRadiusEnd]
78
+ }, pulseTransition);
79
+ }
80
+ }
81
+ }), [isIdle, idlePulse, scope, animate, pulseTransition]);
82
+
83
+ // Create continuous pulse transition by repeating the base pulse transition with delay
84
+ const continuousPulseTransition = useMemo(() => _objectSpread(_objectSpread({}, pulseTransition), {}, {
85
+ repeat: Infinity,
86
+ repeatDelay: pulseRepeatDelay
87
+ }), [pulseTransition, pulseRepeatDelay]);
88
+ const shouldPulse = isIdle && idlePulse;
89
+ const isWithinDrawingArea = useMemo(() => {
90
+ if (!pixelCoordinate) return false;
91
+ return pixelCoordinate.x >= drawingArea.x && pixelCoordinate.x <= drawingArea.x + drawingArea.width && pixelCoordinate.y >= drawingArea.y && pixelCoordinate.y <= drawingArea.y + drawingArea.height;
92
+ }, [pixelCoordinate, drawingArea]);
93
+ if (!pixelCoordinate) return;
94
+ if (isIdle) {
95
+ return /*#__PURE__*/_jsxs("g", {
96
+ "data-testid": testID,
97
+ opacity: isWithinDrawingArea ? opacity : 0,
98
+ children: [/*#__PURE__*/_jsx(motion.g, {
99
+ animate: {
100
+ x: pixelCoordinate.x,
101
+ y: pixelCoordinate.y
102
+ },
103
+ initial: false,
104
+ transition: updateTransition,
105
+ children: /*#__PURE__*/_jsx(motion.circle, {
106
+ ref: scope,
107
+ animate: shouldPulse ? {
108
+ opacity: [pulseOpacityStart, pulseOpacityEnd],
109
+ r: [pulseRadiusStart, pulseRadiusEnd],
110
+ transition: continuousPulseTransition
111
+ } : {
112
+ opacity: pulseOpacityEnd,
113
+ r: pulseRadiusStart
114
+ },
115
+ cx: 0,
116
+ cy: 0,
117
+ fill: color,
118
+ initial: {
119
+ opacity: shouldPulse ? pulseOpacityStart : pulseOpacityEnd,
120
+ r: pulseRadiusStart
121
+ }
122
+ })
123
+ }), /*#__PURE__*/_jsx(motion.circle, {
124
+ animate: {
125
+ cx: pixelCoordinate.x,
126
+ cy: pixelCoordinate.y
127
+ },
128
+ className: className,
129
+ cx: pixelCoordinate.x,
130
+ cy: pixelCoordinate.y,
131
+ fill: color,
132
+ initial: false,
133
+ r: radius,
134
+ stroke: "var(--color-bg)",
135
+ strokeWidth: strokeWidth,
136
+ style: style,
137
+ transition: updateTransition
138
+ })]
139
+ });
140
+ }
141
+ return /*#__PURE__*/_jsx("g", {
142
+ "data-testid": testID,
143
+ opacity: isWithinDrawingArea ? opacity : 0,
144
+ children: /*#__PURE__*/_jsx("circle", {
145
+ className: className,
146
+ cx: pixelCoordinate.x,
147
+ cy: pixelCoordinate.y,
148
+ fill: color,
149
+ r: radius,
150
+ stroke: "var(--color-bg)",
151
+ strokeWidth: strokeWidth,
152
+ style: style
153
+ })
154
+ });
155
+ }));
@@ -1,4 +1,4 @@
1
- const _excluded = ["background", "color", "elevation", "borderRadius", "font", "verticalAlignment"];
1
+ const _excluded = ["background", "color", "elevated", "borderRadius", "font", "verticalAlignment", "inset", "label"];
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; }
@@ -9,25 +9,38 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
9
9
  import { memo } from 'react';
10
10
  import { ChartText } from '../text';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ const labelVerticalInset = 3.5;
13
+ const labelHorizontalInset = 4;
12
14
  /**
13
- * 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).
15
+ * DefaultScrubberBeaconLabel 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).
14
16
  */
15
- export const ScrubberBeaconLabel = /*#__PURE__*/memo(_ref => {
17
+ export const DefaultScrubberBeaconLabel = /*#__PURE__*/memo(_ref => {
16
18
  let {
17
- background = 'white',
19
+ background = 'var(--color-bg',
18
20
  color = 'var(--color-fgPrimary)',
19
- elevation = background !== undefined ? 1 : undefined,
20
- borderRadius = background !== undefined ? 4 : undefined,
21
+ elevated = true,
22
+ borderRadius = 4,
21
23
  font = 'label1',
22
- verticalAlignment = 'middle'
24
+ verticalAlignment = 'middle',
25
+ inset = {
26
+ left: labelHorizontalInset,
27
+ right: labelHorizontalInset,
28
+ top: labelVerticalInset,
29
+ bottom: labelVerticalInset
30
+ },
31
+ label
23
32
  } = _ref,
24
33
  chartTextProps = _objectWithoutProperties(_ref, _excluded);
25
- return /*#__PURE__*/_jsx(ChartText, _objectSpread({
34
+ return /*#__PURE__*/_jsx(ChartText, _objectSpread(_objectSpread({
35
+ disableRepositioning: true,
26
36
  background: background,
27
37
  borderRadius: borderRadius,
28
38
  color: color,
29
- elevation: elevation,
39
+ elevated: elevated,
30
40
  font: font,
41
+ inset: inset,
31
42
  verticalAlignment: verticalAlignment
32
- }, chartTextProps));
43
+ }, chartTextProps), {}, {
44
+ children: label
45
+ }));
33
46
  });
@@ -0,0 +1,30 @@
1
+ const _excluded = ["verticalAlignment", "dy"];
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
+ 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
+ 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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
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
+ 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
+ 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';
10
+ import { useCartesianChartContext } from '../ChartProvider';
11
+ import { DefaultReferenceLineLabel } from '../line';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ /**
14
+ * DefaultScrubberLabel is the default label component for the scrubber line.
15
+ * It will center the label vertically with the top available area.
16
+ */
17
+ export const DefaultScrubberLabel = /*#__PURE__*/memo(_ref => {
18
+ let {
19
+ verticalAlignment = 'middle',
20
+ dy
21
+ } = _ref,
22
+ props = _objectWithoutProperties(_ref, _excluded);
23
+ const {
24
+ drawingArea
25
+ } = useCartesianChartContext();
26
+ return /*#__PURE__*/_jsx(DefaultReferenceLineLabel, _objectSpread({
27
+ dy: dy !== null && dy !== void 0 ? dy : -0.5 * drawingArea.y,
28
+ verticalAlignment: verticalAlignment
29
+ }, props));
30
+ });