@choc-ui/chakra-autocomplete 5.8.4 → 5.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,181 +1,167 @@
1
- import { jsx as p, jsxs as V, Fragment as ut } from "react/jsx-runtime";
2
- import * as pe from "react";
3
- import ee, { useMemo as te, useRef as ne, useState as Ne, useEffect as D, useImperativeHandle as at, memo as ct } from "react";
4
- import { useDisclosure as ft, useControllableState as pt, useUpdateEffect as dt, forwardRef as H, Popover as gt, chakra as mt, useMergeRefs as De, Flex as de, Box as Xe, Divider as $e, InputGroup as vt, Input as ht, InputRightElement as yt, Spinner as Ze, useMultiStyleConfig as bt, Wrap as Ct, WrapItem as qe, PopoverAnchor as St, PopoverContent as xt, Center as At, Tag as It, TagLabel as wt, TagCloseButton as Ot } from "@chakra-ui/react";
5
- const [Et, j] = Ft();
6
- function Ft() {
7
- const e = pe.createContext(void 0);
1
+ import { jsx as f, jsxs as H, Fragment as st } from "react/jsx-runtime";
2
+ import * as ae from "react";
3
+ import q, { useMemo as J, useRef as X, useState as we, useEffect as L, useImperativeHandle as lt, memo as it } from "react";
4
+ import { useDisclosure as ut, useControllableState as at, useUpdateEffect as ct, forwardRef as k, Popover as ft, chakra as dt, useMergeRefs as Ee, Flex as ce, Box as Be, Divider as We, InputGroup as pt, Input as mt, InputRightElement as gt, Spinner as He, useMultiStyleConfig as ht, Wrap as vt, WrapItem as Ue, PopoverAnchor as yt, Portal as bt, PopoverContent as It, Center as Ct, Tag as St, TagLabel as xt, TagCloseButton as At } from "@chakra-ui/react";
5
+ const [wt, _] = Ot();
6
+ function Ot() {
7
+ const e = ae.createContext(void 0);
8
8
  e.displayName = "AutoCompleteContext";
9
9
  function t() {
10
- var o;
11
- const n = pe.useContext(e), r = "useAutoCompleteContext: `context` is undefined. Seems you forgot to wrap all autoomplete components within `<AutoComplete />`";
10
+ const n = ae.useContext(e), o = "useAutoCompleteContext: `context` is undefined. Seems you forgot to wrap all autoomplete components within `<AutoComplete />`";
12
11
  if (!n) {
13
- const l = new Error(r);
14
- throw l.name = "ContextError", (o = Error.captureStackTrace) == null || o.call(Error, l, t), l;
12
+ const r = new Error(o);
13
+ throw r.name = "ContextError", Error.captureStackTrace?.(r, t), r;
15
14
  }
16
15
  return n;
17
16
  }
18
17
  return [e.Provider, t, e];
19
18
  }
20
- function Lt(e) {
21
- return e == null ? void 0 : e[0];
19
+ function Et(e) {
20
+ return e?.[0];
22
21
  }
23
- function Pe(e) {
24
- return e != null && e.length ? e[e.length - 1] : void 0;
22
+ function Oe(e) {
23
+ return e?.length ? e[e.length - 1] : void 0;
25
24
  }
26
- function et(e, t, n = 1, r = !0) {
25
+ function Qe(e, t, n = 1, o = !0) {
27
26
  if (t === 0) return -1;
28
- let o = e + n;
29
- return e === -1 && (o = n > 0 ? 0 : t - 1), r ? o = (o % t + t) % t : o = Math.max(0, Math.min(o, t - 1)), o;
27
+ let r = e + n;
28
+ return e === -1 && (r = n > 0 ? 0 : t - 1), o ? r = (r % t + t) % t : r = Math.max(0, Math.min(r, t - 1)), r;
30
29
  }
31
- function Nt(e, t, n = !0) {
32
- return et(e, t, -1, n);
30
+ function Lt(e, t, n = !0) {
31
+ return Qe(e, t, -1, n);
33
32
  }
34
- function Pt(e, t, n = !0) {
35
- const r = et(e, t.length, 1, n);
36
- return t[r];
33
+ function Ft(e, t, n = !0) {
34
+ const o = Qe(e, t.length, 1, n);
35
+ return t[o];
37
36
  }
38
- function Dt(e, t, n = !0) {
39
- const r = Nt(e, t.length, n);
40
- return t[r];
37
+ function Nt(e, t, n = !0) {
38
+ const o = Lt(e, t.length, n);
39
+ return t[o];
41
40
  }
42
- function Re(e) {
41
+ function Le(e) {
43
42
  return Array.isArray(e);
44
43
  }
45
- function Rt(e) {
46
- return Re(e) && e.length === 0;
44
+ function Pt(e) {
45
+ return Le(e) && e.length === 0;
47
46
  }
48
- function Te(e) {
49
- return e !== null && typeof e == "object" && !Re(e);
47
+ function Fe(e) {
48
+ return e !== null && typeof e == "object" && !Le(e);
50
49
  }
51
- function Tt(e) {
52
- return Te(e) && Object.keys(e).length === 0;
50
+ function Rt(e) {
51
+ return Fe(e) && Object.keys(e).length === 0;
53
52
  }
54
- function Me(e) {
55
- return Re(e) ? Rt(e) : Te(e) ? Tt(e) : e == null || e === "";
53
+ function Ne(e) {
54
+ return Le(e) ? Pt(e) : Fe(e) ? Rt(e) : e == null || e === "";
56
55
  }
57
- function fe(e) {
56
+ function ue(e) {
58
57
  return typeof e > "u";
59
58
  }
60
- function tt(e) {
59
+ function $e(e) {
61
60
  return typeof e < "u";
62
61
  }
63
- function Mt(e, t) {
62
+ function Dt(e, t) {
64
63
  const n = {};
65
- return t.forEach((r) => {
66
- r in e && (n[r] = e[r]);
64
+ return t.forEach((o) => {
65
+ o in e && (n[o] = e[o]);
67
66
  }), n;
68
67
  }
69
- function _e(e, t) {
68
+ function Pe(e, t) {
70
69
  const n = { ...e };
71
- return t.forEach((r) => {
72
- delete n[r];
70
+ return t.forEach((o) => {
71
+ delete n[o];
73
72
  }), n;
74
73
  }
75
- function _t(e) {
74
+ function Tt(e) {
76
75
  return typeof e == "function";
77
76
  }
78
- function m(e, ...t) {
79
- return _t(e) ? e(...t) : e;
77
+ function p(e, ...t) {
78
+ return Tt(e) ? e(...t) : e;
80
79
  }
81
- var ge = function(e, t) {
82
- for (var n, r = pe.Children.toArray(e), o = 0, l = r; o < l.length; o++) {
83
- var i = l[o];
80
+ var fe = function(e, t) {
81
+ for (var n, o = ae.Children.toArray(e), r = 0, l = o; r < l.length; r++) {
82
+ var i = l[r];
84
83
  if (t(i))
85
84
  return i;
86
85
  if (!((n = i.props) === null || n === void 0) && n.children) {
87
- var u = ge(i.props.children, t);
86
+ var u = fe(i.props.children, t);
88
87
  if (u)
89
88
  return u;
90
89
  }
91
90
  }
92
- }, ce = function(e, t) {
93
- for (var n = 0, r = t.length, o = e.length; n < r; n++, o++)
94
- e[o] = t[n];
91
+ }, ie = function(e, t) {
92
+ for (var n = 0, o = t.length, r = e.length; n < o; n++, r++)
93
+ e[r] = t[n];
95
94
  return e;
96
- }, nt = function(e, t) {
97
- for (var n, r = pe.Children.toArray(e), o = [], l = 0, i = r; l < i.length; l++) {
95
+ }, Ke = function(e, t) {
96
+ for (var n, o = ae.Children.toArray(e), r = [], l = 0, i = o; l < i.length; l++) {
98
97
  var u = i[l];
99
- t(u) && (o = ce(ce([], o), [u])), !((n = u.props) === null || n === void 0) && n.children && (o = ce(ce([], o), nt(u.props.children, t)));
98
+ t(u) && (r = ie(ie([], r), [u])), !((n = u.props) === null || n === void 0) && n.children && (r = ie(ie([], r), Ke(u.props.children, t)));
100
99
  }
101
- return o;
100
+ return r;
102
101
  };
103
- function Ke(e, t, n = 2) {
104
- function r(c, E) {
105
- c = " ".repeat(E - 1) + c.toLowerCase() + " ".repeat(E - 1);
106
- let b = new Array(c.length - E + 1);
107
- for (let w = 0; w < b.length; w++)
108
- b[w] = c.slice(w, w + E);
109
- return b;
102
+ function je(e, t, n = 2) {
103
+ function o(a, w) {
104
+ a = " ".repeat(w - 1) + a.toLowerCase() + " ".repeat(w - 1);
105
+ let v = new Array(a.length - w + 1);
106
+ for (let S = 0; S < v.length; S++)
107
+ v[S] = a.slice(S, S + w);
108
+ return v;
110
109
  }
111
- if (!(e != null && e.length) || !(t != null && t.length))
110
+ if (!e?.length || !t?.length)
112
111
  return 0;
113
- let o = e.length < t.length ? e : t, l = e.length < t.length ? t : e, i = r(o, n), u = r(l, n), v = new Set(i), h = u.length, y = 0;
114
- for (let c of u)
115
- v.delete(c) && y++;
116
- return y / h;
112
+ let r = e.length < t.length ? e : t, l = e.length < t.length ? t : e, i = o(r, n), u = o(l, n), m = new Set(i), g = u.length, h = 0;
113
+ for (let a of u)
114
+ m.delete(a) && h++;
115
+ return h / g;
117
116
  }
118
- const Ge = (e) => {
119
- var t;
120
- return (t = typeof e == "string" || typeof e == "number" ? e : e[Object.keys(e)[0]]) == null ? void 0 : t.toString();
121
- }, Gt = (e, t) => typeof e != "string" || Me(t) ? e : e.toString().replace(
122
- new RegExp(zt(t), "gi"),
123
- (r) => `<mark>${r}</mark>`
124
- ), Wt = (e) => nt(
117
+ const Re = (e) => (typeof e == "string" || typeof e == "number" ? e : e[Object.keys(e)[0]])?.toString(), Mt = (e, t) => typeof e != "string" || Ne(t) ? e : e.toString().replace(
118
+ new RegExp(jt(t), "gi"),
119
+ (o) => `<mark>${o}</mark>`
120
+ ), _t = (e) => Ke(
125
121
  e,
126
- (n) => {
127
- var r;
128
- return ((r = n == null ? void 0 : n.type) == null ? void 0 : r.displayName) === "AutoCompleteItem";
129
- }
122
+ (n) => n?.type?.displayName === "AutoCompleteItem"
130
123
  ).map((n) => {
131
- const r = Mt(n.props, ["value", "label", "fixed", "disabled"]), { getValue: o = Ge } = n.props, l = o(r.value);
132
- return { ...tt(r.label) ? r : { ...r, label: l }, value: l, originalValue: r.value };
133
- }), jt = () => ({
124
+ const o = Dt(n.props, ["value", "label", "fixed", "disabled"]), { getValue: r = Re } = n.props, l = r(o.value);
125
+ return { ...$e(o.label) ? o : { ...o, label: l }, value: l, originalValue: o.value };
126
+ }), Gt = () => ({
134
127
  bg: "whiteAlpha.100",
135
128
  _light: {
136
129
  bg: "gray.200"
137
130
  }
138
- }), kt = (e, t, n) => (t == null ? void 0 : t.toLowerCase().indexOf(e == null ? void 0 : e.toLowerCase())) >= 0 || (n == null ? void 0 : n.toLowerCase().indexOf(e == null ? void 0 : e.toLowerCase())) >= 0 || Ke(e, t) >= 0.5 || Ke(e, n) >= 0.5;
139
- function zt(e) {
131
+ }), Wt = (e, t, n) => t?.toLowerCase().indexOf(e?.toLowerCase()) >= 0 || n?.toLowerCase().indexOf(e?.toLowerCase()) >= 0 || je(e, t) >= 0.5 || je(e, n) >= 0.5;
132
+ function jt(e) {
140
133
  return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
141
134
  }
142
- const Bt = (e, t) => ge(
135
+ const kt = (e, t) => fe(
143
136
  e,
144
- (r) => {
145
- var o;
146
- return ((o = r == null ? void 0 : r.type) == null ? void 0 : o.displayName) === "AutoCompleteItem" && r.props.value === (t == null ? void 0 : t.value);
147
- }
148
- ), Ht = (e, t) => ge(
137
+ (o) => o?.type?.displayName === "AutoCompleteItem" && o.props.value === t?.value
138
+ ), Vt = (e, t) => fe(
149
139
  e,
150
- (r) => {
151
- var o;
152
- return ((o = r == null ? void 0 : r.type) == null ? void 0 : o.displayName) === "AutoCompleteItem" && r.props.value === (t == null ? void 0 : t.value);
153
- }
154
- ), Ut = (e, t) => tt(
155
- ge(e, (n) => {
156
- var o, l;
157
- const r = m(
158
- ((o = n.props) == null ? void 0 : o.getValue) || Ge,
159
- ((l = n.props) == null ? void 0 : l.value) || {}
140
+ (o) => o?.type?.displayName === "AutoCompleteItem" && o.props.value === t?.value
141
+ ), zt = (e, t) => $e(
142
+ fe(e, (n) => {
143
+ const o = p(
144
+ n.props?.getValue || Re,
145
+ n.props?.value || {}
160
146
  );
161
- return t.some((i) => i.value === r);
147
+ return t.some((r) => r.value === o);
162
148
  })
163
- ), Qt = (e, t) => {
164
- const n = {}, r = {}, { field: o } = e;
165
- return o && Object.keys(o).forEach((l) => {
149
+ ), Bt = (e, t) => {
150
+ const n = {}, o = {}, { field: r } = e;
151
+ return r && Object.keys(r).forEach((l) => {
166
152
  if (l.startsWith("--input") === !1)
167
- n[l] = o[l];
153
+ n[l] = r[l];
168
154
  else {
169
- let i = o[l];
170
- const v = l.replace("--input-", "").replace(/-([a-z])/g, function(h) {
171
- return h[1].toUpperCase();
155
+ let i = r[l];
156
+ const m = l.replace("--input-", "").replace(/-([a-z])/g, function(g) {
157
+ return g[1].toUpperCase();
172
158
  });
173
- i.indexOf(".") !== -1 && (i = i.substring(i.indexOf(".") + 1)), r[v] = i;
159
+ i.indexOf(".") !== -1 && (i = i.substring(i.indexOf(".") + 1)), o[m] = i;
174
160
  }
175
161
  }), {
176
162
  ...t && {
177
163
  ...n,
178
- ...r,
164
+ ...o,
179
165
  _focusWithin: e.field._focus,
180
166
  pos: "relative",
181
167
  minH: 9,
@@ -188,540 +174,518 @@ const Bt = (e, t) => ge(
188
174
  // w: "full",
189
175
  };
190
176
  };
191
- function $t(e) {
192
- var He;
177
+ function Ht(e) {
193
178
  let {
194
179
  prefocusFirstItem: t = !0,
195
180
  closeOnBlur: n = !0,
196
- creatable: r,
197
- emphasize: o,
181
+ creatable: o,
182
+ emphasize: r,
198
183
  emptyState: l = !0,
199
184
  defaultEmptyStateProps: i = {},
200
185
  freeSolo: u,
201
- isReadOnly: v,
202
- listAllValuesOnFocus: h,
203
- maxSuggestions: y,
204
- multiple: c,
205
- closeOnSelect: E = !c,
206
- defaultValue: b,
207
- defaultValues: w = b ? [b] : [],
208
- onReady: U,
209
- defaultIsOpen: k,
210
- disableFilter: oe,
211
- isLoading: me = !1,
212
- placement: re = "bottom",
213
- restoreOnBlurIfEmpty: Y = !u,
214
- shouldRenderSuggestions: ve = () => !0,
215
- submitKeys: he = [],
216
- suggestWhenEmpty: se,
217
- value: z,
218
- values: J = z ? typeof z == "string" ? [z] : [...z] : void 0
186
+ isReadOnly: m,
187
+ listAllValuesOnFocus: g,
188
+ maxSuggestions: h,
189
+ multiple: a,
190
+ closeOnSelect: w = !a,
191
+ defaultValue: v,
192
+ defaultValues: S = v ? [v] : [],
193
+ onReady: de,
194
+ defaultIsOpen: G,
195
+ disableFilter: Z,
196
+ isLoading: pe = !1,
197
+ placement: ee = "bottom",
198
+ restoreOnBlurIfEmpty: U = !u,
199
+ shouldRenderSuggestions: me = () => !0,
200
+ submitKeys: ge = [],
201
+ suggestWhenEmpty: te,
202
+ value: W,
203
+ values: Q = W ? typeof W == "string" ? [W] : [...W] : void 0
219
204
  } = e;
220
- u = u || (c ? !0 : e.freeSolo);
221
- const { isOpen: O, onClose: _, onOpen: Q } = ft({ defaultIsOpen: k }), ye = te(
222
- () => m(e.children, {
223
- isOpen: O,
224
- onClose: _,
225
- onOpen: Q
205
+ u = u || (a ? !0 : e.freeSolo);
206
+ const { isOpen: x, onClose: D, onOpen: V } = ut({ defaultIsOpen: G }), he = J(
207
+ () => p(e.children, {
208
+ isOpen: x,
209
+ onClose: D,
210
+ onOpen: V
226
211
  }),
227
- [e.children, O]
228
- ), x = te(() => Wt(ye), [ye]), N = ne(null), We = ne(null), X = ne(null), $ = ne(null), [je, le] = Ne(!1);
229
- let ie = "";
230
- c ? ie = "" : fe(w) ? fe(J) || (ie = J[0]) : ie = w[0];
231
- const [R, Z] = Ne(ie ?? ""), be = te(
232
- () => oe ? x : x.filter(
233
- (s) => s.fixed || m(
234
- e.filter || kt,
235
- R,
212
+ [e.children, x]
213
+ ), I = J(() => _t(he), [he]), T = X(null), De = X(null), ve = X(null), z = X(null), [Te, ne] = we(!1);
214
+ let oe = "";
215
+ a ? oe = "" : ue(S) ? ue(Q) || (oe = Q[0]) : oe = S[0];
216
+ const [F, $] = we(oe ?? ""), ye = J(
217
+ () => Z ? I : I.filter(
218
+ (s) => s.fixed || p(
219
+ e.filter || Wt,
220
+ F,
236
221
  s.value,
237
222
  s.label
238
- ) || je
223
+ ) || Te
239
224
  ).filter(
240
- (s, a) => y ? s.fixed || a < y : !0
225
+ (s, c) => h ? s.fixed || c < h : !0
241
226
  ),
242
- [R, x, je, y, oe]
243
- ), ue = r ? [{ value: R, noFilter: !0, creatable: !0 }] : [], C = te(() => [...be, ...ue], [be, ue]), st = te(() => [...x, ...ue], [x, ue]), [T, Ce] = pt({
244
- defaultValue: w.map((s) => s == null ? void 0 : s.toString()),
245
- value: J,
227
+ [F, I, Te, h, Z]
228
+ ), re = o ? [{ value: F, noFilter: !0, creatable: !0 }] : [], y = J(() => [...ye, ...re], [ye, re]), Je = J(() => [...I, ...re], [I, re]), [N, be] = at({
229
+ defaultValue: S.map((s) => s?.toString()),
230
+ value: Q,
246
231
  onChange: (s) => {
247
- const a = C.find((F) => F.value === s.at(-1));
248
- if (!a) return;
249
- const d = s.map(
250
- (F) => st.find((L) => L.value === F)
232
+ const c = y.find((A) => A.value === s.at(-1));
233
+ if (!c) return;
234
+ const C = s.map(
235
+ (A) => Je.find((E) => E.value === A)
251
236
  );
252
- m(
237
+ p(
253
238
  e.onChange,
254
- c ? s : s[0],
255
- c ? d : a
239
+ a ? s : s[0],
240
+ a ? C : c
256
241
  );
257
242
  }
258
243
  });
259
- D(() => {
260
- C.length === 0 && !l && O && _();
261
- }, [C.length, l, O]);
262
- const [K, G] = Ne(
263
- t ? (He = x[0]) == null ? void 0 : He.value : null
264
- ), lt = e.maxSelections || T.length + 1, Se = C.findIndex((s) => s.value === K), xe = Pt(
265
- Se,
266
- C,
244
+ L(() => {
245
+ y.length === 0 && !l && x && D();
246
+ }, [y.length, l, x]);
247
+ const [B, M] = we(
248
+ t ? I[0]?.value : null
249
+ ), Xe = e.maxSelections || N.length + 1, Ie = y.findIndex((s) => s.value === B), Ze = Ft(
250
+ Ie,
251
+ y,
267
252
  !!e.rollNavigation
268
- ), Ae = Dt(
269
- Se,
270
- C,
253
+ ), et = Nt(
254
+ Ie,
255
+ y,
271
256
  !!e.rollNavigation
272
- ), P = Lt(C), Ie = Pe(C), ke = !C.some(
273
- (s) => s.value === K
257
+ ), se = Et(y), tt = Oe(y), Me = !y.some(
258
+ (s) => s.value === B
274
259
  );
275
- D(() => {
276
- var s;
277
- ke && G(t ? (s = x[0]) == null ? void 0 : s.value : null);
278
- }, [ke]), dt(() => {
279
- t && G(P == null ? void 0 : P.value);
280
- }, [R, P == null ? void 0 : P.value]), D(() => {
281
- var s;
282
- !O && t && G((s = x[0]) == null ? void 0 : s.value);
283
- }, [O]), D(() => {
284
- O && h && le(!0);
285
- }, [O, h, le]), D(() => {
286
- const s = x.find((a) => a.value === K);
287
- m(e.onOptionFocus, {
260
+ L(() => {
261
+ Me && M(t ? I[0]?.value : null);
262
+ }, [Me]), ct(() => {
263
+ t && M(se?.value);
264
+ }, [F, se?.value]), L(() => {
265
+ !x && t && M(I[0]?.value);
266
+ }, [x]), L(() => {
267
+ x && g && ne(!0);
268
+ }, [x, g, ne]), L(() => {
269
+ const s = I.find((c) => c.value === B);
270
+ p(e.onOptionFocus, {
288
271
  item: s,
289
- focusMethod: $.current,
290
- isNewInput: s == null ? void 0 : s.creatable
272
+ focusMethod: z.current,
273
+ isNewInput: s?.creatable
291
274
  });
292
- }, [K, e.onOptionFocus]);
293
- const we = (s) => {
294
- var F, L;
295
- const a = C.find((A) => A.value === s), d = (a == null ? void 0 : a.label) || (a == null ? void 0 : a.value);
296
- Z(() => c ? "" : d ?? ""), !T.includes(s) && T.length < lt && Ce((A) => c ? [...A, s] : [s]), c && ((F = N.current) == null || F.focus()), e.focusInputOnSelect && ((L = N.current) == null || L.focus()), m(e.onSelectOption, {
297
- item: a,
298
- selectMethod: $.current,
299
- isNewInput: a == null ? void 0 : a.creatable
300
- }), a != null && a.creatable && m(e.onCreateOption, {
301
- item: _e(a, ["noFilter"]),
302
- selectMethod: $.current
303
- }), E && _();
304
- }, ze = (s, a) => {
305
- var L;
306
- Ce((A) => {
307
- let W = x.find((M) => M.value === s);
308
- return !W && r === !0 && (W = { label: s, value: s }), W ? (m(e.onTagRemoved, s, W, A), A.filter((M) => M !== s)) : A;
275
+ }, [B, e.onOptionFocus]);
276
+ const Ce = (s) => {
277
+ const c = y.find((A) => A.value === s), C = c?.label || c?.value;
278
+ $(() => a ? "" : C ?? ""), !N.includes(s) && N.length < Xe && be((A) => a ? [...A, s] : [s]), a && T.current?.focus(), e.focusInputOnSelect && T.current?.focus(), p(e.onSelectOption, {
279
+ item: c,
280
+ selectMethod: z.current,
281
+ isNewInput: c?.creatable
282
+ }), c?.creatable && p(e.onCreateOption, {
283
+ item: Pe(c, ["noFilter"]),
284
+ selectMethod: z.current
285
+ }), w && D();
286
+ }, _e = (s, c) => {
287
+ be((E) => {
288
+ let P = I.find((j) => j.value === s);
289
+ return !P && o === !0 && (P = { label: s, value: s }), P ? (p(e.onTagRemoved, s, P, E), E.filter((j) => j !== s)) : E;
309
290
  });
310
- const d = x.find((A) => A.value === s), F = (d == null ? void 0 : d.label) || (d == null ? void 0 : d.value);
311
- R === F && Z(""), a && ((L = N.current) == null || L.focus());
312
- }, it = (s) => {
313
- var a;
314
- Ce([]), s && ((a = N.current) == null || a.focus());
315
- }, Be = c ? T.map((s) => {
316
- var a;
317
- return {
318
- label: ((a = x.find((d) => d.value === (s == null ? void 0 : s.toString()))) == null ? void 0 : a.label) || s,
319
- onRemove: () => ze(s)
320
- };
321
- }) : [];
322
- return D(() => {
323
- m(U, { tags: Be });
324
- }, [T]), {
291
+ const C = I.find((E) => E.value === s), A = C?.label || C?.value;
292
+ F === A && $(""), c && T.current?.focus();
293
+ }, nt = (s) => {
294
+ be([]), s && T.current?.focus();
295
+ }, Ge = a ? N.map((s) => ({
296
+ label: I.find((c) => c.value === s?.toString())?.label || s,
297
+ onRemove: () => _e(s)
298
+ })) : [];
299
+ return L(() => {
300
+ p(de, { tags: Ge });
301
+ }, [N]), {
325
302
  autoCompleteProps: e,
326
- children: ye,
327
- filteredList: C,
328
- filteredResults: be,
329
- focusedValue: K,
303
+ children: he,
304
+ filteredList: y,
305
+ filteredResults: ye,
306
+ focusedValue: B,
330
307
  defaultEmptyStateProps: i,
331
308
  getEmptyStateProps: (s) => {
332
- if (C.every((d) => d.noFilter) && l && !r)
333
- return typeof l == "boolean" ? s : m(l, { query: R });
309
+ if (y.every((C) => C.noFilter) && l && !o)
310
+ return typeof l == "boolean" ? s : p(l, { query: F });
334
311
  },
335
312
  getGroupProps: (s) => {
336
- const a = Ut(s.children, C);
313
+ const c = zt(s.children, y);
337
314
  return {
338
315
  divider: {
339
- hasFirstChild: Bt(s.children, P),
340
- hasLastChild: Ht(
316
+ hasFirstChild: kt(s.children, se),
317
+ hasLastChild: Vt(
341
318
  s.children,
342
- Pe(C.filter((d) => fe(d == null ? void 0 : d.noFilter)))
319
+ Oe(y.filter((C) => ue(C?.noFilter)))
343
320
  )
344
321
  },
345
322
  group: {
346
- display: a ? "initial" : "none"
323
+ display: c ? "initial" : "none"
347
324
  }
348
325
  };
349
326
  },
350
- getInputProps: (s, a) => {
351
- const { onBlur: d, onChange: F, onFocus: L, onKeyDown: A, variant: W, ...M } = s;
327
+ getInputProps: (s, c) => {
328
+ const { onBlur: C, onChange: A, onFocus: E, onKeyDown: P, variant: j, ...K } = s;
352
329
  return {
353
330
  wrapper: {
354
- ref: We,
331
+ ref: De,
355
332
  onClick: () => {
356
- var f;
357
- (f = N == null ? void 0 : N.current) == null || f.focus();
333
+ T?.current?.focus();
358
334
  },
359
- ...Qt(a, c),
360
- ...M
335
+ ...Bt(c, a),
336
+ ...K
361
337
  },
362
338
  input: {
363
- isReadOnly: v,
364
- onFocus: (f) => {
365
- m(L, f), e.openOnFocus && !v && Q(), e.selectOnFocus && f.target.select(), h && le(!0);
339
+ isReadOnly: m,
340
+ onFocus: (d) => {
341
+ p(E, d), e.openOnFocus && !m && V(), e.selectOnFocus && d.target.select(), g && ne(!0);
366
342
  },
367
- onBlur: (f) => {
368
- var B, ae;
369
- m(d, f);
370
- const S = f.relatedTarget === (X == null ? void 0 : X.current) || ((B = X.current) == null ? void 0 : B.contains(f.relatedTarget)), g = (ae = We.current) == null ? void 0 : ae.contains(
371
- f.relatedTarget
343
+ onBlur: (d) => {
344
+ p(C, d);
345
+ const b = d.relatedTarget === ve?.current || ve.current?.contains(d.relatedTarget), O = De.current?.contains(
346
+ d.relatedTarget
372
347
  );
373
- if (!S && !g && (n && _(), !T.includes(f.target.value) && Y)) {
374
- const Oe = Pe(T), I = x.find(
375
- (Fe) => Fe.value === Oe
376
- ), Ee = (I == null ? void 0 : I.label) || (I == null ? void 0 : I.value) || "";
377
- Z(Ee);
348
+ if (!b && !O && (n && D(), !N.includes(d.target.value) && U)) {
349
+ const Se = Oe(N), le = I.find(
350
+ (R) => R.value === Se
351
+ ), xe = le?.label || le?.value || "";
352
+ $(xe);
378
353
  }
379
354
  },
380
- onChange: (f) => {
381
- const S = f.target.value;
382
- m(F, f), Z(S);
383
- const g = Me(S);
384
- m(ve, S) && (!g || se) ? Q() : _(), le(!1);
355
+ onChange: (d) => {
356
+ const b = d.target.value;
357
+ p(A, d), $(b);
358
+ const O = Ne(b);
359
+ p(me, b) && (!O || te) ? V() : D(), ne(!1);
385
360
  },
386
- onKeyDown: (f) => {
387
- var B;
388
- m(A, f), $.current = "keyboard";
389
- const { key: S } = f, g = C[Se];
390
- if (["Enter", ...he].includes(S)) {
391
- g && !(g != null && g.disabled) && O ? we(g == null ? void 0 : g.value) : (B = N.current) == null || B.focus(), f.preventDefault();
361
+ onKeyDown: (d) => {
362
+ p(P, d), z.current = "keyboard";
363
+ const { key: b } = d, O = y[Ie];
364
+ if (["Enter", ...ge].includes(b)) {
365
+ O && !O?.disabled && x ? Ce(O?.value) : T.current?.focus(), d.preventDefault();
392
366
  return;
393
367
  }
394
- if (S === "ArrowDown") {
395
- O ? G(xe == null ? void 0 : xe.value) : Q(), f.preventDefault();
368
+ if (b === "ArrowDown") {
369
+ x ? M(Ze?.value) : V(), d.preventDefault();
396
370
  return;
397
371
  }
398
- if (S === "ArrowUp") {
399
- O ? G(Ae == null ? void 0 : Ae.value) : Q(), f.preventDefault();
372
+ if (b === "ArrowUp") {
373
+ x ? M(et?.value) : V(), d.preventDefault();
400
374
  return;
401
375
  }
402
- if (S === "Tab") {
403
- O && g && !(g != null && g.disabled) ? we(g == null ? void 0 : g.value) : _();
376
+ if (b === "Tab") {
377
+ x && O && !O?.disabled ? Ce(O?.value) : D();
404
378
  return;
405
379
  }
406
- if (S === "Home") {
407
- G(P == null ? void 0 : P.value), f.preventDefault();
380
+ if (b === "Home") {
381
+ M(se?.value), d.preventDefault();
408
382
  return;
409
383
  }
410
- if (S === "End") {
411
- G(Ie == null ? void 0 : Ie.value), f.preventDefault();
384
+ if (b === "End") {
385
+ M(tt?.value), d.preventDefault();
412
386
  return;
413
387
  }
414
- S === "Escape" && (_(), f.preventDefault());
388
+ b === "Escape" && (D(), d.preventDefault());
415
389
  },
416
- value: R,
417
- variant: c ? "unstyled" : W,
418
- ...M
390
+ value: F,
391
+ variant: a ? "unstyled" : j,
392
+ ...K
419
393
  }
420
394
  };
421
395
  },
422
- getItemProps: (s, a) => {
423
- var Ue;
396
+ getItemProps: (s, c) => {
424
397
  const {
425
- _fixed: d,
426
- _focus: F,
427
- children: L,
428
- disabled: A,
429
- label: W,
430
- value: M,
431
- fixed: f,
432
- getValue: S = Ge,
433
- onClick: g,
434
- onMouseOver: B,
435
- sx: ae,
436
- ...Oe
437
- } = s, I = a ? M : (Ue = S(M)) == null ? void 0 : Ue.toString(), Ee = I === K, Fe = C.findIndex((q) => q.value === I) >= 0, Le = L || W || I;
398
+ _fixed: C,
399
+ _focus: A,
400
+ children: E,
401
+ disabled: P,
402
+ label: j,
403
+ value: K,
404
+ fixed: d,
405
+ getValue: b = Re,
406
+ onClick: O,
407
+ onMouseOver: Se,
408
+ sx: le,
409
+ ...xe
410
+ } = s, R = c ? K : b(K)?.toString(), ot = R === B, rt = y.findIndex((Y) => Y.value === R) >= 0, Ae = E || j || R;
438
411
  return {
439
412
  item: {
440
- ...typeof Le != "string" || !o ? { children: Le } : {
413
+ ...typeof Ae != "string" || !r ? { children: Ae } : {
441
414
  dangerouslySetInnerHTML: {
442
- __html: Gt(Le, R)
415
+ __html: Mt(Ae, F)
443
416
  }
444
417
  },
445
- "aria-selected": T.includes(I),
446
- "aria-disabled": A,
418
+ "aria-selected": N.includes(R),
419
+ "aria-disabled": P,
447
420
  _disabled: { opacity: 0.4, cursor: "not-allowed", userSelect: "none" },
448
- onClick: (q) => {
449
- var Qe;
450
- m(g, q), A ? (Qe = N.current) == null || Qe.focus() : we(I);
421
+ onClick: (Y) => {
422
+ p(O, Y), P ? T.current?.focus() : Ce(R);
451
423
  },
452
- onMouseOver: (q) => {
453
- m(B, q), G(I), $.current = "mouse";
424
+ onMouseOver: (Y) => {
425
+ p(Se, Y), M(R), z.current = "mouse";
454
426
  },
455
427
  sx: {
456
- ...ae,
428
+ ...le,
457
429
  mark: {
458
430
  color: "inherit",
459
431
  bg: "transparent",
460
- ...Te(o) ? o : {
461
- fontWeight: o ? "extrabold" : "inherit"
432
+ ...Fe(r) ? r : {
433
+ fontWeight: r ? "extrabold" : "inherit"
462
434
  }
463
435
  }
464
436
  },
465
- ...Ee && (F || jt()),
466
- ...f && d,
467
- ...Oe
437
+ ...ot && (A || Gt()),
438
+ ...d && C,
439
+ ...xe
468
440
  },
469
441
  root: {
470
- isValidSuggestion: Fe,
471
- value: I
442
+ isValidSuggestion: rt,
443
+ value: R
472
444
  }
473
445
  };
474
446
  },
475
- inputRef: N,
476
- interactionRef: $,
477
- isLoading: me,
478
- isOpen: O,
479
- itemList: x,
480
- listRef: X,
481
- onClose: _,
482
- onOpen: Q,
483
- placement: re,
484
- query: R,
485
- removeItem: ze,
486
- resetItems: it,
487
- setQuery: Z,
488
- tags: Be,
489
- value: z,
490
- values: T
447
+ inputRef: T,
448
+ interactionRef: z,
449
+ isLoading: pe,
450
+ isOpen: x,
451
+ itemList: I,
452
+ listRef: ve,
453
+ onClose: D,
454
+ onOpen: V,
455
+ placement: ee,
456
+ query: F,
457
+ removeItem: _e,
458
+ resetItems: nt,
459
+ setQuery: $,
460
+ tags: Ge,
461
+ value: W,
462
+ values: N
491
463
  };
492
464
  }
493
- const Kt = H(
465
+ const Ut = k(
494
466
  (e, t) => {
495
- const n = $t(e), {
496
- children: r,
497
- isOpen: o,
467
+ const n = Ht(e), {
468
+ children: o,
469
+ isOpen: r,
498
470
  onClose: l,
499
471
  onOpen: i,
500
472
  placement: u,
501
- resetItems: v,
502
- removeItem: h
473
+ resetItems: m,
474
+ removeItem: g
503
475
  } = n;
504
- at(t, () => ({
505
- resetItems: v,
506
- removeItem: h
476
+ lt(t, () => ({
477
+ resetItems: m,
478
+ removeItem: g
507
479
  }));
508
- const { matchWidth: y = !0 } = n.autoCompleteProps;
509
- return /* @__PURE__ */ p(Et, { value: n, children: /* @__PURE__ */ p(
510
- gt,
480
+ const { matchWidth: h = !0 } = n.autoCompleteProps;
481
+ return /* @__PURE__ */ f(wt, { value: n, children: /* @__PURE__ */ f(
482
+ ft,
511
483
  {
512
484
  isLazy: !0,
513
- isOpen: o,
485
+ isOpen: r,
514
486
  autoFocus: !1,
515
487
  placement: u,
516
488
  closeOnBlur: !0,
517
- matchWidth: y,
518
- children: /* @__PURE__ */ p(mt.div, { w: "full", ref: t, children: r })
489
+ matchWidth: h,
490
+ children: /* @__PURE__ */ f(dt.div, { w: "full", ref: t, children: o })
519
491
  }
520
492
  ) });
521
493
  }
522
494
  );
523
- Kt.displayName = "AutoComplete";
524
- const Vt = H(
495
+ Ut.displayName = "AutoComplete";
496
+ const Qt = k(
525
497
  (e, t) => {
526
498
  const {
527
499
  focusedValue: n,
528
- getItemProps: r,
529
- interactionRef: o
530
- } = j(), l = ne(), i = De(t, l), u = r(e), { isValidSuggestion: v, value: h } = u.root, y = n === h;
531
- D(() => {
532
- var U;
533
- y && o.current === "keyboard" && ((U = l == null ? void 0 : l.current) == null || U.scrollIntoView({
500
+ getItemProps: o,
501
+ interactionRef: r
502
+ } = _(), l = X(), i = Ee(t, l), u = o(e), { isValidSuggestion: m, value: g } = u.root, h = n === g;
503
+ L(() => {
504
+ h && r.current === "keyboard" && l?.current?.scrollIntoView({
534
505
  behavior: "smooth",
535
506
  block: "nearest"
536
- }));
537
- }, [y, o]), D(() => {
538
- typeof h != "string" && console.warn("wow"), typeof h != "string" && fe(e.getValue) && console.error(
507
+ });
508
+ }, [h, r]), L(() => {
509
+ typeof g != "string" && console.warn("wow"), typeof g != "string" && ue(e.getValue) && console.error(
539
510
  "You must define the `getValue` prop, when an Item's value is not a string"
540
511
  );
541
512
  }, []);
542
- const { children: c, dangerouslySetInnerHTML: E, ...b } = u.item, w = _e(b, ["groupId"]);
543
- return v ? /* @__PURE__ */ p(de, { ref: i, ...ot, ...w, children: c || /* @__PURE__ */ p("span", { dangerouslySetInnerHTML: E }) }) : null;
513
+ const { children: a, dangerouslySetInnerHTML: w, ...v } = u.item, S = Pe(v, ["groupId"]);
514
+ return m ? /* @__PURE__ */ f(ce, { ref: i, ...Ye, ...S, children: a || /* @__PURE__ */ f("span", { dangerouslySetInnerHTML: w }) }) : null;
544
515
  }
545
516
  );
546
- Vt.displayName = "AutoCompleteItem";
547
- const ot = {
517
+ Qt.displayName = "AutoCompleteItem";
518
+ const Ye = {
548
519
  mx: "2",
549
520
  px: "2",
550
521
  py: "2",
551
522
  rounded: "md",
552
523
  cursor: "pointer"
553
524
  };
554
- function Yt(e) {
555
- const { alwaysDisplay: t, children: n, ...r } = e, {
556
- autoCompleteProps: o,
525
+ function $t(e) {
526
+ const { alwaysDisplay: t, children: n, ...o } = e, {
527
+ autoCompleteProps: r,
557
528
  getItemProps: l,
558
529
  query: i,
559
530
  filteredResults: u
560
- } = j(), { children: v, ...h } = l(
531
+ } = _(), { children: m, ...g } = l(
561
532
  {
562
533
  ...e,
563
534
  value: i,
564
- children: m(n, {
535
+ children: p(n, {
565
536
  value: i
566
537
  })
567
538
  },
568
539
  !0
569
- ).item, y = u.some((b) => b.value === i), c = Me(i) ? t : !0;
570
- return o.creatable && c && !y ? /* @__PURE__ */ p(de, { ...ot, ...h, ...r, children: v || `Add ${i}` }) : null;
540
+ ).item, h = u.some((v) => v.value === i), a = Ne(i) ? t : !0;
541
+ return r.creatable && a && !h ? /* @__PURE__ */ f(ce, { ...Ye, ...g, ...o, children: m || `Add ${i}` }) : null;
571
542
  }
572
- Yt.displayName = "AutoCompleteCreatable";
573
- const Jt = H(
543
+ $t.displayName = "AutoCompleteCreatable";
544
+ const Kt = k(
574
545
  (e, t) => {
575
- const { children: n, showDivider: r, ...o } = e, l = _e(o, ["groupSibling"]), { getGroupProps: i } = j(), { group: u } = i(e), v = qt(e);
576
- return /* @__PURE__ */ V(Xe, { ref: t, ...u, ...l, children: [
577
- /* @__PURE__ */ p($e, { ...v.top }),
546
+ const { children: n, showDivider: o, ...r } = e, l = Pe(r, ["groupSibling"]), { getGroupProps: i } = _(), { group: u } = i(e), m = Jt(e);
547
+ return /* @__PURE__ */ H(Be, { ref: t, ...u, ...l, children: [
548
+ /* @__PURE__ */ f(We, { ...m.top }),
578
549
  n,
579
- /* @__PURE__ */ p($e, { ...v.bottom })
550
+ /* @__PURE__ */ f(We, { ...m.bottom })
580
551
  ] });
581
552
  }
582
- ), Xt = H(
583
- (e, t) => /* @__PURE__ */ p(de, { ...Zt, ...e, ref: t })
553
+ ), Yt = k(
554
+ (e, t) => /* @__PURE__ */ f(ce, { ...qt, ...e, ref: t })
584
555
  );
585
- Jt.displayName = "AutoCompleteGroup";
586
- Xt.displayName = "AutoCompleteGroupTitle";
587
- const Zt = {
556
+ Kt.displayName = "AutoCompleteGroup";
557
+ Yt.displayName = "AutoCompleteGroupTitle";
558
+ const qt = {
588
559
  ml: 5,
589
560
  my: 1,
590
561
  fontSize: "xs",
591
562
  letterSpacing: "wider",
592
563
  fontWeight: "extrabold",
593
564
  textTransform: "uppercase"
594
- }, qt = (e) => {
595
- const { getGroupProps: t } = j(), n = e.groupSibling, {
596
- divider: { hasFirstChild: r, hasLastChild: o }
565
+ }, Jt = (e) => {
566
+ const { getGroupProps: t } = _(), n = e.groupSibling, {
567
+ divider: { hasFirstChild: o, hasLastChild: r }
597
568
  } = t(e), l = {
598
569
  my: 2,
599
570
  borderColor: e.dividerColor
600
571
  }, i = {
601
572
  ...l,
602
573
  mb: 4,
603
- display: !e.showDivider || r ? "none" : ""
574
+ display: !e.showDivider || o ? "none" : ""
604
575
  }, u = {
605
576
  ...l,
606
- display: !e.showDivider || o || n ? "none" : ""
577
+ display: !e.showDivider || r || n ? "none" : ""
607
578
  };
608
579
  return { top: i, bottom: u };
609
- }, Ve = H((e, t) => {
610
- const { isLoading: n } = j(), { loadingIcon: r, ...o } = e;
611
- return /* @__PURE__ */ V(vt, { children: [
612
- /* @__PURE__ */ p(ht, { ...o, ref: t }),
613
- n && /* @__PURE__ */ p(yt, { children: r || /* @__PURE__ */ p(Ze, {}) })
580
+ }, ke = k((e, t) => {
581
+ const { isLoading: n } = _(), { loadingIcon: o, ...r } = e;
582
+ return /* @__PURE__ */ H(pt, { children: [
583
+ /* @__PURE__ */ f(mt, { ...r, ref: t }),
584
+ n && /* @__PURE__ */ f(gt, { children: o || /* @__PURE__ */ f(He, {}) })
614
585
  ] });
615
- }), rt = H(
586
+ }), qe = k(
616
587
  (e, t) => {
617
588
  const {
618
589
  autoCompleteProps: n,
619
- inputRef: r,
620
- getInputProps: o,
590
+ inputRef: o,
591
+ getInputProps: r,
621
592
  tags: l,
622
593
  setQuery: i,
623
594
  value: u,
624
- itemList: v
625
- } = j(), {
626
- children: h,
627
- isInvalid: y,
628
- hidePlaceholder: c,
629
- ...E
630
- } = e, { value: b } = E;
631
- D(() => {
595
+ itemList: m
596
+ } = _(), {
597
+ children: g,
598
+ isInvalid: h,
599
+ hidePlaceholder: a,
600
+ ...w
601
+ } = e, { value: v } = w;
602
+ L(() => {
632
603
  if (u !== void 0 && (typeof u == "string" || u instanceof String)) {
633
- const se = v.find((J) => J.value === u), z = se === void 0 ? u : se.label;
634
- i(z);
604
+ const te = m.find((Q) => Q.value === u), W = te === void 0 ? u : te.label;
605
+ i(W);
635
606
  }
636
- }, [u]), D(() => {
637
- b !== void 0 && (typeof b == "string" || b instanceof String) && i(b);
638
- }, [b]);
639
- const w = bt("Input", e);
640
- let { wrapper: U, input: k } = o(E, w);
641
- const { ref: oe, ...me } = U, re = De(t, r), Y = m(h, { tags: l });
642
- c && (k = {
643
- ...k,
644
- placeholder: Array.isArray(Y) && Y.length ? void 0 : k.placeholder
607
+ }, [u]), L(() => {
608
+ v !== void 0 && (typeof v == "string" || v instanceof String) && i(v);
609
+ }, [v]);
610
+ const S = ht("Input", e);
611
+ let { wrapper: de, input: G } = r(w, S);
612
+ const { ref: Z, ...pe } = de, ee = Ee(t, o), U = p(g, { tags: l });
613
+ a && (G = {
614
+ ...G,
615
+ placeholder: Array.isArray(U) && U.length ? void 0 : G.placeholder
645
616
  });
646
- const ve = /* @__PURE__ */ p(
647
- Ve,
617
+ const me = /* @__PURE__ */ f(
618
+ ke,
648
619
  {
649
- isInvalid: y,
650
- ...k,
651
- ref: re
620
+ isInvalid: h,
621
+ ...G,
622
+ ref: ee
652
623
  }
653
- ), he = /* @__PURE__ */ V(Ct, { "aria-invalid": y, ...me, ref: oe, children: [
654
- Y,
655
- /* @__PURE__ */ p(
656
- qe,
624
+ ), ge = /* @__PURE__ */ H(vt, { "aria-invalid": h, ...pe, ref: Z, children: [
625
+ U,
626
+ /* @__PURE__ */ f(
627
+ Ue,
657
628
  {
658
- as: Ve,
659
- ...k,
660
- ref: re
629
+ as: ke,
630
+ ...G,
631
+ ref: ee
661
632
  }
662
633
  )
663
634
  ] });
664
- return /* @__PURE__ */ p(St, { children: n.multiple ? he : ve });
635
+ return /* @__PURE__ */ f(yt, { children: n.multiple ? ge : me });
665
636
  }
666
637
  );
667
- rt.displayName = "Input";
668
- rt.id = "Input";
669
- const en = (e) => {
670
- const { getEmptyStateProps: t, defaultEmptyStateProps: n } = j(), r = t(
671
- /* @__PURE__ */ p(de, { ...tn, ...n, children: "No options found!" })
638
+ qe.displayName = "Input";
639
+ qe.id = "Input";
640
+ const Xt = (e) => {
641
+ const { getEmptyStateProps: t, defaultEmptyStateProps: n } = _(), o = t(
642
+ /* @__PURE__ */ f(ce, { ...Zt, ...n, children: "No options found!" })
672
643
  );
673
- return /* @__PURE__ */ p(Xe, { ...e, children: r });
674
- }, tn = {
644
+ return /* @__PURE__ */ f(Be, { ...e, children: o });
645
+ }, Zt = {
675
646
  fontSize: "sm",
676
647
  align: "center",
677
648
  justify: "center",
678
649
  fontWeight: "bold",
679
650
  fontStyle: "italic"
680
- }, Ye = [
651
+ }, Ve = [
681
652
  "AutoCompleteGroup",
682
653
  "AutoCompleteItem",
683
654
  "AutoCompleteCreatable"
684
- ], nn = (e) => {
685
- const t = ee.Children.map(e, (o, l) => {
686
- var i;
687
- if (((i = o == null ? void 0 : o.type) == null ? void 0 : i.displayName) === "AutoCompleteGroup") {
688
- const u = ee.Children.toArray(e)[l + 1];
689
- return ee.cloneElement(o, {
690
- groupSibling: u ? u.type.displayName === "AutoCompleteGroup" : !1
655
+ ], en = (e) => {
656
+ const t = q.Children.map(e, (r, l) => {
657
+ if (r?.type?.displayName === "AutoCompleteGroup") {
658
+ const i = q.Children.toArray(e)[l + 1];
659
+ return q.cloneElement(r, {
660
+ groupSibling: i ? i.type.displayName === "AutoCompleteGroup" : !1
691
661
  });
692
662
  }
693
- return o;
694
- }), n = ee.Children.toArray(t).filter(
695
- (o) => {
696
- var l;
697
- return !Ye.includes(
698
- (l = o == null ? void 0 : o.type) == null ? void 0 : l.displayName
699
- );
700
- }
663
+ return r;
664
+ }), n = q.Children.toArray(t).filter(
665
+ (r) => !Ve.includes(
666
+ r?.type?.displayName
667
+ )
701
668
  );
702
- return [ee.Children.toArray(t).filter(
703
- (o) => {
704
- var l;
705
- return Ye.includes(
706
- (l = o == null ? void 0 : o.type) == null ? void 0 : l.displayName
707
- );
708
- }
669
+ return [q.Children.toArray(t).filter(
670
+ (r) => Ve.includes(
671
+ r?.type?.displayName
672
+ )
709
673
  ), n];
710
- }, on = H(
674
+ }, tn = k(
711
675
  (e, t) => {
712
- const { children: n, loadingState: r, ...o } = e, { listRef: l, isLoading: i } = j(), u = De(t, l), [v, h] = nn(n);
713
- return /* @__PURE__ */ V(xt, { ref: u, w: "inherit", ...rn, ...o, children: [
714
- i && /* @__PURE__ */ p(At, { children: r || /* @__PURE__ */ p(Ze, { size: "md" }) }),
715
- !i && /* @__PURE__ */ V(ut, { children: [
716
- v,
717
- /* @__PURE__ */ p(en, {}),
718
- h
676
+ const { children: n, loadingState: o, ...r } = e, { listRef: l, isLoading: i } = _(), u = Ee(t, l), [m, g] = en(n);
677
+ return /* @__PURE__ */ f(bt, { appendToParentPortal: !1, children: /* @__PURE__ */ H(It, { ref: u, w: "inherit", ...nn, ...r, children: [
678
+ i && /* @__PURE__ */ f(Ct, { children: o || /* @__PURE__ */ f(He, { size: "md" }) }),
679
+ !i && /* @__PURE__ */ H(st, { children: [
680
+ m,
681
+ /* @__PURE__ */ f(Xt, {}),
682
+ g
719
683
  ] })
720
- ] });
684
+ ] }) });
721
685
  }
722
686
  );
723
- on.displayName = "AutoCompleteList";
724
- const rn = {
687
+ tn.displayName = "AutoCompleteList";
688
+ const nn = {
725
689
  py: "4",
726
690
  opacity: "0",
727
691
  bg: "#232934",
@@ -737,46 +701,46 @@ const rn = {
737
701
  _focus: {
738
702
  boxShadow: "none"
739
703
  }
740
- }, dn = ct((e) => {
741
- const { label: t, onRemove: n, disabled: r, ...o } = e;
742
- return /* @__PURE__ */ p(qe, { children: /* @__PURE__ */ V(
743
- It,
704
+ }, fn = it((e) => {
705
+ const { label: t, onRemove: n, disabled: o, ...r } = e;
706
+ return /* @__PURE__ */ f(Ue, { children: /* @__PURE__ */ H(
707
+ St,
744
708
  {
745
709
  borderRadius: "md",
746
710
  fontWeight: "normal",
747
- ...r && Je,
748
- ...o,
711
+ ...o && ze,
712
+ ...r,
749
713
  children: [
750
- /* @__PURE__ */ p(wt, { children: t }),
751
- /* @__PURE__ */ p(
752
- Ot,
714
+ /* @__PURE__ */ f(xt, { children: t }),
715
+ /* @__PURE__ */ f(
716
+ At,
753
717
  {
754
- onClick: () => !r && m(n),
718
+ onClick: () => !o && p(n),
755
719
  cursor: "pointer",
756
- ...r && Je
720
+ ...o && ze
757
721
  }
758
722
  )
759
723
  ]
760
724
  }
761
725
  ) });
762
- }), Je = {
726
+ }), ze = {
763
727
  cursor: "text",
764
728
  userSelect: "none",
765
729
  opacity: 0.4,
766
730
  _focus: { boxShadow: "none" }
767
731
  };
768
732
  export {
769
- Kt as AutoComplete,
770
- Yt as AutoCompleteCreatable,
771
- Jt as AutoCompleteGroup,
772
- Xt as AutoCompleteGroupTitle,
773
- rt as AutoCompleteInput,
774
- Vt as AutoCompleteItem,
775
- on as AutoCompleteList,
776
- Et as AutoCompleteProvider,
777
- dn as AutoCompleteTag,
778
- ot as baseItemStyles,
779
- Ft as createContext,
780
- $t as useAutoComplete,
781
- j as useAutoCompleteContext
733
+ Ut as AutoComplete,
734
+ $t as AutoCompleteCreatable,
735
+ Kt as AutoCompleteGroup,
736
+ Yt as AutoCompleteGroupTitle,
737
+ qe as AutoCompleteInput,
738
+ Qt as AutoCompleteItem,
739
+ tn as AutoCompleteList,
740
+ wt as AutoCompleteProvider,
741
+ fn as AutoCompleteTag,
742
+ Ye as baseItemStyles,
743
+ Ot as createContext,
744
+ Ht as useAutoComplete,
745
+ _ as useAutoCompleteContext
782
746
  };