@ledgerhq/lumen-ui-react-visualization 0.1.19 → 0.1.21
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/Axis/Axis.types.d.ts +6 -0
- package/dist/lib/Components/Axis/Axis.types.d.ts.map +1 -1
- package/dist/lib/Components/Axis/XAxis/XAxis.d.ts +1 -1
- package/dist/lib/Components/Axis/XAxis/XAxis.d.ts.map +1 -1
- package/dist/lib/Components/Axis/XAxis/XAxis.js +18 -17
- package/dist/lib/Components/Axis/YAxis/YAxis.d.ts +1 -1
- package/dist/lib/Components/Axis/YAxis/YAxis.d.ts.map +1 -1
- package/dist/lib/Components/Axis/YAxis/YAxis.js +20 -19
- package/dist/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
- package/dist/lib/Components/CartesianChart/CartesianChart.js +61 -61
- package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts +3 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.js +41 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/context.d.ts +15 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/context.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/context.js +10 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/index.d.ts +3 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/index.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/types.d.ts +57 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/types.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/utils.d.ts +31 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/utils.d.ts.map +1 -0
- package/dist/lib/Components/CartesianChart/RevealAnimation/utils.js +67 -0
- package/dist/lib/Components/CartesianChart/utils.d.ts +1 -24
- package/dist/lib/Components/CartesianChart/utils.d.ts.map +1 -1
- package/dist/lib/Components/CartesianChart/utils.js +12 -23
- 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 +40 -33
- package/dist/lib/Components/Line/types.d.ts +7 -0
- package/dist/lib/Components/Line/types.d.ts.map +1 -1
- package/dist/lib/Components/Line/utils.d.ts +8 -3
- package/dist/lib/Components/Line/utils.d.ts.map +1 -1
- package/dist/lib/Components/Line/utils.js +30 -25
- 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 +114 -102
- package/dist/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.js +16 -16
- package/dist/lib/Components/LineChart/__stories__/chartStoryFixtures.d.ts +21 -0
- package/dist/lib/Components/LineChart/__stories__/chartStoryFixtures.d.ts.map +1 -1
- package/dist/lib/Components/LineChart/types.d.ts +12 -1
- 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 +29 -27
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -1
- package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +4 -2
- package/dist/lib/utils/types.d.ts +7 -0
- package/dist/lib/utils/types.d.ts.map +1 -1
- package/dist/package.json +3 -3
- package/package.json +2 -2
- package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts +0 -3
- package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts.map +0 -1
- package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js +0 -42
- package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts +0 -7
- package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts.map +0 -1
- package/dist/lib/Components/CartesianChart/RevealClip/context.js +0 -6
- package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts +0 -3
- package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts.map +0 -1
- package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts +0 -37
- package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts.map +0 -1
- package/dist/lib/Components/CartesianChart/hooks/useDataFingerprint.d.ts +0 -9
- package/dist/lib/Components/CartesianChart/hooks/useDataFingerprint.d.ts.map +0 -1
- package/dist/lib/Components/CartesianChart/hooks/useDataFingerprint.js +0 -8
- package/dist/lib/Components/CartesianChart/hooks/useRevealClipAnimation.d.ts +0 -14
- package/dist/lib/Components/CartesianChart/hooks/useRevealClipAnimation.d.ts.map +0 -1
- package/dist/lib/Components/CartesianChart/hooks/useRevealClipAnimation.js +0 -20
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
import { ChartInset } from '../../utils/types';
|
|
2
2
|
import { CartesianChartProps } from './types';
|
|
3
|
-
export declare const DEFAULT_HEIGHT =
|
|
4
|
-
/**
|
|
5
|
-
* Internal buffer added around the drawing area so SVG content (labels, points,
|
|
6
|
-
* ticks) drawn at the edges is not clipped. The SVG canvas is enlarged by this
|
|
7
|
-
* buffer on every side and shifted back by {@link OVERFLOW_OFFSET} so
|
|
8
|
-
* the chart's layout footprint (and the drawing area) stays exactly the
|
|
9
|
-
* consumer-provided width/height.
|
|
10
|
-
*/
|
|
11
|
-
export declare const OVERFLOW_BUFFER: ChartInset;
|
|
12
|
-
/**
|
|
13
|
-
* Top/left offset applied to the (enlarged) SVG so its drawing area aligns with
|
|
14
|
-
* the container's top-left. The extra width/height added to the SVG overflows
|
|
15
|
-
* symmetrically on every side via `overflow: visible`.
|
|
16
|
-
*
|
|
17
|
-
* Uses `position: relative` rather than negative margins: a negative
|
|
18
|
-
* `margin-top` would collapse through the container (which has no border,
|
|
19
|
-
* padding, or block-formatting context), shifting the whole container instead
|
|
20
|
-
* of offsetting the SVG inside it.
|
|
21
|
-
*/
|
|
22
|
-
export declare const OVERFLOW_OFFSET: {
|
|
23
|
-
position: "relative";
|
|
24
|
-
top: number;
|
|
25
|
-
left: number;
|
|
26
|
-
};
|
|
3
|
+
export declare const DEFAULT_HEIGHT = 240;
|
|
27
4
|
export declare const ZERO_PADDING: ChartInset;
|
|
28
5
|
export declare const resolveInset: (inset: CartesianChartProps["inset"]) => ChartInset;
|
|
29
6
|
export declare const resolveAxisPadding: (padding: CartesianChartProps["axisPadding"]) => ChartInset;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,eAAO,MAAM,YAAY,EAAE,UAK1B,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,OAAO,mBAAmB,CAAC,OAAO,CAAC,KAClC,UAqBF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,mBAAmB,CAAC,aAAa,CAAC,KAC1C,UAQF,CAAC"}
|
|
@@ -1,41 +1,30 @@
|
|
|
1
|
-
const
|
|
2
|
-
top: 25,
|
|
3
|
-
right: 25,
|
|
4
|
-
bottom: 25,
|
|
5
|
-
left: 25
|
|
6
|
-
}, f = {
|
|
7
|
-
position: "relative",
|
|
8
|
-
top: -25,
|
|
9
|
-
left: -25
|
|
10
|
-
}, e = {
|
|
1
|
+
const e = 240, r = {
|
|
11
2
|
top: 0,
|
|
12
3
|
right: 0,
|
|
13
4
|
bottom: 0,
|
|
14
5
|
left: 0
|
|
15
|
-
},
|
|
6
|
+
}, l = (t) => {
|
|
16
7
|
let o;
|
|
17
|
-
return t === void 0 ? o =
|
|
8
|
+
return t === void 0 ? o = r : typeof t == "number" ? o = { top: t, right: t, bottom: t, left: t } : o = {
|
|
18
9
|
top: t.top ?? 0,
|
|
19
10
|
right: t.right ?? 0,
|
|
20
11
|
bottom: t.bottom ?? 0,
|
|
21
12
|
left: t.left ?? 0
|
|
22
13
|
}, {
|
|
23
|
-
top: o.top
|
|
24
|
-
right: o.right
|
|
25
|
-
bottom: o.bottom
|
|
26
|
-
left: o.left
|
|
14
|
+
top: o.top,
|
|
15
|
+
right: o.right,
|
|
16
|
+
bottom: o.bottom,
|
|
17
|
+
left: o.left
|
|
27
18
|
};
|
|
28
|
-
},
|
|
19
|
+
}, f = (t) => t === void 0 ? r : {
|
|
29
20
|
top: t.top ?? 0,
|
|
30
21
|
right: t.right ?? 0,
|
|
31
22
|
bottom: t.bottom ?? 0,
|
|
32
23
|
left: t.left ?? 0
|
|
33
24
|
};
|
|
34
25
|
export {
|
|
35
|
-
|
|
36
|
-
r as
|
|
37
|
-
f as
|
|
38
|
-
|
|
39
|
-
b as resolveAxisPadding,
|
|
40
|
-
m as resolveInset
|
|
26
|
+
e as DEFAULT_HEIGHT,
|
|
27
|
+
r as ZERO_PADDING,
|
|
28
|
+
f as resolveAxisPadding,
|
|
29
|
+
l as resolveInset
|
|
41
30
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LineProps } from './types';
|
|
2
|
-
export declare function Line({ seriesId, stroke, showArea, areaType: _areaType, curve, }: LineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
export declare function Line({ seriesId, stroke, showArea, areaType: _areaType, curve, connectNulls, }: LineProps): import("react/jsx-runtime").JSX.Element | null;
|
|
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,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,MAAM,EACN,QAAgB,EAChB,QAAQ,EAAE,SAAsB,EAChC,KAAK,
|
|
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,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,MAAM,EACN,QAAgB,EAChB,QAAQ,EAAE,SAAsB,EAChC,KAAK,EACL,YAAY,GACb,EAAE,SAAS,kDAwFX"}
|
|
@@ -1,34 +1,41 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useId as
|
|
3
|
-
import { isNumericScale as
|
|
4
|
-
import { LINE_DEFAULT_STROKE_COLOR as
|
|
5
|
-
import { toScaledPoints as
|
|
6
|
-
import { useCartesianChartContext as
|
|
7
|
-
import {
|
|
8
|
-
function
|
|
1
|
+
import { jsxs as c, jsx as o, Fragment as T } from "react/jsx-runtime";
|
|
2
|
+
import { useId as k, useMemo as d } from "react";
|
|
3
|
+
import { isNumericScale as y } from "../../utils/scales/scales.js";
|
|
4
|
+
import { LINE_DEFAULT_STROKE_COLOR as A, LINE_AREA_GRADIENT_OPACITY as N, LINE_STROKE_WIDTH as O } from "./constants.js";
|
|
5
|
+
import { toScaledPoints as v, buildLinePath as R, buildAreaPath as D } from "./utils.js";
|
|
6
|
+
import { useCartesianChartContext as j } from "../CartesianChart/context/cartesianChartContext.js";
|
|
7
|
+
import { usePathReveal as b } from "../CartesianChart/RevealAnimation/context.js";
|
|
8
|
+
function U({
|
|
9
9
|
seriesId: g,
|
|
10
|
-
stroke:
|
|
11
|
-
showArea:
|
|
12
|
-
areaType:
|
|
13
|
-
curve:
|
|
10
|
+
stroke: C,
|
|
11
|
+
showArea: s = !1,
|
|
12
|
+
areaType: F = "gradient",
|
|
13
|
+
curve: x,
|
|
14
|
+
connectNulls: L
|
|
14
15
|
}) {
|
|
15
|
-
const { getXScale:
|
|
16
|
-
() =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
[
|
|
16
|
+
const { getXScale: S, getYScale: _, getXAxisConfig: E, drawingArea: i, seriesMap: I } = j(), P = b(), l = S(), n = _(), p = E(), u = k(), t = I.get(g), r = (C ?? t?.stroke) || A, a = x ?? t?.curve, f = L ?? t?.connectNulls ?? !1, e = d(
|
|
17
|
+
() => t?.data && l && n && y(n) ? v(
|
|
18
|
+
t.data,
|
|
19
|
+
l,
|
|
20
|
+
n,
|
|
21
|
+
p?.data,
|
|
22
|
+
f
|
|
23
|
+
) : null,
|
|
24
|
+
[t, l, n, p, f]
|
|
25
|
+
), m = d(
|
|
26
|
+
() => e ? R(e, a) : null,
|
|
27
|
+
[e, a]
|
|
28
|
+
), h = d(
|
|
29
|
+
() => s && e && i ? D(e, i, a) : null,
|
|
30
|
+
[s, e, i, a]
|
|
24
31
|
);
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */
|
|
32
|
+
return m ? /* @__PURE__ */ c("g", { clipPath: P, children: [
|
|
33
|
+
s && h && r && /* @__PURE__ */ c(T, { children: [
|
|
34
|
+
/* @__PURE__ */ o("defs", { children: /* @__PURE__ */ c(
|
|
28
35
|
"linearGradient",
|
|
29
36
|
{
|
|
30
37
|
"data-testid": "line-gradient",
|
|
31
|
-
id:
|
|
38
|
+
id: u,
|
|
32
39
|
x1: "0",
|
|
33
40
|
y1: "0",
|
|
34
41
|
x2: "0",
|
|
@@ -38,11 +45,11 @@ function Y({
|
|
|
38
45
|
"stop",
|
|
39
46
|
{
|
|
40
47
|
offset: "0%",
|
|
41
|
-
stopColor:
|
|
42
|
-
stopOpacity:
|
|
48
|
+
stopColor: r,
|
|
49
|
+
stopOpacity: N
|
|
43
50
|
}
|
|
44
51
|
),
|
|
45
|
-
/* @__PURE__ */ o("stop", { offset: "100%", stopColor:
|
|
52
|
+
/* @__PURE__ */ o("stop", { offset: "100%", stopColor: r, stopOpacity: 0 })
|
|
46
53
|
]
|
|
47
54
|
}
|
|
48
55
|
) }),
|
|
@@ -50,8 +57,8 @@ function Y({
|
|
|
50
57
|
"path",
|
|
51
58
|
{
|
|
52
59
|
"data-testid": "line-area",
|
|
53
|
-
d:
|
|
54
|
-
fill: `url(#${
|
|
60
|
+
d: h,
|
|
61
|
+
fill: `url(#${u})`,
|
|
55
62
|
stroke: "none"
|
|
56
63
|
}
|
|
57
64
|
)
|
|
@@ -60,9 +67,9 @@ function Y({
|
|
|
60
67
|
"path",
|
|
61
68
|
{
|
|
62
69
|
"data-testid": "line-path",
|
|
63
|
-
d:
|
|
70
|
+
d: m,
|
|
64
71
|
fill: "none",
|
|
65
|
-
stroke:
|
|
72
|
+
stroke: r,
|
|
66
73
|
strokeWidth: O,
|
|
67
74
|
strokeLinecap: "round",
|
|
68
75
|
strokeLinejoin: "round"
|
|
@@ -71,5 +78,5 @@ function Y({
|
|
|
71
78
|
] }) : null;
|
|
72
79
|
}
|
|
73
80
|
export {
|
|
74
|
-
|
|
81
|
+
U as Line
|
|
75
82
|
};
|
|
@@ -28,5 +28,12 @@ export type LineProps = {
|
|
|
28
28
|
* @default 'bump'
|
|
29
29
|
*/
|
|
30
30
|
curve?: CurveType;
|
|
31
|
+
/**
|
|
32
|
+
* When true, skips null values and draws a continuous line across gaps.
|
|
33
|
+
* When false, null values create gaps in the line.
|
|
34
|
+
* When omitted, falls back to the `connectNulls` defined on the series.
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
connectNulls?: boolean;
|
|
31
38
|
};
|
|
32
39
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ChartScaleFunction, CurveType, DrawingArea, NumericScale } from '../../utils/types';
|
|
2
|
-
type Point = [x: number, y: number];
|
|
2
|
+
type Point = [x: number, y: number | null];
|
|
3
3
|
/**
|
|
4
|
-
* Project series data into scaled [x, y] pixel coordinates
|
|
4
|
+
* Project series data into scaled [x, y] pixel coordinates.
|
|
5
5
|
*
|
|
6
6
|
* When `xData` contains numeric values, those values are fed into the scale
|
|
7
7
|
* instead of the array index so the points honour a numeric X domain.
|
|
@@ -9,8 +9,13 @@ type Point = [x: number, y: number];
|
|
|
9
9
|
* When `xData` is provided, iteration is capped at `xData.length` so a series
|
|
10
10
|
* with more points than the axis has labels does not overflow past the right
|
|
11
11
|
* edge of the chart. The axis is treated as authoritative for the X domain.
|
|
12
|
+
*
|
|
13
|
+
* Null values (and other non-finite numbers) are handled according to `connectNulls`:
|
|
14
|
+
* - `false` (default): kept as `[x, null]` holes so the line/area break into
|
|
15
|
+
* gaps via the generators' `.defined()` check.
|
|
16
|
+
* - `true`: skipped entirely so the line is drawn continuously across gaps.
|
|
12
17
|
*/
|
|
13
|
-
export declare const toScaledPoints: (data: (number | null)[], xScale: ChartScaleFunction, yScale: NumericScale, xData?: readonly (string | number)[]) => Point[] | null;
|
|
18
|
+
export declare const toScaledPoints: (data: (number | null)[], xScale: ChartScaleFunction, yScale: NumericScale, xData?: readonly (string | number)[], connectNulls?: boolean) => Point[] | null;
|
|
14
19
|
/**
|
|
15
20
|
* Build the SVG `d` attribute for the line stroke.
|
|
16
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/utils.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,KAAK,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/utils.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,KAAK,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;AAoB3C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,EACvB,QAAQ,kBAAkB,EAC1B,QAAQ,YAAY,EACpB,QAAQ,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EACpC,sBAAoB,KACnB,KAAK,EAAE,GAAG,IA4BZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,EAAE,EACf,QAAQ,SAAS,KAChB,MAAM,GAAG,IAQX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,EAAE,EACf,aAAa,WAAW,EACxB,QAAQ,SAAS,KAChB,MAAM,GAAG,IAWX,CAAC"}
|
|
@@ -1,35 +1,40 @@
|
|
|
1
|
-
import { isFiniteNumber as
|
|
2
|
-
import { isCategoricalScale as
|
|
3
|
-
import
|
|
4
|
-
import g, { stepBefore as
|
|
5
|
-
import
|
|
6
|
-
import { monotoneX as
|
|
1
|
+
import { isFiniteNumber as y } from "../../utils/numbers.js";
|
|
2
|
+
import { isCategoricalScale as d } from "../../utils/scales/scales.js";
|
|
3
|
+
import C from "../../../node_modules/d3-shape/src/line.js";
|
|
4
|
+
import g, { stepBefore as F, stepAfter as a } from "../../../node_modules/d3-shape/src/curve/step.js";
|
|
5
|
+
import A from "../../../node_modules/d3-shape/src/curve/natural.js";
|
|
6
|
+
import { monotoneX as E } from "../../../node_modules/d3-shape/src/curve/monotone.js";
|
|
7
7
|
import B from "../../../node_modules/d3-shape/src/curve/linear.js";
|
|
8
8
|
import { bumpX as L } from "../../../node_modules/d3-shape/src/curve/bump.js";
|
|
9
9
|
import P from "../../../node_modules/d3-shape/src/area.js";
|
|
10
|
-
const
|
|
10
|
+
const f = {
|
|
11
11
|
bump: L,
|
|
12
12
|
linear: B,
|
|
13
|
-
monotone:
|
|
14
|
-
natural:
|
|
13
|
+
monotone: E,
|
|
14
|
+
natural: A,
|
|
15
15
|
step: g,
|
|
16
|
-
stepAfter:
|
|
17
|
-
stepBefore:
|
|
18
|
-
},
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
n
|
|
16
|
+
stepAfter: a,
|
|
17
|
+
stepBefore: F
|
|
18
|
+
}, h = "bump", b = (t = h) => f[t] ?? f[h], O = (t, e, o, n, r = !1) => {
|
|
19
|
+
const u = [], v = n ? Math.min(t.length, n.length) : t.length;
|
|
20
|
+
let m = 0;
|
|
21
|
+
for (let i = 0; i < v; i++) {
|
|
22
|
+
const l = t[i], s = y(l);
|
|
23
|
+
if (!s && r) continue;
|
|
24
|
+
const p = n && typeof n[i] == "number" ? n[i] : i, c = d(e) ? (e(p) ?? 0) + e.bandwidth() / 2 : e(p);
|
|
25
|
+
if (!s) {
|
|
26
|
+
u.push([c, null]);
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
u.push([c, o(l)]), m++;
|
|
25
30
|
}
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
const
|
|
29
|
-
return P().x((
|
|
31
|
+
return m >= 2 ? u : null;
|
|
32
|
+
}, S = (t, e) => C().defined((o) => o[1] !== null).x((o) => o[0]).y((o) => o[1]).curve(b(e))(t) ?? null, j = (t, e, o) => {
|
|
33
|
+
const n = e.y + e.height;
|
|
34
|
+
return P().defined((r) => r[1] !== null).x((r) => r[0]).y0(n).y1((r) => r[1]).curve(b(o))(t) ?? null;
|
|
30
35
|
};
|
|
31
36
|
export {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
37
|
+
j as buildAreaPath,
|
|
38
|
+
S as buildLinePath,
|
|
39
|
+
O as toScaledPoints
|
|
35
40
|
};
|
|
@@ -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, animate, magnetRadius, loading, emptyLabel, children, }: Readonly<LineChartProps>): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function LineChart({ series, showArea, areaType, connectNulls, showXAxis, showYAxis, xAxis, yAxis, width, height, inset, enableScrubbing, onScrubberPositionChange, animate, magnetRadius, loading, emptyLabel, children, }: Readonly<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":"
|
|
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,2CAgF1B"}
|
|
@@ -1,144 +1,156 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { ChartEmptyLabel as
|
|
4
|
-
import { useShimmerAnimation as
|
|
5
|
-
import { computeAxisPadding as
|
|
6
|
-
import { defaultXAxisProps as
|
|
7
|
-
import { CartesianChart as
|
|
8
|
-
import { LineChartEmptyState as
|
|
9
|
-
import { XAxis as
|
|
10
|
-
import { YAxis as
|
|
11
|
-
import { Line as
|
|
12
|
-
|
|
1
|
+
import { jsx as i, jsxs as A, Fragment as g } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as I } from "react";
|
|
3
|
+
import { ChartEmptyLabel as M } from "../CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js";
|
|
4
|
+
import { useShimmerAnimation as R } from "../CartesianChart/hooks/useShimmerAnimation.js";
|
|
5
|
+
import { computeAxisPadding as V, canRenderLine as W, getChartDisplayState as q } from "./utils.js";
|
|
6
|
+
import { defaultXAxisProps as P, defaultYAxisProps as h } from "../Axis/Axis.constants.js";
|
|
7
|
+
import { CartesianChart as z } from "../CartesianChart/CartesianChart.js";
|
|
8
|
+
import { LineChartEmptyState as G } from "./LineChartEmptyState/LineChartEmptyState.js";
|
|
9
|
+
import { XAxis as H } from "../Axis/XAxis/XAxis.js";
|
|
10
|
+
import { YAxis as J } from "../Axis/YAxis/YAxis.js";
|
|
11
|
+
import { Line as K } from "../Line/Line.js";
|
|
12
|
+
import { cssVar as N } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
|
|
13
|
+
const k = ({
|
|
13
14
|
series: o,
|
|
14
|
-
showArea:
|
|
15
|
-
areaType:
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
showArea: r,
|
|
16
|
+
areaType: a,
|
|
17
|
+
connectNulls: s,
|
|
18
|
+
stroke: n
|
|
19
|
+
}) => /* @__PURE__ */ i(g, { children: o.map((t) => /* @__PURE__ */ i(
|
|
20
|
+
K,
|
|
18
21
|
{
|
|
19
22
|
seriesId: t.id,
|
|
20
|
-
stroke: t.stroke,
|
|
21
|
-
showArea:
|
|
22
|
-
areaType:
|
|
23
|
+
stroke: n ?? t.stroke,
|
|
24
|
+
showArea: r,
|
|
25
|
+
areaType: a,
|
|
26
|
+
connectNulls: s
|
|
23
27
|
},
|
|
24
28
|
t.id
|
|
25
|
-
)) }),
|
|
29
|
+
)) }), O = ({
|
|
26
30
|
series: o,
|
|
27
|
-
showArea:
|
|
28
|
-
areaType:
|
|
31
|
+
showArea: r,
|
|
32
|
+
areaType: a,
|
|
33
|
+
connectNulls: s
|
|
29
34
|
}) => {
|
|
30
|
-
const { animationStyle:
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */ i("style", { children:
|
|
33
|
-
/* @__PURE__ */ i("g", { style: { animation:
|
|
34
|
-
|
|
35
|
+
const { animationStyle: n, keyframe: t } = R();
|
|
36
|
+
return /* @__PURE__ */ A(g, { children: [
|
|
37
|
+
/* @__PURE__ */ i("style", { children: t }),
|
|
38
|
+
/* @__PURE__ */ i("g", { style: { animation: n }, children: /* @__PURE__ */ i(
|
|
39
|
+
k,
|
|
35
40
|
{
|
|
36
41
|
series: o,
|
|
37
|
-
showArea:
|
|
38
|
-
areaType:
|
|
42
|
+
showArea: r,
|
|
43
|
+
areaType: a,
|
|
44
|
+
connectNulls: s,
|
|
45
|
+
stroke: N("var(--border-muted-subtle)")
|
|
39
46
|
}
|
|
40
47
|
) })
|
|
41
48
|
] });
|
|
42
|
-
},
|
|
49
|
+
}, Q = ({
|
|
43
50
|
series: o,
|
|
44
|
-
showArea:
|
|
45
|
-
areaType:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
showArea: r,
|
|
52
|
+
areaType: a,
|
|
53
|
+
connectNulls: s,
|
|
54
|
+
showXAxis: n,
|
|
55
|
+
showYAxis: t,
|
|
56
|
+
xAxisConfig: d,
|
|
57
|
+
yAxisConfig: e,
|
|
58
|
+
isTransitionLoading: c,
|
|
59
|
+
children: f
|
|
60
|
+
}) => /* @__PURE__ */ A(g, { children: [
|
|
61
|
+
n && /* @__PURE__ */ i(H, { ...d }),
|
|
62
|
+
t && /* @__PURE__ */ i(J, { ...e }),
|
|
63
|
+
c ? /* @__PURE__ */ i(
|
|
64
|
+
O,
|
|
57
65
|
{
|
|
58
66
|
series: o,
|
|
59
|
-
showArea:
|
|
60
|
-
areaType:
|
|
67
|
+
showArea: r,
|
|
68
|
+
areaType: a,
|
|
69
|
+
connectNulls: s
|
|
61
70
|
}
|
|
62
71
|
) : /* @__PURE__ */ i(
|
|
63
|
-
|
|
72
|
+
k,
|
|
64
73
|
{
|
|
65
74
|
series: o,
|
|
66
|
-
showArea:
|
|
67
|
-
areaType:
|
|
75
|
+
showArea: r,
|
|
76
|
+
areaType: a,
|
|
77
|
+
connectNulls: s
|
|
68
78
|
}
|
|
69
79
|
),
|
|
70
|
-
|
|
80
|
+
f
|
|
71
81
|
] });
|
|
72
|
-
function
|
|
82
|
+
function ei({
|
|
73
83
|
series: o,
|
|
74
|
-
showArea:
|
|
75
|
-
areaType:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
showArea: r = !1,
|
|
85
|
+
areaType: a = "gradient",
|
|
86
|
+
connectNulls: s,
|
|
87
|
+
showXAxis: n = !1,
|
|
88
|
+
showYAxis: t = !1,
|
|
89
|
+
xAxis: d,
|
|
90
|
+
yAxis: e,
|
|
91
|
+
width: c = "100%",
|
|
92
|
+
height: f = 240,
|
|
82
93
|
inset: S,
|
|
83
|
-
enableScrubbing:
|
|
84
|
-
onScrubberPositionChange:
|
|
85
|
-
animate:
|
|
94
|
+
enableScrubbing: b,
|
|
95
|
+
onScrubberPositionChange: v,
|
|
96
|
+
animate: j,
|
|
86
97
|
magnetRadius: D,
|
|
87
|
-
loading:
|
|
88
|
-
emptyLabel:
|
|
98
|
+
loading: u = !1,
|
|
99
|
+
emptyLabel: C = "No data",
|
|
89
100
|
children: E
|
|
90
101
|
}) {
|
|
91
|
-
const
|
|
92
|
-
...
|
|
93
|
-
...
|
|
94
|
-
position:
|
|
102
|
+
const p = {
|
|
103
|
+
...P,
|
|
104
|
+
...d,
|
|
105
|
+
position: d?.position ?? P.position
|
|
95
106
|
}, l = {
|
|
96
|
-
...
|
|
97
|
-
...
|
|
98
|
-
position:
|
|
99
|
-
width:
|
|
100
|
-
},
|
|
101
|
-
() =>
|
|
102
|
-
showXAxis:
|
|
103
|
-
showYAxis:
|
|
104
|
-
xAxisPosition:
|
|
105
|
-
yAxisPosition:
|
|
106
|
-
yAxisWidth:
|
|
107
|
+
...h,
|
|
108
|
+
...e,
|
|
109
|
+
position: e?.position ?? h.position,
|
|
110
|
+
width: e?.width ?? h.width
|
|
111
|
+
}, L = p.position, x = l.position, y = l.width, T = I(
|
|
112
|
+
() => V({
|
|
113
|
+
showXAxis: n,
|
|
114
|
+
showYAxis: t,
|
|
115
|
+
xAxisPosition: L,
|
|
116
|
+
yAxisPosition: x,
|
|
117
|
+
yAxisWidth: y
|
|
107
118
|
}),
|
|
108
|
-
[
|
|
109
|
-
),
|
|
110
|
-
loading:
|
|
111
|
-
hasData:
|
|
112
|
-
emptyLabel:
|
|
119
|
+
[n, t, L, x, y]
|
|
120
|
+
), B = W(o, p.data), { status: m, ariaLabel: F } = q({
|
|
121
|
+
loading: u,
|
|
122
|
+
hasData: B,
|
|
123
|
+
emptyLabel: C
|
|
113
124
|
});
|
|
114
125
|
return /* @__PURE__ */ i(
|
|
115
|
-
|
|
126
|
+
z,
|
|
116
127
|
{
|
|
117
128
|
series: o ?? [],
|
|
118
|
-
xAxis:
|
|
129
|
+
xAxis: p,
|
|
119
130
|
yAxis: l,
|
|
120
|
-
width:
|
|
121
|
-
height:
|
|
131
|
+
width: c,
|
|
132
|
+
height: f,
|
|
122
133
|
inset: S,
|
|
123
134
|
axisPadding: T,
|
|
124
|
-
enableScrubbing:
|
|
125
|
-
onScrubberPositionChange:
|
|
126
|
-
animate:
|
|
135
|
+
enableScrubbing: b,
|
|
136
|
+
onScrubberPositionChange: v,
|
|
137
|
+
animate: j,
|
|
127
138
|
magnetRadius: D,
|
|
128
|
-
ariaLabel:
|
|
129
|
-
ariaBusy:
|
|
130
|
-
overlay:
|
|
131
|
-
children:
|
|
132
|
-
|
|
139
|
+
ariaLabel: F,
|
|
140
|
+
ariaBusy: u,
|
|
141
|
+
overlay: m === "empty" ? /* @__PURE__ */ i(M, { children: C }) : void 0,
|
|
142
|
+
children: m === "initial-loading" || m === "empty" ? /* @__PURE__ */ i(G, { loading: m === "initial-loading" }) : /* @__PURE__ */ i(
|
|
143
|
+
Q,
|
|
133
144
|
{
|
|
134
145
|
series: o ?? [],
|
|
135
|
-
showArea:
|
|
136
|
-
areaType:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
showArea: r,
|
|
147
|
+
areaType: a,
|
|
148
|
+
connectNulls: s,
|
|
149
|
+
showXAxis: n,
|
|
150
|
+
showYAxis: t,
|
|
151
|
+
xAxisConfig: p,
|
|
140
152
|
yAxisConfig: l,
|
|
141
|
-
isTransitionLoading:
|
|
153
|
+
isTransitionLoading: m === "transition-loading",
|
|
142
154
|
children: E
|
|
143
155
|
}
|
|
144
156
|
)
|
|
@@ -146,5 +158,5 @@ function ri({
|
|
|
146
158
|
);
|
|
147
159
|
}
|
|
148
160
|
export {
|
|
149
|
-
|
|
161
|
+
ei as LineChart
|
|
150
162
|
};
|