@ogcio/design-system-react 1.26.0 → 1.28.0
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/README.md +27 -11
- package/dist/autocomplete/use-autocomplete-controller.js +1 -1
- package/dist/browser-support/browser-support.js +1 -1
- package/dist/character-count/character-count.d.ts +6 -0
- package/dist/character-count/character-count.js +23 -0
- package/dist/character-count/types.d.ts +10 -0
- package/dist/character-count/types.js +1 -0
- package/dist/data-table/editable-table-cell.js +1 -1
- package/dist/forms/form-field/form-field.js +1 -1
- package/dist/forms/form-field-with-tag/form-field-with-tag.js +1 -1
- package/dist/header/header-next/components/menu/components/header-menu-item-button.js +1 -1
- package/dist/header/header-next/components/menu/components/header-menu-item-link.js +1 -1
- package/dist/hooks/use-focus-trap.js +574 -416
- package/dist/i18n/config.js +2 -2
- package/dist/i18n/utility.js +1 -1
- package/dist/{i18nInstance-D_96ADqd.js → i18nInstance-AYICsHJu.js} +8 -6
- package/dist/{i18next-B_GQfCrJ.js → i18next-Bfi2-LyH.js} +125 -117
- package/dist/index-D_wwt4P0.js +87 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +232 -229
- package/dist/link/link.js +33 -33
- package/dist/load-symbols/load-symbols.d.ts +7 -0
- package/dist/{load-fonts/load-fonts.js → load-symbols/load-symbols.js} +7 -13
- package/dist/{lodash-LsP9-6SV.js → lodash-82PmXrjJ.js} +16 -16
- package/dist/pagination/pagination.js +249 -221
- package/dist/primitives/anchor.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/textarea/textarea.d.ts +6 -0
- package/dist/textarea/textarea.js +33 -33
- package/dist/useTranslation-DiBQuy8S.js +268 -0
- package/package.json +2 -2
- package/dist/index-2sRBqKFV.js +0 -78
- package/dist/load-fonts/load-fonts.d.ts +0 -40
- package/dist/useTranslation-BmIU4GBA.js +0 -272
|
@@ -1,329 +1,409 @@
|
|
|
1
|
-
import { useLayoutEffect as
|
|
1
|
+
import { useLayoutEffect as ge } from "react";
|
|
2
2
|
/*!
|
|
3
|
-
* tabbable 6.
|
|
3
|
+
* tabbable 6.4.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
5
|
*/
|
|
6
|
-
var
|
|
7
|
-
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector,
|
|
6
|
+
var se = ["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] *)"], M = /* @__PURE__ */ se.join(","), ce = typeof Element > "u", O = ce ? function() {
|
|
7
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, _ = !ce && Element.prototype.getRootNode ? function(r) {
|
|
8
8
|
var e;
|
|
9
9
|
return r == null || (e = r.getRootNode) === null || e === void 0 ? void 0 : e.call(r);
|
|
10
10
|
} : function(r) {
|
|
11
11
|
return r == null ? void 0 : r.ownerDocument;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
12
|
+
}, G = function(e, t) {
|
|
13
|
+
var n;
|
|
14
14
|
t === void 0 && (t = !0);
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
var u = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "inert"), l = u === "" || u === "true", a = l || t && e && // closest does not exist on shadow roots, so we fall back to a manual
|
|
16
|
+
// lookup upward, in case it is not defined.
|
|
17
|
+
(typeof e.closest == "function" ? e.closest("[inert]") : G(e.parentNode));
|
|
18
|
+
return a;
|
|
19
|
+
}, we = function(e) {
|
|
20
|
+
var t, n = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
|
|
21
|
+
return n === "" || n === "true";
|
|
22
|
+
}, fe = function(e, t, n) {
|
|
23
|
+
if (G(e))
|
|
22
24
|
return [];
|
|
23
|
-
var
|
|
24
|
-
return t &&
|
|
25
|
-
},
|
|
26
|
-
for (var
|
|
27
|
-
var
|
|
28
|
-
if (!
|
|
29
|
-
if (
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
scopeParent:
|
|
33
|
-
candidates:
|
|
25
|
+
var u = Array.prototype.slice.apply(e.querySelectorAll(M));
|
|
26
|
+
return t && O.call(e, M) && u.unshift(e), u = u.filter(n), u;
|
|
27
|
+
}, V = function(e, t, n) {
|
|
28
|
+
for (var u = [], l = Array.from(e); l.length; ) {
|
|
29
|
+
var a = l.shift();
|
|
30
|
+
if (!G(a, !1))
|
|
31
|
+
if (a.tagName === "SLOT") {
|
|
32
|
+
var v = a.assignedElements(), y = v.length ? v : a.children, g = V(y, !0, n);
|
|
33
|
+
n.flatten ? u.push.apply(u, g) : u.push({
|
|
34
|
+
scopeParent: a,
|
|
35
|
+
candidates: g
|
|
34
36
|
});
|
|
35
37
|
} else {
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
typeof
|
|
40
|
-
if (
|
|
41
|
-
var
|
|
42
|
-
|
|
43
|
-
scopeParent:
|
|
44
|
-
candidates:
|
|
38
|
+
var w = O.call(a, M);
|
|
39
|
+
w && n.filter(a) && (t || !e.includes(a)) && u.push(a);
|
|
40
|
+
var T = a.shadowRoot || // check for an undisclosed shadow
|
|
41
|
+
typeof n.getShadowRoot == "function" && n.getShadowRoot(a), I = !G(T, !1) && (!n.shadowRootFilter || n.shadowRootFilter(a));
|
|
42
|
+
if (T && I) {
|
|
43
|
+
var P = V(T === !0 ? a.children : T.children, !0, n);
|
|
44
|
+
n.flatten ? u.push.apply(u, P) : u.push({
|
|
45
|
+
scopeParent: a,
|
|
46
|
+
candidates: P
|
|
45
47
|
});
|
|
46
48
|
} else
|
|
47
|
-
|
|
49
|
+
l.unshift.apply(l, a.children);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
return
|
|
51
|
-
},
|
|
52
|
+
return u;
|
|
53
|
+
}, de = function(e) {
|
|
52
54
|
return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
|
|
53
|
-
},
|
|
55
|
+
}, D = function(e) {
|
|
54
56
|
if (!e)
|
|
55
57
|
throw new Error("No node provided");
|
|
56
|
-
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) ||
|
|
57
|
-
},
|
|
58
|
-
var
|
|
59
|
-
return
|
|
60
|
-
},
|
|
58
|
+
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || we(e)) && !de(e) ? 0 : e.tabIndex;
|
|
59
|
+
}, Te = function(e, t) {
|
|
60
|
+
var n = D(e);
|
|
61
|
+
return n < 0 && t && !de(e) ? 0 : n;
|
|
62
|
+
}, Se = function(e, t) {
|
|
61
63
|
return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
|
|
62
|
-
},
|
|
64
|
+
}, ve = function(e) {
|
|
63
65
|
return e.tagName === "INPUT";
|
|
64
|
-
},
|
|
65
|
-
return
|
|
66
|
-
},
|
|
67
|
-
var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(
|
|
68
|
-
return
|
|
66
|
+
}, Ne = function(e) {
|
|
67
|
+
return ve(e) && e.type === "hidden";
|
|
68
|
+
}, Ee = function(e) {
|
|
69
|
+
var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(n) {
|
|
70
|
+
return n.tagName === "SUMMARY";
|
|
69
71
|
});
|
|
70
72
|
return t;
|
|
71
|
-
},
|
|
72
|
-
for (var
|
|
73
|
-
if (e[
|
|
74
|
-
return e[
|
|
75
|
-
},
|
|
73
|
+
}, Fe = function(e, t) {
|
|
74
|
+
for (var n = 0; n < e.length; n++)
|
|
75
|
+
if (e[n].checked && e[n].form === t)
|
|
76
|
+
return e[n];
|
|
77
|
+
}, ke = function(e) {
|
|
76
78
|
if (!e.name)
|
|
77
79
|
return !0;
|
|
78
|
-
var t = e.form ||
|
|
79
|
-
return t.querySelectorAll('input[type="radio"][name="' +
|
|
80
|
-
},
|
|
80
|
+
var t = e.form || _(e), n = function(v) {
|
|
81
|
+
return t.querySelectorAll('input[type="radio"][name="' + v + '"]');
|
|
82
|
+
}, u;
|
|
81
83
|
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
82
|
-
|
|
84
|
+
u = n(window.CSS.escape(e.name));
|
|
83
85
|
else
|
|
84
86
|
try {
|
|
85
|
-
|
|
86
|
-
} catch (
|
|
87
|
-
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",
|
|
87
|
+
u = n(e.name);
|
|
88
|
+
} catch (a) {
|
|
89
|
+
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", a.message), !1;
|
|
88
90
|
}
|
|
89
|
-
var
|
|
90
|
-
return !
|
|
91
|
-
},
|
|
92
|
-
return
|
|
93
|
-
},
|
|
94
|
-
return
|
|
95
|
-
},
|
|
96
|
-
var t,
|
|
97
|
-
if (
|
|
98
|
-
var
|
|
99
|
-
for (
|
|
100
|
-
var
|
|
101
|
-
|
|
91
|
+
var l = Fe(u, e.form);
|
|
92
|
+
return !l || l === e;
|
|
93
|
+
}, Ae = function(e) {
|
|
94
|
+
return ve(e) && e.type === "radio";
|
|
95
|
+
}, Ie = function(e) {
|
|
96
|
+
return Ae(e) && !ke(e);
|
|
97
|
+
}, Re = function(e) {
|
|
98
|
+
var t, n = e && _(e), u = (t = n) === null || t === void 0 ? void 0 : t.host, l = !1;
|
|
99
|
+
if (n && n !== e) {
|
|
100
|
+
var a, v, y;
|
|
101
|
+
for (l = !!((a = u) !== null && a !== void 0 && (v = a.ownerDocument) !== null && v !== void 0 && v.contains(u) || e != null && (y = e.ownerDocument) !== null && y !== void 0 && y.contains(e)); !l && u; ) {
|
|
102
|
+
var g, w, T;
|
|
103
|
+
n = _(u), u = (g = n) === null || g === void 0 ? void 0 : g.host, l = !!((w = u) !== null && w !== void 0 && (T = w.ownerDocument) !== null && T !== void 0 && T.contains(u));
|
|
102
104
|
}
|
|
103
105
|
}
|
|
104
|
-
return
|
|
105
|
-
},
|
|
106
|
-
var t = e.getBoundingClientRect(),
|
|
107
|
-
return
|
|
108
|
-
},
|
|
109
|
-
var
|
|
106
|
+
return l;
|
|
107
|
+
}, ne = function(e) {
|
|
108
|
+
var t = e.getBoundingClientRect(), n = t.width, u = t.height;
|
|
109
|
+
return n === 0 && u === 0;
|
|
110
|
+
}, De = function(e, t) {
|
|
111
|
+
var n = t.displayCheck, u = t.getShadowRoot;
|
|
112
|
+
if (n === "full-native" && "checkVisibility" in e) {
|
|
113
|
+
var l = e.checkVisibility({
|
|
114
|
+
// Checking opacity might be desirable for some use cases, but natively,
|
|
115
|
+
// opacity zero elements _are_ focusable and tabbable.
|
|
116
|
+
checkOpacity: !1,
|
|
117
|
+
opacityProperty: !1,
|
|
118
|
+
contentVisibilityAuto: !0,
|
|
119
|
+
visibilityProperty: !0,
|
|
120
|
+
// This is an alias for `visibilityProperty`. Contemporary browsers
|
|
121
|
+
// support both. However, this alias has wider browser support (Chrome
|
|
122
|
+
// >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
|
|
123
|
+
// we include it anyway.
|
|
124
|
+
checkVisibilityCSS: !0
|
|
125
|
+
});
|
|
126
|
+
return !l;
|
|
127
|
+
}
|
|
110
128
|
if (getComputedStyle(e).visibility === "hidden")
|
|
111
129
|
return !0;
|
|
112
|
-
var
|
|
113
|
-
if (
|
|
130
|
+
var a = O.call(e, "details>summary:first-of-type"), v = a ? e.parentElement : e;
|
|
131
|
+
if (O.call(v, "details:not([open]) *"))
|
|
114
132
|
return !0;
|
|
115
|
-
if (!
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
133
|
+
if (!n || n === "full" || // full-native can run this branch when it falls through in case
|
|
134
|
+
// Element#checkVisibility is unsupported
|
|
135
|
+
n === "full-native" || n === "legacy-full") {
|
|
136
|
+
if (typeof u == "function") {
|
|
137
|
+
for (var y = e; e; ) {
|
|
138
|
+
var g = e.parentElement, w = _(e);
|
|
139
|
+
if (g && !g.shadowRoot && u(g) === !0)
|
|
140
|
+
return ne(e);
|
|
141
|
+
e.assignedSlot ? e = e.assignedSlot : !g && w !== e.ownerDocument ? e = w.host : e = g;
|
|
122
142
|
}
|
|
123
|
-
e =
|
|
143
|
+
e = y;
|
|
124
144
|
}
|
|
125
|
-
if (
|
|
145
|
+
if (Re(e))
|
|
126
146
|
return !e.getClientRects().length;
|
|
127
|
-
if (
|
|
147
|
+
if (n !== "legacy-full")
|
|
128
148
|
return !0;
|
|
129
|
-
} else if (
|
|
130
|
-
return
|
|
149
|
+
} else if (n === "non-zero-area")
|
|
150
|
+
return ne(e);
|
|
131
151
|
return !1;
|
|
132
|
-
},
|
|
152
|
+
}, Oe = function(e) {
|
|
133
153
|
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
|
|
134
154
|
for (var t = e.parentElement; t; ) {
|
|
135
155
|
if (t.tagName === "FIELDSET" && t.disabled) {
|
|
136
|
-
for (var
|
|
137
|
-
var
|
|
138
|
-
if (
|
|
139
|
-
return
|
|
156
|
+
for (var n = 0; n < t.children.length; n++) {
|
|
157
|
+
var u = t.children.item(n);
|
|
158
|
+
if (u.tagName === "LEGEND")
|
|
159
|
+
return O.call(t, "fieldset[disabled] *") ? !0 : !u.contains(e);
|
|
140
160
|
}
|
|
141
161
|
return !0;
|
|
142
162
|
}
|
|
143
163
|
t = t.parentElement;
|
|
144
164
|
}
|
|
145
165
|
return !1;
|
|
146
|
-
},
|
|
147
|
-
return !(t.disabled ||
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}, U = function(e, t) {
|
|
153
|
-
return !(Ee(t) || k(t) < 0 || !G(e, t));
|
|
154
|
-
}, De = function(e) {
|
|
166
|
+
}, q = function(e, t) {
|
|
167
|
+
return !(t.disabled || Ne(t) || De(t, e) || // For a details element with a summary, the summary element gets the focus
|
|
168
|
+
Ee(t) || Oe(t));
|
|
169
|
+
}, Z = function(e, t) {
|
|
170
|
+
return !(Ie(t) || D(t) < 0 || !q(e, t));
|
|
171
|
+
}, Pe = function(e) {
|
|
155
172
|
var t = parseInt(e.getAttribute("tabindex"), 10);
|
|
156
173
|
return !!(isNaN(t) || t >= 0);
|
|
157
|
-
},
|
|
158
|
-
var t = [],
|
|
159
|
-
return e.forEach(function(
|
|
160
|
-
var
|
|
161
|
-
|
|
162
|
-
documentOrder:
|
|
163
|
-
tabIndex:
|
|
164
|
-
item:
|
|
165
|
-
isScope:
|
|
166
|
-
content:
|
|
174
|
+
}, be = function(e) {
|
|
175
|
+
var t = [], n = [];
|
|
176
|
+
return e.forEach(function(u, l) {
|
|
177
|
+
var a = !!u.scopeParent, v = a ? u.scopeParent : u, y = Te(v, a), g = a ? be(u.candidates) : v;
|
|
178
|
+
y === 0 ? a ? t.push.apply(t, g) : t.push(v) : n.push({
|
|
179
|
+
documentOrder: l,
|
|
180
|
+
tabIndex: y,
|
|
181
|
+
item: u,
|
|
182
|
+
isScope: a,
|
|
183
|
+
content: g
|
|
167
184
|
});
|
|
168
|
-
}),
|
|
169
|
-
return
|
|
185
|
+
}), n.sort(Se).reduce(function(u, l) {
|
|
186
|
+
return l.isScope ? u.push.apply(u, l.content) : u.push(l.content), u;
|
|
170
187
|
}, []).concat(t);
|
|
171
|
-
},
|
|
188
|
+
}, Ce = function(e, t) {
|
|
172
189
|
t = t || {};
|
|
173
|
-
var
|
|
174
|
-
return t.getShadowRoot ?
|
|
175
|
-
filter:
|
|
190
|
+
var n;
|
|
191
|
+
return t.getShadowRoot ? n = V([e], t.includeContainer, {
|
|
192
|
+
filter: Z.bind(null, t),
|
|
176
193
|
flatten: !1,
|
|
177
194
|
getShadowRoot: t.getShadowRoot,
|
|
178
|
-
shadowRootFilter:
|
|
179
|
-
}) :
|
|
180
|
-
},
|
|
195
|
+
shadowRootFilter: Pe
|
|
196
|
+
}) : n = fe(e, t.includeContainer, Z.bind(null, t)), be(n);
|
|
197
|
+
}, je = function(e, t) {
|
|
181
198
|
t = t || {};
|
|
182
|
-
var
|
|
183
|
-
return t.getShadowRoot ?
|
|
184
|
-
filter:
|
|
199
|
+
var n;
|
|
200
|
+
return t.getShadowRoot ? n = V([e], t.includeContainer, {
|
|
201
|
+
filter: q.bind(null, t),
|
|
185
202
|
flatten: !0,
|
|
186
203
|
getShadowRoot: t.getShadowRoot
|
|
187
|
-
}) :
|
|
188
|
-
},
|
|
204
|
+
}) : n = fe(e, t.includeContainer, q.bind(null, t)), n;
|
|
205
|
+
}, C = function(e, t) {
|
|
189
206
|
if (t = t || {}, !e)
|
|
190
207
|
throw new Error("No node provided");
|
|
191
|
-
return
|
|
192
|
-
},
|
|
208
|
+
return O.call(e, M) === !1 ? !1 : Z(t, e);
|
|
209
|
+
}, Le = /* @__PURE__ */ se.concat("iframe:not([inert]):not([inert] *)").join(","), H = function(e, t) {
|
|
193
210
|
if (t = t || {}, !e)
|
|
194
211
|
throw new Error("No node provided");
|
|
195
|
-
return
|
|
212
|
+
return O.call(e, Le) === !1 ? !1 : q(t, e);
|
|
196
213
|
};
|
|
197
214
|
/*!
|
|
198
|
-
* focus-trap 7.
|
|
215
|
+
* focus-trap 7.8.0
|
|
199
216
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
200
217
|
*/
|
|
201
|
-
function
|
|
218
|
+
function z(r, e) {
|
|
202
219
|
(e == null || e > r.length) && (e = r.length);
|
|
203
|
-
for (var t = 0,
|
|
204
|
-
return
|
|
220
|
+
for (var t = 0, n = Array(e); t < e; t++) n[t] = r[t];
|
|
221
|
+
return n;
|
|
205
222
|
}
|
|
206
|
-
function
|
|
207
|
-
if (Array.isArray(r)) return
|
|
223
|
+
function xe(r) {
|
|
224
|
+
if (Array.isArray(r)) return z(r);
|
|
225
|
+
}
|
|
226
|
+
function ie(r, e) {
|
|
227
|
+
var t = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
228
|
+
if (!t) {
|
|
229
|
+
if (Array.isArray(r) || (t = he(r)) || e) {
|
|
230
|
+
t && (r = t);
|
|
231
|
+
var n = 0, u = function() {
|
|
232
|
+
};
|
|
233
|
+
return {
|
|
234
|
+
s: u,
|
|
235
|
+
n: function() {
|
|
236
|
+
return n >= r.length ? {
|
|
237
|
+
done: !0
|
|
238
|
+
} : {
|
|
239
|
+
done: !1,
|
|
240
|
+
value: r[n++]
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
e: function(y) {
|
|
244
|
+
throw y;
|
|
245
|
+
},
|
|
246
|
+
f: u
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
250
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
251
|
+
}
|
|
252
|
+
var l, a = !0, v = !1;
|
|
253
|
+
return {
|
|
254
|
+
s: function() {
|
|
255
|
+
t = t.call(r);
|
|
256
|
+
},
|
|
257
|
+
n: function() {
|
|
258
|
+
var y = t.next();
|
|
259
|
+
return a = y.done, y;
|
|
260
|
+
},
|
|
261
|
+
e: function(y) {
|
|
262
|
+
v = !0, l = y;
|
|
263
|
+
},
|
|
264
|
+
f: function() {
|
|
265
|
+
try {
|
|
266
|
+
a || t.return == null || t.return();
|
|
267
|
+
} finally {
|
|
268
|
+
if (v) throw l;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
};
|
|
208
272
|
}
|
|
209
|
-
function
|
|
210
|
-
return (e =
|
|
273
|
+
function Be(r, e, t) {
|
|
274
|
+
return (e = Ve(e)) in r ? Object.defineProperty(r, e, {
|
|
211
275
|
value: t,
|
|
212
276
|
enumerable: !0,
|
|
213
277
|
configurable: !0,
|
|
214
278
|
writable: !0
|
|
215
279
|
}) : r[e] = t, r;
|
|
216
280
|
}
|
|
217
|
-
function
|
|
281
|
+
function Ke(r) {
|
|
218
282
|
if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
|
|
219
283
|
}
|
|
220
|
-
function
|
|
284
|
+
function Me() {
|
|
221
285
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
222
286
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
223
287
|
}
|
|
224
|
-
function
|
|
288
|
+
function oe(r, e) {
|
|
225
289
|
var t = Object.keys(r);
|
|
226
290
|
if (Object.getOwnPropertySymbols) {
|
|
227
|
-
var
|
|
228
|
-
e && (
|
|
229
|
-
return Object.getOwnPropertyDescriptor(r,
|
|
230
|
-
})), t.push.apply(t,
|
|
291
|
+
var n = Object.getOwnPropertySymbols(r);
|
|
292
|
+
e && (n = n.filter(function(u) {
|
|
293
|
+
return Object.getOwnPropertyDescriptor(r, u).enumerable;
|
|
294
|
+
})), t.push.apply(t, n);
|
|
231
295
|
}
|
|
232
296
|
return t;
|
|
233
297
|
}
|
|
234
|
-
function
|
|
298
|
+
function ue(r) {
|
|
235
299
|
for (var e = 1; e < arguments.length; e++) {
|
|
236
300
|
var t = arguments[e] != null ? arguments[e] : {};
|
|
237
|
-
e % 2 ?
|
|
238
|
-
|
|
239
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) :
|
|
240
|
-
Object.defineProperty(r,
|
|
301
|
+
e % 2 ? oe(Object(t), !0).forEach(function(n) {
|
|
302
|
+
Be(r, n, t[n]);
|
|
303
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : oe(Object(t)).forEach(function(n) {
|
|
304
|
+
Object.defineProperty(r, n, Object.getOwnPropertyDescriptor(t, n));
|
|
241
305
|
});
|
|
242
306
|
}
|
|
243
307
|
return r;
|
|
244
308
|
}
|
|
245
|
-
function
|
|
246
|
-
return
|
|
309
|
+
function _e(r) {
|
|
310
|
+
return xe(r) || Ke(r) || he(r) || Me();
|
|
247
311
|
}
|
|
248
|
-
function
|
|
312
|
+
function Ge(r, e) {
|
|
249
313
|
if (typeof r != "object" || !r) return r;
|
|
250
314
|
var t = r[Symbol.toPrimitive];
|
|
251
315
|
if (t !== void 0) {
|
|
252
|
-
var
|
|
253
|
-
if (typeof
|
|
316
|
+
var n = t.call(r, e);
|
|
317
|
+
if (typeof n != "object") return n;
|
|
254
318
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
255
319
|
}
|
|
256
320
|
return (e === "string" ? String : Number)(r);
|
|
257
321
|
}
|
|
258
|
-
function
|
|
259
|
-
var e =
|
|
322
|
+
function Ve(r) {
|
|
323
|
+
var e = Ge(r, "string");
|
|
260
324
|
return typeof e == "symbol" ? e : e + "";
|
|
261
325
|
}
|
|
262
|
-
function
|
|
326
|
+
function he(r, e) {
|
|
263
327
|
if (r) {
|
|
264
|
-
if (typeof r == "string") return
|
|
328
|
+
if (typeof r == "string") return z(r, e);
|
|
265
329
|
var t = {}.toString.call(r).slice(8, -1);
|
|
266
|
-
return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ?
|
|
330
|
+
return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? z(r, e) : void 0;
|
|
267
331
|
}
|
|
268
332
|
}
|
|
269
|
-
var
|
|
333
|
+
var F = {
|
|
334
|
+
// Returns the trap from the top of the stack.
|
|
335
|
+
getActiveTrap: function(e) {
|
|
336
|
+
return (e == null ? void 0 : e.length) > 0 ? e[e.length - 1] : null;
|
|
337
|
+
},
|
|
338
|
+
// Pauses the currently active trap, then adds a new trap to the stack.
|
|
270
339
|
activateTrap: function(e, t) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
var o = e.indexOf(t);
|
|
276
|
-
o === -1 || e.splice(o, 1), e.push(t);
|
|
340
|
+
var n = F.getActiveTrap(e);
|
|
341
|
+
t !== n && F.pauseTrap(e);
|
|
342
|
+
var u = e.indexOf(t);
|
|
343
|
+
u === -1 || e.splice(u, 1), e.push(t);
|
|
277
344
|
},
|
|
345
|
+
// Removes the trap from the top of the stack, then unpauses the next trap down.
|
|
278
346
|
deactivateTrap: function(e, t) {
|
|
279
|
-
var
|
|
280
|
-
|
|
347
|
+
var n = e.indexOf(t);
|
|
348
|
+
n !== -1 && e.splice(n, 1), F.unpauseTrap(e);
|
|
349
|
+
},
|
|
350
|
+
// Pauses the trap at the top of the stack.
|
|
351
|
+
pauseTrap: function(e) {
|
|
352
|
+
var t = F.getActiveTrap(e);
|
|
353
|
+
t == null || t._setPausedState(!0);
|
|
354
|
+
},
|
|
355
|
+
// Unpauses the trap at the top of the stack.
|
|
356
|
+
unpauseTrap: function(e) {
|
|
357
|
+
var t = F.getActiveTrap(e);
|
|
358
|
+
t && !t._isManuallyPaused() && t._setPausedState(!1);
|
|
281
359
|
}
|
|
282
360
|
}, qe = function(e) {
|
|
283
361
|
return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
|
|
284
|
-
},
|
|
362
|
+
}, Ue = function(e) {
|
|
285
363
|
return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
|
|
286
364
|
}, x = function(e) {
|
|
287
365
|
return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
|
|
288
|
-
},
|
|
366
|
+
}, We = function(e) {
|
|
289
367
|
return x(e) && !e.shiftKey;
|
|
290
|
-
},
|
|
368
|
+
}, Ye = function(e) {
|
|
291
369
|
return x(e) && e.shiftKey;
|
|
292
|
-
},
|
|
370
|
+
}, le = function(e) {
|
|
293
371
|
return setTimeout(e, 0);
|
|
294
|
-
},
|
|
295
|
-
for (var t = arguments.length,
|
|
296
|
-
|
|
297
|
-
return typeof e == "function" ? e.apply(void 0,
|
|
298
|
-
},
|
|
372
|
+
}, L = function(e) {
|
|
373
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), u = 1; u < t; u++)
|
|
374
|
+
n[u - 1] = arguments[u];
|
|
375
|
+
return typeof e == "function" ? e.apply(void 0, n) : e;
|
|
376
|
+
}, K = function(e) {
|
|
299
377
|
return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
|
|
300
|
-
},
|
|
301
|
-
var
|
|
378
|
+
}, He = [], Ze = function(e, t) {
|
|
379
|
+
var n = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) || He, l = ue({
|
|
302
380
|
returnFocusOnDeactivate: !0,
|
|
303
381
|
escapeDeactivates: !0,
|
|
304
382
|
delayInitialFocus: !0,
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
383
|
+
isolateSubtrees: !1,
|
|
384
|
+
isKeyForward: We,
|
|
385
|
+
isKeyBackward: Ye
|
|
386
|
+
}, t), a = {
|
|
308
387
|
// containers given to createFocusTrap()
|
|
309
|
-
|
|
388
|
+
/** @type {Array<HTMLElement>} */
|
|
310
389
|
containers: [],
|
|
311
390
|
// list of objects identifying tabbable nodes in `containers` in the trap
|
|
312
391
|
// NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
|
|
313
392
|
// is active, but the trap should never get to a state where there isn't at least one group
|
|
314
393
|
// with at least one tabbable node in it (that would lead to an error condition that would
|
|
315
394
|
// result in an error being thrown)
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
395
|
+
/** @type {Array<{
|
|
396
|
+
* container: HTMLElement,
|
|
397
|
+
* tabbableNodes: Array<HTMLElement>, // empty if none
|
|
398
|
+
* focusableNodes: Array<HTMLElement>, // empty if none
|
|
399
|
+
* posTabIndexesFound: boolean,
|
|
400
|
+
* firstTabbableNode: HTMLElement|undefined,
|
|
401
|
+
* lastTabbableNode: HTMLElement|undefined,
|
|
402
|
+
* firstDomTabbableNode: HTMLElement|undefined,
|
|
403
|
+
* lastDomTabbableNode: HTMLElement|undefined,
|
|
404
|
+
* nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
405
|
+
* }>}
|
|
406
|
+
*/
|
|
327
407
|
containerGroups: [],
|
|
328
408
|
// same order/length as `containers` list
|
|
329
409
|
// references to objects in `containerGroups`, but only those that actually have
|
|
@@ -331,6 +411,12 @@ var ie = {
|
|
|
331
411
|
// NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
|
|
332
412
|
// the same length
|
|
333
413
|
tabbableGroups: [],
|
|
414
|
+
// references to nodes that are siblings to the ancestors of this trap's containers.
|
|
415
|
+
/** @type {Set<HTMLElement>} */
|
|
416
|
+
adjacentElements: /* @__PURE__ */ new Set(),
|
|
417
|
+
// references to nodes that were inert or aria-hidden before the trap was activated.
|
|
418
|
+
/** @type {Set<HTMLElement>} */
|
|
419
|
+
alreadySilent: /* @__PURE__ */ new Set(),
|
|
334
420
|
nodeFocusedBeforeActivation: null,
|
|
335
421
|
mostRecentlyFocusedNode: null,
|
|
336
422
|
active: !1,
|
|
@@ -341,74 +427,74 @@ var ie = {
|
|
|
341
427
|
delayInitialFocusTimer: void 0,
|
|
342
428
|
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
343
429
|
recentNavEvent: void 0
|
|
344
|
-
},
|
|
345
|
-
return
|
|
346
|
-
},
|
|
347
|
-
var
|
|
348
|
-
return
|
|
349
|
-
var
|
|
350
|
-
return
|
|
430
|
+
}, v, y = function(i, o, s) {
|
|
431
|
+
return i && i[o] !== void 0 ? i[o] : l[s || o];
|
|
432
|
+
}, g = function(i, o) {
|
|
433
|
+
var s = typeof (o == null ? void 0 : o.composedPath) == "function" ? o.composedPath() : void 0;
|
|
434
|
+
return a.containerGroups.findIndex(function(d) {
|
|
435
|
+
var f = d.container, b = d.tabbableNodes;
|
|
436
|
+
return f.contains(i) || // fall back to explicit tabbable search which will take into consideration any
|
|
351
437
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
352
438
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
353
439
|
// look inside web components even if open)
|
|
354
|
-
(
|
|
355
|
-
return
|
|
440
|
+
(s == null ? void 0 : s.includes(f)) || b.find(function(c) {
|
|
441
|
+
return c === i;
|
|
356
442
|
});
|
|
357
443
|
});
|
|
358
|
-
},
|
|
359
|
-
var
|
|
360
|
-
if (typeof
|
|
361
|
-
if (
|
|
362
|
-
return
|
|
363
|
-
throw new Error("`".concat(
|
|
444
|
+
}, w = function(i) {
|
|
445
|
+
var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s = o.hasFallback, d = s === void 0 ? !1 : s, f = o.params, b = f === void 0 ? [] : f, c = l[i];
|
|
446
|
+
if (typeof c == "function" && (c = c.apply(void 0, _e(b))), c === !0 && (c = void 0), !c) {
|
|
447
|
+
if (c === void 0 || c === !1)
|
|
448
|
+
return c;
|
|
449
|
+
throw new Error("`".concat(i, "` was specified but was not a node, or did not return a node"));
|
|
364
450
|
}
|
|
365
|
-
var
|
|
366
|
-
if (typeof
|
|
451
|
+
var h = c;
|
|
452
|
+
if (typeof c == "string") {
|
|
367
453
|
try {
|
|
368
|
-
|
|
369
|
-
} catch (
|
|
370
|
-
throw new Error("`".concat(
|
|
454
|
+
h = n.querySelector(c);
|
|
455
|
+
} catch (p) {
|
|
456
|
+
throw new Error("`".concat(i, '` appears to be an invalid selector; error="').concat(p.message, '"'));
|
|
371
457
|
}
|
|
372
|
-
if (!
|
|
373
|
-
throw new Error("`".concat(
|
|
458
|
+
if (!h && !d)
|
|
459
|
+
throw new Error("`".concat(i, "` as selector refers to no known node"));
|
|
374
460
|
}
|
|
375
|
-
return
|
|
376
|
-
},
|
|
377
|
-
var
|
|
461
|
+
return h;
|
|
462
|
+
}, T = function() {
|
|
463
|
+
var i = w("initialFocus", {
|
|
378
464
|
hasFallback: !0
|
|
379
465
|
});
|
|
380
|
-
if (
|
|
466
|
+
if (i === !1)
|
|
381
467
|
return !1;
|
|
382
|
-
if (
|
|
383
|
-
if (
|
|
384
|
-
|
|
468
|
+
if (i === void 0 || i && !H(i, l.tabbableOptions))
|
|
469
|
+
if (g(n.activeElement) >= 0)
|
|
470
|
+
i = n.activeElement;
|
|
385
471
|
else {
|
|
386
|
-
var
|
|
387
|
-
|
|
472
|
+
var o = a.tabbableGroups[0], s = o && o.firstTabbableNode;
|
|
473
|
+
i = s || w("fallbackFocus");
|
|
388
474
|
}
|
|
389
|
-
else
|
|
390
|
-
if (!
|
|
475
|
+
else i === null && (i = w("fallbackFocus"));
|
|
476
|
+
if (!i)
|
|
391
477
|
throw new Error("Your focus-trap needs to have at least one focusable element");
|
|
392
|
-
return
|
|
393
|
-
},
|
|
394
|
-
if (
|
|
395
|
-
var
|
|
396
|
-
return
|
|
397
|
-
}),
|
|
398
|
-
return
|
|
399
|
-
}),
|
|
400
|
-
return
|
|
478
|
+
return i;
|
|
479
|
+
}, I = function() {
|
|
480
|
+
if (a.containerGroups = a.containers.map(function(i) {
|
|
481
|
+
var o = Ce(i, l.tabbableOptions), s = je(i, l.tabbableOptions), d = o.length > 0 ? o[0] : void 0, f = o.length > 0 ? o[o.length - 1] : void 0, b = s.find(function(p) {
|
|
482
|
+
return C(p);
|
|
483
|
+
}), c = s.slice().reverse().find(function(p) {
|
|
484
|
+
return C(p);
|
|
485
|
+
}), h = !!o.find(function(p) {
|
|
486
|
+
return D(p) > 0;
|
|
401
487
|
});
|
|
402
488
|
return {
|
|
403
|
-
container:
|
|
404
|
-
tabbableNodes:
|
|
405
|
-
focusableNodes:
|
|
489
|
+
container: i,
|
|
490
|
+
tabbableNodes: o,
|
|
491
|
+
focusableNodes: s,
|
|
406
492
|
/** True if at least one node with positive `tabindex` was found in this container. */
|
|
407
|
-
posTabIndexesFound:
|
|
493
|
+
posTabIndexesFound: h,
|
|
408
494
|
/** First tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
409
|
-
firstTabbableNode:
|
|
495
|
+
firstTabbableNode: d,
|
|
410
496
|
/** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
411
|
-
lastTabbableNode:
|
|
497
|
+
lastTabbableNode: f,
|
|
412
498
|
// NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
|
|
413
499
|
// would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
414
500
|
// because that API doesn't work with Shadow DOM as well as it should (@see
|
|
@@ -417,9 +503,9 @@ var ie = {
|
|
|
417
503
|
// "close enough most of the time" alternative for positive tabindexes which should generally
|
|
418
504
|
// be avoided anyway...
|
|
419
505
|
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
420
|
-
firstDomTabbableNode:
|
|
506
|
+
firstDomTabbableNode: b,
|
|
421
507
|
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
422
|
-
lastDomTabbableNode:
|
|
508
|
+
lastDomTabbableNode: c,
|
|
423
509
|
/**
|
|
424
510
|
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
425
511
|
* in this container, if any.
|
|
@@ -429,255 +515,327 @@ var ie = {
|
|
|
429
515
|
* @returns {HTMLElement|undefined} The next tabbable node, if any.
|
|
430
516
|
*/
|
|
431
517
|
nextTabbableNode: function(S) {
|
|
432
|
-
var
|
|
433
|
-
return
|
|
434
|
-
return
|
|
435
|
-
}) :
|
|
436
|
-
return
|
|
437
|
-
}) :
|
|
518
|
+
var E = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, N = o.indexOf(S);
|
|
519
|
+
return N < 0 ? E ? s.slice(s.indexOf(S) + 1).find(function(R) {
|
|
520
|
+
return C(R);
|
|
521
|
+
}) : s.slice(0, s.indexOf(S)).reverse().find(function(R) {
|
|
522
|
+
return C(R);
|
|
523
|
+
}) : o[N + (E ? 1 : -1)];
|
|
438
524
|
}
|
|
439
525
|
};
|
|
440
|
-
}),
|
|
441
|
-
return
|
|
442
|
-
}),
|
|
526
|
+
}), a.tabbableGroups = a.containerGroups.filter(function(i) {
|
|
527
|
+
return i.tabbableNodes.length > 0;
|
|
528
|
+
}), a.tabbableGroups.length <= 0 && !w("fallbackFocus"))
|
|
443
529
|
throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
|
|
444
|
-
if (
|
|
445
|
-
return
|
|
446
|
-
}) &&
|
|
530
|
+
if (a.containerGroups.find(function(i) {
|
|
531
|
+
return i.posTabIndexesFound;
|
|
532
|
+
}) && a.containerGroups.length > 1)
|
|
447
533
|
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.");
|
|
448
|
-
},
|
|
449
|
-
var
|
|
450
|
-
if (
|
|
451
|
-
return
|
|
452
|
-
},
|
|
453
|
-
if (
|
|
454
|
-
if (!
|
|
455
|
-
|
|
534
|
+
}, P = function(i) {
|
|
535
|
+
var o = i.activeElement;
|
|
536
|
+
if (o)
|
|
537
|
+
return o.shadowRoot && o.shadowRoot.activeElement !== null ? P(o.shadowRoot) : o;
|
|
538
|
+
}, k = function(i) {
|
|
539
|
+
if (i !== !1 && i !== P(document)) {
|
|
540
|
+
if (!i || !i.focus) {
|
|
541
|
+
k(T());
|
|
456
542
|
return;
|
|
457
543
|
}
|
|
458
|
-
|
|
459
|
-
preventScroll: !!
|
|
460
|
-
}),
|
|
544
|
+
i.focus({
|
|
545
|
+
preventScroll: !!l.preventScroll
|
|
546
|
+
}), a.mostRecentlyFocusedNode = i, qe(i) && i.select();
|
|
461
547
|
}
|
|
462
|
-
},
|
|
463
|
-
var
|
|
464
|
-
params: [
|
|
548
|
+
}, X = function(i) {
|
|
549
|
+
var o = w("setReturnFocus", {
|
|
550
|
+
params: [i]
|
|
465
551
|
});
|
|
466
|
-
return
|
|
467
|
-
},
|
|
468
|
-
var
|
|
469
|
-
|
|
470
|
-
var
|
|
471
|
-
if (
|
|
472
|
-
var
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
else if (
|
|
476
|
-
var
|
|
477
|
-
var
|
|
478
|
-
return
|
|
552
|
+
return o || (o === !1 ? !1 : i);
|
|
553
|
+
}, $ = function(i) {
|
|
554
|
+
var o = i.target, s = i.event, d = i.isBackward, f = d === void 0 ? !1 : d;
|
|
555
|
+
o = o || K(s), I();
|
|
556
|
+
var b = null;
|
|
557
|
+
if (a.tabbableGroups.length > 0) {
|
|
558
|
+
var c = g(o, s), h = c >= 0 ? a.containerGroups[c] : void 0;
|
|
559
|
+
if (c < 0)
|
|
560
|
+
f ? b = a.tabbableGroups[a.tabbableGroups.length - 1].lastTabbableNode : b = a.tabbableGroups[0].firstTabbableNode;
|
|
561
|
+
else if (f) {
|
|
562
|
+
var p = a.tabbableGroups.findIndex(function(W) {
|
|
563
|
+
var Y = W.firstTabbableNode;
|
|
564
|
+
return o === Y;
|
|
479
565
|
});
|
|
480
|
-
if (
|
|
481
|
-
var S =
|
|
482
|
-
|
|
483
|
-
} else x(
|
|
566
|
+
if (p < 0 && (h.container === o || H(o, l.tabbableOptions) && !C(o, l.tabbableOptions) && !h.nextTabbableNode(o, !1)) && (p = c), p >= 0) {
|
|
567
|
+
var S = p === 0 ? a.tabbableGroups.length - 1 : p - 1, E = a.tabbableGroups[S];
|
|
568
|
+
b = D(o) >= 0 ? E.lastTabbableNode : E.lastDomTabbableNode;
|
|
569
|
+
} else x(s) || (b = h.nextTabbableNode(o, !1));
|
|
484
570
|
} else {
|
|
485
|
-
var
|
|
486
|
-
var
|
|
487
|
-
return
|
|
571
|
+
var N = a.tabbableGroups.findIndex(function(W) {
|
|
572
|
+
var Y = W.lastTabbableNode;
|
|
573
|
+
return o === Y;
|
|
488
574
|
});
|
|
489
|
-
if (
|
|
490
|
-
var
|
|
491
|
-
|
|
492
|
-
} else x(
|
|
575
|
+
if (N < 0 && (h.container === o || H(o, l.tabbableOptions) && !C(o, l.tabbableOptions) && !h.nextTabbableNode(o)) && (N = c), N >= 0) {
|
|
576
|
+
var R = N === a.tabbableGroups.length - 1 ? 0 : N + 1, A = a.tabbableGroups[R];
|
|
577
|
+
b = D(o) >= 0 ? A.firstTabbableNode : A.firstDomTabbableNode;
|
|
578
|
+
} else x(s) || (b = h.nextTabbableNode(o));
|
|
493
579
|
}
|
|
494
580
|
} else
|
|
495
|
-
|
|
496
|
-
return
|
|
497
|
-
},
|
|
498
|
-
var
|
|
499
|
-
if (!(
|
|
500
|
-
if (
|
|
501
|
-
|
|
581
|
+
b = w("fallbackFocus");
|
|
582
|
+
return b;
|
|
583
|
+
}, B = function(i) {
|
|
584
|
+
var o = K(i);
|
|
585
|
+
if (!(g(o, i) >= 0)) {
|
|
586
|
+
if (L(l.clickOutsideDeactivates, i)) {
|
|
587
|
+
v.deactivate({
|
|
502
588
|
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
503
589
|
// which will result in the outside click setting focus to the node
|
|
504
590
|
// that was clicked (and if not focusable, to "nothing"); by setting
|
|
505
591
|
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
506
592
|
// on activation (or the configured `setReturnFocus` node), whether the
|
|
507
593
|
// outside click was on a focusable node or not
|
|
508
|
-
returnFocus:
|
|
594
|
+
returnFocus: l.returnFocusOnDeactivate
|
|
509
595
|
});
|
|
510
596
|
return;
|
|
511
597
|
}
|
|
512
|
-
|
|
598
|
+
L(l.allowOutsideClick, i) || i.preventDefault();
|
|
513
599
|
}
|
|
514
|
-
},
|
|
515
|
-
var
|
|
516
|
-
if (
|
|
517
|
-
|
|
600
|
+
}, J = function(i) {
|
|
601
|
+
var o = K(i), s = g(o, i) >= 0;
|
|
602
|
+
if (s || o instanceof Document)
|
|
603
|
+
s && (a.mostRecentlyFocusedNode = o);
|
|
518
604
|
else {
|
|
519
|
-
|
|
520
|
-
var
|
|
521
|
-
if (
|
|
522
|
-
if (
|
|
523
|
-
var
|
|
524
|
-
if (
|
|
525
|
-
var
|
|
526
|
-
return
|
|
605
|
+
i.stopImmediatePropagation();
|
|
606
|
+
var d, f = !0;
|
|
607
|
+
if (a.mostRecentlyFocusedNode)
|
|
608
|
+
if (D(a.mostRecentlyFocusedNode) > 0) {
|
|
609
|
+
var b = g(a.mostRecentlyFocusedNode), c = a.containerGroups[b].tabbableNodes;
|
|
610
|
+
if (c.length > 0) {
|
|
611
|
+
var h = c.findIndex(function(p) {
|
|
612
|
+
return p === a.mostRecentlyFocusedNode;
|
|
527
613
|
});
|
|
528
|
-
|
|
614
|
+
h >= 0 && (l.isKeyForward(a.recentNavEvent) ? h + 1 < c.length && (d = c[h + 1], f = !1) : h - 1 >= 0 && (d = c[h - 1], f = !1));
|
|
529
615
|
}
|
|
530
616
|
} else
|
|
531
|
-
|
|
532
|
-
return
|
|
533
|
-
return
|
|
617
|
+
a.containerGroups.some(function(p) {
|
|
618
|
+
return p.tabbableNodes.some(function(S) {
|
|
619
|
+
return D(S) > 0;
|
|
534
620
|
});
|
|
535
|
-
}) || (
|
|
621
|
+
}) || (f = !1);
|
|
536
622
|
else
|
|
537
|
-
|
|
538
|
-
|
|
623
|
+
f = !1;
|
|
624
|
+
f && (d = $({
|
|
539
625
|
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
540
626
|
// outside the trap causing the focus escape we're trying to fix)
|
|
541
|
-
target:
|
|
542
|
-
isBackward:
|
|
543
|
-
})),
|
|
627
|
+
target: a.mostRecentlyFocusedNode,
|
|
628
|
+
isBackward: l.isKeyBackward(a.recentNavEvent)
|
|
629
|
+
})), k(d || a.mostRecentlyFocusedNode || T());
|
|
544
630
|
}
|
|
545
|
-
|
|
546
|
-
},
|
|
547
|
-
var
|
|
548
|
-
|
|
549
|
-
var
|
|
550
|
-
event:
|
|
551
|
-
isBackward:
|
|
631
|
+
a.recentNavEvent = void 0;
|
|
632
|
+
}, ye = function(i) {
|
|
633
|
+
var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
634
|
+
a.recentNavEvent = i;
|
|
635
|
+
var s = $({
|
|
636
|
+
event: i,
|
|
637
|
+
isBackward: o
|
|
552
638
|
});
|
|
553
|
-
|
|
554
|
-
},
|
|
555
|
-
(
|
|
556
|
-
},
|
|
557
|
-
|
|
558
|
-
},
|
|
559
|
-
var
|
|
560
|
-
|
|
561
|
-
},
|
|
562
|
-
if (
|
|
563
|
-
return
|
|
564
|
-
|
|
565
|
-
}) :
|
|
639
|
+
s && (x(i) && i.preventDefault(), k(s));
|
|
640
|
+
}, Q = function(i) {
|
|
641
|
+
(l.isKeyForward(i) || l.isKeyBackward(i)) && ye(i, l.isKeyBackward(i));
|
|
642
|
+
}, ee = function(i) {
|
|
643
|
+
Ue(i) && L(l.escapeDeactivates, i) !== !1 && (i.preventDefault(), v.deactivate());
|
|
644
|
+
}, te = function(i) {
|
|
645
|
+
var o = K(i);
|
|
646
|
+
g(o, i) >= 0 || L(l.clickOutsideDeactivates, i) || L(l.allowOutsideClick, i) || (i.preventDefault(), i.stopImmediatePropagation());
|
|
647
|
+
}, ae = function() {
|
|
648
|
+
if (a.active)
|
|
649
|
+
return F.activateTrap(u, v), a.delayInitialFocusTimer = l.delayInitialFocus ? le(function() {
|
|
650
|
+
k(T());
|
|
651
|
+
}) : k(T()), n.addEventListener("focusin", J, !0), n.addEventListener("mousedown", B, {
|
|
566
652
|
capture: !0,
|
|
567
653
|
passive: !1
|
|
568
|
-
}),
|
|
654
|
+
}), n.addEventListener("touchstart", B, {
|
|
569
655
|
capture: !0,
|
|
570
656
|
passive: !1
|
|
571
|
-
}),
|
|
657
|
+
}), n.addEventListener("click", te, {
|
|
572
658
|
capture: !0,
|
|
573
659
|
passive: !1
|
|
574
|
-
}),
|
|
660
|
+
}), n.addEventListener("keydown", Q, {
|
|
575
661
|
capture: !0,
|
|
576
662
|
passive: !1
|
|
577
|
-
}),
|
|
578
|
-
},
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
663
|
+
}), n.addEventListener("keydown", ee), v;
|
|
664
|
+
}, pe = function(i) {
|
|
665
|
+
a.active && !a.paused && v._setSubtreeIsolation(!1), a.adjacentElements.clear(), a.alreadySilent.clear();
|
|
666
|
+
var o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), d = ie(i), f;
|
|
667
|
+
try {
|
|
668
|
+
for (d.s(); !(f = d.n()).done; ) {
|
|
669
|
+
var b = f.value;
|
|
670
|
+
o.add(b);
|
|
671
|
+
for (var c = typeof ShadowRoot < "u" && b.getRootNode() instanceof ShadowRoot, h = b; h; ) {
|
|
672
|
+
o.add(h);
|
|
673
|
+
var p = h.parentElement, S = [];
|
|
674
|
+
p ? S = p.children : !p && c && (S = h.getRootNode().children, p = h.getRootNode().host, c = typeof ShadowRoot < "u" && p.getRootNode() instanceof ShadowRoot);
|
|
675
|
+
var E = ie(S), N;
|
|
676
|
+
try {
|
|
677
|
+
for (E.s(); !(N = E.n()).done; ) {
|
|
678
|
+
var R = N.value;
|
|
679
|
+
s.add(R);
|
|
680
|
+
}
|
|
681
|
+
} catch (A) {
|
|
682
|
+
E.e(A);
|
|
683
|
+
} finally {
|
|
684
|
+
E.f();
|
|
685
|
+
}
|
|
686
|
+
h = p;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
} catch (A) {
|
|
690
|
+
d.e(A);
|
|
691
|
+
} finally {
|
|
692
|
+
d.f();
|
|
693
|
+
}
|
|
694
|
+
o.forEach(function(A) {
|
|
695
|
+
s.delete(A);
|
|
696
|
+
}), a.adjacentElements = s;
|
|
697
|
+
}, re = function() {
|
|
698
|
+
if (a.active)
|
|
699
|
+
return n.removeEventListener("focusin", J, !0), n.removeEventListener("mousedown", B, !0), n.removeEventListener("touchstart", B, !0), n.removeEventListener("click", te, !0), n.removeEventListener("keydown", Q, !0), n.removeEventListener("keydown", ee), v;
|
|
700
|
+
}, me = function(i) {
|
|
701
|
+
var o = i.some(function(s) {
|
|
702
|
+
var d = Array.from(s.removedNodes);
|
|
703
|
+
return d.some(function(f) {
|
|
704
|
+
return f === a.mostRecentlyFocusedNode;
|
|
586
705
|
});
|
|
587
706
|
});
|
|
588
|
-
|
|
589
|
-
},
|
|
590
|
-
|
|
591
|
-
|
|
707
|
+
o && k(T());
|
|
708
|
+
}, U = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(me) : void 0, j = function() {
|
|
709
|
+
U && (U.disconnect(), a.active && !a.paused && a.containers.map(function(i) {
|
|
710
|
+
U.observe(i, {
|
|
592
711
|
subtree: !0,
|
|
593
712
|
childList: !0
|
|
594
713
|
});
|
|
595
714
|
}));
|
|
596
715
|
};
|
|
597
|
-
return
|
|
716
|
+
return v = {
|
|
598
717
|
get active() {
|
|
599
|
-
return
|
|
718
|
+
return a.active;
|
|
600
719
|
},
|
|
601
720
|
get paused() {
|
|
602
|
-
return
|
|
721
|
+
return a.paused;
|
|
603
722
|
},
|
|
604
|
-
activate: function(
|
|
605
|
-
if (
|
|
723
|
+
activate: function(i) {
|
|
724
|
+
if (a.active)
|
|
606
725
|
return this;
|
|
607
|
-
var
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}
|
|
612
|
-
|
|
726
|
+
var o = y(i, "onActivate"), s = y(i, "onPostActivate"), d = y(i, "checkCanFocusTrap"), f = F.getActiveTrap(u), b = !1;
|
|
727
|
+
if (f && !f.paused) {
|
|
728
|
+
var c;
|
|
729
|
+
(c = f._setSubtreeIsolation) === null || c === void 0 || c.call(f, !1), b = !0;
|
|
730
|
+
}
|
|
731
|
+
try {
|
|
732
|
+
d || I(), a.active = !0, a.paused = !1, a.nodeFocusedBeforeActivation = P(n), o == null || o();
|
|
733
|
+
var h = function() {
|
|
734
|
+
d && I(), ae(), j(), l.isolateSubtrees && v._setSubtreeIsolation(!0), s == null || s();
|
|
735
|
+
};
|
|
736
|
+
if (d)
|
|
737
|
+
return d(a.containers.concat()).then(h, h), this;
|
|
738
|
+
h();
|
|
739
|
+
} catch (S) {
|
|
740
|
+
if (f === F.getActiveTrap(u) && b) {
|
|
741
|
+
var p;
|
|
742
|
+
(p = f._setSubtreeIsolation) === null || p === void 0 || p.call(f, !0);
|
|
743
|
+
}
|
|
744
|
+
throw S;
|
|
745
|
+
}
|
|
746
|
+
return this;
|
|
613
747
|
},
|
|
614
|
-
deactivate: function(
|
|
615
|
-
if (!
|
|
748
|
+
deactivate: function(i) {
|
|
749
|
+
if (!a.active)
|
|
616
750
|
return this;
|
|
617
|
-
var
|
|
618
|
-
onDeactivate:
|
|
619
|
-
onPostDeactivate:
|
|
620
|
-
checkCanReturnFocus:
|
|
621
|
-
},
|
|
622
|
-
clearTimeout(
|
|
623
|
-
var
|
|
624
|
-
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
|
|
751
|
+
var o = ue({
|
|
752
|
+
onDeactivate: l.onDeactivate,
|
|
753
|
+
onPostDeactivate: l.onPostDeactivate,
|
|
754
|
+
checkCanReturnFocus: l.checkCanReturnFocus
|
|
755
|
+
}, i);
|
|
756
|
+
clearTimeout(a.delayInitialFocusTimer), a.delayInitialFocusTimer = void 0, a.paused || v._setSubtreeIsolation(!1), a.alreadySilent.clear(), re(), a.active = !1, a.paused = !1, j(), F.deactivateTrap(u, v);
|
|
757
|
+
var s = y(o, "onDeactivate"), d = y(o, "onPostDeactivate"), f = y(o, "checkCanReturnFocus"), b = y(o, "returnFocus", "returnFocusOnDeactivate");
|
|
758
|
+
s == null || s();
|
|
759
|
+
var c = function() {
|
|
760
|
+
le(function() {
|
|
761
|
+
b && k(X(a.nodeFocusedBeforeActivation)), d == null || d();
|
|
628
762
|
});
|
|
629
763
|
};
|
|
630
|
-
return
|
|
764
|
+
return b && f ? (f(X(a.nodeFocusedBeforeActivation)).then(c, c), this) : (c(), this);
|
|
631
765
|
},
|
|
632
|
-
pause: function(
|
|
633
|
-
return
|
|
766
|
+
pause: function(i) {
|
|
767
|
+
return a.active ? (a.manuallyPaused = !0, this._setPausedState(!0, i)) : this;
|
|
634
768
|
},
|
|
635
|
-
unpause: function(
|
|
636
|
-
return
|
|
769
|
+
unpause: function(i) {
|
|
770
|
+
return a.active ? (a.manuallyPaused = !1, u[u.length - 1] !== this ? this : this._setPausedState(!1, i)) : this;
|
|
637
771
|
},
|
|
638
|
-
updateContainerElements: function(
|
|
639
|
-
var
|
|
640
|
-
return
|
|
641
|
-
return typeof
|
|
642
|
-
}),
|
|
772
|
+
updateContainerElements: function(i) {
|
|
773
|
+
var o = [].concat(i).filter(Boolean);
|
|
774
|
+
return a.containers = o.map(function(s) {
|
|
775
|
+
return typeof s == "string" ? n.querySelector(s) : s;
|
|
776
|
+
}), l.isolateSubtrees && pe(a.containers), a.active && (I(), l.isolateSubtrees && !a.paused && v._setSubtreeIsolation(!0)), j(), this;
|
|
643
777
|
}
|
|
644
|
-
}, Object.defineProperties(
|
|
778
|
+
}, Object.defineProperties(v, {
|
|
645
779
|
_isManuallyPaused: {
|
|
646
780
|
value: function() {
|
|
647
|
-
return
|
|
781
|
+
return a.manuallyPaused;
|
|
648
782
|
}
|
|
649
783
|
},
|
|
650
784
|
_setPausedState: {
|
|
651
|
-
value: function(
|
|
652
|
-
if (
|
|
785
|
+
value: function(i, o) {
|
|
786
|
+
if (a.paused === i)
|
|
653
787
|
return this;
|
|
654
|
-
if (
|
|
655
|
-
var
|
|
656
|
-
|
|
788
|
+
if (a.paused = i, i) {
|
|
789
|
+
var s = y(o, "onPause"), d = y(o, "onPostPause");
|
|
790
|
+
s == null || s(), re(), j(), v._setSubtreeIsolation(!1), d == null || d();
|
|
657
791
|
} else {
|
|
658
|
-
var
|
|
659
|
-
|
|
792
|
+
var f = y(o, "onUnpause"), b = y(o, "onPostUnpause");
|
|
793
|
+
f == null || f(), v._setSubtreeIsolation(!0), I(), ae(), j(), b == null || b();
|
|
660
794
|
}
|
|
661
795
|
return this;
|
|
662
796
|
}
|
|
797
|
+
},
|
|
798
|
+
_setSubtreeIsolation: {
|
|
799
|
+
value: function(i) {
|
|
800
|
+
l.isolateSubtrees && a.adjacentElements.forEach(function(o) {
|
|
801
|
+
var s;
|
|
802
|
+
if (i)
|
|
803
|
+
switch (l.isolateSubtrees) {
|
|
804
|
+
case "aria-hidden":
|
|
805
|
+
(o.ariaHidden === "true" || ((s = o.getAttribute("aria-hidden")) === null || s === void 0 ? void 0 : s.toLowerCase()) === "true") && a.alreadySilent.add(o), o.setAttribute("aria-hidden", "true");
|
|
806
|
+
break;
|
|
807
|
+
default:
|
|
808
|
+
(o.inert || o.hasAttribute("inert")) && a.alreadySilent.add(o), o.setAttribute("inert", !0);
|
|
809
|
+
break;
|
|
810
|
+
}
|
|
811
|
+
else if (!a.alreadySilent.has(o)) switch (l.isolateSubtrees) {
|
|
812
|
+
case "aria-hidden":
|
|
813
|
+
o.removeAttribute("aria-hidden");
|
|
814
|
+
break;
|
|
815
|
+
default:
|
|
816
|
+
o.removeAttribute("inert");
|
|
817
|
+
break;
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
}
|
|
663
821
|
}
|
|
664
|
-
}),
|
|
822
|
+
}), v.updateContainerElements(e), v;
|
|
665
823
|
};
|
|
666
|
-
const
|
|
667
|
-
|
|
824
|
+
const Xe = (r, e, t) => {
|
|
825
|
+
ge(() => {
|
|
668
826
|
if (!r || !e)
|
|
669
827
|
return;
|
|
670
|
-
const
|
|
828
|
+
const n = Ze(r, {
|
|
671
829
|
...t,
|
|
672
830
|
initialFocus: (t == null ? void 0 : t.initialFocus) ?? r,
|
|
673
831
|
fallbackFocus: (t == null ? void 0 : t.fallbackFocus) ?? r,
|
|
674
832
|
returnFocusOnDeactivate: !1
|
|
675
833
|
});
|
|
676
|
-
return
|
|
677
|
-
|
|
834
|
+
return n.activate(), () => {
|
|
835
|
+
n.deactivate();
|
|
678
836
|
};
|
|
679
837
|
}, [r, e]);
|
|
680
838
|
};
|
|
681
839
|
export {
|
|
682
|
-
|
|
840
|
+
Xe as useFocusTrap
|
|
683
841
|
};
|