@ledgerhq/lumen-ui-react-visualization 0.1.9 → 0.1.11

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 (55) hide show
  1. package/dist/index.js +11 -5
  2. package/dist/lib/Components/Axis/XAxis/XAxis.d.ts.map +1 -1
  3. package/dist/lib/Components/Axis/XAxis/XAxis.js +7 -5
  4. package/dist/lib/Components/Axis/YAxis/YAxis.d.ts.map +1 -1
  5. package/dist/lib/Components/Axis/YAxis/YAxis.js +8 -6
  6. package/dist/lib/Components/CartesianChart/CartesianChart.d.ts +1 -1
  7. package/dist/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
  8. package/dist/lib/Components/CartesianChart/CartesianChart.js +67 -50
  9. package/dist/lib/Components/CartesianChart/types.d.ts +11 -0
  10. package/dist/lib/Components/CartesianChart/types.d.ts.map +1 -1
  11. package/dist/lib/Components/ChartTooltip/ChartTooltip.d.ts +23 -0
  12. package/dist/lib/Components/ChartTooltip/ChartTooltip.d.ts.map +1 -0
  13. package/dist/lib/Components/ChartTooltip/ChartTooltip.js +81 -0
  14. package/dist/lib/Components/ChartTooltip/ChartTooltipItem.d.ts +3 -0
  15. package/dist/lib/Components/ChartTooltip/ChartTooltipItem.d.ts.map +1 -0
  16. package/dist/lib/Components/ChartTooltip/ChartTooltipItem.js +46 -0
  17. package/dist/lib/Components/ChartTooltip/constants.d.ts +10 -0
  18. package/dist/lib/Components/ChartTooltip/constants.d.ts.map +1 -0
  19. package/dist/lib/Components/ChartTooltip/constants.js +12 -0
  20. package/dist/lib/Components/ChartTooltip/index.d.ts +3 -0
  21. package/dist/lib/Components/ChartTooltip/index.d.ts.map +1 -0
  22. package/dist/lib/Components/ChartTooltip/types.d.ts +61 -0
  23. package/dist/lib/Components/ChartTooltip/types.d.ts.map +1 -0
  24. package/dist/lib/Components/Line/Line.js +1 -1
  25. package/dist/lib/Components/LineChart/LineChart.d.ts +1 -1
  26. package/dist/lib/Components/LineChart/LineChart.d.ts.map +1 -1
  27. package/dist/lib/Components/LineChart/LineChart.js +38 -34
  28. package/dist/lib/Components/LineChart/types.d.ts +11 -0
  29. package/dist/lib/Components/LineChart/types.d.ts.map +1 -1
  30. package/dist/lib/Components/Scrubber/Scrubber.d.ts +17 -0
  31. package/dist/lib/Components/Scrubber/Scrubber.d.ts.map +1 -0
  32. package/dist/lib/Components/Scrubber/Scrubber.js +134 -0
  33. package/dist/lib/Components/Scrubber/ScrubberProvider.d.ts +3 -0
  34. package/dist/lib/Components/Scrubber/ScrubberProvider.d.ts.map +1 -0
  35. package/dist/lib/Components/Scrubber/ScrubberProvider.js +122 -0
  36. package/dist/lib/Components/Scrubber/context/index.d.ts +2 -0
  37. package/dist/lib/Components/Scrubber/context/index.d.ts.map +1 -0
  38. package/dist/lib/Components/Scrubber/context/scrubberContext.d.ts +8 -0
  39. package/dist/lib/Components/Scrubber/context/scrubberContext.d.ts.map +1 -0
  40. package/dist/lib/Components/Scrubber/context/scrubberContext.js +9 -0
  41. package/dist/lib/Components/Scrubber/index.d.ts +4 -0
  42. package/dist/lib/Components/Scrubber/index.d.ts.map +1 -0
  43. package/dist/lib/Components/Scrubber/types.d.ts +53 -0
  44. package/dist/lib/Components/Scrubber/types.d.ts.map +1 -0
  45. package/dist/lib/Components/Scrubber/utils.d.ts +30 -0
  46. package/dist/lib/Components/Scrubber/utils.d.ts.map +1 -0
  47. package/dist/lib/Components/Scrubber/utils.js +57 -0
  48. package/dist/lib/Components/index.d.ts +2 -0
  49. package/dist/lib/Components/index.d.ts.map +1 -1
  50. package/dist/lib/utils/scales/scales.d.ts +5 -0
  51. package/dist/lib/utils/scales/scales.d.ts.map +1 -1
  52. package/dist/lib/utils/scales/scales.js +19 -18
  53. package/dist/libs/utils-shared/dist/index.js +13 -13
  54. package/dist/package.json +3 -3
  55. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,7 +1,13 @@
1
- import { LineChart as t } from "./lib/Components/LineChart/LineChart.js";
2
- import { Point as i, PointLabel as n } from "./lib/Components/Point/Point.js";
1
+ import { ChartTooltip as t } from "./lib/Components/ChartTooltip/ChartTooltip.js";
2
+ import { LineChart as p } from "./lib/Components/LineChart/LineChart.js";
3
+ import { Point as b, PointLabel as f } from "./lib/Components/Point/Point.js";
4
+ import { Scrubber as i } from "./lib/Components/Scrubber/Scrubber.js";
5
+ import { useScrubberContext as a } from "./lib/Components/Scrubber/context/scrubberContext.js";
3
6
  export {
4
- t as LineChart,
5
- i as Point,
6
- n as PointLabel
7
+ t as ChartTooltip,
8
+ p as LineChart,
9
+ b as Point,
10
+ f as PointLabel,
11
+ i as Scrubber,
12
+ a as useScrubberContext
7
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/XAxis/XAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,wBAAgB,KAAK,CAAC,EACpB,aAAwB,EACxB,QAAmB,EACnB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAqFZ"}
1
+ {"version":3,"file":"XAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/XAxis/XAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAmB,EACnB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAuFZ"}
@@ -5,9 +5,9 @@ import { useCartesianChartContext as D } from "../../CartesianChart/context/cart
5
5
  import { cssVar as o } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
6
6
  const c = 4, S = 6, F = 28;
7
7
  function K({
8
- gridLineStyle: h = "dashed",
8
+ gridLineStyle: p = "solid",
9
9
  position: l = "bottom",
10
- showGrid: p = !1,
10
+ showGrid: h = !1,
11
11
  showLine: u = !1,
12
12
  showTickMark: g = !1,
13
13
  ticks: d,
@@ -21,16 +21,18 @@ function K({
21
21
  return null;
22
22
  const f = l === "top", s = f ? e.y : e.y + e.height, y = f ? -1 : 1, b = s + y * (c + S);
23
23
  return /* @__PURE__ */ k("g", { "data-testid": "x-axis", children: [
24
- p && n.filter((t) => E(t, e)).map((t, i) => /* @__PURE__ */ a(
24
+ h && n.filter((t) => E(t, e)).map((t, i) => /* @__PURE__ */ a(
25
25
  "line",
26
26
  {
27
27
  x1: t.position,
28
28
  y1: e.y,
29
29
  x2: t.position,
30
30
  y2: e.y + e.height,
31
- style: { stroke: o("var(--border-muted-subtle)") },
31
+ style: {
32
+ stroke: o("var(--border-muted-subtle-transparent)")
33
+ },
32
34
  strokeWidth: o("var(--stroke-1)"),
33
- strokeDasharray: h === "dashed" ? "3 3" : void 0
35
+ strokeDasharray: p === "dashed" ? "3 3" : void 0
34
36
  },
35
37
  `grid-${t.value}-${i}`
36
38
  )),
@@ -1 +1 @@
1
- {"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,wBAAgB,KAAK,CAAC,EACpB,aAAwB,EACxB,QAAkB,EAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAqFZ"}
1
+ {"version":3,"file":"YAxis.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Axis/YAxis/YAxis.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAI1C,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,wBAAgB,KAAK,CAAC,EACpB,aAAuB,EACvB,QAAkB,EAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,KAAK,EAAE,SAAS,EAChB,kBAAkB,GACnB,EAAE,UAAU,kDAuFZ"}
@@ -5,10 +5,10 @@ import { useCartesianChartContext as T } from "../../CartesianChart/context/cart
5
5
  import { cssVar as s } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
6
6
  const f = 4, E = 6, w = 40;
7
7
  function F({
8
- gridLineStyle: h = "dashed",
8
+ gridLineStyle: h = "solid",
9
9
  position: l = "start",
10
- showGrid: u = !1,
11
- showLine: p = !1,
10
+ showGrid: p = !1,
11
+ showLine: u = !1,
12
12
  showTickMark: v = !1,
13
13
  ticks: d,
14
14
  tickLabelFormatter: x
@@ -21,20 +21,22 @@ function F({
21
21
  return null;
22
22
  const y = l === "start", r = y ? e.x : e.x + e.width, c = y ? -1 : 1, k = r + c * (f + E);
23
23
  return /* @__PURE__ */ b("g", { "data-testid": "y-axis", children: [
24
- u && n.filter((t) => S(t, e)).map((t, o) => /* @__PURE__ */ a(
24
+ p && n.filter((t) => S(t, e)).map((t, o) => /* @__PURE__ */ a(
25
25
  "line",
26
26
  {
27
27
  x1: e.x,
28
28
  y1: t.position,
29
29
  x2: e.x + e.width,
30
30
  y2: t.position,
31
- style: { stroke: s("var(--border-muted-subtle)") },
31
+ style: {
32
+ stroke: s("var(--border-muted-subtle-transparent)")
33
+ },
32
34
  strokeWidth: s("var(--stroke-1)"),
33
35
  strokeDasharray: h === "dashed" ? "3 3" : void 0
34
36
  },
35
37
  `grid-${t.value}-${o}`
36
38
  )),
37
- p && /* @__PURE__ */ a(
39
+ u && /* @__PURE__ */ a(
38
40
  "line",
39
41
  {
40
42
  x1: r,
@@ -1,3 +1,3 @@
1
1
  import { CartesianChartProps } from './types';
2
- export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, children, }: CartesianChartProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function CartesianChart({ series, xAxis, yAxis, width, height, inset, axisPadding, ariaLabel, enableScrubbing, onScrubberPositionChange, 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":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQnD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAuB,EACvB,KAAK,EACL,WAAW,EACX,SAAmB,EACnB,QAAQ,GACT,EAAE,mBAAmB,2CA2FrB"}
1
+ {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/CartesianChart.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAQnD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAuB,EACvB,KAAK,EACL,WAAW,EACX,SAAmB,EACnB,eAAuB,EACvB,wBAAwB,EACxB,QAAQ,GACT,EAAE,mBAAmB,2CA4GrB"}
@@ -1,79 +1,96 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { useRef as I, useState as M, useCallback as O, useEffect as W, useMemo as v } from "react";
3
- import { resolveInset as g, resolveAxisPadding as z, OVERFLOW_NEGATIVE_MARGIN as m, DEFAULT_HEIGHT as G } from "./utils.js";
4
- import { useBuildChartContext as P } from "./context/useBuildChartContext.js";
5
- import { CartesianChartProvider as T } from "./context/cartesianChartContext.js";
6
- function L({
7
- series: b,
8
- xAxis: p,
9
- yAxis: C,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useRef as C, useState as W, useCallback as z, useEffect as G, useMemo as y } from "react";
3
+ import { ScrubberProvider as T } from "../Scrubber/ScrubberProvider.js";
4
+ import { resolveInset as V, resolveAxisPadding as _, OVERFLOW_NEGATIVE_MARGIN as R, DEFAULT_HEIGHT as k } from "./utils.js";
5
+ import { useBuildChartContext as F } from "./context/useBuildChartContext.js";
6
+ import { CartesianChartProvider as H } from "./context/cartesianChartContext.js";
7
+ function D({
8
+ series: h,
9
+ xAxis: x,
10
+ yAxis: E,
10
11
  width: e = "100%",
11
- height: t = G,
12
+ height: r = k,
12
13
  inset: a,
13
- axisPadding: d,
14
- ariaLabel: y = "Chart",
15
- children: h
14
+ axisPadding: c,
15
+ ariaLabel: I = "Chart",
16
+ enableScrubbing: o = !1,
17
+ onScrubberPositionChange: b,
18
+ children: l
16
19
  }) {
17
- const s = I(null), [c, R] = M(
20
+ const n = C(null), f = C(null), [u, A] = W(
18
21
  typeof e == "number" ? e : void 0
19
- ), o = typeof e != "number", l = O((r) => {
20
- const [f] = r;
21
- f && R(f.contentRect.width);
22
+ ), i = typeof e != "number", v = z((s) => {
23
+ const [p] = s;
24
+ p && A(p.contentRect.width);
22
25
  }, []);
23
- W(() => {
24
- if (!o || !s.current || typeof ResizeObserver > "u")
26
+ G(() => {
27
+ if (!i || !n.current || typeof ResizeObserver > "u")
25
28
  return;
26
- const r = new ResizeObserver(l);
27
- return r.observe(s.current), () => r.disconnect();
28
- }, [o, l]);
29
- const i = typeof e == "number" ? e : c ?? 0, x = v(() => g(a), [a]), E = v(
30
- () => z(d),
31
- [d]
32
- ), A = P({
33
- series: b,
34
- xAxis: p,
35
- yAxis: C,
36
- width: i,
37
- height: t,
38
- inset: x,
39
- axisPadding: E
40
- }), u = /* @__PURE__ */ n(
29
+ const s = new ResizeObserver(v);
30
+ return s.observe(n.current), () => s.disconnect();
31
+ }, [i, v]);
32
+ const d = typeof e == "number" ? e : u ?? 0, M = y(() => V(a), [a]), O = y(
33
+ () => _(c),
34
+ [c]
35
+ ), P = F({
36
+ series: h,
37
+ xAxis: x,
38
+ yAxis: E,
39
+ width: d,
40
+ height: r,
41
+ inset: M,
42
+ axisPadding: O
43
+ }), m = /* @__PURE__ */ t(
41
44
  "svg",
42
45
  {
46
+ ref: f,
43
47
  "data-testid": "chart-svg",
44
- width: i,
45
- height: t,
48
+ width: d,
49
+ height: r,
46
50
  role: "img",
47
- "aria-label": y || "Chart",
48
- style: { display: "block", overflow: "visible" },
49
- children: /* @__PURE__ */ n(T, { value: A, children: h })
51
+ "aria-label": I || "Chart",
52
+ tabIndex: o ? 0 : void 0,
53
+ style: {
54
+ display: "block",
55
+ overflow: "visible",
56
+ outline: o ? "none" : void 0
57
+ },
58
+ children: /* @__PURE__ */ t(H, { value: P, children: o ? /* @__PURE__ */ t(
59
+ T,
60
+ {
61
+ svgRef: f,
62
+ enableScrubbing: o,
63
+ onScrubberPositionChange: b,
64
+ children: l
65
+ }
66
+ ) : l })
50
67
  }
51
68
  );
52
- return o ? /* @__PURE__ */ n(
69
+ return i ? /* @__PURE__ */ t(
53
70
  "div",
54
71
  {
55
- ref: s,
72
+ ref: n,
56
73
  "data-testid": "chart-container",
57
74
  style: {
58
75
  width: e,
59
- height: t,
60
- ...m
76
+ height: r,
77
+ ...R
61
78
  },
62
- children: c !== void 0 && u
79
+ children: u !== void 0 && m
63
80
  }
64
- ) : /* @__PURE__ */ n(
81
+ ) : /* @__PURE__ */ t(
65
82
  "div",
66
83
  {
67
84
  "data-testid": "chart-container",
68
85
  style: {
69
- width: i,
70
- height: t,
71
- ...m
86
+ width: d,
87
+ height: r,
88
+ ...R
72
89
  },
73
- children: u
90
+ children: m
74
91
  }
75
92
  );
76
93
  }
77
94
  export {
78
- L as CartesianChart
95
+ D as CartesianChart
79
96
  };
@@ -46,5 +46,16 @@ export type CartesianChartProps = {
46
46
  * SVG content rendered inside the chart's context provider.
47
47
  */
48
48
  children?: ReactNode;
49
+ /**
50
+ * Enables scrubbing (hover/touch/keyboard) interactions on the chart.
51
+ * When true, the SVG becomes focusable and captures pointer/keyboard events.
52
+ * @default false
53
+ */
54
+ enableScrubbing?: boolean;
55
+ /**
56
+ * Callback fired whenever the scrubber moves to a new data index or is cleared.
57
+ * Receives `undefined` when the scrubber leaves the chart.
58
+ */
59
+ onScrubberPositionChange?: (index: number | undefined) => void;
49
60
  };
50
61
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/CartesianChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE7E,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { ChartTooltipProps } from './types';
2
+ /**
3
+ * Renders a structured tooltip anchored to the scrubber line.
4
+ *
5
+ * Visible at every scrubber position by default. To limit which positions
6
+ * show a tooltip, return an empty array from `items` for unwanted indices.
7
+ *
8
+ * Must be used as a child of `LineChart` (or `CartesianChart`) with
9
+ * `enableScrubbing` enabled.
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ * <LineChart series={series} enableScrubbing>
14
+ * <Scrubber />
15
+ * <ChartTooltip
16
+ * title={(i) => `${count[i]} Transactions`}
17
+ * items={(i) => [{ label: 'Index', value: i }]}
18
+ * />
19
+ * </LineChart>
20
+ * ```
21
+ */
22
+ export declare function ChartTooltip({ title, items, offset, side, tooltipWidth, }: Readonly<ChartTooltipProps>): import("react/jsx-runtime").JSX.Element;
23
+ //# sourceMappingURL=ChartTooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartTooltip.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/ChartTooltip/ChartTooltip.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAwB,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAwBvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,KAAK,EACL,MAAuB,EACvB,IAAa,EACb,YAAoC,GACrC,EAAE,QAAQ,CAAC,iBAAiB,CAAC,2CAqE7B"}
@@ -0,0 +1,81 @@
1
+ import { jsx as l, jsxs as P } from "react/jsx-runtime";
2
+ import { resolvePixelX as b } from "../Scrubber/utils.js";
3
+ import { ChartTooltipItem as A } from "./ChartTooltipItem.js";
4
+ import { TOOLTIP_TRANSITION as L, BORDER_RADIUS as S, DEFAULT_TOOLTIP_WIDTH as C, PADDING_Y as d, ROW_HEIGHT as o, PADDING_X as R, ROW_GAP as I, DEFAULT_OFFSET as F, TITLE_GAP as G } from "./constants.js";
5
+ import { useScrubberContext as H } from "../Scrubber/context/scrubberContext.js";
6
+ import { useCartesianChartContext as X } from "../CartesianChart/context/cartesianChartContext.js";
7
+ import { cssVar as e } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
8
+ const p = /* @__PURE__ */ l(
9
+ "g",
10
+ {
11
+ "data-testid": "chart-tooltip",
12
+ role: "tooltip",
13
+ "aria-hidden": "true",
14
+ style: { opacity: 0, pointerEvents: "none", transition: "none" }
15
+ }
16
+ ), w = {
17
+ opacity: 1,
18
+ transition: L,
19
+ pointerEvents: "none"
20
+ }, N = {
21
+ fontSize: e("var(--font-style-body-4-size)"),
22
+ fontFamily: e("var(--font-family-font)"),
23
+ fill: e("var(--text-base)"),
24
+ fontWeight: e("var(--font-style-body-4-weight-medium)")
25
+ };
26
+ function V({
27
+ title: s,
28
+ items: g,
29
+ offset: c = F,
30
+ side: f = "auto",
31
+ tooltipWidth: i = C
32
+ }) {
33
+ const { scrubberPosition: n } = H(), { getXScale: v, getXAxisConfig: O, drawingArea: t } = X();
34
+ if (n === void 0) return p;
35
+ const r = b(n, v, O());
36
+ if (r === void 0) return p;
37
+ const a = g(n);
38
+ if (a.length === 0) return p;
39
+ const m = typeof s == "function" ? s(n) : s, h = m != null, _ = f === "left" || f === "auto" && r + c + i > t.x + t.width, T = Math.max(
40
+ t.x,
41
+ _ ? r - c - i : r + c
42
+ ), u = h ? o + G : 0, E = d * 2 + u + a.length * o + (a.length - 1) * I, D = t.y + d + u;
43
+ return /* @__PURE__ */ P("g", { "data-testid": "chart-tooltip", role: "tooltip", style: w, children: [
44
+ /* @__PURE__ */ l(
45
+ "rect",
46
+ {
47
+ x: T,
48
+ y: t.y,
49
+ width: i,
50
+ height: E,
51
+ rx: S,
52
+ fill: e("var(--background-muted)")
53
+ }
54
+ ),
55
+ h && /* @__PURE__ */ l(
56
+ "text",
57
+ {
58
+ "data-testid": "chart-tooltip-title",
59
+ x: T + R,
60
+ y: t.y + d + o / 2,
61
+ dominantBaseline: "middle",
62
+ style: N,
63
+ children: m
64
+ }
65
+ ),
66
+ a.map((y, x) => /* @__PURE__ */ l(
67
+ A,
68
+ {
69
+ label: y.label,
70
+ value: y.value,
71
+ x: T,
72
+ y: D + x * (o + I) + o / 2,
73
+ width: i
74
+ },
75
+ x
76
+ ))
77
+ ] });
78
+ }
79
+ export {
80
+ V as ChartTooltip
81
+ };
@@ -0,0 +1,3 @@
1
+ import { ChartTooltipItemProps } from './types';
2
+ export declare function ChartTooltipItem({ label, value, x, y, width, }: Readonly<ChartTooltipItemProps>): import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=ChartTooltipItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartTooltipItem.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/ChartTooltip/ChartTooltipItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,CAAK,EACL,CAAK,EACL,KAAK,GACN,EAAE,QAAQ,CAAC,qBAAqB,CAAC,2CA+BjC"}
@@ -0,0 +1,46 @@
1
+ import { jsxs as a, jsx as i } from "react/jsx-runtime";
2
+ import { PADDING_X as n } from "./constants.js";
3
+ import { cssVar as t } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
4
+ function y({
5
+ label: r,
6
+ value: l,
7
+ x: e = 0,
8
+ y: o = 0,
9
+ width: f
10
+ }) {
11
+ return /* @__PURE__ */ a("g", { children: [
12
+ /* @__PURE__ */ i(
13
+ "text",
14
+ {
15
+ x: e + n,
16
+ y: o,
17
+ dominantBaseline: "middle",
18
+ style: {
19
+ fontSize: t("var(--font-style-body-4-size)"),
20
+ fontFamily: t("var(--font-family-font)"),
21
+ fill: t("var(--text-muted)")
22
+ },
23
+ children: r
24
+ }
25
+ ),
26
+ /* @__PURE__ */ i(
27
+ "text",
28
+ {
29
+ x: e + f - n,
30
+ y: o,
31
+ dominantBaseline: "middle",
32
+ textAnchor: "end",
33
+ style: {
34
+ fontSize: t("var(--font-style-body-4-size)"),
35
+ fontFamily: t("var(--font-family-font)"),
36
+ fill: t("var(--text-base)"),
37
+ fontWeight: t("var(--font-style-body-4-weight-medium)")
38
+ },
39
+ children: l
40
+ }
41
+ )
42
+ ] });
43
+ }
44
+ export {
45
+ y as ChartTooltipItem
46
+ };
@@ -0,0 +1,10 @@
1
+ export declare const DEFAULT_OFFSET = 10;
2
+ export declare const DEFAULT_TOOLTIP_WIDTH = 120;
3
+ export declare const PADDING_X = 8;
4
+ export declare const PADDING_Y = 8;
5
+ export declare const ROW_HEIGHT = 16;
6
+ export declare const ROW_GAP = 6;
7
+ export declare const TITLE_GAP = 6;
8
+ export declare const BORDER_RADIUS = 4;
9
+ export declare const TOOLTIP_TRANSITION = "opacity 0.15s ease-out 0.05s";
10
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/ChartTooltip/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AACzC,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,kBAAkB,iCAAiC,CAAC"}
@@ -0,0 +1,12 @@
1
+ const T = 10, o = 120, s = 8, t = 8, c = 16, I = 6, _ = 6, n = 4, D = "opacity 0.15s ease-out 0.05s";
2
+ export {
3
+ n as BORDER_RADIUS,
4
+ T as DEFAULT_OFFSET,
5
+ o as DEFAULT_TOOLTIP_WIDTH,
6
+ s as PADDING_X,
7
+ t as PADDING_Y,
8
+ I as ROW_GAP,
9
+ c as ROW_HEIGHT,
10
+ _ as TITLE_GAP,
11
+ D as TOOLTIP_TRANSITION
12
+ };
@@ -0,0 +1,3 @@
1
+ export { ChartTooltip } from './ChartTooltip';
2
+ export type { ChartTooltipProps, ChartTooltipItemData } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/ChartTooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { ReactElement, SVGProps } from 'react';
2
+ /**
3
+ * Valid content for an SVG `<text>` element: a plain string,
4
+ * a number, or a `<tspan>` element.
5
+ */
6
+ export type SvgTextContent = string | number | ReactElement<SVGProps<SVGTSpanElement>, 'tspan'>;
7
+ export type ChartTooltipItemData = {
8
+ /** Label displayed on the left side of the row. */
9
+ label: SvgTextContent;
10
+ /** Value displayed on the right side of the row. */
11
+ value: SvgTextContent;
12
+ };
13
+ export type ChartTooltipItemProps = ChartTooltipItemData & {
14
+ /**
15
+ * X position in SVG coordinate space.
16
+ * @default 0
17
+ */
18
+ x?: number;
19
+ /**
20
+ * Y midline position in SVG coordinate space.
21
+ * @default 0
22
+ */
23
+ y?: number;
24
+ /**
25
+ * Width allocated to this row, used to right-align the value text.
26
+ */
27
+ width: number;
28
+ };
29
+ export type ChartTooltipProps = {
30
+ /**
31
+ * Optional header rendered at the top of the tooltip card.
32
+ * Accepts a static value or a callback receiving the active data index.
33
+ * A callback may return `null` or `undefined` to suppress the title for a
34
+ * specific data index without unmounting the tooltip.
35
+ */
36
+ title?: SvgTextContent | ((index: number) => SvgTextContent | null | undefined);
37
+ /**
38
+ * Produces tooltip rows from the active data index.
39
+ * Each returned item is rendered as a `<ChartTooltipItem>`.
40
+ * Return an empty array to suppress the tooltip at a given index.
41
+ */
42
+ items: (index: number) => ChartTooltipItemData[];
43
+ /**
44
+ * Horizontal gap in pixels between the scrubber line and the tooltip box.
45
+ * @default 10
46
+ */
47
+ offset?: number;
48
+ /**
49
+ * Which side of the scrubber line the tooltip appears on.
50
+ * `'auto'` flips to the left when the right side would overflow.
51
+ * @default 'auto'
52
+ */
53
+ side?: 'auto' | 'left' | 'right';
54
+ /**
55
+ * Fixed width of the tooltip box in pixels.
56
+ * Used for flip-side detection and for right-aligning value text.
57
+ * @default 120
58
+ */
59
+ tooltipWidth?: number;
60
+ };
61
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/ChartTooltip/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD;;;GAGG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,YAAY,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG;IACjC,mDAAmD;IACnD,KAAK,EAAE,cAAc,CAAC;IACtB,oDAAoD;IACpD,KAAK,EAAE,cAAc,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG;IACzD;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,CAAC,CAAC,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,KAAK,CAAC,EACF,cAAc,GACd,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAC3D;;;;OAIG;IACH,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,oBAAoB,EAAE,CAAC;IACjD;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IACjC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC"}
@@ -4,7 +4,7 @@ import { isNumericScale as A } from "../../utils/scales/scales.js";
4
4
  import { toScaledPoints as P, buildLinePath as I, buildAreaPath as L } from "./utils.js";
5
5
  import { useCartesianChartContext as T } from "../CartesianChart/context/cartesianChartContext.js";
6
6
  import { cssVar as j } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
7
- const O = 0.2;
7
+ const O = 0.15;
8
8
  function N({
9
9
  seriesId: g,
10
10
  stroke: h,
@@ -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, children, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
2
+ export declare function LineChart({ series, showArea, areaType, showXAxis, showYAxis, xAxis, yAxis, width, height, inset, enableScrubbing, onScrubberPositionChange, children, }: LineChartProps): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=LineChart.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAgB,EAChB,QAAqB,EACrB,SAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE,cAAc,2CAwEhB"}
1
+ {"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/LineChart/LineChart.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAgB,EAChB,QAAqB,EACrB,SAAiB,EACjB,SAAiB,EACjB,KAAK,EACL,KAAK,EACL,KAAc,EACd,MAAY,EACZ,KAAK,EACL,eAAe,EACf,wBAAwB,EACxB,QAAQ,GACT,EAAE,cAAc,2CA0EhB"}