@slotted/react 0.1.0-beta.30 → 0.1.0-beta.31

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 (118) hide show
  1. package/dist/dashboard-grid-YMoSW5C1.js +1178 -0
  2. package/dist/dashboard-grid.js +1 -1
  3. package/dist/docs/alert.json +1 -1
  4. package/dist/docs/alert.md +1 -1
  5. package/dist/docs/app-shell.json +1 -1
  6. package/dist/docs/app-shell.md +1 -1
  7. package/dist/docs/card.json +1 -0
  8. package/dist/docs/card.md +1 -1
  9. package/dist/docs/cascader.json +1 -0
  10. package/dist/docs/cascader.md +1 -1
  11. package/dist/docs/collapsible.json +1 -0
  12. package/dist/docs/collapsible.md +1 -1
  13. package/dist/docs/combobox.json +1 -0
  14. package/dist/docs/combobox.md +1 -1
  15. package/dist/docs/dashboard-grid.json +21 -0
  16. package/dist/docs/dashboard-grid.md +3 -0
  17. package/dist/docs/dialog.json +2 -0
  18. package/dist/docs/dialog.md +1 -1
  19. package/dist/docs/drawer.json +1 -0
  20. package/dist/docs/drawer.md +1 -1
  21. package/dist/docs/entity-picker.json +1 -0
  22. package/dist/docs/entity-picker.md +1 -1
  23. package/dist/docs/form.json +1 -1
  24. package/dist/docs/form.md +1 -1
  25. package/dist/docs/import-export-center.json +1 -0
  26. package/dist/docs/import-export-center.md +1 -1
  27. package/dist/docs/list.examples.md +721 -0
  28. package/dist/docs/list.json +120 -32
  29. package/dist/docs/list.md +58 -140
  30. package/dist/docs/menu.json +1 -0
  31. package/dist/docs/menu.md +1 -1
  32. package/dist/docs/multi-select.json +1 -0
  33. package/dist/docs/multi-select.md +1 -1
  34. package/dist/docs/navigation-menu.json +1 -0
  35. package/dist/docs/navigation-menu.md +1 -1
  36. package/dist/docs/notification-center.json +1 -0
  37. package/dist/docs/notification-center.md +1 -1
  38. package/dist/docs/page-header.json +1 -1
  39. package/dist/docs/page-header.md +1 -1
  40. package/dist/docs/popover.json +1 -0
  41. package/dist/docs/popover.md +1 -1
  42. package/dist/docs/result-state.json +1 -0
  43. package/dist/docs/result-state.md +1 -1
  44. package/dist/docs/section.json +1 -1
  45. package/dist/docs/section.md +1 -1
  46. package/dist/docs/select.json +1 -0
  47. package/dist/docs/select.md +1 -1
  48. package/dist/docs/skills/compose-screen/SKILL.md +5 -0
  49. package/dist/docs/skills/review-screen/SKILL.md +23 -22
  50. package/dist/docs/toast.json +1 -0
  51. package/dist/docs/toast.md +1 -1
  52. package/dist/docs/tokens.md +8 -0
  53. package/dist/docs/tour.json +1 -0
  54. package/dist/docs/tour.md +1 -1
  55. package/dist/index.js +1 -1
  56. package/dist/styles/action-bar.css +1 -1
  57. package/dist/styles/action-sheet.css +1 -1
  58. package/dist/styles/alert.css +1 -1
  59. package/dist/styles/app-shell.css +1 -1
  60. package/dist/styles/card.css +1 -1
  61. package/dist/styles/cascader.css +1 -1
  62. package/dist/styles/chart.css +1 -1
  63. package/dist/styles/code-block.css +1 -1
  64. package/dist/styles/collapsible.css +1 -1
  65. package/dist/styles/color-picker.css +2 -2
  66. package/dist/styles/column-manager.css +3 -3
  67. package/dist/styles/combobox.css +1 -1
  68. package/dist/styles/command-palette.css +1 -1
  69. package/dist/styles/context-menu.css +1 -1
  70. package/dist/styles/dashboard-grid.css +6 -4
  71. package/dist/styles/data-grid.css +5 -5
  72. package/dist/styles/data-list.css +2 -2
  73. package/dist/styles/detail-panel.css +2 -2
  74. package/dist/styles/dialog.css +1 -1
  75. package/dist/styles/drawer.css +1 -1
  76. package/dist/styles/entity-picker.css +2 -2
  77. package/dist/styles/event-calendar.css +3 -3
  78. package/dist/styles/filter-bar.css +5 -5
  79. package/dist/styles/form.css +1 -1
  80. package/dist/styles/hover-card.css +1 -1
  81. package/dist/styles/import-export-center.css +5 -5
  82. package/dist/styles/index.css +26 -26
  83. package/dist/styles/markdown.css +2 -2
  84. package/dist/styles/media-viewer.css +1 -1
  85. package/dist/styles/menu.css +1 -1
  86. package/dist/styles/menubar.css +1 -1
  87. package/dist/styles/message.css +1 -1
  88. package/dist/styles/multi-select.css +1 -1
  89. package/dist/styles/navigation-menu.css +1 -1
  90. package/dist/styles/notification-center.css +1 -1
  91. package/dist/styles/page-header.css +1 -1
  92. package/dist/styles/popover.css +1 -1
  93. package/dist/styles/result-state.css +1 -1
  94. package/dist/styles/saved-views.css +2 -2
  95. package/dist/styles/scroll-area.css +1 -1
  96. package/dist/styles/section.css +1 -1
  97. package/dist/styles/select.css +1 -1
  98. package/dist/styles/side-navigation.css +2 -2
  99. package/dist/styles/split-button.css +1 -1
  100. package/dist/styles/table.css +2 -2
  101. package/dist/styles/toast.css +1 -1
  102. package/dist/styles/toolbar.css +1 -1
  103. package/dist/styles/top-navigation.css +2 -2
  104. package/dist/styles/tour.css +1 -1
  105. package/dist/styles/upload.css +1 -1
  106. package/dist/styles/wizard.css +2 -2
  107. package/dist/styles.css +1 -1
  108. package/dist/types/dashboard-grid/dashboard-grid.types.d.ts +5 -0
  109. package/dist/types/dashboard-grid/dashboard-grid.types.d.ts.map +1 -1
  110. package/dist/types/dashboard-grid/dashboard-widget-help.d.ts +12 -0
  111. package/dist/types/dashboard-grid/dashboard-widget-help.d.ts.map +1 -0
  112. package/dist/types/dashboard-grid/dashboard-widget.d.ts.map +1 -1
  113. package/dist/types/dialog/dialog.types.d.ts +6 -2
  114. package/dist/types/dialog/dialog.types.d.ts.map +1 -1
  115. package/dist/types/drawer/drawer.types.d.ts +6 -2
  116. package/dist/types/drawer/drawer.types.d.ts.map +1 -1
  117. package/package.json +6 -6
  118. package/dist/dashboard-grid-De6al1Mj.js +0 -1149
@@ -0,0 +1,1178 @@
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-DNQDoJnd.js";
4
+ /* empty css */
5
+ import { n as u, t as d } from "./icon-button-DERKFHX1.js";
6
+ import { a as f, c as p, i as m, o as ee, s as h } from "./card-DRmq8_5e.js";
7
+ import { i as g, o as _, r as v } from "./skeleton-DeEOmm1y.js";
8
+ import { a as y, d as b, f as x, l as S, r as C } from "./popover-BfEn2wdZ.js";
9
+ import { i as te, n as w, o as ne, r as re, t as ie } from "./result-state-BMYhelu1.js";
10
+ import { i as ae } from "./typography-BESqb4C0.js";
11
+ import { keyedProps as oe, selectorKeyProps as se, withSelectorKey as T } from "@slotted/core/selector-key";
12
+ import { createControllable as ce } from "@slotted/core/state";
13
+ import { Children as E, Fragment as le, createContext as ue, isValidElement as de, memo as D, useCallback as O, useContext as k, useEffect as fe, useId as pe, useImperativeHandle as me, useLayoutEffect as he, useMemo as A, useRef as j, useState as M } from "react";
14
+ import { Fragment as ge, jsx as N, jsxs as P } from "react/jsx-runtime";
15
+ import { dashboardGridMessages as F, dragMessages as _e } from "@slotted/core/i18n";
16
+ import { getLiveAnnouncer as ve } from "@slotted/core/live-announcer";
17
+ import { createDragController as ye } from "@slotted/core/drag";
18
+ import { DASHBOARD_SUBROWS as be, cellAt as xe, dashboardKeyIntent as Se, gridStyle as I, handleShortcuts as Ce, layoutsEqual as we, materializeLayout as L, measureTiles as Te, moveTile as Ee, moveTileBy as De, observeContentSpan as Oe, parseDashboardLayout as ke, parseDuration as Ae, playFlip as je, playResize as R, resizeTileBy as z, resizeTileInClass as Me, resolveColumns as Ne, resolveTiles as Pe, serializeDashboardLayout as Fe, setTileHidden as Ie, sizeClassOf as Le, spanFromTravel as Re, swapTiles as ze, tileStyle as Be } from "@slotted/core/dashboard-grid";
19
+ //#region src/dashboard-grid/dashboard-grid-context.ts
20
+ var Ve = ue(null), He = [
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
+ ], Ue = ue(null);
34
+ function B(e) {
35
+ let t = k(Ve);
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 We = {
42
+ columns: 12,
43
+ editBar: !0,
44
+ headingLevel: "auto"
45
+ }, Ge = ue(We);
46
+ function Ke() {
47
+ return k(Ge);
48
+ }
49
+ function qe({ children: e, ...t }) {
50
+ let n = Ke();
51
+ return /* @__PURE__ */ N(Ge.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 Je = [], Ye = "dashboard-grid", Xe = "\0placeholder";
63
+ function Ze(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 ce({
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 Qe(e) {
90
+ return e.detail === 0 ? "keyboard" : "pointer";
91
+ }
92
+ function $e(e) {
93
+ return e === null || typeof getComputedStyle != "function" ? "ltr" : getComputedStyle(e).direction === "rtl" ? "rtl" : "ltr";
94
+ }
95
+ function et(e, t) {
96
+ return e !== null && e.clientWidth > 0 ? Le(e.clientWidth, t) : "expanded";
97
+ }
98
+ function tt(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 nt(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) * be;
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 rt(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 it = [
134
+ "inset-inline-start",
135
+ "inset-block-start",
136
+ "inline-size",
137
+ "block-size",
138
+ "translate"
139
+ ];
140
+ function at(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 ot(e) {
144
+ if (e !== void 0) for (let t of it) e.style.removeProperty(t);
145
+ }
146
+ function st(e, t = []) {
147
+ return E.forEach(e, (e) => {
148
+ de(e) && e.type === le ? st(e.props.children, t) : t.push(e);
149
+ }), t;
150
+ }
151
+ function ct(e, t) {
152
+ return e !== void 0 && He.every((n) => e[n] === t[n]);
153
+ }
154
+ function lt(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 V({ "aria-label": o, "aria-labelledby": c, children: d, columns: f, defaultEditing: p = !1, defaultLayout: m = Je, editBar: ee, editing: h, expandedFrom: g, headingLevel: _, layout: v, messages: y, onEditingChange: b, onLayoutChange: x, ref: S, render: C, style: w, ...ae }) {
159
+ let ce = Ke(), E = e(F, y), ue = e(_e), D = A(() => Ne(f ?? ce.columns), [f, ce.columns]), k = ee ?? ce.editBar, be = _ ?? ce.headingLevel, Ce = `${pe()}-edit-status`, [ke, Fe] = M(() => /* @__PURE__ */ new Map()), Le = j(/* @__PURE__ */ new Map()), He = O((e) => {
160
+ let t = Le.current.get(e);
161
+ return t === void 0 && (t = (t) => Fe((n) => ct(n.get(e), t) ? n : new Map(n).set(e, t)), Le.current.set(e, t)), t;
162
+ }, []), { declarations: B, elements: We, pending: Ge } = A(() => {
163
+ let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), n = [], r = 0;
164
+ for (let i of st(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(Ue.Provider, {
173
+ value: He(o),
174
+ children: i
175
+ }, `host-${o}`), c = ke.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
+ ke,
190
+ He
191
+ ]), [qe, it] = M(() => /* @__PURE__ */ new Map()), V = A(() => [...B.values()].map((e) => tt(e, qe)), [B, qe]), ut = A(() => new Map([...B].map(([e, t]) => [e, t.title])), [B]), [H, dt] = Ze(v, m, x, we), [U, ft] = Ze(h, p, b), W = A(() => Pe(H, V, D), [
192
+ H,
193
+ V,
194
+ D
195
+ ]), G = A(() => W.filter((e) => !e.hidden), [W]), [K, pt] = M(null), mt = j(null), [q, ht] = M(null), gt = j(null), _t = j(null), J = j(/* @__PURE__ */ new Map()), vt = j(/* @__PURE__ */ new Map()), yt = j(/* @__PURE__ */ new Map()), [bt, xt] = M(0), St = 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
+ xt((e) => e + 1);
205
+ }, []), Ct = O((e, t) => St(J.current, e, t), [St]), wt = O((e, t) => St(vt.current, e, t), [St]), Tt = O((e, t) => St(yt.current, e, t), [St]), Et = [...B.values()].filter((e) => e.rows === "auto").map((e) => e.value).join("\n");
206
+ fe(() => {
207
+ let e = gt.current;
208
+ if (e === null || Et === "") return;
209
+ let t = Et.split("\n").map((t) => {
210
+ let n = yt.current.get(t);
211
+ return n === void 0 ? () => {} : Oe(n, e, (e) => it((n) => new Map(n).set(t, e)));
212
+ });
213
+ return () => {
214
+ for (let e of t) e();
215
+ };
216
+ }, [Et, bt]);
217
+ let [Dt, Ot] = M(null), Y = Dt ?? "expanded";
218
+ fe(() => {
219
+ if (!q || typeof ResizeObserver > "u") return;
220
+ let e = () => Ot(q.clientWidth > 0 ? et(q, g) : null), t = new ResizeObserver(e);
221
+ return t.observe(q), e(), () => t.disconnect();
222
+ }, [q, g]);
223
+ let kt = j(null), At = j(null), X = j(null), jt = O(() => {
224
+ let e = new Map(J.current), t = mt.current?.key;
225
+ t !== void 0 && e.delete(t), _t.current && e.set(Xe, _t.current), kt.current = Te(e);
226
+ }, []), Mt = O((e) => {
227
+ jt(), mt.current = e, pt(e);
228
+ }, [jt]), Nt = O((e) => {
229
+ let t = q?.ownerDocument;
230
+ t && e !== "" && ve(t).announce(e);
231
+ }, [q]), Z = j({
232
+ layout: H,
233
+ widgets: V,
234
+ grid: D,
235
+ tiles: W,
236
+ visible: G,
237
+ t: E,
238
+ dragT: ue,
239
+ titles: ut,
240
+ editing: U
241
+ });
242
+ Z.current = {
243
+ layout: H,
244
+ widgets: V,
245
+ grid: D,
246
+ tiles: W,
247
+ visible: G,
248
+ t: E,
249
+ dragT: ue,
250
+ titles: ut,
251
+ editing: U
252
+ };
253
+ let Q = O((e) => Z.current.titles.get(e) ?? e, []), $ = O((e, t, n, r, i) => {
254
+ let a = Z.current, o = L(e, a.widgets, a.grid);
255
+ return !we(o, L(a.layout, a.widgets, a.grid)) && (kt.current === null && jt(), dt(o, t, r, { change: n }) ? (Nt(i(o)), !0) : (kt.current = null, !1));
256
+ }, [
257
+ Nt,
258
+ jt,
259
+ dt
260
+ ]), Pt = O(() => et(q, g), [q, g]), Ft = O((e, t) => (n) => {
261
+ let r = Z.current, i = Pe(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 = Pe(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 = De(i.layout, i.widgets, i.grid, e, t, a);
280
+ X.current = e, $(o, n, {
281
+ kind: "move",
282
+ key: e
283
+ }, r, Ft(e, a)) || (X.current = null);
284
+ }, [
285
+ $,
286
+ Ft,
287
+ Pt
288
+ ]), Rt = O((e, t, n, r) => {
289
+ let i = Z.current, a = Pt(), o = z(i.layout, i.widgets, i.grid, e, t, a);
290
+ X.current = e, $(o, n, {
291
+ kind: "resize",
292
+ key: e
293
+ }, r, It(e, a)) || (X.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
+ X.current = o?.key ?? `${Ye}:add`;
303
+ let s = Ie(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) })) || (X.current = null);
308
+ }, [$, Q]), Bt = O((e, t, n) => {
309
+ let r = Z.current;
310
+ X.current = e;
311
+ let i = Ie(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
+ he(() => {
318
+ if (U && !Ut.current) {
319
+ let e = Z.current;
320
+ Vt.current = L(e.layout, e.widgets, e.grid), Ht.current = q?.ownerDocument.activeElement ?? null;
321
+ }
322
+ if (!U && Ut.current) {
323
+ let e = q?.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 = U;
327
+ }, [U, q]);
328
+ let Wt = O((e, t) => {
329
+ ft(!1, e, t);
330
+ }, [ft]), 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")), ft(!1, e, t);
336
+ }, [$, ft]), 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 = Se(t, $e(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 = gt.current, o = J.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 = $e(a) === "rtl", u = nt(a, r.grid[s]), d = rt(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
+ }, _ = L(r.layout, r.widgets, r.grid);
373
+ at(o, d), Mt({
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 = Re({
386
+ span: p,
387
+ track: u.track,
388
+ gap: u.columnGap,
389
+ travel: y - d.inlineSize
390
+ }), C = h ? Re({
391
+ span: i.h,
392
+ track: u.row,
393
+ gap: u.rowGap,
394
+ travel: b - d.blockSize
395
+ }) : i.h, te = m ? i.x + i.w - S : i.x;
396
+ if (S === g.w && C === g.h && te === g.x) return;
397
+ g = {
398
+ x: te,
399
+ y: i.y,
400
+ w: S,
401
+ h: C
402
+ };
403
+ let w = Z.current;
404
+ _ = Me(w.layout, w.widgets, w.grid, e, g, s), Mt({
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
+ At.current = {
415
+ key: e,
416
+ box: {
417
+ left: r.left,
418
+ top: r.top,
419
+ width: r.width,
420
+ height: r.height
421
+ }
422
+ }, ot(o), Mt(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
+ Mt,
436
+ Pt
437
+ ]);
438
+ fe(() => () => Jt.current?.(), []), fe(() => {
439
+ let e = gt.current;
440
+ if (!q || !U || e === null) return;
441
+ let t = q.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 ze(n.layout, n.widgets, n.grid, e, t.slice(5));
457
+ let [r, i] = t.split(",").map(Number);
458
+ return Ee(n.layout, n.widgets, n.grid, e, {
459
+ x: r ?? 0,
460
+ y: i ?? 0
461
+ });
462
+ }, u = ye({
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 = xe({
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 J.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: Ye,
503
+ key: i
504
+ };
505
+ },
506
+ onTargetChange: ({ state: e }) => {
507
+ let t = e.items[0];
508
+ t !== void 0 && e.target?.kind === "on" && Mt({
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" && (X.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: Ye,
523
+ items: n,
524
+ orientation: "grid",
525
+ targets: ["on"],
526
+ element: () => e,
527
+ itemElement: (e) => J.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
+ q.addEventListener("click", m, !0);
534
+ let ee = u.subscribe((t) => {
535
+ if (t.status !== "dragging") {
536
+ if (p !== null) {
537
+ let e = J.current.get(p);
538
+ if (e) {
539
+ let t = e.getBoundingClientRect();
540
+ At.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
+ ot(e), f = t.reason === "pointer" || t.reason === null, window.setTimeout(() => {
551
+ f = !1;
552
+ }, 0), p = null, i = null, mt.current?.kind === "move" && Mt(null);
553
+ }
554
+ return;
555
+ }
556
+ let n = t.items[0];
557
+ if (n === void 0 || r === null) return;
558
+ let c = J.current.get(n);
559
+ c !== void 0 && (p === null && (p = n, a = et(q), o = $e(e) === "rtl", s = nt(e, Z.current.grid[a]), at(c, rt(c, e, o)), Mt({
560
+ kind: "move",
561
+ key: n,
562
+ preview: L(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 = J.current.get(e.key);
568
+ if (t === void 0) continue;
569
+ let n = yt.current.get(e.key), r = vt.current.get(e.key);
570
+ n && h.push(u.attachDraggable(t, {
571
+ container: Ye,
572
+ key: e.key,
573
+ handle: () => n,
574
+ canDrag: (e) => e.pointerType !== "touch"
575
+ })), r && h.push(u.attachDraggable(t, {
576
+ container: Ye,
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), q.removeEventListener("click", m, !0), ee(), d(), u.destroy();
585
+ };
586
+ }, [
587
+ q,
588
+ U,
589
+ bt,
590
+ $,
591
+ Ft,
592
+ Mt,
593
+ Q
594
+ ]);
595
+ let Xt = A(() => JSON.stringify(L(H, V, D)), [
596
+ H,
597
+ V,
598
+ D
599
+ ]);
600
+ he(() => {
601
+ if (q === null) return;
602
+ let e = getComputedStyle(q), t = {
603
+ duration: Ae(e.getPropertyValue("--slotted-duration-medium")),
604
+ easing: e.getPropertyValue("--slotted-easing-standard").trim() || "ease"
605
+ }, n = kt.current;
606
+ if (n !== null) {
607
+ kt.current = null;
608
+ let e = new Map(J.current), r = mt.current?.key;
609
+ r !== void 0 && e.delete(r), _t.current && e.set(Xe, _t.current), je(e, n, t);
610
+ }
611
+ let r = At.current;
612
+ if (r !== null && mt.current === null) {
613
+ At.current = null;
614
+ let e = J.current.get(r.key);
615
+ e && R(e, r.box, t);
616
+ }
617
+ let i = X.current;
618
+ if (i === null) return;
619
+ X.current = null;
620
+ let a = i === `${Ye}:add` ? q.querySelector("[data-part=\"add\"]") : Z.current.editing ? vt.current.get(i) : null;
621
+ a && a !== q.ownerDocument.activeElement && a.focus();
622
+ }, [
623
+ Xt,
624
+ K,
625
+ q
626
+ ]), me(S, () => ({
627
+ get element() {
628
+ return q;
629
+ },
630
+ focusWidget: (e) => {
631
+ ((Z.current.editing ? vt.current.get(e) : void 0) ?? J.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
+ q
639
+ ]);
640
+ let Zt = A(() => K === null ? W : Pe(K.preview, V, D), [
641
+ K,
642
+ W,
643
+ V,
644
+ D
645
+ ]), Qt = A(() => Zt.filter((e) => !e.hidden), [Zt]), $t = A(() => {
646
+ let e = /* @__PURE__ */ new Map(), t = L(H, V, D), n = (e) => !we(L(e, V, D), t);
647
+ for (let t of G) {
648
+ let r = (e) => U && n(De(H, V, D, t.key, e, Y)), i = (e, r) => U && n(z(H, V, D, t.key, {
649
+ columns: e,
650
+ rows: r
651
+ }, Y));
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
+ G,
666
+ U,
667
+ H,
668
+ V,
669
+ D,
670
+ Y
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 G) {
674
+ let r = Zt.find((e) => e.key === n.key) ?? n, i = K !== null && K.key === n.key, a = i && K.kind === "resize", o = {
675
+ tile: r,
676
+ order: K === null || Y === "expanded" ? void 0 : t.get(n.key),
677
+ dragging: i && K.kind === "move",
678
+ resizing: a,
679
+ edge: a ? K.edge : null,
680
+ readout: a ? E("size", {
681
+ columns: K.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 && lt(s, o) ? s : o);
687
+ }
688
+ return e;
689
+ }, [
690
+ Zt,
691
+ Qt,
692
+ G,
693
+ K,
694
+ E,
695
+ $t,
696
+ Y
697
+ ]);
698
+ he(() => {
699
+ en.current = tn;
700
+ }, [tn]);
701
+ let nn = A(() => ({
702
+ editing: U,
703
+ t: E,
704
+ headingLevel: be,
705
+ statusId: Ce,
706
+ sizeClass: Y,
707
+ slots: tn,
708
+ registerWidget: Ct,
709
+ registerHandle: wt,
710
+ registerCard: Tt,
711
+ move: Lt,
712
+ resize: Rt,
713
+ hide: zt,
714
+ onHandleKeyDown: qt,
715
+ onResizePointerDown: Yt
716
+ }), [
717
+ U,
718
+ E,
719
+ be,
720
+ Ce,
721
+ Y,
722
+ tn,
723
+ Ct,
724
+ wt,
725
+ Tt,
726
+ Lt,
727
+ Rt,
728
+ zt,
729
+ qt,
730
+ Yt
731
+ ]), rn = W.filter((e) => e.hidden), an = /* @__PURE__ */ N("p", {
732
+ "data-part": "edit-status",
733
+ "data-part-edit-status": "",
734
+ id: Ce,
735
+ ...k ? {} : {
736
+ "data-ui": "visually-hidden",
737
+ ...se("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 = K === null ? null : Zt.find((e) => e.key === K.key), ln = oe({
762
+ ...ae,
763
+ style: {
764
+ ...I(D),
765
+ ...w
766
+ },
767
+ "data-ui": "dashboard-grid",
768
+ "data-part": "root",
769
+ ...U ? { "data-editing": "" } : {},
770
+ ...Dt === null ? {} : { "data-size-class": Dt },
771
+ ref: ht,
772
+ children: /* @__PURE__ */ P(ge, { children: [
773
+ U && k ? /* @__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(Qe(e), e.nativeEvent)),
784
+ sn("cancel", E("cancel"), (e) => Gt(Qe(e), e.nativeEvent)),
785
+ sn("done", E("done"), (e) => Wt("submit", e.nativeEvent))
786
+ ]
787
+ })]
788
+ }) : null,
789
+ U && !k ? an : null,
790
+ /* @__PURE__ */ P("ul", {
791
+ ref: gt,
792
+ "data-part": "grid",
793
+ "data-part-grid": "",
794
+ ...K === null ? {} : { "data-gesture": "" },
795
+ role: "list",
796
+ "aria-label": o,
797
+ "aria-labelledby": c,
798
+ hidden: G.length === 0 || void 0,
799
+ children: [/* @__PURE__ */ P(Ue.Provider, {
800
+ value: null,
801
+ children: [G.map((e) => /* @__PURE__ */ N(le, { children: We.get(e.key) }, e.key)), Ge]
802
+ }), cn ? /* @__PURE__ */ N("li", {
803
+ ref: _t,
804
+ "data-part": "placeholder",
805
+ "data-part-placeholder": "",
806
+ "aria-hidden": "true",
807
+ style: {
808
+ ...Be(cn),
809
+ ...Y === "expanded" ? {} : { order: Qt.findIndex((e) => e.key === cn.key) }
810
+ }
811
+ }) : null]
812
+ }),
813
+ G.length === 0 ? /* @__PURE__ */ N("div", {
814
+ "data-part": "empty",
815
+ "data-part-empty": "",
816
+ children: /* @__PURE__ */ N(ie, {
817
+ status: "empty",
818
+ reach: "section",
819
+ live: "polite",
820
+ children: /* @__PURE__ */ P(re, { children: [/* @__PURE__ */ N(ne, { children: E("empty") }), U ? /* @__PURE__ */ N(te, { children: E("emptyEditing") }) : null] })
821
+ })
822
+ }) : null
823
+ ] })
824
+ });
825
+ return /* @__PURE__ */ N(Ve.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 ut({ children: e, label: r }) {
833
+ return /* @__PURE__ */ P(x, {
834
+ align: "start",
835
+ side: "bottom",
836
+ size: "sm",
837
+ children: [/* @__PURE__ */ N(b, { render: (e) => /* @__PURE__ */ N(d, {
838
+ ...e,
839
+ "aria-label": r,
840
+ render: (e) => /* @__PURE__ */ N("button", { ...T(e, "part", "help") }),
841
+ size: "sm",
842
+ tone: "secondary",
843
+ variant: "ghost",
844
+ children: /* @__PURE__ */ N(n, { children: /* @__PURE__ */ N(t, { name: "circle-info" }) })
845
+ }) }), /* @__PURE__ */ N(S, { children: /* @__PURE__ */ N(y, {
846
+ "aria-label": r,
847
+ children: /* @__PURE__ */ N(C, { children: e })
848
+ }) })]
849
+ });
850
+ }
851
+ //#endregion
852
+ //#region src/dashboard-grid/dashboard-widget.tsx
853
+ var H = [
854
+ "start",
855
+ "end",
856
+ "bottom",
857
+ "bottom-start",
858
+ "bottom-end"
859
+ ];
860
+ function dt(e, t) {
861
+ typeof e == "function" ? e(t) : e && (e.current = t);
862
+ }
863
+ var U = (e) => e.reason === "keyboard" ? "keyboard" : "pointer";
864
+ function ft({ register: e, triggerRef: r, ...i }) {
865
+ let a = j(r);
866
+ a.current = r;
867
+ let o = O((t) => {
868
+ e(t), dt(a.current, t);
869
+ }, [e]);
870
+ return /* @__PURE__ */ N("button", {
871
+ ...T(i, "part", "handle"),
872
+ type: "button",
873
+ ref: o,
874
+ children: /* @__PURE__ */ N(n, { children: /* @__PURE__ */ N(t, { name: "grip-horizontal" }) })
875
+ });
876
+ }
877
+ 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 }) {
878
+ let { value: m, title: ee } = p, h = B("DashboardWidget"), g = k(Ue);
879
+ he(() => {
880
+ g?.({
881
+ value: m,
882
+ title: ee,
883
+ rows: s,
884
+ defaultColumns: t,
885
+ defaultRows: n,
886
+ minColumns: r,
887
+ maxColumns: i,
888
+ minRows: a,
889
+ maxRows: o,
890
+ movable: c,
891
+ resizable: l,
892
+ removable: u
893
+ });
894
+ }, [
895
+ g,
896
+ m,
897
+ ee,
898
+ s,
899
+ t,
900
+ n,
901
+ r,
902
+ i,
903
+ a,
904
+ o,
905
+ c,
906
+ l,
907
+ u
908
+ ]);
909
+ let y = ae(), b = h.slots.get(m), x = `${pe()}-title`, S = `${x}-description`, C = _(), te = v({
910
+ delay: C.delay ?? 0,
911
+ loading: d,
912
+ minDuration: C.minDuration ?? 0
913
+ }), { registerWidget: w, registerHandle: ne, registerCard: re } = h, ie = O((e) => {
914
+ w(m, e), dt(f, e);
915
+ }, [
916
+ f,
917
+ w,
918
+ m
919
+ ]), oe = O((e) => re(m, e), [re, m]), se = O((e) => ne(m, e), [ne, m]), T = e ?? h.headingLevel, ce = T === "auto" ? Math.max(2, y) : T;
920
+ return b === void 0 ? null : /* @__PURE__ */ N(G, {
921
+ ...p,
922
+ headingLevel: ce,
923
+ rows: s,
924
+ drawnSlot: b,
925
+ painted: te,
926
+ titleId: x,
927
+ descriptionId: S,
928
+ setWidget: ie,
929
+ setCard: oe,
930
+ setHandle: se,
931
+ t: h.t,
932
+ editing: h.editing,
933
+ sizeClass: h.sizeClass,
934
+ statusId: h.statusId,
935
+ move: h.move,
936
+ resize: h.resize,
937
+ hide: h.hide,
938
+ onHandleKeyDown: h.onHandleKeyDown,
939
+ onResizePointerDown: h.onResizePointerDown
940
+ });
941
+ }
942
+ var G = D(function({ rows: e, value: _, title: v, description: y, help: b, children: x, headingLevel: S, busy: C = !1, status: ae = "ready", skeleton: se, emptyTitle: ce, emptyDescription: E, emptyAction: le, errorTitle: ue, errorDescription: de, onRetry: D, detailHref: O, renderDetail: k, onDetail: fe, actions: pe, footer: me, fill: he, size: A, render: j, style: M, drawnSlot: F, painted: _e, titleId: ve, descriptionId: ye, setWidget: be, setCard: xe, setHandle: Se, t: I, editing: we, sizeClass: L, statusId: Te, move: Ee, resize: De, hide: Oe, onHandleKeyDown: ke, onResizePointerDown: Ae, ...je }) {
943
+ let { tile: R, can: z } = F, Me = `h${S}`, Ne = { title: v }, Pe = L !== "expanded", Fe = /* @__PURE__ */ N(Me, {
944
+ "data-part": "title",
945
+ "data-part-title": "",
946
+ id: ve,
947
+ children: v
948
+ }), Ie = O === void 0 ? fe === void 0 ? null : /* @__PURE__ */ N(d, {
949
+ "aria-label": I("detail", Ne),
950
+ size: "sm",
951
+ tone: "secondary",
952
+ variant: "ghost",
953
+ onClick: fe,
954
+ render: (e) => /* @__PURE__ */ N("button", { ...T(e, "part", "detail") }),
955
+ children: /* @__PURE__ */ N(n, {
956
+ directional: !0,
957
+ children: /* @__PURE__ */ N(t, { name: "external" })
958
+ })
959
+ }) : /* @__PURE__ */ N(d, {
960
+ "aria-label": I("detail", Ne),
961
+ size: "sm",
962
+ tone: "secondary",
963
+ variant: "ghost",
964
+ render: ({ type: e, disabled: t, ...n }) => {
965
+ let r = {
966
+ ...T(n, "part", "detail"),
967
+ href: O,
968
+ onClick: fe
969
+ };
970
+ return k === void 0 ? /* @__PURE__ */ N("a", { ...r }) : k(r);
971
+ },
972
+ children: /* @__PURE__ */ N(n, {
973
+ directional: !0,
974
+ children: /* @__PURE__ */ N(t, { name: "external" })
975
+ })
976
+ }), Le = (e) => (t) => Ee(_, e, U(t), t.source), Re = (e, t) => (n) => De(_, {
977
+ columns: e,
978
+ rows: t
979
+ }, U(n), n.source), ze = R.resizable && L !== "compact", Ve = we && (R.movable || ze || R.removable) ? /* @__PURE__ */ P(r, { children: [/* @__PURE__ */ N(s, {
980
+ onKeyDown: (e) => ke(_, e),
981
+ render: ({ ref: e, ...t }) => /* @__PURE__ */ N(ft, {
982
+ ...t,
983
+ "aria-label": I("handle", Ne),
984
+ "aria-describedby": Te,
985
+ "aria-keyshortcuts": Ce(R.removable),
986
+ register: Se,
987
+ triggerRef: e
988
+ })
989
+ }), /* @__PURE__ */ P(l, { children: [
990
+ R.movable ? /* @__PURE__ */ P(ge, { children: [
991
+ /* @__PURE__ */ P(i, {
992
+ disabled: !z.up,
993
+ onSelect: Le("up"),
994
+ children: [/* @__PURE__ */ N(a, { children: I("moveUp") }), /* @__PURE__ */ N(c, { keys: "Alt+ArrowUp" })]
995
+ }),
996
+ /* @__PURE__ */ P(i, {
997
+ disabled: !z.down,
998
+ onSelect: Le("down"),
999
+ children: [/* @__PURE__ */ N(a, { children: I("moveDown") }), /* @__PURE__ */ N(c, { keys: "Alt+ArrowDown" })]
1000
+ }),
1001
+ Pe ? null : /* @__PURE__ */ P(ge, { children: [/* @__PURE__ */ P(i, {
1002
+ disabled: !z.left,
1003
+ onSelect: Le("left"),
1004
+ children: [/* @__PURE__ */ N(a, { children: I("moveStart") }), /* @__PURE__ */ N(c, { keys: "Alt+ArrowLeft" })]
1005
+ }), /* @__PURE__ */ P(i, {
1006
+ disabled: !z.right,
1007
+ onSelect: Le("right"),
1008
+ children: [/* @__PURE__ */ N(a, { children: I("moveEnd") }), /* @__PURE__ */ N(c, { keys: "Alt+ArrowRight" })]
1009
+ })] })
1010
+ ] }) : null,
1011
+ R.movable && ze ? /* @__PURE__ */ N(o, {}) : null,
1012
+ ze ? /* @__PURE__ */ P(ge, { children: [
1013
+ /* @__PURE__ */ P(i, {
1014
+ disabled: !z.wider,
1015
+ onSelect: Re(1, 0),
1016
+ children: [/* @__PURE__ */ N(a, { children: I("wider") }), /* @__PURE__ */ N(c, { keys: "Shift+ArrowRight" })]
1017
+ }),
1018
+ /* @__PURE__ */ P(i, {
1019
+ disabled: !z.narrower,
1020
+ onSelect: Re(-1, 0),
1021
+ children: [/* @__PURE__ */ N(a, { children: I("narrower") }), /* @__PURE__ */ N(c, { keys: "Shift+ArrowLeft" })]
1022
+ }),
1023
+ /* @__PURE__ */ P(i, {
1024
+ disabled: !z.taller,
1025
+ onSelect: Re(0, 1),
1026
+ children: [/* @__PURE__ */ N(a, { children: I("taller") }), /* @__PURE__ */ N(c, { keys: "Shift+ArrowDown" })]
1027
+ }),
1028
+ /* @__PURE__ */ P(i, {
1029
+ disabled: !z.shorter,
1030
+ onSelect: Re(0, -1),
1031
+ children: [/* @__PURE__ */ N(a, { children: I("shorter") }), /* @__PURE__ */ N(c, { keys: "Shift+ArrowUp" })]
1032
+ })
1033
+ ] }) : null,
1034
+ R.removable ? /* @__PURE__ */ P(ge, { children: [R.movable || ze ? /* @__PURE__ */ N(o, {}) : null, /* @__PURE__ */ P(i, {
1035
+ tone: "danger",
1036
+ onSelect: (e) => Oe(_, "remove", e.source),
1037
+ children: [/* @__PURE__ */ N(a, { children: I("hide") }), /* @__PURE__ */ N(c, { keys: "Delete" })]
1038
+ })] }) : null
1039
+ ] })] }) : null, He = (e) => /* @__PURE__ */ N("div", {
1040
+ "data-part": "message",
1041
+ "data-part-message": "",
1042
+ children: /* @__PURE__ */ P(ie, {
1043
+ status: e,
1044
+ reach: "section",
1045
+ align: "center",
1046
+ live: e === "error" ? "polite" : "off",
1047
+ children: [
1048
+ /* @__PURE__ */ P(re, { children: [/* @__PURE__ */ N(ne, { children: e === "empty" ? ce ?? I("emptyTitle") : ue ?? I("errorTitle") }), (e === "empty" ? E : de) === void 0 ? null : /* @__PURE__ */ N(te, { children: e === "empty" ? E : de })] }),
1049
+ e === "empty" && le !== void 0 ? /* @__PURE__ */ N(w, { children: le }) : null,
1050
+ e === "error" && D !== void 0 ? /* @__PURE__ */ N(w, { children: /* @__PURE__ */ N(u, {
1051
+ size: "sm",
1052
+ tone: "secondary",
1053
+ variant: "outline",
1054
+ start: /* @__PURE__ */ N(n, { children: /* @__PURE__ */ N(t, { name: "rotate-ccw" }) }),
1055
+ onClick: D,
1056
+ render: (e) => /* @__PURE__ */ N("button", { ...T(e, "part", "retry") }),
1057
+ children: I("retry")
1058
+ }) }) : null
1059
+ ]
1060
+ })
1061
+ }), Ue = _e ? /* @__PURE__ */ N("div", {
1062
+ "data-part": "skeleton",
1063
+ "data-part-skeleton": "",
1064
+ children: se ?? /* @__PURE__ */ N(g, { shape: "block" })
1065
+ }) : ae === "empty" ? He("empty") : ae === "error" ? He("error") : x, B = oe({
1066
+ ...je,
1067
+ style: {
1068
+ ...Be(R),
1069
+ ...F.order === void 0 ? {} : { order: F.order },
1070
+ ...M
1071
+ },
1072
+ "data-part": "widget",
1073
+ "data-key": _,
1074
+ "data-rows": e,
1075
+ "data-status": ae,
1076
+ ..._e ? { "data-loading": "" } : {},
1077
+ ...R.movable ? { "data-movable": "" } : {},
1078
+ ...R.resizable ? { "data-resizable": "" } : {},
1079
+ ...F.dragging ? { "data-dragging": "" } : {},
1080
+ ...F.resizing ? { "data-resizing": "" } : {},
1081
+ ref: be,
1082
+ children: /* @__PURE__ */ P(ge, { children: [
1083
+ /* @__PURE__ */ P(p, {
1084
+ fill: he,
1085
+ size: A,
1086
+ render: (e) => /* @__PURE__ */ N("article", {
1087
+ ...e,
1088
+ ref: xe,
1089
+ "aria-labelledby": ve,
1090
+ "aria-describedby": y === void 0 ? void 0 : ye,
1091
+ "aria-busy": _e || C || void 0
1092
+ }),
1093
+ children: [
1094
+ /* @__PURE__ */ P(m, { children: [
1095
+ b === void 0 ? Fe : /* @__PURE__ */ P("div", {
1096
+ "data-part": "title-row",
1097
+ "data-part-title-row": "",
1098
+ children: [Fe, /* @__PURE__ */ N(ut, {
1099
+ label: I("help", Ne),
1100
+ children: b
1101
+ })]
1102
+ }),
1103
+ y === void 0 ? null : /* @__PURE__ */ N("p", {
1104
+ "data-part": "description",
1105
+ "data-part-description": "",
1106
+ id: ye,
1107
+ children: y
1108
+ }),
1109
+ pe !== void 0 || Ie !== null ? /* @__PURE__ */ P(h, { children: [pe, Ie] }) : null
1110
+ ] }),
1111
+ /* @__PURE__ */ P(ee, { children: [C && !_e ? /* @__PURE__ */ N("span", {
1112
+ "data-part": "busy-indicator",
1113
+ "data-part-busy-indicator": "",
1114
+ "aria-hidden": "true"
1115
+ }) : null, Ue] }),
1116
+ me === void 0 ? null : /* @__PURE__ */ N(f, { children: me })
1117
+ ]
1118
+ }),
1119
+ Ve,
1120
+ we && ze ? H.map((e) => /* @__PURE__ */ N("span", {
1121
+ "data-part": "resize-handle",
1122
+ "data-part-resize-handle": "",
1123
+ "data-edge": e,
1124
+ ...F.edge === e ? { "data-active": "" } : {},
1125
+ "aria-hidden": "true",
1126
+ onPointerDown: (t) => Ae(_, e, t)
1127
+ }, e)) : null,
1128
+ F.readout === null ? null : /* @__PURE__ */ N("span", {
1129
+ "data-part": "size-readout",
1130
+ "data-part-size-readout": "",
1131
+ "data-edge": F.edge ?? void 0,
1132
+ "aria-hidden": "true",
1133
+ children: F.readout
1134
+ })
1135
+ ] })
1136
+ });
1137
+ return j === void 0 ? /* @__PURE__ */ N("li", { ...B }) : j(B);
1138
+ }), K = [];
1139
+ function pt() {
1140
+ try {
1141
+ return typeof window > "u" ? null : window.localStorage;
1142
+ } catch {
1143
+ return null;
1144
+ }
1145
+ }
1146
+ function mt({ key: e, storage: t, defaultLayout: n = K }) {
1147
+ let r = A(() => t === void 0 ? pt() : t, [t]), [i, a] = M(() => {
1148
+ let t;
1149
+ try {
1150
+ t = r?.getItem(e) ?? null;
1151
+ } catch {
1152
+ t = null;
1153
+ }
1154
+ return (t === null ? null : ke(t)) ?? n;
1155
+ });
1156
+ return {
1157
+ layout: i,
1158
+ defaultLayout: n,
1159
+ onLayoutChange: O((t) => {
1160
+ a(t);
1161
+ try {
1162
+ r?.setItem(e, Fe(t));
1163
+ } catch {}
1164
+ }, [e, r]),
1165
+ clear: O(() => {
1166
+ a(n);
1167
+ try {
1168
+ r?.removeItem(e);
1169
+ } catch {}
1170
+ }, [
1171
+ n,
1172
+ e,
1173
+ r
1174
+ ])
1175
+ };
1176
+ }
1177
+ //#endregion
1178
+ export { qe as a, We as i, W as n, Ke as o, V as r, mt as t };