@yselimcan/ui 0.0.6 → 0.0.8

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 (236) hide show
  1. package/dist/index100.js +5 -32
  2. package/dist/index101.js +8 -19
  3. package/dist/index102.js +86 -4
  4. package/dist/index103.js +13 -4
  5. package/dist/index104.js +63 -5
  6. package/dist/index105.js +38 -12
  7. package/dist/index106.js +14 -19
  8. package/dist/index107.js +33 -13
  9. package/dist/index108.js +19 -297
  10. package/dist/index109.js +5 -4
  11. package/dist/index110.js +4 -39
  12. package/dist/index111.js +5 -126
  13. package/dist/index112.js +11 -4
  14. package/dist/index113.js +19 -21
  15. package/dist/index114.js +13 -77
  16. package/dist/index115.js +291 -59
  17. package/dist/index116.js +4 -45
  18. package/dist/index117.js +37 -65
  19. package/dist/index118.js +125 -8
  20. package/dist/index119.js +20 -13
  21. package/dist/index120.js +76 -3
  22. package/dist/index121.js +64 -3
  23. package/dist/index122.js +45 -5
  24. package/dist/index123.js +14 -134
  25. package/dist/index124.js +5 -27
  26. package/dist/index125.js +27 -6
  27. package/dist/index127.js +26 -11
  28. package/dist/index128.js +15 -20
  29. package/dist/index129.js +22 -14
  30. package/dist/index130.js +58 -5
  31. package/dist/index131.js +16 -28
  32. package/dist/index132.js +25 -15
  33. package/dist/index133.js +40 -21
  34. package/dist/index134.js +43 -59
  35. package/dist/index135.js +19 -15
  36. package/dist/index136.js +47 -26
  37. package/dist/index137.js +49 -38
  38. package/dist/index138.js +18 -43
  39. package/dist/index139.js +11 -21
  40. package/dist/index140.js +22 -48
  41. package/dist/index141.js +34 -50
  42. package/dist/index142.js +229 -16
  43. package/dist/index143.js +283 -11
  44. package/dist/index144.js +52 -21
  45. package/dist/index145.js +15 -35
  46. package/dist/index146.js +74 -225
  47. package/dist/index147.js +3 -283
  48. package/dist/index148.js +30 -53
  49. package/dist/index149.js +24 -16
  50. package/dist/index150.js +15 -79
  51. package/dist/index151.js +69 -3
  52. package/dist/index152.js +4 -31
  53. package/dist/index153.js +103 -22
  54. package/dist/index154.js +79 -15
  55. package/dist/index155.js +259 -65
  56. package/dist/index156.js +12 -4
  57. package/dist/index157.js +11 -105
  58. package/dist/index158.js +37 -76
  59. package/dist/index159.js +4 -263
  60. package/dist/index160.js +66 -11
  61. package/dist/index161.js +9 -10
  62. package/dist/index162.js +8 -40
  63. package/dist/index163.js +5 -4
  64. package/dist/index164.js +129 -62
  65. package/dist/index165.js +54 -10
  66. package/dist/index166.js +11 -8
  67. package/dist/index167.js +118 -6
  68. package/dist/index168.js +11 -53
  69. package/dist/index169.js +6 -6
  70. package/dist/index17.js +4 -4
  71. package/dist/index170.js +63 -114
  72. package/dist/index171.js +8 -7
  73. package/dist/index172.js +13 -12
  74. package/dist/index173.js +11 -65
  75. package/dist/index174.js +10 -11
  76. package/dist/index175.js +87 -12
  77. package/dist/index176.js +7 -8
  78. package/dist/index177.js +11 -11
  79. package/dist/index178.js +52 -83
  80. package/dist/index179.js +11 -11
  81. package/dist/index18.js +4 -4
  82. package/dist/index180.js +11 -11
  83. package/dist/index181.js +16 -54
  84. package/dist/index182.js +8 -11
  85. package/dist/index183.js +7 -10
  86. package/dist/index184.js +102 -17
  87. package/dist/index185.js +7 -8
  88. package/dist/index186.js +32 -8
  89. package/dist/index187.js +73 -102
  90. package/dist/index188.js +14 -7
  91. package/dist/index189.js +27 -31
  92. package/dist/index19.js +9 -9
  93. package/dist/index190.js +12 -74
  94. package/dist/index191.js +7 -14
  95. package/dist/index192.js +21 -27
  96. package/dist/index193.js +25 -8
  97. package/dist/index194.js +159 -21
  98. package/dist/index195.js +114 -25
  99. package/dist/index196.js +67 -152
  100. package/dist/index197.js +62 -111
  101. package/dist/index198.js +8 -75
  102. package/dist/index199.js +22 -64
  103. package/dist/index20.js +2 -2
  104. package/dist/index200.js +5 -47
  105. package/dist/index201.js +4 -200
  106. package/dist/index202.js +9 -47
  107. package/dist/index203.js +39 -20
  108. package/dist/index204.js +57 -27
  109. package/dist/index205.js +27 -5
  110. package/dist/index206.js +7 -9
  111. package/dist/index207.js +12 -11
  112. package/dist/index208.js +11 -16
  113. package/dist/index209.js +11 -6
  114. package/dist/index21.js +3 -3
  115. package/dist/index210.js +22 -4
  116. package/dist/index211.js +11 -21
  117. package/dist/index212.js +7 -127
  118. package/dist/index213.js +43 -45
  119. package/dist/index214.js +595 -16
  120. package/dist/index215.js +12 -5
  121. package/dist/index216.js +15 -179
  122. package/dist/index217.js +47 -75
  123. package/dist/index218.js +186 -385
  124. package/dist/index219.js +48 -4
  125. package/dist/index22.js +5 -5
  126. package/dist/index220.js +19 -4
  127. package/dist/index221.js +30 -12
  128. package/dist/index222.js +5 -31
  129. package/dist/index223.js +26 -38
  130. package/dist/index224.js +12 -57
  131. package/dist/index225.js +21 -27
  132. package/dist/index226.js +127 -7
  133. package/dist/index227.js +45 -13
  134. package/dist/index228.js +18 -12
  135. package/dist/index229.js +5 -12
  136. package/dist/index23.js +2 -2
  137. package/dist/index230.js +178 -19
  138. package/dist/index231.js +75 -11
  139. package/dist/index232.js +398 -7
  140. package/dist/index233.js +4 -43
  141. package/dist/index234.js +5 -597
  142. package/dist/index235.js +14 -11
  143. package/dist/index236.js +20 -208
  144. package/dist/index237.js +6 -4
  145. package/dist/index238.js +208 -13
  146. package/dist/index239.js +3 -47
  147. package/dist/index24.js +9 -9
  148. package/dist/index240.js +13 -3
  149. package/dist/index241.js +45 -10
  150. package/dist/index242.js +3 -57
  151. package/dist/index243.js +11 -28
  152. package/dist/index244.js +56 -12
  153. package/dist/index245.js +30 -9
  154. package/dist/index246.js +12 -205
  155. package/dist/index247.js +9 -15
  156. package/dist/index248.js +189 -304
  157. package/dist/index249.js +15 -3
  158. package/dist/index250.js +322 -3
  159. package/dist/index251.js +3 -21
  160. package/dist/index252.js +3 -6
  161. package/dist/index253.js +1 -1
  162. package/dist/index256.js +1 -1
  163. package/dist/index257.js +1 -1
  164. package/dist/index260.js +1 -1
  165. package/dist/index261.js +1 -1
  166. package/dist/index262.js +2 -2
  167. package/dist/index264.js +2 -2
  168. package/dist/index28.js +1 -1
  169. package/dist/index29.js +1 -1
  170. package/dist/index30.js +1 -1
  171. package/dist/index31.js +1 -1
  172. package/dist/index32.js +1 -1
  173. package/dist/index33.js +16 -16
  174. package/dist/index34.js +5 -5
  175. package/dist/index35.js +12 -12
  176. package/dist/index36.js +10 -10
  177. package/dist/index37.js +7 -7
  178. package/dist/index38.js +8 -8
  179. package/dist/index39.js +4 -4
  180. package/dist/index40.js +2 -2
  181. package/dist/index41.js +2 -2
  182. package/dist/index42.js +2 -2
  183. package/dist/index43.js +1 -1
  184. package/dist/index45.js +5 -5
  185. package/dist/index46.js +9 -9
  186. package/dist/index47.js +9 -9
  187. package/dist/index48.js +18 -18
  188. package/dist/index49.js +4 -4
  189. package/dist/index50.js +11 -11
  190. package/dist/index51.js +1 -1
  191. package/dist/index52.js +24 -24
  192. package/dist/index53.js +3 -3
  193. package/dist/index54.js +30 -30
  194. package/dist/index55.js +13 -13
  195. package/dist/index56.js +12 -12
  196. package/dist/index57.js +1 -1
  197. package/dist/index58.js +2 -2
  198. package/dist/index59.js +5 -5
  199. package/dist/index60.js +11 -11
  200. package/dist/index61.js +4 -4
  201. package/dist/index62.js +3 -3
  202. package/dist/index63.js +11 -11
  203. package/dist/index64.js +4 -4
  204. package/dist/index65.js +3 -3
  205. package/dist/index66.js +13 -13
  206. package/dist/index68.js +1 -1
  207. package/dist/index69.js +31 -31
  208. package/dist/index70.js +5 -5
  209. package/dist/index71.js +16 -16
  210. package/dist/index72.js +22 -22
  211. package/dist/index73.js +7 -7
  212. package/dist/index74.js +1 -1
  213. package/dist/index75.js +12 -12
  214. package/dist/index76.js +2 -2
  215. package/dist/index77.js +4 -4
  216. package/dist/index78.js +2 -2
  217. package/dist/index79.js +1 -1
  218. package/dist/index80.js +1 -1
  219. package/dist/index81.js +17 -17
  220. package/dist/index82.js +4 -4
  221. package/dist/index83.js +4 -4
  222. package/dist/index87.js +7 -7
  223. package/dist/index88.js +9 -9
  224. package/dist/index89.js +19 -90
  225. package/dist/index90.js +15 -18
  226. package/dist/index91.js +33 -16
  227. package/dist/index92.js +12 -33
  228. package/dist/index93.js +90 -12
  229. package/dist/index94.js +4 -7
  230. package/dist/index95.js +65 -86
  231. package/dist/index96.js +8 -12
  232. package/dist/index97.js +12 -61
  233. package/dist/index98.js +4 -38
  234. package/dist/index99.js +4 -14
  235. package/dist/styles.css +1 -1
  236. package/package.json +7 -4
package/dist/index214.js CHANGED
@@ -1,20 +1,599 @@
1
- import { hide as a } from "./index216.js";
2
- const o = {
3
- name: "hide",
4
- async fn(e) {
5
- const {
6
- width: n,
7
- height: d,
8
- x: i,
9
- y: t
10
- } = e.rects.reference, r = n === 0 && d === 0 && i === 0 && t === 0;
11
- return {
12
- data: {
13
- referenceHidden: (await a().fn(e)).data?.referenceHidden || r
1
+ "use client";
2
+ import * as o from "react";
3
+ import { useControlled as $e } from "./index125.js";
4
+ import { useIsoLayoutEffect as z } from "./index126.js";
5
+ import { useOnFirstRender as on } from "./index124.js";
6
+ import { useStableCallback as E } from "./index127.js";
7
+ import { useMergedRefs as ln } from "./index95.js";
8
+ import { visuallyHidden as sn } from "./index123.js";
9
+ import { useRefWithInit as xt } from "./index101.js";
10
+ import { useValueAsRef as un } from "./index128.js";
11
+ import { createGenericEventDetails as le, createChangeEventDetails as V } from "./index107.js";
12
+ import { ComboboxRootContext as an, ComboboxFloatingContext as cn, ComboboxDerivedItemsContext as fn, ComboboxInputValueContext as dn } from "./index203.js";
13
+ import { selectors as q } from "./index204.js";
14
+ import { useOpenChangeComplete as mn } from "./index113.js";
15
+ import { useFieldRootContext as pn } from "./index130.js";
16
+ import { useField as gn } from "./index136.js";
17
+ import { useFormContext as In } from "./index135.js";
18
+ import { useLabelableId as hn } from "./index132.js";
19
+ import { createSingleSelectionCollatorFilter as Cn, createCollatorItemFilter as xn } from "./index236.js";
20
+ import { useCoreFilter as yn } from "./index213.js";
21
+ import { useTransitionStatus as vn } from "./index133.js";
22
+ import { useOpenInteractionType as Vn } from "./index140.js";
23
+ import { useValueChanged as Ae } from "./index139.js";
24
+ import { isGroupedItems as bn, stringifyAsLabel as w, stringifyAsValue as se } from "./index137.js";
25
+ import { defaultItemEquality as Pn, findItemIndex as yt, itemIncludes as Oe, removeItem as Rn } from "./index138.js";
26
+ import { INITIAL_LAST_HIGHLIGHT as Y, NO_ACTIVE_VALUE as En } from "./index237.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 "./index100.js";
29
+ import { useStore as k } from "./index145.js";
30
+ import { useFloatingRootContext as On } from "./index141.js";
31
+ import { useClick as Fn } from "./index121.js";
32
+ import { useDismiss as Mn } from "./index142.js";
33
+ import { useListNavigation as Hn } from "./index143.js";
34
+ import { useInteractions as Tn } from "./index122.js";
35
+ import { Store as qn } from "./index146.js";
36
+ import { inputChange as De, inputClear as te, none as j, itemPress as wn } from "./index108.js";
37
+ import { getTarget as vt, contains as et } from "./index151.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"
14
426
  }
15
427
  };
16
- }
17
- };
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
+ }
18
597
  export {
19
- o as hide
598
+ Cr as AriaCombobox
20
599
  };
package/dist/index215.js CHANGED
@@ -1,7 +1,14 @@
1
- const e = {
2
- sideX: "left",
3
- sideY: "top"
4
- };
1
+ import n from "./index94.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;
10
+ }
5
11
  export {
6
- e as DEFAULT_SIDES
12
+ e as ComboboxChipContext,
13
+ i as useComboboxChipContext
7
14
  };