@yselimcan/ui 0.0.5 → 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.
Files changed (198) hide show
  1. package/dist/index100.js +32 -5
  2. package/dist/index101.js +19 -8
  3. package/dist/index102.js +4 -86
  4. package/dist/index103.js +4 -13
  5. package/dist/index104.js +5 -63
  6. package/dist/index105.js +12 -38
  7. package/dist/index106.js +19 -14
  8. package/dist/index107.js +13 -33
  9. package/dist/index108.js +297 -19
  10. package/dist/index109.js +4 -5
  11. package/dist/index110.js +39 -4
  12. package/dist/index111.js +126 -5
  13. package/dist/index112.js +4 -11
  14. package/dist/index113.js +21 -19
  15. package/dist/index114.js +77 -13
  16. package/dist/index115.js +59 -291
  17. package/dist/index116.js +45 -4
  18. package/dist/index117.js +65 -37
  19. package/dist/index118.js +8 -125
  20. package/dist/index119.js +13 -20
  21. package/dist/index120.js +3 -76
  22. package/dist/index121.js +3 -64
  23. package/dist/index122.js +5 -45
  24. package/dist/index123.js +134 -14
  25. package/dist/index124.js +27 -5
  26. package/dist/index125.js +6 -27
  27. package/dist/index127.js +11 -26
  28. package/dist/index128.js +20 -15
  29. package/dist/index129.js +14 -22
  30. package/dist/index130.js +5 -58
  31. package/dist/index131.js +28 -16
  32. package/dist/index132.js +15 -25
  33. package/dist/index133.js +21 -40
  34. package/dist/index134.js +59 -43
  35. package/dist/index135.js +15 -19
  36. package/dist/index136.js +26 -47
  37. package/dist/index137.js +38 -49
  38. package/dist/index138.js +43 -18
  39. package/dist/index139.js +21 -11
  40. package/dist/index140.js +48 -22
  41. package/dist/index141.js +50 -34
  42. package/dist/index142.js +16 -229
  43. package/dist/index143.js +11 -283
  44. package/dist/index144.js +21 -52
  45. package/dist/index145.js +35 -15
  46. package/dist/index146.js +225 -74
  47. package/dist/index147.js +283 -3
  48. package/dist/index148.js +53 -30
  49. package/dist/index149.js +16 -24
  50. package/dist/index150.js +79 -15
  51. package/dist/index151.js +3 -69
  52. package/dist/index152.js +31 -4
  53. package/dist/index153.js +22 -103
  54. package/dist/index154.js +15 -79
  55. package/dist/index155.js +65 -259
  56. package/dist/index156.js +4 -12
  57. package/dist/index157.js +105 -11
  58. package/dist/index158.js +76 -37
  59. package/dist/index159.js +263 -4
  60. package/dist/index160.js +11 -66
  61. package/dist/index161.js +10 -9
  62. package/dist/index162.js +40 -8
  63. package/dist/index163.js +4 -5
  64. package/dist/index164.js +62 -129
  65. package/dist/index165.js +10 -54
  66. package/dist/index166.js +8 -11
  67. package/dist/index167.js +6 -118
  68. package/dist/index168.js +53 -11
  69. package/dist/index169.js +11 -8
  70. package/dist/index17.js +4 -4
  71. package/dist/index170.js +117 -12
  72. package/dist/index171.js +11 -22
  73. package/dist/index172.js +1 -1
  74. package/dist/index173.js +2 -2
  75. package/dist/index174.js +1 -1
  76. package/dist/index175.js +2 -2
  77. package/dist/index176.js +1 -1
  78. package/dist/index177.js +1 -1
  79. package/dist/index178.js +6 -6
  80. package/dist/index179.js +1 -1
  81. package/dist/index18.js +3 -3
  82. package/dist/index180.js +1 -1
  83. package/dist/index181.js +1 -1
  84. package/dist/index182.js +1 -1
  85. package/dist/index183.js +1 -1
  86. package/dist/index184.js +1 -1
  87. package/dist/index187.js +6 -6
  88. package/dist/index189.js +2 -2
  89. package/dist/index19.js +9 -9
  90. package/dist/index190.js +2 -2
  91. package/dist/index191.js +1 -1
  92. package/dist/index192.js +2 -2
  93. package/dist/index193.js +1 -1
  94. package/dist/index194.js +2 -2
  95. package/dist/index195.js +2 -2
  96. package/dist/index196.js +7 -7
  97. package/dist/index197.js +3 -3
  98. package/dist/index198.js +6 -6
  99. package/dist/index199.js +1 -1
  100. package/dist/index20.js +2 -2
  101. package/dist/index200.js +47 -5
  102. package/dist/index201.js +193 -41
  103. package/dist/index202.js +30 -182
  104. package/dist/index203.js +20 -48
  105. package/dist/index204.js +27 -20
  106. package/dist/index205.js +5 -26
  107. package/dist/index206.js +9 -11
  108. package/dist/index207.js +11 -6
  109. package/dist/index208.js +17 -4
  110. package/dist/index209.js +6 -9
  111. package/dist/index21.js +3 -3
  112. package/dist/index210.js +4 -17
  113. package/dist/index217.js +2 -2
  114. package/dist/index218.js +1 -1
  115. package/dist/index219.js +4 -39
  116. package/dist/index22.js +5 -5
  117. package/dist/index220.js +4 -56
  118. package/dist/index221.js +14 -27
  119. package/dist/index222.js +32 -7
  120. package/dist/index223.js +37 -11
  121. package/dist/index224.js +57 -12
  122. package/dist/index225.js +27 -11
  123. package/dist/index226.js +6 -20
  124. package/dist/index227.js +11 -10
  125. package/dist/index228.js +11 -7
  126. package/dist/index229.js +11 -42
  127. package/dist/index23.js +2 -2
  128. package/dist/index230.js +22 -4
  129. package/dist/index231.js +11 -4
  130. package/dist/index232.js +6 -595
  131. package/dist/index233.js +42 -11
  132. package/dist/index234.js +594 -12
  133. package/dist/index235.js +11 -32
  134. package/dist/index239.js +2 -2
  135. package/dist/index24.js +8 -8
  136. package/dist/index242.js +4 -4
  137. package/dist/index243.js +1 -1
  138. package/dist/index244.js +1 -1
  139. package/dist/index246.js +2 -2
  140. package/dist/index247.js +1 -1
  141. package/dist/index251.js +1 -1
  142. package/dist/index32.js +1 -1
  143. package/dist/index33.js +15 -15
  144. package/dist/index34.js +5 -5
  145. package/dist/index35.js +12 -12
  146. package/dist/index36.js +10 -10
  147. package/dist/index37.js +7 -7
  148. package/dist/index38.js +7 -7
  149. package/dist/index39.js +4 -4
  150. package/dist/index40.js +2 -2
  151. package/dist/index41.js +2 -2
  152. package/dist/index42.js +2 -2
  153. package/dist/index43.js +1 -1
  154. package/dist/index45.js +5 -5
  155. package/dist/index46.js +9 -9
  156. package/dist/index47.js +8 -8
  157. package/dist/index48.js +17 -17
  158. package/dist/index49.js +4 -4
  159. package/dist/index50.js +10 -10
  160. package/dist/index52.js +14 -14
  161. package/dist/index53.js +1 -1
  162. package/dist/index54.js +16 -16
  163. package/dist/index55.js +8 -8
  164. package/dist/index56.js +9 -9
  165. package/dist/index58.js +1 -1
  166. package/dist/index59.js +2 -2
  167. package/dist/index60.js +6 -6
  168. package/dist/index61.js +2 -2
  169. package/dist/index62.js +2 -2
  170. package/dist/index63.js +5 -5
  171. package/dist/index64.js +2 -2
  172. package/dist/index66.js +7 -7
  173. package/dist/index69.js +31 -31
  174. package/dist/index70.js +5 -5
  175. package/dist/index71.js +16 -16
  176. package/dist/index72.js +22 -22
  177. package/dist/index73.js +7 -7
  178. package/dist/index74.js +1 -1
  179. package/dist/index75.js +11 -11
  180. package/dist/index76.js +2 -2
  181. package/dist/index77.js +4 -4
  182. package/dist/index78.js +2 -2
  183. package/dist/index79.js +1 -1
  184. package/dist/index80.js +1 -1
  185. package/dist/index81.js +16 -16
  186. package/dist/index82.js +4 -4
  187. package/dist/index83.js +4 -4
  188. package/dist/index87.js +7 -7
  189. package/dist/index88.js +9 -9
  190. package/dist/index89.js +5 -5
  191. package/dist/index94.js +7 -4
  192. package/dist/index95.js +86 -65
  193. package/dist/index96.js +12 -8
  194. package/dist/index97.js +61 -12
  195. package/dist/index98.js +38 -4
  196. package/dist/index99.js +14 -4
  197. package/dist/styles.css +1 -1
  198. package/package.json +4 -3
package/dist/index234.js CHANGED
@@ -1,17 +1,599 @@
1
- function o() {
2
- const t = /* @__PURE__ */ new Map();
3
- return {
4
- emit(e, a) {
5
- t.get(e)?.forEach((n) => n(a));
6
- },
7
- on(e, a) {
8
- t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(a);
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"
9
443
  },
10
- off(e, a) {
11
- t.get(e)?.delete(a);
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
+ });
12
476
  }
13
- };
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
+ });
14
596
  }
15
597
  export {
16
- o as createEventEmitter
598
+ Cr as AriaCombobox
17
599
  };
package/dist/index235.js CHANGED
@@ -1,35 +1,14 @@
1
- "use client";
2
- import * as r from "react";
3
- import { useMergedRefs as p } from "./index95.js";
4
- import { useCompositeRootContext as h } from "./index170.js";
5
- import { useCompositeListItem as g } from "./index165.js";
6
- function I(m = {}) {
7
- const {
8
- highlightItemOnHover: s,
9
- highlightedIndex: c,
10
- onHighlightedIndexChange: i
11
- } = h(), {
12
- ref: u,
13
- index: e
14
- } = g(m), t = c === e, n = r.useRef(null), d = p(u, n);
15
- return {
16
- compositeProps: r.useMemo(() => ({
17
- tabIndex: t ? 0 : -1,
18
- onFocus() {
19
- i(e);
20
- },
21
- onMouseMove() {
22
- const o = n.current;
23
- if (!s || !o)
24
- return;
25
- const f = o.hasAttribute("disabled") || o.ariaDisabled === "true";
26
- !t && !f && o.focus();
27
- }
28
- }), [t, i, e, s]),
29
- compositeRef: d,
30
- index: e
31
- };
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;
32
10
  }
33
11
  export {
34
- I as useCompositeItem
12
+ e as ComboboxChipContext,
13
+ i as useComboboxChipContext
35
14
  };
package/dist/index239.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getNodeName as V } from "./index164.js";
2
- import { getDocument as y } from "./index151.js";
1
+ import { getNodeName as V } from "./index123.js";
2
+ import { getDocument as y } from "./index155.js";
3
3
  const u = {
4
4
  inert: /* @__PURE__ */ new WeakMap(),
5
5
  "aria-hidden": /* @__PURE__ */ new WeakMap(),
package/dist/index24.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import C from "./index94.js";
2
+ import C from "./index112.js";
3
3
  import * as r from "react";
4
- import { useDialogRootContext as N } from "./index103.js";
4
+ import { useDialogRootContext as N } from "./index96.js";
5
5
  import { useButton as b } from "./index89.js";
6
6
  import { useRenderElement as w } from "./index87.js";
7
- import { triggerOpenStateMapping as P } from "./index105.js";
8
- import { CLICK_TRIGGER_IDENTIFIER as v } from "./index119.js";
9
- import { useBaseUiId as x } from "./index109.js";
10
- import { useTriggerDataForwarding as y } from "./index120.js";
11
- import { useClick as M } from "./index121.js";
12
- import { useInteractions as O } from "./index122.js";
7
+ import { triggerOpenStateMapping as P } from "./index98.js";
8
+ import { CLICK_TRIGGER_IDENTIFIER as v } from "./index113.js";
9
+ import { useBaseUiId as x } from "./index102.js";
10
+ import { useTriggerDataForwarding as y } from "./index114.js";
11
+ import { useClick as M } from "./index115.js";
12
+ import { useInteractions as O } from "./index116.js";
13
13
  const S = /* @__PURE__ */ r.forwardRef(function(i, g) {
14
14
  const {
15
15
  render: k,