@adecore/charts 0.48.4 → 0.49.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/dist/Heatmap.js +537 -328
- package/dist/Root.js +382 -275
- package/dist/heat-cursor.d.ts +9 -0
- package/dist/heat-cursor.js +59 -0
- package/package.json +3 -3
- package/src/Heatmap.tsx +133 -62
- package/src/Root.tsx +26 -13
- package/src/heat-cursor.ts +77 -0
package/dist/Heatmap.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { useId, useState } from 'react';
|
|
2
|
+
import { useId, useState, useSyncExternalStore } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { Button, Surface } from '@adecore/ui';
|
|
6
6
|
import { formatNumber } from '@adecore/ui/format';
|
|
7
7
|
import { colorOf } from './color.js';
|
|
8
|
+
import { createHeatmapCursor } from './heat-cursor.js';
|
|
8
9
|
import { FLOOR, heatMix, heatShare, moveCell } from './heat.js';
|
|
9
10
|
import { tableClasses } from './values-table.js';
|
|
10
11
|
/* Between a cell and the card beside it. */
|
|
11
|
-
import {
|
|
12
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
const OFFSET = 8;
|
|
13
14
|
// The React Compiler cannot compile optional chaining inside a condition, so the comparison lives out here.
|
|
14
15
|
const sameCell = (one, other) => one === null || other === null ? one === other : one.row === other.row && one.column === other.column;
|
|
@@ -20,9 +21,258 @@ const cardPlace = (toRight, down) => ({
|
|
|
20
21
|
top: down ? 0 : undefined,
|
|
21
22
|
bottom: down ? undefined : 0
|
|
22
23
|
});
|
|
24
|
+
function HeatmapCellView(t0) {
|
|
25
|
+
const $ = _c(30);
|
|
26
|
+
const {
|
|
27
|
+
cursor,
|
|
28
|
+
color,
|
|
29
|
+
top,
|
|
30
|
+
steps,
|
|
31
|
+
cellHeight,
|
|
32
|
+
valueLabel,
|
|
33
|
+
write,
|
|
34
|
+
onHover,
|
|
35
|
+
row,
|
|
36
|
+
column,
|
|
37
|
+
rowLabel,
|
|
38
|
+
columnLabel,
|
|
39
|
+
toRight,
|
|
40
|
+
down,
|
|
41
|
+
value
|
|
42
|
+
} = t0;
|
|
43
|
+
let t1;
|
|
44
|
+
if ($[0] !== column || $[1] !== row) {
|
|
45
|
+
t1 = {
|
|
46
|
+
row,
|
|
47
|
+
column
|
|
48
|
+
};
|
|
49
|
+
$[0] = column;
|
|
50
|
+
$[1] = row;
|
|
51
|
+
$[2] = t1;
|
|
52
|
+
} else {
|
|
53
|
+
t1 = $[2];
|
|
54
|
+
}
|
|
55
|
+
const cell = t1;
|
|
56
|
+
let t2;
|
|
57
|
+
if ($[3] !== cell || $[4] !== cursor) {
|
|
58
|
+
t2 = listener => cursor.subscribeCell(cell, listener);
|
|
59
|
+
$[3] = cell;
|
|
60
|
+
$[4] = cursor;
|
|
61
|
+
$[5] = t2;
|
|
62
|
+
} else {
|
|
63
|
+
t2 = $[5];
|
|
64
|
+
}
|
|
65
|
+
const subscribe = t2;
|
|
66
|
+
let t3;
|
|
67
|
+
if ($[6] !== cell || $[7] !== cursor) {
|
|
68
|
+
t3 = () => cursor.isActive(cell);
|
|
69
|
+
$[6] = cell;
|
|
70
|
+
$[7] = cursor;
|
|
71
|
+
$[8] = t3;
|
|
72
|
+
} else {
|
|
73
|
+
t3 = $[8];
|
|
74
|
+
}
|
|
75
|
+
const selected = t3;
|
|
76
|
+
const active = useSyncExternalStore(subscribe, selected, selected);
|
|
77
|
+
let t4;
|
|
78
|
+
if ($[9] !== active || $[10] !== cell || $[11] !== cellHeight || $[12] !== color || $[13] !== columnLabel || $[14] !== down || $[15] !== onHover || $[16] !== rowLabel || $[17] !== steps || $[18] !== toRight || $[19] !== top || $[20] !== value || $[21] !== valueLabel || $[22] !== write) {
|
|
79
|
+
const mix = heatMix(value, top, steps);
|
|
80
|
+
const t5 = mix === 0 && "bg-surface-sunken";
|
|
81
|
+
const t6 = active && "relative z-10 outline-1 outline-offset-1 outline-text";
|
|
82
|
+
let t7;
|
|
83
|
+
if ($[24] !== t5 || $[25] !== t6) {
|
|
84
|
+
t7 = clsx("rounded-xs", t5, t6);
|
|
85
|
+
$[24] = t5;
|
|
86
|
+
$[25] = t6;
|
|
87
|
+
$[26] = t7;
|
|
88
|
+
} else {
|
|
89
|
+
t7 = $[26];
|
|
90
|
+
}
|
|
91
|
+
let t8;
|
|
92
|
+
if ($[27] !== cell || $[28] !== onHover) {
|
|
93
|
+
t8 = () => onHover(cell);
|
|
94
|
+
$[27] = cell;
|
|
95
|
+
$[28] = onHover;
|
|
96
|
+
$[29] = t8;
|
|
97
|
+
} else {
|
|
98
|
+
t8 = $[29];
|
|
99
|
+
}
|
|
100
|
+
t4 = /*#__PURE__*/_jsx("span", {
|
|
101
|
+
"data-mix": mix,
|
|
102
|
+
className: t7,
|
|
103
|
+
style: {
|
|
104
|
+
height: cellHeight,
|
|
105
|
+
backgroundColor: shade(color, mix)
|
|
106
|
+
},
|
|
107
|
+
onPointerEnter: t8,
|
|
108
|
+
children: active && /*#__PURE__*/_jsxs(Surface, {
|
|
109
|
+
className: "pointer-events-none absolute flex w-max min-w-36 flex-col gap-1 rounded-lg px-2.5 py-2 text-xs",
|
|
110
|
+
style: cardPlace(toRight, down),
|
|
111
|
+
children: [/*#__PURE__*/_jsxs("p", {
|
|
112
|
+
className: "font-medium whitespace-nowrap text-text",
|
|
113
|
+
children: [rowLabel, " \xB7 ", columnLabel]
|
|
114
|
+
}), /*#__PURE__*/_jsxs("p", {
|
|
115
|
+
className: "flex items-center gap-2 text-text-muted",
|
|
116
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
117
|
+
className: clsx("size-2 shrink-0 rounded-xs", mix === 0 && "bg-surface-sunken"),
|
|
118
|
+
style: {
|
|
119
|
+
backgroundColor: shade(color, mix)
|
|
120
|
+
}
|
|
121
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
122
|
+
className: "min-w-0 truncate",
|
|
123
|
+
children: valueLabel
|
|
124
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
125
|
+
className: "ml-auto pl-3 text-text tabular-nums",
|
|
126
|
+
children: write(value)
|
|
127
|
+
})]
|
|
128
|
+
})]
|
|
129
|
+
})
|
|
130
|
+
});
|
|
131
|
+
$[9] = active;
|
|
132
|
+
$[10] = cell;
|
|
133
|
+
$[11] = cellHeight;
|
|
134
|
+
$[12] = color;
|
|
135
|
+
$[13] = columnLabel;
|
|
136
|
+
$[14] = down;
|
|
137
|
+
$[15] = onHover;
|
|
138
|
+
$[16] = rowLabel;
|
|
139
|
+
$[17] = steps;
|
|
140
|
+
$[18] = toRight;
|
|
141
|
+
$[19] = top;
|
|
142
|
+
$[20] = value;
|
|
143
|
+
$[21] = valueLabel;
|
|
144
|
+
$[22] = write;
|
|
145
|
+
$[23] = t4;
|
|
146
|
+
} else {
|
|
147
|
+
t4 = $[23];
|
|
148
|
+
}
|
|
149
|
+
return t4;
|
|
150
|
+
}
|
|
151
|
+
function HeatmapGrid(t0) {
|
|
152
|
+
const $ = _c(33);
|
|
153
|
+
const {
|
|
154
|
+
rows,
|
|
155
|
+
columns,
|
|
156
|
+
values,
|
|
157
|
+
valueLabel,
|
|
158
|
+
cursor,
|
|
159
|
+
color,
|
|
160
|
+
top,
|
|
161
|
+
steps,
|
|
162
|
+
cellHeight,
|
|
163
|
+
write,
|
|
164
|
+
onHover
|
|
165
|
+
} = t0;
|
|
166
|
+
const t1 = `auto repeat(${columns.length}, minmax(0, 1fr))`;
|
|
167
|
+
let t2;
|
|
168
|
+
if ($[0] !== t1) {
|
|
169
|
+
t2 = {
|
|
170
|
+
gridTemplateColumns: t1
|
|
171
|
+
};
|
|
172
|
+
$[0] = t1;
|
|
173
|
+
$[1] = t2;
|
|
174
|
+
} else {
|
|
175
|
+
t2 = $[1];
|
|
176
|
+
}
|
|
177
|
+
let t3;
|
|
178
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
179
|
+
t3 = /*#__PURE__*/_jsx("span", {});
|
|
180
|
+
$[2] = t3;
|
|
181
|
+
} else {
|
|
182
|
+
t3 = $[2];
|
|
183
|
+
}
|
|
184
|
+
let t4;
|
|
185
|
+
if ($[3] !== columns) {
|
|
186
|
+
t4 = columns.map(_temp);
|
|
187
|
+
$[3] = columns;
|
|
188
|
+
$[4] = t4;
|
|
189
|
+
} else {
|
|
190
|
+
t4 = $[4];
|
|
191
|
+
}
|
|
192
|
+
let t5;
|
|
193
|
+
if ($[5] !== cellHeight || $[6] !== color || $[7] !== columns || $[8] !== cursor || $[9] !== onHover || $[10] !== rows || $[11] !== steps || $[12] !== top || $[13] !== valueLabel || $[14] !== values || $[15] !== write) {
|
|
194
|
+
let t6;
|
|
195
|
+
if ($[17] !== cellHeight || $[18] !== color || $[19] !== columns || $[20] !== cursor || $[21] !== onHover || $[22] !== rows.length || $[23] !== steps || $[24] !== top || $[25] !== valueLabel || $[26] !== values || $[27] !== write) {
|
|
196
|
+
t6 = (row, rowIndex) => /*#__PURE__*/_jsxs("div", {
|
|
197
|
+
className: "contents",
|
|
198
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
199
|
+
className: "flex items-center pr-2 leading-4 whitespace-nowrap",
|
|
200
|
+
children: row.short === undefined ? row.label : row.short
|
|
201
|
+
}), columns.map((column_0, columnIndex) => /*#__PURE__*/_jsx(HeatmapCellView, {
|
|
202
|
+
cursor: cursor,
|
|
203
|
+
row: rowIndex,
|
|
204
|
+
column: columnIndex,
|
|
205
|
+
rowLabel: row.label,
|
|
206
|
+
columnLabel: column_0.label,
|
|
207
|
+
value: values[rowIndex]?.[columnIndex] ?? null,
|
|
208
|
+
color: color,
|
|
209
|
+
top: top,
|
|
210
|
+
steps: steps,
|
|
211
|
+
cellHeight: cellHeight,
|
|
212
|
+
valueLabel: valueLabel,
|
|
213
|
+
write: write,
|
|
214
|
+
onHover: onHover,
|
|
215
|
+
toRight: columnIndex < columns.length / 2,
|
|
216
|
+
down: rowIndex < rows.length / 2
|
|
217
|
+
}, column_0.key))]
|
|
218
|
+
}, row.key);
|
|
219
|
+
$[17] = cellHeight;
|
|
220
|
+
$[18] = color;
|
|
221
|
+
$[19] = columns;
|
|
222
|
+
$[20] = cursor;
|
|
223
|
+
$[21] = onHover;
|
|
224
|
+
$[22] = rows.length;
|
|
225
|
+
$[23] = steps;
|
|
226
|
+
$[24] = top;
|
|
227
|
+
$[25] = valueLabel;
|
|
228
|
+
$[26] = values;
|
|
229
|
+
$[27] = write;
|
|
230
|
+
$[28] = t6;
|
|
231
|
+
} else {
|
|
232
|
+
t6 = $[28];
|
|
233
|
+
}
|
|
234
|
+
t5 = rows.map(t6);
|
|
235
|
+
$[5] = cellHeight;
|
|
236
|
+
$[6] = color;
|
|
237
|
+
$[7] = columns;
|
|
238
|
+
$[8] = cursor;
|
|
239
|
+
$[9] = onHover;
|
|
240
|
+
$[10] = rows;
|
|
241
|
+
$[11] = steps;
|
|
242
|
+
$[12] = top;
|
|
243
|
+
$[13] = valueLabel;
|
|
244
|
+
$[14] = values;
|
|
245
|
+
$[15] = write;
|
|
246
|
+
$[16] = t5;
|
|
247
|
+
} else {
|
|
248
|
+
t5 = $[16];
|
|
249
|
+
}
|
|
250
|
+
let t6;
|
|
251
|
+
if ($[29] !== t2 || $[30] !== t4 || $[31] !== t5) {
|
|
252
|
+
t6 = /*#__PURE__*/_jsxs("div", {
|
|
253
|
+
"aria-hidden": true,
|
|
254
|
+
className: "grid gap-0.5 text-xs text-text-muted",
|
|
255
|
+
style: t2,
|
|
256
|
+
children: [t3, t4, t5]
|
|
257
|
+
});
|
|
258
|
+
$[29] = t2;
|
|
259
|
+
$[30] = t4;
|
|
260
|
+
$[31] = t5;
|
|
261
|
+
$[32] = t6;
|
|
262
|
+
} else {
|
|
263
|
+
t6 = $[32];
|
|
264
|
+
}
|
|
265
|
+
return t6;
|
|
266
|
+
}
|
|
23
267
|
/* A grid of rows by columns, each cell shaded by its value, such as events per weekday and hour. */
|
|
268
|
+
function _temp(column) {
|
|
269
|
+
return /*#__PURE__*/_jsx("span", {
|
|
270
|
+
className: "flex justify-center leading-4 whitespace-nowrap tabular-nums",
|
|
271
|
+
children: column.short === undefined ? column.label : column.short
|
|
272
|
+
}, column.key);
|
|
273
|
+
}
|
|
24
274
|
export function Heatmap(t0) {
|
|
25
|
-
const $ = _c(
|
|
275
|
+
const $ = _c(93);
|
|
26
276
|
const {
|
|
27
277
|
rows,
|
|
28
278
|
columns,
|
|
@@ -49,228 +299,223 @@ export function Heatmap(t0) {
|
|
|
49
299
|
t
|
|
50
300
|
} = useTranslation("charts");
|
|
51
301
|
const id = useId();
|
|
52
|
-
const [
|
|
302
|
+
const [cursor] = useState(createHeatmapCursor);
|
|
303
|
+
const active = useSyncExternalStore(cursor.subscribe, cursor.getSnapshot, cursor.getSnapshot);
|
|
53
304
|
const [announce, setAnnounce] = useState(false);
|
|
54
305
|
const [shown, setShown] = useState(false);
|
|
55
|
-
let classes;
|
|
56
|
-
let current;
|
|
57
|
-
let describe;
|
|
58
|
-
let empty;
|
|
59
306
|
let t6;
|
|
307
|
+
if ($[0] !== tone) {
|
|
308
|
+
t6 = colorOf(tone);
|
|
309
|
+
$[0] = tone;
|
|
310
|
+
$[1] = t6;
|
|
311
|
+
} else {
|
|
312
|
+
t6 = $[1];
|
|
313
|
+
}
|
|
314
|
+
const color = t6;
|
|
60
315
|
let t7;
|
|
316
|
+
if ($[2] !== values) {
|
|
317
|
+
t7 = (row, column) => values[row]?.[column] ?? null;
|
|
318
|
+
$[2] = values;
|
|
319
|
+
$[3] = t7;
|
|
320
|
+
} else {
|
|
321
|
+
t7 = $[3];
|
|
322
|
+
}
|
|
323
|
+
const valueAt = t7;
|
|
61
324
|
let t8;
|
|
325
|
+
if ($[4] !== max || $[5] !== values) {
|
|
326
|
+
t8 = max ?? Math.max(0, ...values.flatMap(_temp3));
|
|
327
|
+
$[4] = max;
|
|
328
|
+
$[5] = values;
|
|
329
|
+
$[6] = t8;
|
|
330
|
+
} else {
|
|
331
|
+
t8 = $[6];
|
|
332
|
+
}
|
|
333
|
+
const top = t8;
|
|
334
|
+
const empty = rows.length === 0 || columns.length === 0;
|
|
62
335
|
let t9;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
$[59] = t21;
|
|
187
|
-
} else {
|
|
188
|
-
t20 = $[58];
|
|
189
|
-
t21 = $[59];
|
|
190
|
-
}
|
|
191
|
-
const t22 = empty ? /*#__PURE__*/_jsx("p", {
|
|
336
|
+
if ($[7] !== format || $[8] !== t) {
|
|
337
|
+
t9 = value_0 => value_0 === null ? t("noData") : format(value_0);
|
|
338
|
+
$[7] = format;
|
|
339
|
+
$[8] = t;
|
|
340
|
+
$[9] = t9;
|
|
341
|
+
} else {
|
|
342
|
+
t9 = $[9];
|
|
343
|
+
}
|
|
344
|
+
const write = t9;
|
|
345
|
+
let t10;
|
|
346
|
+
if ($[10] !== columns || $[11] !== format || $[12] !== rows || $[13] !== t || $[14] !== valueAt || $[15] !== valueLabel) {
|
|
347
|
+
t10 = cell => {
|
|
348
|
+
const value_1 = valueAt(cell.row, cell.column);
|
|
349
|
+
return `${rows[cell.row].label}, ${columns[cell.column].label}, ${value_1 === null ? t("noData") : `${valueLabel} ${format(value_1)}`}`;
|
|
350
|
+
};
|
|
351
|
+
$[10] = columns;
|
|
352
|
+
$[11] = format;
|
|
353
|
+
$[12] = rows;
|
|
354
|
+
$[13] = t;
|
|
355
|
+
$[14] = valueAt;
|
|
356
|
+
$[15] = valueLabel;
|
|
357
|
+
$[16] = t10;
|
|
358
|
+
} else {
|
|
359
|
+
t10 = $[16];
|
|
360
|
+
}
|
|
361
|
+
const describe = t10;
|
|
362
|
+
const current = active !== null && active.row < rows.length && active.column < columns.length ? active : null;
|
|
363
|
+
const t11 = table && shown;
|
|
364
|
+
let t12;
|
|
365
|
+
if ($[17] !== t11) {
|
|
366
|
+
t12 = tableClasses(t11);
|
|
367
|
+
$[17] = t11;
|
|
368
|
+
$[18] = t12;
|
|
369
|
+
} else {
|
|
370
|
+
t12 = $[18];
|
|
371
|
+
}
|
|
372
|
+
const classes = t12;
|
|
373
|
+
let t13;
|
|
374
|
+
if ($[19] !== columns.length || $[20] !== cursor || $[21] !== onActiveChange || $[22] !== rows.length) {
|
|
375
|
+
t13 = cell_0 => {
|
|
376
|
+
const previous = cursor.getSnapshot();
|
|
377
|
+
const before = previous !== null && previous.row < rows.length && previous.column < columns.length ? previous : null;
|
|
378
|
+
cursor.set(cell_0);
|
|
379
|
+
if (!sameCell(cell_0, before)) {
|
|
380
|
+
onActiveChange?.(cell_0);
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
$[19] = columns.length;
|
|
384
|
+
$[20] = cursor;
|
|
385
|
+
$[21] = onActiveChange;
|
|
386
|
+
$[22] = rows.length;
|
|
387
|
+
$[23] = t13;
|
|
388
|
+
} else {
|
|
389
|
+
t13 = $[23];
|
|
390
|
+
}
|
|
391
|
+
const activate = t13;
|
|
392
|
+
let t14;
|
|
393
|
+
if ($[24] !== activate) {
|
|
394
|
+
t14 = cell_1 => {
|
|
395
|
+
setAnnounce(false);
|
|
396
|
+
activate(cell_1);
|
|
397
|
+
};
|
|
398
|
+
$[24] = activate;
|
|
399
|
+
$[25] = t14;
|
|
400
|
+
} else {
|
|
401
|
+
t14 = $[25];
|
|
402
|
+
}
|
|
403
|
+
const hover = t14;
|
|
404
|
+
let t15;
|
|
405
|
+
if ($[26] !== activate || $[27] !== columns.length || $[28] !== current || $[29] !== rows.length) {
|
|
406
|
+
t15 = e => {
|
|
407
|
+
const target = moveCell(e.key, current, rows.length, columns.length, e.ctrlKey || e.metaKey);
|
|
408
|
+
if (target === undefined) {
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
e.preventDefault();
|
|
412
|
+
setAnnounce(target !== null);
|
|
413
|
+
activate(target);
|
|
414
|
+
};
|
|
415
|
+
$[26] = activate;
|
|
416
|
+
$[27] = columns.length;
|
|
417
|
+
$[28] = current;
|
|
418
|
+
$[29] = rows.length;
|
|
419
|
+
$[30] = t15;
|
|
420
|
+
} else {
|
|
421
|
+
t15 = $[30];
|
|
422
|
+
}
|
|
423
|
+
const onKeyDown = t15;
|
|
424
|
+
let t16;
|
|
425
|
+
if ($[31] !== className) {
|
|
426
|
+
t16 = clsx("flex min-w-0 flex-col gap-2", className);
|
|
427
|
+
$[31] = className;
|
|
428
|
+
$[32] = t16;
|
|
429
|
+
} else {
|
|
430
|
+
t16 = $[32];
|
|
431
|
+
}
|
|
432
|
+
let t17;
|
|
433
|
+
if ($[33] !== t) {
|
|
434
|
+
t17 = t("heatmap.name");
|
|
435
|
+
$[33] = t;
|
|
436
|
+
$[34] = t17;
|
|
437
|
+
} else {
|
|
438
|
+
t17 = $[34];
|
|
439
|
+
}
|
|
440
|
+
const t18 = `${id}-hint`;
|
|
441
|
+
let t19;
|
|
442
|
+
let t20;
|
|
443
|
+
if ($[35] !== activate) {
|
|
444
|
+
t19 = () => activate(null);
|
|
445
|
+
t20 = () => {
|
|
446
|
+
activate(null);
|
|
447
|
+
setAnnounce(false);
|
|
448
|
+
};
|
|
449
|
+
$[35] = activate;
|
|
450
|
+
$[36] = t19;
|
|
451
|
+
$[37] = t20;
|
|
452
|
+
} else {
|
|
453
|
+
t19 = $[36];
|
|
454
|
+
t20 = $[37];
|
|
455
|
+
}
|
|
456
|
+
let t21;
|
|
457
|
+
if ($[38] !== cellHeight || $[39] !== color || $[40] !== columns || $[41] !== cursor || $[42] !== empty || $[43] !== hover || $[44] !== rows || $[45] !== steps || $[46] !== t || $[47] !== top || $[48] !== valueLabel || $[49] !== values || $[50] !== write) {
|
|
458
|
+
t21 = empty ? /*#__PURE__*/_jsx("p", {
|
|
192
459
|
className: "py-6 text-center text-xs text-text-faint",
|
|
193
460
|
children: t("noData")
|
|
194
|
-
}) : /*#__PURE__*/
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const value_2 = valueAt(rowIndex, columnIndex);
|
|
207
|
-
const mix = heatMix(value_2, top, steps);
|
|
208
|
-
const isActive = current !== null && current.row === rowIndex && current.column === columnIndex;
|
|
209
|
-
return /*#__PURE__*/_jsx("span", {
|
|
210
|
-
"data-mix": mix,
|
|
211
|
-
className: clsx("rounded-xs", mix === 0 && "bg-surface-sunken", isActive && "relative z-10 outline-1 outline-offset-1 outline-text"),
|
|
212
|
-
style: {
|
|
213
|
-
height: cellHeight,
|
|
214
|
-
backgroundColor: shade(color, mix)
|
|
215
|
-
},
|
|
216
|
-
onPointerEnter: () => {
|
|
217
|
-
setAnnounce(false);
|
|
218
|
-
activate({
|
|
219
|
-
row: rowIndex,
|
|
220
|
-
column: columnIndex
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
children: isActive && /*#__PURE__*/_jsxs(Surface, {
|
|
224
|
-
className: "pointer-events-none absolute flex w-max min-w-36 flex-col gap-1 rounded-lg px-2.5 py-2 text-xs",
|
|
225
|
-
style: cardPlace(columnIndex < columns.length / 2, rowIndex < rows.length / 2),
|
|
226
|
-
children: [/*#__PURE__*/_jsxs("p", {
|
|
227
|
-
className: "font-medium whitespace-nowrap text-text",
|
|
228
|
-
children: [row_0.label, " \xB7 ", column_1.label]
|
|
229
|
-
}), /*#__PURE__*/_jsxs("p", {
|
|
230
|
-
className: "flex items-center gap-2 text-text-muted",
|
|
231
|
-
children: [/*#__PURE__*/_jsx("span", {
|
|
232
|
-
className: clsx("size-2 shrink-0 rounded-xs", mix === 0 && "bg-surface-sunken"),
|
|
233
|
-
style: {
|
|
234
|
-
backgroundColor: shade(color, mix)
|
|
235
|
-
}
|
|
236
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
237
|
-
className: "min-w-0 truncate",
|
|
238
|
-
children: valueLabel
|
|
239
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
240
|
-
className: "ml-auto pl-3 text-text tabular-nums",
|
|
241
|
-
children: write(value_2)
|
|
242
|
-
})]
|
|
243
|
-
})]
|
|
244
|
-
})
|
|
245
|
-
}, column_1.key);
|
|
246
|
-
})]
|
|
247
|
-
}, row_0.key))]
|
|
461
|
+
}) : /*#__PURE__*/_jsx(HeatmapGrid, {
|
|
462
|
+
rows: rows,
|
|
463
|
+
columns: columns,
|
|
464
|
+
values: values,
|
|
465
|
+
valueLabel: valueLabel,
|
|
466
|
+
cursor: cursor,
|
|
467
|
+
color: color,
|
|
468
|
+
top: top,
|
|
469
|
+
steps: steps,
|
|
470
|
+
cellHeight: cellHeight,
|
|
471
|
+
write: write,
|
|
472
|
+
onHover: hover
|
|
248
473
|
});
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
474
|
+
$[38] = cellHeight;
|
|
475
|
+
$[39] = color;
|
|
476
|
+
$[40] = columns;
|
|
477
|
+
$[41] = cursor;
|
|
478
|
+
$[42] = empty;
|
|
479
|
+
$[43] = hover;
|
|
480
|
+
$[44] = rows;
|
|
481
|
+
$[45] = steps;
|
|
482
|
+
$[46] = t;
|
|
483
|
+
$[47] = top;
|
|
484
|
+
$[48] = valueLabel;
|
|
485
|
+
$[49] = values;
|
|
486
|
+
$[50] = write;
|
|
487
|
+
$[51] = t21;
|
|
488
|
+
} else {
|
|
489
|
+
t21 = $[51];
|
|
490
|
+
}
|
|
491
|
+
let t22;
|
|
492
|
+
if ($[52] !== label || $[53] !== onKeyDown || $[54] !== t17 || $[55] !== t18 || $[56] !== t19 || $[57] !== t20 || $[58] !== t21) {
|
|
493
|
+
t22 = /*#__PURE__*/_jsx("div", {
|
|
494
|
+
role: "group",
|
|
495
|
+
tabIndex: 0,
|
|
496
|
+
"aria-roledescription": t17,
|
|
497
|
+
"aria-label": label,
|
|
498
|
+
"aria-describedby": t18,
|
|
499
|
+
className: "focus-ring rounded-xs",
|
|
500
|
+
onKeyDown: onKeyDown,
|
|
501
|
+
onPointerLeave: t19,
|
|
502
|
+
onBlur: t20,
|
|
503
|
+
children: t21
|
|
504
|
+
});
|
|
505
|
+
$[52] = label;
|
|
506
|
+
$[53] = onKeyDown;
|
|
507
|
+
$[54] = t17;
|
|
508
|
+
$[55] = t18;
|
|
509
|
+
$[56] = t19;
|
|
510
|
+
$[57] = t20;
|
|
511
|
+
$[58] = t21;
|
|
512
|
+
$[59] = t22;
|
|
513
|
+
} else {
|
|
514
|
+
t22 = $[59];
|
|
515
|
+
}
|
|
516
|
+
let t23;
|
|
517
|
+
if ($[60] !== color || $[61] !== empty || $[62] !== legend || $[63] !== steps || $[64] !== t) {
|
|
518
|
+
t23 = legend && !empty && /*#__PURE__*/_jsxs("div", {
|
|
274
519
|
"aria-hidden": true,
|
|
275
520
|
className: "flex items-center justify-end gap-1 text-xs text-text-muted",
|
|
276
521
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -298,48 +543,18 @@ export function Heatmap(t0) {
|
|
|
298
543
|
children: t("heatmap.more")
|
|
299
544
|
})]
|
|
300
545
|
});
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
$[6] = label;
|
|
308
|
-
$[7] = legend;
|
|
309
|
-
$[8] = max;
|
|
310
|
-
$[9] = onActiveChange;
|
|
311
|
-
$[10] = ref;
|
|
312
|
-
$[11] = rows;
|
|
313
|
-
$[12] = shown;
|
|
314
|
-
$[13] = steps;
|
|
315
|
-
$[14] = t;
|
|
316
|
-
$[15] = table;
|
|
317
|
-
$[16] = tone;
|
|
318
|
-
$[17] = valueLabel;
|
|
319
|
-
$[18] = values;
|
|
320
|
-
$[19] = classes;
|
|
321
|
-
$[20] = current;
|
|
322
|
-
$[21] = describe;
|
|
323
|
-
$[22] = empty;
|
|
324
|
-
$[23] = t6;
|
|
325
|
-
$[24] = t7;
|
|
326
|
-
$[25] = t8;
|
|
327
|
-
$[26] = t9;
|
|
328
|
-
$[27] = valueAt;
|
|
546
|
+
$[60] = color;
|
|
547
|
+
$[61] = empty;
|
|
548
|
+
$[62] = legend;
|
|
549
|
+
$[63] = steps;
|
|
550
|
+
$[64] = t;
|
|
551
|
+
$[65] = t23;
|
|
329
552
|
} else {
|
|
330
|
-
|
|
331
|
-
current = $[20];
|
|
332
|
-
describe = $[21];
|
|
333
|
-
empty = $[22];
|
|
334
|
-
t6 = $[23];
|
|
335
|
-
t7 = $[24];
|
|
336
|
-
t8 = $[25];
|
|
337
|
-
t9 = $[26];
|
|
338
|
-
valueAt = $[27];
|
|
553
|
+
t23 = $[65];
|
|
339
554
|
}
|
|
340
|
-
let
|
|
341
|
-
if ($[
|
|
342
|
-
|
|
555
|
+
let t24;
|
|
556
|
+
if ($[66] !== classes || $[67] !== columns || $[68] !== empty || $[69] !== format || $[70] !== id || $[71] !== label || $[72] !== rows || $[73] !== shown || $[74] !== t || $[75] !== table || $[76] !== valueAt) {
|
|
557
|
+
t24 = !empty && /*#__PURE__*/_jsxs("div", {
|
|
343
558
|
className: table ? "flex flex-col items-start gap-2" : undefined,
|
|
344
559
|
children: [table && /*#__PURE__*/_jsx(Button, {
|
|
345
560
|
size: "sm",
|
|
@@ -360,113 +575,107 @@ export function Heatmap(t0) {
|
|
|
360
575
|
}), /*#__PURE__*/_jsx("thead", {
|
|
361
576
|
className: classes.head,
|
|
362
577
|
children: /*#__PURE__*/_jsxs("tr", {
|
|
363
|
-
children: [/*#__PURE__*/_jsx("td", {}), columns.map(
|
|
578
|
+
children: [/*#__PURE__*/_jsx("td", {}), columns.map(column_0 => /*#__PURE__*/_jsx("th", {
|
|
364
579
|
scope: "col",
|
|
365
580
|
className: classes.column,
|
|
366
|
-
children:
|
|
367
|
-
},
|
|
581
|
+
children: column_0.label
|
|
582
|
+
}, column_0.key))]
|
|
368
583
|
})
|
|
369
584
|
}), /*#__PURE__*/_jsx("tbody", {
|
|
370
|
-
children: rows.map((
|
|
585
|
+
children: rows.map((row_0, rowIndex) => /*#__PURE__*/_jsxs("tr", {
|
|
371
586
|
className: classes.row,
|
|
372
587
|
children: [/*#__PURE__*/_jsx("th", {
|
|
373
588
|
scope: "row",
|
|
374
589
|
className: classes.rowHeading,
|
|
375
|
-
children:
|
|
376
|
-
}), columns.map((
|
|
377
|
-
const
|
|
590
|
+
children: row_0.label
|
|
591
|
+
}), columns.map((column_1, columnIndex) => {
|
|
592
|
+
const value_2 = valueAt(rowIndex, columnIndex);
|
|
378
593
|
return /*#__PURE__*/_jsx("td", {
|
|
379
594
|
className: classes.cell,
|
|
380
|
-
children:
|
|
381
|
-
},
|
|
595
|
+
children: value_2 === null ? "" : format(value_2)
|
|
596
|
+
}, column_1.key);
|
|
382
597
|
})]
|
|
383
|
-
},
|
|
598
|
+
}, row_0.key))
|
|
384
599
|
})]
|
|
385
600
|
})
|
|
386
601
|
})]
|
|
387
602
|
});
|
|
388
|
-
$[
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
$[
|
|
399
|
-
$[
|
|
603
|
+
$[66] = classes;
|
|
604
|
+
$[67] = columns;
|
|
605
|
+
$[68] = empty;
|
|
606
|
+
$[69] = format;
|
|
607
|
+
$[70] = id;
|
|
608
|
+
$[71] = label;
|
|
609
|
+
$[72] = rows;
|
|
610
|
+
$[73] = shown;
|
|
611
|
+
$[74] = t;
|
|
612
|
+
$[75] = table;
|
|
613
|
+
$[76] = valueAt;
|
|
614
|
+
$[77] = t24;
|
|
400
615
|
} else {
|
|
401
|
-
|
|
616
|
+
t24 = $[77];
|
|
402
617
|
}
|
|
403
|
-
const
|
|
404
|
-
let
|
|
405
|
-
if ($[
|
|
406
|
-
|
|
407
|
-
$[
|
|
408
|
-
$[
|
|
618
|
+
const t25 = `${id}-hint`;
|
|
619
|
+
let t26;
|
|
620
|
+
if ($[78] !== t) {
|
|
621
|
+
t26 = t("heatmap.keyboard");
|
|
622
|
+
$[78] = t;
|
|
623
|
+
$[79] = t26;
|
|
409
624
|
} else {
|
|
410
|
-
|
|
625
|
+
t26 = $[79];
|
|
411
626
|
}
|
|
412
|
-
let
|
|
413
|
-
if ($[
|
|
414
|
-
|
|
415
|
-
id:
|
|
627
|
+
let t27;
|
|
628
|
+
if ($[80] !== t25 || $[81] !== t26) {
|
|
629
|
+
t27 = /*#__PURE__*/_jsx("p", {
|
|
630
|
+
id: t25,
|
|
416
631
|
className: "sr-only",
|
|
417
|
-
children:
|
|
632
|
+
children: t26
|
|
418
633
|
});
|
|
419
|
-
$[
|
|
420
|
-
$[
|
|
421
|
-
$[
|
|
634
|
+
$[80] = t25;
|
|
635
|
+
$[81] = t26;
|
|
636
|
+
$[82] = t27;
|
|
422
637
|
} else {
|
|
423
|
-
|
|
638
|
+
t27 = $[82];
|
|
424
639
|
}
|
|
425
|
-
const
|
|
426
|
-
let
|
|
427
|
-
if ($[
|
|
428
|
-
|
|
640
|
+
const t28 = announce && current !== null ? describe(current) : "";
|
|
641
|
+
let t29;
|
|
642
|
+
if ($[83] !== t28) {
|
|
643
|
+
t29 = /*#__PURE__*/_jsx("p", {
|
|
429
644
|
"aria-live": "polite",
|
|
430
645
|
className: "sr-only",
|
|
431
|
-
children:
|
|
646
|
+
children: t28
|
|
432
647
|
});
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
648
|
+
$[83] = t28;
|
|
649
|
+
$[84] = t29;
|
|
435
650
|
} else {
|
|
436
|
-
|
|
651
|
+
t29 = $[84];
|
|
437
652
|
}
|
|
438
|
-
let
|
|
439
|
-
if ($[
|
|
440
|
-
|
|
441
|
-
ref:
|
|
442
|
-
className:
|
|
443
|
-
children: [
|
|
653
|
+
let t30;
|
|
654
|
+
if ($[85] !== ref || $[86] !== t16 || $[87] !== t22 || $[88] !== t23 || $[89] !== t24 || $[90] !== t27 || $[91] !== t29) {
|
|
655
|
+
t30 = /*#__PURE__*/_jsxs("div", {
|
|
656
|
+
ref: ref,
|
|
657
|
+
className: t16,
|
|
658
|
+
children: [t22, t23, t24, t27, t29]
|
|
444
659
|
});
|
|
445
|
-
$[
|
|
446
|
-
$[
|
|
447
|
-
$[
|
|
448
|
-
$[
|
|
449
|
-
$[
|
|
450
|
-
$[
|
|
451
|
-
$[
|
|
452
|
-
$[
|
|
660
|
+
$[85] = ref;
|
|
661
|
+
$[86] = t16;
|
|
662
|
+
$[87] = t22;
|
|
663
|
+
$[88] = t23;
|
|
664
|
+
$[89] = t24;
|
|
665
|
+
$[90] = t27;
|
|
666
|
+
$[91] = t29;
|
|
667
|
+
$[92] = t30;
|
|
453
668
|
} else {
|
|
454
|
-
|
|
669
|
+
t30 = $[92];
|
|
455
670
|
}
|
|
456
|
-
return
|
|
671
|
+
return t30;
|
|
457
672
|
}
|
|
458
673
|
function _temp4(open) {
|
|
459
674
|
return !open;
|
|
460
675
|
}
|
|
461
|
-
function _temp3(
|
|
462
|
-
return
|
|
463
|
-
className: "flex justify-center leading-4 whitespace-nowrap tabular-nums",
|
|
464
|
-
children: column_0.short === undefined ? column_0.label : column_0.short
|
|
465
|
-
}, column_0.key);
|
|
466
|
-
}
|
|
467
|
-
function _temp2(line) {
|
|
468
|
-
return line.filter(_temp);
|
|
676
|
+
function _temp3(line) {
|
|
677
|
+
return line.filter(_temp2);
|
|
469
678
|
}
|
|
470
|
-
function
|
|
679
|
+
function _temp2(value) {
|
|
471
680
|
return value !== null && Number.isFinite(value);
|
|
472
681
|
}
|