@ledgerhq/lumen-ui-react-visualization 0.1.11 → 0.1.12
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 +13 -9
- 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 +78 -79
- package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts +3 -0
- package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js +41 -0
- package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts +7 -0
- package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealClip/context.js +6 -0
- package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts +3 -0
- package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts +37 -0
- package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealClip/utils.d.ts +17 -0
- package/dist/lib/Components/CartesianChart/RevealClip/utils.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealClip/utils.js +23 -0
- package/dist/lib/Components/CartesianChart/types.d.ts +6 -0
- package/dist/lib/Components/CartesianChart/types.d.ts.map +1 -1
- package/dist/lib/Components/CartesianChart/utils.js +8 -8
- package/dist/lib/Components/Line/Line.d.ts.map +1 -1
- package/dist/lib/Components/Line/Line.js +22 -21
- 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 +36 -34
- package/dist/lib/Components/LineChart/types.d.ts +5 -0
- package/dist/lib/Components/LineChart/types.d.ts.map +1 -1
- package/dist/lib/Components/Point/Point.d.ts.map +1 -1
- package/dist/lib/Components/Point/Point.js +19 -17
- package/dist/lib/Components/ReferenceLine/ReferenceLine.d.ts +3 -0
- package/dist/lib/Components/ReferenceLine/ReferenceLine.d.ts.map +1 -0
- package/dist/lib/Components/ReferenceLine/ReferenceLine.js +122 -0
- package/dist/lib/Components/ReferenceLine/constants.d.ts +4 -0
- package/dist/lib/Components/ReferenceLine/constants.d.ts.map +1 -0
- package/dist/lib/Components/ReferenceLine/constants.js +7 -0
- package/dist/lib/Components/ReferenceLine/index.d.ts +3 -0
- package/dist/lib/Components/ReferenceLine/index.d.ts.map +1 -0
- package/dist/lib/Components/ReferenceLine/types.d.ts +74 -0
- package/dist/lib/Components/ReferenceLine/types.d.ts.map +1 -0
- package/dist/lib/Components/ReferenceLine/utils.d.ts +49 -0
- package/dist/lib/Components/ReferenceLine/utils.d.ts.map +1 -0
- package/dist/lib/Components/ReferenceLine/utils.js +65 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.d.ts +3 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.d.ts.map +1 -0
- package/dist/lib/Components/{ChartTooltip → Scrubber/DefaultScrubberTooltip}/ChartTooltipItem.js +13 -9
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts +12 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +85 -0
- package/dist/lib/Components/{ChartTooltip → Scrubber/DefaultScrubberTooltip}/constants.d.ts +2 -1
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/constants.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/constants.js +13 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/index.d.ts +3 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/index.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/utils.d.ts +43 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/utils.d.ts.map +1 -0
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/utils.js +59 -0
- package/dist/lib/Components/Scrubber/Scrubber.d.ts +14 -2
- package/dist/lib/Components/Scrubber/Scrubber.d.ts.map +1 -1
- package/dist/lib/Components/Scrubber/Scrubber.js +107 -81
- package/dist/lib/Components/Scrubber/index.d.ts +2 -1
- package/dist/lib/Components/Scrubber/index.d.ts.map +1 -1
- package/dist/lib/Components/Scrubber/types.d.ts +99 -1
- package/dist/lib/Components/Scrubber/types.d.ts.map +1 -1
- package/dist/lib/Components/index.d.ts +1 -1
- package/dist/lib/Components/index.d.ts.map +1 -1
- package/dist/package.json +3 -3
- package/package.json +2 -2
- package/dist/lib/Components/ChartTooltip/ChartTooltip.d.ts +0 -23
- package/dist/lib/Components/ChartTooltip/ChartTooltip.d.ts.map +0 -1
- package/dist/lib/Components/ChartTooltip/ChartTooltip.js +0 -81
- package/dist/lib/Components/ChartTooltip/ChartTooltipItem.d.ts +0 -3
- package/dist/lib/Components/ChartTooltip/ChartTooltipItem.d.ts.map +0 -1
- package/dist/lib/Components/ChartTooltip/constants.d.ts.map +0 -1
- package/dist/lib/Components/ChartTooltip/constants.js +0 -12
- package/dist/lib/Components/ChartTooltip/index.d.ts +0 -3
- package/dist/lib/Components/ChartTooltip/index.d.ts.map +0 -1
- package/dist/lib/Components/ChartTooltip/types.d.ts +0 -61
- package/dist/lib/Components/ChartTooltip/types.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { LineChart as o } from "./lib/Components/LineChart/LineChart.js";
|
|
2
|
+
import { Point as f, PointLabel as p } from "./lib/Components/Point/Point.js";
|
|
3
|
+
import { ReferenceLine as x } from "./lib/Components/ReferenceLine/ReferenceLine.js";
|
|
4
4
|
import { Scrubber as i } from "./lib/Components/Scrubber/Scrubber.js";
|
|
5
|
-
import { useScrubberContext as
|
|
5
|
+
import { useScrubberContext as u } from "./lib/Components/Scrubber/context/scrubberContext.js";
|
|
6
|
+
import { ChartTooltipItem as c } from "./lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.js";
|
|
7
|
+
import { DefaultScrubberTooltip as C } from "./lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js";
|
|
6
8
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
f as
|
|
9
|
+
c as ChartTooltipItem,
|
|
10
|
+
C as DefaultScrubberTooltip,
|
|
11
|
+
o as LineChart,
|
|
12
|
+
f as Point,
|
|
13
|
+
p as PointLabel,
|
|
14
|
+
x as ReferenceLine,
|
|
11
15
|
i as Scrubber,
|
|
12
|
-
|
|
16
|
+
u as useScrubberContext
|
|
13
17
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CartesianChartProps } from './types';
|
|
2
|
-
export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, enableScrubbing, onScrubberPositionChange, children, }: CartesianChartProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, enableScrubbing, onScrubberPositionChange, animate, 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":"AAKA,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,OAAc,EACd,QAAQ,GACT,EAAE,mBAAmB,2CA6FrB"}
|
|
@@ -1,96 +1,95 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { ScrubberProvider as
|
|
4
|
-
import { resolveInset as
|
|
5
|
-
import { useBuildChartContext as
|
|
6
|
-
import { CartesianChartProvider as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useState as O, useCallback as P, useEffect as W, useMemo as h } from "react";
|
|
3
|
+
import { ScrubberProvider as w } from "../Scrubber/ScrubberProvider.js";
|
|
4
|
+
import { resolveInset as z, resolveAxisPadding as G, OVERFLOW_NEGATIVE_MARGIN as T, DEFAULT_HEIGHT as V } from "./utils.js";
|
|
5
|
+
import { useBuildChartContext as _ } from "./context/useBuildChartContext.js";
|
|
6
|
+
import { CartesianChartProvider as k } from "./context/cartesianChartContext.js";
|
|
7
|
+
import { RevealClipDefs as D } from "./RevealClip/RevealClipDefs.js";
|
|
8
|
+
function q({
|
|
9
|
+
series: d,
|
|
10
|
+
xAxis: C,
|
|
11
|
+
yAxis: R,
|
|
11
12
|
width: e = "100%",
|
|
12
|
-
height:
|
|
13
|
-
inset:
|
|
13
|
+
height: s = V,
|
|
14
|
+
inset: l,
|
|
14
15
|
axisPadding: c,
|
|
15
|
-
ariaLabel:
|
|
16
|
-
enableScrubbing:
|
|
17
|
-
onScrubberPositionChange:
|
|
18
|
-
|
|
16
|
+
ariaLabel: b = "Chart",
|
|
17
|
+
enableScrubbing: i = !1,
|
|
18
|
+
onScrubberPositionChange: y,
|
|
19
|
+
animate: x = !0,
|
|
20
|
+
children: A
|
|
19
21
|
}) {
|
|
20
|
-
const
|
|
22
|
+
const a = p(null), f = p(null), [E, I] = O(
|
|
21
23
|
typeof e == "number" ? e : void 0
|
|
22
|
-
),
|
|
23
|
-
const [
|
|
24
|
-
|
|
24
|
+
), t = typeof e != "number", u = P((n) => {
|
|
25
|
+
const [m] = n;
|
|
26
|
+
m && I(m.contentRect.width);
|
|
25
27
|
}, []);
|
|
26
|
-
|
|
27
|
-
if (!
|
|
28
|
+
W(() => {
|
|
29
|
+
if (!t || !a.current || typeof ResizeObserver > "u")
|
|
28
30
|
return;
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
33
|
-
() =>
|
|
31
|
+
const n = new ResizeObserver(u);
|
|
32
|
+
return n.observe(a.current), () => n.disconnect();
|
|
33
|
+
}, [t, u]);
|
|
34
|
+
const o = typeof e == "number" ? e : E ?? 0, g = h(() => z(l), [l]), M = h(
|
|
35
|
+
() => G(c),
|
|
34
36
|
[c]
|
|
35
|
-
),
|
|
36
|
-
series:
|
|
37
|
-
xAxis:
|
|
38
|
-
yAxis:
|
|
39
|
-
width:
|
|
40
|
-
height:
|
|
41
|
-
inset:
|
|
42
|
-
axisPadding:
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
ref: f,
|
|
47
|
-
"data-testid": "chart-svg",
|
|
48
|
-
width: d,
|
|
49
|
-
height: r,
|
|
50
|
-
role: "img",
|
|
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 })
|
|
67
|
-
}
|
|
68
|
-
);
|
|
69
|
-
return i ? /* @__PURE__ */ t(
|
|
37
|
+
), v = _({
|
|
38
|
+
series: d,
|
|
39
|
+
xAxis: C,
|
|
40
|
+
yAxis: R,
|
|
41
|
+
width: o,
|
|
42
|
+
height: s,
|
|
43
|
+
inset: g,
|
|
44
|
+
axisPadding: M
|
|
45
|
+
});
|
|
46
|
+
return /* @__PURE__ */ r(
|
|
70
47
|
"div",
|
|
71
48
|
{
|
|
72
|
-
ref:
|
|
49
|
+
ref: t ? a : void 0,
|
|
73
50
|
"data-testid": "chart-container",
|
|
74
51
|
style: {
|
|
75
|
-
width: e,
|
|
76
|
-
height:
|
|
77
|
-
...
|
|
52
|
+
width: t ? e : o,
|
|
53
|
+
height: s,
|
|
54
|
+
...T
|
|
78
55
|
},
|
|
79
|
-
children:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
56
|
+
children: o > 0 && /* @__PURE__ */ r(
|
|
57
|
+
"svg",
|
|
58
|
+
{
|
|
59
|
+
ref: f,
|
|
60
|
+
"data-testid": "chart-svg",
|
|
61
|
+
width: o,
|
|
62
|
+
height: s,
|
|
63
|
+
role: "img",
|
|
64
|
+
"aria-label": b || "Chart",
|
|
65
|
+
tabIndex: i ? 0 : void 0,
|
|
66
|
+
style: {
|
|
67
|
+
display: "block",
|
|
68
|
+
overflow: "visible",
|
|
69
|
+
outline: i ? "none" : void 0
|
|
70
|
+
},
|
|
71
|
+
children: /* @__PURE__ */ r(k, { value: v, children: /* @__PURE__ */ r(
|
|
72
|
+
w,
|
|
73
|
+
{
|
|
74
|
+
svgRef: f,
|
|
75
|
+
enableScrubbing: i,
|
|
76
|
+
onScrubberPositionChange: y,
|
|
77
|
+
children: /* @__PURE__ */ r(
|
|
78
|
+
D,
|
|
79
|
+
{
|
|
80
|
+
drawingArea: v.drawingArea,
|
|
81
|
+
series: d,
|
|
82
|
+
animate: x,
|
|
83
|
+
children: A
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
) })
|
|
88
|
+
}
|
|
89
|
+
)
|
|
91
90
|
}
|
|
92
91
|
);
|
|
93
92
|
}
|
|
94
93
|
export {
|
|
95
|
-
|
|
94
|
+
q as CartesianChart
|
|
96
95
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealClipDefs.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAMnD,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAc,EACd,WAAW,GACZ,EAAE,mBAAmB,2CA4CrB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as i, Fragment as d, jsxs as F } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as x } from "react";
|
|
3
|
+
import { OVERFLOW_BUFFER as t } from "../utils.js";
|
|
4
|
+
import { RevealClipContext as D } from "./context.js";
|
|
5
|
+
import { useComputeDataFingerprint as y, useRevealClipAnimation as C } from "./utils.js";
|
|
6
|
+
const E = 0.8, R = "linear";
|
|
7
|
+
function O({
|
|
8
|
+
children: n,
|
|
9
|
+
drawingArea: e,
|
|
10
|
+
series: l,
|
|
11
|
+
animate: s = !0,
|
|
12
|
+
transitions: r
|
|
13
|
+
}) {
|
|
14
|
+
const m = !s, c = r?.enter?.duration ?? E, p = r?.enter?.easing ?? R, a = y({ series: l }), { clipId: o, animationStyle: u, keyframe: f } = C({
|
|
15
|
+
duration: c,
|
|
16
|
+
easing: p,
|
|
17
|
+
drawingArea: e
|
|
18
|
+
}), h = x(
|
|
19
|
+
() => ({
|
|
20
|
+
clipPathAttr: `url(#${o})`
|
|
21
|
+
}),
|
|
22
|
+
[o]
|
|
23
|
+
);
|
|
24
|
+
return m ? /* @__PURE__ */ i(d, { children: n }) : /* @__PURE__ */ F(D.Provider, { value: h, children: [
|
|
25
|
+
/* @__PURE__ */ i("defs", { children: /* @__PURE__ */ i("clipPath", { id: o, children: /* @__PURE__ */ i(
|
|
26
|
+
"rect",
|
|
27
|
+
{
|
|
28
|
+
x: e.x - t.left,
|
|
29
|
+
y: e.y - t.top,
|
|
30
|
+
height: e.height + t.top + t.bottom,
|
|
31
|
+
width: e.width + t.left + t.right,
|
|
32
|
+
style: { animation: u }
|
|
33
|
+
}
|
|
34
|
+
) }) }),
|
|
35
|
+
/* @__PURE__ */ i("style", { children: f }),
|
|
36
|
+
n
|
|
37
|
+
] }, a);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
O as RevealClipDefs
|
|
41
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type RevealClipContextValue = {
|
|
2
|
+
clipPathAttr: string;
|
|
3
|
+
};
|
|
4
|
+
export declare const RevealClipContext: import('react').Context<RevealClipContextValue | undefined>;
|
|
5
|
+
export declare const useRevealClip: () => string | undefined;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealClip/context.ts"],"names":[],"mappings":"AAEA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,iBAAiB,6DAElB,CAAC;AAEb,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,SAEzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealClip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DrawingArea, Series } from '../../../utils';
|
|
3
|
+
export type EnterTransitionConfig = {
|
|
4
|
+
/**
|
|
5
|
+
* Duration in seconds. @default 0.8
|
|
6
|
+
*/
|
|
7
|
+
duration?: number;
|
|
8
|
+
/**
|
|
9
|
+
* CSS easing function. @default 'linear'
|
|
10
|
+
*/
|
|
11
|
+
easing?: string;
|
|
12
|
+
};
|
|
13
|
+
export type RevealClipDefsProps = {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The drawing area whose bounds define the clip rectangle.
|
|
17
|
+
*/
|
|
18
|
+
drawingArea: DrawingArea;
|
|
19
|
+
/**
|
|
20
|
+
* Whether to animate the chart.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
animate?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Transition configuration.
|
|
26
|
+
* @default { enter: { duration: 0.8, easing: 'linear' } }
|
|
27
|
+
*/
|
|
28
|
+
transitions?: {
|
|
29
|
+
enter?: EnterTransitionConfig;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Data series used to compute a fingerprint that restarts
|
|
33
|
+
* the animation when data changes.
|
|
34
|
+
*/
|
|
35
|
+
series: Series[];
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealClip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,qBAAqB,CAAA;KAAE,CAAC;IAChD;;;OAGG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DrawingArea, Series } from '../../../utils/types';
|
|
2
|
+
type RevealClipAnimationConfig = {
|
|
3
|
+
duration: number;
|
|
4
|
+
easing: string;
|
|
5
|
+
drawingArea: DrawingArea;
|
|
6
|
+
};
|
|
7
|
+
type RevealClipAnimationResult = {
|
|
8
|
+
clipId: string;
|
|
9
|
+
animationStyle: string;
|
|
10
|
+
keyframe: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const useRevealClipAnimation: ({ duration, easing, drawingArea, }: RevealClipAnimationConfig) => RevealClipAnimationResult;
|
|
13
|
+
export declare const useComputeDataFingerprint: ({ series, }: {
|
|
14
|
+
series: Series[];
|
|
15
|
+
}) => string;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealClip/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGhE,KAAK,yBAAyB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,oCAIpC,yBAAyB,KAAG,yBAY9B,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,aAEvC;IACD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,KAAG,MAEH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useId as a, useMemo as n } from "react";
|
|
2
|
+
import { OVERFLOW_BUFFER as m } from "../utils.js";
|
|
3
|
+
const s = ({
|
|
4
|
+
duration: t,
|
|
5
|
+
easing: e,
|
|
6
|
+
drawingArea: r
|
|
7
|
+
}) => {
|
|
8
|
+
const o = a(), i = `reveal-clip-${o.replaceAll(":", "")}`;
|
|
9
|
+
return n(
|
|
10
|
+
() => ({
|
|
11
|
+
clipId: o,
|
|
12
|
+
animationStyle: `${i} ${t}s ${e} forwards`,
|
|
13
|
+
keyframe: `@keyframes ${i} { from { width: 0; } to { width: ${r.width + m.left + m.right}px; } }`
|
|
14
|
+
}),
|
|
15
|
+
[o, i, t, e, r.width]
|
|
16
|
+
);
|
|
17
|
+
}, c = ({
|
|
18
|
+
series: t
|
|
19
|
+
}) => t.map((e) => e.data?.join(",") ?? "").join("|");
|
|
20
|
+
export {
|
|
21
|
+
c as useComputeDataFingerprint,
|
|
22
|
+
s as useRevealClipAnimation
|
|
23
|
+
};
|
|
@@ -57,5 +57,11 @@ export type CartesianChartProps = {
|
|
|
57
57
|
* Receives `undefined` when the scrubber leaves the chart.
|
|
58
58
|
*/
|
|
59
59
|
onScrubberPositionChange?: (index: number | undefined) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Whether to animate the chart on mount and data changes.
|
|
62
|
+
* Duration is 0.8 seconds and easing is linear.
|
|
63
|
+
* @default true
|
|
64
|
+
*/
|
|
65
|
+
animate?: boolean;
|
|
60
66
|
};
|
|
61
67
|
//# 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;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,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;IAC/D;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const m = 160, r = {
|
|
2
|
-
top:
|
|
3
|
-
right:
|
|
4
|
-
bottom:
|
|
5
|
-
left:
|
|
2
|
+
top: 50,
|
|
3
|
+
right: 50,
|
|
4
|
+
bottom: 50,
|
|
5
|
+
left: 50
|
|
6
6
|
}, f = {
|
|
7
|
-
marginTop: -
|
|
8
|
-
marginRight: -
|
|
9
|
-
marginBottom: -
|
|
10
|
-
marginLeft: -
|
|
7
|
+
marginTop: -50,
|
|
8
|
+
marginRight: -50,
|
|
9
|
+
marginBottom: -50,
|
|
10
|
+
marginLeft: -50
|
|
11
11
|
}, e = {
|
|
12
12
|
top: 0,
|
|
13
13
|
right: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Line.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/Line.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAKzC,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,MAAM,EACN,QAAgB,EAChB,QAAQ,EAAE,SAAsB,GACjC,EAAE,SAAS,kDA8EX"}
|
|
@@ -1,28 +1,29 @@
|
|
|
1
|
-
import { jsxs as l,
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as P } from "react/jsx-runtime";
|
|
2
2
|
import { useId as S, useMemo as d } from "react";
|
|
3
3
|
import { isNumericScale as A } from "../../utils/scales/scales.js";
|
|
4
|
-
import { toScaledPoints as
|
|
5
|
-
import { useCartesianChartContext as
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import { toScaledPoints as I, buildLinePath as L, buildAreaPath as T } from "./utils.js";
|
|
5
|
+
import { useCartesianChartContext as j } from "../CartesianChart/context/cartesianChartContext.js";
|
|
6
|
+
import { useRevealClip as v } from "../CartesianChart/RevealClip/context.js";
|
|
7
|
+
import { cssVar as O } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
8
|
+
const R = 0.15;
|
|
9
|
+
function Y({
|
|
10
|
+
seriesId: u,
|
|
11
|
+
stroke: g,
|
|
12
|
+
showArea: i = !1,
|
|
12
13
|
areaType: _ = "gradient"
|
|
13
14
|
}) {
|
|
14
|
-
const { getXScale:
|
|
15
|
-
() => r?.data && s && o && A(o) ?
|
|
15
|
+
const { getXScale: h, getYScale: x, getXAxisConfig: C, drawingArea: n, seriesMap: k } = j(), y = v(), s = h(), o = x(), c = C(), p = S(), r = k.get(u), a = g ?? r?.stroke, t = d(
|
|
16
|
+
() => r?.data && s && o && A(o) ? I(r.data, s, o, c?.data) : null,
|
|
16
17
|
[r, s, o, c]
|
|
17
18
|
), f = d(
|
|
18
|
-
() => t ?
|
|
19
|
+
() => t ? L(t) : null,
|
|
19
20
|
[t]
|
|
20
|
-
),
|
|
21
|
-
() =>
|
|
22
|
-
[
|
|
21
|
+
), m = d(
|
|
22
|
+
() => i && t && n ? T(t, n) : null,
|
|
23
|
+
[i, t, n]
|
|
23
24
|
);
|
|
24
|
-
return f ? /* @__PURE__ */ l(
|
|
25
|
-
|
|
25
|
+
return f ? /* @__PURE__ */ l("g", { clipPath: y, children: [
|
|
26
|
+
i && m && a && /* @__PURE__ */ l(P, { children: [
|
|
26
27
|
/* @__PURE__ */ e("defs", { children: /* @__PURE__ */ l(
|
|
27
28
|
"linearGradient",
|
|
28
29
|
{
|
|
@@ -38,7 +39,7 @@ function N({
|
|
|
38
39
|
{
|
|
39
40
|
offset: "0%",
|
|
40
41
|
stopColor: a,
|
|
41
|
-
stopOpacity:
|
|
42
|
+
stopOpacity: R
|
|
42
43
|
}
|
|
43
44
|
),
|
|
44
45
|
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: a, stopOpacity: 0 })
|
|
@@ -49,7 +50,7 @@ function N({
|
|
|
49
50
|
"path",
|
|
50
51
|
{
|
|
51
52
|
"data-testid": "line-area",
|
|
52
|
-
d:
|
|
53
|
+
d: m,
|
|
53
54
|
fill: `url(#${p})`,
|
|
54
55
|
stroke: "none"
|
|
55
56
|
}
|
|
@@ -62,7 +63,7 @@ function N({
|
|
|
62
63
|
d: f,
|
|
63
64
|
fill: "none",
|
|
64
65
|
stroke: a,
|
|
65
|
-
strokeWidth:
|
|
66
|
+
strokeWidth: O("var(--stroke-2)"),
|
|
66
67
|
strokeLinecap: "round",
|
|
67
68
|
strokeLinejoin: "round"
|
|
68
69
|
}
|
|
@@ -70,5 +71,5 @@ function N({
|
|
|
70
71
|
] }) : null;
|
|
71
72
|
}
|
|
72
73
|
export {
|
|
73
|
-
|
|
74
|
+
Y as Line
|
|
74
75
|
};
|
|
@@ -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, enableScrubbing, onScrubberPositionChange, 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, animate, 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,eAAe,EACf,wBAAwB,EACxB,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,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,2CA2EhB"}
|
|
@@ -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 j, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as F } from "react";
|
|
3
|
+
import { DEFAULT_AXIS_WIDTH as U, YAxis as V } from "../Axis/YAxis/YAxis.js";
|
|
4
|
+
import { DEFAULT_AXIS_HEIGHT as m, XAxis as W } from "../Axis/XAxis/XAxis.js";
|
|
5
|
+
import { CartesianChart as h } from "../CartesianChart/CartesianChart.js";
|
|
6
|
+
import { Line as v } from "../Line/Line.js";
|
|
7
|
+
function J({
|
|
8
8
|
series: r,
|
|
9
9
|
showArea: d = !1,
|
|
10
10
|
areaType: c = "gradient",
|
|
@@ -17,29 +17,30 @@ function B({
|
|
|
17
17
|
inset: T,
|
|
18
18
|
enableScrubbing: g,
|
|
19
19
|
onScrubberPositionChange: u,
|
|
20
|
-
|
|
20
|
+
animate: A,
|
|
21
|
+
children: D
|
|
21
22
|
}) {
|
|
22
23
|
const {
|
|
23
|
-
scaleType:
|
|
24
|
-
data:
|
|
25
|
-
domain:
|
|
24
|
+
scaleType: C,
|
|
25
|
+
data: I,
|
|
26
|
+
domain: P,
|
|
26
27
|
...n
|
|
27
28
|
} = f ?? {}, {
|
|
28
|
-
scaleType:
|
|
29
|
-
data:
|
|
30
|
-
domain:
|
|
29
|
+
scaleType: L,
|
|
30
|
+
data: S,
|
|
31
|
+
domain: _,
|
|
31
32
|
...o
|
|
32
|
-
} = l ?? {},
|
|
33
|
-
scaleType:
|
|
34
|
-
data:
|
|
35
|
-
domain:
|
|
36
|
-
},
|
|
37
|
-
scaleType:
|
|
38
|
-
data:
|
|
39
|
-
domain:
|
|
40
|
-
},
|
|
33
|
+
} = l ?? {}, b = {
|
|
34
|
+
scaleType: C,
|
|
35
|
+
data: I,
|
|
36
|
+
domain: P
|
|
37
|
+
}, E = {
|
|
38
|
+
scaleType: L,
|
|
39
|
+
data: S,
|
|
40
|
+
domain: _
|
|
41
|
+
}, H = F(() => {
|
|
41
42
|
if (!t && !i) return;
|
|
42
|
-
const a = n.position === "top" ? "top" : "bottom", s = o.position === "end" ? "right" : "left", p = o.width ??
|
|
43
|
+
const a = n.position === "top" ? "top" : "bottom", s = o.position === "end" ? "right" : "left", p = o.width ?? U;
|
|
43
44
|
return {
|
|
44
45
|
top: t && a === "top" ? m : 0,
|
|
45
46
|
bottom: t && a === "bottom" ? m : 0,
|
|
@@ -53,23 +54,24 @@ function B({
|
|
|
53
54
|
o.position,
|
|
54
55
|
o.width
|
|
55
56
|
]);
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
|
|
57
|
+
return /* @__PURE__ */ j(
|
|
58
|
+
h,
|
|
58
59
|
{
|
|
59
60
|
series: r ?? [],
|
|
60
|
-
xAxis:
|
|
61
|
-
yAxis:
|
|
61
|
+
xAxis: b,
|
|
62
|
+
yAxis: E,
|
|
62
63
|
width: x,
|
|
63
64
|
height: y,
|
|
64
65
|
inset: T,
|
|
65
|
-
axisPadding:
|
|
66
|
+
axisPadding: H,
|
|
66
67
|
enableScrubbing: g,
|
|
67
68
|
onScrubberPositionChange: u,
|
|
69
|
+
animate: A,
|
|
68
70
|
children: [
|
|
69
|
-
t && /* @__PURE__ */ e(
|
|
70
|
-
i && /* @__PURE__ */ e(
|
|
71
|
+
t && /* @__PURE__ */ e(W, { ...n }),
|
|
72
|
+
i && /* @__PURE__ */ e(V, { ...o }),
|
|
71
73
|
r?.map((a) => /* @__PURE__ */ e(
|
|
72
|
-
|
|
74
|
+
v,
|
|
73
75
|
{
|
|
74
76
|
seriesId: a.id,
|
|
75
77
|
showArea: d,
|
|
@@ -77,11 +79,11 @@ function B({
|
|
|
77
79
|
},
|
|
78
80
|
a.id
|
|
79
81
|
)),
|
|
80
|
-
|
|
82
|
+
D
|
|
81
83
|
]
|
|
82
84
|
}
|
|
83
85
|
);
|
|
84
86
|
}
|
|
85
87
|
export {
|
|
86
|
-
|
|
88
|
+
J as LineChart
|
|
87
89
|
};
|