@ledgerhq/lumen-ui-react-visualization 0.1.22 → 0.1.23
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/lib/Components/Line/Line.d.ts +1 -1
- package/dist/lib/Components/Line/Line.d.ts.map +1 -1
- package/dist/lib/Components/Line/Line.js +16 -16
- package/dist/lib/Components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/lib/Components/LineChart/LineChart.js +69 -63
- package/dist/lib/Components/Point/Point.d.ts +1 -1
- package/dist/lib/Components/Point/Point.d.ts.map +1 -1
- package/dist/lib/Components/Point/Point.js +68 -67
- package/dist/lib/Components/Point/pointContext/MagneticPointsProvider.d.ts.map +1 -1
- package/dist/lib/Components/Point/pointContext/MagneticPointsProvider.js +14 -11
- package/dist/lib/Components/Point/pointContext/index.d.ts +1 -1
- package/dist/lib/Components/Point/pointContext/index.d.ts.map +1 -1
- package/dist/lib/Components/Point/pointContext/magneticPointsContext.d.ts +22 -5
- package/dist/lib/Components/Point/pointContext/magneticPointsContext.d.ts.map +1 -1
- package/dist/lib/Components/Point/pointContext/magneticPointsContext.js +10 -5
- package/dist/lib/Components/Point/usePointGeometry.d.ts +2 -2
- package/dist/lib/Components/Point/usePointGeometry.d.ts.map +1 -1
- package/dist/lib/Components/Point/usePointGeometry.js +21 -21
- package/dist/lib/Components/Scrubber/ScrubberProvider.js +40 -40
- package/dist/package.json +4 -4
- package/package.json +2 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LineProps } from './types';
|
|
2
|
-
export declare
|
|
2
|
+
export declare const Line: import('react').NamedExoticComponent<LineProps>;
|
|
3
3
|
//# sourceMappingURL=Line.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,
|
|
1
|
+
{"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,eAAO,MAAM,IAAI,iDA+Ff,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsxs as c, jsx as o, Fragment as T } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { isNumericScale as
|
|
4
|
-
import { LINE_DEFAULT_STROKE_COLOR as
|
|
5
|
-
import { toScaledPoints as
|
|
6
|
-
import { useCartesianChartContext as
|
|
7
|
-
import { usePathReveal as
|
|
8
|
-
|
|
2
|
+
import { memo as k, useId as y, useMemo as d } from "react";
|
|
3
|
+
import { isNumericScale as A } from "../../utils/scales/scales.js";
|
|
4
|
+
import { LINE_DEFAULT_STROKE_COLOR as N, LINE_AREA_GRADIENT_OPACITY as O, LINE_STROKE_WIDTH as v } from "./constants.js";
|
|
5
|
+
import { toScaledPoints as R, buildLinePath as D, buildAreaPath as j } from "./utils.js";
|
|
6
|
+
import { useCartesianChartContext as b } from "../CartesianChart/context/cartesianChartContext.js";
|
|
7
|
+
import { usePathReveal as F } from "../CartesianChart/RevealAnimation/context.js";
|
|
8
|
+
const q = k(function({
|
|
9
9
|
seriesId: g,
|
|
10
10
|
stroke: C,
|
|
11
11
|
showArea: s = !1,
|
|
12
|
-
areaType:
|
|
12
|
+
areaType: K = "gradient",
|
|
13
13
|
curve: x,
|
|
14
14
|
connectNulls: L
|
|
15
15
|
}) {
|
|
16
|
-
const { getXScale: S, getYScale: _, getXAxisConfig: E, drawingArea: i, seriesMap: I } =
|
|
17
|
-
() => t?.data && l && n &&
|
|
16
|
+
const { getXScale: S, getYScale: _, getXAxisConfig: E, drawingArea: i, seriesMap: I } = b(), P = F(), l = S(), n = _(), p = E(), u = y(), t = I.get(g), r = (C ?? t?.stroke) || N, a = x ?? t?.curve, f = L ?? t?.connectNulls ?? !1, e = d(
|
|
17
|
+
() => t?.data && l && n && A(n) ? R(
|
|
18
18
|
t.data,
|
|
19
19
|
l,
|
|
20
20
|
n,
|
|
@@ -23,10 +23,10 @@ function U({
|
|
|
23
23
|
) : null,
|
|
24
24
|
[t, l, n, p, f]
|
|
25
25
|
), m = d(
|
|
26
|
-
() => e ?
|
|
26
|
+
() => e ? D(e, a) : null,
|
|
27
27
|
[e, a]
|
|
28
28
|
), h = d(
|
|
29
|
-
() => s && e && i ?
|
|
29
|
+
() => s && e && i ? j(e, i, a) : null,
|
|
30
30
|
[s, e, i, a]
|
|
31
31
|
);
|
|
32
32
|
return m ? /* @__PURE__ */ c("g", { clipPath: P, children: [
|
|
@@ -46,7 +46,7 @@ function U({
|
|
|
46
46
|
{
|
|
47
47
|
offset: "0%",
|
|
48
48
|
stopColor: r,
|
|
49
|
-
stopOpacity:
|
|
49
|
+
stopOpacity: O
|
|
50
50
|
}
|
|
51
51
|
),
|
|
52
52
|
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: r, stopOpacity: 0 })
|
|
@@ -70,13 +70,13 @@ function U({
|
|
|
70
70
|
d: m,
|
|
71
71
|
fill: "none",
|
|
72
72
|
stroke: r,
|
|
73
|
-
strokeWidth:
|
|
73
|
+
strokeWidth: v,
|
|
74
74
|
strokeLinecap: "round",
|
|
75
75
|
strokeLinejoin: "round"
|
|
76
76
|
}
|
|
77
77
|
)
|
|
78
78
|
] }) : null;
|
|
79
|
-
}
|
|
79
|
+
});
|
|
80
80
|
export {
|
|
81
|
-
|
|
81
|
+
q as Line
|
|
82
82
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,SAAS,CAAC;AA0FjB,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAgB,EAChB,QAAqB,EACrB,YAAY,EACZ,SAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAY,EACZ,KAAK,EACL,eAAe,EACf,wBAAwB,EACxB,OAAO,EACP,YAAY,EACZ,OAAe,EACf,UAAsB,EACtB,QAAQ,GACT,EAAE,QAAQ,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,SAAS,CAAC;AA0FjB,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAgB,EAChB,QAAqB,EACrB,YAAY,EACZ,SAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAY,EACZ,KAAK,EACL,eAAe,EACf,wBAAwB,EACxB,OAAO,EACP,YAAY,EACZ,OAAe,EACf,UAAsB,EACtB,QAAQ,GACT,EAAE,QAAQ,CAAC,cAAc,CAAC,2CAsF1B"}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useMemo as
|
|
1
|
+
import { jsx as i, jsxs as S, Fragment as u } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as h } from "react";
|
|
3
3
|
import { ChartEmptyLabel as M } from "../CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js";
|
|
4
4
|
import { useShimmerAnimation as R } from "../CartesianChart/hooks/useShimmerAnimation.js";
|
|
5
5
|
import { computeAxisPadding as V, canRenderLine as W, getChartDisplayState as q } from "./utils.js";
|
|
6
|
-
import { defaultXAxisProps as
|
|
6
|
+
import { defaultXAxisProps as k, defaultYAxisProps as g } from "../Axis/Axis.constants.js";
|
|
7
7
|
import { CartesianChart as z } from "../CartesianChart/CartesianChart.js";
|
|
8
8
|
import { LineChartEmptyState as G } from "./LineChartEmptyState/LineChartEmptyState.js";
|
|
9
9
|
import { XAxis as H } from "../Axis/XAxis/XAxis.js";
|
|
10
10
|
import { YAxis as J } from "../Axis/YAxis/YAxis.js";
|
|
11
11
|
import { Line as K } from "../Line/Line.js";
|
|
12
12
|
import { cssVar as N } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
13
|
-
const
|
|
13
|
+
const b = ({
|
|
14
14
|
series: o,
|
|
15
15
|
showArea: r,
|
|
16
16
|
areaType: a,
|
|
17
|
-
connectNulls:
|
|
17
|
+
connectNulls: e,
|
|
18
18
|
stroke: n
|
|
19
|
-
}) => /* @__PURE__ */ i(
|
|
19
|
+
}) => /* @__PURE__ */ i(u, { children: o.map((t) => /* @__PURE__ */ i(
|
|
20
20
|
K,
|
|
21
21
|
{
|
|
22
22
|
seriesId: t.id,
|
|
23
23
|
stroke: n ?? t.stroke,
|
|
24
24
|
showArea: r,
|
|
25
25
|
areaType: a,
|
|
26
|
-
connectNulls:
|
|
26
|
+
connectNulls: e
|
|
27
27
|
},
|
|
28
28
|
t.id
|
|
29
29
|
)) }), O = ({
|
|
30
30
|
series: o,
|
|
31
31
|
showArea: r,
|
|
32
32
|
areaType: a,
|
|
33
|
-
connectNulls:
|
|
33
|
+
connectNulls: e
|
|
34
34
|
}) => {
|
|
35
35
|
const { animationStyle: n, keyframe: t } = R();
|
|
36
|
-
return /* @__PURE__ */
|
|
36
|
+
return /* @__PURE__ */ S(u, { children: [
|
|
37
37
|
/* @__PURE__ */ i("style", { children: t }),
|
|
38
38
|
/* @__PURE__ */ i("g", { style: { animation: n }, children: /* @__PURE__ */ i(
|
|
39
|
-
|
|
39
|
+
b,
|
|
40
40
|
{
|
|
41
41
|
series: o,
|
|
42
42
|
showArea: r,
|
|
43
43
|
areaType: a,
|
|
44
|
-
connectNulls:
|
|
44
|
+
connectNulls: e,
|
|
45
45
|
stroke: N("var(--border-muted-subtle)")
|
|
46
46
|
}
|
|
47
47
|
) })
|
|
@@ -50,77 +50,83 @@ const k = ({
|
|
|
50
50
|
series: o,
|
|
51
51
|
showArea: r,
|
|
52
52
|
areaType: a,
|
|
53
|
-
connectNulls:
|
|
53
|
+
connectNulls: e,
|
|
54
54
|
showXAxis: n,
|
|
55
55
|
showYAxis: t,
|
|
56
|
-
xAxisConfig:
|
|
57
|
-
yAxisConfig:
|
|
56
|
+
xAxisConfig: m,
|
|
57
|
+
yAxisConfig: s,
|
|
58
58
|
isTransitionLoading: c,
|
|
59
59
|
children: f
|
|
60
|
-
}) => /* @__PURE__ */
|
|
61
|
-
n && /* @__PURE__ */ i(H, { ...
|
|
62
|
-
t && /* @__PURE__ */ i(J, { ...
|
|
60
|
+
}) => /* @__PURE__ */ S(u, { children: [
|
|
61
|
+
n && /* @__PURE__ */ i(H, { ...m }),
|
|
62
|
+
t && /* @__PURE__ */ i(J, { ...s }),
|
|
63
63
|
c ? /* @__PURE__ */ i(
|
|
64
64
|
O,
|
|
65
65
|
{
|
|
66
66
|
series: o,
|
|
67
67
|
showArea: r,
|
|
68
68
|
areaType: a,
|
|
69
|
-
connectNulls:
|
|
69
|
+
connectNulls: e
|
|
70
70
|
}
|
|
71
71
|
) : /* @__PURE__ */ i(
|
|
72
|
-
|
|
72
|
+
b,
|
|
73
73
|
{
|
|
74
74
|
series: o,
|
|
75
75
|
showArea: r,
|
|
76
76
|
areaType: a,
|
|
77
|
-
connectNulls:
|
|
77
|
+
connectNulls: e
|
|
78
78
|
}
|
|
79
79
|
),
|
|
80
80
|
f
|
|
81
81
|
] });
|
|
82
|
-
function
|
|
82
|
+
function si({
|
|
83
83
|
series: o,
|
|
84
84
|
showArea: r = !1,
|
|
85
85
|
areaType: a = "gradient",
|
|
86
|
-
connectNulls:
|
|
86
|
+
connectNulls: e,
|
|
87
87
|
showXAxis: n = !1,
|
|
88
88
|
showYAxis: t = !1,
|
|
89
|
-
xAxis:
|
|
90
|
-
yAxis:
|
|
89
|
+
xAxis: m,
|
|
90
|
+
yAxis: s,
|
|
91
91
|
width: c = "100%",
|
|
92
92
|
height: f = 240,
|
|
93
|
-
inset:
|
|
94
|
-
enableScrubbing:
|
|
95
|
-
onScrubberPositionChange:
|
|
96
|
-
animate:
|
|
97
|
-
magnetRadius:
|
|
98
|
-
loading:
|
|
99
|
-
emptyLabel:
|
|
100
|
-
children:
|
|
93
|
+
inset: v,
|
|
94
|
+
enableScrubbing: A,
|
|
95
|
+
onScrubberPositionChange: j,
|
|
96
|
+
animate: D,
|
|
97
|
+
magnetRadius: E,
|
|
98
|
+
loading: C = !1,
|
|
99
|
+
emptyLabel: L = "No data",
|
|
100
|
+
children: T
|
|
101
101
|
}) {
|
|
102
|
-
const p =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
102
|
+
const p = h(
|
|
103
|
+
() => ({
|
|
104
|
+
...k,
|
|
105
|
+
...m,
|
|
106
|
+
position: m?.position ?? k.position
|
|
107
|
+
}),
|
|
108
|
+
[m]
|
|
109
|
+
), l = h(
|
|
110
|
+
() => ({
|
|
111
|
+
...g,
|
|
112
|
+
...s,
|
|
113
|
+
position: s?.position ?? g.position,
|
|
114
|
+
width: s?.width ?? g.width
|
|
115
|
+
}),
|
|
116
|
+
[s]
|
|
117
|
+
), y = p.position, x = l.position, P = l.width, B = h(
|
|
112
118
|
() => V({
|
|
113
119
|
showXAxis: n,
|
|
114
120
|
showYAxis: t,
|
|
115
|
-
xAxisPosition:
|
|
121
|
+
xAxisPosition: y,
|
|
116
122
|
yAxisPosition: x,
|
|
117
|
-
yAxisWidth:
|
|
123
|
+
yAxisWidth: P
|
|
118
124
|
}),
|
|
119
|
-
[n, t,
|
|
120
|
-
),
|
|
121
|
-
loading:
|
|
122
|
-
hasData:
|
|
123
|
-
emptyLabel:
|
|
125
|
+
[n, t, y, x, P]
|
|
126
|
+
), F = W(o, p.data), { status: d, ariaLabel: I } = q({
|
|
127
|
+
loading: C,
|
|
128
|
+
hasData: F,
|
|
129
|
+
emptyLabel: L
|
|
124
130
|
});
|
|
125
131
|
return /* @__PURE__ */ i(
|
|
126
132
|
z,
|
|
@@ -130,33 +136,33 @@ function ei({
|
|
|
130
136
|
yAxis: l,
|
|
131
137
|
width: c,
|
|
132
138
|
height: f,
|
|
133
|
-
inset:
|
|
134
|
-
axisPadding:
|
|
135
|
-
enableScrubbing:
|
|
136
|
-
onScrubberPositionChange:
|
|
137
|
-
animate:
|
|
138
|
-
magnetRadius:
|
|
139
|
-
ariaLabel:
|
|
140
|
-
ariaBusy:
|
|
141
|
-
overlay:
|
|
142
|
-
children:
|
|
139
|
+
inset: v,
|
|
140
|
+
axisPadding: B,
|
|
141
|
+
enableScrubbing: A,
|
|
142
|
+
onScrubberPositionChange: j,
|
|
143
|
+
animate: D,
|
|
144
|
+
magnetRadius: E,
|
|
145
|
+
ariaLabel: I,
|
|
146
|
+
ariaBusy: C,
|
|
147
|
+
overlay: d === "empty" ? /* @__PURE__ */ i(M, { children: L }) : void 0,
|
|
148
|
+
children: d === "initial-loading" || d === "empty" ? /* @__PURE__ */ i(G, { loading: d === "initial-loading" }) : /* @__PURE__ */ i(
|
|
143
149
|
Q,
|
|
144
150
|
{
|
|
145
151
|
series: o ?? [],
|
|
146
152
|
showArea: r,
|
|
147
153
|
areaType: a,
|
|
148
|
-
connectNulls:
|
|
154
|
+
connectNulls: e,
|
|
149
155
|
showXAxis: n,
|
|
150
156
|
showYAxis: t,
|
|
151
157
|
xAxisConfig: p,
|
|
152
158
|
yAxisConfig: l,
|
|
153
|
-
isTransitionLoading:
|
|
154
|
-
children:
|
|
159
|
+
isTransitionLoading: d === "transition-loading",
|
|
160
|
+
children: T
|
|
155
161
|
}
|
|
156
162
|
)
|
|
157
163
|
}
|
|
158
164
|
);
|
|
159
165
|
}
|
|
160
166
|
export {
|
|
161
|
-
|
|
167
|
+
si as LineChart
|
|
162
168
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PointLabelProps, PointProps } from './types';
|
|
2
2
|
export declare function PointLabel({ style, textAnchor, dominantBaseline, ...props }: Readonly<PointLabelProps>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
-
export declare
|
|
3
|
+
export declare const Point: import('react').NamedExoticComponent<Readonly<PointProps>>;
|
|
4
4
|
//# sourceMappingURL=Point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Point/Point.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Point/Point.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAEV,eAAe,EAEf,UAAU,EACX,MAAM,SAAS,CAAC;AAKjB,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,UAAqB,EACrB,gBAAyB,EACzB,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,eAAe,CAAC,2CAe3B;AA+BD,eAAO,MAAM,KAAK,4DAwEhB,CAAC"}
|
|
@@ -1,122 +1,123 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { jsxs as P, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as E } from "react";
|
|
3
|
+
import { DEFAULT_SIZE as S, LABEL_FONT_SIZE as T, STROKE_WIDTH as k } from "./constants.js";
|
|
4
|
+
import { usePointGeometry as _ } from "./usePointGeometry.js";
|
|
5
|
+
import { resolveLabel as w, computeLabelGeometry as F, buildArrowPoints as G } from "./utils.js";
|
|
5
6
|
import { cssVar as l } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
6
|
-
function
|
|
7
|
-
style:
|
|
8
|
-
textAnchor:
|
|
7
|
+
function I({
|
|
8
|
+
style: i,
|
|
9
|
+
textAnchor: t = "middle",
|
|
9
10
|
dominantBaseline: o = "auto",
|
|
10
|
-
...
|
|
11
|
+
...e
|
|
11
12
|
}) {
|
|
12
13
|
return /* @__PURE__ */ n(
|
|
13
14
|
"text",
|
|
14
15
|
{
|
|
15
|
-
textAnchor:
|
|
16
|
+
textAnchor: t,
|
|
16
17
|
dominantBaseline: o,
|
|
17
18
|
style: {
|
|
18
19
|
fill: l("var(--text-base)"),
|
|
19
|
-
fontSize:
|
|
20
|
+
fontSize: T,
|
|
20
21
|
fontWeight: l("var(--font-style-body-4-weight-medium)"),
|
|
21
22
|
fontFamily: l("var(--font-family-font)"),
|
|
22
|
-
...
|
|
23
|
+
...i
|
|
23
24
|
},
|
|
24
|
-
...
|
|
25
|
+
...e
|
|
25
26
|
}
|
|
26
27
|
);
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
-
const
|
|
29
|
+
function V({ x: i, y: t, size: o, color: e }) {
|
|
30
|
+
const c = o / 2, m = e ?? l("var(--background-muted-strong)");
|
|
30
31
|
return /* @__PURE__ */ n(
|
|
31
32
|
"circle",
|
|
32
33
|
{
|
|
33
34
|
"data-testid": "point-circle",
|
|
34
|
-
cx:
|
|
35
|
-
cy:
|
|
36
|
-
r:
|
|
35
|
+
cx: i,
|
|
36
|
+
cy: t,
|
|
37
|
+
r: c,
|
|
37
38
|
style: {
|
|
38
|
-
fill:
|
|
39
|
+
fill: m,
|
|
39
40
|
stroke: l("var(--background-canvas)")
|
|
40
41
|
},
|
|
41
|
-
strokeWidth:
|
|
42
|
+
strokeWidth: k
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
|
-
function
|
|
46
|
+
function W({ x: i, y: t, size: o, position: e }) {
|
|
46
47
|
return /* @__PURE__ */ n(
|
|
47
48
|
"polygon",
|
|
48
49
|
{
|
|
49
50
|
"data-testid": "point-arrow",
|
|
50
|
-
points:
|
|
51
|
+
points: G(i, t, o / 2, e),
|
|
51
52
|
style: { fill: l("var(--text-base)") }
|
|
52
53
|
}
|
|
53
54
|
);
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
+
const K = E(function({
|
|
56
57
|
dataX: t,
|
|
57
|
-
dataY:
|
|
58
|
-
color:
|
|
59
|
-
label:
|
|
60
|
-
LabelComponent:
|
|
61
|
-
labelPosition:
|
|
62
|
-
hidePoint:
|
|
63
|
-
showLabelArrow:
|
|
64
|
-
size:
|
|
65
|
-
onClick:
|
|
66
|
-
magnetic:
|
|
67
|
-
labelAlignment:
|
|
58
|
+
dataY: o,
|
|
59
|
+
color: e,
|
|
60
|
+
label: c,
|
|
61
|
+
LabelComponent: m,
|
|
62
|
+
labelPosition: f = "top",
|
|
63
|
+
hidePoint: p = !1,
|
|
64
|
+
showLabelArrow: x = !0,
|
|
65
|
+
size: u = S,
|
|
66
|
+
onClick: y,
|
|
67
|
+
magnetic: b = !1,
|
|
68
|
+
labelAlignment: v = "auto"
|
|
68
69
|
}) {
|
|
69
|
-
const { pixel:
|
|
70
|
+
const { pixel: r, drawingArea: g, revealStyle: L, isVisible: h } = _({
|
|
70
71
|
dataX: t,
|
|
71
|
-
dataY:
|
|
72
|
-
magnetic:
|
|
72
|
+
dataY: o,
|
|
73
|
+
magnetic: b
|
|
73
74
|
});
|
|
74
|
-
if (!
|
|
75
|
+
if (!h || !r)
|
|
75
76
|
return null;
|
|
76
|
-
const
|
|
77
|
-
text:
|
|
78
|
-
pixelX:
|
|
79
|
-
pixelY:
|
|
80
|
-
size:
|
|
81
|
-
labelPosition:
|
|
82
|
-
showLabelArrow:
|
|
83
|
-
area:
|
|
84
|
-
alignment:
|
|
85
|
-
}) : null,
|
|
86
|
-
return /* @__PURE__ */
|
|
77
|
+
const a = w(c, t), d = a !== void 0, s = d ? F({
|
|
78
|
+
text: a,
|
|
79
|
+
pixelX: r.x,
|
|
80
|
+
pixelY: r.y,
|
|
81
|
+
size: u,
|
|
82
|
+
labelPosition: f,
|
|
83
|
+
showLabelArrow: x,
|
|
84
|
+
area: g,
|
|
85
|
+
alignment: v
|
|
86
|
+
}) : null, A = m ?? I;
|
|
87
|
+
return /* @__PURE__ */ P(
|
|
87
88
|
"g",
|
|
88
89
|
{
|
|
89
90
|
"data-testid": "point-group",
|
|
90
|
-
onClick:
|
|
91
|
+
onClick: y,
|
|
91
92
|
style: {
|
|
92
|
-
...
|
|
93
|
-
...
|
|
93
|
+
...L,
|
|
94
|
+
...y ? { cursor: "pointer" } : void 0
|
|
94
95
|
},
|
|
95
96
|
children: [
|
|
96
|
-
!
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
!p && /* @__PURE__ */ n(V, { x: r.x, y: r.y, size: u, color: e }),
|
|
98
|
+
d && x && /* @__PURE__ */ n(
|
|
99
|
+
W,
|
|
99
100
|
{
|
|
100
|
-
x:
|
|
101
|
-
y:
|
|
102
|
-
size:
|
|
103
|
-
position:
|
|
101
|
+
x: r.x,
|
|
102
|
+
y: r.y,
|
|
103
|
+
size: u,
|
|
104
|
+
position: f
|
|
104
105
|
}
|
|
105
106
|
),
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
a != null && s && /* @__PURE__ */ n(
|
|
108
|
+
A,
|
|
108
109
|
{
|
|
109
|
-
x:
|
|
110
|
-
y:
|
|
111
|
-
textAnchor:
|
|
112
|
-
children:
|
|
110
|
+
x: s.x,
|
|
111
|
+
y: s.y,
|
|
112
|
+
textAnchor: s.textAnchor,
|
|
113
|
+
children: a
|
|
113
114
|
}
|
|
114
115
|
)
|
|
115
116
|
]
|
|
116
117
|
}
|
|
117
118
|
);
|
|
118
|
-
}
|
|
119
|
+
});
|
|
119
120
|
export {
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
K as Point,
|
|
122
|
+
I as PointLabel
|
|
122
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MagneticPointsProvider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Point/pointContext/MagneticPointsProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MagneticPointsProvider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Point/pointContext/MagneticPointsProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AASvC,KAAK,2BAA2B,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,GACT,EAAE,QAAQ,CAAC,2BAA2B,CAAC,2CAwCvC"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
2
|
+
import { useRef as l, useState as v, useCallback as n, useMemo as g } from "react";
|
|
3
|
+
import { MagneticRegistryProvider as h, MagneticSnapshotProvider as M } from "./magneticPointsContext.js";
|
|
4
|
+
function S({
|
|
5
5
|
children: f
|
|
6
6
|
}) {
|
|
7
|
-
const e =
|
|
8
|
-
e.current.has(r) || (e.current.add(r),
|
|
7
|
+
const e = l(/* @__PURE__ */ new Set()), [s, o] = v(0), i = n((r) => {
|
|
8
|
+
e.current.has(r) || (e.current.add(r), o((t) => t + 1));
|
|
9
9
|
}, []), c = n((r) => {
|
|
10
|
-
e.current.has(r) && (e.current.delete(r),
|
|
11
|
-
}, []), u = n(() => e.current, []), m =
|
|
12
|
-
() => ({ register: i, unregister: c
|
|
13
|
-
[i, c
|
|
10
|
+
e.current.has(r) && (e.current.delete(r), o((t) => t + 1));
|
|
11
|
+
}, []), u = n(() => e.current, []), m = g(
|
|
12
|
+
() => ({ register: i, unregister: c }),
|
|
13
|
+
[i, c]
|
|
14
|
+
), p = g(
|
|
15
|
+
() => ({ version: s, getMagneticPoints: u }),
|
|
16
|
+
[s, u]
|
|
14
17
|
);
|
|
15
|
-
return /* @__PURE__ */ a(
|
|
18
|
+
return /* @__PURE__ */ a(h, { value: m, children: /* @__PURE__ */ a(M, { value: p, children: f }) });
|
|
16
19
|
}
|
|
17
20
|
export {
|
|
18
|
-
|
|
21
|
+
S as MagneticPointsProvider
|
|
19
22
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { useMagneticRegistry, useMagneticSnapshot, type MagneticRegistryValue, type MagneticSnapshotValue, } from './magneticPointsContext';
|
|
2
2
|
export { MagneticPointsProvider } from './MagneticPointsProvider';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Point/pointContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Point/pointContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Stable registration API for magnetic points. Its identity never changes for
|
|
3
|
+
* the provider's lifetime, so consumers (every `Point`) do not re-render when
|
|
4
|
+
* the magnetic set changes — only when they mount/unmount.
|
|
5
|
+
*/
|
|
6
|
+
export type MagneticRegistryValue = {
|
|
2
7
|
register: (dataIndex: number) => void;
|
|
3
8
|
unregister: (dataIndex: number) => void;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Mutable snapshot of the registered magnetic points. Changes on every
|
|
12
|
+
* register/unregister (via `version`) and is consumed only by the scrubber,
|
|
13
|
+
* which needs to recompute its snap targets when the set changes.
|
|
14
|
+
*/
|
|
15
|
+
export type MagneticSnapshotValue = {
|
|
4
16
|
version: number;
|
|
5
17
|
getMagneticPoints: () => ReadonlySet<number>;
|
|
6
18
|
};
|
|
7
|
-
declare const
|
|
19
|
+
declare const MagneticRegistryProvider: import('react').FC<{
|
|
20
|
+
children: import('react').ReactNode;
|
|
21
|
+
value: MagneticRegistryValue;
|
|
22
|
+
}>;
|
|
23
|
+
declare const MagneticSnapshotProvider: import('react').FC<{
|
|
8
24
|
children: import('react').ReactNode;
|
|
9
|
-
value:
|
|
25
|
+
value: MagneticSnapshotValue;
|
|
10
26
|
}>;
|
|
11
|
-
export declare const
|
|
12
|
-
export
|
|
27
|
+
export declare const useMagneticRegistry: () => MagneticRegistryValue;
|
|
28
|
+
export declare const useMagneticSnapshot: () => MagneticSnapshotValue;
|
|
29
|
+
export { MagneticRegistryProvider, MagneticSnapshotProvider };
|
|
13
30
|
//# sourceMappingURL=magneticPointsContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magneticPointsContext.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Point/pointContext/magneticPointsContext.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"magneticPointsContext.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Point/pointContext/magneticPointsContext.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,QAAA,MAAO,wBAAwB;;;EAC+B,CAAC;AAE/D,QAAA,MAAO,wBAAwB;;;EAC+B,CAAC;AAE/D,eAAO,MAAM,mBAAmB,QAAO,qBAInC,CAAC;AAEL,eAAO,MAAM,mBAAmB,QAAO,qBAInC,CAAC;AAEL,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import { createSafeContext as
|
|
2
|
-
const [o,
|
|
3
|
-
consumerName: "
|
|
1
|
+
import { createSafeContext as e } from "../../../../libs/utils-shared/dist/index.js";
|
|
2
|
+
const [a, t] = e("MagneticRegistry"), [o, n] = e("MagneticSnapshot"), i = () => t({
|
|
3
|
+
consumerName: "useMagneticRegistry",
|
|
4
|
+
contextRequired: !0
|
|
5
|
+
}), c = () => n({
|
|
6
|
+
consumerName: "useMagneticSnapshot",
|
|
4
7
|
contextRequired: !0
|
|
5
8
|
});
|
|
6
9
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
a as MagneticRegistryProvider,
|
|
11
|
+
o as MagneticSnapshotProvider,
|
|
12
|
+
i as useMagneticRegistry,
|
|
13
|
+
c as useMagneticSnapshot
|
|
9
14
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { DrawingArea } from '../../utils/types';
|
|
3
3
|
import { BaseAxisProps } from '../Axis';
|
|
4
|
-
import {
|
|
4
|
+
import { MagneticRegistryValue } from './pointContext/magneticPointsContext';
|
|
5
5
|
type Pixel = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
|
@@ -28,6 +28,6 @@ export declare const usePointGeometry: ({ dataX, dataY, magnetic, }: UsePointGeo
|
|
|
28
28
|
* Registers/unregisters a data index as a magnetic snap target
|
|
29
29
|
* when the Point has `magnetic` enabled.
|
|
30
30
|
*/
|
|
31
|
-
export declare const useMagneticRegistration: (magnetic: boolean, dataX: number, getXAxisConfig: () => BaseAxisProps | undefined, { register, unregister }:
|
|
31
|
+
export declare const useMagneticRegistration: (magnetic: boolean, dataX: number, getXAxisConfig: () => BaseAxisProps | undefined, { register, unregister }: MagneticRegistryValue) => void;
|
|
32
32
|
export {};
|
|
33
33
|
//# sourceMappingURL=usePointGeometry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePointGeometry.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Point/usePointGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"usePointGeometry.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Point/usePointGeometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,OAAO,CAAC;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAI7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAGlF,KAAK,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,6BAI9B,sBAAsB,KAAG,aAqB3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,UAAU,OAAO,EACjB,OAAO,MAAM,EACb,gBAAgB,MAAM,aAAa,GAAG,SAAS,EAC/C,0BAA0B,qBAAqB,KAC9C,IAQF,CAAC"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useMemo as
|
|
2
|
-
import { projectPoint as
|
|
3
|
-
import { isWithinBounds as
|
|
4
|
-
import { useCartesianChartContext as
|
|
5
|
-
import {
|
|
6
|
-
import { usePointReveal as
|
|
1
|
+
import { useMemo as a, useEffect as x } from "react";
|
|
2
|
+
import { projectPoint as g } from "../../utils/scales/scales.js";
|
|
3
|
+
import { isWithinBounds as v, resolveDataXToIndex as y } from "./utils.js";
|
|
4
|
+
import { useCartesianChartContext as S } from "../CartesianChart/context/cartesianChartContext.js";
|
|
5
|
+
import { useMagneticRegistry as R } from "./pointContext/magneticPointsContext.js";
|
|
6
|
+
import { usePointReveal as d } from "../CartesianChart/RevealAnimation/context.js";
|
|
7
7
|
const A = ({
|
|
8
|
-
dataX:
|
|
9
|
-
dataY:
|
|
10
|
-
magnetic:
|
|
8
|
+
dataX: e,
|
|
9
|
+
dataY: t,
|
|
10
|
+
magnetic: r
|
|
11
11
|
}) => {
|
|
12
|
-
const { getXScale:
|
|
13
|
-
|
|
14
|
-
const c =
|
|
12
|
+
const { getXScale: i, getYScale: n, getXAxisConfig: o, drawingArea: u } = S(), f = R();
|
|
13
|
+
C(r, e, o, f);
|
|
14
|
+
const c = i(), m = n(), s = a(() => {
|
|
15
15
|
if (!(!c || !m))
|
|
16
|
-
return
|
|
17
|
-
}, [
|
|
16
|
+
return g(e, t, c, m);
|
|
17
|
+
}, [e, t, c, m]), l = d(), p = s !== void 0 && v(s.x, s.y, u);
|
|
18
18
|
return { pixel: s, drawingArea: u, revealStyle: l, isVisible: p };
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
if (!
|
|
22
|
-
const o =
|
|
19
|
+
}, C = (e, t, r, { register: i, unregister: n }) => {
|
|
20
|
+
x(() => {
|
|
21
|
+
if (!e) return;
|
|
22
|
+
const o = y(t, r());
|
|
23
23
|
if (o !== void 0)
|
|
24
|
-
return
|
|
25
|
-
}, [
|
|
24
|
+
return i(o), () => n(o);
|
|
25
|
+
}, [e, t, r, i, n]);
|
|
26
26
|
};
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
C as useMagneticRegistration,
|
|
29
29
|
A as usePointGeometry
|
|
30
30
|
};
|
|
@@ -3,7 +3,7 @@ import { useState as K, useRef as k, useMemo as X, useCallback as c, useEffect a
|
|
|
3
3
|
import { clamp as p } from "../../utils/numbers.js";
|
|
4
4
|
import { buildSortedMagnets as z, getDataIndexFromPosition as H, resolvePixelX as N, applyMagnetization as U } from "./utils.js";
|
|
5
5
|
import { useCartesianChartContext as V } from "../CartesianChart/context/cartesianChartContext.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useMagneticSnapshot as G } from "../Point/pointContext/magneticPointsContext.js";
|
|
7
7
|
import { ScrubberContextProvider as J } from "./context/scrubberContext.js";
|
|
8
8
|
function S({
|
|
9
9
|
children: R,
|
|
@@ -17,31 +17,31 @@ function S({
|
|
|
17
17
|
), h = k(m);
|
|
18
18
|
h.current = m;
|
|
19
19
|
const g = k(null), l = k(0), A = X(() => {
|
|
20
|
-
const
|
|
20
|
+
const e = w();
|
|
21
21
|
return z({
|
|
22
|
-
magneticIndices:
|
|
23
|
-
getPixelForIndex: (
|
|
22
|
+
magneticIndices: e,
|
|
23
|
+
getPixelForIndex: (t) => N(t, f, v())
|
|
24
24
|
});
|
|
25
25
|
}, [T, w, f, v]), i = c(
|
|
26
|
-
(
|
|
27
|
-
const
|
|
28
|
-
B(
|
|
26
|
+
(e) => {
|
|
27
|
+
const t = e === void 0 || n <= 0 ? void 0 : p(e, 0, n - 1);
|
|
28
|
+
B(t), y?.(t);
|
|
29
29
|
},
|
|
30
30
|
[n, y]
|
|
31
31
|
), I = c(
|
|
32
|
-
(
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
32
|
+
(e) => {
|
|
33
|
+
const t = f();
|
|
34
|
+
if (!t || !r || n <= 0) return;
|
|
35
35
|
const a = v();
|
|
36
36
|
let o = H(
|
|
37
|
-
t,
|
|
38
37
|
e,
|
|
38
|
+
t,
|
|
39
39
|
a,
|
|
40
40
|
n
|
|
41
41
|
);
|
|
42
42
|
E > 0 && (o = U({
|
|
43
43
|
resolvedIndex: o,
|
|
44
|
-
pixelX:
|
|
44
|
+
pixelX: e,
|
|
45
45
|
sortedMagnets: A,
|
|
46
46
|
magnetRadius: E
|
|
47
47
|
})), o !== h.current && i(o);
|
|
@@ -56,57 +56,57 @@ function S({
|
|
|
56
56
|
i
|
|
57
57
|
]
|
|
58
58
|
), u = c(
|
|
59
|
-
(
|
|
60
|
-
g.current =
|
|
59
|
+
(e) => {
|
|
60
|
+
g.current = e, l.current || (l.current = requestAnimationFrame(() => {
|
|
61
61
|
l.current = 0;
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const t = g.current;
|
|
63
|
+
t !== null && (g.current = null, I(t));
|
|
64
64
|
}));
|
|
65
65
|
},
|
|
66
66
|
[I]
|
|
67
67
|
), s = c(() => {
|
|
68
68
|
r && i(void 0);
|
|
69
69
|
}, [r, i]), L = c(
|
|
70
|
-
(
|
|
71
|
-
const a =
|
|
72
|
-
u(
|
|
70
|
+
(e) => {
|
|
71
|
+
const a = e.currentTarget.getBoundingClientRect();
|
|
72
|
+
u(e.clientX - a.left);
|
|
73
73
|
},
|
|
74
74
|
[u]
|
|
75
75
|
), x = c(
|
|
76
|
-
(
|
|
77
|
-
if (!r || !
|
|
78
|
-
const
|
|
79
|
-
u(
|
|
76
|
+
(e) => {
|
|
77
|
+
if (!r || !e.touches.length) return;
|
|
78
|
+
const t = e.touches[0], o = e.currentTarget.getBoundingClientRect();
|
|
79
|
+
u(t.clientX - o.left);
|
|
80
80
|
},
|
|
81
81
|
[r, u]
|
|
82
82
|
), P = c(
|
|
83
|
-
(
|
|
84
|
-
if (!
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
u(
|
|
83
|
+
(e) => {
|
|
84
|
+
if (!e.touches.length) return;
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
const t = e.touches[0], o = e.currentTarget.getBoundingClientRect();
|
|
87
|
+
u(t.clientX - o.left);
|
|
88
88
|
},
|
|
89
89
|
[u]
|
|
90
90
|
), C = c(
|
|
91
|
-
(
|
|
91
|
+
(e) => {
|
|
92
92
|
if (!r || n <= 0) return;
|
|
93
|
-
const
|
|
93
|
+
const t = n - 1, a = h.current ?? t, o = e.shiftKey ? p(Math.floor(t * 0.1), 1, 10) : 1;
|
|
94
94
|
let d;
|
|
95
|
-
switch (
|
|
95
|
+
switch (e.key) {
|
|
96
96
|
case "ArrowLeft":
|
|
97
|
-
|
|
97
|
+
e.preventDefault(), d = p(a - o, 0, t);
|
|
98
98
|
break;
|
|
99
99
|
case "ArrowRight":
|
|
100
|
-
|
|
100
|
+
e.preventDefault(), d = p(a + o, 0, t);
|
|
101
101
|
break;
|
|
102
102
|
case "Home":
|
|
103
|
-
|
|
103
|
+
e.preventDefault(), d = 0;
|
|
104
104
|
break;
|
|
105
105
|
case "End":
|
|
106
|
-
|
|
106
|
+
e.preventDefault(), d = t;
|
|
107
107
|
break;
|
|
108
108
|
case "Escape":
|
|
109
|
-
|
|
109
|
+
e.preventDefault(), d = void 0;
|
|
110
110
|
break;
|
|
111
111
|
default:
|
|
112
112
|
return;
|
|
@@ -118,10 +118,10 @@ function S({
|
|
|
118
118
|
!r || h.current === void 0 || s();
|
|
119
119
|
}, [r, s]);
|
|
120
120
|
j(() => {
|
|
121
|
-
const
|
|
122
|
-
if (!(!
|
|
123
|
-
return
|
|
124
|
-
|
|
121
|
+
const e = D.current;
|
|
122
|
+
if (!(!e || !r))
|
|
123
|
+
return e.addEventListener("mousemove", L), e.addEventListener("mouseleave", s), e.addEventListener("touchstart", x, { passive: !1 }), e.addEventListener("touchmove", P, { passive: !1 }), e.addEventListener("touchend", s), e.addEventListener("touchcancel", s), e.addEventListener("keydown", C), e.addEventListener("blur", M), () => {
|
|
124
|
+
e.removeEventListener("mousemove", L), e.removeEventListener("mouseleave", s), e.removeEventListener("touchstart", x), e.removeEventListener("touchmove", P), e.removeEventListener("touchend", s), e.removeEventListener("touchcancel", s), e.removeEventListener("keydown", C), e.removeEventListener("blur", M), cancelAnimationFrame(l.current), l.current = 0;
|
|
125
125
|
};
|
|
126
126
|
}, [
|
|
127
127
|
D,
|
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.22",
|
|
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.18",
|
|
37
|
+
"@ledgerhq/lumen-ui-react": "0.1.43",
|
|
38
38
|
"class-variance-authority": "^0.7.1",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tailwind-merge": "^2.6.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@ledgerhq/lumen-utils-shared": "0.1.
|
|
45
|
+
"@ledgerhq/lumen-utils-shared": "0.1.6",
|
|
46
46
|
"d3-array": "^3.2.4",
|
|
47
47
|
"d3-scale": "^4.0.2",
|
|
48
48
|
"d3-shape": "^3.2.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.23",
|
|
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.18",
|
|
37
|
-
"@ledgerhq/lumen-ui-react": "0.1.
|
|
37
|
+
"@ledgerhq/lumen-ui-react": "0.1.44",
|
|
38
38
|
"class-variance-authority": "^0.7.1",
|
|
39
39
|
"clsx": "^2.1.1",
|
|
40
40
|
"react": "^18.0.0 || ^19.0.0",
|