p1-charts 0.2.0 → 0.4.0

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 (168) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +158 -4
  3. package/dist/CategoryBarChart-KYzsjGwg.js +715 -0
  4. package/dist/CategoryBarChart-KYzsjGwg.js.map +1 -0
  5. package/dist/ChartFrame-DOEsou-R.js +403 -0
  6. package/dist/ChartFrame-DOEsou-R.js.map +1 -0
  7. package/dist/ChartLegend-B8ZmIG2y.js +46 -0
  8. package/dist/ChartLegend-B8ZmIG2y.js.map +1 -0
  9. package/dist/{Heatmap-C1XcTUg1.js → Heatmap-Bwhf305C.js} +278 -272
  10. package/dist/Heatmap-Bwhf305C.js.map +1 -0
  11. package/dist/{PieLegend-BZsv9IbF.js → PieLegend-16E6W10x.js} +94 -111
  12. package/dist/PieLegend-16E6W10x.js.map +1 -0
  13. package/dist/PolarChart-C_vPz-3K.js +489 -0
  14. package/dist/PolarChart-C_vPz-3K.js.map +1 -0
  15. package/dist/Sparkline-BApLVWfg.js +110 -0
  16. package/dist/Sparkline-BApLVWfg.js.map +1 -0
  17. package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BZMLERDZ.js} +530 -529
  18. package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BZMLERDZ.js.map} +1 -1
  19. package/dist/category.d.ts +5 -2
  20. package/dist/category.d.ts.map +1 -1
  21. package/dist/category.js +4 -3
  22. package/dist/charts/CategoryBarChart/index.d.ts +3 -1
  23. package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
  24. package/dist/charts/Heatmap/index.d.ts.map +1 -1
  25. package/dist/charts/PolarChart/index.d.ts.map +1 -1
  26. package/dist/charts/ScatterChart/index.d.ts +1 -1
  27. package/dist/charts/ScatterChart/index.d.ts.map +1 -1
  28. package/dist/charts/Sparkline/index.d.ts +5 -2
  29. package/dist/charts/Sparkline/index.d.ts.map +1 -1
  30. package/dist/components/ChartFrame/index.d.ts +7 -0
  31. package/dist/components/ChartFrame/index.d.ts.map +1 -0
  32. package/dist/components/ChartLegend/index.d.ts +13 -0
  33. package/dist/components/ChartLegend/index.d.ts.map +1 -0
  34. package/dist/components/ChartStory/index.d.ts +7 -0
  35. package/dist/components/ChartStory/index.d.ts.map +1 -0
  36. package/dist/components/HeatmapCells/index.d.ts +1 -1
  37. package/dist/components/HeatmapCells/index.d.ts.map +1 -1
  38. package/dist/{css-C-rsk7-l.js → css-BTZA9hea.js} +2 -2
  39. package/dist/{css-C-rsk7-l.js.map → css-BTZA9hea.js.map} +1 -1
  40. package/dist/heatmap.js +1 -1
  41. package/dist/hooks/useMarkMemory.d.ts +9 -0
  42. package/dist/hooks/useMarkMemory.d.ts.map +1 -0
  43. package/dist/hooks/usePieTween.d.ts.map +1 -1
  44. package/dist/hooks/useSteps.d.ts +4 -0
  45. package/dist/hooks/useSteps.d.ts.map +1 -0
  46. package/dist/hooks/useTween.d.ts +12 -0
  47. package/dist/hooks/useTween.d.ts.map +1 -0
  48. package/dist/index.d.ts +16 -1
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +122 -117
  51. package/dist/index.js.map +1 -1
  52. package/dist/motion.utils-DFoqptDi.js +55 -0
  53. package/dist/motion.utils-DFoqptDi.js.map +1 -0
  54. package/dist/pie.js +1 -1
  55. package/dist/scatter.d.ts +4 -1
  56. package/dist/scatter.d.ts.map +1 -1
  57. package/dist/scatter.js +3 -2
  58. package/dist/series.js +1 -1
  59. package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
  60. package/dist/shared-C1pGJV4T.js.map +1 -0
  61. package/dist/sparkline.d.ts +1 -1
  62. package/dist/sparkline.d.ts.map +1 -1
  63. package/dist/sparkline.js +2 -2
  64. package/dist/standalone/p1-charts.standalone.js +13 -0
  65. package/dist/standalone.d.ts +27 -0
  66. package/dist/standalone.d.ts.map +1 -0
  67. package/dist/story.d.ts +11 -0
  68. package/dist/story.d.ts.map +1 -0
  69. package/dist/story.js +7 -0
  70. package/dist/theme.js +3 -3
  71. package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DF_e8LxQ.js} +132 -113
  72. package/dist/theme.utils-DF_e8LxQ.js.map +1 -0
  73. package/dist/tooltip.utils-CXD_NapA.js +9 -0
  74. package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
  75. package/dist/types/category.d.ts +26 -0
  76. package/dist/types/category.d.ts.map +1 -1
  77. package/dist/types/heatmap.d.ts +3 -0
  78. package/dist/types/heatmap.d.ts.map +1 -1
  79. package/dist/types/heatmapParts.d.ts +2 -0
  80. package/dist/types/heatmapParts.d.ts.map +1 -1
  81. package/dist/types/motion.d.ts +31 -0
  82. package/dist/types/motion.d.ts.map +1 -0
  83. package/dist/types/pie.d.ts +3 -4
  84. package/dist/types/pie.d.ts.map +1 -1
  85. package/dist/types/polar.d.ts +3 -0
  86. package/dist/types/polar.d.ts.map +1 -1
  87. package/dist/types/scatter.d.ts +34 -0
  88. package/dist/types/scatter.d.ts.map +1 -1
  89. package/dist/types/sparkline.d.ts +3 -0
  90. package/dist/types/sparkline.d.ts.map +1 -1
  91. package/dist/types/story.d.ts +73 -0
  92. package/dist/types/story.d.ts.map +1 -0
  93. package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-D0bQ3LQq.js} +2 -2
  94. package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-D0bQ3LQq.js.map} +1 -1
  95. package/dist/useControllable-Crsr0byh.js +11 -0
  96. package/dist/useControllable-Crsr0byh.js.map +1 -0
  97. package/dist/useMarkMemory-CLNY6TtT.js +15 -0
  98. package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
  99. package/dist/useTween-B0G0CcvM.js +46 -0
  100. package/dist/useTween-B0G0CcvM.js.map +1 -0
  101. package/dist/utils/category.utils.d.ts +15 -1
  102. package/dist/utils/category.utils.d.ts.map +1 -1
  103. package/dist/utils/color.utils.d.ts +9 -0
  104. package/dist/utils/color.utils.d.ts.map +1 -1
  105. package/dist/utils/csv.utils.d.ts +6 -0
  106. package/dist/utils/csv.utils.d.ts.map +1 -0
  107. package/dist/utils/motion.utils.d.ts +25 -0
  108. package/dist/utils/motion.utils.d.ts.map +1 -1
  109. package/dist/utils/pieTween.utils.d.ts +1 -1
  110. package/dist/utils/pieTween.utils.d.ts.map +1 -1
  111. package/dist/utils/scatter.utils.d.ts +17 -1
  112. package/dist/utils/scatter.utils.d.ts.map +1 -1
  113. package/dist/utils/sparkline.utils.d.ts +15 -0
  114. package/dist/utils/sparkline.utils.d.ts.map +1 -1
  115. package/dist/utils/theme.utils.d.ts +1 -1
  116. package/dist/utils/theme.utils.d.ts.map +1 -1
  117. package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
  118. package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
  119. package/package.json +16 -5
  120. package/src/category.ts +5 -1
  121. package/src/charts/CategoryBarChart/index.tsx +310 -62
  122. package/src/charts/Heatmap/index.tsx +4 -0
  123. package/src/charts/PolarChart/index.tsx +98 -5
  124. package/src/charts/ScatterChart/index.tsx +164 -18
  125. package/src/charts/Sparkline/index.tsx +54 -7
  126. package/src/components/ChartFrame/index.tsx +180 -0
  127. package/src/components/ChartLegend/index.tsx +46 -0
  128. package/src/components/ChartStory/index.tsx +184 -0
  129. package/src/components/HeatmapCells/index.tsx +5 -2
  130. package/src/hooks/useMarkMemory.ts +29 -0
  131. package/src/hooks/usePieTween.ts +9 -44
  132. package/src/hooks/useSteps.ts +77 -0
  133. package/src/hooks/useTween.ts +112 -0
  134. package/src/index.ts +24 -1
  135. package/src/scatter.ts +4 -1
  136. package/src/sparkline.ts +1 -1
  137. package/src/standalone.tsx +68 -0
  138. package/src/story.ts +19 -0
  139. package/src/types/category.ts +27 -0
  140. package/src/types/heatmap.ts +3 -0
  141. package/src/types/heatmapParts.ts +2 -0
  142. package/src/types/motion.ts +35 -0
  143. package/src/types/pie.ts +3 -3
  144. package/src/types/polar.ts +3 -0
  145. package/src/types/scatter.ts +23 -0
  146. package/src/types/sparkline.ts +3 -0
  147. package/src/types/story.ts +103 -0
  148. package/src/utils/category.utils.ts +111 -2
  149. package/src/utils/color.utils.ts +48 -0
  150. package/src/utils/csv.utils.ts +28 -0
  151. package/src/utils/motion.utils.ts +124 -0
  152. package/src/utils/pieTween.utils.ts +1 -2
  153. package/src/utils/scatter.utils.ts +22 -5
  154. package/src/utils/sparkline.utils.ts +69 -0
  155. package/src/utils/theme.utils.ts +18 -15
  156. package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
  157. package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
  158. package/dist/Heatmap-C1XcTUg1.js.map +0 -1
  159. package/dist/PieLegend-BZsv9IbF.js.map +0 -1
  160. package/dist/PolarChart-BUEhn3CI.js +0 -334
  161. package/dist/PolarChart-BUEhn3CI.js.map +0 -1
  162. package/dist/Sparkline-DtNhxGVo.js +0 -67
  163. package/dist/Sparkline-DtNhxGVo.js.map +0 -1
  164. package/dist/motion.utils-C1eaZJdQ.js +0 -9
  165. package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
  166. package/dist/theme.utils-CP1XtGIe.js.map +0 -1
  167. package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
  168. package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
@@ -1,20 +1,23 @@
1
1
  "use client";
2
- import { n as e, o as t, t as n } from "./visibility.utils-nMI5a_Et.js";
3
- import { n as r, r as i, t as a } from "./heatmap-CIBukkjS.js";
4
- import { n as o, r as s, t as c } from "./tooltip.utils-D7xaBSUK.js";
5
- import { n as l, t as u } from "./dom.utils-CKMWLto-.js";
6
- import { t as d } from "./useChartTheme-B06p_jvu.js";
7
- import { useEffect as f, useId as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
8
- import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
2
+ import { a as e, t } from "./visibility.utils-wuc3ZS8D.js";
3
+ import { n, r, t as i } from "./heatmap-CIBukkjS.js";
4
+ import { n as a, t as o } from "./shared-C1pGJV4T.js";
5
+ import { n as s, t as c } from "./dom.utils-CKMWLto-.js";
6
+ import { t as l } from "./motion.utils-DFoqptDi.js";
7
+ import { t as u } from "./useChartTheme-D0bQ3LQq.js";
8
+ import { t as d } from "./useControllable-Crsr0byh.js";
9
+ import { t as f } from "./tooltip.utils-CXD_NapA.js";
10
+ import { useEffect as p, useId as m, useLayoutEffect as h, useMemo as g, useRef as _, useState as v } from "react";
11
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
9
12
  //#region src/utils/heatmap.utils.ts
10
- var x = 6, S = 26;
11
- function C(e, n, r, i) {
12
- let a = e.map((e, t) => n.map((n, i) => {
13
+ var S = 6, C = 26;
14
+ function w(t, n, r, i) {
15
+ let a = t.map((e, t) => n.map((n, i) => {
13
16
  let a = r(e, n, t, i);
14
17
  return typeof a == "number" && Number.isFinite(a) ? a : null;
15
- })), o = a.flat().filter((e) => e !== null), { thresholds: s, step: c } = t(o, i);
18
+ })), o = a.flat().filter((e) => e !== null), { thresholds: s, step: c } = e(o, i);
16
19
  return {
17
- grid: e.map((e, t) => n.map((n, r) => {
20
+ grid: t.map((e, t) => n.map((n, r) => {
18
21
  let i = a[t][r];
19
22
  return {
20
23
  row: e,
@@ -28,22 +31,22 @@ function C(e, n, r, i) {
28
31
  thresholds: s
29
32
  };
30
33
  }
31
- function w(e, t, n) {
34
+ function T(e, t, n) {
32
35
  if (e < 1 || !n.length) return;
33
36
  if (t <= 1) return n[n.length - 1];
34
37
  let r = Math.round((e - 1) * (n.length - 1) / (t - 1));
35
38
  return n[Math.min(r, n.length - 1)];
36
39
  }
37
- var T = (e, t) => ({
40
+ var E = (e, t) => ({
38
41
  r0: Math.min(e.r, t.r),
39
42
  r1: Math.max(e.r, t.r),
40
43
  c0: Math.min(e.c, t.c),
41
44
  c1: Math.max(e.c, t.c)
42
- }), E = (e, t, n) => !!e && t >= e.r0 && t <= e.r1 && n >= e.c0 && n <= e.c1;
43
- function D(e, t, n = []) {
45
+ }), D = (e, t, n) => !!e && t >= e.r0 && t <= e.r1 && n >= e.c0 && n <= e.c1;
46
+ function O(e, t, n = []) {
44
47
  let r = 0, i = 0, a = 0, o = null, s = null;
45
48
  return e.forEach((e, c) => e.forEach((e, l) => {
46
- if (E(t, c, l)) {
49
+ if (D(t, c, l)) {
47
50
  if (e.value === null) return void i++;
48
51
  n.includes(e.step) || (r++, a += e.value, (!o || e.value < o.value) && (o = e), (!s || e.value > s.value) && (s = e));
49
52
  }
@@ -55,8 +58,8 @@ function D(e, t, n = []) {
55
58
  max: s
56
59
  };
57
60
  }
58
- function O(e) {
59
- let { min: t, max: n } = D(e, {
61
+ function k(e) {
62
+ let { min: t, max: n } = O(e, {
60
63
  r0: 0,
61
64
  r1: e.length - 1,
62
65
  c0: 0,
@@ -67,24 +70,24 @@ function O(e) {
67
70
  max: n
68
71
  };
69
72
  }
70
- function k({ rows: e, cols: t, cellSize: n = 30, labelWidth: r = 46, gap: i = 0 }) {
73
+ function A({ rows: e, cols: t, cellSize: n = 30, labelWidth: r = 46, gap: i = 0 }) {
71
74
  return {
72
75
  rows: e,
73
76
  cols: t,
74
- top: x,
77
+ top: S,
75
78
  width: r + t * n + 4,
76
- height: x + e * n + S,
79
+ height: S + e * n + C,
77
80
  cellSize: n,
78
81
  labelWidth: r,
79
- axisY: x + e * n,
82
+ axisY: S + e * n,
80
83
  cell: (e, t) => ({
81
84
  x: r + t * n + i / 2,
82
- y: x + e * n + i / 2,
85
+ y: S + e * n + i / 2,
83
86
  size: Math.max(n - i, 0)
84
87
  })
85
88
  };
86
89
  }
87
- function A({ rows: e, cols: t, top: n, cellSize: r, labelWidth: i }, a, o, s = !1) {
90
+ function j({ rows: e, cols: t, top: n, cellSize: r, labelWidth: i }, a, o, s = !1) {
88
91
  let c = Math.floor((a - i) / r), l = Math.floor((o - n) / r), u = (e, t) => Math.min(Math.max(e, 0), t - 1);
89
92
  return s && e && t ? {
90
93
  r: u(l, e),
@@ -94,12 +97,12 @@ function A({ rows: e, cols: t, top: n, cellSize: r, labelWidth: i }, a, o, s = !
94
97
  c
95
98
  } : null;
96
99
  }
97
- function j(e, t, { clientX: n, clientY: r }, i = !1) {
100
+ function M(e, t, { clientX: n, clientY: r }, i = !1) {
98
101
  let a = t.getBoundingClientRect();
99
- return !a.width || !a.height ? null : A(e, (n - a.left) * e.width / a.width, (r - a.top) * e.height / a.height, i);
102
+ return !a.width || !a.height ? null : j(e, (n - a.left) * e.width / a.width, (r - a.top) * e.height / a.height, i);
100
103
  }
101
- function M(e, t, n, r, i) {
102
- return t ? e === "none" ? !1 : e === "cell" ? t.r !== r || t.c !== i : t.r !== r && t.c !== i : !!n && !E(n, r, i);
104
+ function ee(e, t, n, r, i) {
105
+ return t ? e === "none" ? !1 : e === "cell" ? t.r !== r || t.c !== i : t.r !== r && t.c !== i : !!n && !D(n, r, i);
103
106
  }
104
107
  var N = {
105
108
  solid: void 0,
@@ -111,7 +114,7 @@ var N = {
111
114
  strokeDasharray: N[e?.style ?? "solid"]
112
115
  }), F = new Intl.NumberFormat(), I = (e) => String(e);
113
116
  function L(e) {
114
- let { rows: t, cols: n, value: r, steps: i, colors: a, scale: o, unit: s, markExtreme: c = !1, formatValue: l = F.format, formatRow: u = I, formatCol: f = I, describeCell: m } = e, g = d(e), _ = g?.heatmap, v = g && a || g?.palette.sequential || [], y = Array.isArray(i) ? i : void 0, b = y ? y.length + 1 : i ?? (v.length || 5), { grid: x, thresholds: S } = h(() => C(t, n, r, {
117
+ let { rows: t, cols: n, value: r, steps: i, colors: a, scale: o, unit: s, markExtreme: c = !1, formatValue: l = F.format, formatRow: d = I, formatCol: f = I, describeCell: p } = e, h = u(e), _ = h?.heatmap, v = h && a || h?.palette.sequential || [], y = Array.isArray(i) ? i : void 0, b = y ? y.length + 1 : i ?? (v.length || 5), { grid: x, thresholds: S } = g(() => w(t, n, r, {
115
118
  count: b,
116
119
  thresholds: y,
117
120
  scale: o
@@ -122,72 +125,72 @@ function L(e) {
122
125
  b,
123
126
  y,
124
127
  o
125
- ]), T = k({
128
+ ]), C = A({
126
129
  rows: t.length,
127
130
  cols: n.length,
128
131
  gap: e.gap ?? _?.gap ?? 0
129
- }), E = h(() => O(x), [x]), A = ["max", "min"].flatMap((e) => {
132
+ }), E = g(() => k(x), [x]), D = ["max", "min"].flatMap((e) => {
130
133
  let t = E[e];
131
134
  return t && (c === e || c === "both") ? [{
132
135
  kind: e,
133
136
  cell: t
134
137
  }] : [];
135
138
  }), j = (e, t) => {
136
- let n = `${u(t.row, t.r)} ${f(t.col, t.c)}`, r = `${l(t.value)}${s ? ` ${s}` : ""}`;
139
+ let n = `${d(t.row, t.r)} ${f(t.col, t.c)}`, r = `${l(t.value)}${s ? ` ${s}` : ""}`;
137
140
  return `${e === "max" ? "peak" : "low"} ${n} · ${r}`;
138
- }, M = m ?? ((e) => `${u(e.row, e.r)} ${f(e.col, e.c)}, ${e.value === null ? "no data" : `${l(e.value)}${s ? ` ${s}` : ""}, step ${e.step} of ${b}`}`);
141
+ }, M = p ?? ((e) => `${d(e.row, e.r)} ${f(e.col, e.c)}, ${e.value === null ? "no data" : `${l(e.value)}${s ? ` ${s}` : ""}, step ${e.step} of ${b}`}`);
139
142
  return {
140
- theme: g,
143
+ theme: h,
141
144
  summarise: (e, r) => {
142
- let { count: i, mean: a } = D(x, e, r), o = (e, t) => e === t ? e : `${e} to ${t}`;
143
- return `Selected ${o(u(t[e.r0], e.r0), u(t[e.r1], e.r1))}, ${o(f(n[e.c0], e.c0), f(n[e.c1], e.c1))}: ${i} cells, ${a === null ? "no data" : `mean ${l(a)}`}`;
145
+ let { count: i, mean: a } = O(x, e, r), o = (e, t) => e === t ? e : `${e} to ${t}`;
146
+ return `Selected ${o(d(t[e.r0], e.r0), d(t[e.r1], e.r1))}, ${o(f(n[e.c0], e.c0), f(n[e.c1], e.c1))}: ${i} cells, ${a === null ? "no data" : `mean ${l(a)}`}`;
144
147
  },
145
148
  grid: x,
146
149
  count: b,
147
150
  thresholds: S,
148
- layout: T,
149
- marks: A,
150
- marked: A.map((e) => e.cell),
151
+ layout: C,
152
+ marks: D,
153
+ marked: D.map((e) => e.cell),
151
154
  markLabel: j,
152
155
  describe: M,
153
156
  formatValue: l,
154
- formatRow: u,
157
+ formatRow: d,
155
158
  formatCol: f,
156
- hatchId: `hm-hatch-${p().replace(/[^a-zA-Z0-9-]/g, "")}`,
157
- fill: (e) => w(e, b, v),
158
- ink: (e) => w(e, b, _?.valueInk ?? [])
159
+ hatchId: `hm-hatch-${m().replace(/[^a-zA-Z0-9-]/g, "")}`,
160
+ fill: (e) => T(e, b, v),
161
+ ink: (e) => T(e, b, _?.valueInk ?? [])
159
162
  };
160
163
  }
161
164
  //#endregion
162
165
  //#region src/hooks/useHeatmapSteps.ts
163
166
  var R = [];
164
- function z({ count: t, thresholds: r, fill: i, hiddenSteps: a, defaultHiddenSteps: o = R, onHiddenStepsChange: s }) {
165
- let [c, l] = e(a, o), [u, d] = _(null), f = Array.from({ length: t }, (e, t) => t + 1), p = (e, t) => {
166
- let r = f.map(String), i = c.map(String), a = n(r, i, String(e), t);
167
+ function z({ count: e, thresholds: n, fill: r, hiddenSteps: i, defaultHiddenSteps: a = R, onHiddenStepsChange: o }) {
168
+ let [s, c] = d(i, a), [l, u] = v(null), f = Array.from({ length: e }, (e, t) => t + 1), p = (e, n) => {
169
+ let r = f.map(String), i = s.map(String), a = t(r, i, String(e), n);
167
170
  if (a === i) return;
168
- let o = a.map(Number);
169
- l(o), s?.(o);
170
- }, m = f.map((e) => ({
171
- step: e,
172
- from: e > 1 ? r[e - 2] ?? null : null,
173
- to: e < t ? r[e - 1] ?? null : null,
174
- color: i(e),
175
- hidden: c.includes(e),
176
- active: u === e,
177
- toggle: () => p(e, !1),
178
- isolate: () => p(e, !0),
179
- enter: () => d(e),
180
- leave: () => d((t) => t === e ? null : t)
171
+ let l = a.map(Number);
172
+ c(l), o?.(l);
173
+ }, m = f.map((t) => ({
174
+ step: t,
175
+ from: t > 1 ? n[t - 2] ?? null : null,
176
+ to: t < e ? n[t - 1] ?? null : null,
177
+ color: r(t),
178
+ hidden: s.includes(t),
179
+ active: l === t,
180
+ toggle: () => p(t, !1),
181
+ isolate: () => p(t, !0),
182
+ enter: () => u(t),
183
+ leave: () => u((e) => e === t ? null : e)
181
184
  }));
182
185
  return {
183
- hidden: c,
184
- preview: u !== null && c.includes(u) ? null : u,
186
+ hidden: s,
187
+ preview: l !== null && s.includes(l) ? null : l,
185
188
  entries: m
186
189
  };
187
190
  }
188
191
  //#endregion
189
192
  //#region src/components/HeatmapAxis/index.tsx
190
- function B({ rows: e, cols: t, theme: n, layout: r, formatRow: a, formatCol: o, colTickEvery: s, active: c, hits: l, classNames: u, styles: d }) {
193
+ function B({ rows: e, cols: t, theme: n, layout: i, formatRow: a, formatCol: o, colTickEvery: s, active: c, hits: l, classNames: u, styles: d }) {
191
194
  let f = n?.typography.axis, p = {
192
195
  fontSize: f?.size ?? 11,
193
196
  fontFamily: f?.family,
@@ -196,56 +199,56 @@ function B({ rows: e, cols: t, theme: n, layout: r, formatRow: a, formatCol: o,
196
199
  fill: "transparent",
197
200
  style: { cursor: "pointer" }
198
201
  };
199
- return /* @__PURE__ */ b("g", {
202
+ return /* @__PURE__ */ x("g", {
200
203
  "aria-hidden": "true",
201
204
  children: [
202
- l && e.map((e, t) => /* @__PURE__ */ y("rect", {
205
+ l && e.map((e, t) => /* @__PURE__ */ b("rect", {
203
206
  "data-hit": "row",
204
207
  "data-at": t,
205
208
  x: 0,
206
- y: r.top + t * r.cellSize,
207
- width: r.labelWidth - 2,
208
- height: r.cellSize,
209
+ y: i.top + t * i.cellSize,
210
+ width: i.labelWidth - 2,
211
+ height: i.cellSize,
209
212
  ...h
210
213
  }, `hr${t}`)),
211
- l && t.map((e, t) => /* @__PURE__ */ y("rect", {
214
+ l && t.map((e, t) => /* @__PURE__ */ b("rect", {
212
215
  "data-hit": "col",
213
216
  "data-at": t,
214
- x: r.labelWidth + t * r.cellSize,
215
- y: r.axisY + 2,
216
- width: r.cellSize,
217
+ x: i.labelWidth + t * i.cellSize,
218
+ y: i.axisY + 2,
219
+ width: i.cellSize,
217
220
  height: 22,
218
221
  ...h
219
222
  }, `hc${t}`)),
220
223
  e.map((e, t) => {
221
- let { y: n, size: o } = r.cell(t, 0);
222
- return /* @__PURE__ */ y("text", {
224
+ let { y: n, size: o } = i.cell(t, 0);
225
+ return /* @__PURE__ */ b("text", {
223
226
  "data-part": "row-label",
224
227
  "data-r": t,
225
228
  "data-active": c?.r === t || void 0,
226
- x: r.labelWidth - 10,
229
+ x: i.labelWidth - 10,
227
230
  y: n + o / 2,
228
231
  dy: "0.35em",
229
232
  textAnchor: "end",
230
233
  ...p,
231
234
  className: u?.["row-label"],
232
235
  style: {
233
- ...i,
236
+ ...r,
234
237
  ...d?.["row-label"]
235
238
  },
236
239
  children: a(e, t)
237
240
  }, `r${t}`);
238
241
  }),
239
- t.map((e, t) => t % m === 0 || c?.c === t ? /* @__PURE__ */ y("text", {
242
+ t.map((e, t) => t % m === 0 || c?.c === t ? /* @__PURE__ */ b("text", {
240
243
  "data-part": "col-label",
241
244
  "data-c": t,
242
245
  "data-active": c?.c === t || void 0,
243
- x: r.cell(0, t).x,
244
- y: r.axisY + 17,
246
+ x: i.cell(0, t).x,
247
+ y: i.axisY + 17,
245
248
  ...p,
246
249
  className: u?.["col-label"],
247
250
  style: {
248
- ...i,
251
+ ...r,
249
252
  ...d?.["col-label"]
250
253
  },
251
254
  children: o(e, t)
@@ -256,32 +259,32 @@ function B({ rows: e, cols: t, theme: n, layout: r, formatRow: a, formatCol: o,
256
259
  //#endregion
257
260
  //#region src/components/HeatmapCells/index.tsx
258
261
  var V = 6;
259
- function H({ grid: e, theme: t, layout: n, rowKey: r, colKey: a, marked: o, showValues: s, hatchId: c, describe: l, formatValue: u, fill: d, ink: f, dimmed: p, selected: m, filtered: h, selectable: g, stop: _, handlers: x, classNames: S, styles: C }) {
260
- let w = t?.heatmap.dimOpacity, T = t?.heatmap.filteredOpacity, E = (e) => h(e.step) ? T : p(e.r, e.c) ? w : void 0, D = (e) => t ? e ? d(e) : `url(#${c})` : void 0, O = t?.heatmap.missing;
261
- return /* @__PURE__ */ b(v, { children: [
262
- t && /* @__PURE__ */ y("defs", { children: /* @__PURE__ */ b("pattern", {
262
+ function H({ grid: e, theme: t, layout: n, rowKey: i, colKey: a, marked: o, showValues: s, hatchId: c, describe: l, formatValue: u, fill: d, ink: f, dimmed: p, selected: m, filtered: h, selectable: g, stop: _, handlers: v, transition: S, classNames: C, styles: w }) {
263
+ let T = t?.heatmap.dimOpacity, E = t?.heatmap.filteredOpacity, D = (e) => h(e.step) ? E : p(e.r, e.c) ? T : void 0, O = (e) => t ? e ? d(e) : `url(#${c})` : void 0, k = t?.heatmap.missing;
264
+ return /* @__PURE__ */ x(y, { children: [
265
+ t && /* @__PURE__ */ b("defs", { children: /* @__PURE__ */ x("pattern", {
263
266
  id: c,
264
267
  width: 4,
265
268
  height: 4,
266
269
  patternUnits: "userSpaceOnUse",
267
270
  patternTransform: "rotate(45)",
268
- children: [/* @__PURE__ */ y("rect", {
271
+ children: [/* @__PURE__ */ b("rect", {
269
272
  width: 4,
270
273
  height: 4,
271
- fill: O?.fill ?? t.palette.background
272
- }), /* @__PURE__ */ y("line", {
274
+ fill: k?.fill ?? t.palette.background
275
+ }), /* @__PURE__ */ b("line", {
273
276
  y2: 4,
274
- stroke: O?.hatch ?? t.palette.grid,
277
+ stroke: k?.hatch ?? t.palette.grid,
275
278
  strokeWidth: 1
276
279
  })]
277
280
  }) }),
278
- e.map((e, i) => e.length ? /* @__PURE__ */ y("g", {
281
+ e.map((e, r) => e.length ? /* @__PURE__ */ b("g", {
279
282
  role: "row",
280
283
  children: e.map((e) => {
281
- let { x: i, y: s, size: c } = n.cell(e.r, e.c), u = p(e.r, e.c);
282
- return /* @__PURE__ */ y("rect", {
284
+ let { x: r, y: s, size: c } = n.cell(e.r, e.c), u = p(e.r, e.c);
285
+ return /* @__PURE__ */ b("rect", {
283
286
  "data-part": "cell",
284
- "data-row": r(e.row, e.r),
287
+ "data-row": i(e.row, e.r),
285
288
  "data-col": a(e.col, e.c),
286
289
  "data-step": e.step,
287
290
  "data-missing": e.step === 0 || void 0,
@@ -293,42 +296,44 @@ function H({ grid: e, theme: t, layout: n, rowKey: r, colKey: a, marked: o, show
293
296
  tabIndex: e.r === _.r && e.c === _.c ? 0 : -1,
294
297
  "aria-label": l(e),
295
298
  "aria-selected": g ? m(e.r, e.c) : void 0,
296
- x: i,
299
+ x: r,
297
300
  y: s,
298
301
  width: c,
299
302
  height: c,
300
- fill: D(e.step),
301
- opacity: E(e),
302
- className: S?.cell,
303
+ fill: O(e.step),
304
+ opacity: D(e),
305
+ className: C?.cell,
303
306
  style: t ? {
304
307
  outline: "none",
305
- ...C?.cell
306
- } : C?.cell,
307
- onFocus: (t) => x.focus(e, t.currentTarget),
308
- onBlur: x.blur,
309
- onKeyDown: (t) => x.keyDown(t, e)
308
+ transition: S,
309
+ ...w?.cell
310
+ } : w?.cell,
311
+ onFocus: (t) => v.focus(e, t.currentTarget),
312
+ onBlur: v.blur,
313
+ onKeyDown: (t) => v.keyDown(t, e)
310
314
  }, a(e.col, e.c));
311
315
  })
312
- }, r(e[0].row, i)) : null),
313
- s && /* @__PURE__ */ y("g", {
316
+ }, i(e[0].row, r)) : null),
317
+ s && /* @__PURE__ */ b("g", {
314
318
  "aria-hidden": "true",
315
319
  children: e.flat().map((e) => {
316
- let { x: r, y: a, size: o } = n.cell(e.r, e.c), s = e.value === null ? "" : u(e.value);
317
- return !s || s.length * V > o - 2 ? null : /* @__PURE__ */ y("text", {
320
+ let { x: i, y: a, size: o } = n.cell(e.r, e.c), s = e.value === null ? "" : u(e.value);
321
+ return !s || s.length * V > o - 2 ? null : /* @__PURE__ */ b("text", {
318
322
  "data-part": "value",
319
323
  "data-step": e.step,
320
324
  "data-dimmed": p(e.r, e.c) || void 0,
321
- opacity: E(e),
322
- x: r + o / 2,
325
+ opacity: D(e),
326
+ x: i + o / 2,
323
327
  y: a + o / 2,
324
328
  dy: "0.35em",
325
329
  textAnchor: "middle",
326
330
  fontSize: 10,
327
331
  fill: t ? f(e.step) ?? t.palette.text : void 0,
328
- className: S?.value,
332
+ className: C?.value,
329
333
  style: {
330
- ...i,
331
- ...C?.value
334
+ ...r,
335
+ ...t && { transition: S },
336
+ ...w?.value
332
337
  },
333
338
  children: s
334
339
  }, `${e.r}:${e.c}`);
@@ -344,10 +349,10 @@ var U = {
344
349
  };
345
350
  function W({ theme: e, layout: t, marked: n, active: r, focused: i, range: a, classNames: o, styles: s }) {
346
351
  let c = e && (e.heatmap.extreme?.color ?? e.palette.text), l = i ? "focus" : "active", u = e && P(e.heatmap[l], e.palette.crosshairLabel), d = r && t.cell(r.r, r.c), f = u?.strokeWidth ?? 2, p = e && P(e.heatmap.selection, e.palette.crosshairLabel), m = (p?.strokeWidth ?? 2) / 2;
347
- return /* @__PURE__ */ b(v, { children: [
352
+ return /* @__PURE__ */ x(y, { children: [
348
353
  n.map((e) => {
349
354
  let { x: n, y: r, size: i } = t.cell(e.r, e.c), [a, l] = [n + i - 2, r + 2], u = Math.min(9, i / 3);
350
- return /* @__PURE__ */ y("path", {
355
+ return /* @__PURE__ */ b("path", {
351
356
  "data-part": "extreme",
352
357
  "data-row": e.r,
353
358
  "data-col": e.c,
@@ -361,7 +366,7 @@ function W({ theme: e, layout: t, marked: n, active: r, focused: i, range: a, cl
361
366
  }
362
367
  }, `${e.r}:${e.c}`);
363
368
  }),
364
- a && /* @__PURE__ */ y("rect", {
369
+ a && /* @__PURE__ */ b("rect", {
365
370
  "data-part": "selection",
366
371
  "aria-hidden": "true",
367
372
  x: t.labelWidth + a.c0 * t.cellSize - m,
@@ -375,7 +380,7 @@ function W({ theme: e, layout: t, marked: n, active: r, focused: i, range: a, cl
375
380
  ...s?.selection
376
381
  }
377
382
  }),
378
- d && /* @__PURE__ */ y("rect", {
383
+ d && /* @__PURE__ */ b("rect", {
379
384
  "data-part": l,
380
385
  "aria-hidden": "true",
381
386
  x: d.x + f / 2,
@@ -396,16 +401,16 @@ function W({ theme: e, layout: t, marked: n, active: r, focused: i, range: a, cl
396
401
  var G = new Intl.NumberFormat();
397
402
  function K({ entries: e, marks: t = [], unit: n, formatValue: r = G.format, className: i, style: a, classNames: o }) {
398
403
  let s = (e, t) => e === null ? t === null ? "all" : `< ${r(t)}` : t === null ? `≥ ${r(e)}` : `${r(e)} to ${r(t)}`;
399
- return /* @__PURE__ */ b("ul", {
404
+ return /* @__PURE__ */ x("ul", {
400
405
  "data-part": "legend",
401
- className: u(i, o?.legend),
406
+ className: c(i, o?.legend),
402
407
  style: a,
403
408
  children: [
404
- n && /* @__PURE__ */ y("li", {
409
+ n && /* @__PURE__ */ b("li", {
405
410
  "data-unit": !0,
406
411
  children: n
407
412
  }),
408
- e.map(({ step: e, from: t, to: n, color: r, hidden: i, active: a, ...c }) => /* @__PURE__ */ y("li", { children: /* @__PURE__ */ b("button", {
413
+ e.map(({ step: e, from: t, to: n, color: r, hidden: i, active: a, ...c }) => /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
409
414
  type: "button",
410
415
  role: "checkbox",
411
416
  "aria-checked": !i,
@@ -419,27 +424,27 @@ function K({ entries: e, marks: t = [], unit: n, formatValue: r = G.format, clas
419
424
  onMouseLeave: c.leave,
420
425
  onFocus: c.enter,
421
426
  onBlur: c.leave,
422
- children: [/* @__PURE__ */ y("span", {
427
+ children: [/* @__PURE__ */ b("span", {
423
428
  "data-swatch": !0,
424
429
  "data-step": e,
425
430
  "aria-hidden": "true",
426
431
  style: r ? { background: r } : void 0
427
- }), /* @__PURE__ */ y("span", {
432
+ }), /* @__PURE__ */ b("span", {
428
433
  "data-range": !0,
429
434
  children: s(t, n)
430
435
  })]
431
436
  }) }, e)),
432
- t.map((e) => /* @__PURE__ */ y("li", { children: /* @__PURE__ */ b("button", {
437
+ t.map((e) => /* @__PURE__ */ b("li", { children: /* @__PURE__ */ x("button", {
433
438
  type: "button",
434
439
  "data-part": "legend-item",
435
440
  "data-mark": e.kind,
436
441
  className: o?.["legend-item"],
437
442
  onClick: e.focus,
438
- children: [/* @__PURE__ */ y("span", {
443
+ children: [/* @__PURE__ */ b("span", {
439
444
  "data-swatch": !0,
440
445
  "data-mark": e.kind,
441
446
  "aria-hidden": "true"
442
- }), /* @__PURE__ */ y("span", {
447
+ }), /* @__PURE__ */ b("span", {
443
448
  "data-range": !0,
444
449
  children: e.label
445
450
  })]
@@ -453,33 +458,33 @@ var q = {
453
458
  pointer: 16,
454
459
  keyboard: 4
455
460
  };
456
- function J({ active: e, source: t, root: n, svg: r, layout: i, render: a, className: o, style: l }) {
457
- let u = g(null), [d, p] = _(null), h = t === "pointer" || t === "keyboard" ? t : null, v = n.current?.getBoundingClientRect(), b = r.current?.getBoundingClientRect(), x = b && i.width ? b.width / i.width : 0, S = e && i.cell(e.r, e.c), C = !e || !h ? null : h === "pointer" ? d : v && b && S ? [b.left - v.left + (S.x + S.size) * x, b.top - v.top + (S.y + S.size) * x] : null;
458
- return f(() => {
461
+ function J({ active: e, source: t, root: n, svg: r, layout: i, render: o, className: s, style: c }) {
462
+ let l = _(null), [u, d] = v(null), m = t === "pointer" || t === "keyboard" ? t : null, g = n.current?.getBoundingClientRect(), y = r.current?.getBoundingClientRect(), x = y && i.width ? y.width / i.width : 0, S = e && i.cell(e.r, e.c), C = !e || !m ? null : m === "pointer" ? u : g && y && S ? [y.left - g.left + (S.x + S.size) * x, y.top - g.top + (S.y + S.size) * x] : null;
463
+ return p(() => {
459
464
  let e = n.current, t = (t) => {
460
465
  let n = e.getBoundingClientRect();
461
- p([t.clientX - n.left, t.clientY - n.top]);
466
+ d([t.clientX - n.left, t.clientY - n.top]);
462
467
  };
463
468
  return e?.addEventListener("pointermove", t), e?.addEventListener("mousemove", t), () => {
464
469
  e?.removeEventListener("pointermove", t), e?.removeEventListener("mousemove", t);
465
470
  };
466
- }, [n]), m(() => {
467
- let e = u.current, t = e?.parentElement;
468
- if (!e || !t || !C || !h) return;
469
- let [n, r] = c(C, q[h], [e.offsetWidth, e.offsetHeight], [t.clientWidth, t.clientHeight]);
471
+ }, [n]), h(() => {
472
+ let e = l.current, t = e?.parentElement;
473
+ if (!e || !t || !C || !m) return;
474
+ let [n, r] = f(C, q[m], [e.offsetWidth, e.offsetHeight], [t.clientWidth, t.clientHeight]);
470
475
  e.style.transform = `translate(${n}px, ${r}px)`;
471
- }), !e || !h || !C ? null : /* @__PURE__ */ y("div", {
472
- ref: u,
476
+ }), !e || !m || !C ? null : /* @__PURE__ */ b("div", {
477
+ ref: l,
473
478
  "data-part": "tooltip",
474
- "data-source": h,
479
+ "data-source": m,
475
480
  "aria-hidden": "true",
476
- className: o,
481
+ className: s,
477
482
  style: {
478
- ...s,
479
- ...l
483
+ ...a,
484
+ ...c
480
485
  },
481
- children: a(e, {
482
- source: h,
486
+ children: o(e, {
487
+ source: m,
483
488
  x: C[0],
484
489
  y: C[1]
485
490
  })
@@ -504,33 +509,33 @@ var Y = {
504
509
  r: 0,
505
510
  c: 1
506
511
  }
507
- }, ee = (e, t) => e === t || !!e && !!t && e.r === t.r && e.c === t.c;
508
- function X({ grid: t, layout: n, activeCell: r, onActiveChange: i, onCellHover: a, onCellLeave: o }) {
509
- let s = g(null), [c, u] = e(r, null), [d, f] = _(null), [p, m] = _(!1), [h, v] = _({
512
+ }, te = (e, t) => e === t || !!e && !!t && e.r === t.r && e.c === t.c;
513
+ function X({ grid: e, layout: t, activeCell: n, onActiveChange: r, onCellHover: i, onCellLeave: a }) {
514
+ let o = _(null), [c, l] = d(n, null), [u, f] = v(null), [p, m] = v(!1), [h, g] = v({
510
515
  r: 0,
511
516
  c: 0
512
- }), y = (e) => e && t[e.r]?.[e.c] || null, b = y(c), x = y(h) ? h : {
517
+ }), y = (t) => t && e[t.r]?.[t.c] || null, b = y(c), x = y(h) ? h : {
513
518
  r: 0,
514
519
  c: 0
515
520
  }, S = (e, t) => {
516
- if (f(t), ee(e, c)) return;
517
- let [n, r] = [y(c), y(e)];
518
- u(e && {
521
+ if (f(t), te(e, c)) return;
522
+ let [n, o] = [y(c), y(e)];
523
+ l(e && {
519
524
  r: e.r,
520
525
  c: e.c
521
- }), n && o?.(n), r && a?.(r), i?.(r, t);
522
- }, C = (e) => S(j(n, e.currentTarget, e), "pointer"), w = () => {
523
- d === "pointer" && S(null, "pointer");
526
+ }), n && a?.(n), o && i?.(o), r?.(o, t);
527
+ }, C = (e) => S(M(t, e.currentTarget, e), "pointer"), w = () => {
528
+ u === "pointer" && S(null, "pointer");
524
529
  }, T = (e, t) => {
525
- v(e), m(l(t)), S(e, "keyboard");
530
+ g(e), m(s(t)), S(e, "keyboard");
526
531
  }, E = () => {
527
- m(!1), d === "keyboard" && S(null, "keyboard");
528
- }, D = ({ r: e, c: t }) => s.current?.querySelectorAll("[data-part=\"cell\"]")[e * n.cols + t]?.focus();
532
+ m(!1), u === "keyboard" && S(null, "keyboard");
533
+ }, D = ({ r: e, c: n }) => o.current?.querySelectorAll("[data-part=\"cell\"]")[e * t.cols + n]?.focus();
529
534
  return {
530
- svgRef: s,
535
+ svgRef: o,
531
536
  active: b,
532
- source: d,
533
- focused: p && d === "keyboard",
537
+ source: u,
538
+ focused: p && u === "keyboard",
534
539
  stop: x,
535
540
  focusCell: D,
536
541
  handlers: {
@@ -538,19 +543,19 @@ function X({ grid: t, layout: n, activeCell: r, onActiveChange: i, onCellHover:
538
543
  pointerLeave: w,
539
544
  focus: T,
540
545
  blur: E,
541
- keyDown: (e, t) => {
546
+ keyDown: (e, n) => {
542
547
  let r = {
543
- r: n.rows - 1,
544
- c: n.cols - 1
548
+ r: t.rows - 1,
549
+ c: t.cols - 1
545
550
  }, i = e.ctrlKey || e.metaKey, a = Y[e.key], o = e.key === "Home" ? {
546
- r: i ? 0 : t.r,
551
+ r: i ? 0 : n.r,
547
552
  c: 0
548
553
  } : e.key === "End" ? {
549
- r: i ? r.r : t.r,
554
+ r: i ? r.r : n.r,
550
555
  c: r.c
551
556
  } : a && {
552
- r: Math.min(Math.max(t.r + a.r, 0), r.r),
553
- c: Math.min(Math.max(t.c + a.c, 0), r.c)
557
+ r: Math.min(Math.max(n.r + a.r, 0), r.r),
558
+ c: Math.min(Math.max(n.c + a.c, 0), r.c)
554
559
  };
555
560
  if (o) return e.preventDefault(), D(o), o;
556
561
  }
@@ -560,19 +565,19 @@ function X({ grid: t, layout: n, activeCell: r, onActiveChange: i, onCellHover:
560
565
  //#endregion
561
566
  //#region src/hooks/useHeatmapSelection.ts
562
567
  var Z = (e, t) => e === t || !!e && !!t && e.r0 === t.r0 && e.r1 === t.r1 && e.c0 === t.c0 && e.c1 === t.c1;
563
- function Q({ grid: t, layout: n, hiddenSteps: r, selectionMode: i = "none", selection: a, defaultSelection: o = null, onSelectionChange: s, onCellClick: c }) {
564
- let [l, u] = e(a, o), [d, f] = _(null), [p, m] = _(null), [h, g] = _(null), v = i === "range", y = i === "none" ? null : p ?? l, b = (e) => {
565
- m(null), !Z(e, l) && (u(e), s?.(e, e && D(t, e, r)));
566
- }, x = (e, n) => {
567
- let r = t[e.r]?.[e.c];
568
- if (!r || (c?.(r), i === "none")) return;
569
- let a = T(v && n && d ? d : e, e);
570
- v && n || f(e), b(Z(a, l) ? null : a);
568
+ function Q({ grid: e, layout: t, hiddenSteps: n, selectionMode: r = "none", selection: i, defaultSelection: a = null, onSelectionChange: o, onCellClick: s }) {
569
+ let [c, l] = d(i, a), [u, f] = v(null), [p, m] = v(null), [h, g] = v(null), _ = r === "range", y = r === "none" ? null : p ?? c, b = (t) => {
570
+ m(null), !Z(t, c) && (l(t), o?.(t, t && O(e, t, n)));
571
+ }, x = (t, n) => {
572
+ let i = e[t.r]?.[t.c];
573
+ if (!i || (s?.(i), r === "none")) return;
574
+ let a = E(_ && n && u ? u : t, t);
575
+ _ && n || f(t), b(Z(a, c) ? null : a);
571
576
  }, S = (e) => {
572
- let t = e.closest("[data-hit]"), r = Number(t?.dataset.at);
573
- if (!t || !Number.isInteger(r)) return !1;
574
- let [i, a] = [n.rows - 1, n.cols - 1];
575
- return b(t.dataset.hit === "row" ? {
577
+ let n = e.closest("[data-hit]"), r = Number(n?.dataset.at);
578
+ if (!n || !Number.isInteger(r)) return !1;
579
+ let [i, a] = [t.rows - 1, t.cols - 1];
580
+ return b(n.dataset.hit === "row" ? {
576
581
  r0: r,
577
582
  r1: r,
578
583
  c0: 0,
@@ -587,31 +592,31 @@ function Q({ grid: t, layout: n, hiddenSteps: r, selectionMode: i = "none", sele
587
592
  return {
588
593
  range: y,
589
594
  dragging: !!p && !!h,
590
- selected: (e, t) => E(y, e, t),
595
+ selected: (e, t) => D(y, e, t),
591
596
  handlers: {
592
597
  pointerDown: (e) => {
593
- if (e.button > 0 || v && S(e.target)) return;
594
- let t = j(n, e.currentTarget, e);
595
- t && (g(t), v && !e.shiftKey && f(t), e.currentTarget.setPointerCapture?.(e.pointerId));
598
+ if (e.button > 0 || _ && S(e.target)) return;
599
+ let n = M(t, e.currentTarget, e);
600
+ n && (g(n), _ && !e.shiftKey && f(n), e.currentTarget.setPointerCapture?.(e.pointerId));
596
601
  },
597
602
  pointerMove: (e) => {
598
- if (!h || !v) return;
599
- let t = j(n, e.currentTarget, e, !0), r = e.shiftKey && d ? d : h, i = t.r !== h.r || t.c !== h.c;
600
- m(i || p ? T(r, t) : null);
603
+ if (!h || !_) return;
604
+ let n = M(t, e.currentTarget, e, !0), r = e.shiftKey && u ? u : h, i = n.r !== h.r || n.c !== h.c;
605
+ m(i || p ? E(r, n) : null);
601
606
  },
602
607
  pointerUp: (e) => {
603
608
  h && (g(null), p ? b(p) : x(h, e.shiftKey));
604
609
  },
605
610
  key: (e, t) => {
606
611
  if (e.key === "Enter" || e.key === " ") e.preventDefault(), x(t, e.shiftKey);
607
- else if (e.key === "Escape" && (l || p)) e.preventDefault(), b(null);
612
+ else if (e.key === "Escape" && (c || p)) e.preventDefault(), b(null);
608
613
  else return !1;
609
614
  return !0;
610
615
  },
611
616
  extend: (e, t) => {
612
- if (!v) return;
613
- let n = d ?? e;
614
- d || f(e), m(T(n, t));
617
+ if (!_) return;
618
+ let n = u ?? e;
619
+ u || f(e), m(E(n, t));
615
620
  },
616
621
  release: (e) => {
617
622
  e.key === "Shift" && p && !h && b(p);
@@ -621,7 +626,7 @@ function Q({ grid: t, layout: n, hiddenSteps: r, selectionMode: i = "none", sele
621
626
  }
622
627
  //#endregion
623
628
  //#region src/hooks/useHeatmapInteraction.ts
624
- function te(e, t, n, r) {
629
+ function ne(e, t, n, r) {
625
630
  let i = X({
626
631
  ...e,
627
632
  grid: t,
@@ -656,122 +661,123 @@ function te(e, t, n, r) {
656
661
  //#endregion
657
662
  //#region src/charts/Heatmap/index.tsx
658
663
  var $ = (e, t) => String(t);
659
- function ne(e) {
660
- let { rows: t, cols: n, rowKey: i = $, colKey: s = $, colTickEvery: c = 3, showValues: l = !1, ariaLabel: d = "Heatmap", emphasis: f = "crosshair", selectionMode: p = "none", renderTooltip: m, renderLegend: h, unit: _, className: v, style: x, classNames: S, styles: C } = e, w = L(e), { layout: T } = w, E = g(null), D = z({
664
+ function re(e) {
665
+ let { rows: t, cols: r, rowKey: a = $, colKey: s = $, colTickEvery: u = 3, showValues: d = !1, ariaLabel: f = "Heatmap", emphasis: p = "crosshair", selectionMode: m = "none", renderTooltip: h, renderLegend: g, unit: v, className: y, style: S, classNames: C, styles: w, animate: T = !0 } = e, E = l(T, ["fill", "opacity"]), D = L(e), { layout: O } = D, k = _(null), A = z({
661
666
  ...e,
662
- count: w.count,
663
- thresholds: w.thresholds,
664
- fill: w.fill
665
- }), O = te(e, w.grid, T, D.hidden), { active: k, range: A, handlers: j } = O, N = (e, t) => D.preview === null ? M(f, k, A, e, t) : w.grid[e][t].step !== D.preview, P = w.marks.map(({ kind: e, cell: t }) => ({
667
+ count: D.count,
668
+ thresholds: D.thresholds,
669
+ fill: D.fill
670
+ }), j = ne(e, D.grid, O, A.hidden), { active: M, range: N, handlers: P } = j, F = (e, t) => A.preview === null ? ee(p, M, N, e, t) : D.grid[e][t].step !== A.preview, I = D.marks.map(({ kind: e, cell: t }) => ({
666
671
  kind: e,
667
672
  cell: t,
668
- label: w.markLabel(e, t),
669
- focus: () => O.focusCell(t)
670
- })), F = !w.grid.flat().some((e) => e.value !== null), I = {
671
- theme: w.theme,
672
- layout: T,
673
- classNames: S,
674
- styles: C
673
+ label: D.markLabel(e, t),
674
+ focus: () => j.focusCell(t)
675
+ })), R = !D.grid.flat().some((e) => e.value !== null), V = {
676
+ theme: D.theme,
677
+ layout: O,
678
+ classNames: C,
679
+ styles: w
675
680
  };
676
- return /* @__PURE__ */ b("div", {
677
- ref: E,
681
+ return /* @__PURE__ */ x("div", {
682
+ ref: k,
678
683
  "data-part": "root",
679
- "data-emphasis": f,
680
- className: u(v, S?.root),
684
+ "data-emphasis": p,
685
+ className: c(y, C?.root),
681
686
  style: {
682
- ...a,
683
- ...x,
684
- ...C?.root
687
+ ...i,
688
+ ...S,
689
+ ...w?.root
685
690
  },
686
691
  children: [
687
- /* @__PURE__ */ b("svg", {
688
- ref: O.svgRef,
692
+ /* @__PURE__ */ x("svg", {
693
+ ref: j.svgRef,
689
694
  role: "grid",
690
- "aria-label": F ? `${d}, no data` : d,
695
+ "aria-label": R ? `${f}, no data` : f,
691
696
  "aria-rowcount": t.length,
692
- "aria-colcount": n.length,
693
- "aria-multiselectable": p === "range" || void 0,
694
- viewBox: `0 0 ${T.width} ${T.height}`,
697
+ "aria-colcount": r.length,
698
+ "aria-multiselectable": m === "range" || void 0,
699
+ viewBox: `0 0 ${O.width} ${O.height}`,
695
700
  style: {
696
- ...r,
697
- minWidth: T.width * 14 / T.cellSize
701
+ ...n,
702
+ minWidth: O.width * 14 / O.cellSize
698
703
  },
699
- onPointerDown: j.pointerDown,
700
- onPointerMove: j.pointerMove,
701
- onPointerUp: j.pointerUp,
702
- onPointerLeave: j.pointerLeave,
703
- onKeyUp: j.keyUp,
704
+ onPointerDown: P.pointerDown,
705
+ onPointerMove: P.pointerMove,
706
+ onPointerUp: P.pointerUp,
707
+ onPointerLeave: P.pointerLeave,
708
+ onKeyUp: P.keyUp,
704
709
  children: [
705
- /* @__PURE__ */ y(H, {
706
- ...I,
707
- grid: w.grid,
708
- rowKey: i,
710
+ /* @__PURE__ */ b(H, {
711
+ ...V,
712
+ grid: D.grid,
713
+ rowKey: a,
709
714
  colKey: s,
710
- marked: w.marked,
711
- showValues: l,
712
- hatchId: w.hatchId,
713
- describe: w.describe,
714
- formatValue: w.formatValue,
715
- fill: w.fill,
716
- ink: w.ink,
717
- dimmed: N,
718
- selected: O.selected,
719
- filtered: (e) => D.hidden.includes(e),
720
- selectable: p !== "none",
721
- stop: O.stop,
722
- handlers: j
715
+ marked: D.marked,
716
+ showValues: d,
717
+ hatchId: D.hatchId,
718
+ describe: D.describe,
719
+ formatValue: D.formatValue,
720
+ fill: D.fill,
721
+ ink: D.ink,
722
+ dimmed: F,
723
+ selected: j.selected,
724
+ filtered: (e) => A.hidden.includes(e),
725
+ selectable: m !== "none",
726
+ stop: j.stop,
727
+ handlers: P,
728
+ transition: E
723
729
  }),
724
- /* @__PURE__ */ y(B, {
725
- ...I,
730
+ /* @__PURE__ */ b(B, {
731
+ ...V,
726
732
  rows: t,
727
- cols: n,
728
- formatRow: w.formatRow,
729
- formatCol: w.formatCol,
730
- colTickEvery: c,
731
- active: f === "none" ? null : k,
732
- hits: p === "range"
733
+ cols: r,
734
+ formatRow: D.formatRow,
735
+ formatCol: D.formatCol,
736
+ colTickEvery: u,
737
+ active: p === "none" ? null : M,
738
+ hits: m === "range"
733
739
  }),
734
- /* @__PURE__ */ y(W, {
735
- ...I,
736
- marked: w.marked,
737
- active: k,
738
- focused: O.focused,
739
- range: A
740
+ /* @__PURE__ */ b(W, {
741
+ ...V,
742
+ marked: D.marked,
743
+ active: M,
744
+ focused: j.focused,
745
+ range: N
740
746
  })
741
747
  ]
742
748
  }),
743
- h === void 0 ? /* @__PURE__ */ y(K, {
744
- entries: D.entries,
745
- marks: P,
746
- unit: _,
747
- formatValue: w.formatValue,
748
- classNames: S
749
- }) : h?.(D.entries, P),
750
- m && !O.dragging && /* @__PURE__ */ y(J, {
751
- active: k,
752
- source: O.source,
753
- root: E,
754
- svg: O.svgRef,
755
- layout: T,
756
- render: m,
757
- className: S?.tooltip,
758
- style: C?.tooltip
749
+ g === void 0 ? /* @__PURE__ */ b(K, {
750
+ entries: A.entries,
751
+ marks: I,
752
+ unit: v,
753
+ formatValue: D.formatValue,
754
+ classNames: C
755
+ }) : g?.(A.entries, I),
756
+ h && !j.dragging && /* @__PURE__ */ b(J, {
757
+ active: M,
758
+ source: j.source,
759
+ root: k,
760
+ svg: j.svgRef,
761
+ layout: O,
762
+ render: h,
763
+ className: C?.tooltip,
764
+ style: w?.tooltip
759
765
  }),
760
- /* @__PURE__ */ y("div", {
766
+ /* @__PURE__ */ b("div", {
761
767
  "data-part": "readout",
762
768
  "aria-live": "polite",
763
769
  "aria-atomic": "true",
764
- className: S?.readout,
770
+ className: C?.readout,
765
771
  style: {
766
772
  ...o,
767
- ...C?.readout
773
+ ...w?.readout
768
774
  },
769
- children: k ? w.describe(k) : A ? w.summarise(A, D.hidden) : ""
775
+ children: M ? D.describe(M) : N ? D.summarise(N, A.hidden) : ""
770
776
  })
771
777
  ]
772
778
  });
773
779
  }
774
780
  //#endregion
775
- export { z as a, C as c, T as d, j as f, K as i, k as l, w as m, Q as n, A as o, D as p, X as r, O as s, ne as t, E as u };
781
+ export { z as a, w as c, E as d, M as f, K as i, A as l, T as m, Q as n, j as o, O as p, X as r, k as s, re as t, D as u };
776
782
 
777
- //# sourceMappingURL=Heatmap-C1XcTUg1.js.map
783
+ //# sourceMappingURL=Heatmap-Bwhf305C.js.map