@inertiaui/modal-react 0.19.2 → 0.19.3
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 +294 -335
- 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, useState as
|
|
6
|
-
import { jsx as T, jsxs as
|
|
5
|
+
import E, { createContext as H, useState as S, useEffect as M, useContext as R, useRef as O, createElement as Re, useMemo as C, forwardRef as dt, 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 { jsx as T, jsxs as se, Fragment as ct } 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,20 +28,20 @@ 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
|
}
|
|
@@ -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), de = (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) {
|
|
@@ -94,14 +94,14 @@ function Mn(e, t = 3, n = 10) {
|
|
|
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 = [], ce = {};
|
|
103
|
+
const Ln = ({ children: e }) => {
|
|
104
|
+
const [t, n] = S([]), [r, l] = S({}), a = (v) => {
|
|
105
105
|
n((u) => {
|
|
106
106
|
const m = v([...u]), p = (g) => {
|
|
107
107
|
var x;
|
|
@@ -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,
|
|
@@ -183,17 +183,17 @@ const Sn = ({ children: e }) => {
|
|
|
183
183
|
q(this, "updateProps", (u) => {
|
|
184
184
|
Object.assign(this.props, u), a((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, ce[this.id]) {
|
|
187
187
|
this.config = {
|
|
188
188
|
...this.config,
|
|
189
|
-
...
|
|
189
|
+
...ce[this.id].config ?? {}
|
|
190
190
|
};
|
|
191
|
-
const h =
|
|
191
|
+
const h = ce[this.id].onClose, $ = ce[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 ce[this.id];
|
|
197
197
|
}
|
|
198
198
|
this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
|
|
199
199
|
}
|
|
@@ -201,7 +201,7 @@ 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) =>
|
|
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
205
|
const x = new o(v, u, m, p, g);
|
|
206
206
|
return x.index = t.length, a((h) => [...h, x]), x.show(), x;
|
|
207
207
|
};
|
|
@@ -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
|
_(d(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, ce[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,7 +267,7 @@ 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
|
}, c = {
|
|
@@ -301,9 +301,9 @@ const Sn = ({ children: e }) => {
|
|
|
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: a }) => /* @__PURE__ */ se(ct, { children: [
|
|
307
307
|
(() => {
|
|
308
308
|
const s = Re(r, { key: a, ...l });
|
|
309
309
|
return typeof r.layout == "function" ? r.layout(s) : Array.isArray(r.layout) ? r.layout.concat(s).reverse().reduce((d, f) => Re(f, l, d)) : s;
|
|
@@ -313,49 +313,8 @@ const Sn = ({ children: e }) => {
|
|
|
313
313
|
var s;
|
|
314
314
|
const t = R(Be);
|
|
315
315
|
let n = !1, r = !1;
|
|
316
|
-
M(
|
|
317
|
-
() =>
|
|
318
|
-
if (!xt(window.location.href, i.detail.visit.url) || i.detail.visit.replace || t.length() !== 1 || !r)
|
|
319
|
-
return !0;
|
|
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) {
|
|
316
|
+
M(() => xe.on("start", () => n = !0), []), M(() => xe.on("finish", () => n = !1), []), M(
|
|
317
|
+
() => xe.on("navigate", function(i) {
|
|
359
318
|
const d = i.detail.page.props._inertiaui_modal;
|
|
360
319
|
if (!d) {
|
|
361
320
|
r && t.closeAll();
|
|
@@ -366,7 +325,7 @@ const Sn = ({ children: e }) => {
|
|
|
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 !== d.baseUrl &&
|
|
328
|
+
!n && window.location.href !== d.baseUrl && xe.visit(d.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 a =
|
|
340
|
+
const a = xn(), o = O();
|
|
382
341
|
return M(() => {
|
|
383
342
|
var f, y;
|
|
384
343
|
const i = (f = a.props) == null ? void 0 : f._inertiaui_modal, d = o.current;
|
|
385
|
-
o.current = i, i && d && i.component === d.component &&
|
|
386
|
-
}, [(s = a.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */
|
|
344
|
+
o.current = i, i && d && i.component === d.component && Tn(i.url, d.url) && ((y = t.stack[0]) == null || y.updateProps(i.props ?? {}));
|
|
345
|
+
}, [(s = a.props) == null ? void 0 : s._inertiaui_modal]), /* @__PURE__ */ se(ct, { 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,19 +362,19 @@ const Nt = () => {
|
|
|
403
362
|
onModalEvent: (...r) => n.emit(...r)
|
|
404
363
|
}
|
|
405
364
|
) });
|
|
406
|
-
},
|
|
407
|
-
const i = Nt(), { stack: d, registerLocalModal: f, removeLocalModal: y } = Xe(), [b, w] =
|
|
365
|
+
}, It = dt(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: a = null, ...o }, s) => {
|
|
366
|
+
const i = Nt(), { stack: d, registerLocalModal: f, removeLocalModal: y } = Xe(), [b, w] = S(null), c = C(() => e ? b : d[i], [e, b, i, d]), v = C(() => {
|
|
408
367
|
var h;
|
|
409
368
|
return (h = d.find(($) => $.shouldRender && $.index > (c == null ? void 0 : c.index))) == null ? void 0 : h.index;
|
|
410
369
|
}, [i, d]), u = C(() => (c == null ? void 0 : c.config.slideover) ?? o.slideover ?? ft("type") === "slideover", [o.slideover]), m = C(
|
|
411
370
|
() => ({
|
|
412
371
|
slideover: u,
|
|
413
|
-
closeButton: o.closeButton ??
|
|
414
|
-
closeExplicitly: o.closeExplicitly ??
|
|
415
|
-
maxWidth: o.maxWidth ??
|
|
416
|
-
paddingClasses: o.paddingClasses ??
|
|
417
|
-
panelClasses: o.panelClasses ??
|
|
418
|
-
position: o.position ??
|
|
372
|
+
closeButton: o.closeButton ?? de(u, "closeButton"),
|
|
373
|
+
closeExplicitly: o.closeExplicitly ?? de(u, "closeExplicitly"),
|
|
374
|
+
maxWidth: o.maxWidth ?? de(u, "maxWidth"),
|
|
375
|
+
paddingClasses: o.paddingClasses ?? de(u, "paddingClasses"),
|
|
376
|
+
panelClasses: o.panelClasses ?? de(u, "panelClasses"),
|
|
377
|
+
position: o.position ?? de(u, "position"),
|
|
419
378
|
...c == null ? void 0 : c.config
|
|
420
379
|
}),
|
|
421
380
|
[o, c == null ? void 0 : c.config]
|
|
@@ -437,10 +396,10 @@ const Nt = () => {
|
|
|
437
396
|
}, [c]), M(() => {
|
|
438
397
|
c !== null && (c.isOpen ? a == null || a() : l == null || l());
|
|
439
398
|
}, [c == null ? void 0 : c.isOpen]);
|
|
440
|
-
const [g, x] =
|
|
399
|
+
const [g, x] = S(!1);
|
|
441
400
|
return M(() => {
|
|
442
401
|
g && c !== null && c.isOpen && (c.onTopOfStack ? n == null || n() : r == null || r()), x(!0);
|
|
443
|
-
}, [c == null ? void 0 : c.onTopOfStack]),
|
|
402
|
+
}, [c == null ? void 0 : c.onTopOfStack]), St(
|
|
444
403
|
s,
|
|
445
404
|
() => ({
|
|
446
405
|
afterLeave: () => {
|
|
@@ -500,7 +459,7 @@ const Nt = () => {
|
|
|
500
459
|
}
|
|
501
460
|
}),
|
|
502
461
|
[c]
|
|
503
|
-
), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */
|
|
462
|
+
), (c == null ? void 0 : c.shouldRender) && /* @__PURE__ */ se(ct, { children: [
|
|
504
463
|
typeof t == "function" ? t({
|
|
505
464
|
afterLeave: c.afterLeave,
|
|
506
465
|
close: c.close,
|
|
@@ -517,25 +476,25 @@ const Nt = () => {
|
|
|
517
476
|
setOpen: c.setOpen,
|
|
518
477
|
shouldRender: c.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
|
+
}, oe = new Nn();
|
|
567
526
|
function Ve(e) {
|
|
568
|
-
return
|
|
527
|
+
return oe.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(() => {
|
|
@@ -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
|
+
oe.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(" ");
|
|
@@ -646,24 +605,24 @@ function W() {
|
|
|
646
605
|
}
|
|
647
606
|
function Rn({ ourProps: e, theirProps: t, slot: n, defaultTag: r, features: l, visible: a = !0, name: o, mergeRefs: s }) {
|
|
648
607
|
s = s ?? jn;
|
|
649
|
-
let i =
|
|
650
|
-
if (a) return
|
|
608
|
+
let i = Dt(t, e);
|
|
609
|
+
if (a) return Ae(i, n, r, o, s);
|
|
651
610
|
let d = l ?? 0;
|
|
652
611
|
if (d & 2) {
|
|
653
612
|
let { static: f = !1, ...y } = i;
|
|
654
|
-
if (f) return
|
|
613
|
+
if (f) return Ae(y, n, r, o, s);
|
|
655
614
|
}
|
|
656
615
|
if (d & 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, o, s);
|
|
662
621
|
} });
|
|
663
622
|
}
|
|
664
|
-
return
|
|
623
|
+
return Ae(i, n, r, o, s);
|
|
665
624
|
}
|
|
666
|
-
function
|
|
625
|
+
function Ae(e, t = {}, n, r, l) {
|
|
667
626
|
let { as: a = n, children: o, refName: s = "ref", ...i } = nt(e, ["unmount", "static"]), d = e.ref !== void 0 ? { [s]: e.ref } : {}, f = typeof o == "function" ? o(t) : o;
|
|
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 = {};
|
|
@@ -675,15 +634,15 @@ function Ne(e, t = {}, n, r, l) {
|
|
|
675
634
|
for (let c of w) y[`data-${c}`] = "";
|
|
676
635
|
}
|
|
677
636
|
}
|
|
678
|
-
if (a === G && (Object.keys(
|
|
679
|
-
if (Object.keys(
|
|
637
|
+
if (a === 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, c = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = c ? { className: c } : {}, u =
|
|
643
|
+
let b = f.props, w = b == null ? void 0 : b.className, c = typeof w == "function" ? (...m) => lt(w(...m), i.className) : lt(w, i.className), v = c ? { className: c } : {}, 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, d, { ref: l(Un(f), d.ref) }, v));
|
|
687
646
|
}
|
|
688
647
|
return Re(a, Object.assign({}, nt(i, ["ref"]), a !== G && d, a !== G && y), f);
|
|
689
648
|
}
|
|
@@ -700,7 +659,7 @@ 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 = {};
|
|
@@ -722,7 +681,7 @@ function D(e) {
|
|
|
722
681
|
var t;
|
|
723
682
|
return Object.assign(dt(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;
|
|
@@ -742,34 +701,34 @@ function Wn(e, t) {
|
|
|
742
701
|
let { features: r = 1, ...l } = e, a = { 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" } } };
|
|
743
702
|
return W()({ ourProps: a, 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 =
|
|
731
|
+
let r = L((a) => (t((o) => [...o, a]), () => t((o) => {
|
|
773
732
|
let s = o.slice(), i = s.indexOf(a);
|
|
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]);
|
|
@@ -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}`, ...a } = e, o =
|
|
782
|
-
|
|
740
|
+
let n = Pe(), r = In(), { id: l = `headlessui-description-${n}`, ...a } = e, o = Ut(), s = Z(t);
|
|
741
|
+
A(() => o.register(l), [l, o.register]);
|
|
783
742
|
let i = r || !1, d = C(() => ({ ...o.slot, disabled: i }), [o.slot, i]), f = { ref: s, ...o.props, id: l };
|
|
784
743
|
return W()({ ourProps: f, theirProps: a, slot: d, defaultTag: Xn, name: o.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,7 +758,7 @@ 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;
|
|
@@ -810,10 +769,10 @@ function _t(e, t) {
|
|
|
810
769
|
o && (n = o, 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,21 +780,21 @@ 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
788
|
let a = l.indexOf(r), o = l.length;
|
|
830
789
|
return a === -1 && (a = o, o += 1), a === o - 1;
|
|
831
790
|
}
|
|
832
791
|
let at = /* @__PURE__ */ new Map(), Te = /* @__PURE__ */ new Map();
|
|
833
|
-
function
|
|
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) : (at.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;
|
|
@@ -843,12 +802,12 @@ function $t(e) {
|
|
|
843
802
|
r && (r["aria-hidden"] === null ? e.removeAttribute("aria-hidden") : e.setAttribute("aria-hidden", r["aria-hidden"]), e.inert = r.inert, at.delete(e));
|
|
844
803
|
}
|
|
845
804
|
function Jn(e, { allowed: t, disallowed: n } = {}) {
|
|
846
|
-
let r =
|
|
847
|
-
|
|
805
|
+
let r = fe(e, "inert-others");
|
|
806
|
+
A(() => {
|
|
848
807
|
var l, a;
|
|
849
808
|
if (!r) return;
|
|
850
809
|
let o = re();
|
|
851
|
-
for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && o.add(
|
|
810
|
+
for (let i of (l = n == null ? void 0 : n()) != null ? l : []) i && o.add(bt(i));
|
|
852
811
|
let s = (a = t == null ? void 0 : t()) != null ? a : [];
|
|
853
812
|
for (let i of s) {
|
|
854
813
|
if (!i) continue;
|
|
@@ -856,7 +815,7 @@ function Jn(e, { allowed: t, disallowed: n } = {}) {
|
|
|
856
815
|
if (!d) continue;
|
|
857
816
|
let f = i.parentElement;
|
|
858
817
|
for (; f && f !== d.body; ) {
|
|
859
|
-
for (let y of f.children) s.some((b) => y.contains(b)) || o.add(
|
|
818
|
+
for (let y of f.children) s.some((b) => y.contains(b)) || o.add(bt(y));
|
|
860
819
|
f = f.parentElement;
|
|
861
820
|
}
|
|
862
821
|
}
|
|
@@ -864,7 +823,7 @@ function Jn(e, { allowed: t, disallowed: n } = {}) {
|
|
|
864
823
|
}, [r, t, n]);
|
|
865
824
|
}
|
|
866
825
|
function Qn(e, t, n) {
|
|
867
|
-
let r =
|
|
826
|
+
let r = ue((l) => {
|
|
868
827
|
let a = l.getBoundingClientRect();
|
|
869
828
|
a.x === 0 && a.y === 0 && a.width === 0 && a.height === 0 && n();
|
|
870
829
|
});
|
|
@@ -892,7 +851,7 @@ function nr(e = document.body) {
|
|
|
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() {
|
|
@@ -954,17 +913,17 @@ function Oe(e, t, { sorted: n = !0, relativeTo: r = null, skipElements: l = [] }
|
|
|
954
913
|
} while (b !== a.activeElement);
|
|
955
914
|
return t & 6 && or(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
922
|
function dr() {
|
|
964
|
-
return
|
|
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
929
|
function a(o) {
|
|
@@ -973,8 +932,8 @@ function xe(e, t, n, r) {
|
|
|
973
932
|
return document.addEventListener(t, a, r), () => document.removeEventListener(t, a, 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
939
|
function a(o) {
|
|
@@ -983,9 +942,9 @@ function qt(e, t, n, r) {
|
|
|
983
942
|
return window.addEventListener(t, a, r), () => window.removeEventListener(t, a, r);
|
|
984
943
|
}, [e, t, r]);
|
|
985
944
|
}
|
|
986
|
-
const
|
|
945
|
+
const $t = 30;
|
|
987
946
|
function cr(e, t, n) {
|
|
988
|
-
let r =
|
|
947
|
+
let r = fe(e, "outside-click"), l = ue(n), a = Y(function(i, d) {
|
|
989
948
|
if (i.defaultPrevented) return;
|
|
990
949
|
let f = d(i);
|
|
991
950
|
if (f === null || !f.getRootNode().contains(f) || !f.isConnected) return;
|
|
@@ -993,30 +952,30 @@ function cr(e, t, n) {
|
|
|
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,
|
|
955
|
+
return !lr(f, Bt.Loose) && f.tabIndex !== -1 && i.preventDefault(), l.current(i, f);
|
|
997
956
|
}, [l, t]), o = O(null);
|
|
998
|
-
|
|
957
|
+
ye(r, "pointerdown", (i) => {
|
|
999
958
|
var d, f;
|
|
1000
959
|
o.current = ((f = (d = i.composedPath) == null ? void 0 : d.call(i)) == null ? void 0 : f[0]) || i.target;
|
|
1001
|
-
}, !0),
|
|
960
|
+
}, !0), ye(r, "mousedown", (i) => {
|
|
1002
961
|
var d, f;
|
|
1003
962
|
o.current = ((f = (d = i.composedPath) == null ? void 0 : d.call(i)) == null ? void 0 : f[0]) || i.target;
|
|
1004
|
-
}, !0),
|
|
963
|
+
}, !0), ye(r, "click", (i) => {
|
|
1005
964
|
dr() || o.current && (a(i, () => o.current), o.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),
|
|
969
|
+
}, !0), ye(r, "touchend", (i) => {
|
|
1011
970
|
let d = { x: i.changedTouches[0].clientX, y: i.changedTouches[0].clientY };
|
|
1012
|
-
if (!(Math.abs(d.x - s.current.x) >=
|
|
1013
|
-
}, !0),
|
|
971
|
+
if (!(Math.abs(d.x - s.current.x) >= $t || Math.abs(d.y - s.current.y) >= $t)) return a(i, () => i.target instanceof HTMLElement ? i.target : null);
|
|
972
|
+
}, !0), Vt(r, "blur", (i) => a(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
981
|
function a(o) {
|
|
@@ -1037,7 +996,7 @@ function fr() {
|
|
|
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
1001
|
return n.containers.flatMap((a) => a()).some((a) => a.contains(l));
|
|
1043
1002
|
}
|
|
@@ -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
|
|
1051
|
+
let ae = 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;
|
|
@@ -1104,33 +1063,33 @@ let oe = _t(() => /* @__PURE__ */ new Map(), { PUSH(e, t) {
|
|
|
1104
1063
|
}, TEARDOWN({ doc: e }) {
|
|
1105
1064
|
this.delete(e);
|
|
1106
1065
|
} });
|
|
1107
|
-
|
|
1108
|
-
let e =
|
|
1066
|
+
ae.subscribe(() => {
|
|
1067
|
+
let e = ae.getSnapshot(), t = /* @__PURE__ */ new Map();
|
|
1109
1068
|
for (let [n] of e) t.set(n, n.documentElement.style.overflow);
|
|
1110
1069
|
for (let n of e.values()) {
|
|
1111
1070
|
let r = t.get(n.doc) === "hidden", l = n.count !== 0;
|
|
1112
|
-
(l && !r || !l && r) &&
|
|
1071
|
+
(l && !r || !l && r) && ae.dispatch(n.count > 0 ? "SCROLL_PREVENT" : "SCROLL_ALLOW", n), n.count === 0 && ae.dispatch("TEARDOWN", n);
|
|
1113
1072
|
}
|
|
1114
1073
|
});
|
|
1115
1074
|
function vr(e, t, n = () => ({ containers: [] })) {
|
|
1116
|
-
let r =
|
|
1117
|
-
return
|
|
1118
|
-
if (!(!t || !e)) return
|
|
1075
|
+
let r = _t(ae), l = t ? r.get(t) : void 0, a = l ? l.count > 0 : !1;
|
|
1076
|
+
return A(() => {
|
|
1077
|
+
if (!(!t || !e)) return ae.dispatch("PUSH", t, n), () => ae.dispatch("POP", t, n);
|
|
1119
1078
|
}, [e, t]), a;
|
|
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
1083
|
var a;
|
|
1125
1084
|
return { containers: [...(a = l.containers) != null ? a : [], n] };
|
|
1126
1085
|
});
|
|
1127
1086
|
}
|
|
1128
1087
|
function wr(e = 0) {
|
|
1129
|
-
let [t, n] =
|
|
1088
|
+
let [t, n] = S(e), r = Y((i) => n(i), [t]), l = Y((i) => n((d) => d | i), [t]), a = Y((i) => (t & i) === i, [t]), o = Y((i) => n((d) => d & ~i), [n]), s = Y((i) => n((d) => d ^ i), [n]);
|
|
1130
1089
|
return { flags: t, setFlag: r, addFlag: l, hasFlag: a, removeFlag: o, 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,8 +1100,8 @@ function xr(e) {
|
|
|
1141
1100
|
return t;
|
|
1142
1101
|
}
|
|
1143
1102
|
function br(e, t, n, r) {
|
|
1144
|
-
let [l, a] =
|
|
1145
|
-
return
|
|
1103
|
+
let [l, a] = S(n), { hasFlag: o, addFlag: s, removeFlag: i } = wr(e && l ? 3 : 0), d = O(!1), f = O(!1), y = pt();
|
|
1104
|
+
return A(() => {
|
|
1146
1105
|
var b;
|
|
1147
1106
|
if (e) {
|
|
1148
1107
|
if (n && a(!0), !t) {
|
|
@@ -1190,7 +1149,7 @@ 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
1155
|
for (let [a, o] of t.entries()) if (n.current[a] !== o) {
|
|
@@ -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(oe.isHandoffComplete);
|
|
1203
|
+
return t && oe.isHandoffComplete === !1 && n(!1), Ee.useEffect(() => {
|
|
1245
1204
|
t !== !0 && n(!0);
|
|
1246
|
-
}, [t]), Ee.useEffect(() =>
|
|
1205
|
+
}, [t]), Ee.useEffect(() => oe.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 =
|
|
1215
|
+
let t = Sr(), n = R(Kt), r = Me(e), [l, a] = S(() => {
|
|
1257
1216
|
var o;
|
|
1258
1217
|
if (!t && n !== null) return (o = n.current) != null ? o : null;
|
|
1259
|
-
if (
|
|
1218
|
+
if (oe.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;
|
|
@@ -1269,36 +1228,36 @@ function Fr(e) {
|
|
|
1269
1228
|
t || n !== null && a(n.current);
|
|
1270
1229
|
}, [n, a, 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), a = Me(r), o = Fr(r), [s] =
|
|
1234
|
+
}), t), a = Me(r), o = Fr(r), [s] = S(() => {
|
|
1276
1235
|
var y;
|
|
1277
|
-
return
|
|
1278
|
-
}), i = R(st), d =
|
|
1279
|
-
|
|
1236
|
+
return oe.isServer ? null : (y = a == null ? void 0 : a.createElement("div")) != null ? y : null;
|
|
1237
|
+
}), i = R(st), d = Le();
|
|
1238
|
+
A(() => {
|
|
1280
1239
|
!o || !s || o.contains(s) || (s.setAttribute("data-headlessui-portal", ""), o.appendChild(s));
|
|
1281
|
-
}, [o, s]),
|
|
1240
|
+
}, [o, s]), A(() => {
|
|
1282
1241
|
if (s && i) return i.register(s);
|
|
1283
|
-
}, [i, s]),
|
|
1242
|
+
}, [i, s]), Yt(() => {
|
|
1284
1243
|
var y;
|
|
1285
1244
|
!o || !s || (s instanceof Node && o.contains(s) && o.removeChild(s), o.childNodes.length <= 0 && ((y = o.parentElement) == null || y.removeChild(o)));
|
|
1286
1245
|
});
|
|
1287
1246
|
let f = W();
|
|
1288
|
-
return d ? !o || !s ? null :
|
|
1247
|
+
return d ? !o || !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
1250
|
let n = Z(t), { enabled: r = !0, ...l } = e, a = W();
|
|
1292
|
-
return r ? E.createElement(Cr, { ...l, ref: n }) : a({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag:
|
|
1251
|
+
return r ? E.createElement(Cr, { ...l, ref: n }) : a({ ourProps: { ref: n }, theirProps: l, slot: {}, defaultTag: Gt, name: "Portal" });
|
|
1293
1252
|
}
|
|
1294
|
-
let
|
|
1295
|
-
function
|
|
1253
|
+
let Nr = G, Kt = H(null);
|
|
1254
|
+
function Ar(e, t) {
|
|
1296
1255
|
let { target: n, ...r } = e, l = { ref: Z(t) }, a = W();
|
|
1297
|
-
return E.createElement(
|
|
1256
|
+
return E.createElement(Kt.Provider, { value: n }, a({ 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 =
|
|
1260
|
+
let e = R(st), t = O([]), n = L((a) => (t.current.push(a), e && e.register(a), () => r(a))), r = L((a) => {
|
|
1302
1261
|
let o = t.current.indexOf(a);
|
|
1303
1262
|
o !== -1 && t.current.splice(o, 1), e && e.unregister(a);
|
|
1304
1263
|
}), l = C(() => ({ register: n, unregister: r, portals: t }), [n, r, t]);
|
|
@@ -1306,17 +1265,17 @@ function Ir() {
|
|
|
1306
1265
|
return E.createElement(st.Provider, { value: l }, a);
|
|
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
1280
|
function l(a) {
|
|
1322
1281
|
r(a.matches);
|
|
@@ -1325,7 +1284,7 @@ function Ur() {
|
|
|
1325
1284
|
}, [t]), n;
|
|
1326
1285
|
}
|
|
1327
1286
|
function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
|
|
1328
|
-
let r = Me(n), l =
|
|
1287
|
+
let r = Me(n), l = L(() => {
|
|
1329
1288
|
var a, o;
|
|
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));
|
|
@@ -1333,12 +1292,12 @@ function Hr({ defaultContainers: e = [], portals: t, mainTreeNode: n } = {}) {
|
|
|
1333
1292
|
for (let i of (a = r == null ? void 0 : r.querySelectorAll("html > *, body > *")) != null ? a : []) i !== document.body && i !== document.head && i instanceof HTMLElement && i.id !== "headlessui-portal-root" && (n && (i.contains(n) || i.contains((o = n == null ? void 0 : n.getRootNode()) == null ? void 0 : o.host)) || s.some((d) => i.contains(d)) || s.push(i));
|
|
1334
1293
|
return s;
|
|
1335
1294
|
});
|
|
1336
|
-
return { resolveContainers: l, contains:
|
|
1295
|
+
return { resolveContainers: l, contains: L((a) => l().some((o) => o.contains(a))) };
|
|
1337
1296
|
}
|
|
1338
|
-
let
|
|
1339
|
-
function
|
|
1340
|
-
let [n, r] =
|
|
1341
|
-
return E.createElement(
|
|
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: (a) => {
|
|
1342
1301
|
var o, s;
|
|
1343
1302
|
if (a) {
|
|
1344
1303
|
for (let i of (s = (o = Ve(a)) == null ? void 0 : o.querySelectorAll("html > *, body > *")) != null ? s : []) if (i !== document.body && i !== document.head && i instanceof HTMLElement && i != null && i.contains(a)) {
|
|
@@ -1348,24 +1307,24 @@ function St({ children: e, node: t }) {
|
|
|
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,15 +1332,15 @@ 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
1337
|
let n = O(null), r = Z(n, t), { initialFocus: l, initialFocusFallback: a, containers: o, features: s = 15, ...i } = e;
|
|
1379
|
-
|
|
1338
|
+
Le() || (s = 0);
|
|
1380
1339
|
let d = Me(n);
|
|
1381
1340
|
Yr(s, { ownerDocument: d });
|
|
1382
1341
|
let f = zr(s, { ownerDocument: d, container: n, initialFocus: l, initialFocusFallback: a });
|
|
1383
1342
|
Gr(s, { ownerDocument: d, container: n, containers: o, previousActiveElement: f });
|
|
1384
|
-
let y = Wr(), b =
|
|
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]: () => {
|
|
@@ -1390,27 +1349,27 @@ function Br(e, t) {
|
|
|
1390
1349
|
Oe(g, J.Last, { skipElements: [p.relatedTarget, a] });
|
|
1391
1350
|
} });
|
|
1392
1351
|
});
|
|
1393
|
-
}), w =
|
|
1352
|
+
}), w = fe(!!(s & 2), "focus-trap#tab-lock"), c = pt(), v = O(!1), u = { ref: r, onKeyDown(p) {
|
|
1394
1353
|
p.key == "Tab" && (v.current = !0, c.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(o);
|
|
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,12 +1378,12 @@ 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 a = O(null), o =
|
|
1386
|
+
let a = O(null), o = fe(!!(e & 1), "focus-trap#initial-focus"), s = gt();
|
|
1428
1387
|
return vt(() => {
|
|
1429
1388
|
if (e === 0) return;
|
|
1430
1389
|
if (!o) {
|
|
@@ -1458,23 +1417,23 @@ function zr(e, { ownerDocument: t, container: n, initialFocus: r, initialFocusFa
|
|
|
1458
1417
|
}
|
|
1459
1418
|
function Gr(e, { ownerDocument: t, container: n, containers: r, previousActiveElement: l }) {
|
|
1460
1419
|
let a = gt(), o = !!(e & 4);
|
|
1461
|
-
|
|
1420
|
+
qt(t == null ? void 0 : t.defaultView, "focus", (s) => {
|
|
1462
1421
|
if (!o || !a.current) return;
|
|
1463
|
-
let i =
|
|
1422
|
+
let i = en(r);
|
|
1464
1423
|
n.current instanceof HTMLElement && i.add(n.current);
|
|
1465
1424
|
let d = l.current;
|
|
1466
1425
|
if (!d) 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(d)) : 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,8 +1453,8 @@ 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(), a = pt(), o = L((w, c = te.Hidden) => {
|
|
1499
1458
|
let v = r.current.findIndex(({ el: u }) => u === w);
|
|
1500
1459
|
v !== -1 && (ne(c, { [te.Unmount]() {
|
|
1501
1460
|
r.current.splice(v, 1);
|
|
@@ -1505,16 +1464,16 @@ function ln(e, t) {
|
|
|
1505
1464
|
var u;
|
|
1506
1465
|
!Ze(r) && l.current && ((u = n.current) == null || u.call(n));
|
|
1507
1466
|
}));
|
|
1508
|
-
}), s =
|
|
1467
|
+
}), s = L((w) => {
|
|
1509
1468
|
let c = r.current.find(({ el: v }) => v === w);
|
|
1510
1469
|
return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: w, state: "visible" }), () => o(w, te.Unmount);
|
|
1511
|
-
}), i = O([]), d = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y =
|
|
1470
|
+
}), i = O([]), d = O(Promise.resolve()), f = O({ enter: [], leave: [] }), y = L((w, c, v) => {
|
|
1512
1471
|
i.current.splice(0), t && (t.chains.current[c] = t.chains.current[c].filter(([u]) => u !== w)), t == null || t.chains.current[c].push([w, new Promise((u) => {
|
|
1513
1472
|
i.current.push(u);
|
|
1514
1473
|
})]), t == null || t.chains.current[c].push([w, new Promise((u) => {
|
|
1515
1474
|
Promise.all(f.current[c].map(([m, p]) => p)).then(() => u());
|
|
1516
1475
|
})]), c === "enter" ? d.current = d.current.then(() => t == null ? void 0 : t.wait.current).then(() => v(c)) : v(c);
|
|
1517
|
-
}), b =
|
|
1476
|
+
}), b = L((w, c, v) => {
|
|
1518
1477
|
Promise.all(f.current[c].splice(0).map(([u, m]) => m)).then(() => {
|
|
1519
1478
|
var u;
|
|
1520
1479
|
(u = i.current.shift()) == null || u();
|
|
@@ -1522,74 +1481,74 @@ function ln(e, t) {
|
|
|
1522
1481
|
});
|
|
1523
1482
|
return C(() => ({ children: r, register: s, unregister: o, onStart: y, onStop: b, wait: d, chains: f }), [s, o, r, y, b, f, d]);
|
|
1524
1483
|
}
|
|
1525
|
-
let
|
|
1484
|
+
let ln = G, an = Ue.RenderStrategy;
|
|
1526
1485
|
function Qr(e, t) {
|
|
1527
1486
|
var n, r;
|
|
1528
|
-
let { transition: l = !0, beforeEnter: a, afterEnter: o, beforeLeave: s, afterLeave: i, enter: d, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: c, leaveTo: v, ...u } = e, [m, p] =
|
|
1529
|
-
|
|
1487
|
+
let { transition: l = !0, beforeEnter: a, afterEnter: o, beforeLeave: s, afterLeave: i, enter: d, enterFrom: f, enterTo: y, entered: b, leave: w, leaveFrom: c, 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" ? a == null || a() : 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" ? o == null || o() : 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 }), dn = le({ ref: h, className: ((r = lt(u.className, Fe && d, Fe && f, I.enter && d, I.enter && I.closed && f, I.enter && !I.closed && y, I.leave && w, I.leave && !I.closed && c, 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 cn = W();
|
|
1521
|
+
return E.createElement(Ke.Provider, { value: K }, E.createElement(Or, { value: he }, cn({ ourProps: dn, theirProps: u, defaultTag: ln, features: an, visible: N === "visible", name: "Transition.Child" })));
|
|
1563
1522
|
}
|
|
1564
1523
|
function el(e, t) {
|
|
1565
|
-
let { show: n, appear: r = !1, unmount: l = !0, ...a } = e, o = O(null), s =
|
|
1566
|
-
|
|
1524
|
+
let { show: n, appear: r = !1, unmount: l = !0, ...a } = e, o = O(null), s = nn(e), i = Z(...s ? [o, t] : t === null ? [] : [t]);
|
|
1525
|
+
Le();
|
|
1567
1526
|
let d = ze();
|
|
1568
1527
|
if (n === void 0 && d !== null && (n = (d & z.Open) === z.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
1569
|
-
let [f, y] =
|
|
1528
|
+
let [f, y] = S(n ? "visible" : "hidden"), b = rn(() => {
|
|
1570
1529
|
n || y("hidden");
|
|
1571
|
-
}), [w, c] =
|
|
1572
|
-
|
|
1530
|
+
}), [w, c] = S(!0), v = O([n]);
|
|
1531
|
+
A(() => {
|
|
1573
1532
|
w !== !1 && v.current[v.current.length - 1] !== n && (v.current.push(n), c(!1));
|
|
1574
1533
|
}, [v, n]);
|
|
1575
1534
|
let u = C(() => ({ show: n, appear: r, initial: w }), [n, r, w]);
|
|
1576
|
-
|
|
1535
|
+
A(() => {
|
|
1577
1536
|
n ? y("visible") : !Ze(b) && o.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
1540
|
w && c(!1), (h = e.beforeEnter) == null || h.call(e);
|
|
1582
|
-
}), g =
|
|
1541
|
+
}), g = L(() => {
|
|
1583
1542
|
var h;
|
|
1584
1543
|
w && c(!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(on, { ref: i, ...m, ...a, beforeEnter: p, beforeLeave: g }) }, theirProps: {}, defaultTag: G, features: an, 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(on, { ref: t, ...e }));
|
|
1591
1550
|
}
|
|
1592
|
-
let ut = D(el),
|
|
1551
|
+
let ut = D(el), on = 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 };
|
|
@@ -1613,25 +1572,25 @@ let Lt = D(function(e, t) {
|
|
|
1613
1572
|
}();
|
|
1614
1573
|
let w = ze();
|
|
1615
1574
|
l === void 0 && w !== null && (l = (w & z.Open) === z.Open);
|
|
1616
|
-
let c = O(null), v = Z(c, t), u = Me(c), m = l ? 0 : 1, [p, g] =
|
|
1575
|
+
let c = O(null), v = Z(c, t), u = Me(c), m = l ? 0 : 1, [p, g] = wn(il, { titleId: null, descriptionId: null, panelRef: yn() }), x = L(() => a(!1)), h = L((k) => g({ type: 0, id: k })), $ = Le() ? m === 0 : !1, [F, j] = Ir(), _ = { get current() {
|
|
1617
1576
|
var k;
|
|
1618
1577
|
return (k = p.panelRef.current) != null ? k : c.current;
|
|
1619
|
-
} },
|
|
1620
|
-
Jn(d || B ? !1 : $, { allowed:
|
|
1578
|
+
} }, N = Qt(), { resolveContainers: U } = Hr({ mainTreeNode: N, portals: F, defaultContainers: [_] }), B = w !== null ? (w & z.Closing) === z.Closing : !1;
|
|
1579
|
+
Jn(d || B ? !1 : $, { allowed: L(() => {
|
|
1621
1580
|
var k, ke;
|
|
1622
1581
|
return [(ke = (k = c.current) == null ? void 0 : k.closest("[data-headlessui-portal]")) != null ? ke : null];
|
|
1623
|
-
}), disallowed:
|
|
1582
|
+
}), disallowed: L(() => {
|
|
1624
1583
|
var k;
|
|
1625
|
-
return [(k =
|
|
1584
|
+
return [(k = N == null ? void 0 : N.closest("body > *:not(#headlessui-portal-root)")) != null ? k : null];
|
|
1626
1585
|
}) }), cr($, 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
1589
|
}), gr(d || B ? !1 : $, u, U), Qn($, c, x);
|
|
1631
|
-
let [X, P] = Bn(), V = C(() => [{ dialogState: m, close: x, setTitleId: h, unmount: f }, p], [m, p, x, h, f]),
|
|
1632
|
-
$ && !d && (K |=
|
|
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": d ? void 0 : m === 0 ? !0 : void 0, "aria-labelledby": p.titleId, "aria-describedby": X, unmount: f }, pe = !Ur(), K = ie.None;
|
|
1591
|
+
$ && !d && (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(
|
|
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: c }, E.createElement(Pt, { force: !1 }, E.createElement(P, { slot: Se }, E.createElement(j, null, E.createElement(Vr, { initialFocus: o, initialFocusFallback: c, containers: U, features: K }, E.createElement(Gn, { value: x }, Ce({ ourProps: Fe, theirProps: y, slot: Se, defaultTag: al, features: ol, visible: m === 0, name: "Dialog" })))))))))));
|
|
1635
1594
|
}), al = "div", ol = Ue.RenderStrategy | Ue.Static;
|
|
1636
1595
|
function sl(e, t) {
|
|
1637
1596
|
let { transition: n = !1, open: r, ...l } = e, a = ze(), o = e.hasOwnProperty("open") || a !== null, s = e.hasOwnProperty("onClose");
|
|
@@ -1640,18 +1599,18 @@ function sl(e, t) {
|
|
|
1640
1599
|
if (!s) throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");
|
|
1641
1600
|
if (!a && 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
1605
|
function dl(e, t) {
|
|
1647
|
-
let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...a } = e, [{ dialogState: o, unmount: s }, i] = Je("Dialog.Panel"), d = Z(t, i.panelRef), f = C(() => ({ open: o === 0 }), [o]), y =
|
|
1606
|
+
let n = Pe(), { id: r = `headlessui-dialog-panel-${n}`, transition: l = !1, ...a } = e, [{ dialogState: o, unmount: s }, i] = Je("Dialog.Panel"), d = Z(t, i.panelRef), f = C(() => ({ open: o === 0 }), [o]), y = L((u) => {
|
|
1648
1607
|
u.stopPropagation();
|
|
1649
|
-
}), b = { ref: d, id: r, onClick: y }, w = l ?
|
|
1608
|
+
}), b = { ref: d, id: r, onClick: y }, w = l ? me : G, c = l ? { unmount: s } : {}, v = W();
|
|
1650
1609
|
return E.createElement(w, { ...c }, v({ ourProps: b, theirProps: a, slot: f, defaultTag: ul, name: "Dialog.Panel" }));
|
|
1651
1610
|
}
|
|
1652
1611
|
let cl = "div";
|
|
1653
1612
|
function fl(e, t) {
|
|
1654
|
-
let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: a }] = Je("Dialog.Backdrop"), o = C(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ?
|
|
1613
|
+
let { transition: n = !1, ...r } = e, [{ dialogState: l, unmount: a }] = Je("Dialog.Backdrop"), o = C(() => ({ open: l === 0 }), [l]), s = { ref: t, "aria-hidden": !0 }, i = n ? me : G, d = n ? { unmount: a } : {}, f = W();
|
|
1655
1614
|
return E.createElement(i, { ...d }, f({ ourProps: s, theirProps: r, slot: o, defaultTag: cl, name: "Dialog.Backdrop" }));
|
|
1656
1615
|
}
|
|
1657
1616
|
let ml = "h2";
|
|
@@ -1664,8 +1623,8 @@ function pl(e, t) {
|
|
|
1664
1623
|
let hl = D(sl), yt = D(dl);
|
|
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
|
}
|
|
@@ -1792,8 +1751,8 @@ const wl = ({ modalContext: e, config: t, children: n }) => {
|
|
|
1792
1751
|
) });
|
|
1793
1752
|
}, xl = dt(({ name: e, children: t, onFocus: n = null, onBlur: r = null, onClose: l = null, onSuccess: a = null, onAfterLeave: o = null, ...s }, i) => {
|
|
1794
1753
|
const d = (y) => typeof t == "function" ? t(y) : t, f = O(null);
|
|
1795
|
-
return
|
|
1796
|
-
|
|
1754
|
+
return St(i, () => f.current, [f]), /* @__PURE__ */ T(
|
|
1755
|
+
It,
|
|
1797
1756
|
{
|
|
1798
1757
|
ref: f,
|
|
1799
1758
|
name: e,
|
|
@@ -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
1784
|
afterLeave: o,
|
|
1826
|
-
children: /* @__PURE__ */
|
|
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",
|
|
@@ -1905,7 +1864,7 @@ 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 = {},
|
|
@@ -1923,13 +1882,13 @@ const Al = ({
|
|
|
1923
1882
|
children: c,
|
|
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();
|
|
@@ -1942,7 +1901,7 @@ const Al = ({
|
|
|
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
|
a,
|
|
@@ -1965,23 +1924,23 @@ const Al = ({
|
|
|
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
|
};
|