@slotted/react 0.1.0-beta.44 → 0.1.0-beta.46

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 (78) hide show
  1. package/dist/{chart-C4uPgUW8.js → chart-sewqbbm-.js} +385 -383
  2. package/dist/chart.js +1 -1
  3. package/dist/dashboard-grid-CBqqgiKr.js +1238 -0
  4. package/dist/dashboard-grid.js +1 -1
  5. package/dist/{detail-panel-Czs05E_D.js → detail-panel-WW2-BwEP.js} +2 -2
  6. package/dist/detail-panel.js +1 -1
  7. package/dist/docs/chart.json +15 -1
  8. package/dist/docs/chart.md +4 -2
  9. package/dist/docs/dashboard-grid.json +9 -2
  10. package/dist/docs/dashboard-grid.md +2 -1
  11. package/dist/docs/field.json +1 -1
  12. package/dist/docs/field.md +1 -1
  13. package/dist/docs/guidelines/index.md +1 -1
  14. package/dist/docs/guidelines/overviews.md +1 -1
  15. package/dist/docs/guidelines/record-pages.md +3 -3
  16. package/dist/docs/menu.json +1 -1
  17. package/dist/docs/menu.md +1 -1
  18. package/dist/docs/page-header.examples.md +120 -76
  19. package/dist/docs/page-header.json +57 -5
  20. package/dist/docs/page-header.md +14 -1
  21. package/dist/docs/popover.json +1 -1
  22. package/dist/docs/popover.md +1 -1
  23. package/dist/docs/select.json +1 -1
  24. package/dist/docs/select.md +1 -1
  25. package/dist/docs/stat-card.examples.md +121 -0
  26. package/dist/docs/stat-card.json +205 -0
  27. package/dist/docs/stat-card.md +51 -1
  28. package/dist/index.js +64 -64
  29. package/dist/page-header-nMgl8RZu.js +395 -0
  30. package/dist/page-header.js +2 -2
  31. package/dist/page.js +1 -1
  32. package/dist/stat-card-Bt92l0qa.js +344 -0
  33. package/dist/stat-card.js +2 -2
  34. package/dist/styles/chart.css +1 -1
  35. package/dist/styles/dashboard-grid.css +1 -1
  36. package/dist/styles/detail-panel.css +1 -1
  37. package/dist/styles/index.css +4 -4
  38. package/dist/styles/page-header.css +1 -1
  39. package/dist/styles/stat-card.css +7 -1
  40. package/dist/styles.css +1 -1
  41. package/dist/types/chart/chart.d.ts.map +1 -1
  42. package/dist/types/chart/chart.types.d.ts +8 -0
  43. package/dist/types/chart/chart.types.d.ts.map +1 -1
  44. package/dist/types/chart/index.d.ts +1 -1
  45. package/dist/types/chart/index.d.ts.map +1 -1
  46. package/dist/types/dashboard-grid/dashboard-grid-context.d.ts +6 -0
  47. package/dist/types/dashboard-grid/dashboard-grid-context.d.ts.map +1 -1
  48. package/dist/types/dashboard-grid/dashboard-grid.d.ts +1 -1
  49. package/dist/types/dashboard-grid/dashboard-grid.d.ts.map +1 -1
  50. package/dist/types/dashboard-grid/dashboard-grid.types.d.ts +8 -0
  51. package/dist/types/dashboard-grid/dashboard-grid.types.d.ts.map +1 -1
  52. package/dist/types/dashboard-grid/index.d.ts +1 -1
  53. package/dist/types/dashboard-grid/index.d.ts.map +1 -1
  54. package/dist/types/dashboard-grid/use-edit-status.d.ts +8 -0
  55. package/dist/types/dashboard-grid/use-edit-status.d.ts.map +1 -0
  56. package/dist/types/page-header/index.d.ts +2 -1
  57. package/dist/types/page-header/index.d.ts.map +1 -1
  58. package/dist/types/page-header/page-header-notice.d.ts +10 -0
  59. package/dist/types/page-header/page-header-notice.d.ts.map +1 -0
  60. package/dist/types/page-header/page-header.types.d.ts +17 -0
  61. package/dist/types/page-header/page-header.types.d.ts.map +1 -1
  62. package/dist/types/select/use-select-sheet.d.ts +2 -2
  63. package/dist/types/stat-card/delta-run.d.ts +15 -0
  64. package/dist/types/stat-card/delta-run.d.ts.map +1 -0
  65. package/dist/types/stat-card/index.d.ts +3 -1
  66. package/dist/types/stat-card/index.d.ts.map +1 -1
  67. package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
  68. package/dist/types/stat-card/stat-card-group.d.ts +10 -0
  69. package/dist/types/stat-card/stat-card-group.d.ts.map +1 -0
  70. package/dist/types/stat-card/stat-card.types.d.ts +38 -0
  71. package/dist/types/stat-card/stat-card.types.d.ts.map +1 -1
  72. package/dist/types/stat-card/stat-delta.d.ts +9 -0
  73. package/dist/types/stat-card/stat-delta.d.ts.map +1 -0
  74. package/package.json +6 -6
  75. package/dist/dashboard-grid-_3H4G0dP.js +0 -1207
  76. package/dist/page-header-DK896DGD.js +0 -367
  77. package/dist/stat-card-D6NMjkZM.js +0 -295
  78. /package/dist/{page-DT8L0iRT.js → use-page-size-class-Cv1DbtKx.js} +0 -0
@@ -0,0 +1,1238 @@
1
+ import { r as e } from "./i18n-D7xXDd8-.js";
2
+ import { n as t, t as n } from "./icon-D04-_QFA.js";
3
+ import { _ as r, c as i, d as a, g as o, n as s, p as c, t as l } from "./menu-parts-DXs5YuUA.js";
4
+ import { t as u } from "./use-media-query-DJY5h_K5.js";
5
+ import { n as d, t as f } from "./icon-button-DzPkQamc.js";
6
+ /* empty css */
7
+ import { a as p, c as m, i as ee, o as h, s as g } from "./card-DO3Kfl_t.js";
8
+ import { a as _, d as v, f as y, l as b, p as x, r as S } from "./popover-DED1MTi-.js";
9
+ import { i as C, o as w, r as te } from "./skeleton-DTqt2GEv.js";
10
+ import { i as ne, n as re, o as ie, r as ae, t as oe } from "./result-state-Ct9AB01a.js";
11
+ import { i as se } from "./typography-77WM-zPA.js";
12
+ import { keyedProps as ce, selectorKeyProps as le, withSelectorKey as T } from "@slotted/core/selector-key";
13
+ import { createControllable as E } from "@slotted/core/state";
14
+ import { Children as ue, Fragment as de, createContext as D, isValidElement as fe, memo as pe, useCallback as O, useContext as me, useEffect as he, useId as ge, useImperativeHandle as _e, useLayoutEffect as ve, useMemo as k, useRef as A, useState as j } from "react";
15
+ import { Fragment as ye, jsx as M, jsxs as N } from "react/jsx-runtime";
16
+ import { dashboardGridMessages as be, dragMessages as xe } from "@slotted/core/i18n";
17
+ import { getLiveAnnouncer as Se } from "@slotted/core/live-announcer";
18
+ import { createDragController as Ce } from "@slotted/core/drag";
19
+ import { DASHBOARD_SUBROWS as we, cellAt as P, dashboardKeyIntent as Te, editStatusSentences as Ee, gridStyle as De, handleShortcuts as Oe, inChildOrder as ke, layoutsEqual as Ae, materializeLayout as F, measureTiles as je, moveTile as Me, moveTileBy as Ne, observeContentSpan as I, parseDashboardLayout as L, parseDuration as Pe, playFlip as Fe, playResize as Ie, resizeTileBy as Le, resizeTileInClass as Re, resolveColumns as ze, resolveTiles as Be, serializeDashboardLayout as R, setTileHidden as Ve, setTileHiddenInPlace as He, sizeClassOf as Ue, spanFromTravel as We, swapTiles as Ge, tileStyle as Ke } from "@slotted/core/dashboard-grid";
20
+ //#region src/dashboard-grid/dashboard-grid-context.ts
21
+ var qe = D(null), Je = [
22
+ "value",
23
+ "title",
24
+ "rows",
25
+ "defaultColumns",
26
+ "defaultRows",
27
+ "minColumns",
28
+ "maxColumns",
29
+ "minRows",
30
+ "maxRows",
31
+ "movable",
32
+ "resizable",
33
+ "removable"
34
+ ], Ye = D(null);
35
+ function Xe(e) {
36
+ let t = me(qe);
37
+ if (t === null) throw Error(`${e} must be rendered inside a DashboardGrid`);
38
+ return t;
39
+ }
40
+ //#endregion
41
+ //#region src/dashboard-grid/dashboard-grid-defaults.tsx
42
+ var Ze = {
43
+ columns: 12,
44
+ editBar: !0,
45
+ headingLevel: "auto"
46
+ }, Qe = D(Ze);
47
+ function $e() {
48
+ return me(Qe);
49
+ }
50
+ function z({ children: e, ...t }) {
51
+ let n = $e();
52
+ return /* @__PURE__ */ M(Qe.Provider, {
53
+ value: {
54
+ columns: t.columns ?? n.columns,
55
+ editBar: t.editBar ?? n.editBar,
56
+ headingLevel: t.headingLevel ?? n.headingLevel
57
+ },
58
+ children: e
59
+ });
60
+ }
61
+ //#endregion
62
+ //#region src/dashboard-grid/use-edit-status.ts
63
+ function et(e, t, n) {
64
+ let r = u("(pointer: coarse)"), i = u("(any-pointer: fine)"), a = e("editStatus");
65
+ return a === "" ? Ee({
66
+ coarse: r,
67
+ fine: i,
68
+ sizeClass: n,
69
+ tiles: t
70
+ }).map((t) => tt(e, t)).join(" ") : a;
71
+ }
72
+ function tt(e, t) {
73
+ switch (t.key) {
74
+ case "editStatusMove": return e("editStatusMove", t.values);
75
+ case "editStatusKeys": return e("editStatusKeys", t.values);
76
+ case "editStatusResize": return e("editStatusResize");
77
+ case "editStatusHandle": return e("editStatusHandle");
78
+ }
79
+ }
80
+ //#endregion
81
+ //#region src/dashboard-grid/dashboard-grid.tsx
82
+ var nt = [], rt = "dashboard-grid", it = "\0placeholder";
83
+ function at(e, t, n, r = Object.is) {
84
+ let [i, a] = j(t), o = e === void 0 ? i : e, s = A({
85
+ controlled: e,
86
+ value: o,
87
+ onRequest: n,
88
+ equals: r
89
+ });
90
+ return s.current = {
91
+ controlled: e,
92
+ value: o,
93
+ onRequest: n,
94
+ equals: r
95
+ }, [o, O((e, t, n, r) => {
96
+ let { controlled: i, value: o, onRequest: c, equals: l } = s.current;
97
+ if (l(o, e)) return !1;
98
+ let u = !0;
99
+ return E({
100
+ controlled: i,
101
+ initial: o,
102
+ equals: l,
103
+ onRequest: (e) => {
104
+ c?.(e.value, Object.assign(e, r ?? {})), u = !e.cancelled;
105
+ }
106
+ }).request(e, t, n) && (s.current.value = e, a(e)), u;
107
+ }, [])];
108
+ }
109
+ function ot(e) {
110
+ return e.detail === 0 ? "keyboard" : "pointer";
111
+ }
112
+ function st(e) {
113
+ return e === null || typeof getComputedStyle != "function" ? "ltr" : getComputedStyle(e).direction === "rtl" ? "rtl" : "ltr";
114
+ }
115
+ function ct(e, t) {
116
+ return e !== null && e.clientWidth > 0 ? Ue(e.clientWidth, t) : "expanded";
117
+ }
118
+ function lt(e, t) {
119
+ let n = e.rows === "auto" ? t.get(e.value) : void 0;
120
+ return {
121
+ key: e.value,
122
+ ...n === void 0 ? {} : { contentSpan: n },
123
+ ...e.defaultColumns === void 0 ? {} : { defaultColumns: e.defaultColumns },
124
+ ...e.defaultRows === void 0 ? {} : { defaultRows: e.defaultRows },
125
+ ...e.minColumns === void 0 ? {} : { minColumns: e.minColumns },
126
+ ...e.maxColumns === void 0 ? {} : { maxColumns: e.maxColumns },
127
+ ...e.minRows === void 0 ? {} : { minRows: e.minRows },
128
+ ...e.maxRows === void 0 ? {} : { maxRows: e.maxRows },
129
+ ...e.movable === void 0 ? {} : { movable: e.movable },
130
+ ...e.resizable === void 0 ? {} : { resizable: e.resizable },
131
+ ...e.removable === void 0 ? {} : { removable: e.removable }
132
+ };
133
+ }
134
+ function ut(e, t) {
135
+ let n = getComputedStyle(e), r = parseFloat(n.columnGap) || 0, i = (e.clientWidth - r * (t - 1)) / Math.max(1, t), a = (parseFloat(n.gridAutoRows) || 0) * we;
136
+ return {
137
+ columns: t,
138
+ track: i,
139
+ columnGap: r,
140
+ row: Math.max(0, a - r),
141
+ rowGap: r
142
+ };
143
+ }
144
+ function dt(e, t, n) {
145
+ let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
146
+ return {
147
+ inlineStart: n ? i.right - r.right : r.left - i.left,
148
+ blockStart: r.top - i.top,
149
+ inlineSize: r.width,
150
+ blockSize: r.height
151
+ };
152
+ }
153
+ var B = [
154
+ "inset-inline-start",
155
+ "inset-block-start",
156
+ "inline-size",
157
+ "block-size",
158
+ "translate"
159
+ ];
160
+ function ft(e, t) {
161
+ e.style.setProperty("inset-inline-start", `${t.inlineStart}px`), e.style.setProperty("inset-block-start", `${t.blockStart}px`), e.style.setProperty("inline-size", `${t.inlineSize}px`), e.style.setProperty("block-size", `${t.blockSize}px`);
162
+ }
163
+ function pt(e) {
164
+ if (e !== void 0) for (let t of B) e.style.removeProperty(t);
165
+ }
166
+ function mt(e, t = []) {
167
+ return ue.forEach(e, (e) => {
168
+ fe(e) && e.type === de ? mt(e.props.children, t) : t.push(e);
169
+ }), t;
170
+ }
171
+ function ht(e, t) {
172
+ return e !== void 0 && Je.every((n) => e[n] === t[n]);
173
+ }
174
+ function gt(e, t) {
175
+ let n = Object.keys(e.tile), r = Object.keys(e.can);
176
+ return e.order === t.order && e.child === t.child && e.dragging === t.dragging && e.resizing === t.resizing && e.edge === t.edge && e.readout === t.readout && n.every((n) => e.tile[n] === t.tile[n]) && r.every((n) => e.can[n] === t.can[n]);
177
+ }
178
+ function _t({ "aria-label": o, "aria-labelledby": c, children: u, columns: f, defaultEditing: p = !1, defaultLayout: m = nt, editBar: ee, editing: h, expandedFrom: g, headingLevel: _, layout: v, messages: y, narrowOrder: b = "layout", onEditingChange: x, onLayoutChange: S, ref: C, render: w, style: te, ...re }) {
179
+ let se = $e(), E = e(be, y), ue = e(xe), D = k(() => ze(f ?? se.columns), [f, se.columns]), pe = ee ?? se.editBar, me = _ ?? se.headingLevel, we = `${ge()}-edit-status`, [Ee, Oe] = j(() => /* @__PURE__ */ new Map()), L = A(/* @__PURE__ */ new Map()), R = O((e) => {
180
+ let t = L.current.get(e);
181
+ return t === void 0 && (t = (t) => Oe((n) => ht(n.get(e), t) ? n : new Map(n).set(e, t)), L.current.set(e, t)), t;
182
+ }, []), { declarations: Ue, elements: Je, pending: Xe } = k(() => {
183
+ let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], r = 0;
184
+ for (let i of mt(u)) {
185
+ if (!fe(i)) continue;
186
+ let { value: a } = i.props;
187
+ if (typeof a == "string") {
188
+ if (e.has(a)) continue;
189
+ e.set(a, i.props), t.set(a, i);
190
+ continue;
191
+ }
192
+ let o = r++, s = /* @__PURE__ */ M(Ye.Provider, {
193
+ value: R(o),
194
+ children: i
195
+ }, `host-${o}`), c = Ee.get(o);
196
+ if (c === void 0 || e.has(c.value)) {
197
+ n.push(s);
198
+ continue;
199
+ }
200
+ e.set(c.value, c), t.set(c.value, s);
201
+ }
202
+ return {
203
+ declarations: e,
204
+ elements: t,
205
+ pending: n
206
+ };
207
+ }, [
208
+ u,
209
+ Ee,
210
+ R
211
+ ]), [Ze, Qe] = j(() => /* @__PURE__ */ new Map()), z = k(() => [...Ue.values()].map((e) => lt(e, Ze)), [Ue, Ze]), tt = k(() => new Map([...Ue].map(([e, t]) => [e, t.title])), [Ue]), [B, _t] = at(v, m, S, Ae), [V, vt] = at(h, p, x), yt = k(() => Be(B, z, D), [
212
+ B,
213
+ z,
214
+ D
215
+ ]), [H, bt] = j(null), xt = A(null), [U, St] = j(null), W = A(null), Ct = A(null), G = A(/* @__PURE__ */ new Map()), wt = A(/* @__PURE__ */ new Map()), Tt = A(/* @__PURE__ */ new Map()), [Et, Dt] = j(0), Ot = O((e, t, n) => {
216
+ let r = e.get(t);
217
+ if (n === null) {
218
+ if (r === void 0) return;
219
+ e.delete(t);
220
+ } else {
221
+ if (r === n) return;
222
+ e.set(t, n);
223
+ }
224
+ Dt((e) => e + 1);
225
+ }, []), kt = O((e, t) => Ot(G.current, e, t), [Ot]), At = O((e, t) => Ot(wt.current, e, t), [Ot]), jt = O((e, t) => Ot(Tt.current, e, t), [Ot]), Mt = [...Ue.values()].filter((e) => e.rows === "auto").map((e) => e.value).join("\n");
226
+ he(() => {
227
+ let e = W.current;
228
+ if (e === null || Mt === "") return;
229
+ let t = Mt.split("\n").map((t) => {
230
+ let n = Tt.current.get(t);
231
+ return n === void 0 ? () => {} : I(n, e, (e) => Qe((n) => new Map(n).set(t, e)));
232
+ });
233
+ return () => {
234
+ for (let e of t) e();
235
+ };
236
+ }, [Mt, Et]);
237
+ let [Nt, Pt] = j(null), K = Nt ?? "expanded", Ft = b === "children" && K !== "expanded", q = k(() => Ft ? ke(yt, z) : yt, [
238
+ Ft,
239
+ yt,
240
+ z
241
+ ]), J = k(() => q.filter((e) => !e.hidden), [q]);
242
+ he(() => {
243
+ if (!U || typeof ResizeObserver > "u") return;
244
+ let e = () => Pt(U.clientWidth > 0 ? ct(U, g) : null), t = new ResizeObserver(e);
245
+ return t.observe(U), e(), () => t.disconnect();
246
+ }, [U, g]);
247
+ let It = A(null), Lt = A(null), Y = A(null), Rt = O(() => {
248
+ let e = new Map(G.current), t = xt.current?.key;
249
+ t !== void 0 && e.delete(t), Ct.current && e.set(it, Ct.current), It.current = je(e);
250
+ }, []), X = O((e) => {
251
+ Rt(), xt.current = e, bt(e);
252
+ }, [Rt]), zt = O((e) => {
253
+ let t = U?.ownerDocument;
254
+ t && e !== "" && Se(t).announce(e);
255
+ }, [U]), Z = A({
256
+ layout: B,
257
+ widgets: z,
258
+ grid: D,
259
+ tiles: q,
260
+ visible: J,
261
+ inPlace: Ft,
262
+ t: E,
263
+ dragT: ue,
264
+ titles: tt,
265
+ editing: V
266
+ });
267
+ Z.current = {
268
+ layout: B,
269
+ widgets: z,
270
+ grid: D,
271
+ tiles: q,
272
+ visible: J,
273
+ inPlace: Ft,
274
+ t: E,
275
+ dragT: ue,
276
+ titles: tt,
277
+ editing: V
278
+ };
279
+ let Q = O((e) => Z.current.titles.get(e) ?? e, []), $ = O((e, t, n, r, i) => {
280
+ let a = Z.current, o = a.inPlace && (n.kind === "hide" || n.kind === "show"), s = o ? e : F(e, a.widgets, a.grid), c = o ? a.layout : F(a.layout, a.widgets, a.grid);
281
+ return !Ae(s, c) && (It.current === null && Rt(), _t(s, t, r, { change: n }) ? (zt(i(s)), !0) : (It.current = null, !1));
282
+ }, [
283
+ zt,
284
+ Rt,
285
+ _t
286
+ ]), Bt = O(() => ct(U, g), [U, g]), Vt = O((e, t) => (n) => {
287
+ let r = Z.current, i = Be(n, r.widgets, r.grid).filter((e) => !e.hidden), a = i.findIndex((t) => t.key === e), o = i[a];
288
+ return o === void 0 ? "" : t === "expanded" ? r.t("moved", {
289
+ title: Q(e),
290
+ row: o.y + 1,
291
+ column: o.x + 1
292
+ }) : r.t("movedInOrder", {
293
+ title: Q(e),
294
+ position: a + 1,
295
+ total: i.length
296
+ });
297
+ }, [Q]), Ht = O((e, t) => (n) => {
298
+ let r = Z.current, i = Be(n, r.widgets, r.grid).find((t) => t.key === e);
299
+ return i === void 0 ? "" : r.t("resized", {
300
+ title: Q(e),
301
+ columns: t === "medium" ? i.medium : i.w,
302
+ rows: i.h
303
+ });
304
+ }, [Q]), Ut = O((e, t, n, r) => {
305
+ let i = Z.current, a = Bt(), o = Ne(i.layout, i.widgets, i.grid, e, t, a);
306
+ Y.current = e, $(o, n, {
307
+ kind: "move",
308
+ key: e
309
+ }, r, Vt(e, a)) || (Y.current = null);
310
+ }, [
311
+ $,
312
+ Vt,
313
+ Bt
314
+ ]), Wt = O((e, t, n, r) => {
315
+ let i = Z.current, a = Bt(), o = Le(i.layout, i.widgets, i.grid, e, t, a);
316
+ Y.current = e, $(o, n, {
317
+ kind: "resize",
318
+ key: e
319
+ }, r, Ht(e, a)) || (Y.current = null);
320
+ }, [
321
+ $,
322
+ Ht,
323
+ Bt
324
+ ]), Gt = O((e, t, n) => {
325
+ let r = Z.current, i = r.visible.findIndex((t) => t.key === e), a = r.visible[i];
326
+ if (a === void 0 || !a.removable) return;
327
+ let o = r.visible[i + 1] ?? r.visible[i - 1];
328
+ Y.current = o?.key ?? `${rt}:add`;
329
+ let s = (r.inPlace ? He : Ve)(r.layout, r.widgets, r.grid, e, !0);
330
+ $(s, t, {
331
+ kind: "hide",
332
+ key: e
333
+ }, n, () => r.t("hidden", { title: Q(e) })) || (Y.current = null);
334
+ }, [$, Q]), Kt = O((e, t, n) => {
335
+ let r = Z.current;
336
+ Y.current = e;
337
+ let i = (r.inPlace ? He : Ve)(r.layout, r.widgets, r.grid, e, !1);
338
+ $(i, t, {
339
+ kind: "show",
340
+ key: e
341
+ }, n, () => r.t("shown", { title: Q(e) }));
342
+ }, [$, Q]), qt = A(null), Jt = A(null), Yt = A(!1);
343
+ ve(() => {
344
+ if (V && !Yt.current) {
345
+ let e = Z.current;
346
+ qt.current = F(e.layout, e.widgets, e.grid), Jt.current = U?.ownerDocument.activeElement ?? null;
347
+ }
348
+ if (!V && Yt.current) {
349
+ let e = U?.ownerDocument, t = e?.activeElement ?? null, n = t === null || t === e?.body || !t.isConnected, r = Jt.current;
350
+ n && r instanceof HTMLElement && r.isConnected && r.focus(), qt.current = null, Jt.current = null;
351
+ }
352
+ Yt.current = V;
353
+ }, [V, U]);
354
+ let Xt = O((e, t) => {
355
+ vt(!1, e, t);
356
+ }, [vt]), Zt = O((e, t) => {
357
+ let n = Z.current, r = qt.current;
358
+ r !== null && $(r, "dismiss", {
359
+ kind: "cancel",
360
+ key: null
361
+ }, t, () => n.t("cancelled")), vt(!1, e, t);
362
+ }, [$, vt]), Qt = O((e, t) => {
363
+ let n = Z.current;
364
+ $(m, e, {
365
+ kind: "reset",
366
+ key: null
367
+ }, t, () => n.t("resetDone"));
368
+ }, [$, m]), $t = O((e, t) => {
369
+ let n = Te(t, st(t.currentTarget));
370
+ if (n === null) return;
371
+ let r = Z.current.visible.find((t) => t.key === e);
372
+ if (r === void 0) return;
373
+ t.preventDefault(), t.stopPropagation();
374
+ let i = t.nativeEvent;
375
+ n.kind === "move" && r.movable && Ut(e, n.direction, "keyboard", i), n.kind === "resize" && r.resizable && Wt(e, {
376
+ columns: n.columns,
377
+ rows: n.rows
378
+ }, "keyboard", i), n.kind === "hide" && Gt(e, "remove", i);
379
+ }, [
380
+ Gt,
381
+ Ut,
382
+ Wt
383
+ ]), en = A(null), tn = O((e, t, n) => {
384
+ if (n.button !== 0 || en.current !== null) return;
385
+ let r = Z.current, i = r.visible.find((t) => t.key === e), a = W.current, o = G.current.get(e);
386
+ if (i === void 0 || !i.resizable || a === null || o === void 0) return;
387
+ n.preventDefault(), n.stopPropagation();
388
+ let s = Bt();
389
+ if (s === "compact") return;
390
+ let c = n.currentTarget, l = st(a) === "rtl", u = ut(a, r.grid[s]), d = dt(o, a, l), f = {
391
+ x: n.clientX,
392
+ y: n.clientY
393
+ }, p = s === "medium" ? i.medium : i.w, m = t === "start" || t === "bottom-start", ee = t === "end" || t === "bottom-end", h = t !== "start" && t !== "end", g = {
394
+ x: i.x,
395
+ y: i.y,
396
+ w: p,
397
+ h: i.h
398
+ }, _ = F(r.layout, r.widgets, r.grid);
399
+ ft(o, d), X({
400
+ kind: "resize",
401
+ key: e,
402
+ edge: t,
403
+ preview: _,
404
+ sizeClass: s
405
+ });
406
+ let v = (n) => {
407
+ let r = n.clientX - f.x, a = n.clientY - f.y, c = l ? -r : r, v = u.track, y = ee ? Math.max(v, d.inlineSize + c) : m ? Math.max(v, d.inlineSize - c) : d.inlineSize, b = h ? Math.max(u.row, d.blockSize + a) : d.blockSize;
408
+ o.style.setProperty("inline-size", `${y}px`), o.style.setProperty("block-size", `${b}px`);
409
+ let x = m ? d.inlineSize - y : 0;
410
+ o.style.setProperty("translate", `${l ? -x : x}px 0px`);
411
+ let S = We({
412
+ span: p,
413
+ track: u.track,
414
+ gap: u.columnGap,
415
+ travel: y - d.inlineSize
416
+ }), C = h ? We({
417
+ span: i.h,
418
+ track: u.row,
419
+ gap: u.rowGap,
420
+ travel: b - d.blockSize
421
+ }) : i.h, w = m ? i.x + i.w - S : i.x;
422
+ if (S === g.w && C === g.h && w === g.x) return;
423
+ g = {
424
+ x: w,
425
+ y: i.y,
426
+ w: S,
427
+ h: C
428
+ };
429
+ let te = Z.current;
430
+ _ = Re(te.layout, te.widgets, te.grid, e, g, s), X({
431
+ kind: "resize",
432
+ key: e,
433
+ edge: t,
434
+ preview: _,
435
+ sizeClass: s
436
+ });
437
+ }, y = (t, n) => {
438
+ en.current?.();
439
+ let r = o.getBoundingClientRect();
440
+ Lt.current = {
441
+ key: e,
442
+ box: {
443
+ left: r.left,
444
+ top: r.top,
445
+ width: r.width,
446
+ height: r.height
447
+ }
448
+ }, pt(o), X(null), t && $(_, "pointer", {
449
+ kind: "resize",
450
+ key: e
451
+ }, n, Ht(e, s));
452
+ }, b = (e) => y(!0, e), x = () => y(!1), S = (e) => {
453
+ e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), y(!1));
454
+ }, C = c.ownerDocument;
455
+ c.setPointerCapture?.(n.pointerId), c.addEventListener("pointermove", v), c.addEventListener("pointerup", b), c.addEventListener("pointercancel", x), C.addEventListener("keydown", S, !0), en.current = () => {
456
+ en.current = null, c.removeEventListener("pointermove", v), c.removeEventListener("pointerup", b), c.removeEventListener("pointercancel", x), C.removeEventListener("keydown", S, !0), c.hasPointerCapture?.(n.pointerId) && c.releasePointerCapture(n.pointerId);
457
+ };
458
+ }, [
459
+ $,
460
+ Ht,
461
+ X,
462
+ Bt
463
+ ]);
464
+ he(() => () => en.current?.(), []), he(() => {
465
+ let e = W.current;
466
+ if (!U || !V || e === null) return;
467
+ let t = U.ownerDocument, n = () => Z.current.visible.map((e) => e.key), r = null, i = null, a = "expanded", o = !1, s = null, c = (t) => {
468
+ let n = t.target?.closest("[data-part=\"widget\"]"), i = n?.dataset.key;
469
+ if (!n || i === void 0 || n.parentElement !== e) return;
470
+ let a = n.getBoundingClientRect();
471
+ r = {
472
+ x: t.clientX,
473
+ y: t.clientY,
474
+ grabX: t.clientX - a.left,
475
+ grabY: t.clientY - a.top,
476
+ key: i
477
+ };
478
+ };
479
+ e.addEventListener("pointerdown", c, !0);
480
+ let l = (e, t) => {
481
+ let n = Z.current;
482
+ if (t.startsWith("swap:")) return Ge(n.layout, n.widgets, n.grid, e, t.slice(5));
483
+ let [r, i] = t.split(",").map(Number);
484
+ return Me(n.layout, n.widgets, n.grid, e, {
485
+ x: r ?? 0,
486
+ y: i ?? 0
487
+ });
488
+ }, u = Ce({
489
+ document: t,
490
+ restoreFocus: !1,
491
+ preview: !1,
492
+ autoScroll: { axis: "y" },
493
+ t: (e, t) => Z.current.dragT(e, t),
494
+ silent: [
495
+ "pickedUp",
496
+ "moved",
497
+ "dropped",
498
+ "cancelled"
499
+ ],
500
+ resolveTarget: (t) => {
501
+ let n = u.state.items[0];
502
+ if (n === void 0 || r === null || s === null) return null;
503
+ let c = e.getBoundingClientRect();
504
+ if (a === "expanded") {
505
+ let e = t.x - r.grabX, a = t.y - r.grabY, l = Z.current.visible.find((e) => e.key === n), u = l ? l.w * s.track + (l.w - 1) * s.columnGap : 0, d = o ? e + u - s.track / 2 : e + s.track / 2, f = P({
506
+ x: d,
507
+ y: a + s.row / 2
508
+ }, {
509
+ left: c.left,
510
+ top: c.top,
511
+ width: c.width
512
+ }, {
513
+ columns: s.columns,
514
+ row: s.row,
515
+ gap: s.columnGap
516
+ }, o ? "rtl" : "ltr");
517
+ i = `${f.x},${f.y}`;
518
+ } else for (let [e, r] of G.current) {
519
+ if (e === n) continue;
520
+ let a = r.getBoundingClientRect();
521
+ if (t.x >= a.left && t.x <= a.right && t.y >= a.top && t.y <= a.bottom) {
522
+ i = `swap:${e}`;
523
+ break;
524
+ }
525
+ }
526
+ return i === null ? null : {
527
+ kind: "on",
528
+ container: rt,
529
+ key: i
530
+ };
531
+ },
532
+ onTargetChange: ({ state: e }) => {
533
+ let t = e.items[0];
534
+ t !== void 0 && e.target?.kind === "on" && X({
535
+ kind: "move",
536
+ key: t,
537
+ preview: l(t, e.target.key)
538
+ });
539
+ },
540
+ onDrop: ({ items: e, target: t, reason: n, event: r }) => {
541
+ let i = e[0];
542
+ i !== void 0 && t.kind === "on" && (Y.current = null, $(l(i, t.key), n === "keyboard" ? "keyboard" : "pointer", {
543
+ kind: "move",
544
+ key: i
545
+ }, r, Vt(i, a)));
546
+ }
547
+ }), d = u.registerContainer({
548
+ key: rt,
549
+ items: n,
550
+ orientation: "grid",
551
+ targets: ["on"],
552
+ element: () => e,
553
+ itemElement: (e) => G.current.get(e) ?? null,
554
+ label: () => Z.current.t("editBar"),
555
+ itemLabel: Q
556
+ }), f = !1, p = null, m = (e) => {
557
+ f && (f = !1, e.preventDefault(), e.stopPropagation());
558
+ };
559
+ U.addEventListener("click", m, !0);
560
+ let ee = u.subscribe((t) => {
561
+ if (t.status !== "dragging") {
562
+ if (p !== null) {
563
+ let e = G.current.get(p);
564
+ if (e) {
565
+ let t = e.getBoundingClientRect();
566
+ Lt.current = {
567
+ key: p,
568
+ box: {
569
+ left: t.left,
570
+ top: t.top,
571
+ width: t.width,
572
+ height: t.height
573
+ }
574
+ };
575
+ }
576
+ pt(e), f = t.reason === "pointer" || t.reason === null, window.setTimeout(() => {
577
+ f = !1;
578
+ }, 0), p = null, i = null, xt.current?.kind === "move" && X(null);
579
+ }
580
+ return;
581
+ }
582
+ let n = t.items[0];
583
+ if (n === void 0 || r === null) return;
584
+ let c = G.current.get(n);
585
+ c !== void 0 && (p === null && (p = n, a = ct(U), o = st(e) === "rtl", s = ut(e, Z.current.grid[a]), ft(c, dt(c, e, o)), X({
586
+ kind: "move",
587
+ key: n,
588
+ preview: F(Z.current.layout, Z.current.widgets, Z.current.grid)
589
+ })), t.point !== null && c.style.setProperty("translate", `${t.point.x - r.x}px ${t.point.y - r.y}px`));
590
+ }), h = [];
591
+ for (let e of Z.current.visible) {
592
+ if (!e.movable) continue;
593
+ let t = G.current.get(e.key);
594
+ if (t === void 0) continue;
595
+ let n = Tt.current.get(e.key), r = wt.current.get(e.key);
596
+ n && h.push(u.attachDraggable(t, {
597
+ container: rt,
598
+ key: e.key,
599
+ handle: () => n,
600
+ canDrag: (e) => e.pointerType !== "touch"
601
+ })), r && h.push(u.attachDraggable(t, {
602
+ container: rt,
603
+ key: e.key,
604
+ handle: () => r,
605
+ delay: { touch: 0 }
606
+ }));
607
+ }
608
+ return () => {
609
+ for (let e of h) e();
610
+ e.removeEventListener("pointerdown", c, !0), U.removeEventListener("click", m, !0), ee(), d(), u.destroy();
611
+ };
612
+ }, [
613
+ U,
614
+ V,
615
+ Et,
616
+ $,
617
+ Vt,
618
+ X,
619
+ Q
620
+ ]);
621
+ let nn = k(() => JSON.stringify(F(B, z, D)), [
622
+ B,
623
+ z,
624
+ D
625
+ ]);
626
+ ve(() => {
627
+ if (U === null) return;
628
+ let e = getComputedStyle(U), t = {
629
+ duration: Pe(e.getPropertyValue("--slotted-duration-medium")),
630
+ easing: e.getPropertyValue("--slotted-easing-standard").trim() || "ease"
631
+ }, n = It.current;
632
+ if (n !== null) {
633
+ It.current = null;
634
+ let e = new Map(G.current), r = xt.current?.key;
635
+ r !== void 0 && e.delete(r), Ct.current && e.set(it, Ct.current), Fe(e, n, t);
636
+ }
637
+ let r = Lt.current;
638
+ if (r !== null && xt.current === null) {
639
+ Lt.current = null;
640
+ let e = G.current.get(r.key);
641
+ e && Ie(e, r.box, t);
642
+ }
643
+ let i = Y.current;
644
+ if (i === null) return;
645
+ Y.current = null;
646
+ let a = i === `${rt}:add` ? U.querySelector("[data-part=\"add\"]") : Z.current.editing ? wt.current.get(i) : null;
647
+ a && a !== U.ownerDocument.activeElement && a.focus();
648
+ }, [
649
+ nn,
650
+ H,
651
+ U
652
+ ]), _e(C, () => ({
653
+ get element() {
654
+ return U;
655
+ },
656
+ focusWidget: (e) => {
657
+ ((Z.current.editing ? wt.current.get(e) : void 0) ?? G.current.get(e)?.querySelector("a[href], button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])"))?.focus();
658
+ },
659
+ commitEditing: () => Xt("programmatic"),
660
+ cancelEditing: () => Zt("programmatic")
661
+ }), [
662
+ Zt,
663
+ Xt,
664
+ U
665
+ ]);
666
+ let rn = k(() => H === null ? q : Be(H.preview, z, D), [
667
+ H,
668
+ q,
669
+ z,
670
+ D
671
+ ]), an = k(() => rn.filter((e) => !e.hidden), [rn]), on = k(() => {
672
+ let e = /* @__PURE__ */ new Map(), t = F(B, z, D), n = (e) => !Ae(F(e, z, D), t);
673
+ for (let t of J) {
674
+ let r = (e) => V && n(Ne(B, z, D, t.key, e, K)), i = (e, r) => V && n(Le(B, z, D, t.key, {
675
+ columns: e,
676
+ rows: r
677
+ }, K));
678
+ e.set(t.key, {
679
+ up: r("up"),
680
+ down: r("down"),
681
+ left: r("left"),
682
+ right: r("right"),
683
+ wider: i(1, 0),
684
+ narrower: i(-1, 0),
685
+ taller: i(0, 1),
686
+ shorter: i(0, -1)
687
+ });
688
+ }
689
+ return e;
690
+ }, [
691
+ J,
692
+ V,
693
+ B,
694
+ z,
695
+ D,
696
+ K
697
+ ]), sn = A(/* @__PURE__ */ new Map()), cn = k(() => {
698
+ let e = /* @__PURE__ */ new Map(), t = new Map(an.map((e, t) => [e.key, t])), n = new Map(z.map((e, t) => [e.key, t]));
699
+ for (let r of J) {
700
+ let i = rn.find((e) => e.key === r.key) ?? r, a = H !== null && H.key === r.key, o = a && H.kind === "resize", s = {
701
+ tile: i,
702
+ order: H === null || K === "expanded" ? void 0 : t.get(r.key),
703
+ child: b === "children" ? n.get(r.key) : void 0,
704
+ dragging: a && H.kind === "move",
705
+ resizing: o,
706
+ edge: o ? H.edge : null,
707
+ readout: o ? E("size", {
708
+ columns: H.sizeClass === "medium" ? i.medium : i.w,
709
+ rows: i.h
710
+ }) : null,
711
+ can: on.get(r.key)
712
+ }, c = sn.current.get(r.key);
713
+ e.set(r.key, c !== void 0 && gt(c, s) ? c : s);
714
+ }
715
+ return e;
716
+ }, [
717
+ rn,
718
+ an,
719
+ J,
720
+ H,
721
+ E,
722
+ on,
723
+ K,
724
+ b,
725
+ z
726
+ ]);
727
+ ve(() => {
728
+ sn.current = cn;
729
+ }, [cn]);
730
+ let ln = k(() => ({
731
+ editing: V,
732
+ t: E,
733
+ headingLevel: me,
734
+ statusId: we,
735
+ sizeClass: K,
736
+ slots: cn,
737
+ registerWidget: kt,
738
+ registerHandle: At,
739
+ registerCard: jt,
740
+ move: Ut,
741
+ resize: Wt,
742
+ hide: Gt,
743
+ onHandleKeyDown: $t,
744
+ onResizePointerDown: tn
745
+ }), [
746
+ V,
747
+ E,
748
+ me,
749
+ we,
750
+ K,
751
+ cn,
752
+ kt,
753
+ At,
754
+ jt,
755
+ Ut,
756
+ Wt,
757
+ Gt,
758
+ $t,
759
+ tn
760
+ ]), un = q.filter((e) => e.hidden), dn = et(E, q, K), fn = /* @__PURE__ */ M("p", {
761
+ "data-part": "edit-status",
762
+ "data-part-edit-status": "",
763
+ id: we,
764
+ ...pe ? {} : {
765
+ "data-ui": "visually-hidden",
766
+ ...le("ui", "visually-hidden")
767
+ },
768
+ children: dn
769
+ }), pn = un.length === 0 ? null : /* @__PURE__ */ N(r, { children: [/* @__PURE__ */ M(s, { render: ({ ref: e, ...r }) => /* @__PURE__ */ M(d, {
770
+ ...r,
771
+ size: "sm",
772
+ variant: "outline",
773
+ tone: "secondary",
774
+ start: /* @__PURE__ */ M(n, { children: /* @__PURE__ */ M(t, { name: "plus" }) }),
775
+ render: (t) => /* @__PURE__ */ M("button", {
776
+ ...T(t, "part", "add"),
777
+ ref: e
778
+ }),
779
+ children: E("add")
780
+ }) }), /* @__PURE__ */ M(l, { children: un.map((e) => /* @__PURE__ */ M(i, {
781
+ onSelect: (t) => Kt(e.key, t.reason === "keyboard" ? "keyboard" : "pointer", t.source),
782
+ children: /* @__PURE__ */ M(a, { children: Q(e.key) })
783
+ }, e.key)) })] }), mn = (e, t, n) => /* @__PURE__ */ M(d, {
784
+ size: "sm",
785
+ tone: e === "done" ? "accent" : "secondary",
786
+ variant: e === "done" ? "solid" : e === "cancel" ? "outline" : "ghost",
787
+ onClick: n,
788
+ render: (t) => /* @__PURE__ */ M("button", { ...T(t, "part", e) }),
789
+ children: t
790
+ }), hn = H === null ? null : rn.find((e) => e.key === H.key), gn = ce({
791
+ ...re,
792
+ style: {
793
+ ...De(D),
794
+ ...te
795
+ },
796
+ "data-ui": "dashboard-grid",
797
+ "data-part": "root",
798
+ ...V ? { "data-editing": "" } : {},
799
+ ...Nt === null ? {} : { "data-size-class": Nt },
800
+ ...b === "children" ? { "data-narrow-order": "children" } : {},
801
+ ref: St,
802
+ children: /* @__PURE__ */ N(ye, { children: [
803
+ V && pe ? /* @__PURE__ */ N("div", {
804
+ "data-part": "edit-bar",
805
+ "data-part-edit-bar": "",
806
+ role: "group",
807
+ "aria-label": E("editBar"),
808
+ children: [fn, /* @__PURE__ */ N("div", {
809
+ "data-part": "edit-actions",
810
+ "data-part-edit-actions": "",
811
+ children: [
812
+ pn,
813
+ mn("reset", E("reset"), (e) => Qt(ot(e), e.nativeEvent)),
814
+ mn("cancel", E("cancel"), (e) => Zt(ot(e), e.nativeEvent)),
815
+ mn("done", E("done"), (e) => Xt("submit", e.nativeEvent))
816
+ ]
817
+ })]
818
+ }) : null,
819
+ V && !pe ? fn : null,
820
+ /* @__PURE__ */ N("ul", {
821
+ ref: W,
822
+ "data-part": "grid",
823
+ "data-part-grid": "",
824
+ ...H === null ? {} : { "data-gesture": "" },
825
+ role: "list",
826
+ "aria-label": o,
827
+ "aria-labelledby": c,
828
+ hidden: J.length === 0 || void 0,
829
+ children: [/* @__PURE__ */ N(Ye.Provider, {
830
+ value: null,
831
+ children: [J.map((e) => /* @__PURE__ */ M(de, { children: Je.get(e.key) }, e.key)), Xe]
832
+ }), hn ? /* @__PURE__ */ M("li", {
833
+ ref: Ct,
834
+ "data-part": "placeholder",
835
+ "data-part-placeholder": "",
836
+ "aria-hidden": "true",
837
+ style: {
838
+ ...Ke(hn),
839
+ ...K === "expanded" ? {} : { order: an.findIndex((e) => e.key === hn.key) }
840
+ }
841
+ }) : null]
842
+ }),
843
+ J.length === 0 ? /* @__PURE__ */ M("div", {
844
+ "data-part": "empty",
845
+ "data-part-empty": "",
846
+ children: /* @__PURE__ */ M(oe, {
847
+ status: "empty",
848
+ reach: "section",
849
+ live: "polite",
850
+ children: /* @__PURE__ */ N(ae, { children: [/* @__PURE__ */ M(ie, { children: E("empty") }), V ? /* @__PURE__ */ M(ne, { children: E("emptyEditing") }) : null] })
851
+ })
852
+ }) : null
853
+ ] })
854
+ });
855
+ return /* @__PURE__ */ M(qe.Provider, {
856
+ value: ln,
857
+ children: w === void 0 ? /* @__PURE__ */ M("div", { ...gn }) : w(gn)
858
+ });
859
+ }
860
+ //#endregion
861
+ //#region src/dashboard-grid/dashboard-widget-help.tsx
862
+ function V({ children: e, label: r, title: i }) {
863
+ return /* @__PURE__ */ N(y, {
864
+ align: "start",
865
+ presentation: "auto",
866
+ side: "bottom",
867
+ size: "sm",
868
+ children: [/* @__PURE__ */ M(v, { render: (e) => /* @__PURE__ */ M(f, {
869
+ ...e,
870
+ "aria-label": r,
871
+ inline: !0,
872
+ render: (e) => /* @__PURE__ */ M("button", { ...T(e, "part", "help") }),
873
+ size: "sm",
874
+ tone: "secondary",
875
+ variant: "ghost",
876
+ children: /* @__PURE__ */ M(n, { children: /* @__PURE__ */ M(t, { name: "circle-info" }) })
877
+ }) }), /* @__PURE__ */ M(b, { children: /* @__PURE__ */ M(vt, {
878
+ label: r,
879
+ title: i,
880
+ children: e
881
+ }) })]
882
+ });
883
+ }
884
+ function vt({ children: e, label: t, title: n }) {
885
+ let { sheet: r } = x();
886
+ return /* @__PURE__ */ M(_, {
887
+ "aria-label": r ? n : t,
888
+ children: /* @__PURE__ */ M(S, { children: /* @__PURE__ */ M("div", {
889
+ "data-part": "help-note",
890
+ "data-part-help-note": "",
891
+ children: e
892
+ }) })
893
+ });
894
+ }
895
+ //#endregion
896
+ //#region src/dashboard-grid/dashboard-widget.tsx
897
+ var yt = [
898
+ "start",
899
+ "end",
900
+ "bottom",
901
+ "bottom-start",
902
+ "bottom-end"
903
+ ];
904
+ function H(e, t) {
905
+ typeof e == "function" ? e(t) : e && (e.current = t);
906
+ }
907
+ var bt = (e) => e.reason === "keyboard" ? "keyboard" : "pointer";
908
+ function xt({ register: e, triggerRef: r, ...i }) {
909
+ let a = A(r);
910
+ a.current = r;
911
+ let o = O((t) => {
912
+ e(t), H(a.current, t);
913
+ }, [e]);
914
+ return /* @__PURE__ */ M("button", {
915
+ ...T(i, "part", "handle"),
916
+ type: "button",
917
+ ref: o,
918
+ children: /* @__PURE__ */ M(n, { children: /* @__PURE__ */ M(t, { name: "grip-horizontal" }) })
919
+ });
920
+ }
921
+ function U({ headingLevel: e, defaultColumns: t, defaultRows: n, minColumns: r, maxColumns: i, minRows: a, maxRows: o, rows: s, movable: c, resizable: l, removable: u, loading: d = !1, ref: f, ...p }) {
922
+ let { value: m, title: ee } = p, h = Xe("DashboardWidget"), g = me(Ye);
923
+ ve(() => {
924
+ g?.({
925
+ value: m,
926
+ title: ee,
927
+ rows: s,
928
+ defaultColumns: t,
929
+ defaultRows: n,
930
+ minColumns: r,
931
+ maxColumns: i,
932
+ minRows: a,
933
+ maxRows: o,
934
+ movable: c,
935
+ resizable: l,
936
+ removable: u
937
+ });
938
+ }, [
939
+ g,
940
+ m,
941
+ ee,
942
+ s,
943
+ t,
944
+ n,
945
+ r,
946
+ i,
947
+ a,
948
+ o,
949
+ c,
950
+ l,
951
+ u
952
+ ]);
953
+ let _ = se(), v = h.slots.get(m), y = `${ge()}-title`, b = `${y}-description`, x = w(), S = te({
954
+ delay: x.delay ?? 0,
955
+ loading: d,
956
+ minDuration: x.minDuration ?? 0
957
+ }), { registerWidget: C, registerHandle: ne, registerCard: re } = h, ie = O((e) => {
958
+ C(m, e), H(f, e);
959
+ }, [
960
+ f,
961
+ C,
962
+ m
963
+ ]), ae = O((e) => re(m, e), [re, m]), oe = O((e) => ne(m, e), [ne, m]), ce = e ?? h.headingLevel, le = ce === "auto" ? Math.max(2, _) : ce;
964
+ return v === void 0 ? null : /* @__PURE__ */ M(St, {
965
+ ...p,
966
+ headingLevel: le,
967
+ rows: s,
968
+ drawnSlot: v,
969
+ painted: S,
970
+ titleId: y,
971
+ descriptionId: b,
972
+ setWidget: ie,
973
+ setCard: ae,
974
+ setHandle: oe,
975
+ t: h.t,
976
+ editing: h.editing,
977
+ sizeClass: h.sizeClass,
978
+ statusId: h.statusId,
979
+ move: h.move,
980
+ resize: h.resize,
981
+ hide: h.hide,
982
+ onHandleKeyDown: h.onHandleKeyDown,
983
+ onResizePointerDown: h.onResizePointerDown
984
+ });
985
+ }
986
+ var St = pe(function({ rows: e, value: u, title: _, description: v, help: y, children: b, headingLevel: x, busy: S = !1, status: w = "ready", skeleton: te, emptyTitle: se, emptyDescription: le, emptyAction: E, errorTitle: ue, errorDescription: de, onRetry: D, detailHref: fe, renderDetail: pe, onDetail: O, actions: me, footer: he, fill: ge, size: _e, render: ve, style: k, drawnSlot: A, painted: j, titleId: be, descriptionId: xe, setWidget: Se, setCard: Ce, setHandle: we, t: P, editing: Te, sizeClass: Ee, statusId: De, move: ke, resize: Ae, hide: F, onHandleKeyDown: je, onResizePointerDown: Me, ...Ne }) {
987
+ let { tile: I, can: L } = A, Pe = `h${x}`, Fe = { title: _ }, Ie = Ee !== "expanded", Le = W(y), Re = W(v), ze = /* @__PURE__ */ M(Pe, {
988
+ "data-part": "title",
989
+ "data-part-title": "",
990
+ id: be,
991
+ children: _
992
+ }), Be = fe === void 0 ? O === void 0 ? null : /* @__PURE__ */ M(f, {
993
+ "aria-label": P("detail", Fe),
994
+ size: "sm",
995
+ tone: "secondary",
996
+ variant: "ghost",
997
+ onClick: O,
998
+ render: (e) => /* @__PURE__ */ M("button", { ...T(e, "part", "detail") }),
999
+ children: /* @__PURE__ */ M(n, {
1000
+ directional: !0,
1001
+ children: /* @__PURE__ */ M(t, { name: "external" })
1002
+ })
1003
+ }) : /* @__PURE__ */ M(f, {
1004
+ "aria-label": P("detail", Fe),
1005
+ size: "sm",
1006
+ tone: "secondary",
1007
+ variant: "ghost",
1008
+ render: ({ type: e, disabled: t, ...n }) => {
1009
+ let r = {
1010
+ ...T(n, "part", "detail"),
1011
+ href: fe,
1012
+ onClick: O
1013
+ };
1014
+ return pe === void 0 ? /* @__PURE__ */ M("a", { ...r }) : pe(r);
1015
+ },
1016
+ children: /* @__PURE__ */ M(n, {
1017
+ directional: !0,
1018
+ children: /* @__PURE__ */ M(t, { name: "external" })
1019
+ })
1020
+ }), R = (e) => (t) => ke(u, e, bt(t), t.source), Ve = (e, t) => (n) => Ae(u, {
1021
+ columns: e,
1022
+ rows: t
1023
+ }, bt(n), n.source), He = I.resizable && Ee !== "compact", Ue = Te && (I.movable || He || I.removable) ? /* @__PURE__ */ N(r, { children: [/* @__PURE__ */ M(s, {
1024
+ onKeyDown: (e) => je(u, e),
1025
+ render: ({ ref: e, ...t }) => /* @__PURE__ */ M(xt, {
1026
+ ...t,
1027
+ "aria-label": P("handle", Fe),
1028
+ "aria-describedby": De,
1029
+ "aria-keyshortcuts": Oe(I.removable),
1030
+ register: we,
1031
+ triggerRef: e
1032
+ })
1033
+ }), /* @__PURE__ */ N(l, { children: [
1034
+ I.movable ? /* @__PURE__ */ N(ye, { children: [
1035
+ /* @__PURE__ */ N(i, {
1036
+ disabled: !L.up,
1037
+ onSelect: R("up"),
1038
+ children: [/* @__PURE__ */ M(a, { children: P("moveUp") }), /* @__PURE__ */ M(c, { keys: "Alt+ArrowUp" })]
1039
+ }),
1040
+ /* @__PURE__ */ N(i, {
1041
+ disabled: !L.down,
1042
+ onSelect: R("down"),
1043
+ children: [/* @__PURE__ */ M(a, { children: P("moveDown") }), /* @__PURE__ */ M(c, { keys: "Alt+ArrowDown" })]
1044
+ }),
1045
+ Ie ? null : /* @__PURE__ */ N(ye, { children: [/* @__PURE__ */ N(i, {
1046
+ disabled: !L.left,
1047
+ onSelect: R("left"),
1048
+ children: [/* @__PURE__ */ M(a, { children: P("moveStart") }), /* @__PURE__ */ M(c, { keys: "Alt+ArrowLeft" })]
1049
+ }), /* @__PURE__ */ N(i, {
1050
+ disabled: !L.right,
1051
+ onSelect: R("right"),
1052
+ children: [/* @__PURE__ */ M(a, { children: P("moveEnd") }), /* @__PURE__ */ M(c, { keys: "Alt+ArrowRight" })]
1053
+ })] })
1054
+ ] }) : null,
1055
+ I.movable && He ? /* @__PURE__ */ M(o, {}) : null,
1056
+ He ? /* @__PURE__ */ N(ye, { children: [
1057
+ /* @__PURE__ */ N(i, {
1058
+ disabled: !L.wider,
1059
+ onSelect: Ve(1, 0),
1060
+ children: [/* @__PURE__ */ M(a, { children: P("wider") }), /* @__PURE__ */ M(c, { keys: "Shift+ArrowRight" })]
1061
+ }),
1062
+ /* @__PURE__ */ N(i, {
1063
+ disabled: !L.narrower,
1064
+ onSelect: Ve(-1, 0),
1065
+ children: [/* @__PURE__ */ M(a, { children: P("narrower") }), /* @__PURE__ */ M(c, { keys: "Shift+ArrowLeft" })]
1066
+ }),
1067
+ /* @__PURE__ */ N(i, {
1068
+ disabled: !L.taller,
1069
+ onSelect: Ve(0, 1),
1070
+ children: [/* @__PURE__ */ M(a, { children: P("taller") }), /* @__PURE__ */ M(c, { keys: "Shift+ArrowDown" })]
1071
+ }),
1072
+ /* @__PURE__ */ N(i, {
1073
+ disabled: !L.shorter,
1074
+ onSelect: Ve(0, -1),
1075
+ children: [/* @__PURE__ */ M(a, { children: P("shorter") }), /* @__PURE__ */ M(c, { keys: "Shift+ArrowUp" })]
1076
+ })
1077
+ ] }) : null,
1078
+ I.removable ? /* @__PURE__ */ N(ye, { children: [I.movable || He ? /* @__PURE__ */ M(o, {}) : null, /* @__PURE__ */ N(i, {
1079
+ tone: "danger",
1080
+ onSelect: (e) => F(u, "remove", e.source),
1081
+ children: [/* @__PURE__ */ M(a, { children: P("hide") }), /* @__PURE__ */ M(c, { keys: "Delete" })]
1082
+ })] }) : null
1083
+ ] })] }) : null, We = (e) => /* @__PURE__ */ M("div", {
1084
+ "data-part": "message",
1085
+ "data-part-message": "",
1086
+ children: /* @__PURE__ */ N(oe, {
1087
+ status: e,
1088
+ reach: "section",
1089
+ align: "center",
1090
+ live: e === "error" ? "polite" : "off",
1091
+ children: [
1092
+ /* @__PURE__ */ N(ae, { children: [/* @__PURE__ */ M(ie, { children: e === "empty" ? se ?? P("emptyTitle") : ue ?? P("errorTitle") }), (e === "empty" ? le : de) === void 0 ? null : /* @__PURE__ */ M(ne, { children: e === "empty" ? le : de })] }),
1093
+ e === "empty" && E !== void 0 ? /* @__PURE__ */ M(re, { children: E }) : null,
1094
+ e === "error" && D !== void 0 ? /* @__PURE__ */ M(re, { children: /* @__PURE__ */ M(d, {
1095
+ size: "sm",
1096
+ tone: "secondary",
1097
+ variant: "outline",
1098
+ start: /* @__PURE__ */ M(n, { children: /* @__PURE__ */ M(t, { name: "rotate-ccw" }) }),
1099
+ onClick: D,
1100
+ render: (e) => /* @__PURE__ */ M("button", { ...T(e, "part", "retry") }),
1101
+ children: P("retry")
1102
+ }) }) : null
1103
+ ]
1104
+ })
1105
+ }), Ge = j ? /* @__PURE__ */ M("div", {
1106
+ "data-part": "skeleton",
1107
+ "data-part-skeleton": "",
1108
+ children: te ?? /* @__PURE__ */ M(C, { shape: "block" })
1109
+ }) : w === "empty" ? We("empty") : w === "error" ? We("error") : b, qe = ce({
1110
+ ...Ne,
1111
+ style: {
1112
+ ...Ke(I),
1113
+ ...A.order === void 0 ? {} : { order: A.order },
1114
+ ...A.child === void 0 ? {} : { "--_dg-child": String(A.child) },
1115
+ ...k
1116
+ },
1117
+ "data-part": "widget",
1118
+ "data-key": u,
1119
+ "data-rows": e,
1120
+ "data-status": w,
1121
+ ...j ? { "data-loading": "" } : {},
1122
+ ...I.movable ? { "data-movable": "" } : {},
1123
+ ...I.resizable ? { "data-resizable": "" } : {},
1124
+ ...A.dragging ? { "data-dragging": "" } : {},
1125
+ ...A.resizing ? { "data-resizing": "" } : {},
1126
+ ref: Se,
1127
+ children: /* @__PURE__ */ N(ye, { children: [
1128
+ /* @__PURE__ */ N(m, {
1129
+ fill: ge,
1130
+ size: _e,
1131
+ render: (e) => /* @__PURE__ */ M("article", {
1132
+ ...e,
1133
+ ref: Ce,
1134
+ "aria-labelledby": be,
1135
+ "aria-describedby": Re ? xe : void 0,
1136
+ "aria-busy": j || S || void 0
1137
+ }),
1138
+ children: [
1139
+ /* @__PURE__ */ N(ee, { children: [
1140
+ Le ? /* @__PURE__ */ N("div", {
1141
+ "data-part": "title-row",
1142
+ "data-part-title-row": "",
1143
+ children: [ze, /* @__PURE__ */ M(V, {
1144
+ label: P("help", Fe),
1145
+ title: _,
1146
+ children: y
1147
+ })]
1148
+ }) : ze,
1149
+ Re ? /* @__PURE__ */ M("p", {
1150
+ "data-part": "description",
1151
+ "data-part-description": "",
1152
+ id: xe,
1153
+ children: v
1154
+ }) : null,
1155
+ W(me) || Be !== null ? /* @__PURE__ */ N(g, { children: [me, Be] }) : null
1156
+ ] }),
1157
+ /* @__PURE__ */ N(h, { children: [S && !j ? /* @__PURE__ */ M("span", {
1158
+ "data-part": "busy-indicator",
1159
+ "data-part-busy-indicator": "",
1160
+ "aria-hidden": "true"
1161
+ }) : null, Ge] }),
1162
+ W(he) ? /* @__PURE__ */ M(p, { children: he }) : null
1163
+ ]
1164
+ }),
1165
+ Ue,
1166
+ Te && He ? yt.map((e) => /* @__PURE__ */ M("span", {
1167
+ "data-part": "resize-handle",
1168
+ "data-part-resize-handle": "",
1169
+ "data-edge": e,
1170
+ ...A.edge === e ? { "data-active": "" } : {},
1171
+ "aria-hidden": "true",
1172
+ onPointerDown: (t) => Me(u, e, t)
1173
+ }, e)) : null,
1174
+ A.readout === null ? null : /* @__PURE__ */ M("span", {
1175
+ "data-part": "size-readout",
1176
+ "data-part-size-readout": "",
1177
+ "data-edge": A.edge ?? void 0,
1178
+ "aria-hidden": "true",
1179
+ children: A.readout
1180
+ })
1181
+ ] })
1182
+ });
1183
+ return ve === void 0 ? /* @__PURE__ */ M("li", { ...qe }) : ve(qe);
1184
+ });
1185
+ function W(e) {
1186
+ return e != null && e !== !1 && e !== "";
1187
+ }
1188
+ //#endregion
1189
+ //#region src/dashboard-grid/use-persisted-dashboard-layout.ts
1190
+ var Ct = [];
1191
+ function G() {
1192
+ try {
1193
+ return typeof window > "u" ? null : window.localStorage;
1194
+ } catch {
1195
+ return null;
1196
+ }
1197
+ }
1198
+ function wt({ key: e, storage: t, defaultLayout: n = Ct, subscribe: r }) {
1199
+ let i = k(() => t === void 0 ? G() : t, [t]), [a, o] = j(() => Tt(i, e, n));
1200
+ return he(() => {
1201
+ if (r !== void 0) return r(() => o(Tt(i, e, n)));
1202
+ }, [
1203
+ n,
1204
+ e,
1205
+ i,
1206
+ r
1207
+ ]), {
1208
+ layout: a,
1209
+ defaultLayout: n,
1210
+ onLayoutChange: O((t) => {
1211
+ o(t);
1212
+ try {
1213
+ i?.setItem(e, R(t));
1214
+ } catch {}
1215
+ }, [e, i]),
1216
+ clear: O(() => {
1217
+ o(n);
1218
+ try {
1219
+ i?.removeItem(e);
1220
+ } catch {}
1221
+ }, [
1222
+ n,
1223
+ e,
1224
+ i
1225
+ ])
1226
+ };
1227
+ }
1228
+ function Tt(e, t, n) {
1229
+ let r;
1230
+ try {
1231
+ r = e?.getItem(t) ?? null;
1232
+ } catch {
1233
+ r = null;
1234
+ }
1235
+ return (r === null ? null : L(r)) ?? n;
1236
+ }
1237
+ //#endregion
1238
+ export { z as a, Ze as i, U as n, $e as o, _t as r, wt as t };