@ledgerhq/lumen-ui-react-visualization 0.1.18 → 0.1.20

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 (113) 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 +24 -23
  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 +36 -35
  9. package/dist/lib/Components/CartesianChart/CartesianChart.d.ts +1 -1
  10. package/dist/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
  11. package/dist/lib/Components/CartesianChart/CartesianChart.js +89 -82
  12. package/dist/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts +11 -0
  13. package/dist/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.d.ts.map +1 -0
  14. package/dist/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.js +21 -0
  15. package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts +3 -0
  16. package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.d.ts.map +1 -0
  17. package/dist/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.js +41 -0
  18. package/dist/lib/Components/CartesianChart/RevealAnimation/context.d.ts +15 -0
  19. package/dist/lib/Components/CartesianChart/RevealAnimation/context.d.ts.map +1 -0
  20. package/dist/lib/Components/CartesianChart/RevealAnimation/context.js +10 -0
  21. package/dist/lib/Components/CartesianChart/RevealAnimation/index.d.ts +3 -0
  22. package/dist/lib/Components/CartesianChart/RevealAnimation/index.d.ts.map +1 -0
  23. package/dist/lib/Components/CartesianChart/RevealAnimation/types.d.ts +57 -0
  24. package/dist/lib/Components/CartesianChart/RevealAnimation/types.d.ts.map +1 -0
  25. package/dist/lib/Components/CartesianChart/RevealAnimation/utils.d.ts +31 -0
  26. package/dist/lib/Components/CartesianChart/RevealAnimation/utils.d.ts.map +1 -0
  27. package/dist/lib/Components/CartesianChart/RevealAnimation/utils.js +67 -0
  28. package/dist/lib/Components/CartesianChart/hooks/useShimmerAnimation.d.ts +18 -0
  29. package/dist/lib/Components/CartesianChart/hooks/useShimmerAnimation.d.ts.map +1 -0
  30. package/dist/lib/Components/CartesianChart/hooks/useShimmerAnimation.js +14 -0
  31. package/dist/lib/Components/CartesianChart/types.d.ts +11 -0
  32. package/dist/lib/Components/CartesianChart/types.d.ts.map +1 -1
  33. package/dist/lib/Components/CartesianChart/utils.d.ts +1 -24
  34. package/dist/lib/Components/CartesianChart/utils.d.ts.map +1 -1
  35. package/dist/lib/Components/CartesianChart/utils.js +12 -23
  36. package/dist/lib/Components/Line/Line.d.ts +1 -1
  37. package/dist/lib/Components/Line/Line.d.ts.map +1 -1
  38. package/dist/lib/Components/Line/Line.js +43 -36
  39. package/dist/lib/Components/Line/constants.d.ts +4 -0
  40. package/dist/lib/Components/Line/constants.d.ts.map +1 -0
  41. package/dist/lib/Components/Line/constants.js +7 -0
  42. package/dist/lib/Components/Line/index.d.ts +1 -1
  43. package/dist/lib/Components/Line/index.d.ts.map +1 -1
  44. package/dist/lib/Components/Line/types.d.ts +15 -0
  45. package/dist/lib/Components/Line/types.d.ts.map +1 -1
  46. package/dist/lib/Components/Line/utils.d.ts +11 -6
  47. package/dist/lib/Components/Line/utils.d.ts.map +1 -1
  48. package/dist/lib/Components/Line/utils.js +36 -18
  49. package/dist/lib/Components/LineChart/LineChart.d.ts +1 -1
  50. package/dist/lib/Components/LineChart/LineChart.d.ts.map +1 -1
  51. package/dist/lib/Components/LineChart/LineChart.js +152 -69
  52. package/dist/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts +9 -0
  53. package/dist/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.d.ts.map +1 -0
  54. package/dist/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.js +51 -0
  55. package/dist/lib/Components/LineChart/LineChartEmptyState/index.d.ts +3 -0
  56. package/dist/lib/Components/LineChart/LineChartEmptyState/index.d.ts.map +1 -0
  57. package/dist/lib/Components/LineChart/LineChartEmptyState/types.d.ts +3 -0
  58. package/dist/lib/Components/LineChart/LineChartEmptyState/types.d.ts.map +1 -0
  59. package/dist/lib/Components/LineChart/LineChartEmptyState/utils.d.ts +14 -0
  60. package/dist/lib/Components/LineChart/LineChartEmptyState/utils.d.ts.map +1 -0
  61. package/dist/lib/Components/LineChart/LineChartEmptyState/utils.js +9 -0
  62. package/dist/lib/Components/LineChart/__stories__/chartStoryFixtures.d.ts +57 -3
  63. package/dist/lib/Components/LineChart/__stories__/chartStoryFixtures.d.ts.map +1 -1
  64. package/dist/lib/Components/LineChart/types.d.ts +39 -1
  65. package/dist/lib/Components/LineChart/types.d.ts.map +1 -1
  66. package/dist/lib/Components/LineChart/utils.d.ts +43 -0
  67. package/dist/lib/Components/LineChart/utils.d.ts.map +1 -0
  68. package/dist/lib/Components/LineChart/utils.js +37 -0
  69. package/dist/lib/Components/Point/Point.d.ts.map +1 -1
  70. package/dist/lib/Components/Point/Point.js +29 -27
  71. package/dist/lib/Components/ReferenceLine/ReferenceLine.d.ts.map +1 -1
  72. package/dist/lib/Components/ReferenceLine/ReferenceLine.js +16 -16
  73. package/dist/lib/Components/ReferenceLine/constants.d.ts +3 -3
  74. package/dist/lib/Components/ReferenceLine/constants.d.ts.map +1 -1
  75. package/dist/lib/Components/ReferenceLine/constants.js +5 -5
  76. package/dist/lib/Components/ReferenceLine/utils.d.ts.map +1 -1
  77. package/dist/lib/Components/ReferenceLine/utils.js +15 -14
  78. package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.d.ts.map +1 -1
  79. package/dist/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js +4 -2
  80. package/dist/lib/Components/Scrubber/Scrubber.d.ts.map +1 -1
  81. package/dist/lib/Components/Scrubber/Scrubber.js +34 -29
  82. package/dist/lib/Components/Scrubber/ScrubberProvider.d.ts.map +1 -1
  83. package/dist/lib/Components/Scrubber/ScrubberProvider.js +68 -67
  84. package/dist/lib/Components/Scrubber/utils.d.ts.map +1 -1
  85. package/dist/lib/Components/Scrubber/utils.js +30 -32
  86. package/dist/lib/utils/index.d.ts +1 -1
  87. package/dist/lib/utils/index.d.ts.map +1 -1
  88. package/dist/lib/utils/numbers.d.ts +13 -0
  89. package/dist/lib/utils/numbers.d.ts.map +1 -0
  90. package/dist/lib/utils/numbers.js +5 -0
  91. package/dist/lib/utils/ticks/ticks.d.ts +1 -11
  92. package/dist/lib/utils/ticks/ticks.d.ts.map +1 -1
  93. package/dist/lib/utils/ticks/ticks.js +19 -21
  94. package/dist/lib/utils/types.d.ts +26 -1
  95. package/dist/lib/utils/types.d.ts.map +1 -1
  96. package/dist/node_modules/d3-shape/src/curve/monotone.js +69 -0
  97. package/dist/node_modules/d3-shape/src/curve/natural.js +41 -0
  98. package/dist/node_modules/d3-shape/src/curve/step.js +51 -0
  99. package/dist/package.json +3 -3
  100. package/package.json +3 -3
  101. package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts +0 -3
  102. package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts.map +0 -1
  103. package/dist/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js +0 -41
  104. package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts +0 -7
  105. package/dist/lib/Components/CartesianChart/RevealClip/context.d.ts.map +0 -1
  106. package/dist/lib/Components/CartesianChart/RevealClip/context.js +0 -6
  107. package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts +0 -3
  108. package/dist/lib/Components/CartesianChart/RevealClip/index.d.ts.map +0 -1
  109. package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts +0 -37
  110. package/dist/lib/Components/CartesianChart/RevealClip/types.d.ts.map +0 -1
  111. package/dist/lib/Components/CartesianChart/RevealClip/utils.d.ts +0 -17
  112. package/dist/lib/Components/CartesianChart/RevealClip/utils.d.ts.map +0 -1
  113. package/dist/lib/Components/CartesianChart/RevealClip/utils.js +0 -23
@@ -1,3 +1,5 @@
1
+ import { CurveType } from '../../utils/types';
2
+ export type { CurveType };
1
3
  export type LineProps = {
2
4
  /**
3
5
  * The ID of the series to render.
@@ -20,5 +22,18 @@ export type LineProps = {
20
22
  * @default 'gradient'
21
23
  */
22
24
  areaType?: 'gradient';
25
+ /**
26
+ * Override interpolation used to draw the line between data points.
27
+ * When omitted, falls back to the `curve` defined on the series.
28
+ * @default 'bump'
29
+ */
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;
23
38
  };
24
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,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;CACvB,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
- import { ChartScaleFunction, DrawingArea, NumericScale } from '../../utils/types';
2
- type Point = [x: number, y: number];
1
+ import { ChartScaleFunction, CurveType, DrawingArea, NumericScale } from '../../utils/types';
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,15 +9,20 @@ 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
  */
17
- export declare const buildLinePath: (points: Point[]) => string | null;
22
+ export declare const buildLinePath: (points: Point[], curve?: CurveType) => string | null;
18
23
  /**
19
24
  * Build the SVG `d` attribute for the filled area beneath the line.
20
25
  */
21
- export declare const buildAreaPath: (points: Point[], drawingArea: DrawingArea) => string | null;
26
+ export declare const buildAreaPath: (points: Point[], drawingArea: DrawingArea, curve?: CurveType) => string | null;
22
27
  export {};
23
28
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Line/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,KAAK,KAAK,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpC;;;;;;;;;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,GAAI,QAAQ,KAAK,EAAE,KAAG,MAAM,GAAG,IAOxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,KAAK,EAAE,EACf,aAAa,WAAW,KACvB,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,22 +1,40 @@
1
- import { isCategoricalScale as p } from "../../utils/scales/scales.js";
2
- import f from "../../../node_modules/d3-shape/src/line.js";
3
- import { bumpX as s } from "../../../node_modules/d3-shape/src/curve/bump.js";
4
- import y from "../../../node_modules/d3-shape/src/area.js";
5
- const d = (o, t, e, n) => {
6
- const i = [], c = n ? Math.min(o.length, n.length) : o.length;
7
- for (let r = 0; r < c; r++) {
8
- const l = o[r];
9
- if (l === null) continue;
10
- const u = n && typeof n[r] == "number" ? n[r] : r, m = p(t) ? (t(u) ?? 0) + t.bandwidth() / 2 : t(u), h = e(l);
11
- i.push([m, h]);
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
+ import B from "../../../node_modules/d3-shape/src/curve/linear.js";
8
+ import { bumpX as L } from "../../../node_modules/d3-shape/src/curve/bump.js";
9
+ import P from "../../../node_modules/d3-shape/src/area.js";
10
+ const f = {
11
+ bump: L,
12
+ linear: B,
13
+ monotone: E,
14
+ natural: A,
15
+ step: g,
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++;
12
30
  }
13
- return i.length >= 2 ? i : null;
14
- }, B = (o) => f().x((t) => t[0]).y((t) => t[1]).curve(s)(o) ?? null, C = (o, t) => {
15
- const e = t.y + t.height;
16
- return y().x((n) => n[0]).y0(e).y1((n) => n[1]).curve(s)(o) ?? 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;
17
35
  };
18
36
  export {
19
- C as buildAreaPath,
20
- B as buildLinePath,
21
- d as toScaledPoints
37
+ j as buildAreaPath,
38
+ S as buildLinePath,
39
+ O as toScaledPoints
22
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, children, }: 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":"AAaA,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,YAAY,EACZ,QAAQ,GACT,EAAE,cAAc,2CA8DhB"}
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,79 +1,162 @@
1
- import { jsxs as b, jsx as n } from "react/jsx-runtime";
2
- import { useMemo as j } from "react";
3
- import { defaultYAxisProps as y, DEFAULT_AXIS_HEIGHT as m, defaultXAxisProps as A } from "../Axis/Axis.constants.js";
4
- import { CartesianChart as E } from "../CartesianChart/CartesianChart.js";
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";
5
9
  import { XAxis as H } from "../Axis/XAxis/XAxis.js";
6
- import { YAxis as T } from "../Axis/YAxis/YAxis.js";
7
- import { Line as _ } from "../Line/Line.js";
8
- function k({
9
- series: e,
10
- showArea: f = !1,
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 = ({
14
+ series: o,
15
+ showArea: r,
16
+ areaType: a,
17
+ connectNulls: s,
18
+ stroke: n
19
+ }) => /* @__PURE__ */ i(g, { children: o.map((t) => /* @__PURE__ */ i(
20
+ K,
21
+ {
22
+ seriesId: t.id,
23
+ stroke: n ?? t.stroke,
24
+ showArea: r,
25
+ areaType: a,
26
+ connectNulls: s
27
+ },
28
+ t.id
29
+ )) }), O = ({
30
+ series: o,
31
+ showArea: r,
32
+ areaType: a,
33
+ connectNulls: s
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,
40
+ {
41
+ series: o,
42
+ showArea: r,
43
+ areaType: a,
44
+ connectNulls: s,
45
+ stroke: N("var(--border-muted-subtle)")
46
+ }
47
+ ) })
48
+ ] });
49
+ }, Q = ({
50
+ series: o,
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,
65
+ {
66
+ series: o,
67
+ showArea: r,
68
+ areaType: a,
69
+ connectNulls: s
70
+ }
71
+ ) : /* @__PURE__ */ i(
72
+ k,
73
+ {
74
+ series: o,
75
+ showArea: r,
76
+ areaType: a,
77
+ connectNulls: s
78
+ }
79
+ ),
80
+ f
81
+ ] });
82
+ function ei({
83
+ series: o,
84
+ showArea: r = !1,
11
85
  areaType: a = "gradient",
12
- showXAxis: i = !1,
13
- showYAxis: o = !1,
86
+ connectNulls: s,
87
+ showXAxis: n = !1,
88
+ showYAxis: t = !1,
14
89
  xAxis: d,
15
- yAxis: s,
16
- width: l = "100%",
17
- height: u = 160,
18
- inset: x,
19
- enableScrubbing: c,
20
- onScrubberPositionChange: g,
21
- animate: C,
22
- magnetRadius: I,
23
- children: L
90
+ yAxis: e,
91
+ width: c = "100%",
92
+ height: f = 240,
93
+ inset: S,
94
+ enableScrubbing: b,
95
+ onScrubberPositionChange: v,
96
+ animate: j,
97
+ magnetRadius: D,
98
+ loading: u = !1,
99
+ emptyLabel: C = "No data",
100
+ children: E
24
101
  }) {
25
- const r = {
26
- ...A,
27
- ...d
28
- }, t = {
29
- ...y,
30
- ...s
31
- }, P = j(() => {
32
- if (!(!i && !o))
33
- return {
34
- top: i && r.position === "top" ? m : 0,
35
- bottom: i && r.position === "bottom" ? m : 0,
36
- left: o && t.position === "start" ? t.width : 0,
37
- right: o && t.position === "end" ? t.width : 0
38
- };
39
- }, [
40
- i,
41
- o,
42
- r?.position,
43
- t?.position,
44
- t?.width
45
- ]);
46
- return /* @__PURE__ */ b(
47
- E,
102
+ const p = {
103
+ ...P,
104
+ ...d,
105
+ position: d?.position ?? P.position
106
+ }, l = {
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
118
+ }),
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
124
+ });
125
+ return /* @__PURE__ */ i(
126
+ z,
48
127
  {
49
- series: e ?? [],
50
- xAxis: r,
51
- yAxis: t,
52
- width: l,
53
- height: u,
54
- inset: x,
55
- axisPadding: P,
56
- enableScrubbing: c,
57
- onScrubberPositionChange: g,
58
- animate: C,
59
- magnetRadius: I,
60
- children: [
61
- i && /* @__PURE__ */ n(H, { ...r }),
62
- o && /* @__PURE__ */ n(T, { ...t }),
63
- e?.map((p) => /* @__PURE__ */ n(
64
- _,
65
- {
66
- seriesId: p.id,
67
- showArea: f,
68
- areaType: a
69
- },
70
- p.id
71
- )),
72
- L
73
- ]
128
+ series: o ?? [],
129
+ xAxis: p,
130
+ yAxis: l,
131
+ width: c,
132
+ height: f,
133
+ inset: S,
134
+ axisPadding: T,
135
+ enableScrubbing: b,
136
+ onScrubberPositionChange: v,
137
+ animate: j,
138
+ magnetRadius: D,
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,
144
+ {
145
+ series: o ?? [],
146
+ showArea: r,
147
+ areaType: a,
148
+ connectNulls: s,
149
+ showXAxis: n,
150
+ showYAxis: t,
151
+ xAxisConfig: p,
152
+ yAxisConfig: l,
153
+ isTransitionLoading: m === "transition-loading",
154
+ children: E
155
+ }
156
+ )
74
157
  }
75
158
  );
76
159
  }
77
160
  export {
78
- k as LineChart
161
+ ei as LineChart
79
162
  };
@@ -0,0 +1,9 @@
1
+ import { LineChartEmptyStateProps } from './types';
2
+ /**
3
+ * SVG placeholder line shown when a LineChart is loading with no data yet (with
4
+ * a shimmer) or has no data to display (static). Uses a fixed line shape scaled
5
+ * into the chart's reserved drawing area, plus static horizontal grid lines, so
6
+ * axes are not needed.
7
+ */
8
+ export declare function LineChartEmptyState({ loading, }: Readonly<LineChartEmptyStateProps>): import("react/jsx-runtime").JSX.Element | null;
9
+ //# sourceMappingURL=LineChartEmptyState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChartEmptyState.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/LineChart/LineChartEmptyState/LineChartEmptyState.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAKxD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAe,GAChB,EAAE,QAAQ,CAAC,wBAAwB,CAAC,kDAkDpC"}
@@ -0,0 +1,51 @@
1
+ import { jsxs as o, Fragment as h, jsx as e } from "react/jsx-runtime";
2
+ import { useShimmerAnimation as l } from "../../CartesianChart/hooks/useShimmerAnimation.js";
3
+ import { buildPlaceholderTransform as c, PLACEHOLDER_LINE_PATH as p } from "./utils.js";
4
+ import { useCartesianChartContext as f } from "../../CartesianChart/context/cartesianChartContext.js";
5
+ import { usePathReveal as u } from "../../CartesianChart/RevealAnimation/context.js";
6
+ import { cssVar as r } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
7
+ const y = [0.3, 0.5, 0.7];
8
+ function b({
9
+ loading: n = !1
10
+ }) {
11
+ const { drawingArea: t } = f(), { animationStyle: s, keyframe: m } = l(), d = u();
12
+ return t.width <= 0 || t.height <= 0 ? null : /* @__PURE__ */ o(h, { children: [
13
+ n && /* @__PURE__ */ e("style", { children: m }),
14
+ /* @__PURE__ */ o("g", { "data-testid": "chart-empty-state", children: [
15
+ /* @__PURE__ */ e("g", { "data-testid": "chart-empty-state-grid", children: y.map((a) => {
16
+ const i = t.y + t.height * a;
17
+ return /* @__PURE__ */ e(
18
+ "line",
19
+ {
20
+ x1: t.x,
21
+ y1: i,
22
+ x2: t.x + t.width,
23
+ y2: i,
24
+ style: {
25
+ stroke: r("var(--border-muted-subtle-transparent)")
26
+ },
27
+ strokeWidth: r("var(--stroke-1)")
28
+ },
29
+ a
30
+ );
31
+ }) }),
32
+ /* @__PURE__ */ e("g", { clipPath: d, children: /* @__PURE__ */ e("g", { style: n ? { animation: s } : void 0, children: /* @__PURE__ */ e(
33
+ "path",
34
+ {
35
+ "data-testid": "chart-empty-state-line",
36
+ d: p,
37
+ transform: c(t),
38
+ vectorEffect: "non-scaling-stroke",
39
+ fill: "none",
40
+ stroke: r("var(--border-muted-subtle)"),
41
+ strokeWidth: r("var(--stroke-2)"),
42
+ strokeLinecap: "round",
43
+ strokeLinejoin: "round"
44
+ }
45
+ ) }) })
46
+ ] })
47
+ ] });
48
+ }
49
+ export {
50
+ b as LineChartEmptyState
51
+ };
@@ -0,0 +1,3 @@
1
+ export { LineChartEmptyState } from './LineChartEmptyState';
2
+ export type { LineChartEmptyStateProps } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/LineChart/LineChartEmptyState/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { LineChartProps } from '../types';
2
+ export type LineChartEmptyStateProps = Pick<LineChartProps, 'loading'>;
3
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/LineChart/LineChartEmptyState/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { DrawingArea } from '../../../utils/types';
2
+ /**
3
+ * Fixed placeholder line shape, authored against a {@link PLACEHOLDER_VIEW_WIDTH}
4
+ * x {@link PLACEHOLDER_VIEW_HEIGHT} viewBox. Reused for every empty/loading
5
+ * state so the placeholder always reads the same.
6
+ */
7
+ export declare const PLACEHOLDER_LINE_PATH = "M1.00 128.27 C4.02 127.46 13.09 125.96 19.13 123.47 C25.19 120.97 31.23 116.53 37.28 113.31 C43.33 110.10 49.38 106.15 55.42 104.20 C61.48 102.24 67.52 102.53 73.57 101.61 C79.61 100.69 85.65 99.89 91.71 98.70 C97.75 97.51 103.80 95.67 109.84 94.47 C115.90 93.27 121.94 91.71 127.99 91.49 C134.03 91.26 140.09 91.53 146.13 93.16 C152.19 94.79 158.23 98.37 164.27 101.25 C170.32 104.13 176.36 108.16 182.42 110.45 C188.46 112.74 194.51 114.41 200.55 115.00 C206.61 115.60 212.65 114.56 218.70 114.03 C224.75 113.50 230.80 112.56 236.84 111.86 C242.88 111.17 248.94 110.27 254.98 109.87 C261.03 109.48 267.07 109.14 273.13 109.49 C279.17 109.82 285.22 110.90 291.26 111.90 C297.32 112.90 303.36 114.47 309.41 115.50 C315.46 116.54 321.50 118.12 327.55 118.11 C333.59 118.10 339.65 118.08 345.69 115.45 C351.74 112.81 357.78 107.02 363.84 102.29 C369.88 97.54 375.93 90.87 381.97 87.01 C388.03 83.16 394.07 79.81 400.11 79.12 C406.17 78.43 412.21 80.79 418.26 82.88 C424.30 84.99 430.36 88.88 436.40 91.74 C442.45 94.59 448.49 98.24 454.55 100.02 C460.59 101.80 466.64 102.08 472.68 102.44 C478.72 102.81 484.78 102.31 490.82 102.21 C496.87 102.11 502.92 101.95 508.97 101.84 C515.01 101.74 521.07 101.47 527.11 101.58 C533.16 101.68 539.20 101.57 545.26 102.48 C551.30 103.39 557.34 105.37 563.39 107.02 C569.43 108.68 575.49 111.02 581.53 112.40 C587.59 113.79 593.63 114.62 599.68 115.30 C605.72 115.98 611.78 115.81 617.82 116.48 C623.87 117.16 629.91 118.39 635.95 119.32 C642.01 120.25 648.05 121.51 654.10 122.04 C660.15 122.57 666.20 123.89 672.24 122.47 C678.30 121.07 684.34 117.39 690.39 113.54 C696.43 109.69 702.49 103.53 708.53 99.38 C714.57 95.23 722.31 90.65 726.66 88.61";
8
+ /**
9
+ * Transform that fits {@link PLACEHOLDER_LINE_PATH} into the drawing area. Pair
10
+ * with `vector-effect: non-scaling-stroke` on the path so the stroke keeps a
11
+ * constant width despite the (potentially non-uniform) scale.
12
+ */
13
+ export declare const buildPlaceholderTransform: (drawingArea: DrawingArea) => string;
14
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/LineChart/LineChartEmptyState/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,ypDACsnD,CAAC;AAKzpD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,aAAa,WAAW,KAAG,MAKpE,CAAC"}
@@ -0,0 +1,9 @@
1
+ const H = "M1.00 128.27 C4.02 127.46 13.09 125.96 19.13 123.47 C25.19 120.97 31.23 116.53 37.28 113.31 C43.33 110.10 49.38 106.15 55.42 104.20 C61.48 102.24 67.52 102.53 73.57 101.61 C79.61 100.69 85.65 99.89 91.71 98.70 C97.75 97.51 103.80 95.67 109.84 94.47 C115.90 93.27 121.94 91.71 127.99 91.49 C134.03 91.26 140.09 91.53 146.13 93.16 C152.19 94.79 158.23 98.37 164.27 101.25 C170.32 104.13 176.36 108.16 182.42 110.45 C188.46 112.74 194.51 114.41 200.55 115.00 C206.61 115.60 212.65 114.56 218.70 114.03 C224.75 113.50 230.80 112.56 236.84 111.86 C242.88 111.17 248.94 110.27 254.98 109.87 C261.03 109.48 267.07 109.14 273.13 109.49 C279.17 109.82 285.22 110.90 291.26 111.90 C297.32 112.90 303.36 114.47 309.41 115.50 C315.46 116.54 321.50 118.12 327.55 118.11 C333.59 118.10 339.65 118.08 345.69 115.45 C351.74 112.81 357.78 107.02 363.84 102.29 C369.88 97.54 375.93 90.87 381.97 87.01 C388.03 83.16 394.07 79.81 400.11 79.12 C406.17 78.43 412.21 80.79 418.26 82.88 C424.30 84.99 430.36 88.88 436.40 91.74 C442.45 94.59 448.49 98.24 454.55 100.02 C460.59 101.80 466.64 102.08 472.68 102.44 C478.72 102.81 484.78 102.31 490.82 102.21 C496.87 102.11 502.92 101.95 508.97 101.84 C515.01 101.74 521.07 101.47 527.11 101.58 C533.16 101.68 539.20 101.57 545.26 102.48 C551.30 103.39 557.34 105.37 563.39 107.02 C569.43 108.68 575.49 111.02 581.53 112.40 C587.59 113.79 593.63 114.62 599.68 115.30 C605.72 115.98 611.78 115.81 617.82 116.48 C623.87 117.16 629.91 118.39 635.95 119.32 C642.01 120.25 648.05 121.51 654.10 122.04 C660.15 122.57 666.20 123.89 672.24 122.47 C678.30 121.07 684.34 117.39 690.39 113.54 C696.43 109.69 702.49 103.53 708.53 99.38 C714.57 95.23 722.31 90.65 726.66 88.61";
2
+ const s = (C) => {
3
+ const E = C.width / 728, t = C.height / 208;
4
+ return `translate(${C.x}, ${C.y}) scale(${E}, ${t})`;
5
+ };
6
+ export {
7
+ H as PLACEHOLDER_LINE_PATH,
8
+ s as buildPlaceholderTransform
9
+ };