@box-kite/react 2.2.6 → 2.2.8
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/.claude/rules/box-kite-rules.md +2 -0
- package/.claude/skills/box-kite/SKILL.md +2 -0
- package/.claude/skills/box-kite/references/extending.md +10 -0
- package/.claude/skills/box-kite/references/styling.md +3 -2
- package/.cursor/rules/box-kite.mdc +2 -0
- package/AGENTS.md +2 -0
- package/BOX_AI_CONTEXT.md +128 -2
- package/BOX_KITE_AI_CONTEXT.md +128 -2
- package/analytics.cjs +1 -0
- package/analytics.d.ts +10 -0
- package/analytics.mjs +121 -0
- package/behavior.cjs +1 -1
- package/behavior.mjs +42 -38
- package/box.cjs +1 -1
- package/box.d.ts +14 -0
- package/box.mjs +17 -16
- package/catalog.cjs +1 -1
- package/catalog.mjs +8 -0
- package/client.cjs +1 -1
- package/client.mjs +144 -113
- package/components/accordion.cjs +1 -1
- package/components/accordion.mjs +19 -10
- package/components/agent.cjs +1 -1
- package/components/agent.mjs +21 -8
- package/components/calendar.cjs +1 -1
- package/components/calendar.d.ts +3 -1
- package/components/calendar.mjs +154 -142
- package/components/combobox.cjs +1 -1
- package/components/combobox.mjs +184 -174
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +183 -170
- package/components/dataGrid/models/columnModel.d.ts +1 -0
- package/components/dataGrid/models/gridModel.d.ts +18 -0
- package/components/dataGrid/models/headerCellModel.d.ts +1 -0
- package/components/dataGrid/models/rangeModel.d.ts +3 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +1015 -923
- package/components/dateField.cjs +1 -1
- package/components/dateField.mjs +165 -159
- package/components/datePicker.cjs +1 -1
- package/components/datePicker.mjs +198 -183
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +38 -33
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.mjs +107 -93
- package/components/form.cjs +1 -1
- package/components/form.mjs +22 -18
- package/components/menu.cjs +1 -1
- package/components/menu.d.ts +2 -0
- package/components/menu.mjs +196 -175
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +7 -7
- package/components/popover.cjs +1 -1
- package/components/popover.mjs +4 -0
- package/components/radioGroup.cjs +1 -1
- package/components/radioGroup.mjs +10 -5
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +84 -83
- package/components/sortableList.cjs +1 -1
- package/components/sortableList.mjs +158 -150
- package/components/swipeItem.cjs +1 -1
- package/components/swipeItem.mjs +92 -84
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +10 -5
- package/components/timeZoneSelect.cjs +1 -1
- package/components/timeZoneSelect.mjs +40 -35
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +151 -113
- package/create/src/index.d.ts +1 -0
- package/create/src/options.d.ts +27 -0
- package/create/src/options.test.d.ts +1 -0
- package/create/src/packageManager.d.ts +5 -0
- package/create/src/project.d.ts +25 -0
- package/create/src/project.test.d.ts +1 -0
- package/create/templates/ts/designs/azure.d.ts +5 -0
- package/create/templates/ts/designs/ember.d.ts +5 -0
- package/create/templates/ts/designs/mono.d.ts +5 -0
- package/create/templates/ts/src/App.d.ts +2 -0
- package/create/templates/ts/src/design.d.ts +5 -0
- package/create/templates/ts/src/main.d.ts +0 -0
- package/dataGridDateParts.cjs +1 -1
- package/dataGridDateParts.mjs +56 -55
- package/dataGridList.cjs +1 -1
- package/dataGridList.mjs +437 -436
- package/docs/props.md +19 -19
- package/effects.cjs +1 -1
- package/effects.mjs +1 -1
- package/interactionListening.cjs +1 -0
- package/interactionListening.mjs +117 -0
- package/interactions.cjs +1 -0
- package/interactions.mjs +25 -0
- package/layer.cjs +1 -1
- package/layer.mjs +68 -66
- package/package.json +139 -70
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +44 -25
- package/react/interactions/interactions.d.ts +30 -0
- package/react/popover/usePopoverLayer.d.ts +3 -0
- package/react/theme/theme.d.ts +9 -0
- package/react/theme/themeContext.d.ts +2 -0
- package/react/useStyles.d.ts +8 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +49 -48
- package/reporting.cjs +1 -0
- package/reporting.mjs +51 -0
- package/rsc.cjs +1 -1
- package/rsc.d.ts +3 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -1
- package/scrolling.mjs +1 -1
- package/supabase/functions/collect/index.d.ts +30 -0
- package/supabase/functions/collect/index.test.d.ts +1 -0
- package/utils/analytics/analytics.d.ts +72 -0
- package/utils/analytics/analyticsIdentity.d.ts +13 -0
- package/utils/interactions/componentAttribute.d.ts +6 -0
- package/utils/interactions/interactionChannel.d.ts +35 -0
- package/utils/interactions/interactionJson.d.ts +6 -0
- package/utils/interactions/interactionListening.d.ts +6 -0
- package/utils/interactions/interactionTypes.d.ts +224 -0
package/components/dashboard.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
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 {
|
|
7
|
-
import l from "./
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
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
|
|
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
|
-
})(
|
|
275
|
-
var
|
|
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
|
-
],
|
|
283
|
+
], C = [
|
|
283
284
|
"h1",
|
|
284
285
|
"h2",
|
|
285
286
|
"h3",
|
|
286
287
|
"h4",
|
|
287
288
|
"h5",
|
|
288
289
|
"h6"
|
|
289
|
-
],
|
|
290
|
-
function
|
|
290
|
+
], w = f(null);
|
|
291
|
+
function T(e, t, n) {
|
|
291
292
|
return Math.min(Math.max(e, t), n);
|
|
292
293
|
}
|
|
293
|
-
function
|
|
294
|
-
if (typeof e == "number") return [{ count:
|
|
295
|
-
let 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:
|
|
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
|
|
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
|
|
310
|
+
function O(e) {
|
|
310
311
|
return `max${e[0].toUpperCase()}${e.slice(1)}`;
|
|
311
312
|
}
|
|
312
|
-
function
|
|
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
|
|
332
|
+
function k(e) {
|
|
332
333
|
return `column ${e.x + 1}, row ${e.y + 1}`;
|
|
333
334
|
}
|
|
334
|
-
function
|
|
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
|
|
338
|
-
let { children:
|
|
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:
|
|
343
|
-
value:
|
|
344
|
-
defaultValue:
|
|
345
|
-
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:
|
|
350
|
-
}),
|
|
351
|
-
let e =
|
|
352
|
-
for (let n of
|
|
353
|
-
let r = 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 =
|
|
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 ===
|
|
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
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
]),
|
|
375
|
-
|
|
376
|
-
}),
|
|
377
|
-
let n = e.getBoundingClientRect(), r =
|
|
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
|
-
},
|
|
383
|
-
let i = e.kind === "move" ?
|
|
384
|
-
return
|
|
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
|
-
},
|
|
389
|
-
let a =
|
|
390
|
-
!
|
|
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:
|
|
396
|
+
before: W.current,
|
|
396
397
|
pointer: {
|
|
397
398
|
id: t.pointerId,
|
|
398
399
|
x: t.clientX,
|
|
399
400
|
y: t.clientY,
|
|
400
|
-
step:
|
|
401
|
+
step: ie(o, a),
|
|
401
402
|
rtl: e(o)
|
|
402
403
|
}
|
|
403
404
|
}));
|
|
404
|
-
}),
|
|
405
|
-
if (!
|
|
406
|
-
let { x: n, y: r, step: i, rtl: a } =
|
|
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 =
|
|
410
|
-
if (
|
|
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
|
-
|
|
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 (!
|
|
418
|
-
let n =
|
|
419
|
-
e.currentTarget.releasePointerCapture?.(
|
|
420
|
-
reason:
|
|
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 &&
|
|
423
|
-
}),
|
|
424
|
-
|
|
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
|
-
}),
|
|
428
|
-
}),
|
|
429
|
-
if (!
|
|
430
|
-
let a =
|
|
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(),
|
|
438
|
+
t.preventDefault(), L({
|
|
435
439
|
id: n,
|
|
436
440
|
kind: i,
|
|
437
441
|
name: r,
|
|
438
442
|
origin: o,
|
|
439
|
-
before:
|
|
440
|
-
}),
|
|
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(),
|
|
451
|
+
t.preventDefault(), ce(a, t);
|
|
445
452
|
return;
|
|
446
453
|
}
|
|
447
454
|
if (t.key === "Enter" || t.key === " ") {
|
|
448
|
-
t.preventDefault(),
|
|
455
|
+
t.preventDefault(), L(null), G(W.current, {
|
|
449
456
|
reason: i,
|
|
450
457
|
event: t
|
|
451
|
-
}),
|
|
458
|
+
}), B(i === "move" ? `${r} dropped at ${k(o)}.` : `${r} resized to ${A(o)}.`);
|
|
452
459
|
return;
|
|
453
460
|
}
|
|
454
|
-
let s =
|
|
461
|
+
let s = ee(t.key, e(t.currentTarget));
|
|
455
462
|
if (!s) return;
|
|
456
463
|
t.preventDefault();
|
|
457
|
-
let c = i === "move" ?
|
|
458
|
-
l &&
|
|
459
|
-
}),
|
|
460
|
-
|
|
461
|
-
}),
|
|
462
|
-
editable:
|
|
463
|
-
placementOf: (e) =>
|
|
464
|
-
heldOf: (e) =>
|
|
465
|
-
offsetOf: (e) =>
|
|
466
|
-
outsideAuthoring:
|
|
467
|
-
instructionsId:
|
|
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": !!(
|
|
472
|
-
"aria-describedby":
|
|
473
|
-
onPointerDown: (r) =>
|
|
474
|
-
onPointerMove: (t) =>
|
|
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) =>
|
|
478
|
-
onBlur: (t) =>
|
|
484
|
+
onKeyDown: (r) => le(r, e, t, n),
|
|
485
|
+
onBlur: (t) => ue(t, e, n)
|
|
479
486
|
})
|
|
480
487
|
}), [
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
X,
|
|
488
|
+
T,
|
|
489
|
+
J,
|
|
490
|
+
I,
|
|
491
|
+
R,
|
|
492
|
+
q.size,
|
|
493
|
+
V,
|
|
488
494
|
Z,
|
|
489
|
-
Q,
|
|
490
495
|
oe,
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
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__ */
|
|
497
|
-
ref:
|
|
503
|
+
/* @__PURE__ */ y(t, {
|
|
504
|
+
ref: F,
|
|
498
505
|
component: "dashboard",
|
|
499
|
-
...
|
|
500
|
-
variant: [
|
|
501
|
-
vars: { "dashboard-row": `${
|
|
502
|
-
gridTemplateColumns:
|
|
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":
|
|
506
|
-
"aria-labelledby":
|
|
507
|
-
...
|
|
512
|
+
"aria-label": j,
|
|
513
|
+
"aria-labelledby": M,
|
|
514
|
+
...N
|
|
508
515
|
},
|
|
509
|
-
children: [
|
|
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__ */
|
|
527
|
+
/* @__PURE__ */ v(d, {
|
|
521
528
|
props: { role: "status" },
|
|
522
|
-
children:
|
|
529
|
+
children: te
|
|
523
530
|
}),
|
|
524
|
-
/* @__PURE__ */
|
|
525
|
-
id:
|
|
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
|
|
532
|
-
return e === "resize" ? /* @__PURE__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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__ */
|
|
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
|
|
570
|
-
return /* @__PURE__ */
|
|
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__ */
|
|
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
|
|
585
|
-
let { id: n, children: r, title: i, name: a, description: o, actions:
|
|
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:
|
|
597
|
+
grabbed: S?.kind === e,
|
|
591
598
|
corner: e === "resize"
|
|
592
599
|
},
|
|
593
|
-
cq:
|
|
594
|
-
props:
|
|
595
|
-
children: /* @__PURE__ */
|
|
596
|
-
}) : null,
|
|
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__ */
|
|
610
|
+
].map((e) => /* @__PURE__ */ v(t, {
|
|
604
611
|
component: "widget.skeleton.bar",
|
|
605
612
|
width: `${e}%`
|
|
606
613
|
}, e))
|
|
607
|
-
}) :
|
|
614
|
+
}) : d ? /* @__PURE__ */ y(t, {
|
|
608
615
|
component: "widget.message",
|
|
609
616
|
variant: { error: !0 },
|
|
610
617
|
props: { role: "status" },
|
|
611
|
-
children: [
|
|
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:
|
|
623
|
+
onClick: (e) => D(n, {
|
|
624
|
+
reason: "retry",
|
|
625
|
+
event: e
|
|
626
|
+
})
|
|
617
627
|
},
|
|
618
628
|
children: "Try again"
|
|
619
629
|
})]
|
|
620
|
-
}) : f ? /* @__PURE__ */
|
|
630
|
+
}) : f ? /* @__PURE__ */ v(t, {
|
|
621
631
|
component: "widget.message",
|
|
622
632
|
children: f === !0 ? "Nothing to show yet." : f
|
|
623
|
-
}) : r,
|
|
624
|
-
return /* @__PURE__ */
|
|
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
|
-
...
|
|
627
|
-
variant: [
|
|
628
|
-
dragging:
|
|
629
|
-
grabbed:
|
|
636
|
+
..._,
|
|
637
|
+
variant: [_.variant, {
|
|
638
|
+
dragging: S?.pointer !== void 0,
|
|
639
|
+
grabbed: S !== void 0 && S.pointer === void 0
|
|
630
640
|
}],
|
|
631
|
-
order:
|
|
632
|
-
cq:
|
|
633
|
-
...
|
|
641
|
+
order: x?.order,
|
|
642
|
+
cq: x?.query,
|
|
643
|
+
...x?.placement,
|
|
634
644
|
style: {
|
|
635
|
-
...n === void 0 ? void 0 :
|
|
636
|
-
...
|
|
645
|
+
...n === void 0 ? void 0 : b?.offsetOf(n),
|
|
646
|
+
..._.style
|
|
637
647
|
},
|
|
638
648
|
props: {
|
|
639
|
-
role:
|
|
640
|
-
"aria-busy":
|
|
649
|
+
role: x ? "listitem" : void 0,
|
|
650
|
+
"aria-busy": u || void 0,
|
|
641
651
|
"data-widget-id": n,
|
|
642
|
-
...
|
|
652
|
+
...g
|
|
643
653
|
},
|
|
644
654
|
children: [
|
|
645
|
-
|
|
655
|
+
k && /* @__PURE__ */ y(t, {
|
|
646
656
|
component: "widget.header",
|
|
647
657
|
children: [
|
|
648
|
-
|
|
649
|
-
/* @__PURE__ */
|
|
658
|
+
O("move"),
|
|
659
|
+
/* @__PURE__ */ y(t, {
|
|
650
660
|
component: "widget.label",
|
|
651
|
-
children: [i !== void 0 && /* @__PURE__ */
|
|
661
|
+
children: [i !== void 0 && /* @__PURE__ */ v(t, {
|
|
652
662
|
component: "widget.title",
|
|
653
|
-
tag:
|
|
663
|
+
tag: C[l - 1],
|
|
654
664
|
children: i
|
|
655
|
-
}), o !== void 0 && /* @__PURE__ */
|
|
665
|
+
}), o !== void 0 && /* @__PURE__ */ v(t, {
|
|
656
666
|
component: "widget.description",
|
|
657
667
|
children: o
|
|
658
668
|
})]
|
|
659
669
|
}),
|
|
660
|
-
|
|
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":
|
|
667
|
-
onClick:
|
|
676
|
+
"aria-label": h ?? `Refresh ${T}`,
|
|
677
|
+
onClick: (e) => D(n, {
|
|
678
|
+
reason: "refresh",
|
|
679
|
+
event: e
|
|
680
|
+
})
|
|
668
681
|
},
|
|
669
|
-
children: /* @__PURE__ */
|
|
682
|
+
children: /* @__PURE__ */ v(N, {})
|
|
670
683
|
}),
|
|
671
|
-
|
|
684
|
+
c !== void 0 && /* @__PURE__ */ v(t, {
|
|
672
685
|
component: "widget.actions",
|
|
673
|
-
children:
|
|
686
|
+
children: c
|
|
674
687
|
})
|
|
675
688
|
]
|
|
676
689
|
}),
|
|
677
|
-
/* @__PURE__ */
|
|
690
|
+
/* @__PURE__ */ v(t, {
|
|
678
691
|
component: "widget.body",
|
|
679
|
-
children:
|
|
692
|
+
children: ee()
|
|
680
693
|
}),
|
|
681
|
-
|
|
694
|
+
O("resize")
|
|
682
695
|
]
|
|
683
696
|
});
|
|
684
697
|
}
|
|
685
|
-
var
|
|
686
|
-
|
|
687
|
-
var
|
|
688
|
-
|
|
698
|
+
var F = j;
|
|
699
|
+
F.displayName = "DashboardGrid";
|
|
700
|
+
var I = P;
|
|
701
|
+
I.displayName = "Widget";
|
|
689
702
|
//#endregion
|
|
690
|
-
export {
|
|
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;
|