@sps-woodland/focused-task 8.1.0 → 8.1.1
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/lib/index.cjs.js +5 -5
- package/lib/index.es.js +311 -307
- package/package.json +7 -7
package/lib/index.es.js
CHANGED
@@ -1,51 +1,51 @@
|
|
1
1
|
import { Metadata as Se, cl as R, combineEventHandlers as fe, useChildTestIdAttrBuilder as ze, selectChildren as _e, modChildren as Ge, contentOf as pe } from "@sps-woodland/core";
|
2
2
|
import { Button as Ye } from "@sps-woodland/buttons";
|
3
|
-
import * as
|
4
|
-
import
|
3
|
+
import * as f from "react";
|
4
|
+
import h, { useState as V, useRef as y, useEffect as S, useCallback as T, useContext as H, useMemo as I } from "react";
|
5
5
|
import Ue from "react-dom";
|
6
6
|
import { code as me } from "@spscommerce/utils";
|
7
7
|
function Je(e, t, n) {
|
8
|
-
let [r, o] = V(e || t), a =
|
8
|
+
let [r, o] = V(e || t), a = y(e !== void 0), l = e !== void 0;
|
9
9
|
S(() => {
|
10
10
|
let s = a.current;
|
11
|
-
s !==
|
11
|
+
s !== l && console.warn(`WARN: A component changed from ${s ? "controlled" : "uncontrolled"} to ${l ? "controlled" : "uncontrolled"}.`), a.current = l;
|
12
12
|
}, [
|
13
|
-
|
13
|
+
l
|
14
14
|
]);
|
15
|
-
let c =
|
16
|
-
let
|
17
|
-
n && (Object.is(c, d) || n(d, ...
|
15
|
+
let c = l ? e : r, i = T((s, ...u) => {
|
16
|
+
let p = (d, ...m) => {
|
17
|
+
n && (Object.is(c, d) || n(d, ...m)), l || (c = d);
|
18
18
|
};
|
19
|
-
typeof s == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), o((
|
20
|
-
let F = s(
|
21
|
-
return
|
22
|
-
})) : (
|
19
|
+
typeof s == "function" ? (console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320"), o((m, ...b) => {
|
20
|
+
let F = s(l ? c : m, ...b);
|
21
|
+
return p(F, ...u), l ? m : F;
|
22
|
+
})) : (l || o(s), p(s, ...u));
|
23
23
|
}, [
|
24
|
-
|
24
|
+
l,
|
25
25
|
c,
|
26
26
|
n
|
27
27
|
]);
|
28
28
|
return [
|
29
29
|
c,
|
30
|
-
|
30
|
+
i
|
31
31
|
];
|
32
32
|
}
|
33
33
|
const _ = {
|
34
34
|
prefix: String(Math.round(Math.random() * 1e10)),
|
35
35
|
current: 0
|
36
|
-
}, Fe = /* @__PURE__ */
|
36
|
+
}, Fe = /* @__PURE__ */ h.createContext(_), Xe = /* @__PURE__ */ h.createContext(!1);
|
37
37
|
let Qe = Boolean(typeof window < "u" && window.document && window.document.createElement), Z = /* @__PURE__ */ new WeakMap();
|
38
38
|
function Ze(e = !1) {
|
39
|
-
let t = H(Fe), n =
|
39
|
+
let t = H(Fe), n = y(null);
|
40
40
|
if (n.current === null && !e) {
|
41
41
|
var r, o;
|
42
|
-
let a = (o =
|
42
|
+
let a = (o = h.__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;
|
43
43
|
if (a) {
|
44
|
-
let
|
45
|
-
|
44
|
+
let l = Z.get(a);
|
45
|
+
l == null ? Z.set(a, {
|
46
46
|
id: t.current,
|
47
47
|
state: a.memoizedState
|
48
|
-
}) : a.memoizedState !==
|
48
|
+
}) : a.memoizedState !== l.state && (t.current = l.id, Z.delete(a));
|
49
49
|
}
|
50
50
|
n.current = ++t.current;
|
51
51
|
}
|
@@ -58,10 +58,10 @@ function et(e) {
|
|
58
58
|
return e || `${r}-${n}`;
|
59
59
|
}
|
60
60
|
function tt(e) {
|
61
|
-
let t =
|
61
|
+
let t = h.useId(), [n] = V(Pe()), r = n || process.env.NODE_ENV === "test" ? "react-aria" : `react-aria${_.prefix}`;
|
62
62
|
return e || `${r}-${t}`;
|
63
63
|
}
|
64
|
-
const nt = typeof
|
64
|
+
const nt = typeof h.useId == "function" ? tt : et;
|
65
65
|
function rt() {
|
66
66
|
return !1;
|
67
67
|
}
|
@@ -73,31 +73,31 @@ function at(e) {
|
|
73
73
|
};
|
74
74
|
}
|
75
75
|
function Pe() {
|
76
|
-
return typeof
|
76
|
+
return typeof h.useSyncExternalStore == "function" ? h.useSyncExternalStore(at, rt, ot) : H(Xe);
|
77
77
|
}
|
78
|
-
function
|
78
|
+
function ke(e) {
|
79
79
|
var t, n, r = "";
|
80
80
|
if (typeof e == "string" || typeof e == "number")
|
81
81
|
r += e;
|
82
82
|
else if (typeof e == "object")
|
83
83
|
if (Array.isArray(e))
|
84
84
|
for (t = 0; t < e.length; t++)
|
85
|
-
e[t] && (n =
|
85
|
+
e[t] && (n = ke(e[t])) && (r && (r += " "), r += n);
|
86
86
|
else
|
87
87
|
for (t in e)
|
88
88
|
e[t] && (r && (r += " "), r += t);
|
89
89
|
return r;
|
90
90
|
}
|
91
|
-
function
|
91
|
+
function lt() {
|
92
92
|
for (var e, t, n = 0, r = ""; n < arguments.length; )
|
93
|
-
(e = arguments[n++]) && (t =
|
93
|
+
(e = arguments[n++]) && (t = ke(e)) && (r && (r += " "), r += t);
|
94
94
|
return r;
|
95
95
|
}
|
96
|
-
const
|
96
|
+
const g = typeof document < "u" ? h.useLayoutEffect : () => {
|
97
97
|
};
|
98
98
|
function W(e) {
|
99
|
-
const t =
|
100
|
-
return
|
99
|
+
const t = y(null);
|
100
|
+
return g(() => {
|
101
101
|
t.current = e;
|
102
102
|
}, [
|
103
103
|
e
|
@@ -106,20 +106,20 @@ function W(e) {
|
|
106
106
|
return r(...n);
|
107
107
|
}, []);
|
108
108
|
}
|
109
|
-
function
|
110
|
-
let [t, n] = V(e), r =
|
111
|
-
let
|
112
|
-
if (
|
109
|
+
function it(e) {
|
110
|
+
let [t, n] = V(e), r = y(null), o = W(() => {
|
111
|
+
let l = r.current.next();
|
112
|
+
if (l.done) {
|
113
113
|
r.current = null;
|
114
114
|
return;
|
115
115
|
}
|
116
|
-
t ===
|
116
|
+
t === l.value ? o() : n(l.value);
|
117
117
|
});
|
118
|
-
|
118
|
+
g(() => {
|
119
119
|
r.current && o();
|
120
120
|
});
|
121
|
-
let a = W((
|
122
|
-
r.current =
|
121
|
+
let a = W((l) => {
|
122
|
+
r.current = l(t), o();
|
123
123
|
});
|
124
124
|
return [
|
125
125
|
t,
|
@@ -127,20 +127,20 @@ function lt(e) {
|
|
127
127
|
];
|
128
128
|
}
|
129
129
|
let ct = Boolean(typeof window < "u" && window.document && window.document.createElement), G = /* @__PURE__ */ new Map();
|
130
|
-
function
|
131
|
-
let [t, n] = V(e), r =
|
132
|
-
r.current =
|
130
|
+
function Ce(e) {
|
131
|
+
let [t, n] = V(e), r = y(null), o = nt(t), a = T((l) => {
|
132
|
+
r.current = l;
|
133
133
|
}, []);
|
134
|
-
return ct && G.set(o, a),
|
135
|
-
let
|
134
|
+
return ct && G.set(o, a), g(() => {
|
135
|
+
let l = o;
|
136
136
|
return () => {
|
137
|
-
G.delete(
|
137
|
+
G.delete(l);
|
138
138
|
};
|
139
139
|
}, [
|
140
140
|
o
|
141
141
|
]), S(() => {
|
142
|
-
let
|
143
|
-
|
142
|
+
let l = r.current;
|
143
|
+
l && (r.current = null, n(l));
|
144
144
|
}), o;
|
145
145
|
}
|
146
146
|
function st(e, t) {
|
@@ -153,7 +153,7 @@ function st(e, t) {
|
|
153
153
|
return r ? (r(e), e) : t;
|
154
154
|
}
|
155
155
|
function ut(e = []) {
|
156
|
-
let t =
|
156
|
+
let t = Ce(), [n, r] = it(t), o = T(() => {
|
157
157
|
r(function* () {
|
158
158
|
yield t, yield document.getElementById(t) ? t : void 0;
|
159
159
|
});
|
@@ -161,7 +161,7 @@ function ut(e = []) {
|
|
161
161
|
t,
|
162
162
|
r
|
163
163
|
]);
|
164
|
-
return
|
164
|
+
return g(o, [
|
165
165
|
t,
|
166
166
|
o,
|
167
167
|
...e
|
@@ -184,8 +184,8 @@ function ft(...e) {
|
|
184
184
|
for (let n = 1; n < e.length; n++) {
|
185
185
|
let r = e[n];
|
186
186
|
for (let o in r) {
|
187
|
-
let a = t[o],
|
188
|
-
typeof a == "function" && typeof
|
187
|
+
let a = t[o], l = r[o];
|
188
|
+
typeof a == "function" && typeof l == "function" && o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= 65 && o.charCodeAt(2) <= 90 ? t[o] = Y(a, l) : (o === "className" || o === "UNSAFE_className") && typeof a == "string" && typeof l == "string" ? t[o] = lt(a, l) : o === "id" && a && l ? t.id = st(a, l) : t[o] = l !== void 0 ? l : a;
|
189
189
|
}
|
190
190
|
}
|
191
191
|
return t;
|
@@ -207,8 +207,8 @@ const pt = /* @__PURE__ */ new Set([
|
|
207
207
|
]), vt = /^(data-.*)$/;
|
208
208
|
function $t(e, t = {}) {
|
209
209
|
let { labelable: n, isLink: r, propNames: o } = t, a = {};
|
210
|
-
for (const
|
211
|
-
Object.prototype.hasOwnProperty.call(e,
|
210
|
+
for (const l in e)
|
211
|
+
Object.prototype.hasOwnProperty.call(e, l) && (pt.has(l) || n && mt.has(l) || r && bt.has(l) || (o == null ? void 0 : o.has(l)) || vt.test(l)) && (a[l] = e[l]);
|
212
212
|
return a;
|
213
213
|
}
|
214
214
|
function be(e) {
|
@@ -254,28 +254,28 @@ function Et(e) {
|
|
254
254
|
for (let { element: t, scrollTop: n, scrollLeft: r } of e)
|
255
255
|
t.scrollTop = n, t.scrollLeft = r;
|
256
256
|
}
|
257
|
-
function
|
257
|
+
function yt(e) {
|
258
258
|
var t;
|
259
259
|
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);
|
260
260
|
}
|
261
|
-
function
|
261
|
+
function le(e) {
|
262
262
|
var t;
|
263
263
|
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;
|
264
264
|
}
|
265
|
-
function
|
266
|
-
return
|
265
|
+
function Le() {
|
266
|
+
return le(/^Mac/i);
|
267
267
|
}
|
268
|
-
function
|
269
|
-
return
|
268
|
+
function wt() {
|
269
|
+
return le(/^iPhone/i);
|
270
270
|
}
|
271
271
|
function Tt() {
|
272
|
-
return
|
272
|
+
return le(/^iPad/i) || Le() && navigator.maxTouchPoints > 1;
|
273
273
|
}
|
274
274
|
function xt() {
|
275
|
-
return
|
275
|
+
return wt() || Tt();
|
276
276
|
}
|
277
277
|
function Nt() {
|
278
|
-
return
|
278
|
+
return yt(/Android/i);
|
279
279
|
}
|
280
280
|
let O = /* @__PURE__ */ new Map(), ne = /* @__PURE__ */ new Set();
|
281
281
|
function ve() {
|
@@ -312,7 +312,7 @@ function $e(e) {
|
|
312
312
|
function Ft(e) {
|
313
313
|
return e.mozInputSource === 0 && e.isTrusted ? !0 : Nt() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
314
314
|
}
|
315
|
-
const Me =
|
315
|
+
const Me = h.createContext({
|
316
316
|
register: () => {
|
317
317
|
}
|
318
318
|
});
|
@@ -322,11 +322,11 @@ function Pt({ children: e }) {
|
|
322
322
|
register: () => {
|
323
323
|
}
|
324
324
|
}), []);
|
325
|
-
return /* @__PURE__ */
|
325
|
+
return /* @__PURE__ */ h.createElement(Me.Provider, {
|
326
326
|
value: t
|
327
327
|
}, e);
|
328
328
|
}
|
329
|
-
class
|
329
|
+
class kt {
|
330
330
|
isDefaultPrevented() {
|
331
331
|
return this.nativeEvent.defaultPrevented;
|
332
332
|
}
|
@@ -345,12 +345,12 @@ class Ct {
|
|
345
345
|
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;
|
346
346
|
}
|
347
347
|
}
|
348
|
-
function
|
349
|
-
let t =
|
348
|
+
function Ct(e) {
|
349
|
+
let t = y({
|
350
350
|
isFocused: !1,
|
351
351
|
observer: null
|
352
352
|
});
|
353
|
-
|
353
|
+
g(() => {
|
354
354
|
const r = t.current;
|
355
355
|
return () => {
|
356
356
|
r.observer && (r.observer.disconnect(), r.observer = null);
|
@@ -362,15 +362,15 @@ function Lt(e) {
|
|
362
362
|
return T((r) => {
|
363
363
|
if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
|
364
364
|
t.current.isFocused = !0;
|
365
|
-
let o = r.target, a = (
|
366
|
-
t.current.isFocused = !1, o.disabled && n(new
|
365
|
+
let o = r.target, a = (l) => {
|
366
|
+
t.current.isFocused = !1, o.disabled && n(new kt("blur", l)), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
|
367
367
|
};
|
368
368
|
o.addEventListener("focusout", a, {
|
369
369
|
once: !0
|
370
370
|
}), t.current.observer = new MutationObserver(() => {
|
371
371
|
if (t.current.isFocused && o.disabled) {
|
372
|
-
var
|
373
|
-
(
|
372
|
+
var l;
|
373
|
+
(l = t.current.observer) === null || l === void 0 || l.disconnect();
|
374
374
|
let c = o === document.activeElement ? null : document.activeElement;
|
375
375
|
o.dispatchEvent(new FocusEvent("blur", {
|
376
376
|
relatedTarget: c
|
@@ -390,51 +390,51 @@ function Lt(e) {
|
|
390
390
|
n
|
391
391
|
]);
|
392
392
|
}
|
393
|
-
let K = null,
|
394
|
-
function
|
395
|
-
for (let n of
|
393
|
+
let K = null, Lt = /* @__PURE__ */ new Set(), he = !1, C = !1, re = !1;
|
394
|
+
function ie(e, t) {
|
395
|
+
for (let n of Lt)
|
396
396
|
n(e, t);
|
397
397
|
}
|
398
398
|
function Ot(e) {
|
399
|
-
return !(e.metaKey || !
|
399
|
+
return !(e.metaKey || !Le() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
400
400
|
}
|
401
401
|
function ge(e) {
|
402
|
-
|
402
|
+
C = !0, Ot(e) && (K = "keyboard", ie("keyboard", e));
|
403
403
|
}
|
404
|
-
function
|
405
|
-
K = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (
|
404
|
+
function L(e) {
|
405
|
+
K = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (C = !0, ie("pointer", e));
|
406
406
|
}
|
407
407
|
function Mt(e) {
|
408
|
-
Ft(e) && (
|
408
|
+
Ft(e) && (C = !0, K = "virtual");
|
409
409
|
}
|
410
410
|
function Dt(e) {
|
411
|
-
e.target === window || e.target === document || (!
|
411
|
+
e.target === window || e.target === document || (!C && !re && (K = "virtual", ie("virtual", e)), C = !1, re = !1);
|
412
412
|
}
|
413
413
|
function At() {
|
414
|
-
|
414
|
+
C = !1, re = !0;
|
415
415
|
}
|
416
416
|
function Ee() {
|
417
417
|
if (typeof window > "u" || he)
|
418
418
|
return;
|
419
419
|
let e = HTMLElement.prototype.focus;
|
420
420
|
HTMLElement.prototype.focus = function() {
|
421
|
-
|
422
|
-
}, document.addEventListener("keydown", ge, !0), document.addEventListener("keyup", ge, !0), document.addEventListener("click", Mt, !0), window.addEventListener("focus", Dt, !0), window.addEventListener("blur", At, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown",
|
421
|
+
C = !0, e.apply(this, arguments);
|
422
|
+
}, document.addEventListener("keydown", ge, !0), document.addEventListener("keyup", ge, !0), document.addEventListener("click", Mt, !0), window.addEventListener("focus", Dt, !0), window.addEventListener("blur", At, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", L, !0), document.addEventListener("pointermove", L, !0), document.addEventListener("pointerup", L, !0)) : (document.addEventListener("mousedown", L, !0), document.addEventListener("mousemove", L, !0), document.addEventListener("mouseup", L, !0)), he = !0;
|
423
423
|
}
|
424
424
|
typeof document < "u" && (document.readyState !== "loading" ? Ee() : document.addEventListener("DOMContentLoaded", Ee));
|
425
425
|
function Rt() {
|
426
426
|
return K;
|
427
427
|
}
|
428
428
|
function It(e) {
|
429
|
-
let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, a =
|
429
|
+
let { isDisabled: t, onBlurWithin: n, onFocusWithin: r, onFocusWithinChange: o } = e, a = y({
|
430
430
|
isFocusWithin: !1
|
431
|
-
}),
|
431
|
+
}), l = T((s) => {
|
432
432
|
a.current.isFocusWithin && !s.currentTarget.contains(s.relatedTarget) && (a.current.isFocusWithin = !1, n && n(s), o && o(!1));
|
433
433
|
}, [
|
434
434
|
n,
|
435
435
|
o,
|
436
436
|
a
|
437
|
-
]), c =
|
437
|
+
]), c = Ct(l), i = T((s) => {
|
438
438
|
!a.current.isFocusWithin && document.activeElement === s.target && (r && r(s), o && o(!0), a.current.isFocusWithin = !0, c(s));
|
439
439
|
}, [
|
440
440
|
r,
|
@@ -448,46 +448,46 @@ function It(e) {
|
|
448
448
|
}
|
449
449
|
} : {
|
450
450
|
focusWithinProps: {
|
451
|
-
onFocus:
|
452
|
-
onBlur:
|
451
|
+
onFocus: i,
|
452
|
+
onBlur: l
|
453
453
|
}
|
454
454
|
};
|
455
455
|
}
|
456
456
|
function Bt(e) {
|
457
|
-
let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, a =
|
457
|
+
let { ref: t, onInteractOutside: n, isDisabled: r, onInteractOutsideStart: o } = e, a = y({
|
458
458
|
isPointerDown: !1,
|
459
459
|
ignoreEmulatedMouseEvents: !1
|
460
|
-
}),
|
461
|
-
n && j(
|
462
|
-
}), c = W((
|
463
|
-
n && n(
|
460
|
+
}), l = W((i) => {
|
461
|
+
n && j(i, t) && (o && o(i), a.current.isPointerDown = !0);
|
462
|
+
}), c = W((i) => {
|
463
|
+
n && n(i);
|
464
464
|
});
|
465
465
|
S(() => {
|
466
|
-
let
|
466
|
+
let i = a.current;
|
467
467
|
if (r)
|
468
468
|
return;
|
469
469
|
const s = t.current, u = dt(s);
|
470
470
|
if (typeof PointerEvent < "u") {
|
471
|
-
let
|
472
|
-
|
471
|
+
let p = (d) => {
|
472
|
+
i.isPointerDown && j(d, t) && c(d), i.isPointerDown = !1;
|
473
473
|
};
|
474
|
-
return u.addEventListener("pointerdown",
|
475
|
-
u.removeEventListener("pointerdown",
|
474
|
+
return u.addEventListener("pointerdown", l, !0), u.addEventListener("pointerup", p, !0), () => {
|
475
|
+
u.removeEventListener("pointerdown", l, !0), u.removeEventListener("pointerup", p, !0);
|
476
476
|
};
|
477
477
|
} else {
|
478
|
-
let
|
479
|
-
|
480
|
-
}, d = (
|
481
|
-
|
478
|
+
let p = (m) => {
|
479
|
+
i.ignoreEmulatedMouseEvents ? i.ignoreEmulatedMouseEvents = !1 : i.isPointerDown && j(m, t) && c(m), i.isPointerDown = !1;
|
480
|
+
}, d = (m) => {
|
481
|
+
i.ignoreEmulatedMouseEvents = !0, i.isPointerDown && j(m, t) && c(m), i.isPointerDown = !1;
|
482
482
|
};
|
483
|
-
return u.addEventListener("mousedown",
|
484
|
-
u.removeEventListener("mousedown",
|
483
|
+
return u.addEventListener("mousedown", l, !0), u.addEventListener("mouseup", p, !0), u.addEventListener("touchstart", l, !0), u.addEventListener("touchend", d, !0), () => {
|
484
|
+
u.removeEventListener("mousedown", l, !0), u.removeEventListener("mouseup", p, !0), u.removeEventListener("touchstart", l, !0), u.removeEventListener("touchend", d, !0);
|
485
485
|
};
|
486
486
|
}
|
487
487
|
}, [
|
488
488
|
t,
|
489
489
|
r,
|
490
|
-
|
490
|
+
l,
|
491
491
|
c
|
492
492
|
]);
|
493
493
|
}
|
@@ -516,8 +516,8 @@ function Wt(e) {
|
|
516
516
|
let { display: t, visibility: n } = e.style, r = t !== "none" && n !== "hidden" && n !== "collapse";
|
517
517
|
if (r) {
|
518
518
|
const { getComputedStyle: o } = e.ownerDocument.defaultView;
|
519
|
-
let { display: a, visibility:
|
520
|
-
r = a !== "none" &&
|
519
|
+
let { display: a, visibility: l } = o(e);
|
520
|
+
r = a !== "none" && l !== "hidden" && l !== "collapse";
|
521
521
|
}
|
522
522
|
return r;
|
523
523
|
}
|
@@ -527,108 +527,108 @@ function Vt(e, t) {
|
|
527
527
|
function De(e, t) {
|
528
528
|
return e.nodeName !== "#comment" && Wt(e) && Vt(e, t) && (!e.parentElement || De(e.parentElement, e));
|
529
529
|
}
|
530
|
-
const
|
531
|
-
let
|
530
|
+
const ye = /* @__PURE__ */ h.createContext(null);
|
531
|
+
let v = null;
|
532
532
|
function Ht(e) {
|
533
|
-
let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, a =
|
533
|
+
let { children: t, contain: n, restoreFocus: r, autoFocus: o } = e, a = y(null), l = y(null), c = y([]), { parentNode: i } = H(ye) || {}, s = I(() => new ae({
|
534
534
|
scopeRef: c
|
535
535
|
}), [
|
536
536
|
c
|
537
537
|
]);
|
538
|
-
|
539
|
-
let d =
|
540
|
-
if (
|
541
|
-
let
|
542
|
-
|
538
|
+
g(() => {
|
539
|
+
let d = i || $.root;
|
540
|
+
if ($.getTreeNode(d.scopeRef) && v && !J(v, d.scopeRef)) {
|
541
|
+
let m = $.getTreeNode(v);
|
542
|
+
m && (d = m);
|
543
543
|
}
|
544
|
-
d.addChild(s),
|
544
|
+
d.addChild(s), $.addNode(s);
|
545
545
|
}, [
|
546
546
|
s,
|
547
|
-
|
548
|
-
]),
|
549
|
-
let d =
|
547
|
+
i
|
548
|
+
]), g(() => {
|
549
|
+
let d = $.getTreeNode(c);
|
550
550
|
d && (d.contain = !!n);
|
551
551
|
}, [
|
552
552
|
n
|
553
|
-
]),
|
553
|
+
]), g(() => {
|
554
554
|
var d;
|
555
|
-
let
|
556
|
-
for (;
|
557
|
-
|
558
|
-
c.current =
|
555
|
+
let m = (d = a.current) === null || d === void 0 ? void 0 : d.nextSibling, b = [];
|
556
|
+
for (; m && m !== l.current; )
|
557
|
+
b.push(m), m = m.nextSibling;
|
558
|
+
c.current = b;
|
559
559
|
}, [
|
560
560
|
t
|
561
561
|
]), Yt(c, r, n), zt(c, n), Jt(c, r, n), Gt(c, o), S(() => {
|
562
|
-
let d = document.activeElement,
|
562
|
+
let d = document.activeElement, m = null;
|
563
563
|
if (E(d, c.current)) {
|
564
|
-
for (let
|
565
|
-
|
566
|
-
|
564
|
+
for (let b of $.traverse())
|
565
|
+
b.scopeRef && E(d, b.scopeRef.current) && (m = b);
|
566
|
+
m === $.getTreeNode(c) && (v = m.scopeRef);
|
567
567
|
}
|
568
568
|
}, [
|
569
569
|
c
|
570
|
-
]),
|
571
|
-
var d,
|
572
|
-
let F = (
|
573
|
-
(c ===
|
570
|
+
]), g(() => () => {
|
571
|
+
var d, m, b;
|
572
|
+
let F = (b = (m = $.getTreeNode(c)) === null || m === void 0 || (d = m.parent) === null || d === void 0 ? void 0 : d.scopeRef) !== null && b !== void 0 ? b : null;
|
573
|
+
(c === v || J(c, v)) && (!F || $.getTreeNode(F)) && (v = F), $.removeTreeNode(c);
|
574
574
|
}, [
|
575
575
|
c
|
576
576
|
]);
|
577
|
-
let u = I(() => Kt(c), []),
|
577
|
+
let u = I(() => Kt(c), []), p = I(() => ({
|
578
578
|
focusManager: u,
|
579
579
|
parentNode: s
|
580
580
|
}), [
|
581
581
|
s,
|
582
582
|
u
|
583
583
|
]);
|
584
|
-
return /* @__PURE__ */
|
585
|
-
value:
|
586
|
-
}, /* @__PURE__ */
|
584
|
+
return /* @__PURE__ */ h.createElement(ye.Provider, {
|
585
|
+
value: p
|
586
|
+
}, /* @__PURE__ */ h.createElement("span", {
|
587
587
|
"data-focus-scope-start": !0,
|
588
588
|
hidden: !0,
|
589
589
|
ref: a
|
590
|
-
}), t, /* @__PURE__ */
|
590
|
+
}), t, /* @__PURE__ */ h.createElement("span", {
|
591
591
|
"data-focus-scope-end": !0,
|
592
592
|
hidden: !0,
|
593
|
-
ref:
|
593
|
+
ref: l
|
594
594
|
}));
|
595
595
|
}
|
596
596
|
function Kt(e) {
|
597
597
|
return {
|
598
598
|
focusNext(t = {}) {
|
599
|
-
let n = e.current, { from: r, tabbable: o, wrap: a, accept:
|
599
|
+
let n = e.current, { from: r, tabbable: o, wrap: a, accept: l } = t, c = r || document.activeElement, i = n[0].previousElementSibling, s = k(n), u = P(s, {
|
600
600
|
tabbable: o,
|
601
|
-
accept:
|
601
|
+
accept: l
|
602
602
|
}, n);
|
603
|
-
u.currentNode = E(c, n) ? c :
|
604
|
-
let
|
605
|
-
return !
|
603
|
+
u.currentNode = E(c, n) ? c : i;
|
604
|
+
let p = u.nextNode();
|
605
|
+
return !p && a && (u.currentNode = i, p = u.nextNode()), p && N(p, !0), p;
|
606
606
|
},
|
607
607
|
focusPrevious(t = {}) {
|
608
|
-
let n = e.current, { from: r, tabbable: o, wrap: a, accept:
|
608
|
+
let n = e.current, { from: r, tabbable: o, wrap: a, accept: l } = t, c = r || document.activeElement, i = n[n.length - 1].nextElementSibling, s = k(n), u = P(s, {
|
609
609
|
tabbable: o,
|
610
|
-
accept:
|
610
|
+
accept: l
|
611
611
|
}, n);
|
612
|
-
u.currentNode = E(c, n) ? c :
|
613
|
-
let
|
614
|
-
return !
|
612
|
+
u.currentNode = E(c, n) ? c : i;
|
613
|
+
let p = u.previousNode();
|
614
|
+
return !p && a && (u.currentNode = i, p = u.previousNode()), p && N(p, !0), p;
|
615
615
|
},
|
616
616
|
focusFirst(t = {}) {
|
617
|
-
let n = e.current, { tabbable: r, accept: o } = t, a =
|
617
|
+
let n = e.current, { tabbable: r, accept: o } = t, a = k(n), l = P(a, {
|
618
618
|
tabbable: r,
|
619
619
|
accept: o
|
620
620
|
}, n);
|
621
|
-
|
622
|
-
let c =
|
621
|
+
l.currentNode = n[0].previousElementSibling;
|
622
|
+
let c = l.nextNode();
|
623
623
|
return c && N(c, !0), c;
|
624
624
|
},
|
625
625
|
focusLast(t = {}) {
|
626
|
-
let n = e.current, { tabbable: r, accept: o } = t, a =
|
626
|
+
let n = e.current, { tabbable: r, accept: o } = t, a = k(n), l = P(a, {
|
627
627
|
tabbable: r,
|
628
628
|
accept: o
|
629
629
|
}, n);
|
630
|
-
|
631
|
-
let c =
|
630
|
+
l.currentNode = n[n.length - 1].nextElementSibling;
|
631
|
+
let c = l.previousNode();
|
632
632
|
return c && N(c, !0), c;
|
633
633
|
}
|
634
634
|
};
|
@@ -650,11 +650,11 @@ const ce = [
|
|
650
650
|
], qt = ce.join(":not([hidden]),") + ",[tabindex]:not([disabled]):not([hidden])";
|
651
651
|
ce.push('[tabindex]:not([tabindex="-1"]):not([disabled])');
|
652
652
|
const jt = ce.join(':not([hidden]):not([tabindex="-1"]),');
|
653
|
-
function
|
653
|
+
function k(e) {
|
654
654
|
return e[0].parentElement;
|
655
655
|
}
|
656
656
|
function A(e) {
|
657
|
-
let t =
|
657
|
+
let t = $.getTreeNode(v);
|
658
658
|
for (; t && t.scopeRef !== e; ) {
|
659
659
|
if (t.contain)
|
660
660
|
return !1;
|
@@ -663,46 +663,46 @@ function A(e) {
|
|
663
663
|
return !0;
|
664
664
|
}
|
665
665
|
function zt(e, t) {
|
666
|
-
let n =
|
667
|
-
|
666
|
+
let n = y(), r = y();
|
667
|
+
g(() => {
|
668
668
|
let o = e.current;
|
669
669
|
if (!t) {
|
670
670
|
r.current && (cancelAnimationFrame(r.current), r.current = void 0);
|
671
671
|
return;
|
672
672
|
}
|
673
|
-
let a = (
|
674
|
-
if (
|
673
|
+
let a = (i) => {
|
674
|
+
if (i.key !== "Tab" || i.altKey || i.ctrlKey || i.metaKey || !A(e))
|
675
675
|
return;
|
676
676
|
let s = document.activeElement, u = e.current;
|
677
677
|
if (!u || !E(s, u))
|
678
678
|
return;
|
679
|
-
let
|
679
|
+
let p = k(u), d = P(p, {
|
680
680
|
tabbable: !0
|
681
681
|
}, u);
|
682
682
|
if (!s)
|
683
683
|
return;
|
684
684
|
d.currentNode = s;
|
685
|
-
let
|
686
|
-
|
687
|
-
},
|
688
|
-
(!
|
689
|
-
}, c = (
|
685
|
+
let m = i.shiftKey ? d.previousNode() : d.nextNode();
|
686
|
+
m || (d.currentNode = i.shiftKey ? u[u.length - 1].nextElementSibling : u[0].previousElementSibling, m = i.shiftKey ? d.previousNode() : d.nextNode()), i.preventDefault(), m && N(m, !0);
|
687
|
+
}, l = (i) => {
|
688
|
+
(!v || J(v, e)) && E(i.target, e.current) ? (v = e, n.current = i.target) : A(e) && !U(i.target, e) ? n.current ? n.current.focus() : v && v.current && X(v.current) : A(e) && (n.current = i.target);
|
689
|
+
}, c = (i) => {
|
690
690
|
r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
|
691
691
|
if (document.activeElement && A(e) && !U(document.activeElement, e))
|
692
|
-
if (
|
692
|
+
if (v = e, document.body.contains(i.target)) {
|
693
693
|
var s;
|
694
|
-
n.current =
|
694
|
+
n.current = i.target, (s = n.current) === null || s === void 0 || s.focus();
|
695
695
|
} else
|
696
|
-
|
696
|
+
v.current && X(v.current);
|
697
697
|
});
|
698
698
|
};
|
699
|
-
return document.addEventListener("keydown", a, !1), document.addEventListener("focusin",
|
700
|
-
document.removeEventListener("keydown", a, !1), document.removeEventListener("focusin",
|
699
|
+
return document.addEventListener("keydown", a, !1), document.addEventListener("focusin", l, !1), o == null || o.forEach((i) => i.addEventListener("focusin", l, !1)), o == null || o.forEach((i) => i.addEventListener("focusout", c, !1)), () => {
|
700
|
+
document.removeEventListener("keydown", a, !1), document.removeEventListener("focusin", l, !1), o == null || o.forEach((i) => i.removeEventListener("focusin", l, !1)), o == null || o.forEach((i) => i.removeEventListener("focusout", c, !1));
|
701
701
|
};
|
702
702
|
}, [
|
703
703
|
e,
|
704
704
|
t
|
705
|
-
]),
|
705
|
+
]), g(() => () => {
|
706
706
|
r.current && cancelAnimationFrame(r.current);
|
707
707
|
}, [
|
708
708
|
r
|
@@ -717,17 +717,17 @@ function E(e, t) {
|
|
717
717
|
function U(e, t = null) {
|
718
718
|
if (e instanceof Element && e.closest("[data-react-aria-top-layer]"))
|
719
719
|
return !0;
|
720
|
-
for (let { scopeRef: n } of
|
720
|
+
for (let { scopeRef: n } of $.traverse($.getTreeNode(t)))
|
721
721
|
if (n && E(e, n.current))
|
722
722
|
return !0;
|
723
723
|
return !1;
|
724
724
|
}
|
725
725
|
function _t(e) {
|
726
|
-
return U(e,
|
726
|
+
return U(e, v);
|
727
727
|
}
|
728
728
|
function J(e, t) {
|
729
729
|
var n;
|
730
|
-
let r = (n =
|
730
|
+
let r = (n = $.getTreeNode(t)) === null || n === void 0 ? void 0 : n.parent;
|
731
731
|
for (; r; ) {
|
732
732
|
if (r.scopeRef === e)
|
733
733
|
return !0;
|
@@ -748,30 +748,30 @@ function N(e, t = !1) {
|
|
748
748
|
}
|
749
749
|
}
|
750
750
|
function X(e, t = !0) {
|
751
|
-
let n = e[0].previousElementSibling, r =
|
751
|
+
let n = e[0].previousElementSibling, r = k(e), o = P(r, {
|
752
752
|
tabbable: t
|
753
753
|
}, e);
|
754
754
|
o.currentNode = n;
|
755
755
|
let a = o.nextNode();
|
756
|
-
t && !a && (r =
|
756
|
+
t && !a && (r = k(e), o = P(r, {
|
757
757
|
tabbable: !1
|
758
758
|
}, e), o.currentNode = n, a = o.nextNode()), N(a);
|
759
759
|
}
|
760
760
|
function Gt(e, t) {
|
761
|
-
const n =
|
761
|
+
const n = h.useRef(t);
|
762
762
|
S(() => {
|
763
|
-
n.current && (
|
763
|
+
n.current && (v = e, !E(document.activeElement, v.current) && e.current && X(e.current)), n.current = !1;
|
764
764
|
}, [
|
765
765
|
e
|
766
766
|
]);
|
767
767
|
}
|
768
768
|
function Yt(e, t, n) {
|
769
|
-
|
769
|
+
g(() => {
|
770
770
|
if (t || n)
|
771
771
|
return;
|
772
772
|
let r = e.current, o = (a) => {
|
773
|
-
let
|
774
|
-
E(
|
773
|
+
let l = a.target;
|
774
|
+
E(l, e.current) ? v = e : Ae(l) || (v = null);
|
775
775
|
};
|
776
776
|
return document.addEventListener("focusin", o, !1), r == null || r.forEach((a) => a.addEventListener("focusin", o, !1)), () => {
|
777
777
|
document.removeEventListener("focusin", o, !1), r == null || r.forEach((a) => a.removeEventListener("focusin", o, !1));
|
@@ -783,7 +783,7 @@ function Yt(e, t, n) {
|
|
783
783
|
]);
|
784
784
|
}
|
785
785
|
function Ut(e) {
|
786
|
-
let t =
|
786
|
+
let t = $.getTreeNode(v);
|
787
787
|
for (; t && t.scopeRef !== e; ) {
|
788
788
|
if (t.nodeToRestore)
|
789
789
|
return !1;
|
@@ -792,43 +792,43 @@ function Ut(e) {
|
|
792
792
|
return (t == null ? void 0 : t.scopeRef) === e;
|
793
793
|
}
|
794
794
|
function Jt(e, t, n) {
|
795
|
-
const r =
|
796
|
-
|
795
|
+
const r = y(typeof document < "u" ? document.activeElement : null);
|
796
|
+
g(() => {
|
797
797
|
let o = e.current;
|
798
798
|
if (!t || n)
|
799
799
|
return;
|
800
800
|
let a = () => {
|
801
|
-
(!
|
801
|
+
(!v || J(v, e)) && E(document.activeElement, e.current) && (v = e);
|
802
802
|
};
|
803
|
-
return document.addEventListener("focusin", a, !1), o == null || o.forEach((
|
804
|
-
document.removeEventListener("focusin", a, !1), o == null || o.forEach((
|
803
|
+
return document.addEventListener("focusin", a, !1), o == null || o.forEach((l) => l.addEventListener("focusin", a, !1)), () => {
|
804
|
+
document.removeEventListener("focusin", a, !1), o == null || o.forEach((l) => l.removeEventListener("focusin", a, !1));
|
805
805
|
};
|
806
806
|
}, [
|
807
807
|
e,
|
808
808
|
n
|
809
|
-
]),
|
809
|
+
]), g(() => {
|
810
810
|
if (!t)
|
811
811
|
return;
|
812
812
|
let o = (a) => {
|
813
813
|
if (a.key !== "Tab" || a.altKey || a.ctrlKey || a.metaKey || !A(e))
|
814
814
|
return;
|
815
|
-
let
|
816
|
-
if (!E(
|
815
|
+
let l = document.activeElement;
|
816
|
+
if (!E(l, e.current))
|
817
817
|
return;
|
818
|
-
let c =
|
818
|
+
let c = $.getTreeNode(e);
|
819
819
|
if (!c)
|
820
820
|
return;
|
821
|
-
let
|
821
|
+
let i = c.nodeToRestore, s = P(document.body, {
|
822
822
|
tabbable: !0
|
823
823
|
});
|
824
|
-
s.currentNode =
|
824
|
+
s.currentNode = l;
|
825
825
|
let u = a.shiftKey ? s.previousNode() : s.nextNode();
|
826
|
-
if ((!
|
827
|
-
s.currentNode =
|
826
|
+
if ((!i || !document.body.contains(i) || i === document.body) && (i = void 0, c.nodeToRestore = void 0), (!u || !E(u, e.current)) && i) {
|
827
|
+
s.currentNode = i;
|
828
828
|
do
|
829
829
|
u = a.shiftKey ? s.previousNode() : s.nextNode();
|
830
830
|
while (E(u, e.current));
|
831
|
-
a.preventDefault(), a.stopPropagation(), u ? N(u, !0) : Ae(
|
831
|
+
a.preventDefault(), a.stopPropagation(), u ? N(u, !0) : Ae(i) ? N(i, !0) : l.blur();
|
832
832
|
}
|
833
833
|
};
|
834
834
|
return n || document.addEventListener("keydown", o, !0), () => {
|
@@ -838,22 +838,22 @@ function Jt(e, t, n) {
|
|
838
838
|
e,
|
839
839
|
t,
|
840
840
|
n
|
841
|
-
]),
|
841
|
+
]), g(() => {
|
842
842
|
if (!t)
|
843
843
|
return;
|
844
|
-
let o =
|
844
|
+
let o = $.getTreeNode(e);
|
845
845
|
if (!!o) {
|
846
846
|
var a;
|
847
847
|
return o.nodeToRestore = (a = r.current) !== null && a !== void 0 ? a : void 0, () => {
|
848
|
-
let
|
849
|
-
if (!
|
848
|
+
let l = $.getTreeNode(e);
|
849
|
+
if (!l)
|
850
850
|
return;
|
851
|
-
let c =
|
851
|
+
let c = l.nodeToRestore;
|
852
852
|
if (t && c && (E(document.activeElement, e.current) || document.activeElement === document.body && Ut(e))) {
|
853
|
-
let
|
853
|
+
let i = $.clone();
|
854
854
|
requestAnimationFrame(() => {
|
855
855
|
if (document.activeElement === document.body) {
|
856
|
-
let s =
|
856
|
+
let s = i.getTreeNode(e);
|
857
857
|
for (; s; ) {
|
858
858
|
if (s.nodeToRestore && document.body.contains(s.nodeToRestore)) {
|
859
859
|
N(s.nodeToRestore);
|
@@ -861,8 +861,8 @@ function Jt(e, t, n) {
|
|
861
861
|
}
|
862
862
|
s = s.parent;
|
863
863
|
}
|
864
|
-
for (s =
|
865
|
-
if (s.scopeRef && s.scopeRef.current &&
|
864
|
+
for (s = i.getTreeNode(e); s; ) {
|
865
|
+
if (s.scopeRef && s.scopeRef.current && $.getTreeNode(s.scopeRef)) {
|
866
866
|
X(s.scopeRef.current, !0);
|
867
867
|
return;
|
868
868
|
}
|
@@ -881,8 +881,8 @@ function Jt(e, t, n) {
|
|
881
881
|
function P(e, t, n) {
|
882
882
|
let r = t != null && t.tabbable ? jt : qt, o = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
883
883
|
acceptNode(a) {
|
884
|
-
var
|
885
|
-
return !(t == null || (
|
884
|
+
var l;
|
885
|
+
return !(t == null || (l = t.from) === null || l === void 0) && l.contains(a) ? NodeFilter.FILTER_REJECT : a.matches(r) && De(a) && (!n || E(a, n)) && (!(t != null && t.accept) || t.accept(a)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
886
886
|
}
|
887
887
|
});
|
888
888
|
return t != null && t.from && (o.currentNode = t.from), o;
|
@@ -948,25 +948,25 @@ class ae {
|
|
948
948
|
this.children = /* @__PURE__ */ new Set(), this.contain = !1, this.scopeRef = t.scopeRef;
|
949
949
|
}
|
950
950
|
}
|
951
|
-
let
|
951
|
+
let $ = new se();
|
952
952
|
const Xt = /* @__PURE__ */ new WeakMap(), x = [];
|
953
953
|
function Qt(e, t) {
|
954
|
-
let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: a = !1, isKeyboardDismissDisabled:
|
954
|
+
let { onClose: n, shouldCloseOnBlur: r, isOpen: o, isDismissable: a = !1, isKeyboardDismissDisabled: l = !1, shouldCloseOnInteractOutside: c } = e;
|
955
955
|
S(() => (o && x.push(t), () => {
|
956
|
-
let
|
957
|
-
|
956
|
+
let b = x.indexOf(t);
|
957
|
+
b >= 0 && x.splice(b, 1);
|
958
958
|
}), [
|
959
959
|
o,
|
960
960
|
t
|
961
961
|
]);
|
962
|
-
let
|
962
|
+
let i = () => {
|
963
963
|
x[x.length - 1] === t && n && n();
|
964
|
-
}, s = (
|
965
|
-
(!c || c(
|
966
|
-
}, u = (
|
967
|
-
(!c || c(
|
968
|
-
},
|
969
|
-
|
964
|
+
}, s = (b) => {
|
965
|
+
(!c || c(b.target)) && x[x.length - 1] === t && (b.stopPropagation(), b.preventDefault());
|
966
|
+
}, u = (b) => {
|
967
|
+
(!c || c(b.target)) && (x[x.length - 1] === t && (b.stopPropagation(), b.preventDefault()), i());
|
968
|
+
}, p = (b) => {
|
969
|
+
b.key === "Escape" && !l && (b.stopPropagation(), b.preventDefault(), i());
|
970
970
|
};
|
971
971
|
Bt({
|
972
972
|
ref: t,
|
@@ -975,19 +975,19 @@ function Qt(e, t) {
|
|
975
975
|
});
|
976
976
|
let { focusWithinProps: d } = It({
|
977
977
|
isDisabled: !r,
|
978
|
-
onBlurWithin: (
|
979
|
-
!
|
978
|
+
onBlurWithin: (b) => {
|
979
|
+
!b.relatedTarget || _t(b.relatedTarget) || (!c || c(b.relatedTarget)) && n();
|
980
980
|
}
|
981
|
-
}),
|
982
|
-
|
981
|
+
}), m = (b) => {
|
982
|
+
b.target === b.currentTarget && b.preventDefault();
|
983
983
|
};
|
984
984
|
return {
|
985
985
|
overlayProps: {
|
986
|
-
onKeyDown:
|
986
|
+
onKeyDown: p,
|
987
987
|
...d
|
988
988
|
},
|
989
989
|
underlayProps: {
|
990
|
-
onPointerDown:
|
990
|
+
onPointerDown: m
|
991
991
|
}
|
992
992
|
};
|
993
993
|
}
|
@@ -998,16 +998,16 @@ function Zt(e, t, n) {
|
|
998
998
|
});
|
999
999
|
let a;
|
1000
1000
|
r === "menu" ? a = !0 : r === "listbox" && (a = "listbox");
|
1001
|
-
let
|
1001
|
+
let l = Ce();
|
1002
1002
|
return {
|
1003
1003
|
triggerProps: {
|
1004
1004
|
"aria-haspopup": a,
|
1005
1005
|
"aria-expanded": o,
|
1006
|
-
"aria-controls": o ?
|
1006
|
+
"aria-controls": o ? l : null,
|
1007
1007
|
onPress: t.toggle
|
1008
1008
|
},
|
1009
1009
|
overlayProps: {
|
1010
|
-
id:
|
1010
|
+
id: l
|
1011
1011
|
}
|
1012
1012
|
};
|
1013
1013
|
}
|
@@ -1025,7 +1025,7 @@ const ee = typeof document < "u" && window.visualViewport, en = /* @__PURE__ */
|
|
1025
1025
|
let z = 0, te;
|
1026
1026
|
function tn(e = {}) {
|
1027
1027
|
let { isDisabled: t } = e;
|
1028
|
-
|
1028
|
+
g(() => {
|
1029
1029
|
if (!t)
|
1030
1030
|
return z++, z === 1 && (xt() ? te = rn() : te = nn()), () => {
|
1031
1031
|
z--, z === 0 && te();
|
@@ -1038,32 +1038,32 @@ function nn() {
|
|
1038
1038
|
return Y(B(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), B(document.documentElement, "overflow", "hidden"));
|
1039
1039
|
}
|
1040
1040
|
function rn() {
|
1041
|
-
let e, t = 0, n = (
|
1042
|
-
e = Oe(
|
1043
|
-
}, r = (
|
1041
|
+
let e, t = 0, n = (p) => {
|
1042
|
+
e = Oe(p.target), !(e === document.documentElement && e === document.body) && (t = p.changedTouches[0].pageY);
|
1043
|
+
}, r = (p) => {
|
1044
1044
|
if (!e || e === document.documentElement || e === document.body) {
|
1045
|
-
|
1045
|
+
p.preventDefault();
|
1046
1046
|
return;
|
1047
1047
|
}
|
1048
|
-
let d =
|
1049
|
-
|
1050
|
-
}, o = (
|
1051
|
-
let d =
|
1052
|
-
Te(d) && d !== document.activeElement && (
|
1048
|
+
let d = p.changedTouches[0].pageY, m = e.scrollTop, b = e.scrollHeight - e.clientHeight;
|
1049
|
+
b !== 0 && ((m <= 0 && d > t || m >= b && d < t) && p.preventDefault(), t = d);
|
1050
|
+
}, o = (p) => {
|
1051
|
+
let d = p.target;
|
1052
|
+
Te(d) && d !== document.activeElement && (p.preventDefault(), d.style.transform = "translateY(-2000px)", d.focus(), requestAnimationFrame(() => {
|
1053
1053
|
d.style.transform = "";
|
1054
1054
|
}));
|
1055
|
-
}, a = (
|
1056
|
-
let d =
|
1055
|
+
}, a = (p) => {
|
1056
|
+
let d = p.target;
|
1057
1057
|
Te(d) && (d.style.transform = "translateY(-2000px)", requestAnimationFrame(() => {
|
1058
1058
|
d.style.transform = "", ee && (ee.height < window.innerHeight ? requestAnimationFrame(() => {
|
1059
|
-
|
1060
|
-
}) : ee.addEventListener("resize", () =>
|
1059
|
+
we(d);
|
1060
|
+
}) : ee.addEventListener("resize", () => we(d), {
|
1061
1061
|
once: !0
|
1062
1062
|
}));
|
1063
1063
|
}));
|
1064
|
-
},
|
1064
|
+
}, l = () => {
|
1065
1065
|
window.scrollTo(0, 0);
|
1066
|
-
}, c = window.pageXOffset,
|
1066
|
+
}, c = window.pageXOffset, i = window.pageYOffset, s = Y(B(document.documentElement, "paddingRight", `${window.innerWidth - document.documentElement.clientWidth}px`), B(document.documentElement, "overflow", "hidden"), B(document.body, "marginTop", `-${i}px`));
|
1067
1067
|
window.scrollTo(0, 0);
|
1068
1068
|
let u = Y(M(document, "touchstart", n, {
|
1069
1069
|
passive: !1,
|
@@ -1074,9 +1074,9 @@ function rn() {
|
|
1074
1074
|
}), M(document, "touchend", o, {
|
1075
1075
|
passive: !1,
|
1076
1076
|
capture: !0
|
1077
|
-
}), M(document, "focus", a, !0), M(window, "scroll",
|
1077
|
+
}), M(document, "focus", a, !0), M(window, "scroll", l));
|
1078
1078
|
return () => {
|
1079
|
-
s(), u(), window.scrollTo(c,
|
1079
|
+
s(), u(), window.scrollTo(c, i);
|
1080
1080
|
};
|
1081
1081
|
}
|
1082
1082
|
function B(e, t, n) {
|
@@ -1090,7 +1090,7 @@ function M(e, t, n, r) {
|
|
1090
1090
|
e.removeEventListener(t, n, r);
|
1091
1091
|
};
|
1092
1092
|
}
|
1093
|
-
function
|
1093
|
+
function we(e) {
|
1094
1094
|
let t = document.scrollingElement || document.documentElement;
|
1095
1095
|
for (; e && e !== t; ) {
|
1096
1096
|
let n = Oe(e);
|
@@ -1104,34 +1104,34 @@ function ye(e) {
|
|
1104
1104
|
function Te(e) {
|
1105
1105
|
return e instanceof HTMLInputElement && !en.has(e.type) || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable;
|
1106
1106
|
}
|
1107
|
-
let D = /* @__PURE__ */ new WeakMap(),
|
1107
|
+
let D = /* @__PURE__ */ new WeakMap(), w = [];
|
1108
1108
|
function on(e, t = document.body) {
|
1109
|
-
let n = new Set(e), r = /* @__PURE__ */ new Set(), o = (
|
1110
|
-
for (let d of
|
1109
|
+
let n = new Set(e), r = /* @__PURE__ */ new Set(), o = (i) => {
|
1110
|
+
for (let d of i.querySelectorAll("[data-live-announcer], [data-react-aria-top-layer]"))
|
1111
1111
|
n.add(d);
|
1112
1112
|
let s = (d) => {
|
1113
1113
|
if (n.has(d) || r.has(d.parentElement) && d.parentElement.getAttribute("role") !== "row")
|
1114
1114
|
return NodeFilter.FILTER_REJECT;
|
1115
|
-
for (let
|
1116
|
-
if (d.contains(
|
1115
|
+
for (let m of n)
|
1116
|
+
if (d.contains(m))
|
1117
1117
|
return NodeFilter.FILTER_SKIP;
|
1118
1118
|
return NodeFilter.FILTER_ACCEPT;
|
1119
|
-
}, u = document.createTreeWalker(
|
1119
|
+
}, u = document.createTreeWalker(i, NodeFilter.SHOW_ELEMENT, {
|
1120
1120
|
acceptNode: s
|
1121
|
-
}),
|
1122
|
-
if (
|
1121
|
+
}), p = s(i);
|
1122
|
+
if (p === NodeFilter.FILTER_ACCEPT && a(i), p !== NodeFilter.FILTER_REJECT) {
|
1123
1123
|
let d = u.nextNode();
|
1124
1124
|
for (; d != null; )
|
1125
1125
|
a(d), d = u.nextNode();
|
1126
1126
|
}
|
1127
|
-
}, a = (
|
1127
|
+
}, a = (i) => {
|
1128
1128
|
var s;
|
1129
|
-
let u = (s = D.get(
|
1130
|
-
|
1129
|
+
let u = (s = D.get(i)) !== null && s !== void 0 ? s : 0;
|
1130
|
+
i.getAttribute("aria-hidden") === "true" && u === 0 || (u === 0 && i.setAttribute("aria-hidden", "true"), r.add(i), D.set(i, u + 1));
|
1131
1131
|
};
|
1132
|
-
|
1133
|
-
let
|
1134
|
-
for (let s of
|
1132
|
+
w.length && w[w.length - 1].disconnect(), o(t);
|
1133
|
+
let l = new MutationObserver((i) => {
|
1134
|
+
for (let s of i)
|
1135
1135
|
if (!(s.type !== "childList" || s.addedNodes.length === 0) && ![
|
1136
1136
|
...n,
|
1137
1137
|
...r
|
@@ -1142,33 +1142,33 @@ function on(e, t = document.body) {
|
|
1142
1142
|
(u instanceof HTMLElement || u instanceof SVGElement) && (u.dataset.liveAnnouncer === "true" || u.dataset.reactAriaTopLayer === "true") ? n.add(u) : u instanceof Element && o(u);
|
1143
1143
|
}
|
1144
1144
|
});
|
1145
|
-
|
1145
|
+
l.observe(t, {
|
1146
1146
|
childList: !0,
|
1147
1147
|
subtree: !0
|
1148
1148
|
});
|
1149
1149
|
let c = {
|
1150
1150
|
observe() {
|
1151
|
-
|
1151
|
+
l.observe(t, {
|
1152
1152
|
childList: !0,
|
1153
1153
|
subtree: !0
|
1154
1154
|
});
|
1155
1155
|
},
|
1156
1156
|
disconnect() {
|
1157
|
-
|
1157
|
+
l.disconnect();
|
1158
1158
|
}
|
1159
1159
|
};
|
1160
|
-
return
|
1161
|
-
|
1162
|
-
for (let
|
1163
|
-
let s = D.get(
|
1164
|
-
s === 1 ? (
|
1160
|
+
return w.push(c), () => {
|
1161
|
+
l.disconnect();
|
1162
|
+
for (let i of r) {
|
1163
|
+
let s = D.get(i);
|
1164
|
+
s === 1 ? (i.removeAttribute("aria-hidden"), D.delete(i)) : D.set(i, s - 1);
|
1165
1165
|
}
|
1166
|
-
c ===
|
1166
|
+
c === w[w.length - 1] ? (w.pop(), w.length && w[w.length - 1].observe()) : w.splice(w.indexOf(c), 1);
|
1167
1167
|
};
|
1168
1168
|
}
|
1169
|
-
const Re = /* @__PURE__ */
|
1169
|
+
const Re = /* @__PURE__ */ h.createContext(null);
|
1170
1170
|
function an(e) {
|
1171
|
-
let t = Pe(), { portalContainer: n = t ? null : document.body, isExiting: r } = e, [o, a] = V(!1),
|
1171
|
+
let t = Pe(), { portalContainer: n = t ? null : document.body, isExiting: r } = e, [o, a] = V(!1), l = I(() => ({
|
1172
1172
|
contain: o,
|
1173
1173
|
setContain: a
|
1174
1174
|
}), [
|
@@ -1178,16 +1178,16 @@ function an(e) {
|
|
1178
1178
|
if (!n)
|
1179
1179
|
return null;
|
1180
1180
|
let c = e.children;
|
1181
|
-
return e.disableFocusManagement || (c = /* @__PURE__ */
|
1181
|
+
return e.disableFocusManagement || (c = /* @__PURE__ */ h.createElement(Ht, {
|
1182
1182
|
restoreFocus: !0,
|
1183
1183
|
contain: o && !r
|
1184
|
-
}, c)), c = /* @__PURE__ */
|
1185
|
-
value:
|
1186
|
-
}, /* @__PURE__ */
|
1184
|
+
}, c)), c = /* @__PURE__ */ h.createElement(Re.Provider, {
|
1185
|
+
value: l
|
1186
|
+
}, /* @__PURE__ */ h.createElement(Pt, null, c)), /* @__PURE__ */ Ue.createPortal(c, n);
|
1187
1187
|
}
|
1188
1188
|
function Ie() {
|
1189
1189
|
let e = H(Re), t = e == null ? void 0 : e.setContain;
|
1190
|
-
|
1190
|
+
g(() => {
|
1191
1191
|
t == null || t(!0);
|
1192
1192
|
}, [
|
1193
1193
|
t
|
@@ -1217,7 +1217,7 @@ function ln(e, t, n) {
|
|
1217
1217
|
function cn(e, t) {
|
1218
1218
|
let { role: n = "dialog" } = e, r = ut();
|
1219
1219
|
r = e["aria-label"] ? void 0 : r;
|
1220
|
-
let o =
|
1220
|
+
let o = y(!1);
|
1221
1221
|
return S(() => {
|
1222
1222
|
if (t.current && !t.current.contains(document.activeElement)) {
|
1223
1223
|
oe(t.current);
|
@@ -1286,12 +1286,12 @@ var un = (e, t, n) => {
|
|
1286
1286
|
}, dn = (e) => (t) => {
|
1287
1287
|
var n = e.defaultClassName, r = Ne(Ne({}, e.defaultVariants), t);
|
1288
1288
|
for (var o in r) {
|
1289
|
-
var a,
|
1290
|
-
if (
|
1291
|
-
var c =
|
1289
|
+
var a, l = (a = r[o]) !== null && a !== void 0 ? a : e.defaultVariants[o];
|
1290
|
+
if (l != null) {
|
1291
|
+
var c = l;
|
1292
1292
|
typeof c == "boolean" && (c = c === !0 ? "true" : "false");
|
1293
|
-
var
|
1294
|
-
|
1293
|
+
var i = e.variantClassNames[o][c];
|
1294
|
+
i && (n += " " + i);
|
1295
1295
|
}
|
1296
1296
|
}
|
1297
1297
|
for (var [s, u] of e.compoundVariants)
|
@@ -1303,31 +1303,31 @@ function Be({
|
|
1303
1303
|
className: t = "",
|
1304
1304
|
...n
|
1305
1305
|
}) {
|
1306
|
-
return /* @__PURE__ */
|
1306
|
+
return /* @__PURE__ */ f.createElement("div", { className: R(hn, t), ...n }, /* @__PURE__ */ f.createElement("div", { className: R(vn) }, /* @__PURE__ */ f.createElement("div", { className: R($n) }, e)));
|
1307
1307
|
}
|
1308
1308
|
Se.set(Be, { name: "FocusedTaskActions" });
|
1309
|
-
function
|
1309
|
+
function yn({
|
1310
1310
|
children: e,
|
1311
1311
|
className: t,
|
1312
1312
|
"data-testid": n,
|
1313
1313
|
onBlur: r,
|
1314
1314
|
onFocus: o,
|
1315
1315
|
overlayProps: a,
|
1316
|
-
state:
|
1316
|
+
state: l,
|
1317
1317
|
onClose: c,
|
1318
|
-
fullWidth:
|
1318
|
+
fullWidth: i = !1,
|
1319
1319
|
...s
|
1320
1320
|
}) {
|
1321
|
-
const u =
|
1321
|
+
const u = f.useRef(null), { modalProps: p, underlayProps: d } = ln(
|
1322
1322
|
{ ...s },
|
1323
|
-
|
1323
|
+
l,
|
1324
1324
|
u
|
1325
|
-
), { dialogProps:
|
1325
|
+
), { dialogProps: m, titleProps: b } = cn(s, u), F = fe(p.onFocus, m.onFocus, o), Ve = fe(p.onBlur, m.onBlur, r), He = ze({ "data-testid": n }), [Q, Ke] = _e(e, [{ type: Be }]);
|
1326
1326
|
function qe() {
|
1327
|
-
c && typeof c == "function" && c(),
|
1327
|
+
c && typeof c == "function" && c(), l.close();
|
1328
1328
|
}
|
1329
1329
|
const ue = function() {
|
1330
|
-
return /* @__PURE__ */
|
1330
|
+
return /* @__PURE__ */ f.createElement(
|
1331
1331
|
Ye,
|
1332
1332
|
{
|
1333
1333
|
"aria-label": "Close",
|
@@ -1338,11 +1338,11 @@ function wn({
|
|
1338
1338
|
}
|
1339
1339
|
);
|
1340
1340
|
}, je = Ge(Ke, (de) => de.type === ue ? [{ className: R(de.props.classname, mn) }] : []);
|
1341
|
-
return /* @__PURE__ */
|
1341
|
+
return /* @__PURE__ */ f.createElement(an, null, /* @__PURE__ */ f.createElement("div", { className: En, ...d, ...s }, /* @__PURE__ */ f.createElement(
|
1342
1342
|
"div",
|
1343
1343
|
{
|
1344
|
-
...f,
|
1345
1344
|
...p,
|
1345
|
+
...m,
|
1346
1346
|
...a,
|
1347
1347
|
onFocus: F,
|
1348
1348
|
onBlur: Ve,
|
@@ -1350,13 +1350,13 @@ function wn({
|
|
1350
1350
|
ref: u,
|
1351
1351
|
className: R(bn, t)
|
1352
1352
|
},
|
1353
|
-
/* @__PURE__ */
|
1354
|
-
/* @__PURE__ */
|
1355
|
-
Q && Q.length > 0 && /* @__PURE__ */
|
1353
|
+
/* @__PURE__ */ f.createElement("div", { ...b, className: gn }, /* @__PURE__ */ f.createElement(ue, null)),
|
1354
|
+
/* @__PURE__ */ f.createElement("div", { className: fn({ fullWidth: i }) }, pe(je, l.close)),
|
1355
|
+
Q && Q.length > 0 && /* @__PURE__ */ f.createElement(f.Fragment, null, pe(Q, l.close))
|
1356
1356
|
)));
|
1357
1357
|
}
|
1358
1358
|
function We(e) {
|
1359
|
-
return e.state.isOpen ? /* @__PURE__ */
|
1359
|
+
return e.state.isOpen ? /* @__PURE__ */ f.createElement(yn, { ...e }, e.children) : /* @__PURE__ */ f.createElement(f.Fragment, null);
|
1360
1360
|
}
|
1361
1361
|
Se.set(We, {
|
1362
1362
|
name: "FocusedTask",
|
@@ -1367,7 +1367,7 @@ Se.set(We, {
|
|
1367
1367
|
onFocus: { type: "() => void" }
|
1368
1368
|
}
|
1369
1369
|
});
|
1370
|
-
function
|
1370
|
+
function wn(e) {
|
1371
1371
|
let [t, n] = Je(e.isOpen, e.defaultOpen || !1, e.onOpenChange);
|
1372
1372
|
const r = T(() => {
|
1373
1373
|
n(!0);
|
@@ -1391,11 +1391,11 @@ function yn(e) {
|
|
1391
1391
|
toggle: a
|
1392
1392
|
};
|
1393
1393
|
}
|
1394
|
-
function
|
1395
|
-
const t =
|
1394
|
+
function kn(e = {}) {
|
1395
|
+
const t = wn(e), n = y(null), { triggerProps: r, overlayProps: o } = Zt({ type: "dialog" }, t, n), { onPress: a, ...l } = r;
|
1396
1396
|
return {
|
1397
1397
|
triggerProps: {
|
1398
|
-
...
|
1398
|
+
...l,
|
1399
1399
|
onClick: a,
|
1400
1400
|
ref: n
|
1401
1401
|
},
|
@@ -1406,12 +1406,16 @@ function Cn(e = {}) {
|
|
1406
1406
|
const Tn = {
|
1407
1407
|
components: [We],
|
1408
1408
|
examples: {
|
1409
|
+
hooks: {
|
1410
|
+
label: "Using the Hook",
|
1411
|
+
description: () => /* @__PURE__ */ f.createElement(f.Fragment, null, /* @__PURE__ */ f.createElement("p", null, "To use the focused task component, you must call the ", /* @__PURE__ */ f.createElement("code", null, "useFocusedTask"), " hook. Optional arguments for this hook include:"), /* @__PURE__ */ f.createElement("dl", null, /* @__PURE__ */ f.createElement("dt", null, /* @__PURE__ */ f.createElement("code", null, "isOpen"), ": boolean"), /* @__PURE__ */ f.createElement("dd", null, "Whether the overlay is open by default (controlled)"), /* @__PURE__ */ f.createElement("dt", null, /* @__PURE__ */ f.createElement("code", null, "defaultOpen"), ": boolean"), /* @__PURE__ */ f.createElement("dd", null, "Whether the overlay is open by default (uncontrolled)."), /* @__PURE__ */ f.createElement("dt", null, /* @__PURE__ */ f.createElement("code", null, "onOpenChange"), ": function"), /* @__PURE__ */ f.createElement("dd", null, "Handler that is called when the overlay's open state changes.", /* @__PURE__ */ f.createElement("code", null, "(isOpen: boolean) => void"))), /* @__PURE__ */ f.createElement("h5", null, "Focused Task Props, Focused Task State, and Trigger Props"), /* @__PURE__ */ f.createElement("p", null, "The ", /* @__PURE__ */ f.createElement("code", null, "useFocusedTask"), " returns an object with ", /* @__PURE__ */ f.createElement("code", null, "focusedTaskProps"), ",", " ", /* @__PURE__ */ f.createElement("code", null, "focusedTaskState"), " and ", /* @__PURE__ */ f.createElement("code", null, "triggerProps")), /* @__PURE__ */ f.createElement("p", null, "The ", /* @__PURE__ */ f.createElement("code", null, "triggerProps"), " need to be spread on the element that triggers the focused task."), /* @__PURE__ */ f.createElement("p", null, "The ", /* @__PURE__ */ f.createElement("code", null, "focusedTaskState"), " object (which is also included in ", /* @__PURE__ */ f.createElement("code", null, "focusedTaskProps"), ") allows programmatic access to the state of the focused task. This includes a read only", " ", /* @__PURE__ */ f.createElement("code", null, "isOpen"), " property, a ", /* @__PURE__ */ f.createElement("code", null, "setOpen(isOpen: boolean)"), " method which can be use to set whether the overlay is open, an ", /* @__PURE__ */ f.createElement("code", null, "open()"), " method which opens the overlay, a ", /* @__PURE__ */ f.createElement("code", null, "close()"), " method which closes the overlay and a", " ", /* @__PURE__ */ f.createElement("code", null, "toggle()"), " method that toggles the overlay's visiblity."), /* @__PURE__ */ f.createElement("p", null, "The ", /* @__PURE__ */ f.createElement("code", null, "focusedTaskProps"), " should be spread on the actual ", /* @__PURE__ */ f.createElement("code", null, "FocusedTask"), " component."), /* @__PURE__ */ f.createElement("p", null, "Please refer to the examples to see its implementation"))
|
1412
|
+
},
|
1409
1413
|
standard: {
|
1410
1414
|
label: "Standard",
|
1411
1415
|
examples: {
|
1412
1416
|
basic: {
|
1413
1417
|
react: me`
|
1414
|
-
import { FocusedTask, FocusedTaskActions } from "@sps-woodland/focused-task";
|
1418
|
+
import { FocusedTask, FocusedTaskActions, useFocusedTask } from "@sps-woodland/focused-task";
|
1415
1419
|
import { Button } from "@sps-woodland/buttons";
|
1416
1420
|
import { Card } from "@sps-woodland/cards";
|
1417
1421
|
import { grid } from "@sps-woodland/tokens";
|
@@ -1457,7 +1461,7 @@ const Tn = {
|
|
1457
1461
|
examples: {
|
1458
1462
|
basic: {
|
1459
1463
|
react: me`
|
1460
|
-
import { FocusedTask, FocusedTaskActions } from "@sps-woodland/focused-task";
|
1464
|
+
import { FocusedTask, FocusedTaskActions, useFocusedTask } from "@sps-woodland/focused-task";
|
1461
1465
|
import { Button } from "@sps-woodland/buttons";
|
1462
1466
|
import { Card } from "@sps-woodland/cards";
|
1463
1467
|
import { grid } from "@sps-woodland/tokens";
|
@@ -1500,12 +1504,12 @@ const Tn = {
|
|
1500
1504
|
}
|
1501
1505
|
}
|
1502
1506
|
}
|
1503
|
-
},
|
1507
|
+
}, Cn = {
|
1504
1508
|
"Focused Task": Tn
|
1505
1509
|
};
|
1506
1510
|
export {
|
1507
1511
|
We as FocusedTask,
|
1508
1512
|
Be as FocusedTaskActions,
|
1509
|
-
|
1510
|
-
|
1513
|
+
Cn as MANIFEST,
|
1514
|
+
kn as useFocusedTask
|
1511
1515
|
};
|