@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.
Files changed (66) hide show
  1. package/dist/lib/Components/Axis/Axis.types.d.ts +6 -0
  2. package/dist/lib/Components/Axis/Axis.types.d.ts.map +1 -1
  3. package/dist/lib/Components/Axis/XAxis/XAxis.d.ts +1 -1
  4. package/dist/lib/Components/Axis/XAxis/XAxis.d.ts.map +1 -1
  5. package/dist/lib/Components/Axis/XAxis/XAxis.js +18 -17
  6. package/dist/lib/Components/Axis/YAxis/YAxis.d.ts +1 -1
  7. package/dist/lib/Components/Axis/YAxis/YAxis.d.ts.map +1 -1
  8. package/dist/lib/Components/Axis/YAxis/YAxis.js +20 -19
  9. package/dist/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
  10. package/dist/lib/Components/CartesianChart/CartesianChart.js +61 -61
  11. package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts +3 -0
  12. package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts.map +1 -0
  13. package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.js +41 -0
  14. package/dist/lib/Components/CartesianChart/RevealAnimation/context.d.ts +15 -0
  15. package/dist/lib/Components/CartesianChart/RevealAnimation/context.d.ts.map +1 -0
  16. package/dist/lib/Components/CartesianChart/RevealAnimation/context.js +10 -0
  17. package/dist/lib/Components/CartesianChart/RevealAnimation/index.d.ts +3 -0
  18. package/dist/lib/Components/CartesianChart/RevealAnimation/index.d.ts.map +1 -0
  19. package/dist/lib/Components/CartesianChart/RevealAnimation/types.d.ts +57 -0
  20. package/dist/lib/Components/CartesianChart/RevealAnimation/types.d.ts.map +1 -0
  21. package/dist/lib/Components/CartesianChart/RevealAnimation/utils.d.ts +31 -0
  22. package/dist/lib/Components/CartesianChart/RevealAnimation/utils.d.ts.map +1 -0
  23. package/dist/lib/Components/CartesianChart/RevealAnimation/utils.js +67 -0
  24. package/dist/lib/Components/CartesianChart/utils.d.ts +1 -24
  25. package/dist/lib/Components/CartesianChart/utils.d.ts.map +1 -1
  26. package/dist/lib/Components/CartesianChart/utils.js +12 -23
  27. package/dist/lib/Components/Line/Line.d.ts +1 -1
  28. package/dist/lib/Components/Line/Line.d.ts.map +1 -1
  29. package/dist/lib/Components/Line/Line.js +40 -33
  30. package/dist/lib/Components/Line/types.d.ts +7 -0
  31. package/dist/lib/Components/Line/types.d.ts.map +1 -1
  32. package/dist/lib/Components/Line/utils.d.ts +8 -3
  33. package/dist/lib/Components/Line/utils.d.ts.map +1 -1
  34. package/dist/lib/Components/Line/utils.js +30 -25
  35. package/dist/lib/Components/LineChart/LineChart.d.ts +1 -1
  36. package/dist/lib/Components/LineChart/LineChart.d.ts.map +1 -1
  37. package/dist/lib/Components/LineChart/LineChart.js +114 -102
  38. package/dist/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.js +16 -16
  39. package/dist/lib/Components/LineChart/__stories__/chartStoryFixtures.d.ts +21 -0
  40. package/dist/lib/Components/LineChart/__stories__/chartStoryFixtures.d.ts.map +1 -1
  41. package/dist/lib/Components/LineChart/types.d.ts +12 -1
  42. package/dist/lib/Components/LineChart/types.d.ts.map +1 -1
  43. package/dist/lib/Components/Point/Point.d.ts.map +1 -1
  44. package/dist/lib/Components/Point/Point.js +29 -27
  45. package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -1
  46. package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +4 -2
  47. package/dist/lib/utils/types.d.ts +7 -0
  48. package/dist/lib/utils/types.d.ts.map +1 -1
  49. package/dist/package.json +3 -3
  50. package/package.json +2 -2
  51. package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts +0 -3
  52. package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts.map +0 -1
  53. package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js +0 -42
  54. package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts +0 -7
  55. package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts.map +0 -1
  56. package/dist/lib/Components/CartesianChart/RevealClip/context.js +0 -6
  57. package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts +0 -3
  58. package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts.map +0 -1
  59. package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts +0 -37
  60. package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts.map +0 -1
  61. package/dist/lib/Components/CartesianChart/hooks/useDataFingerprint.d.ts +0 -9
  62. package/dist/lib/Components/CartesianChart/hooks/useDataFingerprint.d.ts.map +0 -1
  63. package/dist/lib/Components/CartesianChart/hooks/useDataFingerprint.js +0 -8
  64. package/dist/lib/Components/CartesianChart/hooks/useRevealClipAnimation.d.ts +0 -14
  65. package/dist/lib/Components/CartesianChart/hooks/useRevealClipAnimation.d.ts.map +0 -1
  66. 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 = 160;
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;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,UAK7B,CAAC;AACF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AACF,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
+ {"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 l = 160, r = {
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
- }, m = (t) => {
6
+ }, l = (t) => {
16
7
  let o;
17
- return t === void 0 ? o = e : typeof t == "number" ? o = { top: t, right: t, bottom: t, left: t } : 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 + r.top,
24
- right: o.right + r.right,
25
- bottom: o.bottom + r.bottom,
26
- left: o.left + r.left
14
+ top: o.top,
15
+ right: o.right,
16
+ bottom: o.bottom,
17
+ left: o.left
27
18
  };
28
- }, b = (t) => t === void 0 ? e : {
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
- l as DEFAULT_HEIGHT,
36
- r as OVERFLOW_BUFFER,
37
- f as OVERFLOW_OFFSET,
38
- e as ZERO_PADDING,
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,GACN,EAAE,SAAS,kDAgFX"}
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 d, jsx as o, Fragment as I } from "react/jsx-runtime";
2
- import { useId as T, useMemo as c } from "react";
3
- import { isNumericScale as k } from "../../utils/scales/scales.js";
4
- import { LINE_DEFAULT_STROKE_COLOR as y, LINE_AREA_GRADIENT_OPACITY as A, LINE_STROKE_WIDTH as O } from "./constants.js";
5
- import { toScaledPoints as P, buildLinePath as R, buildAreaPath as v } from "./utils.js";
6
- import { useCartesianChartContext as N } from "../CartesianChart/context/cartesianChartContext.js";
7
- import { useRevealClip as D } from "../CartesianChart/RevealClip/context.js";
8
- function Y({
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: h,
11
- showArea: n = !1,
12
- areaType: j = "gradient",
13
- curve: C
10
+ stroke: C,
11
+ showArea: s = !1,
12
+ areaType: F = "gradient",
13
+ curve: x,
14
+ connectNulls: L
14
15
  }) {
15
- const { getXScale: x, getYScale: L, getXAxisConfig: S, drawingArea: s, seriesMap: _ } = N(), E = D(), l = x(), r = L(), p = S(), f = T(), e = _.get(g), a = (h ?? e?.stroke) || y, i = C ?? e?.curve, t = c(
16
- () => e?.data && l && r && k(r) ? P(e.data, l, r, p?.data) : null,
17
- [e, l, r, p]
18
- ), u = c(
19
- () => t ? R(t, i) : null,
20
- [t, i]
21
- ), m = c(
22
- () => n && t && s ? v(t, s, i) : null,
23
- [n, t, s, i]
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 u ? /* @__PURE__ */ d("g", { clipPath: E, children: [
26
- n && m && a && /* @__PURE__ */ d(I, { children: [
27
- /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ d(
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: f,
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: a,
42
- stopOpacity: A
48
+ stopColor: r,
49
+ stopOpacity: N
43
50
  }
44
51
  ),
45
- /* @__PURE__ */ o("stop", { offset: "100%", stopColor: a, stopOpacity: 0 })
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: m,
54
- fill: `url(#${f})`,
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: u,
70
+ d: m,
64
71
  fill: "none",
65
- stroke: a,
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
- Y as Line
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;CACnB,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, skipping nulls.
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;AAoBpC;;;;;;;;;GASG;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,KACnC,KAAK,EAAE,GAAG,IAoBZ,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,EAAE,EACf,QAAQ,SAAS,KAChB,MAAM,GAAG,IAOX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,EAAE,EACf,aAAa,WAAW,EACxB,QAAQ,SAAS,KAChB,MAAM,GAAG,IAUX,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 b } from "../../utils/numbers.js";
2
- import { isCategoricalScale as y } from "../../utils/scales/scales.js";
3
- import v from "../../../node_modules/d3-shape/src/line.js";
4
- import g, { stepBefore as C, stepAfter as A } from "../../../node_modules/d3-shape/src/curve/step.js";
5
- import E from "../../../node_modules/d3-shape/src/curve/natural.js";
6
- import { monotoneX as F } from "../../../node_modules/d3-shape/src/curve/monotone.js";
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 p = {
10
+ const f = {
11
11
  bump: L,
12
12
  linear: B,
13
- monotone: F,
14
- natural: E,
13
+ monotone: E,
14
+ natural: A,
15
15
  step: g,
16
- stepAfter: A,
17
- stepBefore: C
18
- }, s = "bump", c = (t = s) => p[t] ?? p[s], _ = (t, o, r, e) => {
19
- const n = [], l = e ? Math.min(t.length, e.length) : t.length;
20
- for (let i = 0; i < l; i++) {
21
- const m = t[i];
22
- if (!b(m)) continue;
23
- const u = e && typeof e[i] == "number" ? e[i] : i, f = y(o) ? (o(u) ?? 0) + o.bandwidth() / 2 : o(u), h = r(m);
24
- n.push([f, h]);
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 n.length >= 2 ? n : null;
27
- }, M = (t, o) => v().x((r) => r[0]).y((r) => r[1]).curve(c(o))(t) ?? null, O = (t, o, r) => {
28
- const e = o.y + o.height;
29
- return P().x((n) => n[0]).y0(e).y1((n) => n[1]).curve(c(r))(t) ?? null;
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
- O as buildAreaPath,
33
- M as buildLinePath,
34
- _ as toScaledPoints
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":"AAWA,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,SAAS,CAAC;AAiFjB,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,YAAY,EACZ,OAAe,EACf,UAAsB,EACtB,QAAQ,GACT,EAAE,QAAQ,CAAC,cAAc,CAAC,2CA+E1B"}
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 P, Fragment as h } from "react/jsx-runtime";
2
- import { useMemo as F } from "react";
3
- import { ChartEmptyLabel as I } from "../CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js";
4
- import { useShimmerAnimation as M } from "../CartesianChart/hooks/useShimmerAnimation.js";
5
- import { computeAxisPadding as N, canRenderLine as R, getChartDisplayState as W } from "./utils.js";
6
- import { defaultXAxisProps as y, defaultYAxisProps as f } from "../Axis/Axis.constants.js";
7
- import { CartesianChart as q } from "../CartesianChart/CartesianChart.js";
8
- import { LineChartEmptyState as z } from "./LineChartEmptyState/LineChartEmptyState.js";
9
- import { XAxis as G } from "../Axis/XAxis/XAxis.js";
10
- import { YAxis as H } from "../Axis/YAxis/YAxis.js";
11
- import { Line as J } from "../Line/Line.js";
12
- const A = ({
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: n,
15
- areaType: r
16
- }) => /* @__PURE__ */ i(h, { children: o.map((t) => /* @__PURE__ */ i(
17
- J,
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: n,
22
- areaType: r
23
+ stroke: n ?? t.stroke,
24
+ showArea: r,
25
+ areaType: a,
26
+ connectNulls: s
23
27
  },
24
28
  t.id
25
- )) }), K = ({
29
+ )) }), O = ({
26
30
  series: o,
27
- showArea: n,
28
- areaType: r
31
+ showArea: r,
32
+ areaType: a,
33
+ connectNulls: s
29
34
  }) => {
30
- const { animationStyle: t, keyframe: a } = M();
31
- return /* @__PURE__ */ P(h, { children: [
32
- /* @__PURE__ */ i("style", { children: a }),
33
- /* @__PURE__ */ i("g", { style: { animation: t }, children: /* @__PURE__ */ i(
34
- A,
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: n,
38
- areaType: r
42
+ showArea: r,
43
+ areaType: a,
44
+ connectNulls: s,
45
+ stroke: N("var(--border-muted-subtle)")
39
46
  }
40
47
  ) })
41
48
  ] });
42
- }, O = ({
49
+ }, Q = ({
43
50
  series: o,
44
- showArea: n,
45
- areaType: r,
46
- showXAxis: t,
47
- showYAxis: a,
48
- xAxisConfig: m,
49
- yAxisConfig: s,
50
- isTransitionLoading: p,
51
- children: c
52
- }) => /* @__PURE__ */ P(h, { children: [
53
- t && /* @__PURE__ */ i(G, { ...m }),
54
- a && /* @__PURE__ */ i(H, { ...s }),
55
- p ? /* @__PURE__ */ i(
56
- K,
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: n,
60
- areaType: r
67
+ showArea: r,
68
+ areaType: a,
69
+ connectNulls: s
61
70
  }
62
71
  ) : /* @__PURE__ */ i(
63
- A,
72
+ k,
64
73
  {
65
74
  series: o,
66
- showArea: n,
67
- areaType: r
75
+ showArea: r,
76
+ areaType: a,
77
+ connectNulls: s
68
78
  }
69
79
  ),
70
- c
80
+ f
71
81
  ] });
72
- function ri({
82
+ function ei({
73
83
  series: o,
74
- showArea: n = !1,
75
- areaType: r = "gradient",
76
- showXAxis: t = !1,
77
- showYAxis: a = !1,
78
- xAxis: m,
79
- yAxis: s,
80
- width: p = "100%",
81
- height: c = 240,
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: k,
84
- onScrubberPositionChange: j,
85
- animate: v,
94
+ enableScrubbing: b,
95
+ onScrubberPositionChange: v,
96
+ animate: j,
86
97
  magnetRadius: D,
87
- loading: g = !1,
88
- emptyLabel: u = "No data",
98
+ loading: u = !1,
99
+ emptyLabel: C = "No data",
89
100
  children: E
90
101
  }) {
91
- const d = {
92
- ...y,
93
- ...m,
94
- position: m?.position ?? y.position
102
+ const p = {
103
+ ...P,
104
+ ...d,
105
+ position: d?.position ?? P.position
95
106
  }, l = {
96
- ...f,
97
- ...s,
98
- position: s?.position ?? f.position,
99
- width: s?.width ?? f.width
100
- }, C = d.position, L = l.position, x = l.width, T = F(
101
- () => N({
102
- showXAxis: t,
103
- showYAxis: a,
104
- xAxisPosition: C,
105
- yAxisPosition: L,
106
- yAxisWidth: x
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
- [t, a, C, L, x]
109
- ), b = R(o, d.data), { status: e, ariaLabel: B } = W({
110
- loading: g,
111
- hasData: b,
112
- emptyLabel: u
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
- q,
126
+ z,
116
127
  {
117
128
  series: o ?? [],
118
- xAxis: d,
129
+ xAxis: p,
119
130
  yAxis: l,
120
- width: p,
121
- height: c,
131
+ width: c,
132
+ height: f,
122
133
  inset: S,
123
134
  axisPadding: T,
124
- enableScrubbing: k,
125
- onScrubberPositionChange: j,
126
- animate: v,
135
+ enableScrubbing: b,
136
+ onScrubberPositionChange: v,
137
+ animate: j,
127
138
  magnetRadius: D,
128
- ariaLabel: B,
129
- ariaBusy: g,
130
- overlay: e === "empty" ? /* @__PURE__ */ i(I, { children: u }) : void 0,
131
- children: e === "initial-loading" || e === "empty" ? /* @__PURE__ */ i(z, { loading: e === "initial-loading" }) : /* @__PURE__ */ i(
132
- O,
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: n,
136
- areaType: r,
137
- showXAxis: t,
138
- showYAxis: a,
139
- xAxisConfig: d,
146
+ showArea: r,
147
+ areaType: a,
148
+ connectNulls: s,
149
+ showXAxis: n,
150
+ showYAxis: t,
151
+ xAxisConfig: p,
140
152
  yAxisConfig: l,
141
- isTransitionLoading: e === "transition-loading",
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
- ri as LineChart
161
+ ei as LineChart
150
162
  };