@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
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
import re, { useRef as M, useCallback as b, useEffect as S, useState as N, useMemo as oe } from "react";
|
|
2
|
+
const ie = typeof document < "u" ? re.useLayoutEffect : () => {
|
|
3
|
+
}, h = (e) => {
|
|
4
|
+
var n;
|
|
5
|
+
return (n = e?.ownerDocument) !== null && n !== void 0 ? n : document;
|
|
6
|
+
}, L = (e) => e && "window" in e && e.window === e ? e : h(e).defaultView || window;
|
|
7
|
+
function ae(e) {
|
|
8
|
+
return e !== null && typeof e == "object" && "nodeType" in e && typeof e.nodeType == "number";
|
|
9
|
+
}
|
|
10
|
+
function se(e) {
|
|
11
|
+
return ae(e) && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in e;
|
|
12
|
+
}
|
|
13
|
+
let ue = !1;
|
|
14
|
+
function j() {
|
|
15
|
+
return ue;
|
|
16
|
+
}
|
|
17
|
+
function y(e, n) {
|
|
18
|
+
if (!j()) return n && e ? e.contains(n) : !1;
|
|
19
|
+
if (!e || !n) return !1;
|
|
20
|
+
let t = n;
|
|
21
|
+
for (; t !== null; ) {
|
|
22
|
+
if (t === e) return !0;
|
|
23
|
+
t.tagName === "SLOT" && t.assignedSlot ? t = t.assignedSlot.parentNode : se(t) ? t = t.host : t = t.parentNode;
|
|
24
|
+
}
|
|
25
|
+
return !1;
|
|
26
|
+
}
|
|
27
|
+
const A = (e = document) => {
|
|
28
|
+
var n;
|
|
29
|
+
if (!j()) return e.activeElement;
|
|
30
|
+
let t = e.activeElement;
|
|
31
|
+
for (; t && "shadowRoot" in t && (!((n = t.shadowRoot) === null || n === void 0) && n.activeElement); ) t = t.shadowRoot.activeElement;
|
|
32
|
+
return t;
|
|
33
|
+
};
|
|
34
|
+
function q(e) {
|
|
35
|
+
return j() && e.target.shadowRoot && e.composedPath ? e.composedPath()[0] : e.target;
|
|
36
|
+
}
|
|
37
|
+
function ce(e) {
|
|
38
|
+
if (le()) e.focus({
|
|
39
|
+
preventScroll: !0
|
|
40
|
+
});
|
|
41
|
+
else {
|
|
42
|
+
let n = de(e);
|
|
43
|
+
e.focus(), fe(n);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
let D = null;
|
|
47
|
+
function le() {
|
|
48
|
+
if (D == null) {
|
|
49
|
+
D = !1;
|
|
50
|
+
try {
|
|
51
|
+
document.createElement("div").focus({
|
|
52
|
+
get preventScroll() {
|
|
53
|
+
return D = !0, !0;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
} catch {
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return D;
|
|
60
|
+
}
|
|
61
|
+
function de(e) {
|
|
62
|
+
let n = e.parentNode, t = [], r = document.scrollingElement || document.documentElement;
|
|
63
|
+
for (; n instanceof HTMLElement && n !== r; )
|
|
64
|
+
(n.offsetHeight < n.scrollHeight || n.offsetWidth < n.scrollWidth) && t.push({
|
|
65
|
+
element: n,
|
|
66
|
+
scrollTop: n.scrollTop,
|
|
67
|
+
scrollLeft: n.scrollLeft
|
|
68
|
+
}), n = n.parentNode;
|
|
69
|
+
return r instanceof HTMLElement && t.push({
|
|
70
|
+
element: r,
|
|
71
|
+
scrollTop: r.scrollTop,
|
|
72
|
+
scrollLeft: r.scrollLeft
|
|
73
|
+
}), t;
|
|
74
|
+
}
|
|
75
|
+
function fe(e) {
|
|
76
|
+
for (let { element: n, scrollTop: t, scrollLeft: r } of e)
|
|
77
|
+
n.scrollTop = t, n.scrollLeft = r;
|
|
78
|
+
}
|
|
79
|
+
function W(e) {
|
|
80
|
+
var n;
|
|
81
|
+
if (typeof window > "u" || window.navigator == null) return !1;
|
|
82
|
+
let t = (n = window.navigator.userAgentData) === null || n === void 0 ? void 0 : n.brands;
|
|
83
|
+
return Array.isArray(t) && t.some((r) => e.test(r.brand)) || e.test(window.navigator.userAgent);
|
|
84
|
+
}
|
|
85
|
+
function R(e) {
|
|
86
|
+
var n;
|
|
87
|
+
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;
|
|
88
|
+
}
|
|
89
|
+
function E(e) {
|
|
90
|
+
if (process.env.NODE_ENV === "test") return e;
|
|
91
|
+
let n = null;
|
|
92
|
+
return () => (n == null && (n = e()), n);
|
|
93
|
+
}
|
|
94
|
+
const x = E(function() {
|
|
95
|
+
return R(/^Mac/i);
|
|
96
|
+
}), ve = E(function() {
|
|
97
|
+
return R(/^iPhone/i);
|
|
98
|
+
}), z = E(function() {
|
|
99
|
+
return R(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
100
|
+
x() && navigator.maxTouchPoints > 1;
|
|
101
|
+
}), be = E(function() {
|
|
102
|
+
return ve() || z();
|
|
103
|
+
});
|
|
104
|
+
E(function() {
|
|
105
|
+
return x() || be();
|
|
106
|
+
});
|
|
107
|
+
const pe = E(function() {
|
|
108
|
+
return W(/AppleWebKit/i) && !$e();
|
|
109
|
+
}), $e = E(function() {
|
|
110
|
+
return W(/Chrome/i);
|
|
111
|
+
}), Ee = E(function() {
|
|
112
|
+
return W(/Android/i);
|
|
113
|
+
}), me = E(function() {
|
|
114
|
+
return W(/Firefox/i);
|
|
115
|
+
});
|
|
116
|
+
function H(e, n, t = !0) {
|
|
117
|
+
var r, o;
|
|
118
|
+
let { metaKey: a, ctrlKey: s, altKey: i, shiftKey: u } = n;
|
|
119
|
+
me() && (!((o = window.event) === null || o === void 0 || (r = o.type) === null || r === void 0) && r.startsWith("key")) && e.target === "_blank" && (x() ? a = !0 : s = !0);
|
|
120
|
+
let l = pe() && x() && !z() && process.env.NODE_ENV !== "test" ? new KeyboardEvent("keydown", {
|
|
121
|
+
keyIdentifier: "Enter",
|
|
122
|
+
metaKey: a,
|
|
123
|
+
ctrlKey: s,
|
|
124
|
+
altKey: i,
|
|
125
|
+
shiftKey: u
|
|
126
|
+
}) : new MouseEvent("click", {
|
|
127
|
+
metaKey: a,
|
|
128
|
+
ctrlKey: s,
|
|
129
|
+
altKey: i,
|
|
130
|
+
shiftKey: u,
|
|
131
|
+
detail: 1,
|
|
132
|
+
bubbles: !0,
|
|
133
|
+
cancelable: !0
|
|
134
|
+
});
|
|
135
|
+
H.isOpening = t, ce(e), e.dispatchEvent(l), H.isOpening = !1;
|
|
136
|
+
}
|
|
137
|
+
H.isOpening = !1;
|
|
138
|
+
function J() {
|
|
139
|
+
let e = M(/* @__PURE__ */ new Map()), n = b((o, a, s, i) => {
|
|
140
|
+
let u = i?.once ? (...l) => {
|
|
141
|
+
e.current.delete(s), s(...l);
|
|
142
|
+
} : s;
|
|
143
|
+
e.current.set(s, {
|
|
144
|
+
type: a,
|
|
145
|
+
eventTarget: o,
|
|
146
|
+
fn: u,
|
|
147
|
+
options: i
|
|
148
|
+
}), o.addEventListener(a, u, i);
|
|
149
|
+
}, []), t = b((o, a, s, i) => {
|
|
150
|
+
var u;
|
|
151
|
+
let l = ((u = e.current.get(s)) === null || u === void 0 ? void 0 : u.fn) || s;
|
|
152
|
+
o.removeEventListener(a, l, i), e.current.delete(s);
|
|
153
|
+
}, []), r = b(() => {
|
|
154
|
+
e.current.forEach((o, a) => {
|
|
155
|
+
t(o.eventTarget, o.type, a, o.options);
|
|
156
|
+
});
|
|
157
|
+
}, [
|
|
158
|
+
t
|
|
159
|
+
]);
|
|
160
|
+
return S(() => r, [
|
|
161
|
+
r
|
|
162
|
+
]), {
|
|
163
|
+
addGlobalListener: n,
|
|
164
|
+
removeGlobalListener: t,
|
|
165
|
+
removeAllGlobalListeners: r
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
function ge(e) {
|
|
169
|
+
return e.pointerType === "" && e.isTrusted ? !0 : Ee() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
|
170
|
+
}
|
|
171
|
+
function Q(e) {
|
|
172
|
+
let n = e;
|
|
173
|
+
return n.nativeEvent = e, n.isDefaultPrevented = () => n.defaultPrevented, n.isPropagationStopped = () => n.cancelBubble, n.persist = () => {
|
|
174
|
+
}, n;
|
|
175
|
+
}
|
|
176
|
+
function ye(e, n) {
|
|
177
|
+
Object.defineProperty(e, "target", {
|
|
178
|
+
value: n
|
|
179
|
+
}), Object.defineProperty(e, "currentTarget", {
|
|
180
|
+
value: n
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
function X(e) {
|
|
184
|
+
let n = M({
|
|
185
|
+
isFocused: !1,
|
|
186
|
+
observer: null
|
|
187
|
+
});
|
|
188
|
+
return ie(() => {
|
|
189
|
+
const t = n.current;
|
|
190
|
+
return () => {
|
|
191
|
+
t.observer && (t.observer.disconnect(), t.observer = null);
|
|
192
|
+
};
|
|
193
|
+
}, []), b((t) => {
|
|
194
|
+
if (t.target instanceof HTMLButtonElement || t.target instanceof HTMLInputElement || t.target instanceof HTMLTextAreaElement || t.target instanceof HTMLSelectElement) {
|
|
195
|
+
n.current.isFocused = !0;
|
|
196
|
+
let r = t.target, o = (a) => {
|
|
197
|
+
if (n.current.isFocused = !1, r.disabled) {
|
|
198
|
+
let s = Q(a);
|
|
199
|
+
e?.(s);
|
|
200
|
+
}
|
|
201
|
+
n.current.observer && (n.current.observer.disconnect(), n.current.observer = null);
|
|
202
|
+
};
|
|
203
|
+
r.addEventListener("focusout", o, {
|
|
204
|
+
once: !0
|
|
205
|
+
}), n.current.observer = new MutationObserver(() => {
|
|
206
|
+
if (n.current.isFocused && r.disabled) {
|
|
207
|
+
var a;
|
|
208
|
+
(a = n.current.observer) === null || a === void 0 || a.disconnect();
|
|
209
|
+
let s = r === document.activeElement ? null : document.activeElement;
|
|
210
|
+
r.dispatchEvent(new FocusEvent("blur", {
|
|
211
|
+
relatedTarget: s
|
|
212
|
+
})), r.dispatchEvent(new FocusEvent("focusout", {
|
|
213
|
+
bubbles: !0,
|
|
214
|
+
relatedTarget: s
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
}), n.current.observer.observe(r, {
|
|
218
|
+
attributes: !0,
|
|
219
|
+
attributeFilter: [
|
|
220
|
+
"disabled"
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}, [
|
|
225
|
+
e
|
|
226
|
+
]);
|
|
227
|
+
}
|
|
228
|
+
let he = !1, P = null;
|
|
229
|
+
const C = /* @__PURE__ */ new Set();
|
|
230
|
+
let F = /* @__PURE__ */ new Map(), T = !1, G = !1;
|
|
231
|
+
const we = {
|
|
232
|
+
Tab: !0,
|
|
233
|
+
Escape: !0
|
|
234
|
+
};
|
|
235
|
+
function U(e, n) {
|
|
236
|
+
for (let t of C) t(e, n);
|
|
237
|
+
}
|
|
238
|
+
function Le(e) {
|
|
239
|
+
return !(e.metaKey || !x() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
240
|
+
}
|
|
241
|
+
function _(e) {
|
|
242
|
+
T = !0, !H.isOpening && Le(e) && (P = "keyboard", U("keyboard", e));
|
|
243
|
+
}
|
|
244
|
+
function f(e) {
|
|
245
|
+
P = "pointer", "pointerType" in e && e.pointerType, (e.type === "mousedown" || e.type === "pointerdown") && (T = !0, U("pointer", e));
|
|
246
|
+
}
|
|
247
|
+
function Z(e) {
|
|
248
|
+
!H.isOpening && ge(e) && (T = !0, P = "virtual");
|
|
249
|
+
}
|
|
250
|
+
function ee(e) {
|
|
251
|
+
e.target === window || e.target === document || he || !e.isTrusted || (!T && !G && (P = "virtual", U("virtual", e)), T = !1, G = !1);
|
|
252
|
+
}
|
|
253
|
+
function te() {
|
|
254
|
+
T = !1, G = !0;
|
|
255
|
+
}
|
|
256
|
+
function V(e) {
|
|
257
|
+
if (typeof window > "u" || typeof document > "u" || F.get(L(e))) return;
|
|
258
|
+
const n = L(e), t = h(e);
|
|
259
|
+
let r = n.HTMLElement.prototype.focus;
|
|
260
|
+
n.HTMLElement.prototype.focus = function() {
|
|
261
|
+
T = !0, r.apply(this, arguments);
|
|
262
|
+
}, t.addEventListener("keydown", _, !0), t.addEventListener("keyup", _, !0), t.addEventListener("click", Z, !0), n.addEventListener("focus", ee, !0), n.addEventListener("blur", te, !1), typeof PointerEvent < "u" ? (t.addEventListener("pointerdown", f, !0), t.addEventListener("pointermove", f, !0), t.addEventListener("pointerup", f, !0)) : process.env.NODE_ENV === "test" && (t.addEventListener("mousedown", f, !0), t.addEventListener("mousemove", f, !0), t.addEventListener("mouseup", f, !0)), n.addEventListener("beforeunload", () => {
|
|
263
|
+
ne(e);
|
|
264
|
+
}, {
|
|
265
|
+
once: !0
|
|
266
|
+
}), F.set(n, {
|
|
267
|
+
focus: r
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
const ne = (e, n) => {
|
|
271
|
+
const t = L(e), r = h(e);
|
|
272
|
+
n && r.removeEventListener("DOMContentLoaded", n), F.has(t) && (t.HTMLElement.prototype.focus = F.get(t).focus, r.removeEventListener("keydown", _, !0), r.removeEventListener("keyup", _, !0), r.removeEventListener("click", Z, !0), t.removeEventListener("focus", ee, !0), t.removeEventListener("blur", te, !1), typeof PointerEvent < "u" ? (r.removeEventListener("pointerdown", f, !0), r.removeEventListener("pointermove", f, !0), r.removeEventListener("pointerup", f, !0)) : process.env.NODE_ENV === "test" && (r.removeEventListener("mousedown", f, !0), r.removeEventListener("mousemove", f, !0), r.removeEventListener("mouseup", f, !0)), F.delete(t));
|
|
273
|
+
};
|
|
274
|
+
function Te(e) {
|
|
275
|
+
const n = h(e);
|
|
276
|
+
let t;
|
|
277
|
+
return n.readyState !== "loading" ? V(e) : (t = () => {
|
|
278
|
+
V(e);
|
|
279
|
+
}, n.addEventListener("DOMContentLoaded", t)), () => ne(e, t);
|
|
280
|
+
}
|
|
281
|
+
typeof document < "u" && Te();
|
|
282
|
+
function I() {
|
|
283
|
+
return P !== "pointer";
|
|
284
|
+
}
|
|
285
|
+
const Fe = /* @__PURE__ */ new Set([
|
|
286
|
+
"checkbox",
|
|
287
|
+
"radio",
|
|
288
|
+
"range",
|
|
289
|
+
"color",
|
|
290
|
+
"file",
|
|
291
|
+
"image",
|
|
292
|
+
"button",
|
|
293
|
+
"submit",
|
|
294
|
+
"reset"
|
|
295
|
+
]);
|
|
296
|
+
function xe(e, n, t) {
|
|
297
|
+
let r = h(t?.target);
|
|
298
|
+
const o = typeof window < "u" ? L(t?.target).HTMLInputElement : HTMLInputElement, a = typeof window < "u" ? L(t?.target).HTMLTextAreaElement : HTMLTextAreaElement, s = typeof window < "u" ? L(t?.target).HTMLElement : HTMLElement, i = typeof window < "u" ? L(t?.target).KeyboardEvent : KeyboardEvent;
|
|
299
|
+
return e = e || r.activeElement instanceof o && !Fe.has(r.activeElement.type) || r.activeElement instanceof a || r.activeElement instanceof s && r.activeElement.isContentEditable, !(e && n === "keyboard" && t instanceof i && !we[t.key]);
|
|
300
|
+
}
|
|
301
|
+
function He(e, n, t) {
|
|
302
|
+
V(), S(() => {
|
|
303
|
+
if (t?.enabled === !1) return;
|
|
304
|
+
let r = (o, a) => {
|
|
305
|
+
xe(!!t?.isTextInput, o, a) && e(I());
|
|
306
|
+
};
|
|
307
|
+
return C.add(r), () => {
|
|
308
|
+
C.delete(r);
|
|
309
|
+
};
|
|
310
|
+
}, n);
|
|
311
|
+
}
|
|
312
|
+
function Me(e) {
|
|
313
|
+
let { isDisabled: n, onFocus: t, onBlur: r, onFocusChange: o } = e;
|
|
314
|
+
const a = b((u) => {
|
|
315
|
+
if (u.target === u.currentTarget)
|
|
316
|
+
return r && r(u), o && o(!1), !0;
|
|
317
|
+
}, [
|
|
318
|
+
r,
|
|
319
|
+
o
|
|
320
|
+
]), s = X(a), i = b((u) => {
|
|
321
|
+
const l = h(u.target), m = l ? A(l) : A();
|
|
322
|
+
u.target === u.currentTarget && m === q(u.nativeEvent) && (t && t(u), o && o(!0), s(u));
|
|
323
|
+
}, [
|
|
324
|
+
o,
|
|
325
|
+
t,
|
|
326
|
+
s
|
|
327
|
+
]);
|
|
328
|
+
return {
|
|
329
|
+
focusProps: {
|
|
330
|
+
onFocus: !n && (t || o || r) ? i : void 0,
|
|
331
|
+
onBlur: !n && (r || o) ? a : void 0
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
function Pe(e) {
|
|
336
|
+
let { isDisabled: n, onBlurWithin: t, onFocusWithin: r, onFocusWithinChange: o } = e, a = M({
|
|
337
|
+
isFocusWithin: !1
|
|
338
|
+
}), { addGlobalListener: s, removeAllGlobalListeners: i } = J(), u = b((d) => {
|
|
339
|
+
y(d.currentTarget, d.target) && a.current.isFocusWithin && !y(d.currentTarget, d.relatedTarget) && (a.current.isFocusWithin = !1, i(), t && t(d), o && o(!1));
|
|
340
|
+
}, [
|
|
341
|
+
t,
|
|
342
|
+
o,
|
|
343
|
+
a,
|
|
344
|
+
i
|
|
345
|
+
]), l = X(u), m = b((d) => {
|
|
346
|
+
if (!y(d.currentTarget, d.target)) return;
|
|
347
|
+
const g = h(d.target), v = A(g);
|
|
348
|
+
if (!a.current.isFocusWithin && v === q(d.nativeEvent)) {
|
|
349
|
+
r && r(d), o && o(!0), a.current.isFocusWithin = !0, l(d);
|
|
350
|
+
let p = d.currentTarget;
|
|
351
|
+
s(g, "focus", (c) => {
|
|
352
|
+
if (a.current.isFocusWithin && !y(p, c.target)) {
|
|
353
|
+
let $ = new g.defaultView.FocusEvent("blur", {
|
|
354
|
+
relatedTarget: c.target
|
|
355
|
+
});
|
|
356
|
+
ye($, p);
|
|
357
|
+
let w = Q($);
|
|
358
|
+
u(w);
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
capture: !0
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
}, [
|
|
365
|
+
r,
|
|
366
|
+
o,
|
|
367
|
+
l,
|
|
368
|
+
s,
|
|
369
|
+
u
|
|
370
|
+
]);
|
|
371
|
+
return n ? {
|
|
372
|
+
focusWithinProps: {
|
|
373
|
+
// These cannot be null, that would conflict in mergeProps
|
|
374
|
+
onFocus: void 0,
|
|
375
|
+
onBlur: void 0
|
|
376
|
+
}
|
|
377
|
+
} : {
|
|
378
|
+
focusWithinProps: {
|
|
379
|
+
onFocus: m,
|
|
380
|
+
onBlur: u
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
let O = !1, K = 0;
|
|
385
|
+
function B() {
|
|
386
|
+
O = !0, setTimeout(() => {
|
|
387
|
+
O = !1;
|
|
388
|
+
}, 50);
|
|
389
|
+
}
|
|
390
|
+
function Y(e) {
|
|
391
|
+
e.pointerType === "touch" && B();
|
|
392
|
+
}
|
|
393
|
+
function De() {
|
|
394
|
+
if (!(typeof document > "u"))
|
|
395
|
+
return K === 0 && (typeof PointerEvent < "u" ? document.addEventListener("pointerup", Y) : process.env.NODE_ENV === "test" && document.addEventListener("touchend", B)), K++, () => {
|
|
396
|
+
K--, !(K > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", Y) : process.env.NODE_ENV === "test" && document.removeEventListener("touchend", B));
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function Se(e) {
|
|
400
|
+
let { onHoverStart: n, onHoverChange: t, onHoverEnd: r, isDisabled: o } = e, [a, s] = N(!1), i = M({
|
|
401
|
+
isHovered: !1,
|
|
402
|
+
ignoreEmulatedMouseEvents: !1,
|
|
403
|
+
pointerType: "",
|
|
404
|
+
target: null
|
|
405
|
+
}).current;
|
|
406
|
+
S(De, []);
|
|
407
|
+
let { addGlobalListener: u, removeAllGlobalListeners: l } = J(), { hoverProps: m, triggerHoverEnd: d } = oe(() => {
|
|
408
|
+
let g = (c, $) => {
|
|
409
|
+
if (i.pointerType = $, o || $ === "touch" || i.isHovered || !y(c.currentTarget, c.target)) return;
|
|
410
|
+
i.isHovered = !0;
|
|
411
|
+
let w = c.currentTarget;
|
|
412
|
+
i.target = w, u(h(c.target), "pointerover", (k) => {
|
|
413
|
+
i.isHovered && i.target && !y(i.target, k.target) && v(k, k.pointerType);
|
|
414
|
+
}, {
|
|
415
|
+
capture: !0
|
|
416
|
+
}), n && n({
|
|
417
|
+
type: "hoverstart",
|
|
418
|
+
target: w,
|
|
419
|
+
pointerType: $
|
|
420
|
+
}), t && t(!0), s(!0);
|
|
421
|
+
}, v = (c, $) => {
|
|
422
|
+
let w = i.target;
|
|
423
|
+
i.pointerType = "", i.target = null, !($ === "touch" || !i.isHovered || !w) && (i.isHovered = !1, l(), r && r({
|
|
424
|
+
type: "hoverend",
|
|
425
|
+
target: w,
|
|
426
|
+
pointerType: $
|
|
427
|
+
}), t && t(!1), s(!1));
|
|
428
|
+
}, p = {};
|
|
429
|
+
return typeof PointerEvent < "u" ? (p.onPointerEnter = (c) => {
|
|
430
|
+
O && c.pointerType === "mouse" || g(c, c.pointerType);
|
|
431
|
+
}, p.onPointerLeave = (c) => {
|
|
432
|
+
!o && y(c.currentTarget, c.target) && v(c, c.pointerType);
|
|
433
|
+
}) : process.env.NODE_ENV === "test" && (p.onTouchStart = () => {
|
|
434
|
+
i.ignoreEmulatedMouseEvents = !0;
|
|
435
|
+
}, p.onMouseEnter = (c) => {
|
|
436
|
+
!i.ignoreEmulatedMouseEvents && !O && g(c, "mouse"), i.ignoreEmulatedMouseEvents = !1;
|
|
437
|
+
}, p.onMouseLeave = (c) => {
|
|
438
|
+
!o && y(c.currentTarget, c.target) && v(c, "mouse");
|
|
439
|
+
}), {
|
|
440
|
+
hoverProps: p,
|
|
441
|
+
triggerHoverEnd: v
|
|
442
|
+
};
|
|
443
|
+
}, [
|
|
444
|
+
n,
|
|
445
|
+
t,
|
|
446
|
+
r,
|
|
447
|
+
o,
|
|
448
|
+
i,
|
|
449
|
+
u,
|
|
450
|
+
l
|
|
451
|
+
]);
|
|
452
|
+
return S(() => {
|
|
453
|
+
o && d({
|
|
454
|
+
currentTarget: i.target
|
|
455
|
+
}, i.pointerType);
|
|
456
|
+
}, [
|
|
457
|
+
o
|
|
458
|
+
]), {
|
|
459
|
+
hoverProps: m,
|
|
460
|
+
isHovered: a
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
function _e(e = {}) {
|
|
464
|
+
let { autoFocus: n = !1, isTextInput: t, within: r } = e, o = M({
|
|
465
|
+
isFocused: !1,
|
|
466
|
+
isFocusVisible: n || I()
|
|
467
|
+
}), [a, s] = N(!1), [i, u] = N(() => o.current.isFocused && o.current.isFocusVisible), l = b(() => u(o.current.isFocused && o.current.isFocusVisible), []), m = b((v) => {
|
|
468
|
+
o.current.isFocused = v, o.current.isFocusVisible = I(), s(v), l();
|
|
469
|
+
}, [
|
|
470
|
+
l
|
|
471
|
+
]);
|
|
472
|
+
He((v) => {
|
|
473
|
+
o.current.isFocusVisible = v, l();
|
|
474
|
+
}, [
|
|
475
|
+
t,
|
|
476
|
+
a
|
|
477
|
+
], {
|
|
478
|
+
enabled: a,
|
|
479
|
+
isTextInput: t
|
|
480
|
+
});
|
|
481
|
+
let { focusProps: d } = Me({
|
|
482
|
+
isDisabled: r,
|
|
483
|
+
onFocusChange: m
|
|
484
|
+
}), { focusWithinProps: g } = Pe({
|
|
485
|
+
isDisabled: !r,
|
|
486
|
+
onFocusWithinChange: m
|
|
487
|
+
});
|
|
488
|
+
return {
|
|
489
|
+
isFocused: a,
|
|
490
|
+
isFocusVisible: i,
|
|
491
|
+
focusProps: r ? g : d
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
export {
|
|
495
|
+
_e as $,
|
|
496
|
+
Se as a
|
|
497
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forsyteco/product-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "An implementation of Forsyte's product design system using React 🐝",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -86,6 +86,16 @@
|
|
|
86
86
|
"default": "./dist/checkbox/index.cjs"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
|
+
"./autocomplete": {
|
|
90
|
+
"import": {
|
|
91
|
+
"types": "./dist/autocomplete/index.d.ts",
|
|
92
|
+
"default": "./dist/autocomplete/index.mjs"
|
|
93
|
+
},
|
|
94
|
+
"require": {
|
|
95
|
+
"types": "./dist/autocomplete/index.d.ts",
|
|
96
|
+
"default": "./dist/autocomplete/index.cjs"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
89
99
|
"./combobox": {
|
|
90
100
|
"import": {
|
|
91
101
|
"types": "./dist/combobox/index.d.ts",
|
|
@@ -363,38 +373,38 @@
|
|
|
363
373
|
"@github/relative-time-element": "^5.0.0",
|
|
364
374
|
"@headlessui/react": "^2.2.9",
|
|
365
375
|
"@lit-labs/react": "^2.1.3",
|
|
366
|
-
"@tailwindcss/vite": "^4.1.
|
|
376
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
367
377
|
"boring-avatars": "^2.0.4",
|
|
368
378
|
"class-variance-authority": "^0.7.1",
|
|
369
379
|
"clsx": "^2.1.1",
|
|
370
380
|
"dayjs": "^1.11.19",
|
|
371
|
-
"lucide-react": "^0.
|
|
381
|
+
"lucide-react": "^0.563.0",
|
|
372
382
|
"radix-ui": "^1.4.3",
|
|
373
|
-
"react": "^19.2.
|
|
374
|
-
"react-day-picker": "^9.
|
|
375
|
-
"react-dom": "^19.2.
|
|
383
|
+
"react": "^19.2.4",
|
|
384
|
+
"react-day-picker": "^9.13.1",
|
|
385
|
+
"react-dom": "^19.2.4",
|
|
376
386
|
"sonner": "^2.0.7",
|
|
377
387
|
"tailwind-merge": "^3.4.0"
|
|
378
388
|
},
|
|
379
389
|
"devDependencies": {
|
|
380
|
-
"@storybook/addon-vitest": "^10.
|
|
381
|
-
"@storybook/react-vite": "^10.
|
|
390
|
+
"@storybook/addon-vitest": "^10.2.8",
|
|
391
|
+
"@storybook/react-vite": "^10.2.8",
|
|
382
392
|
"@testing-library/jest-dom": "^6.9.1",
|
|
383
|
-
"@testing-library/react": "^16.3.
|
|
393
|
+
"@testing-library/react": "^16.3.2",
|
|
384
394
|
"@testing-library/user-event": "^14.6.1",
|
|
385
|
-
"@types/react": "19",
|
|
386
|
-
"@vitejs/plugin-react": "^
|
|
387
|
-
"@vitest/browser-playwright": "^4.0.
|
|
388
|
-
"@vitest/coverage-v8": "^4.0.
|
|
389
|
-
"@vitest/ui": "^4.0.
|
|
390
|
-
"jsdom": "^
|
|
391
|
-
"playwright": "^1.
|
|
392
|
-
"rollup": "^4.
|
|
393
|
-
"storybook": "^10.
|
|
394
|
-
"tailwindcss": "^4.1.
|
|
395
|
-
"vite": "^7.
|
|
396
|
-
"vite-plugin-dts": "^4.
|
|
397
|
-
"vitest": "^4.0.
|
|
395
|
+
"@types/react": "^19.2.13",
|
|
396
|
+
"@vitejs/plugin-react": "^5.1.3",
|
|
397
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
398
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
399
|
+
"@vitest/ui": "^4.0.18",
|
|
400
|
+
"jsdom": "^28.0.0",
|
|
401
|
+
"playwright": "^1.58.2",
|
|
402
|
+
"rollup": "^4.57.1",
|
|
403
|
+
"storybook": "^10.2.8",
|
|
404
|
+
"tailwindcss": "^4.1.18",
|
|
405
|
+
"vite": "^7.3.1",
|
|
406
|
+
"vite-plugin-dts": "^4.5.4",
|
|
407
|
+
"vitest": "^4.0.18"
|
|
398
408
|
},
|
|
399
409
|
"peerDependencies": {
|
|
400
410
|
"react": ">=19.2.1 <20",
|