@yselimcan/ui 0.0.8 → 0.0.9

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 (266) hide show
  1. package/dist/index.js +15277 -100
  2. package/dist/styles.css +1 -1
  3. package/package.json +7 -10
  4. package/dist/index10.js +0 -137
  5. package/dist/index100.js +0 -8
  6. package/dist/index101.js +0 -10
  7. package/dist/index102.js +0 -90
  8. package/dist/index103.js +0 -15
  9. package/dist/index104.js +0 -65
  10. package/dist/index105.js +0 -40
  11. package/dist/index106.js +0 -16
  12. package/dist/index107.js +0 -35
  13. package/dist/index108.js +0 -21
  14. package/dist/index109.js +0 -8
  15. package/dist/index11.js +0 -21
  16. package/dist/index110.js +0 -6
  17. package/dist/index111.js +0 -7
  18. package/dist/index112.js +0 -14
  19. package/dist/index113.js +0 -21
  20. package/dist/index114.js +0 -15
  21. package/dist/index115.js +0 -299
  22. package/dist/index116.js +0 -7
  23. package/dist/index117.js +0 -41
  24. package/dist/index118.js +0 -128
  25. package/dist/index119.js +0 -23
  26. package/dist/index12.js +0 -20
  27. package/dist/index120.js +0 -79
  28. package/dist/index121.js +0 -67
  29. package/dist/index122.js +0 -48
  30. package/dist/index123.js +0 -16
  31. package/dist/index124.js +0 -8
  32. package/dist/index125.js +0 -32
  33. package/dist/index126.js +0 -7
  34. package/dist/index127.js +0 -30
  35. package/dist/index128.js +0 -20
  36. package/dist/index129.js +0 -24
  37. package/dist/index13.js +0 -206
  38. package/dist/index130.js +0 -61
  39. package/dist/index131.js +0 -20
  40. package/dist/index132.js +0 -30
  41. package/dist/index133.js +0 -43
  42. package/dist/index134.js +0 -45
  43. package/dist/index135.js +0 -24
  44. package/dist/index136.js +0 -51
  45. package/dist/index137.js +0 -54
  46. package/dist/index138.js +0 -20
  47. package/dist/index139.js +0 -14
  48. package/dist/index14.js +0 -24
  49. package/dist/index140.js +0 -25
  50. package/dist/index141.js +0 -38
  51. package/dist/index142.js +0 -233
  52. package/dist/index143.js +0 -286
  53. package/dist/index144.js +0 -56
  54. package/dist/index145.js +0 -18
  55. package/dist/index146.js +0 -82
  56. package/dist/index147.js +0 -6
  57. package/dist/index148.js +0 -33
  58. package/dist/index149.js +0 -26
  59. package/dist/index15.js +0 -19
  60. package/dist/index150.js +0 -18
  61. package/dist/index151.js +0 -72
  62. package/dist/index152.js +0 -6
  63. package/dist/index153.js +0 -107
  64. package/dist/index154.js +0 -82
  65. package/dist/index155.js +0 -266
  66. package/dist/index156.js +0 -14
  67. package/dist/index157.js +0 -13
  68. package/dist/index158.js +0 -43
  69. package/dist/index159.js +0 -7
  70. package/dist/index16.js +0 -8
  71. package/dist/index160.js +0 -69
  72. package/dist/index161.js +0 -12
  73. package/dist/index162.js +0 -11
  74. package/dist/index163.js +0 -8
  75. package/dist/index164.js +0 -136
  76. package/dist/index165.js +0 -56
  77. package/dist/index166.js +0 -14
  78. package/dist/index167.js +0 -120
  79. package/dist/index168.js +0 -14
  80. package/dist/index169.js +0 -14
  81. package/dist/index17.js +0 -46
  82. package/dist/index170.js +0 -69
  83. package/dist/index171.js +0 -15
  84. package/dist/index172.js +0 -15
  85. package/dist/index173.js +0 -15
  86. package/dist/index174.js +0 -14
  87. package/dist/index175.js +0 -90
  88. package/dist/index176.js +0 -14
  89. package/dist/index177.js +0 -14
  90. package/dist/index178.js +0 -59
  91. package/dist/index179.js +0 -14
  92. package/dist/index18.js +0 -41
  93. package/dist/index180.js +0 -14
  94. package/dist/index181.js +0 -21
  95. package/dist/index182.js +0 -11
  96. package/dist/index183.js +0 -11
  97. package/dist/index184.js +0 -106
  98. package/dist/index185.js +0 -10
  99. package/dist/index186.js +0 -35
  100. package/dist/index187.js +0 -77
  101. package/dist/index188.js +0 -17
  102. package/dist/index189.js +0 -31
  103. package/dist/index19.js +0 -80
  104. package/dist/index190.js +0 -15
  105. package/dist/index191.js +0 -10
  106. package/dist/index192.js +0 -25
  107. package/dist/index193.js +0 -27
  108. package/dist/index194.js +0 -163
  109. package/dist/index195.js +0 -116
  110. package/dist/index196.js +0 -78
  111. package/dist/index197.js +0 -67
  112. package/dist/index198.js +0 -11
  113. package/dist/index199.js +0 -25
  114. package/dist/index20.js +0 -25
  115. package/dist/index200.js +0 -8
  116. package/dist/index201.js +0 -6
  117. package/dist/index202.js +0 -12
  118. package/dist/index203.js +0 -41
  119. package/dist/index204.js +0 -59
  120. package/dist/index205.js +0 -30
  121. package/dist/index206.js +0 -10
  122. package/dist/index207.js +0 -15
  123. package/dist/index208.js +0 -14
  124. package/dist/index209.js +0 -14
  125. package/dist/index21.js +0 -40
  126. package/dist/index210.js +0 -24
  127. package/dist/index211.js +0 -14
  128. package/dist/index212.js +0 -10
  129. package/dist/index213.js +0 -45
  130. package/dist/index214.js +0 -599
  131. package/dist/index215.js +0 -14
  132. package/dist/index216.js +0 -19
  133. package/dist/index217.js +0 -50
  134. package/dist/index218.js +0 -202
  135. package/dist/index219.js +0 -50
  136. package/dist/index22.js +0 -31
  137. package/dist/index220.js +0 -22
  138. package/dist/index221.js +0 -35
  139. package/dist/index222.js +0 -9
  140. package/dist/index223.js +0 -29
  141. package/dist/index224.js +0 -14
  142. package/dist/index225.js +0 -24
  143. package/dist/index226.js +0 -130
  144. package/dist/index227.js +0 -47
  145. package/dist/index228.js +0 -20
  146. package/dist/index229.js +0 -7
  147. package/dist/index23.js +0 -25
  148. package/dist/index230.js +0 -183
  149. package/dist/index231.js +0 -78
  150. package/dist/index232.js +0 -401
  151. package/dist/index233.js +0 -6
  152. package/dist/index234.js +0 -7
  153. package/dist/index235.js +0 -17
  154. package/dist/index236.js +0 -23
  155. package/dist/index237.js +0 -8
  156. package/dist/index238.js +0 -211
  157. package/dist/index239.js +0 -6
  158. package/dist/index24.js +0 -56
  159. package/dist/index240.js +0 -16
  160. package/dist/index241.js +0 -50
  161. package/dist/index242.js +0 -6
  162. package/dist/index243.js +0 -15
  163. package/dist/index244.js +0 -60
  164. package/dist/index245.js +0 -32
  165. package/dist/index246.js +0 -16
  166. package/dist/index247.js +0 -11
  167. package/dist/index248.js +0 -209
  168. package/dist/index249.js +0 -17
  169. package/dist/index25.js +0 -35
  170. package/dist/index250.js +0 -324
  171. package/dist/index251.js +0 -5
  172. package/dist/index252.js +0 -5
  173. package/dist/index253.js +0 -489
  174. package/dist/index254.js +0 -10
  175. package/dist/index255.js +0 -4
  176. package/dist/index256.js +0 -46
  177. package/dist/index257.js +0 -58
  178. package/dist/index258.js +0 -10
  179. package/dist/index259.js +0 -4
  180. package/dist/index26.js +0 -7
  181. package/dist/index260.js +0 -57
  182. package/dist/index261.js +0 -58
  183. package/dist/index262.js +0 -4
  184. package/dist/index263.js +0 -4
  185. package/dist/index264.js +0 -4
  186. package/dist/index265.js +0 -4
  187. package/dist/index27.js +0 -82
  188. package/dist/index28.js +0 -32
  189. package/dist/index29.js +0 -6
  190. package/dist/index3.js +0 -181
  191. package/dist/index30.js +0 -9
  192. package/dist/index31.js +0 -6
  193. package/dist/index32.js +0 -23
  194. package/dist/index33.js +0 -207
  195. package/dist/index34.js +0 -25
  196. package/dist/index35.js +0 -102
  197. package/dist/index36.js +0 -69
  198. package/dist/index37.js +0 -66
  199. package/dist/index38.js +0 -113
  200. package/dist/index39.js +0 -53
  201. package/dist/index4.js +0 -47
  202. package/dist/index40.js +0 -35
  203. package/dist/index41.js +0 -28
  204. package/dist/index42.js +0 -18
  205. package/dist/index43.js +0 -27
  206. package/dist/index44.js +0 -25
  207. package/dist/index45.js +0 -36
  208. package/dist/index46.js +0 -78
  209. package/dist/index47.js +0 -65
  210. package/dist/index48.js +0 -128
  211. package/dist/index49.js +0 -19
  212. package/dist/index5.js +0 -52
  213. package/dist/index50.js +0 -86
  214. package/dist/index51.js +0 -6
  215. package/dist/index52.js +0 -268
  216. package/dist/index53.js +0 -25
  217. package/dist/index54.js +0 -207
  218. package/dist/index55.js +0 -146
  219. package/dist/index56.js +0 -88
  220. package/dist/index57.js +0 -29
  221. package/dist/index58.js +0 -30
  222. package/dist/index59.js +0 -48
  223. package/dist/index6.js +0 -93
  224. package/dist/index60.js +0 -79
  225. package/dist/index61.js +0 -45
  226. package/dist/index62.js +0 -46
  227. package/dist/index63.js +0 -76
  228. package/dist/index64.js +0 -45
  229. package/dist/index65.js +0 -22
  230. package/dist/index66.js +0 -101
  231. package/dist/index67.js +0 -14
  232. package/dist/index68.js +0 -6
  233. package/dist/index69.js +0 -321
  234. package/dist/index7.js +0 -294
  235. package/dist/index70.js +0 -24
  236. package/dist/index71.js +0 -143
  237. package/dist/index72.js +0 -200
  238. package/dist/index73.js +0 -43
  239. package/dist/index74.js +0 -29
  240. package/dist/index75.js +0 -148
  241. package/dist/index76.js +0 -32
  242. package/dist/index77.js +0 -53
  243. package/dist/index78.js +0 -28
  244. package/dist/index79.js +0 -15
  245. package/dist/index8.js +0 -264
  246. package/dist/index80.js +0 -15
  247. package/dist/index81.js +0 -135
  248. package/dist/index82.js +0 -31
  249. package/dist/index83.js +0 -35
  250. package/dist/index84.js +0 -17
  251. package/dist/index85.js +0 -2765
  252. package/dist/index86.js +0 -14
  253. package/dist/index87.js +0 -57
  254. package/dist/index88.js +0 -98
  255. package/dist/index89.js +0 -21
  256. package/dist/index9.js +0 -197
  257. package/dist/index90.js +0 -18
  258. package/dist/index91.js +0 -35
  259. package/dist/index92.js +0 -14
  260. package/dist/index93.js +0 -92
  261. package/dist/index94.js +0 -7
  262. package/dist/index95.js +0 -69
  263. package/dist/index96.js +0 -11
  264. package/dist/index97.js +0 -16
  265. package/dist/index98.js +0 -6
  266. package/dist/index99.js +0 -6
package/dist/index214.js DELETED
@@ -1,599 +0,0 @@
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"
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
- }
597
- export {
598
- Cr as AriaCombobox
599
- };
package/dist/index215.js DELETED
@@ -1,14 +0,0 @@
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
- }
11
- export {
12
- e as ComboboxChipContext,
13
- i as useComboboxChipContext
14
- };
package/dist/index216.js DELETED
@@ -1,19 +0,0 @@
1
- import * as n from "react";
2
- function e(i) {
3
- const o = n.useRef(""), c = n.useCallback((r) => {
4
- r.defaultPrevented || (o.current = r.pointerType, i(r, r.pointerType));
5
- }, [i]);
6
- return {
7
- onClick: n.useCallback((r) => {
8
- if (r.detail === 0) {
9
- i(r, "keyboard");
10
- return;
11
- }
12
- "pointerType" in r && i(r, r.pointerType), i(r, o.current), o.current = "";
13
- }, [i]),
14
- onPointerDown: c
15
- };
16
- }
17
- export {
18
- e as useEnhancedClickHandler
19
- };
package/dist/index217.js DELETED
@@ -1,50 +0,0 @@
1
- import { getEmptyRootContext as i } from "./index249.js";
2
- import { EMPTY_OBJECT as n } from "./index100.js";
3
- import { createSelector as t } from "./index220.js";
4
- function l() {
5
- return {
6
- open: !1,
7
- mounted: !1,
8
- transitionStatus: "idle",
9
- floatingRootContext: i(),
10
- preventUnmountingOnClose: !1,
11
- payload: void 0,
12
- activeTriggerId: null,
13
- activeTriggerElement: null,
14
- popupElement: null,
15
- positionerElement: null,
16
- activeTriggerProps: n,
17
- inactiveTriggerProps: n,
18
- popupProps: n
19
- };
20
- }
21
- const a = {
22
- open: t((e) => e.open),
23
- mounted: t((e) => e.mounted),
24
- transitionStatus: t((e) => e.transitionStatus),
25
- floatingRootContext: t((e) => e.floatingRootContext),
26
- preventUnmountingOnClose: t((e) => e.preventUnmountingOnClose),
27
- payload: t((e) => e.payload),
28
- activeTriggerId: t((e) => e.activeTriggerId),
29
- activeTriggerElement: t((e) => e.mounted ? e.activeTriggerElement : null),
30
- /**
31
- * Whether the trigger with the given ID was used to open the popup.
32
- */
33
- isTriggerActive: t((e, o) => o !== void 0 && e.activeTriggerId === o),
34
- /**
35
- * Whether the popup is open and was activated by a trigger with the given ID.
36
- */
37
- isOpenedByTrigger: t((e, o) => o !== void 0 && e.activeTriggerId === o && e.open),
38
- /**
39
- * Whether the popup is mounted and was activated by a trigger with the given ID.
40
- */
41
- isMountedByTrigger: t((e, o) => o !== void 0 && e.activeTriggerId === o && e.mounted),
42
- triggerProps: t((e, o) => o ? e.activeTriggerProps : e.inactiveTriggerProps),
43
- popupProps: t((e) => e.popupProps),
44
- popupElement: t((e) => e.popupElement),
45
- positionerElement: t((e) => e.positionerElement)
46
- };
47
- export {
48
- l as createInitialPopupStoreState,
49
- a as popupStoreSelectors
50
- };