@box-kite/react 2.2.7 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/BOX_AI_CONTEXT.md +76 -0
  2. package/BOX_KITE_AI_CONTEXT.md +76 -0
  3. package/analytics.cjs +1 -0
  4. package/analytics.d.ts +10 -0
  5. package/analytics.mjs +121 -0
  6. package/behavior.cjs +1 -1
  7. package/behavior.mjs +42 -38
  8. package/box.cjs +1 -1
  9. package/box.d.ts +9 -0
  10. package/box.mjs +17 -16
  11. package/catalog.cjs +1 -1
  12. package/catalog.mjs +8 -0
  13. package/client.cjs +1 -1
  14. package/client.mjs +120 -120
  15. package/components/accordion.cjs +1 -1
  16. package/components/accordion.mjs +19 -10
  17. package/components/agent.cjs +1 -1
  18. package/components/agent.mjs +21 -8
  19. package/components/calendar.cjs +1 -1
  20. package/components/calendar.d.ts +3 -1
  21. package/components/calendar.mjs +154 -142
  22. package/components/combobox.cjs +1 -1
  23. package/components/combobox.mjs +184 -174
  24. package/components/dashboard.cjs +1 -1
  25. package/components/dashboard.mjs +183 -170
  26. package/components/dataGrid/models/columnModel.d.ts +1 -0
  27. package/components/dataGrid/models/gridModel.d.ts +18 -0
  28. package/components/dataGrid/models/rangeModel.d.ts +3 -0
  29. package/components/dataGrid.cjs +3 -3
  30. package/components/dataGrid.mjs +987 -896
  31. package/components/dateField.cjs +1 -1
  32. package/components/dateField.mjs +160 -149
  33. package/components/datePicker.cjs +1 -1
  34. package/components/datePicker.mjs +226 -206
  35. package/components/dialog.cjs +1 -1
  36. package/components/dialog.mjs +38 -33
  37. package/components/dropdown.cjs +1 -1
  38. package/components/dropdown.mjs +107 -93
  39. package/components/form.cjs +1 -1
  40. package/components/form.mjs +22 -18
  41. package/components/menu.cjs +1 -1
  42. package/components/menu.d.ts +2 -0
  43. package/components/menu.mjs +196 -175
  44. package/components/overlay.cjs +1 -1
  45. package/components/overlay.mjs +7 -7
  46. package/components/popover.cjs +1 -1
  47. package/components/popover.mjs +4 -0
  48. package/components/radioGroup.cjs +1 -1
  49. package/components/radioGroup.mjs +10 -5
  50. package/components/slider.cjs +1 -1
  51. package/components/slider.mjs +84 -83
  52. package/components/sortableList.cjs +1 -1
  53. package/components/sortableList.mjs +158 -150
  54. package/components/swipeItem.cjs +1 -1
  55. package/components/swipeItem.mjs +92 -84
  56. package/components/tabs.cjs +1 -1
  57. package/components/tabs.mjs +10 -5
  58. package/components/timeZoneSelect.cjs +1 -1
  59. package/components/timeZoneSelect.mjs +40 -35
  60. package/components/toaster.cjs +1 -1
  61. package/components/toaster.mjs +151 -113
  62. package/dataGridDateParts.cjs +1 -1
  63. package/dataGridDateParts.mjs +56 -55
  64. package/dataGridList.cjs +1 -1
  65. package/dataGridList.mjs +430 -429
  66. package/effects.cjs +1 -1
  67. package/effects.mjs +1 -1
  68. package/interactionListening.cjs +1 -0
  69. package/interactionListening.mjs +117 -0
  70. package/interactions.cjs +1 -0
  71. package/interactions.mjs +25 -0
  72. package/layer.cjs +1 -1
  73. package/layer.mjs +68 -66
  74. package/package.json +132 -68
  75. package/placement.cjs +1 -1
  76. package/placement.mjs +10 -10
  77. package/platform.cjs +1 -1
  78. package/platform.mjs +44 -25
  79. package/react/interactions/interactions.d.ts +30 -0
  80. package/react/popover/usePopoverLayer.d.ts +3 -0
  81. package/react/useStyles.d.ts +8 -1
  82. package/react-shared.cjs +1 -1
  83. package/react-shared.mjs +49 -48
  84. package/reporting.cjs +1 -0
  85. package/reporting.mjs +51 -0
  86. package/scrolling.cjs +1 -1
  87. package/scrolling.mjs +1 -1
  88. package/supabase/functions/collect/index.d.ts +30 -0
  89. package/supabase/functions/collect/index.test.d.ts +1 -0
  90. package/utils/analytics/analytics.d.ts +72 -0
  91. package/utils/analytics/analyticsIdentity.d.ts +13 -0
  92. package/utils/interactions/componentAttribute.d.ts +6 -0
  93. package/utils/interactions/interactionChannel.d.ts +35 -0
  94. package/utils/interactions/interactionJson.d.ts +6 -0
  95. package/utils/interactions/interactionListening.d.ts +6 -0
  96. package/utils/interactions/interactionTypes.d.ts +224 -0
@@ -1,14 +1,15 @@
1
1
  "use client";
2
- import { d as e } from "../platform.mjs";
2
+ import { p as e } from "../platform.mjs";
3
3
  import t from "../box.mjs";
4
4
  import { a as n, i as r, o as i } from "../behavior.mjs";
5
5
  import { t as a } from "../dashboardSchema.mjs";
6
- import { Circle as o, Path as s, Svg as c } from "./svg.mjs";
7
- import l from "./visuallyHidden.mjs";
8
- import { createContext as u, useContext as d, useId as f, useMemo as p, useRef as m, useState as h } from "react";
9
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
6
+ import { i as o, r as s } from "../reporting.mjs";
7
+ import { Circle as c, Path as l, Svg as u } from "./svg.mjs";
8
+ import d from "./visuallyHidden.mjs";
9
+ import { createContext as f, useContext as p, useId as m, useMemo as h, useRef as g, useState as _ } from "react";
10
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
10
11
  //#region src/utils/dashboard/dashboardUtils.ts
11
- var v;
12
+ var b;
12
13
  (function(e) {
13
14
  let t = e.VERSION = 1, n = e.MIN_COLUMNS = 1, r = e.MAX_COLUMNS = 24;
14
15
  function i(e, t, n) {
@@ -271,34 +272,34 @@ var v;
271
272
  };
272
273
  }
273
274
  e.parse = E, e.SCHEMA = a;
274
- })(v ||= {});
275
- var y = v, b = [
275
+ })(b ||= {});
276
+ var x = b, S = [
276
277
  "xs",
277
278
  "sm",
278
279
  "md",
279
280
  "lg",
280
281
  "xl",
281
282
  "xxl"
282
- ], x = [
283
+ ], C = [
283
284
  "h1",
284
285
  "h2",
285
286
  "h3",
286
287
  "h4",
287
288
  "h5",
288
289
  "h6"
289
- ], S = u(null);
290
- function C(e, t, n) {
290
+ ], w = f(null);
291
+ function T(e, t, n) {
291
292
  return Math.min(Math.max(e, t), n);
292
293
  }
293
- function w(e) {
294
- if (typeof e == "number") return [{ count: C(Math.round(e), y.MIN_COLUMNS, y.MAX_COLUMNS) }];
295
- let t = b.filter((t) => typeof e[t] == "number").map((t) => ({
294
+ function E(e) {
295
+ if (typeof e == "number") return [{ count: T(Math.round(e), x.MIN_COLUMNS, x.MAX_COLUMNS) }];
296
+ let t = S.filter((t) => typeof e[t] == "number").map((t) => ({
296
297
  size: t,
297
- count: C(Math.round(e[t]), y.MIN_COLUMNS, y.MAX_COLUMNS)
298
+ count: T(Math.round(e[t]), x.MIN_COLUMNS, x.MAX_COLUMNS)
298
299
  }));
299
300
  return t.length > 0 ? t : [{ count: 12 }];
300
301
  }
301
- function T(e) {
302
+ function D(e) {
302
303
  return {
303
304
  gridColumnStart: e.x + 1,
304
305
  gridColumnEnd: e.x + 1 + e.w,
@@ -306,10 +307,10 @@ function T(e) {
306
307
  gridRowEnd: e.y + 1 + e.h
307
308
  };
308
309
  }
309
- function E(e) {
310
+ function O(e) {
310
311
  return `max${e[0].toUpperCase()}${e.slice(1)}`;
311
312
  }
312
- function D(e, t) {
313
+ function ee(e, t) {
313
314
  let n = t ? -1 : 1;
314
315
  if (e === "ArrowLeft") return {
315
316
  x: -n,
@@ -328,39 +329,39 @@ function D(e, t) {
328
329
  y: 1
329
330
  };
330
331
  }
331
- function O(e) {
332
+ function k(e) {
332
333
  return `column ${e.x + 1}, row ${e.y + 1}`;
333
334
  }
334
- function k(e) {
335
+ function A(e) {
335
336
  return `${e.w} ${e.w === 1 ? "column" : "columns"} by ${e.h} ${e.h === 1 ? "row" : "rows"}`;
336
337
  }
337
- function A(a) {
338
- let { children: o, layout: s, defaultLayout: c, onLayoutChange: u, onLayoutCommit: d, columns: v = {
338
+ function j(a) {
339
+ let { children: c, layout: l, defaultLayout: u, onLayoutChange: f, onLayoutCommit: p, columns: b = {
339
340
  xs: 1,
340
341
  md: 6,
341
342
  xxl: 12
342
- }, rowHeight: x = 24, editable: C = !1, label: A, labelledBy: j, props: M, ...N } = a, P = m(null), [F, I] = h(null), [L, R] = h(null), [ee, z] = h(""), B = `${f()}-dashboard`, [V, te] = r({
343
- value: s,
344
- defaultValue: c ?? {
345
- version: y.VERSION,
343
+ }, rowHeight: C = 24, editable: T = !1, label: j, labelledBy: M, props: N, ...P } = a, F = g(null), [I, L] = _(null), [R, z] = _(null), [te, B] = _(""), V = `${m()}-dashboard`, [H, ne] = r({
344
+ value: l,
345
+ defaultValue: u ?? {
346
+ version: x.VERSION,
346
347
  columns: 12,
347
348
  items: []
348
349
  },
349
- onChange: u
350
- }), H = p(() => y.normalize(V), [V]), U = i(H), W = n(d), ne = typeof v == "number" ? String(v) : b.map((e) => v[e] ?? "").join(), G = p(() => w(v), [ne]), K = G[G.length - 1], q = p(() => {
351
- let e = y.ranks(H), t = /* @__PURE__ */ new Map();
352
- for (let n of G) {
353
- let r = n.count === K.count ? H : y.project(H, n.count), i = K.count / n.count;
350
+ onChange: f
351
+ }), U = h(() => x.normalize(H), [H]), W = i(U), G = s(p, "dashboard", "layoutCommit"), re = typeof b == "number" ? String(b) : S.map((e) => b[e] ?? "").join(), K = h(() => E(b), [re]), q = K[K.length - 1], J = h(() => {
352
+ let e = x.ranks(U), t = /* @__PURE__ */ new Map();
353
+ for (let n of K) {
354
+ let r = n.count === q.count ? U : x.project(U, n.count), i = q.count / n.count;
354
355
  for (let a of r.items) {
355
356
  let r = t.get(a.id) ?? {
356
357
  order: e.get(a.id) ?? 0,
357
358
  fixed: a.fixed === !0
358
- }, o = T({
359
+ }, o = D({
359
360
  ...a,
360
361
  x: Math.round(a.x * i),
361
362
  w: Math.round((a.x + a.w) * i) - Math.round(a.x * i)
362
363
  });
363
- n === G[0] ? r.placement = o : r.query = {
364
+ n === K[0] ? r.placement = o : r.query = {
364
365
  ...r.query,
365
366
  [n.size]: o
366
367
  }, t.set(a.id, r);
@@ -368,145 +369,151 @@ function A(a) {
368
369
  }
369
370
  return t;
370
371
  }, [
371
- H,
372
- G,
373
- K.count
374
- ]), J = n((e, t) => {
375
- y.same(e, U.current) || te(e, t);
376
- }), re = (e, t) => {
377
- let n = e.getBoundingClientRect(), r = P.current, i = r && typeof getComputedStyle == "function" ? getComputedStyle(r) : void 0, a = Number.parseFloat(i?.columnGap ?? "") || 0, o = Number.parseFloat(i?.rowGap ?? "") || 0;
372
+ U,
373
+ K,
374
+ q.count
375
+ ]), Y = n((e, t) => {
376
+ x.same(e, W.current) || ne(e, t);
377
+ }), ie = (e, t) => {
378
+ let n = e.getBoundingClientRect(), r = F.current, i = r && typeof getComputedStyle == "function" ? getComputedStyle(r) : void 0, a = Number.parseFloat(i?.columnGap ?? "") || 0, o = Number.parseFloat(i?.rowGap ?? "") || 0;
378
379
  return {
379
380
  x: (n.width + a) / t.w,
380
381
  y: (n.height + o) / t.h
381
382
  };
382
- }, ie = (e) => e instanceof Element ? e.closest("[data-widget-id]") : null, Y = (e, t, n, r) => {
383
- let i = e.kind === "move" ? y.moveTo(U.current, e.id, t, n) : y.resizeTo(U.current, e.id, t, n);
384
- return J(i, {
383
+ }, ae = (e) => e instanceof Element ? e.closest("[data-widget-id]") : null, X = (e, t, n, r) => {
384
+ let i = e.kind === "move" ? x.moveTo(W.current, e.id, t, n) : x.resizeTo(W.current, e.id, t, n);
385
+ return Y(i, {
385
386
  reason: e.kind,
386
387
  event: r
387
388
  }), i;
388
- }, X = n((t, n, r, i) => {
389
- let a = y.itemOf(U.current, n), o = ie(t.currentTarget);
390
- !C || t.button !== 0 || t.defaultPrevented || !a || a.fixed || !o || (t.preventDefault(), t.currentTarget.setPointerCapture?.(t.pointerId), t.currentTarget.focus(), I({
389
+ }, Z = n((t, n, r, i) => {
390
+ let a = x.itemOf(W.current, n), o = ae(t.currentTarget);
391
+ !T || t.button !== 0 || t.defaultPrevented || !a || a.fixed || !o || (t.preventDefault(), t.currentTarget.setPointerCapture?.(t.pointerId), t.currentTarget.focus(), L({
391
392
  id: n,
392
393
  kind: i,
393
394
  name: r,
394
395
  origin: a,
395
- before: U.current,
396
+ before: W.current,
396
397
  pointer: {
397
398
  id: t.pointerId,
398
399
  x: t.clientX,
399
400
  y: t.clientY,
400
- step: re(o, a),
401
+ step: ie(o, a),
401
402
  rtl: e(o)
402
403
  }
403
404
  }));
404
- }), Z = n((e, t) => {
405
- if (!F?.pointer || F.id !== t) return;
406
- let { x: n, y: r, step: i, rtl: a } = F.pointer, o = {
405
+ }), oe = n((e, t) => {
406
+ if (!I?.pointer || I.id !== t) return;
407
+ let { x: n, y: r, step: i, rtl: a } = I.pointer, o = {
407
408
  x: e.clientX - n,
408
409
  y: e.clientY - r
409
- }, s = y.cellsMoved(a ? -o.x : o.x, o.y, i), c = F.origin, l = F.kind === "move" ? Y(F, c.x + s.columns, c.y + s.rows, e) : Y(F, c.w + s.columns, c.h + s.rows, e), u = y.itemOf(l, t);
410
- if (F.kind !== "move" || !u) return;
410
+ }, s = x.cellsMoved(a ? -o.x : o.x, o.y, i), c = I.origin, l = I.kind === "move" ? X(I, c.x + s.columns, c.y + s.rows, e) : X(I, c.w + s.columns, c.h + s.rows, e), u = x.itemOf(l, t);
411
+ if (I.kind !== "move" || !u) return;
411
412
  let d = {
412
413
  x: (u.x - c.x) * i.x * (a ? -1 : 1),
413
414
  y: (u.y - c.y) * i.y
414
415
  };
415
- R({ translate: `${Math.round(o.x - d.x)}px ${Math.round(o.y - d.y)}px` });
416
+ z({ translate: `${Math.round(o.x - d.x)}px ${Math.round(o.y - d.y)}px` });
416
417
  }), Q = n((e, t) => {
417
- if (!F?.pointer || F.id !== t) return;
418
- let n = y.itemOf(U.current, t);
419
- e.currentTarget.releasePointerCapture?.(F.pointer.id), I(null), R(null), W(U.current, {
420
- reason: F.kind,
418
+ if (!I?.pointer || I.id !== t) return;
419
+ let n = x.itemOf(W.current, t);
420
+ e.currentTarget.releasePointerCapture?.(I.pointer.id), L(null), z(null), G(W.current, {
421
+ reason: I.kind,
421
422
  event: e
422
- }), n && z(F.kind === "move" ? `${F.name} moved to ${O(n)}.` : `${F.name} resized to ${k(n)}.`);
423
- }), ae = n((e, t) => {
424
- J(e.before, {
423
+ }), n && B(I.kind === "move" ? `${I.name} moved to ${k(n)}.` : `${I.name} resized to ${A(n)}.`);
424
+ }), se = o("dashboard"), ce = n((e, t) => {
425
+ se("grabCancel", e.id, {
426
+ reason: t.type === "blur" ? "blur" : "escape",
427
+ event: t
428
+ }), Y(e.before, {
425
429
  reason: e.kind,
426
430
  event: t
427
- }), I(null), z(`${e.name} put back at ${O(e.origin)}.`);
428
- }), oe = n((t, n, r, i) => {
429
- if (!C || t.defaultPrevented) return;
430
- let a = F && F.id === n && F.kind === i && !F.pointer ? F : void 0, o = y.itemOf(U.current, n);
431
+ }), L(null), B(`${e.name} put back at ${k(e.origin)}.`);
432
+ }), le = n((t, n, r, i) => {
433
+ if (!T || t.defaultPrevented) return;
434
+ let a = I && I.id === n && I.kind === i && !I.pointer ? I : void 0, o = x.itemOf(W.current, n);
431
435
  if (!o) return;
432
436
  if (!a) {
433
437
  if (t.key !== "Enter" && t.key !== " " || o.fixed) return;
434
- t.preventDefault(), I({
438
+ t.preventDefault(), L({
435
439
  id: n,
436
440
  kind: i,
437
441
  name: r,
438
442
  origin: o,
439
- before: U.current
440
- }), z(i === "move" ? `${r} picked up at ${O(o)}. Use the arrow keys to move it.` : `${r} held for resizing at ${k(o)}. Use the arrow keys to resize it.`);
443
+ before: W.current
444
+ }), se("grab", n, {
445
+ reason: i,
446
+ event: t
447
+ }), B(i === "move" ? `${r} picked up at ${k(o)}. Use the arrow keys to move it.` : `${r} held for resizing at ${A(o)}. Use the arrow keys to resize it.`);
441
448
  return;
442
449
  }
443
450
  if (t.key === "Escape") {
444
- t.preventDefault(), ae(a, t);
451
+ t.preventDefault(), ce(a, t);
445
452
  return;
446
453
  }
447
454
  if (t.key === "Enter" || t.key === " ") {
448
- t.preventDefault(), I(null), W(U.current, {
455
+ t.preventDefault(), L(null), G(W.current, {
449
456
  reason: i,
450
457
  event: t
451
- }), z(i === "move" ? `${r} dropped at ${O(o)}.` : `${r} resized to ${k(o)}.`);
458
+ }), B(i === "move" ? `${r} dropped at ${k(o)}.` : `${r} resized to ${A(o)}.`);
452
459
  return;
453
460
  }
454
- let s = D(t.key, e(t.currentTarget));
461
+ let s = ee(t.key, e(t.currentTarget));
455
462
  if (!s) return;
456
463
  t.preventDefault();
457
- let c = i === "move" ? Y(a, o.x + s.x, o.y + s.y, t) : Y(a, o.w + s.x, o.h + s.y, t), l = y.itemOf(c, n);
458
- l && z(i === "move" ? `${r}, ${O(l)}.` : `${r}, ${k(l)}.`);
459
- }), se = n((e, t, n) => {
460
- F && F.id === t && F.kind === n && !F.pointer && ae(F, e);
461
- }), ce = p(() => ({
462
- editable: C,
463
- placementOf: (e) => q.get(e),
464
- heldOf: (e) => F && F.id === e ? F : void 0,
465
- offsetOf: (e) => F && F.id === e && L ? L : void 0,
466
- outsideAuthoring: K.size ? { [E(K.size)]: { display: "none" } } : void 0,
467
- instructionsId: B,
464
+ let c = i === "move" ? X(a, o.x + s.x, o.y + s.y, t) : X(a, o.w + s.x, o.h + s.y, t), l = x.itemOf(c, n);
465
+ l && B(i === "move" ? `${r}, ${k(l)}.` : `${r}, ${A(l)}.`);
466
+ }), ue = n((e, t, n) => {
467
+ I && I.id === t && I.kind === n && !I.pointer && ce(I, e);
468
+ }), de = h(() => ({
469
+ editable: T,
470
+ placementOf: (e) => J.get(e),
471
+ heldOf: (e) => I && I.id === e ? I : void 0,
472
+ offsetOf: (e) => I && I.id === e && R ? R : void 0,
473
+ outsideAuthoring: q.size ? { [O(q.size)]: { display: "none" } } : void 0,
474
+ instructionsId: V,
468
475
  handleProps: (e, t, n) => ({
469
476
  type: "button",
470
477
  "aria-label": n === "move" ? `Move ${t}` : `Resize ${t}`,
471
- "aria-pressed": !!(F && F.id === e && F.kind === n),
472
- "aria-describedby": B,
473
- onPointerDown: (r) => X(r, e, t, n),
474
- onPointerMove: (t) => Z(t, e),
478
+ "aria-pressed": !!(I && I.id === e && I.kind === n),
479
+ "aria-describedby": V,
480
+ onPointerDown: (r) => Z(r, e, t, n),
481
+ onPointerMove: (t) => oe(t, e),
475
482
  onPointerUp: (t) => Q(t, e),
476
483
  onPointerCancel: (t) => Q(t, e),
477
- onKeyDown: (r) => oe(r, e, t, n),
478
- onBlur: (t) => se(t, e, n)
484
+ onKeyDown: (r) => le(r, e, t, n),
485
+ onBlur: (t) => ue(t, e, n)
479
486
  })
480
487
  }), [
481
- C,
482
- q,
483
- F,
484
- L,
485
- K.size,
486
- B,
487
- X,
488
+ T,
489
+ J,
490
+ I,
491
+ R,
492
+ q.size,
493
+ V,
488
494
  Z,
489
- Q,
490
495
  oe,
491
- se
492
- ]), $ = F ? q.get(F.id) : void 0;
493
- return /* @__PURE__ */ _(S.Provider, {
494
- value: ce,
496
+ Q,
497
+ le,
498
+ ue
499
+ ]), $ = I ? J.get(I.id) : void 0;
500
+ return /* @__PURE__ */ y(w.Provider, {
501
+ value: de,
495
502
  children: [
496
- /* @__PURE__ */ _(t, {
497
- ref: P,
503
+ /* @__PURE__ */ y(t, {
504
+ ref: F,
498
505
  component: "dashboard",
499
- ...N,
500
- variant: [N.variant, { dragging: F !== null }],
501
- vars: { "dashboard-row": `${x / 4}rem` },
502
- gridTemplateColumns: K.count,
506
+ ...P,
507
+ variant: [P.variant, { dragging: I !== null }],
508
+ vars: { "dashboard-row": `${C / 4}rem` },
509
+ gridTemplateColumns: q.count,
503
510
  props: {
504
511
  role: "list",
505
- "aria-label": A,
506
- "aria-labelledby": j,
507
- ...M
512
+ "aria-label": j,
513
+ "aria-labelledby": M,
514
+ ...N
508
515
  },
509
- children: [o, $ && /* @__PURE__ */ g(t, {
516
+ children: [c, $ && /* @__PURE__ */ v(t, {
510
517
  component: "dashboard.placeholder",
511
518
  order: $.order,
512
519
  cq: $.query,
@@ -517,31 +524,31 @@ function A(a) {
517
524
  }
518
525
  })]
519
526
  }),
520
- /* @__PURE__ */ g(l, {
527
+ /* @__PURE__ */ v(d, {
521
528
  props: { role: "status" },
522
- children: ee
529
+ children: te
523
530
  }),
524
- /* @__PURE__ */ g(l, {
525
- id: B,
531
+ /* @__PURE__ */ v(d, {
532
+ id: V,
526
533
  children: "Press Enter or Space to pick the widget up, the arrow keys to move or resize it, Enter to drop it and Escape to put it back."
527
534
  })
528
535
  ]
529
536
  });
530
537
  }
531
- function j({ kind: e }) {
532
- return e === "resize" ? /* @__PURE__ */ g(c, {
538
+ function M({ kind: e }) {
539
+ return e === "resize" ? /* @__PURE__ */ v(u, {
533
540
  viewBox: "0 0 24 24",
534
541
  width: "1rem",
535
542
  height: "1rem",
536
543
  rtl: { flip: "xAxis" },
537
544
  props: { fill: "none" },
538
- children: /* @__PURE__ */ g(s, {
545
+ children: /* @__PURE__ */ v(l, {
539
546
  d: "M20 10 10 20M20 16l-4 4",
540
547
  stroke: "currentColor",
541
548
  strokeWidth: 2,
542
549
  strokeLinecap: "round"
543
550
  })
544
- }) : /* @__PURE__ */ _(c, {
551
+ }) : /* @__PURE__ */ y(u, {
545
552
  viewBox: "0 0 24 24",
546
553
  width: "1rem",
547
554
  height: "1rem",
@@ -549,7 +556,7 @@ function j({ kind: e }) {
549
556
  8,
550
557
  12,
551
558
  16
552
- ].map((e) => /* @__PURE__ */ g(o, {
559
+ ].map((e) => /* @__PURE__ */ v(c, {
553
560
  cx: 9,
554
561
  cy: e,
555
562
  r: 1.4,
@@ -558,7 +565,7 @@ function j({ kind: e }) {
558
565
  8,
559
566
  12,
560
567
  16
561
- ].map((e) => /* @__PURE__ */ g(o, {
568
+ ].map((e) => /* @__PURE__ */ v(c, {
562
569
  cx: 15,
563
570
  cy: e,
564
571
  r: 1.4,
@@ -566,13 +573,13 @@ function j({ kind: e }) {
566
573
  }, e))]
567
574
  });
568
575
  }
569
- function M() {
570
- return /* @__PURE__ */ g(c, {
576
+ function N() {
577
+ return /* @__PURE__ */ v(u, {
571
578
  viewBox: "0 0 24 24",
572
579
  width: "1rem",
573
580
  height: "1rem",
574
581
  props: { fill: "none" },
575
- children: /* @__PURE__ */ g(s, {
582
+ children: /* @__PURE__ */ v(l, {
576
583
  d: "M20 12a8 8 0 1 1-2.6-5.9M20 4v4h-4",
577
584
  stroke: "currentColor",
578
585
  strokeWidth: 2,
@@ -581,110 +588,116 @@ function M() {
581
588
  })
582
589
  });
583
590
  }
584
- function N(e) {
585
- let { id: n, children: r, title: i, name: a, description: o, actions: s, level: c = 3, loading: l = !1, error: u, empty: f, onRefresh: p, refreshLabel: m, props: h, ...v } = e, y = d(S), b = n === void 0 ? void 0 : y?.placementOf(n), C = n === void 0 ? void 0 : y?.heldOf(n), w = a ?? (typeof i == "string" ? i : void 0) ?? n ?? "Widget", T = y?.editable === !0 && b !== void 0 && !b.fixed, E = (e) => T && n !== void 0 ? /* @__PURE__ */ g(t, {
591
+ function P(e) {
592
+ let { id: n, children: r, title: i, name: a, description: o, actions: c, level: l = 3, loading: u = !1, error: d, empty: f, onRefresh: m, refreshLabel: h, props: g, ..._ } = e, b = p(w), x = n === void 0 ? void 0 : b?.placementOf(n), S = n === void 0 ? void 0 : b?.heldOf(n), T = a ?? (typeof i == "string" ? i : void 0) ?? n ?? "Widget", E = b?.editable === !0 && x !== void 0 && !x.fixed, D = s((e, t) => m?.(), "widget", "refresh"), O = (e) => E && n !== void 0 ? /* @__PURE__ */ v(t, {
586
593
  component: "widget.handle",
587
594
  tag: "button",
588
595
  variant: {
589
596
  editable: !0,
590
- grabbed: C?.kind === e,
597
+ grabbed: S?.kind === e,
591
598
  corner: e === "resize"
592
599
  },
593
- cq: y?.outsideAuthoring,
594
- props: y?.handleProps(n, w, e),
595
- children: /* @__PURE__ */ g(j, { kind: e })
596
- }) : null, D = () => l ? /* @__PURE__ */ g(t, {
600
+ cq: b?.outsideAuthoring,
601
+ props: b?.handleProps(n, T, e),
602
+ children: /* @__PURE__ */ v(M, { kind: e })
603
+ }) : null, ee = () => u ? /* @__PURE__ */ v(t, {
597
604
  component: "widget.skeleton",
598
605
  props: { "aria-hidden": !0 },
599
606
  children: [
600
607
  80,
601
608
  100,
602
609
  60
603
- ].map((e) => /* @__PURE__ */ g(t, {
610
+ ].map((e) => /* @__PURE__ */ v(t, {
604
611
  component: "widget.skeleton.bar",
605
612
  width: `${e}%`
606
613
  }, e))
607
- }) : u ? /* @__PURE__ */ _(t, {
614
+ }) : d ? /* @__PURE__ */ y(t, {
608
615
  component: "widget.message",
609
616
  variant: { error: !0 },
610
617
  props: { role: "status" },
611
- children: [u, p && /* @__PURE__ */ g(t, {
618
+ children: [d, m && /* @__PURE__ */ v(t, {
612
619
  tag: "button",
613
620
  component: "widget.retry",
614
621
  props: {
615
622
  type: "button",
616
- onClick: p
623
+ onClick: (e) => D(n, {
624
+ reason: "retry",
625
+ event: e
626
+ })
617
627
  },
618
628
  children: "Try again"
619
629
  })]
620
- }) : f ? /* @__PURE__ */ g(t, {
630
+ }) : f ? /* @__PURE__ */ v(t, {
621
631
  component: "widget.message",
622
632
  children: f === !0 ? "Nothing to show yet." : f
623
- }) : r, O = i !== void 0 || o !== void 0 || s !== void 0 || p !== void 0 || T;
624
- return /* @__PURE__ */ _(t, {
633
+ }) : r, k = i !== void 0 || o !== void 0 || c !== void 0 || m !== void 0 || E;
634
+ return /* @__PURE__ */ y(t, {
625
635
  component: "widget",
626
- ...v,
627
- variant: [v.variant, {
628
- dragging: C?.pointer !== void 0,
629
- grabbed: C !== void 0 && C.pointer === void 0
636
+ ..._,
637
+ variant: [_.variant, {
638
+ dragging: S?.pointer !== void 0,
639
+ grabbed: S !== void 0 && S.pointer === void 0
630
640
  }],
631
- order: b?.order,
632
- cq: b?.query,
633
- ...b?.placement,
641
+ order: x?.order,
642
+ cq: x?.query,
643
+ ...x?.placement,
634
644
  style: {
635
- ...n === void 0 ? void 0 : y?.offsetOf(n),
636
- ...v.style
645
+ ...n === void 0 ? void 0 : b?.offsetOf(n),
646
+ ..._.style
637
647
  },
638
648
  props: {
639
- role: b ? "listitem" : void 0,
640
- "aria-busy": l || void 0,
649
+ role: x ? "listitem" : void 0,
650
+ "aria-busy": u || void 0,
641
651
  "data-widget-id": n,
642
- ...h
652
+ ...g
643
653
  },
644
654
  children: [
645
- O && /* @__PURE__ */ _(t, {
655
+ k && /* @__PURE__ */ y(t, {
646
656
  component: "widget.header",
647
657
  children: [
648
- E("move"),
649
- /* @__PURE__ */ _(t, {
658
+ O("move"),
659
+ /* @__PURE__ */ y(t, {
650
660
  component: "widget.label",
651
- children: [i !== void 0 && /* @__PURE__ */ g(t, {
661
+ children: [i !== void 0 && /* @__PURE__ */ v(t, {
652
662
  component: "widget.title",
653
- tag: x[c - 1],
663
+ tag: C[l - 1],
654
664
  children: i
655
- }), o !== void 0 && /* @__PURE__ */ g(t, {
665
+ }), o !== void 0 && /* @__PURE__ */ v(t, {
656
666
  component: "widget.description",
657
667
  children: o
658
668
  })]
659
669
  }),
660
- p && /* @__PURE__ */ g(t, {
670
+ m && /* @__PURE__ */ v(t, {
661
671
  component: "widget.handle",
662
672
  tag: "button",
663
673
  variant: { editable: !0 },
664
674
  props: {
665
675
  type: "button",
666
- "aria-label": m ?? `Refresh ${w}`,
667
- onClick: p
676
+ "aria-label": h ?? `Refresh ${T}`,
677
+ onClick: (e) => D(n, {
678
+ reason: "refresh",
679
+ event: e
680
+ })
668
681
  },
669
- children: /* @__PURE__ */ g(M, {})
682
+ children: /* @__PURE__ */ v(N, {})
670
683
  }),
671
- s !== void 0 && /* @__PURE__ */ g(t, {
684
+ c !== void 0 && /* @__PURE__ */ v(t, {
672
685
  component: "widget.actions",
673
- children: s
686
+ children: c
674
687
  })
675
688
  ]
676
689
  }),
677
- /* @__PURE__ */ g(t, {
690
+ /* @__PURE__ */ v(t, {
678
691
  component: "widget.body",
679
- children: D()
692
+ children: ee()
680
693
  }),
681
- E("resize")
694
+ O("resize")
682
695
  ]
683
696
  });
684
697
  }
685
- var P = A;
686
- P.displayName = "DashboardGrid";
687
- var F = N;
688
- F.displayName = "Widget";
698
+ var F = j;
699
+ F.displayName = "DashboardGrid";
700
+ var I = P;
701
+ I.displayName = "Widget";
689
702
  //#endregion
690
- export { y as DashboardUtils, F as Widget, P as default };
703
+ export { x as DashboardUtils, I as Widget, F as default };
@@ -157,6 +157,7 @@ export default class ColumnModel<TRow> {
157
157
  /** Resize to an exact total width — where Home and End on the separator land. Does not notify. */
158
158
  resizeWidthTo: (width: number) => void;
159
159
  pinColumn: (pin?: PinPositionInput) => void;
160
+ private setPin;
160
161
  toggleGrouping: () => void;
161
162
  sortColumn: (sortDirection?: SortDirection) => void;
162
163
  setWidth: (width: number) => void;
@@ -1,4 +1,5 @@
1
1
  import { ComponentsAndVariants } from '../../../types';
2
+ import { InteractionType } from '../../../utils/interactions/interactionChannel';
2
3
  import { ColumnFilters, DataGridCsvOptions, DataGridProps, DataGridXlsxOptions, ExportConfig, FilterValue, Key, PaginationState, PinPositionInput, SortDirection } from '../contracts/dataGridContract';
3
4
  import { default as AggregationModel } from './aggregationModel';
4
5
  import { default as ColumnModel } from './columnModel';
@@ -18,6 +19,10 @@ import { default as TreeModel } from './treeModel';
18
19
  import { default as ViewportModel } from './viewportModel';
19
20
  export { GROUPING_CELL_KEY, ROW_DETAIL_CELL_KEY, ROW_NUMBER_CELL_KEY, ROW_SELECTION_CELL_KEY } from './cellKeys';
20
21
  export declare const DEFAULT_ROW_NUMBER_COLUMN_WIDTH = 70;
22
+ /** A change the host hears through `on<Type>` and `Box.onInteraction` hears under the same type. */
23
+ type GridCallback = {
24
+ [K in keyof DataGridProps<unknown>]-?: K extends `on${infer T}` ? Uncapitalize<T> : never;
25
+ }[keyof DataGridProps<unknown>] & InteractionType<'datagrid'>;
21
26
  export default class GridModel<TRow> {
22
27
  props: DataGridProps<TRow>;
23
28
  constructor(props: DataGridProps<TRow>, onChange?: () => void);
@@ -118,6 +123,19 @@ export default class GridModel<TRow> {
118
123
  * Get filtered data (applies external, global, then column filters)
119
124
  */
120
125
  get filteredData(): TRow[];
126
+ /** What the grid tells `Box.onInteraction` about a change no host callback carries; `content` names what a person typed. */
127
+ reportInteraction(type: InteractionType<'datagrid'>, value: unknown, reason?: string, details?: Record<string, unknown>, content?: readonly string[]): void;
128
+ /**
129
+ * A host callback and its report in one call, so a callback cannot be added without the event `Box.onInteraction` hears.
130
+ * `report: false` is a change the person did not make: a reset that a sort or a filter caused, a value that stayed the same.
131
+ */
132
+ fire<T extends GridCallback>(type: T, value: Parameters<NonNullable<DataGridProps<TRow>[`on${Capitalize<T>}`]>>[0], reason: string, report?: false | {
133
+ details?: Record<string, unknown>;
134
+ content?: readonly string[];
135
+ }): void;
136
+ private _batching;
137
+ /** Run several changes that are one action, so they report once — the caller reports the whole. */
138
+ quietly(changes: () => void): void;
121
139
  private fireServerStateChange;
122
140
  /** Both pager callbacks: the one carrying a reason, and the `(page, pageSize)` pair it replaces. */
123
141
  private firePaginationChange;
@@ -98,7 +98,10 @@ export default class RangeModel<TRow> {
98
98
  /** A rectangle as a consumer hears about it. `values` is a call because a range can be very large. */
99
99
  rangeOf(bounds: RangeBounds): CellRange;
100
100
  private get range();
101
+ /** The rectangle as `Box.onInteraction` hears it: no `values()`, which would keep the whole grid alive until delivery. */
102
+ private get block();
101
103
  private emit;
104
+ private reportBlock;
102
105
  /**
103
106
  * Ctrl+C, through the browser's own copy event rather than through a keystroke: `clipboardData` is
104
107
  * writable there with no permission and no promise, and the same press on a page with text selected in