@ledgerhq/lumen-ui-react-visualization 0.1.14 → 0.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,17 +1,13 @@
1
1
  import { LineChart as o } from "./lib/Components/LineChart/LineChart.js";
2
- import { Point as f, PointLabel as p } from "./lib/Components/Point/Point.js";
3
- import { ReferenceLine as x } from "./lib/Components/ReferenceLine/ReferenceLine.js";
4
- import { Scrubber as i } from "./lib/Components/Scrubber/Scrubber.js";
5
- import { useScrubberContext as u } from "./lib/Components/Scrubber/context/scrubberContext.js";
6
- import { ChartTooltipItem as c } from "./lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.js";
7
- import { DefaultScrubberTooltip as C } from "./lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.js";
2
+ import { Point as f, PointLabel as n } from "./lib/Components/Point/Point.js";
3
+ import { ReferenceLine as b } from "./lib/Components/ReferenceLine/ReferenceLine.js";
4
+ import { Scrubber as p } from "./lib/Components/Scrubber/Scrubber.js";
5
+ import { useScrubberContext as c } from "./lib/Components/Scrubber/context/scrubberContext.js";
8
6
  export {
9
- c as ChartTooltipItem,
10
- C as DefaultScrubberTooltip,
11
7
  o as LineChart,
12
8
  f as Point,
13
- p as PointLabel,
14
- x as ReferenceLine,
15
- i as Scrubber,
16
- u as useScrubberContext
9
+ n as PointLabel,
10
+ b as ReferenceLine,
11
+ p as Scrubber,
12
+ c as useScrubberContext
17
13
  };
@@ -1,3 +1,9 @@
1
1
  import { ChartTooltipItemProps } from '../types';
2
- export declare function ChartTooltipItem({ label, value, x, y, width, labelRef, valueRef, }: Readonly<ChartTooltipItemProps>): import("react/jsx-runtime").JSX.Element;
2
+ /**
3
+ * Memoized so it only re-renders when one of its primitive props actually
4
+ * changes. Combined with the stable per-index ref callbacks built in
5
+ * `DefaultScrubberTooltip`, this keeps the row out of the per-scrub-frame
6
+ * reconciliation path when its label / value / position have not changed.
7
+ */
8
+ export declare const ChartTooltipItem: import('react').NamedExoticComponent<Readonly<ChartTooltipItemProps>>;
3
9
  //# sourceMappingURL=ChartTooltipItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTooltipItem.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,KAAK,EACL,CAAK,EACL,CAAK,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,QAAQ,CAAC,qBAAqB,CAAC,2CAiCjC"}
1
+ {"version":3,"file":"ChartTooltipItem.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/ChartTooltipItem.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAgBtD;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,uEAgC3B,CAAC"}
@@ -1,50 +1,51 @@
1
- import { jsxs as d, jsx as i } from "react/jsx-runtime";
1
+ import { jsxs as s, jsx as i } from "react/jsx-runtime";
2
+ import { memo as d } from "react";
2
3
  import { PADDING_X as n } from "./constants.js";
3
4
  import { cssVar as t } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
4
- function h({
5
+ const y = {
6
+ fontSize: t("var(--font-style-body-4-size)"),
7
+ fontFamily: t("var(--font-family-font)"),
8
+ fill: t("var(--text-muted)")
9
+ }, c = {
10
+ fontSize: t("var(--font-style-body-4-size)"),
11
+ fontFamily: t("var(--font-family-font)"),
12
+ fill: t("var(--text-base)"),
13
+ fontWeight: t("var(--font-style-body-4-weight-medium)")
14
+ }, b = d(function({
5
15
  label: r,
6
16
  value: f,
7
17
  x: e = 0,
8
18
  y: o = 0,
9
- width: l,
10
- labelRef: a,
11
- valueRef: m
19
+ width: m,
20
+ labelRef: l,
21
+ valueRef: a
12
22
  }) {
13
- return /* @__PURE__ */ d("g", { children: [
23
+ return /* @__PURE__ */ s("g", { children: [
14
24
  /* @__PURE__ */ i(
15
25
  "text",
16
26
  {
17
- ref: a,
27
+ ref: l,
18
28
  x: e + n,
19
29
  y: o,
20
30
  dominantBaseline: "middle",
21
- style: {
22
- fontSize: t("var(--font-style-body-4-size)"),
23
- fontFamily: t("var(--font-family-font)"),
24
- fill: t("var(--text-muted)")
25
- },
31
+ style: y,
26
32
  children: r
27
33
  }
28
34
  ),
29
35
  /* @__PURE__ */ i(
30
36
  "text",
31
37
  {
32
- ref: m,
33
- x: e + l - n,
38
+ ref: a,
39
+ x: e + m - n,
34
40
  y: o,
35
41
  dominantBaseline: "middle",
36
42
  textAnchor: "end",
37
- style: {
38
- fontSize: t("var(--font-style-body-4-size)"),
39
- fontFamily: t("var(--font-family-font)"),
40
- fill: t("var(--text-base)"),
41
- fontWeight: t("var(--font-style-body-4-weight-medium)")
42
- },
43
+ style: c,
43
44
  children: f
44
45
  }
45
46
  )
46
47
  ] });
47
- }
48
+ });
48
49
  export {
49
- h as ChartTooltipItem
50
+ b as ChartTooltipItem
50
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultScrubberTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA2BrD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,WAAW,EACX,KAAK,EACL,KAAK,EACL,MAAuB,EACvB,QAAoC,GACrC,EAAE,QAAQ,CAAC,oBAAoB,CAAC,kDAkEhC"}
1
+ {"version":3,"file":"DefaultScrubberTooltip.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/DefaultScrubberTooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AA4BrD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,WAAW,EACX,KAAK,EACL,KAAK,EACL,MAAuB,EACvB,QAAoC,GACrC,EAAE,QAAQ,CAAC,oBAAoB,CAAC,kDAiEhC"}
@@ -1,85 +1,81 @@
1
- import { jsxs as R, jsx as f } from "react/jsx-runtime";
2
- import { ChartTooltipItem as _ } from "./ChartTooltipItem.js";
3
- import { TOOLTIP_TRANSITION as D, BORDER_RADIUS as x, PADDING_Y as O, ROW_HEIGHT as u, PADDING_X as E, ROW_GAP as g, DEFAULT_OFFSET as L, DEFAULT_TOOLTIP_MIN_WIDTH as S } from "./constants.js";
4
- import { useTooltipMeasurement as W, computeTooltipWidth as F, computeTooltipHeight as H, computeTooltipX as N, computeItemsBaseY as P } from "./utils.js";
1
+ import { jsxs as D, jsx as a } from "react/jsx-runtime";
2
+ import { ChartTooltipItem as x } from "./ChartTooltipItem.js";
3
+ import { TOOLTIP_TRANSITION as O, BORDER_RADIUS as S, PADDING_Y as g, ROW_HEIGHT as f, PADDING_X as E, ROW_GAP as L, DEFAULT_OFFSET as W, DEFAULT_TOOLTIP_MIN_WIDTH as B } from "./constants.js";
4
+ import { useTooltipMeasurement as F, useBuildRefSetters as u, computeTooltipWidth as H, computeTooltipHeight as N, computeTooltipX as P, computeItemsBaseY as A } from "./utils.js";
5
5
  import { cssVar as o } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
6
- const A = {
6
+ const G = {
7
7
  fontSize: o("var(--font-style-body-4-size)"),
8
8
  fontFamily: o("var(--font-family-font)"),
9
9
  fill: o("var(--text-base)"),
10
10
  fontWeight: o("var(--font-style-body-4-weight-medium)")
11
11
  };
12
- function $({
13
- pixelX: T,
14
- drawingArea: e,
15
- title: l,
16
- items: i,
17
- offset: m = L,
18
- minWidth: h = S
12
+ function M({
13
+ pixelX: h,
14
+ drawingArea: l,
15
+ title: n,
16
+ items: t,
17
+ offset: T = W,
18
+ minWidth: m = B
19
19
  }) {
20
- const t = l != null, { widths: c, titleRef: d, labelRefs: y, valueRefs: I } = W(
21
- i,
20
+ const e = n !== void 0, { widths: p, titleRef: d, labelRefs: y, valueRefs: R } = F(
22
21
  t,
23
- l
24
- );
25
- if (i.length === 0)
22
+ e,
23
+ n
24
+ ), I = u(y, t.length), v = u(R, t.length);
25
+ if (t.length === 0)
26
26
  return null;
27
- const a = F(c, t, h), s = N(T, m, a, e), v = H(i.length, t), b = P(e.y, t);
28
- return /* @__PURE__ */ R(
27
+ const s = H(p, e, m), r = P(h, T, s, l), b = N(t.length, e), _ = A(l.y, e);
28
+ return /* @__PURE__ */ D(
29
29
  "g",
30
30
  {
31
31
  "data-testid": "chart-tooltip",
32
32
  role: "tooltip",
33
33
  style: {
34
- opacity: c === null ? 0 : 1,
35
- transition: D,
34
+ opacity: p === null ? 0 : 1,
35
+ transition: O,
36
36
  pointerEvents: "none"
37
37
  },
38
38
  children: [
39
- /* @__PURE__ */ f(
39
+ /* @__PURE__ */ a(
40
40
  "rect",
41
41
  {
42
- x: s,
43
- y: e.y,
44
- width: a,
45
- height: v,
46
- rx: x,
42
+ x: r,
43
+ y: l.y,
44
+ width: s,
45
+ height: b,
46
+ rx: S,
47
47
  fill: o("var(--background-muted)")
48
48
  }
49
49
  ),
50
- t && /* @__PURE__ */ f(
50
+ e && /* @__PURE__ */ a(
51
51
  "text",
52
52
  {
53
53
  ref: d,
54
54
  "data-testid": "chart-tooltip-title",
55
- x: s + E,
56
- y: e.y + O + u / 2,
55
+ x: r + E,
56
+ y: l.y + g + f / 2,
57
57
  dominantBaseline: "middle",
58
- style: A,
59
- children: l
58
+ style: G,
59
+ children: n
60
60
  }
61
61
  ),
62
- i.map((n, r) => /* @__PURE__ */ f(
63
- _,
62
+ t.map((c, i) => /* @__PURE__ */ a(
63
+ x,
64
64
  {
65
- label: n.label,
66
- value: n.value,
67
- x: s,
68
- y: b + r * (u + g) + u / 2,
69
- width: a,
70
- labelRef: (p) => {
71
- y.current[r] = p;
72
- },
73
- valueRef: (p) => {
74
- I.current[r] = p;
75
- }
65
+ label: c.label,
66
+ value: c.value,
67
+ x: r,
68
+ y: _ + i * (f + L) + f / 2,
69
+ width: s,
70
+ labelRef: I[i],
71
+ valueRef: v[i]
76
72
  },
77
- `${n.label}-${n.value}-${r}`
73
+ i
78
74
  ))
79
75
  ]
80
76
  }
81
77
  );
82
78
  }
83
79
  export {
84
- $ as DefaultScrubberTooltip
80
+ M as DefaultScrubberTooltip
85
81
  };
@@ -34,10 +34,25 @@ export declare const computeItemsBaseY: (drawingAreaY: number, hasTitle: boolean
34
34
  /**
35
35
  * Manages SVG text measurement for the tooltip via `getBBox`.
36
36
  *
37
- * A single `ResizeObserver` is created on mount and reused for the
38
- * component's entire lifetime, avoiding the cost of tearing down and
39
- * recreating an observer on every scrubber movement.
37
+ * A single `ResizeObserver` is created on mount and reused for the component's
38
+ * entire lifetime, avoiding the cost of tearing down and recreating an observer
39
+ * on every scrubber movement.
40
+ *
41
+ * The re-measure / re-observe effect's dependency is a shape signature (labels
42
+ * + title + count) rather than the raw `items` reference, so high-frequency
43
+ * value updates during a scrub do not trigger a fresh measurement or
44
+ * disconnect / re-observe cycle. The `ResizeObserver` still picks up real
45
+ * geometry changes (e.g. value strings widening past the current rect).
46
+ */
47
+ export declare function useTooltipMeasurement(items: ChartTooltipItemData[], hasTitle: boolean, title: SvgTextContent | undefined): UseTooltipMeasurementReturn;
48
+ type SvgTextRefSetter = (el: SVGTextElement | null) => void;
49
+ /**
50
+ * Builds stable per-index ref-callback arrays that mutate the given refs in
51
+ * place. Recomputed only when `length` changes, so the same callback identity
52
+ * is passed to each `ChartTooltipItem` across scrub frames. This unlocks
53
+ * `React.memo` on `ChartTooltipItem` and avoids the per-frame detach /
54
+ * re-attach dance of inline arrow ref callbacks.
40
55
  */
41
- export declare function useTooltipMeasurement(items: ChartTooltipItemData[], hasTitle: boolean, title: SvgTextContent | null | undefined): UseTooltipMeasurementReturn;
56
+ export declare const useBuildRefSetters: (refs: RefObject<(SVGTextElement | null)[]>, length: number) => SvgTextRefSetter[];
42
57
  export {};
43
58
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAUrE,KAAK,MAAM,GAAG;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC3C,SAAS,EAAE,SAAS,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,SAAS,EAAE,SAAS,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;CACjD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,IAAI,kBAAkB,GAAG,IAAI,KAAG,MAOhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,MAAM,GAAG,IAAI,EACrB,UAAU,OAAO,EACjB,UAAU,MAAM,KACf,MAUF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB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C9B,QAAQ,MAAM,GAAG,IAAI,EACrB,UAAU,OAAO,EACjB,UAAU,MAAM,KACf,MAUF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,cAAc,MAAM,EACpB,aAAa,WAAW,KACvB,MAOF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,WAAW,MAAM,EACjB,UAAU,OAAO,KAChB,MAQF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,MAAM,EACpB,UAAU,OAAO,KAChB,MAGF,CAAC;AA4BF;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,oBAAoB,EAAE,EAC7B,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,cAAc,GAAG,SAAS,GAChC,2BAA2B,CAuD7B;AAED,KAAK,gBAAgB,GAAG,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;AAE5D;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,SAAS,CAAC,CAAC,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,EAC1C,QAAQ,MAAM,KACb,gBAAgB,EAUlB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { useRef as i, useState as W, useEffect as _, useLayoutEffect as g } from "react";
2
- import { LABEL_VALUE_GAP as E, PADDING_Y as d, ROW_HEIGHT as p, ROW_GAP as x, PADDING_X as G, TITLE_GAP as b } from "./constants.js";
1
+ import { useRef as i, useState as W, useEffect as _, useLayoutEffect as E, useMemo as x } from "react";
2
+ import { LABEL_VALUE_GAP as G, PADDING_Y as g, ROW_HEIGHT as b, ROW_GAP as L, PADDING_X as T, TITLE_GAP as R } from "./constants.js";
3
3
  const m = (t) => {
4
4
  if (!t || typeof t.getBBox != "function") return 0;
5
5
  try {
@@ -7,53 +7,74 @@ const m = (t) => {
7
7
  } catch {
8
8
  return 0;
9
9
  }
10
- }, A = (t, e, r) => {
11
- const n = t && e ? t.title : 0, c = t ? t.labels.map(
12
- (a, f) => a + E + (t.values[f] ?? 0)
13
- ) : [], l = Math.max(n, ...c) + G * 2;
14
- return Math.max(l, r);
15
- }, H = (t, e, r, n) => {
16
- const c = t + e + r > n.x + n.width;
10
+ }, I = (t, r, n) => {
11
+ const e = t && r ? t.title : 0, o = t ? t.labels.map(
12
+ (a, h) => a + G + (t.values[h] ?? 0)
13
+ ) : [], u = Math.max(e, ...o) + T * 2;
14
+ return Math.max(u, n);
15
+ }, M = (t, r, n, e) => {
16
+ const o = t + r + n > e.x + e.width;
17
17
  return Math.max(
18
- n.x,
19
- c ? t - e - r : t + e
18
+ e.x,
19
+ o ? t - r - n : t + r
20
20
  );
21
- }, I = (t, e) => {
22
- const r = e ? p + b : 0;
23
- return d * 2 + r + t * p + (t - 1) * x;
24
- }, P = (t, e) => {
25
- const r = e ? p + b : 0;
26
- return t + d + r;
21
+ }, P = (t, r) => {
22
+ const n = r ? b + R : 0;
23
+ return g * 2 + n + t * b + (t - 1) * L;
24
+ }, D = (t, r) => {
25
+ const n = r ? b + R : 0;
26
+ return t + g + n;
27
+ }, A = (t, r, n) => {
28
+ let e = "";
29
+ for (let c = 0; c < t.length; c++) {
30
+ c > 0 && (e += "");
31
+ const u = t[c].label;
32
+ e += typeof u == "string" || typeof u == "number" ? String(u) : "";
33
+ }
34
+ const o = typeof n == "string" || typeof n == "number" ? String(n) : "";
35
+ return `${r ? "1" : "0"}|${e}|${o}`;
27
36
  };
28
- function y(t, e, r) {
29
- const n = i(null), c = i([]), s = i([]), l = i(null), a = i(() => {
30
- }), [f, v] = W(null);
31
- return a.current = () => {
32
- const o = e ? m(n.current) : 0, u = t.map(
33
- (R, h) => m(c.current[h])
34
- ), B = t.map(
35
- (R, h) => m(s.current[h])
37
+ function O(t, r, n) {
38
+ const e = i(null), o = i([]), c = i([]), u = i(null), a = i(() => {
39
+ }), [h, y] = W(null);
40
+ a.current = () => {
41
+ const f = r ? m(e.current) : 0, s = t.map(
42
+ (v, p) => m(o.current[p])
43
+ ), l = t.map(
44
+ (v, p) => m(c.current[p])
36
45
  );
37
- v({
38
- title: o,
39
- labels: u,
40
- values: B
46
+ y({
47
+ title: f,
48
+ labels: s,
49
+ values: l
41
50
  });
42
51
  }, _(() => {
43
52
  if (!(typeof ResizeObserver > "u"))
44
- return l.current = new ResizeObserver(() => a.current()), () => l.current?.disconnect();
45
- }, []), g(() => {
46
- if (t.length === 0) return;
47
- c.current.length = t.length, s.current.length = t.length, a.current();
48
- const o = l.current;
49
- o && (o.disconnect(), n.current && o.observe(n.current), c.current.forEach((u) => u && o.observe(u)), s.current.forEach((u) => u && o.observe(u)));
50
- }, [t, r, e]), { widths: f, titleRef: n, labelRefs: c, valueRefs: s };
53
+ return u.current = new ResizeObserver(() => a.current()), () => u.current?.disconnect();
54
+ }, []);
55
+ const B = A(t, r, n), d = i(t.length);
56
+ return d.current = t.length, E(() => {
57
+ const f = d.current;
58
+ if (f === 0) return;
59
+ o.current.length = f, c.current.length = f, a.current();
60
+ const s = u.current;
61
+ s && (s.disconnect(), e.current && s.observe(e.current), o.current.forEach((l) => l && s.observe(l)), c.current.forEach((l) => l && s.observe(l)));
62
+ }, [B]), { widths: h, titleRef: e, labelRefs: o, valueRefs: c };
51
63
  }
64
+ const $ = (t, r) => x(() => {
65
+ const n = new Array(r);
66
+ for (let e = 0; e < r; e++)
67
+ n[e] = (o) => {
68
+ t.current[e] = o;
69
+ };
70
+ return n;
71
+ }, [t, r]);
52
72
  export {
53
- P as computeItemsBaseY,
54
- I as computeTooltipHeight,
55
- A as computeTooltipWidth,
56
- H as computeTooltipX,
73
+ D as computeItemsBaseY,
74
+ P as computeTooltipHeight,
75
+ I as computeTooltipWidth,
76
+ M as computeTooltipX,
57
77
  m as safeGetBBoxWidth,
58
- y as useTooltipMeasurement
78
+ $ as useBuildRefSetters,
79
+ O as useTooltipMeasurement
59
80
  };
@@ -25,5 +25,5 @@ import { ScrubberProps } from './types';
25
25
  * />
26
26
  * ```
27
27
  */
28
- export declare function Scrubber({ label, hideLine, hideOverlay, showBeacons, tooltip, }: Readonly<ScrubberProps>): import("react/jsx-runtime").JSX.Element | null;
28
+ export declare function Scrubber({ hideLine, hideOverlay, showBeacons, tooltip, }: Readonly<ScrubberProps>): import("react/jsx-runtime").JSX.Element | null;
29
29
  //# sourceMappingURL=Scrubber.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Scrubber.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/Scrubber.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAa7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAgB,EAChB,WAAmB,EACnB,WAAmB,EACnB,OAAO,GACR,EAAE,QAAQ,CAAC,aAAa,CAAC,kDA2KzB"}
1
+ {"version":3,"file":"Scrubber.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/Scrubber.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAY7C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,EACvB,QAAgB,EAChB,WAAmB,EACnB,WAAmB,EACnB,OAAO,GACR,EAAE,QAAQ,CAAC,aAAa,CAAC,kDAoJzB"}
@@ -1,160 +1,139 @@
1
- import { jsxs as v, jsx as o, Fragment as F } from "react/jsx-runtime";
2
- import { useId as N, useMemo as d } from "react";
3
- import { resolvePixelX as P, resolvePixelY as R, LINE_GRADIENT_EDGE_OPACITY as O, OVERLAY_OPACITY as X, LABEL_OFFSET_Y as G, BEACON_STROKE_WIDTH as V, BEACON_RADIUS as H, OVERLAY_OFFSET as m, OVERLAY_LINE_INSET as S } from "./utils.js";
4
- import { useScrubberContext as M } from "./context/scrubberContext.js";
5
- import { useCartesianChartContext as U } from "../CartesianChart/context/cartesianChartContext.js";
6
- import { DefaultScrubberTooltip as j } from "./DefaultScrubberTooltip/DefaultScrubberTooltip.js";
7
- import { cssVar as r } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
8
- function Z({
9
- label: n,
10
- hideLine: Y = !1,
11
- hideOverlay: _ = !1,
12
- showBeacons: l = !1,
13
- tooltip: f
1
+ import { jsxs as f, jsx as i, Fragment as N } from "react/jsx-runtime";
2
+ import { useId as P, useMemo as u } from "react";
3
+ import { DefaultScrubberTooltip as R } from "./DefaultScrubberTooltip/DefaultScrubberTooltip.js";
4
+ import { resolvePixelX as X, resolvePixelY as w, LINE_GRADIENT_EDGE_OPACITY as E, OVERLAY_OPACITY as L, BEACON_STROKE_WIDTH as G, BEACON_RADIUS as V, OVERLAY_OFFSET as p, OVERLAY_LINE_INSET as O } from "./utils.js";
5
+ import { useScrubberContext as F } from "./context/scrubberContext.js";
6
+ import { useCartesianChartContext as H } from "../CartesianChart/context/cartesianChartContext.js";
7
+ import { cssVar as o } from "../../../libs/design-core/dist/lib/cssVar/cssVar.js";
8
+ function B({
9
+ hideLine: A = !1,
10
+ hideOverlay: Y = !1,
11
+ showBeacons: n = !1,
12
+ tooltip: d
14
13
  }) {
15
- const b = N(), { scrubberPosition: e } = M(), {
16
- getXScale: p,
17
- getXAxisConfig: h,
18
- getYScale: y,
14
+ const m = P(), { scrubberPosition: e } = F(), {
15
+ getXScale: v,
16
+ getXAxisConfig: b,
17
+ getYScale: h,
19
18
  drawingArea: x,
20
- series: g,
21
- seriesMap: E
22
- } = U(), i = d(() => {
19
+ series: y,
20
+ seriesMap: g
21
+ } = H(), r = u(() => {
23
22
  if (e !== void 0)
24
- return P(e, p, h());
25
- }, [e, p, h]), I = d(() => e === void 0 || !l ? [] : g.map((t) => {
26
- const u = E.get(t.id)?.data, C = R(e, u, y);
23
+ return X(e, v, b());
24
+ }, [e, v, b]), k = u(() => e === void 0 || !n ? [] : y.map((t) => {
25
+ const c = g.get(t.id)?.data, C = w(e, c, h);
27
26
  return C === void 0 ? null : { id: t.id, stroke: t.stroke, pixelY: C };
28
27
  }).filter(
29
28
  (t) => t !== null
30
- ), [e, l, g, E, y]), A = d(() => {
31
- if (!(e === void 0 || !n))
32
- return n(e);
33
- }, [e, n]), a = d(() => {
34
- if (e === void 0 || !f)
29
+ ), [e, n, y, g, h]), s = u(() => {
30
+ if (e === void 0 || !d)
35
31
  return;
36
- const t = f(e);
32
+ const t = d(e);
37
33
  if (t.items.length === 0) return;
38
- const u = typeof t.title == "function" ? t.title(e) : t.title;
34
+ const c = typeof t.title == "function" ? t.title(e) : t.title;
39
35
  return {
40
36
  items: t.items,
41
- resolvedTitle: u,
37
+ resolvedTitle: c,
42
38
  offset: t.offset,
43
39
  minWidth: t.minWidth
44
40
  };
45
- }, [e, f]);
46
- if (e === void 0 || i === void 0)
41
+ }, [e, d]);
42
+ if (e === void 0 || r === void 0)
47
43
  return null;
48
44
  const {
49
- x: T,
50
- y: s,
51
- width: k,
52
- height: c
53
- } = x, W = i + S, L = s - m, w = Math.max(
45
+ x: I,
46
+ y: a,
47
+ width: S,
48
+ height: l
49
+ } = x, T = r + O, _ = a - p, W = Math.max(
54
50
  0,
55
- T + k - i - S + m
56
- ), D = c + m * 2;
57
- return /* @__PURE__ */ v("g", { "data-testid": "scrubber", children: [
58
- !Y && /* @__PURE__ */ v(F, { children: [
59
- /* @__PURE__ */ o("defs", { children: /* @__PURE__ */ v(
51
+ I + S - r - O + p
52
+ ), D = l + p * 2;
53
+ return /* @__PURE__ */ f("g", { "data-testid": "scrubber", children: [
54
+ !A && /* @__PURE__ */ f(N, { children: [
55
+ /* @__PURE__ */ i("defs", { children: /* @__PURE__ */ f(
60
56
  "linearGradient",
61
57
  {
62
- id: b,
58
+ id: m,
63
59
  gradientUnits: "userSpaceOnUse",
64
- x1: i,
65
- y1: s,
66
- x2: i,
67
- y2: s + c,
60
+ x1: r,
61
+ y1: a,
62
+ x2: r,
63
+ y2: a + l,
68
64
  children: [
69
- /* @__PURE__ */ o(
65
+ /* @__PURE__ */ i(
70
66
  "stop",
71
67
  {
72
68
  offset: "0%",
73
- stopColor: r("var(--border-base)"),
74
- stopOpacity: O
69
+ stopColor: o("var(--border-base)"),
70
+ stopOpacity: E
75
71
  }
76
72
  ),
77
- /* @__PURE__ */ o("stop", { offset: "20%", stopColor: r("var(--border-base)") }),
78
- /* @__PURE__ */ o("stop", { offset: "80%", stopColor: r("var(--border-base)") }),
79
- /* @__PURE__ */ o(
73
+ /* @__PURE__ */ i("stop", { offset: "20%", stopColor: o("var(--border-base)") }),
74
+ /* @__PURE__ */ i("stop", { offset: "80%", stopColor: o("var(--border-base)") }),
75
+ /* @__PURE__ */ i(
80
76
  "stop",
81
77
  {
82
78
  offset: "100%",
83
- stopColor: r("var(--border-base)"),
84
- stopOpacity: O
79
+ stopColor: o("var(--border-base)"),
80
+ stopOpacity: E
85
81
  }
86
82
  )
87
83
  ]
88
84
  }
89
85
  ) }),
90
- /* @__PURE__ */ o(
86
+ /* @__PURE__ */ i(
91
87
  "line",
92
88
  {
93
89
  "data-testid": "scrubber-line",
94
- x1: i,
95
- y1: s,
96
- x2: i,
97
- y2: s + c,
98
- stroke: `url(#${b})`,
99
- strokeWidth: r("var(--stroke-1)")
90
+ x1: r,
91
+ y1: a,
92
+ x2: r,
93
+ y2: a + l,
94
+ stroke: `url(#${m})`,
95
+ strokeWidth: o("var(--stroke-1)")
100
96
  }
101
97
  )
102
98
  ] }),
103
- !_ && /* @__PURE__ */ o(
99
+ !Y && /* @__PURE__ */ i(
104
100
  "rect",
105
101
  {
106
102
  "data-testid": "scrubber-overlay",
107
- x: W,
108
- y: L,
109
- width: w,
103
+ x: T,
104
+ y: _,
105
+ width: W,
110
106
  height: D,
111
- fill: r("var(--background-base)"),
112
- opacity: X
107
+ fill: o("var(--background-base)"),
108
+ opacity: L
113
109
  }
114
110
  ),
115
- A !== void 0 && /* @__PURE__ */ o(
116
- "text",
117
- {
118
- "data-testid": "scrubber-label",
119
- x: i,
120
- y: s - G,
121
- textAnchor: "middle",
122
- style: {
123
- fill: r("var(--text-base)"),
124
- fontSize: r("var(--font-style-body-4-size)"),
125
- fontWeight: r("var(--font-style-body-4-weight-medium)"),
126
- fontFamily: r("var(--font-family-font)")
127
- },
128
- children: A
129
- }
130
- ),
131
- l && I.map((t) => /* @__PURE__ */ o(
111
+ n && k.map((t) => /* @__PURE__ */ i(
132
112
  "circle",
133
113
  {
134
114
  "data-testid": `scrubber-beacon-${t.id}`,
135
- cx: i,
115
+ cx: r,
136
116
  cy: t.pixelY,
137
- r: H,
117
+ r: V,
138
118
  fill: t.stroke,
139
- stroke: r("var(--background-canvas)"),
140
- strokeWidth: V
119
+ stroke: o("var(--background-canvas)"),
120
+ strokeWidth: G
141
121
  },
142
122
  t.id
143
123
  )),
144
- a !== void 0 && /* @__PURE__ */ o(
145
- j,
124
+ s !== void 0 && /* @__PURE__ */ i(
125
+ R,
146
126
  {
147
- pixelX: i,
127
+ pixelX: r,
148
128
  drawingArea: x,
149
- dataIndex: e,
150
- title: a.resolvedTitle,
151
- items: a.items,
152
- offset: a.offset,
153
- minWidth: a.minWidth
129
+ title: s.resolvedTitle,
130
+ items: s.items,
131
+ offset: s.offset,
132
+ minWidth: s.minWidth
154
133
  }
155
134
  )
156
135
  ] });
157
136
  }
158
137
  export {
159
- Z as Scrubber
138
+ B as Scrubber
160
139
  };
@@ -1,5 +1,4 @@
1
1
  export { Scrubber } from './Scrubber';
2
2
  export { useScrubberContext } from './context';
3
- export { ChartTooltipItem, DefaultScrubberTooltip, } from './DefaultScrubberTooltip';
4
3
  export type { ChartTooltipItemData, ChartTooltipItemProps, ScrubberContextValue, ScrubberProps, ScrubberTooltipContent, ScrubberTooltipProps, SvgTextContent, } from './types';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EACL,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,GACf,MAAM,SAAS,CAAC"}
@@ -35,9 +35,13 @@ export type ScrubberProviderProps = {
35
35
  */
36
36
  export type SvgTextContent = string | number | ReactElement<SVGProps<SVGTSpanElement>, 'tspan'>;
37
37
  export type ChartTooltipItemData = {
38
- /** Label displayed on the left side of the row. */
38
+ /**
39
+ * Label displayed on the left side of the row.
40
+ */
39
41
  label: SvgTextContent;
40
- /** Value displayed on the right side of the row. */
42
+ /**
43
+ * Value displayed on the right side of the row.
44
+ */
41
45
  value: SvgTextContent;
42
46
  };
43
47
  export type ChartTooltipItemProps = ChartTooltipItemData & {
@@ -92,15 +96,10 @@ export type ScrubberTooltipProps = ScrubberTooltipLayoutProps & {
92
96
  */
93
97
  drawingArea: DrawingArea;
94
98
  /**
95
- * Zero-based index of the data point currently under the scrubber. Maps
96
- * directly to the series data arrays so consumers can look up values.
99
+ * Optional title displayed at the top of the tooltip. Omit to render
100
+ * the tooltip without a title row.
97
101
  */
98
- dataIndex: number;
99
- /**
100
- * Optional title displayed at the top of the tooltip. Pass `null` or omit
101
- * to render the tooltip without a title row.
102
- */
103
- title?: SvgTextContent | null;
102
+ title?: SvgTextContent;
104
103
  /**
105
104
  * List of label/value pairs rendered as rows inside the tooltip body.
106
105
  */
@@ -112,20 +111,15 @@ export type ScrubberTooltipProps = ScrubberTooltipLayoutProps & {
112
111
  export type ScrubberTooltipContent = ScrubberTooltipLayoutProps & {
113
112
  /**
114
113
  * Optional header. Static value or callback per data index.
115
- * A callback may return `null` or `undefined` to suppress the title.
114
+ * A callback may return `undefined` to suppress the title.
116
115
  */
117
- title?: SvgTextContent | ((index: number) => SvgTextContent | null | undefined);
116
+ title?: SvgTextContent | ((index: number) => SvgTextContent | undefined);
118
117
  /**
119
118
  * Tooltip rows for this index. Return an empty array to hide the tooltip.
120
119
  */
121
120
  items: ChartTooltipItemData[];
122
121
  };
123
122
  export type ScrubberProps = {
124
- /**
125
- * Formats a label string shown above the reference line for a given data index.
126
- * When omitted, no label is rendered.
127
- */
128
- label?: (dataIndex: number) => string;
129
123
  /**
130
124
  * Hides the vertical reference line.
131
125
  * @default false
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/Scrubber/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;OAEG;IACH,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,SAAS,CA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K,CAAC,EAAE,cAAc,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC,CAAC;IACzE;;OAEG;IACH,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,sBAAsB,CAAC;CACzD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { getPointOnScale as d, isNumericScale as u, isCategoricalScale as l } from "../../utils/scales/scales.js";
2
- const v = 5, _ = 2, m = 12, A = 2, I = 0.5, O = 0.8, h = 0.1, f = (o) => typeof o[0] == "number", a = (o, n, r) => {
2
+ const E = 5, m = 2, I = 2, A = 0.5, O = 0.8, _ = 0.1, f = (o) => typeof o[0] == "number", a = (o, n, r) => {
3
3
  let e = 0, t = 1 / 0;
4
4
  for (let i = 0; i < o; i++) {
5
5
  const s = r(i);
@@ -8,7 +8,7 @@ const v = 5, _ = 2, m = 12, A = 2, I = 0.5, O = 0.8, h = 0.1, f = (o) => typeof
8
8
  c < t && (t = c, e = i);
9
9
  }
10
10
  return e;
11
- }, S = (o, n, r, e) => {
11
+ }, h = (o, n, r, e) => {
12
12
  if (l(n)) {
13
13
  const t = n.domain(), i = n.bandwidth();
14
14
  return a(t.length, o, (s) => {
@@ -44,14 +44,13 @@ const v = 5, _ = 2, m = 12, A = 2, I = 0.5, O = 0.8, h = 0.1, f = (o) => typeof
44
44
  return d(typeof t == "number" ? t : o, e);
45
45
  };
46
46
  export {
47
- v as BEACON_RADIUS,
48
- _ as BEACON_STROKE_WIDTH,
49
- m as LABEL_OFFSET_Y,
50
- h as LINE_GRADIENT_EDGE_OPACITY,
51
- I as OVERLAY_LINE_INSET,
52
- A as OVERLAY_OFFSET,
47
+ E as BEACON_RADIUS,
48
+ m as BEACON_STROKE_WIDTH,
49
+ _ as LINE_GRADIENT_EDGE_OPACITY,
50
+ A as OVERLAY_LINE_INSET,
51
+ I as OVERLAY_OFFSET,
53
52
  O as OVERLAY_OPACITY,
54
- S as getDataIndexFromPosition,
53
+ h as getDataIndexFromPosition,
55
54
  N as resolvePixelX,
56
55
  x as resolvePixelY
57
56
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react-visualization",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@ledgerhq/lumen-design-core": "0.1.14",
37
- "@ledgerhq/lumen-ui-react": "0.1.34",
37
+ "@ledgerhq/lumen-ui-react": "0.1.35",
38
38
  "class-variance-authority": "^0.7.1",
39
39
  "clsx": "^2.1.1",
40
40
  "react": "^18.0.0 || ^19.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react-visualization",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "keywords": [
@@ -33,8 +33,8 @@
33
33
  ]
34
34
  },
35
35
  "peerDependencies": {
36
- "@ledgerhq/lumen-design-core": "0.1.14",
37
- "@ledgerhq/lumen-ui-react": "0.1.35",
36
+ "@ledgerhq/lumen-design-core": "0.1.15",
37
+ "@ledgerhq/lumen-ui-react": "0.1.36",
38
38
  "class-variance-authority": "^0.7.1",
39
39
  "clsx": "^2.1.1",
40
40
  "react": "^18.0.0 || ^19.0.0",
@@ -42,7 +42,7 @@
42
42
  "tailwind-merge": "^2.6.0"
43
43
  },
44
44
  "dependencies": {
45
- "@ledgerhq/lumen-utils-shared": "0.1.3",
45
+ "@ledgerhq/lumen-utils-shared": "0.1.4",
46
46
  "d3-array": "^3.2.4",
47
47
  "d3-scale": "^4.0.2",
48
48
  "d3-shape": "^3.2.0"
@@ -1,3 +0,0 @@
1
- export { ChartTooltipItem } from './ChartTooltipItem';
2
- export { DefaultScrubberTooltip } from './DefaultScrubberTooltip';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC"}