@inertiaui/modal-react 0.19.2 → 0.19.4
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/inertiaui-modal.js +550 -591
- package/dist/inertiaui-modal.umd.cjs +3 -3
- package/package.json +1 -1
- package/src/ModalRoot.jsx +0 -64
package/dist/inertiaui-modal.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var q = (e, t, n) =>
|
|
1
|
+
var fn = Object.defineProperty;
|
|
2
|
+
var mn = (e, t, n) => t in e ? fn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var q = (e, t, n) => mn(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import * as Ee from "react";
|
|
5
|
-
import E, { createContext as H,
|
|
6
|
-
import {
|
|
5
|
+
import E, { createContext as H, useContext as R, useEffect as M, useRef as O, useState as S, createElement as Re, useMemo as C, forwardRef as ct, useImperativeHandle as St, useLayoutEffect as pn, useCallback as Y, Fragment as G, isValidElement as hn, cloneElement as vn, useId as Pe, useSyncExternalStore as gn, useReducer as wn, createRef as yn } from "react";
|
|
6
|
+
import { jsxs as se, Fragment as dt, jsx as T } from "react/jsx-runtime";
|
|
7
7
|
import De from "axios";
|
|
8
|
-
import { router as
|
|
9
|
-
import { mergeDataIntoQueryString as
|
|
10
|
-
import { createPortal as
|
|
11
|
-
const
|
|
8
|
+
import { router as xe, usePage as xn } from "@inertiajs/react";
|
|
9
|
+
import { mergeDataIntoQueryString as bn } from "@inertiajs/core";
|
|
10
|
+
import { createPortal as En } from "react-dom";
|
|
11
|
+
const ge = {
|
|
12
12
|
type: "modal",
|
|
13
13
|
navigate: !1,
|
|
14
14
|
modal: {
|
|
@@ -28,27 +28,27 @@ const we = {
|
|
|
28
28
|
position: "right"
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
class
|
|
31
|
+
class $n {
|
|
32
32
|
constructor() {
|
|
33
33
|
this.config = {}, this.reset();
|
|
34
34
|
}
|
|
35
35
|
reset() {
|
|
36
|
-
this.config = JSON.parse(JSON.stringify(
|
|
36
|
+
this.config = JSON.parse(JSON.stringify(ge));
|
|
37
37
|
}
|
|
38
38
|
put(t, n) {
|
|
39
39
|
if (typeof t == "object") {
|
|
40
40
|
this.config = {
|
|
41
|
-
type: t.type ??
|
|
42
|
-
navigate: t.navigate ??
|
|
43
|
-
modal: { ...
|
|
44
|
-
slideover: { ...
|
|
41
|
+
type: t.type ?? ge.type,
|
|
42
|
+
navigate: t.navigate ?? ge.navigate,
|
|
43
|
+
modal: { ...ge.modal, ...t.modal ?? {} },
|
|
44
|
+
slideover: { ...ge.slideover, ...t.slideover ?? {} }
|
|
45
45
|
};
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
const r = t.split(".");
|
|
49
49
|
let l = this.config;
|
|
50
|
-
for (let
|
|
51
|
-
l = l[r[
|
|
50
|
+
for (let o = 0; o < r.length - 1; o++)
|
|
51
|
+
l = l[r[o]] = l[r[o]] || {};
|
|
52
52
|
l[r[r.length - 1]] = n;
|
|
53
53
|
}
|
|
54
54
|
get(t) {
|
|
@@ -64,8 +64,8 @@ class Tn {
|
|
|
64
64
|
return r;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
const _e = new
|
|
68
|
-
function
|
|
67
|
+
const _e = new $n(), Ll = () => _e.reset(), Sl = (e, t) => _e.put(e, t), ft = (e) => _e.get(e), ce = (e, t) => _e.get(e ? `slideover.${t}` : `modal.${t}`);
|
|
68
|
+
function Tn(e, t) {
|
|
69
69
|
return e = typeof e == "string" ? new URL(e, window.location.origin) : e, t = typeof t == "string" ? new URL(t, window.location.origin) : t, `${e.origin}${e.pathname}` == `${t.origin}${t.pathname}`;
|
|
70
70
|
}
|
|
71
71
|
function et(e = "inertiaui_modal_") {
|
|
@@ -74,7 +74,7 @@ function et(e = "inertiaui_modal_") {
|
|
|
74
74
|
function On(e, t) {
|
|
75
75
|
return Array.isArray(e) ? e.filter((n) => !t.includes(n)) : Object.keys(e).reduce((n, r) => (t.includes(r) || (n[r] = e[r]), n), {});
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function Ft(e, t) {
|
|
78
78
|
return Array.isArray(e) ? e.filter((n) => t.includes(n)) : t.reduce((n, r) => (r in e && (n[r] = e[r]), n), {});
|
|
79
79
|
}
|
|
80
80
|
function Pn(e) {
|
|
@@ -82,26 +82,26 @@ function Pn(e) {
|
|
|
82
82
|
}
|
|
83
83
|
function Mn(e, t = 3, n = 10) {
|
|
84
84
|
return new Promise((r, l) => {
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
r(
|
|
85
|
+
const o = e();
|
|
86
|
+
if (o) {
|
|
87
|
+
r(o);
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
|
-
let
|
|
90
|
+
let a = t * 1e3 / n;
|
|
91
91
|
const s = setInterval(() => {
|
|
92
92
|
const i = e();
|
|
93
|
-
i && (clearInterval(s), r(i)), --
|
|
93
|
+
i && (clearInterval(s), r(i)), --a <= 0 && (clearInterval(s), l(new Error("Condition not met in time")));
|
|
94
94
|
}, n);
|
|
95
95
|
});
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function we(e) {
|
|
98
98
|
return e ? (e = e.replace(/_/g, "-"), e = e.replace(/-+/g, "-"), /[A-Z]/.test(e) ? (e = e.replace(/\s+/g, "").replace(/_/g, "").replace(/(?:^|\s|-)+([A-Za-z])/g, (t, n) => n.toUpperCase()), e = e.replace(/(.)(?=[A-Z])/g, "$1-"), e.toLowerCase()) : e) : "";
|
|
99
99
|
}
|
|
100
100
|
const Be = H(null);
|
|
101
101
|
Be.displayName = "ModalStackContext";
|
|
102
|
-
let
|
|
103
|
-
const
|
|
104
|
-
const [t, n] =
|
|
102
|
+
let Ct = null, kt = null, $e = null, rt = null, Ie = [], de = {};
|
|
103
|
+
const Ln = ({ children: e }) => {
|
|
104
|
+
const [t, n] = S([]), [r, l] = S({}), o = (v) => {
|
|
105
105
|
n((u) => {
|
|
106
106
|
const m = v([...u]), p = (g) => {
|
|
107
107
|
var x;
|
|
@@ -115,10 +115,10 @@ const Sn = ({ children: e }) => {
|
|
|
115
115
|
M(() => {
|
|
116
116
|
Ie = t;
|
|
117
117
|
}, [t]);
|
|
118
|
-
class
|
|
118
|
+
class a {
|
|
119
119
|
constructor(u, m, p, g, x) {
|
|
120
120
|
q(this, "show", () => {
|
|
121
|
-
|
|
121
|
+
o(
|
|
122
122
|
(u) => u.map((m) => (m.id === this.id && !m.isOpen && (m.isOpen = !0, m.shouldRender = !0), m))
|
|
123
123
|
);
|
|
124
124
|
});
|
|
@@ -126,7 +126,7 @@ const Sn = ({ children: e }) => {
|
|
|
126
126
|
u ? this.show() : this.close();
|
|
127
127
|
});
|
|
128
128
|
q(this, "close", () => {
|
|
129
|
-
|
|
129
|
+
o(
|
|
130
130
|
(u) => u.map((m) => {
|
|
131
131
|
var p;
|
|
132
132
|
return m.id === this.id && m.isOpen && (Object.keys(m.listeners).forEach((g) => {
|
|
@@ -136,7 +136,7 @@ const Sn = ({ children: e }) => {
|
|
|
136
136
|
);
|
|
137
137
|
});
|
|
138
138
|
q(this, "afterLeave", () => {
|
|
139
|
-
this.isOpen ||
|
|
139
|
+
this.isOpen || o((u) => {
|
|
140
140
|
const m = u.map((p) => {
|
|
141
141
|
var g;
|
|
142
142
|
return p.id === this.id && !p.isOpen && (p.shouldRender = !1, (g = p.afterLeaveCallback) == null || g.call(p), p.afterLeaveCallback = null), p;
|
|
@@ -145,27 +145,27 @@ const Sn = ({ children: e }) => {
|
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
147
|
q(this, "on", (u, m) => {
|
|
148
|
-
u =
|
|
148
|
+
u = we(u), this.listeners[u] = this.listeners[u] ?? [], this.listeners[u].push(m);
|
|
149
149
|
});
|
|
150
150
|
q(this, "off", (u, m) => {
|
|
151
151
|
var p;
|
|
152
|
-
u =
|
|
152
|
+
u = we(u), m ? this.listeners[u] = ((p = this.listeners[u]) == null ? void 0 : p.filter((g) => g !== m)) ?? [] : delete this.listeners[u];
|
|
153
153
|
});
|
|
154
154
|
q(this, "emit", (u, ...m) => {
|
|
155
155
|
var p;
|
|
156
|
-
(p = this.listeners[
|
|
156
|
+
(p = this.listeners[we(u)]) == null || p.forEach((g) => g(...m));
|
|
157
157
|
});
|
|
158
158
|
q(this, "registerEventListenersFromProps", (u) => {
|
|
159
159
|
const m = [];
|
|
160
160
|
return Object.keys(u).filter((p) => p.startsWith("on")).forEach((p) => {
|
|
161
|
-
const g =
|
|
161
|
+
const g = we(p).replace(/^on-/, "");
|
|
162
162
|
this.on(g, u[p]), m.push(() => this.off(g, u[p]));
|
|
163
163
|
}), () => m.forEach((p) => p());
|
|
164
164
|
});
|
|
165
165
|
q(this, "reload", (u = {}) => {
|
|
166
166
|
var p;
|
|
167
167
|
let m = Object.keys(this.response.props);
|
|
168
|
-
u.only && (m =
|
|
168
|
+
u.only && (m = Ft(m, u.only)), u.except && (m = On(m, u.except)), (p = this.response) != null && p.url && De.get(this.response.url, {
|
|
169
169
|
headers: {
|
|
170
170
|
Accept: "text/html, application/xhtml+xml",
|
|
171
171
|
"X-Inertia": !0,
|
|
@@ -181,19 +181,19 @@ const Sn = ({ children: e }) => {
|
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
q(this, "updateProps", (u) => {
|
|
184
|
-
Object.assign(this.props, u),
|
|
184
|
+
Object.assign(this.props, u), o((m) => m);
|
|
185
185
|
});
|
|
186
|
-
if (this.id = m.id ?? et(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = u, this.props = m.props, this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = x,
|
|
186
|
+
if (this.id = m.id ?? et(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = u, this.props = m.props, this.response = m, this.config = p ?? {}, this.onCloseCallback = g, this.afterLeaveCallback = x, de[this.id]) {
|
|
187
187
|
this.config = {
|
|
188
188
|
...this.config,
|
|
189
|
-
...
|
|
189
|
+
...de[this.id].config ?? {}
|
|
190
190
|
};
|
|
191
|
-
const h =
|
|
191
|
+
const h = de[this.id].onClose, $ = de[this.id].onAfterLeave;
|
|
192
192
|
h && (this.onCloseCallback = g ? () => {
|
|
193
193
|
g(), h();
|
|
194
194
|
} : h), $ && (this.afterLeaveCallback = x ? () => {
|
|
195
195
|
x(), $();
|
|
196
|
-
} : $), delete
|
|
196
|
+
} : $), delete de[this.id];
|
|
197
197
|
}
|
|
198
198
|
this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
|
|
199
199
|
}
|
|
@@ -201,11 +201,11 @@ const Sn = ({ children: e }) => {
|
|
|
201
201
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `inertiaui_modal_${crypto.randomUUID()}` : `inertiaui_modal_${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
const s = (v, u = {}, m = null, p = null) =>
|
|
205
|
-
const x = new
|
|
206
|
-
return x.index = t.length,
|
|
204
|
+
const s = (v, u = {}, m = null, p = null) => kt(v.component).then((g) => i(g, v, u, m, p)), i = (v, u, m, p, g) => {
|
|
205
|
+
const x = new a(v, u, m, p, g);
|
|
206
|
+
return x.index = t.length, o((h) => [...h, x]), x.show(), x;
|
|
207
207
|
};
|
|
208
|
-
function
|
|
208
|
+
function c(v, u, m, p) {
|
|
209
209
|
if (!r[v])
|
|
210
210
|
throw new Error(`The local modal "${v}" has not been registered.`);
|
|
211
211
|
const g = i(null, {}, u, m, p);
|
|
@@ -224,39 +224,39 @@ const Sn = ({ children: e }) => {
|
|
|
224
224
|
).then((m) => {
|
|
225
225
|
const p = u.listeners ?? {};
|
|
226
226
|
return Object.keys(p).forEach((g) => {
|
|
227
|
-
const x =
|
|
227
|
+
const x = we(g);
|
|
228
228
|
m.on(x, p[g]);
|
|
229
229
|
}), m;
|
|
230
230
|
}), y = (v, u, m = {}, p = {}, g = {}, x = null, h = null, $ = "brackets", F = !1) => {
|
|
231
231
|
const j = et();
|
|
232
|
-
return new Promise((_,
|
|
232
|
+
return new Promise((_, N) => {
|
|
233
233
|
if (v.startsWith("#")) {
|
|
234
|
-
_(
|
|
234
|
+
_(c(v.substring(1), g, x, h));
|
|
235
235
|
return;
|
|
236
236
|
}
|
|
237
|
-
const [U, B] =
|
|
237
|
+
const [U, B] = bn(u, v || "", m, $);
|
|
238
238
|
let X = F && t.length === 0;
|
|
239
239
|
if (t.length === 0 && ($e = typeof window < "u" ? window.location.href : ""), p = {
|
|
240
240
|
...p,
|
|
241
241
|
Accept: "text/html, application/xhtml+xml",
|
|
242
242
|
"X-Requested-With": "XMLHttpRequest",
|
|
243
243
|
"X-Inertia": !0,
|
|
244
|
-
"X-Inertia-Version":
|
|
244
|
+
"X-Inertia-Version": Ct,
|
|
245
245
|
"X-InertiaUI-Modal": j,
|
|
246
246
|
"X-InertiaUI-Modal-Use-Router": X ? 1 : 0,
|
|
247
247
|
"X-InertiaUI-Modal-Base-Url": $e
|
|
248
248
|
}, X)
|
|
249
|
-
return rt = null,
|
|
249
|
+
return rt = null, de[j] = {
|
|
250
250
|
config: g,
|
|
251
251
|
onClose: x,
|
|
252
252
|
onAfterLeave: h
|
|
253
|
-
},
|
|
253
|
+
}, xe.visit(U, {
|
|
254
254
|
method: u,
|
|
255
255
|
data: B,
|
|
256
256
|
headers: p,
|
|
257
257
|
preserveScroll: !0,
|
|
258
258
|
preserveState: !0,
|
|
259
|
-
onError:
|
|
259
|
+
onError: N,
|
|
260
260
|
onFinish: () => {
|
|
261
261
|
Mn(() => rt).then(_);
|
|
262
262
|
}
|
|
@@ -267,10 +267,10 @@ const Sn = ({ children: e }) => {
|
|
|
267
267
|
data: B,
|
|
268
268
|
headers: p
|
|
269
269
|
}).then((P) => _(s(P.data, g, x, h))).catch((P) => {
|
|
270
|
-
|
|
270
|
+
N(P);
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
|
-
},
|
|
273
|
+
}, d = {
|
|
274
274
|
stack: t,
|
|
275
275
|
localModals: r,
|
|
276
276
|
push: i,
|
|
@@ -279,7 +279,7 @@ const Sn = ({ children: e }) => {
|
|
|
279
279
|
closeAll: () => {
|
|
280
280
|
Ie.reverse().forEach((v) => v.close());
|
|
281
281
|
},
|
|
282
|
-
reset: () =>
|
|
282
|
+
reset: () => o(() => []),
|
|
283
283
|
visit: y,
|
|
284
284
|
visitModal: f,
|
|
285
285
|
registerLocalModal: (v, u) => {
|
|
@@ -295,78 +295,37 @@ const Sn = ({ children: e }) => {
|
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
|
-
return /* @__PURE__ */ T(Be.Provider, { value:
|
|
298
|
+
return /* @__PURE__ */ T(Be.Provider, { value: d, children: e });
|
|
299
299
|
}, Xe = () => {
|
|
300
300
|
const e = R(Be);
|
|
301
301
|
if (e === null)
|
|
302
302
|
throw new Error("useModalStack must be used within a ModalStackProvider");
|
|
303
303
|
return e;
|
|
304
|
-
},
|
|
305
|
-
e.initialPage && (
|
|
306
|
-
}, Fl = (e, t) => (
|
|
304
|
+
}, xt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Sn = (e) => {
|
|
305
|
+
e.initialPage && (Ct = e.initialPage.version), e.resolveComponent && (kt = e.resolveComponent);
|
|
306
|
+
}, Fl = (e, t) => (Sn(t), /* @__PURE__ */ T(Ln, { children: /* @__PURE__ */ T(e, { ...t, children: ({ Component: r, props: l, key: o }) => /* @__PURE__ */ se(dt, { children: [
|
|
307
307
|
(() => {
|
|
308
|
-
const s = Re(r, { key:
|
|
309
|
-
return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((
|
|
308
|
+
const s = Re(r, { key: o, ...l });
|
|
309
|
+
return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((c, f) => Re(f, l, c)) : s;
|
|
310
310
|
})(),
|
|
311
311
|
/* @__PURE__ */ T(Fn, {})
|
|
312
312
|
] }) }) })), Fn = ({ children: e }) => {
|
|
313
313
|
var s;
|
|
314
314
|
const t = R(Be);
|
|
315
315
|
let n = !1, r = !1;
|
|
316
|
-
M(
|
|
317
|
-
() =>
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
const {
|
|
321
|
-
method: d,
|
|
322
|
-
data: f,
|
|
323
|
-
only: y,
|
|
324
|
-
except: b,
|
|
325
|
-
headers: w,
|
|
326
|
-
errorBag: c,
|
|
327
|
-
forceFormData: v,
|
|
328
|
-
queryStringArrayFormat: u,
|
|
329
|
-
async: m,
|
|
330
|
-
showProgress: p,
|
|
331
|
-
prefetch: g,
|
|
332
|
-
fresh: x,
|
|
333
|
-
reset: h,
|
|
334
|
-
preserveUrl: $
|
|
335
|
-
} = i.detail.visit;
|
|
336
|
-
return le.visit(i.detail.visit.url, {
|
|
337
|
-
replace: !0,
|
|
338
|
-
preserveScroll: !0,
|
|
339
|
-
preserveState: !0,
|
|
340
|
-
method: d,
|
|
341
|
-
data: f,
|
|
342
|
-
only: y,
|
|
343
|
-
except: b,
|
|
344
|
-
headers: w,
|
|
345
|
-
errorBag: c,
|
|
346
|
-
forceFormData: v,
|
|
347
|
-
queryStringArrayFormat: u,
|
|
348
|
-
async: m,
|
|
349
|
-
showProgress: p,
|
|
350
|
-
prefetch: g,
|
|
351
|
-
fresh: x,
|
|
352
|
-
reset: h,
|
|
353
|
-
preserveUrl: $
|
|
354
|
-
}), !1;
|
|
355
|
-
}),
|
|
356
|
-
[]
|
|
357
|
-
), M(() => le.on("start", () => n = !0), []), M(() => le.on("finish", () => n = !1), []), M(
|
|
358
|
-
() => le.on("navigate", function(i) {
|
|
359
|
-
const d = i.detail.page.props._inertiaui_modal;
|
|
360
|
-
if (!d) {
|
|
316
|
+
M(() => xe.on("start", () => n = !0), []), M(() => xe.on("finish", () => n = !1), []), M(
|
|
317
|
+
() => xe.on("navigate", function(i) {
|
|
318
|
+
const c = i.detail.page.props._inertiaui_modal;
|
|
319
|
+
if (!c) {
|
|
361
320
|
r && t.closeAll();
|
|
362
321
|
return;
|
|
363
322
|
}
|
|
364
|
-
r =
|
|
365
|
-
if (!
|
|
323
|
+
r = c, $e = c.baseUrl, t.pushFromResponseData(c, {}, () => {
|
|
324
|
+
if (!c.baseUrl) {
|
|
366
325
|
console.error("No base url in modal response data so cannot navigate back");
|
|
367
326
|
return;
|
|
368
327
|
}
|
|
369
|
-
!n && window.location.href !==
|
|
328
|
+
!n && window.location.href !== c.baseUrl && xe.visit(c.baseUrl, {
|
|
370
329
|
preserveScroll: !0,
|
|
371
330
|
preserveState: !0
|
|
372
331
|
});
|
|
@@ -378,14 +337,14 @@ const Sn = ({ children: e }) => {
|
|
|
378
337
|
);
|
|
379
338
|
const l = (i) => (Ie.length && (i.headers["X-InertiaUI-Modal-Base-Url"] = $e), i);
|
|
380
339
|
M(() => (De.interceptors.request.use(l), () => De.interceptors.request.eject(l)), []);
|
|
381
|
-
const
|
|
340
|
+
const o = xn(), a = O();
|
|
382
341
|
return M(() => {
|
|
383
342
|
var f, y;
|
|
384
|
-
const i = (f =
|
|
385
|
-
|
|
386
|
-
}, [(s =
|
|
343
|
+
const i = (f = o.props) == null ? void 0 : f._inertiaui_modal, c = a.current;
|
|
344
|
+
a.current = i, i && c && i.component === c.component && Tn(i.url, c.url) && ((y = t.stack[0]) == null || y.updateProps(i.props ?? {}));
|
|
345
|
+
}, [(s = o.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */ se(dt, { children: [
|
|
387
346
|
e,
|
|
388
|
-
t.stack.length > 0 && /* @__PURE__ */ T(
|
|
347
|
+
t.stack.length > 0 && /* @__PURE__ */ T(At, { index: 0 })
|
|
389
348
|
] });
|
|
390
349
|
}, mt = E.createContext(null);
|
|
391
350
|
mt.displayName = "ModalIndexContext";
|
|
@@ -394,7 +353,7 @@ const Nt = () => {
|
|
|
394
353
|
if (e === void 0)
|
|
395
354
|
throw new Error("useModalIndex must be used within a ModalIndexProvider");
|
|
396
355
|
return e;
|
|
397
|
-
},
|
|
356
|
+
}, At = ({ index: e }) => {
|
|
398
357
|
const { stack: t } = Xe(), n = C(() => t[e], [t, e]);
|
|
399
358
|
return (n == null ? void 0 : n.component) && /* @__PURE__ */ T(mt.Provider, { value: e, children: /* @__PURE__ */ T(
|
|
400
359
|
n.component,
|
|
@@ -403,44 +362,44 @@ const Nt = () => {
|
|
|
403
362
|
onModalEvent: (...r) => n.emit(...r)
|
|
404
363
|
}
|
|
405
364
|
) });
|
|
406
|
-
},
|
|
407
|
-
const i = Nt(), { stack:
|
|
365
|
+
}, It = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, ...a }, s) => {
|
|
366
|
+
const i = Nt(), { stack: c, registerLocalModal: f, removeLocalModal: y } = Xe(), [b, w] = S(null), d = C(() => e ? b : c[i], [e, b, i, c]), v = C(() => {
|
|
408
367
|
var h;
|
|
409
|
-
return (h =
|
|
410
|
-
}, [i,
|
|
368
|
+
return (h = c.find(($) => $.shouldRender && $.index > (d == null ? void 0 : d.index))) == null ? void 0 : h.index;
|
|
369
|
+
}, [i, c]), u = C(() => (d == null ? void 0 : d.config.slideover) ?? a.slideover ?? ft("type") === "slideover", [a.slideover]), m = C(
|
|
411
370
|
() => ({
|
|
412
371
|
slideover: u,
|
|
413
|
-
closeButton:
|
|
414
|
-
closeExplicitly:
|
|
415
|
-
maxWidth:
|
|
416
|
-
paddingClasses:
|
|
417
|
-
panelClasses:
|
|
418
|
-
position:
|
|
419
|
-
...
|
|
372
|
+
closeButton: a.closeButton ?? ce(u, "closeButton"),
|
|
373
|
+
closeExplicitly: a.closeExplicitly ?? ce(u, "closeExplicitly"),
|
|
374
|
+
maxWidth: a.maxWidth ?? ce(u, "maxWidth"),
|
|
375
|
+
paddingClasses: a.paddingClasses ?? ce(u, "paddingClasses"),
|
|
376
|
+
panelClasses: a.panelClasses ?? ce(u, "panelClasses"),
|
|
377
|
+
position: a.position ?? ce(u, "position"),
|
|
378
|
+
...d == null ? void 0 : d.config
|
|
420
379
|
}),
|
|
421
|
-
[
|
|
380
|
+
[a, d == null ? void 0 : d.config]
|
|
422
381
|
);
|
|
423
382
|
M(() => {
|
|
424
383
|
if (e) {
|
|
425
384
|
let h = null;
|
|
426
385
|
return f(e, ($) => {
|
|
427
|
-
h = $.registerEventListenersFromProps(
|
|
386
|
+
h = $.registerEventListenersFromProps(a), w($);
|
|
428
387
|
}), () => {
|
|
429
388
|
h == null || h(), h = null, y(e);
|
|
430
389
|
};
|
|
431
390
|
}
|
|
432
|
-
return
|
|
391
|
+
return d.registerEventListenersFromProps(a);
|
|
433
392
|
}, [e]);
|
|
434
|
-
const p = O(
|
|
393
|
+
const p = O(d);
|
|
435
394
|
M(() => {
|
|
436
|
-
p.current =
|
|
437
|
-
}, [
|
|
438
|
-
|
|
439
|
-
}, [
|
|
440
|
-
const [g, x] =
|
|
395
|
+
p.current = d;
|
|
396
|
+
}, [d]), M(() => {
|
|
397
|
+
d !== null && (d.isOpen ? o == null || o() : l == null || l());
|
|
398
|
+
}, [d == null ? void 0 : d.isOpen]);
|
|
399
|
+
const [g, x] = S(!1);
|
|
441
400
|
return M(() => {
|
|
442
|
-
g &&
|
|
443
|
-
}, [
|
|
401
|
+
g && d !== null && d.isOpen && (d.onTopOfStack ? n == null || n() : r == null || r()), x(!0);
|
|
402
|
+
}, [d == null ? void 0 : d.onTopOfStack]), St(
|
|
444
403
|
s,
|
|
445
404
|
() => ({
|
|
446
405
|
afterLeave: () => {
|
|
@@ -499,43 +458,43 @@ const Nt = () => {
|
|
|
499
458
|
return (h = p.current) == null ? void 0 : h.shouldRender;
|
|
500
459
|
}
|
|
501
460
|
}),
|
|
502
|
-
[
|
|
503
|
-
), (
|
|
461
|
+
[d]
|
|
462
|
+
), (d == null ? void 0 : d.shouldRender) && /* @__PURE__ */ se(dt, { children: [
|
|
504
463
|
typeof t == "function" ? t({
|
|
505
|
-
afterLeave:
|
|
506
|
-
close:
|
|
464
|
+
afterLeave: d.afterLeave,
|
|
465
|
+
close: d.close,
|
|
507
466
|
config: m,
|
|
508
|
-
emit:
|
|
509
|
-
getChildModal:
|
|
510
|
-
getParentModal:
|
|
511
|
-
id:
|
|
512
|
-
index:
|
|
513
|
-
isOpen:
|
|
514
|
-
modalContext:
|
|
515
|
-
onTopOfStack:
|
|
516
|
-
reload:
|
|
517
|
-
setOpen:
|
|
518
|
-
shouldRender:
|
|
467
|
+
emit: d.emit,
|
|
468
|
+
getChildModal: d.getChildModal,
|
|
469
|
+
getParentModal: d.getParentModal,
|
|
470
|
+
id: d.id,
|
|
471
|
+
index: d.index,
|
|
472
|
+
isOpen: d.isOpen,
|
|
473
|
+
modalContext: d,
|
|
474
|
+
onTopOfStack: d.onTopOfStack,
|
|
475
|
+
reload: d.reload,
|
|
476
|
+
setOpen: d.setOpen,
|
|
477
|
+
shouldRender: d.shouldRender
|
|
519
478
|
}) : t,
|
|
520
|
-
v && /* @__PURE__ */ T(
|
|
479
|
+
v && /* @__PURE__ */ T(At, { index: v })
|
|
521
480
|
] });
|
|
522
481
|
});
|
|
523
|
-
|
|
524
|
-
function
|
|
482
|
+
It.displayName = "HeadlessModal";
|
|
483
|
+
function Rt(e) {
|
|
525
484
|
var t, n, r = "";
|
|
526
485
|
if (typeof e == "string" || typeof e == "number") r += e;
|
|
527
486
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
528
487
|
var l = e.length;
|
|
529
|
-
for (t = 0; t < l; t++) e[t] && (n =
|
|
488
|
+
for (t = 0; t < l; t++) e[t] && (n = Rt(e[t])) && (r && (r += " "), r += n);
|
|
530
489
|
} else for (n in e) e[n] && (r && (r += " "), r += n);
|
|
531
490
|
return r;
|
|
532
491
|
}
|
|
533
492
|
function je() {
|
|
534
|
-
for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t =
|
|
493
|
+
for (var e, t, n = 0, r = "", l = arguments.length; n < l; n++) (e = arguments[n]) && (t = Rt(e)) && (r && (r += " "), r += t);
|
|
535
494
|
return r;
|
|
536
495
|
}
|
|
537
496
|
var Cn = Object.defineProperty, kn = (e, t, n) => t in e ? Cn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, tt = (e, t, n) => (kn(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
538
|
-
let
|
|
497
|
+
let Nn = class {
|
|
539
498
|
constructor() {
|
|
540
499
|
tt(this, "current", this.detect()), tt(this, "handoffState", "pending"), tt(this, "currentId", 0);
|
|
541
500
|
}
|
|
@@ -563,9 +522,9 @@ let An = class {
|
|
|
563
522
|
get isHandoffComplete() {
|
|
564
523
|
return this.handoffState === "complete";
|
|
565
524
|
}
|
|
566
|
-
},
|
|
525
|
+
}, ae = new Nn();
|
|
567
526
|
function Ve(e) {
|
|
568
|
-
return
|
|
527
|
+
return ae.isServer ? null : e instanceof Node ? e.ownerDocument : e != null && e.hasOwnProperty("current") && e.current instanceof Node ? e.current.ownerDocument : document;
|
|
569
528
|
}
|
|
570
529
|
function qe(e) {
|
|
571
530
|
typeof queueMicrotask == "function" ? queueMicrotask(e) : Promise.resolve().then(e).catch((t) => setTimeout(() => {
|
|
@@ -573,8 +532,8 @@ function qe(e) {
|
|
|
573
532
|
}));
|
|
574
533
|
}
|
|
575
534
|
function re() {
|
|
576
|
-
let e = [], t = { addEventListener(n, r, l,
|
|
577
|
-
return n.addEventListener(r, l,
|
|
535
|
+
let e = [], t = { addEventListener(n, r, l, o) {
|
|
536
|
+
return n.addEventListener(r, l, o), t.add(() => n.removeEventListener(r, l, o));
|
|
578
537
|
}, requestAnimationFrame(...n) {
|
|
579
538
|
let r = requestAnimationFrame(...n);
|
|
580
539
|
return t.add(() => cancelAnimationFrame(r));
|
|
@@ -591,9 +550,9 @@ function re() {
|
|
|
591
550
|
r.current = !1;
|
|
592
551
|
});
|
|
593
552
|
}, style(n, r, l) {
|
|
594
|
-
let
|
|
553
|
+
let o = n.style.getPropertyValue(r);
|
|
595
554
|
return Object.assign(n.style, { [r]: l }), this.add(() => {
|
|
596
|
-
Object.assign(n.style, { [r]:
|
|
555
|
+
Object.assign(n.style, { [r]: o });
|
|
597
556
|
});
|
|
598
557
|
}, group(n) {
|
|
599
558
|
let r = re();
|
|
@@ -609,24 +568,24 @@ function re() {
|
|
|
609
568
|
return t;
|
|
610
569
|
}
|
|
611
570
|
function pt() {
|
|
612
|
-
let [e] =
|
|
571
|
+
let [e] = S(re);
|
|
613
572
|
return M(() => () => e.dispose(), [e]), e;
|
|
614
573
|
}
|
|
615
|
-
let
|
|
616
|
-
|
|
574
|
+
let A = (e, t) => {
|
|
575
|
+
ae.isServer ? M(e, t) : pn(e, t);
|
|
617
576
|
};
|
|
618
|
-
function
|
|
577
|
+
function ue(e) {
|
|
619
578
|
let t = O(e);
|
|
620
|
-
return
|
|
579
|
+
return A(() => {
|
|
621
580
|
t.current = e;
|
|
622
581
|
}, [e]), t;
|
|
623
582
|
}
|
|
624
|
-
let
|
|
625
|
-
let t =
|
|
583
|
+
let L = function(e) {
|
|
584
|
+
let t = ue(e);
|
|
626
585
|
return E.useCallback((...n) => t.current(...n), [t]);
|
|
627
|
-
},
|
|
586
|
+
}, An = H(void 0);
|
|
628
587
|
function In() {
|
|
629
|
-
return R(
|
|
588
|
+
return R(An);
|
|
630
589
|
}
|
|
631
590
|
function lt(...e) {
|
|
632
591
|
return Array.from(new Set(e.flatMap((t) => typeof t == "string" ? t.split(" ") : []))).filter(Boolean).join(" ");
|
|
@@ -644,48 +603,48 @@ function W() {
|
|
|
644
603
|
let e = Dn();
|
|
645
604
|
return Y((t) => Rn({ mergeRefs: e, ...t }), [e]);
|
|
646
605
|
}
|
|
647
|
-
function Rn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible:
|
|
606
|
+
function Rn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: o = !0, name: a, mergeRefs: s }) {
|
|
648
607
|
s = s ?? jn;
|
|
649
|
-
let i =
|
|
650
|
-
if (
|
|
651
|
-
let
|
|
652
|
-
if (
|
|
608
|
+
let i = Dt(t, e);
|
|
609
|
+
if (o) return Ae(i, n, r, a, s);
|
|
610
|
+
let c = l ?? 0;
|
|
611
|
+
if (c & 2) {
|
|
653
612
|
let { static: f = !1, ...y } = i;
|
|
654
|
-
if (f) return
|
|
613
|
+
if (f) return Ae(y, n, r, a, s);
|
|
655
614
|
}
|
|
656
|
-
if (
|
|
615
|
+
if (c & 1) {
|
|
657
616
|
let { unmount: f = !0, ...y } = i;
|
|
658
617
|
return ne(f ? 0 : 1, { 0() {
|
|
659
618
|
return null;
|
|
660
619
|
}, 1() {
|
|
661
|
-
return
|
|
620
|
+
return Ae({ ...y, hidden: !0, style: { display: "none" } }, n, r, a, s);
|
|
662
621
|
} });
|
|
663
622
|
}
|
|
664
|
-
return
|
|
623
|
+
return Ae(i, n, r, a, s);
|
|
665
624
|
}
|
|
666
|
-
function
|
|
667
|
-
let { as:
|
|
625
|
+
function Ae(e, t = {}, n, r, l) {
|
|
626
|
+
let { as: o = n, children: a, refName: s = "ref", ...i } = nt(e, ["unmount", "static"]), c = e.ref !== void 0 ? { [s]: e.ref } : {}, f = typeof a == "function" ? a(t) : a;
|
|
668
627
|
"className" in i && i.className && typeof i.className == "function" && (i.className = i.className(t)), i["aria-labelledby"] && i["aria-labelledby"] === i.id && (i["aria-labelledby"] = void 0);
|
|
669
628
|
let y = {};
|
|
670
629
|
if (t) {
|
|
671
630
|
let b = !1, w = [];
|
|
672
|
-
for (let [
|
|
631
|
+
for (let [d, v] of Object.entries(t)) typeof v == "boolean" && (b = !0), v === !0 && w.push(d.replace(/([A-Z])/g, (u) => `-${u.toLowerCase()}`));
|
|
673
632
|
if (b) {
|
|
674
633
|
y["data-headlessui-state"] = w.join(" ");
|
|
675
|
-
for (let
|
|
634
|
+
for (let d of w) y[`data-${d}`] = "";
|
|
676
635
|
}
|
|
677
636
|
}
|
|
678
|
-
if (
|
|
679
|
-
if (Object.keys(
|
|
637
|
+
if (o === G && (Object.keys(le(i)).length > 0 || Object.keys(le(y)).length > 0)) if (!hn(f) || Array.isArray(f) && f.length > 1) {
|
|
638
|
+
if (Object.keys(le(i)).length > 0) throw new Error(['Passing props on "Fragment"!', "", `The current component <${r} /> is rendering a "Fragment".`, "However we need to passthrough the following props:", Object.keys(le(i)).concat(Object.keys(le(y))).map((b) => ` - ${b}`).join(`
|
|
680
639
|
`), "", "You can apply a few solutions:", ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', "Render a single element as the child so that we can forward the props onto that element."].map((b) => ` - ${b}`).join(`
|
|
681
640
|
`)].join(`
|
|
682
641
|
`));
|
|
683
642
|
} else {
|
|
684
|
-
let b = f.props, w = b == null ? void 0 : b.className,
|
|
643
|
+
let b = f.props, w = b == null ? void 0 : b.className, d = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = d ? { className: d } : {}, u = Dt(f.props, le(nt(i, ["ref"])));
|
|
685
644
|
for (let m in y) m in u && delete y[m];
|
|
686
|
-
return
|
|
645
|
+
return vn(f, Object.assign({}, u, y, c, { ref: l(Un(f), c.ref) }, v));
|
|
687
646
|
}
|
|
688
|
-
return Re(
|
|
647
|
+
return Re(o, Object.assign({}, nt(i, ["ref"]), o !== G && c, o !== G && y), f);
|
|
689
648
|
}
|
|
690
649
|
function Dn() {
|
|
691
650
|
let e = O([]), t = Y((n) => {
|
|
@@ -700,29 +659,29 @@ function jn(...e) {
|
|
|
700
659
|
for (let n of e) n != null && (typeof n == "function" ? n(t) : n.current = t);
|
|
701
660
|
};
|
|
702
661
|
}
|
|
703
|
-
function
|
|
662
|
+
function Dt(...e) {
|
|
704
663
|
if (e.length === 0) return {};
|
|
705
664
|
if (e.length === 1) return e[0];
|
|
706
665
|
let t = {}, n = {};
|
|
707
666
|
for (let r of e) for (let l in r) l.startsWith("on") && typeof r[l] == "function" ? (n[l] != null || (n[l] = []), n[l].push(r[l])) : t[l] = r[l];
|
|
708
667
|
if (t.disabled || t["aria-disabled"]) for (let r in n) /^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r) && (n[r] = [(l) => {
|
|
709
|
-
var
|
|
710
|
-
return (
|
|
668
|
+
var o;
|
|
669
|
+
return (o = l == null ? void 0 : l.preventDefault) == null ? void 0 : o.call(l);
|
|
711
670
|
}]);
|
|
712
|
-
for (let r in n) Object.assign(t, { [r](l, ...
|
|
713
|
-
let
|
|
714
|
-
for (let s of
|
|
671
|
+
for (let r in n) Object.assign(t, { [r](l, ...o) {
|
|
672
|
+
let a = n[r];
|
|
673
|
+
for (let s of a) {
|
|
715
674
|
if ((l instanceof Event || (l == null ? void 0 : l.nativeEvent) instanceof Event) && l.defaultPrevented) return;
|
|
716
|
-
s(l, ...
|
|
675
|
+
s(l, ...o);
|
|
717
676
|
}
|
|
718
677
|
} });
|
|
719
678
|
return t;
|
|
720
679
|
}
|
|
721
680
|
function D(e) {
|
|
722
681
|
var t;
|
|
723
|
-
return Object.assign(
|
|
682
|
+
return Object.assign(ct(e), { displayName: (t = e.displayName) != null ? t : e.name });
|
|
724
683
|
}
|
|
725
|
-
function
|
|
684
|
+
function le(e) {
|
|
726
685
|
let t = Object.assign({}, e);
|
|
727
686
|
for (let n in t) t[n] === void 0 && delete t[n];
|
|
728
687
|
return t;
|
|
@@ -739,38 +698,38 @@ let Hn = "span";
|
|
|
739
698
|
var He = ((e) => (e[e.None = 1] = "None", e[e.Focusable = 2] = "Focusable", e[e.Hidden = 4] = "Hidden", e))(He || {});
|
|
740
699
|
function Wn(e, t) {
|
|
741
700
|
var n;
|
|
742
|
-
let { features: r = 1, ...l } = e,
|
|
743
|
-
return W()({ ourProps:
|
|
701
|
+
let { features: r = 1, ...l } = e, o = { ref: t, "aria-hidden": (r & 2) === 2 ? !0 : (n = l["aria-hidden"]) != null ? n : 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" } } };
|
|
702
|
+
return W()({ ourProps: o, theirProps: l, slot: {}, defaultTag: Hn, name: "Hidden" });
|
|
744
703
|
}
|
|
745
|
-
let it = D(Wn),
|
|
704
|
+
let it = D(Wn), jt = Symbol();
|
|
746
705
|
function _n(e, t = !0) {
|
|
747
|
-
return Object.assign(e, { [
|
|
706
|
+
return Object.assign(e, { [jt]: t });
|
|
748
707
|
}
|
|
749
708
|
function Z(...e) {
|
|
750
709
|
let t = O(e);
|
|
751
710
|
M(() => {
|
|
752
711
|
t.current = e;
|
|
753
712
|
}, [e]);
|
|
754
|
-
let n =
|
|
713
|
+
let n = L((r) => {
|
|
755
714
|
for (let l of t.current) l != null && (typeof l == "function" ? l(r) : l.current = r);
|
|
756
715
|
});
|
|
757
|
-
return e.every((r) => r == null || (r == null ? void 0 : r[
|
|
716
|
+
return e.every((r) => r == null || (r == null ? void 0 : r[jt])) ? void 0 : n;
|
|
758
717
|
}
|
|
759
718
|
let ht = H(null);
|
|
760
719
|
ht.displayName = "DescriptionContext";
|
|
761
|
-
function
|
|
720
|
+
function Ut() {
|
|
762
721
|
let e = R(ht);
|
|
763
722
|
if (e === null) {
|
|
764
723
|
let t = new Error("You used a <Description /> component, but it is not inside a relevant parent.");
|
|
765
|
-
throw Error.captureStackTrace && Error.captureStackTrace(t,
|
|
724
|
+
throw Error.captureStackTrace && Error.captureStackTrace(t, Ut), t;
|
|
766
725
|
}
|
|
767
726
|
return e;
|
|
768
727
|
}
|
|
769
728
|
function Bn() {
|
|
770
|
-
let [e, t] =
|
|
729
|
+
let [e, t] = S([]);
|
|
771
730
|
return [e.length > 0 ? e.join(" ") : void 0, C(() => function(n) {
|
|
772
|
-
let r =
|
|
773
|
-
let s =
|
|
731
|
+
let r = L((o) => (t((a) => [...a, o]), () => t((a) => {
|
|
732
|
+
let s = a.slice(), i = s.indexOf(o);
|
|
774
733
|
return i !== -1 && s.splice(i, 1), s;
|
|
775
734
|
}))), l = C(() => ({ register: r, slot: n.slot, name: n.name, props: n.props, value: n.value }), [r, n.slot, n.name, n.props, n.value]);
|
|
776
735
|
return E.createElement(ht.Provider, { value: l }, n.children);
|
|
@@ -778,13 +737,13 @@ function Bn() {
|
|
|
778
737
|
}
|
|
779
738
|
let Xn = "p";
|
|
780
739
|
function Vn(e, t) {
|
|
781
|
-
let n = Pe(), r = In(), { id: l = `headlessui-description-${n}`, ...
|
|
782
|
-
|
|
783
|
-
let i = r || !1,
|
|
784
|
-
return W()({ ourProps: f, theirProps:
|
|
740
|
+
let n = Pe(), r = In(), { id: l = `headlessui-description-${n}`, ...o } = e, a = Ut(), s = Z(t);
|
|
741
|
+
A(() => a.register(l), [l, a.register]);
|
|
742
|
+
let i = r || !1, c = C(() => ({ ...a.slot, disabled: i }), [a.slot, i]), f = { ref: s, ...a.props, id: l };
|
|
743
|
+
return W()({ ourProps: f, theirProps: o, slot: c, defaultTag: Xn, name: a.name || "Description" });
|
|
785
744
|
}
|
|
786
745
|
let qn = D(Vn), Yn = Object.assign(qn, {});
|
|
787
|
-
var
|
|
746
|
+
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 || {});
|
|
788
747
|
let zn = H(() => {
|
|
789
748
|
});
|
|
790
749
|
function Gn({ value: e, children: t }) {
|
|
@@ -799,21 +758,21 @@ let Kn = class extends Map {
|
|
|
799
758
|
return n === void 0 && (n = this.factory(t), this.set(t, n)), n;
|
|
800
759
|
}
|
|
801
760
|
};
|
|
802
|
-
function
|
|
761
|
+
function Wt(e, t) {
|
|
803
762
|
let n = e(), r = /* @__PURE__ */ new Set();
|
|
804
763
|
return { getSnapshot() {
|
|
805
764
|
return n;
|
|
806
765
|
}, subscribe(l) {
|
|
807
766
|
return r.add(l), () => r.delete(l);
|
|
808
|
-
}, dispatch(l, ...
|
|
809
|
-
let
|
|
810
|
-
|
|
767
|
+
}, dispatch(l, ...o) {
|
|
768
|
+
let a = t[l].call(n, ...o);
|
|
769
|
+
a && (n = a, r.forEach((s) => s()));
|
|
811
770
|
} };
|
|
812
771
|
}
|
|
813
|
-
function
|
|
814
|
-
return
|
|
772
|
+
function _t(e) {
|
|
773
|
+
return gn(e.subscribe, e.getSnapshot, e.getSnapshot);
|
|
815
774
|
}
|
|
816
|
-
let Zn = new Kn(() =>
|
|
775
|
+
let Zn = new Kn(() => Wt(() => [], { ADD(e) {
|
|
817
776
|
return this.includes(e) ? this : [...this, e];
|
|
818
777
|
}, REMOVE(e) {
|
|
819
778
|
let t = this.indexOf(e);
|
|
@@ -821,78 +780,78 @@ let Zn = new Kn(() => _t(() => [], { ADD(e) {
|
|
|
821
780
|
let n = this.slice();
|
|
822
781
|
return n.splice(t, 1), n;
|
|
823
782
|
} }));
|
|
824
|
-
function
|
|
825
|
-
let n = Zn.get(t), r = Pe(), l =
|
|
826
|
-
if (
|
|
783
|
+
function fe(e, t) {
|
|
784
|
+
let n = Zn.get(t), r = Pe(), l = _t(n);
|
|
785
|
+
if (A(() => {
|
|
827
786
|
if (e) return n.dispatch("ADD", r), () => n.dispatch("REMOVE", r);
|
|
828
787
|
}, [n, e]), !e) return !1;
|
|
829
|
-
let
|
|
830
|
-
return
|
|
788
|
+
let o = l.indexOf(r), a = l.length;
|
|
789
|
+
return o === -1 && (o = a, a += 1), o === a - 1;
|
|
831
790
|
}
|
|
832
|
-
let
|
|
833
|
-
function
|
|
791
|
+
let ot = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
|
|
792
|
+
function bt(e) {
|
|
834
793
|
var t;
|
|
835
794
|
let n = (t = Te.get(e)) != null ? t : 0;
|
|
836
|
-
return Te.set(e, n + 1), n !== 0 ? () =>
|
|
795
|
+
return Te.set(e, n + 1), n !== 0 ? () => Et(e) : (ot.set(e, { "aria-hidden": e.getAttribute("aria-hidden"), inert: e.inert }), e.setAttribute("aria-hidden", "true"), e.inert = !0, () => Et(e));
|
|
837
796
|
}
|
|
838
|
-
function
|
|
797
|
+
function Et(e) {
|
|
839
798
|
var t;
|
|
840
799
|
let n = (t = Te.get(e)) != null ? t : 1;
|
|
841
800
|
if (n === 1 ? Te.delete(e) : Te.set(e, n - 1), n !== 1) return;
|
|
842
|
-
let r =
|
|
843
|
-
r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert,
|
|
801
|
+
let r = ot.get(e);
|
|
802
|
+
r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, ot.delete(e));
|
|
844
803
|
}
|
|
845
804
|
function Jn(e, { allowed: t, disallowed: n } = {}) {
|
|
846
|
-
let r =
|
|
847
|
-
|
|
848
|
-
var l,
|
|
805
|
+
let r = fe(e, "inert-others");
|
|
806
|
+
A(() => {
|
|
807
|
+
var l, o;
|
|
849
808
|
if (!r) return;
|
|
850
|
-
let
|
|
851
|
-
for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i &&
|
|
852
|
-
let s = (
|
|
809
|
+
let a = re();
|
|
810
|
+
for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && a.add(bt(i));
|
|
811
|
+
let s = (o = t == null ? void 0 : t()) != null ? o : [];
|
|
853
812
|
for (let i of s) {
|
|
854
813
|
if (!i) continue;
|
|
855
|
-
let
|
|
856
|
-
if (!
|
|
814
|
+
let c = Ve(i);
|
|
815
|
+
if (!c) continue;
|
|
857
816
|
let f = i.parentElement;
|
|
858
|
-
for (; f && f !==
|
|
859
|
-
for (let y of f.children) s.some((b) => y.contains(b)) ||
|
|
817
|
+
for (; f && f !== c.body; ) {
|
|
818
|
+
for (let y of f.children) s.some((b) => y.contains(b)) || a.add(bt(y));
|
|
860
819
|
f = f.parentElement;
|
|
861
820
|
}
|
|
862
821
|
}
|
|
863
|
-
return
|
|
822
|
+
return a.dispose;
|
|
864
823
|
}, [r, t, n]);
|
|
865
824
|
}
|
|
866
825
|
function Qn(e, t, n) {
|
|
867
|
-
let r =
|
|
868
|
-
let
|
|
869
|
-
|
|
826
|
+
let r = ue((l) => {
|
|
827
|
+
let o = l.getBoundingClientRect();
|
|
828
|
+
o.x === 0 && o.y === 0 && o.width === 0 && o.height === 0 && n();
|
|
870
829
|
});
|
|
871
830
|
M(() => {
|
|
872
831
|
if (!e) return;
|
|
873
832
|
let l = t === null ? null : t instanceof HTMLElement ? t : t.current;
|
|
874
833
|
if (!l) return;
|
|
875
|
-
let
|
|
834
|
+
let o = re();
|
|
876
835
|
if (typeof ResizeObserver < "u") {
|
|
877
|
-
let
|
|
878
|
-
|
|
836
|
+
let a = new ResizeObserver(() => r.current(l));
|
|
837
|
+
a.observe(l), o.add(() => a.disconnect());
|
|
879
838
|
}
|
|
880
839
|
if (typeof IntersectionObserver < "u") {
|
|
881
|
-
let
|
|
882
|
-
|
|
840
|
+
let a = new IntersectionObserver(() => r.current(l));
|
|
841
|
+
a.observe(l), o.add(() => a.disconnect());
|
|
883
842
|
}
|
|
884
|
-
return () =>
|
|
843
|
+
return () => o.dispose();
|
|
885
844
|
}, [t, r, e]);
|
|
886
845
|
}
|
|
887
846
|
let We = ["[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(","), er = ["[data-autofocus]"].map((e) => `${e}:not([tabindex='-1'])`).join(",");
|
|
888
|
-
var J = ((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[e.AutoFocus = 64] = "AutoFocus", e))(J || {}),
|
|
847
|
+
var J = ((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[e.AutoFocus = 64] = "AutoFocus", e))(J || {}), at = ((e) => (e[e.Error = 0] = "Error", e[e.Overflow = 1] = "Overflow", e[e.Success = 2] = "Success", e[e.Underflow = 3] = "Underflow", e))(at || {}), tr = ((e) => (e[e.Previous = -1] = "Previous", e[e.Next = 1] = "Next", e))(tr || {});
|
|
889
848
|
function nr(e = document.body) {
|
|
890
849
|
return e == null ? [] : Array.from(e.querySelectorAll(We)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
891
850
|
}
|
|
892
851
|
function rr(e = document.body) {
|
|
893
852
|
return e == null ? [] : Array.from(e.querySelectorAll(er)).sort((t, n) => Math.sign((t.tabIndex || Number.MAX_SAFE_INTEGER) - (n.tabIndex || Number.MAX_SAFE_INTEGER)));
|
|
894
853
|
}
|
|
895
|
-
var
|
|
854
|
+
var Bt = ((e) => (e[e.Strict = 0] = "Strict", e[e.Loose = 1] = "Loose", e))(Bt || {});
|
|
896
855
|
function lr(e, t = 0) {
|
|
897
856
|
var n;
|
|
898
857
|
return e === ((n = Ve(e)) == null ? void 0 : n.body) ? !1 : ne(t, { 0() {
|
|
@@ -915,33 +874,33 @@ typeof window < "u" && typeof document < "u" && (document.addEventListener("keyd
|
|
|
915
874
|
function Q(e) {
|
|
916
875
|
e == null || e.focus({ preventScroll: !0 });
|
|
917
876
|
}
|
|
918
|
-
let
|
|
919
|
-
function
|
|
877
|
+
let or = ["textarea", "input"].join(",");
|
|
878
|
+
function ar(e) {
|
|
920
879
|
var t, n;
|
|
921
|
-
return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e,
|
|
880
|
+
return (n = (t = e == null ? void 0 : e.matches) == null ? void 0 : t.call(e, or)) != null ? n : !1;
|
|
922
881
|
}
|
|
923
882
|
function sr(e, t = (n) => n) {
|
|
924
883
|
return e.slice().sort((n, r) => {
|
|
925
|
-
let l = t(n),
|
|
926
|
-
if (l === null ||
|
|
927
|
-
let
|
|
928
|
-
return
|
|
884
|
+
let l = t(n), o = t(r);
|
|
885
|
+
if (l === null || o === null) return 0;
|
|
886
|
+
let a = l.compareDocumentPosition(o);
|
|
887
|
+
return a & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : a & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
929
888
|
});
|
|
930
889
|
}
|
|
931
890
|
function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] } = {}) {
|
|
932
|
-
let
|
|
933
|
-
l.length > 0 &&
|
|
891
|
+
let o = Array.isArray(e) ? e.length > 0 ? e[0].ownerDocument : document : e.ownerDocument, a = Array.isArray(e) ? n ? sr(e) : e : t & 64 ? rr(e) : nr(e);
|
|
892
|
+
l.length > 0 && a.length > 1 && (a = a.filter((w) => !l.some((d) => d != null && "current" in d ? (d == null ? void 0 : d.current) === w : d === w))), r = r ?? o.activeElement;
|
|
934
893
|
let s = (() => {
|
|
935
894
|
if (t & 5) return 1;
|
|
936
895
|
if (t & 10) return -1;
|
|
937
896
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
938
897
|
})(), i = (() => {
|
|
939
898
|
if (t & 1) return 0;
|
|
940
|
-
if (t & 2) return Math.max(0,
|
|
941
|
-
if (t & 4) return Math.max(0,
|
|
942
|
-
if (t & 8) return
|
|
899
|
+
if (t & 2) return Math.max(0, a.indexOf(r)) - 1;
|
|
900
|
+
if (t & 4) return Math.max(0, a.indexOf(r)) + 1;
|
|
901
|
+
if (t & 8) return a.length - 1;
|
|
943
902
|
throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last");
|
|
944
|
-
})(),
|
|
903
|
+
})(), c = t & 32 ? { preventScroll: !0 } : {}, f = 0, y = a.length, b;
|
|
945
904
|
do {
|
|
946
905
|
if (f >= y || f + y <= 0) return 0;
|
|
947
906
|
let w = i + f;
|
|
@@ -950,79 +909,79 @@ function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] }
|
|
|
950
909
|
if (w < 0) return 3;
|
|
951
910
|
if (w >= y) return 1;
|
|
952
911
|
}
|
|
953
|
-
b =
|
|
954
|
-
} while (b !==
|
|
955
|
-
return t & 6 &&
|
|
912
|
+
b = a[w], b == null || b.focus(c), f += s;
|
|
913
|
+
} while (b !== o.activeElement);
|
|
914
|
+
return t & 6 && ar(b) && b.select(), 2;
|
|
956
915
|
}
|
|
957
|
-
function
|
|
916
|
+
function Xt() {
|
|
958
917
|
return /iPhone/gi.test(window.navigator.platform) || /Mac/gi.test(window.navigator.platform) && window.navigator.maxTouchPoints > 0;
|
|
959
918
|
}
|
|
960
919
|
function ur() {
|
|
961
920
|
return /Android/gi.test(window.navigator.userAgent);
|
|
962
921
|
}
|
|
963
|
-
function
|
|
964
|
-
return
|
|
922
|
+
function cr() {
|
|
923
|
+
return Xt() || ur();
|
|
965
924
|
}
|
|
966
|
-
function
|
|
967
|
-
let l =
|
|
925
|
+
function ye(e, t, n, r) {
|
|
926
|
+
let l = ue(n);
|
|
968
927
|
M(() => {
|
|
969
928
|
if (!e) return;
|
|
970
|
-
function a
|
|
971
|
-
l.current(
|
|
929
|
+
function o(a) {
|
|
930
|
+
l.current(a);
|
|
972
931
|
}
|
|
973
|
-
return document.addEventListener(t,
|
|
932
|
+
return document.addEventListener(t, o, r), () => document.removeEventListener(t, o, r);
|
|
974
933
|
}, [e, t, r]);
|
|
975
934
|
}
|
|
976
|
-
function
|
|
977
|
-
let l =
|
|
935
|
+
function Vt(e, t, n, r) {
|
|
936
|
+
let l = ue(n);
|
|
978
937
|
M(() => {
|
|
979
938
|
if (!e) return;
|
|
980
|
-
function a
|
|
981
|
-
l.current(
|
|
939
|
+
function o(a) {
|
|
940
|
+
l.current(a);
|
|
982
941
|
}
|
|
983
|
-
return window.addEventListener(t,
|
|
942
|
+
return window.addEventListener(t, o, r), () => window.removeEventListener(t, o, r);
|
|
984
943
|
}, [e, t, r]);
|
|
985
944
|
}
|
|
986
|
-
const
|
|
987
|
-
function
|
|
988
|
-
let r =
|
|
945
|
+
const $t = 30;
|
|
946
|
+
function dr(e, t, n) {
|
|
947
|
+
let r = fe(e, "outside-click"), l = ue(n), o = Y(function(i, c) {
|
|
989
948
|
if (i.defaultPrevented) return;
|
|
990
|
-
let f =
|
|
949
|
+
let f = c(i);
|
|
991
950
|
if (f === null || !f.getRootNode().contains(f) || !f.isConnected) return;
|
|
992
951
|
let y = function b(w) {
|
|
993
952
|
return typeof w == "function" ? b(w()) : Array.isArray(w) || w instanceof Set ? w : [w];
|
|
994
953
|
}(t);
|
|
995
954
|
for (let b of y) if (b !== null && (b.contains(f) || i.composed && i.composedPath().includes(b))) return;
|
|
996
|
-
return !lr(f,
|
|
997
|
-
}, [l, t]),
|
|
998
|
-
|
|
999
|
-
var
|
|
1000
|
-
|
|
1001
|
-
}, !0),
|
|
1002
|
-
var
|
|
1003
|
-
|
|
1004
|
-
}, !0),
|
|
1005
|
-
|
|
955
|
+
return !lr(f, Bt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
|
|
956
|
+
}, [l, t]), a = O(null);
|
|
957
|
+
ye(r, "pointerdown", (i) => {
|
|
958
|
+
var c, f;
|
|
959
|
+
a.current = ((f = (c = i.composedPath) == null ? void 0 : c.call(i)) == null ? void 0 : f[0]) || i.target;
|
|
960
|
+
}, !0), ye(r, "mousedown", (i) => {
|
|
961
|
+
var c, f;
|
|
962
|
+
a.current = ((f = (c = i.composedPath) == null ? void 0 : c.call(i)) == null ? void 0 : f[0]) || i.target;
|
|
963
|
+
}, !0), ye(r, "click", (i) => {
|
|
964
|
+
cr() || a.current && (o(i, () => a.current), a.current = null);
|
|
1006
965
|
}, !0);
|
|
1007
966
|
let s = O({ x: 0, y: 0 });
|
|
1008
|
-
|
|
967
|
+
ye(r, "touchstart", (i) => {
|
|
1009
968
|
s.current.x = i.touches[0].clientX, s.current.y = i.touches[0].clientY;
|
|
1010
|
-
}, !0),
|
|
1011
|
-
let
|
|
1012
|
-
if (!(Math.abs(
|
|
1013
|
-
}, !0),
|
|
969
|
+
}, !0), ye(r, "touchend", (i) => {
|
|
970
|
+
let c = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
|
|
971
|
+
if (!(Math.abs(c.x - s.current.x) >= $t || Math.abs(c.y - s.current.y) >= $t)) return o(i, () => i.target instanceof HTMLElement ? i.target : null);
|
|
972
|
+
}, !0), Vt(r, "blur", (i) => o(i, () => window.document.activeElement instanceof HTMLIFrameElement ? window.document.activeElement : null), !0);
|
|
1014
973
|
}
|
|
1015
974
|
function Me(...e) {
|
|
1016
975
|
return C(() => Ve(...e), [...e]);
|
|
1017
976
|
}
|
|
1018
|
-
function
|
|
1019
|
-
let l =
|
|
977
|
+
function qt(e, t, n, r) {
|
|
978
|
+
let l = ue(n);
|
|
1020
979
|
M(() => {
|
|
1021
980
|
e = e ?? window;
|
|
1022
|
-
function a
|
|
1023
|
-
l.current(
|
|
981
|
+
function o(a) {
|
|
982
|
+
l.current(a);
|
|
1024
983
|
}
|
|
1025
|
-
return e.addEventListener(t,
|
|
984
|
+
return e.addEventListener(t, o, r), () => e.removeEventListener(t, o, r);
|
|
1026
985
|
}, [e, t, r]);
|
|
1027
986
|
}
|
|
1028
987
|
function fr() {
|
|
@@ -1032,14 +991,14 @@ function fr() {
|
|
|
1032
991
|
let r = t.documentElement, l = (n = t.defaultView) != null ? n : window;
|
|
1033
992
|
e = Math.max(0, l.innerWidth - r.clientWidth);
|
|
1034
993
|
}, after({ doc: t, d: n }) {
|
|
1035
|
-
let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth),
|
|
1036
|
-
n.style(r, "paddingRight", `${
|
|
994
|
+
let r = t.documentElement, l = Math.max(0, r.clientWidth - r.offsetWidth), o = Math.max(0, e - l);
|
|
995
|
+
n.style(r, "paddingRight", `${o}px`);
|
|
1037
996
|
} };
|
|
1038
997
|
}
|
|
1039
998
|
function mr() {
|
|
1040
|
-
return
|
|
999
|
+
return Xt() ? { before({ doc: e, d: t, meta: n }) {
|
|
1041
1000
|
function r(l) {
|
|
1042
|
-
return n.containers.flatMap((
|
|
1001
|
+
return n.containers.flatMap((o) => o()).some((o) => o.contains(l));
|
|
1043
1002
|
}
|
|
1044
1003
|
t.microTask(() => {
|
|
1045
1004
|
var l;
|
|
@@ -1047,13 +1006,13 @@ function mr() {
|
|
|
1047
1006
|
let s = re();
|
|
1048
1007
|
s.style(e.documentElement, "scrollBehavior", "auto"), t.add(() => t.microTask(() => s.dispose()));
|
|
1049
1008
|
}
|
|
1050
|
-
let
|
|
1009
|
+
let o = (l = window.scrollY) != null ? l : window.pageYOffset, a = null;
|
|
1051
1010
|
t.addEventListener(e, "click", (s) => {
|
|
1052
1011
|
if (s.target instanceof HTMLElement) try {
|
|
1053
1012
|
let i = s.target.closest("a");
|
|
1054
1013
|
if (!i) return;
|
|
1055
|
-
let { hash:
|
|
1056
|
-
f && !r(f) && (
|
|
1014
|
+
let { hash: c } = new URL(i.href), f = e.querySelector(c);
|
|
1015
|
+
f && !r(f) && (a = f);
|
|
1057
1016
|
} catch {
|
|
1058
1017
|
}
|
|
1059
1018
|
}, !0), t.addEventListener(e, "touchstart", (s) => {
|
|
@@ -1074,7 +1033,7 @@ function mr() {
|
|
|
1074
1033
|
}, { passive: !1 }), t.add(() => {
|
|
1075
1034
|
var s;
|
|
1076
1035
|
let i = (s = window.scrollY) != null ? s : window.pageYOffset;
|
|
1077
|
-
|
|
1036
|
+
o !== i && window.scrollTo(0, o), a && a.isConnected && (a.scrollIntoView({ block: "nearest" }), a = null);
|
|
1078
1037
|
});
|
|
1079
1038
|
});
|
|
1080
1039
|
} } : {};
|
|
@@ -1089,7 +1048,7 @@ function hr(e) {
|
|
|
1089
1048
|
for (let n of e) Object.assign(t, n(t));
|
|
1090
1049
|
return t;
|
|
1091
1050
|
}
|
|
1092
|
-
let oe =
|
|
1051
|
+
let oe = Wt(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
|
|
1093
1052
|
var n;
|
|
1094
1053
|
let r = (n = this.get(e)) != null ? n : { doc: e, count: 0, d: re(), meta: /* @__PURE__ */ new Set() };
|
|
1095
1054
|
return r.count++, r.meta.add(t), this.set(e, r), this;
|
|
@@ -1098,7 +1057,7 @@ let oe = _t(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
|
|
|
1098
1057
|
return n && (n.count--, n.meta.delete(t)), this;
|
|
1099
1058
|
}, SCROLL_PREVENT({ doc: e, d: t, meta: n }) {
|
|
1100
1059
|
let r = { doc: e, d: t, meta: hr(n) }, l = [mr(), fr(), pr()];
|
|
1101
|
-
l.forEach(({ before:
|
|
1060
|
+
l.forEach(({ before: o }) => o == null ? void 0 : o(r)), l.forEach(({ after: o }) => o == null ? void 0 : o(r));
|
|
1102
1061
|
}, SCROLL_ALLOW({ d: e }) {
|
|
1103
1062
|
e.dispose();
|
|
1104
1063
|
}, TEARDOWN({ doc: e }) {
|
|
@@ -1113,24 +1072,24 @@ oe.subscribe(() => {
|
|
|
1113
1072
|
}
|
|
1114
1073
|
});
|
|
1115
1074
|
function vr(e, t, n = () => ({ containers: [] })) {
|
|
1116
|
-
let r =
|
|
1117
|
-
return
|
|
1075
|
+
let r = _t(oe), l = t ? r.get(t) : void 0, o = l ? l.count > 0 : !1;
|
|
1076
|
+
return A(() => {
|
|
1118
1077
|
if (!(!t || !e)) return oe.dispatch("PUSH", t, n), () => oe.dispatch("POP", t, n);
|
|
1119
|
-
}, [e, t]),
|
|
1078
|
+
}, [e, t]), o;
|
|
1120
1079
|
}
|
|
1121
1080
|
function gr(e, t, n = () => [document.body]) {
|
|
1122
|
-
let r =
|
|
1081
|
+
let r = fe(e, "scroll-lock");
|
|
1123
1082
|
vr(r, t, (l) => {
|
|
1124
|
-
var
|
|
1125
|
-
return { containers: [...(
|
|
1083
|
+
var o;
|
|
1084
|
+
return { containers: [...(o = l.containers) != null ? o : [], n] };
|
|
1126
1085
|
});
|
|
1127
1086
|
}
|
|
1128
1087
|
function wr(e = 0) {
|
|
1129
|
-
let [t, n] =
|
|
1130
|
-
return { flags: t, setFlag: r, addFlag: l, hasFlag:
|
|
1088
|
+
let [t, n] = S(e), r = Y((i) => n(i), [t]), l = Y((i) => n((c) => c | i), [t]), o = Y((i) => (t & i) === i, [t]), a = Y((i) => n((c) => c & ~i), [n]), s = Y((i) => n((c) => c ^ i), [n]);
|
|
1089
|
+
return { flags: t, setFlag: r, addFlag: l, hasFlag: o, removeFlag: a, toggleFlag: s };
|
|
1131
1090
|
}
|
|
1132
|
-
var
|
|
1133
|
-
typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((
|
|
1091
|
+
var Tt, Ot;
|
|
1092
|
+
typeof process < "u" && typeof globalThis < "u" && typeof Element < "u" && ((Tt = process == null ? void 0 : process.env) == null ? void 0 : Tt.NODE_ENV) === "test" && typeof ((Ot = Element == null ? void 0 : Element.prototype) == null ? void 0 : Ot.getAnimations) > "u" && (Element.prototype.getAnimations = function() {
|
|
1134
1093
|
return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.", "Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.", "", "Example usage:", "```js", "import { mockAnimationsApi } from 'jsdom-testing-mocks'", "mockAnimationsApi()", "```"].join(`
|
|
1135
1094
|
`)), [];
|
|
1136
1095
|
});
|
|
@@ -1141,44 +1100,44 @@ function xr(e) {
|
|
|
1141
1100
|
return t;
|
|
1142
1101
|
}
|
|
1143
1102
|
function br(e, t, n, r) {
|
|
1144
|
-
let [l,
|
|
1145
|
-
return
|
|
1103
|
+
let [l, o] = S(n), { hasFlag: a, addFlag: s, removeFlag: i } = wr(e && l ? 3 : 0), c = O(!1), f = O(!1), y = pt();
|
|
1104
|
+
return A(() => {
|
|
1146
1105
|
var b;
|
|
1147
1106
|
if (e) {
|
|
1148
|
-
if (n &&
|
|
1107
|
+
if (n && o(!0), !t) {
|
|
1149
1108
|
n && s(3);
|
|
1150
1109
|
return;
|
|
1151
1110
|
}
|
|
1152
|
-
return (b = r == null ? void 0 : r.start) == null || b.call(r, n), Er(t, { inFlight:
|
|
1153
|
-
f.current ? f.current = !1 : f.current =
|
|
1111
|
+
return (b = r == null ? void 0 : r.start) == null || b.call(r, n), Er(t, { inFlight: c, prepare() {
|
|
1112
|
+
f.current ? f.current = !1 : f.current = c.current, c.current = !0, !f.current && (n ? (s(3), i(4)) : (s(4), i(2)));
|
|
1154
1113
|
}, run() {
|
|
1155
1114
|
f.current ? n ? (i(3), s(4)) : (i(4), s(3)) : n ? i(1) : s(1);
|
|
1156
1115
|
}, done() {
|
|
1157
1116
|
var w;
|
|
1158
|
-
f.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (
|
|
1117
|
+
f.current && typeof t.getAnimations == "function" && t.getAnimations().length > 0 || (c.current = !1, i(7), n || o(!1), (w = r == null ? void 0 : r.end) == null || w.call(r, n));
|
|
1159
1118
|
} });
|
|
1160
1119
|
}
|
|
1161
|
-
}, [e, n, t, y]), e ? [l, { closed:
|
|
1120
|
+
}, [e, n, t, y]), e ? [l, { closed: a(1), enter: a(2), leave: a(4), transition: a(2) || a(4) }] : [n, { closed: void 0, enter: void 0, leave: void 0, transition: void 0 }];
|
|
1162
1121
|
}
|
|
1163
1122
|
function Er(e, { prepare: t, run: n, done: r, inFlight: l }) {
|
|
1164
|
-
let
|
|
1165
|
-
return Tr(e, { prepare: t, inFlight: l }),
|
|
1166
|
-
n(),
|
|
1167
|
-
|
|
1123
|
+
let o = re();
|
|
1124
|
+
return Tr(e, { prepare: t, inFlight: l }), o.nextFrame(() => {
|
|
1125
|
+
n(), o.requestAnimationFrame(() => {
|
|
1126
|
+
o.add($r(e, r));
|
|
1168
1127
|
});
|
|
1169
|
-
}),
|
|
1128
|
+
}), o.dispose;
|
|
1170
1129
|
}
|
|
1171
1130
|
function $r(e, t) {
|
|
1172
1131
|
var n, r;
|
|
1173
1132
|
let l = re();
|
|
1174
1133
|
if (!e) return l.dispose;
|
|
1175
|
-
let
|
|
1134
|
+
let o = !1;
|
|
1176
1135
|
l.add(() => {
|
|
1177
|
-
|
|
1136
|
+
o = !0;
|
|
1178
1137
|
});
|
|
1179
|
-
let
|
|
1180
|
-
return
|
|
1181
|
-
|
|
1138
|
+
let a = (r = (n = e.getAnimations) == null ? void 0 : n.call(e).filter((s) => s instanceof CSSTransition)) != null ? r : [];
|
|
1139
|
+
return a.length === 0 ? (t(), l.dispose) : (Promise.allSettled(a.map((s) => s.finished)).then(() => {
|
|
1140
|
+
o || t();
|
|
1182
1141
|
}), l.dispose);
|
|
1183
1142
|
}
|
|
1184
1143
|
function Tr(e, { inFlight: t, prepare: n }) {
|
|
@@ -1190,10 +1149,10 @@ function Tr(e, { inFlight: t, prepare: n }) {
|
|
|
1190
1149
|
e.style.transition = "none", n(), e.offsetHeight, e.style.transition = r;
|
|
1191
1150
|
}
|
|
1192
1151
|
function vt(e, t) {
|
|
1193
|
-
let n = O([]), r =
|
|
1152
|
+
let n = O([]), r = L(e);
|
|
1194
1153
|
M(() => {
|
|
1195
1154
|
let l = [...n.current];
|
|
1196
|
-
for (let [
|
|
1155
|
+
for (let [o, a] of t.entries()) if (n.current[o] !== a) {
|
|
1197
1156
|
let s = r(t, l);
|
|
1198
1157
|
return n.current = t, s;
|
|
1199
1158
|
}
|
|
@@ -1226,37 +1185,37 @@ Mr(() => {
|
|
|
1226
1185
|
}
|
|
1227
1186
|
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 });
|
|
1228
1187
|
});
|
|
1229
|
-
function
|
|
1230
|
-
let t =
|
|
1188
|
+
function Yt(e) {
|
|
1189
|
+
let t = L(e), n = O(!1);
|
|
1231
1190
|
M(() => (n.current = !1, () => {
|
|
1232
1191
|
n.current = !0, qe(() => {
|
|
1233
1192
|
n.current && t();
|
|
1234
1193
|
});
|
|
1235
1194
|
}), [t]);
|
|
1236
1195
|
}
|
|
1237
|
-
function
|
|
1196
|
+
function Lr() {
|
|
1238
1197
|
let e = typeof document > "u";
|
|
1239
1198
|
return "useSyncExternalStore" in Ee ? ((t) => t.useSyncExternalStore)(Ee)(() => () => {
|
|
1240
1199
|
}, () => !1, () => !e) : !1;
|
|
1241
1200
|
}
|
|
1242
|
-
function
|
|
1243
|
-
let e =
|
|
1244
|
-
return t &&
|
|
1201
|
+
function Le() {
|
|
1202
|
+
let e = Lr(), [t, n] = Ee.useState(ae.isHandoffComplete);
|
|
1203
|
+
return t && ae.isHandoffComplete === !1 && n(!1), Ee.useEffect(() => {
|
|
1245
1204
|
t !== !0 && n(!0);
|
|
1246
|
-
}, [t]), Ee.useEffect(() =>
|
|
1205
|
+
}, [t]), Ee.useEffect(() => ae.handoff(), []), e ? !1 : t;
|
|
1247
1206
|
}
|
|
1248
|
-
let
|
|
1249
|
-
function
|
|
1250
|
-
return R(
|
|
1207
|
+
let zt = H(!1);
|
|
1208
|
+
function Sr() {
|
|
1209
|
+
return R(zt);
|
|
1251
1210
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return E.createElement(
|
|
1211
|
+
function Pt(e) {
|
|
1212
|
+
return E.createElement(zt.Provider, { value: e.force }, e.children);
|
|
1254
1213
|
}
|
|
1255
1214
|
function Fr(e) {
|
|
1256
|
-
let t =
|
|
1257
|
-
var
|
|
1258
|
-
if (!t && n !== null) return (
|
|
1259
|
-
if (
|
|
1215
|
+
let t = Sr(), n = R(Kt), r = Me(e), [l, o] = S(() => {
|
|
1216
|
+
var a;
|
|
1217
|
+
if (!t && n !== null) return (a = n.current) != null ? a : null;
|
|
1218
|
+
if (ae.isServer) return null;
|
|
1260
1219
|
let s = r == null ? void 0 : r.getElementById("headlessui-portal-root");
|
|
1261
1220
|
if (s) return s;
|
|
1262
1221
|
if (r === null) return null;
|
|
@@ -1266,106 +1225,106 @@ function Fr(e) {
|
|
|
1266
1225
|
return M(() => {
|
|
1267
1226
|
l !== null && (r != null && r.body.contains(l) || r == null || r.body.appendChild(l));
|
|
1268
1227
|
}, [l, r]), M(() => {
|
|
1269
|
-
t || n !== null &&
|
|
1270
|
-
}, [n,
|
|
1228
|
+
t || n !== null && o(n.current);
|
|
1229
|
+
}, [n, o, t]), l;
|
|
1271
1230
|
}
|
|
1272
|
-
let
|
|
1231
|
+
let Gt = G, Cr = D(function(e, t) {
|
|
1273
1232
|
let n = e, r = O(null), l = Z(_n((y) => {
|
|
1274
1233
|
r.current = y;
|
|
1275
|
-
}), t),
|
|
1234
|
+
}), t), o = Me(r), a = Fr(r), [s] = S(() => {
|
|
1276
1235
|
var y;
|
|
1277
|
-
return
|
|
1278
|
-
}), i = R(st),
|
|
1279
|
-
|
|
1280
|
-
!
|
|
1281
|
-
}, [
|
|
1236
|
+
return ae.isServer ? null : (y = o == null ? void 0 : o.createElement("div")) != null ? y : null;
|
|
1237
|
+
}), i = R(st), c = Le();
|
|
1238
|
+
A(() => {
|
|
1239
|
+
!a || !s || a.contains(s) || (s.setAttribute("data-headlessui-portal", ""), a.appendChild(s));
|
|
1240
|
+
}, [a, s]), A(() => {
|
|
1282
1241
|
if (s && i) return i.register(s);
|
|
1283
|
-
}, [i, s]),
|
|
1242
|
+
}, [i, s]), Yt(() => {
|
|
1284
1243
|
var y;
|
|
1285
|
-
!
|
|
1244
|
+
!a || !s || (s instanceof Node && a.contains(s) && a.removeChild(s), a.childNodes.length <= 0 && ((y = a.parentElement) == null || y.removeChild(a)));
|
|
1286
1245
|
});
|
|
1287
1246
|
let f = W();
|
|
1288
|
-
return
|
|
1247
|
+
return c ? !a || !s ? null : En(f({ ourProps: { ref: l }, theirProps: n, slot: {}, defaultTag: Gt, name: "Portal" }), s) : null;
|
|
1289
1248
|
});
|
|
1290
1249
|
function kr(e, t) {
|
|
1291
|
-
let n = Z(t), { enabled: r = !0, ...l } = e,
|
|
1292
|
-
return r ? E.createElement(Cr, { ...l, ref: n }) :
|
|
1250
|
+
let n = Z(t), { enabled: r = !0, ...l } = e, o = W();
|
|
1251
|
+
return r ? E.createElement(Cr, { ...l, ref: n }) : o({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Gt, name: "Portal" });
|
|
1293
1252
|
}
|
|
1294
|
-
let
|
|
1295
|
-
function
|
|
1296
|
-
let { target: n, ...r } = e, l = { ref: Z(t) },
|
|
1297
|
-
return E.createElement(
|
|
1253
|
+
let Nr = G, Kt = H(null);
|
|
1254
|
+
function Ar(e, t) {
|
|
1255
|
+
let { target: n, ...r } = e, l = { ref: Z(t) }, o = W();
|
|
1256
|
+
return E.createElement(Kt.Provider, { value: n }, o({ ourProps: l, theirProps: r, defaultTag: Nr, name: "Popover.Group" }));
|
|
1298
1257
|
}
|
|
1299
1258
|
let st = H(null);
|
|
1300
1259
|
function Ir() {
|
|
1301
|
-
let e = R(st), t = O([]), n =
|
|
1302
|
-
let
|
|
1303
|
-
|
|
1260
|
+
let e = R(st), t = O([]), n = L((o) => (t.current.push(o), e && e.register(o), () => r(o))), r = L((o) => {
|
|
1261
|
+
let a = t.current.indexOf(o);
|
|
1262
|
+
a !== -1 && t.current.splice(a, 1), e && e.unregister(o);
|
|
1304
1263
|
}), l = C(() => ({ register: n, unregister: r, portals: t }), [n, r, t]);
|
|
1305
|
-
return [t, C(() => function({ children:
|
|
1306
|
-
return E.createElement(st.Provider, { value: l },
|
|
1264
|
+
return [t, C(() => function({ children: o }) {
|
|
1265
|
+
return E.createElement(st.Provider, { value: l }, o);
|
|
1307
1266
|
}, [l])];
|
|
1308
1267
|
}
|
|
1309
|
-
let Rr = D(kr),
|
|
1268
|
+
let Rr = D(kr), Zt = D(Ar), Dr = Object.assign(Rr, { Group: Zt });
|
|
1310
1269
|
function jr(e, t = typeof document < "u" ? document.defaultView : null, n) {
|
|
1311
|
-
let r =
|
|
1312
|
-
|
|
1313
|
-
r && (l.defaultPrevented || l.key ===
|
|
1270
|
+
let r = fe(e, "escape");
|
|
1271
|
+
qt(t, "keydown", (l) => {
|
|
1272
|
+
r && (l.defaultPrevented || l.key === Ht.Escape && n(l));
|
|
1314
1273
|
});
|
|
1315
1274
|
}
|
|
1316
1275
|
function Ur() {
|
|
1317
1276
|
var e;
|
|
1318
|
-
let [t] =
|
|
1319
|
-
return
|
|
1277
|
+
let [t] = S(() => typeof window < "u" && typeof window.matchMedia == "function" ? window.matchMedia("(pointer: coarse)") : null), [n, r] = S((e = t == null ? void 0 : t.matches) != null ? e : !1);
|
|
1278
|
+
return A(() => {
|
|
1320
1279
|
if (!t) return;
|
|
1321
|
-
function l(
|
|
1322
|
-
r(
|
|
1280
|
+
function l(o) {
|
|
1281
|
+
r(o.matches);
|
|
1323
1282
|
}
|
|
1324
1283
|
return t.addEventListener("change", l), () => t.removeEventListener("change", l);
|
|
1325
1284
|
}, [t]), n;
|
|
1326
1285
|
}
|
|
1327
1286
|
function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
|
|
1328
|
-
let r = Me(n), l =
|
|
1329
|
-
var
|
|
1287
|
+
let r = Me(n), l = L(() => {
|
|
1288
|
+
var o, a;
|
|
1330
1289
|
let s = [];
|
|
1331
1290
|
for (let i of e) i !== null && (i instanceof HTMLElement ? s.push(i) : "current" in i && i.current instanceof HTMLElement && s.push(i.current));
|
|
1332
1291
|
if (t != null && t.current) for (let i of t.current) s.push(i);
|
|
1333
|
-
for (let i of (
|
|
1292
|
+
for (let i of (o = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? o : []) i !== document.body && i !== document.head && i instanceof HTMLElement && i.id !== "headlessui-portal-root" && (n && (i.contains(n) || i.contains((a = n == null ? void 0 : n.getRootNode()) == null ? void 0 : a.host)) || s.some((c) => i.contains(c)) || s.push(i));
|
|
1334
1293
|
return s;
|
|
1335
1294
|
});
|
|
1336
|
-
return { resolveContainers: l, contains:
|
|
1337
|
-
}
|
|
1338
|
-
let
|
|
1339
|
-
function
|
|
1340
|
-
let [n, r] =
|
|
1341
|
-
return E.createElement(
|
|
1342
|
-
var
|
|
1343
|
-
if (
|
|
1344
|
-
for (let i of (s = (
|
|
1295
|
+
return { resolveContainers: l, contains: L((o) => l().some((a) => a.contains(o))) };
|
|
1296
|
+
}
|
|
1297
|
+
let Jt = H(null);
|
|
1298
|
+
function Mt({ children: e, node: t }) {
|
|
1299
|
+
let [n, r] = S(null), l = Qt(t ?? n);
|
|
1300
|
+
return E.createElement(Jt.Provider, { value: l }, e, l === null && E.createElement(it, { features: He.Hidden, ref: (o) => {
|
|
1301
|
+
var a, s;
|
|
1302
|
+
if (o) {
|
|
1303
|
+
for (let i of (s = (a = Ve(o)) == null ? void 0 : a.querySelectorAll("html > *, body > *")) != null ? s : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(o)) {
|
|
1345
1304
|
r(i);
|
|
1346
1305
|
break;
|
|
1347
1306
|
}
|
|
1348
1307
|
}
|
|
1349
1308
|
} }));
|
|
1350
1309
|
}
|
|
1351
|
-
function
|
|
1310
|
+
function Qt(e = null) {
|
|
1352
1311
|
var t;
|
|
1353
|
-
return (t = R(
|
|
1312
|
+
return (t = R(Jt)) != null ? t : e;
|
|
1354
1313
|
}
|
|
1355
1314
|
function gt() {
|
|
1356
1315
|
let e = O(!1);
|
|
1357
|
-
return
|
|
1316
|
+
return A(() => (e.current = !0, () => {
|
|
1358
1317
|
e.current = !1;
|
|
1359
1318
|
}), []), e;
|
|
1360
1319
|
}
|
|
1361
1320
|
var be = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(be || {});
|
|
1362
1321
|
function Wr() {
|
|
1363
1322
|
let e = O(0);
|
|
1364
|
-
return
|
|
1323
|
+
return Vt(!0, "keydown", (t) => {
|
|
1365
1324
|
t.key === "Tab" && (e.current = t.shiftKey ? 1 : 0);
|
|
1366
1325
|
}, !0), e;
|
|
1367
1326
|
}
|
|
1368
|
-
function
|
|
1327
|
+
function en(e) {
|
|
1369
1328
|
if (!e) return /* @__PURE__ */ new Set();
|
|
1370
1329
|
if (typeof e == "function") return new Set(e());
|
|
1371
1330
|
let t = /* @__PURE__ */ new Set();
|
|
@@ -1373,44 +1332,44 @@ function tn(e) {
|
|
|
1373
1332
|
return t;
|
|
1374
1333
|
}
|
|
1375
1334
|
let _r = "div";
|
|
1376
|
-
var
|
|
1335
|
+
var ie = ((e) => (e[e.None = 0] = "None", e[e.InitialFocus = 1] = "InitialFocus", e[e.TabLock = 2] = "TabLock", e[e.FocusLock = 4] = "FocusLock", e[e.RestoreFocus = 8] = "RestoreFocus", e[e.AutoFocus = 16] = "AutoFocus", e))(ie || {});
|
|
1377
1336
|
function Br(e, t) {
|
|
1378
|
-
let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback:
|
|
1379
|
-
|
|
1380
|
-
let
|
|
1381
|
-
Yr(s, { ownerDocument:
|
|
1382
|
-
let f = zr(s, { ownerDocument:
|
|
1383
|
-
Gr(s, { ownerDocument:
|
|
1384
|
-
let y = Wr(), b =
|
|
1337
|
+
let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback: o, containers: a, features: s = 15, ...i } = e;
|
|
1338
|
+
Le() || (s = 0);
|
|
1339
|
+
let c = Me(n);
|
|
1340
|
+
Yr(s, { ownerDocument: c });
|
|
1341
|
+
let f = zr(s, { ownerDocument: c, container: n, initialFocus: l, initialFocusFallback: o });
|
|
1342
|
+
Gr(s, { ownerDocument: c, container: n, containers: a, previousActiveElement: f });
|
|
1343
|
+
let y = Wr(), b = L((p) => {
|
|
1385
1344
|
let g = n.current;
|
|
1386
1345
|
g && ((x) => x())(() => {
|
|
1387
1346
|
ne(y.current, { [be.Forwards]: () => {
|
|
1388
|
-
Oe(g, J.First, { skipElements: [p.relatedTarget,
|
|
1347
|
+
Oe(g, J.First, { skipElements: [p.relatedTarget, o] });
|
|
1389
1348
|
}, [be.Backwards]: () => {
|
|
1390
|
-
Oe(g, J.Last, { skipElements: [p.relatedTarget,
|
|
1349
|
+
Oe(g, J.Last, { skipElements: [p.relatedTarget, o] });
|
|
1391
1350
|
} });
|
|
1392
1351
|
});
|
|
1393
|
-
}), w =
|
|
1394
|
-
p.key == "Tab" && (v.current = !0,
|
|
1352
|
+
}), w = fe(!!(s & 2), "focus-trap#tab-lock"), d = pt(), v = O(!1), u = { ref: r, onKeyDown(p) {
|
|
1353
|
+
p.key == "Tab" && (v.current = !0, d.requestAnimationFrame(() => {
|
|
1395
1354
|
v.current = !1;
|
|
1396
1355
|
}));
|
|
1397
1356
|
}, onBlur(p) {
|
|
1398
1357
|
if (!(s & 4)) return;
|
|
1399
|
-
let g =
|
|
1358
|
+
let g = en(a);
|
|
1400
1359
|
n.current instanceof HTMLElement && g.add(n.current);
|
|
1401
1360
|
let x = p.relatedTarget;
|
|
1402
|
-
x instanceof HTMLElement && x.dataset.headlessuiFocusGuard !== "true" && (
|
|
1361
|
+
x instanceof HTMLElement && x.dataset.headlessuiFocusGuard !== "true" && (tn(g, x) || (v.current ? Oe(n.current, ne(y.current, { [be.Forwards]: () => J.Next, [be.Backwards]: () => J.Previous }) | J.WrapAround, { relativeTo: p.target }) : p.target instanceof HTMLElement && Q(p.target)));
|
|
1403
1362
|
} }, m = W();
|
|
1404
1363
|
return E.createElement(E.Fragment, null, w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }), m({ ourProps: u, theirProps: i, defaultTag: _r, name: "FocusTrap" }), w && E.createElement(it, { as: "button", type: "button", "data-headlessui-focus-guard": !0, onFocus: b, features: He.Focusable }));
|
|
1405
1364
|
}
|
|
1406
|
-
let Xr = D(Br), Vr = Object.assign(Xr, { features:
|
|
1365
|
+
let Xr = D(Br), Vr = Object.assign(Xr, { features: ie });
|
|
1407
1366
|
function qr(e = !0) {
|
|
1408
1367
|
let t = O(ee.slice());
|
|
1409
1368
|
return vt(([n], [r]) => {
|
|
1410
1369
|
r === !0 && n === !1 && qe(() => {
|
|
1411
1370
|
t.current.splice(0);
|
|
1412
1371
|
}), r === !1 && n === !0 && (t.current = ee.slice());
|
|
1413
|
-
}, [e, ee, t]),
|
|
1372
|
+
}, [e, ee, t]), L(() => {
|
|
1414
1373
|
var n;
|
|
1415
1374
|
return (n = t.current.find((r) => r != null && r.isConnected)) != null ? n : null;
|
|
1416
1375
|
});
|
|
@@ -1419,62 +1378,62 @@ function Yr(e, { ownerDocument: t }) {
|
|
|
1419
1378
|
let n = !!(e & 8), r = qr(n);
|
|
1420
1379
|
vt(() => {
|
|
1421
1380
|
n || (t == null ? void 0 : t.activeElement) === (t == null ? void 0 : t.body) && Q(r());
|
|
1422
|
-
}, [n]),
|
|
1381
|
+
}, [n]), Yt(() => {
|
|
1423
1382
|
n && Q(r());
|
|
1424
1383
|
});
|
|
1425
1384
|
}
|
|
1426
1385
|
function zr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFallback: l }) {
|
|
1427
|
-
let
|
|
1386
|
+
let o = O(null), a = fe(!!(e & 1), "focus-trap#initial-focus"), s = gt();
|
|
1428
1387
|
return vt(() => {
|
|
1429
1388
|
if (e === 0) return;
|
|
1430
|
-
if (!
|
|
1389
|
+
if (!a) {
|
|
1431
1390
|
l != null && l.current && Q(l.current);
|
|
1432
1391
|
return;
|
|
1433
1392
|
}
|
|
1434
1393
|
let i = n.current;
|
|
1435
1394
|
i && qe(() => {
|
|
1436
1395
|
if (!s.current) return;
|
|
1437
|
-
let
|
|
1396
|
+
let c = t == null ? void 0 : t.activeElement;
|
|
1438
1397
|
if (r != null && r.current) {
|
|
1439
|
-
if ((r == null ? void 0 : r.current) ===
|
|
1440
|
-
|
|
1398
|
+
if ((r == null ? void 0 : r.current) === c) {
|
|
1399
|
+
o.current = c;
|
|
1441
1400
|
return;
|
|
1442
1401
|
}
|
|
1443
|
-
} else if (i.contains(
|
|
1444
|
-
|
|
1402
|
+
} else if (i.contains(c)) {
|
|
1403
|
+
o.current = c;
|
|
1445
1404
|
return;
|
|
1446
1405
|
}
|
|
1447
1406
|
if (r != null && r.current) Q(r.current);
|
|
1448
1407
|
else {
|
|
1449
1408
|
if (e & 16) {
|
|
1450
|
-
if (Oe(i, J.First | J.AutoFocus) !==
|
|
1451
|
-
} else if (Oe(i, J.First) !==
|
|
1409
|
+
if (Oe(i, J.First | J.AutoFocus) !== at.Error) return;
|
|
1410
|
+
} else if (Oe(i, J.First) !== at.Error) return;
|
|
1452
1411
|
if (l != null && l.current && (Q(l.current), (t == null ? void 0 : t.activeElement) === l.current)) return;
|
|
1453
1412
|
console.warn("There are no focusable elements inside the <FocusTrap />");
|
|
1454
1413
|
}
|
|
1455
|
-
|
|
1414
|
+
o.current = t == null ? void 0 : t.activeElement;
|
|
1456
1415
|
});
|
|
1457
|
-
}, [l,
|
|
1416
|
+
}, [l, a, e]), o;
|
|
1458
1417
|
}
|
|
1459
1418
|
function Gr(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
|
|
1460
|
-
let
|
|
1461
|
-
|
|
1462
|
-
if (!
|
|
1463
|
-
let i =
|
|
1419
|
+
let o = gt(), a = !!(e & 4);
|
|
1420
|
+
qt(t == null ? void 0 : t.defaultView, "focus", (s) => {
|
|
1421
|
+
if (!a || !o.current) return;
|
|
1422
|
+
let i = en(r);
|
|
1464
1423
|
n.current instanceof HTMLElement && i.add(n.current);
|
|
1465
|
-
let
|
|
1466
|
-
if (!
|
|
1424
|
+
let c = l.current;
|
|
1425
|
+
if (!c) return;
|
|
1467
1426
|
let f = s.target;
|
|
1468
|
-
f && f instanceof HTMLElement ?
|
|
1427
|
+
f && f instanceof HTMLElement ? tn(i, f) ? (l.current = f, Q(f)) : (s.preventDefault(), s.stopPropagation(), Q(c)) : Q(l.current);
|
|
1469
1428
|
}, !0);
|
|
1470
1429
|
}
|
|
1471
|
-
function
|
|
1430
|
+
function tn(e, t) {
|
|
1472
1431
|
for (let n of e) if (n.contains(t)) return !0;
|
|
1473
1432
|
return !1;
|
|
1474
1433
|
}
|
|
1475
|
-
function
|
|
1434
|
+
function nn(e) {
|
|
1476
1435
|
var t;
|
|
1477
|
-
return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t :
|
|
1436
|
+
return !!(e.enter || e.enterFrom || e.enterTo || e.leave || e.leaveFrom || e.leaveTo) || ((t = e.as) != null ? t : ln) !== G || E.Children.count(e.children) === 1;
|
|
1478
1437
|
}
|
|
1479
1438
|
let Ge = H(null);
|
|
1480
1439
|
Ge.displayName = "TransitionContext";
|
|
@@ -1494,102 +1453,102 @@ Ke.displayName = "NestingContext";
|
|
|
1494
1453
|
function Ze(e) {
|
|
1495
1454
|
return "children" in e ? Ze(e.children) : e.current.filter(({ el: t }) => t.current !== null).filter(({ state: t }) => t === "visible").length > 0;
|
|
1496
1455
|
}
|
|
1497
|
-
function
|
|
1498
|
-
let n =
|
|
1456
|
+
function rn(e, t) {
|
|
1457
|
+
let n = ue(e), r = O([]), l = gt(), o = pt(), a = L((w, d = te.Hidden) => {
|
|
1499
1458
|
let v = r.current.findIndex(({ el: u }) => u === w);
|
|
1500
|
-
v !== -1 && (ne(
|
|
1459
|
+
v !== -1 && (ne(d, { [te.Unmount]() {
|
|
1501
1460
|
r.current.splice(v, 1);
|
|
1502
1461
|
}, [te.Hidden]() {
|
|
1503
1462
|
r.current[v].state = "hidden";
|
|
1504
|
-
} }),
|
|
1463
|
+
} }), o.microTask(() => {
|
|
1505
1464
|
var u;
|
|
1506
1465
|
!Ze(r) && l.current && ((u = n.current) == null || u.call(n));
|
|
1507
1466
|
}));
|
|
1508
|
-
}), s =
|
|
1509
|
-
let
|
|
1510
|
-
return
|
|
1511
|
-
}), i = O([]),
|
|
1512
|
-
i.current.splice(0), t && (t.chains.current[
|
|
1467
|
+
}), s = L((w) => {
|
|
1468
|
+
let d = r.current.find(({ el: v }) => v === w);
|
|
1469
|
+
return d ? d.state !== "visible" && (d.state = "visible") : r.current.push({ el: w, state: "visible" }), () => a(w, te.Unmount);
|
|
1470
|
+
}), i = O([]), c = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y = L((w, d, v) => {
|
|
1471
|
+
i.current.splice(0), t && (t.chains.current[d] = t.chains.current[d].filter(([u]) => u !== w)), t == null || t.chains.current[d].push([w, new Promise((u) => {
|
|
1513
1472
|
i.current.push(u);
|
|
1514
|
-
})]), t == null || t.chains.current[
|
|
1515
|
-
Promise.all(f.current[
|
|
1516
|
-
})]),
|
|
1517
|
-
}), b =
|
|
1518
|
-
Promise.all(f.current[
|
|
1473
|
+
})]), t == null || t.chains.current[d].push([w, new Promise((u) => {
|
|
1474
|
+
Promise.all(f.current[d].map(([m, p]) => p)).then(() => u());
|
|
1475
|
+
})]), d === "enter" ? c.current = c.current.then(() => t == null ? void 0 : t.wait.current).then(() => v(d)) : v(d);
|
|
1476
|
+
}), b = L((w, d, v) => {
|
|
1477
|
+
Promise.all(f.current[d].splice(0).map(([u, m]) => m)).then(() => {
|
|
1519
1478
|
var u;
|
|
1520
1479
|
(u = i.current.shift()) == null || u();
|
|
1521
|
-
}).then(() => v(
|
|
1480
|
+
}).then(() => v(d));
|
|
1522
1481
|
});
|
|
1523
|
-
return C(() => ({ children: r, register: s, unregister:
|
|
1482
|
+
return C(() => ({ children: r, register: s, unregister: a, onStart: y, onStop: b, wait: c, chains: f }), [s, a, r, y, b, f, c]);
|
|
1524
1483
|
}
|
|
1525
|
-
let
|
|
1484
|
+
let ln = G, on = Ue.RenderStrategy;
|
|
1526
1485
|
function Qr(e, t) {
|
|
1527
1486
|
var n, r;
|
|
1528
|
-
let { transition: l = !0, beforeEnter:
|
|
1529
|
-
|
|
1487
|
+
let { transition: l = !0, beforeEnter: o, afterEnter: a, beforeLeave: s, afterLeave: i, enter: c, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: d, leaveTo: v, ...u } = e, [m, p] = S(null), g = O(null), x = nn(e), h = Z(...x ? [g, t, p] : t === null ? [] : [t]), $ = (n = u.unmount) == null || n ? te.Unmount : te.Hidden, { show: F, appear: j, initial: _ } = Zr(), [N, U] = S(F ? "visible" : "hidden"), B = Jr(), { register: X, unregister: P } = B;
|
|
1488
|
+
A(() => X(g), [X, g]), A(() => {
|
|
1530
1489
|
if ($ === te.Hidden && g.current) {
|
|
1531
|
-
if (F &&
|
|
1490
|
+
if (F && N !== "visible") {
|
|
1532
1491
|
U("visible");
|
|
1533
1492
|
return;
|
|
1534
1493
|
}
|
|
1535
|
-
return ne(
|
|
1494
|
+
return ne(N, { hidden: () => P(g), visible: () => X(g) });
|
|
1536
1495
|
}
|
|
1537
|
-
}, [
|
|
1538
|
-
let V =
|
|
1539
|
-
|
|
1540
|
-
if (x && V &&
|
|
1541
|
-
}, [g,
|
|
1542
|
-
let
|
|
1543
|
-
|
|
1544
|
-
}, B), Ce =
|
|
1545
|
-
|
|
1546
|
-
let
|
|
1547
|
-
K.onStart(g,
|
|
1548
|
-
|
|
1496
|
+
}, [N, g, X, P, F, $]);
|
|
1497
|
+
let V = Le();
|
|
1498
|
+
A(() => {
|
|
1499
|
+
if (x && V && N === "visible" && g.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
1500
|
+
}, [g, N, V, x]);
|
|
1501
|
+
let Se = _ && !j, Fe = j && F && _, pe = O(!1), K = rn(() => {
|
|
1502
|
+
pe.current || (U("hidden"), P(g));
|
|
1503
|
+
}, B), Ce = L((Qe) => {
|
|
1504
|
+
pe.current = !0;
|
|
1505
|
+
let Ne = Qe ? "enter" : "leave";
|
|
1506
|
+
K.onStart(g, Ne, (ve) => {
|
|
1507
|
+
ve === "enter" ? o == null || o() : ve === "leave" && (s == null || s());
|
|
1549
1508
|
});
|
|
1550
|
-
}), k =
|
|
1551
|
-
let
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
}),
|
|
1509
|
+
}), k = L((Qe) => {
|
|
1510
|
+
let Ne = Qe ? "enter" : "leave";
|
|
1511
|
+
pe.current = !1, K.onStop(g, Ne, (ve) => {
|
|
1512
|
+
ve === "enter" ? a == null || a() : ve === "leave" && (i == null || i());
|
|
1513
|
+
}), Ne === "leave" && !Ze(K) && (U("hidden"), P(g));
|
|
1555
1514
|
});
|
|
1556
1515
|
M(() => {
|
|
1557
1516
|
x && l || (Ce(F), k(F));
|
|
1558
1517
|
}, [F, x, l]);
|
|
1559
|
-
let ke = !(!l || !x || !V ||
|
|
1560
|
-
|
|
1561
|
-
let
|
|
1562
|
-
return E.createElement(Ke.Provider, { value: K }, E.createElement(Or, { value:
|
|
1518
|
+
let ke = !(!l || !x || !V || Se), [, I] = br(ke, m, F, { start: Ce, end: k }), cn = le({ ref: h, className: ((r = lt(u.className, Fe && c, Fe && f, I.enter && c, I.enter && I.closed && f, I.enter && !I.closed && y, I.leave && w, I.leave && !I.closed && d, I.leave && I.closed && v, !I.transition && F && b)) == null ? void 0 : r.trim()) || void 0, ...xr(I) }), he = 0;
|
|
1519
|
+
N === "visible" && (he |= z.Open), N === "hidden" && (he |= z.Closed), I.enter && (he |= z.Opening), I.leave && (he |= z.Closing);
|
|
1520
|
+
let dn = W();
|
|
1521
|
+
return E.createElement(Ke.Provider, { value: K }, E.createElement(Or, { value: he }, dn({ ourProps: cn, theirProps: u, defaultTag: ln, features: on, visible: N === "visible", name: "Transition.Child" })));
|
|
1563
1522
|
}
|
|
1564
1523
|
function el(e, t) {
|
|
1565
|
-
let { show: n, appear: r = !1, unmount: l = !0, ...
|
|
1566
|
-
|
|
1567
|
-
let
|
|
1568
|
-
if (n === void 0 &&
|
|
1569
|
-
let [f, y] =
|
|
1524
|
+
let { show: n, appear: r = !1, unmount: l = !0, ...o } = e, a = O(null), s = nn(e), i = Z(...s ? [a, t] : t === null ? [] : [t]);
|
|
1525
|
+
Le();
|
|
1526
|
+
let c = ze();
|
|
1527
|
+
if (n === void 0 && c !== null && (n = (c & z.Open) === z.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
1528
|
+
let [f, y] = S(n ? "visible" : "hidden"), b = rn(() => {
|
|
1570
1529
|
n || y("hidden");
|
|
1571
|
-
}), [w,
|
|
1572
|
-
|
|
1573
|
-
w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n),
|
|
1530
|
+
}), [w, d] = S(!0), v = O([n]);
|
|
1531
|
+
A(() => {
|
|
1532
|
+
w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n), d(!1));
|
|
1574
1533
|
}, [v, n]);
|
|
1575
1534
|
let u = C(() => ({ show: n, appear: r, initial: w }), [n, r, w]);
|
|
1576
|
-
|
|
1577
|
-
n ? y("visible") : !Ze(b) &&
|
|
1535
|
+
A(() => {
|
|
1536
|
+
n ? y("visible") : !Ze(b) && a.current !== null && y("hidden");
|
|
1578
1537
|
}, [n, b]);
|
|
1579
|
-
let m = { unmount: l }, p =
|
|
1538
|
+
let m = { unmount: l }, p = L(() => {
|
|
1580
1539
|
var h;
|
|
1581
|
-
w &&
|
|
1582
|
-
}), g =
|
|
1540
|
+
w && d(!1), (h = e.beforeEnter) == null || h.call(e);
|
|
1541
|
+
}), g = L(() => {
|
|
1583
1542
|
var h;
|
|
1584
|
-
w &&
|
|
1543
|
+
w && d(!1), (h = e.beforeLeave) == null || h.call(e);
|
|
1585
1544
|
}), x = W();
|
|
1586
|
-
return E.createElement(Ke.Provider, { value: b }, E.createElement(Ge.Provider, { value: u }, x({ ourProps: { ...m, as: G, children: E.createElement(
|
|
1545
|
+
return E.createElement(Ke.Provider, { value: b }, E.createElement(Ge.Provider, { value: u }, x({ ourProps: { ...m, as: G, children: E.createElement(an, { ref: i, ...m, ...o, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: on, visible: f === "visible", name: "Transition" })));
|
|
1587
1546
|
}
|
|
1588
1547
|
function tl(e, t) {
|
|
1589
1548
|
let n = R(Ge) !== null, r = ze() !== null;
|
|
1590
|
-
return E.createElement(E.Fragment, null, !n && r ? E.createElement(ut, { ref: t, ...e }) : E.createElement(
|
|
1549
|
+
return E.createElement(E.Fragment, null, !n && r ? E.createElement(ut, { ref: t, ...e }) : E.createElement(an, { ref: t, ...e }));
|
|
1591
1550
|
}
|
|
1592
|
-
let ut = D(el),
|
|
1551
|
+
let ut = D(el), an = D(Qr), me = D(tl), sn = Object.assign(ut, { Child: me, Root: ut });
|
|
1593
1552
|
var nl = ((e) => (e[e.Open = 0] = "Open", e[e.Closed = 1] = "Closed", e))(nl || {}), rl = ((e) => (e[e.SetTitleId = 0] = "SetTitleId", e))(rl || {});
|
|
1594
1553
|
let ll = { 0(e, t) {
|
|
1595
1554
|
return e.titleId === t.id ? e : { ...e, titleId: t.id };
|
|
@@ -1607,65 +1566,65 @@ function il(e, t) {
|
|
|
1607
1566
|
return ne(t.type, ll, e, t);
|
|
1608
1567
|
}
|
|
1609
1568
|
let Lt = D(function(e, t) {
|
|
1610
|
-
let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose:
|
|
1569
|
+
let n = Pe(), { id: r = `headlessui-dialog-${n}`, open: l, onClose: o, initialFocus: a, role: s = "dialog", autoFocus: i = !0, __demoMode: c = !1, unmount: f = !1, ...y } = e, b = O(!1);
|
|
1611
1570
|
s = function() {
|
|
1612
1571
|
return s === "dialog" || s === "alertdialog" ? s : (b.current || (b.current = !0, console.warn(`Invalid role [${s}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)), "dialog");
|
|
1613
1572
|
}();
|
|
1614
1573
|
let w = ze();
|
|
1615
1574
|
l === void 0 && w !== null && (l = (w & z.Open) === z.Open);
|
|
1616
|
-
let
|
|
1575
|
+
let d = O(null), v = Z(d, t), u = Me(d), m = l ? 0 : 1, [p, g] = wn(il, { titleId: null, descriptionId: null, panelRef: yn() }), x = L(() => o(!1)), h = L((k) => g({ type: 0, id: k })), $ = Le() ? m === 0 : !1, [F, j] = Ir(), _ = { get current() {
|
|
1617
1576
|
var k;
|
|
1618
|
-
return (k = p.panelRef.current) != null ? k :
|
|
1619
|
-
} },
|
|
1620
|
-
Jn(
|
|
1577
|
+
return (k = p.panelRef.current) != null ? k : d.current;
|
|
1578
|
+
} }, N = Qt(), { resolveContainers: U } = Hr({ mainTreeNode: N, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
|
|
1579
|
+
Jn(c || B ? !1 : $, { allowed: L(() => {
|
|
1621
1580
|
var k, ke;
|
|
1622
|
-
return [(ke = (k =
|
|
1623
|
-
}), disallowed:
|
|
1581
|
+
return [(ke = (k = d.current) == null ? void 0 : k.closest("[data-headlessui-portal]")) != null ? ke : null];
|
|
1582
|
+
}), disallowed: L(() => {
|
|
1624
1583
|
var k;
|
|
1625
|
-
return [(k =
|
|
1626
|
-
}) }),
|
|
1584
|
+
return [(k = N == null ? void 0 : N.closest("body > *:not(#headlessui-portal-root)")) != null ? k : null];
|
|
1585
|
+
}) }), dr($, U, (k) => {
|
|
1627
1586
|
k.preventDefault(), x();
|
|
1628
1587
|
}), jr($, u == null ? void 0 : u.defaultView, (k) => {
|
|
1629
1588
|
k.preventDefault(), k.stopPropagation(), document.activeElement && "blur" in document.activeElement && typeof document.activeElement.blur == "function" && document.activeElement.blur(), x();
|
|
1630
|
-
}), gr(
|
|
1631
|
-
let [X, P] = Bn(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]),
|
|
1632
|
-
$ && !
|
|
1589
|
+
}), gr(c || B ? !1 : $, u, U), Qn($, d, x);
|
|
1590
|
+
let [X, P] = Bn(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]), Se = C(() => ({ open: m === 0 }), [m]), Fe = { ref: v, id: r, role: s, tabIndex: -1, "aria-modal": c ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, pe = !Ur(), K = ie.None;
|
|
1591
|
+
$ && !c && (K |= ie.RestoreFocus, K |= ie.TabLock, i && (K |= ie.AutoFocus), pe && (K |= ie.InitialFocus));
|
|
1633
1592
|
let Ce = W();
|
|
1634
|
-
return E.createElement(Pr, null, E.createElement(
|
|
1635
|
-
}),
|
|
1593
|
+
return E.createElement(Pr, null, E.createElement(Pt, { force: !0 }, E.createElement(Dr, null, E.createElement(wt.Provider, { value: V }, E.createElement(Zt, { target: d }, E.createElement(Pt, { force: !1 }, E.createElement(P, { slot: Se }, E.createElement(j, null, E.createElement(Vr, { initialFocus: a, initialFocusFallback: d, containers: U, features: K }, E.createElement(Gn, { value: x }, Ce({ ourProps: Fe, theirProps: y, slot: Se, defaultTag: ol, features: al, visible: m === 0, name: "Dialog" })))))))))));
|
|
1594
|
+
}), ol = "div", al = Ue.RenderStrategy | Ue.Static;
|
|
1636
1595
|
function sl(e, t) {
|
|
1637
|
-
let { transition: n = !1, open: r, ...l } = e,
|
|
1638
|
-
if (!
|
|
1639
|
-
if (!
|
|
1596
|
+
let { transition: n = !1, open: r, ...l } = e, o = ze(), a = e.hasOwnProperty("open") || o !== null, s = e.hasOwnProperty("onClose");
|
|
1597
|
+
if (!a && !s) throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");
|
|
1598
|
+
if (!a) throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");
|
|
1640
1599
|
if (!s) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
|
|
1641
|
-
if (!
|
|
1600
|
+
if (!o && typeof e.open != "boolean") throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);
|
|
1642
1601
|
if (typeof e.onClose != "function") throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);
|
|
1643
|
-
return (r !== void 0 || n) && !l.static ? E.createElement(
|
|
1602
|
+
return (r !== void 0 || n) && !l.static ? E.createElement(Mt, null, E.createElement(sn, { show: r, transition: n, unmount: l.unmount }, E.createElement(Lt, { ref: t, ...l }))) : E.createElement(Mt, null, E.createElement(Lt, { ref: t, open: r, ...l }));
|
|
1644
1603
|
}
|
|
1645
1604
|
let ul = "div";
|
|
1646
|
-
function
|
|
1647
|
-
let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...
|
|
1605
|
+
function cl(e, t) {
|
|
1606
|
+
let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...o } = e, [{ dialogState: a, unmount: s }, i] = Je("Dialog.Panel"), c = Z(t, i.panelRef), f = C(() => ({ open: a === 0 }), [a]), y = L((u) => {
|
|
1648
1607
|
u.stopPropagation();
|
|
1649
|
-
}), b = { ref:
|
|
1650
|
-
return E.createElement(w, { ...
|
|
1608
|
+
}), b = { ref: c, id: r, onClick: y }, w = l ? me : G, d = l ? { unmount: s } : {}, v = W();
|
|
1609
|
+
return E.createElement(w, { ...d }, v({ ourProps: b, theirProps: o, slot: f, defaultTag: ul, name: "Dialog.Panel" }));
|
|
1651
1610
|
}
|
|
1652
|
-
let
|
|
1611
|
+
let dl = "div";
|
|
1653
1612
|
function fl(e, t) {
|
|
1654
|
-
let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount:
|
|
1655
|
-
return E.createElement(i, { ...
|
|
1613
|
+
let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: o }] = Je("Dialog.Backdrop"), a = C(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ? me : G, c = n ? { unmount: o } : {}, f = W();
|
|
1614
|
+
return E.createElement(i, { ...c }, f({ ourProps: s, theirProps: r, slot: a, defaultTag: dl, name: "Dialog.Backdrop" }));
|
|
1656
1615
|
}
|
|
1657
1616
|
let ml = "h2";
|
|
1658
1617
|
function pl(e, t) {
|
|
1659
|
-
let n = Pe(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState:
|
|
1660
|
-
M(() => (
|
|
1661
|
-
let i = C(() => ({ open:
|
|
1662
|
-
return W()({ ourProps:
|
|
1618
|
+
let n = Pe(), { id: r = `headlessui-dialog-title-${n}`, ...l } = e, [{ dialogState: o, setTitleId: a }] = Je("Dialog.Title"), s = Z(t);
|
|
1619
|
+
M(() => (a(r), () => a(null)), [r, a]);
|
|
1620
|
+
let i = C(() => ({ open: o === 0 }), [o]), c = { ref: s, id: r };
|
|
1621
|
+
return W()({ ourProps: c, theirProps: l, slot: i, defaultTag: ml, name: "Dialog.Title" });
|
|
1663
1622
|
}
|
|
1664
|
-
let hl = D(sl), yt = D(
|
|
1623
|
+
let hl = D(sl), yt = D(cl);
|
|
1665
1624
|
D(fl);
|
|
1666
1625
|
let vl = D(pl), gl = Object.assign(hl, { Panel: yt, Title: vl, Description: Yn });
|
|
1667
|
-
function
|
|
1668
|
-
return /* @__PURE__ */
|
|
1626
|
+
function un({ onClick: e }) {
|
|
1627
|
+
return /* @__PURE__ */ se(
|
|
1669
1628
|
"button",
|
|
1670
1629
|
{
|
|
1671
1630
|
type: "button",
|
|
@@ -1698,7 +1657,7 @@ function dn({ onClick: e }) {
|
|
|
1698
1657
|
);
|
|
1699
1658
|
}
|
|
1700
1659
|
const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
1701
|
-
const [r, l] =
|
|
1660
|
+
const [r, l] = S(!1);
|
|
1702
1661
|
return /* @__PURE__ */ T("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ T(
|
|
1703
1662
|
"div",
|
|
1704
1663
|
{
|
|
@@ -1708,7 +1667,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1708
1667
|
"items-end": t.position === "bottom"
|
|
1709
1668
|
}),
|
|
1710
1669
|
children: /* @__PURE__ */ T(
|
|
1711
|
-
|
|
1670
|
+
me,
|
|
1712
1671
|
{
|
|
1713
1672
|
as: "div",
|
|
1714
1673
|
enterFrom: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
@@ -1729,13 +1688,13 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1729
1688
|
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
|
|
1730
1689
|
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
|
|
1731
1690
|
}),
|
|
1732
|
-
children: /* @__PURE__ */
|
|
1691
|
+
children: /* @__PURE__ */ se(
|
|
1733
1692
|
yt,
|
|
1734
1693
|
{
|
|
1735
1694
|
className: `im-modal-content relative ${t.paddingClasses} ${t.panelClasses}`,
|
|
1736
1695
|
"data-inertiaui-modal-entered": r,
|
|
1737
1696
|
children: [
|
|
1738
|
-
t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(
|
|
1697
|
+
t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(un, { onClick: e.close }) }),
|
|
1739
1698
|
typeof n == "function" ? n({ modalContext: e, config: t }) : n
|
|
1740
1699
|
]
|
|
1741
1700
|
}
|
|
@@ -1745,7 +1704,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1745
1704
|
}
|
|
1746
1705
|
) });
|
|
1747
1706
|
}, yl = ({ modalContext: e, config: t, children: n }) => {
|
|
1748
|
-
const [r, l] =
|
|
1707
|
+
const [r, l] = S(!1);
|
|
1749
1708
|
return /* @__PURE__ */ T("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ T(
|
|
1750
1709
|
"div",
|
|
1751
1710
|
{
|
|
@@ -1754,7 +1713,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1754
1713
|
"justify-end rtl:justify-start": (t == null ? void 0 : t.position) === "right"
|
|
1755
1714
|
}),
|
|
1756
1715
|
children: /* @__PURE__ */ T(
|
|
1757
|
-
|
|
1716
|
+
me,
|
|
1758
1717
|
{
|
|
1759
1718
|
as: "div",
|
|
1760
1719
|
enterFrom: `opacity-0 ${t.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
|
|
@@ -1775,13 +1734,13 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1775
1734
|
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": t.maxWidth === "6xl",
|
|
1776
1735
|
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": t.maxWidth === "7xl"
|
|
1777
1736
|
}),
|
|
1778
|
-
children: /* @__PURE__ */
|
|
1737
|
+
children: /* @__PURE__ */ se(
|
|
1779
1738
|
yt,
|
|
1780
1739
|
{
|
|
1781
1740
|
className: `im-slideover-content relative ${t.paddingClasses} ${t.panelClasses}`,
|
|
1782
1741
|
"data-inertiaui-modal-entered": r,
|
|
1783
1742
|
children: [
|
|
1784
|
-
t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(
|
|
1743
|
+
t.closeButton && /* @__PURE__ */ T("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ T(un, { onClick: e.close }) }),
|
|
1785
1744
|
typeof n == "function" ? n({ modalContext: e, config: t }) : n
|
|
1786
1745
|
]
|
|
1787
1746
|
}
|
|
@@ -1790,23 +1749,23 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1790
1749
|
)
|
|
1791
1750
|
}
|
|
1792
1751
|
) });
|
|
1793
|
-
}, xl =
|
|
1794
|
-
const
|
|
1795
|
-
return
|
|
1796
|
-
|
|
1752
|
+
}, xl = ct(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: o = null, onAfterLeave: a = null, ...s }, i) => {
|
|
1753
|
+
const c = (y) => typeof t == "function" ? t(y) : t, f = O(null);
|
|
1754
|
+
return St(i, () => f.current, [f]), /* @__PURE__ */ T(
|
|
1755
|
+
It,
|
|
1797
1756
|
{
|
|
1798
1757
|
ref: f,
|
|
1799
1758
|
name: e,
|
|
1800
1759
|
onFocus: n,
|
|
1801
1760
|
onBlur: r,
|
|
1802
1761
|
onClose: l,
|
|
1803
|
-
onSuccess:
|
|
1762
|
+
onSuccess: o,
|
|
1804
1763
|
...s,
|
|
1805
1764
|
children: ({
|
|
1806
1765
|
afterLeave: y,
|
|
1807
1766
|
close: b,
|
|
1808
1767
|
config: w,
|
|
1809
|
-
emit:
|
|
1768
|
+
emit: d,
|
|
1810
1769
|
getChildModal: v,
|
|
1811
1770
|
getParentModal: u,
|
|
1812
1771
|
id: m,
|
|
@@ -1818,12 +1777,12 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1818
1777
|
setOpen: F,
|
|
1819
1778
|
shouldRender: j
|
|
1820
1779
|
}) => /* @__PURE__ */ T(
|
|
1821
|
-
|
|
1780
|
+
sn,
|
|
1822
1781
|
{
|
|
1823
1782
|
appear: !0,
|
|
1824
1783
|
show: g ?? !1,
|
|
1825
|
-
afterLeave:
|
|
1826
|
-
children: /* @__PURE__ */
|
|
1784
|
+
afterLeave: a,
|
|
1785
|
+
children: /* @__PURE__ */ se(
|
|
1827
1786
|
gl,
|
|
1828
1787
|
{
|
|
1829
1788
|
as: "div",
|
|
@@ -1833,7 +1792,7 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1833
1792
|
"data-inertiaui-modal-index": p,
|
|
1834
1793
|
children: [
|
|
1835
1794
|
p === 0 ? /* @__PURE__ */ T(
|
|
1836
|
-
|
|
1795
|
+
me,
|
|
1837
1796
|
{
|
|
1838
1797
|
enter: "transition transform ease-in-out duration-300",
|
|
1839
1798
|
enterFrom: "opacity-0",
|
|
@@ -1856,11 +1815,11 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1856
1815
|
{
|
|
1857
1816
|
modalContext: x,
|
|
1858
1817
|
config: w,
|
|
1859
|
-
children:
|
|
1818
|
+
children: c({
|
|
1860
1819
|
afterLeave: y,
|
|
1861
1820
|
close: b,
|
|
1862
1821
|
config: w,
|
|
1863
|
-
emit:
|
|
1822
|
+
emit: d,
|
|
1864
1823
|
getChildModal: v,
|
|
1865
1824
|
getParentModal: u,
|
|
1866
1825
|
id: m,
|
|
@@ -1878,11 +1837,11 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1878
1837
|
{
|
|
1879
1838
|
modalContext: x,
|
|
1880
1839
|
config: w,
|
|
1881
|
-
children:
|
|
1840
|
+
children: c({
|
|
1882
1841
|
afterLeave: y,
|
|
1883
1842
|
close: b,
|
|
1884
1843
|
config: w,
|
|
1885
|
-
emit:
|
|
1844
|
+
emit: d,
|
|
1886
1845
|
getChildModal: v,
|
|
1887
1846
|
getParentModal: u,
|
|
1888
1847
|
id: m,
|
|
@@ -1905,55 +1864,55 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1905
1864
|
);
|
|
1906
1865
|
});
|
|
1907
1866
|
xl.displayName = "Modal";
|
|
1908
|
-
const
|
|
1867
|
+
const Nl = ({
|
|
1909
1868
|
href: e,
|
|
1910
1869
|
method: t = "get",
|
|
1911
1870
|
data: n = {},
|
|
1912
1871
|
as: r = "a",
|
|
1913
1872
|
headers: l = {},
|
|
1914
|
-
queryStringArrayFormat:
|
|
1915
|
-
onAfterLeave:
|
|
1873
|
+
queryStringArrayFormat: o = "brackets",
|
|
1874
|
+
onAfterLeave: a = null,
|
|
1916
1875
|
onBlur: s = null,
|
|
1917
1876
|
onClose: i = null,
|
|
1918
|
-
onError:
|
|
1877
|
+
onError: c = null,
|
|
1919
1878
|
onFocus: f = null,
|
|
1920
1879
|
onStart: y = null,
|
|
1921
1880
|
onSuccess: b = null,
|
|
1922
1881
|
navigate: w = null,
|
|
1923
|
-
children:
|
|
1882
|
+
children: d,
|
|
1924
1883
|
...v
|
|
1925
1884
|
}) => {
|
|
1926
|
-
const [u, m] =
|
|
1885
|
+
const [u, m] = S(!1), [p, g] = S(null), { stack: x, visit: h } = Xe(), $ = C(() => w ?? ft("navigate"), [w]), F = {}, j = {};
|
|
1927
1886
|
Object.keys(v).forEach((P) => {
|
|
1928
|
-
|
|
1887
|
+
xt.includes(P) || (P.startsWith("on") && typeof v[P] == "function" ? P.toLowerCase() in window ? F[P] = v[P] : j[P] = v[P] : F[P] = v[P]);
|
|
1929
1888
|
});
|
|
1930
|
-
const [_,
|
|
1889
|
+
const [_, N] = S(!1);
|
|
1931
1890
|
M(() => {
|
|
1932
|
-
p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (s == null || s()),
|
|
1891
|
+
p && (p.onTopOfStack && _ ? f == null || f() : !p.onTopOfStack && !_ && (s == null || s()), N(!p.onTopOfStack));
|
|
1933
1892
|
}, [x]);
|
|
1934
1893
|
const U = Y(() => {
|
|
1935
1894
|
i == null || i();
|
|
1936
1895
|
}, [i]), B = Y(() => {
|
|
1937
|
-
g(null),
|
|
1938
|
-
}, [
|
|
1896
|
+
g(null), a == null || a();
|
|
1897
|
+
}, [a]), X = Y(
|
|
1939
1898
|
(P) => {
|
|
1940
1899
|
P == null || P.preventDefault(), !u && (e.startsWith("#") || (m(!0), y == null || y()), h(
|
|
1941
1900
|
e,
|
|
1942
1901
|
t,
|
|
1943
1902
|
n,
|
|
1944
1903
|
l,
|
|
1945
|
-
Pn(
|
|
1904
|
+
Pn(Ft(v, xt)),
|
|
1946
1905
|
() => U(x.length),
|
|
1947
1906
|
B,
|
|
1948
|
-
|
|
1907
|
+
o,
|
|
1949
1908
|
$
|
|
1950
1909
|
).then((V) => {
|
|
1951
1910
|
g(V), V.registerEventListenersFromProps(j), b == null || b();
|
|
1952
1911
|
}).catch((V) => {
|
|
1953
|
-
console.error(V),
|
|
1912
|
+
console.error(V), c == null || c(V);
|
|
1954
1913
|
}).finally(() => m(!1)));
|
|
1955
1914
|
},
|
|
1956
|
-
[e, t, n, l,
|
|
1915
|
+
[e, t, n, l, o, v, U, B]
|
|
1957
1916
|
);
|
|
1958
1917
|
return /* @__PURE__ */ T(
|
|
1959
1918
|
r,
|
|
@@ -1961,27 +1920,27 @@ const Al = ({
|
|
|
1961
1920
|
...F,
|
|
1962
1921
|
href: e,
|
|
1963
1922
|
onClick: X,
|
|
1964
|
-
children: typeof
|
|
1923
|
+
children: typeof d == "function" ? d({ loading: u }) : d
|
|
1965
1924
|
}
|
|
1966
1925
|
);
|
|
1967
1926
|
};
|
|
1968
|
-
function
|
|
1927
|
+
function Al() {
|
|
1969
1928
|
return Xe().stack[Nt()] ?? null;
|
|
1970
1929
|
}
|
|
1971
1930
|
const Il = (e) => (t) => (t.default.layout = (n) => Re(e, {}, n), t);
|
|
1972
1931
|
export {
|
|
1973
|
-
|
|
1932
|
+
It as HeadlessModal,
|
|
1974
1933
|
xl as Modal,
|
|
1975
|
-
|
|
1934
|
+
Nl as ModalLink,
|
|
1976
1935
|
Fn as ModalRoot,
|
|
1977
|
-
|
|
1936
|
+
Ln as ModalStackProvider,
|
|
1978
1937
|
ft as getConfig,
|
|
1979
|
-
|
|
1980
|
-
|
|
1938
|
+
Sn as initFromPageProps,
|
|
1939
|
+
Sl as putConfig,
|
|
1981
1940
|
Fl as renderApp,
|
|
1982
|
-
|
|
1941
|
+
Ll as resetConfig,
|
|
1983
1942
|
Il as setPageLayout,
|
|
1984
|
-
|
|
1943
|
+
Al as useModal,
|
|
1985
1944
|
Nt as useModalIndex,
|
|
1986
1945
|
Xe as useModalStack
|
|
1987
1946
|
};
|