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

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