@coinbase/cds-web-visualization 3.4.0-beta.1 → 3.4.0-beta.11
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.
- package/CHANGELOG.md +53 -0
- package/dts/chart/CartesianChart.d.ts +38 -2
- package/dts/chart/CartesianChart.d.ts.map +1 -1
- package/dts/chart/Path.d.ts +27 -7
- package/dts/chart/Path.d.ts.map +1 -1
- package/dts/chart/PeriodSelector.d.ts +0 -4
- package/dts/chart/PeriodSelector.d.ts.map +1 -1
- package/dts/chart/area/Area.d.ts +54 -24
- package/dts/chart/area/Area.d.ts.map +1 -1
- package/dts/chart/area/AreaChart.d.ts +33 -6
- package/dts/chart/area/AreaChart.d.ts.map +1 -1
- package/dts/chart/area/DottedArea.d.ts +21 -44
- package/dts/chart/area/DottedArea.d.ts.map +1 -1
- package/dts/chart/area/GradientArea.d.ts +21 -12
- package/dts/chart/area/GradientArea.d.ts.map +1 -1
- package/dts/chart/area/SolidArea.d.ts +16 -1
- package/dts/chart/area/SolidArea.d.ts.map +1 -1
- package/dts/chart/axis/Axis.d.ts +109 -63
- package/dts/chart/axis/Axis.d.ts.map +1 -1
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts +8 -0
- package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +1 -0
- package/dts/chart/axis/XAxis.d.ts +1 -1
- package/dts/chart/axis/XAxis.d.ts.map +1 -1
- package/dts/chart/axis/YAxis.d.ts +2 -2
- package/dts/chart/axis/YAxis.d.ts.map +1 -1
- package/dts/chart/axis/index.d.ts +1 -0
- package/dts/chart/axis/index.d.ts.map +1 -1
- package/dts/chart/bar/Bar.d.ts +16 -13
- package/dts/chart/bar/Bar.d.ts.map +1 -1
- package/dts/chart/bar/BarChart.d.ts +17 -8
- package/dts/chart/bar/BarChart.d.ts.map +1 -1
- package/dts/chart/bar/BarPlot.d.ts +2 -1
- package/dts/chart/bar/BarPlot.d.ts.map +1 -1
- package/dts/chart/bar/BarStack.d.ts +40 -48
- package/dts/chart/bar/BarStack.d.ts.map +1 -1
- package/dts/chart/bar/BarStackGroup.d.ts +1 -0
- package/dts/chart/bar/BarStackGroup.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBar.d.ts.map +1 -1
- package/dts/chart/bar/DefaultBarStack.d.ts.map +1 -1
- package/dts/chart/gradient/Gradient.d.ts +35 -0
- package/dts/chart/gradient/Gradient.d.ts.map +1 -0
- package/dts/chart/gradient/index.d.ts +2 -0
- package/dts/chart/gradient/index.d.ts.map +1 -0
- package/dts/chart/index.d.ts +2 -1
- package/dts/chart/index.d.ts.map +1 -1
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts +9 -0
- package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +1 -0
- package/dts/chart/line/DottedLine.d.ts +15 -3
- package/dts/chart/line/DottedLine.d.ts.map +1 -1
- package/dts/chart/line/Line.d.ts +87 -28
- package/dts/chart/line/Line.d.ts.map +1 -1
- package/dts/chart/line/LineChart.d.ts +26 -8
- package/dts/chart/line/LineChart.d.ts.map +1 -1
- package/dts/chart/line/ReferenceLine.d.ts +91 -44
- package/dts/chart/line/ReferenceLine.d.ts.map +1 -1
- package/dts/chart/line/SolidLine.d.ts +14 -3
- package/dts/chart/line/SolidLine.d.ts.map +1 -1
- package/dts/chart/line/index.d.ts +1 -1
- package/dts/chart/line/index.d.ts.map +1 -1
- package/dts/chart/point/DefaultPointLabel.d.ts +10 -0
- package/dts/chart/point/DefaultPointLabel.d.ts.map +1 -0
- package/dts/chart/point/Point.d.ts +201 -0
- package/dts/chart/point/Point.d.ts.map +1 -0
- package/dts/chart/point/index.d.ts +3 -0
- package/dts/chart/point/index.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +24 -0
- package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +12 -0
- package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +10 -0
- package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +1 -0
- package/dts/chart/scrubber/Scrubber.d.ts +207 -66
- package/dts/chart/scrubber/Scrubber.d.ts.map +1 -1
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +70 -0
- package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +32 -0
- package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +1 -0
- package/dts/chart/scrubber/index.d.ts +3 -0
- package/dts/chart/scrubber/index.d.ts.map +1 -1
- package/dts/chart/text/ChartText.d.ts +46 -43
- package/dts/chart/text/ChartText.d.ts.map +1 -1
- package/dts/chart/text/{SmartChartTextGroup.d.ts → ChartTextGroup.d.ts} +9 -3
- package/dts/chart/text/ChartTextGroup.d.ts.map +1 -0
- package/dts/chart/text/index.d.ts +1 -1
- package/dts/chart/text/index.d.ts.map +1 -1
- package/dts/chart/utils/axis.d.ts +25 -1
- package/dts/chart/utils/axis.d.ts.map +1 -1
- package/dts/chart/utils/chart.d.ts +27 -7
- package/dts/chart/utils/chart.d.ts.map +1 -1
- package/dts/chart/utils/context.d.ts +6 -0
- package/dts/chart/utils/context.d.ts.map +1 -1
- package/dts/chart/utils/gradient.d.ts +104 -0
- package/dts/chart/utils/gradient.d.ts.map +1 -0
- package/dts/chart/utils/index.d.ts +4 -0
- package/dts/chart/utils/index.d.ts.map +1 -1
- package/dts/chart/utils/interpolate.d.ts +112 -0
- package/dts/chart/utils/interpolate.d.ts.map +1 -0
- package/dts/chart/utils/path.d.ts +24 -1
- package/dts/chart/utils/path.d.ts.map +1 -1
- package/dts/chart/utils/point.d.ts +40 -7
- package/dts/chart/utils/point.d.ts.map +1 -1
- package/dts/chart/utils/scale.d.ts +11 -0
- package/dts/chart/utils/scale.d.ts.map +1 -1
- package/dts/chart/utils/scrubber.d.ts +39 -0
- package/dts/chart/utils/scrubber.d.ts.map +1 -0
- package/dts/chart/utils/transition.d.ts +65 -0
- package/dts/chart/utils/transition.d.ts.map +1 -0
- package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +1 -1
- package/esm/chart/CartesianChart.js +140 -85
- package/esm/chart/Path.js +53 -47
- package/esm/chart/PeriodSelector.js +4 -18
- package/esm/chart/area/Area.js +24 -34
- package/esm/chart/area/AreaChart.js +24 -15
- package/esm/chart/area/DottedArea.js +35 -89
- package/esm/chart/area/GradientArea.js +34 -80
- package/esm/chart/area/SolidArea.js +29 -11
- package/esm/chart/axis/Axis.js +4 -39
- package/esm/chart/axis/DefaultAxisTickLabel.js +15 -0
- package/esm/chart/axis/XAxis.js +184 -63
- package/esm/chart/axis/YAxis.js +190 -57
- package/esm/chart/axis/index.js +1 -0
- package/esm/chart/bar/Bar.js +3 -1
- package/esm/chart/bar/BarChart.js +15 -32
- package/esm/chart/bar/BarPlot.js +3 -2
- package/esm/chart/bar/BarStack.js +65 -23
- package/esm/chart/bar/BarStackGroup.js +7 -17
- package/esm/chart/bar/DefaultBar.js +4 -7
- package/esm/chart/bar/DefaultBarStack.js +5 -7
- package/esm/chart/gradient/Gradient.js +104 -0
- package/esm/chart/gradient/index.js +1 -0
- package/esm/chart/index.js +2 -1
- package/esm/chart/line/DefaultReferenceLineLabel.js +81 -0
- package/esm/chart/line/DottedLine.js +38 -17
- package/esm/chart/line/Line.js +96 -70
- package/esm/chart/line/LineChart.js +18 -6
- package/esm/chart/line/ReferenceLine.js +41 -43
- package/esm/chart/line/SolidLine.js +36 -15
- package/esm/chart/line/index.js +1 -1
- package/esm/chart/{line/GradientLine.js → point/DefaultPointLabel.js} +31 -45
- package/esm/chart/point/Point.css +2 -0
- package/esm/chart/{Point.js → point/Point.js} +66 -57
- package/esm/chart/point/index.js +2 -0
- package/esm/chart/scrubber/DefaultScrubberBeacon.js +155 -0
- package/esm/chart/scrubber/{ScrubberBeaconLabel.js → DefaultScrubberBeaconLabel.js} +23 -10
- package/esm/chart/scrubber/DefaultScrubberLabel.js +30 -0
- package/esm/chart/scrubber/Scrubber.js +98 -392
- package/esm/chart/scrubber/ScrubberBeaconGroup.js +166 -0
- package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +186 -0
- package/esm/chart/scrubber/index.js +3 -1
- package/esm/chart/text/ChartText.js +15 -20
- package/esm/chart/text/{SmartChartTextGroup.js → ChartTextGroup.js} +4 -3
- package/esm/chart/text/index.js +1 -1
- package/esm/chart/utils/axis.js +45 -29
- package/esm/chart/utils/chart.js +29 -3
- package/esm/chart/utils/gradient.js +257 -0
- package/esm/chart/utils/index.js +4 -0
- package/esm/chart/utils/interpolate.js +644 -0
- package/esm/chart/utils/path.js +32 -9
- package/esm/chart/utils/point.js +99 -12
- package/esm/chart/utils/scale.js +13 -2
- package/esm/chart/utils/scrubber.js +132 -0
- package/esm/chart/utils/transition.js +111 -0
- package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +8 -4
- package/package.json +9 -9
- package/dts/chart/Point.d.ts +0 -153
- package/dts/chart/Point.d.ts.map +0 -1
- package/dts/chart/line/GradientLine.d.ts +0 -42
- package/dts/chart/line/GradientLine.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeacon.d.ts +0 -93
- package/dts/chart/scrubber/ScrubberBeacon.d.ts.map +0 -1
- package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts +0 -7
- package/dts/chart/scrubber/ScrubberBeaconLabel.d.ts.map +0 -1
- package/dts/chart/text/SmartChartTextGroup.d.ts.map +0 -1
- package/esm/chart/Point.css +0 -2
- package/esm/chart/scrubber/ScrubberBeacon.js +0 -195
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["
|
|
1
|
+
const _excluded = ["x", "y", "position", "offset", "children"];
|
|
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,53 +6,39 @@ 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,
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { memo, useMemo } from 'react';
|
|
10
|
+
import { ChartText } from '../text';
|
|
11
|
+
import { getAlignmentFromPosition, getLabelCoordinates } from '../utils/point';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* DefaultPointLabel is the default label component for point labels.
|
|
15
|
+
* It renders text at the specified position relative to the point.
|
|
14
16
|
*/
|
|
15
|
-
export const
|
|
17
|
+
export const DefaultPointLabel = /*#__PURE__*/memo(_ref => {
|
|
16
18
|
let {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
startOpacity = strokeOpacity,
|
|
23
|
-
endOpacity = strokeOpacity,
|
|
24
|
-
strokeLinecap = 'round',
|
|
25
|
-
strokeLinejoin = 'round',
|
|
26
|
-
strokeWidth = 2
|
|
19
|
+
x,
|
|
20
|
+
y,
|
|
21
|
+
position = 'center',
|
|
22
|
+
offset,
|
|
23
|
+
children
|
|
27
24
|
} = _ref,
|
|
28
25
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})
|
|
48
|
-
}), /*#__PURE__*/_jsx(Path, _objectSpread({
|
|
49
|
-
clipOffset: strokeWidth,
|
|
50
|
-
fill: fill,
|
|
51
|
-
stroke: "url(#".concat(patternId, ")"),
|
|
52
|
-
strokeLinecap: strokeLinecap,
|
|
53
|
-
strokeLinejoin: strokeLinejoin,
|
|
54
|
-
strokeOpacity: strokeOpacity,
|
|
55
|
-
strokeWidth: strokeWidth
|
|
56
|
-
}, props))]
|
|
57
|
-
});
|
|
26
|
+
const {
|
|
27
|
+
horizontalAlignment,
|
|
28
|
+
verticalAlignment
|
|
29
|
+
} = useMemo(() => getAlignmentFromPosition(position), [position]);
|
|
30
|
+
const labelCoordinates = useMemo(() => {
|
|
31
|
+
if (offset === undefined) return {
|
|
32
|
+
x,
|
|
33
|
+
y
|
|
34
|
+
};
|
|
35
|
+
return getLabelCoordinates(x, y, position, offset);
|
|
36
|
+
}, [x, y, position, offset]);
|
|
37
|
+
return /*#__PURE__*/_jsx(ChartText, _objectSpread(_objectSpread({}, props), {}, {
|
|
38
|
+
horizontalAlignment: horizontalAlignment,
|
|
39
|
+
verticalAlignment: verticalAlignment,
|
|
40
|
+
x: labelCoordinates.x,
|
|
41
|
+
y: labelCoordinates.y,
|
|
42
|
+
children: children
|
|
43
|
+
}));
|
|
58
44
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["dataX", "dataY", "yAxisId", "fill", "radius", "opacity", "onClick", "
|
|
1
|
+
const _excluded = ["dataX", "dataY", "yAxisId", "fill", "radius", "opacity", "onClick", "className", "style", "classNames", "styles", "stroke", "strokeWidth", "accessibilityLabel", "label", "LabelComponent", "labelPosition", "labelOffset", "labelFont", "testID", "animate", "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,23 +6,18 @@ 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 React, { memo,
|
|
9
|
+
import React, { memo, useMemo } from 'react';
|
|
10
10
|
import { cx } from '@coinbase/cds-web';
|
|
11
11
|
import { m as motion } from 'framer-motion';
|
|
12
|
-
import { useCartesianChartContext } from '
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { jsx as _jsx,
|
|
16
|
-
const containerCss = "cds-containerCss-
|
|
17
|
-
const innerPointCss = "cds-innerPointCss-
|
|
12
|
+
import { useCartesianChartContext } from '../ChartProvider';
|
|
13
|
+
import { projectPoint } from '../utils';
|
|
14
|
+
import { DefaultPointLabel } from './DefaultPointLabel';
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const containerCss = "cds-containerCss-ckemp0e";
|
|
17
|
+
const innerPointCss = "cds-innerPointCss-ik8duli";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Shared configuration for point appearance and behavior.
|
|
25
|
-
* Used by line-associated points rendered via Line/LineChart components.
|
|
20
|
+
* Props for point label components.
|
|
26
21
|
*/
|
|
27
22
|
|
|
28
23
|
export const Point = /*#__PURE__*/memo(_ref => {
|
|
@@ -31,10 +26,9 @@ export const Point = /*#__PURE__*/memo(_ref => {
|
|
|
31
26
|
dataY,
|
|
32
27
|
yAxisId,
|
|
33
28
|
fill = 'var(--color-fgPrimary)',
|
|
34
|
-
radius =
|
|
29
|
+
radius = 5,
|
|
35
30
|
opacity,
|
|
36
31
|
onClick,
|
|
37
|
-
onScrubberEnter,
|
|
38
32
|
className,
|
|
39
33
|
style,
|
|
40
34
|
classNames,
|
|
@@ -43,27 +37,25 @@ export const Point = /*#__PURE__*/memo(_ref => {
|
|
|
43
37
|
strokeWidth = 2,
|
|
44
38
|
accessibilityLabel,
|
|
45
39
|
label,
|
|
46
|
-
|
|
40
|
+
LabelComponent = DefaultPointLabel,
|
|
41
|
+
labelPosition = 'center',
|
|
42
|
+
labelOffset = radius * 2,
|
|
43
|
+
labelFont,
|
|
47
44
|
testID,
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
animate: animateProp,
|
|
46
|
+
transition
|
|
50
47
|
} = _ref,
|
|
51
48
|
svgProps = _objectWithoutProperties(_ref, _excluded);
|
|
52
49
|
const {
|
|
53
50
|
getXScale,
|
|
54
51
|
getYScale,
|
|
55
|
-
animate: animationEnabled
|
|
52
|
+
animate: animationEnabled,
|
|
53
|
+
drawingArea
|
|
56
54
|
} = useCartesianChartContext();
|
|
57
|
-
const
|
|
58
|
-
scrubberPosition
|
|
59
|
-
} = useScrubberContext();
|
|
55
|
+
const animate = animateProp !== null && animateProp !== void 0 ? animateProp : animationEnabled;
|
|
60
56
|
const xScale = getXScale();
|
|
61
57
|
const yScale = getYScale(yAxisId);
|
|
62
|
-
const isScrubberHighlighted = scrubberPosition !== undefined && scrubberPosition === dataX;
|
|
63
58
|
const pixelCoordinate = useMemo(() => {
|
|
64
|
-
if (pixelCoordinates) {
|
|
65
|
-
return pixelCoordinates;
|
|
66
|
-
}
|
|
67
59
|
if (!xScale || !yScale) {
|
|
68
60
|
return {
|
|
69
61
|
x: 0,
|
|
@@ -76,15 +68,11 @@ export const Point = /*#__PURE__*/memo(_ref => {
|
|
|
76
68
|
xScale,
|
|
77
69
|
yScale
|
|
78
70
|
});
|
|
79
|
-
}, [xScale, yScale, dataX, dataY
|
|
80
|
-
|
|
81
|
-
if (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
y: pixelCoordinate.y
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}, [isScrubberHighlighted, onScrubberEnter, pixelCoordinate.x, pixelCoordinate.y]);
|
|
71
|
+
}, [xScale, yScale, dataX, dataY]);
|
|
72
|
+
const isWithinDrawingArea = useMemo(() => {
|
|
73
|
+
if (!pixelCoordinate) return false;
|
|
74
|
+
return pixelCoordinate.x >= drawingArea.x && pixelCoordinate.x <= drawingArea.x + drawingArea.width && pixelCoordinate.y >= drawingArea.y && pixelCoordinate.y <= drawingArea.y + drawingArea.height;
|
|
75
|
+
}, [pixelCoordinate, drawingArea]);
|
|
88
76
|
const innerPoint = useMemo(() => {
|
|
89
77
|
const mergedStyles = _objectSpread(_objectSpread({
|
|
90
78
|
cursor: onClick !== undefined ? 'pointer' : undefined
|
|
@@ -113,15 +101,33 @@ export const Point = /*#__PURE__*/memo(_ref => {
|
|
|
113
101
|
});
|
|
114
102
|
}
|
|
115
103
|
} : undefined;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
if (!animate) {
|
|
105
|
+
return /*#__PURE__*/_jsx("circle", _objectSpread({
|
|
106
|
+
"aria-label": accessibilityLabel,
|
|
107
|
+
className: cx(innerPointCss, className, classNames === null || classNames === void 0 ? void 0 : classNames.point),
|
|
108
|
+
cx: pixelCoordinate.x,
|
|
109
|
+
cy: pixelCoordinate.y,
|
|
110
|
+
fill: fill,
|
|
111
|
+
onClick: onClick ? event => onClick(event, {
|
|
112
|
+
dataX,
|
|
113
|
+
dataY,
|
|
114
|
+
x: pixelCoordinate.x,
|
|
115
|
+
y: pixelCoordinate.y
|
|
116
|
+
}) : undefined,
|
|
117
|
+
onKeyDown: handleKeyDown,
|
|
118
|
+
r: radius,
|
|
119
|
+
role: onClick ? 'button' : undefined,
|
|
120
|
+
stroke: stroke,
|
|
121
|
+
strokeWidth: strokeWidth,
|
|
122
|
+
style: mergedStyles,
|
|
123
|
+
tabIndex: onClick ? 0 : -1
|
|
124
|
+
}, svgProps));
|
|
125
|
+
}
|
|
120
126
|
return /*#__PURE__*/_jsx(motion.circle, _objectSpread({
|
|
121
|
-
animate:
|
|
127
|
+
animate: {
|
|
122
128
|
cx: pixelCoordinate.x,
|
|
123
129
|
cy: pixelCoordinate.y
|
|
124
|
-
}
|
|
130
|
+
},
|
|
125
131
|
"aria-label": accessibilityLabel,
|
|
126
132
|
className: cx(innerPointCss, className, classNames === null || classNames === void 0 ? void 0 : classNames.point),
|
|
127
133
|
cx: pixelCoordinate.x,
|
|
@@ -141,31 +147,34 @@ export const Point = /*#__PURE__*/memo(_ref => {
|
|
|
141
147
|
strokeWidth: strokeWidth,
|
|
142
148
|
style: mergedStyles,
|
|
143
149
|
tabIndex: onClick ? 0 : -1,
|
|
144
|
-
transition:
|
|
145
|
-
duration: 0.3,
|
|
146
|
-
ease: 'easeInOut'
|
|
147
|
-
},
|
|
150
|
+
transition: transition,
|
|
148
151
|
variants: variants,
|
|
149
|
-
whileHover:
|
|
150
|
-
whileTap:
|
|
152
|
+
whileHover: onClick ? 'hovered' : 'default',
|
|
153
|
+
whileTap: onClick ? 'pressed' : 'default'
|
|
151
154
|
}, svgProps));
|
|
152
|
-
}, [style, styles === null || styles === void 0 ? void 0 : styles.point, classNames === null || classNames === void 0 ? void 0 : classNames.point, fill, animate,
|
|
155
|
+
}, [style, styles === null || styles === void 0 ? void 0 : styles.point, classNames === null || classNames === void 0 ? void 0 : classNames.point, fill, animate, radius, className, onClick, stroke, strokeWidth, svgProps, dataX, dataY, pixelCoordinate.x, pixelCoordinate.y, accessibilityLabel, transition]);
|
|
153
156
|
if (!xScale || !yScale) {
|
|
154
|
-
return
|
|
157
|
+
return;
|
|
155
158
|
}
|
|
156
|
-
return /*#__PURE__*/_jsxs(
|
|
159
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
160
|
+
opacity: isWithinDrawingArea ? 1 : 0,
|
|
157
161
|
children: [/*#__PURE__*/_jsx("g", {
|
|
158
|
-
className: cx(containerCss, classNames === null || classNames === void 0 ? void 0 : classNames.
|
|
162
|
+
className: cx(containerCss, classNames === null || classNames === void 0 ? void 0 : classNames.root),
|
|
159
163
|
"data-testid": testID,
|
|
160
164
|
opacity: opacity,
|
|
161
|
-
style: styles === null || styles === void 0 ? void 0 : styles.
|
|
165
|
+
style: styles === null || styles === void 0 ? void 0 : styles.root,
|
|
162
166
|
children: innerPoint
|
|
163
|
-
}), label && /*#__PURE__*/_jsx(
|
|
167
|
+
}), label && /*#__PURE__*/_jsx(LabelComponent, {
|
|
168
|
+
dataX: dataX,
|
|
169
|
+
dataY: dataY,
|
|
170
|
+
fill: fill,
|
|
171
|
+
font: labelFont,
|
|
172
|
+
offset: labelOffset,
|
|
173
|
+
position: labelPosition,
|
|
164
174
|
x: pixelCoordinate.x,
|
|
165
|
-
y: pixelCoordinate.y
|
|
166
|
-
}, labelProps), {}, {
|
|
175
|
+
y: pixelCoordinate.y,
|
|
167
176
|
children: label
|
|
168
|
-
})
|
|
177
|
+
})]
|
|
169
178
|
});
|
|
170
179
|
});
|
|
171
180
|
import "./Point.css";
|
|
@@ -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", "
|
|
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
|
-
*
|
|
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
|
|
17
|
+
export const DefaultScrubberBeaconLabel = /*#__PURE__*/memo(_ref => {
|
|
16
18
|
let {
|
|
17
|
-
background = '
|
|
19
|
+
background = 'var(--color-bg',
|
|
18
20
|
color = 'var(--color-fgPrimary)',
|
|
19
|
-
|
|
20
|
-
borderRadius =
|
|
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
|
-
|
|
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
|
+
});
|