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