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