@adecore/charts 0.48.4 → 0.49.1

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/Root.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { useContext, useEffect, useId, useRef, useState, useSyncExternalStore } from 'react';
2
+ import { useContext, useEffect, useId, useMemo, useRef, useState, useSyncExternalStore } from 'react';
3
3
  import clsx from 'clsx';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { useContentSize } from '@adecore/ui';
@@ -33,7 +33,7 @@ const NO_ENTRIES = new Map();
33
33
  const defaultValue = value => Number.isInteger(value) ? formatNumber(value) : formatRounded(value, 2);
34
34
  /* The box of a chart: owns the data, the scales, the cursor and the keyboard; each part inside draws one layer. */
35
35
  export function ChartRoot(t0) {
36
- const $ = _c(71);
36
+ const $ = _c(112);
37
37
  const {
38
38
  data,
39
39
  x,
@@ -76,7 +76,15 @@ export function ChartRoot(t0) {
76
76
  const rowHeight = t6 === undefined ? ROW_HEIGHT : t6;
77
77
  const leastHeight = t7 === undefined ? 200 : t7;
78
78
  const grow = t8 === undefined ? false : t8;
79
- const margin = t9 === undefined ? {} : t9;
79
+ let t15;
80
+ if ($[0] !== t9) {
81
+ t15 = t9 === undefined ? {} : t9;
82
+ $[0] = t9;
83
+ $[1] = t15;
84
+ } else {
85
+ t15 = $[1];
86
+ }
87
+ const margin = t15;
80
88
  const surface = t10 === undefined ? "base" : t10;
81
89
  const groupGap = t11 === undefined ? GROUP_GAP : t11;
82
90
  const minBucketWidth = t12 === undefined ? 0 : t12;
@@ -120,10 +128,10 @@ export function ChartRoot(t0) {
120
128
  const markers = horizontal ? NO_ENTRIES : allMarkers;
121
129
  const bands = horizontal ? NO_ENTRIES : allBands;
122
130
  const dropped = horizontal && (series.size < allSeries.size || allMarkers.size > 0 || allBands.size > 0);
123
- let t15;
124
131
  let t16;
125
- if ($[0] !== band || $[1] !== dropped || $[2] !== orientation) {
126
- t15 = () => {
132
+ let t17;
133
+ if ($[2] !== band || $[3] !== dropped || $[4] !== orientation) {
134
+ t16 = () => {
127
135
  if (orientation === "horizontal" && !band) {
128
136
  warnOnce("Chart.Root: `orientation=\"horizontal\"` takes the buckets of a band scale; this chart stays vertical.");
129
137
  }
@@ -131,42 +139,133 @@ export function ChartRoot(t0) {
131
139
  warnOnce("Chart.Root: a horizontal chart draws `Chart.Bar` only; its lines, areas, points, markers and bands are left out.");
132
140
  }
133
141
  };
134
- t16 = [orientation, band, dropped];
135
- $[0] = band;
136
- $[1] = dropped;
137
- $[2] = orientation;
138
- $[3] = t15;
139
- $[4] = t16;
142
+ t17 = [orientation, band, dropped];
143
+ $[2] = band;
144
+ $[3] = dropped;
145
+ $[4] = orientation;
146
+ $[5] = t16;
147
+ $[6] = t17;
140
148
  } else {
141
- t15 = $[3];
142
- t16 = $[4];
149
+ t16 = $[5];
150
+ t17 = $[6];
143
151
  }
144
- useEffect(t15, t16);
145
- let t17;
146
- if ($[5] !== x) {
147
- t17 = (row, index) => {
148
- const value = readValue(x, row, index);
149
- return value === null || value === undefined ? Number.NaN : xOf(value);
152
+ useEffect(t16, t17);
153
+ let t18;
154
+ if ($[7] !== data || $[8] !== x) {
155
+ let t19;
156
+ if ($[10] !== x) {
157
+ t19 = (row, index) => {
158
+ const value = readValue(x, row, index);
159
+ return value === null || value === undefined ? Number.NaN : xOf(value);
160
+ };
161
+ $[10] = x;
162
+ $[11] = t19;
163
+ } else {
164
+ t19 = $[11];
165
+ }
166
+ t18 = data.map(t19);
167
+ $[7] = data;
168
+ $[8] = x;
169
+ $[9] = t18;
170
+ } else {
171
+ t18 = $[9];
172
+ }
173
+ const xs = t18;
174
+ let t19;
175
+ if ($[12] !== data || $[13] !== points || $[14] !== rowKey) {
176
+ t19 = points ? data.map((row_0, index_0) => rowKey === undefined ? String(index_0) : String(readValue(rowKey, row_0, index_0))) : null;
177
+ $[12] = data;
178
+ $[13] = points;
179
+ $[14] = rowKey;
180
+ $[15] = t19;
181
+ } else {
182
+ t19 = $[15];
183
+ }
184
+ const keys = t19;
185
+ let t20;
186
+ if ($[16] !== data || $[17] !== rowLabel) {
187
+ t20 = rowLabel !== undefined ? data.map((row_1, index_1) => String(readValue(rowLabel, row_1, index_1))) : null;
188
+ $[16] = data;
189
+ $[17] = rowLabel;
190
+ $[18] = t20;
191
+ } else {
192
+ t20 = $[18];
193
+ }
194
+ const rowLabels = t20;
195
+ let t21;
196
+ if ($[19] !== band || $[20] !== data || $[21] !== group || $[22] !== points) {
197
+ t21 = (band || points) && group !== undefined ? data.map((row_2, index_2) => String(readValue(group, row_2, index_2))) : null;
198
+ $[19] = band;
199
+ $[20] = data;
200
+ $[21] = group;
201
+ $[22] = points;
202
+ $[23] = t21;
203
+ } else {
204
+ t21 = $[23];
205
+ }
206
+ const groupKeys = t21;
207
+ let t22;
208
+ if ($[24] !== data || $[25] !== groupKeys || $[26] !== groupLabel) {
209
+ t22 = groupKeys === null ? null : groupLabel === undefined ? groupKeys : data.map((row_3, index_3) => String(readValue(groupLabel, row_3, index_3)));
210
+ $[24] = data;
211
+ $[25] = groupKeys;
212
+ $[26] = groupLabel;
213
+ $[27] = t22;
214
+ } else {
215
+ t22 = $[27];
216
+ }
217
+ const groupLabels = t22;
218
+ let t23;
219
+ if ($[28] !== groupKeys || $[29] !== groupLabels || $[30] !== keys || $[31] !== rowLabels || $[32] !== xs) {
220
+ t23 = {
221
+ xs,
222
+ keys,
223
+ rowLabels,
224
+ groupKeys,
225
+ groupLabels
150
226
  };
151
- $[5] = x;
152
- $[6] = t17;
227
+ $[28] = groupKeys;
228
+ $[29] = groupLabels;
229
+ $[30] = keys;
230
+ $[31] = rowLabels;
231
+ $[32] = xs;
232
+ $[33] = t23;
153
233
  } else {
154
- t17 = $[6];
234
+ t23 = $[33];
155
235
  }
156
- const xs = data.map(t17);
157
- const keys = points ? data.map((row_0, index_0) => rowKey === undefined ? String(index_0) : String(readValue(rowKey, row_0, index_0))) : null;
158
- const rowLabels = rowLabel !== undefined ? data.map((row_1, index_1) => String(readValue(rowLabel, row_1, index_1))) : null;
159
- const groupKeys = (band || points) && group !== undefined ? data.map((row_2, index_2) => String(readValue(group, row_2, index_2))) : null;
160
- const groupLabels = groupKeys === null ? null : groupLabel === undefined ? groupKeys : data.map((row_3, index_3) => String(readValue(groupLabel, row_3, index_3)));
236
+ const {
237
+ xs: xs_0,
238
+ keys: keys_0,
239
+ rowLabels: rowLabels_0,
240
+ groupKeys: groupKeys_0,
241
+ groupLabels: groupLabels_0
242
+ } = t23;
161
243
  const leftY = yAxes.get("left");
162
244
  const rightY = yAxes.get("right");
163
245
  const [leftAxis, rightAxis] = useAlignedAxes(chartGroup?.widths ?? null, horizontal ? axes.start ?? 0 : leftY?.width ?? 0, horizontal ? 0 : rightY?.width ?? 0);
164
246
  const room = Math.max(0, size.width - leftAxis - rightAxis);
165
- const bucketStep = xScale === "time" && !points ? stepProp ?? bucketStepOf(xs) : 0;
247
+ const bucketStep = xScale === "time" && !points ? stepProp ?? bucketStepOf(xs_0) : 0;
166
248
  const inset = band || bucketStep > 0 ? 0 : INSET;
167
249
  const marginLeft = margin.left ?? inset;
168
250
  const marginRight = margin.right ?? inset;
169
- const layout = horizontal ? bandLayout(xs.length, groupKeys, 0, rowHeight, groupGap) : band ? bandLayout(xs.length, groupKeys, Math.max(0, room - marginLeft - marginRight), minBucketWidth, groupGap) : null;
251
+ let t24;
252
+ if ($[34] !== band || $[35] !== groupGap || $[36] !== groupKeys_0 || $[37] !== horizontal || $[38] !== marginLeft || $[39] !== marginRight || $[40] !== minBucketWidth || $[41] !== room || $[42] !== rowHeight || $[43] !== xs_0.length) {
253
+ t24 = horizontal ? bandLayout(xs_0.length, groupKeys_0, 0, rowHeight, groupGap) : band ? bandLayout(xs_0.length, groupKeys_0, Math.max(0, room - marginLeft - marginRight), minBucketWidth, groupGap) : null;
254
+ $[34] = band;
255
+ $[35] = groupGap;
256
+ $[36] = groupKeys_0;
257
+ $[37] = horizontal;
258
+ $[38] = marginLeft;
259
+ $[39] = marginRight;
260
+ $[40] = minBucketWidth;
261
+ $[41] = room;
262
+ $[42] = rowHeight;
263
+ $[43] = xs_0.length;
264
+ $[44] = t24;
265
+ } else {
266
+ t24 = $[44];
267
+ }
268
+ const layout = t24;
170
269
  const width = layout === null || horizontal ? room : Math.max(room, Math.ceil(layout.width + marginLeft + marginRight));
171
270
  const scrolls = layout !== null && width > room;
172
271
  const overhang = scrolls ? leftAxis : 0;
@@ -178,7 +277,7 @@ export function ChartRoot(t0) {
178
277
  let height;
179
278
  if (horizontal) {
180
279
  top = Math.max(margin.top ?? 8, titleRoom + (rules.size > 0 ? RULE_LABEL_ROOM : 0));
181
- bottom = top + (xs.length === 0 ? 2 * rowHeight : layout.width);
280
+ bottom = top + (xs_0.length === 0 ? 2 * rowHeight : layout.width);
182
281
  height = bottom + (margin.bottom ?? 0) + (yAxes.size > 0 ? X_AXIS_GAP + VALUE_AXIS_LINE : 0);
183
282
  } else {
184
283
  height = boxHeight;
@@ -196,9 +295,9 @@ export function ChartRoot(t0) {
196
295
  };
197
296
  const valueRange = horizontal ? [plot.left, plot.right] : [plot.bottom, plot.top];
198
297
  const continuousKind = xScale === "band" ? "linear" : xScale;
199
- const continuous = band ? null : points ? pointXScale(continuousKind, xs, [plot.left, plot.right], xOptions) : continuousXScale(continuousKind, xs, [plot.left, plot.right], bucketStep, xOptions);
298
+ const continuous = band ? null : points ? pointXScale(continuousKind, xs_0, [plot.left, plot.right], xOptions) : continuousXScale(continuousKind, xs_0, [plot.left, plot.right], bucketStep, xOptions);
200
299
  const stackInput = [...series].map(_temp5);
201
- const stacked = stackSeries(stackInput, xs.length);
300
+ const stacked = stackSeries(stackInput, xs_0.length);
202
301
  const ruleValues = [...rules.values()].map(_temp6);
203
302
  const yOptions = ruleValues.length === 0 ? y : {
204
303
  ...y,
@@ -243,7 +342,7 @@ export function ChartRoot(t0) {
243
342
  if (points) {
244
343
  const found = new Map();
245
344
  data.forEach((_, index_5) => {
246
- const key = groupKeys?.[index_5] ?? "";
345
+ const key = groupKeys_0?.[index_5] ?? "";
247
346
  let at = found.get(key);
248
347
  if (at === undefined) {
249
348
  at = pointGroups.length;
@@ -260,7 +359,7 @@ export function ChartRoot(t0) {
260
359
  const placed = [];
261
360
  const positions = data.map((__0, index_6) => {
262
361
  const value_1 = placing?.values[index_6];
263
- const left = continuous === null || !points ? Number.NaN : continuous.at(xs[index_6]);
362
+ const left = continuous === null || !points ? Number.NaN : continuous.at(xs_0[index_6]);
264
363
  const pixel_0 = value_1 === null || value_1 === undefined ? null : pixelOfY(value_1);
265
364
  if (pixel_0 === null || !Number.isFinite(left)) {
266
365
  return null;
@@ -272,10 +371,10 @@ export function ChartRoot(t0) {
272
371
  });
273
372
  return [left, pixel_0];
274
373
  });
275
- const readable = [...series].filter((t18, index_7, all) => {
276
- const [, entry_6] = t18;
277
- return !points || all.findIndex(t19 => {
278
- const [, other] = t19;
374
+ const readable = [...series].filter((t25, index_7, all) => {
375
+ const [, entry_6] = t25;
376
+ return !points || all.findIndex(t26 => {
377
+ const [, other] = t26;
279
378
  return other.label === entry_6.label;
280
379
  }) === index_7;
281
380
  });
@@ -286,7 +385,7 @@ export function ChartRoot(t0) {
286
385
  if (layout !== null) {
287
386
  return bucketStart + (layout.lefts[index_10] ?? 0) + layout.bucket / 2;
288
387
  }
289
- return continuous.at(xs[index_10] + bucketStep / 2);
388
+ return continuous.at(xs_0[index_10] + bucketStep / 2);
290
389
  };
291
390
  const bucketAt = index_11 => {
292
391
  if (layout !== null) {
@@ -295,18 +394,18 @@ export function ChartRoot(t0) {
295
394
  width: layout.bucket
296
395
  };
297
396
  }
298
- if (bucketStep <= 0 || xs[index_11] === undefined) {
397
+ if (bucketStep <= 0 || xs_0[index_11] === undefined) {
299
398
  return null;
300
399
  }
301
- const left_0 = continuous.at(xs[index_11]);
400
+ const left_0 = continuous.at(xs_0[index_11]);
302
401
  return {
303
402
  left: left_0,
304
- width: continuous.at(xs[index_11] + bucketStep) - left_0
403
+ width: continuous.at(xs_0[index_11] + bucketStep) - left_0
305
404
  };
306
405
  };
307
406
  const pixelOfX = value_2 => {
308
407
  if (layout !== null) {
309
- const index_12 = keyIndexOf(xs, value_2);
408
+ const index_12 = keyIndexOf(xs_0, value_2);
310
409
  return index_12 < 0 ? null : centerOf(index_12);
311
410
  }
312
411
  return typeof value_2 === "number" ? continuous.at(value_2) : null;
@@ -324,17 +423,17 @@ export function ChartRoot(t0) {
324
423
  };
325
424
  const formatY = format ?? leftY?.format ?? rightY?.format ?? defaultValue;
326
425
  const xValueOf = index_13 => {
327
- const text = formatX(xs[index_13]);
426
+ const text = formatX(xs_0[index_13]);
328
427
  return points && formats.xTitle !== undefined ? `${formats.xTitle} ${text}` : text;
329
428
  };
330
429
  const notesAt = index_14 => {
331
- const at_0 = xs[index_14];
430
+ const at_0 = xs_0[index_14];
332
431
  if (at_0 === undefined) {
333
432
  return [];
334
433
  }
335
434
  const notes = [];
336
435
  for (const marker of markers.values()) {
337
- const inside = band ? String(marker.at) === String(at_0) : !points && typeof marker.at === "number" && containingIndex(xs, marker.at, bucketStep || undefined) === index_14;
436
+ const inside = band ? String(marker.at) === String(at_0) : !points && typeof marker.at === "number" && containingIndex(xs_0, marker.at, bucketStep || undefined) === index_14;
338
437
  if (inside) {
339
438
  notes.push({
340
439
  kind: "marker",
@@ -347,8 +446,8 @@ export function ChartRoot(t0) {
347
446
  for (const range of bands.values()) {
348
447
  let inside_0;
349
448
  if (band) {
350
- const from = keyIndexOf(xs, range.from);
351
- const to = keyIndexOf(xs, range.to);
449
+ const from = keyIndexOf(xs_0, range.from);
450
+ const to = keyIndexOf(xs_0, range.to);
352
451
  inside_0 = from >= 0 && to >= 0 && index_14 >= Math.min(from, to) && index_14 <= Math.max(from, to);
353
452
  } else {
354
453
  if (bucketStep > 0) {
@@ -371,19 +470,19 @@ export function ChartRoot(t0) {
371
470
  const controlled = activeX !== undefined;
372
471
  const cursorX = controlled ? activeX : sharedCursor !== null ? sharedCursor.x : ownX;
373
472
  const indexAt = value_4 => {
374
- if (keys === null) {
375
- return snapIndex(xs, xScale, value_4, bucketStep);
473
+ if (keys_0 === null) {
474
+ return snapIndex(xs_0, xScale, value_4, bucketStep);
376
475
  }
377
- const index_15 = value_4 === null ? -1 : keys.indexOf(String(value_4));
476
+ const index_15 = value_4 === null ? -1 : keys_0.indexOf(String(value_4));
378
477
  return positions[index_15] == null ? -1 : index_15;
379
478
  };
380
479
  const activeIndex = indexAt(cursorX);
381
480
  const keyIndex = indexAt(keyX);
382
481
  const from_0 = keyIndex >= 0 ? keyIndex : activeIndex;
383
482
  const ownsCursor = controlled || sharedCursor === null || sharedCursor.owner === id;
384
- let t20;
385
- if ($[7] !== controlled || $[8] !== id || $[9] !== onActiveXChange || $[10] !== sharedCursor) {
386
- t20 = value_5 => {
483
+ let t27;
484
+ if ($[45] !== controlled || $[46] !== id || $[47] !== onActiveXChange || $[48] !== sharedCursor) {
485
+ t27 = value_5 => {
387
486
  if (!controlled) {
388
487
  if (sharedCursor !== null) {
389
488
  sharedCursor.setX(value_5, id);
@@ -393,53 +492,53 @@ export function ChartRoot(t0) {
393
492
  }
394
493
  onActiveXChange?.(value_5);
395
494
  };
396
- $[7] = controlled;
397
- $[8] = id;
398
- $[9] = onActiveXChange;
399
- $[10] = sharedCursor;
400
- $[11] = t20;
495
+ $[45] = controlled;
496
+ $[46] = id;
497
+ $[47] = onActiveXChange;
498
+ $[48] = sharedCursor;
499
+ $[49] = t27;
401
500
  } else {
402
- t20 = $[11];
501
+ t27 = $[49];
403
502
  }
404
- const setActiveX = t20;
405
- let t21;
406
- if ($[12] !== selected) {
407
- t21 = new Set((selected ?? []).map(String));
408
- $[12] = selected;
409
- $[13] = t21;
503
+ const setActiveX = t27;
504
+ let t28;
505
+ if ($[50] !== selected) {
506
+ t28 = new Set((selected ?? []).map(String));
507
+ $[50] = selected;
508
+ $[51] = t28;
410
509
  } else {
411
- t21 = $[13];
510
+ t28 = $[51];
412
511
  }
413
- const picked = t21;
414
- let t22;
415
- if ($[14] !== picked) {
416
- t22 = key_0 => picked.has(String(key_0));
417
- $[14] = picked;
418
- $[15] = t22;
512
+ const picked = t28;
513
+ let t29;
514
+ if ($[52] !== picked) {
515
+ t29 = key_0 => picked.has(String(key_0));
516
+ $[52] = picked;
517
+ $[53] = t29;
419
518
  } else {
420
- t22 = $[15];
519
+ t29 = $[53];
421
520
  }
422
- const selectedRows = (keys ?? xs).map(t22);
423
- let t23;
424
- if ($[16] !== dimmed) {
425
- t23 = (row_6, index_16) => dimmed?.(row_6, index_16) ?? false;
426
- $[16] = dimmed;
427
- $[17] = t23;
521
+ const selectedRows = (keys_0 ?? xs_0).map(t29);
522
+ let t30;
523
+ if ($[54] !== dimmed) {
524
+ t30 = (row_6, index_16) => dimmed?.(row_6, index_16) ?? false;
525
+ $[54] = dimmed;
526
+ $[55] = t30;
428
527
  } else {
429
- t23 = $[17];
528
+ t30 = $[55];
430
529
  }
431
- const dimmedRows = data.map(t23);
530
+ const dimmedRows = data.map(t30);
432
531
  const dimmedGroups = new Set(pointGroups.filter(run => run.indexes.every(index_17 => dimmedRows[index_17])).map(_temp9));
433
532
  const anyPicked = selectedRows.some(Boolean);
434
533
  const columnDim = [...series.values()].find(_temp0)?.dimOpacity ?? null;
435
- const labelFocus = xs.map((__1, index_18) => {
534
+ const labelFocus = xs_0.map((__1, index_18) => {
436
535
  if (index_18 === activeIndex || selectedRows[index_18]) {
437
536
  return "strong";
438
537
  }
439
538
  return dimmedRows[index_18] || anyPicked ? "dim" : null;
440
539
  });
441
540
  const describe = index_19 => {
442
- const parts = (points ? [groupLabels?.[index_19], rowLabels?.[index_19], xValueOf(index_19)] : [groupLabels?.[index_19], rowLabels?.[index_19] ?? xValueOf(index_19)]).filter(_temp1);
541
+ const parts = (points ? [groupLabels_0?.[index_19], rowLabels_0?.[index_19], xValueOf(index_19)] : [groupLabels_0?.[index_19], rowLabels_0?.[index_19] ?? xValueOf(index_19)]).filter(_temp1);
443
542
  for (const [, entry_8] of readable) {
444
543
  const value_6 = entry_8.values[index_19];
445
544
  if (value_6 !== null && value_6 !== undefined) {
@@ -448,72 +547,72 @@ export function ChartRoot(t0) {
448
547
  }
449
548
  return [...parts, ...notesAt(index_19).map(_temp10)].join(", ");
450
549
  };
451
- let t24;
452
- let t25;
453
- if ($[18] !== data || $[19] !== x) {
454
- t24 = () => {
550
+ let t31;
551
+ let t32;
552
+ if ($[56] !== data || $[57] !== x) {
553
+ t31 = () => {
455
554
  warnMissingKey(x, data, "Chart.Root");
456
555
  };
457
- t25 = [x, data];
458
- $[18] = data;
459
- $[19] = x;
460
- $[20] = t24;
461
- $[21] = t25;
556
+ t32 = [x, data];
557
+ $[56] = data;
558
+ $[57] = x;
559
+ $[58] = t31;
560
+ $[59] = t32;
462
561
  } else {
463
- t24 = $[20];
464
- t25 = $[21];
562
+ t31 = $[58];
563
+ t32 = $[59];
465
564
  }
466
- useEffect(t24, t25);
565
+ useEffect(t31, t32);
467
566
  const indexAtPointer = e => {
468
567
  const box = e.currentTarget.getBoundingClientRect();
469
568
  const pixel_1 = horizontal ? e.clientY - box.top : e.clientX - box.left;
470
569
  if (points) {
471
570
  return nearestPoint(placed, pixel_1, e.clientY - box.top, POINT_REACH);
472
571
  }
473
- return nearestIndex(xs.map((__2, index_20) => centerOf(index_20)), pixel_1);
572
+ return nearestIndex(xs_0.map((__2, index_20) => centerOf(index_20)), pixel_1);
474
573
  };
475
574
  const onPointerMove = e_0 => {
476
575
  setAnnounce(false);
477
- if (xs.length === 0) {
576
+ if (xs_0.length === 0) {
478
577
  return;
479
578
  }
480
- if (keys !== null) {
579
+ if (keys_0 !== null) {
481
580
  const index_21 = indexAtPointer(e_0);
482
581
  if (index_21 !== activeIndex) {
483
- setActiveX(index_21 < 0 ? null : keys[index_21]);
582
+ setActiveX(index_21 < 0 ? null : keys_0[index_21]);
484
583
  }
485
584
  return;
486
585
  }
487
586
  if (continuous !== null) {
488
587
  const pixel_2 = e_0.clientX - e_0.currentTarget.getBoundingClientRect().left;
489
- const index_22 = snapIndex(xs, xScale, continuous.invert(Math.min(plot.right - 1, Math.max(plot.left, pixel_2))), bucketStep);
490
- const value_7 = index_22 < 0 ? null : xs[index_22];
588
+ const index_22 = snapIndex(xs_0, xScale, continuous.invert(Math.min(plot.right - 1, Math.max(plot.left, pixel_2))), bucketStep);
589
+ const value_7 = index_22 < 0 ? null : xs_0[index_22];
491
590
  if (value_7 !== cursorX) {
492
591
  setActiveX(value_7);
493
592
  }
494
593
  return;
495
594
  }
496
595
  const index_23 = indexAtPointer(e_0);
497
- if (index_23 >= 0 && String(xs[index_23]) !== String(cursorX)) {
498
- setActiveX(xs[index_23]);
596
+ if (index_23 >= 0 && String(xs_0[index_23]) !== String(cursorX)) {
597
+ setActiveX(xs_0[index_23]);
499
598
  }
500
599
  };
501
600
  const pressable = interactive && onActivate !== undefined && (layout !== null || points);
502
- let t26;
503
- if ($[22] !== data || $[23] !== onActivate || $[24] !== pressable) {
504
- t26 = index_24 => {
601
+ let t33;
602
+ if ($[60] !== data || $[61] !== onActivate || $[62] !== pressable) {
603
+ t33 = index_24 => {
505
604
  if (pressable && index_24 >= 0) {
506
605
  onActivate(data[index_24], index_24);
507
606
  }
508
607
  };
509
- $[22] = data;
510
- $[23] = onActivate;
511
- $[24] = pressable;
512
- $[25] = t26;
608
+ $[60] = data;
609
+ $[61] = onActivate;
610
+ $[62] = pressable;
611
+ $[63] = t33;
513
612
  } else {
514
- t26 = $[25];
613
+ t33 = $[63];
515
614
  }
516
- const activate = t26;
615
+ const activate = t33;
517
616
  const onKeyDown = e_1 => {
518
617
  if (pressable && from_0 >= 0 && (e_1.key === "Enter" || e_1.key === " ")) {
519
618
  e_1.preventDefault();
@@ -521,7 +620,7 @@ export function ChartRoot(t0) {
521
620
  return;
522
621
  }
523
622
  const groupStarts = layout?.groups.map(_temp11) ?? [];
524
- const target = keys === null ? moveIndex(e_1.key, from_0, xs.length, groupStarts, horizontal ? "rows" : "columns") : movePoint(pointGroups.map(run_2 => run_2.indexes.filter(index_25 => positions[index_25] !== null)), from_0, e_1.key);
623
+ const target = keys_0 === null ? moveIndex(e_1.key, from_0, xs_0.length, groupStarts, horizontal ? "rows" : "columns") : movePoint(pointGroups.map(run_2 => run_2.indexes.filter(index_25 => positions[index_25] !== null)), from_0, e_1.key);
525
624
  if (target === undefined) {
526
625
  return;
527
626
  }
@@ -533,7 +632,7 @@ export function ChartRoot(t0) {
533
632
  return;
534
633
  }
535
634
  setAnnounce(true);
536
- const value_8 = keys === null ? xs[target] : keys[target];
635
+ const value_8 = keys_0 === null ? xs_0[target] : keys_0[target];
537
636
  setKeyX(value_8);
538
637
  setActiveX(value_8);
539
638
  const box_0 = scroller.current;
@@ -549,7 +648,7 @@ export function ChartRoot(t0) {
549
648
  store,
550
649
  label,
551
650
  data,
552
- xs,
651
+ xs: xs_0,
553
652
  xScale,
554
653
  height,
555
654
  plot,
@@ -566,8 +665,8 @@ export function ChartRoot(t0) {
566
665
  slots,
567
666
  markers,
568
667
  bands,
569
- groupKeys,
570
- groupLabels,
668
+ groupKeys: groupKeys_0,
669
+ groupLabels: groupLabels_0,
571
670
  activeIndex,
572
671
  ownsCursor,
573
672
  selected: selectedRows,
@@ -598,8 +697,8 @@ export function ChartRoot(t0) {
598
697
  valueFormat: format ?? null,
599
698
  notesAt,
600
699
  points,
601
- keys,
602
- rowLabels,
700
+ keys: keys_0,
701
+ rowLabels: rowLabels_0,
603
702
  positions,
604
703
  pointGroups,
605
704
  dimmedGroups,
@@ -613,39 +712,47 @@ export function ChartRoot(t0) {
613
712
  halo: surface === "raised" ? "var(--surface-raised)" : "var(--surface)"
614
713
  };
615
714
  const ruleText = rules.size === 0 ? null : `${[...rules.values()].map(rule_0 => `${rule_0.label} ${formatY(rule_0.value)}`).join(", ")}.`;
616
- let t27;
617
- if ($[26] !== horizontal || $[27] !== points || $[28] !== t) {
618
- t27 = points ? t("keyboard.points") : horizontal ? t("keyboard.rows") : t("keyboard.move");
619
- $[26] = horizontal;
620
- $[27] = points;
621
- $[28] = t;
622
- $[29] = t27;
715
+ let t34;
716
+ if ($[64] !== horizontal || $[65] !== points || $[66] !== t) {
717
+ t34 = points ? t("keyboard.points") : horizontal ? t("keyboard.rows") : t("keyboard.move");
718
+ $[64] = horizontal;
719
+ $[65] = points;
720
+ $[66] = t;
721
+ $[67] = t34;
623
722
  } else {
624
- t27 = $[29];
723
+ t34 = $[67];
625
724
  }
626
- const t28 = layout !== null && layout.groups.length > 0 ? t("keyboard.groups") : null;
627
- let t29;
628
- if ($[30] !== pressable || $[31] !== t) {
629
- t29 = pressable ? t("keyboard.activate") : null;
630
- $[30] = pressable;
631
- $[31] = t;
632
- $[32] = t29;
725
+ let t35;
726
+ if ($[68] !== layout || $[69] !== t) {
727
+ t35 = layout !== null && layout.groups.length > 0 ? t("keyboard.groups") : null;
728
+ $[68] = layout;
729
+ $[69] = t;
730
+ $[70] = t35;
633
731
  } else {
634
- t29 = $[32];
732
+ t35 = $[70];
635
733
  }
636
- let t30;
637
- if ($[33] !== ruleText || $[34] !== t27 || $[35] !== t28 || $[36] !== t29) {
638
- t30 = [ruleText, t27, t28, t29].filter(Boolean);
639
- $[33] = ruleText;
640
- $[34] = t27;
641
- $[35] = t28;
642
- $[36] = t29;
643
- $[37] = t30;
734
+ let t36;
735
+ if ($[71] !== pressable || $[72] !== t) {
736
+ t36 = pressable ? t("keyboard.activate") : null;
737
+ $[71] = pressable;
738
+ $[72] = t;
739
+ $[73] = t36;
644
740
  } else {
645
- t30 = $[37];
741
+ t36 = $[73];
646
742
  }
647
- const hint = t30.join(" ");
648
- const highlighted = layout === null ? [] : xs.flatMap((__3, index_26) => cursor === "full" && index_26 === activeIndex || selectedRows[index_26] ? [index_26] : []);
743
+ let t37;
744
+ if ($[74] !== ruleText || $[75] !== t34 || $[76] !== t35 || $[77] !== t36) {
745
+ t37 = [ruleText, t34, t35, t36].filter(Boolean);
746
+ $[74] = ruleText;
747
+ $[75] = t34;
748
+ $[76] = t35;
749
+ $[77] = t36;
750
+ $[78] = t37;
751
+ } else {
752
+ t37 = $[78];
753
+ }
754
+ const hint = t37.join(" ");
755
+ const highlighted = layout === null ? [] : xs_0.flatMap((__3, index_26) => cursor === "full" && index_26 === activeIndex || selectedRows[index_26] ? [index_26] : []);
649
756
  const bucketBox = (index_27, pressing) => {
650
757
  const start = Math.round(bucketStart + (layout?.lefts[index_27] ?? 0));
651
758
  const size_0 = Math.max(1, Math.round(layout?.bucket ?? 0));
@@ -669,191 +776,191 @@ export function ChartRoot(t0) {
669
776
  height: pressing ? height - plot.top : plot.height
670
777
  };
671
778
  };
672
- let t31;
673
- if ($[38] !== keyX || $[39] !== setActiveX) {
674
- t31 = () => setActiveX(keyX);
675
- $[38] = keyX;
676
- $[39] = setActiveX;
677
- $[40] = t31;
779
+ let t38;
780
+ if ($[79] !== keyX || $[80] !== setActiveX) {
781
+ t38 = () => setActiveX(keyX);
782
+ $[79] = keyX;
783
+ $[80] = setActiveX;
784
+ $[81] = t38;
678
785
  } else {
679
- t31 = $[40];
786
+ t38 = $[81];
680
787
  }
681
788
  const pointer = {
682
789
  onPointerMove,
683
- onPointerLeave: t31,
790
+ onPointerLeave: t38,
684
791
  onClick: pressable ? e_2 => activate(indexAtPointer(e_2)) : undefined
685
792
  };
686
- const t32 = grow && "h-full min-h-0";
687
- let t33;
688
- if ($[41] !== className || $[42] !== t32) {
689
- t33 = clsx("flex min-w-0 flex-col gap-3", t32, className);
690
- $[41] = className;
691
- $[42] = t32;
692
- $[43] = t33;
793
+ const t39 = grow && "h-full min-h-0";
794
+ let t40;
795
+ if ($[82] !== className || $[83] !== t39) {
796
+ t40 = clsx("flex min-w-0 flex-col gap-3", t39, className);
797
+ $[82] = className;
798
+ $[83] = t39;
799
+ $[84] = t40;
693
800
  } else {
694
- t33 = $[43];
801
+ t40 = $[84];
695
802
  }
696
- let t34;
697
- if ($[44] === Symbol.for("react.memo_cache_sentinel")) {
698
- t34 = /*#__PURE__*/_jsx("div", {
803
+ let t41;
804
+ if ($[85] === Symbol.for("react.memo_cache_sentinel")) {
805
+ t41 = /*#__PURE__*/_jsx("div", {
699
806
  ref: setLegendSlot,
700
807
  className: "empty:hidden"
701
808
  });
702
- $[44] = t34;
809
+ $[85] = t41;
703
810
  } else {
704
- t34 = $[44];
811
+ t41 = $[85];
705
812
  }
706
- const t35 = grow && !horizontal && "min-h-0 flex-1";
707
- const t36 = horizontal && pressable && "cursor-pointer";
708
- let t37;
709
- if ($[45] !== t35 || $[46] !== t36) {
710
- t37 = clsx("focus-ring-within relative flex rounded-md", t35, t36);
711
- $[45] = t35;
712
- $[46] = t36;
713
- $[47] = t37;
813
+ const t42 = grow && !horizontal && "min-h-0 flex-1";
814
+ const t43 = horizontal && pressable && "cursor-pointer";
815
+ let t44;
816
+ if ($[86] !== t42 || $[87] !== t43) {
817
+ t44 = clsx("focus-ring-within relative flex rounded-md", t42, t43);
818
+ $[86] = t42;
819
+ $[87] = t43;
820
+ $[88] = t44;
714
821
  } else {
715
- t37 = $[47];
822
+ t44 = $[88];
716
823
  }
717
- let t38;
718
- if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
719
- t38 = {
824
+ let t45;
825
+ if ($[89] === Symbol.for("react.memo_cache_sentinel")) {
826
+ t45 = {
720
827
  outlineOffset: 4
721
828
  };
722
- $[48] = t38;
829
+ $[89] = t45;
723
830
  } else {
724
- t38 = $[48];
831
+ t45 = $[89];
725
832
  }
726
- const t39 = scrolls ? "overflow-x-auto overflow-y-hidden overscroll-x-contain" : "overflow-visible";
727
- let t40;
728
- if ($[49] !== t39) {
729
- t40 = clsx("min-w-0 flex-1", t39);
730
- $[49] = t39;
731
- $[50] = t40;
833
+ const t46 = scrolls ? "overflow-x-auto overflow-y-hidden overscroll-x-contain" : "overflow-visible";
834
+ let t47;
835
+ if ($[90] !== t46) {
836
+ t47 = clsx("min-w-0 flex-1", t46);
837
+ $[90] = t46;
838
+ $[91] = t47;
732
839
  } else {
733
- t40 = $[50];
840
+ t47 = $[91];
734
841
  }
735
- let t41;
736
- if ($[51] !== overhang || $[52] !== scroll) {
737
- t41 = overhang > 0 ? {
842
+ let t48;
843
+ if ($[92] !== overhang || $[93] !== scroll) {
844
+ t48 = overhang > 0 ? {
738
845
  marginLeft: -overhang,
739
846
  paddingLeft: overhang,
740
847
  clipPath: scroll > 0 ? `inset(0 0 0 ${overhang}px)` : undefined
741
848
  } : undefined;
742
- $[51] = overhang;
743
- $[52] = scroll;
744
- $[53] = t41;
849
+ $[92] = overhang;
850
+ $[93] = scroll;
851
+ $[94] = t48;
745
852
  } else {
746
- t41 = $[53];
853
+ t48 = $[94];
747
854
  }
748
- let t42;
749
- if ($[54] === Symbol.for("react.memo_cache_sentinel")) {
750
- t42 = e_3 => setScroll(e_3.currentTarget.scrollLeft);
751
- $[54] = t42;
855
+ let t49;
856
+ if ($[95] === Symbol.for("react.memo_cache_sentinel")) {
857
+ t49 = e_3 => setScroll(e_3.currentTarget.scrollLeft);
858
+ $[95] = t49;
752
859
  } else {
753
- t42 = $[54];
860
+ t49 = $[95];
754
861
  }
755
- const t43 = height;
756
- let t44;
757
- if ($[55] !== interactive || $[56] !== t) {
758
- t44 = interactive ? t("chart") : undefined;
759
- $[55] = interactive;
760
- $[56] = t;
761
- $[57] = t44;
862
+ const t50 = height;
863
+ let t51;
864
+ if ($[96] !== interactive || $[97] !== t) {
865
+ t51 = interactive ? t("chart") : undefined;
866
+ $[96] = interactive;
867
+ $[97] = t;
868
+ $[98] = t51;
762
869
  } else {
763
- t44 = $[57];
870
+ t51 = $[98];
764
871
  }
765
- const t45 = pressable && "cursor-pointer";
766
- let t46;
767
- if ($[58] !== t45) {
768
- t46 = clsx("block overflow-visible outline-none", t45);
769
- $[58] = t45;
770
- $[59] = t46;
872
+ const t52 = pressable && "cursor-pointer";
873
+ let t53;
874
+ if ($[99] !== t52) {
875
+ t53 = clsx("block overflow-visible outline-none", t52);
876
+ $[99] = t52;
877
+ $[100] = t53;
771
878
  } else {
772
- t46 = $[59];
879
+ t53 = $[100];
773
880
  }
774
- let t47;
775
- if ($[60] === Symbol.for("react.memo_cache_sentinel")) {
776
- t47 = /*#__PURE__*/_jsx("g", {
881
+ let t54;
882
+ if ($[101] === Symbol.for("react.memo_cache_sentinel")) {
883
+ t54 = /*#__PURE__*/_jsx("g", {
777
884
  ref: setRulesSlot,
778
885
  tabIndex: -1
779
886
  });
780
- $[60] = t47;
887
+ $[101] = t54;
781
888
  } else {
782
- t47 = $[60];
889
+ t54 = $[101];
783
890
  }
784
- let t48;
785
- if ($[61] !== measureGroups) {
786
- t48 = node => {
891
+ let t55;
892
+ if ($[102] !== measureGroups) {
893
+ t55 = node => {
787
894
  setGroupsSlot(node);
788
895
  measureGroups(node);
789
896
  };
790
- $[61] = measureGroups;
791
- $[62] = t48;
897
+ $[102] = measureGroups;
898
+ $[103] = t55;
792
899
  } else {
793
- t48 = $[62];
900
+ t55 = $[103];
794
901
  }
795
- let t49;
796
- if ($[63] !== width) {
797
- t49 = {
902
+ let t56;
903
+ if ($[104] !== width) {
904
+ t56 = {
798
905
  width
799
906
  };
800
- $[63] = width;
801
- $[64] = t49;
907
+ $[104] = width;
908
+ $[105] = t56;
802
909
  } else {
803
- t49 = $[64];
910
+ t56 = $[105];
804
911
  }
805
- let t50;
806
- if ($[65] !== t48 || $[66] !== t49) {
807
- t50 = /*#__PURE__*/_jsx("div", {
808
- ref: t48,
912
+ let t57;
913
+ if ($[106] !== t55 || $[107] !== t56) {
914
+ t57 = /*#__PURE__*/_jsx("div", {
915
+ ref: t55,
809
916
  className: "empty:hidden",
810
- style: t49
917
+ style: t56
811
918
  });
812
- $[65] = t48;
813
- $[66] = t49;
814
- $[67] = t50;
919
+ $[106] = t55;
920
+ $[107] = t56;
921
+ $[108] = t57;
815
922
  } else {
816
- t50 = $[67];
923
+ t57 = $[108];
817
924
  }
818
- let t51;
819
- if ($[68] === Symbol.for("react.memo_cache_sentinel")) {
820
- t51 = /*#__PURE__*/_jsx("g", {
925
+ let t58;
926
+ if ($[109] === Symbol.for("react.memo_cache_sentinel")) {
927
+ t58 = /*#__PURE__*/_jsx("g", {
821
928
  ref: setRightSlot,
822
929
  tabIndex: -1
823
930
  });
824
- $[68] = t51;
931
+ $[109] = t58;
825
932
  } else {
826
- t51 = $[68];
933
+ t58 = $[109];
827
934
  }
828
- let t52;
829
- if ($[69] === Symbol.for("react.memo_cache_sentinel")) {
830
- t52 = /*#__PURE__*/_jsx("div", {
935
+ let t59;
936
+ if ($[110] === Symbol.for("react.memo_cache_sentinel")) {
937
+ t59 = /*#__PURE__*/_jsx("div", {
831
938
  ref: setTooltipSlot,
832
939
  className: "pointer-events-none absolute inset-0"
833
940
  });
834
- $[69] = t52;
941
+ $[110] = t59;
835
942
  } else {
836
- t52 = $[69];
943
+ t59 = $[110];
837
944
  }
838
- let t53;
839
- if ($[70] === Symbol.for("react.memo_cache_sentinel")) {
840
- t53 = /*#__PURE__*/_jsx("div", {
945
+ let t60;
946
+ if ($[111] === Symbol.for("react.memo_cache_sentinel")) {
947
+ t60 = /*#__PURE__*/_jsx("div", {
841
948
  ref: setTableSlot,
842
949
  className: "empty:hidden"
843
950
  });
844
- $[70] = t53;
951
+ $[111] = t60;
845
952
  } else {
846
- t53 = $[70];
953
+ t60 = $[111];
847
954
  }
848
955
  return /*#__PURE__*/_jsx(ChartContext, {
849
956
  value: context,
850
957
  children: /*#__PURE__*/_jsxs("div", {
851
958
  ref: ref,
852
- className: t33,
853
- children: [t34, /*#__PURE__*/_jsxs("div", {
959
+ className: t40,
960
+ children: [t41, /*#__PURE__*/_jsxs("div", {
854
961
  ref: measure,
855
- className: t37,
856
- style: t38,
962
+ className: t44,
963
+ style: t45,
857
964
  ...(horizontal ? pointer : {}),
858
965
  children: [horizontal ? /*#__PURE__*/_jsx("div", {
859
966
  ref: setRowsSlot,
@@ -874,19 +981,19 @@ export function ChartRoot(t0) {
874
981
  })
875
982
  }), /*#__PURE__*/_jsxs("div", {
876
983
  ref: scroller,
877
- className: t40,
878
- style: t41,
879
- onScroll: t42,
984
+ className: t47,
985
+ style: t48,
986
+ onScroll: t49,
880
987
  children: [/*#__PURE__*/_jsxs("svg", {
881
988
  width: width,
882
- height: t43,
989
+ height: t50,
883
990
  role: interactive ? "group" : "img",
884
991
  tabIndex: interactive ? 0 : undefined,
885
- "aria-roledescription": t44,
992
+ "aria-roledescription": t51,
886
993
  "aria-label": label,
887
994
  "aria-describedby": interactive ? `${id}-hint` : undefined,
888
995
  "aria-activedescendant": pressable && from_0 >= 0 ? `${id}-${from_0}` : undefined,
889
- className: t46,
996
+ className: t53,
890
997
  ...(horizontal ? {} : pointer),
891
998
  onKeyDown: interactive ? onKeyDown : undefined,
892
999
  onBlur: () => {
@@ -899,7 +1006,7 @@ export function ChartRoot(t0) {
899
1006
  children: [layout !== null && highlighted.map(index_28 => /*#__PURE__*/_jsx("rect", {
900
1007
  ...bucketBox(index_28, false),
901
1008
  className: "fill-surface-hover"
902
- }, index_28)), children, t47, continuous !== null && !points && activeIndex >= 0 && cursor !== "none" && /*#__PURE__*/_jsx(Crosshair, {
1009
+ }, index_28)), children, t54, continuous !== null && !points && activeIndex >= 0 && cursor !== "none" && /*#__PURE__*/_jsx(Crosshair, {
903
1010
  context: context,
904
1011
  dots: cursor === "full"
905
1012
  }), points && /*#__PURE__*/_jsx(Guides, {
@@ -913,14 +1020,14 @@ export function ChartRoot(t0) {
913
1020
  cy: position[1],
914
1021
  r: 10,
915
1022
  fill: "transparent"
916
- }, keys[index_29])), pressable && layout !== null && xs.map((key_1, index_30) => /*#__PURE__*/_jsx("rect", {
1023
+ }, keys_0[index_29])), pressable && layout !== null && xs_0.map((key_1, index_30) => /*#__PURE__*/_jsx("rect", {
917
1024
  id: `${id}-${index_30}`,
918
1025
  role: "button",
919
1026
  "aria-pressed": selectedRows[index_30],
920
1027
  "aria-label": describe(index_30),
921
1028
  ...bucketBox(index_30, true),
922
1029
  fill: "transparent"
923
- }, String(key_1))), xs.length === 0 && /*#__PURE__*/_jsx("text", {
1030
+ }, String(key_1))), xs_0.length === 0 && /*#__PURE__*/_jsx("text", {
924
1031
  x: Math.round((plot.left + plot.right) / 2),
925
1032
  y: Math.round((plot.top + plot.bottom) / 2),
926
1033
  dy: "0.32em",
@@ -928,15 +1035,15 @@ export function ChartRoot(t0) {
928
1035
  className: "fill-text-faint text-xs",
929
1036
  children: t("noData")
930
1037
  })]
931
- }), t50]
1038
+ }), t57]
932
1039
  }), /*#__PURE__*/_jsx("svg", {
933
1040
  width: rightAxis,
934
1041
  height: height,
935
1042
  "aria-hidden": true,
936
1043
  className: "shrink-0 overflow-visible",
937
- children: t51
938
- }), t52]
939
- }), t53, interactive && /*#__PURE__*/_jsxs(_Fragment, {
1044
+ children: t58
1045
+ }), t59]
1046
+ }), t60, interactive && /*#__PURE__*/_jsxs(_Fragment, {
940
1047
  children: [/*#__PURE__*/_jsx("p", {
941
1048
  id: `${id}-hint`,
942
1049
  className: "sr-only",