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

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.
@@ -1,12 +1,12 @@
1
1
  const l = 160, r = {
2
- top: 50,
3
- right: 50,
4
- bottom: 50,
5
- left: 50
2
+ top: 25,
3
+ right: 25,
4
+ bottom: 25,
5
+ left: 25
6
6
  }, f = {
7
7
  position: "relative",
8
- top: -50,
9
- left: -50
8
+ top: -25,
9
+ left: -25
10
10
  }, e = {
11
11
  top: 0,
12
12
  right: 0,
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Shared fixtures for the Visualization Storybook stories.
3
+ *
4
+ * Every chart story renders through `<LineChart>` (never `<CartesianChart>`)
5
+ * and, where it makes sense, reuses the same dimensions and series so the
6
+ * examples stay visually consistent across the main component and its
7
+ * sub-components.
8
+ */
9
+ /** Standard chart width (CSS length) shared by every story. */
10
+ export declare const CHART_WIDTH = "100%";
11
+ /** Standard chart height (px) shared by every story. */
12
+ export declare const CHART_HEIGHT = 250;
13
+ /**
14
+ * Canonical single-series dataset reused across stories. Declared with
15
+ * `satisfies` so `data` stays a concrete `number[]` (handy for index lookups
16
+ * in tooltip/label stories) while remaining assignable to `Series[]`.
17
+ */
18
+ export declare const sampleSeries: {
19
+ id: string;
20
+ stroke: string;
21
+ data: number[];
22
+ }[];
23
+ /** Canonical two-series dataset for multi-line examples. */
24
+ export declare const multiSeries: {
25
+ id: string;
26
+ label: string;
27
+ stroke: string;
28
+ data: number[];
29
+ }[];
30
+ /**
31
+ * Dense, deterministic single-series dataset (160 points) shaped like a real
32
+ * price series: a seeded random walk with mild mean reversion and occasional
33
+ * larger moves. Deterministic so stories (and visual snapshots) render
34
+ * identically every time. Useful for features that need many data points to
35
+ * read clearly, such as the magnetic scrubber: the scrubber glides over the
36
+ * many ordinary points but snaps onto the few magnetic ones.
37
+ */
38
+ export declare const denseData: number[];
39
+ export declare const denseSeries: {
40
+ id: string;
41
+ stroke: string;
42
+ data: number[];
43
+ }[];
44
+ /** Month labels aligned to the 14-point `sampleSeries`, for axis/scrubber stories. */
45
+ export declare const monthLabels: string[];
46
+ //# sourceMappingURL=chartStoryFixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartStoryFixtures.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/LineChart/__stories__/chartStoryFixtures.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,WAAW,SAAS,CAAC;AAElC,wDAAwD;AACxD,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,YAAY;;;;GAML,CAAC;AAErB,4DAA4D;AAC5D,eAAO,MAAM,WAAW;;;;;GAaJ,CAAC;AAErB;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,UAqBlB,CAAC;AAEL,eAAO,MAAM,WAAW;;;;GAEJ,CAAC;AAErB,sFAAsF;AACtF,eAAO,MAAM,WAAW,UAevB,CAAC"}
@@ -3,30 +3,30 @@ import { memo as d } from "react";
3
3
  import { PADDING_X as n } from "./constants.js";
4
4
  import { cssVar as t } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
5
5
  const y = {
6
- fontSize: t("var(--font-style-body-4-size)"),
6
+ fontSize: t("var(--font-style-body-3-size)"),
7
7
  fontFamily: t("var(--font-family-font)"),
8
8
  fill: t("var(--text-muted)")
9
9
  }, c = {
10
- fontSize: t("var(--font-style-body-4-size)"),
10
+ fontSize: t("var(--font-style-body-3-size)"),
11
11
  fontFamily: t("var(--font-family-font)"),
12
12
  fill: t("var(--text-base)"),
13
- fontWeight: t("var(--font-style-body-4-weight-medium)")
14
- }, b = d(function({
13
+ fontWeight: t("var(--font-style-body-3-weight-semi-bold)")
14
+ }, L = d(function({
15
15
  label: r,
16
16
  value: f,
17
- x: e = 0,
18
- y: o = 0,
19
- width: m,
20
- labelRef: l,
17
+ x: o = 0,
18
+ y: e = 0,
19
+ width: l,
20
+ labelRef: m,
21
21
  valueRef: a
22
22
  }) {
23
23
  return /* @__PURE__ */ s("g", { children: [
24
24
  /* @__PURE__ */ i(
25
25
  "text",
26
26
  {
27
- ref: l,
28
- x: e + n,
29
- y: o,
27
+ ref: m,
28
+ x: o + n,
29
+ y: e,
30
30
  dominantBaseline: "middle",
31
31
  style: y,
32
32
  children: r
@@ -36,8 +36,8 @@ const y = {
36
36
  "text",
37
37
  {
38
38
  ref: a,
39
- x: e + m - n,
40
- y: o,
39
+ x: o + l - n,
40
+ y: e,
41
41
  dominantBaseline: "middle",
42
42
  textAnchor: "end",
43
43
  style: c,
@@ -47,5 +47,5 @@ const y = {
47
47
  ] });
48
48
  });
49
49
  export {
50
- b as ChartTooltipItem
50
+ L as ChartTooltipItem
51
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;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
+ {"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,kDAiEhC"}
@@ -1,74 +1,74 @@
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
- import { cssVar as o } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
1
+ import { jsxs as x, jsx as a } from "react/jsx-runtime";
2
+ import { ChartTooltipItem as g } from "./ChartTooltipItem.js";
3
+ import { TOOLTIP_TRANSITION as D, PADDING_Y as O, ROW_HEIGHT as f, PADDING_X as S, ROW_GAP as E, DEFAULT_OFFSET as L, DEFAULT_TOOLTIP_MIN_WIDTH as W } from "./constants.js";
4
+ import { useTooltipMeasurement as F, useBuildRefSetters as c, computeTooltipWidth as H, computeTooltipHeight as N, computeTooltipX as P, computeItemsBaseY as B } from "./utils.js";
5
+ import { cssVar as e } from "../../../../libs/design-core/dist/lib/cssVar/cssVar.js";
6
6
  const G = {
7
- fontSize: o("var(--font-style-body-4-size)"),
8
- fontFamily: o("var(--font-family-font)"),
9
- fill: o("var(--text-base)"),
10
- fontWeight: o("var(--font-style-body-4-weight-medium)")
7
+ fontSize: e("var(--font-style-body-3-size)"),
8
+ fontFamily: e("var(--font-family-font)"),
9
+ fill: e("var(--text-muted)"),
10
+ fontWeight: e("var(--font-style-body-3-weight-medium)")
11
11
  };
12
12
  function M({
13
- pixelX: h,
13
+ pixelX: m,
14
14
  drawingArea: l,
15
- title: n,
15
+ title: r,
16
16
  items: t,
17
- offset: T = W,
18
- minWidth: m = B
17
+ offset: d = L,
18
+ minWidth: h = W
19
19
  }) {
20
- const e = n !== void 0, { widths: p, titleRef: d, labelRefs: y, valueRefs: R } = F(
20
+ const o = r !== void 0, { widths: p, titleRef: T, labelRefs: y, valueRefs: v } = F(
21
21
  t,
22
- e,
23
- n
24
- ), I = u(y, t.length), v = u(R, t.length);
22
+ o,
23
+ r
24
+ ), I = c(y, t.length), b = c(v, t.length);
25
25
  if (t.length === 0)
26
26
  return null;
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(
27
+ const n = H(p, o, h), s = P(m, d, n, l), R = N(t.length, o), _ = B(l.y, o);
28
+ return /* @__PURE__ */ x(
29
29
  "g",
30
30
  {
31
31
  "data-testid": "chart-tooltip",
32
32
  role: "tooltip",
33
33
  style: {
34
34
  opacity: p === null ? 0 : 1,
35
- transition: O,
35
+ transition: D,
36
36
  pointerEvents: "none"
37
37
  },
38
38
  children: [
39
39
  /* @__PURE__ */ a(
40
40
  "rect",
41
41
  {
42
- x: r,
42
+ x: s,
43
43
  y: l.y,
44
- width: s,
45
- height: b,
46
- rx: S,
47
- fill: o("var(--background-muted)")
44
+ width: n,
45
+ height: R,
46
+ rx: e("var(--border-radius-sm)"),
47
+ fill: e("var(--background-muted)")
48
48
  }
49
49
  ),
50
- e && /* @__PURE__ */ a(
50
+ o && /* @__PURE__ */ a(
51
51
  "text",
52
52
  {
53
- ref: d,
53
+ ref: T,
54
54
  "data-testid": "chart-tooltip-title",
55
- x: r + E,
56
- y: l.y + g + f / 2,
55
+ x: s + S,
56
+ y: l.y + O + f / 2,
57
57
  dominantBaseline: "middle",
58
58
  style: G,
59
- children: n
59
+ children: r
60
60
  }
61
61
  ),
62
- t.map((c, i) => /* @__PURE__ */ a(
63
- x,
62
+ t.map((u, i) => /* @__PURE__ */ a(
63
+ g,
64
64
  {
65
- label: c.label,
66
- value: c.value,
67
- x: r,
68
- y: _ + i * (f + L) + f / 2,
69
- width: s,
65
+ label: u.label,
66
+ value: u.value,
67
+ x: s,
68
+ y: _ + i * (f + E) + f / 2,
69
+ width: n,
70
70
  labelRef: I[i],
71
- valueRef: v[i]
71
+ valueRef: b[i]
72
72
  },
73
73
  i
74
74
  ))
@@ -2,9 +2,8 @@ export declare const DEFAULT_OFFSET = 10;
2
2
  export declare const PADDING_X = 8;
3
3
  export declare const PADDING_Y = 8;
4
4
  export declare const ROW_HEIGHT = 16;
5
- export declare const ROW_GAP = 6;
5
+ export declare const ROW_GAP = 4;
6
6
  export declare const TITLE_GAP = 6;
7
- export declare const BORDER_RADIUS = 4;
8
7
  export declare const TOOLTIP_TRANSITION = "opacity 0.15s ease-out 0.05s";
9
8
  export declare const LABEL_VALUE_GAP = 12;
10
9
  export declare const DEFAULT_TOOLTIP_MIN_WIDTH = 80;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,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;AACjE,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,yBAAyB,KAAK,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Scrubber/DefaultScrubberTooltip/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,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,kBAAkB,iCAAiC,CAAC;AACjE,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,yBAAyB,KAAK,CAAC"}
@@ -1,13 +1,12 @@
1
- const o = 10, s = 8, t = 8, T = 16, _ = 6, c = 6, A = 4, I = "opacity 0.15s ease-out 0.05s", n = 12, D = 80;
1
+ const T = 10, o = 8, s = 8, t = 16, _ = 4, c = 6, A = "opacity 0.15s ease-out 0.05s", I = 12, n = 80;
2
2
  export {
3
- A as BORDER_RADIUS,
4
- o as DEFAULT_OFFSET,
5
- D as DEFAULT_TOOLTIP_MIN_WIDTH,
6
- n as LABEL_VALUE_GAP,
7
- s as PADDING_X,
8
- t as PADDING_Y,
3
+ T as DEFAULT_OFFSET,
4
+ n as DEFAULT_TOOLTIP_MIN_WIDTH,
5
+ I as LABEL_VALUE_GAP,
6
+ o as PADDING_X,
7
+ s as PADDING_Y,
9
8
  _ as ROW_GAP,
10
- T as ROW_HEIGHT,
9
+ t as ROW_HEIGHT,
11
10
  c as TITLE_GAP,
12
- I as TOOLTIP_TRANSITION
11
+ A as TOOLTIP_TRANSITION
13
12
  };
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react-visualization",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
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.15",
37
- "@ledgerhq/lumen-ui-react": "0.1.36",
36
+ "@ledgerhq/lumen-design-core": "0.1.16",
37
+ "@ledgerhq/lumen-ui-react": "0.1.38",
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.4",
45
+ "@ledgerhq/lumen-utils-shared": "0.1.5",
46
46
  "d3-array": "^3.2.4",
47
47
  "d3-scale": "^4.0.2",
48
48
  "d3-shape": "^3.2.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/lumen-ui-react-visualization",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
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.16",
37
- "@ledgerhq/lumen-ui-react": "0.1.37",
37
+ "@ledgerhq/lumen-ui-react": "0.1.39",
38
38
  "class-variance-authority": "^0.7.1",
39
39
  "clsx": "^2.1.1",
40
40
  "react": "^18.0.0 || ^19.0.0",