p1-charts 0.2.0 → 0.3.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.
- package/CHANGELOG.md +28 -0
- package/README.md +100 -2
- package/dist/CategoryBarChart-1Kn3Vozc.js +580 -0
- package/dist/CategoryBarChart-1Kn3Vozc.js.map +1 -0
- package/dist/ChartFrame-B1bVFM2E.js +403 -0
- package/dist/ChartFrame-B1bVFM2E.js.map +1 -0
- package/dist/{Heatmap-C1XcTUg1.js → Heatmap-CFC753mV.js} +278 -272
- package/dist/Heatmap-CFC753mV.js.map +1 -0
- package/dist/{PieLegend-BZsv9IbF.js → PieLegend-CbpjaOJH.js} +94 -111
- package/dist/PieLegend-CbpjaOJH.js.map +1 -0
- package/dist/PolarChart-hcNTWKfJ.js +450 -0
- package/dist/PolarChart-hcNTWKfJ.js.map +1 -0
- package/dist/Sparkline-BApLVWfg.js +110 -0
- package/dist/Sparkline-BApLVWfg.js.map +1 -0
- package/dist/{TimeSeriesChart-BIwJxgnD.js → TimeSeriesChart-BzeHEtQl.js} +120 -119
- package/dist/{TimeSeriesChart-BIwJxgnD.js.map → TimeSeriesChart-BzeHEtQl.js.map} +1 -1
- package/dist/category.d.ts +1 -1
- package/dist/category.d.ts.map +1 -1
- package/dist/category.js +1 -1
- package/dist/charts/CategoryBarChart/index.d.ts +1 -1
- package/dist/charts/CategoryBarChart/index.d.ts.map +1 -1
- package/dist/charts/Heatmap/index.d.ts.map +1 -1
- package/dist/charts/PolarChart/index.d.ts.map +1 -1
- package/dist/charts/ScatterChart/index.d.ts +1 -1
- package/dist/charts/ScatterChart/index.d.ts.map +1 -1
- package/dist/charts/Sparkline/index.d.ts +5 -2
- package/dist/charts/Sparkline/index.d.ts.map +1 -1
- package/dist/components/ChartFrame/index.d.ts +7 -0
- package/dist/components/ChartFrame/index.d.ts.map +1 -0
- package/dist/components/ChartStory/index.d.ts +7 -0
- package/dist/components/ChartStory/index.d.ts.map +1 -0
- package/dist/components/HeatmapCells/index.d.ts +1 -1
- package/dist/components/HeatmapCells/index.d.ts.map +1 -1
- package/dist/{css-C-rsk7-l.js → css-BtFQ2bM4.js} +2 -2
- package/dist/{css-C-rsk7-l.js.map → css-BtFQ2bM4.js.map} +1 -1
- package/dist/heatmap.js +1 -1
- package/dist/hooks/useMarkMemory.d.ts +9 -0
- package/dist/hooks/useMarkMemory.d.ts.map +1 -0
- package/dist/hooks/usePieTween.d.ts.map +1 -1
- package/dist/hooks/useSteps.d.ts +4 -0
- package/dist/hooks/useSteps.d.ts.map +1 -0
- package/dist/hooks/useTween.d.ts +12 -0
- package/dist/hooks/useTween.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +122 -118
- package/dist/index.js.map +1 -1
- package/dist/motion.utils-DFoqptDi.js +55 -0
- package/dist/motion.utils-DFoqptDi.js.map +1 -0
- package/dist/pie.js +1 -1
- package/dist/scatter.js +1 -1
- package/dist/series.js +1 -1
- package/dist/{tooltip.utils-D7xaBSUK.js → shared-C1pGJV4T.js} +3 -7
- package/dist/shared-C1pGJV4T.js.map +1 -0
- package/dist/sparkline.d.ts +1 -1
- package/dist/sparkline.d.ts.map +1 -1
- package/dist/sparkline.js +2 -2
- package/dist/story.d.ts +11 -0
- package/dist/story.d.ts.map +1 -0
- package/dist/story.js +7 -0
- package/dist/theme.js +3 -3
- package/dist/{theme.utils-CP1XtGIe.js → theme.utils-DgmWROoe.js} +40 -20
- package/dist/theme.utils-DgmWROoe.js.map +1 -0
- package/dist/tooltip.utils-CXD_NapA.js +9 -0
- package/dist/tooltip.utils-CXD_NapA.js.map +1 -0
- package/dist/types/category.d.ts +10 -0
- package/dist/types/category.d.ts.map +1 -1
- package/dist/types/heatmap.d.ts +3 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmapParts.d.ts +2 -0
- package/dist/types/heatmapParts.d.ts.map +1 -1
- package/dist/types/motion.d.ts +31 -0
- package/dist/types/motion.d.ts.map +1 -0
- package/dist/types/pie.d.ts +3 -4
- package/dist/types/pie.d.ts.map +1 -1
- package/dist/types/polar.d.ts +3 -0
- package/dist/types/polar.d.ts.map +1 -1
- package/dist/types/scatter.d.ts +3 -0
- package/dist/types/scatter.d.ts.map +1 -1
- package/dist/types/sparkline.d.ts +3 -0
- package/dist/types/sparkline.d.ts.map +1 -1
- package/dist/types/story.d.ts +73 -0
- package/dist/types/story.d.ts.map +1 -0
- package/dist/{useChartTheme-B06p_jvu.js → useChartTheme-KKtc1C4K.js} +2 -2
- package/dist/{useChartTheme-B06p_jvu.js.map → useChartTheme-KKtc1C4K.js.map} +1 -1
- package/dist/useControllable-Crsr0byh.js +11 -0
- package/dist/useControllable-Crsr0byh.js.map +1 -0
- package/dist/useMarkMemory-CLNY6TtT.js +15 -0
- package/dist/useMarkMemory-CLNY6TtT.js.map +1 -0
- package/dist/useTween-B0G0CcvM.js +46 -0
- package/dist/useTween-B0G0CcvM.js.map +1 -0
- package/dist/utils/category.utils.d.ts +2 -0
- package/dist/utils/category.utils.d.ts.map +1 -1
- package/dist/utils/color.utils.d.ts +9 -0
- package/dist/utils/color.utils.d.ts.map +1 -1
- package/dist/utils/csv.utils.d.ts +6 -0
- package/dist/utils/csv.utils.d.ts.map +1 -0
- package/dist/utils/motion.utils.d.ts +25 -0
- package/dist/utils/motion.utils.d.ts.map +1 -1
- package/dist/utils/pieTween.utils.d.ts +1 -1
- package/dist/utils/pieTween.utils.d.ts.map +1 -1
- package/dist/utils/sparkline.utils.d.ts +15 -0
- package/dist/utils/sparkline.utils.d.ts.map +1 -1
- package/dist/{visibility.utils-nMI5a_Et.js → visibility.utils-wuc3ZS8D.js} +18 -25
- package/dist/visibility.utils-wuc3ZS8D.js.map +1 -0
- package/package.json +10 -3
- package/src/category.ts +1 -0
- package/src/charts/CategoryBarChart/index.tsx +203 -44
- package/src/charts/Heatmap/index.tsx +4 -0
- package/src/charts/PolarChart/index.tsx +98 -5
- package/src/charts/ScatterChart/index.tsx +96 -13
- package/src/charts/Sparkline/index.tsx +54 -7
- package/src/components/ChartFrame/index.tsx +180 -0
- package/src/components/ChartStory/index.tsx +184 -0
- package/src/components/HeatmapCells/index.tsx +5 -2
- package/src/hooks/useMarkMemory.ts +29 -0
- package/src/hooks/usePieTween.ts +9 -44
- package/src/hooks/useSteps.ts +77 -0
- package/src/hooks/useTween.ts +112 -0
- package/src/index.ts +19 -0
- package/src/sparkline.ts +1 -1
- package/src/story.ts +19 -0
- package/src/types/category.ts +11 -0
- package/src/types/heatmap.ts +3 -0
- package/src/types/heatmapParts.ts +2 -0
- package/src/types/motion.ts +35 -0
- package/src/types/pie.ts +3 -3
- package/src/types/polar.ts +3 -0
- package/src/types/scatter.ts +3 -0
- package/src/types/sparkline.ts +3 -0
- package/src/types/story.ts +103 -0
- package/src/utils/category.utils.ts +22 -0
- package/src/utils/color.utils.ts +48 -0
- package/src/utils/csv.utils.ts +28 -0
- package/src/utils/motion.utils.ts +124 -0
- package/src/utils/pieTween.utils.ts +1 -2
- package/src/utils/sparkline.utils.ts +69 -0
- package/dist/CategoryBarChart-YEJ9VB8h.js +0 -453
- package/dist/CategoryBarChart-YEJ9VB8h.js.map +0 -1
- package/dist/Heatmap-C1XcTUg1.js.map +0 -1
- package/dist/PieLegend-BZsv9IbF.js.map +0 -1
- package/dist/PolarChart-BUEhn3CI.js +0 -334
- package/dist/PolarChart-BUEhn3CI.js.map +0 -1
- package/dist/Sparkline-DtNhxGVo.js +0 -67
- package/dist/Sparkline-DtNhxGVo.js.map +0 -1
- package/dist/motion.utils-C1eaZJdQ.js +0 -9
- package/dist/motion.utils-C1eaZJdQ.js.map +0 -1
- package/dist/theme.utils-CP1XtGIe.js.map +0 -1
- package/dist/tooltip.utils-D7xaBSUK.js.map +0 -1
- package/dist/visibility.utils-nMI5a_Et.js.map +0 -1
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { n
|
|
4
|
-
import { n as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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-KKtc1C4K.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
|
|
11
|
-
function
|
|
12
|
-
let a =
|
|
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 } =
|
|
18
|
+
})), o = a.flat().filter((e) => e !== null), { thresholds: s, step: c } = e(o, i);
|
|
16
19
|
return {
|
|
17
|
-
grid:
|
|
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
|
|
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
|
|
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
|
-
}),
|
|
43
|
-
function
|
|
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 (
|
|
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
|
|
59
|
-
let { min: t, max: n } =
|
|
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
|
|
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:
|
|
77
|
+
top: S,
|
|
75
78
|
width: r + t * n + 4,
|
|
76
|
-
height:
|
|
79
|
+
height: S + e * n + C,
|
|
77
80
|
cellSize: n,
|
|
78
81
|
labelWidth: r,
|
|
79
|
-
axisY:
|
|
82
|
+
axisY: S + e * n,
|
|
80
83
|
cell: (e, t) => ({
|
|
81
84
|
x: r + t * n + i / 2,
|
|
82
|
-
y:
|
|
85
|
+
y: S + e * n + i / 2,
|
|
83
86
|
size: Math.max(n - i, 0)
|
|
84
87
|
})
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
|
-
function
|
|
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
|
|
100
|
+
function M(e, t, { clientX: n, clientY: r }, i = !1) {
|
|
98
101
|
let a = t.getBoundingClientRect();
|
|
99
|
-
return !a.width || !a.height ? null :
|
|
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
|
|
102
|
-
return t ? e === "none" ? !1 : e === "cell" ? t.r !== r || t.c !== i : t.r !== r && t.c !== i : !!n && !
|
|
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:
|
|
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
|
-
]),
|
|
128
|
+
]), C = A({
|
|
126
129
|
rows: t.length,
|
|
127
130
|
cols: n.length,
|
|
128
131
|
gap: e.gap ?? _?.gap ?? 0
|
|
129
|
-
}), 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 = `${
|
|
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 =
|
|
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:
|
|
143
|
+
theme: h,
|
|
141
144
|
summarise: (e, r) => {
|
|
142
|
-
let { count: i, mean: a } =
|
|
143
|
-
return `Selected ${o(
|
|
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:
|
|
149
|
-
marks:
|
|
150
|
-
marked:
|
|
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:
|
|
157
|
+
formatRow: d,
|
|
155
158
|
formatCol: f,
|
|
156
|
-
hatchId: `hm-hatch-${
|
|
157
|
-
fill: (e) =>
|
|
158
|
-
ink: (e) =>
|
|
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:
|
|
165
|
-
let [
|
|
166
|
-
let r = f.map(String), i =
|
|
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
|
|
169
|
-
l
|
|
170
|
-
}, m = f.map((
|
|
171
|
-
step:
|
|
172
|
-
from:
|
|
173
|
-
to:
|
|
174
|
-
color:
|
|
175
|
-
hidden:
|
|
176
|
-
active:
|
|
177
|
-
toggle: () => p(
|
|
178
|
-
isolate: () => p(
|
|
179
|
-
enter: () =>
|
|
180
|
-
leave: () =>
|
|
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:
|
|
184
|
-
preview:
|
|
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:
|
|
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__ */
|
|
202
|
+
return /* @__PURE__ */ x("g", {
|
|
200
203
|
"aria-hidden": "true",
|
|
201
204
|
children: [
|
|
202
|
-
l && e.map((e, t) => /* @__PURE__ */
|
|
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:
|
|
207
|
-
width:
|
|
208
|
-
height:
|
|
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__ */
|
|
214
|
+
l && t.map((e, t) => /* @__PURE__ */ b("rect", {
|
|
212
215
|
"data-hit": "col",
|
|
213
216
|
"data-at": t,
|
|
214
|
-
x:
|
|
215
|
-
y:
|
|
216
|
-
width:
|
|
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 } =
|
|
222
|
-
return /* @__PURE__ */
|
|
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:
|
|
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
|
-
...
|
|
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__ */
|
|
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:
|
|
244
|
-
y:
|
|
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
|
-
...
|
|
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:
|
|
260
|
-
let
|
|
261
|
-
return /* @__PURE__ */
|
|
262
|
-
t && /* @__PURE__ */
|
|
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__ */
|
|
271
|
+
children: [/* @__PURE__ */ b("rect", {
|
|
269
272
|
width: 4,
|
|
270
273
|
height: 4,
|
|
271
|
-
fill:
|
|
272
|
-
}), /* @__PURE__ */
|
|
274
|
+
fill: k?.fill ?? t.palette.background
|
|
275
|
+
}), /* @__PURE__ */ b("line", {
|
|
273
276
|
y2: 4,
|
|
274
|
-
stroke:
|
|
277
|
+
stroke: k?.hatch ?? t.palette.grid,
|
|
275
278
|
strokeWidth: 1
|
|
276
279
|
})]
|
|
277
280
|
}) }),
|
|
278
|
-
e.map((e,
|
|
281
|
+
e.map((e, r) => e.length ? /* @__PURE__ */ b("g", {
|
|
279
282
|
role: "row",
|
|
280
283
|
children: e.map((e) => {
|
|
281
|
-
let { x:
|
|
282
|
-
return /* @__PURE__ */
|
|
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":
|
|
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:
|
|
299
|
+
x: r,
|
|
297
300
|
y: s,
|
|
298
301
|
width: c,
|
|
299
302
|
height: c,
|
|
300
|
-
fill:
|
|
301
|
-
opacity:
|
|
302
|
-
className:
|
|
303
|
+
fill: O(e.step),
|
|
304
|
+
opacity: D(e),
|
|
305
|
+
className: C?.cell,
|
|
303
306
|
style: t ? {
|
|
304
307
|
outline: "none",
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
},
|
|
313
|
-
s && /* @__PURE__ */
|
|
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:
|
|
317
|
-
return !s || s.length * V > o - 2 ? null : /* @__PURE__ */
|
|
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:
|
|
322
|
-
x:
|
|
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:
|
|
332
|
+
className: C?.value,
|
|
329
333
|
style: {
|
|
330
|
-
...
|
|
331
|
-
...
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
404
|
+
return /* @__PURE__ */ x("ul", {
|
|
400
405
|
"data-part": "legend",
|
|
401
|
-
className:
|
|
406
|
+
className: c(i, o?.legend),
|
|
402
407
|
style: a,
|
|
403
408
|
children: [
|
|
404
|
-
n && /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
443
|
+
children: [/* @__PURE__ */ b("span", {
|
|
439
444
|
"data-swatch": !0,
|
|
440
445
|
"data-mark": e.kind,
|
|
441
446
|
"aria-hidden": "true"
|
|
442
|
-
}), /* @__PURE__ */
|
|
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:
|
|
457
|
-
let
|
|
458
|
-
return
|
|
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
|
-
|
|
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]),
|
|
467
|
-
let e =
|
|
468
|
-
if (!e || !t || !C || !
|
|
469
|
-
let [n, r] =
|
|
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 || !
|
|
472
|
-
ref:
|
|
476
|
+
}), !e || !m || !C ? null : /* @__PURE__ */ b("div", {
|
|
477
|
+
ref: l,
|
|
473
478
|
"data-part": "tooltip",
|
|
474
|
-
"data-source":
|
|
479
|
+
"data-source": m,
|
|
475
480
|
"aria-hidden": "true",
|
|
476
|
-
className:
|
|
481
|
+
className: s,
|
|
477
482
|
style: {
|
|
478
|
-
...
|
|
479
|
-
...
|
|
483
|
+
...a,
|
|
484
|
+
...c
|
|
480
485
|
},
|
|
481
|
-
children:
|
|
482
|
-
source:
|
|
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
|
-
},
|
|
508
|
-
function X({ grid:
|
|
509
|
-
let
|
|
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 = (
|
|
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),
|
|
517
|
-
let [n,
|
|
518
|
-
|
|
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 &&
|
|
522
|
-
}, C = (e) => S(
|
|
523
|
-
|
|
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
|
-
|
|
530
|
+
g(e), m(s(t)), S(e, "keyboard");
|
|
526
531
|
}, E = () => {
|
|
527
|
-
m(!1),
|
|
528
|
-
}, D = ({ r: e, c:
|
|
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:
|
|
535
|
+
svgRef: o,
|
|
531
536
|
active: b,
|
|
532
|
-
source:
|
|
533
|
-
focused: p &&
|
|
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,
|
|
546
|
+
keyDown: (e, n) => {
|
|
542
547
|
let r = {
|
|
543
|
-
r:
|
|
544
|
-
c:
|
|
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 :
|
|
551
|
+
r: i ? 0 : n.r,
|
|
547
552
|
c: 0
|
|
548
553
|
} : e.key === "End" ? {
|
|
549
|
-
r: i ? r.r :
|
|
554
|
+
r: i ? r.r : n.r,
|
|
550
555
|
c: r.c
|
|
551
556
|
} : a && {
|
|
552
|
-
r: Math.min(Math.max(
|
|
553
|
-
c: Math.min(Math.max(
|
|
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:
|
|
564
|
-
let [
|
|
565
|
-
m(null), !Z(
|
|
566
|
-
}, x = (
|
|
567
|
-
let
|
|
568
|
-
if (!
|
|
569
|
-
let a =
|
|
570
|
-
|
|
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
|
|
573
|
-
if (!
|
|
574
|
-
let [i, a] = [
|
|
575
|
-
return b(
|
|
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) =>
|
|
595
|
+
selected: (e, t) => D(y, e, t),
|
|
591
596
|
handlers: {
|
|
592
597
|
pointerDown: (e) => {
|
|
593
|
-
if (e.button > 0 ||
|
|
594
|
-
let
|
|
595
|
-
|
|
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 || !
|
|
599
|
-
let
|
|
600
|
-
m(i || p ?
|
|
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" && (
|
|
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 (!
|
|
613
|
-
let n =
|
|
614
|
-
|
|
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
|
|
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
|
|
660
|
-
let { rows: t, cols:
|
|
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:
|
|
663
|
-
thresholds:
|
|
664
|
-
fill:
|
|
665
|
-
}),
|
|
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:
|
|
669
|
-
focus: () =>
|
|
670
|
-
})),
|
|
671
|
-
theme:
|
|
672
|
-
layout:
|
|
673
|
-
classNames:
|
|
674
|
-
styles:
|
|
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__ */
|
|
677
|
-
ref:
|
|
681
|
+
return /* @__PURE__ */ x("div", {
|
|
682
|
+
ref: k,
|
|
678
683
|
"data-part": "root",
|
|
679
|
-
"data-emphasis":
|
|
680
|
-
className:
|
|
684
|
+
"data-emphasis": p,
|
|
685
|
+
className: c(y, C?.root),
|
|
681
686
|
style: {
|
|
682
|
-
...
|
|
683
|
-
...
|
|
684
|
-
...
|
|
687
|
+
...i,
|
|
688
|
+
...S,
|
|
689
|
+
...w?.root
|
|
685
690
|
},
|
|
686
691
|
children: [
|
|
687
|
-
/* @__PURE__ */
|
|
688
|
-
ref:
|
|
692
|
+
/* @__PURE__ */ x("svg", {
|
|
693
|
+
ref: j.svgRef,
|
|
689
694
|
role: "grid",
|
|
690
|
-
"aria-label":
|
|
695
|
+
"aria-label": R ? `${f}, no data` : f,
|
|
691
696
|
"aria-rowcount": t.length,
|
|
692
|
-
"aria-colcount":
|
|
693
|
-
"aria-multiselectable":
|
|
694
|
-
viewBox: `0 0 ${
|
|
697
|
+
"aria-colcount": r.length,
|
|
698
|
+
"aria-multiselectable": m === "range" || void 0,
|
|
699
|
+
viewBox: `0 0 ${O.width} ${O.height}`,
|
|
695
700
|
style: {
|
|
696
|
-
...
|
|
697
|
-
minWidth:
|
|
701
|
+
...n,
|
|
702
|
+
minWidth: O.width * 14 / O.cellSize
|
|
698
703
|
},
|
|
699
|
-
onPointerDown:
|
|
700
|
-
onPointerMove:
|
|
701
|
-
onPointerUp:
|
|
702
|
-
onPointerLeave:
|
|
703
|
-
onKeyUp:
|
|
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__ */
|
|
706
|
-
...
|
|
707
|
-
grid:
|
|
708
|
-
rowKey:
|
|
710
|
+
/* @__PURE__ */ b(H, {
|
|
711
|
+
...V,
|
|
712
|
+
grid: D.grid,
|
|
713
|
+
rowKey: a,
|
|
709
714
|
colKey: s,
|
|
710
|
-
marked:
|
|
711
|
-
showValues:
|
|
712
|
-
hatchId:
|
|
713
|
-
describe:
|
|
714
|
-
formatValue:
|
|
715
|
-
fill:
|
|
716
|
-
ink:
|
|
717
|
-
dimmed:
|
|
718
|
-
selected:
|
|
719
|
-
filtered: (e) =>
|
|
720
|
-
selectable:
|
|
721
|
-
stop:
|
|
722
|
-
handlers:
|
|
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__ */
|
|
725
|
-
...
|
|
730
|
+
/* @__PURE__ */ b(B, {
|
|
731
|
+
...V,
|
|
726
732
|
rows: t,
|
|
727
|
-
cols:
|
|
728
|
-
formatRow:
|
|
729
|
-
formatCol:
|
|
730
|
-
colTickEvery:
|
|
731
|
-
active:
|
|
732
|
-
hits:
|
|
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__ */
|
|
735
|
-
...
|
|
736
|
-
marked:
|
|
737
|
-
active:
|
|
738
|
-
focused:
|
|
739
|
-
range:
|
|
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
|
-
|
|
744
|
-
entries:
|
|
745
|
-
marks:
|
|
746
|
-
unit:
|
|
747
|
-
formatValue:
|
|
748
|
-
classNames:
|
|
749
|
-
}) :
|
|
750
|
-
|
|
751
|
-
active:
|
|
752
|
-
source:
|
|
753
|
-
root:
|
|
754
|
-
svg:
|
|
755
|
-
layout:
|
|
756
|
-
render:
|
|
757
|
-
className:
|
|
758
|
-
style:
|
|
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__ */
|
|
766
|
+
/* @__PURE__ */ b("div", {
|
|
761
767
|
"data-part": "readout",
|
|
762
768
|
"aria-live": "polite",
|
|
763
769
|
"aria-atomic": "true",
|
|
764
|
-
className:
|
|
770
|
+
className: C?.readout,
|
|
765
771
|
style: {
|
|
766
772
|
...o,
|
|
767
|
-
...
|
|
773
|
+
...w?.readout
|
|
768
774
|
},
|
|
769
|
-
children:
|
|
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,
|
|
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-
|
|
783
|
+
//# sourceMappingURL=Heatmap-CFC753mV.js.map
|