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