@kakadu/components 1.7.4 → 1.7.6
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/input.js +2 -2
- package/build/components/input.mjs +60 -60
- package/build/components/modal.d.ts +5 -1
- package/build/components/modal.js +5 -5
- package/build/components/modal.mjs +462 -456
- package/build/components.css +1 -1
- package/package.json +1 -1
- package/readme.md +14 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
1
|
+
import { j as N } from "../jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import je, { createContext as Ie, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as Ae } from "react";
|
|
3
3
|
import { cx as pe } from "@kuma-ui/core";
|
|
4
4
|
import { createPortal as xe } from "react-dom";
|
|
5
5
|
import { a as _e } from "../icon-C6X3pQX0.mjs";
|
|
6
|
-
import Le from "
|
|
7
|
-
import Be from "./text-button.mjs";
|
|
6
|
+
import Le from "./text-button.mjs";
|
|
8
7
|
function we(r) {
|
|
9
8
|
if (Object.prototype.hasOwnProperty.call(r, "__esModule")) return r;
|
|
10
9
|
var e = r.default;
|
|
@@ -29,7 +28,7 @@ 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 ke = ["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__ */ ke.join(","), Ee = typeof Element > "u",
|
|
31
|
+
var ke = ["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__ */ ke.join(","), Ee = typeof Element > "u", z = Ee ? function() {
|
|
33
32
|
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, oe = !Ee && 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);
|
|
@@ -38,73 +37,73 @@ 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 u = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"),
|
|
40
|
+
var u = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), c = u === "" || u === "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
|
+
}, Be = 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
|
}, Fe = function(e, t, a) {
|
|
49
48
|
if (ue(e))
|
|
50
49
|
return [];
|
|
51
50
|
var u = Array.prototype.slice.apply(e.querySelectorAll(ie));
|
|
52
|
-
return t &&
|
|
51
|
+
return t && z.call(e, ie) && u.unshift(e), u = u.filter(a), u;
|
|
53
52
|
}, se = function(e, t, a) {
|
|
54
|
-
for (var u = [],
|
|
55
|
-
var n =
|
|
53
|
+
for (var u = [], c = Array.from(e); c.length; ) {
|
|
54
|
+
var n = c.shift();
|
|
56
55
|
if (!ue(n, !1))
|
|
57
56
|
if (n.tagName === "SLOT") {
|
|
58
|
-
var
|
|
57
|
+
var b = n.assignedElements(), g = b.length ? b : n.children, k = se(g, !0, a);
|
|
59
58
|
a.flatten ? u.push.apply(u, k) : u.push({
|
|
60
59
|
scopeParent: n,
|
|
61
60
|
candidates: k
|
|
62
61
|
});
|
|
63
62
|
} else {
|
|
64
|
-
var S =
|
|
63
|
+
var S = z.call(n, ie);
|
|
65
64
|
S && a.filter(n) && (t || !e.includes(n)) && u.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 ? u.push.apply(u,
|
|
68
|
+
var I = se(D === !0 ? n.children : D.children, !0, a);
|
|
69
|
+
a.flatten ? u.push.apply(u, I) : u.push({
|
|
71
70
|
scopeParent: n,
|
|
72
|
-
candidates:
|
|
71
|
+
candidates: I
|
|
73
72
|
});
|
|
74
73
|
} else
|
|
75
|
-
|
|
74
|
+
c.unshift.apply(c, n.children);
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
return u;
|
|
79
78
|
}, Se = function(e) {
|
|
80
79
|
return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
|
|
81
|
-
},
|
|
80
|
+
}, V = 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) ||
|
|
85
|
-
},
|
|
86
|
-
var a =
|
|
83
|
+
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Be(e)) && !Se(e) ? 0 : e.tabIndex;
|
|
84
|
+
}, Me = function(e, t) {
|
|
85
|
+
var a = V(e);
|
|
87
86
|
return a < 0 && t && !Se(e) ? 0 : a;
|
|
88
|
-
},
|
|
87
|
+
}, Ke = function(e, t) {
|
|
89
88
|
return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
|
|
90
89
|
}, Oe = function(e) {
|
|
91
90
|
return e.tagName === "INPUT";
|
|
92
|
-
},
|
|
91
|
+
}, qe = function(e) {
|
|
93
92
|
return Oe(e) && e.type === "hidden";
|
|
94
|
-
},
|
|
93
|
+
}, Ve = function(e) {
|
|
95
94
|
var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(a) {
|
|
96
95
|
return a.tagName === "SUMMARY";
|
|
97
96
|
});
|
|
98
97
|
return t;
|
|
99
|
-
},
|
|
98
|
+
}, $e = function(e, t) {
|
|
100
99
|
for (var a = 0; a < e.length; a++)
|
|
101
100
|
if (e[a].checked && e[a].form === t)
|
|
102
101
|
return e[a];
|
|
103
|
-
},
|
|
102
|
+
}, Ge = function(e) {
|
|
104
103
|
if (!e.name)
|
|
105
104
|
return !0;
|
|
106
|
-
var t = e.form || oe(e), a = function(
|
|
107
|
-
return t.querySelectorAll('input[type="radio"][name="' +
|
|
105
|
+
var t = e.form || oe(e), a = function(b) {
|
|
106
|
+
return t.querySelectorAll('input[type="radio"][name="' + b + '"]');
|
|
108
107
|
}, u;
|
|
109
108
|
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
110
109
|
u = a(window.CSS.escape(e.name));
|
|
@@ -114,29 +113,29 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
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 !
|
|
119
|
-
},
|
|
116
|
+
var c = $e(u, e.form);
|
|
117
|
+
return !c || c === e;
|
|
118
|
+
}, Ue = function(e) {
|
|
120
119
|
return Oe(e) && e.type === "radio";
|
|
120
|
+
}, We = function(e) {
|
|
121
|
+
return Ue(e) && !Ge(e);
|
|
121
122
|
}, ze = function(e) {
|
|
122
|
-
|
|
123
|
-
}, Ye = function(e) {
|
|
124
|
-
var t, a = e && oe(e), u = (t = a) === null || t === void 0 ? void 0 : t.host, l = !1;
|
|
123
|
+
var t, a = e && oe(e), u = (t = a) === null || t === void 0 ? void 0 : t.host, c = !1;
|
|
125
124
|
if (a && a !== e) {
|
|
126
|
-
var n,
|
|
127
|
-
for (
|
|
125
|
+
var n, b, g;
|
|
126
|
+
for (c = !!((n = u) !== null && n !== void 0 && (b = n.ownerDocument) !== null && b !== void 0 && b.contains(u) || e != null && (g = e.ownerDocument) !== null && g !== void 0 && g.contains(e)); !c && u; ) {
|
|
128
127
|
var k, S, D;
|
|
129
|
-
a = oe(u), u = (k = a) === null || k === void 0 ? void 0 : k.host,
|
|
128
|
+
a = oe(u), u = (k = a) === null || k === void 0 ? void 0 : k.host, c = !!((S = u) !== null && S !== void 0 && (D = S.ownerDocument) !== null && D !== void 0 && D.contains(u));
|
|
130
129
|
}
|
|
131
130
|
}
|
|
132
|
-
return
|
|
131
|
+
return c;
|
|
133
132
|
}, be = function(e) {
|
|
134
133
|
var t = e.getBoundingClientRect(), a = t.width, u = t.height;
|
|
135
134
|
return a === 0 && u === 0;
|
|
136
|
-
},
|
|
135
|
+
}, Ye = function(e, t) {
|
|
137
136
|
var a = t.displayCheck, u = 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,40 +148,40 @@ 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"), b = n ? e.parentElement : e;
|
|
156
|
+
if (z.call(b, "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
161
|
if (typeof u == "function") {
|
|
163
|
-
for (var
|
|
162
|
+
for (var g = e; e; ) {
|
|
164
163
|
var k = e.parentElement, S = oe(e);
|
|
165
164
|
if (k && !k.shadowRoot && u(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
|
}
|
|
169
|
-
e =
|
|
168
|
+
e = g;
|
|
170
169
|
}
|
|
171
|
-
if (
|
|
170
|
+
if (ze(e))
|
|
172
171
|
return !e.getClientRects().length;
|
|
173
172
|
if (a !== "legacy-full")
|
|
174
173
|
return !0;
|
|
175
174
|
} else if (a === "non-zero-area")
|
|
176
175
|
return be(e);
|
|
177
176
|
return !1;
|
|
178
|
-
},
|
|
177
|
+
}, He = function(e) {
|
|
179
178
|
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
|
|
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
182
|
var u = t.children.item(a);
|
|
184
183
|
if (u.tagName === "LEGEND")
|
|
185
|
-
return
|
|
184
|
+
return z.call(t, "fieldset[disabled] *") ? !0 : !u.contains(e);
|
|
186
185
|
}
|
|
187
186
|
return !0;
|
|
188
187
|
}
|
|
@@ -190,26 +189,26 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
190
189
|
}
|
|
191
190
|
return !1;
|
|
192
191
|
}, ce = function(e, t) {
|
|
193
|
-
return !(t.disabled ||
|
|
194
|
-
|
|
192
|
+
return !(t.disabled || qe(t) || Ye(t, e) || // For a details element with a summary, the summary element gets the focus
|
|
193
|
+
Ve(t) || He(t));
|
|
195
194
|
}, de = function(e, t) {
|
|
196
|
-
return !(
|
|
197
|
-
},
|
|
195
|
+
return !(We(t) || V(t) < 0 || !ce(e, t));
|
|
196
|
+
}, Ze = function(e) {
|
|
198
197
|
var t = parseInt(e.getAttribute("tabindex"), 10);
|
|
199
198
|
return !!(isNaN(t) || t >= 0);
|
|
200
199
|
}, De = function(e) {
|
|
201
200
|
var t = [], a = [];
|
|
202
|
-
return e.forEach(function(u,
|
|
203
|
-
var n = !!u.scopeParent,
|
|
204
|
-
|
|
205
|
-
documentOrder:
|
|
206
|
-
tabIndex:
|
|
201
|
+
return e.forEach(function(u, c) {
|
|
202
|
+
var n = !!u.scopeParent, b = n ? u.scopeParent : u, g = Me(b, n), k = n ? De(u.candidates) : b;
|
|
203
|
+
g === 0 ? n ? t.push.apply(t, k) : t.push(b) : a.push({
|
|
204
|
+
documentOrder: c,
|
|
205
|
+
tabIndex: g,
|
|
207
206
|
item: u,
|
|
208
207
|
isScope: n,
|
|
209
208
|
content: k
|
|
210
209
|
});
|
|
211
|
-
}), a.sort(
|
|
212
|
-
return
|
|
210
|
+
}), a.sort(Ke).reduce(function(u, c) {
|
|
211
|
+
return c.isScope ? u.push.apply(u, c.content) : u.push(c.content), u;
|
|
213
212
|
}, []).concat(t);
|
|
214
213
|
}, Ne = function(e, t) {
|
|
215
214
|
t = t || {};
|
|
@@ -218,7 +217,7 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
218
217
|
filter: de.bind(null, t),
|
|
219
218
|
flatten: !1,
|
|
220
219
|
getShadowRoot: t.getShadowRoot,
|
|
221
|
-
shadowRootFilter:
|
|
220
|
+
shadowRootFilter: Ze
|
|
222
221
|
}) : a = Fe(e, t.includeContainer, de.bind(null, t)), De(a);
|
|
223
222
|
}, Re = function(e, t) {
|
|
224
223
|
t = t || {};
|
|
@@ -228,21 +227,21 @@ var ke = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert]
|
|
|
228
227
|
flatten: !0,
|
|
229
228
|
getShadowRoot: t.getShadowRoot
|
|
230
229
|
}) : a = Fe(e, t.includeContainer, ce.bind(null, t)), a;
|
|
231
|
-
},
|
|
230
|
+
}, W = function(e, t) {
|
|
232
231
|
if (t = t || {}, !e)
|
|
233
232
|
throw new Error("No node provided");
|
|
234
|
-
return
|
|
235
|
-
},
|
|
233
|
+
return z.call(e, ie) === !1 ? !1 : de(t, e);
|
|
234
|
+
}, Xe = /* @__PURE__ */ ke.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, Xe) === !1 ? !1 : ce(t, e);
|
|
239
238
|
};
|
|
240
|
-
const
|
|
239
|
+
const Je = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
241
240
|
__proto__: null,
|
|
242
241
|
focusable: Re,
|
|
243
|
-
getTabIndex:
|
|
242
|
+
getTabIndex: V,
|
|
244
243
|
isFocusable: ae,
|
|
245
|
-
isTabbable:
|
|
244
|
+
isTabbable: W,
|
|
246
245
|
tabbable: Ne
|
|
247
246
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
248
247
|
/*!
|
|
@@ -254,7 +253,7 @@ function ve(r, e) {
|
|
|
254
253
|
for (var t = 0, a = Array(e); t < e; t++) a[t] = r[t];
|
|
255
254
|
return a;
|
|
256
255
|
}
|
|
257
|
-
function
|
|
256
|
+
function Qe(r) {
|
|
258
257
|
if (Array.isArray(r)) return ve(r);
|
|
259
258
|
}
|
|
260
259
|
function he(r, e) {
|
|
@@ -274,8 +273,8 @@ function he(r, e) {
|
|
|
274
273
|
value: r[a++]
|
|
275
274
|
};
|
|
276
275
|
},
|
|
277
|
-
e: function(
|
|
278
|
-
throw
|
|
276
|
+
e: function(g) {
|
|
277
|
+
throw g;
|
|
279
278
|
},
|
|
280
279
|
f: u
|
|
281
280
|
};
|
|
@@ -283,39 +282,39 @@ function he(r, e) {
|
|
|
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, b = !1;
|
|
287
286
|
return {
|
|
288
287
|
s: function() {
|
|
289
288
|
t = t.call(r);
|
|
290
289
|
},
|
|
291
290
|
n: function() {
|
|
292
|
-
var
|
|
293
|
-
return n =
|
|
291
|
+
var g = t.next();
|
|
292
|
+
return n = g.done, g;
|
|
294
293
|
},
|
|
295
|
-
e: function(
|
|
296
|
-
|
|
294
|
+
e: function(g) {
|
|
295
|
+
b = !0, c = g;
|
|
297
296
|
},
|
|
298
297
|
f: function() {
|
|
299
298
|
try {
|
|
300
299
|
n || t.return == null || t.return();
|
|
301
300
|
} finally {
|
|
302
|
-
if (
|
|
301
|
+
if (b) throw c;
|
|
303
302
|
}
|
|
304
303
|
}
|
|
305
304
|
};
|
|
306
305
|
}
|
|
307
|
-
function
|
|
308
|
-
return (e =
|
|
306
|
+
function et(r, e, t) {
|
|
307
|
+
return (e = it(e)) in r ? Object.defineProperty(r, e, {
|
|
309
308
|
value: t,
|
|
310
309
|
enumerable: !0,
|
|
311
310
|
configurable: !0,
|
|
312
311
|
writable: !0
|
|
313
312
|
}) : r[e] = t, r;
|
|
314
313
|
}
|
|
315
|
-
function
|
|
314
|
+
function tt(r) {
|
|
316
315
|
if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
|
|
317
316
|
}
|
|
318
|
-
function
|
|
317
|
+
function rt() {
|
|
319
318
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
320
319
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
321
320
|
}
|
|
@@ -333,17 +332,17 @@ function me(r) {
|
|
|
333
332
|
for (var e = 1; e < arguments.length; e++) {
|
|
334
333
|
var t = arguments[e] != null ? arguments[e] : {};
|
|
335
334
|
e % 2 ? ye(Object(t), !0).forEach(function(a) {
|
|
336
|
-
|
|
335
|
+
et(r, a, t[a]);
|
|
337
336
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : ye(Object(t)).forEach(function(a) {
|
|
338
337
|
Object.defineProperty(r, a, Object.getOwnPropertyDescriptor(t, a));
|
|
339
338
|
});
|
|
340
339
|
}
|
|
341
340
|
return r;
|
|
342
341
|
}
|
|
343
|
-
function
|
|
344
|
-
return
|
|
342
|
+
function at(r) {
|
|
343
|
+
return Qe(r) || tt(r) || Pe(r) || rt();
|
|
345
344
|
}
|
|
346
|
-
function
|
|
345
|
+
function nt(r, e) {
|
|
347
346
|
if (typeof r != "object" || !r) return r;
|
|
348
347
|
var t = r[Symbol.toPrimitive];
|
|
349
348
|
if (t !== void 0) {
|
|
@@ -353,8 +352,8 @@ function it(r, e) {
|
|
|
353
352
|
}
|
|
354
353
|
return (e === "string" ? String : Number)(r);
|
|
355
354
|
}
|
|
356
|
-
function
|
|
357
|
-
var e =
|
|
355
|
+
function it(r) {
|
|
356
|
+
var e = nt(r, "string");
|
|
358
357
|
return typeof e == "symbol" ? e : e + "";
|
|
359
358
|
}
|
|
360
359
|
function Pe(r, e) {
|
|
@@ -391,15 +390,15 @@ var B = {
|
|
|
391
390
|
var t = B.getActiveTrap(e);
|
|
392
391
|
t && !t._isManuallyPaused() && t._setPausedState(!1);
|
|
393
392
|
}
|
|
394
|
-
},
|
|
393
|
+
}, ot = function(e) {
|
|
395
394
|
return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
|
|
396
|
-
},
|
|
395
|
+
}, ut = function(e) {
|
|
397
396
|
return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
|
|
398
397
|
}, X = function(e) {
|
|
399
398
|
return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
|
|
400
|
-
},
|
|
399
|
+
}, st = function(e) {
|
|
401
400
|
return X(e) && !e.shiftKey;
|
|
402
|
-
},
|
|
401
|
+
}, ct = function(e) {
|
|
403
402
|
return X(e) && e.shiftKey;
|
|
404
403
|
}, ge = function(e) {
|
|
405
404
|
return setTimeout(e, 0);
|
|
@@ -409,14 +408,14 @@ var B = {
|
|
|
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
|
-
},
|
|
413
|
-
var a = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) ||
|
|
411
|
+
}, lt = [], ft = function(e, t) {
|
|
412
|
+
var a = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) || lt, c = me({
|
|
414
413
|
returnFocusOnDeactivate: !0,
|
|
415
414
|
escapeDeactivates: !0,
|
|
416
415
|
delayInitialFocus: !0,
|
|
417
416
|
isolateSubtrees: !1,
|
|
418
|
-
isKeyForward:
|
|
419
|
-
isKeyBackward:
|
|
417
|
+
isKeyForward: st,
|
|
418
|
+
isKeyBackward: ct
|
|
420
419
|
}, t), n = {
|
|
421
420
|
// containers given to createFocusTrap()
|
|
422
421
|
/** @type {Array<HTMLElement>} */
|
|
@@ -461,35 +460,35 @@ 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
|
-
},
|
|
465
|
-
return o && o[i] !== void 0 ? o[i] : l
|
|
463
|
+
}, b, g = function(o, i, l) {
|
|
464
|
+
return o && o[i] !== void 0 ? o[i] : c[l || i];
|
|
466
465
|
}, k = function(o, i) {
|
|
467
|
-
var
|
|
468
|
-
return n.containerGroups.findIndex(function(
|
|
469
|
-
var
|
|
470
|
-
return
|
|
466
|
+
var l = typeof (i == null ? void 0 : i.composedPath) == "function" ? i.composedPath() : void 0;
|
|
467
|
+
return n.containerGroups.findIndex(function(m) {
|
|
468
|
+
var y = m.container, w = m.tabbableNodes;
|
|
469
|
+
return y.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
|
-
(
|
|
475
|
-
return
|
|
473
|
+
(l == null ? void 0 : l.includes(y)) || w.find(function(p) {
|
|
474
|
+
return p === 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
|
|
481
|
-
if (
|
|
482
|
-
return
|
|
478
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, l = i.hasFallback, m = l === void 0 ? !1 : l, y = i.params, w = y === void 0 ? [] : y, p = c[o];
|
|
479
|
+
if (typeof p == "function" && (p = p.apply(void 0, at(w))), p === !0 && (p = void 0), !p) {
|
|
480
|
+
if (p === void 0 || p === !1)
|
|
481
|
+
return p;
|
|
483
482
|
throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
|
|
484
483
|
}
|
|
485
|
-
var E =
|
|
486
|
-
if (typeof
|
|
484
|
+
var E = p;
|
|
485
|
+
if (typeof p == "string") {
|
|
487
486
|
try {
|
|
488
|
-
E = a.querySelector(
|
|
487
|
+
E = a.querySelector(p);
|
|
489
488
|
} catch (F) {
|
|
490
489
|
throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(F.message, '"'));
|
|
491
490
|
}
|
|
492
|
-
if (!E && !
|
|
491
|
+
if (!E && !m)
|
|
493
492
|
throw new Error("`".concat(o, "` as selector refers to no known node"));
|
|
494
493
|
}
|
|
495
494
|
return E;
|
|
@@ -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,23 +511,23 @@ var B = {
|
|
|
512
511
|
return o;
|
|
513
512
|
}, R = function() {
|
|
514
513
|
if (n.containerGroups = n.containers.map(function(o) {
|
|
515
|
-
var i = Ne(o,
|
|
516
|
-
return
|
|
517
|
-
}),
|
|
518
|
-
return
|
|
514
|
+
var i = Ne(o, c.tabbableOptions), l = Re(o, c.tabbableOptions), m = i.length > 0 ? i[0] : void 0, y = i.length > 0 ? i[i.length - 1] : void 0, w = l.find(function(F) {
|
|
515
|
+
return W(F);
|
|
516
|
+
}), p = l.slice().reverse().find(function(F) {
|
|
517
|
+
return W(F);
|
|
519
518
|
}), E = !!i.find(function(F) {
|
|
520
|
-
return
|
|
519
|
+
return V(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. */
|
|
529
|
-
firstTabbableNode:
|
|
528
|
+
firstTabbableNode: m,
|
|
530
529
|
/** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
531
|
-
lastTabbableNode:
|
|
530
|
+
lastTabbableNode: y,
|
|
532
531
|
// NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
|
|
533
532
|
// would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
534
533
|
// because that API doesn't work with Shadow DOM as well as it should (@see
|
|
@@ -537,9 +536,9 @@ 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
|
-
lastDomTabbableNode:
|
|
541
|
+
lastDomTabbableNode: p,
|
|
543
542
|
/**
|
|
544
543
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
545
544
|
* in this container, if any.
|
|
@@ -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 A < 0 ?
|
|
554
|
-
return U
|
|
555
|
-
}) :
|
|
556
|
-
return U
|
|
557
|
-
}) : i[A + (
|
|
550
|
+
nextTabbableNode: function(C) {
|
|
551
|
+
var _ = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, A = i.indexOf(C);
|
|
552
|
+
return A < 0 ? _ ? l.slice(l.indexOf(C) + 1).find(function(U) {
|
|
553
|
+
return W(U);
|
|
554
|
+
}) : l.slice(0, l.indexOf(C)).reverse().find(function(U) {
|
|
555
|
+
return W(U);
|
|
556
|
+
}) : i[A + (_ ? 1 : -1)];
|
|
558
557
|
}
|
|
559
558
|
};
|
|
560
559
|
}), n.tabbableGroups = n.containerGroups.filter(function(o) {
|
|
@@ -565,189 +564,189 @@ 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
|
+
}, I = 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 ? I(i.shadowRoot) : i;
|
|
571
|
+
}, j = function(o) {
|
|
572
|
+
if (o !== !1 && o !== I(document)) {
|
|
574
573
|
if (!o || !o.focus) {
|
|
575
|
-
|
|
574
|
+
j(D());
|
|
576
575
|
return;
|
|
577
576
|
}
|
|
578
577
|
o.focus({
|
|
579
|
-
preventScroll: !!
|
|
580
|
-
}), n.mostRecentlyFocusedNode = o,
|
|
578
|
+
preventScroll: !!c.preventScroll
|
|
579
|
+
}), n.mostRecentlyFocusedNode = o, ot(o) && o.select();
|
|
581
580
|
}
|
|
582
581
|
}, x = 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
|
+
}, P = function(o) {
|
|
587
|
+
var i = o.target, l = o.event, m = o.isBackward, y = m === void 0 ? !1 : m;
|
|
588
|
+
i = i || ee(l), R();
|
|
589
|
+
var w = null;
|
|
591
590
|
if (n.tabbableGroups.length > 0) {
|
|
592
|
-
var
|
|
593
|
-
if (
|
|
594
|
-
|
|
595
|
-
else if (
|
|
591
|
+
var p = k(i, l), E = p >= 0 ? n.containerGroups[p] : void 0;
|
|
592
|
+
if (p < 0)
|
|
593
|
+
y ? w = n.tabbableGroups[n.tabbableGroups.length - 1].lastTabbableNode : w = n.tabbableGroups[0].firstTabbableNode;
|
|
594
|
+
else if (y) {
|
|
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 = p), F >= 0) {
|
|
600
|
+
var C = F === 0 ? n.tabbableGroups.length - 1 : F - 1, _ = n.tabbableGroups[C];
|
|
601
|
+
w = V(i) >= 0 ? _.lastTabbableNode : _.lastDomTabbableNode;
|
|
602
|
+
} else X(l) || (w = E.nextTabbableNode(i, !1));
|
|
604
603
|
} else {
|
|
605
604
|
var A = n.tabbableGroups.findIndex(function(le) {
|
|
606
605
|
var fe = le.lastTabbableNode;
|
|
607
606
|
return i === fe;
|
|
608
607
|
});
|
|
609
|
-
if (A < 0 && (E.container === i || ae(i,
|
|
610
|
-
var
|
|
611
|
-
|
|
612
|
-
} else X(
|
|
608
|
+
if (A < 0 && (E.container === i || ae(i, c.tabbableOptions) && !W(i, c.tabbableOptions) && !E.nextTabbableNode(i)) && (A = p), A >= 0) {
|
|
609
|
+
var U = A === n.tabbableGroups.length - 1 ? 0 : A + 1, q = n.tabbableGroups[U];
|
|
610
|
+
w = V(i) >= 0 ? q.firstTabbableNode : q.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
|
+
}, L = function(o) {
|
|
618
617
|
var i = ee(o);
|
|
619
618
|
if (!(k(i, o) >= 0)) {
|
|
620
|
-
if (Z(
|
|
621
|
-
|
|
619
|
+
if (Z(c.clickOutsideDeactivates, o)) {
|
|
620
|
+
b.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
|
|
624
623
|
// that was clicked (and if not focusable, to "nothing"); by setting
|
|
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
|
+
}, M = 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
|
-
var
|
|
639
|
+
var m, y = !0;
|
|
641
640
|
if (n.mostRecentlyFocusedNode)
|
|
642
|
-
if (
|
|
643
|
-
var
|
|
644
|
-
if (
|
|
645
|
-
var E =
|
|
641
|
+
if (V(n.mostRecentlyFocusedNode) > 0) {
|
|
642
|
+
var w = k(n.mostRecentlyFocusedNode), p = n.containerGroups[w].tabbableNodes;
|
|
643
|
+
if (p.length > 0) {
|
|
644
|
+
var E = p.findIndex(function(F) {
|
|
646
645
|
return F === n.mostRecentlyFocusedNode;
|
|
647
646
|
});
|
|
648
|
-
E >= 0 && (
|
|
647
|
+
E >= 0 && (c.isKeyForward(n.recentNavEvent) ? E + 1 < p.length && (m = p[E + 1], y = !1) : E - 1 >= 0 && (m = p[E - 1], y = !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(C) {
|
|
652
|
+
return V(C) > 0;
|
|
654
653
|
});
|
|
655
|
-
}) || (
|
|
654
|
+
}) || (y = !1);
|
|
656
655
|
else
|
|
657
|
-
|
|
658
|
-
|
|
656
|
+
y = !1;
|
|
657
|
+
y && (m = P({
|
|
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
|
+
})), j(m || n.mostRecentlyFocusedNode || D());
|
|
664
663
|
}
|
|
665
664
|
n.recentNavEvent = void 0;
|
|
666
|
-
},
|
|
665
|
+
}, Y = 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 = P({
|
|
670
669
|
event: o,
|
|
671
670
|
isBackward: i
|
|
672
671
|
});
|
|
673
|
-
|
|
672
|
+
l && (X(o) && o.preventDefault(), j(l));
|
|
674
673
|
}, $ = function(o) {
|
|
675
|
-
(
|
|
676
|
-
},
|
|
677
|
-
|
|
678
|
-
},
|
|
674
|
+
(c.isKeyForward(o) || c.isKeyBackward(o)) && Y(o, c.isKeyBackward(o));
|
|
675
|
+
}, G = function(o) {
|
|
676
|
+
ut(o) && Z(c.escapeDeactivates, o) !== !1 && (o.preventDefault(), b.deactivate());
|
|
677
|
+
}, K = function(o) {
|
|
679
678
|
var i = ee(o);
|
|
680
|
-
k(i, o) >= 0 || Z(
|
|
681
|
-
},
|
|
679
|
+
k(i, o) >= 0 || Z(c.clickOutsideDeactivates, o) || Z(c.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
|
|
680
|
+
}, v = function() {
|
|
682
681
|
if (n.active)
|
|
683
|
-
return B.activateTrap(u,
|
|
684
|
-
|
|
685
|
-
}) :
|
|
682
|
+
return B.activateTrap(u, b), n.delayInitialFocusTimer = c.delayInitialFocus ? ge(function() {
|
|
683
|
+
j(D());
|
|
684
|
+
}) : j(D()), a.addEventListener("focusin", M, !0), a.addEventListener("mousedown", L, {
|
|
686
685
|
capture: !0,
|
|
687
686
|
passive: !1
|
|
688
|
-
}), a.addEventListener("touchstart",
|
|
687
|
+
}), a.addEventListener("touchstart", L, {
|
|
689
688
|
capture: !0,
|
|
690
689
|
passive: !1
|
|
691
|
-
}), a.addEventListener("click",
|
|
690
|
+
}), a.addEventListener("click", K, {
|
|
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
|
-
},
|
|
699
|
-
n.active && !n.paused &&
|
|
700
|
-
var i = /* @__PURE__ */ new Set(),
|
|
696
|
+
}), a.addEventListener("keydown", G), b;
|
|
697
|
+
}, f = function(o) {
|
|
698
|
+
n.active && !n.paused && b._setSubtreeIsolation(!1), n.adjacentElements.clear(), n.alreadySilent.clear();
|
|
699
|
+
var i = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), m = he(o), y;
|
|
701
700
|
try {
|
|
702
|
-
for (
|
|
703
|
-
var
|
|
704
|
-
i.add(
|
|
705
|
-
for (var
|
|
701
|
+
for (m.s(); !(y = m.n()).done; ) {
|
|
702
|
+
var w = y.value;
|
|
703
|
+
i.add(w);
|
|
704
|
+
for (var p = 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, C = [];
|
|
707
|
+
F ? C = F.children : !F && p && (C = E.getRootNode().children, F = E.getRootNode().host, p = typeof ShadowRoot < "u" && F.getRootNode() instanceof ShadowRoot);
|
|
708
|
+
var _ = he(C), A;
|
|
710
709
|
try {
|
|
711
|
-
for (
|
|
712
|
-
var
|
|
713
|
-
|
|
710
|
+
for (_.s(); !(A = _.n()).done; ) {
|
|
711
|
+
var U = A.value;
|
|
712
|
+
l.add(U);
|
|
714
713
|
}
|
|
715
|
-
} catch (
|
|
716
|
-
|
|
714
|
+
} catch (q) {
|
|
715
|
+
_.e(q);
|
|
717
716
|
} finally {
|
|
718
|
-
|
|
717
|
+
_.f();
|
|
719
718
|
}
|
|
720
719
|
E = F;
|
|
721
720
|
}
|
|
722
721
|
}
|
|
723
|
-
} catch (
|
|
724
|
-
|
|
722
|
+
} catch (q) {
|
|
723
|
+
m.e(q);
|
|
725
724
|
} finally {
|
|
726
|
-
|
|
725
|
+
m.f();
|
|
727
726
|
}
|
|
728
|
-
i.forEach(function(
|
|
729
|
-
|
|
730
|
-
}), n.adjacentElements =
|
|
731
|
-
},
|
|
727
|
+
i.forEach(function(q) {
|
|
728
|
+
l.delete(q);
|
|
729
|
+
}), n.adjacentElements = l;
|
|
730
|
+
}, d = function() {
|
|
732
731
|
if (n.active)
|
|
733
|
-
return a.removeEventListener("focusin",
|
|
734
|
-
},
|
|
735
|
-
var i = o.some(function(
|
|
736
|
-
var
|
|
737
|
-
return
|
|
738
|
-
return
|
|
732
|
+
return a.removeEventListener("focusin", M, !0), a.removeEventListener("mousedown", L, !0), a.removeEventListener("touchstart", L, !0), a.removeEventListener("click", K, !0), a.removeEventListener("keydown", $, !0), a.removeEventListener("keydown", G), b;
|
|
733
|
+
}, s = function(o) {
|
|
734
|
+
var i = o.some(function(l) {
|
|
735
|
+
var m = Array.from(l.removedNodes);
|
|
736
|
+
return m.some(function(y) {
|
|
737
|
+
return y === n.mostRecentlyFocusedNode;
|
|
739
738
|
});
|
|
740
739
|
});
|
|
741
|
-
i &&
|
|
742
|
-
},
|
|
743
|
-
|
|
744
|
-
|
|
740
|
+
i && j(D());
|
|
741
|
+
}, T = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(s) : 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
|
});
|
|
748
747
|
}));
|
|
749
748
|
};
|
|
750
|
-
return
|
|
749
|
+
return b = {
|
|
751
750
|
get active() {
|
|
752
751
|
return n.active;
|
|
753
752
|
},
|
|
@@ -757,25 +756,25 @@ var B = {
|
|
|
757
756
|
activate: function(o) {
|
|
758
757
|
if (n.active)
|
|
759
758
|
return this;
|
|
760
|
-
var i =
|
|
761
|
-
if (
|
|
762
|
-
var
|
|
763
|
-
(
|
|
759
|
+
var i = g(o, "onActivate"), l = g(o, "onPostActivate"), m = g(o, "checkCanFocusTrap"), y = B.getActiveTrap(u), w = !1;
|
|
760
|
+
if (y && !y.paused) {
|
|
761
|
+
var p;
|
|
762
|
+
(p = y._setSubtreeIsolation) === null || p === void 0 || p.call(y, !1), w = !0;
|
|
764
763
|
}
|
|
765
764
|
try {
|
|
766
|
-
|
|
765
|
+
m || R(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation = I(a), i == null || i();
|
|
767
766
|
var E = function() {
|
|
768
|
-
|
|
767
|
+
m && R(), v(), O(), c.isolateSubtrees && b._setSubtreeIsolation(!0), l == null || l();
|
|
769
768
|
};
|
|
770
|
-
if (
|
|
771
|
-
return
|
|
769
|
+
if (m)
|
|
770
|
+
return m(n.containers.concat()).then(E, E), this;
|
|
772
771
|
E();
|
|
773
|
-
} catch (
|
|
774
|
-
if (
|
|
772
|
+
} catch (C) {
|
|
773
|
+
if (y === B.getActiveTrap(u) && w) {
|
|
775
774
|
var F;
|
|
776
|
-
(F =
|
|
775
|
+
(F = y._setSubtreeIsolation) === null || F === void 0 || F.call(y, !0);
|
|
777
776
|
}
|
|
778
|
-
throw
|
|
777
|
+
throw C;
|
|
779
778
|
}
|
|
780
779
|
return this;
|
|
781
780
|
},
|
|
@@ -783,19 +782,19 @@ 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 ||
|
|
791
|
-
var
|
|
792
|
-
|
|
793
|
-
var
|
|
789
|
+
clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, n.paused || b._setSubtreeIsolation(!1), n.alreadySilent.clear(), d(), n.active = !1, n.paused = !1, O(), B.deactivateTrap(u, b);
|
|
790
|
+
var l = g(i, "onDeactivate"), m = g(i, "onPostDeactivate"), y = g(i, "checkCanReturnFocus"), w = g(i, "returnFocus", "returnFocusOnDeactivate");
|
|
791
|
+
l == null || l();
|
|
792
|
+
var p = function() {
|
|
794
793
|
ge(function() {
|
|
795
|
-
|
|
794
|
+
w && j(x(n.nodeFocusedBeforeActivation)), m == null || m();
|
|
796
795
|
});
|
|
797
796
|
};
|
|
798
|
-
return
|
|
797
|
+
return w && y ? (y(x(n.nodeFocusedBeforeActivation)).then(p, p), this) : (p(), this);
|
|
799
798
|
},
|
|
800
799
|
pause: function(o) {
|
|
801
800
|
return n.active ? (n.manuallyPaused = !0, this._setPausedState(!0, o)) : this;
|
|
@@ -805,11 +804,11 @@ var B = {
|
|
|
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 && b._setSubtreeIsolation(!0)), O(), this;
|
|
811
810
|
}
|
|
812
|
-
}, Object.defineProperties(
|
|
811
|
+
}, Object.defineProperties(b, {
|
|
813
812
|
_isManuallyPaused: {
|
|
814
813
|
value: function() {
|
|
815
814
|
return n.manuallyPaused;
|
|
@@ -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 = g(i, "onPause"), m = g(i, "onPostPause");
|
|
823
|
+
l == null || l(), d(), O(), b._setSubtreeIsolation(!1), m == null || m();
|
|
825
824
|
} else {
|
|
826
|
-
var
|
|
827
|
-
|
|
825
|
+
var y = g(i, "onUnpause"), w = g(i, "onPostUnpause");
|
|
826
|
+
y == null || y(), b._setSubtreeIsolation(!0), R(), v(), 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;
|
|
@@ -853,113 +852,113 @@ var B = {
|
|
|
853
852
|
});
|
|
854
853
|
}
|
|
855
854
|
}
|
|
856
|
-
}),
|
|
855
|
+
}), b.updateContainerElements(e), b;
|
|
857
856
|
};
|
|
858
|
-
const
|
|
857
|
+
const dt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
859
858
|
__proto__: null,
|
|
860
|
-
createFocusTrap:
|
|
861
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
859
|
+
createFocusTrap: ft
|
|
860
|
+
}, Symbol.toStringTag, { value: "Module" })), vt = /* @__PURE__ */ we(dt), pt = /* @__PURE__ */ we(Je);
|
|
862
861
|
var Te;
|
|
863
|
-
function
|
|
862
|
+
function bt() {
|
|
864
863
|
if (Te) return Q.exports;
|
|
865
864
|
Te = 1;
|
|
866
|
-
function r(
|
|
865
|
+
function r(v) {
|
|
867
866
|
"@babel/helpers - typeof";
|
|
868
|
-
return r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(
|
|
869
|
-
return typeof
|
|
870
|
-
} : function(
|
|
871
|
-
return
|
|
872
|
-
}, r(
|
|
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;
|
|
871
|
+
}, r(v);
|
|
873
872
|
}
|
|
874
873
|
var e, t;
|
|
875
|
-
function a(
|
|
876
|
-
if (!(
|
|
874
|
+
function a(v, f) {
|
|
875
|
+
if (!(v instanceof f)) throw new TypeError("Cannot call a class as a function");
|
|
877
876
|
}
|
|
878
|
-
function u(
|
|
879
|
-
for (var
|
|
880
|
-
var
|
|
881
|
-
|
|
877
|
+
function u(v, f) {
|
|
878
|
+
for (var d = 0; d < f.length; d++) {
|
|
879
|
+
var s = f[d];
|
|
880
|
+
s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(v, j(s.key), s);
|
|
882
881
|
}
|
|
883
882
|
}
|
|
884
|
-
function
|
|
885
|
-
return
|
|
883
|
+
function c(v, f, d) {
|
|
884
|
+
return f && u(v.prototype, f), Object.defineProperty(v, "prototype", { writable: !1 }), v;
|
|
886
885
|
}
|
|
887
|
-
function n(
|
|
888
|
-
return
|
|
886
|
+
function n(v, f, d) {
|
|
887
|
+
return f = S(f), b(v, k() ? Reflect.construct(f, d || [], S(v).constructor) : f.apply(v, d));
|
|
889
888
|
}
|
|
890
|
-
function
|
|
891
|
-
if (
|
|
892
|
-
if (
|
|
893
|
-
return
|
|
889
|
+
function b(v, 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");
|
|
892
|
+
return g(v);
|
|
894
893
|
}
|
|
895
|
-
function
|
|
896
|
-
if (
|
|
897
|
-
return
|
|
894
|
+
function g(v) {
|
|
895
|
+
if (v === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
896
|
+
return v;
|
|
898
897
|
}
|
|
899
898
|
function k() {
|
|
900
899
|
try {
|
|
901
|
-
var
|
|
900
|
+
var v = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
902
901
|
}));
|
|
903
902
|
} catch {
|
|
904
903
|
}
|
|
905
904
|
return (k = function() {
|
|
906
|
-
return !!
|
|
905
|
+
return !!v;
|
|
907
906
|
})();
|
|
908
907
|
}
|
|
909
|
-
function S(
|
|
910
|
-
return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(
|
|
911
|
-
return
|
|
912
|
-
}, S(
|
|
908
|
+
function S(v) {
|
|
909
|
+
return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(f) {
|
|
910
|
+
return f.__proto__ || Object.getPrototypeOf(f);
|
|
911
|
+
}, S(v);
|
|
913
912
|
}
|
|
914
|
-
function D(
|
|
915
|
-
if (typeof
|
|
916
|
-
|
|
913
|
+
function D(v, f) {
|
|
914
|
+
if (typeof f != "function" && f !== null) throw new TypeError("Super expression must either be null or a function");
|
|
915
|
+
v.prototype = Object.create(f && f.prototype, { constructor: { value: v, writable: !0, configurable: !0 } }), Object.defineProperty(v, "prototype", { writable: !1 }), f && R(v, f);
|
|
917
916
|
}
|
|
918
|
-
function R(
|
|
919
|
-
return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(
|
|
920
|
-
return
|
|
921
|
-
}, R(
|
|
917
|
+
function R(v, f) {
|
|
918
|
+
return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(d, s) {
|
|
919
|
+
return d.__proto__ = s, d;
|
|
920
|
+
}, R(v, f);
|
|
922
921
|
}
|
|
923
|
-
function
|
|
924
|
-
return (
|
|
922
|
+
function I(v, f, d) {
|
|
923
|
+
return (f = j(f)) in v ? Object.defineProperty(v, f, { value: d, enumerable: !0, configurable: !0, writable: !0 }) : v[f] = d, v;
|
|
925
924
|
}
|
|
926
|
-
function
|
|
927
|
-
var
|
|
928
|
-
return r(
|
|
925
|
+
function j(v) {
|
|
926
|
+
var f = x(v, "string");
|
|
927
|
+
return r(f) == "symbol" ? f : f + "";
|
|
929
928
|
}
|
|
930
|
-
function x(
|
|
931
|
-
if (r(
|
|
932
|
-
var
|
|
933
|
-
if (
|
|
934
|
-
var
|
|
935
|
-
if (r(
|
|
929
|
+
function x(v, f) {
|
|
930
|
+
if (r(v) != "object" || !v) return v;
|
|
931
|
+
var d = v[Symbol.toPrimitive];
|
|
932
|
+
if (d !== void 0) {
|
|
933
|
+
var s = d.call(v, f);
|
|
934
|
+
if (r(s) != "object") return s;
|
|
936
935
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
937
936
|
}
|
|
938
|
-
return (
|
|
937
|
+
return (f === "string" ? String : Number)(v);
|
|
939
938
|
}
|
|
940
|
-
var
|
|
941
|
-
function
|
|
942
|
-
var
|
|
943
|
-
a(this,
|
|
944
|
-
var o, i = (o = this.internalOptions[
|
|
939
|
+
var P = je, L = vt, M = L.createFocusTrap, Y = pt, $ = Y.isFocusable, G = parseInt((e = (t = /^(\d+)\./.exec(P.version)) === null || t === void 0 ? void 0 : t[1]) !== null && e !== void 0 ? e : 0, 10), K = /* @__PURE__ */ (function(v) {
|
|
940
|
+
function f(d) {
|
|
941
|
+
var s;
|
|
942
|
+
a(this, f), s = n(this, f, [d]), I(s, "getNodeForOption", function(h) {
|
|
943
|
+
var o, i = (o = this.internalOptions[h]) !== null && o !== void 0 ? o : this.originalOptions[h];
|
|
945
944
|
if (typeof i == "function") {
|
|
946
|
-
for (var
|
|
947
|
-
|
|
948
|
-
i = i.apply(void 0,
|
|
945
|
+
for (var l = arguments.length, m = new Array(l > 1 ? l - 1 : 0), y = 1; y < l; y++)
|
|
946
|
+
m[y - 1] = arguments[y];
|
|
947
|
+
i = i.apply(void 0, m);
|
|
949
948
|
}
|
|
950
949
|
if (i === !0 && (i = void 0), !i) {
|
|
951
950
|
if (i === void 0 || i === !1)
|
|
952
951
|
return i;
|
|
953
|
-
throw new Error("`".concat(
|
|
952
|
+
throw new Error("`".concat(h, "` 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
|
-
var
|
|
958
|
-
if (
|
|
959
|
-
throw new Error("`".concat(
|
|
956
|
+
var p;
|
|
957
|
+
if (w = (p = this.getDocument()) === null || p === void 0 ? void 0 : p.querySelector(i), !w)
|
|
958
|
+
throw new Error("`".concat(h, "` as selector refers to no known node"));
|
|
960
959
|
}
|
|
961
|
-
return
|
|
962
|
-
}),
|
|
960
|
+
return w;
|
|
961
|
+
}), s.handleDeactivate = s.handleDeactivate.bind(s), s.handlePostDeactivate = s.handlePostDeactivate.bind(s), s.handleClickOutsideDeactivates = s.handleClickOutsideDeactivates.bind(s), s.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: s.handleDeactivate,
|
|
972
|
+
onPostDeactivate: s.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: s.handleClickOutsideDeactivates
|
|
978
|
+
}, s.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 = d.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
|
+
s.originalOptions[O] = T[O];
|
|
997
996
|
continue;
|
|
998
997
|
}
|
|
999
|
-
|
|
998
|
+
s.internalOptions[O] = T[O];
|
|
1000
999
|
}
|
|
1001
|
-
return
|
|
1000
|
+
return s.outsideClick = null, s.focusTrapElements = d.containerElements || [], s.updatePreviousElement(), s;
|
|
1002
1001
|
}
|
|
1003
|
-
return D(
|
|
1002
|
+
return D(f, v), 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 s = this.getNodeForOption("setReturnFocus", this.previouslyFocusedElement);
|
|
1011
|
+
return s || (s === !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 s = this.getDocument();
|
|
1018
|
+
s && (this.previouslyFocusedElement = s.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(s) {
|
|
1043
|
+
var T = typeof this.originalOptions.clickOutsideDeactivates == "function" ? this.originalOptions.clickOutsideDeactivates.call(null, s) : this.originalOptions.clickOutsideDeactivates;
|
|
1044
|
+
return T && (this.outsideClick = {
|
|
1045
|
+
target: s.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
|
|
1060
|
-
(
|
|
1061
|
-
|
|
1062
|
-
(!
|
|
1063
|
-
|
|
1057
|
+
var s = this, T = function() {
|
|
1058
|
+
var h = s.getReturnFocusNode(), o = !!// did the consumer allow it?
|
|
1059
|
+
(s.originalOptions.returnFocusOnDeactivate && // can we actually focus the node?
|
|
1060
|
+
h !== null && h !== void 0 && h.focus && // was there an outside click that allowed deactivation?
|
|
1061
|
+
(!s.outsideClick || // did the consumer allow deactivation when the outside node was clicked?
|
|
1062
|
+
s.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
|
-
!$(
|
|
1067
|
-
o &&
|
|
1068
|
-
preventScroll:
|
|
1069
|
-
}),
|
|
1065
|
+
!$(s.outsideClick.target, s.internalOptions.tabbableOptions))), i = s.internalOptions.preventScroll, l = i === void 0 ? !1 : i;
|
|
1066
|
+
o && h.focus({
|
|
1067
|
+
preventScroll: l
|
|
1068
|
+
}), s.originalOptions.onPostDeactivate && s.originalOptions.onPostDeactivate.call(null), s.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 s = this.focusTrapElements.some(Boolean);
|
|
1079
|
+
s && (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(s) {
|
|
1091
1090
|
if (this.focusTrap) {
|
|
1092
|
-
|
|
1093
|
-
var
|
|
1094
|
-
if (
|
|
1091
|
+
s.containerElements !== this.props.containerElements && this.focusTrap.updateContainerElements(this.props.containerElements);
|
|
1092
|
+
var T = !s.active && this.props.active, O = s.active && !this.props.active, h = !s.paused && this.props.paused, o = s.paused && !this.props.paused;
|
|
1093
|
+
if (T && (this.updatePreviousElement(), this.focusTrap.activate()), O) {
|
|
1095
1094
|
this.deactivateTrap();
|
|
1096
1095
|
return;
|
|
1097
1096
|
}
|
|
1098
|
-
|
|
1097
|
+
h && this.focusTrap.pause(), o && this.focusTrap.unpause();
|
|
1099
1098
|
} else
|
|
1100
|
-
|
|
1099
|
+
s.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,140 +1106,147 @@ function ht() {
|
|
|
1107
1106
|
}, {
|
|
1108
1107
|
key: "render",
|
|
1109
1108
|
value: function() {
|
|
1110
|
-
var
|
|
1111
|
-
if (
|
|
1112
|
-
if (
|
|
1109
|
+
var s = this, T = this.props.children ? P.Children.only(this.props.children) : void 0;
|
|
1110
|
+
if (T) {
|
|
1111
|
+
if (T.type && T.type === P.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
|
-
},
|
|
1114
|
+
var l = s.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)), s.focusTrapElements = l || [i];
|
|
1116
|
+
}, h = P.cloneElement(T, {
|
|
1118
1117
|
ref: O
|
|
1119
1118
|
});
|
|
1120
|
-
return
|
|
1119
|
+
return h;
|
|
1121
1120
|
}
|
|
1122
1121
|
return null;
|
|
1123
1122
|
}
|
|
1124
1123
|
}]);
|
|
1125
|
-
})(
|
|
1126
|
-
return
|
|
1124
|
+
})(P.Component);
|
|
1125
|
+
return K.defaultProps = {
|
|
1127
1126
|
active: !0,
|
|
1128
1127
|
paused: !1,
|
|
1129
1128
|
focusTrapOptions: {},
|
|
1130
|
-
_createFocusTrap:
|
|
1131
|
-
}, Q.exports =
|
|
1129
|
+
_createFocusTrap: M
|
|
1130
|
+
}, Q.exports = K, Q.exports.FocusTrap = K, Q.exports;
|
|
1132
1131
|
}
|
|
1133
|
-
var
|
|
1134
|
-
const Ce =
|
|
1132
|
+
var ht = bt();
|
|
1133
|
+
const Ce = Ie({
|
|
1135
1134
|
isVisible: !1
|
|
1136
1135
|
}), {
|
|
1137
|
-
Provider:
|
|
1136
|
+
Provider: yt
|
|
1138
1137
|
} = Ce;
|
|
1139
|
-
function
|
|
1140
|
-
return
|
|
1138
|
+
function mt() {
|
|
1139
|
+
return Ae(Ce);
|
|
1141
1140
|
}
|
|
1142
|
-
function
|
|
1141
|
+
function gt() {
|
|
1143
1142
|
const {
|
|
1144
1143
|
close: r
|
|
1145
|
-
} =
|
|
1144
|
+
} = mt(), 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(Le, { iconLeft: _e.times, label: "Close", className: "kakadu-components-3855719072", onClick: e }) })
|
|
1151
1150
|
] });
|
|
1152
1151
|
}
|
|
1153
|
-
function
|
|
1152
|
+
function Tt({
|
|
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
|
+
decorators: e = [],
|
|
1161
|
+
maxWidth: t,
|
|
1162
|
+
className: a,
|
|
1163
|
+
isVisible: u,
|
|
1164
|
+
isFullWidth: c = !1,
|
|
1165
|
+
shouldCloseOnOutsideClick: n = !0,
|
|
1166
|
+
shouldCloseOnEscapePress: b = !0,
|
|
1167
|
+
showCloseButton: g = !0,
|
|
1168
|
+
onClose: k,
|
|
1169
|
+
children: S
|
|
1164
1170
|
}) {
|
|
1165
|
-
const
|
|
1166
|
-
|
|
1167
|
-
}, []),
|
|
1168
|
-
|
|
1169
|
-
}, []), [
|
|
1170
|
-
isVisible:
|
|
1171
|
-
setInitialFocus:
|
|
1172
|
-
close:
|
|
1173
|
-
}), [
|
|
1171
|
+
const D = te(null), R = te(null), [I, j] = re(!1), [x, P] = re(!1), L = J((d) => {
|
|
1172
|
+
D.current = d, P(!1);
|
|
1173
|
+
}, []), M = te(null), Y = J((d) => {
|
|
1174
|
+
d && (M.current = d);
|
|
1175
|
+
}, []), [$, G] = re(u ?? !1), K = ne(() => ({
|
|
1176
|
+
isVisible: $,
|
|
1177
|
+
setInitialFocus: Y,
|
|
1178
|
+
close: L
|
|
1179
|
+
}), [$, Y, L]);
|
|
1174
1180
|
H(() => {
|
|
1175
|
-
|
|
1176
|
-
}, [
|
|
1177
|
-
if (
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1181
|
+
u && (j(!0), G(!0));
|
|
1182
|
+
}, [u]), H(() => {
|
|
1183
|
+
if (u) {
|
|
1184
|
+
const d = setTimeout(() => {
|
|
1185
|
+
P(!0);
|
|
1180
1186
|
}, 100);
|
|
1181
1187
|
return () => {
|
|
1182
|
-
clearTimeout(
|
|
1188
|
+
clearTimeout(d);
|
|
1183
1189
|
};
|
|
1184
1190
|
}
|
|
1185
|
-
|
|
1186
|
-
}, [
|
|
1187
|
-
if (
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1191
|
+
P(!1);
|
|
1192
|
+
}, [u]), H(() => {
|
|
1193
|
+
if (I && !x) {
|
|
1194
|
+
const d = setTimeout(() => {
|
|
1195
|
+
k == null || k(D.current ?? void 0), G(!1);
|
|
1190
1196
|
}, 370);
|
|
1191
1197
|
return () => {
|
|
1192
|
-
clearTimeout(
|
|
1198
|
+
clearTimeout(d);
|
|
1193
1199
|
};
|
|
1194
1200
|
}
|
|
1195
|
-
}, [
|
|
1196
|
-
const
|
|
1197
|
-
if (
|
|
1198
|
-
const
|
|
1199
|
-
|
|
1201
|
+
}, [I, x, k]), H(() => {
|
|
1202
|
+
const d = R.current;
|
|
1203
|
+
if (u && n && d) {
|
|
1204
|
+
const s = (T) => {
|
|
1205
|
+
d === T.target && P(!1);
|
|
1200
1206
|
};
|
|
1201
|
-
return
|
|
1202
|
-
|
|
1207
|
+
return d.addEventListener("click", s), () => {
|
|
1208
|
+
d.removeEventListener("click", s);
|
|
1203
1209
|
};
|
|
1204
1210
|
}
|
|
1205
|
-
}, [
|
|
1206
|
-
if (!
|
|
1211
|
+
}, [u, n]), H(() => {
|
|
1212
|
+
if (!u || !b)
|
|
1207
1213
|
return;
|
|
1208
|
-
const
|
|
1209
|
-
|
|
1214
|
+
const d = (s) => {
|
|
1215
|
+
s.key === "Escape" && P(!1);
|
|
1210
1216
|
};
|
|
1211
|
-
return window.addEventListener("keydown",
|
|
1212
|
-
window.removeEventListener("keydown",
|
|
1217
|
+
return window.addEventListener("keydown", d), () => {
|
|
1218
|
+
window.removeEventListener("keydown", d);
|
|
1213
1219
|
};
|
|
1214
|
-
}, [
|
|
1215
|
-
const
|
|
1216
|
-
initialFocus: () =>
|
|
1220
|
+
}, [u, b]);
|
|
1221
|
+
const v = ne(() => ({
|
|
1222
|
+
initialFocus: () => M.current ?? void 0,
|
|
1217
1223
|
onActivate: () => {
|
|
1218
|
-
var
|
|
1219
|
-
return (
|
|
1224
|
+
var d;
|
|
1225
|
+
return (d = M.current) == null ? void 0 : d.focus();
|
|
1220
1226
|
}
|
|
1221
|
-
}), []),
|
|
1222
|
-
"--max-width":
|
|
1223
|
-
}, className: pe(
|
|
1224
|
-
|
|
1225
|
-
/* @__PURE__ */
|
|
1226
|
-
] }) }) }) }) });
|
|
1227
|
-
return r ? xe(
|
|
1227
|
+
}), []), f = /* @__PURE__ */ N.jsx(Tt, { decorators: e, children: /* @__PURE__ */ N.jsx("div", { style: {
|
|
1228
|
+
"--max-width": t ? `${t}px` : void 0
|
|
1229
|
+
}, className: pe("kakadu-components-4119461136", x && "kakadu-components-2522346797", a), children: /* @__PURE__ */ N.jsx(ht.FocusTrap, { active: x, focusTrapOptions: v, children: /* @__PURE__ */ N.jsx("div", { ref: R, className: "kakadu-components-3001745367", children: /* @__PURE__ */ N.jsx("div", { className: pe("kakadu-components-3903793117", c && "kakadu-components-2700481558", x && "kakadu-components-2379306144"), children: /* @__PURE__ */ N.jsxs(yt, { value: K, children: [
|
|
1230
|
+
g ? /* @__PURE__ */ N.jsx(gt, {}) : null,
|
|
1231
|
+
/* @__PURE__ */ N.jsx("div", { className: "kakadu-components-4238836556", children: S })
|
|
1232
|
+
] }) }) }) }) }) });
|
|
1233
|
+
return r ? xe(f, r) : f;
|
|
1228
1234
|
}
|
|
1229
|
-
function
|
|
1230
|
-
const [t, a] = re(!1), u = te(void 0),
|
|
1231
|
-
u.current =
|
|
1232
|
-
})), []), n = J((
|
|
1235
|
+
function Nt(r, e) {
|
|
1236
|
+
const [t, a] = re(!1), u = te(void 0), c = J(async () => (a(!0), new Promise((g) => {
|
|
1237
|
+
u.current = g;
|
|
1238
|
+
})), []), n = J((g) => {
|
|
1233
1239
|
var k;
|
|
1234
|
-
a(!1), (k = u.current) == null || k.call(u,
|
|
1235
|
-
}, []),
|
|
1240
|
+
a(!1), (k = u.current) == null || k.call(u, g), u.current = void 0;
|
|
1241
|
+
}, []), b = ne(() => /* @__PURE__ */ N.jsx(r, { ...e, isVisible: t, onClose: n }), [r, e, t, n]);
|
|
1236
1242
|
return ne(() => ({
|
|
1237
1243
|
isVisible: t,
|
|
1238
|
-
show:
|
|
1239
|
-
modal:
|
|
1240
|
-
}), [t,
|
|
1244
|
+
show: c,
|
|
1245
|
+
modal: b
|
|
1246
|
+
}), [t, c, b]);
|
|
1241
1247
|
}
|
|
1242
1248
|
export {
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1249
|
+
Dt as default,
|
|
1250
|
+
Nt as useModal,
|
|
1251
|
+
mt as useModalContext
|
|
1246
1252
|
};
|