@kakadu/components 1.7.5 → 1.7.7
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/build/components/modal.d.ts +6 -1
- package/build/components/modal.js +5 -5
- package/build/components/modal.mjs +392 -385
- package/build/components.css +1 -1
- package/package.json +1 -1
- package/readme.md +15 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import Ie, { createContext as Ae, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as
|
|
1
|
+
import { j as N } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import Ie, { createContext as Ae, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as xe } from "react";
|
|
3
3
|
import { cx as pe } from "@kuma-ui/core";
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { a as
|
|
6
|
-
import Le from "../theme.mjs";
|
|
4
|
+
import { createPortal as _e } from "react-dom";
|
|
5
|
+
import { a as Le } from "../icon-C6X3pQX0.mjs";
|
|
7
6
|
import Be from "./text-button.mjs";
|
|
8
|
-
function
|
|
7
|
+
function ke(r) {
|
|
9
8
|
if (Object.prototype.hasOwnProperty.call(r, "__esModule")) return r;
|
|
10
9
|
var e = r.default;
|
|
11
10
|
if (typeof e == "function") {
|
|
@@ -15,8 +14,8 @@ function we(r) {
|
|
|
15
14
|
t.prototype = e.prototype;
|
|
16
15
|
} else t = {};
|
|
17
16
|
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(r).forEach(function(a) {
|
|
18
|
-
var
|
|
19
|
-
Object.defineProperty(t, a,
|
|
17
|
+
var s = Object.getOwnPropertyDescriptor(r, a);
|
|
18
|
+
Object.defineProperty(t, a, s.get ? s : {
|
|
20
19
|
enumerable: !0,
|
|
21
20
|
get: function() {
|
|
22
21
|
return r[a];
|
|
@@ -29,8 +28,8 @@ var Q = { exports: {} };
|
|
|
29
28
|
* tabbable 6.4.0
|
|
30
29
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
31
30
|
*/
|
|
32
|
-
var
|
|
33
|
-
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, oe = !
|
|
31
|
+
var Ee = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"], ie = /* @__PURE__ */ Ee.join(","), Fe = typeof Element > "u", z = Fe ? function() {
|
|
32
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, oe = !Fe && Element.prototype.getRootNode ? function(r) {
|
|
34
33
|
var e;
|
|
35
34
|
return r == null || (e = r.getRootNode) === null || e === void 0 ? void 0 : e.call(r);
|
|
36
35
|
} : function(r) {
|
|
@@ -38,59 +37,59 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
38
37
|
}, ue = function(e, t) {
|
|
39
38
|
var a;
|
|
40
39
|
t === void 0 && (t = !0);
|
|
41
|
-
var
|
|
40
|
+
var s = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), c = s === "" || s === "true", n = c || t && e && // closest does not exist on shadow roots, so we fall back to a manual
|
|
42
41
|
// lookup upward, in case it is not defined.
|
|
43
42
|
(typeof e.closest == "function" ? e.closest("[inert]") : ue(e.parentNode));
|
|
44
43
|
return n;
|
|
45
44
|
}, Me = function(e) {
|
|
46
45
|
var t, a = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
|
|
47
46
|
return a === "" || a === "true";
|
|
48
|
-
},
|
|
47
|
+
}, Se = function(e, t, a) {
|
|
49
48
|
if (ue(e))
|
|
50
49
|
return [];
|
|
51
|
-
var
|
|
52
|
-
return t &&
|
|
50
|
+
var s = Array.prototype.slice.apply(e.querySelectorAll(ie));
|
|
51
|
+
return t && z.call(e, ie) && s.unshift(e), s = s.filter(a), s;
|
|
53
52
|
}, se = function(e, t, a) {
|
|
54
|
-
for (var
|
|
55
|
-
var n =
|
|
53
|
+
for (var s = [], c = Array.from(e); c.length; ) {
|
|
54
|
+
var n = c.shift();
|
|
56
55
|
if (!ue(n, !1))
|
|
57
56
|
if (n.tagName === "SLOT") {
|
|
58
57
|
var p = n.assignedElements(), y = p.length ? p : n.children, k = se(y, !0, a);
|
|
59
|
-
a.flatten ?
|
|
58
|
+
a.flatten ? s.push.apply(s, k) : s.push({
|
|
60
59
|
scopeParent: n,
|
|
61
60
|
candidates: k
|
|
62
61
|
});
|
|
63
62
|
} else {
|
|
64
|
-
var S =
|
|
65
|
-
S && a.filter(n) && (t || !e.includes(n)) &&
|
|
63
|
+
var S = z.call(n, ie);
|
|
64
|
+
S && a.filter(n) && (t || !e.includes(n)) && s.push(n);
|
|
66
65
|
var D = n.shadowRoot || // check for an undisclosed shadow
|
|
67
66
|
typeof a.getShadowRoot == "function" && a.getShadowRoot(n), R = !ue(D, !1) && (!a.shadowRootFilter || a.shadowRootFilter(n));
|
|
68
67
|
if (D && R) {
|
|
69
|
-
var
|
|
70
|
-
a.flatten ?
|
|
68
|
+
var A = se(D === !0 ? n.children : D.children, !0, a);
|
|
69
|
+
a.flatten ? s.push.apply(s, A) : s.push({
|
|
71
70
|
scopeParent: n,
|
|
72
|
-
candidates:
|
|
71
|
+
candidates: A
|
|
73
72
|
});
|
|
74
73
|
} else
|
|
75
|
-
|
|
74
|
+
c.unshift.apply(c, n.children);
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
|
-
return
|
|
79
|
-
},
|
|
77
|
+
return s;
|
|
78
|
+
}, Oe = function(e) {
|
|
80
79
|
return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
|
|
81
|
-
},
|
|
80
|
+
}, K = function(e) {
|
|
82
81
|
if (!e)
|
|
83
82
|
throw new Error("No node provided");
|
|
84
|
-
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Me(e)) && !
|
|
83
|
+
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Me(e)) && !Oe(e) ? 0 : e.tabIndex;
|
|
85
84
|
}, Ke = function(e, t) {
|
|
86
|
-
var a =
|
|
87
|
-
return a < 0 && t && !
|
|
85
|
+
var a = K(e);
|
|
86
|
+
return a < 0 && t && !Oe(e) ? 0 : a;
|
|
88
87
|
}, qe = function(e, t) {
|
|
89
88
|
return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
|
|
90
|
-
},
|
|
89
|
+
}, De = function(e) {
|
|
91
90
|
return e.tagName === "INPUT";
|
|
92
91
|
}, Ve = function(e) {
|
|
93
|
-
return
|
|
92
|
+
return De(e) && e.type === "hidden";
|
|
94
93
|
}, $e = function(e) {
|
|
95
94
|
var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(a) {
|
|
96
95
|
return a.tagName === "SUMMARY";
|
|
@@ -105,38 +104,38 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
105
104
|
return !0;
|
|
106
105
|
var t = e.form || oe(e), a = function(p) {
|
|
107
106
|
return t.querySelectorAll('input[type="radio"][name="' + p + '"]');
|
|
108
|
-
},
|
|
107
|
+
}, s;
|
|
109
108
|
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
110
|
-
|
|
109
|
+
s = a(window.CSS.escape(e.name));
|
|
111
110
|
else
|
|
112
111
|
try {
|
|
113
|
-
|
|
112
|
+
s = a(e.name);
|
|
114
113
|
} catch (n) {
|
|
115
114
|
return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", n.message), !1;
|
|
116
115
|
}
|
|
117
|
-
var
|
|
118
|
-
return !
|
|
116
|
+
var c = Ge(s, e.form);
|
|
117
|
+
return !c || c === e;
|
|
119
118
|
}, We = function(e) {
|
|
120
|
-
return
|
|
119
|
+
return De(e) && e.type === "radio";
|
|
121
120
|
}, ze = function(e) {
|
|
122
121
|
return We(e) && !Ue(e);
|
|
123
122
|
}, Ye = function(e) {
|
|
124
|
-
var t, a = e && oe(e),
|
|
123
|
+
var t, a = e && oe(e), s = (t = a) === null || t === void 0 ? void 0 : t.host, c = !1;
|
|
125
124
|
if (a && a !== e) {
|
|
126
125
|
var n, p, y;
|
|
127
|
-
for (
|
|
126
|
+
for (c = !!((n = s) !== null && n !== void 0 && (p = n.ownerDocument) !== null && p !== void 0 && p.contains(s) || e != null && (y = e.ownerDocument) !== null && y !== void 0 && y.contains(e)); !c && s; ) {
|
|
128
127
|
var k, S, D;
|
|
129
|
-
a = oe(
|
|
128
|
+
a = oe(s), s = (k = a) === null || k === void 0 ? void 0 : k.host, c = !!((S = s) !== null && S !== void 0 && (D = S.ownerDocument) !== null && D !== void 0 && D.contains(s));
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
return
|
|
131
|
+
return c;
|
|
133
132
|
}, be = function(e) {
|
|
134
|
-
var t = e.getBoundingClientRect(), a = t.width,
|
|
135
|
-
return a === 0 &&
|
|
133
|
+
var t = e.getBoundingClientRect(), a = t.width, s = t.height;
|
|
134
|
+
return a === 0 && s === 0;
|
|
136
135
|
}, He = function(e, t) {
|
|
137
|
-
var a = t.displayCheck,
|
|
136
|
+
var a = t.displayCheck, s = t.getShadowRoot;
|
|
138
137
|
if (a === "full-native" && "checkVisibility" in e) {
|
|
139
|
-
var
|
|
138
|
+
var c = e.checkVisibility({
|
|
140
139
|
// Checking opacity might be desirable for some use cases, but natively,
|
|
141
140
|
// opacity zero elements _are_ focusable and tabbable.
|
|
142
141
|
checkOpacity: !1,
|
|
@@ -149,20 +148,20 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
149
148
|
// we include it anyway.
|
|
150
149
|
checkVisibilityCSS: !0
|
|
151
150
|
});
|
|
152
|
-
return !
|
|
151
|
+
return !c;
|
|
153
152
|
}
|
|
154
153
|
if (getComputedStyle(e).visibility === "hidden")
|
|
155
154
|
return !0;
|
|
156
|
-
var n =
|
|
157
|
-
if (
|
|
155
|
+
var n = z.call(e, "details>summary:first-of-type"), p = n ? e.parentElement : e;
|
|
156
|
+
if (z.call(p, "details:not([open]) *"))
|
|
158
157
|
return !0;
|
|
159
158
|
if (!a || a === "full" || // full-native can run this branch when it falls through in case
|
|
160
159
|
// Element#checkVisibility is unsupported
|
|
161
160
|
a === "full-native" || a === "legacy-full") {
|
|
162
|
-
if (typeof
|
|
161
|
+
if (typeof s == "function") {
|
|
163
162
|
for (var y = e; e; ) {
|
|
164
163
|
var k = e.parentElement, S = oe(e);
|
|
165
|
-
if (k && !k.shadowRoot &&
|
|
164
|
+
if (k && !k.shadowRoot && s(k) === !0)
|
|
166
165
|
return be(e);
|
|
167
166
|
e.assignedSlot ? e = e.assignedSlot : !k && S !== e.ownerDocument ? e = S.host : e = k;
|
|
168
167
|
}
|
|
@@ -180,9 +179,9 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
180
179
|
for (var t = e.parentElement; t; ) {
|
|
181
180
|
if (t.tagName === "FIELDSET" && t.disabled) {
|
|
182
181
|
for (var a = 0; a < t.children.length; a++) {
|
|
183
|
-
var
|
|
184
|
-
if (
|
|
185
|
-
return
|
|
182
|
+
var s = t.children.item(a);
|
|
183
|
+
if (s.tagName === "LEGEND")
|
|
184
|
+
return z.call(t, "fieldset[disabled] *") ? !0 : !s.contains(e);
|
|
186
185
|
}
|
|
187
186
|
return !0;
|
|
188
187
|
}
|
|
@@ -193,25 +192,25 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
193
192
|
return !(t.disabled || Ve(t) || He(t, e) || // For a details element with a summary, the summary element gets the focus
|
|
194
193
|
$e(t) || Ze(t));
|
|
195
194
|
}, de = function(e, t) {
|
|
196
|
-
return !(ze(t) ||
|
|
195
|
+
return !(ze(t) || K(t) < 0 || !ce(e, t));
|
|
197
196
|
}, Xe = function(e) {
|
|
198
197
|
var t = parseInt(e.getAttribute("tabindex"), 10);
|
|
199
198
|
return !!(isNaN(t) || t >= 0);
|
|
200
|
-
},
|
|
199
|
+
}, Ne = function(e) {
|
|
201
200
|
var t = [], a = [];
|
|
202
|
-
return e.forEach(function(
|
|
203
|
-
var n = !!
|
|
201
|
+
return e.forEach(function(s, c) {
|
|
202
|
+
var n = !!s.scopeParent, p = n ? s.scopeParent : s, y = Ke(p, n), k = n ? Ne(s.candidates) : p;
|
|
204
203
|
y === 0 ? n ? t.push.apply(t, k) : t.push(p) : a.push({
|
|
205
|
-
documentOrder:
|
|
204
|
+
documentOrder: c,
|
|
206
205
|
tabIndex: y,
|
|
207
|
-
item:
|
|
206
|
+
item: s,
|
|
208
207
|
isScope: n,
|
|
209
208
|
content: k
|
|
210
209
|
});
|
|
211
|
-
}), a.sort(qe).reduce(function(
|
|
212
|
-
return
|
|
210
|
+
}), a.sort(qe).reduce(function(s, c) {
|
|
211
|
+
return c.isScope ? s.push.apply(s, c.content) : s.push(c.content), s;
|
|
213
212
|
}, []).concat(t);
|
|
214
|
-
},
|
|
213
|
+
}, Re = function(e, t) {
|
|
215
214
|
t = t || {};
|
|
216
215
|
var a;
|
|
217
216
|
return t.getShadowRoot ? a = se([e], t.includeContainer, {
|
|
@@ -219,31 +218,31 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
219
218
|
flatten: !1,
|
|
220
219
|
getShadowRoot: t.getShadowRoot,
|
|
221
220
|
shadowRootFilter: Xe
|
|
222
|
-
}) : a =
|
|
223
|
-
},
|
|
221
|
+
}) : a = Se(e, t.includeContainer, de.bind(null, t)), Ne(a);
|
|
222
|
+
}, Pe = function(e, t) {
|
|
224
223
|
t = t || {};
|
|
225
224
|
var a;
|
|
226
225
|
return t.getShadowRoot ? a = se([e], t.includeContainer, {
|
|
227
226
|
filter: ce.bind(null, t),
|
|
228
227
|
flatten: !0,
|
|
229
228
|
getShadowRoot: t.getShadowRoot
|
|
230
|
-
}) : a =
|
|
231
|
-
},
|
|
229
|
+
}) : a = Se(e, t.includeContainer, ce.bind(null, t)), a;
|
|
230
|
+
}, W = function(e, t) {
|
|
232
231
|
if (t = t || {}, !e)
|
|
233
232
|
throw new Error("No node provided");
|
|
234
|
-
return
|
|
235
|
-
}, Je = /* @__PURE__ */
|
|
233
|
+
return z.call(e, ie) === !1 ? !1 : de(t, e);
|
|
234
|
+
}, Je = /* @__PURE__ */ Ee.concat("iframe:not([inert]):not([inert] *)").join(","), ae = function(e, t) {
|
|
236
235
|
if (t = t || {}, !e)
|
|
237
236
|
throw new Error("No node provided");
|
|
238
|
-
return
|
|
237
|
+
return z.call(e, Je) === !1 ? !1 : ce(t, e);
|
|
239
238
|
};
|
|
240
239
|
const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
241
240
|
__proto__: null,
|
|
242
|
-
focusable:
|
|
243
|
-
getTabIndex:
|
|
241
|
+
focusable: Pe,
|
|
242
|
+
getTabIndex: K,
|
|
244
243
|
isFocusable: ae,
|
|
245
|
-
isTabbable:
|
|
246
|
-
tabbable:
|
|
244
|
+
isTabbable: W,
|
|
245
|
+
tabbable: Re
|
|
247
246
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
248
247
|
/*!
|
|
249
248
|
* focus-trap 7.8.0
|
|
@@ -260,12 +259,12 @@ function et(r) {
|
|
|
260
259
|
function he(r, e) {
|
|
261
260
|
var t = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
262
261
|
if (!t) {
|
|
263
|
-
if (Array.isArray(r) || (t =
|
|
262
|
+
if (Array.isArray(r) || (t = Ce(r)) || e) {
|
|
264
263
|
t && (r = t);
|
|
265
|
-
var a = 0,
|
|
264
|
+
var a = 0, s = function() {
|
|
266
265
|
};
|
|
267
266
|
return {
|
|
268
|
-
s
|
|
267
|
+
s,
|
|
269
268
|
n: function() {
|
|
270
269
|
return a >= r.length ? {
|
|
271
270
|
done: !0
|
|
@@ -277,13 +276,13 @@ function he(r, e) {
|
|
|
277
276
|
e: function(y) {
|
|
278
277
|
throw y;
|
|
279
278
|
},
|
|
280
|
-
f:
|
|
279
|
+
f: s
|
|
281
280
|
};
|
|
282
281
|
}
|
|
283
282
|
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
284
283
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
285
284
|
}
|
|
286
|
-
var
|
|
285
|
+
var c, n = !0, p = !1;
|
|
287
286
|
return {
|
|
288
287
|
s: function() {
|
|
289
288
|
t = t.call(r);
|
|
@@ -293,13 +292,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
293
292
|
return n = y.done, y;
|
|
294
293
|
},
|
|
295
294
|
e: function(y) {
|
|
296
|
-
p = !0,
|
|
295
|
+
p = !0, c = y;
|
|
297
296
|
},
|
|
298
297
|
f: function() {
|
|
299
298
|
try {
|
|
300
299
|
n || t.return == null || t.return();
|
|
301
300
|
} finally {
|
|
302
|
-
if (p) throw
|
|
301
|
+
if (p) throw c;
|
|
303
302
|
}
|
|
304
303
|
}
|
|
305
304
|
};
|
|
@@ -323,8 +322,8 @@ function ye(r, e) {
|
|
|
323
322
|
var t = Object.keys(r);
|
|
324
323
|
if (Object.getOwnPropertySymbols) {
|
|
325
324
|
var a = Object.getOwnPropertySymbols(r);
|
|
326
|
-
e && (a = a.filter(function(
|
|
327
|
-
return Object.getOwnPropertyDescriptor(r,
|
|
325
|
+
e && (a = a.filter(function(s) {
|
|
326
|
+
return Object.getOwnPropertyDescriptor(r, s).enumerable;
|
|
328
327
|
})), t.push.apply(t, a);
|
|
329
328
|
}
|
|
330
329
|
return t;
|
|
@@ -341,7 +340,7 @@ function me(r) {
|
|
|
341
340
|
return r;
|
|
342
341
|
}
|
|
343
342
|
function nt(r) {
|
|
344
|
-
return et(r) || rt(r) ||
|
|
343
|
+
return et(r) || rt(r) || Ce(r) || at();
|
|
345
344
|
}
|
|
346
345
|
function it(r, e) {
|
|
347
346
|
if (typeof r != "object" || !r) return r;
|
|
@@ -357,7 +356,7 @@ function ot(r) {
|
|
|
357
356
|
var e = it(r, "string");
|
|
358
357
|
return typeof e == "symbol" ? e : e + "";
|
|
359
358
|
}
|
|
360
|
-
function
|
|
359
|
+
function Ce(r, e) {
|
|
361
360
|
if (r) {
|
|
362
361
|
if (typeof r == "string") return ve(r, e);
|
|
363
362
|
var t = {}.toString.call(r).slice(8, -1);
|
|
@@ -373,8 +372,8 @@ var B = {
|
|
|
373
372
|
activateTrap: function(e, t) {
|
|
374
373
|
var a = B.getActiveTrap(e);
|
|
375
374
|
t !== a && B.pauseTrap(e);
|
|
376
|
-
var
|
|
377
|
-
|
|
375
|
+
var s = e.indexOf(t);
|
|
376
|
+
s === -1 || e.splice(s, 1), e.push(t);
|
|
378
377
|
},
|
|
379
378
|
// Removes the trap from the top of the stack, then unpauses the next trap down.
|
|
380
379
|
deactivateTrap: function(e, t) {
|
|
@@ -404,13 +403,13 @@ var B = {
|
|
|
404
403
|
}, ge = function(e) {
|
|
405
404
|
return setTimeout(e, 0);
|
|
406
405
|
}, Z = function(e) {
|
|
407
|
-
for (var t = arguments.length, a = new Array(t > 1 ? t - 1 : 0),
|
|
408
|
-
a[
|
|
406
|
+
for (var t = arguments.length, a = new Array(t > 1 ? t - 1 : 0), s = 1; s < t; s++)
|
|
407
|
+
a[s - 1] = arguments[s];
|
|
409
408
|
return typeof e == "function" ? e.apply(void 0, a) : e;
|
|
410
409
|
}, ee = function(e) {
|
|
411
410
|
return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
|
|
412
411
|
}, ft = [], dt = function(e, t) {
|
|
413
|
-
var a = (t == null ? void 0 : t.document) || document,
|
|
412
|
+
var a = (t == null ? void 0 : t.document) || document, s = (t == null ? void 0 : t.trapStack) || ft, c = me({
|
|
414
413
|
returnFocusOnDeactivate: !0,
|
|
415
414
|
escapeDeactivates: !0,
|
|
416
415
|
delayInitialFocus: !0,
|
|
@@ -461,23 +460,23 @@ var B = {
|
|
|
461
460
|
delayInitialFocusTimer: void 0,
|
|
462
461
|
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
463
462
|
recentNavEvent: void 0
|
|
464
|
-
}, p, y = function(o, i,
|
|
465
|
-
return o && o[i] !== void 0 ? o[i] : l
|
|
463
|
+
}, p, y = function(o, i, l) {
|
|
464
|
+
return o && o[i] !== void 0 ? o[i] : c[l || i];
|
|
466
465
|
}, k = function(o, i) {
|
|
467
|
-
var
|
|
466
|
+
var l = typeof (i == null ? void 0 : i.composedPath) == "function" ? i.composedPath() : void 0;
|
|
468
467
|
return n.containerGroups.findIndex(function(g) {
|
|
469
|
-
var h = g.container,
|
|
468
|
+
var h = g.container, w = g.tabbableNodes;
|
|
470
469
|
return h.contains(o) || // fall back to explicit tabbable search which will take into consideration any
|
|
471
470
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
472
471
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
473
472
|
// look inside web components even if open)
|
|
474
|
-
(
|
|
473
|
+
(l == null ? void 0 : l.includes(h)) || w.find(function(v) {
|
|
475
474
|
return v === o;
|
|
476
475
|
});
|
|
477
476
|
});
|
|
478
477
|
}, S = function(o) {
|
|
479
|
-
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
|
480
|
-
if (typeof v == "function" && (v = v.apply(void 0, nt(
|
|
478
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, l = i.hasFallback, g = l === void 0 ? !1 : l, h = i.params, w = h === void 0 ? [] : h, v = c[o];
|
|
479
|
+
if (typeof v == "function" && (v = v.apply(void 0, nt(w))), v === !0 && (v = void 0), !v) {
|
|
481
480
|
if (v === void 0 || v === !1)
|
|
482
481
|
return v;
|
|
483
482
|
throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
|
|
@@ -499,12 +498,12 @@ var B = {
|
|
|
499
498
|
});
|
|
500
499
|
if (o === !1)
|
|
501
500
|
return !1;
|
|
502
|
-
if (o === void 0 || o && !ae(o,
|
|
501
|
+
if (o === void 0 || o && !ae(o, c.tabbableOptions))
|
|
503
502
|
if (k(a.activeElement) >= 0)
|
|
504
503
|
o = a.activeElement;
|
|
505
504
|
else {
|
|
506
|
-
var i = n.tabbableGroups[0],
|
|
507
|
-
o =
|
|
505
|
+
var i = n.tabbableGroups[0], l = i && i.firstTabbableNode;
|
|
506
|
+
o = l || S("fallbackFocus");
|
|
508
507
|
}
|
|
509
508
|
else o === null && (o = S("fallbackFocus"));
|
|
510
509
|
if (!o)
|
|
@@ -512,17 +511,17 @@ var B = {
|
|
|
512
511
|
return o;
|
|
513
512
|
}, R = function() {
|
|
514
513
|
if (n.containerGroups = n.containers.map(function(o) {
|
|
515
|
-
var i =
|
|
516
|
-
return
|
|
517
|
-
}), v =
|
|
518
|
-
return
|
|
514
|
+
var i = Re(o, c.tabbableOptions), l = Pe(o, c.tabbableOptions), g = i.length > 0 ? i[0] : void 0, h = i.length > 0 ? i[i.length - 1] : void 0, w = l.find(function(F) {
|
|
515
|
+
return W(F);
|
|
516
|
+
}), v = l.slice().reverse().find(function(F) {
|
|
517
|
+
return W(F);
|
|
519
518
|
}), E = !!i.find(function(F) {
|
|
520
|
-
return
|
|
519
|
+
return K(F) > 0;
|
|
521
520
|
});
|
|
522
521
|
return {
|
|
523
522
|
container: o,
|
|
524
523
|
tabbableNodes: i,
|
|
525
|
-
focusableNodes:
|
|
524
|
+
focusableNodes: l,
|
|
526
525
|
/** True if at least one node with positive `tabindex` was found in this container. */
|
|
527
526
|
posTabIndexesFound: E,
|
|
528
527
|
/** First tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
@@ -537,7 +536,7 @@ var B = {
|
|
|
537
536
|
// "close enough most of the time" alternative for positive tabindexes which should generally
|
|
538
537
|
// be avoided anyway...
|
|
539
538
|
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
540
|
-
firstDomTabbableNode:
|
|
539
|
+
firstDomTabbableNode: w,
|
|
541
540
|
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
542
541
|
lastDomTabbableNode: v,
|
|
543
542
|
/**
|
|
@@ -548,13 +547,13 @@ var B = {
|
|
|
548
547
|
* in reverse.
|
|
549
548
|
* @returns {HTMLElement|undefined} The next tabbable node, if any.
|
|
550
549
|
*/
|
|
551
|
-
nextTabbableNode: function(
|
|
552
|
-
var
|
|
553
|
-
return
|
|
554
|
-
return U
|
|
555
|
-
}) :
|
|
556
|
-
return U
|
|
557
|
-
}) : i[
|
|
550
|
+
nextTabbableNode: function(j) {
|
|
551
|
+
var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, x = i.indexOf(j);
|
|
552
|
+
return x < 0 ? _ ? l.slice(l.indexOf(j) + 1).find(function(U) {
|
|
553
|
+
return W(U);
|
|
554
|
+
}) : l.slice(0, l.indexOf(j)).reverse().find(function(U) {
|
|
555
|
+
return W(U);
|
|
556
|
+
}) : i[x + (_ ? 1 : -1)];
|
|
558
557
|
}
|
|
559
558
|
};
|
|
560
559
|
}), n.tabbableGroups = n.containerGroups.filter(function(o) {
|
|
@@ -565,59 +564,59 @@ var B = {
|
|
|
565
564
|
return o.posTabIndexesFound;
|
|
566
565
|
}) && n.containerGroups.length > 1)
|
|
567
566
|
throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
|
|
568
|
-
},
|
|
567
|
+
}, A = function(o) {
|
|
569
568
|
var i = o.activeElement;
|
|
570
569
|
if (i)
|
|
571
|
-
return i.shadowRoot && i.shadowRoot.activeElement !== null ?
|
|
572
|
-
},
|
|
573
|
-
if (o !== !1 && o !==
|
|
570
|
+
return i.shadowRoot && i.shadowRoot.activeElement !== null ? A(i.shadowRoot) : i;
|
|
571
|
+
}, P = function(o) {
|
|
572
|
+
if (o !== !1 && o !== A(document)) {
|
|
574
573
|
if (!o || !o.focus) {
|
|
575
|
-
|
|
574
|
+
P(D());
|
|
576
575
|
return;
|
|
577
576
|
}
|
|
578
577
|
o.focus({
|
|
579
|
-
preventScroll: !!
|
|
578
|
+
preventScroll: !!c.preventScroll
|
|
580
579
|
}), n.mostRecentlyFocusedNode = o, ut(o) && o.select();
|
|
581
580
|
}
|
|
582
|
-
},
|
|
581
|
+
}, Y = function(o) {
|
|
583
582
|
var i = S("setReturnFocus", {
|
|
584
583
|
params: [o]
|
|
585
584
|
});
|
|
586
585
|
return i || (i === !1 ? !1 : o);
|
|
587
|
-
},
|
|
588
|
-
var i = o.target,
|
|
589
|
-
i = i || ee(
|
|
590
|
-
var
|
|
586
|
+
}, C = function(o) {
|
|
587
|
+
var i = o.target, l = o.event, g = o.isBackward, h = g === void 0 ? !1 : g;
|
|
588
|
+
i = i || ee(l), R();
|
|
589
|
+
var w = null;
|
|
591
590
|
if (n.tabbableGroups.length > 0) {
|
|
592
|
-
var v = k(i,
|
|
591
|
+
var v = k(i, l), E = v >= 0 ? n.containerGroups[v] : void 0;
|
|
593
592
|
if (v < 0)
|
|
594
|
-
h ?
|
|
593
|
+
h ? w = n.tabbableGroups[n.tabbableGroups.length - 1].lastTabbableNode : w = n.tabbableGroups[0].firstTabbableNode;
|
|
595
594
|
else if (h) {
|
|
596
595
|
var F = n.tabbableGroups.findIndex(function(le) {
|
|
597
596
|
var fe = le.firstTabbableNode;
|
|
598
597
|
return i === fe;
|
|
599
598
|
});
|
|
600
|
-
if (F < 0 && (E.container === i || ae(i,
|
|
601
|
-
var
|
|
602
|
-
|
|
603
|
-
} else X(
|
|
599
|
+
if (F < 0 && (E.container === i || ae(i, c.tabbableOptions) && !W(i, c.tabbableOptions) && !E.nextTabbableNode(i, !1)) && (F = v), F >= 0) {
|
|
600
|
+
var j = F === 0 ? n.tabbableGroups.length - 1 : F - 1, _ = n.tabbableGroups[j];
|
|
601
|
+
w = K(i) >= 0 ? _.lastTabbableNode : _.lastDomTabbableNode;
|
|
602
|
+
} else X(l) || (w = E.nextTabbableNode(i, !1));
|
|
604
603
|
} else {
|
|
605
|
-
var
|
|
604
|
+
var x = n.tabbableGroups.findIndex(function(le) {
|
|
606
605
|
var fe = le.lastTabbableNode;
|
|
607
606
|
return i === fe;
|
|
608
607
|
});
|
|
609
|
-
if (
|
|
610
|
-
var
|
|
611
|
-
|
|
612
|
-
} else X(
|
|
608
|
+
if (x < 0 && (E.container === i || ae(i, c.tabbableOptions) && !W(i, c.tabbableOptions) && !E.nextTabbableNode(i)) && (x = v), x >= 0) {
|
|
609
|
+
var U = x === n.tabbableGroups.length - 1 ? 0 : x + 1, M = n.tabbableGroups[U];
|
|
610
|
+
w = K(i) >= 0 ? M.firstTabbableNode : M.firstDomTabbableNode;
|
|
611
|
+
} else X(l) || (w = E.nextTabbableNode(i));
|
|
613
612
|
}
|
|
614
613
|
} else
|
|
615
|
-
|
|
616
|
-
return
|
|
617
|
-
},
|
|
614
|
+
w = S("fallbackFocus");
|
|
615
|
+
return w;
|
|
616
|
+
}, I = function(o) {
|
|
618
617
|
var i = ee(o);
|
|
619
618
|
if (!(k(i, o) >= 0)) {
|
|
620
|
-
if (Z(
|
|
619
|
+
if (Z(c.clickOutsideDeactivates, o)) {
|
|
621
620
|
p.deactivate({
|
|
622
621
|
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
623
622
|
// which will result in the outside click setting focus to the node
|
|
@@ -625,123 +624,123 @@ var B = {
|
|
|
625
624
|
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
626
625
|
// on activation (or the configured `setReturnFocus` node), whether the
|
|
627
626
|
// outside click was on a focusable node or not
|
|
628
|
-
returnFocus:
|
|
627
|
+
returnFocus: c.returnFocusOnDeactivate
|
|
629
628
|
});
|
|
630
629
|
return;
|
|
631
630
|
}
|
|
632
|
-
Z(
|
|
631
|
+
Z(c.allowOutsideClick, o) || o.preventDefault();
|
|
633
632
|
}
|
|
634
|
-
},
|
|
635
|
-
var i = ee(o),
|
|
636
|
-
if (
|
|
637
|
-
|
|
633
|
+
}, q = function(o) {
|
|
634
|
+
var i = ee(o), l = k(i, o) >= 0;
|
|
635
|
+
if (l || i instanceof Document)
|
|
636
|
+
l && (n.mostRecentlyFocusedNode = i);
|
|
638
637
|
else {
|
|
639
638
|
o.stopImmediatePropagation();
|
|
640
639
|
var g, h = !0;
|
|
641
640
|
if (n.mostRecentlyFocusedNode)
|
|
642
|
-
if (
|
|
643
|
-
var
|
|
641
|
+
if (K(n.mostRecentlyFocusedNode) > 0) {
|
|
642
|
+
var w = k(n.mostRecentlyFocusedNode), v = n.containerGroups[w].tabbableNodes;
|
|
644
643
|
if (v.length > 0) {
|
|
645
644
|
var E = v.findIndex(function(F) {
|
|
646
645
|
return F === n.mostRecentlyFocusedNode;
|
|
647
646
|
});
|
|
648
|
-
E >= 0 && (
|
|
647
|
+
E >= 0 && (c.isKeyForward(n.recentNavEvent) ? E + 1 < v.length && (g = v[E + 1], h = !1) : E - 1 >= 0 && (g = v[E - 1], h = !1));
|
|
649
648
|
}
|
|
650
649
|
} else
|
|
651
650
|
n.containerGroups.some(function(F) {
|
|
652
|
-
return F.tabbableNodes.some(function(
|
|
653
|
-
return
|
|
651
|
+
return F.tabbableNodes.some(function(j) {
|
|
652
|
+
return K(j) > 0;
|
|
654
653
|
});
|
|
655
654
|
}) || (h = !1);
|
|
656
655
|
else
|
|
657
656
|
h = !1;
|
|
658
|
-
h && (g =
|
|
657
|
+
h && (g = C({
|
|
659
658
|
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
660
659
|
// outside the trap causing the focus escape we're trying to fix)
|
|
661
660
|
target: n.mostRecentlyFocusedNode,
|
|
662
|
-
isBackward:
|
|
663
|
-
})),
|
|
661
|
+
isBackward: c.isKeyBackward(n.recentNavEvent)
|
|
662
|
+
})), P(g || n.mostRecentlyFocusedNode || D());
|
|
664
663
|
}
|
|
665
664
|
n.recentNavEvent = void 0;
|
|
666
|
-
},
|
|
665
|
+
}, V = function(o) {
|
|
667
666
|
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
668
667
|
n.recentNavEvent = o;
|
|
669
|
-
var
|
|
668
|
+
var l = C({
|
|
670
669
|
event: o,
|
|
671
670
|
isBackward: i
|
|
672
671
|
});
|
|
673
|
-
|
|
672
|
+
l && (X(o) && o.preventDefault(), P(l));
|
|
674
673
|
}, $ = function(o) {
|
|
675
|
-
(
|
|
676
|
-
},
|
|
677
|
-
st(o) && Z(
|
|
678
|
-
},
|
|
674
|
+
(c.isKeyForward(o) || c.isKeyBackward(o)) && V(o, c.isKeyBackward(o));
|
|
675
|
+
}, G = function(o) {
|
|
676
|
+
st(o) && Z(c.escapeDeactivates, o) !== !1 && (o.preventDefault(), p.deactivate());
|
|
677
|
+
}, L = function(o) {
|
|
679
678
|
var i = ee(o);
|
|
680
|
-
k(i, o) >= 0 || Z(
|
|
679
|
+
k(i, o) >= 0 || Z(c.clickOutsideDeactivates, o) || Z(c.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
|
|
681
680
|
}, d = function() {
|
|
682
681
|
if (n.active)
|
|
683
|
-
return B.activateTrap(
|
|
684
|
-
|
|
685
|
-
}) :
|
|
682
|
+
return B.activateTrap(s, p), n.delayInitialFocusTimer = c.delayInitialFocus ? ge(function() {
|
|
683
|
+
P(D());
|
|
684
|
+
}) : P(D()), a.addEventListener("focusin", q, !0), a.addEventListener("mousedown", I, {
|
|
686
685
|
capture: !0,
|
|
687
686
|
passive: !1
|
|
688
|
-
}), a.addEventListener("touchstart",
|
|
687
|
+
}), a.addEventListener("touchstart", I, {
|
|
689
688
|
capture: !0,
|
|
690
689
|
passive: !1
|
|
691
|
-
}), a.addEventListener("click",
|
|
690
|
+
}), a.addEventListener("click", L, {
|
|
692
691
|
capture: !0,
|
|
693
692
|
passive: !1
|
|
694
693
|
}), a.addEventListener("keydown", $, {
|
|
695
694
|
capture: !0,
|
|
696
695
|
passive: !1
|
|
697
|
-
}), a.addEventListener("keydown",
|
|
698
|
-
},
|
|
696
|
+
}), a.addEventListener("keydown", G), p;
|
|
697
|
+
}, f = function(o) {
|
|
699
698
|
n.active && !n.paused && p._setSubtreeIsolation(!1), n.adjacentElements.clear(), n.alreadySilent.clear();
|
|
700
|
-
var i = /* @__PURE__ */ new Set(),
|
|
699
|
+
var i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), g = he(o), h;
|
|
701
700
|
try {
|
|
702
701
|
for (g.s(); !(h = g.n()).done; ) {
|
|
703
|
-
var
|
|
704
|
-
i.add(
|
|
705
|
-
for (var v = typeof ShadowRoot < "u" &&
|
|
702
|
+
var w = h.value;
|
|
703
|
+
i.add(w);
|
|
704
|
+
for (var v = typeof ShadowRoot < "u" && w.getRootNode() instanceof ShadowRoot, E = w; E; ) {
|
|
706
705
|
i.add(E);
|
|
707
|
-
var F = E.parentElement,
|
|
708
|
-
F ?
|
|
709
|
-
var
|
|
706
|
+
var F = E.parentElement, j = [];
|
|
707
|
+
F ? j = F.children : !F && v && (j = E.getRootNode().children, F = E.getRootNode().host, v = typeof ShadowRoot < "u" && F.getRootNode() instanceof ShadowRoot);
|
|
708
|
+
var _ = he(j), x;
|
|
710
709
|
try {
|
|
711
|
-
for (
|
|
712
|
-
var
|
|
713
|
-
|
|
710
|
+
for (_.s(); !(x = _.n()).done; ) {
|
|
711
|
+
var U = x.value;
|
|
712
|
+
l.add(U);
|
|
714
713
|
}
|
|
715
|
-
} catch (
|
|
716
|
-
|
|
714
|
+
} catch (M) {
|
|
715
|
+
_.e(M);
|
|
717
716
|
} finally {
|
|
718
|
-
|
|
717
|
+
_.f();
|
|
719
718
|
}
|
|
720
719
|
E = F;
|
|
721
720
|
}
|
|
722
721
|
}
|
|
723
|
-
} catch (
|
|
724
|
-
g.e(
|
|
722
|
+
} catch (M) {
|
|
723
|
+
g.e(M);
|
|
725
724
|
} finally {
|
|
726
725
|
g.f();
|
|
727
726
|
}
|
|
728
|
-
i.forEach(function(
|
|
729
|
-
|
|
730
|
-
}), n.adjacentElements =
|
|
727
|
+
i.forEach(function(M) {
|
|
728
|
+
l.delete(M);
|
|
729
|
+
}), n.adjacentElements = l;
|
|
731
730
|
}, m = function() {
|
|
732
731
|
if (n.active)
|
|
733
|
-
return a.removeEventListener("focusin",
|
|
734
|
-
},
|
|
735
|
-
var i = o.some(function(
|
|
736
|
-
var g = Array.from(
|
|
732
|
+
return a.removeEventListener("focusin", q, !0), a.removeEventListener("mousedown", I, !0), a.removeEventListener("touchstart", I, !0), a.removeEventListener("click", L, !0), a.removeEventListener("keydown", $, !0), a.removeEventListener("keydown", G), p;
|
|
733
|
+
}, u = function(o) {
|
|
734
|
+
var i = o.some(function(l) {
|
|
735
|
+
var g = Array.from(l.removedNodes);
|
|
737
736
|
return g.some(function(h) {
|
|
738
737
|
return h === n.mostRecentlyFocusedNode;
|
|
739
738
|
});
|
|
740
739
|
});
|
|
741
|
-
i &&
|
|
742
|
-
},
|
|
743
|
-
|
|
744
|
-
|
|
740
|
+
i && P(D());
|
|
741
|
+
}, T = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(u) : void 0, O = function() {
|
|
742
|
+
T && (T.disconnect(), n.active && !n.paused && n.containers.map(function(o) {
|
|
743
|
+
T.observe(o, {
|
|
745
744
|
subtree: !0,
|
|
746
745
|
childList: !0
|
|
747
746
|
});
|
|
@@ -757,25 +756,25 @@ var B = {
|
|
|
757
756
|
activate: function(o) {
|
|
758
757
|
if (n.active)
|
|
759
758
|
return this;
|
|
760
|
-
var i = y(o, "onActivate"),
|
|
759
|
+
var i = y(o, "onActivate"), l = y(o, "onPostActivate"), g = y(o, "checkCanFocusTrap"), h = B.getActiveTrap(s), w = !1;
|
|
761
760
|
if (h && !h.paused) {
|
|
762
761
|
var v;
|
|
763
|
-
(v = h._setSubtreeIsolation) === null || v === void 0 || v.call(h, !1),
|
|
762
|
+
(v = h._setSubtreeIsolation) === null || v === void 0 || v.call(h, !1), w = !0;
|
|
764
763
|
}
|
|
765
764
|
try {
|
|
766
|
-
g || R(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation =
|
|
765
|
+
g || R(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation = A(a), i == null || i();
|
|
767
766
|
var E = function() {
|
|
768
|
-
g && R(), d(), O(),
|
|
767
|
+
g && R(), d(), O(), c.isolateSubtrees && p._setSubtreeIsolation(!0), l == null || l();
|
|
769
768
|
};
|
|
770
769
|
if (g)
|
|
771
770
|
return g(n.containers.concat()).then(E, E), this;
|
|
772
771
|
E();
|
|
773
|
-
} catch (
|
|
774
|
-
if (h === B.getActiveTrap(
|
|
772
|
+
} catch (j) {
|
|
773
|
+
if (h === B.getActiveTrap(s) && w) {
|
|
775
774
|
var F;
|
|
776
775
|
(F = h._setSubtreeIsolation) === null || F === void 0 || F.call(h, !0);
|
|
777
776
|
}
|
|
778
|
-
throw
|
|
777
|
+
throw j;
|
|
779
778
|
}
|
|
780
779
|
return this;
|
|
781
780
|
},
|
|
@@ -783,31 +782,31 @@ var B = {
|
|
|
783
782
|
if (!n.active)
|
|
784
783
|
return this;
|
|
785
784
|
var i = me({
|
|
786
|
-
onDeactivate:
|
|
787
|
-
onPostDeactivate:
|
|
788
|
-
checkCanReturnFocus:
|
|
785
|
+
onDeactivate: c.onDeactivate,
|
|
786
|
+
onPostDeactivate: c.onPostDeactivate,
|
|
787
|
+
checkCanReturnFocus: c.checkCanReturnFocus
|
|
789
788
|
}, o);
|
|
790
|
-
clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, n.paused || p._setSubtreeIsolation(!1), n.alreadySilent.clear(), m(), n.active = !1, n.paused = !1, O(), B.deactivateTrap(
|
|
791
|
-
var
|
|
792
|
-
|
|
789
|
+
clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, n.paused || p._setSubtreeIsolation(!1), n.alreadySilent.clear(), m(), n.active = !1, n.paused = !1, O(), B.deactivateTrap(s, p);
|
|
790
|
+
var l = y(i, "onDeactivate"), g = y(i, "onPostDeactivate"), h = y(i, "checkCanReturnFocus"), w = y(i, "returnFocus", "returnFocusOnDeactivate");
|
|
791
|
+
l == null || l();
|
|
793
792
|
var v = function() {
|
|
794
793
|
ge(function() {
|
|
795
|
-
|
|
794
|
+
w && P(Y(n.nodeFocusedBeforeActivation)), g == null || g();
|
|
796
795
|
});
|
|
797
796
|
};
|
|
798
|
-
return
|
|
797
|
+
return w && h ? (h(Y(n.nodeFocusedBeforeActivation)).then(v, v), this) : (v(), this);
|
|
799
798
|
},
|
|
800
799
|
pause: function(o) {
|
|
801
800
|
return n.active ? (n.manuallyPaused = !0, this._setPausedState(!0, o)) : this;
|
|
802
801
|
},
|
|
803
802
|
unpause: function(o) {
|
|
804
|
-
return n.active ? (n.manuallyPaused = !1,
|
|
803
|
+
return n.active ? (n.manuallyPaused = !1, s[s.length - 1] !== this ? this : this._setPausedState(!1, o)) : this;
|
|
805
804
|
},
|
|
806
805
|
updateContainerElements: function(o) {
|
|
807
806
|
var i = [].concat(o).filter(Boolean);
|
|
808
|
-
return n.containers = i.map(function(
|
|
809
|
-
return typeof
|
|
810
|
-
}),
|
|
807
|
+
return n.containers = i.map(function(l) {
|
|
808
|
+
return typeof l == "string" ? a.querySelector(l) : l;
|
|
809
|
+
}), c.isolateSubtrees && f(n.containers), n.active && (R(), c.isolateSubtrees && !n.paused && p._setSubtreeIsolation(!0)), O(), this;
|
|
811
810
|
}
|
|
812
811
|
}, Object.defineProperties(p, {
|
|
813
812
|
_isManuallyPaused: {
|
|
@@ -820,29 +819,29 @@ var B = {
|
|
|
820
819
|
if (n.paused === o)
|
|
821
820
|
return this;
|
|
822
821
|
if (n.paused = o, o) {
|
|
823
|
-
var
|
|
824
|
-
|
|
822
|
+
var l = y(i, "onPause"), g = y(i, "onPostPause");
|
|
823
|
+
l == null || l(), m(), O(), p._setSubtreeIsolation(!1), g == null || g();
|
|
825
824
|
} else {
|
|
826
|
-
var h = y(i, "onUnpause"),
|
|
827
|
-
h == null || h(), p._setSubtreeIsolation(!0), R(), d(), O(),
|
|
825
|
+
var h = y(i, "onUnpause"), w = y(i, "onPostUnpause");
|
|
826
|
+
h == null || h(), p._setSubtreeIsolation(!0), R(), d(), O(), w == null || w();
|
|
828
827
|
}
|
|
829
828
|
return this;
|
|
830
829
|
}
|
|
831
830
|
},
|
|
832
831
|
_setSubtreeIsolation: {
|
|
833
832
|
value: function(o) {
|
|
834
|
-
|
|
835
|
-
var
|
|
833
|
+
c.isolateSubtrees && n.adjacentElements.forEach(function(i) {
|
|
834
|
+
var l;
|
|
836
835
|
if (o)
|
|
837
|
-
switch (
|
|
836
|
+
switch (c.isolateSubtrees) {
|
|
838
837
|
case "aria-hidden":
|
|
839
|
-
(i.ariaHidden === "true" || ((
|
|
838
|
+
(i.ariaHidden === "true" || ((l = i.getAttribute("aria-hidden")) === null || l === void 0 ? void 0 : l.toLowerCase()) === "true") && n.alreadySilent.add(i), i.setAttribute("aria-hidden", "true");
|
|
840
839
|
break;
|
|
841
840
|
default:
|
|
842
841
|
(i.inert || i.hasAttribute("inert")) && n.alreadySilent.add(i), i.setAttribute("inert", !0);
|
|
843
842
|
break;
|
|
844
843
|
}
|
|
845
|
-
else if (!n.alreadySilent.has(i)) switch (
|
|
844
|
+
else if (!n.alreadySilent.has(i)) switch (c.isolateSubtrees) {
|
|
846
845
|
case "aria-hidden":
|
|
847
846
|
i.removeAttribute("aria-hidden");
|
|
848
847
|
break;
|
|
@@ -858,38 +857,38 @@ var B = {
|
|
|
858
857
|
const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
859
858
|
__proto__: null,
|
|
860
859
|
createFocusTrap: dt
|
|
861
|
-
}, Symbol.toStringTag, { value: "Module" })), pt = /* @__PURE__ */
|
|
860
|
+
}, Symbol.toStringTag, { value: "Module" })), pt = /* @__PURE__ */ ke(vt), bt = /* @__PURE__ */ ke(Qe);
|
|
862
861
|
var Te;
|
|
863
862
|
function ht() {
|
|
864
863
|
if (Te) return Q.exports;
|
|
865
864
|
Te = 1;
|
|
866
865
|
function r(d) {
|
|
867
866
|
"@babel/helpers - typeof";
|
|
868
|
-
return r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(
|
|
869
|
-
return typeof
|
|
870
|
-
} : function(
|
|
871
|
-
return
|
|
867
|
+
return r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(f) {
|
|
868
|
+
return typeof f;
|
|
869
|
+
} : function(f) {
|
|
870
|
+
return f && typeof Symbol == "function" && f.constructor === Symbol && f !== Symbol.prototype ? "symbol" : typeof f;
|
|
872
871
|
}, r(d);
|
|
873
872
|
}
|
|
874
873
|
var e, t;
|
|
875
|
-
function a(d,
|
|
876
|
-
if (!(d instanceof
|
|
874
|
+
function a(d, f) {
|
|
875
|
+
if (!(d instanceof f)) throw new TypeError("Cannot call a class as a function");
|
|
877
876
|
}
|
|
878
|
-
function
|
|
879
|
-
for (var m = 0; m <
|
|
880
|
-
var
|
|
881
|
-
|
|
877
|
+
function s(d, f) {
|
|
878
|
+
for (var m = 0; m < f.length; m++) {
|
|
879
|
+
var u = f[m];
|
|
880
|
+
u.enumerable = u.enumerable || !1, u.configurable = !0, "value" in u && (u.writable = !0), Object.defineProperty(d, P(u.key), u);
|
|
882
881
|
}
|
|
883
882
|
}
|
|
884
|
-
function
|
|
885
|
-
return
|
|
883
|
+
function c(d, f, m) {
|
|
884
|
+
return f && s(d.prototype, f), Object.defineProperty(d, "prototype", { writable: !1 }), d;
|
|
886
885
|
}
|
|
887
|
-
function n(d,
|
|
888
|
-
return
|
|
886
|
+
function n(d, f, m) {
|
|
887
|
+
return f = S(f), p(d, k() ? Reflect.construct(f, m || [], S(d).constructor) : f.apply(d, m));
|
|
889
888
|
}
|
|
890
|
-
function p(d,
|
|
891
|
-
if (
|
|
892
|
-
if (
|
|
889
|
+
function p(d, f) {
|
|
890
|
+
if (f && (r(f) == "object" || typeof f == "function")) return f;
|
|
891
|
+
if (f !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
893
892
|
return y(d);
|
|
894
893
|
}
|
|
895
894
|
function y(d) {
|
|
@@ -907,43 +906,43 @@ function ht() {
|
|
|
907
906
|
})();
|
|
908
907
|
}
|
|
909
908
|
function S(d) {
|
|
910
|
-
return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(
|
|
911
|
-
return
|
|
909
|
+
return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(f) {
|
|
910
|
+
return f.__proto__ || Object.getPrototypeOf(f);
|
|
912
911
|
}, S(d);
|
|
913
912
|
}
|
|
914
|
-
function D(d,
|
|
915
|
-
if (typeof
|
|
916
|
-
d.prototype = Object.create(
|
|
913
|
+
function D(d, f) {
|
|
914
|
+
if (typeof f != "function" && f !== null) throw new TypeError("Super expression must either be null or a function");
|
|
915
|
+
d.prototype = Object.create(f && f.prototype, { constructor: { value: d, writable: !0, configurable: !0 } }), Object.defineProperty(d, "prototype", { writable: !1 }), f && R(d, f);
|
|
917
916
|
}
|
|
918
|
-
function R(d,
|
|
919
|
-
return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m,
|
|
920
|
-
return m.__proto__ =
|
|
921
|
-
}, R(d,
|
|
917
|
+
function R(d, f) {
|
|
918
|
+
return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, u) {
|
|
919
|
+
return m.__proto__ = u, m;
|
|
920
|
+
}, R(d, f);
|
|
922
921
|
}
|
|
923
|
-
function
|
|
924
|
-
return (
|
|
922
|
+
function A(d, f, m) {
|
|
923
|
+
return (f = P(f)) in d ? Object.defineProperty(d, f, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : d[f] = m, d;
|
|
925
924
|
}
|
|
926
|
-
function
|
|
927
|
-
var
|
|
928
|
-
return r(
|
|
925
|
+
function P(d) {
|
|
926
|
+
var f = Y(d, "string");
|
|
927
|
+
return r(f) == "symbol" ? f : f + "";
|
|
929
928
|
}
|
|
930
|
-
function
|
|
929
|
+
function Y(d, f) {
|
|
931
930
|
if (r(d) != "object" || !d) return d;
|
|
932
931
|
var m = d[Symbol.toPrimitive];
|
|
933
932
|
if (m !== void 0) {
|
|
934
|
-
var
|
|
935
|
-
if (r(
|
|
933
|
+
var u = m.call(d, f);
|
|
934
|
+
if (r(u) != "object") return u;
|
|
936
935
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
937
936
|
}
|
|
938
|
-
return (
|
|
937
|
+
return (f === "string" ? String : Number)(d);
|
|
939
938
|
}
|
|
940
|
-
var
|
|
941
|
-
function
|
|
942
|
-
var
|
|
943
|
-
a(this,
|
|
939
|
+
var C = Ie, I = pt, q = I.createFocusTrap, V = bt, $ = V.isFocusable, G = parseInt((e = (t = /^(\d+)\./.exec(C.version)) === null || t === void 0 ? void 0 : t[1]) !== null && e !== void 0 ? e : 0, 10), L = /* @__PURE__ */ (function(d) {
|
|
940
|
+
function f(m) {
|
|
941
|
+
var u;
|
|
942
|
+
a(this, f), u = n(this, f, [m]), A(u, "getNodeForOption", function(b) {
|
|
944
943
|
var o, i = (o = this.internalOptions[b]) !== null && o !== void 0 ? o : this.originalOptions[b];
|
|
945
944
|
if (typeof i == "function") {
|
|
946
|
-
for (var
|
|
945
|
+
for (var l = arguments.length, g = new Array(l > 1 ? l - 1 : 0), h = 1; h < l; h++)
|
|
947
946
|
g[h - 1] = arguments[h];
|
|
948
947
|
i = i.apply(void 0, g);
|
|
949
948
|
}
|
|
@@ -952,14 +951,14 @@ function ht() {
|
|
|
952
951
|
return i;
|
|
953
952
|
throw new Error("`".concat(b, "` was specified but was not a node, or did not return a node"));
|
|
954
953
|
}
|
|
955
|
-
var
|
|
954
|
+
var w = i;
|
|
956
955
|
if (typeof i == "string") {
|
|
957
956
|
var v;
|
|
958
|
-
if (
|
|
957
|
+
if (w = (v = this.getDocument()) === null || v === void 0 ? void 0 : v.querySelector(i), !w)
|
|
959
958
|
throw new Error("`".concat(b, "` as selector refers to no known node"));
|
|
960
959
|
}
|
|
961
|
-
return
|
|
962
|
-
}),
|
|
960
|
+
return w;
|
|
961
|
+
}), u.handleDeactivate = u.handleDeactivate.bind(u), u.handlePostDeactivate = u.handlePostDeactivate.bind(u), u.handleClickOutsideDeactivates = u.handleClickOutsideDeactivates.bind(u), u.internalOptions = {
|
|
963
962
|
// We need to hijack the returnFocusOnDeactivate option,
|
|
964
963
|
// because React can move focus into the element before we arrived at
|
|
965
964
|
// this lifecycle hook (e.g. with autoFocus inputs). So the component
|
|
@@ -969,14 +968,14 @@ function ht() {
|
|
|
969
968
|
// the rest of these are also related to deactivation of the trap, and we
|
|
970
969
|
// need to use them and control them as well
|
|
971
970
|
checkCanReturnFocus: null,
|
|
972
|
-
onDeactivate:
|
|
973
|
-
onPostDeactivate:
|
|
971
|
+
onDeactivate: u.handleDeactivate,
|
|
972
|
+
onPostDeactivate: u.handlePostDeactivate,
|
|
974
973
|
// we need to special-case this setting as well so that we can know if we should
|
|
975
974
|
// NOT return focus if the trap gets auto-deactivated as the result of an
|
|
976
975
|
// outside click (otherwise, we'll always think we should return focus because
|
|
977
976
|
// of how we manage that flag internally here)
|
|
978
|
-
clickOutsideDeactivates:
|
|
979
|
-
},
|
|
977
|
+
clickOutsideDeactivates: u.handleClickOutsideDeactivates
|
|
978
|
+
}, u.originalOptions = {
|
|
980
979
|
// because of the above `internalOptions`, we maintain our own flag for
|
|
981
980
|
// this option, and default it to `true` because that's focus-trap's default
|
|
982
981
|
returnFocusOnDeactivate: !0,
|
|
@@ -989,18 +988,18 @@ function ht() {
|
|
|
989
988
|
// the user's setting, defaulted to false since focus-trap defaults this to false
|
|
990
989
|
clickOutsideDeactivates: !1
|
|
991
990
|
};
|
|
992
|
-
var
|
|
993
|
-
for (var O in
|
|
994
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
991
|
+
var T = m.focusTrapOptions;
|
|
992
|
+
for (var O in T)
|
|
993
|
+
if (Object.prototype.hasOwnProperty.call(T, O)) {
|
|
995
994
|
if (O === "returnFocusOnDeactivate" || O === "onDeactivate" || O === "onPostDeactivate" || O === "checkCanReturnFocus" || O === "clickOutsideDeactivates") {
|
|
996
|
-
|
|
995
|
+
u.originalOptions[O] = T[O];
|
|
997
996
|
continue;
|
|
998
997
|
}
|
|
999
|
-
|
|
998
|
+
u.internalOptions[O] = T[O];
|
|
1000
999
|
}
|
|
1001
|
-
return
|
|
1000
|
+
return u.outsideClick = null, u.focusTrapElements = m.containerElements || [], u.updatePreviousElement(), u;
|
|
1002
1001
|
}
|
|
1003
|
-
return D(
|
|
1002
|
+
return D(f, d), c(f, [{
|
|
1004
1003
|
key: "getDocument",
|
|
1005
1004
|
value: function() {
|
|
1006
1005
|
return this.props.focusTrapOptions.document || (typeof document < "u" ? document : void 0);
|
|
@@ -1008,15 +1007,15 @@ function ht() {
|
|
|
1008
1007
|
}, {
|
|
1009
1008
|
key: "getReturnFocusNode",
|
|
1010
1009
|
value: function() {
|
|
1011
|
-
var
|
|
1012
|
-
return
|
|
1010
|
+
var u = this.getNodeForOption("setReturnFocus", this.previouslyFocusedElement);
|
|
1011
|
+
return u || (u === !1 ? !1 : this.previouslyFocusedElement);
|
|
1013
1012
|
}
|
|
1014
1013
|
/** Update the previously focused element with the currently focused element. */
|
|
1015
1014
|
}, {
|
|
1016
1015
|
key: "updatePreviousElement",
|
|
1017
1016
|
value: function() {
|
|
1018
|
-
var
|
|
1019
|
-
|
|
1017
|
+
var u = this.getDocument();
|
|
1018
|
+
u && (this.previouslyFocusedElement = u.activeElement);
|
|
1020
1019
|
}
|
|
1021
1020
|
}, {
|
|
1022
1021
|
key: "deactivateTrap",
|
|
@@ -1040,12 +1039,12 @@ function ht() {
|
|
|
1040
1039
|
}
|
|
1041
1040
|
}, {
|
|
1042
1041
|
key: "handleClickOutsideDeactivates",
|
|
1043
|
-
value: function(
|
|
1044
|
-
var
|
|
1045
|
-
return
|
|
1046
|
-
target:
|
|
1047
|
-
allowDeactivation:
|
|
1048
|
-
}),
|
|
1042
|
+
value: function(u) {
|
|
1043
|
+
var T = typeof this.originalOptions.clickOutsideDeactivates == "function" ? this.originalOptions.clickOutsideDeactivates.call(null, u) : this.originalOptions.clickOutsideDeactivates;
|
|
1044
|
+
return T && (this.outsideClick = {
|
|
1045
|
+
target: u.target,
|
|
1046
|
+
allowDeactivation: T
|
|
1047
|
+
}), T;
|
|
1049
1048
|
}
|
|
1050
1049
|
}, {
|
|
1051
1050
|
key: "handleDeactivate",
|
|
@@ -1055,20 +1054,20 @@ function ht() {
|
|
|
1055
1054
|
}, {
|
|
1056
1055
|
key: "handlePostDeactivate",
|
|
1057
1056
|
value: function() {
|
|
1058
|
-
var
|
|
1059
|
-
var b =
|
|
1060
|
-
(
|
|
1057
|
+
var u = this, T = function() {
|
|
1058
|
+
var b = u.getReturnFocusNode(), o = !!// did the consumer allow it?
|
|
1059
|
+
(u.originalOptions.returnFocusOnDeactivate && // can we actually focus the node?
|
|
1061
1060
|
b !== null && b !== void 0 && b.focus && // was there an outside click that allowed deactivation?
|
|
1062
|
-
(!
|
|
1063
|
-
|
|
1061
|
+
(!u.outsideClick || // did the consumer allow deactivation when the outside node was clicked?
|
|
1062
|
+
u.outsideClick.allowDeactivation && // is the outside node NOT focusable (implying that it did NOT receive focus
|
|
1064
1063
|
// as a result of the click-through) -- in which case do NOT restore focus
|
|
1065
1064
|
// to `returnFocusNode` because focus should remain on the outside node
|
|
1066
|
-
!$(
|
|
1065
|
+
!$(u.outsideClick.target, u.internalOptions.tabbableOptions))), i = u.internalOptions.preventScroll, l = i === void 0 ? !1 : i;
|
|
1067
1066
|
o && b.focus({
|
|
1068
|
-
preventScroll:
|
|
1069
|
-
}),
|
|
1067
|
+
preventScroll: l
|
|
1068
|
+
}), u.originalOptions.onPostDeactivate && u.originalOptions.onPostDeactivate.call(null), u.outsideClick = null;
|
|
1070
1069
|
};
|
|
1071
|
-
this.originalOptions.checkCanReturnFocus ? this.originalOptions.checkCanReturnFocus.call(null, this.getReturnFocusNode()).then(
|
|
1070
|
+
this.originalOptions.checkCanReturnFocus ? this.originalOptions.checkCanReturnFocus.call(null, this.getReturnFocusNode()).then(T, T) : T();
|
|
1072
1071
|
}
|
|
1073
1072
|
}, {
|
|
1074
1073
|
key: "setupFocusTrap",
|
|
@@ -1076,8 +1075,8 @@ function ht() {
|
|
|
1076
1075
|
if (this.focusTrap)
|
|
1077
1076
|
this.props.active && !this.focusTrap.active && (this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
|
|
1078
1077
|
else {
|
|
1079
|
-
var
|
|
1080
|
-
|
|
1078
|
+
var u = this.focusTrapElements.some(Boolean);
|
|
1079
|
+
u && (this.focusTrap = this.props._createFocusTrap(this.focusTrapElements, this.internalOptions), this.props.active && this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
|
|
1081
1080
|
}
|
|
1082
1081
|
}
|
|
1083
1082
|
}, {
|
|
@@ -1087,17 +1086,17 @@ function ht() {
|
|
|
1087
1086
|
}
|
|
1088
1087
|
}, {
|
|
1089
1088
|
key: "componentDidUpdate",
|
|
1090
|
-
value: function(
|
|
1089
|
+
value: function(u) {
|
|
1091
1090
|
if (this.focusTrap) {
|
|
1092
|
-
|
|
1093
|
-
var
|
|
1094
|
-
if (
|
|
1091
|
+
u.containerElements !== this.props.containerElements && this.focusTrap.updateContainerElements(this.props.containerElements);
|
|
1092
|
+
var T = !u.active && this.props.active, O = u.active && !this.props.active, b = !u.paused && this.props.paused, o = u.paused && !this.props.paused;
|
|
1093
|
+
if (T && (this.updatePreviousElement(), this.focusTrap.activate()), O) {
|
|
1095
1094
|
this.deactivateTrap();
|
|
1096
1095
|
return;
|
|
1097
1096
|
}
|
|
1098
1097
|
b && this.focusTrap.pause(), o && this.focusTrap.unpause();
|
|
1099
1098
|
} else
|
|
1100
|
-
|
|
1099
|
+
u.containerElements !== this.props.containerElements && (this.focusTrapElements = this.props.containerElements), this.props.active && (this.updatePreviousElement(), this.setupFocusTrap());
|
|
1101
1100
|
}
|
|
1102
1101
|
}, {
|
|
1103
1102
|
key: "componentWillUnmount",
|
|
@@ -1107,14 +1106,14 @@ function ht() {
|
|
|
1107
1106
|
}, {
|
|
1108
1107
|
key: "render",
|
|
1109
1108
|
value: function() {
|
|
1110
|
-
var
|
|
1111
|
-
if (
|
|
1112
|
-
if (
|
|
1109
|
+
var u = this, T = this.props.children ? C.Children.only(this.props.children) : void 0;
|
|
1110
|
+
if (T) {
|
|
1111
|
+
if (T.type && T.type === C.Fragment)
|
|
1113
1112
|
throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");
|
|
1114
1113
|
var O = function(i) {
|
|
1115
|
-
var
|
|
1116
|
-
|
|
1117
|
-
}, b =
|
|
1114
|
+
var l = u.props.containerElements;
|
|
1115
|
+
T && (G >= 19 ? typeof T.props.ref == "function" ? T.props.ref(i) : T.props.ref && (T.props.ref.current = i) : typeof T.ref == "function" ? T.ref(i) : T.ref && (T.ref.current = i)), u.focusTrapElements = l || [i];
|
|
1116
|
+
}, b = C.cloneElement(T, {
|
|
1118
1117
|
ref: O
|
|
1119
1118
|
});
|
|
1120
1119
|
return b;
|
|
@@ -1122,22 +1121,22 @@ function ht() {
|
|
|
1122
1121
|
return null;
|
|
1123
1122
|
}
|
|
1124
1123
|
}]);
|
|
1125
|
-
})(
|
|
1126
|
-
return
|
|
1124
|
+
})(C.Component);
|
|
1125
|
+
return L.defaultProps = {
|
|
1127
1126
|
active: !0,
|
|
1128
1127
|
paused: !1,
|
|
1129
1128
|
focusTrapOptions: {},
|
|
1130
|
-
_createFocusTrap:
|
|
1131
|
-
}, Q.exports =
|
|
1129
|
+
_createFocusTrap: q
|
|
1130
|
+
}, Q.exports = L, Q.exports.FocusTrap = L, Q.exports;
|
|
1132
1131
|
}
|
|
1133
1132
|
var yt = ht();
|
|
1134
|
-
const
|
|
1133
|
+
const je = Ae({
|
|
1135
1134
|
isVisible: !1
|
|
1136
1135
|
}), {
|
|
1137
1136
|
Provider: mt
|
|
1138
|
-
} =
|
|
1137
|
+
} = je;
|
|
1139
1138
|
function gt() {
|
|
1140
|
-
return je
|
|
1139
|
+
return xe(je);
|
|
1141
1140
|
}
|
|
1142
1141
|
function Tt() {
|
|
1143
1142
|
const {
|
|
@@ -1145,102 +1144,110 @@ function Tt() {
|
|
|
1145
1144
|
} = gt(), e = J(() => {
|
|
1146
1145
|
r == null || r();
|
|
1147
1146
|
}, [r]);
|
|
1148
|
-
return /* @__PURE__ */
|
|
1149
|
-
/* @__PURE__ */
|
|
1150
|
-
/* @__PURE__ */
|
|
1147
|
+
return /* @__PURE__ */ N.jsxs(N.Fragment, { children: [
|
|
1148
|
+
/* @__PURE__ */ N.jsx("div", { className: "kakadu-components-2543813221" }),
|
|
1149
|
+
/* @__PURE__ */ N.jsx("div", { className: "kakadu-components-840864829", children: /* @__PURE__ */ N.jsx(Be, { iconLeft: Le.times, label: "Close", className: "kakadu-components-3855719072", onClick: e }) })
|
|
1151
1150
|
] });
|
|
1152
1151
|
}
|
|
1153
|
-
function
|
|
1152
|
+
function we({
|
|
1153
|
+
decorators: r,
|
|
1154
|
+
children: e
|
|
1155
|
+
}) {
|
|
1156
|
+
return r.length === 0 ? e : r.reduceRight((t, a) => /* @__PURE__ */ N.jsx(a, { children: t }), e);
|
|
1157
|
+
}
|
|
1158
|
+
function Dt({
|
|
1154
1159
|
root: r,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1160
|
+
outerDecorators: e = [],
|
|
1161
|
+
innerDecorators: t = [],
|
|
1162
|
+
maxWidth: a,
|
|
1163
|
+
className: s,
|
|
1164
|
+
isVisible: c,
|
|
1165
|
+
isFullWidth: n = !1,
|
|
1166
|
+
shouldCloseOnOutsideClick: p = !0,
|
|
1167
|
+
shouldCloseOnEscapePress: y = !0,
|
|
1168
|
+
showCloseButton: k = !0,
|
|
1169
|
+
onClose: S,
|
|
1170
|
+
children: D
|
|
1164
1171
|
}) {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
}, []),
|
|
1168
|
-
|
|
1169
|
-
}, []), [
|
|
1170
|
-
isVisible:
|
|
1171
|
-
setInitialFocus:
|
|
1172
|
-
close:
|
|
1173
|
-
}), [
|
|
1172
|
+
const R = te(null), A = te(null), [P, Y] = re(!1), [C, I] = re(!1), q = J((u) => {
|
|
1173
|
+
R.current = u, I(!1);
|
|
1174
|
+
}, []), V = te(null), $ = J((u) => {
|
|
1175
|
+
u && (V.current = u);
|
|
1176
|
+
}, []), [G, L] = re(c ?? !1), d = ne(() => ({
|
|
1177
|
+
isVisible: G,
|
|
1178
|
+
setInitialFocus: $,
|
|
1179
|
+
close: q
|
|
1180
|
+
}), [G, $, q]);
|
|
1174
1181
|
H(() => {
|
|
1175
|
-
|
|
1176
|
-
}, [
|
|
1177
|
-
if (
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1182
|
+
c && (Y(!0), L(!0));
|
|
1183
|
+
}, [c]), H(() => {
|
|
1184
|
+
if (c) {
|
|
1185
|
+
const u = setTimeout(() => {
|
|
1186
|
+
I(!0);
|
|
1180
1187
|
}, 100);
|
|
1181
1188
|
return () => {
|
|
1182
|
-
clearTimeout(
|
|
1189
|
+
clearTimeout(u);
|
|
1183
1190
|
};
|
|
1184
1191
|
}
|
|
1185
|
-
|
|
1186
|
-
}, [
|
|
1187
|
-
if (
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1192
|
+
I(!1);
|
|
1193
|
+
}, [c]), H(() => {
|
|
1194
|
+
if (P && !C) {
|
|
1195
|
+
const u = setTimeout(() => {
|
|
1196
|
+
S == null || S(R.current ?? void 0), L(!1);
|
|
1190
1197
|
}, 370);
|
|
1191
1198
|
return () => {
|
|
1192
|
-
clearTimeout(
|
|
1199
|
+
clearTimeout(u);
|
|
1193
1200
|
};
|
|
1194
1201
|
}
|
|
1195
|
-
}, [
|
|
1196
|
-
const
|
|
1197
|
-
if (
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1202
|
+
}, [P, C, S]), H(() => {
|
|
1203
|
+
const u = A.current;
|
|
1204
|
+
if (c && p && u) {
|
|
1205
|
+
const T = (O) => {
|
|
1206
|
+
u === O.target && I(!1);
|
|
1200
1207
|
};
|
|
1201
|
-
return
|
|
1202
|
-
|
|
1208
|
+
return u.addEventListener("click", T), () => {
|
|
1209
|
+
u.removeEventListener("click", T);
|
|
1203
1210
|
};
|
|
1204
1211
|
}
|
|
1205
|
-
}, [
|
|
1206
|
-
if (!
|
|
1212
|
+
}, [c, p]), H(() => {
|
|
1213
|
+
if (!c || !y)
|
|
1207
1214
|
return;
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1215
|
+
const u = (T) => {
|
|
1216
|
+
T.key === "Escape" && I(!1);
|
|
1210
1217
|
};
|
|
1211
|
-
return window.addEventListener("keydown",
|
|
1212
|
-
window.removeEventListener("keydown",
|
|
1218
|
+
return window.addEventListener("keydown", u), () => {
|
|
1219
|
+
window.removeEventListener("keydown", u);
|
|
1213
1220
|
};
|
|
1214
|
-
}, [
|
|
1215
|
-
const
|
|
1216
|
-
initialFocus: () =>
|
|
1221
|
+
}, [c, y]);
|
|
1222
|
+
const f = ne(() => ({
|
|
1223
|
+
initialFocus: () => V.current ?? void 0,
|
|
1217
1224
|
onActivate: () => {
|
|
1218
|
-
var
|
|
1219
|
-
return (
|
|
1225
|
+
var u;
|
|
1226
|
+
return (u = V.current) == null ? void 0 : u.focus();
|
|
1220
1227
|
}
|
|
1221
|
-
}), []),
|
|
1222
|
-
"--max-width":
|
|
1223
|
-
}, className: pe(
|
|
1224
|
-
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
] }) }) }) }) });
|
|
1227
|
-
return r ?
|
|
1228
|
+
}), []), m = /* @__PURE__ */ N.jsx(we, { decorators: e, children: /* @__PURE__ */ N.jsx("div", { style: {
|
|
1229
|
+
"--max-width": a ? `${a}px` : void 0
|
|
1230
|
+
}, className: pe("kakadu-components-4119461136", C && "kakadu-components-2522346797", s), children: /* @__PURE__ */ N.jsx(we, { decorators: t, children: /* @__PURE__ */ N.jsx(yt.FocusTrap, { active: C, focusTrapOptions: f, children: /* @__PURE__ */ N.jsx("div", { ref: A, className: "kakadu-components-4011815997", children: /* @__PURE__ */ N.jsx("div", { className: pe("kakadu-components-3324483532", n && "kakadu-components-3799971070", C && "kakadu-components-968755580"), children: /* @__PURE__ */ N.jsxs(mt, { value: d, children: [
|
|
1231
|
+
k ? /* @__PURE__ */ N.jsx(Tt, {}) : null,
|
|
1232
|
+
/* @__PURE__ */ N.jsx("div", { className: "kakadu-components-177997624", children: D })
|
|
1233
|
+
] }) }) }) }) }) }) });
|
|
1234
|
+
return r ? _e(m, r) : m;
|
|
1228
1235
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const [t, a] = re(!1),
|
|
1231
|
-
|
|
1236
|
+
function Nt(r, e) {
|
|
1237
|
+
const [t, a] = re(!1), s = te(void 0), c = J(async () => (a(!0), new Promise((y) => {
|
|
1238
|
+
s.current = y;
|
|
1232
1239
|
})), []), n = J((y) => {
|
|
1233
1240
|
var k;
|
|
1234
|
-
a(!1), (k =
|
|
1235
|
-
}, []), p = ne(() => /* @__PURE__ */
|
|
1241
|
+
a(!1), (k = s.current) == null || k.call(s, y), s.current = void 0;
|
|
1242
|
+
}, []), p = ne(() => /* @__PURE__ */ N.jsx(r, { ...e, isVisible: t, onClose: n }), [r, e, t, n]);
|
|
1236
1243
|
return ne(() => ({
|
|
1237
1244
|
isVisible: t,
|
|
1238
|
-
show:
|
|
1245
|
+
show: c,
|
|
1239
1246
|
modal: p
|
|
1240
|
-
}), [t,
|
|
1247
|
+
}), [t, c, p]);
|
|
1241
1248
|
}
|
|
1242
1249
|
export {
|
|
1243
|
-
|
|
1244
|
-
|
|
1250
|
+
Dt as default,
|
|
1251
|
+
Nt as useModal,
|
|
1245
1252
|
gt as useModalContext
|
|
1246
1253
|
};
|