@uva-glass/component-library 1.26.0 → 1.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/Attention.css +1 -0
- package/dist/assets/Drawer.css +1 -0
- package/dist/components/Attention/Attention.d.ts +3 -0
- package/dist/components/Attention/Attention.js +12 -0
- package/dist/components/Attention/Attention.js.map +1 -0
- package/dist/components/Attention/Attention.stories.d.ts +7 -0
- package/dist/components/Attention/Attention.stories.js +12 -0
- package/dist/components/Attention/Attention.stories.js.map +1 -0
- package/dist/components/Attention/index.d.ts +1 -0
- package/dist/components/Attention/index.js +5 -0
- package/dist/components/Attention/index.js.map +1 -0
- package/dist/components/Drawer/Drawer.d.ts +10 -0
- package/dist/components/Drawer/Drawer.js +60 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/Drawer.stories.d.ts +6 -0
- package/dist/components/Drawer/Drawer.stories.js +57 -0
- package/dist/components/Drawer/Drawer.stories.js.map +1 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +5 -0
- package/dist/components/Drawer/index.js.map +1 -0
- package/dist/components/ModalDialog/ModalDialog.js +105 -8
- package/dist/components/ModalDialog/ModalDialog.js.map +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +8 -7
- package/dist/components/ModalDialog/ModalDialog.stories.js.map +1 -1
- package/dist/components/ModalDialog/index.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +57 -53
- package/dist/components/index.js.map +1 -1
- package/dist/index.js +57 -53
- package/dist/index.js.map +1 -1
- package/dist/useDialog-DDVWB2iX.js +1180 -0
- package/dist/useDialog-DDVWB2iX.js.map +1 -0
- package/package.json +1 -1
- package/dist/ModalDialog-B1c9QYLZ.js +0 -1276
- package/dist/ModalDialog-B1c9QYLZ.js.map +0 -1
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
import p, { useRef as g, useCallback as F, useState as Y, useContext as L, useEffect as P, useMemo as B } from "react";
|
|
2
|
+
import { $ as Ne } from "./index-BA9Z7itR.js";
|
|
3
|
+
const h = typeof document < "u" ? p.useLayoutEffect : () => {
|
|
4
|
+
};
|
|
5
|
+
function A(e) {
|
|
6
|
+
const t = g(null);
|
|
7
|
+
return h(() => {
|
|
8
|
+
t.current = e;
|
|
9
|
+
}, [
|
|
10
|
+
e
|
|
11
|
+
]), F((...n) => {
|
|
12
|
+
const r = t.current;
|
|
13
|
+
return r == null ? void 0 : r(...n);
|
|
14
|
+
}, []);
|
|
15
|
+
}
|
|
16
|
+
function Me(e) {
|
|
17
|
+
let [t, n] = Y(e), r = g(null), o = A(() => {
|
|
18
|
+
if (!r.current)
|
|
19
|
+
return;
|
|
20
|
+
let i = r.current.next();
|
|
21
|
+
if (i.done) {
|
|
22
|
+
r.current = null;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
t === i.value ? o() : n(i.value);
|
|
26
|
+
});
|
|
27
|
+
h(() => {
|
|
28
|
+
r.current && o();
|
|
29
|
+
});
|
|
30
|
+
let a = A((i) => {
|
|
31
|
+
r.current = i(t), o();
|
|
32
|
+
});
|
|
33
|
+
return [
|
|
34
|
+
t,
|
|
35
|
+
a
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
const V = {
|
|
39
|
+
prefix: String(Math.round(Math.random() * 1e10)),
|
|
40
|
+
current: 0
|
|
41
|
+
}, me = /* @__PURE__ */ p.createContext(V), Pe = /* @__PURE__ */ p.createContext(!1);
|
|
42
|
+
let Ce = !!(typeof window < "u" && window.document && window.document.createElement), Q = /* @__PURE__ */ new WeakMap();
|
|
43
|
+
function De(e = !1) {
|
|
44
|
+
let t = L(me), n = g(null);
|
|
45
|
+
if (n.current === null && !e) {
|
|
46
|
+
var r, o;
|
|
47
|
+
let a = (o = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) === null || o === void 0 || (r = o.ReactCurrentOwner) === null || r === void 0 ? void 0 : r.current;
|
|
48
|
+
if (a) {
|
|
49
|
+
let i = Q.get(a);
|
|
50
|
+
i == null ? Q.set(a, {
|
|
51
|
+
id: t.current,
|
|
52
|
+
state: a.memoizedState
|
|
53
|
+
}) : a.memoizedState !== i.state && (t.current = i.id, Q.delete(a));
|
|
54
|
+
}
|
|
55
|
+
n.current = ++t.current;
|
|
56
|
+
}
|
|
57
|
+
return n.current;
|
|
58
|
+
}
|
|
59
|
+
function Fe(e) {
|
|
60
|
+
let t = L(me);
|
|
61
|
+
t === V && !Ce && console.warn("When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.");
|
|
62
|
+
let n = De(!!e), r = t === V && process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${t.prefix}`;
|
|
63
|
+
return e || `${r}-${n}`;
|
|
64
|
+
}
|
|
65
|
+
function ke(e) {
|
|
66
|
+
let t = p.useId(), [n] = Y(he()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${V.prefix}`;
|
|
67
|
+
return e || `${r}-${t}`;
|
|
68
|
+
}
|
|
69
|
+
const Oe = typeof p.useId == "function" ? ke : Fe;
|
|
70
|
+
function We() {
|
|
71
|
+
return !1;
|
|
72
|
+
}
|
|
73
|
+
function Ae() {
|
|
74
|
+
return !0;
|
|
75
|
+
}
|
|
76
|
+
function Ie(e) {
|
|
77
|
+
return () => {
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function he() {
|
|
81
|
+
return typeof p.useSyncExternalStore == "function" ? p.useSyncExternalStore(Ie, We, Ae) : L(Pe);
|
|
82
|
+
}
|
|
83
|
+
let He = !!(typeof window < "u" && window.document && window.document.createElement), ce = /* @__PURE__ */ new Map();
|
|
84
|
+
function Ke(e) {
|
|
85
|
+
let [t, n] = Y(e), r = g(null), o = Oe(t), a = F((i) => {
|
|
86
|
+
r.current = i;
|
|
87
|
+
}, []);
|
|
88
|
+
return He && ce.set(o, a), h(() => {
|
|
89
|
+
let i = o;
|
|
90
|
+
return () => {
|
|
91
|
+
ce.delete(i);
|
|
92
|
+
};
|
|
93
|
+
}, [
|
|
94
|
+
o
|
|
95
|
+
]), P(() => {
|
|
96
|
+
let i = r.current;
|
|
97
|
+
i && (r.current = null, n(i));
|
|
98
|
+
}), o;
|
|
99
|
+
}
|
|
100
|
+
function Re(e = []) {
|
|
101
|
+
let t = Ke(), [n, r] = Me(t), o = F(() => {
|
|
102
|
+
r(function* () {
|
|
103
|
+
yield t, yield document.getElementById(t) ? t : void 0;
|
|
104
|
+
});
|
|
105
|
+
}, [
|
|
106
|
+
t,
|
|
107
|
+
r
|
|
108
|
+
]);
|
|
109
|
+
return h(o, [
|
|
110
|
+
t,
|
|
111
|
+
o,
|
|
112
|
+
...e
|
|
113
|
+
]), n;
|
|
114
|
+
}
|
|
115
|
+
function ee(...e) {
|
|
116
|
+
return (...t) => {
|
|
117
|
+
for (let n of e)
|
|
118
|
+
typeof n == "function" && n(...t);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const E = (e) => {
|
|
122
|
+
var t;
|
|
123
|
+
return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
|
|
124
|
+
}, j = (e) => e && "window" in e && e.window === e ? e : E(e).defaultView || window, Be = /* @__PURE__ */ new Set([
|
|
125
|
+
"id"
|
|
126
|
+
]), Ve = /* @__PURE__ */ new Set([
|
|
127
|
+
"aria-label",
|
|
128
|
+
"aria-labelledby",
|
|
129
|
+
"aria-describedby",
|
|
130
|
+
"aria-details"
|
|
131
|
+
]), je = /* @__PURE__ */ new Set([
|
|
132
|
+
"href",
|
|
133
|
+
"hrefLang",
|
|
134
|
+
"target",
|
|
135
|
+
"rel",
|
|
136
|
+
"download",
|
|
137
|
+
"ping",
|
|
138
|
+
"referrerPolicy"
|
|
139
|
+
]), ze = /^(data-.*)$/;
|
|
140
|
+
function qe(e, t = {}) {
|
|
141
|
+
let { labelable: n, isLink: r, propNames: o } = t, a = {};
|
|
142
|
+
for (const i in e)
|
|
143
|
+
Object.prototype.hasOwnProperty.call(e, i) && (Be.has(i) || n && Ve.has(i) || r && je.has(i) || o != null && o.has(i) || ze.test(i)) && (a[i] = e[i]);
|
|
144
|
+
return a;
|
|
145
|
+
}
|
|
146
|
+
function de(e) {
|
|
147
|
+
if (Ge())
|
|
148
|
+
e.focus({
|
|
149
|
+
preventScroll: !0
|
|
150
|
+
});
|
|
151
|
+
else {
|
|
152
|
+
let t = Ue(e);
|
|
153
|
+
e.focus(), Xe(t);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
let H = null;
|
|
157
|
+
function Ge() {
|
|
158
|
+
if (H == null) {
|
|
159
|
+
H = !1;
|
|
160
|
+
try {
|
|
161
|
+
document.createElement("div").focus({
|
|
162
|
+
get preventScroll() {
|
|
163
|
+
return H = !0, !0;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
} catch {
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return H;
|
|
170
|
+
}
|
|
171
|
+
function Ue(e) {
|
|
172
|
+
let t = e.parentNode, n = [], r = document.scrollingElement || document.documentElement;
|
|
173
|
+
for (; t instanceof HTMLElement && t !== r; )
|
|
174
|
+
(t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && n.push({
|
|
175
|
+
element: t,
|
|
176
|
+
scrollTop: t.scrollTop,
|
|
177
|
+
scrollLeft: t.scrollLeft
|
|
178
|
+
}), t = t.parentNode;
|
|
179
|
+
return r instanceof HTMLElement && n.push({
|
|
180
|
+
element: r,
|
|
181
|
+
scrollTop: r.scrollTop,
|
|
182
|
+
scrollLeft: r.scrollLeft
|
|
183
|
+
}), n;
|
|
184
|
+
}
|
|
185
|
+
function Xe(e) {
|
|
186
|
+
for (let { element: t, scrollTop: n, scrollLeft: r } of e)
|
|
187
|
+
t.scrollTop = n, t.scrollLeft = r;
|
|
188
|
+
}
|
|
189
|
+
function Ye(e) {
|
|
190
|
+
var t;
|
|
191
|
+
return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((n) => e.test(n.brand))) || e.test(window.navigator.userAgent);
|
|
192
|
+
}
|
|
193
|
+
function ie(e) {
|
|
194
|
+
var t;
|
|
195
|
+
return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
|
|
196
|
+
}
|
|
197
|
+
function Ee() {
|
|
198
|
+
return ie(/^Mac/i);
|
|
199
|
+
}
|
|
200
|
+
function Je() {
|
|
201
|
+
return ie(/^iPhone/i);
|
|
202
|
+
}
|
|
203
|
+
function Qe() {
|
|
204
|
+
return ie(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
205
|
+
Ee() && navigator.maxTouchPoints > 1;
|
|
206
|
+
}
|
|
207
|
+
function Ze() {
|
|
208
|
+
return Je() || Qe();
|
|
209
|
+
}
|
|
210
|
+
function _e() {
|
|
211
|
+
return Ye(/Android/i);
|
|
212
|
+
}
|
|
213
|
+
let C = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ new Set();
|
|
214
|
+
function se() {
|
|
215
|
+
if (typeof window > "u")
|
|
216
|
+
return;
|
|
217
|
+
function e(r) {
|
|
218
|
+
return "propertyName" in r;
|
|
219
|
+
}
|
|
220
|
+
let t = (r) => {
|
|
221
|
+
if (!e(r) || !r.target)
|
|
222
|
+
return;
|
|
223
|
+
let o = C.get(r.target);
|
|
224
|
+
o || (o = /* @__PURE__ */ new Set(), C.set(r.target, o), r.target.addEventListener("transitioncancel", n, {
|
|
225
|
+
once: !0
|
|
226
|
+
})), o.add(r.propertyName);
|
|
227
|
+
}, n = (r) => {
|
|
228
|
+
if (!e(r) || !r.target)
|
|
229
|
+
return;
|
|
230
|
+
let o = C.get(r.target);
|
|
231
|
+
if (o && (o.delete(r.propertyName), o.size === 0 && (r.target.removeEventListener("transitioncancel", n), C.delete(r.target)), C.size === 0)) {
|
|
232
|
+
for (let a of te)
|
|
233
|
+
a();
|
|
234
|
+
te.clear();
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", n);
|
|
238
|
+
}
|
|
239
|
+
typeof document < "u" && (document.readyState !== "loading" ? se() : document.addEventListener("DOMContentLoaded", se));
|
|
240
|
+
function et(e) {
|
|
241
|
+
requestAnimationFrame(() => {
|
|
242
|
+
C.size === 0 ? e() : te.add(e);
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
function fe(e, t) {
|
|
246
|
+
let n = window.getComputedStyle(e), r = /(auto|scroll)/.test(n.overflow + n.overflowX + n.overflowY);
|
|
247
|
+
return r && t && (r = e.scrollHeight !== e.clientHeight || e.scrollWidth !== e.clientWidth), r;
|
|
248
|
+
}
|
|
249
|
+
function we(e, t) {
|
|
250
|
+
let n = e;
|
|
251
|
+
for (fe(n, t) && (n = n.parentElement); n && !fe(n, t); )
|
|
252
|
+
n = n.parentElement;
|
|
253
|
+
return n || document.scrollingElement || document.documentElement;
|
|
254
|
+
}
|
|
255
|
+
function tt(e) {
|
|
256
|
+
return e.mozInputSource === 0 && e.isTrusted ? !0 : _e() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
|
257
|
+
}
|
|
258
|
+
class nt {
|
|
259
|
+
isDefaultPrevented() {
|
|
260
|
+
return this.nativeEvent.defaultPrevented;
|
|
261
|
+
}
|
|
262
|
+
preventDefault() {
|
|
263
|
+
this.defaultPrevented = !0, this.nativeEvent.preventDefault();
|
|
264
|
+
}
|
|
265
|
+
stopPropagation() {
|
|
266
|
+
this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
|
|
267
|
+
}
|
|
268
|
+
isPropagationStopped() {
|
|
269
|
+
return !1;
|
|
270
|
+
}
|
|
271
|
+
persist() {
|
|
272
|
+
}
|
|
273
|
+
constructor(t, n) {
|
|
274
|
+
this.nativeEvent = n, this.target = n.target, this.currentTarget = n.currentTarget, this.relatedTarget = n.relatedTarget, this.bubbles = n.bubbles, this.cancelable = n.cancelable, this.defaultPrevented = n.defaultPrevented, this.eventPhase = n.eventPhase, this.isTrusted = n.isTrusted, this.timeStamp = n.timeStamp, this.type = t;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function rt(e) {
|
|
278
|
+
let t = g({
|
|
279
|
+
isFocused: !1,
|
|
280
|
+
observer: null
|
|
281
|
+
});
|
|
282
|
+
h(() => {
|
|
283
|
+
const r = t.current;
|
|
284
|
+
return () => {
|
|
285
|
+
r.observer && (r.observer.disconnect(), r.observer = null);
|
|
286
|
+
};
|
|
287
|
+
}, []);
|
|
288
|
+
let n = A((r) => {
|
|
289
|
+
e == null || e(r);
|
|
290
|
+
});
|
|
291
|
+
return F((r) => {
|
|
292
|
+
if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
|
|
293
|
+
t.current.isFocused = !0;
|
|
294
|
+
let o = r.target, a = (i) => {
|
|
295
|
+
t.current.isFocused = !1, o.disabled && n(new nt("blur", i)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
|
|
296
|
+
};
|
|
297
|
+
o.addEventListener("focusout", a, {
|
|
298
|
+
once: !0
|
|
299
|
+
}), t.current.observer = new MutationObserver(() => {
|
|
300
|
+
if (t.current.isFocused && o.disabled) {
|
|
301
|
+
var i;
|
|
302
|
+
(i = t.current.observer) === null || i === void 0 || i.disconnect();
|
|
303
|
+
let l = o === document.activeElement ? null : document.activeElement;
|
|
304
|
+
o.dispatchEvent(new FocusEvent("blur", {
|
|
305
|
+
relatedTarget: l
|
|
306
|
+
})), o.dispatchEvent(new FocusEvent("focusout", {
|
|
307
|
+
bubbles: !0,
|
|
308
|
+
relatedTarget: l
|
|
309
|
+
}));
|
|
310
|
+
}
|
|
311
|
+
}), t.current.observer.observe(o, {
|
|
312
|
+
attributes: !0,
|
|
313
|
+
attributeFilter: [
|
|
314
|
+
"disabled"
|
|
315
|
+
]
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
}, [
|
|
319
|
+
n
|
|
320
|
+
]);
|
|
321
|
+
}
|
|
322
|
+
let I = null, ot = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Map(), M = !1, ne = !1;
|
|
323
|
+
function ae(e, t) {
|
|
324
|
+
for (let n of ot)
|
|
325
|
+
n(e, t);
|
|
326
|
+
}
|
|
327
|
+
function it(e) {
|
|
328
|
+
return !(e.metaKey || !Ee() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
329
|
+
}
|
|
330
|
+
function z(e) {
|
|
331
|
+
M = !0, it(e) && (I = "keyboard", ae("keyboard", e));
|
|
332
|
+
}
|
|
333
|
+
function y(e) {
|
|
334
|
+
I = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (M = !0, ae("pointer", e));
|
|
335
|
+
}
|
|
336
|
+
function ge(e) {
|
|
337
|
+
tt(e) && (M = !0, I = "virtual");
|
|
338
|
+
}
|
|
339
|
+
function ye(e) {
|
|
340
|
+
e.target === window || e.target === document || (!M && !ne && (I = "virtual", ae("virtual", e)), M = !1, ne = !1);
|
|
341
|
+
}
|
|
342
|
+
function Te() {
|
|
343
|
+
M = !1, ne = !0;
|
|
344
|
+
}
|
|
345
|
+
function ve(e) {
|
|
346
|
+
if (typeof window > "u" || W.get(j(e)))
|
|
347
|
+
return;
|
|
348
|
+
const t = j(e), n = E(e);
|
|
349
|
+
let r = t.HTMLElement.prototype.focus;
|
|
350
|
+
t.HTMLElement.prototype.focus = function() {
|
|
351
|
+
M = !0, r.apply(this, arguments);
|
|
352
|
+
}, n.addEventListener("keydown", z, !0), n.addEventListener("keyup", z, !0), n.addEventListener("click", ge, !0), t.addEventListener("focus", ye, !0), t.addEventListener("blur", Te, !1), typeof PointerEvent < "u" ? (n.addEventListener("pointerdown", y, !0), n.addEventListener("pointermove", y, !0), n.addEventListener("pointerup", y, !0)) : (n.addEventListener("mousedown", y, !0), n.addEventListener("mousemove", y, !0), n.addEventListener("mouseup", y, !0)), t.addEventListener("beforeunload", () => {
|
|
353
|
+
xe(e);
|
|
354
|
+
}, {
|
|
355
|
+
once: !0
|
|
356
|
+
}), W.set(t, {
|
|
357
|
+
focus: r
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
const xe = (e, t) => {
|
|
361
|
+
const n = j(e), r = E(e);
|
|
362
|
+
t && r.removeEventListener("DOMContentLoaded", t), W.has(n) && (n.HTMLElement.prototype.focus = W.get(n).focus, r.removeEventListener("keydown", z, !0), r.removeEventListener("keyup", z, !0), r.removeEventListener("click", ge, !0), n.removeEventListener("focus", ye, !0), n.removeEventListener("blur", Te, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", y, !0), r.removeEventListener("pointermove", y, !0), r.removeEventListener("pointerup", y, !0)) : (r.removeEventListener("mousedown", y, !0), r.removeEventListener("mousemove", y, !0), r.removeEventListener("mouseup", y, !0)), W.delete(n));
|
|
363
|
+
};
|
|
364
|
+
function at(e) {
|
|
365
|
+
const t = E(e);
|
|
366
|
+
let n;
|
|
367
|
+
return t.readyState !== "loading" ? ve(e) : (n = () => {
|
|
368
|
+
ve(e);
|
|
369
|
+
}, t.addEventListener("DOMContentLoaded", n)), () => xe(e, n);
|
|
370
|
+
}
|
|
371
|
+
typeof document < "u" && at();
|
|
372
|
+
function lt() {
|
|
373
|
+
return I;
|
|
374
|
+
}
|
|
375
|
+
function ut(e) {
|
|
376
|
+
let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, a = g({
|
|
377
|
+
isFocusWithin: !1
|
|
378
|
+
}), i = F((u) => {
|
|
379
|
+
a.current.isFocusWithin && !u.currentTarget.contains(u.relatedTarget) && (a.current.isFocusWithin = !1, n && n(u), o && o(!1));
|
|
380
|
+
}, [
|
|
381
|
+
n,
|
|
382
|
+
o,
|
|
383
|
+
a
|
|
384
|
+
]), l = rt(i), d = F((u) => {
|
|
385
|
+
!a.current.isFocusWithin && document.activeElement === u.target && (r && r(u), o && o(!0), a.current.isFocusWithin = !0, l(u));
|
|
386
|
+
}, [
|
|
387
|
+
r,
|
|
388
|
+
o,
|
|
389
|
+
l
|
|
390
|
+
]);
|
|
391
|
+
return t ? {
|
|
392
|
+
focusWithinProps: {
|
|
393
|
+
// These should not have been null, that would conflict in mergeProps
|
|
394
|
+
onFocus: void 0,
|
|
395
|
+
onBlur: void 0
|
|
396
|
+
}
|
|
397
|
+
} : {
|
|
398
|
+
focusWithinProps: {
|
|
399
|
+
onFocus: d,
|
|
400
|
+
onBlur: i
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function ct(e) {
|
|
405
|
+
let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, a = g({
|
|
406
|
+
isPointerDown: !1,
|
|
407
|
+
ignoreEmulatedMouseEvents: !1
|
|
408
|
+
}), i = A((d) => {
|
|
409
|
+
n && K(d, t) && (o && o(d), a.current.isPointerDown = !0);
|
|
410
|
+
}), l = A((d) => {
|
|
411
|
+
n && n(d);
|
|
412
|
+
});
|
|
413
|
+
P(() => {
|
|
414
|
+
let d = a.current;
|
|
415
|
+
if (r)
|
|
416
|
+
return;
|
|
417
|
+
const u = t.current, c = E(u);
|
|
418
|
+
if (typeof PointerEvent < "u") {
|
|
419
|
+
let s = ($) => {
|
|
420
|
+
d.isPointerDown && K($, t) && l($), d.isPointerDown = !1;
|
|
421
|
+
};
|
|
422
|
+
return c.addEventListener("pointerdown", i, !0), c.addEventListener("pointerup", s, !0), () => {
|
|
423
|
+
c.removeEventListener("pointerdown", i, !0), c.removeEventListener("pointerup", s, !0);
|
|
424
|
+
};
|
|
425
|
+
} else {
|
|
426
|
+
let s = (v) => {
|
|
427
|
+
d.ignoreEmulatedMouseEvents ? d.ignoreEmulatedMouseEvents = !1 : d.isPointerDown && K(v, t) && l(v), d.isPointerDown = !1;
|
|
428
|
+
}, $ = (v) => {
|
|
429
|
+
d.ignoreEmulatedMouseEvents = !0, d.isPointerDown && K(v, t) && l(v), d.isPointerDown = !1;
|
|
430
|
+
};
|
|
431
|
+
return c.addEventListener("mousedown", i, !0), c.addEventListener("mouseup", s, !0), c.addEventListener("touchstart", i, !0), c.addEventListener("touchend", $, !0), () => {
|
|
432
|
+
c.removeEventListener("mousedown", i, !0), c.removeEventListener("mouseup", s, !0), c.removeEventListener("touchstart", i, !0), c.removeEventListener("touchend", $, !0);
|
|
433
|
+
};
|
|
434
|
+
}
|
|
435
|
+
}, [
|
|
436
|
+
t,
|
|
437
|
+
r,
|
|
438
|
+
i,
|
|
439
|
+
l
|
|
440
|
+
]);
|
|
441
|
+
}
|
|
442
|
+
function K(e, t) {
|
|
443
|
+
if (e.button > 0)
|
|
444
|
+
return !1;
|
|
445
|
+
if (e.target) {
|
|
446
|
+
const n = e.target.ownerDocument;
|
|
447
|
+
if (!n || !n.documentElement.contains(e.target) || e.target.closest("[data-react-aria-top-layer]"))
|
|
448
|
+
return !1;
|
|
449
|
+
}
|
|
450
|
+
return t.current && !t.current.contains(e.target);
|
|
451
|
+
}
|
|
452
|
+
function re(e) {
|
|
453
|
+
const t = E(e);
|
|
454
|
+
if (lt() === "virtual") {
|
|
455
|
+
let n = t.activeElement;
|
|
456
|
+
et(() => {
|
|
457
|
+
t.activeElement === n && e.isConnected && de(e);
|
|
458
|
+
});
|
|
459
|
+
} else
|
|
460
|
+
de(e);
|
|
461
|
+
}
|
|
462
|
+
function dt(e) {
|
|
463
|
+
const t = j(e);
|
|
464
|
+
if (!(e instanceof t.HTMLElement) && !(e instanceof t.SVGElement))
|
|
465
|
+
return !1;
|
|
466
|
+
let { display: n, visibility: r } = e.style, o = n !== "none" && r !== "hidden" && r !== "collapse";
|
|
467
|
+
if (o) {
|
|
468
|
+
const { getComputedStyle: a } = e.ownerDocument.defaultView;
|
|
469
|
+
let { display: i, visibility: l } = a(e);
|
|
470
|
+
o = i !== "none" && l !== "hidden" && l !== "collapse";
|
|
471
|
+
}
|
|
472
|
+
return o;
|
|
473
|
+
}
|
|
474
|
+
function st(e, t) {
|
|
475
|
+
return !e.hasAttribute("hidden") && // Ignore HiddenSelect when tree walking.
|
|
476
|
+
!e.hasAttribute("data-react-aria-prevent-focus") && (e.nodeName === "DETAILS" && t && t.nodeName !== "SUMMARY" ? e.hasAttribute("open") : !0);
|
|
477
|
+
}
|
|
478
|
+
function Se(e, t) {
|
|
479
|
+
return e.nodeName !== "#comment" && dt(e) && st(e, t) && (!e.parentElement || Se(e.parentElement, e));
|
|
480
|
+
}
|
|
481
|
+
const $e = /* @__PURE__ */ p.createContext(null);
|
|
482
|
+
let b = null;
|
|
483
|
+
function Ft(e) {
|
|
484
|
+
let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, a = g(null), i = g(null), l = g([]), { parentNode: d } = L($e) || {}, u = B(() => new oe({
|
|
485
|
+
scopeRef: l
|
|
486
|
+
}), [
|
|
487
|
+
l
|
|
488
|
+
]);
|
|
489
|
+
h(() => {
|
|
490
|
+
let $ = d || m.root;
|
|
491
|
+
if (m.getTreeNode($.scopeRef) && b && !G(b, $.scopeRef)) {
|
|
492
|
+
let v = m.getTreeNode(b);
|
|
493
|
+
v && ($ = v);
|
|
494
|
+
}
|
|
495
|
+
$.addChild(u), m.addNode(u);
|
|
496
|
+
}, [
|
|
497
|
+
u,
|
|
498
|
+
d
|
|
499
|
+
]), h(() => {
|
|
500
|
+
let $ = m.getTreeNode(l);
|
|
501
|
+
$ && ($.contain = !!n);
|
|
502
|
+
}, [
|
|
503
|
+
n
|
|
504
|
+
]), h(() => {
|
|
505
|
+
var $;
|
|
506
|
+
let v = ($ = a.current) === null || $ === void 0 ? void 0 : $.nextSibling, f = [];
|
|
507
|
+
for (; v && v !== i.current; )
|
|
508
|
+
f.push(v), v = v.nextSibling;
|
|
509
|
+
l.current = f;
|
|
510
|
+
}, [
|
|
511
|
+
t
|
|
512
|
+
]), ht(l, r, n), bt(l, n), wt(l, r, n), mt(l, o), P(() => {
|
|
513
|
+
const $ = E(l.current ? l.current[0] : void 0).activeElement;
|
|
514
|
+
let v = null;
|
|
515
|
+
if (w($, l.current)) {
|
|
516
|
+
for (let f of m.traverse())
|
|
517
|
+
f.scopeRef && w($, f.scopeRef.current) && (v = f);
|
|
518
|
+
v === m.getTreeNode(l) && (b = v.scopeRef);
|
|
519
|
+
}
|
|
520
|
+
}, [
|
|
521
|
+
l
|
|
522
|
+
]), h(() => () => {
|
|
523
|
+
var $, v, f;
|
|
524
|
+
let J = (f = (v = m.getTreeNode(l)) === null || v === void 0 || ($ = v.parent) === null || $ === void 0 ? void 0 : $.scopeRef) !== null && f !== void 0 ? f : null;
|
|
525
|
+
(l === b || G(l, b)) && (!J || m.getTreeNode(J)) && (b = J), m.removeTreeNode(l);
|
|
526
|
+
}, [
|
|
527
|
+
l
|
|
528
|
+
]);
|
|
529
|
+
let c = B(() => ft(l), []), s = B(() => ({
|
|
530
|
+
focusManager: c,
|
|
531
|
+
parentNode: u
|
|
532
|
+
}), [
|
|
533
|
+
u,
|
|
534
|
+
c
|
|
535
|
+
]);
|
|
536
|
+
return /* @__PURE__ */ p.createElement($e.Provider, {
|
|
537
|
+
value: s
|
|
538
|
+
}, /* @__PURE__ */ p.createElement("span", {
|
|
539
|
+
"data-focus-scope-start": !0,
|
|
540
|
+
hidden: !0,
|
|
541
|
+
ref: a
|
|
542
|
+
}), t, /* @__PURE__ */ p.createElement("span", {
|
|
543
|
+
"data-focus-scope-end": !0,
|
|
544
|
+
hidden: !0,
|
|
545
|
+
ref: i
|
|
546
|
+
}));
|
|
547
|
+
}
|
|
548
|
+
function ft(e) {
|
|
549
|
+
return {
|
|
550
|
+
focusNext(t = {}) {
|
|
551
|
+
let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, l = r || E(n[0]).activeElement, d = n[0].previousElementSibling, u = N(n), c = S(u, {
|
|
552
|
+
tabbable: o,
|
|
553
|
+
accept: i
|
|
554
|
+
}, n);
|
|
555
|
+
c.currentNode = w(l, n) ? l : d;
|
|
556
|
+
let s = c.nextNode();
|
|
557
|
+
return !s && a && (c.currentNode = d, s = c.nextNode()), s && x(s, !0), s;
|
|
558
|
+
},
|
|
559
|
+
focusPrevious(t = {}) {
|
|
560
|
+
let n = e.current, { from: r, tabbable: o, wrap: a, accept: i } = t, l = r || E(n[0]).activeElement, d = n[n.length - 1].nextElementSibling, u = N(n), c = S(u, {
|
|
561
|
+
tabbable: o,
|
|
562
|
+
accept: i
|
|
563
|
+
}, n);
|
|
564
|
+
c.currentNode = w(l, n) ? l : d;
|
|
565
|
+
let s = c.previousNode();
|
|
566
|
+
return !s && a && (c.currentNode = d, s = c.previousNode()), s && x(s, !0), s;
|
|
567
|
+
},
|
|
568
|
+
focusFirst(t = {}) {
|
|
569
|
+
let n = e.current, { tabbable: r, accept: o } = t, a = N(n), i = S(a, {
|
|
570
|
+
tabbable: r,
|
|
571
|
+
accept: o
|
|
572
|
+
}, n);
|
|
573
|
+
i.currentNode = n[0].previousElementSibling;
|
|
574
|
+
let l = i.nextNode();
|
|
575
|
+
return l && x(l, !0), l;
|
|
576
|
+
},
|
|
577
|
+
focusLast(t = {}) {
|
|
578
|
+
let n = e.current, { tabbable: r, accept: o } = t, a = N(n), i = S(a, {
|
|
579
|
+
tabbable: r,
|
|
580
|
+
accept: o
|
|
581
|
+
}, n);
|
|
582
|
+
i.currentNode = n[n.length - 1].nextElementSibling;
|
|
583
|
+
let l = i.previousNode();
|
|
584
|
+
return l && x(l, !0), l;
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
const le = [
|
|
589
|
+
"input:not([disabled]):not([type=hidden])",
|
|
590
|
+
"select:not([disabled])",
|
|
591
|
+
"textarea:not([disabled])",
|
|
592
|
+
"button:not([disabled])",
|
|
593
|
+
"a[href]",
|
|
594
|
+
"area[href]",
|
|
595
|
+
"summary",
|
|
596
|
+
"iframe",
|
|
597
|
+
"object",
|
|
598
|
+
"embed",
|
|
599
|
+
"audio[controls]",
|
|
600
|
+
"video[controls]",
|
|
601
|
+
"[contenteditable]"
|
|
602
|
+
], vt = le.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
|
603
|
+
le.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
|
604
|
+
const $t = le.join(':not([hidden]):not([tabindex="-1"]),');
|
|
605
|
+
function N(e) {
|
|
606
|
+
return e[0].parentElement;
|
|
607
|
+
}
|
|
608
|
+
function O(e) {
|
|
609
|
+
let t = m.getTreeNode(b);
|
|
610
|
+
for (; t && t.scopeRef !== e; ) {
|
|
611
|
+
if (t.contain)
|
|
612
|
+
return !1;
|
|
613
|
+
t = t.parent;
|
|
614
|
+
}
|
|
615
|
+
return !0;
|
|
616
|
+
}
|
|
617
|
+
function bt(e, t) {
|
|
618
|
+
let n = g(), r = g();
|
|
619
|
+
h(() => {
|
|
620
|
+
let o = e.current;
|
|
621
|
+
if (!t) {
|
|
622
|
+
r.current && (cancelAnimationFrame(r.current), r.current = void 0);
|
|
623
|
+
return;
|
|
624
|
+
}
|
|
625
|
+
const a = E(o ? o[0] : void 0);
|
|
626
|
+
let i = (u) => {
|
|
627
|
+
if (u.key !== "Tab" || u.altKey || u.ctrlKey || u.metaKey || !O(e) || u.isComposing)
|
|
628
|
+
return;
|
|
629
|
+
let c = a.activeElement, s = e.current;
|
|
630
|
+
if (!s || !w(c, s))
|
|
631
|
+
return;
|
|
632
|
+
let $ = N(s), v = S($, {
|
|
633
|
+
tabbable: !0
|
|
634
|
+
}, s);
|
|
635
|
+
if (!c)
|
|
636
|
+
return;
|
|
637
|
+
v.currentNode = c;
|
|
638
|
+
let f = u.shiftKey ? v.previousNode() : v.nextNode();
|
|
639
|
+
f || (v.currentNode = u.shiftKey ? s[s.length - 1].nextElementSibling : s[0].previousElementSibling, f = u.shiftKey ? v.previousNode() : v.nextNode()), u.preventDefault(), f && x(f, !0);
|
|
640
|
+
}, l = (u) => {
|
|
641
|
+
(!b || G(b, e)) && w(u.target, e.current) ? (b = e, n.current = u.target) : O(e) && !q(u.target, e) ? n.current ? n.current.focus() : b && b.current && U(b.current) : O(e) && (n.current = u.target);
|
|
642
|
+
}, d = (u) => {
|
|
643
|
+
r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
|
644
|
+
if (a.activeElement && O(e) && !q(a.activeElement, e))
|
|
645
|
+
if (b = e, a.body.contains(u.target)) {
|
|
646
|
+
var c;
|
|
647
|
+
n.current = u.target, (c = n.current) === null || c === void 0 || c.focus();
|
|
648
|
+
} else
|
|
649
|
+
b.current && U(b.current);
|
|
650
|
+
});
|
|
651
|
+
};
|
|
652
|
+
return a.addEventListener("keydown", i, !1), a.addEventListener("focusin", l, !1), o == null || o.forEach((u) => u.addEventListener("focusin", l, !1)), o == null || o.forEach((u) => u.addEventListener("focusout", d, !1)), () => {
|
|
653
|
+
a.removeEventListener("keydown", i, !1), a.removeEventListener("focusin", l, !1), o == null || o.forEach((u) => u.removeEventListener("focusin", l, !1)), o == null || o.forEach((u) => u.removeEventListener("focusout", d, !1));
|
|
654
|
+
};
|
|
655
|
+
}, [
|
|
656
|
+
e,
|
|
657
|
+
t
|
|
658
|
+
]), h(() => () => {
|
|
659
|
+
r.current && cancelAnimationFrame(r.current);
|
|
660
|
+
}, [
|
|
661
|
+
r
|
|
662
|
+
]);
|
|
663
|
+
}
|
|
664
|
+
function Le(e) {
|
|
665
|
+
return q(e);
|
|
666
|
+
}
|
|
667
|
+
function w(e, t) {
|
|
668
|
+
return !e || !t ? !1 : t.some((n) => n.contains(e));
|
|
669
|
+
}
|
|
670
|
+
function q(e, t = null) {
|
|
671
|
+
if (e instanceof Element && e.closest("[data-react-aria-top-layer]"))
|
|
672
|
+
return !0;
|
|
673
|
+
for (let { scopeRef: n } of m.traverse(m.getTreeNode(t)))
|
|
674
|
+
if (n && w(e, n.current))
|
|
675
|
+
return !0;
|
|
676
|
+
return !1;
|
|
677
|
+
}
|
|
678
|
+
function pt(e) {
|
|
679
|
+
return q(e, b);
|
|
680
|
+
}
|
|
681
|
+
function G(e, t) {
|
|
682
|
+
var n;
|
|
683
|
+
let r = (n = m.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
|
|
684
|
+
for (; r; ) {
|
|
685
|
+
if (r.scopeRef === e)
|
|
686
|
+
return !0;
|
|
687
|
+
r = r.parent;
|
|
688
|
+
}
|
|
689
|
+
return !1;
|
|
690
|
+
}
|
|
691
|
+
function x(e, t = !1) {
|
|
692
|
+
if (e != null && !t)
|
|
693
|
+
try {
|
|
694
|
+
re(e);
|
|
695
|
+
} catch {
|
|
696
|
+
}
|
|
697
|
+
else if (e != null)
|
|
698
|
+
try {
|
|
699
|
+
e.focus();
|
|
700
|
+
} catch {
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
function U(e, t = !0) {
|
|
704
|
+
let n = e[0].previousElementSibling, r = N(e), o = S(r, {
|
|
705
|
+
tabbable: t
|
|
706
|
+
}, e);
|
|
707
|
+
o.currentNode = n;
|
|
708
|
+
let a = o.nextNode();
|
|
709
|
+
t && !a && (r = N(e), o = S(r, {
|
|
710
|
+
tabbable: !1
|
|
711
|
+
}, e), o.currentNode = n, a = o.nextNode()), x(a);
|
|
712
|
+
}
|
|
713
|
+
function mt(e, t) {
|
|
714
|
+
const n = p.useRef(t);
|
|
715
|
+
P(() => {
|
|
716
|
+
if (n.current) {
|
|
717
|
+
b = e;
|
|
718
|
+
const r = E(e.current ? e.current[0] : void 0);
|
|
719
|
+
!w(r.activeElement, b.current) && e.current && U(e.current);
|
|
720
|
+
}
|
|
721
|
+
n.current = !1;
|
|
722
|
+
}, [
|
|
723
|
+
e
|
|
724
|
+
]);
|
|
725
|
+
}
|
|
726
|
+
function ht(e, t, n) {
|
|
727
|
+
h(() => {
|
|
728
|
+
if (t || n)
|
|
729
|
+
return;
|
|
730
|
+
let r = e.current;
|
|
731
|
+
const o = E(r ? r[0] : void 0);
|
|
732
|
+
let a = (i) => {
|
|
733
|
+
let l = i.target;
|
|
734
|
+
w(l, e.current) ? b = e : Le(l) || (b = null);
|
|
735
|
+
};
|
|
736
|
+
return o.addEventListener("focusin", a, !1), r == null || r.forEach((i) => i.addEventListener("focusin", a, !1)), () => {
|
|
737
|
+
o.removeEventListener("focusin", a, !1), r == null || r.forEach((i) => i.removeEventListener("focusin", a, !1));
|
|
738
|
+
};
|
|
739
|
+
}, [
|
|
740
|
+
e,
|
|
741
|
+
t,
|
|
742
|
+
n
|
|
743
|
+
]);
|
|
744
|
+
}
|
|
745
|
+
function Et(e) {
|
|
746
|
+
let t = m.getTreeNode(b);
|
|
747
|
+
for (; t && t.scopeRef !== e; ) {
|
|
748
|
+
if (t.nodeToRestore)
|
|
749
|
+
return !1;
|
|
750
|
+
t = t.parent;
|
|
751
|
+
}
|
|
752
|
+
return (t == null ? void 0 : t.scopeRef) === e;
|
|
753
|
+
}
|
|
754
|
+
function wt(e, t, n) {
|
|
755
|
+
const r = g(typeof document < "u" ? E(e.current ? e.current[0] : void 0).activeElement : null);
|
|
756
|
+
h(() => {
|
|
757
|
+
let o = e.current;
|
|
758
|
+
const a = E(o ? o[0] : void 0);
|
|
759
|
+
if (!t || n)
|
|
760
|
+
return;
|
|
761
|
+
let i = () => {
|
|
762
|
+
(!b || G(b, e)) && w(a.activeElement, e.current) && (b = e);
|
|
763
|
+
};
|
|
764
|
+
return a.addEventListener("focusin", i, !1), o == null || o.forEach((l) => l.addEventListener("focusin", i, !1)), () => {
|
|
765
|
+
a.removeEventListener("focusin", i, !1), o == null || o.forEach((l) => l.removeEventListener("focusin", i, !1));
|
|
766
|
+
};
|
|
767
|
+
}, [
|
|
768
|
+
e,
|
|
769
|
+
n
|
|
770
|
+
]), h(() => {
|
|
771
|
+
const o = E(e.current ? e.current[0] : void 0);
|
|
772
|
+
if (!t)
|
|
773
|
+
return;
|
|
774
|
+
let a = (i) => {
|
|
775
|
+
if (i.key !== "Tab" || i.altKey || i.ctrlKey || i.metaKey || !O(e) || i.isComposing)
|
|
776
|
+
return;
|
|
777
|
+
let l = o.activeElement;
|
|
778
|
+
if (!w(l, e.current))
|
|
779
|
+
return;
|
|
780
|
+
let d = m.getTreeNode(e);
|
|
781
|
+
if (!d)
|
|
782
|
+
return;
|
|
783
|
+
let u = d.nodeToRestore, c = S(o.body, {
|
|
784
|
+
tabbable: !0
|
|
785
|
+
});
|
|
786
|
+
c.currentNode = l;
|
|
787
|
+
let s = i.shiftKey ? c.previousNode() : c.nextNode();
|
|
788
|
+
if ((!u || !o.body.contains(u) || u === o.body) && (u = void 0, d.nodeToRestore = void 0), (!s || !w(s, e.current)) && u) {
|
|
789
|
+
c.currentNode = u;
|
|
790
|
+
do
|
|
791
|
+
s = i.shiftKey ? c.previousNode() : c.nextNode();
|
|
792
|
+
while (w(s, e.current));
|
|
793
|
+
i.preventDefault(), i.stopPropagation(), s ? x(s, !0) : Le(u) ? x(u, !0) : l.blur();
|
|
794
|
+
}
|
|
795
|
+
};
|
|
796
|
+
return n || o.addEventListener("keydown", a, !0), () => {
|
|
797
|
+
n || o.removeEventListener("keydown", a, !0);
|
|
798
|
+
};
|
|
799
|
+
}, [
|
|
800
|
+
e,
|
|
801
|
+
t,
|
|
802
|
+
n
|
|
803
|
+
]), h(() => {
|
|
804
|
+
const o = E(e.current ? e.current[0] : void 0);
|
|
805
|
+
if (!t)
|
|
806
|
+
return;
|
|
807
|
+
let a = m.getTreeNode(e);
|
|
808
|
+
if (a) {
|
|
809
|
+
var i;
|
|
810
|
+
return a.nodeToRestore = (i = r.current) !== null && i !== void 0 ? i : void 0, () => {
|
|
811
|
+
let l = m.getTreeNode(e);
|
|
812
|
+
if (!l)
|
|
813
|
+
return;
|
|
814
|
+
let d = l.nodeToRestore;
|
|
815
|
+
if (t && d && // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
816
|
+
(w(o.activeElement, e.current) || o.activeElement === o.body && Et(e))) {
|
|
817
|
+
let u = m.clone();
|
|
818
|
+
requestAnimationFrame(() => {
|
|
819
|
+
if (o.activeElement === o.body) {
|
|
820
|
+
let c = u.getTreeNode(e);
|
|
821
|
+
for (; c; ) {
|
|
822
|
+
if (c.nodeToRestore && c.nodeToRestore.isConnected) {
|
|
823
|
+
x(c.nodeToRestore);
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
c = c.parent;
|
|
827
|
+
}
|
|
828
|
+
for (c = u.getTreeNode(e); c; ) {
|
|
829
|
+
if (c.scopeRef && c.scopeRef.current && m.getTreeNode(c.scopeRef)) {
|
|
830
|
+
U(c.scopeRef.current, !0);
|
|
831
|
+
return;
|
|
832
|
+
}
|
|
833
|
+
c = c.parent;
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
}, [
|
|
841
|
+
e,
|
|
842
|
+
t
|
|
843
|
+
]);
|
|
844
|
+
}
|
|
845
|
+
function S(e, t, n) {
|
|
846
|
+
let r = t != null && t.tabbable ? $t : vt, o = E(e).createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
847
|
+
acceptNode(a) {
|
|
848
|
+
var i;
|
|
849
|
+
return !(t == null || (i = t.from) === null || i === void 0) && i.contains(a) ? NodeFilter.FILTER_REJECT : a.matches(r) && Se(a) && (!n || w(a, n)) && (!(t != null && t.accept) || t.accept(a)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
850
|
+
}
|
|
851
|
+
});
|
|
852
|
+
return t != null && t.from && (o.currentNode = t.from), o;
|
|
853
|
+
}
|
|
854
|
+
class ue {
|
|
855
|
+
get size() {
|
|
856
|
+
return this.fastMap.size;
|
|
857
|
+
}
|
|
858
|
+
getTreeNode(t) {
|
|
859
|
+
return this.fastMap.get(t);
|
|
860
|
+
}
|
|
861
|
+
addTreeNode(t, n, r) {
|
|
862
|
+
let o = this.fastMap.get(n ?? null);
|
|
863
|
+
if (!o)
|
|
864
|
+
return;
|
|
865
|
+
let a = new oe({
|
|
866
|
+
scopeRef: t
|
|
867
|
+
});
|
|
868
|
+
o.addChild(a), a.parent = o, this.fastMap.set(t, a), r && (a.nodeToRestore = r);
|
|
869
|
+
}
|
|
870
|
+
addNode(t) {
|
|
871
|
+
this.fastMap.set(t.scopeRef, t);
|
|
872
|
+
}
|
|
873
|
+
removeTreeNode(t) {
|
|
874
|
+
if (t === null)
|
|
875
|
+
return;
|
|
876
|
+
let n = this.fastMap.get(t);
|
|
877
|
+
if (!n)
|
|
878
|
+
return;
|
|
879
|
+
let r = n.parent;
|
|
880
|
+
for (let a of this.traverse())
|
|
881
|
+
a !== n && n.nodeToRestore && a.nodeToRestore && n.scopeRef && n.scopeRef.current && w(a.nodeToRestore, n.scopeRef.current) && (a.nodeToRestore = n.nodeToRestore);
|
|
882
|
+
let o = n.children;
|
|
883
|
+
r && (r.removeChild(n), o.size > 0 && o.forEach((a) => r && r.addChild(a))), this.fastMap.delete(n.scopeRef);
|
|
884
|
+
}
|
|
885
|
+
// Pre Order Depth First
|
|
886
|
+
*traverse(t = this.root) {
|
|
887
|
+
if (t.scopeRef != null && (yield t), t.children.size > 0)
|
|
888
|
+
for (let n of t.children)
|
|
889
|
+
yield* this.traverse(n);
|
|
890
|
+
}
|
|
891
|
+
clone() {
|
|
892
|
+
var t;
|
|
893
|
+
let n = new ue();
|
|
894
|
+
var r;
|
|
895
|
+
for (let o of this.traverse())
|
|
896
|
+
n.addTreeNode(o.scopeRef, (r = (t = o.parent) === null || t === void 0 ? void 0 : t.scopeRef) !== null && r !== void 0 ? r : null, o.nodeToRestore);
|
|
897
|
+
return n;
|
|
898
|
+
}
|
|
899
|
+
constructor() {
|
|
900
|
+
this.fastMap = /* @__PURE__ */ new Map(), this.root = new oe({
|
|
901
|
+
scopeRef: null
|
|
902
|
+
}), this.fastMap.set(null, this.root);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
class oe {
|
|
906
|
+
addChild(t) {
|
|
907
|
+
this.children.add(t), t.parent = this;
|
|
908
|
+
}
|
|
909
|
+
removeChild(t) {
|
|
910
|
+
this.children.delete(t), t.parent = void 0;
|
|
911
|
+
}
|
|
912
|
+
constructor(t) {
|
|
913
|
+
this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
let m = new ue();
|
|
917
|
+
const T = [];
|
|
918
|
+
function kt(e, t) {
|
|
919
|
+
let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: a = !1, isKeyboardDismissDisabled: i = !1, shouldCloseOnInteractOutside: l } = e;
|
|
920
|
+
P(() => (o && T.push(t), () => {
|
|
921
|
+
let f = T.indexOf(t);
|
|
922
|
+
f >= 0 && T.splice(f, 1);
|
|
923
|
+
}), [
|
|
924
|
+
o,
|
|
925
|
+
t
|
|
926
|
+
]);
|
|
927
|
+
let d = () => {
|
|
928
|
+
T[T.length - 1] === t && n && n();
|
|
929
|
+
}, u = (f) => {
|
|
930
|
+
(!l || l(f.target)) && T[T.length - 1] === t && (f.stopPropagation(), f.preventDefault());
|
|
931
|
+
}, c = (f) => {
|
|
932
|
+
(!l || l(f.target)) && (T[T.length - 1] === t && (f.stopPropagation(), f.preventDefault()), d());
|
|
933
|
+
}, s = (f) => {
|
|
934
|
+
f.key === "Escape" && !i && !f.nativeEvent.isComposing && (f.stopPropagation(), f.preventDefault(), d());
|
|
935
|
+
};
|
|
936
|
+
ct({
|
|
937
|
+
ref: t,
|
|
938
|
+
onInteractOutside: a && o ? c : null,
|
|
939
|
+
onInteractOutsideStart: u
|
|
940
|
+
});
|
|
941
|
+
let { focusWithinProps: $ } = ut({
|
|
942
|
+
isDisabled: !r,
|
|
943
|
+
onBlurWithin: (f) => {
|
|
944
|
+
!f.relatedTarget || pt(f.relatedTarget) || (!l || l(f.relatedTarget)) && n();
|
|
945
|
+
}
|
|
946
|
+
}), v = (f) => {
|
|
947
|
+
f.target === f.currentTarget && f.preventDefault();
|
|
948
|
+
};
|
|
949
|
+
return {
|
|
950
|
+
overlayProps: {
|
|
951
|
+
onKeyDown: s,
|
|
952
|
+
...$
|
|
953
|
+
},
|
|
954
|
+
underlayProps: {
|
|
955
|
+
onPointerDown: v
|
|
956
|
+
}
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
const Z = typeof document < "u" && window.visualViewport, gt = /* @__PURE__ */ new Set([
|
|
960
|
+
"checkbox",
|
|
961
|
+
"radio",
|
|
962
|
+
"range",
|
|
963
|
+
"color",
|
|
964
|
+
"file",
|
|
965
|
+
"image",
|
|
966
|
+
"button",
|
|
967
|
+
"submit",
|
|
968
|
+
"reset"
|
|
969
|
+
]);
|
|
970
|
+
let R = 0, _;
|
|
971
|
+
function Ot(e = {}) {
|
|
972
|
+
let { isDisabled: t } = e;
|
|
973
|
+
h(() => {
|
|
974
|
+
if (!t)
|
|
975
|
+
return R++, R === 1 && (Ze() ? _ = Tt() : _ = yt()), () => {
|
|
976
|
+
R--, R === 0 && _();
|
|
977
|
+
};
|
|
978
|
+
}, [
|
|
979
|
+
t
|
|
980
|
+
]);
|
|
981
|
+
}
|
|
982
|
+
function yt() {
|
|
983
|
+
return ee(D(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), D(document.documentElement, "overflow", "hidden"));
|
|
984
|
+
}
|
|
985
|
+
function Tt() {
|
|
986
|
+
let e, t, n = (u) => {
|
|
987
|
+
e = we(u.target, !0), !(e === document.documentElement && e === document.body) && e instanceof HTMLElement && window.getComputedStyle(e).overscrollBehavior === "auto" && (t = D(e, "overscrollBehavior", "contain"));
|
|
988
|
+
}, r = (u) => {
|
|
989
|
+
if (!e || e === document.documentElement || e === document.body) {
|
|
990
|
+
u.preventDefault();
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
e.scrollHeight === e.clientHeight && e.scrollWidth === e.clientWidth && u.preventDefault();
|
|
994
|
+
}, o = (u) => {
|
|
995
|
+
let c = u.target;
|
|
996
|
+
pe(c) && c !== document.activeElement && (u.preventDefault(), l(), c.style.transform = "translateY(-2000px)", c.focus(), requestAnimationFrame(() => {
|
|
997
|
+
c.style.transform = "";
|
|
998
|
+
})), t && t();
|
|
999
|
+
}, a = (u) => {
|
|
1000
|
+
let c = u.target;
|
|
1001
|
+
pe(c) && (l(), c.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
|
1002
|
+
c.style.transform = "", Z && (Z.height < window.innerHeight ? requestAnimationFrame(() => {
|
|
1003
|
+
be(c);
|
|
1004
|
+
}) : Z.addEventListener("resize", () => be(c), {
|
|
1005
|
+
once: !0
|
|
1006
|
+
}));
|
|
1007
|
+
}));
|
|
1008
|
+
}, i = null, l = () => {
|
|
1009
|
+
if (i)
|
|
1010
|
+
return;
|
|
1011
|
+
let u = () => {
|
|
1012
|
+
window.scrollTo(0, 0);
|
|
1013
|
+
}, c = window.pageXOffset, s = window.pageYOffset;
|
|
1014
|
+
i = ee(k(window, "scroll", u), D(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), D(document.documentElement, "overflow", "hidden"), D(document.body, "marginTop", `-${s}px`), () => {
|
|
1015
|
+
window.scrollTo(c, s);
|
|
1016
|
+
}), window.scrollTo(0, 0);
|
|
1017
|
+
}, d = ee(k(document, "touchstart", n, {
|
|
1018
|
+
passive: !1,
|
|
1019
|
+
capture: !0
|
|
1020
|
+
}), k(document, "touchmove", r, {
|
|
1021
|
+
passive: !1,
|
|
1022
|
+
capture: !0
|
|
1023
|
+
}), k(document, "touchend", o, {
|
|
1024
|
+
passive: !1,
|
|
1025
|
+
capture: !0
|
|
1026
|
+
}), k(document, "focus", a, !0));
|
|
1027
|
+
return () => {
|
|
1028
|
+
t == null || t(), i == null || i(), d();
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
function D(e, t, n) {
|
|
1032
|
+
let r = e.style[t];
|
|
1033
|
+
return e.style[t] = n, () => {
|
|
1034
|
+
e.style[t] = r;
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
function k(e, t, n, r) {
|
|
1038
|
+
return e.addEventListener(t, n, r), () => {
|
|
1039
|
+
e.removeEventListener(t, n, r);
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
function be(e) {
|
|
1043
|
+
let t = document.scrollingElement || document.documentElement;
|
|
1044
|
+
for (; e && e !== t; ) {
|
|
1045
|
+
let n = we(e);
|
|
1046
|
+
if (n !== document.documentElement && n !== document.body && n !== e) {
|
|
1047
|
+
let r = n.getBoundingClientRect().top, o = e.getBoundingClientRect().top;
|
|
1048
|
+
o > r + e.clientHeight && (n.scrollTop += o - r);
|
|
1049
|
+
}
|
|
1050
|
+
e = n.parentElement;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
function pe(e) {
|
|
1054
|
+
return e instanceof HTMLInputElement && !gt.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
|
|
1055
|
+
}
|
|
1056
|
+
const X = /* @__PURE__ */ p.createContext(null);
|
|
1057
|
+
function xt(e) {
|
|
1058
|
+
let { children: t } = e, n = L(X), [r, o] = Y(0), a = B(() => ({
|
|
1059
|
+
parent: n,
|
|
1060
|
+
modalCount: r,
|
|
1061
|
+
addModal() {
|
|
1062
|
+
o((i) => i + 1), n && n.addModal();
|
|
1063
|
+
},
|
|
1064
|
+
removeModal() {
|
|
1065
|
+
o((i) => i - 1), n && n.removeModal();
|
|
1066
|
+
}
|
|
1067
|
+
}), [
|
|
1068
|
+
n,
|
|
1069
|
+
r
|
|
1070
|
+
]);
|
|
1071
|
+
return /* @__PURE__ */ p.createElement(X.Provider, {
|
|
1072
|
+
value: a
|
|
1073
|
+
}, t);
|
|
1074
|
+
}
|
|
1075
|
+
function St() {
|
|
1076
|
+
let e = L(X);
|
|
1077
|
+
return {
|
|
1078
|
+
modalProviderProps: {
|
|
1079
|
+
"aria-hidden": e && e.modalCount > 0 ? !0 : null
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
function Lt(e) {
|
|
1084
|
+
let { modalProviderProps: t } = St();
|
|
1085
|
+
return /* @__PURE__ */ p.createElement("div", {
|
|
1086
|
+
"data-overlay-container": !0,
|
|
1087
|
+
...e,
|
|
1088
|
+
...t
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
function Nt(e) {
|
|
1092
|
+
return /* @__PURE__ */ p.createElement(xt, null, /* @__PURE__ */ p.createElement(Lt, e));
|
|
1093
|
+
}
|
|
1094
|
+
function Wt(e) {
|
|
1095
|
+
let t = he(), { portalContainer: n = t ? null : document.body, ...r } = e;
|
|
1096
|
+
if (p.useEffect(() => {
|
|
1097
|
+
if (n != null && n.closest("[data-overlay-container]"))
|
|
1098
|
+
throw new Error("An OverlayContainer must not be inside another container. Please change the portalContainer prop.");
|
|
1099
|
+
}, [
|
|
1100
|
+
n
|
|
1101
|
+
]), !n)
|
|
1102
|
+
return null;
|
|
1103
|
+
let o = /* @__PURE__ */ p.createElement(Nt, r);
|
|
1104
|
+
return /* @__PURE__ */ Ne.createPortal(o, n);
|
|
1105
|
+
}
|
|
1106
|
+
function At(e) {
|
|
1107
|
+
let t = L(X);
|
|
1108
|
+
if (!t)
|
|
1109
|
+
throw new Error("Modal is not contained within a provider");
|
|
1110
|
+
return P(() => {
|
|
1111
|
+
if (!(e != null && e.isDisabled || !t || !t.parent))
|
|
1112
|
+
return t.parent.addModal(), () => {
|
|
1113
|
+
t && t.parent && t.parent.removeModal();
|
|
1114
|
+
};
|
|
1115
|
+
}, [
|
|
1116
|
+
t,
|
|
1117
|
+
t.parent,
|
|
1118
|
+
e == null ? void 0 : e.isDisabled
|
|
1119
|
+
]), {
|
|
1120
|
+
modalProps: {
|
|
1121
|
+
"data-ismodal": !(e != null && e.isDisabled)
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
}
|
|
1125
|
+
const Mt = /* @__PURE__ */ p.createContext(null);
|
|
1126
|
+
function Pt() {
|
|
1127
|
+
let e = L(Mt), t = e == null ? void 0 : e.setContain;
|
|
1128
|
+
h(() => {
|
|
1129
|
+
t == null || t(!0);
|
|
1130
|
+
}, [
|
|
1131
|
+
t
|
|
1132
|
+
]);
|
|
1133
|
+
}
|
|
1134
|
+
function It(e, t) {
|
|
1135
|
+
let { role: n = "dialog" } = e, r = Re();
|
|
1136
|
+
r = e["aria-label"] ? void 0 : r;
|
|
1137
|
+
let o = g(!1);
|
|
1138
|
+
return P(() => {
|
|
1139
|
+
if (t.current && !t.current.contains(document.activeElement)) {
|
|
1140
|
+
re(t.current);
|
|
1141
|
+
let a = setTimeout(() => {
|
|
1142
|
+
document.activeElement === t.current && (o.current = !0, t.current && (t.current.blur(), re(t.current)), o.current = !1);
|
|
1143
|
+
}, 500);
|
|
1144
|
+
return () => {
|
|
1145
|
+
clearTimeout(a);
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
}, [
|
|
1149
|
+
t
|
|
1150
|
+
]), Pt(), {
|
|
1151
|
+
dialogProps: {
|
|
1152
|
+
...qe(e, {
|
|
1153
|
+
labelable: !0
|
|
1154
|
+
}),
|
|
1155
|
+
role: n,
|
|
1156
|
+
tabIndex: -1,
|
|
1157
|
+
"aria-labelledby": e["aria-labelledby"] || r,
|
|
1158
|
+
// Prevent blur events from reaching useOverlay, which may cause
|
|
1159
|
+
// popovers to close. Since focus is contained within the dialog,
|
|
1160
|
+
// we don't want this to occur due to the above useEffect.
|
|
1161
|
+
onBlur: (a) => {
|
|
1162
|
+
o.current && a.stopPropagation();
|
|
1163
|
+
}
|
|
1164
|
+
},
|
|
1165
|
+
titleProps: {
|
|
1166
|
+
id: r
|
|
1167
|
+
}
|
|
1168
|
+
};
|
|
1169
|
+
}
|
|
1170
|
+
export {
|
|
1171
|
+
xt as $,
|
|
1172
|
+
Nt as a,
|
|
1173
|
+
At as b,
|
|
1174
|
+
kt as c,
|
|
1175
|
+
It as d,
|
|
1176
|
+
Ot as e,
|
|
1177
|
+
Wt as f,
|
|
1178
|
+
Ft as g
|
|
1179
|
+
};
|
|
1180
|
+
//# sourceMappingURL=useDialog-DDVWB2iX.js.map
|