@slotted/react 0.1.0-beta.14 → 0.1.0-beta.15
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/{action-sheet-BAoaxbmI.js → action-sheet-Klu-YxIk.js} +1 -1
- package/dist/action-sheet.js +1 -1
- package/dist/{column-manager-DMaWNyXs.js → column-manager-e234Ey_u.js} +1 -1
- package/dist/column-manager.js +1 -1
- package/dist/docs/drawer.examples.md +1 -1
- package/dist/docs/drawer.json +6 -4
- package/dist/docs/drawer.md +4 -4
- package/dist/drawer-CFpBsLG6.js +817 -0
- package/dist/drawer.js +1 -1
- package/dist/{event-calendar-kX0aS8Pm.js → event-calendar-liaKOKOH.js} +1 -1
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-B-Jk5sPq.js → filter-bar-vJzwcDZj.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/index.js +5 -5
- package/dist/styles/action-sheet.css +1 -1
- package/dist/styles/column-manager.css +1 -1
- package/dist/styles/drawer.css +1 -1
- package/dist/styles/event-calendar.css +1 -1
- package/dist/styles/filter-bar.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/drawer/drawer-parts.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/drawer-Pk4tqPUV.js +0 -819
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
import { r as e } from "./i18n-D7xXDd8-.js";
|
|
2
|
+
import { n as t, t as n } from "./icon-D04-_QFA.js";
|
|
3
|
+
import { keyedProps as r } from "@slotted/core/selector-key";
|
|
4
|
+
import { createFocusScope as i } from "@slotted/core/focus";
|
|
5
|
+
import { createControllable as a } from "@slotted/core/state";
|
|
6
|
+
import { createContext as o, useCallback as s, useContext as c, useEffect as l, useId as u, useImperativeHandle as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
7
|
+
import { Fragment as ee, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
8
|
+
import { createPresence as te } from "@slotted/core/presence";
|
|
9
|
+
import { drawerMessages as y } from "@slotted/core/i18n";
|
|
10
|
+
import { createPortalRoot as b } from "@slotted/core/portal";
|
|
11
|
+
import { createDismissableLayer as x } from "@slotted/core/dismissable-layer";
|
|
12
|
+
import { createPortal as S } from "react-dom";
|
|
13
|
+
import { EXTENT_LARGE_STEP_PX as C, EXTENT_STEP_PX as w, SHEET_DRAG_SLOP_PX as ne, SHEET_FLING_PX_PER_S as re, addExtentSample as T, anchorsAtStart as ie, attachSheetScroll as E, extentAtPoint as D, extentBounds as O, extentVelocity as ae, holdResizeGesture as k, isInlineSide as A, measureSheetStops as j, sameStop as oe, settleExtent as M, stepAmountFromPixels as N, stepExtent as se, stopAsExtent as P } from "@slotted/core/extent";
|
|
14
|
+
import { clamp as F, observeKeyboardInset as ce } from "@slotted/core/measure";
|
|
15
|
+
//#region src/drawer/drawer-defaults.tsx
|
|
16
|
+
var I = o({
|
|
17
|
+
back: "close",
|
|
18
|
+
escape: "close",
|
|
19
|
+
modal: !0,
|
|
20
|
+
mode: "overlay",
|
|
21
|
+
mount: "active",
|
|
22
|
+
outsidePress: "close",
|
|
23
|
+
side: "end",
|
|
24
|
+
size: void 0,
|
|
25
|
+
drag: "panel"
|
|
26
|
+
});
|
|
27
|
+
function L() {
|
|
28
|
+
return c(I);
|
|
29
|
+
}
|
|
30
|
+
function R({ children: e, ...t }) {
|
|
31
|
+
let n = L();
|
|
32
|
+
return /* @__PURE__ */ _(I.Provider, {
|
|
33
|
+
value: {
|
|
34
|
+
back: t.back ?? n.back,
|
|
35
|
+
escape: t.escape ?? n.escape,
|
|
36
|
+
modal: t.modal ?? n.modal,
|
|
37
|
+
mode: t.mode ?? n.mode,
|
|
38
|
+
mount: t.mount ?? n.mount,
|
|
39
|
+
outsidePress: t.outsidePress ?? n.outsidePress,
|
|
40
|
+
side: t.side ?? n.side,
|
|
41
|
+
size: t.size ?? n.size,
|
|
42
|
+
drag: t.drag ?? n.drag
|
|
43
|
+
},
|
|
44
|
+
children: e
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/drawer/drawer.tsx
|
|
49
|
+
var z = o(void 0);
|
|
50
|
+
function B() {
|
|
51
|
+
let e = c(z);
|
|
52
|
+
if (e === void 0) throw Error("Every drawer part must be rendered inside Drawer.");
|
|
53
|
+
return e;
|
|
54
|
+
}
|
|
55
|
+
var V = [];
|
|
56
|
+
function H({ children: t, back: n, container: r, defaultExtent: i, defaultOpen: o, drag: c, escape: f, extent: g, finalFocus: ee, initialFocus: v, loading: b, maxExtent: x, messages: S, minExtent: C, modal: w, mode: ne, mount: re, onExtentChange: T, onOpenChange: ie, onOpenChangeComplete: E, open: D, outsidePress: ae, ref: k, scrimFrom: A, side: j, size: oe, snapPoints: M }) {
|
|
57
|
+
let N = L(), se = e(y, S), P = u(), [ce, I] = h(o ?? !1), R = D ?? ce, [B, H] = h(i), U = g ?? B, [W, le] = h(!1), [ue, G] = h(null), [de, fe] = h(void 0), K = ne ?? N.mode, pe = K === "inline" ? !1 : w ?? N.modal, me = re ?? N.mount, q = j ?? N.side, he = oe ?? N.size ?? (q === "top" || q === "bottom" ? "content" : "md"), ge = K === "inline" ? "none" : f ?? N.escape, J = K === "inline" ? "none" : n ?? N.back, Y = K === "inline" ? "none" : ae ?? N.outsidePress, _e = M ?? V, X = p(() => {
|
|
58
|
+
let e = O(_e, C ?? .2, x ?? 1);
|
|
59
|
+
return he === "content" ? {
|
|
60
|
+
...e,
|
|
61
|
+
max: Math.max(e.max, x ?? 1)
|
|
62
|
+
} : e;
|
|
63
|
+
}, [
|
|
64
|
+
x,
|
|
65
|
+
C,
|
|
66
|
+
he,
|
|
67
|
+
_e
|
|
68
|
+
]), [Z, ve] = h(R ? "entering" : "unmounted"), Q = m(null), ye = m(E);
|
|
69
|
+
ye.current = E, Q.current === null && (Q.current = te({
|
|
70
|
+
onEnterComplete: () => ye.current?.(!0),
|
|
71
|
+
onExitComplete: () => ye.current?.(!1),
|
|
72
|
+
onStatusChange: ve,
|
|
73
|
+
present: R,
|
|
74
|
+
skipInitialAnimation: !1
|
|
75
|
+
})), l(() => {
|
|
76
|
+
Q.current?.sync(R);
|
|
77
|
+
}, [R]), l(() => {
|
|
78
|
+
R && G(null);
|
|
79
|
+
}, [R]), l(() => {
|
|
80
|
+
let e = Q.current;
|
|
81
|
+
return () => e?.stop();
|
|
82
|
+
}, []);
|
|
83
|
+
let be = m(R);
|
|
84
|
+
R && (be.current = !0);
|
|
85
|
+
let xe = K === "inline" || me === "eager" ? !0 : me === "lazy" ? be.current : Z !== "unmounted", Se = m({
|
|
86
|
+
layer: null,
|
|
87
|
+
panel: null,
|
|
88
|
+
trigger: null
|
|
89
|
+
}), [Ce, we] = h(!1), [Te, Ee] = h(!1), De = s((e) => (e === "title" ? we(!0) : Ee(!0), () => {
|
|
90
|
+
e === "title" ? we(!1) : Ee(!1);
|
|
91
|
+
}), []), Oe = s((e) => {
|
|
92
|
+
Se.current.layer = e, Q.current?.setNode(e);
|
|
93
|
+
}, []), $ = s((e, t, n, r) => {
|
|
94
|
+
if (e === R) return;
|
|
95
|
+
let i = !1, o = a({
|
|
96
|
+
controlled: D,
|
|
97
|
+
initial: R,
|
|
98
|
+
onRequest: (e) => {
|
|
99
|
+
i = e.cancelled, ie?.(e.value, {
|
|
100
|
+
get cancelled() {
|
|
101
|
+
return e.cancelled;
|
|
102
|
+
},
|
|
103
|
+
cancel: () => e.cancel(),
|
|
104
|
+
previous: e.previous,
|
|
105
|
+
reason: t,
|
|
106
|
+
result: n,
|
|
107
|
+
source: e.source,
|
|
108
|
+
value: e.value
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}).request(e, t, r);
|
|
112
|
+
i || o && I(e);
|
|
113
|
+
}, [
|
|
114
|
+
R,
|
|
115
|
+
ie,
|
|
116
|
+
D
|
|
117
|
+
]), ke = s((e, t, n) => {
|
|
118
|
+
let r = e === void 0 ? void 0 : F(e, 0, X.max);
|
|
119
|
+
if (r === U) return;
|
|
120
|
+
let i = !1, o = a({
|
|
121
|
+
controlled: g,
|
|
122
|
+
initial: U,
|
|
123
|
+
onRequest: (e) => {
|
|
124
|
+
i = e.cancelled, T?.(e.value, {
|
|
125
|
+
get cancelled() {
|
|
126
|
+
return e.cancelled;
|
|
127
|
+
},
|
|
128
|
+
cancel: () => e.cancel(),
|
|
129
|
+
previous: e.previous,
|
|
130
|
+
reason: t,
|
|
131
|
+
source: e.source,
|
|
132
|
+
value: e.value
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}).request(r, t, n);
|
|
136
|
+
i || o && H(r);
|
|
137
|
+
}, [
|
|
138
|
+
X.max,
|
|
139
|
+
U,
|
|
140
|
+
g,
|
|
141
|
+
T
|
|
142
|
+
]);
|
|
143
|
+
d(k, () => ({
|
|
144
|
+
open: () => $(!0, "programmatic", void 0, void 0),
|
|
145
|
+
close: (e) => $(!1, "programmatic", e, void 0),
|
|
146
|
+
focus: () => Se.current.panel?.focus(),
|
|
147
|
+
get panel() {
|
|
148
|
+
return Se.current.panel;
|
|
149
|
+
}
|
|
150
|
+
}), [$]);
|
|
151
|
+
let Ae = p(() => ({
|
|
152
|
+
announce: De,
|
|
153
|
+
close: (e, t, n) => $(!1, e, t, n),
|
|
154
|
+
container: r,
|
|
155
|
+
descriptionId: Te ? `${P}description` : "",
|
|
156
|
+
dragging: W,
|
|
157
|
+
drag: c ?? N.drag,
|
|
158
|
+
scrimFrom: A ?? 0,
|
|
159
|
+
live: ue,
|
|
160
|
+
setLive: G,
|
|
161
|
+
rest: de,
|
|
162
|
+
setRest: fe,
|
|
163
|
+
back: J,
|
|
164
|
+
escape: ge,
|
|
165
|
+
extent: U,
|
|
166
|
+
finalFocus: ee,
|
|
167
|
+
initialFocus: v ?? "first",
|
|
168
|
+
loading: b === !0,
|
|
169
|
+
defaultExtent: i,
|
|
170
|
+
maxExtent: X.max,
|
|
171
|
+
minExtent: X.min,
|
|
172
|
+
modal: pe,
|
|
173
|
+
mode: K,
|
|
174
|
+
mounted: xe,
|
|
175
|
+
mount: me,
|
|
176
|
+
nodes: Se.current,
|
|
177
|
+
open: R,
|
|
178
|
+
openWith: (e, t) => $(!0, e, void 0, t),
|
|
179
|
+
outsidePress: Y,
|
|
180
|
+
panelId: `${P}panel`,
|
|
181
|
+
registerLayer: Oe,
|
|
182
|
+
requestExtent: ke,
|
|
183
|
+
setDragging: le,
|
|
184
|
+
side: q,
|
|
185
|
+
size: he,
|
|
186
|
+
snapPoints: _e,
|
|
187
|
+
t: se,
|
|
188
|
+
titleId: Ce ? `${P}title` : "",
|
|
189
|
+
triggerId: `${P}trigger`,
|
|
190
|
+
visible: K === "inline" ? R : Z === "open",
|
|
191
|
+
interactive: K === "inline" ? R : Z === "entering" || Z === "open"
|
|
192
|
+
}), [
|
|
193
|
+
De,
|
|
194
|
+
P,
|
|
195
|
+
X.max,
|
|
196
|
+
X.min,
|
|
197
|
+
r,
|
|
198
|
+
U,
|
|
199
|
+
i,
|
|
200
|
+
R,
|
|
201
|
+
Te,
|
|
202
|
+
N.drag,
|
|
203
|
+
c,
|
|
204
|
+
W,
|
|
205
|
+
ue,
|
|
206
|
+
de,
|
|
207
|
+
A,
|
|
208
|
+
ee,
|
|
209
|
+
v,
|
|
210
|
+
b,
|
|
211
|
+
xe,
|
|
212
|
+
Oe,
|
|
213
|
+
ke,
|
|
214
|
+
$,
|
|
215
|
+
J,
|
|
216
|
+
ge,
|
|
217
|
+
pe,
|
|
218
|
+
K,
|
|
219
|
+
me,
|
|
220
|
+
Y,
|
|
221
|
+
q,
|
|
222
|
+
he,
|
|
223
|
+
_e,
|
|
224
|
+
Z,
|
|
225
|
+
se,
|
|
226
|
+
Ce
|
|
227
|
+
]);
|
|
228
|
+
return /* @__PURE__ */ _(z.Provider, {
|
|
229
|
+
value: Ae,
|
|
230
|
+
children: t
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
//#endregion
|
|
234
|
+
//#region src/drawer/drawer-parts.tsx
|
|
235
|
+
function U(e) {
|
|
236
|
+
return e.detail === 0 ? "keyboard" : "pointer";
|
|
237
|
+
}
|
|
238
|
+
var W = typeof document > "u" ? l : f;
|
|
239
|
+
function le(e) {
|
|
240
|
+
return e !== null && getComputedStyle(e).direction === "rtl";
|
|
241
|
+
}
|
|
242
|
+
function ue(e, t) {
|
|
243
|
+
if (e === null) return null;
|
|
244
|
+
if (t !== "inline") return e;
|
|
245
|
+
let n = e.parentElement;
|
|
246
|
+
for (; n !== null && G.has(n);) n = n.parentElement;
|
|
247
|
+
return n;
|
|
248
|
+
}
|
|
249
|
+
var G = /* @__PURE__ */ new WeakSet(), de = () => () => {};
|
|
250
|
+
function fe() {
|
|
251
|
+
return g(de, () => !0, () => !1);
|
|
252
|
+
}
|
|
253
|
+
function K({ children: e, className: t, onClick: n, ref: i, render: a, style: o, ...s }) {
|
|
254
|
+
let c = B(), l = r({
|
|
255
|
+
...s,
|
|
256
|
+
"aria-controls": c.mounted ? c.panelId : void 0,
|
|
257
|
+
"aria-expanded": c.open,
|
|
258
|
+
...c.mode === "overlay" ? { "aria-haspopup": "dialog" } : {},
|
|
259
|
+
children: e,
|
|
260
|
+
className: t,
|
|
261
|
+
"data-part": "trigger",
|
|
262
|
+
...c.open ? { "data-open": "" } : {},
|
|
263
|
+
id: c.triggerId,
|
|
264
|
+
onClick: (e) => {
|
|
265
|
+
n?.(e), !e.defaultPrevented && (c.open ? c.close(U(e), void 0, e) : c.openWith(U(e), e));
|
|
266
|
+
},
|
|
267
|
+
ref: (e) => {
|
|
268
|
+
c.nodes.trigger = e, typeof i == "function" ? i(e) : i && (i.current = e);
|
|
269
|
+
},
|
|
270
|
+
style: o,
|
|
271
|
+
type: "button"
|
|
272
|
+
});
|
|
273
|
+
return a === void 0 ? /* @__PURE__ */ _("button", { ...l }) : a(l);
|
|
274
|
+
}
|
|
275
|
+
function pe(e) {
|
|
276
|
+
let [t, n] = h(null);
|
|
277
|
+
return W(() => {
|
|
278
|
+
if (e.mode === "inline" || !e.mounted) return;
|
|
279
|
+
let t = b({
|
|
280
|
+
origin: e.nodes.trigger,
|
|
281
|
+
...e.container === void 0 ? {} : { container: e.container }
|
|
282
|
+
});
|
|
283
|
+
return n(t.container), () => {
|
|
284
|
+
n(null), t.release();
|
|
285
|
+
};
|
|
286
|
+
}, [
|
|
287
|
+
e.container,
|
|
288
|
+
e.mode,
|
|
289
|
+
e.mounted,
|
|
290
|
+
e.nodes
|
|
291
|
+
]), t;
|
|
292
|
+
}
|
|
293
|
+
function me(e, t) {
|
|
294
|
+
let [n, r] = h(void 0), { mode: i, side: a } = e, o = e.live ?? e.extent;
|
|
295
|
+
return W(() => {
|
|
296
|
+
let e = ue(t, i);
|
|
297
|
+
if (e === null || o === void 0) {
|
|
298
|
+
r(void 0);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
let n = () => {
|
|
302
|
+
let t = e.getBoundingClientRect(), n = A(a) ? t.width : t.height;
|
|
303
|
+
n > 0 && r(`${Math.round(o * n)}px`);
|
|
304
|
+
};
|
|
305
|
+
if (n(), typeof ResizeObserver > "u") return;
|
|
306
|
+
let s = new ResizeObserver(n);
|
|
307
|
+
return s.observe(e), () => s.disconnect();
|
|
308
|
+
}, [
|
|
309
|
+
o,
|
|
310
|
+
t,
|
|
311
|
+
i,
|
|
312
|
+
a
|
|
313
|
+
]), n;
|
|
314
|
+
}
|
|
315
|
+
var q = "var(--slotted-space-12, 4rem)";
|
|
316
|
+
function he(e, t, n) {
|
|
317
|
+
return j({
|
|
318
|
+
atRest: e.extent === void 0 && e.live === null,
|
|
319
|
+
content: e.size === "content",
|
|
320
|
+
panel: t,
|
|
321
|
+
reserve: q,
|
|
322
|
+
rest: e.rest,
|
|
323
|
+
snapPoints: e.snapPoints,
|
|
324
|
+
span: n
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
var ge = 300, J = /* @__PURE__ */ new WeakMap();
|
|
328
|
+
function Y(e, t, n) {
|
|
329
|
+
return P(t, n, e.size === "content");
|
|
330
|
+
}
|
|
331
|
+
function _e({ children: e, className: t, ref: n, render: a, style: o, ...c }) {
|
|
332
|
+
let u = B(), d = pe(u), [f, p] = h(null), [g, te] = h(null), y = me(u, f), b = u.mode === "overlay", C = fe(), [w] = h(() => {
|
|
333
|
+
if (typeof document > "u") return null;
|
|
334
|
+
let e = document.createElement("div");
|
|
335
|
+
return e.style.display = "contents", G.add(e), e;
|
|
336
|
+
}), ne = s((e) => {
|
|
337
|
+
e !== null && w !== null && (G.add(e), b ? d !== null && d.append(w) : e.append(w));
|
|
338
|
+
}, [
|
|
339
|
+
w,
|
|
340
|
+
b,
|
|
341
|
+
d
|
|
342
|
+
]), re = m(!1), T = C && w !== null && u.mounted && (!b || d !== null || re.current);
|
|
343
|
+
W(() => {
|
|
344
|
+
re.current = T;
|
|
345
|
+
});
|
|
346
|
+
let ie = !b || d !== null, D = u.titleId !== "" && c["aria-label"] === void 0 && (b || c.role !== void 0), { registerLayer: O } = u, ae = s((e) => {
|
|
347
|
+
p(e), O(e);
|
|
348
|
+
}, [O]), k = m(u);
|
|
349
|
+
k.current = u, l(() => {
|
|
350
|
+
if (g === null || f === null || !u.open || !ie) return;
|
|
351
|
+
let e = u.nodes.trigger === null ? [] : [u.nodes.trigger], t = b ? x(f, {
|
|
352
|
+
back: u.modal && u.back === "close",
|
|
353
|
+
branches: e,
|
|
354
|
+
content: g,
|
|
355
|
+
escape: u.escape === "close",
|
|
356
|
+
modal: u.modal,
|
|
357
|
+
onDismiss: (e) => {
|
|
358
|
+
if (e.reason === "outsidePress" && k.current.outsidePress === "none") return e.cancel();
|
|
359
|
+
k.current.close(e.reason, void 0, e.source);
|
|
360
|
+
},
|
|
361
|
+
outsidePress: u.outsidePress === "close",
|
|
362
|
+
outsidePressEvent: "click"
|
|
363
|
+
}) : null, n = u.initialFocus, r = u.finalFocus, a = g.ownerDocument.activeElement, o = a?.parentElement ?? null, s = i(g, {
|
|
364
|
+
contain: b && u.modal,
|
|
365
|
+
initial: b ? typeof n == "object" && n ? () => n.current : n : !1,
|
|
366
|
+
restore: r === void 0 ? () => {
|
|
367
|
+
if (a === null || a === a.ownerDocument.body) return k.current.nodes.trigger;
|
|
368
|
+
if (a.isConnected) return a;
|
|
369
|
+
let e = o;
|
|
370
|
+
for (; e !== null && !e.isConnected;) e = e.parentElement;
|
|
371
|
+
return e;
|
|
372
|
+
} : r === !1 ? !1 : () => r.current
|
|
373
|
+
});
|
|
374
|
+
return s.enter(), () => {
|
|
375
|
+
t?.destroy(), s.destroy();
|
|
376
|
+
};
|
|
377
|
+
}, [
|
|
378
|
+
u.back,
|
|
379
|
+
u.escape,
|
|
380
|
+
u.finalFocus,
|
|
381
|
+
u.initialFocus,
|
|
382
|
+
u.modal,
|
|
383
|
+
u.open,
|
|
384
|
+
u.outsidePress,
|
|
385
|
+
f,
|
|
386
|
+
b,
|
|
387
|
+
g,
|
|
388
|
+
ie
|
|
389
|
+
]);
|
|
390
|
+
let { setRest: j, open: M, extent: N, live: se, dragging: P } = u;
|
|
391
|
+
W(() => {
|
|
392
|
+
let e = ue(f, u.mode);
|
|
393
|
+
if (g === null || e === null || !M || N !== void 0 || se !== null || P) return;
|
|
394
|
+
let t = A(u.side), n = () => {
|
|
395
|
+
if (J.has(g)) return;
|
|
396
|
+
let n = e.getBoundingClientRect(), r = t ? n.width : n.height;
|
|
397
|
+
if (r <= 0) return;
|
|
398
|
+
let i = t ? g.offsetWidth : g.offsetHeight;
|
|
399
|
+
j(Math.round(i / r * 1e3) / 1e3);
|
|
400
|
+
};
|
|
401
|
+
if (typeof ResizeObserver > "u") {
|
|
402
|
+
n();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
let r = new ResizeObserver(n);
|
|
406
|
+
return r.observe(g), r.observe(e), () => r.disconnect();
|
|
407
|
+
}, [
|
|
408
|
+
f,
|
|
409
|
+
u.mode,
|
|
410
|
+
u.side,
|
|
411
|
+
P,
|
|
412
|
+
N,
|
|
413
|
+
M,
|
|
414
|
+
se,
|
|
415
|
+
g,
|
|
416
|
+
j
|
|
417
|
+
]), l(() => {
|
|
418
|
+
if (!b || f === null || !M) return;
|
|
419
|
+
let e = ce(f.ownerDocument.defaultView, (e) => {
|
|
420
|
+
e === 0 ? f.style.removeProperty("--slotted-keyboard-inset") : f.style.setProperty("--slotted-keyboard-inset", `${e}px`);
|
|
421
|
+
});
|
|
422
|
+
return () => {
|
|
423
|
+
e(), f.style.removeProperty("--slotted-keyboard-inset");
|
|
424
|
+
};
|
|
425
|
+
}, [
|
|
426
|
+
M,
|
|
427
|
+
f,
|
|
428
|
+
b
|
|
429
|
+
]);
|
|
430
|
+
let F = b && u.side === "bottom", I = m(null);
|
|
431
|
+
W(() => {
|
|
432
|
+
if (!F || g === null || f === null) return;
|
|
433
|
+
let e = E(f, g, {
|
|
434
|
+
content: () => k.current.size === "content",
|
|
435
|
+
dismissible: () => !0,
|
|
436
|
+
onScroll: (e) => {
|
|
437
|
+
let t = k.current;
|
|
438
|
+
t.scrimFrom > 0 && f.toggleAttribute("data-undimmed", e < t.scrimFrom);
|
|
439
|
+
},
|
|
440
|
+
onSettle: (t) => {
|
|
441
|
+
let n = k.current;
|
|
442
|
+
if (n.open) {
|
|
443
|
+
if (t === "close") {
|
|
444
|
+
n.close("pointer", void 0, null), setTimeout(() => {
|
|
445
|
+
k.current.open && e.at() === 0 && e.scrollTo(e.rest(), !0);
|
|
446
|
+
}, ge);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
n.requestExtent(Y(n, t, e.rest()), "pointer", null);
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
reserve: q,
|
|
453
|
+
snapPoints: () => k.current.snapPoints,
|
|
454
|
+
step: "var(--_step)"
|
|
455
|
+
});
|
|
456
|
+
return I.current = e, J.set(g, e), () => {
|
|
457
|
+
e.destroy(), I.current = null, J.delete(g);
|
|
458
|
+
};
|
|
459
|
+
}, [
|
|
460
|
+
f,
|
|
461
|
+
g,
|
|
462
|
+
F
|
|
463
|
+
]);
|
|
464
|
+
let L = u.interactive, R = m(!1);
|
|
465
|
+
if (W(() => {
|
|
466
|
+
let e = I.current;
|
|
467
|
+
e !== null && g !== null && f !== null && (M && L && !R.current ? (R.current = !0, e.enter(k.current.extent)) : !M && R.current && (R.current = !1, e.at() > 0 && e.scrollTo(0, !0)));
|
|
468
|
+
}, [
|
|
469
|
+
L,
|
|
470
|
+
M,
|
|
471
|
+
f,
|
|
472
|
+
g
|
|
473
|
+
]), l(() => {
|
|
474
|
+
let e = I.current;
|
|
475
|
+
if (e === null || g === null || f === null || !M || e.busy()) return;
|
|
476
|
+
let t = N ?? e.rest();
|
|
477
|
+
Math.abs(e.at() - t) * f.clientHeight > 2 && e.scrollTo(t, !0);
|
|
478
|
+
}, [
|
|
479
|
+
N,
|
|
480
|
+
M,
|
|
481
|
+
f,
|
|
482
|
+
g
|
|
483
|
+
]), !u.mounted) return null;
|
|
484
|
+
if (!C || w === null) {
|
|
485
|
+
if (b) return null;
|
|
486
|
+
} else if (!T) return null;
|
|
487
|
+
let z = b && u.side === "bottom" && (u.size === "full" || u.extent !== void 0 && oe(u.extent, 1)), V = r({
|
|
488
|
+
...c,
|
|
489
|
+
...u.descriptionId === "" ? {} : { "aria-describedby": u.descriptionId },
|
|
490
|
+
...D ? { "aria-labelledby": u.titleId } : {},
|
|
491
|
+
...u.modal ? { "aria-modal": !0 } : {},
|
|
492
|
+
children: e,
|
|
493
|
+
className: t,
|
|
494
|
+
"data-part": "panel",
|
|
495
|
+
id: u.panelId,
|
|
496
|
+
ref: (e) => {
|
|
497
|
+
te(e), u.nodes.panel = e, typeof n == "function" ? n(e) : n && (n.current = e);
|
|
498
|
+
},
|
|
499
|
+
...b ? { role: "dialog" } : {},
|
|
500
|
+
style: o
|
|
501
|
+
}), H = /* @__PURE__ */ v("div", {
|
|
502
|
+
"data-mode": u.mode,
|
|
503
|
+
"data-mount": u.mount,
|
|
504
|
+
"data-part": "root",
|
|
505
|
+
"data-part-root": "",
|
|
506
|
+
"data-side": u.side,
|
|
507
|
+
"data-size": u.size,
|
|
508
|
+
"data-ui": "drawer",
|
|
509
|
+
"data-ui-drawer": "",
|
|
510
|
+
...u.dragging ? { "data-dragging": "" } : {},
|
|
511
|
+
...b && u.side === "bottom" ? { "data-drag": u.drag } : {},
|
|
512
|
+
...z ? { "data-expanded": "" } : {},
|
|
513
|
+
...b && (u.live ?? u.extent ?? u.rest ?? 1) < u.scrimFrom ? { "data-undimmed": "" } : {},
|
|
514
|
+
...u.loading ? { "data-loading": "" } : {},
|
|
515
|
+
...u.modal ? { "data-modal": "" } : {},
|
|
516
|
+
...u.interactive ? {} : { inert: !0 },
|
|
517
|
+
...u.visible ? { "data-open": "" } : {},
|
|
518
|
+
ref: ae,
|
|
519
|
+
style: y === void 0 ? void 0 : { "--slotted-drawer-extent": y },
|
|
520
|
+
children: [b ? /* @__PURE__ */ _("div", {
|
|
521
|
+
"data-part": "backdrop",
|
|
522
|
+
"data-part-backdrop": ""
|
|
523
|
+
}) : null, a === void 0 ? /* @__PURE__ */ _("div", { ...V }) : a(V)]
|
|
524
|
+
});
|
|
525
|
+
return !C || w === null ? /* @__PURE__ */ _("div", {
|
|
526
|
+
style: X,
|
|
527
|
+
children: H
|
|
528
|
+
}) : /* @__PURE__ */ v(ee, { children: [/* @__PURE__ */ _("div", {
|
|
529
|
+
ref: ne,
|
|
530
|
+
style: X
|
|
531
|
+
}), S(H, w)] });
|
|
532
|
+
}
|
|
533
|
+
var X = { display: "contents" }, Z = 3;
|
|
534
|
+
function ve({ className: e, largeStep: t = C, onDoubleClick: n, onKeyDown: i, onPointerDown: a, ref: o, render: s, step: c = w, style: l, ...u }) {
|
|
535
|
+
let d = B(), f = m(null), p = m(null), h = m([]), g = m(null), te = m(null), y = m(null), b = m(null), x = m(d);
|
|
536
|
+
x.current = d;
|
|
537
|
+
let S = A(d.side), E = d.live ?? d.extent ?? d.rest ?? d.minExtent, O = (e) => Math.round(F(e, 0, 1) * 100), j = () => {
|
|
538
|
+
let e = ue(d.nodes.layer, d.mode);
|
|
539
|
+
return e === null ? null : e.getBoundingClientRect();
|
|
540
|
+
}, P = () => {
|
|
541
|
+
let e = d.nodes.panel, t = e === null ? void 0 : J.get(e);
|
|
542
|
+
if (t !== void 0) return {
|
|
543
|
+
rest: t.rest(),
|
|
544
|
+
stops: [...t.stops()]
|
|
545
|
+
};
|
|
546
|
+
let n = j();
|
|
547
|
+
return e === null || n === null || d.snapPoints.length === 0 ? {
|
|
548
|
+
rest: d.rest,
|
|
549
|
+
stops: []
|
|
550
|
+
} : he(d, e, S ? n.width : n.height);
|
|
551
|
+
}, ce = (e, t) => {
|
|
552
|
+
p.current = e, d.requestExtent(e, "pointer", t);
|
|
553
|
+
}, I = (e, t) => D({
|
|
554
|
+
point: {
|
|
555
|
+
x: e.clientX,
|
|
556
|
+
y: e.clientY
|
|
557
|
+
},
|
|
558
|
+
rect: t,
|
|
559
|
+
rtl: le(f.current),
|
|
560
|
+
side: d.side
|
|
561
|
+
}), L = (e) => {
|
|
562
|
+
if (a?.(e), e.defaultPrevented || e.button !== 0) return;
|
|
563
|
+
let t = d.nodes.panel === null ? void 0 : J.get(d.nodes.panel);
|
|
564
|
+
if (t !== void 0) {
|
|
565
|
+
let n = e.pointerType === "mouse";
|
|
566
|
+
n && (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId)), e.currentTarget.focus(), b.current = {
|
|
567
|
+
drag: null,
|
|
568
|
+
mouse: n,
|
|
569
|
+
scroll: t,
|
|
570
|
+
x: e.clientX,
|
|
571
|
+
y: e.clientY
|
|
572
|
+
};
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
let n = j();
|
|
576
|
+
n !== null && (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), e.currentTarget.focus(), g.current = {
|
|
577
|
+
before: d.extent,
|
|
578
|
+
moved: !1,
|
|
579
|
+
offset: E - I(e, n),
|
|
580
|
+
x: e.clientX,
|
|
581
|
+
y: e.clientY
|
|
582
|
+
}, h.current = []);
|
|
583
|
+
}, R = (e) => {
|
|
584
|
+
let t = b.current;
|
|
585
|
+
if (t !== null) {
|
|
586
|
+
let n = Math.hypot(e.clientX - t.x, e.clientY - t.y);
|
|
587
|
+
if (t.drag === null && n < (t.mouse ? Z : ne)) return;
|
|
588
|
+
if (!t.mouse) {
|
|
589
|
+
b.current = null;
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
t.drag ??= t.scroll.drag(), t.drag.move(t.y - e.clientY);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
let n = g.current;
|
|
596
|
+
if (n === null) return;
|
|
597
|
+
let r = j();
|
|
598
|
+
if (r === null) return;
|
|
599
|
+
if (!n.moved) {
|
|
600
|
+
if (Math.hypot(e.clientX - n.x, e.clientY - n.y) < Z) return;
|
|
601
|
+
n.moved = !0, y.current?.(), y.current = k(f.current?.ownerDocument, S ? "col-resize" : "row-resize"), d.setDragging(!0);
|
|
602
|
+
}
|
|
603
|
+
let i = F(I(e, r) + n.offset, 0, 1);
|
|
604
|
+
h.current = T(h.current, {
|
|
605
|
+
at: e.timeStamp,
|
|
606
|
+
fraction: i
|
|
607
|
+
}), ce(i, e);
|
|
608
|
+
}, z = (e) => {
|
|
609
|
+
let { rest: t, stops: n } = P();
|
|
610
|
+
if (n.length < 2) return;
|
|
611
|
+
let r = (d.nodes.panel === null ? void 0 : J.get(d.nodes.panel))?.at() ?? d.live ?? d.extent ?? t ?? E, i = n.find((e) => e > r && !oe(e, r)) ?? n[0];
|
|
612
|
+
d.requestExtent(Y(d, i, t), "pointer", e);
|
|
613
|
+
}, V = (e) => {
|
|
614
|
+
let t = b.current;
|
|
615
|
+
if (t !== null) {
|
|
616
|
+
b.current = null, t.drag === null ? e.type === "pointerup" && z(e) : t.drag.end();
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
let n = g.current;
|
|
620
|
+
if (n === null) return;
|
|
621
|
+
if (g.current = null, e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), !n.moved) {
|
|
622
|
+
e.type === "pointerup" && z(e);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
y.current?.(), y.current = null, d.setDragging(!1);
|
|
626
|
+
let r = j(), i = r === null ? 0 : S ? r.width : r.height, a = p.current ?? E, o = e.type === "pointercancel" ? 0 : ae(h.current, e.timeStamp);
|
|
627
|
+
p.current = null, h.current = [];
|
|
628
|
+
let { rest: s, stops: c } = P(), l = c.length > 0 ? M({
|
|
629
|
+
fraction: a,
|
|
630
|
+
span: i,
|
|
631
|
+
stops: c,
|
|
632
|
+
velocity: o
|
|
633
|
+
}) : a < d.minExtent || o * i <= -re ? "close" : F(a, d.minExtent, d.maxExtent);
|
|
634
|
+
if (l === "close") {
|
|
635
|
+
let t = c.length > 0 ? c[0] : d.minExtent;
|
|
636
|
+
d.close("pointer", void 0, e), d.requestExtent(n.before, "pointer", e), requestAnimationFrame(() => {
|
|
637
|
+
x.current.open && x.current.requestExtent(t, "pointer", e);
|
|
638
|
+
});
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
d.requestExtent(c.length > 0 ? Y(d, l, s) : l, "pointer", e);
|
|
642
|
+
}, H = (e) => {
|
|
643
|
+
if (i?.(e), e.defaultPrevented) return;
|
|
644
|
+
let n = ie(d.side, le(f.current)), r = S ? "ArrowLeft" : "ArrowUp", a = S ? "ArrowRight" : "ArrowDown", o = (n) => {
|
|
645
|
+
e.preventDefault();
|
|
646
|
+
let r = j(), i = r === null ? 0 : N({
|
|
647
|
+
pixels: e.shiftKey ? t : c,
|
|
648
|
+
rect: r,
|
|
649
|
+
side: d.side
|
|
650
|
+
}), { rest: a, stops: o } = P(), s = se({
|
|
651
|
+
amount: i,
|
|
652
|
+
direction: n,
|
|
653
|
+
fraction: E,
|
|
654
|
+
max: o.at(-1) ?? d.maxExtent,
|
|
655
|
+
min: o[0] ?? d.minExtent,
|
|
656
|
+
snapPoints: o
|
|
657
|
+
});
|
|
658
|
+
d.requestExtent(Y(d, s, a), "keyboard", e);
|
|
659
|
+
}, s = (t) => {
|
|
660
|
+
e.preventDefault();
|
|
661
|
+
let { rest: n, stops: r } = P(), i = t === "first" ? r[0] ?? d.minExtent : r.at(-1) ?? d.maxExtent;
|
|
662
|
+
d.requestExtent(Y(d, i, n), "keyboard", e);
|
|
663
|
+
};
|
|
664
|
+
switch (e.key) {
|
|
665
|
+
case r: return o(n ? -1 : 1);
|
|
666
|
+
case a: return o(n ? 1 : -1);
|
|
667
|
+
case "Home": return s("first");
|
|
668
|
+
case "End": return s("last");
|
|
669
|
+
case "Enter": return e.preventDefault(), E > d.minExtent ? (te.current = E, d.requestExtent(d.minExtent, "keyboard", e)) : d.requestExtent(te.current ?? d.maxExtent, "keyboard", e);
|
|
670
|
+
default: return;
|
|
671
|
+
}
|
|
672
|
+
}, U = (e) => {
|
|
673
|
+
n?.(e), !e.defaultPrevented && (e.preventDefault(), d.requestExtent(d.defaultExtent, "pointer", e));
|
|
674
|
+
}, W = d.size === "content" && d.rest !== void 0 ? Math.min(d.minExtent, d.rest) : d.minExtent, G = r({
|
|
675
|
+
"aria-controls": d.panelId,
|
|
676
|
+
...d.titleId === "" ? {} : { "aria-labelledby": d.titleId },
|
|
677
|
+
"aria-orientation": S ? "vertical" : "horizontal",
|
|
678
|
+
"aria-valuemax": O(d.maxExtent),
|
|
679
|
+
"aria-valuemin": O(W),
|
|
680
|
+
"aria-valuenow": O(F(E, W, d.maxExtent)),
|
|
681
|
+
...u,
|
|
682
|
+
className: e,
|
|
683
|
+
"data-part": "resizer",
|
|
684
|
+
onDoubleClick: U,
|
|
685
|
+
onKeyDown: H,
|
|
686
|
+
onLostPointerCapture: V,
|
|
687
|
+
onPointerCancel: () => {
|
|
688
|
+
b.current = null;
|
|
689
|
+
},
|
|
690
|
+
onPointerDown: L,
|
|
691
|
+
onPointerMove: R,
|
|
692
|
+
onPointerUp: V,
|
|
693
|
+
role: "separator",
|
|
694
|
+
style: l,
|
|
695
|
+
tabIndex: 0
|
|
696
|
+
}), de = (e) => {
|
|
697
|
+
f.current = e, typeof o == "function" ? o(e) : o && (o.current = e);
|
|
698
|
+
}, fe = /* @__PURE__ */ v(ee, { children: [
|
|
699
|
+
/* @__PURE__ */ _("span", {
|
|
700
|
+
"aria-hidden": "true",
|
|
701
|
+
"data-part": "line",
|
|
702
|
+
"data-part-line": ""
|
|
703
|
+
}),
|
|
704
|
+
/* @__PURE__ */ _("span", {
|
|
705
|
+
"aria-hidden": "true",
|
|
706
|
+
"data-part": "grip",
|
|
707
|
+
"data-part-grip": ""
|
|
708
|
+
}),
|
|
709
|
+
/* @__PURE__ */ _("span", {
|
|
710
|
+
"aria-hidden": "true",
|
|
711
|
+
"data-part": "line",
|
|
712
|
+
"data-part-line": ""
|
|
713
|
+
})
|
|
714
|
+
] });
|
|
715
|
+
return s === void 0 ? /* @__PURE__ */ _("div", {
|
|
716
|
+
...G,
|
|
717
|
+
ref: de,
|
|
718
|
+
children: fe
|
|
719
|
+
}) : s({
|
|
720
|
+
...G,
|
|
721
|
+
children: fe,
|
|
722
|
+
ref: de
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
function Q({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
|
|
726
|
+
let s = r({
|
|
727
|
+
...o,
|
|
728
|
+
children: e,
|
|
729
|
+
className: t,
|
|
730
|
+
"data-part": "header",
|
|
731
|
+
style: a
|
|
732
|
+
});
|
|
733
|
+
return i === void 0 ? /* @__PURE__ */ _("header", {
|
|
734
|
+
...s,
|
|
735
|
+
ref: n
|
|
736
|
+
}) : i(s);
|
|
737
|
+
}
|
|
738
|
+
function ye({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
|
|
739
|
+
let s = B();
|
|
740
|
+
l(() => s.announce("title"), [s]);
|
|
741
|
+
let c = r({
|
|
742
|
+
...o,
|
|
743
|
+
children: e,
|
|
744
|
+
className: t,
|
|
745
|
+
"data-part": "title",
|
|
746
|
+
id: s.titleId === "" ? void 0 : s.titleId,
|
|
747
|
+
style: a
|
|
748
|
+
});
|
|
749
|
+
return i === void 0 ? /* @__PURE__ */ _("h2", {
|
|
750
|
+
...c,
|
|
751
|
+
ref: n
|
|
752
|
+
}) : i(c);
|
|
753
|
+
}
|
|
754
|
+
function be({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
|
|
755
|
+
let s = B();
|
|
756
|
+
l(() => s.announce("description"), [s]);
|
|
757
|
+
let c = r({
|
|
758
|
+
...o,
|
|
759
|
+
children: e,
|
|
760
|
+
className: t,
|
|
761
|
+
"data-part": "description",
|
|
762
|
+
id: s.descriptionId === "" ? void 0 : s.descriptionId,
|
|
763
|
+
style: a
|
|
764
|
+
});
|
|
765
|
+
return i === void 0 ? /* @__PURE__ */ _("p", {
|
|
766
|
+
...c,
|
|
767
|
+
ref: n
|
|
768
|
+
}) : i(c);
|
|
769
|
+
}
|
|
770
|
+
function xe({ children: e, className: t, inset: n, ref: i, render: a, style: o, ...s }) {
|
|
771
|
+
let c = B(), l = r({
|
|
772
|
+
...s,
|
|
773
|
+
...c.loading ? { "aria-busy": !0 } : {},
|
|
774
|
+
children: e,
|
|
775
|
+
className: t,
|
|
776
|
+
...n === void 0 ? {} : { "data-inset": n },
|
|
777
|
+
"data-part": "body",
|
|
778
|
+
style: o
|
|
779
|
+
});
|
|
780
|
+
return a === void 0 ? /* @__PURE__ */ _("div", {
|
|
781
|
+
...l,
|
|
782
|
+
ref: i
|
|
783
|
+
}) : a(l);
|
|
784
|
+
}
|
|
785
|
+
function Se({ children: e, className: t, ref: n, render: i, style: a, ...o }) {
|
|
786
|
+
let s = r({
|
|
787
|
+
...o,
|
|
788
|
+
children: e,
|
|
789
|
+
className: t,
|
|
790
|
+
"data-part": "footer",
|
|
791
|
+
style: a
|
|
792
|
+
});
|
|
793
|
+
return i === void 0 ? /* @__PURE__ */ _("footer", {
|
|
794
|
+
...s,
|
|
795
|
+
ref: n
|
|
796
|
+
}) : i(s);
|
|
797
|
+
}
|
|
798
|
+
function Ce({ children: e, className: i, onClick: a, ref: o, render: s, style: c, value: l, ...u }) {
|
|
799
|
+
let d = B(), f = r({
|
|
800
|
+
"aria-label": d.t("close"),
|
|
801
|
+
...u,
|
|
802
|
+
children: e ?? /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(t, { name: "x" }) }),
|
|
803
|
+
className: i,
|
|
804
|
+
"data-part": "close",
|
|
805
|
+
onClick: (e) => {
|
|
806
|
+
a?.(e), !e.defaultPrevented && d.close("dismiss", l, e);
|
|
807
|
+
},
|
|
808
|
+
style: c,
|
|
809
|
+
type: "button"
|
|
810
|
+
});
|
|
811
|
+
return s === void 0 ? /* @__PURE__ */ _("button", {
|
|
812
|
+
...f,
|
|
813
|
+
ref: o
|
|
814
|
+
}) : s(f);
|
|
815
|
+
}
|
|
816
|
+
//#endregion
|
|
817
|
+
export { Q as a, ye as c, B as d, R as f, Se as i, K as l, Ce as n, _e as o, L as p, be as r, ve as s, xe as t, H as u };
|