@kakadu/components 0.1.3 → 1.0.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/build/aria-text.d.ts +5 -0
- package/build/aria-text.js +1 -0
- package/build/aria-text.mjs +15 -0
- package/build/atom.d.ts +10 -2
- package/build/atom.js +1 -1
- package/build/atom.mjs +10 -3
- package/build/bankid-logo.d.ts +2 -0
- package/build/bankid-logo.js +1 -0
- package/build/bankid-logo.mjs +43 -0
- package/build/box.d.ts +4 -1
- package/build/box.js +1 -1
- package/build/box.mjs +11 -2
- package/build/button-tooltip.d.ts +4 -0
- package/build/button-tooltip.js +1 -0
- package/build/button-tooltip.mjs +11 -0
- package/build/button.d.ts +32 -0
- package/build/button.js +1 -0
- package/build/button.mjs +69 -0
- package/build/card.d.ts +8 -0
- package/build/card.js +1 -0
- package/build/card.mjs +36 -0
- package/build/click-ripples.d.ts +2 -0
- package/build/click-ripples.js +1 -0
- package/build/click-ripples.mjs +60 -0
- package/build/components.css +1 -1
- package/build/datum.d.ts +5 -0
- package/build/datum.js +1 -0
- package/build/datum.mjs +27 -0
- package/build/dnb-logo.d.ts +2 -0
- package/build/dnb-logo.js +1 -0
- package/build/dnb-logo.mjs +31 -0
- package/build/dot.d.ts +2 -0
- package/build/dot.js +1 -0
- package/build/dot.mjs +10 -0
- package/build/flex.d.ts +14 -2
- package/build/flex.js +1 -1
- package/build/flex.mjs +17 -2
- package/build/footer.d.ts +3 -0
- package/build/footer.js +1 -0
- package/build/footer.mjs +65 -0
- package/build/gauge.d.ts +6 -2
- package/build/gauge.js +1 -1
- package/build/gauge.mjs +39 -2
- package/build/gjensidige-logo.d.ts +2 -0
- package/build/gjensidige-logo.js +1 -0
- package/build/gjensidige-logo.mjs +30 -0
- package/build/hooks/use-media-query.d.ts +1 -0
- package/build/hooks/use-media-query.js +1 -0
- package/build/hooks/use-media-query.mjs +20 -0
- package/build/hover-gradient.d.ts +5 -0
- package/build/hover-gradient.js +1 -0
- package/build/hover-gradient.mjs +48 -0
- package/build/icon-button.d.ts +13 -0
- package/build/icon-button.js +1 -0
- package/build/icon-button.mjs +45 -0
- package/build/icon.js +1 -0
- package/build/icon.mjs +50 -0
- package/build/icons/arrow-down.d.ts +2 -0
- package/build/icons/arrow-down.js +1 -0
- package/build/icons/arrow-down.mjs +24 -0
- package/build/icons/caret-down.d.ts +2 -0
- package/build/icons/caret-down.js +1 -0
- package/build/icons/caret-down.mjs +27 -0
- package/build/icons/caret-right.d.ts +2 -0
- package/build/icons/caret-right.js +1 -0
- package/build/icons/caret-right.mjs +27 -0
- package/build/icons/check.d.ts +2 -0
- package/build/icons/check.js +1 -0
- package/build/icons/check.mjs +27 -0
- package/build/icons/chevron-down.d.ts +2 -0
- package/build/icons/chevron-down.js +1 -0
- package/build/icons/chevron-down.mjs +27 -0
- package/build/icons/chevron-up.d.ts +2 -0
- package/build/icons/chevron-up.js +1 -0
- package/build/icons/chevron-up.mjs +27 -0
- package/build/icons/chrome-browser-logo.d.ts +2 -0
- package/build/icons/chrome-browser-logo.js +1 -0
- package/build/icons/chrome-browser-logo.mjs +24 -0
- package/build/icons/copy.d.ts +2 -0
- package/build/icons/copy.js +1 -0
- package/build/icons/copy.mjs +29 -0
- package/build/icons/edge-browser-logo.d.ts +2 -0
- package/build/icons/edge-browser-logo.js +1 -0
- package/build/icons/edge-browser-logo.mjs +24 -0
- package/build/icons/edit.d.ts +2 -0
- package/build/icons/edit.js +1 -0
- package/build/icons/edit.mjs +27 -0
- package/build/icons/exclamation-triangle.d.ts +2 -0
- package/build/icons/exclamation-triangle.js +1 -0
- package/build/icons/exclamation-triangle.mjs +29 -0
- package/build/icons/icon.d.ts +25 -0
- package/build/icons/kakadu-guide-glyph.d.ts +2 -0
- package/build/icons/kakadu-guide-glyph.js +1 -0
- package/build/icons/kakadu-guide-glyph.mjs +24 -0
- package/build/icons/kakadu-guide.d.ts +2 -0
- package/build/icons/kakadu-guide.js +1 -0
- package/build/icons/kakadu-guide.mjs +27 -0
- package/build/icons/menu.d.ts +2 -0
- package/build/icons/menu.js +1 -0
- package/build/icons/menu.mjs +25 -0
- package/build/icons/plus.d.ts +2 -0
- package/build/icons/plus.js +1 -0
- package/build/icons/plus.mjs +27 -0
- package/build/icons/test.d.ts +2 -0
- package/build/icons/test.js +1 -0
- package/build/icons/test.mjs +29 -0
- package/build/icons/times.d.ts +2 -0
- package/build/icons/times.js +1 -0
- package/build/icons/times.mjs +27 -0
- package/build/index.html +0 -0
- package/build/kakadu-guide-icon.d.ts +3 -0
- package/build/kakadu-guide-icon.js +1 -0
- package/build/kakadu-guide-icon.mjs +14 -0
- package/build/kakadu-guide-logo.d.ts +10 -0
- package/build/kakadu-guide-logo.js +1 -0
- package/build/kakadu-guide-logo.mjs +59 -0
- package/build/kakadu-index-logo.d.ts +2 -0
- package/build/kakadu-index-logo.js +1 -0
- package/build/kakadu-index-logo.mjs +66 -0
- package/build/kakadu-logo.d.ts +2 -0
- package/build/kakadu-logo.js +1 -0
- package/build/kakadu-logo.mjs +44 -0
- package/build/modal.d.ts +28 -0
- package/build/modal.js +9 -0
- package/build/modal.mjs +1246 -0
- package/build/moving-gradients.d.ts +9 -0
- package/build/moving-gradients.js +1 -0
- package/build/moving-gradients.mjs +86 -0
- package/build/moving-stars.d.ts +12 -0
- package/build/moving-stars.js +1 -0
- package/build/moving-stars.mjs +90 -0
- package/build/notice.d.ts +12 -0
- package/build/notice.js +1 -0
- package/build/notice.mjs +22 -0
- package/build/notification.d.ts +17 -0
- package/build/notification.js +1 -0
- package/build/notification.mjs +84 -0
- package/build/revealer.d.ts +20 -0
- package/build/revealer.js +1 -0
- package/build/revealer.mjs +76 -0
- package/build/separator.d.ts +5 -0
- package/build/separator.js +1 -0
- package/build/separator.mjs +24 -0
- package/build/skeleton.d.ts +15 -1
- package/build/skeleton.js +1 -1
- package/build/skeleton.mjs +38 -3
- package/build/sparebank1-logo.d.ts +2 -0
- package/build/sparebank1-logo.js +1 -0
- package/build/sparebank1-logo.mjs +61 -0
- package/build/spinner.d.ts +10 -1
- package/build/spinner.js +1 -1
- package/build/spinner.mjs +31 -2
- package/build/sto-logo.d.ts +2 -0
- package/build/sto-logo.js +1 -0
- package/build/sto-logo.mjs +53 -0
- package/build/storebrand-logo.d.ts +2 -0
- package/build/storebrand-logo.js +1 -0
- package/build/storebrand-logo.mjs +46 -0
- package/build/text-button.d.ts +19 -0
- package/build/text-button.js +1 -0
- package/build/text-button.mjs +36 -0
- package/build/text.d.ts +11 -1
- package/build/text.js +1 -1
- package/build/text.mjs +49 -5
- package/build/theme-setter.d.ts +11 -0
- package/build/theme-setter.js +20 -0
- package/build/theme-setter.mjs +79 -0
- package/build/theme.d.ts +4 -0
- package/build/theme.js +1 -1
- package/build/theme.mjs +13 -8
- package/build/utilities/copy-to-clipboard.d.ts +1 -0
- package/build/utilities/copy-to-clipboard.js +1 -0
- package/build/utilities/copy-to-clipboard.mjs +26 -0
- package/build/utilities/generate-random-id.d.ts +1 -0
- package/build/utilities/generate-random-id.js +1 -0
- package/build/utilities/generate-random-id.mjs +14 -0
- package/build/utilities/scale.d.ts +11 -0
- package/build/utilities/scale.js +1 -0
- package/build/utilities/scale.mjs +13 -0
- package/build/veil.d.ts +3 -0
- package/build/veil.js +1 -0
- package/build/veil.mjs +17 -0
- package/package.json +278 -19
- package/readme.md +14 -12
- package/theme.tsx +133 -27
- package/build/atom-B-bW2QKm.js +0 -1
- package/build/atom-CqxGy6PS.mjs +0 -12
- package/build/box-BdUR8k49.js +0 -1
- package/build/box-DmpGO-yx.mjs +0 -13
- package/build/components/atom.d.ts +0 -10
- package/build/components/box.d.ts +0 -4
- package/build/components/flex.d.ts +0 -7
- package/build/components/gauge.d.ts +0 -6
- package/build/components/skeleton.d.ts +0 -13
- package/build/components/spinner.d.ts +0 -5
- package/build/components/text.d.ts +0 -7
- package/build/flex-C4bEYrMM.mjs +0 -16
- package/build/flex-JFSv9GFG.js +0 -1
- package/build/gauge-C1CypvvD.mjs +0 -41
- package/build/gauge-mog6SjVx.js +0 -1
- package/build/index.d.ts +0 -11
- package/build/index.js +0 -1
- package/build/index.mjs +0 -26
- package/build/skeleton-B5bJ732_.js +0 -1
- package/build/skeleton-C593Afco.mjs +0 -48
- package/build/spinner-BWIY_fuB.mjs +0 -14
- package/build/spinner-Ci3vM4Cv.js +0 -1
- package/build/text-BO7Qt7Lj.js +0 -1
- package/build/text-ZYVNxqac.mjs +0 -39
package/build/modal.mjs
ADDED
|
@@ -0,0 +1,1246 @@
|
|
|
1
|
+
import { j as C } from "./jsx-runtime-B4hRZ52C.mjs";
|
|
2
|
+
import Ie, { createContext as Ae, useRef as te, useState as re, useCallback as J, useMemo as ne, useEffect as H, useContext as je } from "react";
|
|
3
|
+
import { cx as pe } from "@kuma-ui/core";
|
|
4
|
+
import { createPortal as xe } from "react-dom";
|
|
5
|
+
import { IconType as _e } from "./icon.mjs";
|
|
6
|
+
import Le from "./theme.mjs";
|
|
7
|
+
import Be from "./text-button.mjs";
|
|
8
|
+
function we(r) {
|
|
9
|
+
if (Object.prototype.hasOwnProperty.call(r, "__esModule")) return r;
|
|
10
|
+
var e = r.default;
|
|
11
|
+
if (typeof e == "function") {
|
|
12
|
+
var t = function a() {
|
|
13
|
+
return this instanceof a ? Reflect.construct(e, arguments, this.constructor) : e.apply(this, arguments);
|
|
14
|
+
};
|
|
15
|
+
t.prototype = e.prototype;
|
|
16
|
+
} else t = {};
|
|
17
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(r).forEach(function(a) {
|
|
18
|
+
var u = Object.getOwnPropertyDescriptor(r, a);
|
|
19
|
+
Object.defineProperty(t, a, u.get ? u : {
|
|
20
|
+
enumerable: !0,
|
|
21
|
+
get: function() {
|
|
22
|
+
return r[a];
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}), t;
|
|
26
|
+
}
|
|
27
|
+
var Q = { exports: {} };
|
|
28
|
+
/*!
|
|
29
|
+
* tabbable 6.4.0
|
|
30
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
31
|
+
*/
|
|
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", W = Ee ? function() {
|
|
33
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, oe = !Ee && Element.prototype.getRootNode ? function(r) {
|
|
34
|
+
var e;
|
|
35
|
+
return r == null || (e = r.getRootNode) === null || e === void 0 ? void 0 : e.call(r);
|
|
36
|
+
} : function(r) {
|
|
37
|
+
return r == null ? void 0 : r.ownerDocument;
|
|
38
|
+
}, ue = function(e, t) {
|
|
39
|
+
var a;
|
|
40
|
+
t === void 0 && (t = !0);
|
|
41
|
+
var u = e == null || (a = e.getAttribute) === null || a === void 0 ? void 0 : a.call(e, "inert"), l = u === "" || u === "true", n = l || t && e && // closest does not exist on shadow roots, so we fall back to a manual
|
|
42
|
+
// lookup upward, in case it is not defined.
|
|
43
|
+
(typeof e.closest == "function" ? e.closest("[inert]") : ue(e.parentNode));
|
|
44
|
+
return n;
|
|
45
|
+
}, Me = function(e) {
|
|
46
|
+
var t, a = e == null || (t = e.getAttribute) === null || t === void 0 ? void 0 : t.call(e, "contenteditable");
|
|
47
|
+
return a === "" || a === "true";
|
|
48
|
+
}, Fe = function(e, t, a) {
|
|
49
|
+
if (ue(e))
|
|
50
|
+
return [];
|
|
51
|
+
var u = Array.prototype.slice.apply(e.querySelectorAll(ie));
|
|
52
|
+
return t && W.call(e, ie) && u.unshift(e), u = u.filter(a), u;
|
|
53
|
+
}, se = function(e, t, a) {
|
|
54
|
+
for (var u = [], l = Array.from(e); l.length; ) {
|
|
55
|
+
var n = l.shift();
|
|
56
|
+
if (!ue(n, !1))
|
|
57
|
+
if (n.tagName === "SLOT") {
|
|
58
|
+
var p = n.assignedElements(), y = p.length ? p : n.children, k = se(y, !0, a);
|
|
59
|
+
a.flatten ? u.push.apply(u, k) : u.push({
|
|
60
|
+
scopeParent: n,
|
|
61
|
+
candidates: k
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
var S = W.call(n, ie);
|
|
65
|
+
S && a.filter(n) && (t || !e.includes(n)) && u.push(n);
|
|
66
|
+
var D = n.shadowRoot || // check for an undisclosed shadow
|
|
67
|
+
typeof a.getShadowRoot == "function" && a.getShadowRoot(n), R = !ue(D, !1) && (!a.shadowRootFilter || a.shadowRootFilter(n));
|
|
68
|
+
if (D && R) {
|
|
69
|
+
var j = se(D === !0 ? n.children : D.children, !0, a);
|
|
70
|
+
a.flatten ? u.push.apply(u, j) : u.push({
|
|
71
|
+
scopeParent: n,
|
|
72
|
+
candidates: j
|
|
73
|
+
});
|
|
74
|
+
} else
|
|
75
|
+
l.unshift.apply(l, n.children);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return u;
|
|
79
|
+
}, Se = function(e) {
|
|
80
|
+
return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
|
|
81
|
+
}, q = function(e) {
|
|
82
|
+
if (!e)
|
|
83
|
+
throw new Error("No node provided");
|
|
84
|
+
return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Me(e)) && !Se(e) ? 0 : e.tabIndex;
|
|
85
|
+
}, Ke = function(e, t) {
|
|
86
|
+
var a = q(e);
|
|
87
|
+
return a < 0 && t && !Se(e) ? 0 : a;
|
|
88
|
+
}, qe = function(e, t) {
|
|
89
|
+
return e.tabIndex === t.tabIndex ? e.documentOrder - t.documentOrder : e.tabIndex - t.tabIndex;
|
|
90
|
+
}, Oe = function(e) {
|
|
91
|
+
return e.tagName === "INPUT";
|
|
92
|
+
}, Ve = function(e) {
|
|
93
|
+
return Oe(e) && e.type === "hidden";
|
|
94
|
+
}, $e = function(e) {
|
|
95
|
+
var t = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(a) {
|
|
96
|
+
return a.tagName === "SUMMARY";
|
|
97
|
+
});
|
|
98
|
+
return t;
|
|
99
|
+
}, Ge = function(e, t) {
|
|
100
|
+
for (var a = 0; a < e.length; a++)
|
|
101
|
+
if (e[a].checked && e[a].form === t)
|
|
102
|
+
return e[a];
|
|
103
|
+
}, Ue = function(e) {
|
|
104
|
+
if (!e.name)
|
|
105
|
+
return !0;
|
|
106
|
+
var t = e.form || oe(e), a = function(p) {
|
|
107
|
+
return t.querySelectorAll('input[type="radio"][name="' + p + '"]');
|
|
108
|
+
}, u;
|
|
109
|
+
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
110
|
+
u = a(window.CSS.escape(e.name));
|
|
111
|
+
else
|
|
112
|
+
try {
|
|
113
|
+
u = a(e.name);
|
|
114
|
+
} catch (n) {
|
|
115
|
+
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
|
+
}
|
|
117
|
+
var l = Ge(u, e.form);
|
|
118
|
+
return !l || l === e;
|
|
119
|
+
}, We = function(e) {
|
|
120
|
+
return Oe(e) && e.type === "radio";
|
|
121
|
+
}, ze = function(e) {
|
|
122
|
+
return We(e) && !Ue(e);
|
|
123
|
+
}, Ye = function(e) {
|
|
124
|
+
var t, a = e && oe(e), u = (t = a) === null || t === void 0 ? void 0 : t.host, l = !1;
|
|
125
|
+
if (a && a !== e) {
|
|
126
|
+
var n, p, y;
|
|
127
|
+
for (l = !!((n = u) !== null && n !== void 0 && (p = n.ownerDocument) !== null && p !== void 0 && p.contains(u) || e != null && (y = e.ownerDocument) !== null && y !== void 0 && y.contains(e)); !l && u; ) {
|
|
128
|
+
var k, S, D;
|
|
129
|
+
a = oe(u), u = (k = a) === null || k === void 0 ? void 0 : k.host, l = !!((S = u) !== null && S !== void 0 && (D = S.ownerDocument) !== null && D !== void 0 && D.contains(u));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return l;
|
|
133
|
+
}, be = function(e) {
|
|
134
|
+
var t = e.getBoundingClientRect(), a = t.width, u = t.height;
|
|
135
|
+
return a === 0 && u === 0;
|
|
136
|
+
}, He = function(e, t) {
|
|
137
|
+
var a = t.displayCheck, u = t.getShadowRoot;
|
|
138
|
+
if (a === "full-native" && "checkVisibility" in e) {
|
|
139
|
+
var l = e.checkVisibility({
|
|
140
|
+
// Checking opacity might be desirable for some use cases, but natively,
|
|
141
|
+
// opacity zero elements _are_ focusable and tabbable.
|
|
142
|
+
checkOpacity: !1,
|
|
143
|
+
opacityProperty: !1,
|
|
144
|
+
contentVisibilityAuto: !0,
|
|
145
|
+
visibilityProperty: !0,
|
|
146
|
+
// This is an alias for `visibilityProperty`. Contemporary browsers
|
|
147
|
+
// support both. However, this alias has wider browser support (Chrome
|
|
148
|
+
// >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
|
|
149
|
+
// we include it anyway.
|
|
150
|
+
checkVisibilityCSS: !0
|
|
151
|
+
});
|
|
152
|
+
return !l;
|
|
153
|
+
}
|
|
154
|
+
if (getComputedStyle(e).visibility === "hidden")
|
|
155
|
+
return !0;
|
|
156
|
+
var n = W.call(e, "details>summary:first-of-type"), p = n ? e.parentElement : e;
|
|
157
|
+
if (W.call(p, "details:not([open]) *"))
|
|
158
|
+
return !0;
|
|
159
|
+
if (!a || a === "full" || // full-native can run this branch when it falls through in case
|
|
160
|
+
// Element#checkVisibility is unsupported
|
|
161
|
+
a === "full-native" || a === "legacy-full") {
|
|
162
|
+
if (typeof u == "function") {
|
|
163
|
+
for (var y = e; e; ) {
|
|
164
|
+
var k = e.parentElement, S = oe(e);
|
|
165
|
+
if (k && !k.shadowRoot && u(k) === !0)
|
|
166
|
+
return be(e);
|
|
167
|
+
e.assignedSlot ? e = e.assignedSlot : !k && S !== e.ownerDocument ? e = S.host : e = k;
|
|
168
|
+
}
|
|
169
|
+
e = y;
|
|
170
|
+
}
|
|
171
|
+
if (Ye(e))
|
|
172
|
+
return !e.getClientRects().length;
|
|
173
|
+
if (a !== "legacy-full")
|
|
174
|
+
return !0;
|
|
175
|
+
} else if (a === "non-zero-area")
|
|
176
|
+
return be(e);
|
|
177
|
+
return !1;
|
|
178
|
+
}, Ze = function(e) {
|
|
179
|
+
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
|
|
180
|
+
for (var t = e.parentElement; t; ) {
|
|
181
|
+
if (t.tagName === "FIELDSET" && t.disabled) {
|
|
182
|
+
for (var a = 0; a < t.children.length; a++) {
|
|
183
|
+
var u = t.children.item(a);
|
|
184
|
+
if (u.tagName === "LEGEND")
|
|
185
|
+
return W.call(t, "fieldset[disabled] *") ? !0 : !u.contains(e);
|
|
186
|
+
}
|
|
187
|
+
return !0;
|
|
188
|
+
}
|
|
189
|
+
t = t.parentElement;
|
|
190
|
+
}
|
|
191
|
+
return !1;
|
|
192
|
+
}, ce = function(e, t) {
|
|
193
|
+
return !(t.disabled || Ve(t) || He(t, e) || // For a details element with a summary, the summary element gets the focus
|
|
194
|
+
$e(t) || Ze(t));
|
|
195
|
+
}, de = function(e, t) {
|
|
196
|
+
return !(ze(t) || q(t) < 0 || !ce(e, t));
|
|
197
|
+
}, Xe = function(e) {
|
|
198
|
+
var t = parseInt(e.getAttribute("tabindex"), 10);
|
|
199
|
+
return !!(isNaN(t) || t >= 0);
|
|
200
|
+
}, De = function(e) {
|
|
201
|
+
var t = [], a = [];
|
|
202
|
+
return e.forEach(function(u, l) {
|
|
203
|
+
var n = !!u.scopeParent, p = n ? u.scopeParent : u, y = Ke(p, n), k = n ? De(u.candidates) : p;
|
|
204
|
+
y === 0 ? n ? t.push.apply(t, k) : t.push(p) : a.push({
|
|
205
|
+
documentOrder: l,
|
|
206
|
+
tabIndex: y,
|
|
207
|
+
item: u,
|
|
208
|
+
isScope: n,
|
|
209
|
+
content: k
|
|
210
|
+
});
|
|
211
|
+
}), a.sort(qe).reduce(function(u, l) {
|
|
212
|
+
return l.isScope ? u.push.apply(u, l.content) : u.push(l.content), u;
|
|
213
|
+
}, []).concat(t);
|
|
214
|
+
}, Ne = function(e, t) {
|
|
215
|
+
t = t || {};
|
|
216
|
+
var a;
|
|
217
|
+
return t.getShadowRoot ? a = se([e], t.includeContainer, {
|
|
218
|
+
filter: de.bind(null, t),
|
|
219
|
+
flatten: !1,
|
|
220
|
+
getShadowRoot: t.getShadowRoot,
|
|
221
|
+
shadowRootFilter: Xe
|
|
222
|
+
}) : a = Fe(e, t.includeContainer, de.bind(null, t)), De(a);
|
|
223
|
+
}, Re = function(e, t) {
|
|
224
|
+
t = t || {};
|
|
225
|
+
var a;
|
|
226
|
+
return t.getShadowRoot ? a = se([e], t.includeContainer, {
|
|
227
|
+
filter: ce.bind(null, t),
|
|
228
|
+
flatten: !0,
|
|
229
|
+
getShadowRoot: t.getShadowRoot
|
|
230
|
+
}) : a = Fe(e, t.includeContainer, ce.bind(null, t)), a;
|
|
231
|
+
}, U = function(e, t) {
|
|
232
|
+
if (t = t || {}, !e)
|
|
233
|
+
throw new Error("No node provided");
|
|
234
|
+
return W.call(e, ie) === !1 ? !1 : de(t, e);
|
|
235
|
+
}, Je = /* @__PURE__ */ ke.concat("iframe:not([inert]):not([inert] *)").join(","), ae = function(e, t) {
|
|
236
|
+
if (t = t || {}, !e)
|
|
237
|
+
throw new Error("No node provided");
|
|
238
|
+
return W.call(e, Je) === !1 ? !1 : ce(t, e);
|
|
239
|
+
};
|
|
240
|
+
const Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
241
|
+
__proto__: null,
|
|
242
|
+
focusable: Re,
|
|
243
|
+
getTabIndex: q,
|
|
244
|
+
isFocusable: ae,
|
|
245
|
+
isTabbable: U,
|
|
246
|
+
tabbable: Ne
|
|
247
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
248
|
+
/*!
|
|
249
|
+
* focus-trap 7.8.0
|
|
250
|
+
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
251
|
+
*/
|
|
252
|
+
function ve(r, e) {
|
|
253
|
+
(e == null || e > r.length) && (e = r.length);
|
|
254
|
+
for (var t = 0, a = Array(e); t < e; t++) a[t] = r[t];
|
|
255
|
+
return a;
|
|
256
|
+
}
|
|
257
|
+
function et(r) {
|
|
258
|
+
if (Array.isArray(r)) return ve(r);
|
|
259
|
+
}
|
|
260
|
+
function he(r, e) {
|
|
261
|
+
var t = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"];
|
|
262
|
+
if (!t) {
|
|
263
|
+
if (Array.isArray(r) || (t = Pe(r)) || e) {
|
|
264
|
+
t && (r = t);
|
|
265
|
+
var a = 0, u = function() {
|
|
266
|
+
};
|
|
267
|
+
return {
|
|
268
|
+
s: u,
|
|
269
|
+
n: function() {
|
|
270
|
+
return a >= r.length ? {
|
|
271
|
+
done: !0
|
|
272
|
+
} : {
|
|
273
|
+
done: !1,
|
|
274
|
+
value: r[a++]
|
|
275
|
+
};
|
|
276
|
+
},
|
|
277
|
+
e: function(y) {
|
|
278
|
+
throw y;
|
|
279
|
+
},
|
|
280
|
+
f: u
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
284
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
285
|
+
}
|
|
286
|
+
var l, n = !0, p = !1;
|
|
287
|
+
return {
|
|
288
|
+
s: function() {
|
|
289
|
+
t = t.call(r);
|
|
290
|
+
},
|
|
291
|
+
n: function() {
|
|
292
|
+
var y = t.next();
|
|
293
|
+
return n = y.done, y;
|
|
294
|
+
},
|
|
295
|
+
e: function(y) {
|
|
296
|
+
p = !0, l = y;
|
|
297
|
+
},
|
|
298
|
+
f: function() {
|
|
299
|
+
try {
|
|
300
|
+
n || t.return == null || t.return();
|
|
301
|
+
} finally {
|
|
302
|
+
if (p) throw l;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
function tt(r, e, t) {
|
|
308
|
+
return (e = ot(e)) in r ? Object.defineProperty(r, e, {
|
|
309
|
+
value: t,
|
|
310
|
+
enumerable: !0,
|
|
311
|
+
configurable: !0,
|
|
312
|
+
writable: !0
|
|
313
|
+
}) : r[e] = t, r;
|
|
314
|
+
}
|
|
315
|
+
function rt(r) {
|
|
316
|
+
if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
|
|
317
|
+
}
|
|
318
|
+
function at() {
|
|
319
|
+
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
320
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
321
|
+
}
|
|
322
|
+
function ye(r, e) {
|
|
323
|
+
var t = Object.keys(r);
|
|
324
|
+
if (Object.getOwnPropertySymbols) {
|
|
325
|
+
var a = Object.getOwnPropertySymbols(r);
|
|
326
|
+
e && (a = a.filter(function(u) {
|
|
327
|
+
return Object.getOwnPropertyDescriptor(r, u).enumerable;
|
|
328
|
+
})), t.push.apply(t, a);
|
|
329
|
+
}
|
|
330
|
+
return t;
|
|
331
|
+
}
|
|
332
|
+
function me(r) {
|
|
333
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
334
|
+
var t = arguments[e] != null ? arguments[e] : {};
|
|
335
|
+
e % 2 ? ye(Object(t), !0).forEach(function(a) {
|
|
336
|
+
tt(r, a, t[a]);
|
|
337
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(r, Object.getOwnPropertyDescriptors(t)) : ye(Object(t)).forEach(function(a) {
|
|
338
|
+
Object.defineProperty(r, a, Object.getOwnPropertyDescriptor(t, a));
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
return r;
|
|
342
|
+
}
|
|
343
|
+
function nt(r) {
|
|
344
|
+
return et(r) || rt(r) || Pe(r) || at();
|
|
345
|
+
}
|
|
346
|
+
function it(r, e) {
|
|
347
|
+
if (typeof r != "object" || !r) return r;
|
|
348
|
+
var t = r[Symbol.toPrimitive];
|
|
349
|
+
if (t !== void 0) {
|
|
350
|
+
var a = t.call(r, e);
|
|
351
|
+
if (typeof a != "object") return a;
|
|
352
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
353
|
+
}
|
|
354
|
+
return (e === "string" ? String : Number)(r);
|
|
355
|
+
}
|
|
356
|
+
function ot(r) {
|
|
357
|
+
var e = it(r, "string");
|
|
358
|
+
return typeof e == "symbol" ? e : e + "";
|
|
359
|
+
}
|
|
360
|
+
function Pe(r, e) {
|
|
361
|
+
if (r) {
|
|
362
|
+
if (typeof r == "string") return ve(r, e);
|
|
363
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
364
|
+
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) ? ve(r, e) : void 0;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
var B = {
|
|
368
|
+
// Returns the trap from the top of the stack.
|
|
369
|
+
getActiveTrap: function(e) {
|
|
370
|
+
return (e == null ? void 0 : e.length) > 0 ? e[e.length - 1] : null;
|
|
371
|
+
},
|
|
372
|
+
// Pauses the currently active trap, then adds a new trap to the stack.
|
|
373
|
+
activateTrap: function(e, t) {
|
|
374
|
+
var a = B.getActiveTrap(e);
|
|
375
|
+
t !== a && B.pauseTrap(e);
|
|
376
|
+
var u = e.indexOf(t);
|
|
377
|
+
u === -1 || e.splice(u, 1), e.push(t);
|
|
378
|
+
},
|
|
379
|
+
// Removes the trap from the top of the stack, then unpauses the next trap down.
|
|
380
|
+
deactivateTrap: function(e, t) {
|
|
381
|
+
var a = e.indexOf(t);
|
|
382
|
+
a !== -1 && e.splice(a, 1), B.unpauseTrap(e);
|
|
383
|
+
},
|
|
384
|
+
// Pauses the trap at the top of the stack.
|
|
385
|
+
pauseTrap: function(e) {
|
|
386
|
+
var t = B.getActiveTrap(e);
|
|
387
|
+
t == null || t._setPausedState(!0);
|
|
388
|
+
},
|
|
389
|
+
// Unpauses the trap at the top of the stack.
|
|
390
|
+
unpauseTrap: function(e) {
|
|
391
|
+
var t = B.getActiveTrap(e);
|
|
392
|
+
t && !t._isManuallyPaused() && t._setPausedState(!1);
|
|
393
|
+
}
|
|
394
|
+
}, ut = function(e) {
|
|
395
|
+
return e.tagName && e.tagName.toLowerCase() === "input" && typeof e.select == "function";
|
|
396
|
+
}, st = function(e) {
|
|
397
|
+
return (e == null ? void 0 : e.key) === "Escape" || (e == null ? void 0 : e.key) === "Esc" || (e == null ? void 0 : e.keyCode) === 27;
|
|
398
|
+
}, X = function(e) {
|
|
399
|
+
return (e == null ? void 0 : e.key) === "Tab" || (e == null ? void 0 : e.keyCode) === 9;
|
|
400
|
+
}, ct = function(e) {
|
|
401
|
+
return X(e) && !e.shiftKey;
|
|
402
|
+
}, lt = function(e) {
|
|
403
|
+
return X(e) && e.shiftKey;
|
|
404
|
+
}, ge = function(e) {
|
|
405
|
+
return setTimeout(e, 0);
|
|
406
|
+
}, Z = function(e) {
|
|
407
|
+
for (var t = arguments.length, a = new Array(t > 1 ? t - 1 : 0), u = 1; u < t; u++)
|
|
408
|
+
a[u - 1] = arguments[u];
|
|
409
|
+
return typeof e == "function" ? e.apply(void 0, a) : e;
|
|
410
|
+
}, ee = function(e) {
|
|
411
|
+
return e.target.shadowRoot && typeof e.composedPath == "function" ? e.composedPath()[0] : e.target;
|
|
412
|
+
}, ft = [], dt = function(e, t) {
|
|
413
|
+
var a = (t == null ? void 0 : t.document) || document, u = (t == null ? void 0 : t.trapStack) || ft, l = me({
|
|
414
|
+
returnFocusOnDeactivate: !0,
|
|
415
|
+
escapeDeactivates: !0,
|
|
416
|
+
delayInitialFocus: !0,
|
|
417
|
+
isolateSubtrees: !1,
|
|
418
|
+
isKeyForward: ct,
|
|
419
|
+
isKeyBackward: lt
|
|
420
|
+
}, t), n = {
|
|
421
|
+
// containers given to createFocusTrap()
|
|
422
|
+
/** @type {Array<HTMLElement>} */
|
|
423
|
+
containers: [],
|
|
424
|
+
// list of objects identifying tabbable nodes in `containers` in the trap
|
|
425
|
+
// NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
|
|
426
|
+
// is active, but the trap should never get to a state where there isn't at least one group
|
|
427
|
+
// with at least one tabbable node in it (that would lead to an error condition that would
|
|
428
|
+
// result in an error being thrown)
|
|
429
|
+
/** @type {Array<{
|
|
430
|
+
* container: HTMLElement,
|
|
431
|
+
* tabbableNodes: Array<HTMLElement>, // empty if none
|
|
432
|
+
* focusableNodes: Array<HTMLElement>, // empty if none
|
|
433
|
+
* posTabIndexesFound: boolean,
|
|
434
|
+
* firstTabbableNode: HTMLElement|undefined,
|
|
435
|
+
* lastTabbableNode: HTMLElement|undefined,
|
|
436
|
+
* firstDomTabbableNode: HTMLElement|undefined,
|
|
437
|
+
* lastDomTabbableNode: HTMLElement|undefined,
|
|
438
|
+
* nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
|
|
439
|
+
* }>}
|
|
440
|
+
*/
|
|
441
|
+
containerGroups: [],
|
|
442
|
+
// same order/length as `containers` list
|
|
443
|
+
// references to objects in `containerGroups`, but only those that actually have
|
|
444
|
+
// tabbable nodes in them
|
|
445
|
+
// NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
|
|
446
|
+
// the same length
|
|
447
|
+
tabbableGroups: [],
|
|
448
|
+
// references to nodes that are siblings to the ancestors of this trap's containers.
|
|
449
|
+
/** @type {Set<HTMLElement>} */
|
|
450
|
+
adjacentElements: /* @__PURE__ */ new Set(),
|
|
451
|
+
// references to nodes that were inert or aria-hidden before the trap was activated.
|
|
452
|
+
/** @type {Set<HTMLElement>} */
|
|
453
|
+
alreadySilent: /* @__PURE__ */ new Set(),
|
|
454
|
+
nodeFocusedBeforeActivation: null,
|
|
455
|
+
mostRecentlyFocusedNode: null,
|
|
456
|
+
active: !1,
|
|
457
|
+
paused: !1,
|
|
458
|
+
manuallyPaused: !1,
|
|
459
|
+
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
460
|
+
// has been delayed during activation
|
|
461
|
+
delayInitialFocusTimer: void 0,
|
|
462
|
+
// the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
|
|
463
|
+
recentNavEvent: void 0
|
|
464
|
+
}, p, y = function(o, i, f) {
|
|
465
|
+
return o && o[i] !== void 0 ? o[i] : l[f || i];
|
|
466
|
+
}, k = function(o, i) {
|
|
467
|
+
var f = typeof (i == null ? void 0 : i.composedPath) == "function" ? i.composedPath() : void 0;
|
|
468
|
+
return n.containerGroups.findIndex(function(g) {
|
|
469
|
+
var h = g.container, T = g.tabbableNodes;
|
|
470
|
+
return h.contains(o) || // fall back to explicit tabbable search which will take into consideration any
|
|
471
|
+
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
472
|
+
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
473
|
+
// look inside web components even if open)
|
|
474
|
+
(f == null ? void 0 : f.includes(h)) || T.find(function(v) {
|
|
475
|
+
return v === o;
|
|
476
|
+
});
|
|
477
|
+
});
|
|
478
|
+
}, S = function(o) {
|
|
479
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, f = i.hasFallback, g = f === void 0 ? !1 : f, h = i.params, T = h === void 0 ? [] : h, v = l[o];
|
|
480
|
+
if (typeof v == "function" && (v = v.apply(void 0, nt(T))), v === !0 && (v = void 0), !v) {
|
|
481
|
+
if (v === void 0 || v === !1)
|
|
482
|
+
return v;
|
|
483
|
+
throw new Error("`".concat(o, "` was specified but was not a node, or did not return a node"));
|
|
484
|
+
}
|
|
485
|
+
var E = v;
|
|
486
|
+
if (typeof v == "string") {
|
|
487
|
+
try {
|
|
488
|
+
E = a.querySelector(v);
|
|
489
|
+
} catch (F) {
|
|
490
|
+
throw new Error("`".concat(o, '` appears to be an invalid selector; error="').concat(F.message, '"'));
|
|
491
|
+
}
|
|
492
|
+
if (!E && !g)
|
|
493
|
+
throw new Error("`".concat(o, "` as selector refers to no known node"));
|
|
494
|
+
}
|
|
495
|
+
return E;
|
|
496
|
+
}, D = function() {
|
|
497
|
+
var o = S("initialFocus", {
|
|
498
|
+
hasFallback: !0
|
|
499
|
+
});
|
|
500
|
+
if (o === !1)
|
|
501
|
+
return !1;
|
|
502
|
+
if (o === void 0 || o && !ae(o, l.tabbableOptions))
|
|
503
|
+
if (k(a.activeElement) >= 0)
|
|
504
|
+
o = a.activeElement;
|
|
505
|
+
else {
|
|
506
|
+
var i = n.tabbableGroups[0], f = i && i.firstTabbableNode;
|
|
507
|
+
o = f || S("fallbackFocus");
|
|
508
|
+
}
|
|
509
|
+
else o === null && (o = S("fallbackFocus"));
|
|
510
|
+
if (!o)
|
|
511
|
+
throw new Error("Your focus-trap needs to have at least one focusable element");
|
|
512
|
+
return o;
|
|
513
|
+
}, R = function() {
|
|
514
|
+
if (n.containerGroups = n.containers.map(function(o) {
|
|
515
|
+
var i = Ne(o, l.tabbableOptions), f = Re(o, l.tabbableOptions), g = i.length > 0 ? i[0] : void 0, h = i.length > 0 ? i[i.length - 1] : void 0, T = f.find(function(F) {
|
|
516
|
+
return U(F);
|
|
517
|
+
}), v = f.slice().reverse().find(function(F) {
|
|
518
|
+
return U(F);
|
|
519
|
+
}), E = !!i.find(function(F) {
|
|
520
|
+
return q(F) > 0;
|
|
521
|
+
});
|
|
522
|
+
return {
|
|
523
|
+
container: o,
|
|
524
|
+
tabbableNodes: i,
|
|
525
|
+
focusableNodes: f,
|
|
526
|
+
/** True if at least one node with positive `tabindex` was found in this container. */
|
|
527
|
+
posTabIndexesFound: E,
|
|
528
|
+
/** First tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
529
|
+
firstTabbableNode: g,
|
|
530
|
+
/** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
|
|
531
|
+
lastTabbableNode: h,
|
|
532
|
+
// NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
|
|
533
|
+
// would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
|
|
534
|
+
// because that API doesn't work with Shadow DOM as well as it should (@see
|
|
535
|
+
// https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
|
|
536
|
+
// to address an edge case related to positive tabindex support, this seems like a much easier,
|
|
537
|
+
// "close enough most of the time" alternative for positive tabindexes which should generally
|
|
538
|
+
// be avoided anyway...
|
|
539
|
+
/** First tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
540
|
+
firstDomTabbableNode: T,
|
|
541
|
+
/** Last tabbable node in container, __DOM__ order; `undefined` if none. */
|
|
542
|
+
lastDomTabbableNode: v,
|
|
543
|
+
/**
|
|
544
|
+
* Finds the __tabbable__ node that follows the given node in the specified direction,
|
|
545
|
+
* in this container, if any.
|
|
546
|
+
* @param {HTMLElement} node
|
|
547
|
+
* @param {boolean} [forward] True if going in forward tab order; false if going
|
|
548
|
+
* in reverse.
|
|
549
|
+
* @returns {HTMLElement|undefined} The next tabbable node, if any.
|
|
550
|
+
*/
|
|
551
|
+
nextTabbableNode: function(P) {
|
|
552
|
+
var L = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, A = i.indexOf(P);
|
|
553
|
+
return A < 0 ? L ? f.slice(f.indexOf(P) + 1).find(function(G) {
|
|
554
|
+
return U(G);
|
|
555
|
+
}) : f.slice(0, f.indexOf(P)).reverse().find(function(G) {
|
|
556
|
+
return U(G);
|
|
557
|
+
}) : i[A + (L ? 1 : -1)];
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
}), n.tabbableGroups = n.containerGroups.filter(function(o) {
|
|
561
|
+
return o.tabbableNodes.length > 0;
|
|
562
|
+
}), n.tabbableGroups.length <= 0 && !S("fallbackFocus"))
|
|
563
|
+
throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");
|
|
564
|
+
if (n.containerGroups.find(function(o) {
|
|
565
|
+
return o.posTabIndexesFound;
|
|
566
|
+
}) && n.containerGroups.length > 1)
|
|
567
|
+
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
|
+
}, j = function(o) {
|
|
569
|
+
var i = o.activeElement;
|
|
570
|
+
if (i)
|
|
571
|
+
return i.shadowRoot && i.shadowRoot.activeElement !== null ? j(i.shadowRoot) : i;
|
|
572
|
+
}, N = function(o) {
|
|
573
|
+
if (o !== !1 && o !== j(document)) {
|
|
574
|
+
if (!o || !o.focus) {
|
|
575
|
+
N(D());
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
o.focus({
|
|
579
|
+
preventScroll: !!l.preventScroll
|
|
580
|
+
}), n.mostRecentlyFocusedNode = o, ut(o) && o.select();
|
|
581
|
+
}
|
|
582
|
+
}, x = function(o) {
|
|
583
|
+
var i = S("setReturnFocus", {
|
|
584
|
+
params: [o]
|
|
585
|
+
});
|
|
586
|
+
return i || (i === !1 ? !1 : o);
|
|
587
|
+
}, I = function(o) {
|
|
588
|
+
var i = o.target, f = o.event, g = o.isBackward, h = g === void 0 ? !1 : g;
|
|
589
|
+
i = i || ee(f), R();
|
|
590
|
+
var T = null;
|
|
591
|
+
if (n.tabbableGroups.length > 0) {
|
|
592
|
+
var v = k(i, f), E = v >= 0 ? n.containerGroups[v] : void 0;
|
|
593
|
+
if (v < 0)
|
|
594
|
+
h ? T = n.tabbableGroups[n.tabbableGroups.length - 1].lastTabbableNode : T = n.tabbableGroups[0].firstTabbableNode;
|
|
595
|
+
else if (h) {
|
|
596
|
+
var F = n.tabbableGroups.findIndex(function(le) {
|
|
597
|
+
var fe = le.firstTabbableNode;
|
|
598
|
+
return i === fe;
|
|
599
|
+
});
|
|
600
|
+
if (F < 0 && (E.container === i || ae(i, l.tabbableOptions) && !U(i, l.tabbableOptions) && !E.nextTabbableNode(i, !1)) && (F = v), F >= 0) {
|
|
601
|
+
var P = F === 0 ? n.tabbableGroups.length - 1 : F - 1, L = n.tabbableGroups[P];
|
|
602
|
+
T = q(i) >= 0 ? L.lastTabbableNode : L.lastDomTabbableNode;
|
|
603
|
+
} else X(f) || (T = E.nextTabbableNode(i, !1));
|
|
604
|
+
} else {
|
|
605
|
+
var A = n.tabbableGroups.findIndex(function(le) {
|
|
606
|
+
var fe = le.lastTabbableNode;
|
|
607
|
+
return i === fe;
|
|
608
|
+
});
|
|
609
|
+
if (A < 0 && (E.container === i || ae(i, l.tabbableOptions) && !U(i, l.tabbableOptions) && !E.nextTabbableNode(i)) && (A = v), A >= 0) {
|
|
610
|
+
var G = A === n.tabbableGroups.length - 1 ? 0 : A + 1, K = n.tabbableGroups[G];
|
|
611
|
+
T = q(i) >= 0 ? K.firstTabbableNode : K.firstDomTabbableNode;
|
|
612
|
+
} else X(f) || (T = E.nextTabbableNode(i));
|
|
613
|
+
}
|
|
614
|
+
} else
|
|
615
|
+
T = S("fallbackFocus");
|
|
616
|
+
return T;
|
|
617
|
+
}, _ = function(o) {
|
|
618
|
+
var i = ee(o);
|
|
619
|
+
if (!(k(i, o) >= 0)) {
|
|
620
|
+
if (Z(l.clickOutsideDeactivates, o)) {
|
|
621
|
+
p.deactivate({
|
|
622
|
+
// NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
|
|
623
|
+
// which will result in the outside click setting focus to the node
|
|
624
|
+
// that was clicked (and if not focusable, to "nothing"); by setting
|
|
625
|
+
// `returnFocus: true`, we'll attempt to re-focus the node originally-focused
|
|
626
|
+
// on activation (or the configured `setReturnFocus` node), whether the
|
|
627
|
+
// outside click was on a focusable node or not
|
|
628
|
+
returnFocus: l.returnFocusOnDeactivate
|
|
629
|
+
});
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
Z(l.allowOutsideClick, o) || o.preventDefault();
|
|
633
|
+
}
|
|
634
|
+
}, V = function(o) {
|
|
635
|
+
var i = ee(o), f = k(i, o) >= 0;
|
|
636
|
+
if (f || i instanceof Document)
|
|
637
|
+
f && (n.mostRecentlyFocusedNode = i);
|
|
638
|
+
else {
|
|
639
|
+
o.stopImmediatePropagation();
|
|
640
|
+
var g, h = !0;
|
|
641
|
+
if (n.mostRecentlyFocusedNode)
|
|
642
|
+
if (q(n.mostRecentlyFocusedNode) > 0) {
|
|
643
|
+
var T = k(n.mostRecentlyFocusedNode), v = n.containerGroups[T].tabbableNodes;
|
|
644
|
+
if (v.length > 0) {
|
|
645
|
+
var E = v.findIndex(function(F) {
|
|
646
|
+
return F === n.mostRecentlyFocusedNode;
|
|
647
|
+
});
|
|
648
|
+
E >= 0 && (l.isKeyForward(n.recentNavEvent) ? E + 1 < v.length && (g = v[E + 1], h = !1) : E - 1 >= 0 && (g = v[E - 1], h = !1));
|
|
649
|
+
}
|
|
650
|
+
} else
|
|
651
|
+
n.containerGroups.some(function(F) {
|
|
652
|
+
return F.tabbableNodes.some(function(P) {
|
|
653
|
+
return q(P) > 0;
|
|
654
|
+
});
|
|
655
|
+
}) || (h = !1);
|
|
656
|
+
else
|
|
657
|
+
h = !1;
|
|
658
|
+
h && (g = I({
|
|
659
|
+
// move FROM the MRU node, not event-related node (which will be the node that is
|
|
660
|
+
// outside the trap causing the focus escape we're trying to fix)
|
|
661
|
+
target: n.mostRecentlyFocusedNode,
|
|
662
|
+
isBackward: l.isKeyBackward(n.recentNavEvent)
|
|
663
|
+
})), N(g || n.mostRecentlyFocusedNode || D());
|
|
664
|
+
}
|
|
665
|
+
n.recentNavEvent = void 0;
|
|
666
|
+
}, z = function(o) {
|
|
667
|
+
var i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1;
|
|
668
|
+
n.recentNavEvent = o;
|
|
669
|
+
var f = I({
|
|
670
|
+
event: o,
|
|
671
|
+
isBackward: i
|
|
672
|
+
});
|
|
673
|
+
f && (X(o) && o.preventDefault(), N(f));
|
|
674
|
+
}, $ = function(o) {
|
|
675
|
+
(l.isKeyForward(o) || l.isKeyBackward(o)) && z(o, l.isKeyBackward(o));
|
|
676
|
+
}, Y = function(o) {
|
|
677
|
+
st(o) && Z(l.escapeDeactivates, o) !== !1 && (o.preventDefault(), p.deactivate());
|
|
678
|
+
}, M = function(o) {
|
|
679
|
+
var i = ee(o);
|
|
680
|
+
k(i, o) >= 0 || Z(l.clickOutsideDeactivates, o) || Z(l.allowOutsideClick, o) || (o.preventDefault(), o.stopImmediatePropagation());
|
|
681
|
+
}, d = function() {
|
|
682
|
+
if (n.active)
|
|
683
|
+
return B.activateTrap(u, p), n.delayInitialFocusTimer = l.delayInitialFocus ? ge(function() {
|
|
684
|
+
N(D());
|
|
685
|
+
}) : N(D()), a.addEventListener("focusin", V, !0), a.addEventListener("mousedown", _, {
|
|
686
|
+
capture: !0,
|
|
687
|
+
passive: !1
|
|
688
|
+
}), a.addEventListener("touchstart", _, {
|
|
689
|
+
capture: !0,
|
|
690
|
+
passive: !1
|
|
691
|
+
}), a.addEventListener("click", M, {
|
|
692
|
+
capture: !0,
|
|
693
|
+
passive: !1
|
|
694
|
+
}), a.addEventListener("keydown", $, {
|
|
695
|
+
capture: !0,
|
|
696
|
+
passive: !1
|
|
697
|
+
}), a.addEventListener("keydown", Y), p;
|
|
698
|
+
}, s = function(o) {
|
|
699
|
+
n.active && !n.paused && p._setSubtreeIsolation(!1), n.adjacentElements.clear(), n.alreadySilent.clear();
|
|
700
|
+
var i = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), g = he(o), h;
|
|
701
|
+
try {
|
|
702
|
+
for (g.s(); !(h = g.n()).done; ) {
|
|
703
|
+
var T = h.value;
|
|
704
|
+
i.add(T);
|
|
705
|
+
for (var v = typeof ShadowRoot < "u" && T.getRootNode() instanceof ShadowRoot, E = T; E; ) {
|
|
706
|
+
i.add(E);
|
|
707
|
+
var F = E.parentElement, P = [];
|
|
708
|
+
F ? P = F.children : !F && v && (P = E.getRootNode().children, F = E.getRootNode().host, v = typeof ShadowRoot < "u" && F.getRootNode() instanceof ShadowRoot);
|
|
709
|
+
var L = he(P), A;
|
|
710
|
+
try {
|
|
711
|
+
for (L.s(); !(A = L.n()).done; ) {
|
|
712
|
+
var G = A.value;
|
|
713
|
+
f.add(G);
|
|
714
|
+
}
|
|
715
|
+
} catch (K) {
|
|
716
|
+
L.e(K);
|
|
717
|
+
} finally {
|
|
718
|
+
L.f();
|
|
719
|
+
}
|
|
720
|
+
E = F;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
} catch (K) {
|
|
724
|
+
g.e(K);
|
|
725
|
+
} finally {
|
|
726
|
+
g.f();
|
|
727
|
+
}
|
|
728
|
+
i.forEach(function(K) {
|
|
729
|
+
f.delete(K);
|
|
730
|
+
}), n.adjacentElements = f;
|
|
731
|
+
}, m = function() {
|
|
732
|
+
if (n.active)
|
|
733
|
+
return a.removeEventListener("focusin", V, !0), a.removeEventListener("mousedown", _, !0), a.removeEventListener("touchstart", _, !0), a.removeEventListener("click", M, !0), a.removeEventListener("keydown", $, !0), a.removeEventListener("keydown", Y), p;
|
|
734
|
+
}, c = function(o) {
|
|
735
|
+
var i = o.some(function(f) {
|
|
736
|
+
var g = Array.from(f.removedNodes);
|
|
737
|
+
return g.some(function(h) {
|
|
738
|
+
return h === n.mostRecentlyFocusedNode;
|
|
739
|
+
});
|
|
740
|
+
});
|
|
741
|
+
i && N(D());
|
|
742
|
+
}, w = typeof window < "u" && "MutationObserver" in window ? new MutationObserver(c) : void 0, O = function() {
|
|
743
|
+
w && (w.disconnect(), n.active && !n.paused && n.containers.map(function(o) {
|
|
744
|
+
w.observe(o, {
|
|
745
|
+
subtree: !0,
|
|
746
|
+
childList: !0
|
|
747
|
+
});
|
|
748
|
+
}));
|
|
749
|
+
};
|
|
750
|
+
return p = {
|
|
751
|
+
get active() {
|
|
752
|
+
return n.active;
|
|
753
|
+
},
|
|
754
|
+
get paused() {
|
|
755
|
+
return n.paused;
|
|
756
|
+
},
|
|
757
|
+
activate: function(o) {
|
|
758
|
+
if (n.active)
|
|
759
|
+
return this;
|
|
760
|
+
var i = y(o, "onActivate"), f = y(o, "onPostActivate"), g = y(o, "checkCanFocusTrap"), h = B.getActiveTrap(u), T = !1;
|
|
761
|
+
if (h && !h.paused) {
|
|
762
|
+
var v;
|
|
763
|
+
(v = h._setSubtreeIsolation) === null || v === void 0 || v.call(h, !1), T = !0;
|
|
764
|
+
}
|
|
765
|
+
try {
|
|
766
|
+
g || R(), n.active = !0, n.paused = !1, n.nodeFocusedBeforeActivation = j(a), i == null || i();
|
|
767
|
+
var E = function() {
|
|
768
|
+
g && R(), d(), O(), l.isolateSubtrees && p._setSubtreeIsolation(!0), f == null || f();
|
|
769
|
+
};
|
|
770
|
+
if (g)
|
|
771
|
+
return g(n.containers.concat()).then(E, E), this;
|
|
772
|
+
E();
|
|
773
|
+
} catch (P) {
|
|
774
|
+
if (h === B.getActiveTrap(u) && T) {
|
|
775
|
+
var F;
|
|
776
|
+
(F = h._setSubtreeIsolation) === null || F === void 0 || F.call(h, !0);
|
|
777
|
+
}
|
|
778
|
+
throw P;
|
|
779
|
+
}
|
|
780
|
+
return this;
|
|
781
|
+
},
|
|
782
|
+
deactivate: function(o) {
|
|
783
|
+
if (!n.active)
|
|
784
|
+
return this;
|
|
785
|
+
var i = me({
|
|
786
|
+
onDeactivate: l.onDeactivate,
|
|
787
|
+
onPostDeactivate: l.onPostDeactivate,
|
|
788
|
+
checkCanReturnFocus: l.checkCanReturnFocus
|
|
789
|
+
}, o);
|
|
790
|
+
clearTimeout(n.delayInitialFocusTimer), n.delayInitialFocusTimer = void 0, n.paused || p._setSubtreeIsolation(!1), n.alreadySilent.clear(), m(), n.active = !1, n.paused = !1, O(), B.deactivateTrap(u, p);
|
|
791
|
+
var f = y(i, "onDeactivate"), g = y(i, "onPostDeactivate"), h = y(i, "checkCanReturnFocus"), T = y(i, "returnFocus", "returnFocusOnDeactivate");
|
|
792
|
+
f == null || f();
|
|
793
|
+
var v = function() {
|
|
794
|
+
ge(function() {
|
|
795
|
+
T && N(x(n.nodeFocusedBeforeActivation)), g == null || g();
|
|
796
|
+
});
|
|
797
|
+
};
|
|
798
|
+
return T && h ? (h(x(n.nodeFocusedBeforeActivation)).then(v, v), this) : (v(), this);
|
|
799
|
+
},
|
|
800
|
+
pause: function(o) {
|
|
801
|
+
return n.active ? (n.manuallyPaused = !0, this._setPausedState(!0, o)) : this;
|
|
802
|
+
},
|
|
803
|
+
unpause: function(o) {
|
|
804
|
+
return n.active ? (n.manuallyPaused = !1, u[u.length - 1] !== this ? this : this._setPausedState(!1, o)) : this;
|
|
805
|
+
},
|
|
806
|
+
updateContainerElements: function(o) {
|
|
807
|
+
var i = [].concat(o).filter(Boolean);
|
|
808
|
+
return n.containers = i.map(function(f) {
|
|
809
|
+
return typeof f == "string" ? a.querySelector(f) : f;
|
|
810
|
+
}), l.isolateSubtrees && s(n.containers), n.active && (R(), l.isolateSubtrees && !n.paused && p._setSubtreeIsolation(!0)), O(), this;
|
|
811
|
+
}
|
|
812
|
+
}, Object.defineProperties(p, {
|
|
813
|
+
_isManuallyPaused: {
|
|
814
|
+
value: function() {
|
|
815
|
+
return n.manuallyPaused;
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
_setPausedState: {
|
|
819
|
+
value: function(o, i) {
|
|
820
|
+
if (n.paused === o)
|
|
821
|
+
return this;
|
|
822
|
+
if (n.paused = o, o) {
|
|
823
|
+
var f = y(i, "onPause"), g = y(i, "onPostPause");
|
|
824
|
+
f == null || f(), m(), O(), p._setSubtreeIsolation(!1), g == null || g();
|
|
825
|
+
} else {
|
|
826
|
+
var h = y(i, "onUnpause"), T = y(i, "onPostUnpause");
|
|
827
|
+
h == null || h(), p._setSubtreeIsolation(!0), R(), d(), O(), T == null || T();
|
|
828
|
+
}
|
|
829
|
+
return this;
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
_setSubtreeIsolation: {
|
|
833
|
+
value: function(o) {
|
|
834
|
+
l.isolateSubtrees && n.adjacentElements.forEach(function(i) {
|
|
835
|
+
var f;
|
|
836
|
+
if (o)
|
|
837
|
+
switch (l.isolateSubtrees) {
|
|
838
|
+
case "aria-hidden":
|
|
839
|
+
(i.ariaHidden === "true" || ((f = i.getAttribute("aria-hidden")) === null || f === void 0 ? void 0 : f.toLowerCase()) === "true") && n.alreadySilent.add(i), i.setAttribute("aria-hidden", "true");
|
|
840
|
+
break;
|
|
841
|
+
default:
|
|
842
|
+
(i.inert || i.hasAttribute("inert")) && n.alreadySilent.add(i), i.setAttribute("inert", !0);
|
|
843
|
+
break;
|
|
844
|
+
}
|
|
845
|
+
else if (!n.alreadySilent.has(i)) switch (l.isolateSubtrees) {
|
|
846
|
+
case "aria-hidden":
|
|
847
|
+
i.removeAttribute("aria-hidden");
|
|
848
|
+
break;
|
|
849
|
+
default:
|
|
850
|
+
i.removeAttribute("inert");
|
|
851
|
+
break;
|
|
852
|
+
}
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}), p.updateContainerElements(e), p;
|
|
857
|
+
};
|
|
858
|
+
const vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
859
|
+
__proto__: null,
|
|
860
|
+
createFocusTrap: dt
|
|
861
|
+
}, Symbol.toStringTag, { value: "Module" })), pt = /* @__PURE__ */ we(vt), bt = /* @__PURE__ */ we(Qe);
|
|
862
|
+
var Te;
|
|
863
|
+
function ht() {
|
|
864
|
+
if (Te) return Q.exports;
|
|
865
|
+
Te = 1;
|
|
866
|
+
function r(d) {
|
|
867
|
+
"@babel/helpers - typeof";
|
|
868
|
+
return r = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
|
|
869
|
+
return typeof s;
|
|
870
|
+
} : function(s) {
|
|
871
|
+
return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
|
|
872
|
+
}, r(d);
|
|
873
|
+
}
|
|
874
|
+
var e, t;
|
|
875
|
+
function a(d, s) {
|
|
876
|
+
if (!(d instanceof s)) throw new TypeError("Cannot call a class as a function");
|
|
877
|
+
}
|
|
878
|
+
function u(d, s) {
|
|
879
|
+
for (var m = 0; m < s.length; m++) {
|
|
880
|
+
var c = s[m];
|
|
881
|
+
c.enumerable = c.enumerable || !1, c.configurable = !0, "value" in c && (c.writable = !0), Object.defineProperty(d, N(c.key), c);
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
function l(d, s, m) {
|
|
885
|
+
return s && u(d.prototype, s), Object.defineProperty(d, "prototype", { writable: !1 }), d;
|
|
886
|
+
}
|
|
887
|
+
function n(d, s, m) {
|
|
888
|
+
return s = S(s), p(d, k() ? Reflect.construct(s, m || [], S(d).constructor) : s.apply(d, m));
|
|
889
|
+
}
|
|
890
|
+
function p(d, s) {
|
|
891
|
+
if (s && (r(s) == "object" || typeof s == "function")) return s;
|
|
892
|
+
if (s !== void 0) throw new TypeError("Derived constructors may only return object or undefined");
|
|
893
|
+
return y(d);
|
|
894
|
+
}
|
|
895
|
+
function y(d) {
|
|
896
|
+
if (d === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
897
|
+
return d;
|
|
898
|
+
}
|
|
899
|
+
function k() {
|
|
900
|
+
try {
|
|
901
|
+
var d = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
902
|
+
}));
|
|
903
|
+
} catch {
|
|
904
|
+
}
|
|
905
|
+
return (k = function() {
|
|
906
|
+
return !!d;
|
|
907
|
+
})();
|
|
908
|
+
}
|
|
909
|
+
function S(d) {
|
|
910
|
+
return S = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(s) {
|
|
911
|
+
return s.__proto__ || Object.getPrototypeOf(s);
|
|
912
|
+
}, S(d);
|
|
913
|
+
}
|
|
914
|
+
function D(d, s) {
|
|
915
|
+
if (typeof s != "function" && s !== null) throw new TypeError("Super expression must either be null or a function");
|
|
916
|
+
d.prototype = Object.create(s && s.prototype, { constructor: { value: d, writable: !0, configurable: !0 } }), Object.defineProperty(d, "prototype", { writable: !1 }), s && R(d, s);
|
|
917
|
+
}
|
|
918
|
+
function R(d, s) {
|
|
919
|
+
return R = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, c) {
|
|
920
|
+
return m.__proto__ = c, m;
|
|
921
|
+
}, R(d, s);
|
|
922
|
+
}
|
|
923
|
+
function j(d, s, m) {
|
|
924
|
+
return (s = N(s)) in d ? Object.defineProperty(d, s, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : d[s] = m, d;
|
|
925
|
+
}
|
|
926
|
+
function N(d) {
|
|
927
|
+
var s = x(d, "string");
|
|
928
|
+
return r(s) == "symbol" ? s : s + "";
|
|
929
|
+
}
|
|
930
|
+
function x(d, s) {
|
|
931
|
+
if (r(d) != "object" || !d) return d;
|
|
932
|
+
var m = d[Symbol.toPrimitive];
|
|
933
|
+
if (m !== void 0) {
|
|
934
|
+
var c = m.call(d, s);
|
|
935
|
+
if (r(c) != "object") return c;
|
|
936
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
937
|
+
}
|
|
938
|
+
return (s === "string" ? String : Number)(d);
|
|
939
|
+
}
|
|
940
|
+
var I = Ie, _ = pt, V = _.createFocusTrap, z = bt, $ = z.isFocusable, Y = parseInt((e = (t = /^(\d+)\./.exec(I.version)) === null || t === void 0 ? void 0 : t[1]) !== null && e !== void 0 ? e : 0, 10), M = /* @__PURE__ */ (function(d) {
|
|
941
|
+
function s(m) {
|
|
942
|
+
var c;
|
|
943
|
+
a(this, s), c = n(this, s, [m]), j(c, "getNodeForOption", function(b) {
|
|
944
|
+
var o, i = (o = this.internalOptions[b]) !== null && o !== void 0 ? o : this.originalOptions[b];
|
|
945
|
+
if (typeof i == "function") {
|
|
946
|
+
for (var f = arguments.length, g = new Array(f > 1 ? f - 1 : 0), h = 1; h < f; h++)
|
|
947
|
+
g[h - 1] = arguments[h];
|
|
948
|
+
i = i.apply(void 0, g);
|
|
949
|
+
}
|
|
950
|
+
if (i === !0 && (i = void 0), !i) {
|
|
951
|
+
if (i === void 0 || i === !1)
|
|
952
|
+
return i;
|
|
953
|
+
throw new Error("`".concat(b, "` was specified but was not a node, or did not return a node"));
|
|
954
|
+
}
|
|
955
|
+
var T = i;
|
|
956
|
+
if (typeof i == "string") {
|
|
957
|
+
var v;
|
|
958
|
+
if (T = (v = this.getDocument()) === null || v === void 0 ? void 0 : v.querySelector(i), !T)
|
|
959
|
+
throw new Error("`".concat(b, "` as selector refers to no known node"));
|
|
960
|
+
}
|
|
961
|
+
return T;
|
|
962
|
+
}), c.handleDeactivate = c.handleDeactivate.bind(c), c.handlePostDeactivate = c.handlePostDeactivate.bind(c), c.handleClickOutsideDeactivates = c.handleClickOutsideDeactivates.bind(c), c.internalOptions = {
|
|
963
|
+
// We need to hijack the returnFocusOnDeactivate option,
|
|
964
|
+
// because React can move focus into the element before we arrived at
|
|
965
|
+
// this lifecycle hook (e.g. with autoFocus inputs). So the component
|
|
966
|
+
// captures the previouslyFocusedElement in componentWillMount,
|
|
967
|
+
// then (optionally) returns focus to it in componentWillUnmount.
|
|
968
|
+
returnFocusOnDeactivate: !1,
|
|
969
|
+
// the rest of these are also related to deactivation of the trap, and we
|
|
970
|
+
// need to use them and control them as well
|
|
971
|
+
checkCanReturnFocus: null,
|
|
972
|
+
onDeactivate: c.handleDeactivate,
|
|
973
|
+
onPostDeactivate: c.handlePostDeactivate,
|
|
974
|
+
// we need to special-case this setting as well so that we can know if we should
|
|
975
|
+
// NOT return focus if the trap gets auto-deactivated as the result of an
|
|
976
|
+
// outside click (otherwise, we'll always think we should return focus because
|
|
977
|
+
// of how we manage that flag internally here)
|
|
978
|
+
clickOutsideDeactivates: c.handleClickOutsideDeactivates
|
|
979
|
+
}, c.originalOptions = {
|
|
980
|
+
// because of the above `internalOptions`, we maintain our own flag for
|
|
981
|
+
// this option, and default it to `true` because that's focus-trap's default
|
|
982
|
+
returnFocusOnDeactivate: !0,
|
|
983
|
+
// because of the above `internalOptions`, we keep these separate since
|
|
984
|
+
// they're part of the deactivation process which we configure (internally) to
|
|
985
|
+
// be shared between focus-trap and focus-trap-react
|
|
986
|
+
onDeactivate: null,
|
|
987
|
+
onPostDeactivate: null,
|
|
988
|
+
checkCanReturnFocus: null,
|
|
989
|
+
// the user's setting, defaulted to false since focus-trap defaults this to false
|
|
990
|
+
clickOutsideDeactivates: !1
|
|
991
|
+
};
|
|
992
|
+
var w = m.focusTrapOptions;
|
|
993
|
+
for (var O in w)
|
|
994
|
+
if (Object.prototype.hasOwnProperty.call(w, O)) {
|
|
995
|
+
if (O === "returnFocusOnDeactivate" || O === "onDeactivate" || O === "onPostDeactivate" || O === "checkCanReturnFocus" || O === "clickOutsideDeactivates") {
|
|
996
|
+
c.originalOptions[O] = w[O];
|
|
997
|
+
continue;
|
|
998
|
+
}
|
|
999
|
+
c.internalOptions[O] = w[O];
|
|
1000
|
+
}
|
|
1001
|
+
return c.outsideClick = null, c.focusTrapElements = m.containerElements || [], c.updatePreviousElement(), c;
|
|
1002
|
+
}
|
|
1003
|
+
return D(s, d), l(s, [{
|
|
1004
|
+
key: "getDocument",
|
|
1005
|
+
value: function() {
|
|
1006
|
+
return this.props.focusTrapOptions.document || (typeof document < "u" ? document : void 0);
|
|
1007
|
+
}
|
|
1008
|
+
}, {
|
|
1009
|
+
key: "getReturnFocusNode",
|
|
1010
|
+
value: function() {
|
|
1011
|
+
var c = this.getNodeForOption("setReturnFocus", this.previouslyFocusedElement);
|
|
1012
|
+
return c || (c === !1 ? !1 : this.previouslyFocusedElement);
|
|
1013
|
+
}
|
|
1014
|
+
/** Update the previously focused element with the currently focused element. */
|
|
1015
|
+
}, {
|
|
1016
|
+
key: "updatePreviousElement",
|
|
1017
|
+
value: function() {
|
|
1018
|
+
var c = this.getDocument();
|
|
1019
|
+
c && (this.previouslyFocusedElement = c.activeElement);
|
|
1020
|
+
}
|
|
1021
|
+
}, {
|
|
1022
|
+
key: "deactivateTrap",
|
|
1023
|
+
value: function() {
|
|
1024
|
+
!this.focusTrap || !this.focusTrap.active || this.focusTrap.deactivate({
|
|
1025
|
+
// NOTE: we never let the trap return the focus since we do that ourselves
|
|
1026
|
+
returnFocus: !1,
|
|
1027
|
+
// we'll call this in our own post deactivate handler so make sure the trap doesn't
|
|
1028
|
+
// do it prematurely
|
|
1029
|
+
checkCanReturnFocus: null,
|
|
1030
|
+
// let it call the user's original deactivate handler, if any, instead of
|
|
1031
|
+
// our own which calls back into this function
|
|
1032
|
+
onDeactivate: this.originalOptions.onDeactivate
|
|
1033
|
+
// NOTE: for post deactivate, don't specify anything so that it calls the
|
|
1034
|
+
// onPostDeactivate handler specified on `this.internalOptions`
|
|
1035
|
+
// which will always be our own `handlePostDeactivate()` handler, which
|
|
1036
|
+
// will finish things off by calling the user's provided onPostDeactivate
|
|
1037
|
+
// handler, if any, at the right time
|
|
1038
|
+
// onPostDeactivate: NOTHING
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
}, {
|
|
1042
|
+
key: "handleClickOutsideDeactivates",
|
|
1043
|
+
value: function(c) {
|
|
1044
|
+
var w = typeof this.originalOptions.clickOutsideDeactivates == "function" ? this.originalOptions.clickOutsideDeactivates.call(null, c) : this.originalOptions.clickOutsideDeactivates;
|
|
1045
|
+
return w && (this.outsideClick = {
|
|
1046
|
+
target: c.target,
|
|
1047
|
+
allowDeactivation: w
|
|
1048
|
+
}), w;
|
|
1049
|
+
}
|
|
1050
|
+
}, {
|
|
1051
|
+
key: "handleDeactivate",
|
|
1052
|
+
value: function() {
|
|
1053
|
+
this.originalOptions.onDeactivate && this.originalOptions.onDeactivate.call(null), this.deactivateTrap();
|
|
1054
|
+
}
|
|
1055
|
+
}, {
|
|
1056
|
+
key: "handlePostDeactivate",
|
|
1057
|
+
value: function() {
|
|
1058
|
+
var c = this, w = function() {
|
|
1059
|
+
var b = c.getReturnFocusNode(), o = !!// did the consumer allow it?
|
|
1060
|
+
(c.originalOptions.returnFocusOnDeactivate && // can we actually focus the node?
|
|
1061
|
+
b !== null && b !== void 0 && b.focus && // was there an outside click that allowed deactivation?
|
|
1062
|
+
(!c.outsideClick || // did the consumer allow deactivation when the outside node was clicked?
|
|
1063
|
+
c.outsideClick.allowDeactivation && // is the outside node NOT focusable (implying that it did NOT receive focus
|
|
1064
|
+
// as a result of the click-through) -- in which case do NOT restore focus
|
|
1065
|
+
// to `returnFocusNode` because focus should remain on the outside node
|
|
1066
|
+
!$(c.outsideClick.target, c.internalOptions.tabbableOptions))), i = c.internalOptions.preventScroll, f = i === void 0 ? !1 : i;
|
|
1067
|
+
o && b.focus({
|
|
1068
|
+
preventScroll: f
|
|
1069
|
+
}), c.originalOptions.onPostDeactivate && c.originalOptions.onPostDeactivate.call(null), c.outsideClick = null;
|
|
1070
|
+
};
|
|
1071
|
+
this.originalOptions.checkCanReturnFocus ? this.originalOptions.checkCanReturnFocus.call(null, this.getReturnFocusNode()).then(w, w) : w();
|
|
1072
|
+
}
|
|
1073
|
+
}, {
|
|
1074
|
+
key: "setupFocusTrap",
|
|
1075
|
+
value: function() {
|
|
1076
|
+
if (this.focusTrap)
|
|
1077
|
+
this.props.active && !this.focusTrap.active && (this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
|
|
1078
|
+
else {
|
|
1079
|
+
var c = this.focusTrapElements.some(Boolean);
|
|
1080
|
+
c && (this.focusTrap = this.props._createFocusTrap(this.focusTrapElements, this.internalOptions), this.props.active && this.focusTrap.activate(), this.props.paused && this.focusTrap.pause());
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}, {
|
|
1084
|
+
key: "componentDidMount",
|
|
1085
|
+
value: function() {
|
|
1086
|
+
this.props.active && this.setupFocusTrap();
|
|
1087
|
+
}
|
|
1088
|
+
}, {
|
|
1089
|
+
key: "componentDidUpdate",
|
|
1090
|
+
value: function(c) {
|
|
1091
|
+
if (this.focusTrap) {
|
|
1092
|
+
c.containerElements !== this.props.containerElements && this.focusTrap.updateContainerElements(this.props.containerElements);
|
|
1093
|
+
var w = !c.active && this.props.active, O = c.active && !this.props.active, b = !c.paused && this.props.paused, o = c.paused && !this.props.paused;
|
|
1094
|
+
if (w && (this.updatePreviousElement(), this.focusTrap.activate()), O) {
|
|
1095
|
+
this.deactivateTrap();
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1098
|
+
b && this.focusTrap.pause(), o && this.focusTrap.unpause();
|
|
1099
|
+
} else
|
|
1100
|
+
c.containerElements !== this.props.containerElements && (this.focusTrapElements = this.props.containerElements), this.props.active && (this.updatePreviousElement(), this.setupFocusTrap());
|
|
1101
|
+
}
|
|
1102
|
+
}, {
|
|
1103
|
+
key: "componentWillUnmount",
|
|
1104
|
+
value: function() {
|
|
1105
|
+
this.deactivateTrap();
|
|
1106
|
+
}
|
|
1107
|
+
}, {
|
|
1108
|
+
key: "render",
|
|
1109
|
+
value: function() {
|
|
1110
|
+
var c = this, w = this.props.children ? I.Children.only(this.props.children) : void 0;
|
|
1111
|
+
if (w) {
|
|
1112
|
+
if (w.type && w.type === I.Fragment)
|
|
1113
|
+
throw new Error("A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.");
|
|
1114
|
+
var O = function(i) {
|
|
1115
|
+
var f = c.props.containerElements;
|
|
1116
|
+
w && (Y >= 19 ? typeof w.props.ref == "function" ? w.props.ref(i) : w.props.ref && (w.props.ref.current = i) : typeof w.ref == "function" ? w.ref(i) : w.ref && (w.ref.current = i)), c.focusTrapElements = f || [i];
|
|
1117
|
+
}, b = I.cloneElement(w, {
|
|
1118
|
+
ref: O
|
|
1119
|
+
});
|
|
1120
|
+
return b;
|
|
1121
|
+
}
|
|
1122
|
+
return null;
|
|
1123
|
+
}
|
|
1124
|
+
}]);
|
|
1125
|
+
})(I.Component);
|
|
1126
|
+
return M.defaultProps = {
|
|
1127
|
+
active: !0,
|
|
1128
|
+
paused: !1,
|
|
1129
|
+
focusTrapOptions: {},
|
|
1130
|
+
_createFocusTrap: V
|
|
1131
|
+
}, Q.exports = M, Q.exports.FocusTrap = M, Q.exports;
|
|
1132
|
+
}
|
|
1133
|
+
var yt = ht();
|
|
1134
|
+
const Ce = Ae({
|
|
1135
|
+
isVisible: !1
|
|
1136
|
+
}), {
|
|
1137
|
+
Provider: mt
|
|
1138
|
+
} = Ce;
|
|
1139
|
+
function gt() {
|
|
1140
|
+
return je(Ce);
|
|
1141
|
+
}
|
|
1142
|
+
function Tt() {
|
|
1143
|
+
const {
|
|
1144
|
+
close: r
|
|
1145
|
+
} = gt(), e = J(() => {
|
|
1146
|
+
r == null || r();
|
|
1147
|
+
}, [r]);
|
|
1148
|
+
return /* @__PURE__ */ C.jsxs(C.Fragment, { children: [
|
|
1149
|
+
/* @__PURE__ */ C.jsx("div", { className: "kakadu-components-2543813221" }),
|
|
1150
|
+
/* @__PURE__ */ C.jsx("div", { className: "kakadu-components-840864829", children: /* @__PURE__ */ C.jsx(Be, { icon: _e.times, label: "Close", className: "kakadu-components-3855719072", onClick: e }) })
|
|
1151
|
+
] });
|
|
1152
|
+
}
|
|
1153
|
+
function Nt({
|
|
1154
|
+
root: r,
|
|
1155
|
+
maxWidth: e,
|
|
1156
|
+
className: t,
|
|
1157
|
+
isVisible: a,
|
|
1158
|
+
isFullWidth: u = !1,
|
|
1159
|
+
shouldCloseOnOutsideClick: l = !0,
|
|
1160
|
+
shouldCloseOnEscapePress: n = !0,
|
|
1161
|
+
showCloseButton: p = !0,
|
|
1162
|
+
onClose: y,
|
|
1163
|
+
children: k
|
|
1164
|
+
}) {
|
|
1165
|
+
const S = te(null), D = te(null), [R, j] = re(!1), [N, x] = re(!1), I = J((s) => {
|
|
1166
|
+
S.current = s, x(!1);
|
|
1167
|
+
}, []), _ = te(null), V = J((s) => {
|
|
1168
|
+
s && (_.current = s);
|
|
1169
|
+
}, []), [z, $] = re(a ?? !1), Y = ne(() => ({
|
|
1170
|
+
isVisible: z,
|
|
1171
|
+
setInitialFocus: V,
|
|
1172
|
+
close: I
|
|
1173
|
+
}), [z, V, I]);
|
|
1174
|
+
H(() => {
|
|
1175
|
+
a && (j(!0), $(!0));
|
|
1176
|
+
}, [a]), H(() => {
|
|
1177
|
+
if (a) {
|
|
1178
|
+
const s = setTimeout(() => {
|
|
1179
|
+
x(!0);
|
|
1180
|
+
}, 100);
|
|
1181
|
+
return () => {
|
|
1182
|
+
clearTimeout(s);
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
x(!1);
|
|
1186
|
+
}, [a]), H(() => {
|
|
1187
|
+
if (R && !N) {
|
|
1188
|
+
const s = setTimeout(() => {
|
|
1189
|
+
y == null || y(S.current ?? void 0), $(!1);
|
|
1190
|
+
}, 370);
|
|
1191
|
+
return () => {
|
|
1192
|
+
clearTimeout(s);
|
|
1193
|
+
};
|
|
1194
|
+
}
|
|
1195
|
+
}, [R, N, y]), H(() => {
|
|
1196
|
+
const s = D.current;
|
|
1197
|
+
if (a && l && s) {
|
|
1198
|
+
const m = (c) => {
|
|
1199
|
+
s === c.target && x(!1);
|
|
1200
|
+
};
|
|
1201
|
+
return s.addEventListener("click", m), () => {
|
|
1202
|
+
s.removeEventListener("click", m);
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
}, [a, l]), H(() => {
|
|
1206
|
+
if (!a || !n)
|
|
1207
|
+
return;
|
|
1208
|
+
const s = (m) => {
|
|
1209
|
+
m.key === "Escape" && x(!1);
|
|
1210
|
+
};
|
|
1211
|
+
return window.addEventListener("keydown", s), () => {
|
|
1212
|
+
window.removeEventListener("keydown", s);
|
|
1213
|
+
};
|
|
1214
|
+
}, [a, n]);
|
|
1215
|
+
const M = ne(() => ({
|
|
1216
|
+
initialFocus: () => _.current ?? void 0,
|
|
1217
|
+
onActivate: () => {
|
|
1218
|
+
var s;
|
|
1219
|
+
return (s = _.current) == null ? void 0 : s.focus();
|
|
1220
|
+
}
|
|
1221
|
+
}), []), d = /* @__PURE__ */ C.jsx("div", { style: {
|
|
1222
|
+
"--max-width": e ? `${e}px` : void 0
|
|
1223
|
+
}, className: pe(r ? Le : void 0, "kakadu-components-2807459246", N && "kakadu-components-1399012551", t), children: /* @__PURE__ */ C.jsx(yt.FocusTrap, { active: N, focusTrapOptions: M, children: /* @__PURE__ */ C.jsx("div", { ref: D, className: "kakadu-components-3521538255", children: /* @__PURE__ */ C.jsx("div", { className: pe("kakadu-components-1982320206", u && "kakadu-components-3904045733", N && "kakadu-components-3829535111"), children: /* @__PURE__ */ C.jsxs(mt, { value: Y, children: [
|
|
1224
|
+
p ? /* @__PURE__ */ C.jsx(Tt, {}) : null,
|
|
1225
|
+
/* @__PURE__ */ C.jsx("div", { className: "kakadu-components-2617708556", children: k })
|
|
1226
|
+
] }) }) }) }) });
|
|
1227
|
+
return r ? xe(d, r) : d;
|
|
1228
|
+
}
|
|
1229
|
+
function Rt(r, e) {
|
|
1230
|
+
const [t, a] = re(!1), u = te(void 0), l = J(async () => (a(!0), new Promise((y) => {
|
|
1231
|
+
u.current = y;
|
|
1232
|
+
})), []), n = J((y) => {
|
|
1233
|
+
var k;
|
|
1234
|
+
a(!1), (k = u.current) == null || k.call(u, y), u.current = void 0;
|
|
1235
|
+
}, []), p = ne(() => /* @__PURE__ */ C.jsx(r, { ...e, isVisible: t, onClose: n }), [r, e, t, n]);
|
|
1236
|
+
return ne(() => ({
|
|
1237
|
+
isVisible: t,
|
|
1238
|
+
show: l,
|
|
1239
|
+
modal: p
|
|
1240
|
+
}), [t, l, p]);
|
|
1241
|
+
}
|
|
1242
|
+
export {
|
|
1243
|
+
Nt as default,
|
|
1244
|
+
Rt as useModal,
|
|
1245
|
+
gt as useModalContext
|
|
1246
|
+
};
|