@ledgerhq/lumen-ui-react-visualization 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -5
- package/dist/lib/Components/Axis/XAxis/XAxis.d.ts.map +1 -1
- package/dist/lib/Components/Axis/XAxis/XAxis.js +7 -5
- package/dist/lib/Components/Axis/YAxis/YAxis.d.ts.map +1 -1
- package/dist/lib/Components/Axis/YAxis/YAxis.js +8 -6
- package/dist/lib/Components/CartesianChart/CartesianChart.d.ts +1 -1
- package/dist/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
- package/dist/lib/Components/CartesianChart/CartesianChart.js +67 -50
- package/dist/lib/Components/CartesianChart/types.d.ts +11 -0
- package/dist/lib/Components/CartesianChart/types.d.ts.map +1 -1
- package/dist/lib/Components/Line/Line.js +1 -1
- package/dist/lib/Components/LineChart/LineChart.d.ts +1 -1
- package/dist/lib/Components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/lib/Components/LineChart/LineChart.js +38 -34
- package/dist/lib/Components/LineChart/types.d.ts +11 -0
- package/dist/lib/Components/LineChart/types.d.ts.map +1 -1
- package/dist/lib/Components/Scrubber/Scrubber.d.ts +17 -0
- package/dist/lib/Components/Scrubber/Scrubber.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/Scrubber.js +134 -0
- package/dist/lib/Components/Scrubber/ScrubberProvider.d.ts +3 -0
- package/dist/lib/Components/Scrubber/ScrubberProvider.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/ScrubberProvider.js +122 -0
- package/dist/lib/Components/Scrubber/context/index.d.ts +2 -0
- package/dist/lib/Components/Scrubber/context/index.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/context/scrubberContext.d.ts +8 -0
- package/dist/lib/Components/Scrubber/context/scrubberContext.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/context/scrubberContext.js +9 -0
- package/dist/lib/Components/Scrubber/index.d.ts +4 -0
- package/dist/lib/Components/Scrubber/index.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/types.d.ts +53 -0
- package/dist/lib/Components/Scrubber/types.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/utils.d.ts +30 -0
- package/dist/lib/Components/Scrubber/utils.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/utils.js +57 -0
- package/dist/lib/Components/index.d.ts +1 -0
- package/dist/lib/Components/index.d.ts.map +1 -1
- package/dist/lib/utils/scales/scales.d.ts +5 -0
- package/dist/lib/utils/scales/scales.d.ts.map +1 -1
- package/dist/lib/utils/scales/scales.js +19 -18
- package/dist/libs/utils-shared/dist/index.js +13 -13
- package/dist/package.json +3 -3
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { LineChart as
|
|
2
|
-
import { Point as
|
|
1
|
+
import { LineChart as e } from "./lib/Components/LineChart/LineChart.js";
|
|
2
|
+
import { Point as b, PointLabel as x } from "./lib/Components/Point/Point.js";
|
|
3
|
+
import { Scrubber as m } from "./lib/Components/Scrubber/Scrubber.js";
|
|
4
|
+
import { useScrubberContext as p } from "./lib/Components/Scrubber/context/scrubberContext.js";
|
|
3
5
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
e as LineChart,
|
|
7
|
+
b as Point,
|
|
8
|
+
x as PointLabel,
|
|
9
|
+
m as Scrubber,
|
|
10
|
+
p as useScrubberContext
|
|
7
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/XAxis/XAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,wBAAgB,KAAK,CAAC,EACpB,
|
|
1
|
+
{"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/XAxis/XAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAmB,EACnB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAuFZ"}
|
|
@@ -5,9 +5,9 @@ import { useCartesianChartContext as D } from "../../CartesianChart/context/cart
|
|
|
5
5
|
import { cssVar as o } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
6
6
|
const c = 4, S = 6, F = 28;
|
|
7
7
|
function K({
|
|
8
|
-
gridLineStyle:
|
|
8
|
+
gridLineStyle: p = "solid",
|
|
9
9
|
position: l = "bottom",
|
|
10
|
-
showGrid:
|
|
10
|
+
showGrid: h = !1,
|
|
11
11
|
showLine: u = !1,
|
|
12
12
|
showTickMark: g = !1,
|
|
13
13
|
ticks: d,
|
|
@@ -21,16 +21,18 @@ function K({
|
|
|
21
21
|
return null;
|
|
22
22
|
const f = l === "top", s = f ? e.y : e.y + e.height, y = f ? -1 : 1, b = s + y * (c + S);
|
|
23
23
|
return /* @__PURE__ */ k("g", { "data-testid": "x-axis", children: [
|
|
24
|
-
|
|
24
|
+
h && n.filter((t) => E(t, e)).map((t, i) => /* @__PURE__ */ a(
|
|
25
25
|
"line",
|
|
26
26
|
{
|
|
27
27
|
x1: t.position,
|
|
28
28
|
y1: e.y,
|
|
29
29
|
x2: t.position,
|
|
30
30
|
y2: e.y + e.height,
|
|
31
|
-
style: {
|
|
31
|
+
style: {
|
|
32
|
+
stroke: o("var(--border-muted-subtle-transparent)")
|
|
33
|
+
},
|
|
32
34
|
strokeWidth: o("var(--stroke-1)"),
|
|
33
|
-
strokeDasharray:
|
|
35
|
+
strokeDasharray: p === "dashed" ? "3 3" : void 0
|
|
34
36
|
},
|
|
35
37
|
`grid-${t.value}-${i}`
|
|
36
38
|
)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,wBAAgB,KAAK,CAAC,EACpB,
|
|
1
|
+
{"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAkB,EAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAuFZ"}
|
|
@@ -5,10 +5,10 @@ import { useCartesianChartContext as T } from "../../CartesianChart/context/cart
|
|
|
5
5
|
import { cssVar as s } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
6
6
|
const f = 4, E = 6, w = 40;
|
|
7
7
|
function F({
|
|
8
|
-
gridLineStyle: h = "
|
|
8
|
+
gridLineStyle: h = "solid",
|
|
9
9
|
position: l = "start",
|
|
10
|
-
showGrid:
|
|
11
|
-
showLine:
|
|
10
|
+
showGrid: p = !1,
|
|
11
|
+
showLine: u = !1,
|
|
12
12
|
showTickMark: v = !1,
|
|
13
13
|
ticks: d,
|
|
14
14
|
tickLabelFormatter: x
|
|
@@ -21,20 +21,22 @@ function F({
|
|
|
21
21
|
return null;
|
|
22
22
|
const y = l === "start", r = y ? e.x : e.x + e.width, c = y ? -1 : 1, k = r + c * (f + E);
|
|
23
23
|
return /* @__PURE__ */ b("g", { "data-testid": "y-axis", children: [
|
|
24
|
-
|
|
24
|
+
p && n.filter((t) => S(t, e)).map((t, o) => /* @__PURE__ */ a(
|
|
25
25
|
"line",
|
|
26
26
|
{
|
|
27
27
|
x1: e.x,
|
|
28
28
|
y1: t.position,
|
|
29
29
|
x2: e.x + e.width,
|
|
30
30
|
y2: t.position,
|
|
31
|
-
style: {
|
|
31
|
+
style: {
|
|
32
|
+
stroke: s("var(--border-muted-subtle-transparent)")
|
|
33
|
+
},
|
|
32
34
|
strokeWidth: s("var(--stroke-1)"),
|
|
33
35
|
strokeDasharray: h === "dashed" ? "3 3" : void 0
|
|
34
36
|
},
|
|
35
37
|
`grid-${t.value}-${o}`
|
|
36
38
|
)),
|
|
37
|
-
|
|
39
|
+
u && /* @__PURE__ */ a(
|
|
38
40
|
"line",
|
|
39
41
|
{
|
|
40
42
|
x1: r,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CartesianChartProps } from './types';
|
|
2
|
-
export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, children, }: CartesianChartProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, enableScrubbing, onScrubberPositionChange, children, }: CartesianChartProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=CartesianChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQnD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAuB,EACvB,KAAK,EACL,WAAW,EACX,SAAmB,EACnB,eAAuB,EACvB,wBAAwB,EACxB,QAAQ,GACT,EAAE,mBAAmB,2CA4GrB"}
|
|
@@ -1,79 +1,96 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as C, useState as W, useCallback as z, useEffect as G, useMemo as y } from "react";
|
|
3
|
+
import { ScrubberProvider as T } from "../Scrubber/ScrubberProvider.js";
|
|
4
|
+
import { resolveInset as V, resolveAxisPadding as _, OVERFLOW_NEGATIVE_MARGIN as R, DEFAULT_HEIGHT as k } from "./utils.js";
|
|
5
|
+
import { useBuildChartContext as F } from "./context/useBuildChartContext.js";
|
|
6
|
+
import { CartesianChartProvider as H } from "./context/cartesianChartContext.js";
|
|
7
|
+
function D({
|
|
8
|
+
series: h,
|
|
9
|
+
xAxis: x,
|
|
10
|
+
yAxis: E,
|
|
10
11
|
width: e = "100%",
|
|
11
|
-
height:
|
|
12
|
+
height: r = k,
|
|
12
13
|
inset: a,
|
|
13
|
-
axisPadding:
|
|
14
|
-
ariaLabel:
|
|
15
|
-
|
|
14
|
+
axisPadding: c,
|
|
15
|
+
ariaLabel: I = "Chart",
|
|
16
|
+
enableScrubbing: o = !1,
|
|
17
|
+
onScrubberPositionChange: b,
|
|
18
|
+
children: l
|
|
16
19
|
}) {
|
|
17
|
-
const
|
|
20
|
+
const n = C(null), f = C(null), [u, A] = W(
|
|
18
21
|
typeof e == "number" ? e : void 0
|
|
19
|
-
),
|
|
20
|
-
const [
|
|
21
|
-
|
|
22
|
+
), i = typeof e != "number", v = z((s) => {
|
|
23
|
+
const [p] = s;
|
|
24
|
+
p && A(p.contentRect.width);
|
|
22
25
|
}, []);
|
|
23
|
-
|
|
24
|
-
if (!
|
|
26
|
+
G(() => {
|
|
27
|
+
if (!i || !n.current || typeof ResizeObserver > "u")
|
|
25
28
|
return;
|
|
26
|
-
const
|
|
27
|
-
return
|
|
28
|
-
}, [
|
|
29
|
-
const
|
|
30
|
-
() =>
|
|
31
|
-
[
|
|
32
|
-
),
|
|
33
|
-
series:
|
|
34
|
-
xAxis:
|
|
35
|
-
yAxis:
|
|
36
|
-
width:
|
|
37
|
-
height:
|
|
38
|
-
inset:
|
|
39
|
-
axisPadding:
|
|
40
|
-
}),
|
|
29
|
+
const s = new ResizeObserver(v);
|
|
30
|
+
return s.observe(n.current), () => s.disconnect();
|
|
31
|
+
}, [i, v]);
|
|
32
|
+
const d = typeof e == "number" ? e : u ?? 0, M = y(() => V(a), [a]), O = y(
|
|
33
|
+
() => _(c),
|
|
34
|
+
[c]
|
|
35
|
+
), P = F({
|
|
36
|
+
series: h,
|
|
37
|
+
xAxis: x,
|
|
38
|
+
yAxis: E,
|
|
39
|
+
width: d,
|
|
40
|
+
height: r,
|
|
41
|
+
inset: M,
|
|
42
|
+
axisPadding: O
|
|
43
|
+
}), m = /* @__PURE__ */ t(
|
|
41
44
|
"svg",
|
|
42
45
|
{
|
|
46
|
+
ref: f,
|
|
43
47
|
"data-testid": "chart-svg",
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
48
|
+
width: d,
|
|
49
|
+
height: r,
|
|
46
50
|
role: "img",
|
|
47
|
-
"aria-label":
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
"aria-label": I || "Chart",
|
|
52
|
+
tabIndex: o ? 0 : void 0,
|
|
53
|
+
style: {
|
|
54
|
+
display: "block",
|
|
55
|
+
overflow: "visible",
|
|
56
|
+
outline: o ? "none" : void 0
|
|
57
|
+
},
|
|
58
|
+
children: /* @__PURE__ */ t(H, { value: P, children: o ? /* @__PURE__ */ t(
|
|
59
|
+
T,
|
|
60
|
+
{
|
|
61
|
+
svgRef: f,
|
|
62
|
+
enableScrubbing: o,
|
|
63
|
+
onScrubberPositionChange: b,
|
|
64
|
+
children: l
|
|
65
|
+
}
|
|
66
|
+
) : l })
|
|
50
67
|
}
|
|
51
68
|
);
|
|
52
|
-
return
|
|
69
|
+
return i ? /* @__PURE__ */ t(
|
|
53
70
|
"div",
|
|
54
71
|
{
|
|
55
|
-
ref:
|
|
72
|
+
ref: n,
|
|
56
73
|
"data-testid": "chart-container",
|
|
57
74
|
style: {
|
|
58
75
|
width: e,
|
|
59
|
-
height:
|
|
60
|
-
...
|
|
76
|
+
height: r,
|
|
77
|
+
...R
|
|
61
78
|
},
|
|
62
|
-
children:
|
|
79
|
+
children: u !== void 0 && m
|
|
63
80
|
}
|
|
64
|
-
) : /* @__PURE__ */
|
|
81
|
+
) : /* @__PURE__ */ t(
|
|
65
82
|
"div",
|
|
66
83
|
{
|
|
67
84
|
"data-testid": "chart-container",
|
|
68
85
|
style: {
|
|
69
|
-
width:
|
|
70
|
-
height:
|
|
71
|
-
...
|
|
86
|
+
width: d,
|
|
87
|
+
height: r,
|
|
88
|
+
...R
|
|
72
89
|
},
|
|
73
|
-
children:
|
|
90
|
+
children: m
|
|
74
91
|
}
|
|
75
92
|
);
|
|
76
93
|
}
|
|
77
94
|
export {
|
|
78
|
-
|
|
95
|
+
D as CartesianChart
|
|
79
96
|
};
|
|
@@ -46,5 +46,16 @@ export type CartesianChartProps = {
|
|
|
46
46
|
* SVG content rendered inside the chart's context provider.
|
|
47
47
|
*/
|
|
48
48
|
children?: ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Enables scrubbing (hover/touch/keyboard) interactions on the chart.
|
|
51
|
+
* When true, the SVG becomes focusable and captures pointer/keyboard events.
|
|
52
|
+
* @default false
|
|
53
|
+
*/
|
|
54
|
+
enableScrubbing?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Callback fired whenever the scrubber moves to a new data index or is cleared.
|
|
57
|
+
* Receives `undefined` when the scrubber leaves the chart.
|
|
58
|
+
*/
|
|
59
|
+
onScrubberPositionChange?: (index: number | undefined) => void;
|
|
49
60
|
};
|
|
50
61
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { isNumericScale as A } from "../../utils/scales/scales.js";
|
|
|
4
4
|
import { toScaledPoints as P, buildLinePath as I, buildAreaPath as L } from "./utils.js";
|
|
5
5
|
import { useCartesianChartContext as T } from "../CartesianChart/context/cartesianChartContext.js";
|
|
6
6
|
import { cssVar as j } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
7
|
-
const O = 0.
|
|
7
|
+
const O = 0.15;
|
|
8
8
|
function N({
|
|
9
9
|
seriesId: g,
|
|
10
10
|
stroke: h,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LineChartProps } from './types';
|
|
2
|
-
export declare function LineChart({ series, showArea, areaType, showXAxis, showYAxis, xAxis, yAxis, width, height, inset, children, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function LineChart({ series, showArea, areaType, showXAxis, showYAxis, xAxis, yAxis, width, height, inset, enableScrubbing, onScrubberPositionChange, children, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=LineChart.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAgB,EAChB,QAAqB,EACrB,SAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAgB,EAChB,QAAqB,EACrB,SAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAY,EACZ,KAAK,EACL,eAAe,EACf,wBAAwB,EACxB,QAAQ,GACT,EAAE,cAAc,2CA0EhB"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { DEFAULT_AXIS_WIDTH as
|
|
4
|
-
import { DEFAULT_AXIS_HEIGHT as m, XAxis as
|
|
5
|
-
import { CartesianChart as
|
|
6
|
-
import { Line as
|
|
7
|
-
function
|
|
1
|
+
import { jsxs as H, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as j } from "react";
|
|
3
|
+
import { DEFAULT_AXIS_WIDTH as F, YAxis as U } from "../Axis/YAxis/YAxis.js";
|
|
4
|
+
import { DEFAULT_AXIS_HEIGHT as m, XAxis as V } from "../Axis/XAxis/XAxis.js";
|
|
5
|
+
import { CartesianChart as W } from "../CartesianChart/CartesianChart.js";
|
|
6
|
+
import { Line as h } from "../Line/Line.js";
|
|
7
|
+
function B({
|
|
8
8
|
series: r,
|
|
9
9
|
showArea: d = !1,
|
|
10
10
|
areaType: c = "gradient",
|
|
@@ -15,29 +15,31 @@ function q({
|
|
|
15
15
|
width: x = "100%",
|
|
16
16
|
height: y = 160,
|
|
17
17
|
inset: T,
|
|
18
|
-
|
|
18
|
+
enableScrubbing: g,
|
|
19
|
+
onScrubberPositionChange: u,
|
|
20
|
+
children: A
|
|
19
21
|
}) {
|
|
20
22
|
const {
|
|
21
|
-
scaleType:
|
|
22
|
-
data:
|
|
23
|
-
domain:
|
|
23
|
+
scaleType: D,
|
|
24
|
+
data: C,
|
|
25
|
+
domain: I,
|
|
24
26
|
...n
|
|
25
27
|
} = f ?? {}, {
|
|
26
|
-
scaleType:
|
|
27
|
-
data:
|
|
28
|
-
domain:
|
|
28
|
+
scaleType: P,
|
|
29
|
+
data: L,
|
|
30
|
+
domain: S,
|
|
29
31
|
...o
|
|
30
|
-
} = l ?? {},
|
|
31
|
-
scaleType:
|
|
32
|
-
data:
|
|
33
|
-
domain:
|
|
34
|
-
},
|
|
35
|
-
scaleType:
|
|
36
|
-
data:
|
|
37
|
-
domain:
|
|
38
|
-
},
|
|
32
|
+
} = l ?? {}, _ = {
|
|
33
|
+
scaleType: D,
|
|
34
|
+
data: C,
|
|
35
|
+
domain: I
|
|
36
|
+
}, b = {
|
|
37
|
+
scaleType: P,
|
|
38
|
+
data: L,
|
|
39
|
+
domain: S
|
|
40
|
+
}, E = j(() => {
|
|
39
41
|
if (!t && !i) return;
|
|
40
|
-
const a = n.position === "top" ? "top" : "bottom", s = o.position === "end" ? "right" : "left", p = o.width ??
|
|
42
|
+
const a = n.position === "top" ? "top" : "bottom", s = o.position === "end" ? "right" : "left", p = o.width ?? F;
|
|
41
43
|
return {
|
|
42
44
|
top: t && a === "top" ? m : 0,
|
|
43
45
|
bottom: t && a === "bottom" ? m : 0,
|
|
@@ -51,21 +53,23 @@ function q({
|
|
|
51
53
|
o.position,
|
|
52
54
|
o.width
|
|
53
55
|
]);
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
|
|
56
|
+
return /* @__PURE__ */ H(
|
|
57
|
+
W,
|
|
56
58
|
{
|
|
57
59
|
series: r ?? [],
|
|
58
|
-
xAxis:
|
|
59
|
-
yAxis:
|
|
60
|
+
xAxis: _,
|
|
61
|
+
yAxis: b,
|
|
60
62
|
width: x,
|
|
61
63
|
height: y,
|
|
62
64
|
inset: T,
|
|
63
|
-
axisPadding:
|
|
65
|
+
axisPadding: E,
|
|
66
|
+
enableScrubbing: g,
|
|
67
|
+
onScrubberPositionChange: u,
|
|
64
68
|
children: [
|
|
65
|
-
t && /* @__PURE__ */ e(
|
|
66
|
-
i && /* @__PURE__ */ e(
|
|
69
|
+
t && /* @__PURE__ */ e(V, { ...n }),
|
|
70
|
+
i && /* @__PURE__ */ e(U, { ...o }),
|
|
67
71
|
r?.map((a) => /* @__PURE__ */ e(
|
|
68
|
-
|
|
72
|
+
h,
|
|
69
73
|
{
|
|
70
74
|
seriesId: a.id,
|
|
71
75
|
showArea: d,
|
|
@@ -73,11 +77,11 @@ function q({
|
|
|
73
77
|
},
|
|
74
78
|
a.id
|
|
75
79
|
)),
|
|
76
|
-
|
|
80
|
+
A
|
|
77
81
|
]
|
|
78
82
|
}
|
|
79
83
|
);
|
|
80
84
|
}
|
|
81
85
|
export {
|
|
82
|
-
|
|
86
|
+
B as LineChart
|
|
83
87
|
};
|
|
@@ -59,5 +59,16 @@ export type LineChartProps = {
|
|
|
59
59
|
* Additional SVG content rendered inside the chart after lines and axes.
|
|
60
60
|
*/
|
|
61
61
|
children?: ReactNode;
|
|
62
|
+
/**
|
|
63
|
+
* Enables scrubbing (hover/touch/keyboard) interactions on the chart.
|
|
64
|
+
* When true, add a `<Scrubber>` as a child to visualise the interaction.
|
|
65
|
+
* @default false
|
|
66
|
+
*/
|
|
67
|
+
enableScrubbing?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Callback fired whenever the scrubber moves to a new data index or is cleared.
|
|
70
|
+
* Receives `undefined` when the scrubber leaves the chart.
|
|
71
|
+
*/
|
|
72
|
+
onScrubberPositionChange?: (index: number | undefined) => void;
|
|
62
73
|
};
|
|
63
74
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ScrubberProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the scrubber visuals: vertical reference line, future-data overlay
|
|
4
|
+
* rect, per-series beacon dots, and an optional formatted label above the line.
|
|
5
|
+
*
|
|
6
|
+
* Must be used as a child of `LineChart` (or `CartesianChart`) with
|
|
7
|
+
* `enableScrubbing` enabled. Renders nothing when no scrubber position is active.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <LineChart series={data} enableScrubbing>
|
|
12
|
+
* <Scrubber label={(i) => data[i].date} />
|
|
13
|
+
* </LineChart>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function Scrubber({ label, hideLine, hideOverlay, showBeacons, }: Readonly<ScrubberProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=Scrubber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scrubber.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/Scrubber.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAgB,EAChB,WAAmB,EACnB,WAAmB,GACpB,EAAE,QAAQ,CAAC,aAAa,CAAC,kDA0IzB"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { jsxs as l, jsx as i, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useId as N, useMemo as c } from "react";
|
|
3
|
+
import { resolvePixelX as R, resolvePixelY as W, LINE_GRADIENT_EDGE_OPACITY as g, OVERLAY_OPACITY as X, LABEL_OFFSET_Y as D, BEACON_STROKE_WIDTH as P, BEACON_RADIUS as G, OVERLAY_OFFSET as f, OVERLAY_LINE_INSET as E } from "./utils.js";
|
|
4
|
+
import { useScrubberContext as V } from "./context/scrubberContext.js";
|
|
5
|
+
import { useCartesianChartContext as H } from "../CartesianChart/context/cartesianChartContext.js";
|
|
6
|
+
import { cssVar as t } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
7
|
+
function K({
|
|
8
|
+
label: a,
|
|
9
|
+
hideLine: A = !1,
|
|
10
|
+
hideOverlay: C = !1,
|
|
11
|
+
showBeacons: d = !1
|
|
12
|
+
}) {
|
|
13
|
+
const u = N(), { scrubberPosition: e } = V(), {
|
|
14
|
+
getXScale: b,
|
|
15
|
+
getXAxisConfig: v,
|
|
16
|
+
getYScale: p,
|
|
17
|
+
drawingArea: O,
|
|
18
|
+
series: x,
|
|
19
|
+
seriesMap: y
|
|
20
|
+
} = H(), o = c(() => {
|
|
21
|
+
if (e !== void 0)
|
|
22
|
+
return R(e, b, v());
|
|
23
|
+
}, [e, b, v]), Y = c(() => e === void 0 || !d ? [] : x.map((r) => {
|
|
24
|
+
const w = y.get(r.id)?.data, h = W(e, w, p);
|
|
25
|
+
return h === void 0 ? null : { id: r.id, stroke: r.stroke, pixelY: h };
|
|
26
|
+
}).filter(
|
|
27
|
+
(r) => r !== null
|
|
28
|
+
), [e, d, x, y, p]), m = c(() => {
|
|
29
|
+
if (!(e === void 0 || !a))
|
|
30
|
+
return a(e);
|
|
31
|
+
}, [e, a]);
|
|
32
|
+
if (e === void 0 || o === void 0)
|
|
33
|
+
return null;
|
|
34
|
+
const {
|
|
35
|
+
x: _,
|
|
36
|
+
y: s,
|
|
37
|
+
width: S,
|
|
38
|
+
height: n
|
|
39
|
+
} = O, k = o + E, I = s - f, L = Math.max(
|
|
40
|
+
0,
|
|
41
|
+
_ + S - o - E + f
|
|
42
|
+
), T = n + f * 2;
|
|
43
|
+
return /* @__PURE__ */ l("g", { "data-testid": "scrubber", children: [
|
|
44
|
+
!A && /* @__PURE__ */ l(F, { children: [
|
|
45
|
+
/* @__PURE__ */ i("defs", { children: /* @__PURE__ */ l(
|
|
46
|
+
"linearGradient",
|
|
47
|
+
{
|
|
48
|
+
id: u,
|
|
49
|
+
gradientUnits: "userSpaceOnUse",
|
|
50
|
+
x1: o,
|
|
51
|
+
y1: s,
|
|
52
|
+
x2: o,
|
|
53
|
+
y2: s + n,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ i(
|
|
56
|
+
"stop",
|
|
57
|
+
{
|
|
58
|
+
offset: "0%",
|
|
59
|
+
stopColor: t("var(--border-base)"),
|
|
60
|
+
stopOpacity: g
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ i("stop", { offset: "20%", stopColor: t("var(--border-base)") }),
|
|
64
|
+
/* @__PURE__ */ i("stop", { offset: "80%", stopColor: t("var(--border-base)") }),
|
|
65
|
+
/* @__PURE__ */ i(
|
|
66
|
+
"stop",
|
|
67
|
+
{
|
|
68
|
+
offset: "100%",
|
|
69
|
+
stopColor: t("var(--border-base)"),
|
|
70
|
+
stopOpacity: g
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
) }),
|
|
76
|
+
/* @__PURE__ */ i(
|
|
77
|
+
"line",
|
|
78
|
+
{
|
|
79
|
+
"data-testid": "scrubber-line",
|
|
80
|
+
x1: o,
|
|
81
|
+
y1: s,
|
|
82
|
+
x2: o,
|
|
83
|
+
y2: s + n,
|
|
84
|
+
stroke: `url(#${u})`,
|
|
85
|
+
strokeWidth: t("var(--stroke-1)")
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
] }),
|
|
89
|
+
!C && /* @__PURE__ */ i(
|
|
90
|
+
"rect",
|
|
91
|
+
{
|
|
92
|
+
"data-testid": "scrubber-overlay",
|
|
93
|
+
x: k,
|
|
94
|
+
y: I,
|
|
95
|
+
width: L,
|
|
96
|
+
height: T,
|
|
97
|
+
fill: t("var(--background-base)"),
|
|
98
|
+
opacity: X
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
m !== void 0 && /* @__PURE__ */ i(
|
|
102
|
+
"text",
|
|
103
|
+
{
|
|
104
|
+
"data-testid": "scrubber-label",
|
|
105
|
+
x: o,
|
|
106
|
+
y: s - D,
|
|
107
|
+
textAnchor: "middle",
|
|
108
|
+
style: {
|
|
109
|
+
fill: t("var(--text-base)"),
|
|
110
|
+
fontSize: t("var(--font-style-body-4-size)"),
|
|
111
|
+
fontWeight: t("var(--font-style-body-4-weight-medium)"),
|
|
112
|
+
fontFamily: t("var(--font-family-font)")
|
|
113
|
+
},
|
|
114
|
+
children: m
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
d && Y.map((r) => /* @__PURE__ */ i(
|
|
118
|
+
"circle",
|
|
119
|
+
{
|
|
120
|
+
"data-testid": `scrubber-beacon-${r.id}`,
|
|
121
|
+
cx: o,
|
|
122
|
+
cy: r.pixelY,
|
|
123
|
+
r: G,
|
|
124
|
+
fill: r.stroke,
|
|
125
|
+
stroke: t("var(--background-canvas)"),
|
|
126
|
+
strokeWidth: P
|
|
127
|
+
},
|
|
128
|
+
r.id
|
|
129
|
+
))
|
|
130
|
+
] });
|
|
131
|
+
}
|
|
132
|
+
export {
|
|
133
|
+
K as Scrubber
|
|
134
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ScrubberProviderProps } from './types';
|
|
2
|
+
export declare function ScrubberProvider({ children, svgRef, enableScrubbing, onScrubberPositionChange, }: 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/Scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAG3E,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,eAAe,EACf,wBAAwB,GACzB,EAAE,QAAQ,CAAC,qBAAqB,CAAC,2CAiLjC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsx as D } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as y, useCallback as a, useEffect as R, useMemo as T } from "react";
|
|
3
|
+
import { getDataIndexFromPosition as X } from "./utils.js";
|
|
4
|
+
import { useCartesianChartContext as A } from "../CartesianChart/context/cartesianChartContext.js";
|
|
5
|
+
import { ScrubberContextProvider as B } from "./context/scrubberContext.js";
|
|
6
|
+
function N({
|
|
7
|
+
children: k,
|
|
8
|
+
svgRef: L,
|
|
9
|
+
enableScrubbing: o,
|
|
10
|
+
onScrubberPositionChange: x
|
|
11
|
+
}) {
|
|
12
|
+
const { getXScale: M, getXAxisConfig: g, dataLength: s } = A(), [m, C] = w(
|
|
13
|
+
void 0
|
|
14
|
+
), v = y(m);
|
|
15
|
+
v.current = m;
|
|
16
|
+
const c = a(
|
|
17
|
+
(t) => {
|
|
18
|
+
const e = t === void 0 ? void 0 : Math.max(0, Math.min(t, s - 1));
|
|
19
|
+
C(e), x?.(e);
|
|
20
|
+
},
|
|
21
|
+
[s, x]
|
|
22
|
+
), i = a(
|
|
23
|
+
(t) => {
|
|
24
|
+
const e = M();
|
|
25
|
+
if (!e || !o || s <= 0) return;
|
|
26
|
+
const n = X(
|
|
27
|
+
t,
|
|
28
|
+
e,
|
|
29
|
+
g(),
|
|
30
|
+
s
|
|
31
|
+
);
|
|
32
|
+
n !== v.current && c(n);
|
|
33
|
+
},
|
|
34
|
+
[
|
|
35
|
+
o,
|
|
36
|
+
M,
|
|
37
|
+
g,
|
|
38
|
+
s,
|
|
39
|
+
c
|
|
40
|
+
]
|
|
41
|
+
), r = a(() => {
|
|
42
|
+
o && c(void 0);
|
|
43
|
+
}, [o, c]), h = a(
|
|
44
|
+
(t) => {
|
|
45
|
+
const n = t.currentTarget.getBoundingClientRect();
|
|
46
|
+
i(t.clientX - n.left);
|
|
47
|
+
},
|
|
48
|
+
[i]
|
|
49
|
+
), f = a(
|
|
50
|
+
(t) => {
|
|
51
|
+
if (!o || !t.touches.length) return;
|
|
52
|
+
const e = t.touches[0], u = t.currentTarget.getBoundingClientRect();
|
|
53
|
+
i(e.clientX - u.left);
|
|
54
|
+
},
|
|
55
|
+
[o, i]
|
|
56
|
+
), l = a(
|
|
57
|
+
(t) => {
|
|
58
|
+
if (!t.touches.length) return;
|
|
59
|
+
t.preventDefault();
|
|
60
|
+
const e = t.touches[0], u = t.currentTarget.getBoundingClientRect();
|
|
61
|
+
i(e.clientX - u.left);
|
|
62
|
+
},
|
|
63
|
+
[i]
|
|
64
|
+
), E = a(
|
|
65
|
+
(t) => {
|
|
66
|
+
if (!o || s <= 0) return;
|
|
67
|
+
const e = s - 1, n = v.current ?? e, u = t.shiftKey ? Math.min(10, Math.max(1, Math.floor(e * 0.1))) : 1;
|
|
68
|
+
let d;
|
|
69
|
+
switch (t.key) {
|
|
70
|
+
case "ArrowLeft":
|
|
71
|
+
t.preventDefault(), d = Math.max(0, n - u);
|
|
72
|
+
break;
|
|
73
|
+
case "ArrowRight":
|
|
74
|
+
t.preventDefault(), d = Math.min(e, n + u);
|
|
75
|
+
break;
|
|
76
|
+
case "Home":
|
|
77
|
+
t.preventDefault(), d = 0;
|
|
78
|
+
break;
|
|
79
|
+
case "End":
|
|
80
|
+
t.preventDefault(), d = e;
|
|
81
|
+
break;
|
|
82
|
+
case "Escape":
|
|
83
|
+
t.preventDefault(), d = void 0;
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
c(d);
|
|
89
|
+
},
|
|
90
|
+
[o, s, c]
|
|
91
|
+
), p = a(() => {
|
|
92
|
+
!o || v.current === void 0 || r();
|
|
93
|
+
}, [o, r]);
|
|
94
|
+
R(() => {
|
|
95
|
+
const t = L.current;
|
|
96
|
+
if (!(!t || !o))
|
|
97
|
+
return t.addEventListener("mousemove", h), t.addEventListener("mouseleave", r), t.addEventListener("touchstart", f, { passive: !1 }), t.addEventListener("touchmove", l, { passive: !1 }), t.addEventListener("touchend", r), t.addEventListener("touchcancel", r), t.addEventListener("keydown", E), t.addEventListener("blur", p), () => {
|
|
98
|
+
t.removeEventListener("mousemove", h), t.removeEventListener("mouseleave", r), t.removeEventListener("touchstart", f), t.removeEventListener("touchmove", l), t.removeEventListener("touchend", r), t.removeEventListener("touchcancel", r), t.removeEventListener("keydown", E), t.removeEventListener("blur", p);
|
|
99
|
+
};
|
|
100
|
+
}, [
|
|
101
|
+
L,
|
|
102
|
+
o,
|
|
103
|
+
h,
|
|
104
|
+
r,
|
|
105
|
+
f,
|
|
106
|
+
l,
|
|
107
|
+
E,
|
|
108
|
+
p
|
|
109
|
+
]);
|
|
110
|
+
const P = T(
|
|
111
|
+
() => ({
|
|
112
|
+
enableScrubbing: o,
|
|
113
|
+
scrubberPosition: m,
|
|
114
|
+
onScrubberPositionChange: c
|
|
115
|
+
}),
|
|
116
|
+
[o, m, c]
|
|
117
|
+
);
|
|
118
|
+
return /* @__PURE__ */ D(B, { value: P, children: k });
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
N as ScrubberProvider
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/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/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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ReactNode, RefObject } from 'react';
|
|
2
|
+
export type ScrubberContextValue = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether scrubbing interactions are enabled.
|
|
5
|
+
*/
|
|
6
|
+
enableScrubbing: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The current data index of the scrubber, or undefined when idle.
|
|
9
|
+
*/
|
|
10
|
+
scrubberPosition: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Callback to update the scrubber position.
|
|
13
|
+
*/
|
|
14
|
+
onScrubberPositionChange: (index: number | undefined) => void;
|
|
15
|
+
};
|
|
16
|
+
export type ScrubberProviderProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Ref to the root SVG element where event listeners will be attached.
|
|
20
|
+
*/
|
|
21
|
+
svgRef: RefObject<SVGSVGElement | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Whether scrubbing is enabled.
|
|
24
|
+
*/
|
|
25
|
+
enableScrubbing: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Optional external callback fired whenever the scrubber position changes.
|
|
28
|
+
*/
|
|
29
|
+
onScrubberPositionChange?: (index: number | undefined) => void;
|
|
30
|
+
};
|
|
31
|
+
export type ScrubberProps = {
|
|
32
|
+
/**
|
|
33
|
+
* Formats a label string shown above the reference line for a given data index.
|
|
34
|
+
* When omitted, no label is rendered.
|
|
35
|
+
*/
|
|
36
|
+
label?: (dataIndex: number) => string;
|
|
37
|
+
/**
|
|
38
|
+
* Hides the vertical reference line.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
hideLine?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Hides the semi-transparent overlay that dims data after the scrubber position.
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
46
|
+
hideOverlay?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Shows the beacon dots on each series at the scrubbed data index.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
showBeacons?: boolean;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;OAEG;IACH,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IACxC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AxisConfigProps, ChartScaleFunction } from '../../utils/types';
|
|
2
|
+
import { useCartesianChartContext } from '../CartesianChart/context';
|
|
3
|
+
export declare const BEACON_RADIUS = 5;
|
|
4
|
+
export declare const BEACON_STROKE_WIDTH = 2;
|
|
5
|
+
export declare const LABEL_OFFSET_Y = 12;
|
|
6
|
+
export declare const OVERLAY_OFFSET = 2;
|
|
7
|
+
export declare const OVERLAY_LINE_INSET = 0.5;
|
|
8
|
+
export declare const OVERLAY_OPACITY = 0.8;
|
|
9
|
+
export declare const LINE_GRADIENT_EDGE_OPACITY = 0.1;
|
|
10
|
+
/**
|
|
11
|
+
* Converts a pixel position along the x-axis into the nearest data index.
|
|
12
|
+
*
|
|
13
|
+
* For band (categorical) scales, finds the band whose center is closest to
|
|
14
|
+
* `pixelX`. For numeric scales, uses `scale.invert()` and rounds to the
|
|
15
|
+
* nearest integer, clamped to the valid index range.
|
|
16
|
+
*/
|
|
17
|
+
export declare const getDataIndexFromPosition: (pixelX: number, scale: ChartScaleFunction, axisConfig: Partial<AxisConfigProps> | undefined, dataLength: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the pixel y-coordinate for a given series data point at a data index.
|
|
20
|
+
* Returns undefined when the value is null/missing or the scale is unavailable.
|
|
21
|
+
*/
|
|
22
|
+
export declare const resolvePixelY: (dataIndex: number, seriesData: (number | null)[] | undefined, getYScale: ReturnType<typeof useCartesianChartContext>["getYScale"]) => number | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the pixel x-coordinate for a given data index using the x-scale.
|
|
25
|
+
* When numeric x-axis data is provided, the corresponding axis value is used;
|
|
26
|
+
* otherwise the data index is used as the x input.
|
|
27
|
+
* Returns undefined when the scale is unavailable or the value cannot be mapped.
|
|
28
|
+
*/
|
|
29
|
+
export declare const resolvePixelX: (dataIndex: number, getXScale: ReturnType<typeof useCartesianChartContext>["getXScale"], axisConfig?: AxisConfigProps) => number | undefined;
|
|
30
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE1E,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAgC9C;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,EACd,OAAO,kBAAkB,EACzB,YAAY,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,EAChD,YAAY,MAAM,KACjB,MA2BF,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,eAAe,KAC3B,MAAM,GAAG,SAMX,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { getPointOnScale as d, isNumericScale as u, isCategoricalScale as l } from "../../utils/scales/scales.js";
|
|
2
|
+
const v = 5, _ = 2, m = 12, A = 2, I = 0.5, O = 0.8, h = 0.1, f = (o) => typeof o[0] == "number", a = (o, n, r) => {
|
|
3
|
+
let e = 0, t = 1 / 0;
|
|
4
|
+
for (let i = 0; i < o; i++) {
|
|
5
|
+
const s = r(i);
|
|
6
|
+
if (s === void 0) continue;
|
|
7
|
+
const c = Math.abs(n - s);
|
|
8
|
+
c < t && (t = c, e = i);
|
|
9
|
+
}
|
|
10
|
+
return e;
|
|
11
|
+
}, S = (o, n, r, e) => {
|
|
12
|
+
if (l(n)) {
|
|
13
|
+
const t = n.domain(), i = n.bandwidth();
|
|
14
|
+
return a(t.length, o, (s) => {
|
|
15
|
+
const c = n(t[s]);
|
|
16
|
+
return c === void 0 ? void 0 : c + i / 2;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (u(n)) {
|
|
20
|
+
const t = r?.data;
|
|
21
|
+
if (t && t.length > 0 && f(t))
|
|
22
|
+
return a(
|
|
23
|
+
t.length,
|
|
24
|
+
o,
|
|
25
|
+
(s) => n(t[s])
|
|
26
|
+
);
|
|
27
|
+
const i = n.invert(o);
|
|
28
|
+
return Math.max(
|
|
29
|
+
0,
|
|
30
|
+
Math.min(Math.round(i), e - 1)
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
return 0;
|
|
34
|
+
}, x = (o, n, r) => {
|
|
35
|
+
const e = r();
|
|
36
|
+
if (!e || !u(e) || !n) return;
|
|
37
|
+
const t = n[o];
|
|
38
|
+
if (t != null)
|
|
39
|
+
return e(t);
|
|
40
|
+
}, N = (o, n, r) => {
|
|
41
|
+
const e = n();
|
|
42
|
+
if (!e) return;
|
|
43
|
+
const t = r?.data?.[o];
|
|
44
|
+
return d(typeof t == "number" ? t : o, e);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
v as BEACON_RADIUS,
|
|
48
|
+
_ as BEACON_STROKE_WIDTH,
|
|
49
|
+
m as LABEL_OFFSET_Y,
|
|
50
|
+
h as LINE_GRADIENT_EDGE_OPACITY,
|
|
51
|
+
I as OVERLAY_LINE_INSET,
|
|
52
|
+
A as OVERLAY_OFFSET,
|
|
53
|
+
O as OVERLAY_OPACITY,
|
|
54
|
+
S as getDataIndexFromPosition,
|
|
55
|
+
N as resolvePixelX,
|
|
56
|
+
x as resolvePixelY
|
|
57
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
|
|
@@ -25,6 +25,11 @@ export declare const isCategoricalScale: (scale: ChartScaleFunction) => scale is
|
|
|
25
25
|
* Checks if a scale is a numeric scale.
|
|
26
26
|
*/
|
|
27
27
|
export declare const isNumericScale: (scale: ChartScaleFunction) => scale is NumericScale;
|
|
28
|
+
/**
|
|
29
|
+
* Converts a single data-space value to pixel-space on a given scale.
|
|
30
|
+
* For band scales the result is centered within the band.
|
|
31
|
+
*/
|
|
32
|
+
export declare const getPointOnScale: (value: number, scale: ChartScaleFunction) => number;
|
|
28
33
|
/**
|
|
29
34
|
* Projects a single data-space coordinate pair into pixel-space.
|
|
30
35
|
* Handles centering for categorical (band) scales.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAMH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WAAW,CAAC,KACtC,SAAS,IAAI,MAA8B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,OAAO,MAAM,EACb,QAAQ,kBAAkB,EAC1B,QAAQ,kBAAkB,KACzB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAMH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WAAW,CAAC,KACtC,SAAS,IAAI,MAA8B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,MAAM,EACb,OAAO,kBAAkB,KACxB,MAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,OAAO,MAAM,EACb,QAAQ,kBAAkB,EAC1B,QAAQ,kBAAkB,KACzB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAGvB,CAAC"}
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import c from "../../../node_modules/d3-scale/src/band.js";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import m from "../../../node_modules/d3-scale/src/log.js";
|
|
3
|
+
import d from "../../../node_modules/d3-scale/src/linear.js";
|
|
4
4
|
const p = ({
|
|
5
5
|
scaleType: n,
|
|
6
|
-
domain:
|
|
7
|
-
range:
|
|
8
|
-
}) => (n === "log" ?
|
|
6
|
+
domain: t,
|
|
7
|
+
range: r
|
|
8
|
+
}) => (n === "log" ? m() : d()).domain([t.min, t.max]).nice().range([r.min, r.max]), f = ({
|
|
9
9
|
domain: n,
|
|
10
|
-
range:
|
|
11
|
-
padding:
|
|
10
|
+
range: t,
|
|
11
|
+
padding: r = 0.1
|
|
12
12
|
}) => {
|
|
13
|
-
const
|
|
13
|
+
const i = Array.from(
|
|
14
14
|
{ length: n.max - n.min + 1 },
|
|
15
|
-
(
|
|
15
|
+
(s, a) => n.min + a
|
|
16
16
|
);
|
|
17
|
-
return c().domain(
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
17
|
+
return c().domain(i).range([t.min, t.max]).paddingInner(r).paddingOuter(r / 2);
|
|
18
|
+
}, x = (n) => n === "band", e = (n) => "bandwidth" in n && typeof n.bandwidth == "function", S = (n) => !e(n), o = (n, t) => e(t) ? (t(n) ?? 0) + t.bandwidth() / 2 : t(n), b = (n, t, r, i) => ({
|
|
19
|
+
x: o(n, r),
|
|
20
|
+
y: o(t, i)
|
|
21
|
+
});
|
|
22
22
|
export {
|
|
23
|
-
|
|
23
|
+
f as getCategoricalScale,
|
|
24
24
|
p as getNumericScale,
|
|
25
|
-
|
|
25
|
+
o as getPointOnScale,
|
|
26
|
+
x as isBandScaleType,
|
|
26
27
|
e as isCategoricalScale,
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
S as isNumericScale,
|
|
29
|
+
b as projectPoint
|
|
29
30
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
function d(n,
|
|
4
|
-
if (Object.is(n,
|
|
5
|
-
const s = n, r =
|
|
6
|
-
return u.length !==
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as l, useRef as i, useContext as f } from "react";
|
|
3
|
+
function d(n, o) {
|
|
4
|
+
if (Object.is(n, o)) return !0;
|
|
5
|
+
const s = n, r = o, u = Object.keys(s), c = Object.keys(r);
|
|
6
|
+
return u.length !== c.length ? !1 : u.every(
|
|
7
7
|
(e) => Object.prototype.hasOwnProperty.call(r, e) && Object.is(s[e], r[e])
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
|
-
function b(n,
|
|
11
|
-
const s =
|
|
12
|
-
const t =
|
|
13
|
-
return d(t.current, e) || (t.current = e), /* @__PURE__ */
|
|
10
|
+
function b(n, o) {
|
|
11
|
+
const s = l(o), r = ({ children: c, value: e }) => {
|
|
12
|
+
const t = i(e);
|
|
13
|
+
return d(t.current, e) || (t.current = e), /* @__PURE__ */ a(s.Provider, { value: t.current, children: c });
|
|
14
14
|
};
|
|
15
15
|
r.displayName = n + "Provider";
|
|
16
16
|
function u({
|
|
17
|
-
consumerName:
|
|
17
|
+
consumerName: c,
|
|
18
18
|
contextRequired: e
|
|
19
19
|
}) {
|
|
20
20
|
const t = f(s);
|
|
@@ -22,9 +22,9 @@ function b(n, c) {
|
|
|
22
22
|
return t;
|
|
23
23
|
if (e)
|
|
24
24
|
throw new Error(
|
|
25
|
-
`${
|
|
25
|
+
`${c} must be used within ${n}`
|
|
26
26
|
);
|
|
27
|
-
return
|
|
27
|
+
return o || {};
|
|
28
28
|
}
|
|
29
29
|
return [r, u];
|
|
30
30
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-react-visualization",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"keywords": [
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@ledgerhq/lumen-design-core": "0.1.
|
|
37
|
-
"@ledgerhq/lumen-ui-react": "0.1.
|
|
36
|
+
"@ledgerhq/lumen-design-core": "0.1.13",
|
|
37
|
+
"@ledgerhq/lumen-ui-react": "0.1.30",
|
|
38
38
|
"class-variance-authority": "^0.7.1",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-react-visualization",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@ledgerhq/lumen-design-core": "0.1.13",
|
|
37
|
-
"@ledgerhq/lumen-ui-react": "0.1.
|
|
37
|
+
"@ledgerhq/lumen-ui-react": "0.1.31",
|
|
38
38
|
"class-variance-authority": "^0.7.1",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|