@robuust-digital/vue-components 1.0.1-rc.3 → 1.1.1
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 +10 -0
- package/dist/style.css +1 -0
- package/dist/tailwind/components/alert.js +188 -0
- package/dist/tailwind/components/badge.js +224 -0
- package/dist/tailwind/components/button.js +28 -38
- package/dist/tailwind/components/drawer.js +95 -0
- package/dist/tailwind/index.js +9 -3
- package/dist/vue-components.es.js +1300 -25
- package/dist/vue-components.umd.js +4 -1
- package/package.json +5 -3
|
@@ -1,12 +1,119 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as _e from "vue";
|
|
2
|
+
import { openBlock as P, createElementBlock as fe, createElementVNode as $, createBlock as Y, resolveDynamicComponent as de, normalizeClass as le, withCtx as V, renderSlot as k, createCommentVNode as J, toDisplayString as ce, createVNode as q, unref as R, createTextVNode as Oe, watchEffect as x, mergeProps as Ct, ref as h, computed as m, cloneVNode as Dt, h as S, Fragment as ot, defineComponent as T, inject as B, provide as H, onMounted as L, onUnmounted as N, watch as re, shallowRef as kt, getCurrentInstance as xt, Teleport as Bt, reactive as Nt, nextTick as jt, withModifiers as Mt } from "vue";
|
|
3
|
+
function it(e, t) {
|
|
4
|
+
return P(), fe("svg", {
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
viewBox: "0 0 24 24",
|
|
7
|
+
fill: "currentColor",
|
|
8
|
+
"aria-hidden": "true",
|
|
9
|
+
"data-slot": "icon"
|
|
10
|
+
}, [
|
|
11
|
+
$("path", {
|
|
12
|
+
"fill-rule": "evenodd",
|
|
13
|
+
d: "M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",
|
|
14
|
+
"clip-rule": "evenodd"
|
|
15
|
+
})
|
|
16
|
+
]);
|
|
17
|
+
}
|
|
18
|
+
const Rt = { class: "alert-title" }, Zn = {
|
|
19
|
+
__name: "Alert",
|
|
20
|
+
props: {
|
|
21
|
+
as: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "div"
|
|
24
|
+
},
|
|
25
|
+
title: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
icon: {
|
|
30
|
+
type: [Object, Function],
|
|
31
|
+
default: null
|
|
32
|
+
},
|
|
33
|
+
type: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "default",
|
|
36
|
+
validator: (e) => ["success", "warning", "danger", "default"].includes(e)
|
|
37
|
+
},
|
|
38
|
+
close: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
emits: ["alert:close"],
|
|
44
|
+
setup(e) {
|
|
45
|
+
return (t, n) => (P(), Y(de(e.as), {
|
|
46
|
+
class: le(["alert", `alert-${e.type}`])
|
|
47
|
+
}, {
|
|
48
|
+
default: V(() => [
|
|
49
|
+
k(t.$slots, "icon", {}, () => [
|
|
50
|
+
e.icon ? (P(), Y(de(e.icon), {
|
|
51
|
+
key: 0,
|
|
52
|
+
class: "alert-icon"
|
|
53
|
+
})) : J("", !0)
|
|
54
|
+
]),
|
|
55
|
+
$("div", null, [
|
|
56
|
+
k(t.$slots, "title", {}, () => [
|
|
57
|
+
$("span", Rt, ce(e.title), 1)
|
|
58
|
+
]),
|
|
59
|
+
k(t.$slots, "default")
|
|
60
|
+
]),
|
|
61
|
+
k(t.$slots, "close", {}, () => [
|
|
62
|
+
e.close ? (P(), fe("button", {
|
|
63
|
+
key: 0,
|
|
64
|
+
type: "button",
|
|
65
|
+
class: "alert-close rvc-transition-colors",
|
|
66
|
+
onClick: n[0] || (n[0] = (l) => t.$emit("alert:close"))
|
|
67
|
+
}, [
|
|
68
|
+
q(R(it), { class: "rvc-size-5" })
|
|
69
|
+
])) : J("", !0)
|
|
70
|
+
])
|
|
71
|
+
]),
|
|
72
|
+
_: 3
|
|
73
|
+
}, 8, ["class"]));
|
|
74
|
+
}
|
|
75
|
+
}, ut = (e) => typeof e != "string" ? !1 : /^(primary|secondary|tertiary|light|dark|danger|warning|success)(-soft)?$/.test(e) || e.startsWith("custom-") || e === "clear", Jn = {
|
|
76
|
+
__name: "Badge",
|
|
77
|
+
props: {
|
|
78
|
+
as: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: "span"
|
|
81
|
+
},
|
|
82
|
+
label: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: ""
|
|
85
|
+
},
|
|
86
|
+
size: {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "base",
|
|
89
|
+
validator: (e) => ["xs", "sm", "base", "lg"].includes(e)
|
|
90
|
+
},
|
|
91
|
+
color: {
|
|
92
|
+
type: String,
|
|
93
|
+
default: "primary",
|
|
94
|
+
validator: (e) => ut(e)
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
setup(e) {
|
|
98
|
+
return (t, n) => (P(), Y(de(e.as), {
|
|
99
|
+
class: le(["badge", `badge-${e.color}`, `badge-${e.size}`])
|
|
100
|
+
}, {
|
|
101
|
+
default: V(() => [
|
|
102
|
+
k(t.$slots, "default", { label: e.label }, () => [
|
|
103
|
+
Oe(ce(e.label), 1)
|
|
104
|
+
])
|
|
105
|
+
]),
|
|
106
|
+
_: 3
|
|
107
|
+
}, 8, ["class"]));
|
|
108
|
+
}
|
|
109
|
+
}, Ht = {
|
|
3
110
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4
111
|
fill: "none",
|
|
5
112
|
viewBox: "0 0 24 24"
|
|
6
113
|
};
|
|
7
|
-
function
|
|
8
|
-
return
|
|
9
|
-
|
|
114
|
+
function It(e, t) {
|
|
115
|
+
return P(), fe("svg", Ht, t[0] || (t[0] = [
|
|
116
|
+
$("circle", {
|
|
10
117
|
cx: "12",
|
|
11
118
|
cy: "12",
|
|
12
119
|
r: "10",
|
|
@@ -14,19 +121,26 @@ function f(t, e) {
|
|
|
14
121
|
"stroke-width": "4",
|
|
15
122
|
style: { opacity: ".25" }
|
|
16
123
|
}, null, -1),
|
|
17
|
-
|
|
124
|
+
$("path", {
|
|
18
125
|
fill: "currentColor",
|
|
19
126
|
d: "M4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12zm2 5.291A7.96 7.96 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938z"
|
|
20
127
|
}, null, -1)
|
|
21
128
|
]));
|
|
22
129
|
}
|
|
23
|
-
const
|
|
130
|
+
const Ut = { render: It }, Wt = {
|
|
131
|
+
key: 0,
|
|
132
|
+
class: "rvc-sr-only"
|
|
133
|
+
}, et = {
|
|
24
134
|
__name: "ButtonBase",
|
|
25
135
|
props: {
|
|
26
136
|
as: {
|
|
27
137
|
type: [String, Object, Function],
|
|
28
138
|
default: "button"
|
|
29
139
|
},
|
|
140
|
+
bindAs: {
|
|
141
|
+
type: String,
|
|
142
|
+
default: void 0
|
|
143
|
+
},
|
|
30
144
|
label: {
|
|
31
145
|
type: String,
|
|
32
146
|
default: ""
|
|
@@ -35,13 +149,17 @@ const b = { render: f }, k = {
|
|
|
35
149
|
type: [Object, Function],
|
|
36
150
|
default: null
|
|
37
151
|
},
|
|
152
|
+
iconOnly: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
default: !1
|
|
155
|
+
},
|
|
38
156
|
iconLeft: {
|
|
39
157
|
type: Boolean
|
|
40
158
|
},
|
|
41
159
|
size: {
|
|
42
160
|
type: String,
|
|
43
161
|
default: "base",
|
|
44
|
-
validator: (
|
|
162
|
+
validator: (e) => ["sm", "base"].includes(e)
|
|
45
163
|
},
|
|
46
164
|
spinning: {
|
|
47
165
|
type: Boolean
|
|
@@ -49,32 +167,1189 @@ const b = { render: f }, k = {
|
|
|
49
167
|
color: {
|
|
50
168
|
type: String,
|
|
51
169
|
default: "primary",
|
|
52
|
-
validator: (
|
|
170
|
+
validator: (e) => ut(e)
|
|
53
171
|
}
|
|
54
172
|
},
|
|
55
|
-
setup(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
173
|
+
setup(e) {
|
|
174
|
+
const t = e;
|
|
175
|
+
return x(() => {
|
|
176
|
+
t.iconOnly && !t.icon && console.warn("[ButtonBase] Using iconOnly prop without providing an icon may result in an empty button.");
|
|
177
|
+
}), (n, l) => (P(), Y(de(e.as), Ct(e.bindAs ? { as: e.bindAs } : {}, {
|
|
178
|
+
class: ["button", `button-${e.color}`, `button-${e.size}`, { "button-reverse": e.iconLeft }, { "button-icon-only": e.iconOnly }],
|
|
179
|
+
"aria-label": e.iconOnly ? e.label : null,
|
|
180
|
+
"aria-busy": e.spinning
|
|
181
|
+
}), {
|
|
182
|
+
default: V(() => [
|
|
183
|
+
e.iconOnly && e.label ? (P(), fe("span", Wt, [
|
|
184
|
+
k(n.$slots, "default", { label: e.label }, () => [
|
|
185
|
+
Oe(ce(e.label), 1)
|
|
186
|
+
])
|
|
187
|
+
])) : e.label ? k(n.$slots, "default", {
|
|
188
|
+
key: 1,
|
|
189
|
+
label: e.label
|
|
190
|
+
}, () => [
|
|
191
|
+
Oe(ce(e.label), 1)
|
|
192
|
+
]) : J("", !0),
|
|
193
|
+
k(n.$slots, "icon", { icon: e.icon }, () => [
|
|
194
|
+
e.icon && !e.spinning ? (P(), Y(de(e.icon), {
|
|
63
195
|
key: 0,
|
|
64
|
-
class: "button-icon"
|
|
65
|
-
|
|
196
|
+
class: "button-icon",
|
|
197
|
+
"aria-hidden": !e.iconOnly
|
|
198
|
+
}, null, 8, ["aria-hidden"])) : J("", !0)
|
|
66
199
|
]),
|
|
67
|
-
|
|
68
|
-
|
|
200
|
+
k(n.$slots, "spinner", { spinning: e.spinning }, () => [
|
|
201
|
+
e.spinning ? (P(), Y(R(Ut), {
|
|
69
202
|
key: 0,
|
|
70
|
-
class: "button-icon button-icon-loading"
|
|
71
|
-
|
|
203
|
+
class: "button-icon button-icon-loading",
|
|
204
|
+
"aria-hidden": "true"
|
|
205
|
+
})) : J("", !0)
|
|
72
206
|
])
|
|
73
207
|
]),
|
|
74
208
|
_: 3
|
|
75
|
-
},
|
|
209
|
+
}, 16, ["class", "aria-label", "aria-busy"]));
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
function Ge(e) {
|
|
213
|
+
typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
|
|
214
|
+
throw t;
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
function ve() {
|
|
218
|
+
let e = [], t = { addEventListener(n, l, r, a) {
|
|
219
|
+
return n.addEventListener(l, r, a), t.add(() => n.removeEventListener(l, r, a));
|
|
220
|
+
}, requestAnimationFrame(...n) {
|
|
221
|
+
let l = requestAnimationFrame(...n);
|
|
222
|
+
t.add(() => cancelAnimationFrame(l));
|
|
223
|
+
}, nextFrame(...n) {
|
|
224
|
+
t.requestAnimationFrame(() => {
|
|
225
|
+
t.requestAnimationFrame(...n);
|
|
226
|
+
});
|
|
227
|
+
}, setTimeout(...n) {
|
|
228
|
+
let l = setTimeout(...n);
|
|
229
|
+
t.add(() => clearTimeout(l));
|
|
230
|
+
}, microTask(...n) {
|
|
231
|
+
let l = { current: !0 };
|
|
232
|
+
return Ge(() => {
|
|
233
|
+
l.current && n[0]();
|
|
234
|
+
}), t.add(() => {
|
|
235
|
+
l.current = !1;
|
|
236
|
+
});
|
|
237
|
+
}, style(n, l, r) {
|
|
238
|
+
let a = n.style.getPropertyValue(l);
|
|
239
|
+
return Object.assign(n.style, { [l]: r }), this.add(() => {
|
|
240
|
+
Object.assign(n.style, { [l]: a });
|
|
241
|
+
});
|
|
242
|
+
}, group(n) {
|
|
243
|
+
let l = ve();
|
|
244
|
+
return n(l), this.add(() => l.dispose());
|
|
245
|
+
}, add(n) {
|
|
246
|
+
return e.push(n), () => {
|
|
247
|
+
let l = e.indexOf(n);
|
|
248
|
+
if (l >= 0) for (let r of e.splice(l, 1)) r();
|
|
249
|
+
};
|
|
250
|
+
}, dispose() {
|
|
251
|
+
for (let n of e.splice(0)) n();
|
|
252
|
+
} };
|
|
253
|
+
return t;
|
|
254
|
+
}
|
|
255
|
+
var tt;
|
|
256
|
+
let Vt = Symbol("headlessui.useid"), qt = 0;
|
|
257
|
+
const ee = (tt = _e.useId) != null ? tt : function() {
|
|
258
|
+
return _e.inject(Vt, () => `${++qt}`)();
|
|
259
|
+
};
|
|
260
|
+
function E(e) {
|
|
261
|
+
var t;
|
|
262
|
+
if (e == null || e.value == null) return null;
|
|
263
|
+
let n = (t = e.value.$el) != null ? t : e.value;
|
|
264
|
+
return n instanceof Node ? n : null;
|
|
265
|
+
}
|
|
266
|
+
function I(e, t, ...n) {
|
|
267
|
+
if (e in t) {
|
|
268
|
+
let r = t[e];
|
|
269
|
+
return typeof r == "function" ? r(...n) : r;
|
|
270
|
+
}
|
|
271
|
+
let l = new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map((r) => `"${r}"`).join(", ")}.`);
|
|
272
|
+
throw Error.captureStackTrace && Error.captureStackTrace(l, I), l;
|
|
273
|
+
}
|
|
274
|
+
var zt = Object.defineProperty, Gt = (e, t, n) => t in e ? zt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, nt = (e, t, n) => (Gt(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
275
|
+
let Yt = class {
|
|
276
|
+
constructor() {
|
|
277
|
+
nt(this, "current", this.detect()), nt(this, "currentId", 0);
|
|
278
|
+
}
|
|
279
|
+
set(t) {
|
|
280
|
+
this.current !== t && (this.currentId = 0, this.current = t);
|
|
281
|
+
}
|
|
282
|
+
reset() {
|
|
283
|
+
this.set(this.detect());
|
|
284
|
+
}
|
|
285
|
+
nextId() {
|
|
286
|
+
return ++this.currentId;
|
|
287
|
+
}
|
|
288
|
+
get isServer() {
|
|
289
|
+
return this.current === "server";
|
|
290
|
+
}
|
|
291
|
+
get isClient() {
|
|
292
|
+
return this.current === "client";
|
|
293
|
+
}
|
|
294
|
+
detect() {
|
|
295
|
+
return typeof window > "u" || typeof document > "u" ? "server" : "client";
|
|
296
|
+
}
|
|
297
|
+
}, pe = new Yt();
|
|
298
|
+
function ae(e) {
|
|
299
|
+
if (pe.isServer) return null;
|
|
300
|
+
if (e instanceof Node) return e.ownerDocument;
|
|
301
|
+
if (e != null && e.hasOwnProperty("value")) {
|
|
302
|
+
let t = E(e);
|
|
303
|
+
if (t) return t.ownerDocument;
|
|
304
|
+
}
|
|
305
|
+
return document;
|
|
306
|
+
}
|
|
307
|
+
let Me = ["[contentEditable=true]", "[tabindex]", "a[href]", "area[href]", "button:not([disabled])", "iframe", "input:not([disabled])", "select:not([disabled])", "textarea:not([disabled])"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
|
|
308
|
+
var z = ((e) => (e[e.First = 1] = "First", e[e.Previous = 2] = "Previous", e[e.Next = 4] = "Next", e[e.Last = 8] = "Last", e[e.WrapAround = 16] = "WrapAround", e[e.NoScroll = 32] = "NoScroll", e))(z || {}), st = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(st || {}), Kt = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(Kt || {});
|
|
309
|
+
function Xt(e = document.body) {
|
|
310
|
+
return e == null ? [] : Array.from(e.querySelectorAll(Me)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
311
|
+
}
|
|
312
|
+
var dt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(dt || {});
|
|
313
|
+
function Qt(e, t = 0) {
|
|
314
|
+
var n;
|
|
315
|
+
return e === ((n = ae(e)) == null ? void 0 : n.body) ? !1 : I(t, { 0() {
|
|
316
|
+
return e.matches(Me);
|
|
317
|
+
}, 1() {
|
|
318
|
+
let l = e;
|
|
319
|
+
for (; l !== null; ) {
|
|
320
|
+
if (l.matches(Me)) return !0;
|
|
321
|
+
l = l.parentElement;
|
|
322
|
+
}
|
|
323
|
+
return !1;
|
|
324
|
+
} });
|
|
325
|
+
}
|
|
326
|
+
var Zt = ((e) => (e[e.Keyboard = 0] = "Keyboard", e[e.Mouse = 1] = "Mouse", e))(Zt || {});
|
|
327
|
+
typeof window < "u" && typeof document < "u" && (document.addEventListener("keydown", (e) => {
|
|
328
|
+
e.metaKey || e.altKey || e.ctrlKey || (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
329
|
+
}, !0), document.addEventListener("click", (e) => {
|
|
330
|
+
e.detail === 1 ? delete document.documentElement.dataset.headlessuiFocusVisible : e.detail === 0 && (document.documentElement.dataset.headlessuiFocusVisible = "");
|
|
331
|
+
}, !0));
|
|
332
|
+
function _(e) {
|
|
333
|
+
e == null || e.focus({ preventScroll: !0 });
|
|
334
|
+
}
|
|
335
|
+
let Jt = ["textarea", "input"].join(",");
|
|
336
|
+
function _t(e) {
|
|
337
|
+
var t, n;
|
|
338
|
+
return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, Jt)) != null ? n : !1;
|
|
339
|
+
}
|
|
340
|
+
function en(e, t = (n) => n) {
|
|
341
|
+
return e.slice().sort((n, l) => {
|
|
342
|
+
let r = t(n), a = t(l);
|
|
343
|
+
if (r === null || a === null) return 0;
|
|
344
|
+
let i = r.compareDocumentPosition(a);
|
|
345
|
+
return i & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : i & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
function Te(e, t, { sorted: n = !0, relativeTo: l = null, skipElements: r = [] } = {}) {
|
|
349
|
+
var a;
|
|
350
|
+
let i = (a = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e == null ? void 0 : e.ownerDocument) != null ? a : document, o = Array.isArray(e) ? n ? en(e) : e : Xt(e);
|
|
351
|
+
r.length > 0 && o.length > 1 && (o = o.filter((v) => !r.includes(v))), l = l ?? i.activeElement;
|
|
352
|
+
let u = (() => {
|
|
353
|
+
if (t & 5) return 1;
|
|
354
|
+
if (t & 10) return -1;
|
|
355
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
356
|
+
})(), d = (() => {
|
|
357
|
+
if (t & 1) return 0;
|
|
358
|
+
if (t & 2) return Math.max(0, o.indexOf(l)) - 1;
|
|
359
|
+
if (t & 4) return Math.max(0, o.indexOf(l)) + 1;
|
|
360
|
+
if (t & 8) return o.length - 1;
|
|
361
|
+
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
362
|
+
})(), s = t & 32 ? { preventScroll: !0 } : {}, f = 0, c = o.length, p;
|
|
363
|
+
do {
|
|
364
|
+
if (f >= c || f + c <= 0) return 0;
|
|
365
|
+
let v = d + f;
|
|
366
|
+
if (t & 16) v = (v + c) % c;
|
|
367
|
+
else {
|
|
368
|
+
if (v < 0) return 3;
|
|
369
|
+
if (v >= c) return 1;
|
|
370
|
+
}
|
|
371
|
+
p = o[v], p == null || p.focus(s), f += u;
|
|
372
|
+
} while (p !== i.activeElement);
|
|
373
|
+
return t & 6 && _t(p) && p.select(), 2;
|
|
374
|
+
}
|
|
375
|
+
function ct() {
|
|
376
|
+
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
377
|
+
}
|
|
378
|
+
function tn() {
|
|
379
|
+
return /Android/gi.test(window.navigator.userAgent);
|
|
380
|
+
}
|
|
381
|
+
function nn() {
|
|
382
|
+
return ct() || tn();
|
|
383
|
+
}
|
|
384
|
+
function Se(e, t, n) {
|
|
385
|
+
pe.isServer || x((l) => {
|
|
386
|
+
document.addEventListener(e, t, n), l(() => document.removeEventListener(e, t, n));
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
function ft(e, t, n) {
|
|
390
|
+
pe.isServer || x((l) => {
|
|
391
|
+
window.addEventListener(e, t, n), l(() => window.removeEventListener(e, t, n));
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
function ln(e, t, n = m(() => !0)) {
|
|
395
|
+
function l(a, i) {
|
|
396
|
+
if (!n.value || a.defaultPrevented) return;
|
|
397
|
+
let o = i(a);
|
|
398
|
+
if (o === null || !o.getRootNode().contains(o)) return;
|
|
399
|
+
let u = function d(s) {
|
|
400
|
+
return typeof s == "function" ? d(s()) : Array.isArray(s) || s instanceof Set ? s : [s];
|
|
401
|
+
}(e);
|
|
402
|
+
for (let d of u) {
|
|
403
|
+
if (d === null) continue;
|
|
404
|
+
let s = d instanceof HTMLElement ? d : E(d);
|
|
405
|
+
if (s != null && s.contains(o) || a.composed && a.composedPath().includes(s)) return;
|
|
406
|
+
}
|
|
407
|
+
return !Qt(o, dt.Loose) && o.tabIndex !== -1 && a.preventDefault(), t(a, o);
|
|
408
|
+
}
|
|
409
|
+
let r = h(null);
|
|
410
|
+
Se("pointerdown", (a) => {
|
|
411
|
+
var i, o;
|
|
412
|
+
n.value && (r.value = ((o = (i = a.composedPath) == null ? void 0 : i.call(a)) == null ? void 0 : o[0]) || a.target);
|
|
413
|
+
}, !0), Se("mousedown", (a) => {
|
|
414
|
+
var i, o;
|
|
415
|
+
n.value && (r.value = ((o = (i = a.composedPath) == null ? void 0 : i.call(a)) == null ? void 0 : o[0]) || a.target);
|
|
416
|
+
}, !0), Se("click", (a) => {
|
|
417
|
+
nn() || r.value && (l(a, () => r.value), r.value = null);
|
|
418
|
+
}, !0), Se("touchend", (a) => l(a, () => a.target instanceof HTMLElement ? a.target : null), !0), ft("blur", (a) => l(a, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
|
|
419
|
+
}
|
|
420
|
+
var Fe = ((e) => (e[e.None = 0] = "None", e[e.RenderStrategy = 1] = "RenderStrategy", e[e.Static = 2] = "Static", e))(Fe || {}), G = ((e) => (e[e.Unmount = 0] = "Unmount", e[e.Hidden = 1] = "Hidden", e))(G || {});
|
|
421
|
+
function A({ visible: e = !0, features: t = 0, ourProps: n, theirProps: l, ...r }) {
|
|
422
|
+
var a;
|
|
423
|
+
let i = pt(l, n), o = Object.assign(r, { props: i });
|
|
424
|
+
if (e || t & 2 && i.static) return Be(o);
|
|
425
|
+
if (t & 1) {
|
|
426
|
+
let u = (a = i.unmount) == null || a ? 0 : 1;
|
|
427
|
+
return I(u, { 0() {
|
|
428
|
+
return null;
|
|
429
|
+
}, 1() {
|
|
430
|
+
return Be({ ...r, props: { ...i, hidden: !0, style: { display: "none" } } });
|
|
431
|
+
} });
|
|
432
|
+
}
|
|
433
|
+
return Be(o);
|
|
434
|
+
}
|
|
435
|
+
function Be({ props: e, attrs: t, slots: n, slot: l, name: r }) {
|
|
436
|
+
var a, i;
|
|
437
|
+
let { as: o, ...u } = mt(e, ["unmount", "static"]), d = (a = n.default) == null ? void 0 : a.call(n, l), s = {};
|
|
438
|
+
if (l) {
|
|
439
|
+
let f = !1, c = [];
|
|
440
|
+
for (let [p, v] of Object.entries(l)) typeof v == "boolean" && (f = !0), v === !0 && c.push(p);
|
|
441
|
+
f && (s["data-headlessui-state"] = c.join(" "));
|
|
442
|
+
}
|
|
443
|
+
if (o === "template") {
|
|
444
|
+
if (d = vt(d ?? []), Object.keys(u).length > 0 || Object.keys(t).length > 0) {
|
|
445
|
+
let [f, ...c] = d ?? [];
|
|
446
|
+
if (!rn(f) || c.length > 0) throw new Error(['Passing props on "template"!', "", `The current component <${r} /> is rendering a "template".`, "However we need to passthrough the following props:", Object.keys(u).concat(Object.keys(t)).map((g) => g.trim()).filter((g, b, j) => j.indexOf(g) === b).sort((g, b) => g.localeCompare(b)).map((g) => ` - ${g}`).join(`
|
|
447
|
+
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "template".', "Render a single element as the child so that we can forward the props onto that element."].map((g) => ` - ${g}`).join(`
|
|
448
|
+
`)].join(`
|
|
449
|
+
`));
|
|
450
|
+
let p = pt((i = f.props) != null ? i : {}, u, s), v = Dt(f, p, !0);
|
|
451
|
+
for (let g in p) g.startsWith("on") && (v.props || (v.props = {}), v.props[g] = p[g]);
|
|
452
|
+
return v;
|
|
453
|
+
}
|
|
454
|
+
return Array.isArray(d) && d.length === 1 ? d[0] : d;
|
|
455
|
+
}
|
|
456
|
+
return S(o, Object.assign({}, u, s), { default: () => d });
|
|
457
|
+
}
|
|
458
|
+
function vt(e) {
|
|
459
|
+
return e.flatMap((t) => t.type === ot ? vt(t.children) : [t]);
|
|
460
|
+
}
|
|
461
|
+
function pt(...e) {
|
|
462
|
+
if (e.length === 0) return {};
|
|
463
|
+
if (e.length === 1) return e[0];
|
|
464
|
+
let t = {}, n = {};
|
|
465
|
+
for (let l of e) for (let r in l) r.startsWith("on") && typeof l[r] == "function" ? (n[r] != null || (n[r] = []), n[r].push(l[r])) : t[r] = l[r];
|
|
466
|
+
if (t.disabled || t["aria-disabled"]) return Object.assign(t, Object.fromEntries(Object.keys(n).map((l) => [l, void 0])));
|
|
467
|
+
for (let l in n) Object.assign(t, { [l](r, ...a) {
|
|
468
|
+
let i = n[l];
|
|
469
|
+
for (let o of i) {
|
|
470
|
+
if (r instanceof Event && r.defaultPrevented) return;
|
|
471
|
+
o(r, ...a);
|
|
472
|
+
}
|
|
473
|
+
} });
|
|
474
|
+
return t;
|
|
475
|
+
}
|
|
476
|
+
function mt(e, t = []) {
|
|
477
|
+
let n = Object.assign({}, e);
|
|
478
|
+
for (let l of t) l in n && delete n[l];
|
|
479
|
+
return n;
|
|
480
|
+
}
|
|
481
|
+
function rn(e) {
|
|
482
|
+
return e == null ? !1 : typeof e.type == "string" || typeof e.type == "object" || typeof e.type == "function";
|
|
483
|
+
}
|
|
484
|
+
var Pe = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(Pe || {});
|
|
485
|
+
let Re = T({ name: "Hidden", props: { as: { type: [Object, String], default: "div" }, features: { type: Number, default: 1 } }, setup(e, { slots: t, attrs: n }) {
|
|
486
|
+
return () => {
|
|
487
|
+
var l;
|
|
488
|
+
let { features: r, ...a } = e, i = { "aria-hidden": (r & 2) === 2 ? !0 : (l = a["aria-hidden"]) != null ? l : void 0, hidden: (r & 4) === 4 ? !0 : void 0, style: { position: "fixed", top: 1, left: 1, width: 1, height: 0, padding: 0, margin: -1, overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0", ...(r & 4) === 4 && (r & 2) !== 2 && { display: "none" } } };
|
|
489
|
+
return A({ ourProps: i, theirProps: a, slot: {}, attrs: n, slots: t, name: "Hidden" });
|
|
490
|
+
};
|
|
491
|
+
} }), gt = Symbol("Context");
|
|
492
|
+
var F = ((e) => (e[e.Open = 1] = "Open", e[e.Closed = 2] = "Closed", e[e.Closing = 4] = "Closing", e[e.Opening = 8] = "Opening", e))(F || {});
|
|
493
|
+
function an() {
|
|
494
|
+
return Ye() !== null;
|
|
495
|
+
}
|
|
496
|
+
function Ye() {
|
|
497
|
+
return B(gt, null);
|
|
498
|
+
}
|
|
499
|
+
function on(e) {
|
|
500
|
+
H(gt, e);
|
|
501
|
+
}
|
|
502
|
+
var ht = ((e) => (e.Space = " ", e.Enter = "Enter", e.Escape = "Escape", e.Backspace = "Backspace", e.Delete = "Delete", e.ArrowLeft = "ArrowLeft", e.ArrowUp = "ArrowUp", e.ArrowRight = "ArrowRight", e.ArrowDown = "ArrowDown", e.Home = "Home", e.End = "End", e.PageUp = "PageUp", e.PageDown = "PageDown", e.Tab = "Tab", e))(ht || {});
|
|
503
|
+
function un(e) {
|
|
504
|
+
function t() {
|
|
505
|
+
document.readyState !== "loading" && (e(), document.removeEventListener("DOMContentLoaded", t));
|
|
506
|
+
}
|
|
507
|
+
typeof window < "u" && typeof document < "u" && (document.addEventListener("DOMContentLoaded", t), t());
|
|
508
|
+
}
|
|
509
|
+
let Q = [];
|
|
510
|
+
un(() => {
|
|
511
|
+
function e(t) {
|
|
512
|
+
t.target instanceof HTMLElement && t.target !== document.body && Q[0] !== t.target && (Q.unshift(t.target), Q = Q.filter((n) => n != null && n.isConnected), Q.splice(10));
|
|
513
|
+
}
|
|
514
|
+
window.addEventListener("click", e, { capture: !0 }), window.addEventListener("mousedown", e, { capture: !0 }), window.addEventListener("focus", e, { capture: !0 }), document.body.addEventListener("click", e, { capture: !0 }), document.body.addEventListener("mousedown", e, { capture: !0 }), document.body.addEventListener("focus", e, { capture: !0 });
|
|
515
|
+
});
|
|
516
|
+
function yt(e, t, n, l) {
|
|
517
|
+
pe.isServer || x((r) => {
|
|
518
|
+
e = e ?? window, e.addEventListener(t, n, l), r(() => e.removeEventListener(t, n, l));
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
var se = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(se || {});
|
|
522
|
+
function sn() {
|
|
523
|
+
let e = h(0);
|
|
524
|
+
return ft("keydown", (t) => {
|
|
525
|
+
t.key === "Tab" && (e.value = t.shiftKey ? 1 : 0);
|
|
526
|
+
}), e;
|
|
527
|
+
}
|
|
528
|
+
function bt(e) {
|
|
529
|
+
if (!e) return /* @__PURE__ */ new Set();
|
|
530
|
+
if (typeof e == "function") return new Set(e());
|
|
531
|
+
let t = /* @__PURE__ */ new Set();
|
|
532
|
+
for (let n of e.value) {
|
|
533
|
+
let l = E(n);
|
|
534
|
+
l instanceof HTMLElement && t.add(l);
|
|
535
|
+
}
|
|
536
|
+
return t;
|
|
537
|
+
}
|
|
538
|
+
var wt = ((e) => (e[e.None = 1] = "None", e[e.InitialFocus = 2] = "InitialFocus", e[e.TabLock = 4] = "TabLock", e[e.FocusLock = 8] = "FocusLock", e[e.RestoreFocus = 16] = "RestoreFocus", e[e.All = 30] = "All", e))(wt || {});
|
|
539
|
+
let ie = Object.assign(T({ name: "FocusTrap", props: { as: { type: [Object, String], default: "div" }, initialFocus: { type: Object, default: null }, features: { type: Number, default: 30 }, containers: { type: [Object, Function], default: h(/* @__PURE__ */ new Set()) } }, inheritAttrs: !1, setup(e, { attrs: t, slots: n, expose: l }) {
|
|
540
|
+
let r = h(null);
|
|
541
|
+
l({ el: r, $el: r });
|
|
542
|
+
let a = m(() => ae(r)), i = h(!1);
|
|
543
|
+
L(() => i.value = !0), N(() => i.value = !1), cn({ ownerDocument: a }, m(() => i.value && !!(e.features & 16)));
|
|
544
|
+
let o = fn({ ownerDocument: a, container: r, initialFocus: m(() => e.initialFocus) }, m(() => i.value && !!(e.features & 2)));
|
|
545
|
+
vn({ ownerDocument: a, container: r, containers: e.containers, previousActiveElement: o }, m(() => i.value && !!(e.features & 8)));
|
|
546
|
+
let u = sn();
|
|
547
|
+
function d(p) {
|
|
548
|
+
let v = E(r);
|
|
549
|
+
v && ((g) => g())(() => {
|
|
550
|
+
I(u.value, { [se.Forwards]: () => {
|
|
551
|
+
Te(v, z.First, { skipElements: [p.relatedTarget] });
|
|
552
|
+
}, [se.Backwards]: () => {
|
|
553
|
+
Te(v, z.Last, { skipElements: [p.relatedTarget] });
|
|
554
|
+
} });
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
let s = h(!1);
|
|
558
|
+
function f(p) {
|
|
559
|
+
p.key === "Tab" && (s.value = !0, requestAnimationFrame(() => {
|
|
560
|
+
s.value = !1;
|
|
561
|
+
}));
|
|
562
|
+
}
|
|
563
|
+
function c(p) {
|
|
564
|
+
if (!i.value) return;
|
|
565
|
+
let v = bt(e.containers);
|
|
566
|
+
E(r) instanceof HTMLElement && v.add(E(r));
|
|
567
|
+
let g = p.relatedTarget;
|
|
568
|
+
g instanceof HTMLElement && g.dataset.headlessuiFocusGuard !== "true" && (Et(v, g) || (s.value ? Te(E(r), I(u.value, { [se.Forwards]: () => z.Next, [se.Backwards]: () => z.Previous }) | z.WrapAround, { relativeTo: p.target }) : p.target instanceof HTMLElement && _(p.target)));
|
|
569
|
+
}
|
|
570
|
+
return () => {
|
|
571
|
+
let p = {}, v = { ref: r, onKeydown: f, onFocusout: c }, { features: g, initialFocus: b, containers: j, ...O } = e;
|
|
572
|
+
return S(ot, [!!(g & 4) && S(Re, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: d, features: Pe.Focusable }), A({ ourProps: v, theirProps: { ...t, ...O }, slot: p, attrs: t, slots: n, name: "FocusTrap" }), !!(g & 4) && S(Re, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: d, features: Pe.Focusable })]);
|
|
573
|
+
};
|
|
574
|
+
} }), { features: wt });
|
|
575
|
+
function dn(e) {
|
|
576
|
+
let t = h(Q.slice());
|
|
577
|
+
return re([e], ([n], [l]) => {
|
|
578
|
+
l === !0 && n === !1 ? Ge(() => {
|
|
579
|
+
t.value.splice(0);
|
|
580
|
+
}) : l === !1 && n === !0 && (t.value = Q.slice());
|
|
581
|
+
}, { flush: "post" }), () => {
|
|
582
|
+
var n;
|
|
583
|
+
return (n = t.value.find((l) => l != null && l.isConnected)) != null ? n : null;
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
function cn({ ownerDocument: e }, t) {
|
|
587
|
+
let n = dn(t);
|
|
588
|
+
L(() => {
|
|
589
|
+
x(() => {
|
|
590
|
+
var l, r;
|
|
591
|
+
t.value || ((l = e.value) == null ? void 0 : l.activeElement) === ((r = e.value) == null ? void 0 : r.body) && _(n());
|
|
592
|
+
}, { flush: "post" });
|
|
593
|
+
}), N(() => {
|
|
594
|
+
t.value && _(n());
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
function fn({ ownerDocument: e, container: t, initialFocus: n }, l) {
|
|
598
|
+
let r = h(null), a = h(!1);
|
|
599
|
+
return L(() => a.value = !0), N(() => a.value = !1), L(() => {
|
|
600
|
+
re([t, n, l], (i, o) => {
|
|
601
|
+
if (i.every((d, s) => (o == null ? void 0 : o[s]) === d) || !l.value) return;
|
|
602
|
+
let u = E(t);
|
|
603
|
+
u && Ge(() => {
|
|
604
|
+
var d, s;
|
|
605
|
+
if (!a.value) return;
|
|
606
|
+
let f = E(n), c = (d = e.value) == null ? void 0 : d.activeElement;
|
|
607
|
+
if (f) {
|
|
608
|
+
if (f === c) {
|
|
609
|
+
r.value = c;
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
} else if (u.contains(c)) {
|
|
613
|
+
r.value = c;
|
|
614
|
+
return;
|
|
615
|
+
}
|
|
616
|
+
f ? _(f) : Te(u, z.First | z.NoScroll) === st.Error && console.warn("There are no focusable elements inside the <FocusTrap />"), r.value = (s = e.value) == null ? void 0 : s.activeElement;
|
|
617
|
+
});
|
|
618
|
+
}, { immediate: !0, flush: "post" });
|
|
619
|
+
}), r;
|
|
620
|
+
}
|
|
621
|
+
function vn({ ownerDocument: e, container: t, containers: n, previousActiveElement: l }, r) {
|
|
622
|
+
var a;
|
|
623
|
+
yt((a = e.value) == null ? void 0 : a.defaultView, "focus", (i) => {
|
|
624
|
+
if (!r.value) return;
|
|
625
|
+
let o = bt(n);
|
|
626
|
+
E(t) instanceof HTMLElement && o.add(E(t));
|
|
627
|
+
let u = l.value;
|
|
628
|
+
if (!u) return;
|
|
629
|
+
let d = i.target;
|
|
630
|
+
d && d instanceof HTMLElement ? Et(o, d) ? (l.value = d, _(d)) : (i.preventDefault(), i.stopPropagation(), _(u)) : _(l.value);
|
|
631
|
+
}, !0);
|
|
632
|
+
}
|
|
633
|
+
function Et(e, t) {
|
|
634
|
+
for (let n of e) if (n.contains(t)) return !0;
|
|
635
|
+
return !1;
|
|
636
|
+
}
|
|
637
|
+
function pn(e) {
|
|
638
|
+
let t = kt(e.getSnapshot());
|
|
639
|
+
return N(e.subscribe(() => {
|
|
640
|
+
t.value = e.getSnapshot();
|
|
641
|
+
})), t;
|
|
642
|
+
}
|
|
643
|
+
function mn(e, t) {
|
|
644
|
+
let n = e(), l = /* @__PURE__ */ new Set();
|
|
645
|
+
return { getSnapshot() {
|
|
646
|
+
return n;
|
|
647
|
+
}, subscribe(r) {
|
|
648
|
+
return l.add(r), () => l.delete(r);
|
|
649
|
+
}, dispatch(r, ...a) {
|
|
650
|
+
let i = t[r].call(n, ...a);
|
|
651
|
+
i && (n = i, l.forEach((o) => o()));
|
|
652
|
+
} };
|
|
653
|
+
}
|
|
654
|
+
function gn() {
|
|
655
|
+
let e;
|
|
656
|
+
return { before({ doc: t }) {
|
|
657
|
+
var n;
|
|
658
|
+
let l = t.documentElement;
|
|
659
|
+
e = ((n = t.defaultView) != null ? n : window).innerWidth - l.clientWidth;
|
|
660
|
+
}, after({ doc: t, d: n }) {
|
|
661
|
+
let l = t.documentElement, r = l.clientWidth - l.offsetWidth, a = e - r;
|
|
662
|
+
n.style(l, "paddingRight", `${a}px`);
|
|
663
|
+
} };
|
|
664
|
+
}
|
|
665
|
+
function hn() {
|
|
666
|
+
return ct() ? { before({ doc: e, d: t, meta: n }) {
|
|
667
|
+
function l(r) {
|
|
668
|
+
return n.containers.flatMap((a) => a()).some((a) => a.contains(r));
|
|
669
|
+
}
|
|
670
|
+
t.microTask(() => {
|
|
671
|
+
var r;
|
|
672
|
+
if (window.getComputedStyle(e.documentElement).scrollBehavior !== "auto") {
|
|
673
|
+
let o = ve();
|
|
674
|
+
o.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => o.dispose()));
|
|
675
|
+
}
|
|
676
|
+
let a = (r = window.scrollY) != null ? r : window.pageYOffset, i = null;
|
|
677
|
+
t.addEventListener(e, "click", (o) => {
|
|
678
|
+
if (o.target instanceof HTMLElement) try {
|
|
679
|
+
let u = o.target.closest("a");
|
|
680
|
+
if (!u) return;
|
|
681
|
+
let { hash: d } = new URL(u.href), s = e.querySelector(d);
|
|
682
|
+
s && !l(s) && (i = s);
|
|
683
|
+
} catch {
|
|
684
|
+
}
|
|
685
|
+
}, !0), t.addEventListener(e, "touchstart", (o) => {
|
|
686
|
+
if (o.target instanceof HTMLElement) if (l(o.target)) {
|
|
687
|
+
let u = o.target;
|
|
688
|
+
for (; u.parentElement && l(u.parentElement); ) u = u.parentElement;
|
|
689
|
+
t.style(u, "overscrollBehavior", "contain");
|
|
690
|
+
} else t.style(o.target, "touchAction", "none");
|
|
691
|
+
}), t.addEventListener(e, "touchmove", (o) => {
|
|
692
|
+
if (o.target instanceof HTMLElement) {
|
|
693
|
+
if (o.target.tagName === "INPUT") return;
|
|
694
|
+
if (l(o.target)) {
|
|
695
|
+
let u = o.target;
|
|
696
|
+
for (; u.parentElement && u.dataset.headlessuiPortal !== "" && !(u.scrollHeight > u.clientHeight || u.scrollWidth > u.clientWidth); ) u = u.parentElement;
|
|
697
|
+
u.dataset.headlessuiPortal === "" && o.preventDefault();
|
|
698
|
+
} else o.preventDefault();
|
|
699
|
+
}
|
|
700
|
+
}, { passive: !1 }), t.add(() => {
|
|
701
|
+
var o;
|
|
702
|
+
let u = (o = window.scrollY) != null ? o : window.pageYOffset;
|
|
703
|
+
a !== u && window.scrollTo(0, a), i && i.isConnected && (i.scrollIntoView({ block: "nearest" }), i = null);
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
} } : {};
|
|
707
|
+
}
|
|
708
|
+
function yn() {
|
|
709
|
+
return { before({ doc: e, d: t }) {
|
|
710
|
+
t.style(e.documentElement, "overflow", "hidden");
|
|
711
|
+
} };
|
|
712
|
+
}
|
|
713
|
+
function bn(e) {
|
|
714
|
+
let t = {};
|
|
715
|
+
for (let n of e) Object.assign(t, n(t));
|
|
716
|
+
return t;
|
|
717
|
+
}
|
|
718
|
+
let Z = mn(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
|
|
719
|
+
var n;
|
|
720
|
+
let l = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: ve(), meta: /* @__PURE__ */ new Set() };
|
|
721
|
+
return l.count++, l.meta.add(t), this.set(e, l), this;
|
|
722
|
+
}, POP(e, t) {
|
|
723
|
+
let n = this.get(e);
|
|
724
|
+
return n && (n.count--, n.meta.delete(t)), this;
|
|
725
|
+
}, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
|
|
726
|
+
let l = { doc: e, d: t, meta: bn(n) }, r = [hn(), gn(), yn()];
|
|
727
|
+
r.forEach(({ before: a }) => a == null ? void 0 : a(l)), r.forEach(({ after: a }) => a == null ? void 0 : a(l));
|
|
728
|
+
}, SCROLL_ALLOW({ d: e }) {
|
|
729
|
+
e.dispose();
|
|
730
|
+
}, TEARDOWN({ doc: e }) {
|
|
731
|
+
this.delete(e);
|
|
732
|
+
} });
|
|
733
|
+
Z.subscribe(() => {
|
|
734
|
+
let e = Z.getSnapshot(), t = /* @__PURE__ */ new Map();
|
|
735
|
+
for (let [n] of e) t.set(n, n.documentElement.style.overflow);
|
|
736
|
+
for (let n of e.values()) {
|
|
737
|
+
let l = t.get(n.doc) === "hidden", r = n.count !== 0;
|
|
738
|
+
(r && !l || !r && l) && Z.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && Z.dispatch("TEARDOWN", n);
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
function wn(e, t, n) {
|
|
742
|
+
let l = pn(Z), r = m(() => {
|
|
743
|
+
let a = e.value ? l.value.get(e.value) : void 0;
|
|
744
|
+
return a ? a.count > 0 : !1;
|
|
745
|
+
});
|
|
746
|
+
return re([e, t], ([a, i], [o], u) => {
|
|
747
|
+
if (!a || !i) return;
|
|
748
|
+
Z.dispatch("PUSH", a, n);
|
|
749
|
+
let d = !1;
|
|
750
|
+
u(() => {
|
|
751
|
+
d || (Z.dispatch("POP", o ?? a, n), d = !0);
|
|
752
|
+
});
|
|
753
|
+
}, { immediate: !0 }), r;
|
|
754
|
+
}
|
|
755
|
+
let Ne = /* @__PURE__ */ new Map(), ue = /* @__PURE__ */ new Map();
|
|
756
|
+
function lt(e, t = h(!0)) {
|
|
757
|
+
x((n) => {
|
|
758
|
+
var l;
|
|
759
|
+
if (!t.value) return;
|
|
760
|
+
let r = E(e);
|
|
761
|
+
if (!r) return;
|
|
762
|
+
n(function() {
|
|
763
|
+
var i;
|
|
764
|
+
if (!r) return;
|
|
765
|
+
let o = (i = ue.get(r)) != null ? i : 1;
|
|
766
|
+
if (o === 1 ? ue.delete(r) : ue.set(r, o - 1), o !== 1) return;
|
|
767
|
+
let u = Ne.get(r);
|
|
768
|
+
u && (u["aria-hidden"] === null ? r.removeAttribute("aria-hidden") : r.setAttribute("aria-hidden", u["aria-hidden"]), r.inert = u.inert, Ne.delete(r));
|
|
769
|
+
});
|
|
770
|
+
let a = (l = ue.get(r)) != null ? l : 0;
|
|
771
|
+
ue.set(r, a + 1), a === 0 && (Ne.set(r, { "aria-hidden": r.getAttribute("aria-hidden"), inert: r.inert }), r.setAttribute("aria-hidden", "true"), r.inert = !0);
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
function En({ defaultContainers: e = [], portals: t, mainTreeNodeRef: n } = {}) {
|
|
775
|
+
let l = h(null), r = ae(l);
|
|
776
|
+
function a() {
|
|
777
|
+
var i, o, u;
|
|
778
|
+
let d = [];
|
|
779
|
+
for (let s of e) s !== null && (s instanceof HTMLElement ? d.push(s) : "value" in s && s.value instanceof HTMLElement && d.push(s.value));
|
|
780
|
+
if (t != null && t.value) for (let s of t.value) d.push(s);
|
|
781
|
+
for (let s of (i = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? i : []) s !== document.body && s !== document.head && s instanceof HTMLElement && s.id !== "headlessui-portal-root" && (s.contains(E(l)) || s.contains((u = (o = E(l)) == null ? void 0 : o.getRootNode()) == null ? void 0 : u.host) || d.some((f) => s.contains(f)) || d.push(s));
|
|
782
|
+
return d;
|
|
783
|
+
}
|
|
784
|
+
return { resolveContainers: a, contains(i) {
|
|
785
|
+
return a().some((o) => o.contains(i));
|
|
786
|
+
}, mainTreeNodeRef: l, MainTreeNode() {
|
|
787
|
+
return n != null ? null : S(Re, { features: Pe.Hidden, ref: l });
|
|
788
|
+
} };
|
|
789
|
+
}
|
|
790
|
+
let St = Symbol("ForcePortalRootContext");
|
|
791
|
+
function Sn() {
|
|
792
|
+
return B(St, !1);
|
|
793
|
+
}
|
|
794
|
+
let He = T({ name: "ForcePortalRoot", props: { as: { type: [Object, String], default: "template" }, force: { type: Boolean, default: !1 } }, setup(e, { slots: t, attrs: n }) {
|
|
795
|
+
return H(St, e.force), () => {
|
|
796
|
+
let { force: l, ...r } = e;
|
|
797
|
+
return A({ theirProps: r, ourProps: {}, slot: {}, slots: t, attrs: n, name: "ForcePortalRoot" });
|
|
798
|
+
};
|
|
799
|
+
} }), $t = Symbol("StackContext");
|
|
800
|
+
var Ie = ((e) => (e[e.Add = 0] = "Add", e[e.Remove = 1] = "Remove", e))(Ie || {});
|
|
801
|
+
function $n() {
|
|
802
|
+
return B($t, () => {
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
function Ln({ type: e, enabled: t, element: n, onUpdate: l }) {
|
|
806
|
+
let r = $n();
|
|
807
|
+
function a(...i) {
|
|
808
|
+
l == null || l(...i), r(...i);
|
|
809
|
+
}
|
|
810
|
+
L(() => {
|
|
811
|
+
re(t, (i, o) => {
|
|
812
|
+
i ? a(0, e, n) : o === !0 && a(1, e, n);
|
|
813
|
+
}, { immediate: !0, flush: "sync" });
|
|
814
|
+
}), N(() => {
|
|
815
|
+
t.value && a(1, e, n);
|
|
816
|
+
}), H($t, a);
|
|
817
|
+
}
|
|
818
|
+
let Lt = Symbol("DescriptionContext");
|
|
819
|
+
function Tn() {
|
|
820
|
+
let e = B(Lt, null);
|
|
821
|
+
if (e === null) throw new Error("Missing parent");
|
|
822
|
+
return e;
|
|
823
|
+
}
|
|
824
|
+
function On({ slot: e = h({}), name: t = "Description", props: n = {} } = {}) {
|
|
825
|
+
let l = h([]);
|
|
826
|
+
function r(a) {
|
|
827
|
+
return l.value.push(a), () => {
|
|
828
|
+
let i = l.value.indexOf(a);
|
|
829
|
+
i !== -1 && l.value.splice(i, 1);
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
return H(Lt, { register: r, slot: e, name: t, props: n }), m(() => l.value.length > 0 ? l.value.join(" ") : void 0);
|
|
833
|
+
}
|
|
834
|
+
T({ name: "Description", props: { as: { type: [Object, String], default: "p" }, id: { type: String, default: null } }, setup(e, { attrs: t, slots: n }) {
|
|
835
|
+
var l;
|
|
836
|
+
let r = (l = e.id) != null ? l : `headlessui-description-${ee()}`, a = Tn();
|
|
837
|
+
return L(() => N(a.register(r))), () => {
|
|
838
|
+
let { name: i = "Description", slot: o = h({}), props: u = {} } = a, { ...d } = e, s = { ...Object.entries(u).reduce((f, [c, p]) => Object.assign(f, { [c]: R(p) }), {}), id: r };
|
|
839
|
+
return A({ ourProps: s, theirProps: d, slot: o.value, attrs: t, slots: n, name: i });
|
|
840
|
+
};
|
|
841
|
+
} });
|
|
842
|
+
function Fn(e) {
|
|
843
|
+
let t = ae(e);
|
|
844
|
+
if (!t) {
|
|
845
|
+
if (e === null) return null;
|
|
846
|
+
throw new Error(`[Headless UI]: Cannot find ownerDocument for contextElement: ${e}`);
|
|
847
|
+
}
|
|
848
|
+
let n = t.getElementById("headlessui-portal-root");
|
|
849
|
+
if (n) return n;
|
|
850
|
+
let l = t.createElement("div");
|
|
851
|
+
return l.setAttribute("id", "headlessui-portal-root"), t.body.appendChild(l);
|
|
852
|
+
}
|
|
853
|
+
const Ue = /* @__PURE__ */ new WeakMap();
|
|
854
|
+
function Pn(e) {
|
|
855
|
+
var t;
|
|
856
|
+
return (t = Ue.get(e)) != null ? t : 0;
|
|
857
|
+
}
|
|
858
|
+
function rt(e, t) {
|
|
859
|
+
let n = t(Pn(e));
|
|
860
|
+
return n <= 0 ? Ue.delete(e) : Ue.set(e, n), n;
|
|
861
|
+
}
|
|
862
|
+
let Tt = T({ name: "Portal", props: { as: { type: [Object, String], default: "div" } }, setup(e, { slots: t, attrs: n }) {
|
|
863
|
+
let l = h(null), r = m(() => ae(l)), a = Sn(), i = B(Ot, null), o = h(a === !0 || i == null ? Fn(l.value) : i.resolveTarget());
|
|
864
|
+
o.value && rt(o.value, (c) => c + 1);
|
|
865
|
+
let u = h(!1);
|
|
866
|
+
L(() => {
|
|
867
|
+
u.value = !0;
|
|
868
|
+
}), x(() => {
|
|
869
|
+
a || i != null && (o.value = i.resolveTarget());
|
|
870
|
+
});
|
|
871
|
+
let d = B(We, null), s = !1, f = xt();
|
|
872
|
+
return re(l, () => {
|
|
873
|
+
if (s || !d) return;
|
|
874
|
+
let c = E(l);
|
|
875
|
+
c && (N(d.register(c), f), s = !0);
|
|
876
|
+
}), N(() => {
|
|
877
|
+
var c, p;
|
|
878
|
+
let v = (c = r.value) == null ? void 0 : c.getElementById("headlessui-portal-root");
|
|
879
|
+
!v || o.value !== v || rt(o.value, (g) => g - 1) || o.value.children.length > 0 || (p = o.value.parentElement) == null || p.removeChild(o.value);
|
|
880
|
+
}), () => {
|
|
881
|
+
if (!u.value || o.value === null) return null;
|
|
882
|
+
let c = { ref: l, "data-headlessui-portal": "" };
|
|
883
|
+
return S(Bt, { to: o.value }, A({ ourProps: c, theirProps: e, slot: {}, attrs: n, slots: t, name: "Portal" }));
|
|
884
|
+
};
|
|
885
|
+
} }), We = Symbol("PortalParentContext");
|
|
886
|
+
function An() {
|
|
887
|
+
let e = B(We, null), t = h([]);
|
|
888
|
+
function n(a) {
|
|
889
|
+
return t.value.push(a), e && e.register(a), () => l(a);
|
|
890
|
+
}
|
|
891
|
+
function l(a) {
|
|
892
|
+
let i = t.value.indexOf(a);
|
|
893
|
+
i !== -1 && t.value.splice(i, 1), e && e.unregister(a);
|
|
894
|
+
}
|
|
895
|
+
let r = { register: n, unregister: l, portals: t };
|
|
896
|
+
return [t, T({ name: "PortalWrapper", setup(a, { slots: i }) {
|
|
897
|
+
return H(We, r), () => {
|
|
898
|
+
var o;
|
|
899
|
+
return (o = i.default) == null ? void 0 : o.call(i);
|
|
900
|
+
};
|
|
901
|
+
} })];
|
|
902
|
+
}
|
|
903
|
+
let Ot = Symbol("PortalGroupContext"), Cn = T({ name: "PortalGroup", props: { as: { type: [Object, String], default: "template" }, target: { type: Object, default: null } }, setup(e, { attrs: t, slots: n }) {
|
|
904
|
+
let l = Nt({ resolveTarget() {
|
|
905
|
+
return e.target;
|
|
906
|
+
} });
|
|
907
|
+
return H(Ot, l), () => {
|
|
908
|
+
let { target: r, ...a } = e;
|
|
909
|
+
return A({ theirProps: a, ourProps: {}, slot: {}, attrs: t, slots: n, name: "PortalGroup" });
|
|
910
|
+
};
|
|
911
|
+
} });
|
|
912
|
+
var Dn = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(Dn || {});
|
|
913
|
+
let Ve = Symbol("DialogContext");
|
|
914
|
+
function me(e) {
|
|
915
|
+
let t = B(Ve, null);
|
|
916
|
+
if (t === null) {
|
|
917
|
+
let n = new Error(`<${e} /> is missing a parent <Dialog /> component.`);
|
|
918
|
+
throw Error.captureStackTrace && Error.captureStackTrace(n, me), n;
|
|
919
|
+
}
|
|
920
|
+
return t;
|
|
921
|
+
}
|
|
922
|
+
let $e = "DC8F892D-2EBD-447C-A4C8-A03058436FF4", kn = T({ name: "Dialog", inheritAttrs: !1, props: { as: { type: [Object, String], default: "div" }, static: { type: Boolean, default: !1 }, unmount: { type: Boolean, default: !0 }, open: { type: [Boolean, String], default: $e }, initialFocus: { type: Object, default: null }, id: { type: String, default: null }, role: { type: String, default: "dialog" } }, emits: { close: (e) => !0 }, setup(e, { emit: t, attrs: n, slots: l, expose: r }) {
|
|
923
|
+
var a, i;
|
|
924
|
+
let o = (a = e.id) != null ? a : `headlessui-dialog-${ee()}`, u = h(!1);
|
|
925
|
+
L(() => {
|
|
926
|
+
u.value = !0;
|
|
927
|
+
});
|
|
928
|
+
let d = !1, s = m(() => e.role === "dialog" || e.role === "alertdialog" ? e.role : (d || (d = !0, console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog")), f = h(0), c = Ye(), p = m(() => e.open === $e && c !== null ? (c.value & F.Open) === F.Open : e.open), v = h(null), g = m(() => ae(v));
|
|
929
|
+
if (r({ el: v, $el: v }), !(e.open !== $e || c !== null)) throw new Error("You forgot to provide an `open` prop to the `Dialog`.");
|
|
930
|
+
if (typeof p.value != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${p.value === $e ? void 0 : e.open}`);
|
|
931
|
+
let b = m(() => u.value && p.value ? 0 : 1), j = m(() => b.value === 0), O = m(() => f.value > 1), K = B(Ve, null) !== null, [ge, he] = An(), { resolveContainers: te, mainTreeNodeRef: ye, MainTreeNode: be } = En({ portals: ge, defaultContainers: [m(() => {
|
|
932
|
+
var y;
|
|
933
|
+
return (y = ne.panelRef.value) != null ? y : v.value;
|
|
934
|
+
})] }), Ce = m(() => O.value ? "parent" : "leaf"), we = m(() => c !== null ? (c.value & F.Closing) === F.Closing : !1), De = m(() => K || we.value ? !1 : j.value), ke = m(() => {
|
|
935
|
+
var y, w, C;
|
|
936
|
+
return (C = Array.from((w = (y = g.value) == null ? void 0 : y.querySelectorAll("body > *")) != null ? w : []).find((D) => D.id === "headlessui-portal-root" ? !1 : D.contains(E(ye)) && D instanceof HTMLElement)) != null ? C : null;
|
|
937
|
+
});
|
|
938
|
+
lt(ke, De);
|
|
939
|
+
let M = m(() => O.value ? !0 : j.value), oe = m(() => {
|
|
940
|
+
var y, w, C;
|
|
941
|
+
return (C = Array.from((w = (y = g.value) == null ? void 0 : y.querySelectorAll("[data-headlessui-portal]")) != null ? w : []).find((D) => D.contains(E(ye)) && D instanceof HTMLElement)) != null ? C : null;
|
|
942
|
+
});
|
|
943
|
+
lt(oe, M), Ln({ type: "Dialog", enabled: m(() => b.value === 0), element: v, onUpdate: (y, w) => {
|
|
944
|
+
if (w === "Dialog") return I(y, { [Ie.Add]: () => f.value += 1, [Ie.Remove]: () => f.value -= 1 });
|
|
945
|
+
} });
|
|
946
|
+
let U = On({ name: "DialogDescription", slot: m(() => ({ open: p.value })) }), W = h(null), ne = { titleId: W, panelRef: h(null), dialogState: b, setTitleId(y) {
|
|
947
|
+
W.value !== y && (W.value = y);
|
|
948
|
+
}, close() {
|
|
949
|
+
t("close", !1);
|
|
950
|
+
} };
|
|
951
|
+
H(Ve, ne);
|
|
952
|
+
let Qe = m(() => !(!j.value || O.value));
|
|
953
|
+
ln(te, (y, w) => {
|
|
954
|
+
y.preventDefault(), ne.close(), jt(() => w == null ? void 0 : w.focus());
|
|
955
|
+
}, Qe);
|
|
956
|
+
let Ze = m(() => !(O.value || b.value !== 0));
|
|
957
|
+
yt((i = g.value) == null ? void 0 : i.defaultView, "keydown", (y) => {
|
|
958
|
+
Ze.value && (y.defaultPrevented || y.key === ht.Escape && (y.preventDefault(), y.stopPropagation(), ne.close()));
|
|
959
|
+
});
|
|
960
|
+
let Je = m(() => !(we.value || b.value !== 0 || K));
|
|
961
|
+
return wn(g, Je, (y) => {
|
|
962
|
+
var w;
|
|
963
|
+
return { containers: [...(w = y.containers) != null ? w : [], te] };
|
|
964
|
+
}), x((y) => {
|
|
965
|
+
if (b.value !== 0) return;
|
|
966
|
+
let w = E(v);
|
|
967
|
+
if (!w) return;
|
|
968
|
+
let C = new ResizeObserver((D) => {
|
|
969
|
+
for (let xe of D) {
|
|
970
|
+
let Ee = xe.target.getBoundingClientRect();
|
|
971
|
+
Ee.x === 0 && Ee.y === 0 && Ee.width === 0 && Ee.height === 0 && ne.close();
|
|
972
|
+
}
|
|
973
|
+
});
|
|
974
|
+
C.observe(w), y(() => C.disconnect());
|
|
975
|
+
}), () => {
|
|
976
|
+
let { open: y, initialFocus: w, ...C } = e, D = { ...n, ref: v, id: o, role: s.value, "aria-modal": b.value === 0 ? !0 : void 0, "aria-labelledby": W.value, "aria-describedby": U.value }, xe = { open: b.value === 0 };
|
|
977
|
+
return S(He, { force: !0 }, () => [S(Tt, () => S(Cn, { target: v.value }, () => S(He, { force: !1 }, () => S(ie, { initialFocus: w, containers: te, features: j.value ? I(Ce.value, { parent: ie.features.RestoreFocus, leaf: ie.features.All & ~ie.features.FocusLock }) : ie.features.None }, () => S(he, {}, () => A({ ourProps: D, theirProps: { ...C, ...n }, slot: xe, attrs: n, slots: l, visible: b.value === 0, features: Fe.RenderStrategy | Fe.Static, name: "Dialog" })))))), S(be)]);
|
|
978
|
+
};
|
|
979
|
+
} });
|
|
980
|
+
T({ name: "DialogOverlay", props: { as: { type: [Object, String], default: "div" }, id: { type: String, default: null } }, setup(e, { attrs: t, slots: n }) {
|
|
981
|
+
var l;
|
|
982
|
+
let r = (l = e.id) != null ? l : `headlessui-dialog-overlay-${ee()}`, a = me("DialogOverlay");
|
|
983
|
+
function i(o) {
|
|
984
|
+
o.target === o.currentTarget && (o.preventDefault(), o.stopPropagation(), a.close());
|
|
985
|
+
}
|
|
986
|
+
return () => {
|
|
987
|
+
let { ...o } = e;
|
|
988
|
+
return A({ ourProps: { id: r, "aria-hidden": !0, onClick: i }, theirProps: o, slot: { open: a.dialogState.value === 0 }, attrs: t, slots: n, name: "DialogOverlay" });
|
|
989
|
+
};
|
|
990
|
+
} });
|
|
991
|
+
T({ name: "DialogBackdrop", props: { as: { type: [Object, String], default: "div" }, id: { type: String, default: null } }, inheritAttrs: !1, setup(e, { attrs: t, slots: n, expose: l }) {
|
|
992
|
+
var r;
|
|
993
|
+
let a = (r = e.id) != null ? r : `headlessui-dialog-backdrop-${ee()}`, i = me("DialogBackdrop"), o = h(null);
|
|
994
|
+
return l({ el: o, $el: o }), L(() => {
|
|
995
|
+
if (i.panelRef.value === null) throw new Error("A <DialogBackdrop /> component is being used, but a <DialogPanel /> component is missing.");
|
|
996
|
+
}), () => {
|
|
997
|
+
let { ...u } = e, d = { id: a, ref: o, "aria-hidden": !0 };
|
|
998
|
+
return S(He, { force: !0 }, () => S(Tt, () => A({ ourProps: d, theirProps: { ...t, ...u }, slot: { open: i.dialogState.value === 0 }, attrs: t, slots: n, name: "DialogBackdrop" })));
|
|
999
|
+
};
|
|
1000
|
+
} });
|
|
1001
|
+
let xn = T({ name: "DialogPanel", props: { as: { type: [Object, String], default: "div" }, id: { type: String, default: null } }, setup(e, { attrs: t, slots: n, expose: l }) {
|
|
1002
|
+
var r;
|
|
1003
|
+
let a = (r = e.id) != null ? r : `headlessui-dialog-panel-${ee()}`, i = me("DialogPanel");
|
|
1004
|
+
l({ el: i.panelRef, $el: i.panelRef });
|
|
1005
|
+
function o(u) {
|
|
1006
|
+
u.stopPropagation();
|
|
1007
|
+
}
|
|
1008
|
+
return () => {
|
|
1009
|
+
let { ...u } = e, d = { id: a, ref: i.panelRef, onClick: o };
|
|
1010
|
+
return A({ ourProps: d, theirProps: u, slot: { open: i.dialogState.value === 0 }, attrs: t, slots: n, name: "DialogPanel" });
|
|
1011
|
+
};
|
|
1012
|
+
} }), Bn = T({ name: "DialogTitle", props: { as: { type: [Object, String], default: "h2" }, id: { type: String, default: null } }, setup(e, { attrs: t, slots: n }) {
|
|
1013
|
+
var l;
|
|
1014
|
+
let r = (l = e.id) != null ? l : `headlessui-dialog-title-${ee()}`, a = me("DialogTitle");
|
|
1015
|
+
return L(() => {
|
|
1016
|
+
a.setTitleId(r), N(() => a.setTitleId(null));
|
|
1017
|
+
}), () => {
|
|
1018
|
+
let { ...i } = e;
|
|
1019
|
+
return A({ ourProps: { id: r }, theirProps: i, slot: { open: a.dialogState.value === 0 }, attrs: t, slots: n, name: "DialogTitle" });
|
|
1020
|
+
};
|
|
1021
|
+
} });
|
|
1022
|
+
function Nn(e) {
|
|
1023
|
+
let t = { called: !1 };
|
|
1024
|
+
return (...n) => {
|
|
1025
|
+
if (!t.called) return t.called = !0, e(...n);
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
function je(e, ...t) {
|
|
1029
|
+
e && t.length > 0 && e.classList.add(...t);
|
|
1030
|
+
}
|
|
1031
|
+
function Le(e, ...t) {
|
|
1032
|
+
e && t.length > 0 && e.classList.remove(...t);
|
|
1033
|
+
}
|
|
1034
|
+
var qe = ((e) => (e.Finished = "finished", e.Cancelled = "cancelled", e))(qe || {});
|
|
1035
|
+
function jn(e, t) {
|
|
1036
|
+
let n = ve();
|
|
1037
|
+
if (!e) return n.dispose;
|
|
1038
|
+
let { transitionDuration: l, transitionDelay: r } = getComputedStyle(e), [a, i] = [l, r].map((o) => {
|
|
1039
|
+
let [u = 0] = o.split(",").filter(Boolean).map((d) => d.includes("ms") ? parseFloat(d) : parseFloat(d) * 1e3).sort((d, s) => s - d);
|
|
1040
|
+
return u;
|
|
1041
|
+
});
|
|
1042
|
+
return a !== 0 ? n.setTimeout(() => t("finished"), a + i) : t("finished"), n.add(() => t("cancelled")), n.dispose;
|
|
1043
|
+
}
|
|
1044
|
+
function at(e, t, n, l, r, a) {
|
|
1045
|
+
let i = ve(), o = a !== void 0 ? Nn(a) : () => {
|
|
1046
|
+
};
|
|
1047
|
+
return Le(e, ...r), je(e, ...t, ...n), i.nextFrame(() => {
|
|
1048
|
+
Le(e, ...n), je(e, ...l), i.add(jn(e, (u) => (Le(e, ...l, ...t), je(e, ...r), o(u))));
|
|
1049
|
+
}), i.add(() => Le(e, ...t, ...n, ...l, ...r)), i.add(() => o("cancelled")), i.dispose;
|
|
1050
|
+
}
|
|
1051
|
+
function X(e = "") {
|
|
1052
|
+
return e.split(/\s+/).filter((t) => t.length > 1);
|
|
1053
|
+
}
|
|
1054
|
+
let Ke = Symbol("TransitionContext");
|
|
1055
|
+
var Mn = ((e) => (e.Visible = "visible", e.Hidden = "hidden", e))(Mn || {});
|
|
1056
|
+
function Rn() {
|
|
1057
|
+
return B(Ke, null) !== null;
|
|
1058
|
+
}
|
|
1059
|
+
function Hn() {
|
|
1060
|
+
let e = B(Ke, null);
|
|
1061
|
+
if (e === null) throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");
|
|
1062
|
+
return e;
|
|
1063
|
+
}
|
|
1064
|
+
function In() {
|
|
1065
|
+
let e = B(Xe, null);
|
|
1066
|
+
if (e === null) throw new Error("A <TransitionChild /> is used but it is missing a parent <TransitionRoot />.");
|
|
1067
|
+
return e;
|
|
1068
|
+
}
|
|
1069
|
+
let Xe = Symbol("NestingContext");
|
|
1070
|
+
function Ae(e) {
|
|
1071
|
+
return "children" in e ? Ae(e.children) : e.value.filter(({ state: t }) => t === "visible").length > 0;
|
|
1072
|
+
}
|
|
1073
|
+
function Ft(e) {
|
|
1074
|
+
let t = h([]), n = h(!1);
|
|
1075
|
+
L(() => n.value = !0), N(() => n.value = !1);
|
|
1076
|
+
function l(a, i = G.Hidden) {
|
|
1077
|
+
let o = t.value.findIndex(({ id: u }) => u === a);
|
|
1078
|
+
o !== -1 && (I(i, { [G.Unmount]() {
|
|
1079
|
+
t.value.splice(o, 1);
|
|
1080
|
+
}, [G.Hidden]() {
|
|
1081
|
+
t.value[o].state = "hidden";
|
|
1082
|
+
} }), !Ae(t) && n.value && (e == null || e()));
|
|
1083
|
+
}
|
|
1084
|
+
function r(a) {
|
|
1085
|
+
let i = t.value.find(({ id: o }) => o === a);
|
|
1086
|
+
return i ? i.state !== "visible" && (i.state = "visible") : t.value.push({ id: a, state: "visible" }), () => l(a, G.Unmount);
|
|
1087
|
+
}
|
|
1088
|
+
return { children: t, register: r, unregister: l };
|
|
1089
|
+
}
|
|
1090
|
+
let Pt = Fe.RenderStrategy, ze = T({ props: { as: { type: [Object, String], default: "div" }, show: { type: [Boolean], default: null }, unmount: { type: [Boolean], default: !0 }, appear: { type: [Boolean], default: !1 }, enter: { type: [String], default: "" }, enterFrom: { type: [String], default: "" }, enterTo: { type: [String], default: "" }, entered: { type: [String], default: "" }, leave: { type: [String], default: "" }, leaveFrom: { type: [String], default: "" }, leaveTo: { type: [String], default: "" } }, emits: { beforeEnter: () => !0, afterEnter: () => !0, beforeLeave: () => !0, afterLeave: () => !0 }, setup(e, { emit: t, attrs: n, slots: l, expose: r }) {
|
|
1091
|
+
let a = h(0);
|
|
1092
|
+
function i() {
|
|
1093
|
+
a.value |= F.Opening, t("beforeEnter");
|
|
1094
|
+
}
|
|
1095
|
+
function o() {
|
|
1096
|
+
a.value &= ~F.Opening, t("afterEnter");
|
|
1097
|
+
}
|
|
1098
|
+
function u() {
|
|
1099
|
+
a.value |= F.Closing, t("beforeLeave");
|
|
1100
|
+
}
|
|
1101
|
+
function d() {
|
|
1102
|
+
a.value &= ~F.Closing, t("afterLeave");
|
|
1103
|
+
}
|
|
1104
|
+
if (!Rn() && an()) return () => S(At, { ...e, onBeforeEnter: i, onAfterEnter: o, onBeforeLeave: u, onAfterLeave: d }, l);
|
|
1105
|
+
let s = h(null), f = m(() => e.unmount ? G.Unmount : G.Hidden);
|
|
1106
|
+
r({ el: s, $el: s });
|
|
1107
|
+
let { show: c, appear: p } = Hn(), { register: v, unregister: g } = In(), b = h(c.value ? "visible" : "hidden"), j = { value: !0 }, O = ee(), K = { value: !1 }, ge = Ft(() => {
|
|
1108
|
+
!K.value && b.value !== "hidden" && (b.value = "hidden", g(O), d());
|
|
1109
|
+
});
|
|
1110
|
+
L(() => {
|
|
1111
|
+
let M = v(O);
|
|
1112
|
+
N(M);
|
|
1113
|
+
}), x(() => {
|
|
1114
|
+
if (f.value === G.Hidden && O) {
|
|
1115
|
+
if (c.value && b.value !== "visible") {
|
|
1116
|
+
b.value = "visible";
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
I(b.value, { hidden: () => g(O), visible: () => v(O) });
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
let he = X(e.enter), te = X(e.enterFrom), ye = X(e.enterTo), be = X(e.entered), Ce = X(e.leave), we = X(e.leaveFrom), De = X(e.leaveTo);
|
|
1123
|
+
L(() => {
|
|
1124
|
+
x(() => {
|
|
1125
|
+
if (b.value === "visible") {
|
|
1126
|
+
let M = E(s);
|
|
1127
|
+
if (M instanceof Comment && M.data === "") throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
});
|
|
1131
|
+
function ke(M) {
|
|
1132
|
+
let oe = j.value && !p.value, U = E(s);
|
|
1133
|
+
!U || !(U instanceof HTMLElement) || oe || (K.value = !0, c.value && i(), c.value || u(), M(c.value ? at(U, he, te, ye, be, (W) => {
|
|
1134
|
+
K.value = !1, W === qe.Finished && o();
|
|
1135
|
+
}) : at(U, Ce, we, De, be, (W) => {
|
|
1136
|
+
K.value = !1, W === qe.Finished && (Ae(ge) || (b.value = "hidden", g(O), d()));
|
|
1137
|
+
})));
|
|
1138
|
+
}
|
|
1139
|
+
return L(() => {
|
|
1140
|
+
re([c], (M, oe, U) => {
|
|
1141
|
+
ke(U), j.value = !1;
|
|
1142
|
+
}, { immediate: !0 });
|
|
1143
|
+
}), H(Xe, ge), on(m(() => I(b.value, { visible: F.Open, hidden: F.Closed }) | a.value)), () => {
|
|
1144
|
+
let { appear: M, show: oe, enter: U, enterFrom: W, enterTo: ne, entered: Qe, leave: Ze, leaveFrom: Je, leaveTo: y, ...w } = e, C = { ref: s }, D = { ...w, ...p.value && c.value && pe.isServer ? { class: le([n.class, w.class, ...he, ...te]) } : {} };
|
|
1145
|
+
return A({ theirProps: D, ourProps: C, slot: {}, slots: l, attrs: n, features: Pt, visible: b.value === "visible", name: "TransitionChild" });
|
|
1146
|
+
};
|
|
1147
|
+
} }), Un = ze, At = T({ inheritAttrs: !1, props: { as: { type: [Object, String], default: "div" }, show: { type: [Boolean], default: null }, unmount: { type: [Boolean], default: !0 }, appear: { type: [Boolean], default: !1 }, enter: { type: [String], default: "" }, enterFrom: { type: [String], default: "" }, enterTo: { type: [String], default: "" }, entered: { type: [String], default: "" }, leave: { type: [String], default: "" }, leaveFrom: { type: [String], default: "" }, leaveTo: { type: [String], default: "" } }, emits: { beforeEnter: () => !0, afterEnter: () => !0, beforeLeave: () => !0, afterLeave: () => !0 }, setup(e, { emit: t, attrs: n, slots: l }) {
|
|
1148
|
+
let r = Ye(), a = m(() => e.show === null && r !== null ? (r.value & F.Open) === F.Open : e.show);
|
|
1149
|
+
x(() => {
|
|
1150
|
+
if (![!0, !1].includes(a.value)) throw new Error('A <Transition /> is used but it is missing a `:show="true | false"` prop.');
|
|
1151
|
+
});
|
|
1152
|
+
let i = h(a.value ? "visible" : "hidden"), o = Ft(() => {
|
|
1153
|
+
i.value = "hidden";
|
|
1154
|
+
}), u = h(!0), d = { show: a, appear: m(() => e.appear || !u.value) };
|
|
1155
|
+
return L(() => {
|
|
1156
|
+
x(() => {
|
|
1157
|
+
u.value = !1, a.value ? i.value = "visible" : Ae(o) || (i.value = "hidden");
|
|
1158
|
+
});
|
|
1159
|
+
}), H(Xe, o), H(Ke, d), () => {
|
|
1160
|
+
let s = mt(e, ["show", "appear", "unmount", "onBeforeEnter", "onBeforeLeave", "onAfterEnter", "onAfterLeave"]), f = { unmount: e.unmount };
|
|
1161
|
+
return A({ ourProps: { ...f, as: "template" }, theirProps: {}, slot: {}, slots: { ...l, default: () => [S(Un, { onBeforeEnter: () => t("beforeEnter"), onAfterEnter: () => t("afterEnter"), onBeforeLeave: () => t("beforeLeave"), onAfterLeave: () => t("afterLeave"), ...n, ...f, ...s }, l.default)] }, attrs: {}, features: Pt, visible: i.value === "visible", name: "Transition" });
|
|
1162
|
+
};
|
|
1163
|
+
} });
|
|
1164
|
+
const Wn = {
|
|
1165
|
+
class: "rvc-fixed rvc-inset-0 rvc-overflow-hidden",
|
|
1166
|
+
role: "presentation"
|
|
1167
|
+
}, Vn = { class: "rvc-absolute rvc-inset-0 rvc-overflow-hidden" }, qn = { class: "rvc-pointer-events-none rvc-fixed rvc-inset-y-0 rvc-right-0 rvc-flex rvc-max-w-full rvc-pl-10" }, zn = { class: "rvc-flex rvc-h-full rvc-flex-col rvc-shadow-xl" }, Gn = { class: "rvc-flex rvc-items-center rvc-justify-between" }, Yn = {
|
|
1168
|
+
key: 0,
|
|
1169
|
+
class: "rvc-ml-3 rvc-flex rvc-h-7 rvc-items-center"
|
|
1170
|
+
}, Kn = ["id"], Xn = { class: "rvc-flex rvc-shrink-0 drawer-footer" }, el = {
|
|
1171
|
+
__name: "Drawer",
|
|
1172
|
+
props: {
|
|
1173
|
+
as: {
|
|
1174
|
+
type: String,
|
|
1175
|
+
default: "form"
|
|
1176
|
+
},
|
|
1177
|
+
id: {
|
|
1178
|
+
type: String,
|
|
1179
|
+
required: !0
|
|
1180
|
+
},
|
|
1181
|
+
title: {
|
|
1182
|
+
type: String,
|
|
1183
|
+
required: !0
|
|
1184
|
+
},
|
|
1185
|
+
showClose: {
|
|
1186
|
+
type: Boolean
|
|
1187
|
+
},
|
|
1188
|
+
scrolledDown: {
|
|
1189
|
+
type: Boolean
|
|
1190
|
+
},
|
|
1191
|
+
headerSticky: {
|
|
1192
|
+
type: Boolean
|
|
1193
|
+
},
|
|
1194
|
+
spinning: {
|
|
1195
|
+
type: Boolean
|
|
1196
|
+
},
|
|
1197
|
+
submitLabel: {
|
|
1198
|
+
type: String,
|
|
1199
|
+
default: "Save"
|
|
1200
|
+
},
|
|
1201
|
+
cancelLabel: {
|
|
1202
|
+
type: String,
|
|
1203
|
+
default: "Cancel"
|
|
1204
|
+
},
|
|
1205
|
+
panelClass: {
|
|
1206
|
+
type: String,
|
|
1207
|
+
default: "rvc-max-w-xl"
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
emits: ["drawer:open", "drawer:close", "drawer:save"],
|
|
1211
|
+
setup(e, { emit: t }) {
|
|
1212
|
+
const n = t, l = e, r = h(null), a = h(!1), i = m(() => l.as === "form"), o = m(() => `${l.id}-title`), u = m(() => `${l.id}-content`), d = m(() => {
|
|
1213
|
+
var s;
|
|
1214
|
+
return (s = r.value) == null ? void 0 : s.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
|
|
1215
|
+
});
|
|
1216
|
+
return (s, f) => (P(), Y(R(At), { as: "template" }, {
|
|
1217
|
+
default: V(() => [
|
|
1218
|
+
q(R(kn), {
|
|
1219
|
+
as: e.as,
|
|
1220
|
+
class: "drawer",
|
|
1221
|
+
static: "",
|
|
1222
|
+
"aria-modal": "true",
|
|
1223
|
+
role: "dialog",
|
|
1224
|
+
"initial-focus": d.value,
|
|
1225
|
+
"aria-labelledby": o.value,
|
|
1226
|
+
onClose: f[5] || (f[5] = (c) => s.$emit("drawer:close")),
|
|
1227
|
+
onSubmit: f[6] || (f[6] = Mt((c) => n("drawer:save", c), ["prevent"]))
|
|
1228
|
+
}, {
|
|
1229
|
+
default: V(() => [
|
|
1230
|
+
q(R(ze), {
|
|
1231
|
+
as: "template",
|
|
1232
|
+
enter: "rvc-ease-in-out rvc-duration-500",
|
|
1233
|
+
"enter-from": "rvc-opacity-0",
|
|
1234
|
+
"enter-to": "rvc-opacity-100",
|
|
1235
|
+
leave: "rvc-ease-in-out rvc-duration-500",
|
|
1236
|
+
"leave-from": "rvc-opacity-100",
|
|
1237
|
+
"leave-to": "rvc-opacity-0",
|
|
1238
|
+
onBeforeEnter: f[0] || (f[0] = (c) => n("drawer:open"))
|
|
1239
|
+
}, {
|
|
1240
|
+
default: V(() => f[7] || (f[7] = [
|
|
1241
|
+
$("div", {
|
|
1242
|
+
class: "rvc-fixed rvc-inset-0 rvc-transition-opacity drawer-backdrop",
|
|
1243
|
+
"aria-hidden": "true"
|
|
1244
|
+
}, null, -1)
|
|
1245
|
+
])),
|
|
1246
|
+
_: 1
|
|
1247
|
+
}),
|
|
1248
|
+
$("div", Wn, [
|
|
1249
|
+
$("div", Vn, [
|
|
1250
|
+
$("div", qn, [
|
|
1251
|
+
q(R(ze), {
|
|
1252
|
+
as: "template",
|
|
1253
|
+
enter: "rvc-transform rvc-transition rvc-ease-in-out rvc-duration-500 sm:rvc-duration-700",
|
|
1254
|
+
"enter-from": "rvc-translate-x-full",
|
|
1255
|
+
"enter-to": "rvc-translate-x-0",
|
|
1256
|
+
leave: "rvc-transform rvc-transition rvc-ease-in-out rvc-duration-500 sm:rvc-duration-700",
|
|
1257
|
+
"leave-from": "rvc-translate-x-0",
|
|
1258
|
+
"leave-to": "rvc-translate-x-full",
|
|
1259
|
+
onBeforeEnter: f[3] || (f[3] = (c) => a.value = !0),
|
|
1260
|
+
onAfterLeave: f[4] || (f[4] = (c) => a.value = !1)
|
|
1261
|
+
}, {
|
|
1262
|
+
default: V(() => [
|
|
1263
|
+
q(R(xn), {
|
|
1264
|
+
class: le(["rvc-pointer-events-auto rvc-w-screen", e.panelClass]),
|
|
1265
|
+
"aria-busy": e.spinning,
|
|
1266
|
+
"aria-describedby": u.value
|
|
1267
|
+
}, {
|
|
1268
|
+
default: V(() => [
|
|
1269
|
+
$("div", zn, [
|
|
1270
|
+
$("header", {
|
|
1271
|
+
class: le([{ "rvc-sticky rvc-top-0 rvc-left-0 rvc-w-full rvc-z-10": e.headerSticky }, "drawer-header"])
|
|
1272
|
+
}, [
|
|
1273
|
+
k(s.$slots, "header", {
|
|
1274
|
+
title: e.title,
|
|
1275
|
+
showClose: e.showClose
|
|
1276
|
+
}, () => [
|
|
1277
|
+
$("div", Gn, [
|
|
1278
|
+
q(R(Bn), {
|
|
1279
|
+
id: o.value,
|
|
1280
|
+
class: "drawer-title"
|
|
1281
|
+
}, {
|
|
1282
|
+
default: V(() => [
|
|
1283
|
+
Oe(ce(e.title), 1)
|
|
1284
|
+
]),
|
|
1285
|
+
_: 1
|
|
1286
|
+
}, 8, ["id"]),
|
|
1287
|
+
e.showClose ? (P(), fe("div", Yn, [
|
|
1288
|
+
$("button", {
|
|
1289
|
+
type: "button",
|
|
1290
|
+
class: "rvc-relative drawer-close",
|
|
1291
|
+
"aria-label": "Close panel",
|
|
1292
|
+
onClick: f[1] || (f[1] = (c) => n("drawer:close"))
|
|
1293
|
+
}, [
|
|
1294
|
+
q(R(it), {
|
|
1295
|
+
class: "rvc-size-full",
|
|
1296
|
+
"aria-hidden": "true"
|
|
1297
|
+
})
|
|
1298
|
+
])
|
|
1299
|
+
])) : J("", !0)
|
|
1300
|
+
])
|
|
1301
|
+
])
|
|
1302
|
+
], 2),
|
|
1303
|
+
$("div", {
|
|
1304
|
+
class: le([e.scrolledDown ? "rvc-flex-col-reverse" : "rvc-flex-col", "rvc-flex rvc-min-h-0 rvc-flex-1 rvc-overflow-y-scroll"])
|
|
1305
|
+
}, [
|
|
1306
|
+
$("div", {
|
|
1307
|
+
id: u.value,
|
|
1308
|
+
ref_key: "contentRef",
|
|
1309
|
+
ref: r,
|
|
1310
|
+
class: "rvc-relative rvc-flex-1 drawer-content"
|
|
1311
|
+
}, [
|
|
1312
|
+
k(s.$slots, "default", { ready: a.value })
|
|
1313
|
+
], 8, Kn)
|
|
1314
|
+
], 2),
|
|
1315
|
+
$("footer", Xn, [
|
|
1316
|
+
k(s.$slots, "footer", { loading: e.spinning }, () => [
|
|
1317
|
+
q(et, {
|
|
1318
|
+
type: "button",
|
|
1319
|
+
label: e.cancelLabel,
|
|
1320
|
+
color: "light",
|
|
1321
|
+
onClick: f[2] || (f[2] = (c) => n("drawer:close"))
|
|
1322
|
+
}, null, 8, ["label"]),
|
|
1323
|
+
i.value ? (P(), Y(et, {
|
|
1324
|
+
key: 0,
|
|
1325
|
+
type: "submit",
|
|
1326
|
+
label: e.submitLabel,
|
|
1327
|
+
spinning: e.spinning,
|
|
1328
|
+
disabled: e.spinning
|
|
1329
|
+
}, null, 8, ["label", "spinning", "disabled"])) : J("", !0)
|
|
1330
|
+
])
|
|
1331
|
+
])
|
|
1332
|
+
])
|
|
1333
|
+
]),
|
|
1334
|
+
_: 3
|
|
1335
|
+
}, 8, ["class", "aria-busy", "aria-describedby"])
|
|
1336
|
+
]),
|
|
1337
|
+
_: 3
|
|
1338
|
+
})
|
|
1339
|
+
])
|
|
1340
|
+
])
|
|
1341
|
+
])
|
|
1342
|
+
]),
|
|
1343
|
+
_: 3
|
|
1344
|
+
}, 8, ["as", "initial-focus", "aria-labelledby"])
|
|
1345
|
+
]),
|
|
1346
|
+
_: 3
|
|
1347
|
+
}));
|
|
76
1348
|
}
|
|
77
1349
|
};
|
|
78
1350
|
export {
|
|
79
|
-
|
|
1351
|
+
Zn as Alert,
|
|
1352
|
+
Jn as Badge,
|
|
1353
|
+
et as ButtonBase,
|
|
1354
|
+
el as Drawer
|
|
80
1355
|
};
|