@yselimcan/ui 0.0.4 → 0.0.6
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/index100.js +32 -5
- package/dist/index101.js +19 -134
- package/dist/index102.js +4 -26
- package/dist/index103.js +4 -9
- package/dist/index104.js +5 -5
- package/dist/index105.js +7 -8
- package/dist/index106.js +16 -20
- package/dist/index107.js +13 -8
- package/dist/index108.js +291 -82
- package/dist/index109.js +4 -12
- package/dist/index110.js +37 -61
- package/dist/index111.js +126 -38
- package/dist/index112.js +5 -14
- package/dist/index113.js +21 -33
- package/dist/index114.js +77 -19
- package/dist/index115.js +63 -4
- package/dist/index116.js +46 -4
- package/dist/index117.js +67 -5
- package/dist/index118.js +8 -11
- package/dist/index119.js +13 -18
- package/dist/index120.js +4 -13
- package/dist/index121.js +3 -296
- package/dist/index122.js +5 -4
- package/dist/index123.js +131 -36
- package/dist/index124.js +24 -122
- package/dist/index125.js +8 -20
- package/dist/index126.js +5 -77
- package/dist/index127.js +11 -63
- package/dist/index128.js +22 -45
- package/dist/index132.js +2 -2
- package/dist/index133.js +1 -1
- package/dist/index134.js +2 -2
- package/dist/index135.js +1 -1
- package/dist/index136.js +4 -4
- package/dist/index137.js +1 -1
- package/dist/index139.js +1 -1
- package/dist/index140.js +3 -3
- package/dist/index141.js +1 -1
- package/dist/index143.js +2 -2
- package/dist/index144.js +1 -1
- package/dist/index145.js +3 -3
- package/dist/index146.js +5 -5
- package/dist/index147.js +6 -6
- package/dist/index148.js +4 -4
- package/dist/index149.js +3 -3
- package/dist/index152.js +1 -1
- package/dist/index155.js +1 -1
- package/dist/index157.js +3 -3
- package/dist/index158.js +3 -3
- package/dist/index159.js +2 -2
- package/dist/index160.js +1 -1
- package/dist/index164.js +1 -1
- package/dist/index167.js +2 -2
- package/dist/index168.js +1 -1
- package/dist/index169.js +1 -1
- package/dist/index17.js +4 -4
- package/dist/index170.js +3 -3
- package/dist/index171.js +1 -1
- package/dist/index172.js +1 -1
- package/dist/index173.js +3 -3
- package/dist/index174.js +1 -1
- package/dist/index175.js +2 -2
- package/dist/index176.js +1 -1
- package/dist/index177.js +1 -1
- package/dist/index178.js +6 -6
- package/dist/index179.js +1 -1
- package/dist/index18.js +5 -5
- package/dist/index180.js +1 -1
- package/dist/index181.js +2 -2
- package/dist/index182.js +1 -1
- package/dist/index183.js +1 -1
- package/dist/index184.js +1 -1
- package/dist/index187.js +2 -2
- package/dist/index189.js +3 -3
- package/dist/index19.js +10 -10
- package/dist/index190.js +1 -1
- package/dist/index191.js +1 -1
- package/dist/index192.js +3 -3
- package/dist/index193.js +1 -1
- package/dist/index194.js +1 -1
- package/dist/index195.js +1 -1
- package/dist/index196.js +5 -5
- package/dist/index197.js +1 -1
- package/dist/index198.js +3 -3
- package/dist/index20.js +3 -3
- package/dist/index200.js +2 -2
- package/dist/index201.js +3 -3
- package/dist/index202.js +1 -1
- package/dist/index203.js +2 -2
- package/dist/index204.js +26 -5
- package/dist/index205.js +5 -26
- package/dist/index206.js +9 -11
- package/dist/index207.js +11 -9
- package/dist/index21.js +4 -4
- package/dist/index217.js +2 -2
- package/dist/index218.js +1 -1
- package/dist/index219.js +4 -39
- package/dist/index22.js +5 -5
- package/dist/index220.js +4 -56
- package/dist/index221.js +14 -27
- package/dist/index222.js +32 -7
- package/dist/index223.js +37 -11
- package/dist/index224.js +57 -12
- package/dist/index225.js +27 -11
- package/dist/index226.js +6 -20
- package/dist/index227.js +11 -10
- package/dist/index228.js +11 -7
- package/dist/index229.js +11 -42
- package/dist/index23.js +3 -3
- package/dist/index230.js +17 -592
- package/dist/index231.js +6 -6
- package/dist/index232.js +7 -32
- package/dist/index233.js +43 -4
- package/dist/index234.js +597 -5
- package/dist/index235.js +11 -14
- package/dist/index239.js +1 -1
- package/dist/index24.js +10 -10
- package/dist/index242.js +2 -2
- package/dist/index244.js +1 -1
- package/dist/index246.js +2 -2
- package/dist/index247.js +14 -321
- package/dist/index248.js +322 -3
- package/dist/index249.js +3 -3
- package/dist/index250.js +3 -15
- package/dist/index26.js +1 -1
- package/dist/index27.js +1 -1
- package/dist/index28.js +2 -2
- package/dist/index32.js +1 -1
- package/dist/index33.js +11 -11
- package/dist/index34.js +4 -4
- package/dist/index35.js +11 -11
- package/dist/index36.js +8 -8
- package/dist/index37.js +6 -6
- package/dist/index38.js +7 -7
- package/dist/index39.js +4 -4
- package/dist/index40.js +3 -3
- package/dist/index41.js +4 -4
- package/dist/index42.js +2 -2
- package/dist/index43.js +2 -2
- package/dist/index44.js +1 -1
- package/dist/index45.js +4 -4
- package/dist/index46.js +8 -8
- package/dist/index47.js +8 -8
- package/dist/index48.js +10 -10
- package/dist/index49.js +2 -2
- package/dist/index50.js +9 -9
- package/dist/index52.js +8 -8
- package/dist/index53.js +1 -1
- package/dist/index54.js +15 -15
- package/dist/index55.js +7 -7
- package/dist/index56.js +8 -8
- package/dist/index57.js +1 -1
- package/dist/index58.js +3 -3
- package/dist/index59.js +2 -2
- package/dist/index60.js +5 -5
- package/dist/index61.js +2 -2
- package/dist/index62.js +2 -2
- package/dist/index63.js +5 -5
- package/dist/index64.js +2 -2
- package/dist/index66.js +7 -7
- package/dist/index67.js +1 -1
- package/dist/index69.js +10 -10
- package/dist/index70.js +1 -1
- package/dist/index71.js +9 -9
- package/dist/index72.js +11 -11
- package/dist/index73.js +2 -2
- package/dist/index74.js +1 -1
- package/dist/index75.js +5 -5
- package/dist/index76.js +1 -1
- package/dist/index77.js +3 -3
- package/dist/index78.js +3 -3
- package/dist/index81.js +7 -7
- package/dist/index82.js +2 -2
- package/dist/index83.js +1 -1
- package/dist/index86.js +11 -54
- package/dist/index87.js +54 -11
- package/dist/index88.js +87 -81
- package/dist/index89.js +81 -87
- package/dist/index94.js +7 -4
- package/dist/index95.js +86 -65
- package/dist/index96.js +12 -8
- package/dist/index97.js +61 -12
- package/dist/index98.js +38 -4
- package/dist/index99.js +14 -4
- package/dist/styles.css +1 -1
- package/package.json +4 -3
package/dist/index233.js
CHANGED
|
@@ -1,6 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import "react";
|
|
3
|
+
import { stringifyAsLabel as l } from "./index141.js";
|
|
4
|
+
const f = /* @__PURE__ */ new Map();
|
|
5
|
+
function h(e) {
|
|
6
|
+
return Array.isArray(e) ? e.map((c) => h(c)).join(",") : e == null ? "" : String(e);
|
|
7
|
+
}
|
|
8
|
+
function m(e = {}) {
|
|
9
|
+
const c = {
|
|
10
|
+
usage: "search",
|
|
11
|
+
sensitivity: "base",
|
|
12
|
+
ignorePunctuation: !0,
|
|
13
|
+
...e
|
|
14
|
+
}, a = `${h(e.locale)}|${JSON.stringify(c)}`, g = f.get(a);
|
|
15
|
+
if (g)
|
|
16
|
+
return g;
|
|
17
|
+
const o = new Intl.Collator(e.locale, c), u = {
|
|
18
|
+
contains(i, t, s) {
|
|
19
|
+
if (!t)
|
|
20
|
+
return !0;
|
|
21
|
+
const n = l(i, s);
|
|
22
|
+
for (let r = 0; r <= n.length - t.length; r += 1)
|
|
23
|
+
if (o.compare(n.slice(r, r + t.length), t) === 0)
|
|
24
|
+
return !0;
|
|
25
|
+
return !1;
|
|
26
|
+
},
|
|
27
|
+
startsWith(i, t, s) {
|
|
28
|
+
if (!t)
|
|
29
|
+
return !0;
|
|
30
|
+
const n = l(i, s);
|
|
31
|
+
return o.compare(n.slice(0, t.length), t) === 0;
|
|
32
|
+
},
|
|
33
|
+
endsWith(i, t, s) {
|
|
34
|
+
if (!t)
|
|
35
|
+
return !0;
|
|
36
|
+
const n = l(i, s), r = t.length;
|
|
37
|
+
return n.length >= r && o.compare(n.slice(n.length - r), t) === 0;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return f.set(a, u), u;
|
|
41
|
+
}
|
|
42
|
+
const d = m;
|
|
4
43
|
export {
|
|
5
|
-
|
|
44
|
+
d as useCoreFilter
|
|
6
45
|
};
|
package/dist/index234.js
CHANGED
|
@@ -1,7 +1,599 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
"use client";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { useControlled as $e } from "./index131.js";
|
|
4
|
+
import { useIsoLayoutEffect as z } from "./index126.js";
|
|
5
|
+
import { useOnFirstRender as on } from "./index130.js";
|
|
6
|
+
import { useStableCallback as E } from "./index124.js";
|
|
7
|
+
import { useMergedRefs as ln } from "./index117.js";
|
|
8
|
+
import { visuallyHidden as sn } from "./index129.js";
|
|
9
|
+
import { useRefWithInit as xt } from "./index94.js";
|
|
10
|
+
import { useValueAsRef as un } from "./index132.js";
|
|
11
|
+
import { createGenericEventDetails as le, createChangeEventDetails as V } from "./index100.js";
|
|
12
|
+
import { ComboboxRootContext as an, ComboboxFloatingContext as cn, ComboboxDerivedItemsContext as fn, ComboboxInputValueContext as dn } from "./index223.js";
|
|
13
|
+
import { selectors as q } from "./index224.js";
|
|
14
|
+
import { useOpenChangeComplete as mn } from "./index106.js";
|
|
15
|
+
import { useFieldRootContext as pn } from "./index134.js";
|
|
16
|
+
import { useField as gn } from "./index140.js";
|
|
17
|
+
import { useFormContext as In } from "./index139.js";
|
|
18
|
+
import { useLabelableId as hn } from "./index136.js";
|
|
19
|
+
import { createSingleSelectionCollatorFilter as Cn, createCollatorItemFilter as xn } from "./index251.js";
|
|
20
|
+
import { useCoreFilter as yn } from "./index233.js";
|
|
21
|
+
import { useTransitionStatus as vn } from "./index137.js";
|
|
22
|
+
import { useOpenInteractionType as Vn } from "./index144.js";
|
|
23
|
+
import { useValueChanged as Ae } from "./index143.js";
|
|
24
|
+
import { isGroupedItems as bn, stringifyAsLabel as w, stringifyAsValue as se } from "./index141.js";
|
|
25
|
+
import { defaultItemEquality as Pn, findItemIndex as yt, itemIncludes as Oe, removeItem as Rn } from "./index142.js";
|
|
26
|
+
import { INITIAL_LAST_HIGHLIGHT as Y, NO_ACTIVE_VALUE as En } from "./index252.js";
|
|
27
|
+
import { jsx as ee, jsxs as Sn } from "react/jsx-runtime";
|
|
28
|
+
import { EMPTY_ARRAY as ue, NOOP as F, EMPTY_OBJECT as An } from "./index122.js";
|
|
29
|
+
import { useStore as k } from "./index149.js";
|
|
30
|
+
import { useFloatingRootContext as On } from "./index145.js";
|
|
31
|
+
import { useClick as Fn } from "./index115.js";
|
|
32
|
+
import { useDismiss as Mn } from "./index146.js";
|
|
33
|
+
import { useListNavigation as Hn } from "./index147.js";
|
|
34
|
+
import { useInteractions as Tn } from "./index116.js";
|
|
35
|
+
import { Store as qn } from "./index150.js";
|
|
36
|
+
import { inputChange as De, inputClear as te, none as j, itemPress as wn } from "./index101.js";
|
|
37
|
+
import { getTarget as vt, contains as et } from "./index155.js";
|
|
38
|
+
function Cr(M) {
|
|
39
|
+
const {
|
|
40
|
+
id: Vt,
|
|
41
|
+
onOpenChangeComplete: tt,
|
|
42
|
+
defaultSelectedValue: B = null,
|
|
43
|
+
selectedValue: bt,
|
|
44
|
+
onSelectedValueChange: Pt,
|
|
45
|
+
defaultInputValue: nt,
|
|
46
|
+
inputValue: rt,
|
|
47
|
+
selectionMode: s = "none",
|
|
48
|
+
onItemHighlighted: Rt,
|
|
49
|
+
name: Et,
|
|
50
|
+
disabled: St = !1,
|
|
51
|
+
readOnly: L = !1,
|
|
52
|
+
required: ae = !1,
|
|
53
|
+
inputRef: At,
|
|
54
|
+
grid: W = !1,
|
|
55
|
+
items: u,
|
|
56
|
+
filteredItems: ce,
|
|
57
|
+
filter: fe,
|
|
58
|
+
openOnInputClick: de = !0,
|
|
59
|
+
autoHighlight: it = !1,
|
|
60
|
+
keepHighlight: Ot = !1,
|
|
61
|
+
highlightItemOnHover: Ft = !0,
|
|
62
|
+
itemToStringLabel: f,
|
|
63
|
+
itemToStringValue: H,
|
|
64
|
+
isItemEqualToValue: J = Pn,
|
|
65
|
+
virtualized: Fe = !1,
|
|
66
|
+
inline: me = !1,
|
|
67
|
+
fillInputOnItemPress: Mt = !0,
|
|
68
|
+
modal: Me = !1,
|
|
69
|
+
limit: S = -1,
|
|
70
|
+
autoComplete: ot = "list",
|
|
71
|
+
locale: Ht,
|
|
72
|
+
submitOnItemClick: He = !1
|
|
73
|
+
} = M, {
|
|
74
|
+
clearErrors: lt
|
|
75
|
+
} = In(), {
|
|
76
|
+
setDirty: pe,
|
|
77
|
+
validityData: ge,
|
|
78
|
+
shouldValidateOnChange: Ie,
|
|
79
|
+
setFilled: Te,
|
|
80
|
+
name: Tt,
|
|
81
|
+
disabled: qt,
|
|
82
|
+
validation: b
|
|
83
|
+
} = pn(), K = hn({
|
|
84
|
+
id: Vt
|
|
85
|
+
}), he = yn({
|
|
86
|
+
locale: Ht
|
|
87
|
+
}), [N, Ce] = o.useState(!1), [wt, xe] = o.useState(null), qe = o.useRef([]), st = o.useRef([]), we = o.useRef(null), I = o.useRef(null), kt = o.useRef(null), ut = o.useRef(!0), at = o.useRef(!1), ct = o.useRef(null), ft = o.useRef(null), ke = o.useRef(null), P = o.useRef(Y), Le = o.useRef(null), X = o.useRef([]), dt = o.useRef([]), U = qt || St, R = Tt ?? Et, d = s === "multiple", y = s === "single", Z = rt !== void 0 || nt !== void 0, $ = u !== void 0, Ne = ce !== void 0;
|
|
88
|
+
let p;
|
|
89
|
+
it === "always" ? p = "always" : p = it ? "input-change" : !1;
|
|
90
|
+
const [n, ye] = $e({
|
|
91
|
+
controlled: bt,
|
|
92
|
+
default: d ? B ?? ue : B,
|
|
93
|
+
name: "Combobox",
|
|
94
|
+
state: "selectedValue"
|
|
95
|
+
}), ve = o.useMemo(() => fe === null ? () => !0 : fe !== void 0 ? fe : y && !N ? Cn(he, f, n) : xn(he, f), [fe, y, n, N, he, f]), mt = xt(() => Z ? nt ?? "" : y ? w(n, f) : "").current, [h, Lt] = $e({
|
|
96
|
+
controlled: rt,
|
|
97
|
+
default: mt,
|
|
98
|
+
name: "Combobox",
|
|
99
|
+
state: "inputValue"
|
|
100
|
+
}), [c, Nt] = $e({
|
|
101
|
+
controlled: M.open,
|
|
102
|
+
default: M.defaultOpen,
|
|
103
|
+
name: "Combobox",
|
|
104
|
+
state: "open"
|
|
105
|
+
}), A = bn(u), g = wt ?? (h === "" ? "" : String(h).trim()), Ue = y ? w(n, f) : "", pt = y && !N && g !== "" && Ue !== "" && Ue.length === g.length && he.contains(Ue, g), ne = pt ? "" : g, gt = $ && Ne && pt, T = o.useMemo(() => u ? A ? u.flatMap((e) => e.items) : u : ue, [u, A]), re = o.useMemo(() => {
|
|
106
|
+
if (ce && !gt)
|
|
107
|
+
return ce;
|
|
108
|
+
if (!u)
|
|
109
|
+
return ue;
|
|
110
|
+
if (A) {
|
|
111
|
+
const t = u, r = [];
|
|
112
|
+
let l = 0;
|
|
113
|
+
for (const a of t) {
|
|
114
|
+
if (S > -1 && l >= S)
|
|
115
|
+
break;
|
|
116
|
+
const m = ne === "" ? a.items : a.items.filter((Se) => ve(Se, ne, f));
|
|
117
|
+
if (m.length === 0)
|
|
118
|
+
continue;
|
|
119
|
+
const Q = S > -1 ? S - l : 1 / 0, _ = m.slice(0, Q);
|
|
120
|
+
if (_.length > 0) {
|
|
121
|
+
const Se = {
|
|
122
|
+
...a,
|
|
123
|
+
items: _
|
|
124
|
+
};
|
|
125
|
+
r.push(Se), l += _.length;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return r;
|
|
129
|
+
}
|
|
130
|
+
if (ne === "")
|
|
131
|
+
return S > -1 ? T.slice(0, S) : (
|
|
132
|
+
// The cast here is done as `flatItems` is readonly.
|
|
133
|
+
// valuesRef.current, a mutable ref, can be set to `flatFilteredItems`, which may
|
|
134
|
+
// reference this exact readonly value, creating a mutation risk.
|
|
135
|
+
// However, <Combobox.Item> can never mutate this value as the mutating effect
|
|
136
|
+
// bails early when `items` is provided, and this is only ever returned
|
|
137
|
+
// when `items` is provided due to the early return at the top of this hook.
|
|
138
|
+
T
|
|
139
|
+
);
|
|
140
|
+
const e = [];
|
|
141
|
+
for (const t of T) {
|
|
142
|
+
if (S > -1 && e.length >= S)
|
|
143
|
+
break;
|
|
144
|
+
ve(t, ne, f) && e.push(t);
|
|
145
|
+
}
|
|
146
|
+
return e;
|
|
147
|
+
}, [ce, gt, u, A, ne, S, ve, f, T]), v = o.useMemo(() => A ? re.flatMap((t) => t.items) : re, [re, A]), i = xt(() => new qn({
|
|
148
|
+
id: K,
|
|
149
|
+
selectedValue: n,
|
|
150
|
+
open: c,
|
|
151
|
+
filter: ve,
|
|
152
|
+
query: g,
|
|
153
|
+
items: u,
|
|
154
|
+
selectionMode: s,
|
|
155
|
+
listRef: qe,
|
|
156
|
+
labelsRef: st,
|
|
157
|
+
popupRef: we,
|
|
158
|
+
emptyRef: kt,
|
|
159
|
+
inputRef: I,
|
|
160
|
+
keyboardActiveRef: ut,
|
|
161
|
+
chipsContainerRef: ct,
|
|
162
|
+
clearRef: ft,
|
|
163
|
+
valuesRef: X,
|
|
164
|
+
allValuesRef: dt,
|
|
165
|
+
selectionEventRef: ke,
|
|
166
|
+
name: R,
|
|
167
|
+
disabled: U,
|
|
168
|
+
readOnly: L,
|
|
169
|
+
required: ae,
|
|
170
|
+
grid: W,
|
|
171
|
+
isGrouped: A,
|
|
172
|
+
virtualized: Fe,
|
|
173
|
+
openOnInputClick: de,
|
|
174
|
+
itemToStringLabel: f,
|
|
175
|
+
isItemEqualToValue: J,
|
|
176
|
+
modal: Me,
|
|
177
|
+
autoHighlight: p,
|
|
178
|
+
submitOnItemClick: He,
|
|
179
|
+
hasInputValue: Z,
|
|
180
|
+
mounted: !1,
|
|
181
|
+
forceMounted: !1,
|
|
182
|
+
transitionStatus: "idle",
|
|
183
|
+
inline: me,
|
|
184
|
+
activeIndex: null,
|
|
185
|
+
selectedIndex: null,
|
|
186
|
+
popupProps: {},
|
|
187
|
+
inputProps: {},
|
|
188
|
+
triggerProps: {},
|
|
189
|
+
positionerElement: null,
|
|
190
|
+
listElement: null,
|
|
191
|
+
triggerElement: null,
|
|
192
|
+
inputElement: null,
|
|
193
|
+
popupSide: null,
|
|
194
|
+
openMethod: null,
|
|
195
|
+
inputInsidePopup: !0,
|
|
196
|
+
onOpenChangeComplete: tt || F,
|
|
197
|
+
// Placeholder callbacks replaced on first render
|
|
198
|
+
setOpen: F,
|
|
199
|
+
setInputValue: F,
|
|
200
|
+
setSelectedValue: F,
|
|
201
|
+
setIndices: F,
|
|
202
|
+
onItemHighlighted: F,
|
|
203
|
+
handleSelection: F,
|
|
204
|
+
getItemProps: () => An,
|
|
205
|
+
forceMount: F,
|
|
206
|
+
requestSubmit: F
|
|
207
|
+
})).current, D = s === "none" ? h : n, Ut = o.useMemo(() => s === "none" ? D : Array.isArray(n) ? n.map((e) => se(e, H)) : se(n, H), [D, H, s, n]), Ge = E(Rt), Qe = E(tt), Ve = k(i, q.activeIndex), Gt = k(i, q.selectedIndex), be = k(i, q.positionerElement), It = k(i, q.listElement), ie = k(i, q.triggerElement), _e = k(i, q.inputElement), O = k(i, q.inline), G = k(i, q.inputInsidePopup), Qt = un(ie), {
|
|
208
|
+
mounted: ht,
|
|
209
|
+
setMounted: _t,
|
|
210
|
+
transitionStatus: ze
|
|
211
|
+
} = vn(c), {
|
|
212
|
+
openMethod: Ct,
|
|
213
|
+
triggerProps: Ye,
|
|
214
|
+
reset: zt
|
|
215
|
+
} = Vn(c);
|
|
216
|
+
gn({
|
|
217
|
+
id: K,
|
|
218
|
+
name: R,
|
|
219
|
+
commit: b.commit,
|
|
220
|
+
value: D,
|
|
221
|
+
controlRef: G ? Qt : I,
|
|
222
|
+
getValue: () => Ut
|
|
223
|
+
});
|
|
224
|
+
const Pe = E(() => {
|
|
225
|
+
u ? st.current = v.map((e) => w(e, f)) : i.set("forceMounted", !0);
|
|
226
|
+
}), Yt = o.useRef(n);
|
|
227
|
+
z(() => {
|
|
228
|
+
n !== Yt.current && Pe();
|
|
229
|
+
}, [Pe, n]);
|
|
230
|
+
const C = E((e) => {
|
|
231
|
+
i.update(e);
|
|
232
|
+
const t = e.type || "none";
|
|
233
|
+
if (e.activeIndex !== void 0)
|
|
234
|
+
if (e.activeIndex === null)
|
|
235
|
+
P.current !== Y && (P.current = Y, Ge(void 0, le(t, void 0, {
|
|
236
|
+
index: -1
|
|
237
|
+
})));
|
|
238
|
+
else {
|
|
239
|
+
const r = X.current[e.activeIndex];
|
|
240
|
+
P.current = {
|
|
241
|
+
value: r,
|
|
242
|
+
index: e.activeIndex
|
|
243
|
+
}, Ge(r, le(t, void 0, {
|
|
244
|
+
index: e.activeIndex
|
|
245
|
+
}));
|
|
246
|
+
}
|
|
247
|
+
}), x = E((e, t) => {
|
|
248
|
+
if (at.current = t.reason === te, M.onInputValueChange?.(e, t), !t.isCanceled) {
|
|
249
|
+
if (t.reason === De) {
|
|
250
|
+
const r = e.trim() !== "";
|
|
251
|
+
r && Ce(!0), Le.current = {
|
|
252
|
+
hasQuery: r
|
|
253
|
+
}, r && p && i.state.activeIndex == null && i.set("activeIndex", 0);
|
|
254
|
+
}
|
|
255
|
+
Lt(e);
|
|
256
|
+
}
|
|
257
|
+
}), oe = E((e, t) => {
|
|
258
|
+
c !== e && (t.reason === "escape-key" && $ && v.length === 0 && !i.state.emptyRef.current && t.allowPropagation(), M.onOpenChange?.(e, t), !t.isCanceled && (!e && N && (y ? (xe(g), g === "" && Ce(!1)) : d && (O || G ? C({
|
|
259
|
+
activeIndex: null
|
|
260
|
+
}) : xe(g), x("", V(te, t.event)))), Nt(e)));
|
|
261
|
+
}), Re = E((e, t) => {
|
|
262
|
+
if (Pt?.(e, t), t.isCanceled)
|
|
263
|
+
return;
|
|
264
|
+
ye(e), (s === "none" && we.current && Mt || y && !i.state.inputInsidePopup) && x(w(e, f), V(t.reason, t.event)), y && e != null && t.reason !== De && N && xe(g);
|
|
265
|
+
}), jt = E((e, t) => {
|
|
266
|
+
let r = t;
|
|
267
|
+
if (r === void 0) {
|
|
268
|
+
if (Ve === null)
|
|
269
|
+
return;
|
|
270
|
+
r = X.current[Ve];
|
|
271
|
+
}
|
|
272
|
+
const l = vt(e), a = ke.current ?? e;
|
|
273
|
+
ke.current = null;
|
|
274
|
+
const m = V(wn, a), Q = l?.closest("a")?.getAttribute("href");
|
|
275
|
+
if (Q) {
|
|
276
|
+
Q.startsWith("#") && oe(!1, m);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (d) {
|
|
280
|
+
const _ = Array.isArray(n) ? n : [], rn = Oe(_, r, i.state.isItemEqualToValue) ? Rn(_, r, i.state.isItemEqualToValue) : [..._, r];
|
|
281
|
+
if (Re(rn, m), !(I.current ? I.current.value.trim() !== "" : !1))
|
|
282
|
+
return;
|
|
283
|
+
i.state.inputInsidePopup ? x("", V(te, m.event)) : oe(!1, m);
|
|
284
|
+
} else
|
|
285
|
+
Re(r, m), oe(!1, m);
|
|
286
|
+
}), je = E(() => {
|
|
287
|
+
if (!i.state.submitOnItemClick)
|
|
288
|
+
return;
|
|
289
|
+
const e = i.state.inputElement?.form;
|
|
290
|
+
e && typeof e.requestSubmit == "function" && e.requestSubmit();
|
|
291
|
+
}), Be = E(() => {
|
|
292
|
+
if (_t(!1), Qe?.(!1), Ce(!1), zt(), xe(null), C(s === "none" ? {
|
|
293
|
+
activeIndex: null,
|
|
294
|
+
selectedIndex: null
|
|
295
|
+
} : {
|
|
296
|
+
activeIndex: null
|
|
297
|
+
}), d && I.current && I.current.value !== "" && !at.current && x("", V(te)), y)
|
|
298
|
+
if (i.state.inputInsidePopup)
|
|
299
|
+
I.current && I.current.value !== "" && x("", V(te));
|
|
300
|
+
else {
|
|
301
|
+
const e = w(n, f);
|
|
302
|
+
I.current && I.current.value !== e && x(e, V(e === "" ? te : j));
|
|
303
|
+
}
|
|
304
|
+
}), Bt = o.useMemo(() => O && be ? {
|
|
305
|
+
current: be.closest('[role="dialog"]')
|
|
306
|
+
} : we, [O, be]);
|
|
307
|
+
mn({
|
|
308
|
+
enabled: !M.actionsRef,
|
|
309
|
+
open: c,
|
|
310
|
+
ref: Bt,
|
|
311
|
+
onComplete() {
|
|
312
|
+
c || Be();
|
|
313
|
+
}
|
|
314
|
+
}), o.useImperativeHandle(M.actionsRef, () => ({
|
|
315
|
+
unmount: Be
|
|
316
|
+
}), [Be]), z(function() {
|
|
317
|
+
if (c || s === "none")
|
|
318
|
+
return;
|
|
319
|
+
const t = u ? T : dt.current;
|
|
320
|
+
if (d) {
|
|
321
|
+
const r = Array.isArray(n) ? n : [], l = r[r.length - 1], a = yt(t, l, J);
|
|
322
|
+
C({
|
|
323
|
+
selectedIndex: a === -1 ? null : a
|
|
324
|
+
});
|
|
325
|
+
} else {
|
|
326
|
+
const r = yt(t, n, J);
|
|
327
|
+
C({
|
|
328
|
+
selectedIndex: r === -1 ? null : r
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
}, [c, n, u, s, T, d, J, C]), z(() => {
|
|
332
|
+
u && (X.current = v, qe.current.length = v.length);
|
|
333
|
+
}, [u, v]), z(() => {
|
|
334
|
+
const e = Le.current;
|
|
335
|
+
if (e && (e.hasQuery ? p && i.set("activeIndex", 0) : p === "always" && i.set("activeIndex", 0), Le.current = null), !c && !O)
|
|
336
|
+
return;
|
|
337
|
+
const r = $ || Ne ? v : X.current, l = i.state.activeIndex;
|
|
338
|
+
if (l == null) {
|
|
339
|
+
if (p === "always" && r.length > 0) {
|
|
340
|
+
i.set("activeIndex", 0);
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
P.current !== Y && (P.current = Y, i.state.onItemHighlighted(void 0, le(j, void 0, {
|
|
344
|
+
index: -1
|
|
345
|
+
})));
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (l >= r.length) {
|
|
349
|
+
P.current !== Y && (P.current = Y, i.state.onItemHighlighted(void 0, le(j, void 0, {
|
|
350
|
+
index: -1
|
|
351
|
+
}))), i.set("activeIndex", null);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const a = r[l], m = P.current.value, Q = m !== En && i.state.isItemEqualToValue(a, m);
|
|
355
|
+
(P.current.index !== l || !Q) && (P.current = {
|
|
356
|
+
value: a,
|
|
357
|
+
index: l
|
|
358
|
+
}, i.state.onItemHighlighted(a, le(j, void 0, {
|
|
359
|
+
index: l
|
|
360
|
+
})));
|
|
361
|
+
}, [Ve, p, Ne, $, v, O, c, i]), z(() => {
|
|
362
|
+
if (!u || s === "none")
|
|
363
|
+
return;
|
|
364
|
+
const e = T;
|
|
365
|
+
if (d) {
|
|
366
|
+
const l = Array.isArray(n) ? n : ue, a = l.filter((m) => Oe(e, m, i.state.isItemEqualToValue));
|
|
367
|
+
a.length !== l.length && ye(a);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
if (n == null ? !0 : Oe(e, n, i.state.isItemEqualToValue))
|
|
371
|
+
return;
|
|
372
|
+
let r = null;
|
|
373
|
+
if (B != null && Oe(e, B, i.state.isItemEqualToValue) && (r = B), ye(r), !i.state.inputInsidePopup) {
|
|
374
|
+
const l = w(r, f);
|
|
375
|
+
I.current && I.current.value !== l && x(l, V(j));
|
|
376
|
+
}
|
|
377
|
+
}, [u, T, d, s, n, B, ye, f, i, x]), z(() => {
|
|
378
|
+
if (s === "none") {
|
|
379
|
+
Te(String(h) !== "");
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
Te(d ? Array.isArray(n) && n.length > 0 : n != null);
|
|
383
|
+
}, [Te, s, h, n, d]), o.useEffect(() => {
|
|
384
|
+
$ && p && v.length === 0 && C({
|
|
385
|
+
activeIndex: null
|
|
386
|
+
});
|
|
387
|
+
}, [$, p, v.length, C]), Ae(g, () => {
|
|
388
|
+
!c || g === "" || g === String(mt) || Ce(!0);
|
|
389
|
+
}), Ae(n, () => {
|
|
390
|
+
if (s !== "none" && (lt(R), pe(n !== ge.initialValue), Ie() ? b.commit(n) : b.commit(n, !0), d && i.state.selectedIndex !== null && (!Array.isArray(n) || n.length === 0) && C({
|
|
391
|
+
activeIndex: null,
|
|
392
|
+
selectedIndex: null
|
|
393
|
+
}), y && !Z && !G)) {
|
|
394
|
+
const e = w(n, f);
|
|
395
|
+
h !== e && x(e, V(j));
|
|
396
|
+
}
|
|
397
|
+
}), Ae(h, () => {
|
|
398
|
+
s === "none" && (lt(R), pe(h !== ge.initialValue), Ie() ? b.commit(h) : b.commit(h, !0));
|
|
399
|
+
}), Ae(u, () => {
|
|
400
|
+
if (!y || Z || G || N)
|
|
401
|
+
return;
|
|
402
|
+
const e = w(n, f);
|
|
403
|
+
h !== e && x(e, V(j));
|
|
404
|
+
});
|
|
405
|
+
const Ee = On({
|
|
406
|
+
open: O ? !0 : c,
|
|
407
|
+
onOpenChange: oe,
|
|
408
|
+
elements: {
|
|
409
|
+
reference: G ? ie : _e,
|
|
410
|
+
floating: be
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
let We, Je;
|
|
414
|
+
O || (We = W ? "grid" : "listbox", Je = c ? "true" : "false");
|
|
415
|
+
const Wt = o.useMemo(() => {
|
|
416
|
+
const e = _e?.tagName === "INPUT", t = e || c, r = e ? {
|
|
417
|
+
autoComplete: "off",
|
|
418
|
+
spellCheck: "false",
|
|
419
|
+
autoCorrect: "off",
|
|
420
|
+
autoCapitalize: "none"
|
|
421
|
+
} : {};
|
|
422
|
+
return t && (r.role = "combobox", r["aria-expanded"] = Je, r["aria-haspopup"] = We, r["aria-controls"] = c ? It?.id : void 0, r["aria-autocomplete"] = ot), {
|
|
423
|
+
reference: r,
|
|
424
|
+
floating: {
|
|
425
|
+
role: "presentation"
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}, [_e, c, Je, We, It?.id, ot]), Jt = Fn(Ee, {
|
|
429
|
+
enabled: !L && !U && de,
|
|
430
|
+
event: "mousedown-only",
|
|
431
|
+
toggle: !1,
|
|
432
|
+
// Apply a small delay for touch to let iOS viewport centering settle.
|
|
433
|
+
// This avoids top-bottom flip flickers if the preferred position is "top" when first tapping.
|
|
434
|
+
touchOpenDelay: G ? 0 : 50
|
|
435
|
+
}), Kt = Mn(Ee, {
|
|
436
|
+
enabled: !L && !U && !O,
|
|
437
|
+
outsidePressEvent: {
|
|
438
|
+
mouse: "sloppy",
|
|
439
|
+
// The visual viewport (affected by the mobile software keyboard) can be
|
|
440
|
+
// somewhat small. The user may want to scroll the screen to see more of
|
|
441
|
+
// the popup.
|
|
442
|
+
touch: "intentional"
|
|
443
|
+
},
|
|
444
|
+
// Without a popup, let the Escape key bubble the event up to other popups' handlers.
|
|
445
|
+
bubbles: O ? !0 : void 0,
|
|
446
|
+
outsidePress(e) {
|
|
447
|
+
const t = vt(e);
|
|
448
|
+
return !et(ie, t) && !et(ft.current, t) && !et(ct.current, t);
|
|
449
|
+
}
|
|
450
|
+
}), Xt = Hn(Ee, {
|
|
451
|
+
enabled: !L && !U,
|
|
452
|
+
id: K,
|
|
453
|
+
listRef: qe,
|
|
454
|
+
activeIndex: Ve,
|
|
455
|
+
selectedIndex: Gt,
|
|
456
|
+
virtual: !0,
|
|
457
|
+
loopFocus: !0,
|
|
458
|
+
allowEscape: !p,
|
|
459
|
+
focusItemOnOpen: N || s === "none" && !p ? !1 : "auto",
|
|
460
|
+
focusItemOnHover: Ft,
|
|
461
|
+
resetOnPointerLeave: !Ot,
|
|
462
|
+
// `cols` > 1 enables grid navigation.
|
|
463
|
+
// Since <Combobox.Row> infers column sizes (and is required when building a grid),
|
|
464
|
+
// it works correctly even with a value of `2`.
|
|
465
|
+
// Floating UI tests don't require `role="row"` wrappers, so retains the number API.
|
|
466
|
+
cols: W ? 2 : 1,
|
|
467
|
+
orientation: W ? "horizontal" : void 0,
|
|
468
|
+
disabledIndices: ue,
|
|
469
|
+
onNavigate(e, t) {
|
|
470
|
+
!t && !c || ze === "ending" || C(t ? {
|
|
471
|
+
activeIndex: e,
|
|
472
|
+
type: ut.current ? "keyboard" : "pointer"
|
|
473
|
+
} : {
|
|
474
|
+
activeIndex: e
|
|
475
|
+
});
|
|
476
|
+
}
|
|
477
|
+
}), {
|
|
478
|
+
getReferenceProps: Ke,
|
|
479
|
+
getFloatingProps: Xe,
|
|
480
|
+
getItemProps: Ze
|
|
481
|
+
} = Tn([Wt, Jt, Kt, Xt]);
|
|
482
|
+
on(() => {
|
|
483
|
+
i.update({
|
|
484
|
+
inline: me,
|
|
485
|
+
popupProps: Xe(),
|
|
486
|
+
inputProps: Ke(),
|
|
487
|
+
triggerProps: Ye,
|
|
488
|
+
getItemProps: Ze,
|
|
489
|
+
setOpen: oe,
|
|
490
|
+
setInputValue: x,
|
|
491
|
+
setSelectedValue: Re,
|
|
492
|
+
setIndices: C,
|
|
493
|
+
onItemHighlighted: Ge,
|
|
494
|
+
handleSelection: jt,
|
|
495
|
+
forceMount: Pe,
|
|
496
|
+
requestSubmit: je
|
|
497
|
+
});
|
|
498
|
+
}), z(() => {
|
|
499
|
+
i.update({
|
|
500
|
+
id: K,
|
|
501
|
+
selectedValue: n,
|
|
502
|
+
open: c,
|
|
503
|
+
mounted: ht,
|
|
504
|
+
transitionStatus: ze,
|
|
505
|
+
items: u,
|
|
506
|
+
inline: me,
|
|
507
|
+
popupProps: Xe(),
|
|
508
|
+
inputProps: Ke(),
|
|
509
|
+
triggerProps: Ye,
|
|
510
|
+
openMethod: Ct,
|
|
511
|
+
getItemProps: Ze,
|
|
512
|
+
selectionMode: s,
|
|
513
|
+
name: R,
|
|
514
|
+
disabled: U,
|
|
515
|
+
readOnly: L,
|
|
516
|
+
required: ae,
|
|
517
|
+
grid: W,
|
|
518
|
+
isGrouped: A,
|
|
519
|
+
virtualized: Fe,
|
|
520
|
+
onOpenChangeComplete: Qe,
|
|
521
|
+
openOnInputClick: de,
|
|
522
|
+
itemToStringLabel: f,
|
|
523
|
+
modal: Me,
|
|
524
|
+
autoHighlight: p,
|
|
525
|
+
isItemEqualToValue: J,
|
|
526
|
+
submitOnItemClick: He,
|
|
527
|
+
hasInputValue: Z,
|
|
528
|
+
requestSubmit: je
|
|
529
|
+
});
|
|
530
|
+
}, [i, K, n, c, ht, ze, u, Xe, Ke, Ze, Ct, Ye, s, R, U, L, ae, b, W, A, Fe, Qe, de, f, Me, J, He, Z, me, je, p]);
|
|
531
|
+
const Zt = ln(At, b.inputRef), $t = o.useMemo(() => ({
|
|
532
|
+
query: g,
|
|
533
|
+
filteredItems: re,
|
|
534
|
+
flatFilteredItems: v
|
|
535
|
+
}), [g, re, v]), Dt = o.useMemo(() => Array.isArray(D) ? "" : se(D, H), [D, H]), en = d && Array.isArray(n) && n.length > 0, tn = o.useMemo(() => !d || !Array.isArray(n) || !R ? null : n.map((e) => {
|
|
536
|
+
const t = se(e, H);
|
|
537
|
+
return /* @__PURE__ */ ee("input", {
|
|
538
|
+
type: "hidden",
|
|
539
|
+
name: R,
|
|
540
|
+
value: t
|
|
541
|
+
}, t);
|
|
542
|
+
}), [d, n, R, H]), nn = /* @__PURE__ */ Sn(o.Fragment, {
|
|
543
|
+
children: [M.children, /* @__PURE__ */ ee("input", {
|
|
544
|
+
...b.getInputValidationProps({
|
|
545
|
+
// Move focus when the hidden input is focused.
|
|
546
|
+
onFocus() {
|
|
547
|
+
if (G) {
|
|
548
|
+
ie?.focus();
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
(I.current || ie)?.focus();
|
|
552
|
+
},
|
|
553
|
+
// Handle browser autofill.
|
|
554
|
+
onChange(e) {
|
|
555
|
+
if (e.nativeEvent.defaultPrevented)
|
|
556
|
+
return;
|
|
557
|
+
const t = e.target.value, r = V(De, e.nativeEvent);
|
|
558
|
+
function l() {
|
|
559
|
+
if (d)
|
|
560
|
+
return;
|
|
561
|
+
if (s === "none") {
|
|
562
|
+
pe(t !== ge.initialValue), x(t, r), Ie() && b.commit(t);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
const a = X.current.find((m) => se(m, H).toLowerCase() === t.toLowerCase());
|
|
566
|
+
a != null && (pe(a !== ge.initialValue), Re?.(a, r), Ie() && b.commit(a));
|
|
567
|
+
}
|
|
568
|
+
u ? l() : (Pe(), queueMicrotask(l));
|
|
569
|
+
}
|
|
570
|
+
}),
|
|
571
|
+
id: K,
|
|
572
|
+
name: d || s === "none" ? void 0 : R,
|
|
573
|
+
disabled: U,
|
|
574
|
+
required: ae && !en,
|
|
575
|
+
readOnly: L,
|
|
576
|
+
value: Dt,
|
|
577
|
+
ref: Zt,
|
|
578
|
+
style: sn,
|
|
579
|
+
tabIndex: -1,
|
|
580
|
+
"aria-hidden": !0
|
|
581
|
+
}), tn]
|
|
582
|
+
});
|
|
583
|
+
return /* @__PURE__ */ ee(an.Provider, {
|
|
584
|
+
value: i,
|
|
585
|
+
children: /* @__PURE__ */ ee(cn.Provider, {
|
|
586
|
+
value: Ee,
|
|
587
|
+
children: /* @__PURE__ */ ee(fn.Provider, {
|
|
588
|
+
value: $t,
|
|
589
|
+
children: /* @__PURE__ */ ee(dn.Provider, {
|
|
590
|
+
value: h,
|
|
591
|
+
children: nn
|
|
592
|
+
})
|
|
593
|
+
})
|
|
594
|
+
})
|
|
595
|
+
});
|
|
596
|
+
}
|
|
5
597
|
export {
|
|
6
|
-
|
|
598
|
+
Cr as AriaCombobox
|
|
7
599
|
};
|
package/dist/index235.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
off(e, a) {
|
|
11
|
-
t.get(e)?.delete(a);
|
|
12
|
-
}
|
|
13
|
-
};
|
|
1
|
+
import n from "./index112.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
const e = /* @__PURE__ */ t.createContext(void 0);
|
|
4
|
+
process.env.NODE_ENV !== "production" && (e.displayName = "ComboboxChipContext");
|
|
5
|
+
function i() {
|
|
6
|
+
const o = t.useContext(e);
|
|
7
|
+
if (!o)
|
|
8
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "useComboboxChipContext must be used within a ComboboxChip" : n(17));
|
|
9
|
+
return o;
|
|
14
10
|
}
|
|
15
11
|
export {
|
|
16
|
-
|
|
12
|
+
e as ComboboxChipContext,
|
|
13
|
+
i as useComboboxChipContext
|
|
17
14
|
};
|
package/dist/index239.js
CHANGED