@slotted/react 0.1.0-beta.0 → 0.1.0-beta.2

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