@forsyteco/product-ui 0.0.11 → 0.0.13
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/{active-element-history-BJ1HYFpN.mjs → active-element-history-B7wA4w4L.mjs} +3 -3
- package/dist/autocomplete/autocomplete.d.ts +87 -0
- package/dist/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete/index.cjs +1 -0
- package/dist/autocomplete/index.d.ts +4 -0
- package/dist/autocomplete/index.d.ts.map +1 -0
- package/dist/autocomplete/index.mjs +4 -0
- package/dist/autocomplete/types.d.ts +7 -0
- package/dist/autocomplete/types.d.ts.map +1 -0
- package/dist/autocomplete-DqDP76nV.mjs +318 -0
- package/dist/autocomplete-DuGKfbQn.js +1 -0
- package/dist/avatar/index.mjs +1 -1
- package/dist/{avatar-CN9vtSKm.mjs → avatar-Br4ih6PQ.mjs} +2 -2
- package/dist/breadcrumb/index.cjs +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/{breadcrumb-Bz_JVFcb.mjs → breadcrumb-C81R8CJz.mjs} +2 -2
- package/dist/{breadcrumb-y_RB72EG.js → breadcrumb-DJGlCCR1.js} +1 -1
- package/dist/{bugs-bn44RJ1Q.mjs → bugs-g7aYPtcD.mjs} +1 -1
- package/dist/calendar/calendar.d.ts.map +1 -1
- package/dist/calendar/index.cjs +1 -1
- package/dist/calendar/index.mjs +1 -1
- package/dist/{calendar-CAySGYDy.mjs → calendar-DQdo9vO-.mjs} +1058 -993
- package/dist/calendar-v2NOtsdr.js +1 -0
- package/dist/chevron-right-CIgI-iLu.js +1 -0
- package/dist/{chevron-right-DcjcIxI2.mjs → chevron-right-Ck5BtE5n.mjs} +11 -6
- package/dist/combobox/combobox.d.ts +72 -17
- package/dist/combobox/combobox.d.ts.map +1 -1
- package/dist/combobox/index.cjs +1 -1
- package/dist/combobox/index.d.ts +2 -1
- package/dist/combobox/index.d.ts.map +1 -1
- package/dist/combobox/index.mjs +1 -1
- package/dist/combobox/types.d.ts +7 -0
- package/dist/combobox/types.d.ts.map +1 -0
- package/dist/combobox-B1h2hn6a.js +4 -0
- package/dist/combobox-BHLjk9D9.mjs +293 -0
- package/dist/combobox-DxpuSWuM.js +1 -0
- package/dist/{combobox-Dyen_KC6.mjs → combobox-Umb1ZW9S.mjs} +358 -408
- package/dist/data-table/components/table-body.d.ts.map +1 -1
- package/dist/date-picker/date-picker.d.ts.map +1 -1
- package/dist/{description-CAH1nOgr.mjs → description-hiFZ303Y.mjs} +2 -2
- package/dist/dialog/index.mjs +1 -1
- package/dist/{dialog-nGcnK6o1.mjs → dialog-Cs7TMa7R.mjs} +53 -53
- package/dist/disclosure/index.cjs +1 -1
- package/dist/disclosure/index.mjs +1 -1
- package/dist/{disclosure-CA45jH3I.mjs → disclosure-DOWglOHy.mjs} +8 -12
- package/dist/{disclosure-CGxPdR-8.js → disclosure-qEQ_kll8.js} +1 -1
- package/dist/dropdown-menu/index.cjs +1 -1
- package/dist/dropdown-menu/index.mjs +1 -1
- package/dist/{dropdown-menu-Bj9ftuBZ.mjs → dropdown-menu--aGYYbJi.mjs} +22 -30
- package/dist/dropdown-menu-B9fTvSZe.js +1 -0
- package/dist/{element-movement-B3AVr940.mjs → element-movement-Bad2OqSj.mjs} +4 -4
- package/dist/floating-C1n3e5u7.js +1 -0
- package/dist/{floating-dEgEvBqv.mjs → floating-DQ2M2ViQ.mjs} +429 -425
- package/dist/{focus-management-DUVCz_zm.mjs → focus-management-BGuC9pKE.mjs} +2 -2
- package/dist/{form-fields-CXtJvVC5.mjs → form-fields-Bpp9kTvo.mjs} +2 -2
- package/dist/{frozen-Cpa22rmr.mjs → frozen-CXF36eio.mjs} +2 -2
- package/dist/{hidden-Blo8kfIB.mjs → hidden-H5tOTsXH.mjs} +1 -1
- package/dist/{index-CuNisU0H.mjs → index-Dh75VhI6.mjs} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +769 -776
- package/dist/{keyboard-Bi11Rnr0.mjs → keyboard-BzaAKRwG.mjs} +1 -1
- package/dist/{label-DAaE-vxI.mjs → label--pGndX3z.mjs} +3 -3
- package/dist/listbox/index.cjs +1 -1
- package/dist/listbox/index.mjs +1 -1
- package/dist/{listbox-DZ4v8TYt.mjs → listbox-3DAgC6_y.mjs} +17 -21
- package/dist/{listbox-BIwbzCji.js → listbox-cpJossI7.js} +1 -1
- package/dist/{open-closed-BkH8ZC7H.mjs → open-closed-Be5nD5U2.mjs} +4 -4
- package/dist/popover/index.cjs +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/{popover-BAm_8SCx.mjs → popover-CZO6Afya.mjs} +22 -22
- package/dist/{popover-B5-dVDC1.js → popover-CysmX396.js} +1 -1
- package/dist/{portal-BaBdcS83.mjs → portal-D-TZOwvF.mjs} +6 -6
- package/dist/radio-group/index.cjs +1 -1
- package/dist/radio-group/index.mjs +1 -1
- package/dist/{radio-group-CTf6mrDs.mjs → radio-group-BIQWXrVI.mjs} +8 -8
- package/dist/{radio-group-d2V69c7t.js → radio-group-CbQAsBFv.js} +1 -1
- package/dist/sonner/index.cjs +1 -1
- package/dist/sonner/index.mjs +1 -1
- package/dist/{sonner-CuPfwlK5.js → sonner-BRjN2nJD.js} +1 -1
- package/dist/{sonner-Ce9PJbum.mjs → sonner-Cgc0p6ph.mjs} +3 -5
- package/dist/switch/index.cjs +1 -1
- package/dist/switch/index.mjs +1 -1
- package/dist/{switch-DqAuXwa2.js → switch-D0OrcI50.js} +1 -1
- package/dist/{switch-DKcD0IFH.mjs → switch-Eoi1pTsi.mjs} +13 -13
- package/dist/tabs/index.cjs +1 -1
- package/dist/tabs/index.mjs +1 -1
- package/dist/{tabs-DLqfQ301.mjs → tabs-Cufnu60W.mjs} +15 -15
- package/dist/{tabs-X4sPQQYs.js → tabs-TTkcVq-Q.js} +1 -1
- package/dist/transition/index.mjs +1 -1
- package/dist/{transition-B0MGuDho.mjs → transition-B4KhhkrB.mjs} +4 -4
- package/dist/{transition-D0HuUd2-.mjs → transition-Dfxdl8Si.mjs} +1 -1
- package/dist/{use-event-listener-BjXsgSkG.mjs → use-event-listener-BUA2xXRr.mjs} +1 -1
- package/dist/{use-inert-others-BCB16FKE.mjs → use-inert-others-CgSXXC-d.mjs} +3 -3
- package/dist/{use-is-mounted-COmayWN0.mjs → use-is-mounted-DJc35WXO.mjs} +1 -1
- package/dist/{use-resolve-button-type-637wy6MK.mjs → use-resolve-button-type-BhmWA6Dl.mjs} +2 -2
- package/dist/{use-sync-refs-B0fmGxD4.mjs → use-sync-refs-CDCE8QtA.mjs} +2 -2
- package/dist/{use-tab-direction-BTonGsg0.mjs → use-tab-direction-tJsn3ckX.mjs} +8 -8
- package/dist/{use-text-value-BMXU9EaO.mjs → use-text-value-BKEvykNe.mjs} +2 -2
- package/dist/{use-tree-walker-D25YXIMY.mjs → use-tree-walker-CHC6ccbq.mjs} +2 -2
- package/dist/useFocusRing-BM96K_1O.js +1 -0
- package/dist/useFocusRing-Df1NuOsX.mjs +497 -0
- package/package.json +32 -22
- package/dist/calendar-BIhWkTtG.js +0 -1
- package/dist/chevron-right-HwlOajQy.js +0 -1
- package/dist/combobox-Cm_xVD4l.js +0 -4
- package/dist/dropdown-menu-BPMdVlet.js +0 -1
- package/dist/floating-CTjRm9bt.js +0 -1
- package/dist/useFocusRing-Bocdsy5M.mjs +0 -446
- package/dist/useFocusRing-uXUSOfAR.js +0 -1
|
@@ -1,446 +0,0 @@
|
|
|
1
|
-
import j, { useRef as T, useCallback as b, useEffect as M, useState as S, useMemo as re } from "react";
|
|
2
|
-
const U = typeof document < "u" ? j.useLayoutEffect : () => {
|
|
3
|
-
};
|
|
4
|
-
var O;
|
|
5
|
-
const oe = (O = j.useInsertionEffect) !== null && O !== void 0 ? O : U;
|
|
6
|
-
function ie(e) {
|
|
7
|
-
const n = T(null);
|
|
8
|
-
return oe(() => {
|
|
9
|
-
n.current = e;
|
|
10
|
-
}, [
|
|
11
|
-
e
|
|
12
|
-
]), b((...t) => {
|
|
13
|
-
const r = n.current;
|
|
14
|
-
return r?.(...t);
|
|
15
|
-
}, []);
|
|
16
|
-
}
|
|
17
|
-
const h = (e) => {
|
|
18
|
-
var n;
|
|
19
|
-
return (n = e?.ownerDocument) !== null && n !== void 0 ? n : document;
|
|
20
|
-
}, y = (e) => e && "window" in e && e.window === e ? e : h(e).defaultView || window;
|
|
21
|
-
function ae(e) {
|
|
22
|
-
return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number";
|
|
23
|
-
}
|
|
24
|
-
function ue(e) {
|
|
25
|
-
return ae(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e;
|
|
26
|
-
}
|
|
27
|
-
let se = !1;
|
|
28
|
-
function I() {
|
|
29
|
-
return se;
|
|
30
|
-
}
|
|
31
|
-
function Y(e, n) {
|
|
32
|
-
if (!I()) return n && e ? e.contains(n) : !1;
|
|
33
|
-
if (!e || !n) return !1;
|
|
34
|
-
let t = n;
|
|
35
|
-
for (; t !== null; ) {
|
|
36
|
-
if (t === e) return !0;
|
|
37
|
-
t.tagName === "SLOT" && t.assignedSlot ? t = t.assignedSlot.parentNode : ue(t) ? t = t.host : t = t.parentNode;
|
|
38
|
-
}
|
|
39
|
-
return !1;
|
|
40
|
-
}
|
|
41
|
-
const W = (e = document) => {
|
|
42
|
-
var n;
|
|
43
|
-
if (!I()) return e.activeElement;
|
|
44
|
-
let t = e.activeElement;
|
|
45
|
-
for (; t && "shadowRoot" in t && (!((n = t.shadowRoot) === null || n === void 0) && n.activeElement); ) t = t.shadowRoot.activeElement;
|
|
46
|
-
return t;
|
|
47
|
-
};
|
|
48
|
-
function q(e) {
|
|
49
|
-
return I() && e.target.shadowRoot && e.composedPath ? e.composedPath()[0] : e.target;
|
|
50
|
-
}
|
|
51
|
-
function _(e) {
|
|
52
|
-
var n;
|
|
53
|
-
if (typeof window > "u" || window.navigator == null) return !1;
|
|
54
|
-
let t = (n = window.navigator.userAgentData) === null || n === void 0 ? void 0 : n.brands;
|
|
55
|
-
return Array.isArray(t) && t.some((r) => e.test(r.brand)) || e.test(window.navigator.userAgent);
|
|
56
|
-
}
|
|
57
|
-
function V(e) {
|
|
58
|
-
var n;
|
|
59
|
-
return typeof window < "u" && window.navigator != null ? e.test(((n = window.navigator.userAgentData) === null || n === void 0 ? void 0 : n.platform) || window.navigator.platform) : !1;
|
|
60
|
-
}
|
|
61
|
-
function E(e) {
|
|
62
|
-
if (process.env.NODE_ENV === "test") return e;
|
|
63
|
-
let n = null;
|
|
64
|
-
return () => (n == null && (n = e()), n);
|
|
65
|
-
}
|
|
66
|
-
const B = E(function() {
|
|
67
|
-
return V(/^Mac/i);
|
|
68
|
-
}), ce = E(function() {
|
|
69
|
-
return V(/^iPhone/i);
|
|
70
|
-
}), de = E(function() {
|
|
71
|
-
return V(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
72
|
-
B() && navigator.maxTouchPoints > 1;
|
|
73
|
-
}), fe = E(function() {
|
|
74
|
-
return ce() || de();
|
|
75
|
-
});
|
|
76
|
-
E(function() {
|
|
77
|
-
return B() || fe();
|
|
78
|
-
});
|
|
79
|
-
E(function() {
|
|
80
|
-
return _(/AppleWebKit/i) && !le();
|
|
81
|
-
});
|
|
82
|
-
const le = E(function() {
|
|
83
|
-
return _(/Chrome/i);
|
|
84
|
-
}), ve = E(function() {
|
|
85
|
-
return _(/Android/i);
|
|
86
|
-
});
|
|
87
|
-
E(function() {
|
|
88
|
-
return _(/Firefox/i);
|
|
89
|
-
});
|
|
90
|
-
function z() {
|
|
91
|
-
let e = T(/* @__PURE__ */ new Map()), n = b((o, s, a, i) => {
|
|
92
|
-
let u = i?.once ? (...f) => {
|
|
93
|
-
e.current.delete(a), a(...f);
|
|
94
|
-
} : a;
|
|
95
|
-
e.current.set(a, {
|
|
96
|
-
type: s,
|
|
97
|
-
eventTarget: o,
|
|
98
|
-
fn: u,
|
|
99
|
-
options: i
|
|
100
|
-
}), o.addEventListener(s, u, i);
|
|
101
|
-
}, []), t = b((o, s, a, i) => {
|
|
102
|
-
var u;
|
|
103
|
-
let f = ((u = e.current.get(a)) === null || u === void 0 ? void 0 : u.fn) || a;
|
|
104
|
-
o.removeEventListener(s, f, i), e.current.delete(a);
|
|
105
|
-
}, []), r = b(() => {
|
|
106
|
-
e.current.forEach((o, s) => {
|
|
107
|
-
t(o.eventTarget, o.type, s, o.options);
|
|
108
|
-
});
|
|
109
|
-
}, [
|
|
110
|
-
t
|
|
111
|
-
]);
|
|
112
|
-
return M(() => r, [
|
|
113
|
-
r
|
|
114
|
-
]), {
|
|
115
|
-
addGlobalListener: n,
|
|
116
|
-
removeGlobalListener: t,
|
|
117
|
-
removeAllGlobalListeners: r
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function be(e) {
|
|
121
|
-
return e.pointerType === "" && e.isTrusted ? !0 : ve() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
|
122
|
-
}
|
|
123
|
-
function J(e) {
|
|
124
|
-
let n = e;
|
|
125
|
-
return n.nativeEvent = e, n.isDefaultPrevented = () => n.defaultPrevented, n.isPropagationStopped = () => n.cancelBubble, n.persist = () => {
|
|
126
|
-
}, n;
|
|
127
|
-
}
|
|
128
|
-
function $e(e, n) {
|
|
129
|
-
Object.defineProperty(e, "target", {
|
|
130
|
-
value: n
|
|
131
|
-
}), Object.defineProperty(e, "currentTarget", {
|
|
132
|
-
value: n
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function Q(e) {
|
|
136
|
-
let n = T({
|
|
137
|
-
isFocused: !1,
|
|
138
|
-
observer: null
|
|
139
|
-
});
|
|
140
|
-
U(() => {
|
|
141
|
-
const r = n.current;
|
|
142
|
-
return () => {
|
|
143
|
-
r.observer && (r.observer.disconnect(), r.observer = null);
|
|
144
|
-
};
|
|
145
|
-
}, []);
|
|
146
|
-
let t = ie((r) => {
|
|
147
|
-
e?.(r);
|
|
148
|
-
});
|
|
149
|
-
return b((r) => {
|
|
150
|
-
if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
|
|
151
|
-
n.current.isFocused = !0;
|
|
152
|
-
let o = r.target, s = (a) => {
|
|
153
|
-
if (n.current.isFocused = !1, o.disabled) {
|
|
154
|
-
let i = J(a);
|
|
155
|
-
t(i);
|
|
156
|
-
}
|
|
157
|
-
n.current.observer && (n.current.observer.disconnect(), n.current.observer = null);
|
|
158
|
-
};
|
|
159
|
-
o.addEventListener("focusout", s, {
|
|
160
|
-
once: !0
|
|
161
|
-
}), n.current.observer = new MutationObserver(() => {
|
|
162
|
-
if (n.current.isFocused && o.disabled) {
|
|
163
|
-
var a;
|
|
164
|
-
(a = n.current.observer) === null || a === void 0 || a.disconnect();
|
|
165
|
-
let i = o === document.activeElement ? null : document.activeElement;
|
|
166
|
-
o.dispatchEvent(new FocusEvent("blur", {
|
|
167
|
-
relatedTarget: i
|
|
168
|
-
})), o.dispatchEvent(new FocusEvent("focusout", {
|
|
169
|
-
bubbles: !0,
|
|
170
|
-
relatedTarget: i
|
|
171
|
-
}));
|
|
172
|
-
}
|
|
173
|
-
}), n.current.observer.observe(o, {
|
|
174
|
-
attributes: !0,
|
|
175
|
-
attributeFilter: [
|
|
176
|
-
"disabled"
|
|
177
|
-
]
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}, [
|
|
181
|
-
t
|
|
182
|
-
]);
|
|
183
|
-
}
|
|
184
|
-
let pe = !1, x = null, C = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Map(), L = !1, G = !1;
|
|
185
|
-
const Ee = {
|
|
186
|
-
Tab: !0,
|
|
187
|
-
Escape: !0
|
|
188
|
-
};
|
|
189
|
-
function K(e, n) {
|
|
190
|
-
for (let t of C) t(e, n);
|
|
191
|
-
}
|
|
192
|
-
function ge(e) {
|
|
193
|
-
return !(e.metaKey || !B() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
194
|
-
}
|
|
195
|
-
function P(e) {
|
|
196
|
-
L = !0, ge(e) && (x = "keyboard", K("keyboard", e));
|
|
197
|
-
}
|
|
198
|
-
function l(e) {
|
|
199
|
-
x = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (L = !0, K("pointer", e));
|
|
200
|
-
}
|
|
201
|
-
function X(e) {
|
|
202
|
-
be(e) && (L = !0, x = "virtual");
|
|
203
|
-
}
|
|
204
|
-
function Z(e) {
|
|
205
|
-
e.target === window || e.target === document || pe || !e.isTrusted || (!L && !G && (x = "virtual", K("virtual", e)), L = !1, G = !1);
|
|
206
|
-
}
|
|
207
|
-
function ee() {
|
|
208
|
-
L = !1, G = !0;
|
|
209
|
-
}
|
|
210
|
-
function N(e) {
|
|
211
|
-
if (typeof window > "u" || typeof document > "u" || F.get(y(e))) return;
|
|
212
|
-
const n = y(e), t = h(e);
|
|
213
|
-
let r = n.HTMLElement.prototype.focus;
|
|
214
|
-
n.HTMLElement.prototype.focus = function() {
|
|
215
|
-
L = !0, r.apply(this, arguments);
|
|
216
|
-
}, t.addEventListener("keydown", P, !0), t.addEventListener("keyup", P, !0), t.addEventListener("click", X, !0), n.addEventListener("focus", Z, !0), n.addEventListener("blur", ee, !1), typeof PointerEvent < "u" ? (t.addEventListener("pointerdown", l, !0), t.addEventListener("pointermove", l, !0), t.addEventListener("pointerup", l, !0)) : process.env.NODE_ENV === "test" && (t.addEventListener("mousedown", l, !0), t.addEventListener("mousemove", l, !0), t.addEventListener("mouseup", l, !0)), n.addEventListener("beforeunload", () => {
|
|
217
|
-
te(e);
|
|
218
|
-
}, {
|
|
219
|
-
once: !0
|
|
220
|
-
}), F.set(n, {
|
|
221
|
-
focus: r
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
const te = (e, n) => {
|
|
225
|
-
const t = y(e), r = h(e);
|
|
226
|
-
n && r.removeEventListener("DOMContentLoaded", n), F.has(t) && (t.HTMLElement.prototype.focus = F.get(t).focus, r.removeEventListener("keydown", P, !0), r.removeEventListener("keyup", P, !0), r.removeEventListener("click", X, !0), t.removeEventListener("focus", Z, !0), t.removeEventListener("blur", ee, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", l, !0), r.removeEventListener("pointermove", l, !0), r.removeEventListener("pointerup", l, !0)) : process.env.NODE_ENV === "test" && (r.removeEventListener("mousedown", l, !0), r.removeEventListener("mousemove", l, !0), r.removeEventListener("mouseup", l, !0)), F.delete(t));
|
|
227
|
-
};
|
|
228
|
-
function me(e) {
|
|
229
|
-
const n = h(e);
|
|
230
|
-
let t;
|
|
231
|
-
return n.readyState !== "loading" ? N(e) : (t = () => {
|
|
232
|
-
N(e);
|
|
233
|
-
}, n.addEventListener("DOMContentLoaded", t)), () => te(e, t);
|
|
234
|
-
}
|
|
235
|
-
typeof document < "u" && me();
|
|
236
|
-
function ne() {
|
|
237
|
-
return x !== "pointer";
|
|
238
|
-
}
|
|
239
|
-
const he = /* @__PURE__ */ new Set([
|
|
240
|
-
"checkbox",
|
|
241
|
-
"radio",
|
|
242
|
-
"range",
|
|
243
|
-
"color",
|
|
244
|
-
"file",
|
|
245
|
-
"image",
|
|
246
|
-
"button",
|
|
247
|
-
"submit",
|
|
248
|
-
"reset"
|
|
249
|
-
]);
|
|
250
|
-
function we(e, n, t) {
|
|
251
|
-
let r = h(t?.target);
|
|
252
|
-
const o = typeof window < "u" ? y(t?.target).HTMLInputElement : HTMLInputElement, s = typeof window < "u" ? y(t?.target).HTMLTextAreaElement : HTMLTextAreaElement, a = typeof window < "u" ? y(t?.target).HTMLElement : HTMLElement, i = typeof window < "u" ? y(t?.target).KeyboardEvent : KeyboardEvent;
|
|
253
|
-
return e = e || r.activeElement instanceof o && !he.has(r.activeElement.type) || r.activeElement instanceof s || r.activeElement instanceof a && r.activeElement.isContentEditable, !(e && n === "keyboard" && t instanceof i && !Ee[t.key]);
|
|
254
|
-
}
|
|
255
|
-
function ye(e, n, t) {
|
|
256
|
-
N(), M(() => {
|
|
257
|
-
let r = (o, s) => {
|
|
258
|
-
we(!!t?.isTextInput, o, s) && e(ne());
|
|
259
|
-
};
|
|
260
|
-
return C.add(r), () => {
|
|
261
|
-
C.delete(r);
|
|
262
|
-
};
|
|
263
|
-
}, n);
|
|
264
|
-
}
|
|
265
|
-
function Le(e) {
|
|
266
|
-
let { isDisabled: n, onFocus: t, onBlur: r, onFocusChange: o } = e;
|
|
267
|
-
const s = b((u) => {
|
|
268
|
-
if (u.target === u.currentTarget)
|
|
269
|
-
return r && r(u), o && o(!1), !0;
|
|
270
|
-
}, [
|
|
271
|
-
r,
|
|
272
|
-
o
|
|
273
|
-
]), a = Q(s), i = b((u) => {
|
|
274
|
-
const f = h(u.target), g = f ? W(f) : W();
|
|
275
|
-
u.target === u.currentTarget && g === q(u.nativeEvent) && (t && t(u), o && o(!0), a(u));
|
|
276
|
-
}, [
|
|
277
|
-
o,
|
|
278
|
-
t,
|
|
279
|
-
a
|
|
280
|
-
]);
|
|
281
|
-
return {
|
|
282
|
-
focusProps: {
|
|
283
|
-
onFocus: !n && (t || o || r) ? i : void 0,
|
|
284
|
-
onBlur: !n && (r || o) ? s : void 0
|
|
285
|
-
}
|
|
286
|
-
};
|
|
287
|
-
}
|
|
288
|
-
function Te(e) {
|
|
289
|
-
let { isDisabled: n, onBlurWithin: t, onFocusWithin: r, onFocusWithinChange: o } = e, s = T({
|
|
290
|
-
isFocusWithin: !1
|
|
291
|
-
}), { addGlobalListener: a, removeAllGlobalListeners: i } = z(), u = b((d) => {
|
|
292
|
-
d.currentTarget.contains(d.target) && s.current.isFocusWithin && !d.currentTarget.contains(d.relatedTarget) && (s.current.isFocusWithin = !1, i(), t && t(d), o && o(!1));
|
|
293
|
-
}, [
|
|
294
|
-
t,
|
|
295
|
-
o,
|
|
296
|
-
s,
|
|
297
|
-
i
|
|
298
|
-
]), f = Q(u), g = b((d) => {
|
|
299
|
-
if (!d.currentTarget.contains(d.target)) return;
|
|
300
|
-
const m = h(d.target), v = W(m);
|
|
301
|
-
if (!s.current.isFocusWithin && v === q(d.nativeEvent)) {
|
|
302
|
-
r && r(d), o && o(!0), s.current.isFocusWithin = !0, f(d);
|
|
303
|
-
let $ = d.currentTarget;
|
|
304
|
-
a(m, "focus", (c) => {
|
|
305
|
-
if (s.current.isFocusWithin && !Y($, c.target)) {
|
|
306
|
-
let p = new m.defaultView.FocusEvent("blur", {
|
|
307
|
-
relatedTarget: c.target
|
|
308
|
-
});
|
|
309
|
-
$e(p, $);
|
|
310
|
-
let w = J(p);
|
|
311
|
-
u(w);
|
|
312
|
-
}
|
|
313
|
-
}, {
|
|
314
|
-
capture: !0
|
|
315
|
-
});
|
|
316
|
-
}
|
|
317
|
-
}, [
|
|
318
|
-
r,
|
|
319
|
-
o,
|
|
320
|
-
f,
|
|
321
|
-
a,
|
|
322
|
-
u
|
|
323
|
-
]);
|
|
324
|
-
return n ? {
|
|
325
|
-
focusWithinProps: {
|
|
326
|
-
// These cannot be null, that would conflict in mergeProps
|
|
327
|
-
onFocus: void 0,
|
|
328
|
-
onBlur: void 0
|
|
329
|
-
}
|
|
330
|
-
} : {
|
|
331
|
-
focusWithinProps: {
|
|
332
|
-
onFocus: g,
|
|
333
|
-
onBlur: u
|
|
334
|
-
}
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
let D = !1, H = 0;
|
|
338
|
-
function k() {
|
|
339
|
-
D = !0, setTimeout(() => {
|
|
340
|
-
D = !1;
|
|
341
|
-
}, 50);
|
|
342
|
-
}
|
|
343
|
-
function R(e) {
|
|
344
|
-
e.pointerType === "touch" && k();
|
|
345
|
-
}
|
|
346
|
-
function Fe() {
|
|
347
|
-
if (!(typeof document > "u"))
|
|
348
|
-
return H === 0 && (typeof PointerEvent < "u" ? document.addEventListener("pointerup", R) : process.env.NODE_ENV === "test" && document.addEventListener("touchend", k)), H++, () => {
|
|
349
|
-
H--, !(H > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", R) : process.env.NODE_ENV === "test" && document.removeEventListener("touchend", k));
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
function He(e) {
|
|
353
|
-
let { onHoverStart: n, onHoverChange: t, onHoverEnd: r, isDisabled: o } = e, [s, a] = S(!1), i = T({
|
|
354
|
-
isHovered: !1,
|
|
355
|
-
ignoreEmulatedMouseEvents: !1,
|
|
356
|
-
pointerType: "",
|
|
357
|
-
target: null
|
|
358
|
-
}).current;
|
|
359
|
-
M(Fe, []);
|
|
360
|
-
let { addGlobalListener: u, removeAllGlobalListeners: f } = z(), { hoverProps: g, triggerHoverEnd: d } = re(() => {
|
|
361
|
-
let m = (c, p) => {
|
|
362
|
-
if (i.pointerType = p, o || p === "touch" || i.isHovered || !c.currentTarget.contains(c.target)) return;
|
|
363
|
-
i.isHovered = !0;
|
|
364
|
-
let w = c.currentTarget;
|
|
365
|
-
i.target = w, u(h(c.target), "pointerover", (A) => {
|
|
366
|
-
i.isHovered && i.target && !Y(i.target, A.target) && v(A, A.pointerType);
|
|
367
|
-
}, {
|
|
368
|
-
capture: !0
|
|
369
|
-
}), n && n({
|
|
370
|
-
type: "hoverstart",
|
|
371
|
-
target: w,
|
|
372
|
-
pointerType: p
|
|
373
|
-
}), t && t(!0), a(!0);
|
|
374
|
-
}, v = (c, p) => {
|
|
375
|
-
let w = i.target;
|
|
376
|
-
i.pointerType = "", i.target = null, !(p === "touch" || !i.isHovered || !w) && (i.isHovered = !1, f(), r && r({
|
|
377
|
-
type: "hoverend",
|
|
378
|
-
target: w,
|
|
379
|
-
pointerType: p
|
|
380
|
-
}), t && t(!1), a(!1));
|
|
381
|
-
}, $ = {};
|
|
382
|
-
return typeof PointerEvent < "u" ? ($.onPointerEnter = (c) => {
|
|
383
|
-
D && c.pointerType === "mouse" || m(c, c.pointerType);
|
|
384
|
-
}, $.onPointerLeave = (c) => {
|
|
385
|
-
!o && c.currentTarget.contains(c.target) && v(c, c.pointerType);
|
|
386
|
-
}) : process.env.NODE_ENV === "test" && ($.onTouchStart = () => {
|
|
387
|
-
i.ignoreEmulatedMouseEvents = !0;
|
|
388
|
-
}, $.onMouseEnter = (c) => {
|
|
389
|
-
!i.ignoreEmulatedMouseEvents && !D && m(c, "mouse"), i.ignoreEmulatedMouseEvents = !1;
|
|
390
|
-
}, $.onMouseLeave = (c) => {
|
|
391
|
-
!o && c.currentTarget.contains(c.target) && v(c, "mouse");
|
|
392
|
-
}), {
|
|
393
|
-
hoverProps: $,
|
|
394
|
-
triggerHoverEnd: v
|
|
395
|
-
};
|
|
396
|
-
}, [
|
|
397
|
-
n,
|
|
398
|
-
t,
|
|
399
|
-
r,
|
|
400
|
-
o,
|
|
401
|
-
i,
|
|
402
|
-
u,
|
|
403
|
-
f
|
|
404
|
-
]);
|
|
405
|
-
return M(() => {
|
|
406
|
-
o && d({
|
|
407
|
-
currentTarget: i.target
|
|
408
|
-
}, i.pointerType);
|
|
409
|
-
}, [
|
|
410
|
-
o
|
|
411
|
-
]), {
|
|
412
|
-
hoverProps: g,
|
|
413
|
-
isHovered: s
|
|
414
|
-
};
|
|
415
|
-
}
|
|
416
|
-
function Me(e = {}) {
|
|
417
|
-
let { autoFocus: n = !1, isTextInput: t, within: r } = e, o = T({
|
|
418
|
-
isFocused: !1,
|
|
419
|
-
isFocusVisible: n || ne()
|
|
420
|
-
}), [s, a] = S(!1), [i, u] = S(() => o.current.isFocused && o.current.isFocusVisible), f = b(() => u(o.current.isFocused && o.current.isFocusVisible), []), g = b((v) => {
|
|
421
|
-
o.current.isFocused = v, a(v), f();
|
|
422
|
-
}, [
|
|
423
|
-
f
|
|
424
|
-
]);
|
|
425
|
-
ye((v) => {
|
|
426
|
-
o.current.isFocusVisible = v, f();
|
|
427
|
-
}, [], {
|
|
428
|
-
isTextInput: t
|
|
429
|
-
});
|
|
430
|
-
let { focusProps: d } = Le({
|
|
431
|
-
isDisabled: r,
|
|
432
|
-
onFocusChange: g
|
|
433
|
-
}), { focusWithinProps: m } = Te({
|
|
434
|
-
isDisabled: !r,
|
|
435
|
-
onFocusWithinChange: g
|
|
436
|
-
});
|
|
437
|
-
return {
|
|
438
|
-
isFocused: s,
|
|
439
|
-
isFocusVisible: i,
|
|
440
|
-
focusProps: r ? m : d
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
export {
|
|
444
|
-
Me as $,
|
|
445
|
-
He as a
|
|
446
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const s=require("react"),B=typeof document<"u"?s.useLayoutEffect:()=>{};var D;const Z=(D=s.useInsertionEffect)!==null&&D!==void 0?D:B;function ee(e){const n=s.useRef(null);return Z(()=>{n.current=e},[e]),s.useCallback((...t)=>{const r=n.current;return r?.(...t)},[])}const h=e=>{var n;return(n=e?.ownerDocument)!==null&&n!==void 0?n:document},y=e=>e&&"window"in e&&e.window===e?e:h(e).defaultView||window;function te(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function ne(e){return te(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let re=!1;function _(){return re}function R(e,n){if(!_())return n&&e?e.contains(n):!1;if(!e||!n)return!1;let t=n;for(;t!==null;){if(t===e)return!0;t.tagName==="SLOT"&&t.assignedSlot?t=t.assignedSlot.parentNode:ne(t)?t=t.host:t=t.parentNode}return!1}const k=(e=document)=>{var n;if(!_())return e.activeElement;let t=e.activeElement;for(;t&&"shadowRoot"in t&&(!((n=t.shadowRoot)===null||n===void 0)&&n.activeElement);)t=t.shadowRoot.activeElement;return t};function K(e){return _()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function P(e){var n;if(typeof window>"u"||window.navigator==null)return!1;let t=(n=window.navigator.userAgentData)===null||n===void 0?void 0:n.brands;return Array.isArray(t)&&t.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function G(e){var n;return typeof window<"u"&&window.navigator!=null?e.test(((n=window.navigator.userAgentData)===null||n===void 0?void 0:n.platform)||window.navigator.platform):!1}function E(e){if(process.env.NODE_ENV==="test")return e;let n=null;return()=>(n==null&&(n=e()),n)}const N=E(function(){return G(/^Mac/i)}),oe=E(function(){return G(/^iPhone/i)}),ae=E(function(){return G(/^iPad/i)||N()&&navigator.maxTouchPoints>1}),ie=E(function(){return oe()||ae()});E(function(){return N()||ie()});E(function(){return P(/AppleWebKit/i)&&!ue()});const ue=E(function(){return P(/Chrome/i)}),se=E(function(){return P(/Android/i)});E(function(){return P(/Firefox/i)});function j(){let e=s.useRef(new Map),n=s.useCallback((o,c,i,a)=>{let u=a?.once?(...l)=>{e.current.delete(i),i(...l)}:i;e.current.set(i,{type:c,eventTarget:o,fn:u,options:a}),o.addEventListener(c,u,a)},[]),t=s.useCallback((o,c,i,a)=>{var u;let l=((u=e.current.get(i))===null||u===void 0?void 0:u.fn)||i;o.removeEventListener(c,l,a),e.current.delete(i)},[]),r=s.useCallback(()=>{e.current.forEach((o,c)=>{t(o.eventTarget,o.type,c,o.options)})},[t]);return s.useEffect(()=>r,[r]),{addGlobalListener:n,removeGlobalListener:t,removeAllGlobalListeners:r}}function ce(e){return e.pointerType===""&&e.isTrusted?!0:se()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function U(e){let n=e;return n.nativeEvent=e,n.isDefaultPrevented=()=>n.defaultPrevented,n.isPropagationStopped=()=>n.cancelBubble,n.persist=()=>{},n}function de(e,n){Object.defineProperty(e,"target",{value:n}),Object.defineProperty(e,"currentTarget",{value:n})}function q(e){let n=s.useRef({isFocused:!1,observer:null});B(()=>{const r=n.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let t=ee(r=>{e?.(r)});return s.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){n.current.isFocused=!0;let o=r.target,c=i=>{if(n.current.isFocused=!1,o.disabled){let a=U(i);t(a)}n.current.observer&&(n.current.observer.disconnect(),n.current.observer=null)};o.addEventListener("focusout",c,{once:!0}),n.current.observer=new MutationObserver(()=>{if(n.current.isFocused&&o.disabled){var i;(i=n.current.observer)===null||i===void 0||i.disconnect();let a=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),n.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[t])}let fe=!1,F=null,S=new Set,T=new Map,L=!1,A=!1;const le={Tab:!0,Escape:!0};function I(e,n){for(let t of S)t(e,n)}function ve(e){return!(e.metaKey||!N()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function H(e){L=!0,ve(e)&&(F="keyboard",I("keyboard",e))}function v(e){F="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(L=!0,I("pointer",e))}function Y(e){ce(e)&&(L=!0,F="virtual")}function z(e){e.target===window||e.target===document||fe||!e.isTrusted||(!L&&!A&&(F="virtual",I("virtual",e)),L=!1,A=!1)}function J(){L=!1,A=!0}function O(e){if(typeof window>"u"||typeof document>"u"||T.get(y(e)))return;const n=y(e),t=h(e);let r=n.HTMLElement.prototype.focus;n.HTMLElement.prototype.focus=function(){L=!0,r.apply(this,arguments)},t.addEventListener("keydown",H,!0),t.addEventListener("keyup",H,!0),t.addEventListener("click",Y,!0),n.addEventListener("focus",z,!0),n.addEventListener("blur",J,!1),typeof PointerEvent<"u"?(t.addEventListener("pointerdown",v,!0),t.addEventListener("pointermove",v,!0),t.addEventListener("pointerup",v,!0)):process.env.NODE_ENV==="test"&&(t.addEventListener("mousedown",v,!0),t.addEventListener("mousemove",v,!0),t.addEventListener("mouseup",v,!0)),n.addEventListener("beforeunload",()=>{Q(e)},{once:!0}),T.set(n,{focus:r})}const Q=(e,n)=>{const t=y(e),r=h(e);n&&r.removeEventListener("DOMContentLoaded",n),T.has(t)&&(t.HTMLElement.prototype.focus=T.get(t).focus,r.removeEventListener("keydown",H,!0),r.removeEventListener("keyup",H,!0),r.removeEventListener("click",Y,!0),t.removeEventListener("focus",z,!0),t.removeEventListener("blur",J,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",v,!0),r.removeEventListener("pointermove",v,!0),r.removeEventListener("pointerup",v,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",v,!0),r.removeEventListener("mousemove",v,!0),r.removeEventListener("mouseup",v,!0)),T.delete(t))};function be(e){const n=h(e);let t;return n.readyState!=="loading"?O(e):(t=()=>{O(e)},n.addEventListener("DOMContentLoaded",t)),()=>Q(e,t)}typeof document<"u"&&be();function X(){return F!=="pointer"}const $e=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function pe(e,n,t){let r=h(t?.target);const o=typeof window<"u"?y(t?.target).HTMLInputElement:HTMLInputElement,c=typeof window<"u"?y(t?.target).HTMLTextAreaElement:HTMLTextAreaElement,i=typeof window<"u"?y(t?.target).HTMLElement:HTMLElement,a=typeof window<"u"?y(t?.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!$e.has(r.activeElement.type)||r.activeElement instanceof c||r.activeElement instanceof i&&r.activeElement.isContentEditable,!(e&&n==="keyboard"&&t instanceof a&&!le[t.key])}function Ee(e,n,t){O(),s.useEffect(()=>{let r=(o,c)=>{pe(!!t?.isTextInput,o,c)&&e(X())};return S.add(r),()=>{S.delete(r)}},n)}function ge(e){let{isDisabled:n,onFocus:t,onBlur:r,onFocusChange:o}=e;const c=s.useCallback(u=>{if(u.target===u.currentTarget)return r&&r(u),o&&o(!1),!0},[r,o]),i=q(c),a=s.useCallback(u=>{const l=h(u.target),g=l?k(l):k();u.target===u.currentTarget&&g===K(u.nativeEvent)&&(t&&t(u),o&&o(!0),i(u))},[o,t,i]);return{focusProps:{onFocus:!n&&(t||o||r)?a:void 0,onBlur:!n&&(r||o)?c:void 0}}}function me(e){let{isDisabled:n,onBlurWithin:t,onFocusWithin:r,onFocusWithinChange:o}=e,c=s.useRef({isFocusWithin:!1}),{addGlobalListener:i,removeAllGlobalListeners:a}=j(),u=s.useCallback(f=>{f.currentTarget.contains(f.target)&&c.current.isFocusWithin&&!f.currentTarget.contains(f.relatedTarget)&&(c.current.isFocusWithin=!1,a(),t&&t(f),o&&o(!1))},[t,o,c,a]),l=q(u),g=s.useCallback(f=>{if(!f.currentTarget.contains(f.target))return;const m=h(f.target),b=k(m);if(!c.current.isFocusWithin&&b===K(f.nativeEvent)){r&&r(f),o&&o(!0),c.current.isFocusWithin=!0,l(f);let $=f.currentTarget;i(m,"focus",d=>{if(c.current.isFocusWithin&&!R($,d.target)){let p=new m.defaultView.FocusEvent("blur",{relatedTarget:d.target});de(p,$);let w=U(p);u(w)}},{capture:!0})}},[r,o,l,i,u]);return n?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:g,onBlur:u}}}let M=!1,x=0;function W(){M=!0,setTimeout(()=>{M=!1},50)}function V(e){e.pointerType==="touch"&&W()}function he(){if(!(typeof document>"u"))return x===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",V):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",W)),x++,()=>{x--,!(x>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",V):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",W))}}function we(e){let{onHoverStart:n,onHoverChange:t,onHoverEnd:r,isDisabled:o}=e,[c,i]=s.useState(!1),a=s.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;s.useEffect(he,[]);let{addGlobalListener:u,removeAllGlobalListeners:l}=j(),{hoverProps:g,triggerHoverEnd:f}=s.useMemo(()=>{let m=(d,p)=>{if(a.pointerType=p,o||p==="touch"||a.isHovered||!d.currentTarget.contains(d.target))return;a.isHovered=!0;let w=d.currentTarget;a.target=w,u(h(d.target),"pointerover",C=>{a.isHovered&&a.target&&!R(a.target,C.target)&&b(C,C.pointerType)},{capture:!0}),n&&n({type:"hoverstart",target:w,pointerType:p}),t&&t(!0),i(!0)},b=(d,p)=>{let w=a.target;a.pointerType="",a.target=null,!(p==="touch"||!a.isHovered||!w)&&(a.isHovered=!1,l(),r&&r({type:"hoverend",target:w,pointerType:p}),t&&t(!1),i(!1))},$={};return typeof PointerEvent<"u"?($.onPointerEnter=d=>{M&&d.pointerType==="mouse"||m(d,d.pointerType)},$.onPointerLeave=d=>{!o&&d.currentTarget.contains(d.target)&&b(d,d.pointerType)}):process.env.NODE_ENV==="test"&&($.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},$.onMouseEnter=d=>{!a.ignoreEmulatedMouseEvents&&!M&&m(d,"mouse"),a.ignoreEmulatedMouseEvents=!1},$.onMouseLeave=d=>{!o&&d.currentTarget.contains(d.target)&&b(d,"mouse")}),{hoverProps:$,triggerHoverEnd:b}},[n,t,r,o,a,u,l]);return s.useEffect(()=>{o&&f({currentTarget:a.target},a.pointerType)},[o]),{hoverProps:g,isHovered:c}}function ye(e={}){let{autoFocus:n=!1,isTextInput:t,within:r}=e,o=s.useRef({isFocused:!1,isFocusVisible:n||X()}),[c,i]=s.useState(!1),[a,u]=s.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=s.useCallback(()=>u(o.current.isFocused&&o.current.isFocusVisible),[]),g=s.useCallback(b=>{o.current.isFocused=b,i(b),l()},[l]);Ee(b=>{o.current.isFocusVisible=b,l()},[],{isTextInput:t});let{focusProps:f}=ge({isDisabled:r,onFocusChange:g}),{focusWithinProps:m}=me({isDisabled:!r,onFocusWithinChange:g});return{isFocused:c,isFocusVisible:a,focusProps:r?m:f}}exports.$6179b936705e76d3$export$ae780daf29e6d456=we;exports.$f7dceffc5ad7768b$export$4e328f61c538687f=ye;
|