@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/autocomplete-list.d.ts.map +1 -1
- package/dist/index.es.js +448 -484
- package/dist/index.js +1 -1
- package/package.json +7 -7
package/dist/index.es.js
CHANGED
|
@@ -1,181 +1,167 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { useDisclosure as
|
|
5
|
-
const [
|
|
6
|
-
function
|
|
7
|
-
const e =
|
|
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
|
-
|
|
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
|
|
14
|
-
throw
|
|
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
|
|
21
|
-
return e
|
|
19
|
+
function Et(e) {
|
|
20
|
+
return e?.[0];
|
|
22
21
|
}
|
|
23
|
-
function
|
|
24
|
-
return e
|
|
22
|
+
function Oe(e) {
|
|
23
|
+
return e?.length ? e[e.length - 1] : void 0;
|
|
25
24
|
}
|
|
26
|
-
function
|
|
25
|
+
function Qe(e, t, n = 1, o = !0) {
|
|
27
26
|
if (t === 0) return -1;
|
|
28
|
-
let
|
|
29
|
-
return e === -1 && (
|
|
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
|
|
32
|
-
return
|
|
30
|
+
function Lt(e, t, n = !0) {
|
|
31
|
+
return Qe(e, t, -1, n);
|
|
33
32
|
}
|
|
34
|
-
function
|
|
35
|
-
const
|
|
36
|
-
return t[
|
|
33
|
+
function Ft(e, t, n = !0) {
|
|
34
|
+
const o = Qe(e, t.length, 1, n);
|
|
35
|
+
return t[o];
|
|
37
36
|
}
|
|
38
|
-
function
|
|
39
|
-
const
|
|
40
|
-
return t[
|
|
37
|
+
function Nt(e, t, n = !0) {
|
|
38
|
+
const o = Lt(e, t.length, n);
|
|
39
|
+
return t[o];
|
|
41
40
|
}
|
|
42
|
-
function
|
|
41
|
+
function Le(e) {
|
|
43
42
|
return Array.isArray(e);
|
|
44
43
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
44
|
+
function Pt(e) {
|
|
45
|
+
return Le(e) && e.length === 0;
|
|
47
46
|
}
|
|
48
|
-
function
|
|
49
|
-
return e !== null && typeof e == "object" && !
|
|
47
|
+
function Fe(e) {
|
|
48
|
+
return e !== null && typeof e == "object" && !Le(e);
|
|
50
49
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
50
|
+
function Rt(e) {
|
|
51
|
+
return Fe(e) && Object.keys(e).length === 0;
|
|
53
52
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
53
|
+
function Ne(e) {
|
|
54
|
+
return Le(e) ? Pt(e) : Fe(e) ? Rt(e) : e == null || e === "";
|
|
56
55
|
}
|
|
57
|
-
function
|
|
56
|
+
function ue(e) {
|
|
58
57
|
return typeof e > "u";
|
|
59
58
|
}
|
|
60
|
-
function
|
|
59
|
+
function $e(e) {
|
|
61
60
|
return typeof e < "u";
|
|
62
61
|
}
|
|
63
|
-
function
|
|
62
|
+
function Dt(e, t) {
|
|
64
63
|
const n = {};
|
|
65
|
-
return t.forEach((
|
|
66
|
-
|
|
64
|
+
return t.forEach((o) => {
|
|
65
|
+
o in e && (n[o] = e[o]);
|
|
67
66
|
}), n;
|
|
68
67
|
}
|
|
69
|
-
function
|
|
68
|
+
function Pe(e, t) {
|
|
70
69
|
const n = { ...e };
|
|
71
|
-
return t.forEach((
|
|
72
|
-
delete n[
|
|
70
|
+
return t.forEach((o) => {
|
|
71
|
+
delete n[o];
|
|
73
72
|
}), n;
|
|
74
73
|
}
|
|
75
|
-
function
|
|
74
|
+
function Tt(e) {
|
|
76
75
|
return typeof e == "function";
|
|
77
76
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
77
|
+
function p(e, ...t) {
|
|
78
|
+
return Tt(e) ? e(...t) : e;
|
|
80
79
|
}
|
|
81
|
-
var
|
|
82
|
-
for (var n,
|
|
83
|
-
var i = l[
|
|
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 =
|
|
86
|
+
var u = fe(i.props.children, t);
|
|
88
87
|
if (u)
|
|
89
88
|
return u;
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
|
-
},
|
|
93
|
-
for (var n = 0,
|
|
94
|
-
e[
|
|
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
|
-
},
|
|
97
|
-
for (var n,
|
|
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) && (
|
|
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
|
|
100
|
+
return r;
|
|
102
101
|
};
|
|
103
|
-
function
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
let
|
|
107
|
-
for (let
|
|
108
|
-
|
|
109
|
-
return
|
|
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 (!
|
|
110
|
+
if (!e?.length || !t?.length)
|
|
112
111
|
return 0;
|
|
113
|
-
let
|
|
114
|
-
for (let
|
|
115
|
-
|
|
116
|
-
return
|
|
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
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
|
132
|
-
return {
|
|
133
|
-
}),
|
|
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
|
-
}),
|
|
139
|
-
function
|
|
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
|
|
135
|
+
const kt = (e, t) => fe(
|
|
143
136
|
e,
|
|
144
|
-
(
|
|
145
|
-
|
|
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
|
-
(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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((
|
|
147
|
+
return t.some((r) => r.value === o);
|
|
162
148
|
})
|
|
163
|
-
),
|
|
164
|
-
const n = {},
|
|
165
|
-
return
|
|
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] =
|
|
153
|
+
n[l] = r[l];
|
|
168
154
|
else {
|
|
169
|
-
let i =
|
|
170
|
-
const
|
|
171
|
-
return
|
|
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)),
|
|
159
|
+
i.indexOf(".") !== -1 && (i = i.substring(i.indexOf(".") + 1)), o[m] = i;
|
|
174
160
|
}
|
|
175
161
|
}), {
|
|
176
162
|
...t && {
|
|
177
163
|
...n,
|
|
178
|
-
...
|
|
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
|
|
192
|
-
var He;
|
|
177
|
+
function Ht(e) {
|
|
193
178
|
let {
|
|
194
179
|
prefocusFirstItem: t = !0,
|
|
195
180
|
closeOnBlur: n = !0,
|
|
196
|
-
creatable:
|
|
197
|
-
emphasize:
|
|
181
|
+
creatable: o,
|
|
182
|
+
emphasize: r,
|
|
198
183
|
emptyState: l = !0,
|
|
199
184
|
defaultEmptyStateProps: i = {},
|
|
200
185
|
freeSolo: u,
|
|
201
|
-
isReadOnly:
|
|
202
|
-
listAllValuesOnFocus:
|
|
203
|
-
maxSuggestions:
|
|
204
|
-
multiple:
|
|
205
|
-
closeOnSelect:
|
|
206
|
-
defaultValue:
|
|
207
|
-
defaultValues:
|
|
208
|
-
onReady:
|
|
209
|
-
defaultIsOpen:
|
|
210
|
-
disableFilter:
|
|
211
|
-
isLoading:
|
|
212
|
-
placement:
|
|
213
|
-
restoreOnBlurIfEmpty:
|
|
214
|
-
shouldRenderSuggestions:
|
|
215
|
-
submitKeys:
|
|
216
|
-
suggestWhenEmpty:
|
|
217
|
-
value:
|
|
218
|
-
values:
|
|
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 || (
|
|
221
|
-
const { isOpen:
|
|
222
|
-
() =>
|
|
223
|
-
isOpen:
|
|
224
|
-
onClose:
|
|
225
|
-
onOpen:
|
|
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,
|
|
228
|
-
),
|
|
229
|
-
let
|
|
230
|
-
|
|
231
|
-
const [
|
|
232
|
-
() =>
|
|
233
|
-
(s) => s.fixed ||
|
|
234
|
-
e.filter ||
|
|
235
|
-
|
|
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
|
-
) ||
|
|
223
|
+
) || Te
|
|
239
224
|
).filter(
|
|
240
|
-
(s,
|
|
225
|
+
(s, c) => h ? s.fixed || c < h : !0
|
|
241
226
|
),
|
|
242
|
-
[
|
|
243
|
-
),
|
|
244
|
-
defaultValue:
|
|
245
|
-
value:
|
|
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
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
(
|
|
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
|
-
|
|
237
|
+
p(
|
|
253
238
|
e.onChange,
|
|
254
|
-
|
|
255
|
-
|
|
239
|
+
a ? s : s[0],
|
|
240
|
+
a ? C : c
|
|
256
241
|
);
|
|
257
242
|
}
|
|
258
243
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}, [
|
|
262
|
-
const [
|
|
263
|
-
t ?
|
|
264
|
-
),
|
|
265
|
-
|
|
266
|
-
|
|
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
|
-
),
|
|
269
|
-
|
|
270
|
-
|
|
253
|
+
), et = Nt(
|
|
254
|
+
Ie,
|
|
255
|
+
y,
|
|
271
256
|
!!e.rollNavigation
|
|
272
|
-
),
|
|
273
|
-
(s) => s.value ===
|
|
257
|
+
), se = Et(y), tt = Oe(y), Me = !y.some(
|
|
258
|
+
(s) => s.value === B
|
|
274
259
|
);
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}, [
|
|
284
|
-
|
|
285
|
-
|
|
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:
|
|
290
|
-
isNewInput: s
|
|
272
|
+
focusMethod: z.current,
|
|
273
|
+
isNewInput: s?.creatable
|
|
291
274
|
});
|
|
292
|
-
}, [
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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
|
|
311
|
-
|
|
312
|
-
},
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
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:
|
|
327
|
-
filteredList:
|
|
328
|
-
filteredResults:
|
|
329
|
-
focusedValue:
|
|
303
|
+
children: he,
|
|
304
|
+
filteredList: y,
|
|
305
|
+
filteredResults: ye,
|
|
306
|
+
focusedValue: B,
|
|
330
307
|
defaultEmptyStateProps: i,
|
|
331
308
|
getEmptyStateProps: (s) => {
|
|
332
|
-
if (
|
|
333
|
-
return typeof l == "boolean" ? s :
|
|
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
|
|
313
|
+
const c = zt(s.children, y);
|
|
337
314
|
return {
|
|
338
315
|
divider: {
|
|
339
|
-
hasFirstChild:
|
|
340
|
-
hasLastChild:
|
|
316
|
+
hasFirstChild: kt(s.children, se),
|
|
317
|
+
hasLastChild: Vt(
|
|
341
318
|
s.children,
|
|
342
|
-
|
|
319
|
+
Oe(y.filter((C) => ue(C?.noFilter)))
|
|
343
320
|
)
|
|
344
321
|
},
|
|
345
322
|
group: {
|
|
346
|
-
display:
|
|
323
|
+
display: c ? "initial" : "none"
|
|
347
324
|
}
|
|
348
325
|
};
|
|
349
326
|
},
|
|
350
|
-
getInputProps: (s,
|
|
351
|
-
const { onBlur:
|
|
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:
|
|
331
|
+
ref: De,
|
|
355
332
|
onClick: () => {
|
|
356
|
-
|
|
357
|
-
(f = N == null ? void 0 : N.current) == null || f.focus();
|
|
333
|
+
T?.current?.focus();
|
|
358
334
|
},
|
|
359
|
-
...
|
|
360
|
-
...
|
|
335
|
+
...Bt(c, a),
|
|
336
|
+
...K
|
|
361
337
|
},
|
|
362
338
|
input: {
|
|
363
|
-
isReadOnly:
|
|
364
|
-
onFocus: (
|
|
365
|
-
|
|
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: (
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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 (!
|
|
374
|
-
const
|
|
375
|
-
(
|
|
376
|
-
),
|
|
377
|
-
|
|
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: (
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
const
|
|
384
|
-
|
|
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: (
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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 (
|
|
395
|
-
|
|
368
|
+
if (b === "ArrowDown") {
|
|
369
|
+
x ? M(Ze?.value) : V(), d.preventDefault();
|
|
396
370
|
return;
|
|
397
371
|
}
|
|
398
|
-
if (
|
|
399
|
-
|
|
372
|
+
if (b === "ArrowUp") {
|
|
373
|
+
x ? M(et?.value) : V(), d.preventDefault();
|
|
400
374
|
return;
|
|
401
375
|
}
|
|
402
|
-
if (
|
|
403
|
-
|
|
376
|
+
if (b === "Tab") {
|
|
377
|
+
x && O && !O?.disabled ? Ce(O?.value) : D();
|
|
404
378
|
return;
|
|
405
379
|
}
|
|
406
|
-
if (
|
|
407
|
-
|
|
380
|
+
if (b === "Home") {
|
|
381
|
+
M(se?.value), d.preventDefault();
|
|
408
382
|
return;
|
|
409
383
|
}
|
|
410
|
-
if (
|
|
411
|
-
|
|
384
|
+
if (b === "End") {
|
|
385
|
+
M(tt?.value), d.preventDefault();
|
|
412
386
|
return;
|
|
413
387
|
}
|
|
414
|
-
|
|
388
|
+
b === "Escape" && (D(), d.preventDefault());
|
|
415
389
|
},
|
|
416
|
-
value:
|
|
417
|
-
variant:
|
|
418
|
-
...
|
|
390
|
+
value: F,
|
|
391
|
+
variant: a ? "unstyled" : j,
|
|
392
|
+
...K
|
|
419
393
|
}
|
|
420
394
|
};
|
|
421
395
|
},
|
|
422
|
-
getItemProps: (s,
|
|
423
|
-
var Ue;
|
|
396
|
+
getItemProps: (s, c) => {
|
|
424
397
|
const {
|
|
425
|
-
_fixed:
|
|
426
|
-
_focus:
|
|
427
|
-
children:
|
|
428
|
-
disabled:
|
|
429
|
-
label:
|
|
430
|
-
value:
|
|
431
|
-
fixed:
|
|
432
|
-
getValue:
|
|
433
|
-
onClick:
|
|
434
|
-
onMouseOver:
|
|
435
|
-
sx:
|
|
436
|
-
...
|
|
437
|
-
} = s,
|
|
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
|
|
413
|
+
...typeof Ae != "string" || !r ? { children: Ae } : {
|
|
441
414
|
dangerouslySetInnerHTML: {
|
|
442
|
-
__html:
|
|
415
|
+
__html: Mt(Ae, F)
|
|
443
416
|
}
|
|
444
417
|
},
|
|
445
|
-
"aria-selected":
|
|
446
|
-
"aria-disabled":
|
|
418
|
+
"aria-selected": N.includes(R),
|
|
419
|
+
"aria-disabled": P,
|
|
447
420
|
_disabled: { opacity: 0.4, cursor: "not-allowed", userSelect: "none" },
|
|
448
|
-
onClick: (
|
|
449
|
-
|
|
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: (
|
|
453
|
-
|
|
424
|
+
onMouseOver: (Y) => {
|
|
425
|
+
p(Se, Y), M(R), z.current = "mouse";
|
|
454
426
|
},
|
|
455
427
|
sx: {
|
|
456
|
-
...
|
|
428
|
+
...le,
|
|
457
429
|
mark: {
|
|
458
430
|
color: "inherit",
|
|
459
431
|
bg: "transparent",
|
|
460
|
-
...
|
|
461
|
-
fontWeight:
|
|
432
|
+
...Fe(r) ? r : {
|
|
433
|
+
fontWeight: r ? "extrabold" : "inherit"
|
|
462
434
|
}
|
|
463
435
|
}
|
|
464
436
|
},
|
|
465
|
-
...
|
|
466
|
-
...
|
|
467
|
-
...
|
|
437
|
+
...ot && (A || Gt()),
|
|
438
|
+
...d && C,
|
|
439
|
+
...xe
|
|
468
440
|
},
|
|
469
441
|
root: {
|
|
470
|
-
isValidSuggestion:
|
|
471
|
-
value:
|
|
442
|
+
isValidSuggestion: rt,
|
|
443
|
+
value: R
|
|
472
444
|
}
|
|
473
445
|
};
|
|
474
446
|
},
|
|
475
|
-
inputRef:
|
|
476
|
-
interactionRef:
|
|
477
|
-
isLoading:
|
|
478
|
-
isOpen:
|
|
479
|
-
itemList:
|
|
480
|
-
listRef:
|
|
481
|
-
onClose:
|
|
482
|
-
onOpen:
|
|
483
|
-
placement:
|
|
484
|
-
query:
|
|
485
|
-
removeItem:
|
|
486
|
-
resetItems:
|
|
487
|
-
setQuery:
|
|
488
|
-
tags:
|
|
489
|
-
value:
|
|
490
|
-
values:
|
|
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
|
|
465
|
+
const Ut = k(
|
|
494
466
|
(e, t) => {
|
|
495
|
-
const n =
|
|
496
|
-
children:
|
|
497
|
-
isOpen:
|
|
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:
|
|
502
|
-
removeItem:
|
|
473
|
+
resetItems: m,
|
|
474
|
+
removeItem: g
|
|
503
475
|
} = n;
|
|
504
|
-
|
|
505
|
-
resetItems:
|
|
506
|
-
removeItem:
|
|
476
|
+
lt(t, () => ({
|
|
477
|
+
resetItems: m,
|
|
478
|
+
removeItem: g
|
|
507
479
|
}));
|
|
508
|
-
const { matchWidth:
|
|
509
|
-
return /* @__PURE__ */
|
|
510
|
-
|
|
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:
|
|
485
|
+
isOpen: r,
|
|
514
486
|
autoFocus: !1,
|
|
515
487
|
placement: u,
|
|
516
488
|
closeOnBlur: !0,
|
|
517
|
-
matchWidth:
|
|
518
|
-
children: /* @__PURE__ */
|
|
489
|
+
matchWidth: h,
|
|
490
|
+
children: /* @__PURE__ */ f(dt.div, { w: "full", ref: t, children: o })
|
|
519
491
|
}
|
|
520
492
|
) });
|
|
521
493
|
}
|
|
522
494
|
);
|
|
523
|
-
|
|
524
|
-
const
|
|
495
|
+
Ut.displayName = "AutoComplete";
|
|
496
|
+
const Qt = k(
|
|
525
497
|
(e, t) => {
|
|
526
498
|
const {
|
|
527
499
|
focusedValue: n,
|
|
528
|
-
getItemProps:
|
|
529
|
-
interactionRef:
|
|
530
|
-
} =
|
|
531
|
-
|
|
532
|
-
|
|
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
|
-
}, [
|
|
538
|
-
typeof
|
|
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:
|
|
543
|
-
return
|
|
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
|
-
|
|
547
|
-
const
|
|
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
|
|
555
|
-
const { alwaysDisplay: t, children: n, ...
|
|
556
|
-
autoCompleteProps:
|
|
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
|
-
} =
|
|
531
|
+
} = _(), { children: m, ...g } = l(
|
|
561
532
|
{
|
|
562
533
|
...e,
|
|
563
534
|
value: i,
|
|
564
|
-
children:
|
|
535
|
+
children: p(n, {
|
|
565
536
|
value: i
|
|
566
537
|
})
|
|
567
538
|
},
|
|
568
539
|
!0
|
|
569
|
-
).item,
|
|
570
|
-
return
|
|
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
|
-
|
|
573
|
-
const
|
|
543
|
+
$t.displayName = "AutoCompleteCreatable";
|
|
544
|
+
const Kt = k(
|
|
574
545
|
(e, t) => {
|
|
575
|
-
const { children: n, showDivider:
|
|
576
|
-
return /* @__PURE__ */
|
|
577
|
-
/* @__PURE__ */
|
|
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__ */
|
|
550
|
+
/* @__PURE__ */ f(We, { ...m.bottom })
|
|
580
551
|
] });
|
|
581
552
|
}
|
|
582
|
-
),
|
|
583
|
-
(e, t) => /* @__PURE__ */
|
|
553
|
+
), Yt = k(
|
|
554
|
+
(e, t) => /* @__PURE__ */ f(ce, { ...qt, ...e, ref: t })
|
|
584
555
|
);
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
const
|
|
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
|
-
},
|
|
595
|
-
const { getGroupProps: t } =
|
|
596
|
-
divider: { hasFirstChild:
|
|
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 ||
|
|
574
|
+
display: !e.showDivider || o ? "none" : ""
|
|
604
575
|
}, u = {
|
|
605
576
|
...l,
|
|
606
|
-
display: !e.showDivider ||
|
|
577
|
+
display: !e.showDivider || r || n ? "none" : ""
|
|
607
578
|
};
|
|
608
579
|
return { top: i, bottom: u };
|
|
609
|
-
},
|
|
610
|
-
const { isLoading: n } =
|
|
611
|
-
return /* @__PURE__ */
|
|
612
|
-
/* @__PURE__ */
|
|
613
|
-
n && /* @__PURE__ */
|
|
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
|
-
}),
|
|
586
|
+
}), qe = k(
|
|
616
587
|
(e, t) => {
|
|
617
588
|
const {
|
|
618
589
|
autoCompleteProps: n,
|
|
619
|
-
inputRef:
|
|
620
|
-
getInputProps:
|
|
590
|
+
inputRef: o,
|
|
591
|
+
getInputProps: r,
|
|
621
592
|
tags: l,
|
|
622
593
|
setQuery: i,
|
|
623
594
|
value: u,
|
|
624
|
-
itemList:
|
|
625
|
-
} =
|
|
626
|
-
children:
|
|
627
|
-
isInvalid:
|
|
628
|
-
hidePlaceholder:
|
|
629
|
-
...
|
|
630
|
-
} = e, { value:
|
|
631
|
-
|
|
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
|
|
634
|
-
i(
|
|
604
|
+
const te = m.find((Q) => Q.value === u), W = te === void 0 ? u : te.label;
|
|
605
|
+
i(W);
|
|
635
606
|
}
|
|
636
|
-
}, [u]),
|
|
637
|
-
|
|
638
|
-
}, [
|
|
639
|
-
const
|
|
640
|
-
let { wrapper:
|
|
641
|
-
const { ref:
|
|
642
|
-
|
|
643
|
-
...
|
|
644
|
-
placeholder: Array.isArray(
|
|
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
|
|
647
|
-
|
|
617
|
+
const me = /* @__PURE__ */ f(
|
|
618
|
+
ke,
|
|
648
619
|
{
|
|
649
|
-
isInvalid:
|
|
650
|
-
...
|
|
651
|
-
ref:
|
|
620
|
+
isInvalid: h,
|
|
621
|
+
...G,
|
|
622
|
+
ref: ee
|
|
652
623
|
}
|
|
653
|
-
),
|
|
654
|
-
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
|
|
624
|
+
), ge = /* @__PURE__ */ H(vt, { "aria-invalid": h, ...pe, ref: Z, children: [
|
|
625
|
+
U,
|
|
626
|
+
/* @__PURE__ */ f(
|
|
627
|
+
Ue,
|
|
657
628
|
{
|
|
658
|
-
as:
|
|
659
|
-
...
|
|
660
|
-
ref:
|
|
629
|
+
as: ke,
|
|
630
|
+
...G,
|
|
631
|
+
ref: ee
|
|
661
632
|
}
|
|
662
633
|
)
|
|
663
634
|
] });
|
|
664
|
-
return /* @__PURE__ */
|
|
635
|
+
return /* @__PURE__ */ f(yt, { children: n.multiple ? ge : me });
|
|
665
636
|
}
|
|
666
637
|
);
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
const
|
|
670
|
-
const { getEmptyStateProps: t, defaultEmptyStateProps: n } =
|
|
671
|
-
/* @__PURE__ */
|
|
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__ */
|
|
674
|
-
},
|
|
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
|
-
},
|
|
651
|
+
}, Ve = [
|
|
681
652
|
"AutoCompleteGroup",
|
|
682
653
|
"AutoCompleteItem",
|
|
683
654
|
"AutoCompleteCreatable"
|
|
684
|
-
],
|
|
685
|
-
const t =
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
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
|
|
694
|
-
}), n =
|
|
695
|
-
(
|
|
696
|
-
|
|
697
|
-
|
|
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 [
|
|
703
|
-
(
|
|
704
|
-
|
|
705
|
-
|
|
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
|
-
},
|
|
674
|
+
}, tn = k(
|
|
711
675
|
(e, t) => {
|
|
712
|
-
const { children: n, loadingState:
|
|
713
|
-
return /* @__PURE__ */
|
|
714
|
-
i && /* @__PURE__ */
|
|
715
|
-
!i && /* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
/* @__PURE__ */
|
|
718
|
-
|
|
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
|
-
|
|
724
|
-
const
|
|
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
|
-
},
|
|
741
|
-
const { label: t, onRemove: n, disabled:
|
|
742
|
-
return /* @__PURE__ */
|
|
743
|
-
|
|
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
|
-
...
|
|
748
|
-
...
|
|
711
|
+
...o && ze,
|
|
712
|
+
...r,
|
|
749
713
|
children: [
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
752
|
-
|
|
714
|
+
/* @__PURE__ */ f(xt, { children: t }),
|
|
715
|
+
/* @__PURE__ */ f(
|
|
716
|
+
At,
|
|
753
717
|
{
|
|
754
|
-
onClick: () => !
|
|
718
|
+
onClick: () => !o && p(n),
|
|
755
719
|
cursor: "pointer",
|
|
756
|
-
...
|
|
720
|
+
...o && ze
|
|
757
721
|
}
|
|
758
722
|
)
|
|
759
723
|
]
|
|
760
724
|
}
|
|
761
725
|
) });
|
|
762
|
-
}),
|
|
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
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
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
|
};
|