@inertiaui/modal-react 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/inertiaui-modal.js +440 -434
- package/dist/inertiaui-modal.umd.cjs +8 -8
- package/package.json +1 -1
- package/src/ModalContent.jsx +12 -16
- package/src/SlideoverContent.jsx +12 -16
package/dist/inertiaui-modal.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Bt = (t, e, n) => e in t ?
|
|
3
|
-
var
|
|
4
|
-
import * as
|
|
5
|
-
import B, { createContext as
|
|
6
|
-
import { jsx as
|
|
1
|
+
var Ut = Object.defineProperty;
|
|
2
|
+
var Bt = (t, e, n) => e in t ? Ut(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var q = (t, e, n) => Bt(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import * as pe from "react";
|
|
5
|
+
import B, { createContext as Ie, useState as $, useEffect as D, useContext as de, useRef as j, createElement as Ne, useMemo as Y, forwardRef as Ze, useImperativeHandle as ct, useLayoutEffect as Ht, useCallback as V, Fragment as ae, isValidElement as Kt, cloneElement as _t } from "react";
|
|
6
|
+
import { jsx as C, jsxs as le, Fragment as Ye } from "react/jsx-runtime";
|
|
7
7
|
import Te from "axios";
|
|
8
|
-
import { router as
|
|
9
|
-
import { mergeDataIntoQueryString as
|
|
8
|
+
import { router as ve, usePage as qt } from "@inertiajs/react";
|
|
9
|
+
import { mergeDataIntoQueryString as Xt } from "@inertiajs/core";
|
|
10
10
|
const fe = {
|
|
11
11
|
type: "modal",
|
|
12
12
|
navigate: !1,
|
|
@@ -63,28 +63,27 @@ class Vt {
|
|
|
63
63
|
return r;
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const Pe = new Vt(), mr = () => Pe.reset(), hr = (t, e) => Pe.put(t, e), Je = (t) => Pe.get(t), se = (t, e) => Pe.get(t ? `slideover.${e}` : `modal.${e}`), nt = {
|
|
67
67
|
modifiedElements: [],
|
|
68
68
|
bodyState: {
|
|
69
69
|
hasOverflowHidden: !1,
|
|
70
|
-
hasPointerEventsNone: !1,
|
|
71
70
|
originalPaddingRight: ""
|
|
72
71
|
},
|
|
73
72
|
prepare() {
|
|
74
73
|
const t = window.innerWidth - document.documentElement.clientWidth;
|
|
75
74
|
this.bodyState.originalPaddingRight = document.body.style.paddingRight;
|
|
76
75
|
const e = parseInt(window.getComputedStyle(document.body).paddingRight, 10);
|
|
77
|
-
document.body.style.paddingRight = `${e + t}px`, document.body.classList.contains("overflow-hidden") || (document.body.classList.add("overflow-hidden"), this.bodyState.hasOverflowHidden = !0),
|
|
76
|
+
document.body.style.paddingRight = `${e + t}px`, document.body.classList.contains("overflow-hidden") || (document.body.classList.add("overflow-hidden"), this.bodyState.hasOverflowHidden = !0), Array.from(document.body.children).forEach((n) => {
|
|
78
77
|
!n.classList.contains("im-dialog") && n.getAttribute("aria-hidden") !== "true" && (n.setAttribute("aria-hidden", "true"), this.modifiedElements.push(n));
|
|
79
78
|
});
|
|
80
79
|
},
|
|
81
80
|
cleanup() {
|
|
82
|
-
this.bodyState.hasOverflowHidden && (document.body.classList.remove("overflow-hidden"), this.bodyState.hasOverflowHidden = !1),
|
|
81
|
+
this.bodyState.hasOverflowHidden && (document.body.classList.remove("overflow-hidden"), this.bodyState.hasOverflowHidden = !1), document.body.style.paddingRight = this.bodyState.originalPaddingRight, this.bodyState.originalPaddingRight = "", this.modifiedElements.forEach((t) => {
|
|
83
82
|
t.removeAttribute("aria-hidden");
|
|
84
83
|
}), this.modifiedElements = [];
|
|
85
84
|
}
|
|
86
85
|
};
|
|
87
|
-
function
|
|
86
|
+
function Ue(t = "inertiaui_modal_") {
|
|
88
87
|
return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? `${t}${crypto.randomUUID()}` : `${t}${Date.now().toString(36)}_${Math.random().toString(36).substr(2, 9)}`;
|
|
89
88
|
}
|
|
90
89
|
function zt(t, e) {
|
|
@@ -113,82 +112,82 @@ function Zt(t, e = 3, n = 10) {
|
|
|
113
112
|
function me(t) {
|
|
114
113
|
return t ? (t = t.replace(/_/g, "-"), t = t.replace(/-+/g, "-"), /[A-Z]/.test(t) ? (t = t.replace(/\s+/g, "").replace(/_/g, "").replace(/(?:^|\s|-)+([A-Za-z])/g, (e, n) => n.toUpperCase()), t = t.replace(/(.)(?=[A-Z])/g, "$1-"), t.toLowerCase()) : t) : "";
|
|
115
114
|
}
|
|
116
|
-
const Re =
|
|
115
|
+
const Re = Ie(null);
|
|
117
116
|
Re.displayName = "ModalStackContext";
|
|
118
|
-
let mt = null,
|
|
117
|
+
let mt = null, ht = null, be = null, _e = null, qe = [], oe = {};
|
|
119
118
|
const Yt = ({ children: t }) => {
|
|
120
119
|
const [e, n] = $([]), [r, i] = $({}), l = (g) => {
|
|
121
120
|
n((d) => {
|
|
122
|
-
const f = g([...d]),
|
|
121
|
+
const f = g([...d]), h = (y) => {
|
|
123
122
|
var N;
|
|
124
|
-
return f.length < 2 ? !0 : ((N = f.map((
|
|
123
|
+
return f.length < 2 ? !0 : ((N = f.map((v) => ({ id: v.id, shouldRender: v.shouldRender })).reverse().find((v) => v.shouldRender)) == null ? void 0 : N.id) === y;
|
|
125
124
|
};
|
|
126
125
|
return f.forEach((y, N) => {
|
|
127
|
-
f[N].onTopOfStack =
|
|
126
|
+
f[N].onTopOfStack = h(y.id), f[N].getParentModal = () => N < 1 ? null : f.slice(0, N).reverse().find((v) => v.isOpen), f[N].getChildModal = () => N === f.length - 1 ? null : f.slice(N + 1).find((v) => v.isOpen);
|
|
128
127
|
}), f;
|
|
129
128
|
});
|
|
130
129
|
};
|
|
131
130
|
D(() => {
|
|
132
|
-
|
|
131
|
+
qe = e;
|
|
133
132
|
}, [e]);
|
|
134
133
|
class a {
|
|
135
|
-
constructor(d, f,
|
|
136
|
-
|
|
134
|
+
constructor(d, f, h, y, N) {
|
|
135
|
+
q(this, "show", () => {
|
|
137
136
|
l(
|
|
138
137
|
(d) => d.map((f) => (f.id === this.id && !f.isOpen && (f.isOpen = !0, f.shouldRender = !0), f))
|
|
139
138
|
);
|
|
140
139
|
});
|
|
141
|
-
|
|
140
|
+
q(this, "setOpen", (d) => {
|
|
142
141
|
d ? this.show() : this.close();
|
|
143
142
|
});
|
|
144
|
-
|
|
143
|
+
q(this, "close", () => {
|
|
145
144
|
l(
|
|
146
145
|
(d) => d.map((f) => {
|
|
147
|
-
var
|
|
146
|
+
var h;
|
|
148
147
|
return f.id === this.id && f.isOpen && (Object.keys(f.listeners).forEach((y) => {
|
|
149
148
|
f.off(y);
|
|
150
|
-
}), f.isOpen = !1, (
|
|
149
|
+
}), f.isOpen = !1, (h = f.onCloseCallback) == null || h.call(f)), f;
|
|
151
150
|
})
|
|
152
151
|
);
|
|
153
152
|
});
|
|
154
|
-
|
|
153
|
+
q(this, "afterLeave", () => {
|
|
155
154
|
this.isOpen || l((d) => {
|
|
156
|
-
const f = d.map((
|
|
155
|
+
const f = d.map((h) => {
|
|
157
156
|
var y;
|
|
158
|
-
return
|
|
157
|
+
return h.id === this.id && !h.isOpen && (h.shouldRender = !1, (y = h.afterLeaveCallback) == null || y.call(h), h.afterLeaveCallback = null), h;
|
|
159
158
|
});
|
|
160
159
|
return this.index === 0 ? [] : f;
|
|
161
160
|
});
|
|
162
161
|
});
|
|
163
|
-
|
|
162
|
+
q(this, "on", (d, f) => {
|
|
164
163
|
d = me(d), this.listeners[d] = this.listeners[d] ?? [], this.listeners[d].push(f);
|
|
165
164
|
});
|
|
166
|
-
|
|
167
|
-
var
|
|
168
|
-
d = me(d), f ? this.listeners[d] = ((
|
|
165
|
+
q(this, "off", (d, f) => {
|
|
166
|
+
var h;
|
|
167
|
+
d = me(d), f ? this.listeners[d] = ((h = this.listeners[d]) == null ? void 0 : h.filter((y) => y !== f)) ?? [] : delete this.listeners[d];
|
|
169
168
|
});
|
|
170
|
-
|
|
171
|
-
var
|
|
172
|
-
(
|
|
169
|
+
q(this, "emit", (d, ...f) => {
|
|
170
|
+
var h;
|
|
171
|
+
(h = this.listeners[me(d)]) == null || h.forEach((y) => y(...f));
|
|
173
172
|
});
|
|
174
|
-
|
|
173
|
+
q(this, "registerEventListenersFromProps", (d) => {
|
|
175
174
|
const f = [];
|
|
176
|
-
return Object.keys(d).filter((
|
|
177
|
-
const y = me(
|
|
178
|
-
this.on(y, d[
|
|
179
|
-
}), () => f.forEach((
|
|
175
|
+
return Object.keys(d).filter((h) => h.startsWith("on")).forEach((h) => {
|
|
176
|
+
const y = me(h).replace(/^on-/, "");
|
|
177
|
+
this.on(y, d[h]), f.push(() => this.off(y, d[h]));
|
|
178
|
+
}), () => f.forEach((h) => h());
|
|
180
179
|
});
|
|
181
|
-
|
|
182
|
-
var
|
|
180
|
+
q(this, "reload", (d = {}) => {
|
|
181
|
+
var h;
|
|
183
182
|
let f = Object.keys(this.response.props);
|
|
184
|
-
d.only && (f = ft(f, d.only)), d.except && (f = zt(f, d.except)), (
|
|
183
|
+
d.only && (f = ft(f, d.only)), d.except && (f = zt(f, d.except)), (h = this.response) != null && h.url && Te.get(this.response.url, {
|
|
185
184
|
headers: {
|
|
186
185
|
Accept: "text/html, application/xhtml+xml",
|
|
187
186
|
"X-Inertia": !0,
|
|
188
187
|
"X-Inertia-Partial-Component": this.response.component,
|
|
189
188
|
"X-Inertia-Version": this.response.version,
|
|
190
189
|
"X-Inertia-Partial-Data": f.join(","),
|
|
191
|
-
"X-InertiaUI-Modal":
|
|
190
|
+
"X-InertiaUI-Modal": Ue(),
|
|
192
191
|
"X-InertiaUI-Modal-Use-Router": 0,
|
|
193
192
|
"X-InertiaUI-Modal-Base-Url": be
|
|
194
193
|
}
|
|
@@ -196,20 +195,20 @@ const Yt = ({ children: t }) => {
|
|
|
196
195
|
this.updateProps(y.data.props);
|
|
197
196
|
});
|
|
198
197
|
});
|
|
199
|
-
|
|
198
|
+
q(this, "updateProps", (d) => {
|
|
200
199
|
Object.assign(this.props, d), l((f) => f);
|
|
201
200
|
});
|
|
202
|
-
if (this.id = f.id ??
|
|
201
|
+
if (this.id = f.id ?? Ue(), this.isOpen = !1, this.shouldRender = !1, this.listeners = {}, this.component = d, this.props = f.props, this.response = f, this.config = h ?? {}, this.onCloseCallback = y, this.afterLeaveCallback = N, oe[this.id]) {
|
|
203
202
|
this.config = {
|
|
204
203
|
...this.config,
|
|
205
204
|
...oe[this.id].config ?? {}
|
|
206
205
|
};
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
y(),
|
|
210
|
-
} :
|
|
211
|
-
N(),
|
|
212
|
-
} :
|
|
206
|
+
const v = oe[this.id].onClose, I = oe[this.id].onAfterLeave;
|
|
207
|
+
v && (this.onCloseCallback = y ? () => {
|
|
208
|
+
y(), v();
|
|
209
|
+
} : v), I && (this.afterLeaveCallback = N ? () => {
|
|
210
|
+
N(), I();
|
|
211
|
+
} : I), delete oe[this.id];
|
|
213
212
|
}
|
|
214
213
|
this.index = -1, this.getParentModal = () => null, this.getChildModal = () => null, this.onTopOfStack = !0;
|
|
215
214
|
}
|
|
@@ -217,17 +216,17 @@ const Yt = ({ children: t }) => {
|
|
|
217
216
|
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)}`;
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
|
-
const m = (g, d = {}, f = null,
|
|
221
|
-
const N = new a(g, d, f,
|
|
222
|
-
return N.index = e.length, l((
|
|
219
|
+
const m = (g, d = {}, f = null, h = null) => ht(g.component).then((y) => s(y, g, d, f, h)), s = (g, d, f, h, y) => {
|
|
220
|
+
const N = new a(g, d, f, h, y);
|
|
221
|
+
return N.index = e.length, l((v) => [...v, N]), N.show(), N;
|
|
223
222
|
};
|
|
224
|
-
function
|
|
223
|
+
function p(g, d, f, h) {
|
|
225
224
|
if (!r[g])
|
|
226
225
|
throw new Error(`The local modal "${g}" has not been registered.`);
|
|
227
|
-
const y = s(null, {}, d, f,
|
|
226
|
+
const y = s(null, {}, d, f, h);
|
|
228
227
|
return y.name = g, r[g].callback(y), y;
|
|
229
228
|
}
|
|
230
|
-
const b = (g, d = {}) =>
|
|
229
|
+
const b = (g, d = {}) => w(
|
|
231
230
|
g,
|
|
232
231
|
d.method ?? "get",
|
|
233
232
|
d.data ?? {},
|
|
@@ -238,22 +237,22 @@ const Yt = ({ children: t }) => {
|
|
|
238
237
|
d.queryStringArrayFormat ?? "brackets",
|
|
239
238
|
d.navigate ?? Je("navigate")
|
|
240
239
|
).then((f) => {
|
|
241
|
-
const
|
|
242
|
-
return Object.keys(
|
|
240
|
+
const h = d.listeners ?? {};
|
|
241
|
+
return Object.keys(h).forEach((y) => {
|
|
243
242
|
const N = me(y);
|
|
244
|
-
f.on(N,
|
|
243
|
+
f.on(N, h[y]);
|
|
245
244
|
}), f;
|
|
246
|
-
}),
|
|
247
|
-
const H =
|
|
248
|
-
return new Promise((K,
|
|
245
|
+
}), w = (g, d, f = {}, h = {}, y = {}, N = null, v = null, I = "brackets", A = !1) => {
|
|
246
|
+
const H = Ue();
|
|
247
|
+
return new Promise((K, W) => {
|
|
249
248
|
if (g.startsWith("#")) {
|
|
250
|
-
K(
|
|
249
|
+
K(p(g.substring(1), y, N, v));
|
|
251
250
|
return;
|
|
252
251
|
}
|
|
253
|
-
const [
|
|
252
|
+
const [U, O] = Xt(d, g || "", f, I);
|
|
254
253
|
let o = A && e.length === 0;
|
|
255
|
-
if (e.length === 0 && (be = typeof window < "u" ? window.location.href : ""),
|
|
256
|
-
...
|
|
254
|
+
if (e.length === 0 && (be = typeof window < "u" ? window.location.href : ""), h = {
|
|
255
|
+
...h,
|
|
257
256
|
Accept: "text/html, application/xhtml+xml",
|
|
258
257
|
"X-Requested-With": "XMLHttpRequest",
|
|
259
258
|
"X-Inertia": !0,
|
|
@@ -262,28 +261,28 @@ const Yt = ({ children: t }) => {
|
|
|
262
261
|
"X-InertiaUI-Modal-Use-Router": o ? 1 : 0,
|
|
263
262
|
"X-InertiaUI-Modal-Base-Url": be
|
|
264
263
|
}, o)
|
|
265
|
-
return
|
|
264
|
+
return _e = null, oe[H] = {
|
|
266
265
|
config: y,
|
|
267
266
|
onClose: N,
|
|
268
|
-
onAfterLeave:
|
|
269
|
-
},
|
|
267
|
+
onAfterLeave: v
|
|
268
|
+
}, ve.visit(U, {
|
|
270
269
|
method: d,
|
|
271
270
|
data: O,
|
|
272
|
-
headers:
|
|
271
|
+
headers: h,
|
|
273
272
|
preserveScroll: !0,
|
|
274
273
|
preserveState: !0,
|
|
275
|
-
onError:
|
|
274
|
+
onError: W,
|
|
276
275
|
onFinish: () => {
|
|
277
|
-
Zt(() =>
|
|
276
|
+
Zt(() => _e).then(K);
|
|
278
277
|
}
|
|
279
278
|
});
|
|
280
279
|
Te({
|
|
281
|
-
url:
|
|
280
|
+
url: U,
|
|
282
281
|
method: d,
|
|
283
282
|
data: O,
|
|
284
|
-
headers:
|
|
285
|
-
}).then((u) => K(m(u.data, y, N,
|
|
286
|
-
|
|
283
|
+
headers: h
|
|
284
|
+
}).then((u) => K(m(u.data, y, N, v))).catch((u) => {
|
|
285
|
+
W(u);
|
|
287
286
|
});
|
|
288
287
|
});
|
|
289
288
|
}, c = {
|
|
@@ -292,10 +291,10 @@ const Yt = ({ children: t }) => {
|
|
|
292
291
|
push: s,
|
|
293
292
|
pushFromResponseData: m,
|
|
294
293
|
closeAll: () => {
|
|
295
|
-
|
|
294
|
+
qe.reverse().forEach((g) => g.close());
|
|
296
295
|
},
|
|
297
296
|
reset: () => l(() => []),
|
|
298
|
-
visit:
|
|
297
|
+
visit: w,
|
|
299
298
|
visitModal: b,
|
|
300
299
|
registerLocalModal: (g, d) => {
|
|
301
300
|
i((f) => ({
|
|
@@ -310,67 +309,67 @@ const Yt = ({ children: t }) => {
|
|
|
310
309
|
});
|
|
311
310
|
}
|
|
312
311
|
};
|
|
313
|
-
return /* @__PURE__ */
|
|
312
|
+
return /* @__PURE__ */ C(Re.Provider, { value: c, children: t });
|
|
314
313
|
}, Ae = () => {
|
|
315
314
|
const t = de(Re);
|
|
316
315
|
if (t === null)
|
|
317
316
|
throw new Error("useModalStack must be used within a ModalStackProvider");
|
|
318
317
|
return t;
|
|
319
318
|
}, rt = ["closeButton", "closeExplicitly", "maxWidth", "paddingClasses", "panelClasses", "position", "slideover"], Jt = (t) => {
|
|
320
|
-
t.initialPage && (mt = t.initialPage.version), t.resolveComponent && (
|
|
321
|
-
},
|
|
319
|
+
t.initialPage && (mt = t.initialPage.version), t.resolveComponent && (ht = t.resolveComponent);
|
|
320
|
+
}, vr = (t, e) => (Jt(e), /* @__PURE__ */ C(Yt, { children: /* @__PURE__ */ C(t, { ...e, children: ({ Component: r, props: i, key: l }) => /* @__PURE__ */ le(Ye, { children: [
|
|
322
321
|
(() => {
|
|
323
322
|
const m = Ne(r, { key: l, ...i });
|
|
324
|
-
return typeof r.layout == "function" ? r.layout(m) : Array.isArray(r.layout) ? r.layout.concat(m).reverse().reduce((
|
|
323
|
+
return typeof r.layout == "function" ? r.layout(m) : Array.isArray(r.layout) ? r.layout.concat(m).reverse().reduce((p, b) => Ne(b, i, p)) : m;
|
|
325
324
|
})(),
|
|
326
|
-
/* @__PURE__ */
|
|
325
|
+
/* @__PURE__ */ C(Qt, {})
|
|
327
326
|
] }) }) })), Qt = ({ children: t }) => {
|
|
328
327
|
var m;
|
|
329
328
|
const e = de(Re);
|
|
330
329
|
let n = !1, r = !1;
|
|
331
|
-
D(() =>
|
|
332
|
-
() =>
|
|
333
|
-
const
|
|
334
|
-
if (!
|
|
330
|
+
D(() => ve.on("start", () => n = !0), []), D(() => ve.on("finish", () => n = !1), []), D(
|
|
331
|
+
() => ve.on("navigate", function(s) {
|
|
332
|
+
const p = s.detail.page.props._inertiaui_modal;
|
|
333
|
+
if (!p) {
|
|
335
334
|
r && e.closeAll();
|
|
336
335
|
return;
|
|
337
336
|
}
|
|
338
|
-
r =
|
|
339
|
-
if (!
|
|
337
|
+
r = p, be = p.baseUrl, e.pushFromResponseData(p, {}, () => {
|
|
338
|
+
if (!p.baseUrl) {
|
|
340
339
|
console.error("No base url in modal response data so cannot navigate back");
|
|
341
340
|
return;
|
|
342
341
|
}
|
|
343
|
-
!n && window.location.href !==
|
|
342
|
+
!n && window.location.href !== p.baseUrl && ve.visit(p.baseUrl, {
|
|
344
343
|
preserveScroll: !0,
|
|
345
344
|
preserveState: !0
|
|
346
345
|
});
|
|
347
346
|
}).then((b) => {
|
|
348
|
-
|
|
347
|
+
_e = b;
|
|
349
348
|
});
|
|
350
349
|
}),
|
|
351
350
|
[]
|
|
352
351
|
);
|
|
353
|
-
const i = (s) => (
|
|
352
|
+
const i = (s) => (qe.length && (s.headers["X-InertiaUI-Modal-Base-Url"] = be), s);
|
|
354
353
|
D(() => (Te.interceptors.request.use(i), () => Te.interceptors.request.eject(i)), []);
|
|
355
|
-
const l =
|
|
354
|
+
const l = qt(), a = j();
|
|
356
355
|
return D(() => {
|
|
357
|
-
var b,
|
|
358
|
-
const s = (b = l.props) == null ? void 0 : b._inertiaui_modal,
|
|
359
|
-
a.current = s, s &&
|
|
356
|
+
var b, w;
|
|
357
|
+
const s = (b = l.props) == null ? void 0 : b._inertiaui_modal, p = a.current;
|
|
358
|
+
a.current = s, s && p && s.component === p.component && s.url === p.url && ((w = e.stack[0]) == null || w.updateProps(s.props ?? {}));
|
|
360
359
|
}, [(m = l.props) == null ? void 0 : m._inertiaui_modal]), /* @__PURE__ */ le(Ye, { children: [
|
|
361
360
|
t,
|
|
362
|
-
e.stack.length > 0 && /* @__PURE__ */
|
|
361
|
+
e.stack.length > 0 && /* @__PURE__ */ C(pt, { index: 0 })
|
|
363
362
|
] });
|
|
364
363
|
}, Qe = B.createContext(null);
|
|
365
364
|
Qe.displayName = "ModalIndexContext";
|
|
366
|
-
const
|
|
365
|
+
const vt = () => {
|
|
367
366
|
const t = B.useContext(Qe);
|
|
368
367
|
if (t === void 0)
|
|
369
368
|
throw new Error("useModalIndex must be used within a ModalIndexProvider");
|
|
370
369
|
return t;
|
|
371
|
-
},
|
|
370
|
+
}, pt = ({ index: t }) => {
|
|
372
371
|
const { stack: e } = Ae(), n = Y(() => e[t], [e, t]);
|
|
373
|
-
return (n == null ? void 0 : n.component) && /* @__PURE__ */
|
|
372
|
+
return (n == null ? void 0 : n.component) && /* @__PURE__ */ C(Qe.Provider, { value: t, children: /* @__PURE__ */ C(
|
|
374
373
|
n.component,
|
|
375
374
|
{
|
|
376
375
|
...n.props,
|
|
@@ -378,10 +377,10 @@ const ht = () => {
|
|
|
378
377
|
}
|
|
379
378
|
) });
|
|
380
379
|
}, bt = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, ...a }, m) => {
|
|
381
|
-
const s =
|
|
382
|
-
var
|
|
383
|
-
return (
|
|
384
|
-
}, [s,
|
|
380
|
+
const s = vt(), { stack: p, registerLocalModal: b, removeLocalModal: w } = Ae(), [T, E] = $(null), c = Y(() => t ? T : p[s], [t, T, s, p]), g = Y(() => {
|
|
381
|
+
var v;
|
|
382
|
+
return (v = p.find((I) => I.shouldRender && I.index > (c == null ? void 0 : c.index))) == null ? void 0 : v.index;
|
|
383
|
+
}, [s, p]), d = Y(() => (c == null ? void 0 : c.config.slideover) ?? a.slideover ?? Je("type") === "slideover", [a.slideover]), f = Y(
|
|
385
384
|
() => ({
|
|
386
385
|
slideover: d,
|
|
387
386
|
closeButton: a.closeButton ?? se(d, "closeButton"),
|
|
@@ -396,18 +395,18 @@ const ht = () => {
|
|
|
396
395
|
);
|
|
397
396
|
D(() => {
|
|
398
397
|
if (t) {
|
|
399
|
-
let
|
|
400
|
-
return b(t, (
|
|
401
|
-
|
|
398
|
+
let v = null;
|
|
399
|
+
return b(t, (I) => {
|
|
400
|
+
v = I.registerEventListenersFromProps(a), E(I);
|
|
402
401
|
}), () => {
|
|
403
|
-
|
|
402
|
+
v == null || v(), v = null, w(t);
|
|
404
403
|
};
|
|
405
404
|
}
|
|
406
405
|
return c.registerEventListenersFromProps(a);
|
|
407
406
|
}, [t]);
|
|
408
|
-
const
|
|
407
|
+
const h = j(c);
|
|
409
408
|
D(() => {
|
|
410
|
-
|
|
409
|
+
h.current = c;
|
|
411
410
|
}, [c]), D(() => {
|
|
412
411
|
c !== null && (c.isOpen ? l == null || l() : i == null || i());
|
|
413
412
|
}, [c == null ? void 0 : c.isOpen]);
|
|
@@ -418,59 +417,59 @@ const ht = () => {
|
|
|
418
417
|
m,
|
|
419
418
|
() => ({
|
|
420
419
|
afterLeave: () => {
|
|
421
|
-
var
|
|
422
|
-
return (
|
|
420
|
+
var v;
|
|
421
|
+
return (v = h.current) == null ? void 0 : v.afterLeave();
|
|
423
422
|
},
|
|
424
423
|
close: () => {
|
|
425
|
-
var
|
|
426
|
-
return (
|
|
424
|
+
var v;
|
|
425
|
+
return (v = h.current) == null ? void 0 : v.close();
|
|
427
426
|
},
|
|
428
|
-
emit: (...
|
|
429
|
-
var
|
|
430
|
-
return (
|
|
427
|
+
emit: (...v) => {
|
|
428
|
+
var I;
|
|
429
|
+
return (I = h.current) == null ? void 0 : I.emit(...v);
|
|
431
430
|
},
|
|
432
431
|
getChildModal: () => {
|
|
433
|
-
var
|
|
434
|
-
return (
|
|
432
|
+
var v;
|
|
433
|
+
return (v = h.current) == null ? void 0 : v.getChildModal();
|
|
435
434
|
},
|
|
436
435
|
getParentModal: () => {
|
|
437
|
-
var
|
|
438
|
-
return (
|
|
436
|
+
var v;
|
|
437
|
+
return (v = h.current) == null ? void 0 : v.getParentModal();
|
|
439
438
|
},
|
|
440
|
-
reload: (...
|
|
441
|
-
var
|
|
442
|
-
return (
|
|
439
|
+
reload: (...v) => {
|
|
440
|
+
var I;
|
|
441
|
+
return (I = h.current) == null ? void 0 : I.reload(...v);
|
|
443
442
|
},
|
|
444
443
|
setOpen: () => {
|
|
445
|
-
var
|
|
446
|
-
return (
|
|
444
|
+
var v;
|
|
445
|
+
return (v = h.current) == null ? void 0 : v.setOpen();
|
|
447
446
|
},
|
|
448
447
|
get id() {
|
|
449
|
-
var
|
|
450
|
-
return (
|
|
448
|
+
var v;
|
|
449
|
+
return (v = h.current) == null ? void 0 : v.id;
|
|
451
450
|
},
|
|
452
451
|
get index() {
|
|
453
|
-
var
|
|
454
|
-
return (
|
|
452
|
+
var v;
|
|
453
|
+
return (v = h.current) == null ? void 0 : v.index;
|
|
455
454
|
},
|
|
456
455
|
get isOpen() {
|
|
457
|
-
var
|
|
458
|
-
return (
|
|
456
|
+
var v;
|
|
457
|
+
return (v = h.current) == null ? void 0 : v.isOpen;
|
|
459
458
|
},
|
|
460
459
|
get config() {
|
|
461
|
-
var
|
|
462
|
-
return (
|
|
460
|
+
var v;
|
|
461
|
+
return (v = h.current) == null ? void 0 : v.config;
|
|
463
462
|
},
|
|
464
463
|
get modalContext() {
|
|
465
|
-
return
|
|
464
|
+
return h.current;
|
|
466
465
|
},
|
|
467
466
|
get onTopOfStack() {
|
|
468
|
-
var
|
|
469
|
-
return (
|
|
467
|
+
var v;
|
|
468
|
+
return (v = h.current) == null ? void 0 : v.onTopOfStack;
|
|
470
469
|
},
|
|
471
470
|
get shouldRender() {
|
|
472
|
-
var
|
|
473
|
-
return (
|
|
471
|
+
var v;
|
|
472
|
+
return (v = h.current) == null ? void 0 : v.shouldRender;
|
|
474
473
|
}
|
|
475
474
|
}),
|
|
476
475
|
[c]
|
|
@@ -491,7 +490,7 @@ const ht = () => {
|
|
|
491
490
|
setOpen: c.setOpen,
|
|
492
491
|
shouldRender: c.shouldRender
|
|
493
492
|
}) : e,
|
|
494
|
-
g && /* @__PURE__ */
|
|
493
|
+
g && /* @__PURE__ */ C(pt, { index: g })
|
|
495
494
|
] });
|
|
496
495
|
});
|
|
497
496
|
bt.displayName = "HeadlessModal";
|
|
@@ -596,7 +595,7 @@ let G = function(t) {
|
|
|
596
595
|
let e = wt(t);
|
|
597
596
|
return B.useCallback((...n) => e.current(...n), [e]);
|
|
598
597
|
};
|
|
599
|
-
function
|
|
598
|
+
function Xe(...t) {
|
|
600
599
|
return Array.from(new Set(t.flatMap((e) => typeof e == "string" ? e.split(" ") : []))).filter(Boolean).join(" ");
|
|
601
600
|
}
|
|
602
601
|
function Le(t, e, ...n) {
|
|
@@ -616,44 +615,44 @@ function an({ ourProps: t, theirProps: e, slot: n, defaultTag: r, features: i, v
|
|
|
616
615
|
m = m ?? sn;
|
|
617
616
|
let s = Nt(e, t);
|
|
618
617
|
if (l) return we(s, n, r, a, m);
|
|
619
|
-
let
|
|
620
|
-
if (
|
|
621
|
-
let { static: b = !1, ...
|
|
622
|
-
if (b) return we(
|
|
618
|
+
let p = i ?? 0;
|
|
619
|
+
if (p & 2) {
|
|
620
|
+
let { static: b = !1, ...w } = s;
|
|
621
|
+
if (b) return we(w, n, r, a, m);
|
|
623
622
|
}
|
|
624
|
-
if (
|
|
625
|
-
let { unmount: b = !0, ...
|
|
623
|
+
if (p & 1) {
|
|
624
|
+
let { unmount: b = !0, ...w } = s;
|
|
626
625
|
return Le(b ? 0 : 1, { 0() {
|
|
627
626
|
return null;
|
|
628
627
|
}, 1() {
|
|
629
|
-
return we({ ...
|
|
628
|
+
return we({ ...w, hidden: !0, style: { display: "none" } }, n, r, a, m);
|
|
630
629
|
} });
|
|
631
630
|
}
|
|
632
631
|
return we(s, n, r, a, m);
|
|
633
632
|
}
|
|
634
633
|
function we(t, e = {}, n, r, i) {
|
|
635
|
-
let { as: l = n, children: a, refName: m = "ref", ...s } = He(t, ["unmount", "static"]),
|
|
634
|
+
let { as: l = n, children: a, refName: m = "ref", ...s } = He(t, ["unmount", "static"]), p = t.ref !== void 0 ? { [m]: t.ref } : {}, b = typeof a == "function" ? a(e) : a;
|
|
636
635
|
"className" in s && s.className && typeof s.className == "function" && (s.className = s.className(e)), s["aria-labelledby"] && s["aria-labelledby"] === s.id && (s["aria-labelledby"] = void 0);
|
|
637
|
-
let
|
|
636
|
+
let w = {};
|
|
638
637
|
if (e) {
|
|
639
638
|
let T = !1, E = [];
|
|
640
639
|
for (let [c, g] of Object.entries(e)) typeof g == "boolean" && (T = !0), g === !0 && E.push(c.replace(/([A-Z])/g, (d) => `-${d.toLowerCase()}`));
|
|
641
640
|
if (T) {
|
|
642
|
-
|
|
643
|
-
for (let c of E)
|
|
641
|
+
w["data-headlessui-state"] = E.join(" ");
|
|
642
|
+
for (let c of E) w[`data-${c}`] = "";
|
|
644
643
|
}
|
|
645
644
|
}
|
|
646
|
-
if (l === ae && (Object.keys(te(s)).length > 0 || Object.keys(te(
|
|
647
|
-
if (Object.keys(te(s)).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(te(s)).concat(Object.keys(te(
|
|
645
|
+
if (l === ae && (Object.keys(te(s)).length > 0 || Object.keys(te(w)).length > 0)) if (!Kt(b) || Array.isArray(b) && b.length > 1) {
|
|
646
|
+
if (Object.keys(te(s)).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(te(s)).concat(Object.keys(te(w))).map((T) => ` - ${T}`).join(`
|
|
648
647
|
`), "", "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((T) => ` - ${T}`).join(`
|
|
649
648
|
`)].join(`
|
|
650
649
|
`));
|
|
651
650
|
} else {
|
|
652
|
-
let T = b.props, E = T == null ? void 0 : T.className, c = typeof E == "function" ? (...f) =>
|
|
653
|
-
for (let f in
|
|
654
|
-
return
|
|
651
|
+
let T = b.props, E = T == null ? void 0 : T.className, c = typeof E == "function" ? (...f) => Xe(E(...f), s.className) : Xe(E, s.className), g = c ? { className: c } : {}, d = Nt(b.props, te(He(s, ["ref"])));
|
|
652
|
+
for (let f in w) f in d && delete w[f];
|
|
653
|
+
return _t(b, Object.assign({}, d, w, p, { ref: i(on(b), p.ref) }, g));
|
|
655
654
|
}
|
|
656
|
-
return Ne(l, Object.assign({}, He(s, ["ref"]), l !== ae &&
|
|
655
|
+
return Ne(l, Object.assign({}, He(s, ["ref"]), l !== ae && p, l !== ae && w), b);
|
|
657
656
|
}
|
|
658
657
|
function ln() {
|
|
659
658
|
let t = j([]), e = V((n) => {
|
|
@@ -715,7 +714,7 @@ function Tt(...t) {
|
|
|
715
714
|
return t.every((r) => r == null || (r == null ? void 0 : r[un])) ? void 0 : n;
|
|
716
715
|
}
|
|
717
716
|
function dn(t = 0) {
|
|
718
|
-
let [e, n] = $(t), r = V((s) => n(s), [e]), i = V((s) => n((
|
|
717
|
+
let [e, n] = $(t), r = V((s) => n(s), [e]), i = V((s) => n((p) => p | s), [e]), l = V((s) => (e & s) === s, [e]), a = V((s) => n((p) => p & ~s), [n]), m = V((s) => n((p) => p ^ s), [n]);
|
|
719
718
|
return { flags: e, setFlag: r, addFlag: i, hasFlag: l, removeFlag: a, toggleFlag: m };
|
|
720
719
|
}
|
|
721
720
|
var at, it;
|
|
@@ -730,7 +729,7 @@ function fn(t) {
|
|
|
730
729
|
return e;
|
|
731
730
|
}
|
|
732
731
|
function mn(t, e, n, r) {
|
|
733
|
-
let [i, l] = $(n), { hasFlag: a, addFlag: m, removeFlag: s } = dn(t && i ? 3 : 0),
|
|
732
|
+
let [i, l] = $(n), { hasFlag: a, addFlag: m, removeFlag: s } = dn(t && i ? 3 : 0), p = j(!1), b = j(!1), w = yt();
|
|
734
733
|
return Q(() => {
|
|
735
734
|
var T;
|
|
736
735
|
if (t) {
|
|
@@ -738,26 +737,26 @@ function mn(t, e, n, r) {
|
|
|
738
737
|
n && m(3);
|
|
739
738
|
return;
|
|
740
739
|
}
|
|
741
|
-
return (T = r == null ? void 0 : r.start) == null || T.call(r, n),
|
|
742
|
-
b.current ? b.current = !1 : b.current =
|
|
740
|
+
return (T = r == null ? void 0 : r.start) == null || T.call(r, n), hn(e, { inFlight: p, prepare() {
|
|
741
|
+
b.current ? b.current = !1 : b.current = p.current, p.current = !0, !b.current && (n ? (m(3), s(4)) : (m(4), s(2)));
|
|
743
742
|
}, run() {
|
|
744
743
|
b.current ? n ? (s(3), m(4)) : (s(4), m(3)) : n ? s(1) : m(1);
|
|
745
744
|
}, done() {
|
|
746
745
|
var E;
|
|
747
|
-
b.current && typeof e.getAnimations == "function" && e.getAnimations().length > 0 || (
|
|
746
|
+
b.current && typeof e.getAnimations == "function" && e.getAnimations().length > 0 || (p.current = !1, s(7), n || l(!1), (E = r == null ? void 0 : r.end) == null || E.call(r, n));
|
|
748
747
|
} });
|
|
749
748
|
}
|
|
750
|
-
}, [t, n, e,
|
|
749
|
+
}, [t, n, e, w]), t ? [i, { 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 }];
|
|
751
750
|
}
|
|
752
|
-
function
|
|
751
|
+
function hn(t, { prepare: e, run: n, done: r, inFlight: i }) {
|
|
753
752
|
let l = Me();
|
|
754
|
-
return
|
|
753
|
+
return pn(t, { prepare: e, inFlight: i }), l.nextFrame(() => {
|
|
755
754
|
n(), l.requestAnimationFrame(() => {
|
|
756
|
-
l.add(
|
|
755
|
+
l.add(vn(t, r));
|
|
757
756
|
});
|
|
758
757
|
}), l.dispose;
|
|
759
758
|
}
|
|
760
|
-
function
|
|
759
|
+
function vn(t, e) {
|
|
761
760
|
var n, r;
|
|
762
761
|
let i = Me();
|
|
763
762
|
if (!t) return i.dispose;
|
|
@@ -770,7 +769,7 @@ function hn(t, e) {
|
|
|
770
769
|
l || e();
|
|
771
770
|
}), i.dispose);
|
|
772
771
|
}
|
|
773
|
-
function
|
|
772
|
+
function pn(t, { inFlight: e, prepare: n }) {
|
|
774
773
|
if (e != null && e.current) {
|
|
775
774
|
n();
|
|
776
775
|
return;
|
|
@@ -806,18 +805,18 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
806
805
|
var a = l.shift();
|
|
807
806
|
if (!ke(a, !1))
|
|
808
807
|
if (a.tagName === "SLOT") {
|
|
809
|
-
var m = a.assignedElements(), s = m.length ? m : a.children,
|
|
810
|
-
r.flatten ? i.push.apply(i,
|
|
808
|
+
var m = a.assignedElements(), s = m.length ? m : a.children, p = t(s, !0, r);
|
|
809
|
+
r.flatten ? i.push.apply(i, p) : i.push({
|
|
811
810
|
scopeParent: a,
|
|
812
|
-
candidates:
|
|
811
|
+
candidates: p
|
|
813
812
|
});
|
|
814
813
|
} else {
|
|
815
814
|
var b = ie.call(a, Oe);
|
|
816
815
|
b && r.filter(a) && (n || !e.includes(a)) && i.push(a);
|
|
817
|
-
var
|
|
818
|
-
typeof r.getShadowRoot == "function" && r.getShadowRoot(a), T = !ke(
|
|
819
|
-
if (
|
|
820
|
-
var E = t(
|
|
816
|
+
var w = a.shadowRoot || // check for an undisclosed shadow
|
|
817
|
+
typeof r.getShadowRoot == "function" && r.getShadowRoot(a), T = !ke(w, !1) && (!r.shadowRootFilter || r.shadowRootFilter(a));
|
|
818
|
+
if (w && T) {
|
|
819
|
+
var E = t(w === !0 ? a.children : w.children, !0, r);
|
|
821
820
|
r.flatten ? i.push.apply(i, E) : i.push({
|
|
822
821
|
scopeParent: a,
|
|
823
822
|
candidates: E
|
|
@@ -838,10 +837,10 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
838
837
|
return r < 0 && n && !Ct(e) ? 0 : r;
|
|
839
838
|
}, yn = function(e, n) {
|
|
840
839
|
return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
|
|
841
|
-
},
|
|
840
|
+
}, It = function(e) {
|
|
842
841
|
return e.tagName === "INPUT";
|
|
843
842
|
}, wn = function(e) {
|
|
844
|
-
return
|
|
843
|
+
return It(e) && e.type === "hidden";
|
|
845
844
|
}, xn = function(e) {
|
|
846
845
|
var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
|
|
847
846
|
return r.tagName === "SUMMARY";
|
|
@@ -868,7 +867,7 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
868
867
|
var l = En(i, e.form);
|
|
869
868
|
return !l || l === e;
|
|
870
869
|
}, Tn = function(e) {
|
|
871
|
-
return
|
|
870
|
+
return It(e) && e.type === "radio";
|
|
872
871
|
}, Sn = function(e) {
|
|
873
872
|
return Tn(e) && !Nn(e);
|
|
874
873
|
}, On = function(e) {
|
|
@@ -876,8 +875,8 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
876
875
|
if (r && r !== e) {
|
|
877
876
|
var a, m, s;
|
|
878
877
|
for (l = !!((a = i) !== null && a !== void 0 && (m = a.ownerDocument) !== null && m !== void 0 && m.contains(i) || e != null && (s = e.ownerDocument) !== null && s !== void 0 && s.contains(e)); !l && i; ) {
|
|
879
|
-
var
|
|
880
|
-
r = Fe(i), i = (
|
|
878
|
+
var p, b, w;
|
|
879
|
+
r = Fe(i), i = (p = r) === null || p === void 0 ? void 0 : p.host, l = !!((b = i) !== null && b !== void 0 && (w = b.ownerDocument) !== null && w !== void 0 && w.contains(i));
|
|
881
880
|
}
|
|
882
881
|
}
|
|
883
882
|
return l;
|
|
@@ -894,10 +893,10 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
894
893
|
if (!r || r === "full" || r === "legacy-full") {
|
|
895
894
|
if (typeof i == "function") {
|
|
896
895
|
for (var m = e; e; ) {
|
|
897
|
-
var s = e.parentElement,
|
|
896
|
+
var s = e.parentElement, p = Fe(e);
|
|
898
897
|
if (s && !s.shadowRoot && i(s) === !0)
|
|
899
898
|
return lt(e);
|
|
900
|
-
e.assignedSlot ? e = e.assignedSlot : !s &&
|
|
899
|
+
e.assignedSlot ? e = e.assignedSlot : !s && p !== e.ownerDocument ? e = p.host : e = s;
|
|
901
900
|
}
|
|
902
901
|
e = m;
|
|
903
902
|
}
|
|
@@ -933,21 +932,21 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
933
932
|
}, Cn = function(e) {
|
|
934
933
|
var n = parseInt(e.getAttribute("tabindex"), 10);
|
|
935
934
|
return !!(isNaN(n) || n >= 0);
|
|
936
|
-
},
|
|
935
|
+
}, In = function t(e) {
|
|
937
936
|
var n = [], r = [];
|
|
938
937
|
return e.forEach(function(i, l) {
|
|
939
|
-
var a = !!i.scopeParent, m = a ? i.scopeParent : i, s = gn(m, a),
|
|
940
|
-
s === 0 ? a ? n.push.apply(n,
|
|
938
|
+
var a = !!i.scopeParent, m = a ? i.scopeParent : i, s = gn(m, a), p = a ? t(i.candidates) : m;
|
|
939
|
+
s === 0 ? a ? n.push.apply(n, p) : n.push(m) : r.push({
|
|
941
940
|
documentOrder: l,
|
|
942
941
|
tabIndex: s,
|
|
943
942
|
item: i,
|
|
944
943
|
isScope: a,
|
|
945
|
-
content:
|
|
944
|
+
content: p
|
|
946
945
|
});
|
|
947
946
|
}), r.sort(yn).reduce(function(i, l) {
|
|
948
947
|
return l.isScope ? i.push.apply(i, l.content) : i.push(l.content), i;
|
|
949
948
|
}, []).concat(n);
|
|
950
|
-
},
|
|
949
|
+
}, Pn = function(e, n) {
|
|
951
950
|
n = n || {};
|
|
952
951
|
var r;
|
|
953
952
|
return n.getShadowRoot ? r = kt([e], n.includeContainer, {
|
|
@@ -955,7 +954,7 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
955
954
|
flatten: !1,
|
|
956
955
|
getShadowRoot: n.getShadowRoot,
|
|
957
956
|
shadowRootFilter: Cn
|
|
958
|
-
}) : r = Ft(e, n.includeContainer, Ve.bind(null, n)),
|
|
957
|
+
}) : r = Ft(e, n.includeContainer, Ve.bind(null, n)), In(r);
|
|
959
958
|
}, Rn = function(e, n) {
|
|
960
959
|
n = n || {};
|
|
961
960
|
var r;
|
|
@@ -973,10 +972,10 @@ var St = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])",
|
|
|
973
972
|
throw new Error("No node provided");
|
|
974
973
|
return ie.call(e, An) === !1 ? !1 : Ce(n, e);
|
|
975
974
|
};
|
|
976
|
-
let tt =
|
|
975
|
+
let tt = Ie(null);
|
|
977
976
|
tt.displayName = "OpenClosedContext";
|
|
978
977
|
var re = ((t) => (t[t.Open = 1] = "Open", t[t.Closed = 2] = "Closed", t[t.Closing = 4] = "Closing", t[t.Opening = 8] = "Opening", t))(re || {});
|
|
979
|
-
function
|
|
978
|
+
function Pt() {
|
|
980
979
|
return de(tt);
|
|
981
980
|
}
|
|
982
981
|
function Mn({ value: t, children: e }) {
|
|
@@ -984,14 +983,14 @@ function Mn({ value: t, children: e }) {
|
|
|
984
983
|
}
|
|
985
984
|
function Ln() {
|
|
986
985
|
let t = typeof document > "u";
|
|
987
|
-
return "useSyncExternalStore" in
|
|
986
|
+
return "useSyncExternalStore" in pe ? ((e) => e.useSyncExternalStore)(pe)(() => () => {
|
|
988
987
|
}, () => !1, () => !t) : !1;
|
|
989
988
|
}
|
|
990
989
|
function Rt() {
|
|
991
|
-
let t = Ln(), [e, n] =
|
|
992
|
-
return e && Ee.isHandoffComplete === !1 && n(!1),
|
|
990
|
+
let t = Ln(), [e, n] = pe.useState(Ee.isHandoffComplete);
|
|
991
|
+
return e && Ee.isHandoffComplete === !1 && n(!1), pe.useEffect(() => {
|
|
993
992
|
e !== !0 && n(!0);
|
|
994
|
-
}, [e]),
|
|
993
|
+
}, [e]), pe.useEffect(() => Ee.handoff(), []), t ? !1 : e;
|
|
995
994
|
}
|
|
996
995
|
function jn() {
|
|
997
996
|
let t = j(!1);
|
|
@@ -1003,7 +1002,7 @@ function At(t) {
|
|
|
1003
1002
|
var e;
|
|
1004
1003
|
return !!(t.enter || t.enterFrom || t.enterTo || t.leave || t.leaveFrom || t.leaveTo) || ((e = t.as) != null ? e : Lt) !== ae || B.Children.count(t.children) === 1;
|
|
1005
1004
|
}
|
|
1006
|
-
let je =
|
|
1005
|
+
let je = Ie(null);
|
|
1007
1006
|
je.displayName = "TransitionContext";
|
|
1008
1007
|
var Dn = ((t) => (t.Visible = "visible", t.Hidden = "hidden", t))(Dn || {});
|
|
1009
1008
|
function $n() {
|
|
@@ -1011,12 +1010,12 @@ function $n() {
|
|
|
1011
1010
|
if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
1012
1011
|
return t;
|
|
1013
1012
|
}
|
|
1014
|
-
function
|
|
1013
|
+
function Wn() {
|
|
1015
1014
|
let t = de(De);
|
|
1016
1015
|
if (t === null) throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");
|
|
1017
1016
|
return t;
|
|
1018
1017
|
}
|
|
1019
|
-
let De =
|
|
1018
|
+
let De = Ie(null);
|
|
1020
1019
|
De.displayName = "NestingContext";
|
|
1021
1020
|
function $e(t) {
|
|
1022
1021
|
return "children" in t ? $e(t.children) : t.current.filter(({ el: e }) => e.current !== null).filter(({ state: e }) => e === "visible").length > 0;
|
|
@@ -1035,88 +1034,88 @@ function Mt(t, e) {
|
|
|
1035
1034
|
}), m = G((E) => {
|
|
1036
1035
|
let c = r.current.find(({ el: g }) => g === E);
|
|
1037
1036
|
return c ? c.state !== "visible" && (c.state = "visible") : r.current.push({ el: E, state: "visible" }), () => a(E, J.Unmount);
|
|
1038
|
-
}), s = j([]),
|
|
1037
|
+
}), s = j([]), p = j(Promise.resolve()), b = j({ enter: [], leave: [] }), w = G((E, c, g) => {
|
|
1039
1038
|
s.current.splice(0), e && (e.chains.current[c] = e.chains.current[c].filter(([d]) => d !== E)), e == null || e.chains.current[c].push([E, new Promise((d) => {
|
|
1040
1039
|
s.current.push(d);
|
|
1041
1040
|
})]), e == null || e.chains.current[c].push([E, new Promise((d) => {
|
|
1042
|
-
Promise.all(b.current[c].map(([f,
|
|
1043
|
-
})]), c === "enter" ?
|
|
1041
|
+
Promise.all(b.current[c].map(([f, h]) => h)).then(() => d());
|
|
1042
|
+
})]), c === "enter" ? p.current = p.current.then(() => e == null ? void 0 : e.wait.current).then(() => g(c)) : g(c);
|
|
1044
1043
|
}), T = G((E, c, g) => {
|
|
1045
1044
|
Promise.all(b.current[c].splice(0).map(([d, f]) => f)).then(() => {
|
|
1046
1045
|
var d;
|
|
1047
1046
|
(d = s.current.shift()) == null || d();
|
|
1048
1047
|
}).then(() => g(c));
|
|
1049
1048
|
});
|
|
1050
|
-
return Y(() => ({ children: r, register: m, unregister: a, onStart:
|
|
1049
|
+
return Y(() => ({ children: r, register: m, unregister: a, onStart: w, onStop: T, wait: p, chains: b }), [m, a, r, w, T, b, p]);
|
|
1051
1050
|
}
|
|
1052
1051
|
let Lt = ae, jt = xt.RenderStrategy;
|
|
1053
|
-
function
|
|
1052
|
+
function Un(t, e) {
|
|
1054
1053
|
var n, r;
|
|
1055
|
-
let { transition: i = !0, beforeEnter: l, afterEnter: a, beforeLeave: m, afterLeave: s, enter:
|
|
1054
|
+
let { transition: i = !0, beforeEnter: l, afterEnter: a, beforeLeave: m, afterLeave: s, enter: p, enterFrom: b, enterTo: w, entered: T, leave: E, leaveFrom: c, leaveTo: g, ...d } = t, [f, h] = $(null), y = j(null), N = At(t), v = Tt(...N ? [y, e, h] : e === null ? [] : [e]), I = (n = d.unmount) == null || n ? J.Unmount : J.Hidden, { show: A, appear: H, initial: K } = $n(), [W, U] = $(A ? "visible" : "hidden"), O = Wn(), { register: o, unregister: u } = O;
|
|
1056
1055
|
Q(() => o(y), [o, y]), Q(() => {
|
|
1057
|
-
if (
|
|
1058
|
-
if (A &&
|
|
1059
|
-
|
|
1056
|
+
if (I === J.Hidden && y.current) {
|
|
1057
|
+
if (A && W !== "visible") {
|
|
1058
|
+
U("visible");
|
|
1060
1059
|
return;
|
|
1061
1060
|
}
|
|
1062
|
-
return Le(
|
|
1061
|
+
return Le(W, { hidden: () => u(y), visible: () => o(y) });
|
|
1063
1062
|
}
|
|
1064
|
-
}, [
|
|
1065
|
-
let
|
|
1063
|
+
}, [W, y, o, u, A, I]);
|
|
1064
|
+
let x = Rt();
|
|
1066
1065
|
Q(() => {
|
|
1067
|
-
if (N &&
|
|
1068
|
-
}, [y,
|
|
1069
|
-
let
|
|
1070
|
-
|
|
1066
|
+
if (N && x && W === "visible" && y.current === null) throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?");
|
|
1067
|
+
}, [y, W, x, N]);
|
|
1068
|
+
let F = K && !H, k = H && A && K, P = j(!1), S = Mt(() => {
|
|
1069
|
+
P.current || (U("hidden"), u(y));
|
|
1071
1070
|
}, O), R = G((ee) => {
|
|
1072
|
-
|
|
1071
|
+
P.current = !0;
|
|
1073
1072
|
let Z = ee ? "enter" : "leave";
|
|
1074
1073
|
S.onStart(y, Z, (ce) => {
|
|
1075
1074
|
ce === "enter" ? l == null || l() : ce === "leave" && (m == null || m());
|
|
1076
1075
|
});
|
|
1077
1076
|
}), M = G((ee) => {
|
|
1078
1077
|
let Z = ee ? "enter" : "leave";
|
|
1079
|
-
|
|
1078
|
+
P.current = !1, S.onStop(y, Z, (ce) => {
|
|
1080
1079
|
ce === "enter" ? a == null || a() : ce === "leave" && (s == null || s());
|
|
1081
|
-
}), Z === "leave" && !$e(S) && (
|
|
1080
|
+
}), Z === "leave" && !$e(S) && (U("hidden"), u(y));
|
|
1082
1081
|
});
|
|
1083
1082
|
D(() => {
|
|
1084
1083
|
N && i || (R(A), M(A));
|
|
1085
1084
|
}, [A, N, i]);
|
|
1086
|
-
let z = !(!i || !N || !
|
|
1087
|
-
|
|
1085
|
+
let z = !(!i || !N || !x || F), [, L] = mn(z, f, A, { start: R, end: M }), X = te({ ref: v, className: ((r = Xe(d.className, k && p, k && b, L.enter && p, L.enter && L.closed && b, L.enter && !L.closed && w, L.leave && E, L.leave && !L.closed && c, L.leave && L.closed && g, !L.transition && A && T)) == null ? void 0 : r.trim()) || void 0, ...fn(L) }), _ = 0;
|
|
1086
|
+
W === "visible" && (_ |= re.Open), W === "hidden" && (_ |= re.Closed), L.enter && (_ |= re.Opening), L.leave && (_ |= re.Closing);
|
|
1088
1087
|
let ye = Et();
|
|
1089
|
-
return B.createElement(De.Provider, { value: S }, B.createElement(Mn, { value:
|
|
1088
|
+
return B.createElement(De.Provider, { value: S }, B.createElement(Mn, { value: _ }, ye({ ourProps: X, theirProps: d, defaultTag: Lt, features: jt, visible: W === "visible", name: "Transition.Child" })));
|
|
1090
1089
|
}
|
|
1091
1090
|
function Bn(t, e) {
|
|
1092
1091
|
let { show: n, appear: r = !1, unmount: i = !0, ...l } = t, a = j(null), m = At(t), s = Tt(...m ? [a, e] : e === null ? [] : [e]);
|
|
1093
1092
|
Rt();
|
|
1094
|
-
let
|
|
1095
|
-
if (n === void 0 &&
|
|
1096
|
-
let [b,
|
|
1097
|
-
n ||
|
|
1093
|
+
let p = Pt();
|
|
1094
|
+
if (n === void 0 && p !== null && (n = (p & re.Open) === re.Open), n === void 0) throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");
|
|
1095
|
+
let [b, w] = $(n ? "visible" : "hidden"), T = Mt(() => {
|
|
1096
|
+
n || w("hidden");
|
|
1098
1097
|
}), [E, c] = $(!0), g = j([n]);
|
|
1099
1098
|
Q(() => {
|
|
1100
1099
|
E !== !1 && g.current[g.current.length - 1] !== n && (g.current.push(n), c(!1));
|
|
1101
1100
|
}, [g, n]);
|
|
1102
1101
|
let d = Y(() => ({ show: n, appear: r, initial: E }), [n, r, E]);
|
|
1103
1102
|
Q(() => {
|
|
1104
|
-
n ?
|
|
1103
|
+
n ? w("visible") : !$e(T) && a.current !== null && w("hidden");
|
|
1105
1104
|
}, [n, T]);
|
|
1106
|
-
let f = { unmount: i },
|
|
1107
|
-
var
|
|
1108
|
-
E && c(!1), (
|
|
1105
|
+
let f = { unmount: i }, h = G(() => {
|
|
1106
|
+
var v;
|
|
1107
|
+
E && c(!1), (v = t.beforeEnter) == null || v.call(t);
|
|
1109
1108
|
}), y = G(() => {
|
|
1110
|
-
var
|
|
1111
|
-
E && c(!1), (
|
|
1109
|
+
var v;
|
|
1110
|
+
E && c(!1), (v = t.beforeLeave) == null || v.call(t);
|
|
1112
1111
|
}), N = Et();
|
|
1113
|
-
return B.createElement(De.Provider, { value: T }, B.createElement(je.Provider, { value: d }, N({ ourProps: { ...f, as: ae, children: B.createElement(Dt, { ref: s, ...f, ...l, beforeEnter:
|
|
1112
|
+
return B.createElement(De.Provider, { value: T }, B.createElement(je.Provider, { value: d }, N({ ourProps: { ...f, as: ae, children: B.createElement(Dt, { ref: s, ...f, ...l, beforeEnter: h, beforeLeave: y }) }, theirProps: {}, defaultTag: ae, features: jt, visible: b === "visible", name: "Transition" })));
|
|
1114
1113
|
}
|
|
1115
1114
|
function Hn(t, e) {
|
|
1116
|
-
let n = de(je) !== null, r =
|
|
1115
|
+
let n = de(je) !== null, r = Pt() !== null;
|
|
1117
1116
|
return B.createElement(B.Fragment, null, !n && r ? B.createElement(ze, { ref: e, ...t }) : B.createElement(Dt, { ref: e, ...t }));
|
|
1118
1117
|
}
|
|
1119
|
-
let ze = et(Bn), Dt = et(
|
|
1118
|
+
let ze = et(Bn), Dt = et(Un), We = et(Hn), Kn = Object.assign(ze, { Child: We, Root: ze });
|
|
1120
1119
|
function $t({ onClick: t }) {
|
|
1121
1120
|
return /* @__PURE__ */ le(
|
|
1122
1121
|
"button",
|
|
@@ -1125,8 +1124,8 @@ function $t({ onClick: t }) {
|
|
|
1125
1124
|
className: "im-close-button text-gray-400 hover:text-gray-500",
|
|
1126
1125
|
onClick: t,
|
|
1127
1126
|
children: [
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1127
|
+
/* @__PURE__ */ C("span", { className: "sr-only", children: "Close" }),
|
|
1128
|
+
/* @__PURE__ */ C(
|
|
1130
1129
|
"svg",
|
|
1131
1130
|
{
|
|
1132
1131
|
className: "size-6",
|
|
@@ -1136,7 +1135,7 @@ function $t({ onClick: t }) {
|
|
|
1136
1135
|
strokeWidth: "2",
|
|
1137
1136
|
stroke: "currentColor",
|
|
1138
1137
|
"aria-hidden": "true",
|
|
1139
|
-
children: /* @__PURE__ */
|
|
1138
|
+
children: /* @__PURE__ */ C(
|
|
1140
1139
|
"path",
|
|
1141
1140
|
{
|
|
1142
1141
|
strokeLinecap: "round",
|
|
@@ -1151,7 +1150,7 @@ function $t({ onClick: t }) {
|
|
|
1151
1150
|
);
|
|
1152
1151
|
}
|
|
1153
1152
|
/*!
|
|
1154
|
-
* focus-trap 7.6.
|
|
1153
|
+
* focus-trap 7.6.4
|
|
1155
1154
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
1156
1155
|
*/
|
|
1157
1156
|
function Ge(t, e) {
|
|
@@ -1159,10 +1158,10 @@ function Ge(t, e) {
|
|
|
1159
1158
|
for (var n = 0, r = Array(e); n < e; n++) r[n] = t[n];
|
|
1160
1159
|
return r;
|
|
1161
1160
|
}
|
|
1162
|
-
function
|
|
1161
|
+
function _n(t) {
|
|
1163
1162
|
if (Array.isArray(t)) return Ge(t);
|
|
1164
1163
|
}
|
|
1165
|
-
function
|
|
1164
|
+
function qn(t, e, n) {
|
|
1166
1165
|
return (e = Zn(e)) in t ? Object.defineProperty(t, e, {
|
|
1167
1166
|
value: n,
|
|
1168
1167
|
enumerable: !0,
|
|
@@ -1170,7 +1169,7 @@ function Xn(t, e, n) {
|
|
|
1170
1169
|
writable: !0
|
|
1171
1170
|
}) : t[e] = n, t;
|
|
1172
1171
|
}
|
|
1173
|
-
function
|
|
1172
|
+
function Xn(t) {
|
|
1174
1173
|
if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null) return Array.from(t);
|
|
1175
1174
|
}
|
|
1176
1175
|
function Vn() {
|
|
@@ -1191,7 +1190,7 @@ function ot(t) {
|
|
|
1191
1190
|
for (var e = 1; e < arguments.length; e++) {
|
|
1192
1191
|
var n = arguments[e] != null ? arguments[e] : {};
|
|
1193
1192
|
e % 2 ? st(Object(n), !0).forEach(function(r) {
|
|
1194
|
-
|
|
1193
|
+
qn(t, r, n[r]);
|
|
1195
1194
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : st(Object(n)).forEach(function(r) {
|
|
1196
1195
|
Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
|
|
1197
1196
|
});
|
|
@@ -1199,7 +1198,7 @@ function ot(t) {
|
|
|
1199
1198
|
return t;
|
|
1200
1199
|
}
|
|
1201
1200
|
function zn(t) {
|
|
1202
|
-
return
|
|
1201
|
+
return _n(t) || Xn(t) || Yn(t) || Vn();
|
|
1203
1202
|
}
|
|
1204
1203
|
function Gn(t, e) {
|
|
1205
1204
|
if (typeof t != "object" || !t) return t;
|
|
@@ -1226,14 +1225,14 @@ var ut = {
|
|
|
1226
1225
|
activateTrap: function(e, n) {
|
|
1227
1226
|
if (e.length > 0) {
|
|
1228
1227
|
var r = e[e.length - 1];
|
|
1229
|
-
r !== n && r.
|
|
1228
|
+
r !== n && r._setPausedState(!0);
|
|
1230
1229
|
}
|
|
1231
1230
|
var i = e.indexOf(n);
|
|
1232
1231
|
i === -1 || e.splice(i, 1), e.push(n);
|
|
1233
1232
|
},
|
|
1234
1233
|
deactivateTrap: function(e, n) {
|
|
1235
1234
|
var r = e.indexOf(n);
|
|
1236
|
-
r !== -1 && e.splice(r, 1), e.length > 0 && e[e.length - 1].
|
|
1235
|
+
r !== -1 && e.splice(r, 1), e.length > 0 && !e[e.length - 1]._isManuallyPaused() && e[e.length - 1]._setPausedState(!1);
|
|
1237
1236
|
}
|
|
1238
1237
|
}, Jn = function(e) {
|
|
1239
1238
|
return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
|
|
@@ -1247,7 +1246,7 @@ var ut = {
|
|
|
1247
1246
|
return ge(e) && e.shiftKey;
|
|
1248
1247
|
}, dt = function(e) {
|
|
1249
1248
|
return setTimeout(e, 0);
|
|
1250
|
-
},
|
|
1249
|
+
}, he = function(e) {
|
|
1251
1250
|
for (var n = arguments.length, r = new Array(n > 1 ? n - 1 : 0), i = 1; i < n; i++)
|
|
1252
1251
|
r[i - 1] = arguments[i];
|
|
1253
1252
|
return typeof e == "function" ? e.apply(void 0, r) : e;
|
|
@@ -1291,28 +1290,29 @@ var ut = {
|
|
|
1291
1290
|
mostRecentlyFocusedNode: null,
|
|
1292
1291
|
active: !1,
|
|
1293
1292
|
paused: !1,
|
|
1293
|
+
manuallyPaused: !1,
|
|
1294
1294
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
1295
1295
|
// has been delayed during activation
|
|
1296
1296
|
delayInitialFocusTimer: void 0,
|
|
1297
1297
|
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
1298
1298
|
recentNavEvent: void 0
|
|
1299
|
-
}, m, s = function(o, u,
|
|
1300
|
-
return o && o[u] !== void 0 ? o[u] : l[
|
|
1301
|
-
},
|
|
1302
|
-
var
|
|
1303
|
-
return a.containerGroups.findIndex(function(
|
|
1304
|
-
var
|
|
1305
|
-
return
|
|
1299
|
+
}, m, s = function(o, u, x) {
|
|
1300
|
+
return o && o[u] !== void 0 ? o[u] : l[x || u];
|
|
1301
|
+
}, p = function(o, u) {
|
|
1302
|
+
var x = typeof (u == null ? void 0 : u.composedPath) == "function" ? u.composedPath() : void 0;
|
|
1303
|
+
return a.containerGroups.findIndex(function(F) {
|
|
1304
|
+
var k = F.container, P = F.tabbableNodes;
|
|
1305
|
+
return k.contains(o) || // fall back to explicit tabbable search which will take into consideration any
|
|
1306
1306
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
1307
1307
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
1308
1308
|
// look inside web components even if open)
|
|
1309
|
-
(
|
|
1309
|
+
(x == null ? void 0 : x.includes(k)) || P.find(function(S) {
|
|
1310
1310
|
return S === o;
|
|
1311
1311
|
});
|
|
1312
1312
|
});
|
|
1313
1313
|
}, b = function(o) {
|
|
1314
|
-
var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
1315
|
-
if (typeof S == "function" && (S = S.apply(void 0, zn(
|
|
1314
|
+
var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, x = u.hasFallback, F = x === void 0 ? !1 : x, k = u.params, P = k === void 0 ? [] : k, S = l[o];
|
|
1315
|
+
if (typeof S == "function" && (S = S.apply(void 0, zn(P))), S === !0 && (S = void 0), !S) {
|
|
1316
1316
|
if (S === void 0 || S === !1)
|
|
1317
1317
|
return S;
|
|
1318
1318
|
throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
|
|
@@ -1324,22 +1324,22 @@ var ut = {
|
|
|
1324
1324
|
} catch (M) {
|
|
1325
1325
|
throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(M.message, '"'));
|
|
1326
1326
|
}
|
|
1327
|
-
if (!R && !
|
|
1327
|
+
if (!R && !F)
|
|
1328
1328
|
throw new Error("`".concat(o, "` as selector refers to no known node"));
|
|
1329
1329
|
}
|
|
1330
1330
|
return R;
|
|
1331
|
-
},
|
|
1331
|
+
}, w = function() {
|
|
1332
1332
|
var o = b("initialFocus", {
|
|
1333
1333
|
hasFallback: !0
|
|
1334
1334
|
});
|
|
1335
1335
|
if (o === !1)
|
|
1336
1336
|
return !1;
|
|
1337
1337
|
if (o === void 0 || o && !Ke(o, l.tabbableOptions))
|
|
1338
|
-
if (
|
|
1338
|
+
if (p(r.activeElement) >= 0)
|
|
1339
1339
|
o = r.activeElement;
|
|
1340
1340
|
else {
|
|
1341
|
-
var u = a.tabbableGroups[0],
|
|
1342
|
-
o =
|
|
1341
|
+
var u = a.tabbableGroups[0], x = u && u.firstTabbableNode;
|
|
1342
|
+
o = x || b("fallbackFocus");
|
|
1343
1343
|
}
|
|
1344
1344
|
else o === null && (o = b("fallbackFocus"));
|
|
1345
1345
|
if (!o)
|
|
@@ -1347,9 +1347,9 @@ var ut = {
|
|
|
1347
1347
|
return o;
|
|
1348
1348
|
}, T = function() {
|
|
1349
1349
|
if (a.containerGroups = a.containers.map(function(o) {
|
|
1350
|
-
var u =
|
|
1350
|
+
var u = Pn(o, l.tabbableOptions), x = Rn(o, l.tabbableOptions), F = u.length > 0 ? u[0] : void 0, k = u.length > 0 ? u[u.length - 1] : void 0, P = x.find(function(M) {
|
|
1351
1351
|
return ue(M);
|
|
1352
|
-
}), S =
|
|
1352
|
+
}), S = x.slice().reverse().find(function(M) {
|
|
1353
1353
|
return ue(M);
|
|
1354
1354
|
}), R = !!u.find(function(M) {
|
|
1355
1355
|
return ne(M) > 0;
|
|
@@ -1357,13 +1357,13 @@ var ut = {
|
|
|
1357
1357
|
return {
|
|
1358
1358
|
container: o,
|
|
1359
1359
|
tabbableNodes: u,
|
|
1360
|
-
focusableNodes:
|
|
1360
|
+
focusableNodes: x,
|
|
1361
1361
|
/** True if at least one node with positive `tabindex` was found in this container. */
|
|
1362
1362
|
posTabIndexesFound: R,
|
|
1363
1363
|
/** First tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
1364
|
-
firstTabbableNode:
|
|
1364
|
+
firstTabbableNode: F,
|
|
1365
1365
|
/** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
1366
|
-
lastTabbableNode:
|
|
1366
|
+
lastTabbableNode: k,
|
|
1367
1367
|
// NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
|
|
1368
1368
|
// would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
1369
1369
|
// because that API doesn't work with Shadow DOM as well as it should (@see
|
|
@@ -1372,7 +1372,7 @@ var ut = {
|
|
|
1372
1372
|
// "close enough most of the time" alternative for positive tabindexes which should generally
|
|
1373
1373
|
// be avoided anyway...
|
|
1374
1374
|
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
1375
|
-
firstDomTabbableNode:
|
|
1375
|
+
firstDomTabbableNode: P,
|
|
1376
1376
|
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
1377
1377
|
lastDomTabbableNode: S,
|
|
1378
1378
|
/**
|
|
@@ -1384,12 +1384,12 @@ var ut = {
|
|
|
1384
1384
|
* @returns {HTMLElement|undefined} The next tabbable node, if any.
|
|
1385
1385
|
*/
|
|
1386
1386
|
nextTabbableNode: function(z) {
|
|
1387
|
-
var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0,
|
|
1388
|
-
return
|
|
1389
|
-
return ue(
|
|
1390
|
-
}) :
|
|
1391
|
-
return ue(
|
|
1392
|
-
}) : u[
|
|
1387
|
+
var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, X = u.indexOf(z);
|
|
1388
|
+
return X < 0 ? L ? x.slice(x.indexOf(z) + 1).find(function(_) {
|
|
1389
|
+
return ue(_);
|
|
1390
|
+
}) : x.slice(0, x.indexOf(z)).reverse().find(function(_) {
|
|
1391
|
+
return ue(_);
|
|
1392
|
+
}) : u[X + (L ? 1 : -1)];
|
|
1393
1393
|
}
|
|
1394
1394
|
};
|
|
1395
1395
|
}), a.tabbableGroups = a.containerGroups.filter(function(o) {
|
|
@@ -1407,7 +1407,7 @@ var ut = {
|
|
|
1407
1407
|
}, c = function(o) {
|
|
1408
1408
|
if (o !== !1 && o !== E(document)) {
|
|
1409
1409
|
if (!o || !o.focus) {
|
|
1410
|
-
c(
|
|
1410
|
+
c(w());
|
|
1411
1411
|
return;
|
|
1412
1412
|
}
|
|
1413
1413
|
o.focus({
|
|
@@ -1420,39 +1420,39 @@ var ut = {
|
|
|
1420
1420
|
});
|
|
1421
1421
|
return u || (u === !1 ? !1 : o);
|
|
1422
1422
|
}, d = function(o) {
|
|
1423
|
-
var u = o.target,
|
|
1424
|
-
u = u || xe(
|
|
1425
|
-
var
|
|
1423
|
+
var u = o.target, x = o.event, F = o.isBackward, k = F === void 0 ? !1 : F;
|
|
1424
|
+
u = u || xe(x), T();
|
|
1425
|
+
var P = null;
|
|
1426
1426
|
if (a.tabbableGroups.length > 0) {
|
|
1427
|
-
var S =
|
|
1427
|
+
var S = p(u, x), R = S >= 0 ? a.containerGroups[S] : void 0;
|
|
1428
1428
|
if (S < 0)
|
|
1429
|
-
|
|
1430
|
-
else if (
|
|
1429
|
+
k ? P = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : P = a.tabbableGroups[0].firstTabbableNode;
|
|
1430
|
+
else if (k) {
|
|
1431
1431
|
var M = a.tabbableGroups.findIndex(function(ee) {
|
|
1432
1432
|
var Z = ee.firstTabbableNode;
|
|
1433
1433
|
return u === Z;
|
|
1434
1434
|
});
|
|
1435
1435
|
if (M < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u, !1)) && (M = S), M >= 0) {
|
|
1436
1436
|
var z = M === 0 ? a.tabbableGroups.length - 1 : M - 1, L = a.tabbableGroups[z];
|
|
1437
|
-
|
|
1438
|
-
} else ge(
|
|
1437
|
+
P = ne(u) >= 0 ? L.lastTabbableNode : L.lastDomTabbableNode;
|
|
1438
|
+
} else ge(x) || (P = R.nextTabbableNode(u, !1));
|
|
1439
1439
|
} else {
|
|
1440
|
-
var
|
|
1440
|
+
var X = a.tabbableGroups.findIndex(function(ee) {
|
|
1441
1441
|
var Z = ee.lastTabbableNode;
|
|
1442
1442
|
return u === Z;
|
|
1443
1443
|
});
|
|
1444
|
-
if (
|
|
1445
|
-
var
|
|
1446
|
-
|
|
1447
|
-
} else ge(
|
|
1444
|
+
if (X < 0 && (R.container === u || Ke(u, l.tabbableOptions) && !ue(u, l.tabbableOptions) && !R.nextTabbableNode(u)) && (X = S), X >= 0) {
|
|
1445
|
+
var _ = X === a.tabbableGroups.length - 1 ? 0 : X + 1, ye = a.tabbableGroups[_];
|
|
1446
|
+
P = ne(u) >= 0 ? ye.firstTabbableNode : ye.firstDomTabbableNode;
|
|
1447
|
+
} else ge(x) || (P = R.nextTabbableNode(u));
|
|
1448
1448
|
}
|
|
1449
1449
|
} else
|
|
1450
|
-
|
|
1451
|
-
return
|
|
1450
|
+
P = b("fallbackFocus");
|
|
1451
|
+
return P;
|
|
1452
1452
|
}, f = function(o) {
|
|
1453
1453
|
var u = xe(o);
|
|
1454
|
-
if (!(
|
|
1455
|
-
if (
|
|
1454
|
+
if (!(p(u, o) >= 0)) {
|
|
1455
|
+
if (he(l.clickOutsideDeactivates, o)) {
|
|
1456
1456
|
m.deactivate({
|
|
1457
1457
|
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
1458
1458
|
// which will result in the outside click setting focus to the node
|
|
@@ -1464,86 +1464,86 @@ var ut = {
|
|
|
1464
1464
|
});
|
|
1465
1465
|
return;
|
|
1466
1466
|
}
|
|
1467
|
-
|
|
1467
|
+
he(l.allowOutsideClick, o) || o.preventDefault();
|
|
1468
1468
|
}
|
|
1469
|
-
},
|
|
1470
|
-
var u = xe(o),
|
|
1471
|
-
if (
|
|
1472
|
-
|
|
1469
|
+
}, h = function(o) {
|
|
1470
|
+
var u = xe(o), x = p(u, o) >= 0;
|
|
1471
|
+
if (x || u instanceof Document)
|
|
1472
|
+
x && (a.mostRecentlyFocusedNode = u);
|
|
1473
1473
|
else {
|
|
1474
1474
|
o.stopImmediatePropagation();
|
|
1475
|
-
var
|
|
1475
|
+
var F, k = !0;
|
|
1476
1476
|
if (a.mostRecentlyFocusedNode)
|
|
1477
1477
|
if (ne(a.mostRecentlyFocusedNode) > 0) {
|
|
1478
|
-
var
|
|
1478
|
+
var P = p(a.mostRecentlyFocusedNode), S = a.containerGroups[P].tabbableNodes;
|
|
1479
1479
|
if (S.length > 0) {
|
|
1480
1480
|
var R = S.findIndex(function(M) {
|
|
1481
1481
|
return M === a.mostRecentlyFocusedNode;
|
|
1482
1482
|
});
|
|
1483
|
-
R >= 0 && (l.isKeyForward(a.recentNavEvent) ? R + 1 < S.length && (
|
|
1483
|
+
R >= 0 && (l.isKeyForward(a.recentNavEvent) ? R + 1 < S.length && (F = S[R + 1], k = !1) : R - 1 >= 0 && (F = S[R - 1], k = !1));
|
|
1484
1484
|
}
|
|
1485
1485
|
} else
|
|
1486
1486
|
a.containerGroups.some(function(M) {
|
|
1487
1487
|
return M.tabbableNodes.some(function(z) {
|
|
1488
1488
|
return ne(z) > 0;
|
|
1489
1489
|
});
|
|
1490
|
-
}) || (
|
|
1490
|
+
}) || (k = !1);
|
|
1491
1491
|
else
|
|
1492
|
-
|
|
1493
|
-
|
|
1492
|
+
k = !1;
|
|
1493
|
+
k && (F = d({
|
|
1494
1494
|
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
1495
1495
|
// outside the trap causing the focus escape we're trying to fix)
|
|
1496
1496
|
target: a.mostRecentlyFocusedNode,
|
|
1497
1497
|
isBackward: l.isKeyBackward(a.recentNavEvent)
|
|
1498
|
-
})), c(
|
|
1498
|
+
})), c(F || a.mostRecentlyFocusedNode || w());
|
|
1499
1499
|
}
|
|
1500
1500
|
a.recentNavEvent = void 0;
|
|
1501
1501
|
}, y = function(o) {
|
|
1502
1502
|
var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
1503
1503
|
a.recentNavEvent = o;
|
|
1504
|
-
var
|
|
1504
|
+
var x = d({
|
|
1505
1505
|
event: o,
|
|
1506
1506
|
isBackward: u
|
|
1507
1507
|
});
|
|
1508
|
-
|
|
1508
|
+
x && (ge(o) && o.preventDefault(), c(x));
|
|
1509
1509
|
}, N = function(o) {
|
|
1510
1510
|
(l.isKeyForward(o) || l.isKeyBackward(o)) && y(o, l.isKeyBackward(o));
|
|
1511
|
-
},
|
|
1512
|
-
Qn(o) &&
|
|
1513
|
-
},
|
|
1511
|
+
}, v = function(o) {
|
|
1512
|
+
Qn(o) && he(l.escapeDeactivates, o) !== !1 && (o.preventDefault(), m.deactivate());
|
|
1513
|
+
}, I = function(o) {
|
|
1514
1514
|
var u = xe(o);
|
|
1515
|
-
|
|
1515
|
+
p(u, o) >= 0 || he(l.clickOutsideDeactivates, o) || he(l.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
|
|
1516
1516
|
}, A = function() {
|
|
1517
1517
|
if (a.active)
|
|
1518
1518
|
return ut.activateTrap(i, m), a.delayInitialFocusTimer = l.delayInitialFocus ? dt(function() {
|
|
1519
|
-
c(
|
|
1520
|
-
}) : c(
|
|
1519
|
+
c(w());
|
|
1520
|
+
}) : c(w()), r.addEventListener("focusin", h, !0), r.addEventListener("mousedown", f, {
|
|
1521
1521
|
capture: !0,
|
|
1522
1522
|
passive: !1
|
|
1523
1523
|
}), r.addEventListener("touchstart", f, {
|
|
1524
1524
|
capture: !0,
|
|
1525
1525
|
passive: !1
|
|
1526
|
-
}), r.addEventListener("click",
|
|
1526
|
+
}), r.addEventListener("click", I, {
|
|
1527
1527
|
capture: !0,
|
|
1528
1528
|
passive: !1
|
|
1529
1529
|
}), r.addEventListener("keydown", N, {
|
|
1530
1530
|
capture: !0,
|
|
1531
1531
|
passive: !1
|
|
1532
|
-
}), r.addEventListener("keydown",
|
|
1532
|
+
}), r.addEventListener("keydown", v), m;
|
|
1533
1533
|
}, H = function() {
|
|
1534
1534
|
if (a.active)
|
|
1535
|
-
return r.removeEventListener("focusin",
|
|
1535
|
+
return r.removeEventListener("focusin", h, !0), r.removeEventListener("mousedown", f, !0), r.removeEventListener("touchstart", f, !0), r.removeEventListener("click", I, !0), r.removeEventListener("keydown", N, !0), r.removeEventListener("keydown", v), m;
|
|
1536
1536
|
}, K = function(o) {
|
|
1537
|
-
var u = o.some(function(
|
|
1538
|
-
var
|
|
1539
|
-
return
|
|
1540
|
-
return
|
|
1537
|
+
var u = o.some(function(x) {
|
|
1538
|
+
var F = Array.from(x.removedNodes);
|
|
1539
|
+
return F.some(function(k) {
|
|
1540
|
+
return k === a.mostRecentlyFocusedNode;
|
|
1541
1541
|
});
|
|
1542
1542
|
});
|
|
1543
|
-
u && c(
|
|
1544
|
-
},
|
|
1545
|
-
|
|
1546
|
-
|
|
1543
|
+
u && c(w());
|
|
1544
|
+
}, W = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(K) : void 0, U = function() {
|
|
1545
|
+
W && (W.disconnect(), a.active && !a.paused && a.containers.map(function(o) {
|
|
1546
|
+
W.observe(o, {
|
|
1547
1547
|
subtree: !0,
|
|
1548
1548
|
childList: !0
|
|
1549
1549
|
});
|
|
@@ -1559,12 +1559,12 @@ var ut = {
|
|
|
1559
1559
|
activate: function(o) {
|
|
1560
1560
|
if (a.active)
|
|
1561
1561
|
return this;
|
|
1562
|
-
var u = s(o, "onActivate"),
|
|
1563
|
-
|
|
1564
|
-
var
|
|
1565
|
-
|
|
1562
|
+
var u = s(o, "onActivate"), x = s(o, "onPostActivate"), F = s(o, "checkCanFocusTrap");
|
|
1563
|
+
F || T(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = r.activeElement, u == null || u();
|
|
1564
|
+
var k = function() {
|
|
1565
|
+
F && T(), A(), U(), x == null || x();
|
|
1566
1566
|
};
|
|
1567
|
-
return
|
|
1567
|
+
return F ? (F(a.containers.concat()).then(k, k), this) : (k(), this);
|
|
1568
1568
|
},
|
|
1569
1569
|
deactivate: function(o) {
|
|
1570
1570
|
if (!a.active)
|
|
@@ -1574,37 +1574,51 @@ var ut = {
|
|
|
1574
1574
|
onPostDeactivate: l.onPostDeactivate,
|
|
1575
1575
|
checkCanReturnFocus: l.checkCanReturnFocus
|
|
1576
1576
|
}, o);
|
|
1577
|
-
clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, H(), a.active = !1, a.paused = !1,
|
|
1578
|
-
var
|
|
1579
|
-
|
|
1577
|
+
clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, H(), a.active = !1, a.paused = !1, U(), ut.deactivateTrap(i, m);
|
|
1578
|
+
var x = s(u, "onDeactivate"), F = s(u, "onPostDeactivate"), k = s(u, "checkCanReturnFocus"), P = s(u, "returnFocus", "returnFocusOnDeactivate");
|
|
1579
|
+
x == null || x();
|
|
1580
1580
|
var S = function() {
|
|
1581
1581
|
dt(function() {
|
|
1582
|
-
|
|
1582
|
+
P && c(g(a.nodeFocusedBeforeActivation)), F == null || F();
|
|
1583
1583
|
});
|
|
1584
1584
|
};
|
|
1585
|
-
return
|
|
1585
|
+
return P && k ? (k(g(a.nodeFocusedBeforeActivation)).then(S, S), this) : (S(), this);
|
|
1586
1586
|
},
|
|
1587
1587
|
pause: function(o) {
|
|
1588
|
-
|
|
1589
|
-
return this;
|
|
1590
|
-
var u = s(o, "onPause"), w = s(o, "onPostPause");
|
|
1591
|
-
return a.paused = !0, u == null || u(), H(), W(), w == null || w(), this;
|
|
1588
|
+
return a.active ? (a.manuallyPaused = !0, this._setPausedState(!0, o)) : this;
|
|
1592
1589
|
},
|
|
1593
1590
|
unpause: function(o) {
|
|
1594
|
-
|
|
1595
|
-
return this;
|
|
1596
|
-
var u = s(o, "onUnpause"), w = s(o, "onPostUnpause");
|
|
1597
|
-
return a.paused = !1, u == null || u(), T(), A(), W(), w == null || w(), this;
|
|
1591
|
+
return a.active ? (a.manuallyPaused = !1, i[i.length - 1] !== this ? this : this._setPausedState(!1, o)) : this;
|
|
1598
1592
|
},
|
|
1599
1593
|
updateContainerElements: function(o) {
|
|
1600
1594
|
var u = [].concat(o).filter(Boolean);
|
|
1601
|
-
return a.containers = u.map(function(
|
|
1602
|
-
return typeof
|
|
1603
|
-
}), a.active && T(),
|
|
1595
|
+
return a.containers = u.map(function(x) {
|
|
1596
|
+
return typeof x == "string" ? r.querySelector(x) : x;
|
|
1597
|
+
}), a.active && T(), U(), this;
|
|
1604
1598
|
}
|
|
1605
|
-
},
|
|
1599
|
+
}, Object.defineProperties(m, {
|
|
1600
|
+
_isManuallyPaused: {
|
|
1601
|
+
value: function() {
|
|
1602
|
+
return a.manuallyPaused;
|
|
1603
|
+
}
|
|
1604
|
+
},
|
|
1605
|
+
_setPausedState: {
|
|
1606
|
+
value: function(o, u) {
|
|
1607
|
+
if (a.paused === o)
|
|
1608
|
+
return this;
|
|
1609
|
+
if (a.paused = o, o) {
|
|
1610
|
+
var x = s(u, "onPause"), F = s(u, "onPostPause");
|
|
1611
|
+
x == null || x(), H(), U(), F == null || F();
|
|
1612
|
+
} else {
|
|
1613
|
+
var k = s(u, "onUnpause"), P = s(u, "onPostUnpause");
|
|
1614
|
+
k == null || k(), T(), A(), U(), P == null || P();
|
|
1615
|
+
}
|
|
1616
|
+
return this;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
}), m.updateContainerElements(e), m;
|
|
1606
1620
|
};
|
|
1607
|
-
function
|
|
1621
|
+
function Wt(t, e, n) {
|
|
1608
1622
|
let r = null;
|
|
1609
1623
|
return t && (r = rr(t, {
|
|
1610
1624
|
clickOutsideDeactivates: !e,
|
|
@@ -1618,9 +1632,9 @@ function Ut(t, e, n) {
|
|
|
1618
1632
|
const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
1619
1633
|
const [r, i] = $(!1), l = j(null), [a, m] = $(null);
|
|
1620
1634
|
function s() {
|
|
1621
|
-
m(
|
|
1635
|
+
m(Wt(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
|
|
1622
1636
|
}
|
|
1623
|
-
return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */
|
|
1637
|
+
return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ C("div", { className: "im-modal-container fixed inset-0 z-40 overflow-y-auto p-4", children: /* @__PURE__ */ C(
|
|
1624
1638
|
"div",
|
|
1625
1639
|
{
|
|
1626
1640
|
className: Se("im-modal-positioner flex min-h-full justify-center", {
|
|
@@ -1628,8 +1642,8 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1628
1642
|
"items-center": e.position === "center",
|
|
1629
1643
|
"items-end": e.position === "bottom"
|
|
1630
1644
|
}),
|
|
1631
|
-
children: /* @__PURE__ */
|
|
1632
|
-
|
|
1645
|
+
children: /* @__PURE__ */ C(
|
|
1646
|
+
We,
|
|
1633
1647
|
{
|
|
1634
1648
|
as: "div",
|
|
1635
1649
|
ref: l,
|
|
@@ -1639,29 +1653,25 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1639
1653
|
leaveTo: "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
1640
1654
|
afterEnter: s,
|
|
1641
1655
|
afterLeave: t.afterLeave,
|
|
1642
|
-
className: Se(
|
|
1643
|
-
"
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
|
|
1655
|
-
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
|
|
1656
|
-
}
|
|
1657
|
-
),
|
|
1656
|
+
className: Se("im-modal-wrapper w-full transition duration-300 ease-in-out", t.onTopOfStack ? "" : "blur-sm", {
|
|
1657
|
+
"sm:max-w-sm": e.maxWidth === "sm",
|
|
1658
|
+
"sm:max-w-md": e.maxWidth === "md",
|
|
1659
|
+
"sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
|
|
1660
|
+
"sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
|
|
1661
|
+
"sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
|
|
1662
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
|
|
1663
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
|
|
1664
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
|
|
1665
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
|
|
1666
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
|
|
1667
|
+
}),
|
|
1658
1668
|
children: /* @__PURE__ */ le(
|
|
1659
1669
|
"div",
|
|
1660
1670
|
{
|
|
1661
1671
|
className: `im-modal-content relative ${e.paddingClasses} ${e.panelClasses}`,
|
|
1662
1672
|
"data-inertiaui-modal-entered": r,
|
|
1663
1673
|
children: [
|
|
1664
|
-
e.closeButton && /* @__PURE__ */
|
|
1674
|
+
e.closeButton && /* @__PURE__ */ C("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ C($t, { onClick: t.close }) }),
|
|
1665
1675
|
typeof n == "function" ? n({ modalContext: t, config: e }) : n
|
|
1666
1676
|
]
|
|
1667
1677
|
}
|
|
@@ -1673,17 +1683,17 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1673
1683
|
}, ir = ({ modalContext: t, config: e, children: n }) => {
|
|
1674
1684
|
const [r, i] = $(!1), l = j(null), [a, m] = $(null);
|
|
1675
1685
|
function s() {
|
|
1676
|
-
m(
|
|
1686
|
+
m(Wt(l.current, e == null ? void 0 : e.closeExplicitly, () => t.close())), i(!0);
|
|
1677
1687
|
}
|
|
1678
|
-
return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */
|
|
1688
|
+
return D(() => () => a == null ? void 0 : a.deactivate(), [a]), /* @__PURE__ */ C("div", { className: "im-slideover-container fixed inset-0 z-40 overflow-y-auto overflow-x-hidden", children: /* @__PURE__ */ C(
|
|
1679
1689
|
"div",
|
|
1680
1690
|
{
|
|
1681
1691
|
className: Se("im-slideover-positioner flex min-h-full items-center", {
|
|
1682
1692
|
"justify-start rtl:justify-end": (e == null ? void 0 : e.position) === "left",
|
|
1683
1693
|
"justify-end rtl:justify-start": (e == null ? void 0 : e.position) === "right"
|
|
1684
1694
|
}),
|
|
1685
|
-
children: /* @__PURE__ */
|
|
1686
|
-
|
|
1695
|
+
children: /* @__PURE__ */ C(
|
|
1696
|
+
We,
|
|
1687
1697
|
{
|
|
1688
1698
|
as: "div",
|
|
1689
1699
|
ref: l,
|
|
@@ -1693,29 +1703,25 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1693
1703
|
leaveTo: `opacity-0 ${e.position === "left" ? "-translate-x-full" : "translate-x-full"}`,
|
|
1694
1704
|
afterEnter: s,
|
|
1695
1705
|
afterLeave: t.afterLeave,
|
|
1696
|
-
className: Se(
|
|
1697
|
-
"
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
|
|
1709
|
-
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
|
|
1710
|
-
}
|
|
1711
|
-
),
|
|
1706
|
+
className: Se("im-slideover-wrapper w-full transition duration-300 ease-in-out", t.onTopOfStack ? "" : "blur-sm", {
|
|
1707
|
+
"sm:max-w-sm": e.maxWidth === "sm",
|
|
1708
|
+
"sm:max-w-md": e.maxWidth === "md",
|
|
1709
|
+
"sm:max-w-md md:max-w-lg": e.maxWidth === "lg",
|
|
1710
|
+
"sm:max-w-md md:max-w-xl": e.maxWidth === "xl",
|
|
1711
|
+
"sm:max-w-md md:max-w-xl lg:max-w-2xl": e.maxWidth === "2xl",
|
|
1712
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl": e.maxWidth === "3xl",
|
|
1713
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-4xl": e.maxWidth === "4xl",
|
|
1714
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl": e.maxWidth === "5xl",
|
|
1715
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-6xl": e.maxWidth === "6xl",
|
|
1716
|
+
"sm:max-w-md md:max-w-xl lg:max-w-3xl xl:max-w-5xl 2xl:max-w-7xl": e.maxWidth === "7xl"
|
|
1717
|
+
}),
|
|
1712
1718
|
children: /* @__PURE__ */ le(
|
|
1713
1719
|
"div",
|
|
1714
1720
|
{
|
|
1715
1721
|
className: `im-slideover-content relative ${e.paddingClasses} ${e.panelClasses}`,
|
|
1716
1722
|
"data-inertiaui-modal-entered": r,
|
|
1717
1723
|
children: [
|
|
1718
|
-
e.closeButton && /* @__PURE__ */
|
|
1724
|
+
e.closeButton && /* @__PURE__ */ C("div", { className: "absolute right-0 top-0 pr-3 pt-3", children: /* @__PURE__ */ C($t, { onClick: t.close }) }),
|
|
1719
1725
|
typeof n == "function" ? n({ modalContext: t, config: e }) : n
|
|
1720
1726
|
]
|
|
1721
1727
|
}
|
|
@@ -1725,12 +1731,12 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1725
1731
|
}
|
|
1726
1732
|
) });
|
|
1727
1733
|
}, lr = Ze(({ name: t, children: e, onFocus: n = null, onBlur: r = null, onClose: i = null, onSuccess: l = null, onAfterLeave: a = null, ...m }, s) => {
|
|
1728
|
-
const
|
|
1734
|
+
const p = (w) => typeof e == "function" ? e(w) : e, b = j(null);
|
|
1729
1735
|
return D(() => {
|
|
1730
|
-
var
|
|
1731
|
-
if (((
|
|
1736
|
+
var w;
|
|
1737
|
+
if (((w = b == null ? void 0 : b.current) == null ? void 0 : w.index) === 0)
|
|
1732
1738
|
return nt.prepare(), () => nt.cleanup();
|
|
1733
|
-
}, [b]), ct(s, () => b.current, [b]), /* @__PURE__ */
|
|
1739
|
+
}, [b]), ct(s, () => b.current, [b]), /* @__PURE__ */ C(
|
|
1734
1740
|
bt,
|
|
1735
1741
|
{
|
|
1736
1742
|
ref: b,
|
|
@@ -1741,21 +1747,21 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1741
1747
|
onSuccess: l,
|
|
1742
1748
|
...m,
|
|
1743
1749
|
children: ({
|
|
1744
|
-
afterLeave:
|
|
1750
|
+
afterLeave: w,
|
|
1745
1751
|
close: T,
|
|
1746
1752
|
config: E,
|
|
1747
1753
|
emit: c,
|
|
1748
1754
|
getChildModal: g,
|
|
1749
1755
|
getParentModal: d,
|
|
1750
1756
|
id: f,
|
|
1751
|
-
index:
|
|
1757
|
+
index: h,
|
|
1752
1758
|
isOpen: y,
|
|
1753
1759
|
modalContext: N,
|
|
1754
|
-
onTopOfStack:
|
|
1755
|
-
reload:
|
|
1760
|
+
onTopOfStack: v,
|
|
1761
|
+
reload: I,
|
|
1756
1762
|
setOpen: A,
|
|
1757
1763
|
shouldRender: H
|
|
1758
|
-
}) => /* @__PURE__ */
|
|
1764
|
+
}) => /* @__PURE__ */ C(
|
|
1759
1765
|
Kn,
|
|
1760
1766
|
{
|
|
1761
1767
|
appear: !0,
|
|
@@ -1766,10 +1772,10 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1766
1772
|
{
|
|
1767
1773
|
className: "im-dialog relative z-20",
|
|
1768
1774
|
"data-inertiaui-modal-id": f,
|
|
1769
|
-
"data-inertiaui-modal-index":
|
|
1775
|
+
"data-inertiaui-modal-index": h,
|
|
1770
1776
|
children: [
|
|
1771
|
-
|
|
1772
|
-
|
|
1777
|
+
h === 0 ? /* @__PURE__ */ C(
|
|
1778
|
+
We,
|
|
1773
1779
|
{
|
|
1774
1780
|
enter: "transition transform ease-in-out duration-300",
|
|
1775
1781
|
enterFrom: "opacity-0",
|
|
@@ -1777,56 +1783,56 @@ const ar = ({ modalContext: t, config: e, children: n }) => {
|
|
|
1777
1783
|
leave: "transition transform ease-in-out duration-300",
|
|
1778
1784
|
leaveFrom: "opacity-100",
|
|
1779
1785
|
leaveTo: "opacity-0",
|
|
1780
|
-
children:
|
|
1786
|
+
children: v ? /* @__PURE__ */ C(
|
|
1781
1787
|
"div",
|
|
1782
1788
|
{
|
|
1783
1789
|
className: "im-backdrop fixed inset-0 z-30 bg-black/75",
|
|
1784
1790
|
"aria-hidden": "true"
|
|
1785
1791
|
}
|
|
1786
|
-
) : /* @__PURE__ */
|
|
1792
|
+
) : /* @__PURE__ */ C("div", {})
|
|
1787
1793
|
}
|
|
1788
1794
|
) : null,
|
|
1789
|
-
|
|
1790
|
-
E.slideover ? /* @__PURE__ */
|
|
1795
|
+
h > 0 && v ? /* @__PURE__ */ C("div", { className: "im-backdrop fixed inset-0 z-30 bg-black/75" }) : null,
|
|
1796
|
+
E.slideover ? /* @__PURE__ */ C(
|
|
1791
1797
|
ir,
|
|
1792
1798
|
{
|
|
1793
1799
|
modalContext: N,
|
|
1794
1800
|
config: E,
|
|
1795
|
-
children:
|
|
1796
|
-
afterLeave:
|
|
1801
|
+
children: p({
|
|
1802
|
+
afterLeave: w,
|
|
1797
1803
|
close: T,
|
|
1798
1804
|
config: E,
|
|
1799
1805
|
emit: c,
|
|
1800
1806
|
getChildModal: g,
|
|
1801
1807
|
getParentModal: d,
|
|
1802
1808
|
id: f,
|
|
1803
|
-
index:
|
|
1809
|
+
index: h,
|
|
1804
1810
|
isOpen: y,
|
|
1805
1811
|
modalContext: N,
|
|
1806
|
-
onTopOfStack:
|
|
1807
|
-
reload:
|
|
1812
|
+
onTopOfStack: v,
|
|
1813
|
+
reload: I,
|
|
1808
1814
|
setOpen: A,
|
|
1809
1815
|
shouldRender: H
|
|
1810
1816
|
})
|
|
1811
1817
|
}
|
|
1812
|
-
) : /* @__PURE__ */
|
|
1818
|
+
) : /* @__PURE__ */ C(
|
|
1813
1819
|
ar,
|
|
1814
1820
|
{
|
|
1815
1821
|
modalContext: N,
|
|
1816
1822
|
config: E,
|
|
1817
|
-
children:
|
|
1818
|
-
afterLeave:
|
|
1823
|
+
children: p({
|
|
1824
|
+
afterLeave: w,
|
|
1819
1825
|
close: T,
|
|
1820
1826
|
config: E,
|
|
1821
1827
|
emit: c,
|
|
1822
1828
|
getChildModal: g,
|
|
1823
1829
|
getParentModal: d,
|
|
1824
1830
|
id: f,
|
|
1825
|
-
index:
|
|
1831
|
+
index: h,
|
|
1826
1832
|
isOpen: y,
|
|
1827
1833
|
modalContext: N,
|
|
1828
|
-
onTopOfStack:
|
|
1829
|
-
reload:
|
|
1834
|
+
onTopOfStack: v,
|
|
1835
|
+
reload: I,
|
|
1830
1836
|
setOpen: A,
|
|
1831
1837
|
shouldRender: H
|
|
1832
1838
|
})
|
|
@@ -1851,47 +1857,47 @@ const br = ({
|
|
|
1851
1857
|
onAfterLeave: a = null,
|
|
1852
1858
|
onBlur: m = null,
|
|
1853
1859
|
onClose: s = null,
|
|
1854
|
-
onError:
|
|
1860
|
+
onError: p = null,
|
|
1855
1861
|
onFocus: b = null,
|
|
1856
|
-
onStart:
|
|
1862
|
+
onStart: w = null,
|
|
1857
1863
|
onSuccess: T = null,
|
|
1858
1864
|
navigate: E = null,
|
|
1859
1865
|
children: c,
|
|
1860
1866
|
...g
|
|
1861
1867
|
}) => {
|
|
1862
|
-
const [d, f] = $(!1), [
|
|
1868
|
+
const [d, f] = $(!1), [h, y] = $(null), { stack: N, visit: v } = Ae(), I = Y(() => E ?? Je("navigate"), [E]), A = {}, H = {};
|
|
1863
1869
|
Object.keys(g).forEach((u) => {
|
|
1864
1870
|
rt.includes(u) || (u.startsWith("on") && typeof g[u] == "function" ? u.toLowerCase() in window ? A[u] = g[u] : H[u] = g[u] : A[u] = g[u]);
|
|
1865
1871
|
});
|
|
1866
|
-
const [K,
|
|
1872
|
+
const [K, W] = $(!1);
|
|
1867
1873
|
D(() => {
|
|
1868
|
-
|
|
1874
|
+
h && (h.onTopOfStack && K ? b == null || b() : !h.onTopOfStack && !K && (m == null || m()), W(!h.onTopOfStack));
|
|
1869
1875
|
}, [N]);
|
|
1870
|
-
const
|
|
1876
|
+
const U = V(() => {
|
|
1871
1877
|
s == null || s();
|
|
1872
1878
|
}, [s]), O = V(() => {
|
|
1873
1879
|
y(null), a == null || a();
|
|
1874
1880
|
}, [a]), o = V(
|
|
1875
1881
|
(u) => {
|
|
1876
|
-
u == null || u.preventDefault(), !d && (t.startsWith("#") || (f(!0),
|
|
1882
|
+
u == null || u.preventDefault(), !d && (t.startsWith("#") || (f(!0), w == null || w()), v(
|
|
1877
1883
|
t,
|
|
1878
1884
|
e,
|
|
1879
1885
|
n,
|
|
1880
1886
|
i,
|
|
1881
1887
|
Gt(ft(g, rt)),
|
|
1882
|
-
() =>
|
|
1888
|
+
() => U(N.length),
|
|
1883
1889
|
O,
|
|
1884
1890
|
l,
|
|
1885
|
-
|
|
1886
|
-
).then((
|
|
1887
|
-
y(
|
|
1888
|
-
}).catch((
|
|
1889
|
-
console.error(
|
|
1891
|
+
I
|
|
1892
|
+
).then((x) => {
|
|
1893
|
+
y(x), x.registerEventListenersFromProps(H), T == null || T();
|
|
1894
|
+
}).catch((x) => {
|
|
1895
|
+
console.error(x), p == null || p(x);
|
|
1890
1896
|
}).finally(() => f(!1)));
|
|
1891
1897
|
},
|
|
1892
|
-
[t, e, n, i, l, g,
|
|
1898
|
+
[t, e, n, i, l, g, U, O]
|
|
1893
1899
|
);
|
|
1894
|
-
return /* @__PURE__ */
|
|
1900
|
+
return /* @__PURE__ */ C(
|
|
1895
1901
|
r,
|
|
1896
1902
|
{
|
|
1897
1903
|
...A,
|
|
@@ -1902,7 +1908,7 @@ const br = ({
|
|
|
1902
1908
|
);
|
|
1903
1909
|
};
|
|
1904
1910
|
function gr() {
|
|
1905
|
-
return Ae().stack[
|
|
1911
|
+
return Ae().stack[vt()] ?? null;
|
|
1906
1912
|
}
|
|
1907
1913
|
const yr = (t) => (e) => (e.default.layout = (n) => Ne(t, {}, n), e);
|
|
1908
1914
|
export {
|
|
@@ -1913,11 +1919,11 @@ export {
|
|
|
1913
1919
|
Yt as ModalStackProvider,
|
|
1914
1920
|
Je as getConfig,
|
|
1915
1921
|
Jt as initFromPageProps,
|
|
1916
|
-
|
|
1917
|
-
|
|
1922
|
+
hr as putConfig,
|
|
1923
|
+
vr as renderApp,
|
|
1918
1924
|
mr as resetConfig,
|
|
1919
1925
|
yr as setPageLayout,
|
|
1920
1926
|
gr as useModal,
|
|
1921
|
-
|
|
1927
|
+
vt as useModalIndex,
|
|
1922
1928
|
Ae as useModalStack
|
|
1923
1929
|
};
|