@adecore/charts 0.48.3 → 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 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 { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
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(95);
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 [active, setActive] = useState(null);
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
- let valueAt;
64
- if ($[0] !== active || $[1] !== cellHeight || $[2] !== className || $[3] !== columns || $[4] !== format || $[5] !== id || $[6] !== label || $[7] !== legend || $[8] !== max || $[9] !== onActiveChange || $[10] !== ref || $[11] !== rows || $[12] !== shown || $[13] !== steps || $[14] !== t || $[15] !== table || $[16] !== tone || $[17] !== valueLabel || $[18] !== values) {
65
- const color = colorOf(tone);
66
- let t10;
67
- if ($[28] !== values) {
68
- t10 = (row, column) => values[row]?.[column] ?? null;
69
- $[28] = values;
70
- $[29] = t10;
71
- } else {
72
- t10 = $[29];
73
- }
74
- valueAt = t10;
75
- let t11;
76
- if ($[30] !== max || $[31] !== values) {
77
- t11 = max ?? Math.max(0, ...values.flatMap(_temp2));
78
- $[30] = max;
79
- $[31] = values;
80
- $[32] = t11;
81
- } else {
82
- t11 = $[32];
83
- }
84
- const top = t11;
85
- empty = rows.length === 0 || columns.length === 0;
86
- let t12;
87
- if ($[33] !== format || $[34] !== t) {
88
- t12 = value_0 => value_0 === null ? t("noData") : format(value_0);
89
- $[33] = format;
90
- $[34] = t;
91
- $[35] = t12;
92
- } else {
93
- t12 = $[35];
94
- }
95
- const write = t12;
96
- let t13;
97
- if ($[36] !== columns || $[37] !== format || $[38] !== rows || $[39] !== t || $[40] !== valueAt || $[41] !== valueLabel) {
98
- t13 = cell => {
99
- const value_1 = valueAt(cell.row, cell.column);
100
- return `${rows[cell.row].label}, ${columns[cell.column].label}, ${value_1 === null ? t("noData") : `${valueLabel} ${format(value_1)}`}`;
101
- };
102
- $[36] = columns;
103
- $[37] = format;
104
- $[38] = rows;
105
- $[39] = t;
106
- $[40] = valueAt;
107
- $[41] = valueLabel;
108
- $[42] = t13;
109
- } else {
110
- t13 = $[42];
111
- }
112
- describe = t13;
113
- current = active !== null && active.row < rows.length && active.column < columns.length ? active : null;
114
- const t14 = table && shown;
115
- let t15;
116
- if ($[43] !== t14) {
117
- t15 = tableClasses(t14);
118
- $[43] = t14;
119
- $[44] = t15;
120
- } else {
121
- t15 = $[44];
122
- }
123
- classes = t15;
124
- let t16;
125
- if ($[45] !== current || $[46] !== onActiveChange) {
126
- t16 = cell_0 => {
127
- setActive(cell_0);
128
- if (!sameCell(cell_0, current)) {
129
- onActiveChange?.(cell_0);
130
- }
131
- };
132
- $[45] = current;
133
- $[46] = onActiveChange;
134
- $[47] = t16;
135
- } else {
136
- t16 = $[47];
137
- }
138
- const activate = t16;
139
- let t17;
140
- if ($[48] !== activate || $[49] !== columns.length || $[50] !== current || $[51] !== rows.length) {
141
- t17 = e => {
142
- const target = moveCell(e.key, current, rows.length, columns.length, e.ctrlKey || e.metaKey);
143
- if (target === undefined) {
144
- return;
145
- }
146
- e.preventDefault();
147
- setAnnounce(target !== null);
148
- activate(target);
149
- };
150
- $[48] = activate;
151
- $[49] = columns.length;
152
- $[50] = current;
153
- $[51] = rows.length;
154
- $[52] = t17;
155
- } else {
156
- t17 = $[52];
157
- }
158
- const onKeyDown = t17;
159
- t6 = ref;
160
- if ($[53] !== className) {
161
- t7 = clsx("flex min-w-0 flex-col gap-2", className);
162
- $[53] = className;
163
- $[54] = t7;
164
- } else {
165
- t7 = $[54];
166
- }
167
- let t18;
168
- if ($[55] !== t) {
169
- t18 = t("heatmap.name");
170
- $[55] = t;
171
- $[56] = t18;
172
- } else {
173
- t18 = $[56];
174
- }
175
- const t19 = `${id}-hint`;
176
- let t20;
177
- let t21;
178
- if ($[57] !== activate) {
179
- t20 = () => activate(null);
180
- t21 = () => {
181
- activate(null);
182
- setAnnounce(false);
183
- };
184
- $[57] = activate;
185
- $[58] = t20;
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__*/_jsxs("div", {
195
- "aria-hidden": true,
196
- className: "grid gap-0.5 text-xs text-text-muted",
197
- style: {
198
- gridTemplateColumns: `auto repeat(${columns.length}, minmax(0, 1fr))`
199
- },
200
- children: [/*#__PURE__*/_jsx("span", {}), columns.map(_temp3), rows.map((row_0, rowIndex) => /*#__PURE__*/_jsxs("div", {
201
- className: "contents",
202
- children: [/*#__PURE__*/_jsx("span", {
203
- className: "flex items-center pr-2 leading-4 whitespace-nowrap",
204
- children: row_0.short === undefined ? row_0.label : row_0.short
205
- }), columns.map((column_1, columnIndex) => {
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
- if ($[60] !== label || $[61] !== onKeyDown || $[62] !== t18 || $[63] !== t19 || $[64] !== t20 || $[65] !== t21 || $[66] !== t22) {
250
- t8 = /*#__PURE__*/_jsx("div", {
251
- role: "group",
252
- tabIndex: 0,
253
- "aria-roledescription": t18,
254
- "aria-label": label,
255
- "aria-describedby": t19,
256
- className: "focus-ring rounded-xs",
257
- onKeyDown: onKeyDown,
258
- onPointerLeave: t20,
259
- onBlur: t21,
260
- children: t22
261
- });
262
- $[60] = label;
263
- $[61] = onKeyDown;
264
- $[62] = t18;
265
- $[63] = t19;
266
- $[64] = t20;
267
- $[65] = t21;
268
- $[66] = t22;
269
- $[67] = t8;
270
- } else {
271
- t8 = $[67];
272
- }
273
- t9 = legend && !empty && /*#__PURE__*/_jsxs("div", {
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
- $[0] = active;
302
- $[1] = cellHeight;
303
- $[2] = className;
304
- $[3] = columns;
305
- $[4] = format;
306
- $[5] = id;
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
- classes = $[19];
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 t10;
341
- if ($[68] !== classes || $[69] !== columns || $[70] !== empty || $[71] !== format || $[72] !== id || $[73] !== label || $[74] !== rows || $[75] !== shown || $[76] !== t || $[77] !== table || $[78] !== valueAt) {
342
- t10 = !empty && /*#__PURE__*/_jsxs("div", {
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(column_2 => /*#__PURE__*/_jsx("th", {
578
+ children: [/*#__PURE__*/_jsx("td", {}), columns.map(column_0 => /*#__PURE__*/_jsx("th", {
364
579
  scope: "col",
365
580
  className: classes.column,
366
- children: column_2.label
367
- }, column_2.key))]
581
+ children: column_0.label
582
+ }, column_0.key))]
368
583
  })
369
584
  }), /*#__PURE__*/_jsx("tbody", {
370
- children: rows.map((row_1, rowIndex_0) => /*#__PURE__*/_jsxs("tr", {
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: row_1.label
376
- }), columns.map((column_3, columnIndex_0) => {
377
- const value_3 = valueAt(rowIndex_0, columnIndex_0);
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: value_3 === null ? "" : format(value_3)
381
- }, column_3.key);
595
+ children: value_2 === null ? "" : format(value_2)
596
+ }, column_1.key);
382
597
  })]
383
- }, row_1.key))
598
+ }, row_0.key))
384
599
  })]
385
600
  })
386
601
  })]
387
602
  });
388
- $[68] = classes;
389
- $[69] = columns;
390
- $[70] = empty;
391
- $[71] = format;
392
- $[72] = id;
393
- $[73] = label;
394
- $[74] = rows;
395
- $[75] = shown;
396
- $[76] = t;
397
- $[77] = table;
398
- $[78] = valueAt;
399
- $[79] = t10;
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
- t10 = $[79];
616
+ t24 = $[77];
402
617
  }
403
- const t11 = `${id}-hint`;
404
- let t12;
405
- if ($[80] !== t) {
406
- t12 = t("heatmap.keyboard");
407
- $[80] = t;
408
- $[81] = t12;
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
- t12 = $[81];
625
+ t26 = $[79];
411
626
  }
412
- let t13;
413
- if ($[82] !== t11 || $[83] !== t12) {
414
- t13 = /*#__PURE__*/_jsx("p", {
415
- id: t11,
627
+ let t27;
628
+ if ($[80] !== t25 || $[81] !== t26) {
629
+ t27 = /*#__PURE__*/_jsx("p", {
630
+ id: t25,
416
631
  className: "sr-only",
417
- children: t12
632
+ children: t26
418
633
  });
419
- $[82] = t11;
420
- $[83] = t12;
421
- $[84] = t13;
634
+ $[80] = t25;
635
+ $[81] = t26;
636
+ $[82] = t27;
422
637
  } else {
423
- t13 = $[84];
638
+ t27 = $[82];
424
639
  }
425
- const t14 = announce && current !== null ? describe(current) : "";
426
- let t15;
427
- if ($[85] !== t14) {
428
- t15 = /*#__PURE__*/_jsx("p", {
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: t14
646
+ children: t28
432
647
  });
433
- $[85] = t14;
434
- $[86] = t15;
648
+ $[83] = t28;
649
+ $[84] = t29;
435
650
  } else {
436
- t15 = $[86];
651
+ t29 = $[84];
437
652
  }
438
- let t16;
439
- if ($[87] !== t10 || $[88] !== t13 || $[89] !== t15 || $[90] !== t6 || $[91] !== t7 || $[92] !== t8 || $[93] !== t9) {
440
- t16 = /*#__PURE__*/_jsxs("div", {
441
- ref: t6,
442
- className: t7,
443
- children: [t8, t9, t10, t13, t15]
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
- $[87] = t10;
446
- $[88] = t13;
447
- $[89] = t15;
448
- $[90] = t6;
449
- $[91] = t7;
450
- $[92] = t8;
451
- $[93] = t9;
452
- $[94] = t16;
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
- t16 = $[94];
669
+ t30 = $[92];
455
670
  }
456
- return t16;
671
+ return t30;
457
672
  }
458
673
  function _temp4(open) {
459
674
  return !open;
460
675
  }
461
- function _temp3(column_0) {
462
- return /*#__PURE__*/_jsx("span", {
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 _temp(value) {
679
+ function _temp2(value) {
471
680
  return value !== null && Number.isFinite(value);
472
681
  }