@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
@@ -23,6 +23,12 @@ export type BaseAxisProps = {
23
23
  * @default false
24
24
  */
25
25
  showTickMark?: boolean;
26
+ /**
27
+ * Whether to render the tick labels along the axis.
28
+ * Set to `false` to keep ticks/grid while hiding their text labels.
29
+ * @default true
30
+ */
31
+ showLabels?: boolean;
26
32
  /**
27
33
  * Explicit tick positions along the axis.
28
34
  * When omitted, ticks are computed automatically from the scale.
@@ -1 +1 @@
1
- {"version":3,"file":"Axis.types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Axis/Axis.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACxD;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,CAAC;IACpE;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC"}
1
+ {"version":3,"file":"Axis.types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Axis/Axis.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,MAAM,CAAC;IACxD;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IAC3B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,CAAC;IACpE;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { XAxisProps } from './types';
2
- export declare function XAxis({ gridLineStyle, position, showGrid, showLine, showTickMark, ticks: ticksProp, tickLabelFormatter, }: XAxisProps): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare function XAxis({ gridLineStyle, position, showGrid, showLine, showTickMark, showLabels, ticks: ticksProp, tickLabelFormatter, }: XAxisProps): import("react/jsx-runtime").JSX.Element | null;
3
3
  //# sourceMappingURL=XAxis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/XAxis/XAxis.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAmB,EACnB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAuFZ"}
1
+ {"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/XAxis/XAxis.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAmB,EACnB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,UAAiB,EACjB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAsFZ"}
@@ -1,27 +1,28 @@
1
- import { jsxs as A, jsx as a } from "react/jsx-runtime";
2
- import { useMemo as C } from "react";
3
- import { buildTicksData as T, isTickOnXAxisDomainEdge as $ } from "../../../utils/ticks/ticks.js";
4
- import { TICK_MARK_SIZE as y, TICK_LABEL_OFFSET as D } from "../Axis.constants.js";
5
- import { useCartesianChartContext as E } from "../../CartesianChart/context/cartesianChartContext.js";
1
+ import { jsxs as C, jsx as a } from "react/jsx-runtime";
2
+ import { useMemo as $ } from "react";
3
+ import { buildTicksData as S } from "../../../utils/ticks/ticks.js";
4
+ import { TICK_MARK_SIZE as y, TICK_LABEL_OFFSET as T } from "../Axis.constants.js";
5
+ import { useCartesianChartContext as D } from "../../CartesianChart/context/cartesianChartContext.js";
6
6
  import { cssVar as o } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
7
- function W({
8
- gridLineStyle: h = "solid",
7
+ function X({
8
+ gridLineStyle: u = "solid",
9
9
  position: l = "bottom",
10
- showGrid: u = !1,
10
+ showGrid: h = !1,
11
11
  showLine: c = !1,
12
12
  showTickMark: g = !1,
13
+ showLabels: v = !0,
13
14
  ticks: d,
14
15
  tickLabelFormatter: m
15
16
  }) {
16
- const { getXScale: v, getXAxisConfig: b, drawingArea: e } = E(), r = v(), x = b(), n = C(
17
- () => r ? T(r, x, d, m) : [],
18
- [r, x, d, m]
17
+ const { getXScale: b, getXAxisConfig: k, drawingArea: e } = D(), i = b(), x = k(), n = $(
18
+ () => i ? S(i, x, d, m) : [],
19
+ [i, x, d, m]
19
20
  );
20
- if (!r || e.width <= 0)
21
+ if (!i || e.width <= 0)
21
22
  return null;
22
- const f = l === "top", s = f ? e.y : e.y + e.height, p = f ? -1 : 1, k = s + p * (y + D);
23
- return /* @__PURE__ */ A("g", { "data-testid": "x-axis", children: [
24
- u && n.filter((t) => $(t, e)).map((t, i) => /* @__PURE__ */ a(
23
+ const f = l === "top", s = f ? e.y : e.y + e.height, p = f ? -1 : 1, A = s + p * (y + T);
24
+ return /* @__PURE__ */ C("g", { "data-testid": "x-axis", children: [
25
+ h && n.map((t, r) => /* @__PURE__ */ a(
25
26
  "line",
26
27
  {
27
28
  x1: t.position,
@@ -32,9 +33,9 @@ function W({
32
33
  stroke: o("var(--border-muted-subtle-transparent)")
33
34
  },
34
35
  strokeWidth: o("var(--stroke-1)"),
35
- strokeDasharray: h === "dashed" ? "3 3" : void 0
36
+ strokeDasharray: u === "dashed" ? "3 3" : void 0
36
37
  },
37
- `grid-${t.value}-${i}`
38
+ `grid-${t.value}-${r}`
38
39
  )),
39
40
  c && /* @__PURE__ */ a(
40
41
  "line",
@@ -49,7 +50,7 @@ function W({
49
50
  strokeLinecap: "square"
50
51
  }
51
52
  ),
52
- g && n.map((t, i) => /* @__PURE__ */ a(
53
+ g && n.map((t, r) => /* @__PURE__ */ a(
53
54
  "line",
54
55
  {
55
56
  x1: t.position,
@@ -59,13 +60,13 @@ function W({
59
60
  style: { stroke: o("var(--border-muted)") },
60
61
  strokeWidth: o("var(--stroke-1)")
61
62
  },
62
- `tick-${t.value}-${i}`
63
+ `tick-${t.value}-${r}`
63
64
  )),
64
- n.map((t, i) => /* @__PURE__ */ a(
65
+ v && n.map((t, r) => /* @__PURE__ */ a(
65
66
  "text",
66
67
  {
67
68
  x: t.position,
68
- y: k,
69
+ y: A,
69
70
  textAnchor: "middle",
70
71
  dominantBaseline: l === "top" ? "auto" : "hanging",
71
72
  style: {
@@ -75,10 +76,10 @@ function W({
75
76
  },
76
77
  children: t.label
77
78
  },
78
- `label-${t.value}-${i}`
79
+ `label-${t.value}-${r}`
79
80
  ))
80
81
  ] });
81
82
  }
82
83
  export {
83
- W as XAxis
84
+ X as XAxis
84
85
  };
@@ -1,3 +1,3 @@
1
1
  import { YAxisProps } from './types';
2
- export declare function YAxis({ gridLineStyle, position, showGrid, showLine, showTickMark, ticks: ticksProp, tickLabelFormatter, }: YAxisProps): import("react/jsx-runtime").JSX.Element | null;
2
+ export declare function YAxis({ gridLineStyle, position, showGrid, showLine, showTickMark, showLabels, ticks: ticksProp, tickLabelFormatter, }: YAxisProps): import("react/jsx-runtime").JSX.Element | null;
3
3
  //# sourceMappingURL=YAxis.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAkB,EAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAuFZ"}
1
+ {"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAkB,EAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,UAAiB,EACjB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAsFZ"}
@@ -1,27 +1,28 @@
1
- import { jsxs as A, jsx as a } from "react/jsx-runtime";
2
- import { useMemo as C } from "react";
3
- import { buildTicksData as S, isTickOnYAxisDomainEdge as $ } from "../../../utils/ticks/ticks.js";
4
- import { TICK_MARK_SIZE as c, TICK_LABEL_OFFSET as D } from "../Axis.constants.js";
1
+ import { jsxs as C, jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as S } from "react";
3
+ import { buildTicksData as $ } from "../../../utils/ticks/ticks.js";
4
+ import { TICK_MARK_SIZE as p, TICK_LABEL_OFFSET as D } from "../Axis.constants.js";
5
5
  import { useCartesianChartContext as E } from "../../CartesianChart/context/cartesianChartContext.js";
6
- import { cssVar as s } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
7
- function W({
8
- gridLineStyle: p = "solid",
6
+ import { cssVar as r } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
7
+ function Y({
8
+ gridLineStyle: u = "solid",
9
9
  position: l = "start",
10
- showGrid: h = !1,
11
- showLine: u = !1,
10
+ showGrid: c = !1,
11
+ showLine: h = !1,
12
12
  showTickMark: v = !1,
13
+ showLabels: g = !0,
13
14
  ticks: d,
14
15
  tickLabelFormatter: x
15
16
  }) {
16
- const { getYScale: g, getYAxisConfig: k, drawingArea: e } = E(), i = g(), m = k(), n = C(
17
- () => i ? S(i, m, d, x) : [],
18
- [i, m, d, x]
17
+ const { getYScale: b, getYAxisConfig: k, drawingArea: e } = E(), a = b(), m = k(), n = S(
18
+ () => a ? $(a, m, d, x) : [],
19
+ [a, m, d, x]
19
20
  );
20
- if (!i || e.height <= 0)
21
+ if (!a || e.height <= 0)
21
22
  return null;
22
- const f = l === "start", r = f ? e.x : e.x + e.width, y = f ? -1 : 1, b = r + y * (c + D);
23
- return /* @__PURE__ */ A("g", { "data-testid": "y-axis", children: [
24
- h && n.filter((t) => $(t, e)).map((t, o) => /* @__PURE__ */ a(
23
+ const y = l === "start", s = y ? e.x : e.x + e.width, f = y ? -1 : 1, A = s + f * (p + D);
24
+ return /* @__PURE__ */ C("g", { "data-testid": "y-axis", children: [
25
+ c && n.map((t, o) => /* @__PURE__ */ i(
25
26
  "line",
26
27
  {
27
28
  x1: e.x,
@@ -29,49 +30,49 @@ function W({
29
30
  x2: e.x + e.width,
30
31
  y2: t.position,
31
32
  style: {
32
- stroke: s("var(--border-muted-subtle-transparent)")
33
+ stroke: r("var(--border-muted-subtle-transparent)")
33
34
  },
34
- strokeWidth: s("var(--stroke-1)"),
35
- strokeDasharray: p === "dashed" ? "3 3" : void 0
35
+ strokeWidth: r("var(--stroke-1)"),
36
+ strokeDasharray: u === "dashed" ? "3 3" : void 0
36
37
  },
37
38
  `grid-${t.value}-${o}`
38
39
  )),
39
- u && /* @__PURE__ */ a(
40
+ h && /* @__PURE__ */ i(
40
41
  "line",
41
42
  {
42
- x1: r,
43
+ x1: s,
43
44
  y1: e.y,
44
- x2: r,
45
+ x2: s,
45
46
  y2: e.y + e.height,
46
- style: { stroke: s("var(--border-muted)") },
47
- strokeWidth: s("var(--stroke-1)"),
47
+ style: { stroke: r("var(--border-muted)") },
48
+ strokeWidth: r("var(--stroke-1)"),
48
49
  shapeRendering: "crispEdges",
49
50
  strokeLinecap: "square"
50
51
  }
51
52
  ),
52
- v && n.map((t, o) => /* @__PURE__ */ a(
53
+ v && n.map((t, o) => /* @__PURE__ */ i(
53
54
  "line",
54
55
  {
55
- x1: r,
56
+ x1: s,
56
57
  y1: t.position,
57
- x2: r + y * c,
58
+ x2: s + f * p,
58
59
  y2: t.position,
59
- style: { stroke: s("var(--border-muted)") },
60
- strokeWidth: s("var(--stroke-1)")
60
+ style: { stroke: r("var(--border-muted)") },
61
+ strokeWidth: r("var(--stroke-1)")
61
62
  },
62
63
  `tick-${t.value}-${o}`
63
64
  )),
64
- n.map((t, o) => /* @__PURE__ */ a(
65
+ g && n.map((t, o) => /* @__PURE__ */ i(
65
66
  "text",
66
67
  {
67
- x: b,
68
+ x: A,
68
69
  y: t.position,
69
70
  textAnchor: l === "start" ? "end" : "start",
70
71
  dominantBaseline: "central",
71
72
  style: {
72
- fill: s("var(--text-muted)"),
73
- fontSize: s("var(--font-style-body-4-size)"),
74
- fontFamily: s("var(--font-family-font)")
73
+ fill: r("var(--text-muted)"),
74
+ fontSize: r("var(--font-style-body-4-size)"),
75
+ fontFamily: r("var(--font-family-font)")
75
76
  },
76
77
  children: t.label
77
78
  },
@@ -80,5 +81,5 @@ function W({
80
81
  ] });
81
82
  }
82
83
  export {
83
- W as YAxis
84
+ Y as YAxis
84
85
  };
@@ -1,3 +1,3 @@
1
1
  import { CartesianChartProps } from './types';
2
- export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, enableScrubbing, onScrubberPositionChange, animate, magnetRadius, children, }: CartesianChartProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, ariaBusy, overlay: htmlOverlay, enableScrubbing, onScrubberPositionChange, animate, magnetRadius, children, }: CartesianChartProps): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=CartesianChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AASnD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAuB,EACvB,KAAK,EACL,WAAW,EACX,SAAmB,EACnB,eAAuB,EACvB,wBAAwB,EACxB,OAAc,EACd,YAAY,EACZ,QAAQ,GACT,EAAE,mBAAmB,2CA0GrB"}
1
+ {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAuB,EACvB,KAAK,EACL,WAAW,EACX,SAAmB,EACnB,QAAgB,EAChB,OAAO,EAAE,WAAW,EACpB,eAAuB,EACvB,wBAAwB,EACxB,OAAc,EACd,YAAY,EACZ,QAAQ,GACT,EAAE,mBAAmB,2CAuGrB"}
@@ -1,99 +1,106 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { useRef as R, useState as M, useCallback as z, useEffect as H, useMemo as b } from "react";
3
- import { ScrubberProvider as L } from "../Scrubber/ScrubberProvider.js";
4
- import { resolveInset as T, resolveAxisPadding as V, DEFAULT_HEIGHT as _, OVERFLOW_OFFSET as k, OVERFLOW_BUFFER as s } from "./utils.js";
5
- import { useBuildChartContext as B } from "./context/useBuildChartContext.js";
6
- import { CartesianChartProvider as D } from "./context/cartesianChartContext.js";
7
- import { MagneticPointsProvider as U } from "../Point/pointContext/MagneticPointsProvider.js";
8
- import { RevealClipDefs as j } from "./RevealClip/RevealClipDefs.js";
9
- function Y({
10
- series: a,
11
- xAxis: C,
12
- yAxis: y,
1
+ import { jsx as r, jsxs as j, Fragment as k } from "react/jsx-runtime";
2
+ import { useRef as h, useState as F, useCallback as H, useEffect as O, useMemo as b } from "react";
3
+ import { ScrubberProvider as T } from "../Scrubber/ScrubberProvider.js";
4
+ import { resolveInset as B, resolveAxisPadding as D, DEFAULT_HEIGHT as G } from "./utils.js";
5
+ import { useBuildChartContext as L } from "./context/useBuildChartContext.js";
6
+ import { CartesianChartProvider as U } from "./context/cartesianChartContext.js";
7
+ import { MagneticPointsProvider as V } from "../Point/pointContext/MagneticPointsProvider.js";
8
+ import { RevealAnimationProvider as _ } from "./RevealAnimation/RevealAnimationProvider.js";
9
+ function Z({
10
+ series: d,
11
+ xAxis: y,
12
+ yAxis: C,
13
13
  width: e = "100%",
14
- height: l = _,
15
- inset: c,
16
- axisPadding: f,
14
+ height: n = G,
15
+ inset: l,
16
+ axisPadding: c,
17
17
  ariaLabel: x = "Chart",
18
- enableScrubbing: i = !1,
19
- onScrubberPositionChange: E,
20
- animate: F = !0,
21
- magnetRadius: O,
22
- children: P
18
+ ariaBusy: R = !1,
19
+ overlay: g,
20
+ enableScrubbing: s = !1,
21
+ onScrubberPositionChange: P,
22
+ animate: A = !0,
23
+ magnetRadius: w,
24
+ children: I
23
25
  }) {
24
- const d = R(null), v = R(null), [W, A] = M(
26
+ const a = h(null), v = h(null), [M, W] = F(
25
27
  typeof e == "number" ? e : void 0
26
- ), r = typeof e != "number", u = z((n) => {
27
- const [g] = n;
28
- g && A(g.contentRect.width);
28
+ ), t = typeof e != "number", f = H((i) => {
29
+ const [p] = i;
30
+ p && W(p.contentRect.width);
29
31
  }, []);
30
- H(() => {
31
- if (!r || !d.current || typeof ResizeObserver > "u")
32
+ O(() => {
33
+ if (!t || !a.current || typeof ResizeObserver > "u")
32
34
  return;
33
- const n = new ResizeObserver(u);
34
- return n.observe(d.current), () => n.disconnect();
35
- }, [r, u]);
36
- const o = typeof e == "number" ? e : W ?? 0, m = o > 0 ? o + s.left + s.right : 0, h = l + s.top + s.bottom, w = b(() => T(c), [c]), I = b(
37
- () => V(f),
38
- [f]
39
- ), p = B({
40
- series: a,
41
- xAxis: C,
42
- yAxis: y,
43
- width: m,
44
- height: h,
45
- inset: w,
46
- axisPadding: I
35
+ const i = new ResizeObserver(f);
36
+ return i.observe(a.current), () => i.disconnect();
37
+ }, [t, f]);
38
+ const o = typeof e == "number" ? e : M ?? 0, u = o > 0 ? o : 0, z = b(() => B(l), [l]), E = b(
39
+ () => D(c),
40
+ [c]
41
+ ), m = L({
42
+ series: d,
43
+ xAxis: y,
44
+ yAxis: C,
45
+ width: u,
46
+ height: n,
47
+ inset: z,
48
+ axisPadding: E
47
49
  });
48
- return /* @__PURE__ */ t(
50
+ return /* @__PURE__ */ r(
49
51
  "div",
50
52
  {
51
- ref: r ? d : void 0,
53
+ ref: t ? a : void 0,
52
54
  "data-testid": "chart-container",
53
55
  style: {
54
- width: r ? e : o,
55
- height: l,
56
- overflow: "visible"
56
+ width: t ? e : o,
57
+ height: n,
58
+ overflow: "visible",
59
+ position: "relative"
57
60
  },
58
- children: o > 0 && /* @__PURE__ */ t(
59
- "svg",
60
- {
61
- ref: v,
62
- "data-testid": "chart-svg",
63
- width: m,
64
- height: h,
65
- role: "img",
66
- "aria-label": x || "Chart",
67
- tabIndex: i ? 0 : void 0,
68
- style: {
69
- display: "block",
70
- overflow: "visible",
71
- outline: i ? "none" : void 0,
72
- ...k
73
- },
74
- children: /* @__PURE__ */ t(D, { value: p, children: /* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(
75
- L,
76
- {
77
- svgRef: v,
78
- enableScrubbing: i,
79
- onScrubberPositionChange: E,
80
- magnetRadius: O,
81
- children: /* @__PURE__ */ t(
82
- j,
83
- {
84
- drawingArea: p.drawingArea,
85
- series: a,
86
- animate: F,
87
- children: P
88
- }
89
- )
90
- }
91
- ) }) })
92
- }
93
- )
61
+ children: o > 0 && /* @__PURE__ */ j(k, { children: [
62
+ /* @__PURE__ */ r(
63
+ "svg",
64
+ {
65
+ ref: v,
66
+ "data-testid": "chart-svg",
67
+ width: u,
68
+ height: n,
69
+ role: "img",
70
+ "aria-label": x || "Chart",
71
+ "aria-busy": R || void 0,
72
+ tabIndex: s ? 0 : void 0,
73
+ style: {
74
+ display: "block",
75
+ overflow: "visible",
76
+ position: "relative",
77
+ outline: s ? "none" : void 0
78
+ },
79
+ children: /* @__PURE__ */ r(U, { value: m, children: /* @__PURE__ */ r(V, { children: /* @__PURE__ */ r(
80
+ T,
81
+ {
82
+ svgRef: v,
83
+ enableScrubbing: s,
84
+ onScrubberPositionChange: P,
85
+ magnetRadius: w,
86
+ children: /* @__PURE__ */ r(
87
+ _,
88
+ {
89
+ drawingArea: m.drawingArea,
90
+ series: d,
91
+ animate: A,
92
+ children: I
93
+ }
94
+ )
95
+ }
96
+ ) }) })
97
+ }
98
+ ),
99
+ g
100
+ ] })
94
101
  }
95
102
  );
96
103
  }
97
104
  export {
98
- Y as CartesianChart
105
+ Z as CartesianChart
99
106
  };
@@ -0,0 +1,11 @@
1
+ import { PropsWithChildren } from 'react';
2
+ type ChartEmptyLabelProps = PropsWithChildren;
3
+ /**
4
+ * Centred HTML overlay label shown when a chart has no data (and is not
5
+ * loading). Rendered through the `overlay` prop of `CartesianChart` so it shares
6
+ * the chart's positioned container and aligns with the chart footprint. Shared
7
+ * across cartesian charts.
8
+ */
9
+ export declare function ChartEmptyLabel({ children }: Readonly<ChartEmptyLabelProps>): import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=ChartEmptyLabel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartEmptyLabel.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/ChartEmptyLabel/ChartEmptyLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE/C,KAAK,oBAAoB,GAAG,iBAAiB,CAAC;AAE9C;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,oBAAoB,CAAC,2CAc3E"}
@@ -0,0 +1,21 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ function n({ children: t }) {
3
+ return /* @__PURE__ */ e(
4
+ "div",
5
+ {
6
+ "aria-hidden": "true",
7
+ className: "pointer-events-none absolute inset-0 flex items-center justify-center",
8
+ children: /* @__PURE__ */ e(
9
+ "span",
10
+ {
11
+ "data-testid": "chart-empty-label",
12
+ className: "animate-fade-in rounded-xs bg-muted px-12 py-6 body-3 text-muted",
13
+ children: t
14
+ }
15
+ )
16
+ }
17
+ );
18
+ }
19
+ export {
20
+ n as ChartEmptyLabel
21
+ };
@@ -0,0 +1,3 @@
1
+ import { RevealAnimationProps } from './types';
2
+ export declare function RevealAnimationProvider({ children, drawingArea, series, animate, transitions, }: RevealAnimationProps): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=RevealAnimationProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RevealAnimationProvider.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealAnimation/RevealAnimationProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAMpD,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,WAAW,EACX,MAAM,EACN,OAAc,EACd,WAAW,GACZ,EAAE,oBAAoB,2CA0CtB"}
@@ -0,0 +1,41 @@
1
+ import { jsx as e, Fragment as f, jsxs as y } from "react/jsx-runtime";
2
+ import { useMemo as v } from "react";
3
+ import { RevealAnimationContext as x } from "./context.js";
4
+ import { useDataFingerprint as P, useRevealAnimation as A } from "./utils.js";
5
+ const D = 0.8, R = "linear";
6
+ function I({
7
+ children: n,
8
+ drawingArea: t,
9
+ series: l,
10
+ animate: s = !0,
11
+ transitions: o
12
+ }) {
13
+ const c = !s, m = o?.enter?.duration ?? D, h = o?.enter?.easing ?? R, d = P({ series: l }), { clipId: p, clipPathAttr: r, clipPathAnimation: a, fadeAnimation: i } = A({
14
+ duration: m,
15
+ easing: h,
16
+ drawingArea: t
17
+ }), u = v(
18
+ () => ({
19
+ clipPathAttr: r,
20
+ getPointRevealStyle: i.getPointRevealStyle
21
+ }),
22
+ [r, i]
23
+ );
24
+ return c ? /* @__PURE__ */ e(f, { children: n }) : /* @__PURE__ */ y(x.Provider, { value: u, children: [
25
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ e("clipPath", { id: p, children: /* @__PURE__ */ e(
26
+ "rect",
27
+ {
28
+ x: t.x,
29
+ y: t.y,
30
+ height: t.height,
31
+ width: t.width,
32
+ style: { animation: a.style }
33
+ }
34
+ ) }) }),
35
+ /* @__PURE__ */ e("style", { children: `${a.keyframe} ${i.keyframe}` }),
36
+ n
37
+ ] }, d);
38
+ }
39
+ export {
40
+ I as RevealAnimationProvider
41
+ };
@@ -0,0 +1,15 @@
1
+ import { CSSProperties } from 'react';
2
+ import { RevealAnimationContextValue } from './types';
3
+ export declare const RevealAnimationContext: import('react').Context<RevealAnimationContextValue | undefined>;
4
+ /**
5
+ * Clip-path attribute for path-based consumers (e.g. `Line`).
6
+ * Returns `undefined` when the reveal animation is disabled.
7
+ */
8
+ export declare const usePathReveal: () => string | undefined;
9
+ /**
10
+ * Opacity fade-in style for accessory consumers (e.g. `Point`). Returns
11
+ * `undefined` when the reveal animation is disabled, leaving the consumer fully
12
+ * visible.
13
+ */
14
+ export declare const usePointReveal: () => CSSProperties | undefined;
15
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealAnimation/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAE3D,eAAO,MAAM,sBAAsB,kEAEvB,CAAC;AAEb;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,SAEzC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,aAAa,GAAG,SAGjD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { useContext as e, createContext as n, useMemo as r } from "react";
2
+ const o = n(void 0), s = () => e(o)?.clipPathAttr, c = () => {
3
+ const t = e(o);
4
+ return r(() => t?.getPointRevealStyle(), [t]);
5
+ };
6
+ export {
7
+ o as RevealAnimationContext,
8
+ s as usePathReveal,
9
+ c as usePointReveal
10
+ };
@@ -0,0 +1,3 @@
1
+ export { RevealAnimationProvider } from './RevealAnimationProvider';
2
+ export { usePathReveal, usePointReveal } from './context';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/CartesianChart/RevealAnimation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC"}