@uva-glass/component-library 1.43.0 → 1.44.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/dist/{MultiSelect-DFMb82q4.js → MultiSelect-B9JaIPXs.js} +17 -12
- package/dist/{MultiSelect-DFMb82q4.js.map → MultiSelect-B9JaIPXs.js.map} +1 -1
- package/dist/assets/MenuLink.css +1 -1
- package/dist/assets/MenuLink2.css +1 -1
- package/dist/assets/Spinner.css +1 -1
- package/dist/components/Drawer/Drawer.js +39 -37
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.stories.js +18 -18
- package/dist/components/InputField/InputField.stories.js +24 -19
- package/dist/components/InputField/InputField.stories.js.map +1 -1
- package/dist/components/MenuButton/MenuButton.d.ts +2 -3
- package/dist/components/MenuButton/MenuButton.js +11 -605
- package/dist/components/MenuButton/MenuButton.js.map +1 -1
- package/dist/components/MenuLink/MenuLink.js +14 -4
- package/dist/components/MenuLink/MenuLink.js.map +1 -1
- package/dist/components/MenuLink/MenuLink.stories.js +5 -4
- package/dist/components/MenuLink/MenuLink.stories.js.map +1 -1
- package/dist/components/MenuLink/index.js +1 -1
- package/dist/components/ModalDialog/ModalDialog.js +62 -60
- package/dist/components/ModalDialog/ModalDialog.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +12 -12
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +7 -2
- package/dist/components/MultiSelect/components/MultiSelectHeader.js.map +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +28 -23
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js.map +1 -1
- package/dist/components/Spinner/Spinner.js +13 -12
- package/dist/components/Spinner/Spinner.js.map +1 -1
- package/dist/components/index.js +6 -6
- package/dist/index.js +6 -6
- package/package.json +10 -12
- package/dist/MenuLink-yPEEfABB.js +0 -859
- package/dist/MenuLink-yPEEfABB.js.map +0 -1
- package/dist/focusSafely-b94Glb9J.js +0 -402
- package/dist/focusSafely-b94Glb9J.js.map +0 -1
- package/dist/index-HuvfQN5H.js +0 -19071
- package/dist/index-HuvfQN5H.js.map +0 -1
- package/dist/useDialog-DZhIlo2a.js +0 -785
- package/dist/useDialog-DZhIlo2a.js.map +0 -1
|
@@ -1,785 +0,0 @@
|
|
|
1
|
-
import { $ as ie, a as z, b as h, c as ae, d as g, e as B, f as le, g as H, h as ue, i as ce, j as de } from "./focusSafely-b94Glb9J.js";
|
|
2
|
-
import E, { useRef as y, useCallback as X, useEffect as D, useContext as P, useMemo as O, useState as se } from "react";
|
|
3
|
-
import { $ as fe } from "./index-HuvfQN5H.js";
|
|
4
|
-
function G(e, t) {
|
|
5
|
-
let n = window.getComputedStyle(e), o = /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
|
|
6
|
-
return o && t && (o = e.scrollHeight !== e.clientHeight || e.scrollWidth !== e.clientWidth), o;
|
|
7
|
-
}
|
|
8
|
-
function te(e, t) {
|
|
9
|
-
let n = e;
|
|
10
|
-
for (G(n, t) && (n = n.parentElement); n && !G(n, t); ) n = n.parentElement;
|
|
11
|
-
return n || document.scrollingElement || document.documentElement;
|
|
12
|
-
}
|
|
13
|
-
function ve(e) {
|
|
14
|
-
let { isDisabled: t, onBlurWithin: n, onFocusWithin: o, onFocusWithinChange: r } = e, i = y({
|
|
15
|
-
isFocusWithin: !1
|
|
16
|
-
}), c = X((l) => {
|
|
17
|
-
i.current.isFocusWithin && !l.currentTarget.contains(l.relatedTarget) && (i.current.isFocusWithin = !1, n && n(l), r && r(!1));
|
|
18
|
-
}, [
|
|
19
|
-
n,
|
|
20
|
-
r,
|
|
21
|
-
i
|
|
22
|
-
]), a = ie(c), f = X((l) => {
|
|
23
|
-
!i.current.isFocusWithin && document.activeElement === l.target && (o && o(l), r && r(!0), i.current.isFocusWithin = !0, a(l));
|
|
24
|
-
}, [
|
|
25
|
-
o,
|
|
26
|
-
r,
|
|
27
|
-
a
|
|
28
|
-
]);
|
|
29
|
-
return t ? {
|
|
30
|
-
focusWithinProps: {
|
|
31
|
-
// These should not have been null, that would conflict in mergeProps
|
|
32
|
-
onFocus: void 0,
|
|
33
|
-
onBlur: void 0
|
|
34
|
-
}
|
|
35
|
-
} : {
|
|
36
|
-
focusWithinProps: {
|
|
37
|
-
onFocus: f,
|
|
38
|
-
onBlur: c
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
function be(e) {
|
|
43
|
-
let { ref: t, onInteractOutside: n, isDisabled: o, onInteractOutsideStart: r } = e, i = y({
|
|
44
|
-
isPointerDown: !1,
|
|
45
|
-
ignoreEmulatedMouseEvents: !1
|
|
46
|
-
}), c = z((f) => {
|
|
47
|
-
n && M(f, t) && (r && r(f), i.current.isPointerDown = !0);
|
|
48
|
-
}), a = z((f) => {
|
|
49
|
-
n && n(f);
|
|
50
|
-
});
|
|
51
|
-
D(() => {
|
|
52
|
-
let f = i.current;
|
|
53
|
-
if (o) return;
|
|
54
|
-
const l = t.current, u = h(l);
|
|
55
|
-
if (typeof PointerEvent < "u") {
|
|
56
|
-
let d = (b) => {
|
|
57
|
-
f.isPointerDown && M(b, t) && a(b), f.isPointerDown = !1;
|
|
58
|
-
};
|
|
59
|
-
return u.addEventListener("pointerdown", c, !0), u.addEventListener("pointerup", d, !0), () => {
|
|
60
|
-
u.removeEventListener("pointerdown", c, !0), u.removeEventListener("pointerup", d, !0);
|
|
61
|
-
};
|
|
62
|
-
} else {
|
|
63
|
-
let d = (v) => {
|
|
64
|
-
f.ignoreEmulatedMouseEvents ? f.ignoreEmulatedMouseEvents = !1 : f.isPointerDown && M(v, t) && a(v), f.isPointerDown = !1;
|
|
65
|
-
}, b = (v) => {
|
|
66
|
-
f.ignoreEmulatedMouseEvents = !0, f.isPointerDown && M(v, t) && a(v), f.isPointerDown = !1;
|
|
67
|
-
};
|
|
68
|
-
return u.addEventListener("mousedown", c, !0), u.addEventListener("mouseup", d, !0), u.addEventListener("touchstart", c, !0), u.addEventListener("touchend", b, !0), () => {
|
|
69
|
-
u.removeEventListener("mousedown", c, !0), u.removeEventListener("mouseup", d, !0), u.removeEventListener("touchstart", c, !0), u.removeEventListener("touchend", b, !0);
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}, [
|
|
73
|
-
t,
|
|
74
|
-
o,
|
|
75
|
-
c,
|
|
76
|
-
a
|
|
77
|
-
]);
|
|
78
|
-
}
|
|
79
|
-
function M(e, t) {
|
|
80
|
-
if (e.button > 0) return !1;
|
|
81
|
-
if (e.target) {
|
|
82
|
-
const n = e.target.ownerDocument;
|
|
83
|
-
if (!n || !n.documentElement.contains(e.target) || e.target.closest("[data-react-aria-top-layer]")) return !1;
|
|
84
|
-
}
|
|
85
|
-
return t.current && !t.current.contains(e.target);
|
|
86
|
-
}
|
|
87
|
-
function $e(e) {
|
|
88
|
-
const t = ae(e);
|
|
89
|
-
if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement)) return !1;
|
|
90
|
-
let { display: n, visibility: o } = e.style, r = n !== "none" && o !== "hidden" && o !== "collapse";
|
|
91
|
-
if (r) {
|
|
92
|
-
const { getComputedStyle: i } = e.ownerDocument.defaultView;
|
|
93
|
-
let { display: c, visibility: a } = i(e);
|
|
94
|
-
r = c !== "none" && a !== "hidden" && a !== "collapse";
|
|
95
|
-
}
|
|
96
|
-
return r;
|
|
97
|
-
}
|
|
98
|
-
function me(e, t) {
|
|
99
|
-
return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
|
|
100
|
-
!e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
|
|
101
|
-
}
|
|
102
|
-
function ne(e, t) {
|
|
103
|
-
return e.nodeName !== "#comment" && $e(e) && me(e, t) && (!e.parentElement || ne(e.parentElement, e));
|
|
104
|
-
}
|
|
105
|
-
const J = /* @__PURE__ */ E.createContext(null), V = "react-aria-focus-scope-restore";
|
|
106
|
-
let $ = null;
|
|
107
|
-
function Ae(e) {
|
|
108
|
-
let { children: t, contain: n, restoreFocus: o, autoFocus: r } = e, i = y(null), c = y(null), a = y([]), { parentNode: f } = P(J) || {}, l = O(() => new U({
|
|
109
|
-
scopeRef: a
|
|
110
|
-
}), [
|
|
111
|
-
a
|
|
112
|
-
]);
|
|
113
|
-
g(() => {
|
|
114
|
-
let b = f || m.root;
|
|
115
|
-
if (m.getTreeNode(b.scopeRef) && $ && !W($, b.scopeRef)) {
|
|
116
|
-
let v = m.getTreeNode($);
|
|
117
|
-
v && (b = v);
|
|
118
|
-
}
|
|
119
|
-
b.addChild(l), m.addNode(l);
|
|
120
|
-
}, [
|
|
121
|
-
l,
|
|
122
|
-
f
|
|
123
|
-
]), g(() => {
|
|
124
|
-
let b = m.getTreeNode(a);
|
|
125
|
-
b && (b.contain = !!n);
|
|
126
|
-
}, [
|
|
127
|
-
n
|
|
128
|
-
]), g(() => {
|
|
129
|
-
var b;
|
|
130
|
-
let v = (b = i.current) === null || b === void 0 ? void 0 : b.nextSibling, s = [], S = (A) => A.stopPropagation();
|
|
131
|
-
for (; v && v !== c.current; )
|
|
132
|
-
s.push(v), v.addEventListener(V, S), v = v.nextSibling;
|
|
133
|
-
return a.current = s, () => {
|
|
134
|
-
for (let A of s) A.removeEventListener(V, S);
|
|
135
|
-
};
|
|
136
|
-
}, [
|
|
137
|
-
t
|
|
138
|
-
]), ye(a, o, n), ge(a, n), xe(a, o, n), Te(a, r), D(() => {
|
|
139
|
-
const b = h(a.current ? a.current[0] : void 0).activeElement;
|
|
140
|
-
let v = null;
|
|
141
|
-
if (p(b, a.current)) {
|
|
142
|
-
for (let s of m.traverse()) s.scopeRef && p(b, s.scopeRef.current) && (v = s);
|
|
143
|
-
v === m.getTreeNode(a) && ($ = v.scopeRef);
|
|
144
|
-
}
|
|
145
|
-
}, [
|
|
146
|
-
a
|
|
147
|
-
]), g(() => () => {
|
|
148
|
-
var b, v, s;
|
|
149
|
-
let S = (s = (v = m.getTreeNode(a)) === null || v === void 0 || (b = v.parent) === null || b === void 0 ? void 0 : b.scopeRef) !== null && s !== void 0 ? s : null;
|
|
150
|
-
(a === $ || W(a, $)) && (!S || m.getTreeNode(S)) && ($ = S), m.removeTreeNode(a);
|
|
151
|
-
}, [
|
|
152
|
-
a
|
|
153
|
-
]);
|
|
154
|
-
let u = O(() => pe(a), []), d = O(() => ({
|
|
155
|
-
focusManager: u,
|
|
156
|
-
parentNode: l
|
|
157
|
-
}), [
|
|
158
|
-
l,
|
|
159
|
-
u
|
|
160
|
-
]);
|
|
161
|
-
return /* @__PURE__ */ E.createElement(J.Provider, {
|
|
162
|
-
value: d
|
|
163
|
-
}, /* @__PURE__ */ E.createElement("span", {
|
|
164
|
-
"data-focus-scope-start": !0,
|
|
165
|
-
hidden: !0,
|
|
166
|
-
ref: i
|
|
167
|
-
}), t, /* @__PURE__ */ E.createElement("span", {
|
|
168
|
-
"data-focus-scope-end": !0,
|
|
169
|
-
hidden: !0,
|
|
170
|
-
ref: c
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
function pe(e) {
|
|
174
|
-
return {
|
|
175
|
-
focusNext(t = {}) {
|
|
176
|
-
let n = e.current, { from: o, tabbable: r, wrap: i, accept: c } = t, a = o || h(n[0]).activeElement, f = n[0].previousElementSibling, l = x(n), u = N(l, {
|
|
177
|
-
tabbable: r,
|
|
178
|
-
accept: c
|
|
179
|
-
}, n);
|
|
180
|
-
u.currentNode = p(a, n) ? a : f;
|
|
181
|
-
let d = u.nextNode();
|
|
182
|
-
return !d && i && (u.currentNode = f, d = u.nextNode()), d && T(d, !0), d;
|
|
183
|
-
},
|
|
184
|
-
focusPrevious(t = {}) {
|
|
185
|
-
let n = e.current, { from: o, tabbable: r, wrap: i, accept: c } = t, a = o || h(n[0]).activeElement, f = n[n.length - 1].nextElementSibling, l = x(n), u = N(l, {
|
|
186
|
-
tabbable: r,
|
|
187
|
-
accept: c
|
|
188
|
-
}, n);
|
|
189
|
-
u.currentNode = p(a, n) ? a : f;
|
|
190
|
-
let d = u.previousNode();
|
|
191
|
-
return !d && i && (u.currentNode = f, d = u.previousNode()), d && T(d, !0), d;
|
|
192
|
-
},
|
|
193
|
-
focusFirst(t = {}) {
|
|
194
|
-
let n = e.current, { tabbable: o, accept: r } = t, i = x(n), c = N(i, {
|
|
195
|
-
tabbable: o,
|
|
196
|
-
accept: r
|
|
197
|
-
}, n);
|
|
198
|
-
c.currentNode = n[0].previousElementSibling;
|
|
199
|
-
let a = c.nextNode();
|
|
200
|
-
return a && T(a, !0), a;
|
|
201
|
-
},
|
|
202
|
-
focusLast(t = {}) {
|
|
203
|
-
let n = e.current, { tabbable: o, accept: r } = t, i = x(n), c = N(i, {
|
|
204
|
-
tabbable: o,
|
|
205
|
-
accept: r
|
|
206
|
-
}, n);
|
|
207
|
-
c.currentNode = n[n.length - 1].nextElementSibling;
|
|
208
|
-
let a = c.previousNode();
|
|
209
|
-
return a && T(a, !0), a;
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
const Y = [
|
|
214
|
-
"input:not([disabled]):not([type=hidden])",
|
|
215
|
-
"select:not([disabled])",
|
|
216
|
-
"textarea:not([disabled])",
|
|
217
|
-
"button:not([disabled])",
|
|
218
|
-
"a[href]",
|
|
219
|
-
"area[href]",
|
|
220
|
-
"summary",
|
|
221
|
-
"iframe",
|
|
222
|
-
"object",
|
|
223
|
-
"embed",
|
|
224
|
-
"audio[controls]",
|
|
225
|
-
"video[controls]",
|
|
226
|
-
"[contenteditable]"
|
|
227
|
-
], Ee = Y.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
|
228
|
-
Y.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
|
229
|
-
const he = Y.join(':not([hidden]):not([tabindex="-1"]),');
|
|
230
|
-
function x(e) {
|
|
231
|
-
return e[0].parentElement;
|
|
232
|
-
}
|
|
233
|
-
function F(e) {
|
|
234
|
-
let t = m.getTreeNode($);
|
|
235
|
-
for (; t && t.scopeRef !== e; ) {
|
|
236
|
-
if (t.contain) return !1;
|
|
237
|
-
t = t.parent;
|
|
238
|
-
}
|
|
239
|
-
return !0;
|
|
240
|
-
}
|
|
241
|
-
function ge(e, t) {
|
|
242
|
-
let n = y(void 0), o = y(void 0);
|
|
243
|
-
g(() => {
|
|
244
|
-
let r = e.current;
|
|
245
|
-
if (!t) {
|
|
246
|
-
o.current && (cancelAnimationFrame(o.current), o.current = void 0);
|
|
247
|
-
return;
|
|
248
|
-
}
|
|
249
|
-
const i = h(r ? r[0] : void 0);
|
|
250
|
-
let c = (l) => {
|
|
251
|
-
if (l.key !== "Tab" || l.altKey || l.ctrlKey || l.metaKey || !F(e) || l.isComposing) return;
|
|
252
|
-
let u = i.activeElement, d = e.current;
|
|
253
|
-
if (!d || !p(u, d)) return;
|
|
254
|
-
let b = x(d), v = N(b, {
|
|
255
|
-
tabbable: !0
|
|
256
|
-
}, d);
|
|
257
|
-
if (!u) return;
|
|
258
|
-
v.currentNode = u;
|
|
259
|
-
let s = l.shiftKey ? v.previousNode() : v.nextNode();
|
|
260
|
-
s || (v.currentNode = l.shiftKey ? d[d.length - 1].nextElementSibling : d[0].previousElementSibling, s = l.shiftKey ? v.previousNode() : v.nextNode()), l.preventDefault(), s && T(s, !0);
|
|
261
|
-
}, a = (l) => {
|
|
262
|
-
(!$ || W($, e)) && p(l.target, e.current) ? ($ = e, n.current = l.target) : F(e) && !_(l.target, e) ? n.current ? n.current.focus() : $ && $.current && j($.current) : F(e) && (n.current = l.target);
|
|
263
|
-
}, f = (l) => {
|
|
264
|
-
o.current && cancelAnimationFrame(o.current), o.current = requestAnimationFrame(() => {
|
|
265
|
-
if (i.activeElement && F(e) && !_(i.activeElement, e))
|
|
266
|
-
if ($ = e, i.body.contains(l.target)) {
|
|
267
|
-
var u;
|
|
268
|
-
n.current = l.target, (u = n.current) === null || u === void 0 || u.focus();
|
|
269
|
-
} else $.current && j($.current);
|
|
270
|
-
});
|
|
271
|
-
};
|
|
272
|
-
return i.addEventListener("keydown", c, !1), i.addEventListener("focusin", a, !1), r == null || r.forEach((l) => l.addEventListener("focusin", a, !1)), r == null || r.forEach((l) => l.addEventListener("focusout", f, !1)), () => {
|
|
273
|
-
i.removeEventListener("keydown", c, !1), i.removeEventListener("focusin", a, !1), r == null || r.forEach((l) => l.removeEventListener("focusin", a, !1)), r == null || r.forEach((l) => l.removeEventListener("focusout", f, !1));
|
|
274
|
-
};
|
|
275
|
-
}, [
|
|
276
|
-
e,
|
|
277
|
-
t
|
|
278
|
-
]), g(() => () => {
|
|
279
|
-
o.current && cancelAnimationFrame(o.current);
|
|
280
|
-
}, [
|
|
281
|
-
o
|
|
282
|
-
]);
|
|
283
|
-
}
|
|
284
|
-
function re(e) {
|
|
285
|
-
return _(e);
|
|
286
|
-
}
|
|
287
|
-
function p(e, t) {
|
|
288
|
-
return !e || !t ? !1 : t.some((n) => n.contains(e));
|
|
289
|
-
}
|
|
290
|
-
function _(e, t = null) {
|
|
291
|
-
if (e instanceof Element && e.closest("[data-react-aria-top-layer]")) return !0;
|
|
292
|
-
for (let { scopeRef: n } of m.traverse(m.getTreeNode(t)))
|
|
293
|
-
if (n && p(e, n.current)) return !0;
|
|
294
|
-
return !1;
|
|
295
|
-
}
|
|
296
|
-
function we(e) {
|
|
297
|
-
return _(e, $);
|
|
298
|
-
}
|
|
299
|
-
function W(e, t) {
|
|
300
|
-
var n;
|
|
301
|
-
let o = (n = m.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
|
|
302
|
-
for (; o; ) {
|
|
303
|
-
if (o.scopeRef === e) return !0;
|
|
304
|
-
o = o.parent;
|
|
305
|
-
}
|
|
306
|
-
return !1;
|
|
307
|
-
}
|
|
308
|
-
function T(e, t = !1) {
|
|
309
|
-
if (e != null && !t) try {
|
|
310
|
-
B(e);
|
|
311
|
-
} catch {
|
|
312
|
-
}
|
|
313
|
-
else if (e != null) try {
|
|
314
|
-
e.focus();
|
|
315
|
-
} catch {
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
function oe(e, t = !0) {
|
|
319
|
-
let n = e[0].previousElementSibling, o = x(e), r = N(o, {
|
|
320
|
-
tabbable: t
|
|
321
|
-
}, e);
|
|
322
|
-
r.currentNode = n;
|
|
323
|
-
let i = r.nextNode();
|
|
324
|
-
return t && !i && (o = x(e), r = N(o, {
|
|
325
|
-
tabbable: !1
|
|
326
|
-
}, e), r.currentNode = n, i = r.nextNode()), i;
|
|
327
|
-
}
|
|
328
|
-
function j(e, t = !0) {
|
|
329
|
-
T(oe(e, t));
|
|
330
|
-
}
|
|
331
|
-
function Te(e, t) {
|
|
332
|
-
const n = E.useRef(t);
|
|
333
|
-
D(() => {
|
|
334
|
-
if (n.current) {
|
|
335
|
-
$ = e;
|
|
336
|
-
const o = h(e.current ? e.current[0] : void 0);
|
|
337
|
-
!p(o.activeElement, $.current) && e.current && j(e.current);
|
|
338
|
-
}
|
|
339
|
-
n.current = !1;
|
|
340
|
-
}, [
|
|
341
|
-
e
|
|
342
|
-
]);
|
|
343
|
-
}
|
|
344
|
-
function ye(e, t, n) {
|
|
345
|
-
g(() => {
|
|
346
|
-
if (t || n) return;
|
|
347
|
-
let o = e.current;
|
|
348
|
-
const r = h(o ? o[0] : void 0);
|
|
349
|
-
let i = (c) => {
|
|
350
|
-
let a = c.target;
|
|
351
|
-
p(a, e.current) ? $ = e : re(a) || ($ = null);
|
|
352
|
-
};
|
|
353
|
-
return r.addEventListener("focusin", i, !1), o == null || o.forEach((c) => c.addEventListener("focusin", i, !1)), () => {
|
|
354
|
-
r.removeEventListener("focusin", i, !1), o == null || o.forEach((c) => c.removeEventListener("focusin", i, !1));
|
|
355
|
-
};
|
|
356
|
-
}, [
|
|
357
|
-
e,
|
|
358
|
-
t,
|
|
359
|
-
n
|
|
360
|
-
]);
|
|
361
|
-
}
|
|
362
|
-
function Ne(e) {
|
|
363
|
-
let t = m.getTreeNode($);
|
|
364
|
-
for (; t && t.scopeRef !== e; ) {
|
|
365
|
-
if (t.nodeToRestore) return !1;
|
|
366
|
-
t = t.parent;
|
|
367
|
-
}
|
|
368
|
-
return (t == null ? void 0 : t.scopeRef) === e;
|
|
369
|
-
}
|
|
370
|
-
function xe(e, t, n) {
|
|
371
|
-
const o = y(typeof document < "u" ? h(e.current ? e.current[0] : void 0).activeElement : null);
|
|
372
|
-
g(() => {
|
|
373
|
-
let r = e.current;
|
|
374
|
-
const i = h(r ? r[0] : void 0);
|
|
375
|
-
if (!t || n) return;
|
|
376
|
-
let c = () => {
|
|
377
|
-
(!$ || W($, e)) && p(i.activeElement, e.current) && ($ = e);
|
|
378
|
-
};
|
|
379
|
-
return i.addEventListener("focusin", c, !1), r == null || r.forEach((a) => a.addEventListener("focusin", c, !1)), () => {
|
|
380
|
-
i.removeEventListener("focusin", c, !1), r == null || r.forEach((a) => a.removeEventListener("focusin", c, !1));
|
|
381
|
-
};
|
|
382
|
-
}, [
|
|
383
|
-
e,
|
|
384
|
-
n
|
|
385
|
-
]), g(() => {
|
|
386
|
-
const r = h(e.current ? e.current[0] : void 0);
|
|
387
|
-
if (!t) return;
|
|
388
|
-
let i = (c) => {
|
|
389
|
-
if (c.key !== "Tab" || c.altKey || c.ctrlKey || c.metaKey || !F(e) || c.isComposing) return;
|
|
390
|
-
let a = r.activeElement;
|
|
391
|
-
if (!p(a, e.current)) return;
|
|
392
|
-
let f = m.getTreeNode(e);
|
|
393
|
-
if (!f) return;
|
|
394
|
-
let l = f.nodeToRestore, u = N(r.body, {
|
|
395
|
-
tabbable: !0
|
|
396
|
-
});
|
|
397
|
-
u.currentNode = a;
|
|
398
|
-
let d = c.shiftKey ? u.previousNode() : u.nextNode();
|
|
399
|
-
if ((!l || !r.body.contains(l) || l === r.body) && (l = void 0, f.nodeToRestore = void 0), (!d || !p(d, e.current)) && l) {
|
|
400
|
-
u.currentNode = l;
|
|
401
|
-
do
|
|
402
|
-
d = c.shiftKey ? u.previousNode() : u.nextNode();
|
|
403
|
-
while (p(d, e.current));
|
|
404
|
-
c.preventDefault(), c.stopPropagation(), d ? T(d, !0) : re(l) ? T(l, !0) : a.blur();
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
return n || r.addEventListener("keydown", i, !0), () => {
|
|
408
|
-
n || r.removeEventListener("keydown", i, !0);
|
|
409
|
-
};
|
|
410
|
-
}, [
|
|
411
|
-
e,
|
|
412
|
-
t,
|
|
413
|
-
n
|
|
414
|
-
]), g(() => {
|
|
415
|
-
const r = h(e.current ? e.current[0] : void 0);
|
|
416
|
-
if (!t) return;
|
|
417
|
-
let i = m.getTreeNode(e);
|
|
418
|
-
if (i) {
|
|
419
|
-
var c;
|
|
420
|
-
return i.nodeToRestore = (c = o.current) !== null && c !== void 0 ? c : void 0, () => {
|
|
421
|
-
let a = m.getTreeNode(e);
|
|
422
|
-
if (!a) return;
|
|
423
|
-
let f = a.nodeToRestore;
|
|
424
|
-
if (t && f && // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
425
|
-
(p(r.activeElement, e.current) || r.activeElement === r.body && Ne(e))) {
|
|
426
|
-
let l = m.clone();
|
|
427
|
-
requestAnimationFrame(() => {
|
|
428
|
-
if (r.activeElement === r.body) {
|
|
429
|
-
let u = l.getTreeNode(e);
|
|
430
|
-
for (; u; ) {
|
|
431
|
-
if (u.nodeToRestore && u.nodeToRestore.isConnected) {
|
|
432
|
-
Q(u.nodeToRestore);
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
u = u.parent;
|
|
436
|
-
}
|
|
437
|
-
for (u = l.getTreeNode(e); u; ) {
|
|
438
|
-
if (u.scopeRef && u.scopeRef.current && m.getTreeNode(u.scopeRef)) {
|
|
439
|
-
let d = oe(u.scopeRef.current, !0);
|
|
440
|
-
Q(d);
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
u = u.parent;
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
}, [
|
|
451
|
-
e,
|
|
452
|
-
t
|
|
453
|
-
]);
|
|
454
|
-
}
|
|
455
|
-
function Q(e) {
|
|
456
|
-
e.dispatchEvent(new CustomEvent(V, {
|
|
457
|
-
bubbles: !0,
|
|
458
|
-
cancelable: !0
|
|
459
|
-
})) && T(e);
|
|
460
|
-
}
|
|
461
|
-
function N(e, t, n) {
|
|
462
|
-
let o = t != null && t.tabbable ? he : Ee, r = h(e).createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
463
|
-
acceptNode(i) {
|
|
464
|
-
var c;
|
|
465
|
-
return !(t == null || (c = t.from) === null || c === void 0) && c.contains(i) ? NodeFilter.FILTER_REJECT : i.matches(o) && ne(i) && (!n || p(i, n)) && (!(t != null && t.accept) || t.accept(i)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
return t != null && t.from && (r.currentNode = t.from), r;
|
|
469
|
-
}
|
|
470
|
-
class q {
|
|
471
|
-
get size() {
|
|
472
|
-
return this.fastMap.size;
|
|
473
|
-
}
|
|
474
|
-
getTreeNode(t) {
|
|
475
|
-
return this.fastMap.get(t);
|
|
476
|
-
}
|
|
477
|
-
addTreeNode(t, n, o) {
|
|
478
|
-
let r = this.fastMap.get(n ?? null);
|
|
479
|
-
if (!r) return;
|
|
480
|
-
let i = new U({
|
|
481
|
-
scopeRef: t
|
|
482
|
-
});
|
|
483
|
-
r.addChild(i), i.parent = r, this.fastMap.set(t, i), o && (i.nodeToRestore = o);
|
|
484
|
-
}
|
|
485
|
-
addNode(t) {
|
|
486
|
-
this.fastMap.set(t.scopeRef, t);
|
|
487
|
-
}
|
|
488
|
-
removeTreeNode(t) {
|
|
489
|
-
if (t === null) return;
|
|
490
|
-
let n = this.fastMap.get(t);
|
|
491
|
-
if (!n) return;
|
|
492
|
-
let o = n.parent;
|
|
493
|
-
for (let i of this.traverse()) i !== n && n.nodeToRestore && i.nodeToRestore && n.scopeRef && n.scopeRef.current && p(i.nodeToRestore, n.scopeRef.current) && (i.nodeToRestore = n.nodeToRestore);
|
|
494
|
-
let r = n.children;
|
|
495
|
-
o && (o.removeChild(n), r.size > 0 && r.forEach((i) => o && o.addChild(i))), this.fastMap.delete(n.scopeRef);
|
|
496
|
-
}
|
|
497
|
-
// Pre Order Depth First
|
|
498
|
-
*traverse(t = this.root) {
|
|
499
|
-
if (t.scopeRef != null && (yield t), t.children.size > 0) for (let n of t.children) yield* this.traverse(n);
|
|
500
|
-
}
|
|
501
|
-
clone() {
|
|
502
|
-
var t;
|
|
503
|
-
let n = new q();
|
|
504
|
-
var o;
|
|
505
|
-
for (let r of this.traverse()) n.addTreeNode(r.scopeRef, (o = (t = r.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && o !== void 0 ? o : null, r.nodeToRestore);
|
|
506
|
-
return n;
|
|
507
|
-
}
|
|
508
|
-
constructor() {
|
|
509
|
-
this.fastMap = /* @__PURE__ */ new Map(), this.root = new U({
|
|
510
|
-
scopeRef: null
|
|
511
|
-
}), this.fastMap.set(null, this.root);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
class U {
|
|
515
|
-
addChild(t) {
|
|
516
|
-
this.children.add(t), t.parent = this;
|
|
517
|
-
}
|
|
518
|
-
removeChild(t) {
|
|
519
|
-
this.children.delete(t), t.parent = void 0;
|
|
520
|
-
}
|
|
521
|
-
constructor(t) {
|
|
522
|
-
this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
let m = new q();
|
|
526
|
-
const w = [];
|
|
527
|
-
function Ke(e, t) {
|
|
528
|
-
let { onClose: n, shouldCloseOnBlur: o, isOpen: r, isDismissable: i = !1, isKeyboardDismissDisabled: c = !1, shouldCloseOnInteractOutside: a } = e;
|
|
529
|
-
D(() => (r && w.push(t), () => {
|
|
530
|
-
let s = w.indexOf(t);
|
|
531
|
-
s >= 0 && w.splice(s, 1);
|
|
532
|
-
}), [
|
|
533
|
-
r,
|
|
534
|
-
t
|
|
535
|
-
]);
|
|
536
|
-
let f = () => {
|
|
537
|
-
w[w.length - 1] === t && n && n();
|
|
538
|
-
}, l = (s) => {
|
|
539
|
-
(!a || a(s.target)) && w[w.length - 1] === t && (s.stopPropagation(), s.preventDefault());
|
|
540
|
-
}, u = (s) => {
|
|
541
|
-
(!a || a(s.target)) && (w[w.length - 1] === t && (s.stopPropagation(), s.preventDefault()), f());
|
|
542
|
-
}, d = (s) => {
|
|
543
|
-
s.key === "Escape" && !c && !s.nativeEvent.isComposing && (s.stopPropagation(), s.preventDefault(), f());
|
|
544
|
-
};
|
|
545
|
-
be({
|
|
546
|
-
ref: t,
|
|
547
|
-
onInteractOutside: i && r ? u : null,
|
|
548
|
-
onInteractOutsideStart: l
|
|
549
|
-
});
|
|
550
|
-
let { focusWithinProps: b } = ve({
|
|
551
|
-
isDisabled: !o,
|
|
552
|
-
onBlurWithin: (s) => {
|
|
553
|
-
!s.relatedTarget || we(s.relatedTarget) || (!a || a(s.relatedTarget)) && n();
|
|
554
|
-
}
|
|
555
|
-
}), v = (s) => {
|
|
556
|
-
s.target === s.currentTarget && s.preventDefault();
|
|
557
|
-
};
|
|
558
|
-
return {
|
|
559
|
-
overlayProps: {
|
|
560
|
-
onKeyDown: d,
|
|
561
|
-
...b
|
|
562
|
-
},
|
|
563
|
-
underlayProps: {
|
|
564
|
-
onPointerDown: v
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
}
|
|
568
|
-
const K = typeof document < "u" && window.visualViewport, Se = /* @__PURE__ */ new Set([
|
|
569
|
-
"checkbox",
|
|
570
|
-
"radio",
|
|
571
|
-
"range",
|
|
572
|
-
"color",
|
|
573
|
-
"file",
|
|
574
|
-
"image",
|
|
575
|
-
"button",
|
|
576
|
-
"submit",
|
|
577
|
-
"reset"
|
|
578
|
-
]);
|
|
579
|
-
let R = 0, k;
|
|
580
|
-
function ke(e = {}) {
|
|
581
|
-
let { isDisabled: t } = e;
|
|
582
|
-
g(() => {
|
|
583
|
-
if (!t)
|
|
584
|
-
return R++, R === 1 && (le() ? k = De() : k = Ce()), () => {
|
|
585
|
-
R--, R === 0 && k();
|
|
586
|
-
};
|
|
587
|
-
}, [
|
|
588
|
-
t
|
|
589
|
-
]);
|
|
590
|
-
}
|
|
591
|
-
function Ce() {
|
|
592
|
-
return H(C(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), C(document.documentElement, "overflow", "hidden"));
|
|
593
|
-
}
|
|
594
|
-
function De() {
|
|
595
|
-
let e, t, n = (l) => {
|
|
596
|
-
e = te(l.target, !0), !(e === document.documentElement && e === document.body) && e instanceof HTMLElement && window.getComputedStyle(e).overscrollBehavior === "auto" && (t = C(e, "overscrollBehavior", "contain"));
|
|
597
|
-
}, o = (l) => {
|
|
598
|
-
if (!e || e === document.documentElement || e === document.body) {
|
|
599
|
-
l.preventDefault();
|
|
600
|
-
return;
|
|
601
|
-
}
|
|
602
|
-
e.scrollHeight === e.clientHeight && e.scrollWidth === e.clientWidth && l.preventDefault();
|
|
603
|
-
}, r = (l) => {
|
|
604
|
-
let u = l.target;
|
|
605
|
-
ee(u) && u !== document.activeElement && (l.preventDefault(), a(), u.style.transform = "translateY(-2000px)", u.focus(), requestAnimationFrame(() => {
|
|
606
|
-
u.style.transform = "";
|
|
607
|
-
})), t && t();
|
|
608
|
-
}, i = (l) => {
|
|
609
|
-
let u = l.target;
|
|
610
|
-
ee(u) && (a(), u.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
611
|
-
u.style.transform = "", K && (K.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
612
|
-
Z(u);
|
|
613
|
-
}) : K.addEventListener("resize", () => Z(u), {
|
|
614
|
-
once: !0
|
|
615
|
-
}));
|
|
616
|
-
}));
|
|
617
|
-
}, c = null, a = () => {
|
|
618
|
-
if (c) return;
|
|
619
|
-
let l = () => {
|
|
620
|
-
window.scrollTo(0, 0);
|
|
621
|
-
}, u = window.pageXOffset, d = window.pageYOffset;
|
|
622
|
-
c = H(L(window, "scroll", l), C(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), C(document.documentElement, "overflow", "hidden"), C(document.body, "marginTop", `-${d}px`), () => {
|
|
623
|
-
window.scrollTo(u, d);
|
|
624
|
-
}), window.scrollTo(0, 0);
|
|
625
|
-
}, f = H(L(document, "touchstart", n, {
|
|
626
|
-
passive: !1,
|
|
627
|
-
capture: !0
|
|
628
|
-
}), L(document, "touchmove", o, {
|
|
629
|
-
passive: !1,
|
|
630
|
-
capture: !0
|
|
631
|
-
}), L(document, "touchend", r, {
|
|
632
|
-
passive: !1,
|
|
633
|
-
capture: !0
|
|
634
|
-
}), L(document, "focus", i, !0));
|
|
635
|
-
return () => {
|
|
636
|
-
t == null || t(), c == null || c(), f();
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
function C(e, t, n) {
|
|
640
|
-
let o = e.style[t];
|
|
641
|
-
return e.style[t] = n, () => {
|
|
642
|
-
e.style[t] = o;
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
function L(e, t, n, o) {
|
|
646
|
-
return e.addEventListener(t, n, o), () => {
|
|
647
|
-
e.removeEventListener(t, n, o);
|
|
648
|
-
};
|
|
649
|
-
}
|
|
650
|
-
function Z(e) {
|
|
651
|
-
let t = document.scrollingElement || document.documentElement;
|
|
652
|
-
for (; e && e !== t; ) {
|
|
653
|
-
let n = te(e);
|
|
654
|
-
if (n !== document.documentElement && n !== document.body && n !== e) {
|
|
655
|
-
let o = n.getBoundingClientRect().top, r = e.getBoundingClientRect().top;
|
|
656
|
-
r > o + e.clientHeight && (n.scrollTop += r - o);
|
|
657
|
-
}
|
|
658
|
-
e = n.parentElement;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
function ee(e) {
|
|
662
|
-
return e instanceof HTMLInputElement && !Se.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
|
|
663
|
-
}
|
|
664
|
-
const I = /* @__PURE__ */ E.createContext(null);
|
|
665
|
-
function Le(e) {
|
|
666
|
-
let { children: t } = e, n = P(I), [o, r] = se(0), i = O(() => ({
|
|
667
|
-
parent: n,
|
|
668
|
-
modalCount: o,
|
|
669
|
-
addModal() {
|
|
670
|
-
r((c) => c + 1), n && n.addModal();
|
|
671
|
-
},
|
|
672
|
-
removeModal() {
|
|
673
|
-
r((c) => c - 1), n && n.removeModal();
|
|
674
|
-
}
|
|
675
|
-
}), [
|
|
676
|
-
n,
|
|
677
|
-
o
|
|
678
|
-
]);
|
|
679
|
-
return /* @__PURE__ */ E.createElement(I.Provider, {
|
|
680
|
-
value: i
|
|
681
|
-
}, t);
|
|
682
|
-
}
|
|
683
|
-
function Fe() {
|
|
684
|
-
let e = P(I);
|
|
685
|
-
return {
|
|
686
|
-
modalProviderProps: {
|
|
687
|
-
"aria-hidden": e && e.modalCount > 0 ? !0 : null
|
|
688
|
-
}
|
|
689
|
-
};
|
|
690
|
-
}
|
|
691
|
-
function Pe(e) {
|
|
692
|
-
let { modalProviderProps: t } = Fe();
|
|
693
|
-
return /* @__PURE__ */ E.createElement("div", {
|
|
694
|
-
"data-overlay-container": !0,
|
|
695
|
-
...e,
|
|
696
|
-
...t
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
function Me(e) {
|
|
700
|
-
return /* @__PURE__ */ E.createElement(Le, null, /* @__PURE__ */ E.createElement(Pe, e));
|
|
701
|
-
}
|
|
702
|
-
function Be(e) {
|
|
703
|
-
let t = ue(), { portalContainer: n = t ? null : document.body, ...o } = e;
|
|
704
|
-
if (E.useEffect(() => {
|
|
705
|
-
if (n != null && n.closest("[data-overlay-container]")) throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
|
|
706
|
-
}, [
|
|
707
|
-
n
|
|
708
|
-
]), !n) return null;
|
|
709
|
-
let r = /* @__PURE__ */ E.createElement(Me, o);
|
|
710
|
-
return /* @__PURE__ */ fe.createPortal(r, n);
|
|
711
|
-
}
|
|
712
|
-
function He(e) {
|
|
713
|
-
let t = P(I);
|
|
714
|
-
if (!t) throw new Error("Modal is not contained within a provider");
|
|
715
|
-
return D(() => {
|
|
716
|
-
if (!(e != null && e.isDisabled || !t || !t.parent))
|
|
717
|
-
return t.parent.addModal(), () => {
|
|
718
|
-
t && t.parent && t.parent.removeModal();
|
|
719
|
-
};
|
|
720
|
-
}, [
|
|
721
|
-
t,
|
|
722
|
-
t.parent,
|
|
723
|
-
e == null ? void 0 : e.isDisabled
|
|
724
|
-
]), {
|
|
725
|
-
modalProps: {
|
|
726
|
-
"data-ismodal": !(e != null && e.isDisabled)
|
|
727
|
-
}
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
const Re = /* @__PURE__ */ E.createContext(null);
|
|
731
|
-
function Oe() {
|
|
732
|
-
let e = P(Re), t = e == null ? void 0 : e.setContain;
|
|
733
|
-
g(() => {
|
|
734
|
-
t == null || t(!0);
|
|
735
|
-
}, [
|
|
736
|
-
t
|
|
737
|
-
]);
|
|
738
|
-
}
|
|
739
|
-
function Ve(e, t) {
|
|
740
|
-
let { role: n = "dialog" } = e, o = ce();
|
|
741
|
-
o = e["aria-label"] ? void 0 : o;
|
|
742
|
-
let r = y(!1);
|
|
743
|
-
return D(() => {
|
|
744
|
-
if (t.current && !t.current.contains(document.activeElement)) {
|
|
745
|
-
B(t.current);
|
|
746
|
-
let i = setTimeout(() => {
|
|
747
|
-
document.activeElement === t.current && (r.current = !0, t.current && (t.current.blur(), B(t.current)), r.current = !1);
|
|
748
|
-
}, 500);
|
|
749
|
-
return () => {
|
|
750
|
-
clearTimeout(i);
|
|
751
|
-
};
|
|
752
|
-
}
|
|
753
|
-
}, [
|
|
754
|
-
t
|
|
755
|
-
]), Oe(), {
|
|
756
|
-
dialogProps: {
|
|
757
|
-
...de(e, {
|
|
758
|
-
labelable: !0
|
|
759
|
-
}),
|
|
760
|
-
role: n,
|
|
761
|
-
tabIndex: -1,
|
|
762
|
-
"aria-labelledby": e["aria-labelledby"] || o,
|
|
763
|
-
// Prevent blur events from reaching useOverlay, which may cause
|
|
764
|
-
// popovers to close. Since focus is contained within the dialog,
|
|
765
|
-
// we don't want this to occur due to the above useEffect.
|
|
766
|
-
onBlur: (i) => {
|
|
767
|
-
r.current && i.stopPropagation();
|
|
768
|
-
}
|
|
769
|
-
},
|
|
770
|
-
titleProps: {
|
|
771
|
-
id: o
|
|
772
|
-
}
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
export {
|
|
776
|
-
Le as $,
|
|
777
|
-
Me as a,
|
|
778
|
-
He as b,
|
|
779
|
-
Ke as c,
|
|
780
|
-
Ve as d,
|
|
781
|
-
ke as e,
|
|
782
|
-
Be as f,
|
|
783
|
-
Ae as g
|
|
784
|
-
};
|
|
785
|
-
//# sourceMappingURL=useDialog-DZhIlo2a.js.map
|