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