@ledgerhq/lumen-ui-react 0.1.56 → 0.1.58
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/ai-rules/RULES.md +5 -4
- package/dist/index.js +176 -172
- package/dist/lib/Components/core/DotIcon/DotIcon.d.ts +0 -13
- package/dist/lib/Components/core/DotIcon/DotIcon.d.ts.map +1 -1
- package/dist/lib/Components/core/DotIcon/DotIcon.js +15 -28
- package/dist/lib/Components/core/DotIcon/getDotIconProps.d.ts +66 -0
- package/dist/lib/Components/core/DotIcon/getDotIconProps.d.ts.map +1 -0
- package/dist/lib/Components/core/DotIcon/getDotIconProps.js +19 -0
- package/dist/lib/Components/core/DotIcon/index.d.ts +9 -1
- package/dist/lib/Components/core/DotIcon/index.d.ts.map +1 -1
- package/dist/lib/Components/core/DotIcon/index.js +10 -0
- package/dist/lib/Components/core/DotSymbol/DotSymbol.d.ts +1 -5
- package/dist/lib/Components/core/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/lib/Components/core/DotSymbol/DotSymbol.js +14 -33
- package/dist/lib/Components/core/DotSymbol/getDotSymbolProps.d.ts +102 -0
- package/dist/lib/Components/core/DotSymbol/getDotSymbolProps.d.ts.map +1 -0
- package/dist/lib/Components/core/DotSymbol/getDotSymbolProps.js +25 -0
- package/dist/lib/Components/core/DotSymbol/index.d.ts +14 -1
- package/dist/lib/Components/core/DotSymbol/index.d.ts.map +1 -1
- package/dist/lib/Components/core/DotSymbol/index.js +15 -0
- package/dist/lib/Components/core/Tooltip/Tooltip.d.ts +0 -8
- package/dist/lib/Components/core/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/lib/Components/core/Tooltip/Tooltip.js +1 -1
- package/dist/lib/Components/visualization/Axis/XAxis/XAxis.d.ts +3 -0
- package/dist/lib/Components/visualization/Axis/XAxis/XAxis.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/XAxis/XAxis.js +85 -0
- package/dist/lib/Components/visualization/Axis/XAxis/index.d.ts +3 -0
- package/dist/lib/Components/visualization/Axis/XAxis/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/XAxis/types.d.ts +9 -0
- package/dist/lib/Components/visualization/Axis/XAxis/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/YAxis/YAxis.d.ts +3 -0
- package/dist/lib/Components/visualization/Axis/YAxis/YAxis.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/YAxis/YAxis.js +85 -0
- package/dist/lib/Components/visualization/Axis/YAxis/index.d.ts +3 -0
- package/dist/lib/Components/visualization/Axis/YAxis/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/YAxis/types.d.ts +14 -0
- package/dist/lib/Components/visualization/Axis/YAxis/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/index.d.ts +2 -0
- package/dist/lib/Components/visualization/Axis/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Axis/types.d.ts +80 -0
- package/dist/lib/Components/visualization/Axis/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts +3 -0
- package/dist/lib/Components/visualization/CartesianChart/CartesianChart.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/CartesianChart.js +107 -0
- package/dist/lib/Components/visualization/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts +11 -0
- package/dist/lib/Components/visualization/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js +21 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts +3 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/RevealAnimationProvider.js +41 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/context.d.ts +15 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/context.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/context.js +10 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/index.d.ts +3 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/types.d.ts +57 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/utils.d.ts +35 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/RevealAnimation/utils.js +69 -0
- package/dist/lib/Components/visualization/CartesianChart/context/cartesianChartContext.d.ts +8 -0
- package/dist/lib/Components/visualization/CartesianChart/context/cartesianChartContext.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/context/cartesianChartContext.js +9 -0
- package/dist/lib/Components/visualization/CartesianChart/context/index.d.ts +3 -0
- package/dist/lib/Components/visualization/CartesianChart/context/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/context/useBuildChartContext.d.ts +25 -0
- package/dist/lib/Components/visualization/CartesianChart/context/useBuildChartContext.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/context/useBuildChartContext.js +61 -0
- package/dist/lib/Components/visualization/CartesianChart/hooks/useShimmerAnimation.d.ts +18 -0
- package/dist/lib/Components/visualization/CartesianChart/hooks/useShimmerAnimation.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/hooks/useShimmerAnimation.js +15 -0
- package/dist/lib/Components/visualization/CartesianChart/index.d.ts +4 -0
- package/dist/lib/Components/visualization/CartesianChart/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/types.d.ts +127 -0
- package/dist/lib/Components/visualization/CartesianChart/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/utils.d.ts +5 -0
- package/dist/lib/Components/visualization/CartesianChart/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/CartesianChart/utils.js +24 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts +3 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChart.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChart.js +90 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartAnimatedCenter.d.ts +10 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartAnimatedCenter.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartAnimatedCenter.js +61 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.d.ts +9 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartCenter.js +20 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartDescription.d.ts +3 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartDescription.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartDescription.js +49 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartTitle.d.ts +3 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartTitle.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/DonutChartTitle.js +55 -0
- package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts +12 -0
- package/dist/lib/Components/visualization/DonutChart/DonutRing.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/DonutRing.js +110 -0
- package/dist/lib/Components/visualization/DonutChart/RevealAnimation.d.ts +7 -0
- package/dist/lib/Components/visualization/DonutChart/RevealAnimation.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/RevealAnimation.js +28 -0
- package/dist/lib/Components/visualization/DonutChart/donutSizeContext.d.ts +18 -0
- package/dist/lib/Components/visualization/DonutChart/donutSizeContext.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/donutSizeContext.js +6 -0
- package/dist/lib/Components/visualization/DonutChart/hooks/useContrastSafeSeries.d.ts +12 -0
- package/dist/lib/Components/visualization/DonutChart/hooks/useContrastSafeSeries.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/hooks/useContrastSafeSeries.js +13 -0
- package/dist/lib/Components/visualization/DonutChart/hooks/useDonutLoadingAnimation.d.ts +8 -0
- package/dist/lib/Components/visualization/DonutChart/hooks/useDonutLoadingAnimation.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/hooks/useDonutLoadingAnimation.js +16 -0
- package/dist/lib/Components/visualization/DonutChart/index.d.ts +7 -0
- package/dist/lib/Components/visualization/DonutChart/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/types.d.ts +172 -0
- package/dist/lib/Components/visualization/DonutChart/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/index.d.ts +3 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/useDonutSeries.d.ts +10 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/useDonutSeries.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/useDonutSeries.js +16 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/utils.d.ts +9 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/useDonutSeries/utils.js +46 -0
- package/dist/lib/Components/visualization/DonutChart/utils.d.ts +37 -0
- package/dist/lib/Components/visualization/DonutChart/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/DonutChart/utils.js +83 -0
- package/dist/lib/Components/visualization/Legend/Legend.d.ts +3 -0
- package/dist/lib/Components/visualization/Legend/Legend.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Legend/Legend.js +23 -0
- package/dist/lib/Components/visualization/Legend/LegendItem.d.ts +7 -0
- package/dist/lib/Components/visualization/Legend/LegendItem.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Legend/LegendItem.js +19 -0
- package/dist/lib/Components/visualization/Legend/index.d.ts +3 -0
- package/dist/lib/Components/visualization/Legend/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Legend/types.d.ts +32 -0
- package/dist/lib/Components/visualization/Legend/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Line/Line.d.ts +3 -0
- package/dist/lib/Components/visualization/Line/Line.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Line/Line.js +82 -0
- package/dist/lib/Components/visualization/Line/index.d.ts +3 -0
- package/dist/lib/Components/visualization/Line/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Line/types.d.ts +45 -0
- package/dist/lib/Components/visualization/Line/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Line/utils.d.ts +28 -0
- package/dist/lib/Components/visualization/Line/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Line/utils.js +34 -0
- package/dist/lib/Components/visualization/LineChart/LineChart.d.ts +3 -0
- package/dist/lib/Components/visualization/LineChart/LineChart.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/LineChart.js +181 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts +9 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/LineChartEmptyState.js +51 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/index.d.ts +3 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/types.d.ts +3 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/utils.d.ts +8 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/LineChartEmptyState/utils.js +8 -0
- package/dist/lib/Components/visualization/LineChart/index.d.ts +3 -0
- package/dist/lib/Components/visualization/LineChart/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/types.d.ts +82 -0
- package/dist/lib/Components/visualization/LineChart/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/utils.d.ts +56 -0
- package/dist/lib/Components/visualization/LineChart/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/LineChart/utils.js +57 -0
- package/dist/lib/Components/visualization/Point/Point.d.ts +4 -0
- package/dist/lib/Components/visualization/Point/Point.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/Point.js +122 -0
- package/dist/lib/Components/visualization/Point/index.d.ts +3 -0
- package/dist/lib/Components/visualization/Point/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/pointContext/MagneticPointsProvider.d.ts +7 -0
- package/dist/lib/Components/visualization/Point/pointContext/MagneticPointsProvider.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/pointContext/MagneticPointsProvider.js +22 -0
- package/dist/lib/Components/visualization/Point/pointContext/index.d.ts +3 -0
- package/dist/lib/Components/visualization/Point/pointContext/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/pointContext/magneticPointsContext.d.ts +30 -0
- package/dist/lib/Components/visualization/Point/pointContext/magneticPointsContext.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/pointContext/magneticPointsContext.js +14 -0
- package/dist/lib/Components/visualization/Point/types.d.ts +110 -0
- package/dist/lib/Components/visualization/Point/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/usePointGeometry.d.ts +33 -0
- package/dist/lib/Components/visualization/Point/usePointGeometry.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/usePointGeometry.js +30 -0
- package/dist/lib/Components/visualization/Point/utils.d.ts +51 -0
- package/dist/lib/Components/visualization/Point/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Point/utils.js +54 -0
- package/dist/lib/Components/visualization/ReferenceLine/ReferenceLine.d.ts +3 -0
- package/dist/lib/Components/visualization/ReferenceLine/ReferenceLine.d.ts.map +1 -0
- package/dist/lib/Components/visualization/ReferenceLine/ReferenceLine.js +42 -0
- package/dist/lib/Components/visualization/ReferenceLine/index.d.ts +3 -0
- package/dist/lib/Components/visualization/ReferenceLine/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/ReferenceLine/types.d.ts +74 -0
- package/dist/lib/Components/visualization/ReferenceLine/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.d.ts +21 -0
- package/dist/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.d.ts.map +1 -0
- package/dist/lib/Components/visualization/ReferenceLine/useReferenceLineGeometry.js +49 -0
- package/dist/lib/Components/visualization/ReferenceLine/utils.d.ts +50 -0
- package/dist/lib/Components/visualization/ReferenceLine/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/ReferenceLine/utils.js +66 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.d.ts +9 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.js +50 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts +12 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +82 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.d.ts +58 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/DefaultScrubberTooltip/utils.js +80 -0
- package/dist/lib/Components/visualization/Scrubber/Scrubber.d.ts +29 -0
- package/dist/lib/Components/visualization/Scrubber/Scrubber.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/Scrubber.js +114 -0
- package/dist/lib/Components/visualization/Scrubber/ScrubberProvider.d.ts +3 -0
- package/dist/lib/Components/visualization/Scrubber/ScrubberProvider.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/ScrubberProvider.js +154 -0
- package/dist/lib/Components/visualization/Scrubber/context/index.d.ts +2 -0
- package/dist/lib/Components/visualization/Scrubber/context/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/context/scrubberContext.d.ts +8 -0
- package/dist/lib/Components/visualization/Scrubber/context/scrubberContext.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/context/scrubberContext.js +9 -0
- package/dist/lib/Components/visualization/Scrubber/index.d.ts +4 -0
- package/dist/lib/Components/visualization/Scrubber/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/types.d.ts +130 -0
- package/dist/lib/Components/visualization/Scrubber/types.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/useScrubberGeometry.d.ts +29 -0
- package/dist/lib/Components/visualization/Scrubber/useScrubberGeometry.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/useScrubberGeometry.js +37 -0
- package/dist/lib/Components/visualization/Scrubber/utils.d.ts +79 -0
- package/dist/lib/Components/visualization/Scrubber/utils.d.ts.map +1 -0
- package/dist/lib/Components/visualization/Scrubber/utils.js +104 -0
- package/dist/lib/Components/visualization/config.d.ts +162 -0
- package/dist/lib/Components/visualization/config.d.ts.map +1 -0
- package/dist/lib/Components/visualization/config.js +156 -0
- package/dist/lib/Components/visualization/index.d.ts +8 -0
- package/dist/lib/Components/visualization/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/index.js +27 -0
- package/dist/lib/Components/visualization/utils/domain/domain.d.ts +18 -0
- package/dist/lib/Components/visualization/utils/domain/domain.d.ts.map +1 -0
- package/dist/lib/Components/visualization/utils/domain/domain.js +35 -0
- package/dist/lib/Components/visualization/utils/index.d.ts +2 -0
- package/dist/lib/Components/visualization/utils/index.d.ts.map +1 -0
- package/dist/lib/Components/visualization/utils/numbers.d.ts +13 -0
- package/dist/lib/Components/visualization/utils/numbers.d.ts.map +1 -0
- package/dist/lib/Components/visualization/utils/numbers.js +5 -0
- package/dist/lib/Components/visualization/utils/scales/scales.d.ts +47 -0
- package/dist/lib/Components/visualization/utils/scales/scales.d.ts.map +1 -0
- package/dist/lib/Components/visualization/utils/scales/scales.js +32 -0
- package/dist/lib/Components/visualization/utils/ticks/ticks.d.ts +35 -0
- package/dist/lib/Components/visualization/utils/ticks/ticks.d.ts.map +1 -0
- package/dist/lib/Components/visualization/utils/ticks/ticks.js +23 -0
- package/dist/lib/Components/visualization/utils/types.d.ts +63 -0
- package/dist/lib/Components/visualization/utils/types.d.ts.map +1 -0
- package/dist/libs/design-core/dist/lib/colorContrast/colorContrast.js +15 -0
- package/dist/libs/design-core/dist/lib/colorContrast/hexToHsl.js +14 -0
- package/dist/libs/design-core/dist/lib/colorContrast/hslToHex.js +10 -0
- package/dist/libs/design-core/dist/lib/themes/js/primitives/primitive.colors.js +15 -0
- package/dist/libs/utils-shared/dist/index.js +115 -113
- package/dist/package.json +12 -4
- package/package.json +12 -4
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsxs as f, jsx as t, Fragment as y } from "react/jsx-runtime";
|
|
2
|
+
import { useId as b } from "react";
|
|
3
|
+
import { chartConfig as h } from "../config.js";
|
|
4
|
+
import { DefaultScrubberTooltip as m } from "./DefaultScrubberTooltip/DefaultScrubberTooltip.js";
|
|
5
|
+
import { useScrubberGeometry as g } from "./useScrubberGeometry.js";
|
|
6
|
+
const { color: C, strokeWidth: x, scrubber: e } = h;
|
|
7
|
+
function k({ pixelX: r, top: s, bottom: o }) {
|
|
8
|
+
const l = b();
|
|
9
|
+
return /* @__PURE__ */ f(y, { children: [
|
|
10
|
+
/* @__PURE__ */ t("defs", { children: /* @__PURE__ */ f(
|
|
11
|
+
"linearGradient",
|
|
12
|
+
{
|
|
13
|
+
id: l,
|
|
14
|
+
gradientUnits: "userSpaceOnUse",
|
|
15
|
+
x1: r,
|
|
16
|
+
y1: s,
|
|
17
|
+
x2: r,
|
|
18
|
+
y2: o,
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ t(
|
|
21
|
+
"stop",
|
|
22
|
+
{
|
|
23
|
+
offset: "0%",
|
|
24
|
+
stopColor: e.lineColor,
|
|
25
|
+
stopOpacity: e.lineGradientEdgeOpacity
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ t("stop", { offset: "20%", stopColor: e.lineColor }),
|
|
29
|
+
/* @__PURE__ */ t("stop", { offset: "80%", stopColor: e.lineColor }),
|
|
30
|
+
/* @__PURE__ */ t(
|
|
31
|
+
"stop",
|
|
32
|
+
{
|
|
33
|
+
offset: "100%",
|
|
34
|
+
stopColor: e.lineColor,
|
|
35
|
+
stopOpacity: e.lineGradientEdgeOpacity
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
) }),
|
|
41
|
+
/* @__PURE__ */ t(
|
|
42
|
+
"line",
|
|
43
|
+
{
|
|
44
|
+
"data-testid": "scrubber-line",
|
|
45
|
+
x1: r,
|
|
46
|
+
y1: s,
|
|
47
|
+
x2: r,
|
|
48
|
+
y2: o,
|
|
49
|
+
stroke: `url(#${l})`,
|
|
50
|
+
strokeWidth: x.hairline
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
] });
|
|
54
|
+
}
|
|
55
|
+
function j({
|
|
56
|
+
hideLine: r = !1,
|
|
57
|
+
hideOverlay: s = !1,
|
|
58
|
+
showBeacons: o = !1,
|
|
59
|
+
tooltip: l
|
|
60
|
+
}) {
|
|
61
|
+
const p = g({ showBeacons: o, tooltip: l });
|
|
62
|
+
if (!p)
|
|
63
|
+
return null;
|
|
64
|
+
const { pixelX: c, drawingArea: n, beacons: u, overlay: a, tooltipPayload: i } = p;
|
|
65
|
+
return /* @__PURE__ */ f("g", { "data-testid": "scrubber", children: [
|
|
66
|
+
!r && /* @__PURE__ */ t(
|
|
67
|
+
k,
|
|
68
|
+
{
|
|
69
|
+
pixelX: c,
|
|
70
|
+
top: n.y,
|
|
71
|
+
bottom: n.y + n.height
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
!s && /* @__PURE__ */ t(
|
|
75
|
+
"rect",
|
|
76
|
+
{
|
|
77
|
+
"data-testid": "scrubber-overlay",
|
|
78
|
+
x: a.x,
|
|
79
|
+
y: a.y,
|
|
80
|
+
width: a.width,
|
|
81
|
+
height: a.height,
|
|
82
|
+
fill: e.overlayColor,
|
|
83
|
+
opacity: e.overlayOpacity
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
o && u.map((d) => /* @__PURE__ */ t(
|
|
87
|
+
"circle",
|
|
88
|
+
{
|
|
89
|
+
"data-testid": `scrubber-beacon-${d.id}`,
|
|
90
|
+
cx: c,
|
|
91
|
+
cy: d.pixelY,
|
|
92
|
+
r: e.beaconRadius,
|
|
93
|
+
fill: d.stroke,
|
|
94
|
+
stroke: C.markOutline,
|
|
95
|
+
strokeWidth: e.beaconStrokeWidth
|
|
96
|
+
},
|
|
97
|
+
d.id
|
|
98
|
+
)),
|
|
99
|
+
i !== void 0 && /* @__PURE__ */ t(
|
|
100
|
+
m,
|
|
101
|
+
{
|
|
102
|
+
pixelX: c,
|
|
103
|
+
drawingArea: n,
|
|
104
|
+
title: i.resolvedTitle,
|
|
105
|
+
items: i.items,
|
|
106
|
+
offset: i.offset,
|
|
107
|
+
minWidth: i.minWidth
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
] });
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
j as Scrubber
|
|
114
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ScrubberProviderProps } from './types';
|
|
2
|
+
export declare function ScrubberProvider({ children, svgRef, enableScrubbing, onScrubberPositionChange, magnetRadius, }: Readonly<ScrubberProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=ScrubberProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAU3E,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,eAAe,EACf,wBAAwB,EACxB,YAA2C,GAC5C,EAAE,QAAQ,CAAC,qBAAqB,CAAC,2CAmOjC"}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { jsx as K } from "react/jsx-runtime";
|
|
2
|
+
import { useState as j, useRef as C, useMemo as X, useCallback as c, useEffect as z } from "react";
|
|
3
|
+
import { chartConfig as H } from "../config.js";
|
|
4
|
+
import { clamp as g } from "../utils/numbers.js";
|
|
5
|
+
import { buildSortedMagnets as N, getDataIndexFromPosition as U, resolvePixelX as V, applyMagnetization as G } from "./utils.js";
|
|
6
|
+
import { useCartesianChartContext as J } from "../CartesianChart/context/cartesianChartContext.js";
|
|
7
|
+
import { useMagneticSnapshot as O } from "../Point/pointContext/magneticPointsContext.js";
|
|
8
|
+
import { ScrubberContextProvider as Q } from "./context/scrubberContext.js";
|
|
9
|
+
const { scrubber: l } = H;
|
|
10
|
+
function te({
|
|
11
|
+
children: T,
|
|
12
|
+
svgRef: D,
|
|
13
|
+
enableScrubbing: r,
|
|
14
|
+
onScrubberPositionChange: R,
|
|
15
|
+
magnetRadius: E = l.defaultMagnetRadius
|
|
16
|
+
}) {
|
|
17
|
+
const { getXScale: m, getXAxisConfig: v, dataLength: n } = J(), { getMagneticPoints: w, version: B } = O(), [h, F] = j(
|
|
18
|
+
void 0
|
|
19
|
+
), p = C(h);
|
|
20
|
+
p.current = h;
|
|
21
|
+
const L = C(null), f = C(0), A = X(() => {
|
|
22
|
+
const e = w();
|
|
23
|
+
return N({
|
|
24
|
+
magneticIndices: e,
|
|
25
|
+
getPixelForIndex: (t) => V(t, m, v())
|
|
26
|
+
});
|
|
27
|
+
}, [B, w, m, v]), a = c(
|
|
28
|
+
(e) => {
|
|
29
|
+
const t = e === void 0 || n <= 0 ? void 0 : g(e, 0, n - 1);
|
|
30
|
+
F(t), R?.(t);
|
|
31
|
+
},
|
|
32
|
+
[n, R]
|
|
33
|
+
), I = c(
|
|
34
|
+
(e) => {
|
|
35
|
+
const t = m();
|
|
36
|
+
if (!t || !r || n <= 0) return;
|
|
37
|
+
const i = v();
|
|
38
|
+
let o = U(
|
|
39
|
+
e,
|
|
40
|
+
t,
|
|
41
|
+
i,
|
|
42
|
+
n
|
|
43
|
+
);
|
|
44
|
+
E > 0 && (o = G({
|
|
45
|
+
resolvedIndex: o,
|
|
46
|
+
pixelX: e,
|
|
47
|
+
sortedMagnets: A,
|
|
48
|
+
magnetRadius: E
|
|
49
|
+
})), o !== p.current && a(o);
|
|
50
|
+
},
|
|
51
|
+
[
|
|
52
|
+
r,
|
|
53
|
+
m,
|
|
54
|
+
v,
|
|
55
|
+
n,
|
|
56
|
+
A,
|
|
57
|
+
E,
|
|
58
|
+
a
|
|
59
|
+
]
|
|
60
|
+
), u = c(
|
|
61
|
+
(e) => {
|
|
62
|
+
L.current = e, f.current || (f.current = requestAnimationFrame(() => {
|
|
63
|
+
f.current = 0;
|
|
64
|
+
const t = L.current;
|
|
65
|
+
t !== null && (L.current = null, I(t));
|
|
66
|
+
}));
|
|
67
|
+
},
|
|
68
|
+
[I]
|
|
69
|
+
), s = c(() => {
|
|
70
|
+
r && a(void 0);
|
|
71
|
+
}, [r, a]), x = c(
|
|
72
|
+
(e) => {
|
|
73
|
+
const i = e.currentTarget.getBoundingClientRect();
|
|
74
|
+
u(e.clientX - i.left);
|
|
75
|
+
},
|
|
76
|
+
[u]
|
|
77
|
+
), P = c(
|
|
78
|
+
(e) => {
|
|
79
|
+
if (!r || !e.touches.length) return;
|
|
80
|
+
const t = e.touches[0], o = e.currentTarget.getBoundingClientRect();
|
|
81
|
+
u(t.clientX - o.left);
|
|
82
|
+
},
|
|
83
|
+
[r, u]
|
|
84
|
+
), k = c(
|
|
85
|
+
(e) => {
|
|
86
|
+
if (!e.touches.length) return;
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
const t = e.touches[0], o = e.currentTarget.getBoundingClientRect();
|
|
89
|
+
u(t.clientX - o.left);
|
|
90
|
+
},
|
|
91
|
+
[u]
|
|
92
|
+
), M = c(
|
|
93
|
+
(e) => {
|
|
94
|
+
if (!r || n <= 0) return;
|
|
95
|
+
const t = n - 1, i = p.current ?? t, o = e.shiftKey ? g(
|
|
96
|
+
Math.floor(t * l.keyboardPageStepRatio),
|
|
97
|
+
l.keyboardPageStepMin,
|
|
98
|
+
l.keyboardPageStepMax
|
|
99
|
+
) : l.keyboardStep;
|
|
100
|
+
let d;
|
|
101
|
+
switch (e.key) {
|
|
102
|
+
case "ArrowLeft":
|
|
103
|
+
e.preventDefault(), d = g(i - o, 0, t);
|
|
104
|
+
break;
|
|
105
|
+
case "ArrowRight":
|
|
106
|
+
e.preventDefault(), d = g(i + o, 0, t);
|
|
107
|
+
break;
|
|
108
|
+
case "Home":
|
|
109
|
+
e.preventDefault(), d = 0;
|
|
110
|
+
break;
|
|
111
|
+
case "End":
|
|
112
|
+
e.preventDefault(), d = t;
|
|
113
|
+
break;
|
|
114
|
+
case "Escape":
|
|
115
|
+
e.preventDefault(), d = void 0;
|
|
116
|
+
break;
|
|
117
|
+
default:
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
a(d);
|
|
121
|
+
},
|
|
122
|
+
[r, n, a]
|
|
123
|
+
), y = c(() => {
|
|
124
|
+
!r || p.current === void 0 || s();
|
|
125
|
+
}, [r, s]);
|
|
126
|
+
z(() => {
|
|
127
|
+
const e = D.current;
|
|
128
|
+
if (!(!e || !r))
|
|
129
|
+
return e.addEventListener("mousemove", x), e.addEventListener("mouseleave", s), e.addEventListener("touchstart", P, { passive: !1 }), e.addEventListener("touchmove", k, { passive: !1 }), e.addEventListener("touchend", s), e.addEventListener("touchcancel", s), e.addEventListener("keydown", M), e.addEventListener("blur", y), () => {
|
|
130
|
+
e.removeEventListener("mousemove", x), e.removeEventListener("mouseleave", s), e.removeEventListener("touchstart", P), e.removeEventListener("touchmove", k), e.removeEventListener("touchend", s), e.removeEventListener("touchcancel", s), e.removeEventListener("keydown", M), e.removeEventListener("blur", y), cancelAnimationFrame(f.current), f.current = 0;
|
|
131
|
+
};
|
|
132
|
+
}, [
|
|
133
|
+
D,
|
|
134
|
+
r,
|
|
135
|
+
x,
|
|
136
|
+
s,
|
|
137
|
+
P,
|
|
138
|
+
k,
|
|
139
|
+
M,
|
|
140
|
+
y
|
|
141
|
+
]);
|
|
142
|
+
const q = X(
|
|
143
|
+
() => ({
|
|
144
|
+
enableScrubbing: r,
|
|
145
|
+
scrubberPosition: h,
|
|
146
|
+
onScrubberPositionChange: a
|
|
147
|
+
}),
|
|
148
|
+
[r, h, a]
|
|
149
|
+
);
|
|
150
|
+
return /* @__PURE__ */ K(Q, { value: q, children: T });
|
|
151
|
+
}
|
|
152
|
+
export {
|
|
153
|
+
te as ScrubberProvider
|
|
154
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/visualization/Scrubber/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ScrubberContextValue } from '../types';
|
|
2
|
+
declare const ScrubberContextProvider: import('react').FC<{
|
|
3
|
+
children: import('react').ReactNode;
|
|
4
|
+
value: ScrubberContextValue;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useScrubberContext: () => ScrubberContextValue;
|
|
7
|
+
export { ScrubberContextProvider };
|
|
8
|
+
//# sourceMappingURL=scrubberContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrubberContext.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/visualization/Scrubber/context/scrubberContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,QAAA,MAAO,uBAAuB;;;EACuB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,QAAO,oBAIlC,CAAC;AAEL,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createSafeContext as e } from "../../../../../libs/utils-shared/dist/index.js";
|
|
2
|
+
const [o, r] = e("Scrubber"), u = () => r({
|
|
3
|
+
consumerName: "useScrubberContext",
|
|
4
|
+
contextRequired: !0
|
|
5
|
+
});
|
|
6
|
+
export {
|
|
7
|
+
o as ScrubberContextProvider,
|
|
8
|
+
u as useScrubberContext
|
|
9
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Scrubber } from './Scrubber';
|
|
2
|
+
export { useScrubberContext } from './context';
|
|
3
|
+
export type { ChartTooltipItemData, ChartTooltipItemProps, ScrubberContextValue, ScrubberProps, ScrubberTooltipContent, ScrubberTooltipProps, SvgTextContent, } from './types';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Scrubber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { ReactElement, ReactNode, Ref, RefObject, SVGProps } from 'react';
|
|
2
|
+
import { ScrubbingOptions } from '../CartesianChart/types';
|
|
3
|
+
import { DrawingArea } from '../utils/types';
|
|
4
|
+
export type ScrubberContextValue = Required<Pick<ScrubbingOptions, 'enableScrubbing' | 'onScrubberPositionChange'>> & {
|
|
5
|
+
/**
|
|
6
|
+
* The current data index of the scrubber, or undefined when idle.
|
|
7
|
+
*/
|
|
8
|
+
scrubberPosition: number | undefined;
|
|
9
|
+
};
|
|
10
|
+
export type ScrubberProviderProps = Omit<ScrubbingOptions, 'enableScrubbing'> & Required<Pick<ScrubbingOptions, 'enableScrubbing'>> & {
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Ref to the root SVG element where event listeners will be attached.
|
|
14
|
+
*/
|
|
15
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Valid content for an SVG `<text>` element: a plain string,
|
|
19
|
+
* a number, or a `<tspan>` element.
|
|
20
|
+
*/
|
|
21
|
+
export type SvgTextContent = string | number | ReactElement<SVGProps<SVGTSpanElement>, 'tspan'>;
|
|
22
|
+
export type ChartTooltipItemData = {
|
|
23
|
+
/**
|
|
24
|
+
* Label displayed on the left side of the row.
|
|
25
|
+
*/
|
|
26
|
+
label: SvgTextContent;
|
|
27
|
+
/**
|
|
28
|
+
* Value displayed on the right side of the row.
|
|
29
|
+
*/
|
|
30
|
+
value: SvgTextContent;
|
|
31
|
+
};
|
|
32
|
+
export type ChartTooltipItemProps = ChartTooltipItemData & {
|
|
33
|
+
/**
|
|
34
|
+
* X position in SVG coordinate space.
|
|
35
|
+
* @default 0
|
|
36
|
+
*/
|
|
37
|
+
x?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Y midline position in SVG coordinate space.
|
|
40
|
+
* @default 0
|
|
41
|
+
*/
|
|
42
|
+
y?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Width allocated to this row, used to right-align the value text.
|
|
45
|
+
*/
|
|
46
|
+
width: number;
|
|
47
|
+
/**
|
|
48
|
+
* Optional ref forwarded to the label `<text>` element. Useful to measure
|
|
49
|
+
* the label's natural width via `getBBox` for auto-fit layouts.
|
|
50
|
+
*/
|
|
51
|
+
labelRef?: Ref<SVGTextElement>;
|
|
52
|
+
/**
|
|
53
|
+
* Optional ref forwarded to the value `<text>` element. Useful to measure
|
|
54
|
+
* the value's natural width via `getBBox` for auto-fit layouts.
|
|
55
|
+
*/
|
|
56
|
+
valueRef?: Ref<SVGTextElement>;
|
|
57
|
+
};
|
|
58
|
+
export type ScrubberTooltipLayoutProps = {
|
|
59
|
+
/**
|
|
60
|
+
* Horizontal gap in pixels between the scrubber line and the tooltip box.
|
|
61
|
+
* @default 10
|
|
62
|
+
*/
|
|
63
|
+
offset?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Minimum width in pixels. The tooltip auto-fits to the rendered content
|
|
66
|
+
* but never collapses below this floor; raise it to avoid jitter when
|
|
67
|
+
* value length changes between indices.
|
|
68
|
+
* @default 80
|
|
69
|
+
*/
|
|
70
|
+
minWidth?: number;
|
|
71
|
+
};
|
|
72
|
+
export type ScrubberTooltipProps = ScrubberTooltipLayoutProps & {
|
|
73
|
+
/**
|
|
74
|
+
* Horizontal pixel position of the scrubber line within the SVG coordinate
|
|
75
|
+
* space. Used to place the tooltip left or right of the line.
|
|
76
|
+
*/
|
|
77
|
+
pixelX: number;
|
|
78
|
+
/**
|
|
79
|
+
* Bounding box of the chart's drawing area (x, y, width, height). Used to
|
|
80
|
+
* constrain the tooltip so it never overflows the chart boundaries.
|
|
81
|
+
*/
|
|
82
|
+
drawingArea: DrawingArea;
|
|
83
|
+
/**
|
|
84
|
+
* Optional title displayed at the top of the tooltip. Omit to render
|
|
85
|
+
* the tooltip without a title row.
|
|
86
|
+
*/
|
|
87
|
+
title?: SvgTextContent;
|
|
88
|
+
/**
|
|
89
|
+
* List of label/value pairs rendered as rows inside the tooltip body.
|
|
90
|
+
*/
|
|
91
|
+
items: ChartTooltipItemData[];
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Return value of the `tooltip` callback on {@link ScrubberProps}.
|
|
95
|
+
*/
|
|
96
|
+
export type ScrubberTooltipContent = ScrubberTooltipLayoutProps & {
|
|
97
|
+
/**
|
|
98
|
+
* Optional header. Static value or callback per data index.
|
|
99
|
+
* A callback may return `undefined` to suppress the title.
|
|
100
|
+
*/
|
|
101
|
+
title?: SvgTextContent | ((index: number) => SvgTextContent | undefined);
|
|
102
|
+
/**
|
|
103
|
+
* Tooltip rows for this index. Return an empty array to hide the tooltip.
|
|
104
|
+
*/
|
|
105
|
+
items: ChartTooltipItemData[];
|
|
106
|
+
};
|
|
107
|
+
export type ScrubberProps = {
|
|
108
|
+
/**
|
|
109
|
+
* Hides the vertical reference line.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
hideLine?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Hides the semi-transparent overlay that dims data after the scrubber position.
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
hideOverlay?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Shows the beacon dots on each series at the scrubbed data index.
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
showBeacons?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Produces tooltip content for the active data index. When set, {@link DefaultScrubberTooltip}
|
|
125
|
+
* is rendered. Optional `offset` and `minWidth` on the returned object tune layout.
|
|
126
|
+
* Return `{ items: [] }` to hide the tooltip at an index.
|
|
127
|
+
*/
|
|
128
|
+
tooltip?: (dataIndex: number) => ScrubberTooltipContent;
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Scrubber/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CACzC,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,0BAA0B,CAAC,CACvE,GAAG;IACF;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,GAC3E,QAAQ,CAAC,IAAI,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,GAAG;IACpD,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;CACzC,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG;IACzD;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,GAAG;IAC9D;;;OAGG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,0BAA0B,GAAG;IAChE;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC,CAAC;IACzE;;OAEG;IACH,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;CACzD,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DrawingArea } from '../utils/types';
|
|
2
|
+
import { ScrubberProps } from './types';
|
|
3
|
+
import { OverlayRect, ScrubberTooltipPayload } from './utils';
|
|
4
|
+
type Beacon = {
|
|
5
|
+
id: string;
|
|
6
|
+
stroke: string;
|
|
7
|
+
pixelY: number;
|
|
8
|
+
};
|
|
9
|
+
type ScrubberGeometry = {
|
|
10
|
+
pixelX: number;
|
|
11
|
+
drawingArea: DrawingArea;
|
|
12
|
+
beacons: Beacon[];
|
|
13
|
+
overlay: OverlayRect;
|
|
14
|
+
tooltipPayload: ScrubberTooltipPayload | undefined;
|
|
15
|
+
};
|
|
16
|
+
type UseScrubberGeometryParams = {
|
|
17
|
+
showBeacons: boolean;
|
|
18
|
+
tooltip: ScrubberProps['tooltip'];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the scrubber's chart geometry: reads the scrubber and chart
|
|
22
|
+
* contexts, projects the active data index to the line's `pixelX`, and derives
|
|
23
|
+
* the per-series beacons, the future-data overlay rect, and the tooltip
|
|
24
|
+
* payload. Returns `null` when no scrubber position is active or the position
|
|
25
|
+
* cannot be projected.
|
|
26
|
+
*/
|
|
27
|
+
export declare const useScrubberGeometry: ({ showBeacons, tooltip, }: UseScrubberGeometryParams) => ScrubberGeometry | null;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=useScrubberGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrubberGeometry.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Scrubber/useScrubberGeometry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC5B,MAAM,SAAS,CAAC;AAIjB,KAAK,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;IACrB,cAAc,EAAE,sBAAsB,GAAG,SAAS,CAAC;CACpD,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CACnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,2BAGjC,yBAAyB,KAAG,gBAAgB,GAAG,IA4CjD,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useMemo as t } from "react";
|
|
2
|
+
import { chartConfig as x } from "../config.js";
|
|
3
|
+
import { resolvePixelX as b, resolvePixelY as g, resolveTooltipPayload as C, computeOverlayRect as y } from "./utils.js";
|
|
4
|
+
import { useScrubberContext as P } from "./context/scrubberContext.js";
|
|
5
|
+
import { useCartesianChartContext as S } from "../CartesianChart/context/cartesianChartContext.js";
|
|
6
|
+
const { color: X } = x, D = ({
|
|
7
|
+
showBeacons: i,
|
|
8
|
+
tooltip: n
|
|
9
|
+
}) => {
|
|
10
|
+
const { scrubberPosition: r } = P(), {
|
|
11
|
+
getXScale: s,
|
|
12
|
+
getXAxisConfig: l,
|
|
13
|
+
getYScale: u,
|
|
14
|
+
drawingArea: a,
|
|
15
|
+
series: c,
|
|
16
|
+
seriesMap: d
|
|
17
|
+
} = S(), o = t(() => {
|
|
18
|
+
if (r !== void 0)
|
|
19
|
+
return b(r, s, l());
|
|
20
|
+
}, [r, s, l]), f = t(() => r === void 0 || !i ? [] : c.map((e) => {
|
|
21
|
+
const p = d.get(e.id)?.data, m = g(r, p, u);
|
|
22
|
+
return m === void 0 ? null : { id: e.id, stroke: e.stroke || X.stroke, pixelY: m };
|
|
23
|
+
}).filter((e) => e !== null), [r, i, c, d, u]), v = t(() => {
|
|
24
|
+
if (r !== void 0)
|
|
25
|
+
return C(n, r);
|
|
26
|
+
}, [r, n]);
|
|
27
|
+
return r === void 0 || o === void 0 ? null : {
|
|
28
|
+
pixelX: o,
|
|
29
|
+
drawingArea: a,
|
|
30
|
+
beacons: f,
|
|
31
|
+
overlay: y(o, a),
|
|
32
|
+
tooltipPayload: v
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
D as useScrubberGeometry
|
|
37
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { BaseAxisProps } from '../Axis';
|
|
2
|
+
import { useCartesianChartContext } from '../CartesianChart/context';
|
|
3
|
+
import { ChartScaleFunction, DrawingArea } from '../utils/types';
|
|
4
|
+
import { ChartTooltipItemData, ScrubberTooltipContent, SvgTextContent } from './types';
|
|
5
|
+
export type MagnetEntry = {
|
|
6
|
+
index: number;
|
|
7
|
+
pixelX: number;
|
|
8
|
+
};
|
|
9
|
+
export type OverlayRect = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
export type ScrubberTooltipPayload = {
|
|
16
|
+
items: ChartTooltipItemData[];
|
|
17
|
+
resolvedTitle: SvgTextContent | undefined;
|
|
18
|
+
offset?: number;
|
|
19
|
+
minWidth?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Resolves each magnetic index to its pixel position and returns them sorted
|
|
23
|
+
* by `pixelX` ascending. Indices that cannot be projected are filtered out.
|
|
24
|
+
* The sorted output enables early-exit in {@link applyMagnetization}.
|
|
25
|
+
*/
|
|
26
|
+
export declare const buildSortedMagnets: ({ magneticIndices, getPixelForIndex, }: {
|
|
27
|
+
magneticIndices: ReadonlySet<number>;
|
|
28
|
+
getPixelForIndex: (index: number) => number | undefined;
|
|
29
|
+
}) => MagnetEntry[];
|
|
30
|
+
/**
|
|
31
|
+
* Converts a pixel position along the x-axis into the nearest data index.
|
|
32
|
+
*
|
|
33
|
+
* For band (categorical) scales, finds the band whose center is closest to
|
|
34
|
+
* `pixelX`. For numeric scales, uses `scale.invert()` and rounds to the
|
|
35
|
+
* nearest integer, clamped to the valid index range.
|
|
36
|
+
*/
|
|
37
|
+
export declare const getDataIndexFromPosition: (pixelX: number, scale: ChartScaleFunction, axisConfig: Partial<BaseAxisProps> | undefined, dataLength: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the pixel y-coordinate for a given series data point at a data index.
|
|
40
|
+
* Returns undefined when the value is null/missing or the scale is unavailable.
|
|
41
|
+
*/
|
|
42
|
+
export declare const resolvePixelY: (dataIndex: number, seriesData: (number | null)[] | undefined, getYScale: ReturnType<typeof useCartesianChartContext>["getYScale"]) => number | undefined;
|
|
43
|
+
/**
|
|
44
|
+
* Resolves the pixel x-coordinate for a given data index using the x-scale.
|
|
45
|
+
* When numeric x-axis data is provided, the corresponding axis value is used;
|
|
46
|
+
* otherwise the data index is used as the x input.
|
|
47
|
+
* Returns undefined when the scale is unavailable or the value cannot be mapped.
|
|
48
|
+
*/
|
|
49
|
+
export declare const resolvePixelX: (dataIndex: number, getXScale: ReturnType<typeof useCartesianChartContext>["getXScale"], axisConfig?: BaseAxisProps) => number | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Binary search for the magnet whose `pixelX` is closest to `pixelX`.
|
|
52
|
+
* Returns -1 when the array is empty. Favors the left neighbor on ties.
|
|
53
|
+
*/
|
|
54
|
+
export declare const nearestIndex: (sortedMagnets: readonly MagnetEntry[], pixelX: number) => number;
|
|
55
|
+
/**
|
|
56
|
+
* Given a resolved data index and the raw pixel position, checks whether any
|
|
57
|
+
* magnetic point is within `magnetRadius` pixels of `pixelX`. If so, returns
|
|
58
|
+
* the closest magnetic index; otherwise returns the original `resolvedIndex`.
|
|
59
|
+
*/
|
|
60
|
+
export declare const applyMagnetization: ({ resolvedIndex, pixelX, sortedMagnets, magnetRadius, }: {
|
|
61
|
+
resolvedIndex: number;
|
|
62
|
+
pixelX: number;
|
|
63
|
+
sortedMagnets: readonly MagnetEntry[];
|
|
64
|
+
magnetRadius: number;
|
|
65
|
+
}) => number;
|
|
66
|
+
/**
|
|
67
|
+
* Computes the rect that dims the data after the scrubber line. It starts just
|
|
68
|
+
* right of the line and spans to the drawing area's right edge, padded by
|
|
69
|
+
* `overlayOffset` on the top, bottom, and right. Width is clamped at 0 so the
|
|
70
|
+
* rect never inverts when the line sits at the right edge.
|
|
71
|
+
*/
|
|
72
|
+
export declare const computeOverlayRect: (pixelX: number, drawingArea: DrawingArea) => OverlayRect;
|
|
73
|
+
/**
|
|
74
|
+
* Resolves the `tooltip` callback for a data index into render-ready payload:
|
|
75
|
+
* invokes the callback, resolves a function `title`, and returns `undefined`
|
|
76
|
+
* when there is no callback or it yields no items (so nothing is rendered).
|
|
77
|
+
*/
|
|
78
|
+
export declare const resolveTooltipPayload: (tooltip: ((dataIndex: number) => ScrubberTooltipContent) | undefined, scrubberPosition: number) => ScrubberTooltipPayload | undefined;
|
|
79
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/visualization/Scrubber/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAQ1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEtE,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACf,MAAM,SAAS,CAAC;AAIjB,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,oBAAoB,EAAE,CAAC;IAC9B,aAAa,EAAE,cAAc,GAAG,SAAS,CAAC;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,wCAGhC;IACD,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CACzD,KAAG,WAAW,EAad,CAAC;AAgCF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,EACd,OAAO,kBAAkB,EACzB,YAAY,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,EAC9C,YAAY,MAAM,KACjB,MAwBF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EACzC,WAAW,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,WAAW,CAAC,KAClE,MAAM,GAAG,SASX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,WAAW,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,WAAW,CAAC,EACnE,aAAa,aAAa,KACzB,MAAM,GAAG,SAMX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,eAAe,SAAS,WAAW,EAAE,EACrC,QAAQ,MAAM,KACb,MAsBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAI,yDAKhC;IACD,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,SAAS,WAAW,EAAE,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC;CACtB,KAAG,MAWH,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,MAAM,EACd,aAAa,WAAW,KACvB,WAYD,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAChC,SAAS,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC,GAAG,SAAS,EACpE,kBAAkB,MAAM,KACvB,sBAAsB,GAAG,SAiB3B,CAAC"}
|