@choc-ui/chakra-autocomplete 5.8.0 → 6.0.0
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/README.md +187 -132
- package/dist/autocomplete-group.d.ts +2 -3
- package/dist/autocomplete-group.d.ts.map +1 -1
- package/dist/autocomplete-input.d.ts +1 -2
- package/dist/autocomplete-input.d.ts.map +1 -1
- package/dist/autocomplete-item.d.ts +1 -1
- package/dist/autocomplete-item.d.ts.map +1 -1
- package/dist/autocomplete-list.d.ts +3 -3
- package/dist/autocomplete-list.d.ts.map +1 -1
- package/dist/autocomplete-tag.d.ts +1 -1
- package/dist/autocomplete-tag.d.ts.map +1 -1
- package/dist/autocomplete.d.ts +1 -1
- package/dist/autocomplete.d.ts.map +1 -1
- package/dist/components/ui/close-button.d.ts +5 -0
- package/dist/components/ui/close-button.d.ts.map +1 -0
- package/dist/components/ui/input-group.d.ts +13 -0
- package/dist/components/ui/input-group.d.ts.map +1 -0
- package/dist/components/ui/popover.d.ts +18 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/tag.d.ts +10 -0
- package/dist/components/ui/tag.d.ts.map +1 -0
- package/dist/index.es.js +649 -495
- package/dist/index.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/use-autocomplete.d.ts.map +1 -1
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -1
- package/package.json +7 -9
package/dist/index.es.js
CHANGED
|
@@ -1,731 +1,876 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { useDisclosure as
|
|
5
|
-
const [
|
|
6
|
-
function
|
|
7
|
-
const e =
|
|
1
|
+
import { jsx as a, jsxs as Z, Fragment as ft } from "react/jsx-runtime";
|
|
2
|
+
import * as L from "react";
|
|
3
|
+
import I, { useMemo as oe, useRef as se, useState as Fe, useEffect as j, forwardRef as K, useImperativeHandle as pt, memo as dt } from "react";
|
|
4
|
+
import { useDisclosure as mt, useControllableState as gt, IconButton as ht, Portal as vt, Popover as N, chakra as yt, Flex as he, Box as Te, Separator as Xe, Group as bt, InputElement as Je, Spinner as nt, PopoverAnchor as Ct, Input as wt, Center as St, Tag as J } from "@chakra-ui/react";
|
|
5
|
+
const [xt, $] = Ot();
|
|
6
|
+
function Ot() {
|
|
7
|
+
const e = L.createContext(void 0);
|
|
8
8
|
e.displayName = "AutoCompleteContext";
|
|
9
9
|
function t() {
|
|
10
10
|
var o;
|
|
11
|
-
const n =
|
|
11
|
+
const n = L.useContext(e), r = "useAutoCompleteContext: `context` is undefined. Seems you forgot to wrap all autoomplete components within `<AutoComplete />`";
|
|
12
12
|
if (!n) {
|
|
13
|
-
const
|
|
14
|
-
throw
|
|
13
|
+
const s = new Error(r);
|
|
14
|
+
throw s.name = "ContextError", (o = Error.captureStackTrace) == null || o.call(Error, s, t), s;
|
|
15
15
|
}
|
|
16
16
|
return n;
|
|
17
17
|
}
|
|
18
18
|
return [e.Provider, t, e];
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function At(e) {
|
|
21
21
|
return e == null ? void 0 : e[0];
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function De(e) {
|
|
24
24
|
return e != null && e.length ? e[e.length - 1] : void 0;
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function rt(e, t, n = 1, r = !0) {
|
|
27
27
|
if (t === 0) return -1;
|
|
28
28
|
let o = e + n;
|
|
29
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;
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
return
|
|
31
|
+
function Et(e, t, n = !0) {
|
|
32
|
+
return rt(e, t, -1, n);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
const r =
|
|
34
|
+
function Pt(e, t, n = !0) {
|
|
35
|
+
const r = rt(e, t.length, 1, n);
|
|
36
36
|
return t[r];
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
const r =
|
|
38
|
+
function It(e, t, n = !0) {
|
|
39
|
+
const r = Et(e, t.length, n);
|
|
40
40
|
return t[r];
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function _e(e) {
|
|
43
43
|
return Array.isArray(e);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return
|
|
45
|
+
function Nt(e) {
|
|
46
|
+
return _e(e) && e.length === 0;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
return e !== null && typeof e == "object" && !
|
|
48
|
+
function Ge(e) {
|
|
49
|
+
return e !== null && typeof e == "object" && !_e(e);
|
|
50
50
|
}
|
|
51
51
|
function Rt(e) {
|
|
52
|
-
return
|
|
52
|
+
return Ge(e) && Object.keys(e).length === 0;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
54
|
+
function Me(e) {
|
|
55
|
+
return _e(e) ? Nt(e) : Ge(e) ? Rt(e) : e == null || e === "";
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function de(e) {
|
|
58
58
|
return typeof e > "u";
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function ot(e) {
|
|
61
61
|
return typeof e < "u";
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function jt(e, t) {
|
|
64
64
|
const n = {};
|
|
65
65
|
return t.forEach((r) => {
|
|
66
66
|
r in e && (n[r] = e[r]);
|
|
67
67
|
}), n;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function ve(e, t) {
|
|
70
70
|
const n = { ...e };
|
|
71
71
|
return t.forEach((r) => {
|
|
72
72
|
delete n[r];
|
|
73
73
|
}), n;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function Lt(e) {
|
|
76
76
|
return typeof e == "function";
|
|
77
77
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
78
|
+
function h(e, ...t) {
|
|
79
|
+
return Lt(e) ? e(...t) : e;
|
|
80
|
+
}
|
|
81
|
+
function Ft(e, t) {
|
|
82
|
+
if (e != null) {
|
|
83
|
+
if (typeof e == "function") {
|
|
84
|
+
e(t);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
try {
|
|
88
|
+
e.current = t;
|
|
89
|
+
} catch {
|
|
90
|
+
throw new Error(`Cannot assign value '${t}' to ref '${e}'`);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
|
-
}
|
|
93
|
+
}
|
|
94
|
+
function Dt(...e) {
|
|
95
|
+
return (t) => {
|
|
96
|
+
e.forEach((n) => {
|
|
97
|
+
Ft(n, t);
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function We(...e) {
|
|
102
|
+
return oe(() => Dt(...e), e);
|
|
103
|
+
}
|
|
104
|
+
var ye = function(e, t) {
|
|
105
|
+
for (var n, r = L.Children.toArray(e), o = 0, s = r; o < s.length; o++) {
|
|
106
|
+
var u = s[o];
|
|
107
|
+
if (t(u))
|
|
108
|
+
return u;
|
|
109
|
+
if (!((n = u.props) === null || n === void 0) && n.children) {
|
|
110
|
+
var l = ye(u.props.children, t);
|
|
111
|
+
if (l)
|
|
112
|
+
return l;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}, pe = function(e, t) {
|
|
93
116
|
for (var n = 0, r = t.length, o = e.length; n < r; n++, o++)
|
|
94
117
|
e[o] = t[n];
|
|
95
118
|
return e;
|
|
96
|
-
},
|
|
97
|
-
for (var n, r =
|
|
98
|
-
var
|
|
99
|
-
t(
|
|
119
|
+
}, st = function(e, t) {
|
|
120
|
+
for (var n, r = L.Children.toArray(e), o = [], s = 0, u = r; s < u.length; s++) {
|
|
121
|
+
var l = u[s];
|
|
122
|
+
t(l) && (o = pe(pe([], o), [l])), !((n = l.props) === null || n === void 0) && n.children && (o = pe(pe([], o), st(l.props.children, t)));
|
|
100
123
|
}
|
|
101
124
|
return o;
|
|
102
125
|
};
|
|
103
|
-
function
|
|
104
|
-
function r(
|
|
105
|
-
|
|
106
|
-
let
|
|
107
|
-
for (let
|
|
108
|
-
|
|
109
|
-
return
|
|
126
|
+
function Ze(e, t, n = 2) {
|
|
127
|
+
function r(d, C) {
|
|
128
|
+
d = " ".repeat(C - 1) + d.toLowerCase() + " ".repeat(C - 1);
|
|
129
|
+
let A = new Array(d.length - C + 1);
|
|
130
|
+
for (let x = 0; x < A.length; x++)
|
|
131
|
+
A[x] = d.slice(x, x + C);
|
|
132
|
+
return A;
|
|
110
133
|
}
|
|
111
134
|
if (!(e != null && e.length) || !(t != null && t.length))
|
|
112
135
|
return 0;
|
|
113
|
-
let o = e.length < t.length ? e : t,
|
|
114
|
-
for (let
|
|
115
|
-
|
|
116
|
-
return
|
|
136
|
+
let o = e.length < t.length ? e : t, s = e.length < t.length ? t : e, u = r(o, n), l = r(s, n), f = new Set(u), v = l.length, y = 0;
|
|
137
|
+
for (let d of l)
|
|
138
|
+
f.delete(d) && y++;
|
|
139
|
+
return y / v;
|
|
117
140
|
}
|
|
118
|
-
const
|
|
141
|
+
const ke = (e) => {
|
|
119
142
|
var t;
|
|
120
143
|
return (t = typeof e == "string" || typeof e == "number" ? e : e[Object.keys(e)[0]]) == null ? void 0 : t.toString();
|
|
121
|
-
},
|
|
122
|
-
new RegExp(
|
|
144
|
+
}, Tt = (e, t) => typeof e != "string" || Me(t) ? e : e.toString().replace(
|
|
145
|
+
new RegExp(Wt(t), "gi"),
|
|
123
146
|
(r) => `<mark>${r}</mark>`
|
|
124
|
-
),
|
|
147
|
+
), _t = (e) => st(
|
|
125
148
|
e,
|
|
126
149
|
(n) => {
|
|
127
150
|
var r;
|
|
128
151
|
return ((r = n == null ? void 0 : n.type) == null ? void 0 : r.displayName) === "AutoCompleteItem";
|
|
129
152
|
}
|
|
130
153
|
).map((n) => {
|
|
131
|
-
const r =
|
|
132
|
-
return { ...
|
|
133
|
-
}),
|
|
154
|
+
const r = jt(n.props, ["value", "label", "fixed", "disabled"]), { getValue: o = ke } = n.props, s = o(r.value);
|
|
155
|
+
return { ...ot(r.label) ? r : { ...r, label: s }, value: s, originalValue: r.value };
|
|
156
|
+
}), Gt = () => ({
|
|
134
157
|
bg: "whiteAlpha.100",
|
|
135
158
|
_light: {
|
|
136
159
|
bg: "gray.200"
|
|
137
160
|
}
|
|
138
|
-
}),
|
|
139
|
-
function
|
|
161
|
+
}), Mt = (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 || Ze(e, t) >= 0.5 || Ze(e, n) >= 0.5;
|
|
162
|
+
function Wt(e) {
|
|
140
163
|
return e.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
141
164
|
}
|
|
142
|
-
const
|
|
165
|
+
const kt = (e, t) => ye(
|
|
143
166
|
e,
|
|
144
167
|
(r) => {
|
|
145
168
|
var o;
|
|
146
169
|
return ((o = r == null ? void 0 : r.type) == null ? void 0 : o.displayName) === "AutoCompleteItem" && r.props.value === (t == null ? void 0 : t.value);
|
|
147
170
|
}
|
|
148
|
-
),
|
|
171
|
+
), zt = (e, t) => ye(
|
|
149
172
|
e,
|
|
150
173
|
(r) => {
|
|
151
174
|
var o;
|
|
152
175
|
return ((o = r == null ? void 0 : r.type) == null ? void 0 : o.displayName) === "AutoCompleteItem" && r.props.value === (t == null ? void 0 : t.value);
|
|
153
176
|
}
|
|
154
|
-
),
|
|
155
|
-
|
|
156
|
-
var o,
|
|
157
|
-
const r =
|
|
158
|
-
((o = n.props) == null ? void 0 : o.getValue) ||
|
|
159
|
-
((
|
|
177
|
+
), Bt = (e, t) => ot(
|
|
178
|
+
ye(e, (n) => {
|
|
179
|
+
var o, s;
|
|
180
|
+
const r = h(
|
|
181
|
+
((o = n.props) == null ? void 0 : o.getValue) || ke,
|
|
182
|
+
((s = n.props) == null ? void 0 : s.value) || {}
|
|
160
183
|
);
|
|
161
|
-
return t.some((
|
|
184
|
+
return t.some((u) => u.value === r);
|
|
162
185
|
})
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (l.startsWith("--input") === !1)
|
|
167
|
-
n[l] = o[l];
|
|
168
|
-
else {
|
|
169
|
-
let i = o[l];
|
|
170
|
-
const v = l.replace("--input-", "").replace(/-([a-z])/g, function(h) {
|
|
171
|
-
return h[1].toUpperCase();
|
|
172
|
-
});
|
|
173
|
-
i.indexOf(".") !== -1 && (i = i.substring(i.indexOf(".") + 1)), r[v] = i;
|
|
174
|
-
}
|
|
175
|
-
}), {
|
|
176
|
-
...t && {
|
|
177
|
-
...n,
|
|
178
|
-
...r,
|
|
179
|
-
_focusWithin: e.field._focus,
|
|
180
|
-
pos: "relative",
|
|
181
|
-
minH: 9,
|
|
182
|
-
// px: 3,
|
|
183
|
-
py: 1.5,
|
|
184
|
-
spacing: 3
|
|
185
|
-
},
|
|
186
|
-
cursor: "text",
|
|
187
|
-
h: "fit-content"
|
|
188
|
-
// w: "full",
|
|
189
|
-
};
|
|
190
|
-
};
|
|
191
|
-
function Vt(e) {
|
|
192
|
-
var He;
|
|
186
|
+
);
|
|
187
|
+
function $t(e) {
|
|
188
|
+
var Qe;
|
|
193
189
|
let {
|
|
194
190
|
prefocusFirstItem: t = !0,
|
|
195
191
|
closeOnBlur: n = !0,
|
|
196
192
|
creatable: r,
|
|
197
193
|
emphasize: o,
|
|
198
|
-
emptyState:
|
|
199
|
-
defaultEmptyStateProps:
|
|
200
|
-
freeSolo:
|
|
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:
|
|
194
|
+
emptyState: s = !0,
|
|
195
|
+
defaultEmptyStateProps: u = {},
|
|
196
|
+
freeSolo: l,
|
|
197
|
+
isReadOnly: f,
|
|
198
|
+
listAllValuesOnFocus: v,
|
|
199
|
+
maxSuggestions: y,
|
|
200
|
+
multiple: d,
|
|
201
|
+
closeOnSelect: C = !d,
|
|
202
|
+
defaultValue: A,
|
|
203
|
+
defaultValues: x = A ? [A] : [],
|
|
204
|
+
onReady: T,
|
|
205
|
+
defaultIsOpen: be,
|
|
206
|
+
disableFilter: ie,
|
|
207
|
+
isLoading: Ce = !1,
|
|
208
|
+
placement: q = "bottom",
|
|
209
|
+
restoreOnBlurIfEmpty: le = !l,
|
|
210
|
+
shouldRenderSuggestions: we = () => !0,
|
|
211
|
+
submitKeys: ue = [],
|
|
212
|
+
suggestWhenEmpty: Se,
|
|
213
|
+
value: H,
|
|
214
|
+
values: xe = H ? typeof H == "string" ? [H] : [...H] : void 0
|
|
219
215
|
} = e;
|
|
220
|
-
|
|
221
|
-
const {
|
|
222
|
-
() =>
|
|
223
|
-
isOpen:
|
|
224
|
-
onClose:
|
|
225
|
-
onOpen:
|
|
216
|
+
l = l || (d ? !0 : e.freeSolo);
|
|
217
|
+
const { open: O, onClose: z, onOpen: Q } = mt({ open: be }), Oe = oe(
|
|
218
|
+
() => h(e.children, {
|
|
219
|
+
isOpen: O,
|
|
220
|
+
onClose: z,
|
|
221
|
+
onOpen: Q
|
|
226
222
|
}),
|
|
227
|
-
[e.children,
|
|
228
|
-
), E =
|
|
229
|
-
let
|
|
230
|
-
|
|
231
|
-
const [
|
|
232
|
-
() =>
|
|
233
|
-
(
|
|
234
|
-
e.filter ||
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
) ||
|
|
223
|
+
[e.children, O]
|
|
224
|
+
), E = oe(() => _t(Oe), [Oe]), F = se(null), ze = se(null), ee = se(null), U = se(null), [Be, ae] = Fe(!1);
|
|
225
|
+
let ce = "";
|
|
226
|
+
d ? ce = "" : de(x) ? de(xe) || (ce = xe[0]) : ce = x[0];
|
|
227
|
+
const [_, te] = Fe(ce ?? ""), Ae = oe(
|
|
228
|
+
() => ie ? E : E.filter(
|
|
229
|
+
(i) => i.fixed || h(
|
|
230
|
+
e.filter || Mt,
|
|
231
|
+
_,
|
|
232
|
+
i.value,
|
|
233
|
+
i.label
|
|
234
|
+
) || Be
|
|
239
235
|
).filter(
|
|
240
|
-
(
|
|
236
|
+
(i, c) => y ? i.fixed || c < y : !0
|
|
241
237
|
),
|
|
242
|
-
[
|
|
243
|
-
),
|
|
244
|
-
defaultValue:
|
|
245
|
-
value:
|
|
246
|
-
onChange: (
|
|
247
|
-
const
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
(
|
|
238
|
+
[_, E, Be, y, ie]
|
|
239
|
+
), $e = r ? [{ value: _, noFilter: !0, creatable: !0 }] : [], b = oe(() => [...Ae, ...$e], [Ae, $e]), [G, Ee] = gt({
|
|
240
|
+
defaultValue: x.map((i) => i == null ? void 0 : i.toString()),
|
|
241
|
+
value: xe,
|
|
242
|
+
onChange: (i) => {
|
|
243
|
+
const c = b.find((P) => P.value === i[0]);
|
|
244
|
+
if (!c) return;
|
|
245
|
+
const m = i.map(
|
|
246
|
+
(P) => b.find((R) => R.value === P)
|
|
251
247
|
);
|
|
252
|
-
|
|
248
|
+
h(
|
|
253
249
|
e.onChange,
|
|
254
|
-
|
|
255
|
-
|
|
250
|
+
d ? i : i[0],
|
|
251
|
+
d ? m : c
|
|
256
252
|
);
|
|
257
253
|
}
|
|
258
254
|
});
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}, [
|
|
262
|
-
const [
|
|
263
|
-
t ? (
|
|
264
|
-
),
|
|
265
|
-
|
|
266
|
-
|
|
255
|
+
j(() => {
|
|
256
|
+
b.length === 0 && !s && O && z();
|
|
257
|
+
}, [b.length, s, O]);
|
|
258
|
+
const [Y, M] = Fe(
|
|
259
|
+
t ? (Qe = E[0]) == null ? void 0 : Qe.value : null
|
|
260
|
+
), at = e.maxSelections || G.length + 1, Pe = b.findIndex((i) => i.value === Y), Ie = Pt(
|
|
261
|
+
Pe,
|
|
262
|
+
b,
|
|
267
263
|
!!e.rollNavigation
|
|
268
|
-
),
|
|
269
|
-
|
|
270
|
-
|
|
264
|
+
), Ne = It(
|
|
265
|
+
Pe,
|
|
266
|
+
b,
|
|
271
267
|
!!e.rollNavigation
|
|
272
|
-
),
|
|
273
|
-
(
|
|
268
|
+
), D = At(b), Re = De(b), He = !b.some(
|
|
269
|
+
(i) => i.value === Y
|
|
274
270
|
);
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
}, [
|
|
279
|
-
t &&
|
|
280
|
-
}, [
|
|
281
|
-
var
|
|
282
|
-
!
|
|
283
|
-
}, [
|
|
284
|
-
|
|
285
|
-
}, [
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
item:
|
|
289
|
-
focusMethod:
|
|
290
|
-
isNewInput:
|
|
271
|
+
j(() => {
|
|
272
|
+
var i;
|
|
273
|
+
He && M(t ? (i = E[0]) == null ? void 0 : i.value : null);
|
|
274
|
+
}, [He]), j(() => {
|
|
275
|
+
t && M(D == null ? void 0 : D.value);
|
|
276
|
+
}, [t, M, _, D == null ? void 0 : D.value]), j(() => {
|
|
277
|
+
var i;
|
|
278
|
+
!O && t && M((i = E[0]) == null ? void 0 : i.value);
|
|
279
|
+
}, [O]), j(() => {
|
|
280
|
+
O && v && ae(!0);
|
|
281
|
+
}, [O, v, ae]), j(() => {
|
|
282
|
+
const i = E.find((c) => c.value === Y);
|
|
283
|
+
h(e.onOptionFocus, {
|
|
284
|
+
item: i,
|
|
285
|
+
focusMethod: U.current,
|
|
286
|
+
isNewInput: i == null ? void 0 : i.creatable
|
|
291
287
|
});
|
|
292
|
-
}, [
|
|
293
|
-
const
|
|
294
|
-
var
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
item:
|
|
298
|
-
selectMethod:
|
|
299
|
-
isNewInput:
|
|
300
|
-
}),
|
|
301
|
-
item:
|
|
302
|
-
selectMethod:
|
|
303
|
-
}),
|
|
304
|
-
},
|
|
305
|
-
var
|
|
306
|
-
|
|
307
|
-
const
|
|
308
|
-
return
|
|
288
|
+
}, [Y, e.onOptionFocus]);
|
|
289
|
+
const je = (i) => {
|
|
290
|
+
var P, R;
|
|
291
|
+
const c = b.find((S) => S.value === i), m = (c == null ? void 0 : c.label) || (c == null ? void 0 : c.value);
|
|
292
|
+
te(() => d ? "" : m ?? ""), !G.includes(i) && G.length < at && Ee((S) => d ? [...S, i] : [i]), d && ((P = F.current) == null || P.focus()), e.focusInputOnSelect && ((R = F.current) == null || R.focus()), h(e.onSelectOption, {
|
|
293
|
+
item: c,
|
|
294
|
+
selectMethod: U.current,
|
|
295
|
+
isNewInput: c == null ? void 0 : c.creatable
|
|
296
|
+
}), c != null && c.creatable && h(e.onCreateOption, {
|
|
297
|
+
item: ve(c, ["noFilter"]),
|
|
298
|
+
selectMethod: U.current
|
|
299
|
+
}), C && z();
|
|
300
|
+
}, Ve = (i, c) => {
|
|
301
|
+
var R;
|
|
302
|
+
Ee((S) => {
|
|
303
|
+
const X = E.find((W) => W.value === i);
|
|
304
|
+
return X ? (h(e.onTagRemoved, i, X, S), S.filter((W) => W !== i)) : S;
|
|
309
305
|
});
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
},
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
var
|
|
306
|
+
const m = E.find((S) => S.value === i), P = (m == null ? void 0 : m.label) || (m == null ? void 0 : m.value);
|
|
307
|
+
_ === P && te(""), c && ((R = F.current) == null || R.focus());
|
|
308
|
+
}, ct = (i) => {
|
|
309
|
+
var c;
|
|
310
|
+
Ee([]), i && ((c = F.current) == null || c.focus());
|
|
311
|
+
}, Ke = d ? G.map((i) => {
|
|
312
|
+
var c;
|
|
317
313
|
return {
|
|
318
|
-
label: ((
|
|
319
|
-
onRemove: () =>
|
|
314
|
+
label: ((c = E.find((m) => m.value === (i == null ? void 0 : i.toString()))) == null ? void 0 : c.label) || i,
|
|
315
|
+
onRemove: () => Ve(i)
|
|
320
316
|
};
|
|
321
317
|
}) : [];
|
|
322
|
-
return
|
|
323
|
-
|
|
324
|
-
}, [
|
|
318
|
+
return j(() => {
|
|
319
|
+
h(T, { tags: Ke });
|
|
320
|
+
}, [G]), {
|
|
325
321
|
autoCompleteProps: e,
|
|
326
|
-
children:
|
|
327
|
-
filteredList:
|
|
328
|
-
filteredResults:
|
|
329
|
-
focusedValue:
|
|
330
|
-
defaultEmptyStateProps:
|
|
331
|
-
getEmptyStateProps: (
|
|
332
|
-
if (
|
|
333
|
-
return typeof
|
|
322
|
+
children: Oe,
|
|
323
|
+
filteredList: b,
|
|
324
|
+
filteredResults: Ae,
|
|
325
|
+
focusedValue: Y,
|
|
326
|
+
defaultEmptyStateProps: u,
|
|
327
|
+
getEmptyStateProps: (i) => {
|
|
328
|
+
if (b.every((m) => m.noFilter) && s && !r)
|
|
329
|
+
return typeof s == "boolean" ? i : h(s, { query: _ });
|
|
334
330
|
},
|
|
335
|
-
getGroupProps: (
|
|
336
|
-
const
|
|
331
|
+
getGroupProps: (i) => {
|
|
332
|
+
const c = Bt(i.children, b);
|
|
337
333
|
return {
|
|
338
334
|
divider: {
|
|
339
|
-
hasFirstChild:
|
|
340
|
-
hasLastChild:
|
|
341
|
-
|
|
342
|
-
|
|
335
|
+
hasFirstChild: kt(i.children, D),
|
|
336
|
+
hasLastChild: zt(
|
|
337
|
+
i.children,
|
|
338
|
+
De(b.filter((m) => de(m == null ? void 0 : m.noFilter)))
|
|
343
339
|
)
|
|
344
340
|
},
|
|
345
341
|
group: {
|
|
346
|
-
display:
|
|
342
|
+
display: c ? "initial" : "none"
|
|
347
343
|
}
|
|
348
344
|
};
|
|
349
345
|
},
|
|
350
|
-
getInputProps: (
|
|
351
|
-
const { onBlur:
|
|
346
|
+
getInputProps: (i, c) => {
|
|
347
|
+
const { onBlur: m, onChange: P, onFocus: R, onKeyDown: S, variant: X, ...W } = i;
|
|
352
348
|
return {
|
|
353
349
|
wrapper: {
|
|
354
|
-
ref:
|
|
350
|
+
ref: ze,
|
|
355
351
|
onClick: () => {
|
|
356
|
-
var
|
|
357
|
-
(
|
|
352
|
+
var p;
|
|
353
|
+
(p = F == null ? void 0 : F.current) == null || p.focus();
|
|
358
354
|
},
|
|
359
|
-
|
|
360
|
-
...
|
|
355
|
+
//...getMultipleWrapStyles(themeInput, multiple),
|
|
356
|
+
...W
|
|
361
357
|
},
|
|
362
358
|
input: {
|
|
363
|
-
isReadOnly:
|
|
364
|
-
onFocus: (
|
|
365
|
-
|
|
359
|
+
isReadOnly: f,
|
|
360
|
+
onFocus: (p) => {
|
|
361
|
+
h(R, p), e.openOnFocus && !f && Q(), e.selectOnFocus && p.target.select(), v && ae(!0);
|
|
366
362
|
},
|
|
367
|
-
onBlur: (
|
|
368
|
-
var
|
|
369
|
-
m
|
|
370
|
-
const
|
|
371
|
-
|
|
363
|
+
onBlur: (p) => {
|
|
364
|
+
var V, fe;
|
|
365
|
+
h(m, p);
|
|
366
|
+
const w = p.relatedTarget === (ee == null ? void 0 : ee.current) || ((V = ee.current) == null ? void 0 : V.contains(p.relatedTarget)), g = (fe = ze.current) == null ? void 0 : fe.contains(
|
|
367
|
+
p.relatedTarget
|
|
372
368
|
);
|
|
373
|
-
if (!
|
|
374
|
-
const
|
|
375
|
-
(
|
|
376
|
-
),
|
|
377
|
-
|
|
369
|
+
if (!w && !g && (n && z(), !G.includes(p.target.value) && le)) {
|
|
370
|
+
const k = De(G), B = E.find(
|
|
371
|
+
(ne) => ne.value === k
|
|
372
|
+
), Le = (B == null ? void 0 : B.label) || (B == null ? void 0 : B.value) || "";
|
|
373
|
+
te(Le);
|
|
378
374
|
}
|
|
379
375
|
},
|
|
380
|
-
onChange: (
|
|
381
|
-
const
|
|
382
|
-
|
|
383
|
-
const g =
|
|
384
|
-
|
|
376
|
+
onChange: (p) => {
|
|
377
|
+
const w = p.target.value;
|
|
378
|
+
h(P, p), te(w);
|
|
379
|
+
const g = Me(w);
|
|
380
|
+
h(we, w) && (!g || Se) ? Q() : z(), ae(!1);
|
|
385
381
|
},
|
|
386
|
-
onKeyDown: (
|
|
387
|
-
var
|
|
388
|
-
|
|
389
|
-
const { key:
|
|
390
|
-
if (["Enter", ...
|
|
391
|
-
g && !(g != null && g.disabled) &&
|
|
382
|
+
onKeyDown: (p) => {
|
|
383
|
+
var V;
|
|
384
|
+
h(S, p), U.current = "keyboard";
|
|
385
|
+
const { key: w } = p, g = b[Pe];
|
|
386
|
+
if (["Enter", ...ue].includes(w)) {
|
|
387
|
+
g && !(g != null && g.disabled) && O ? je(g == null ? void 0 : g.value) : (V = F.current) == null || V.focus(), p.preventDefault();
|
|
392
388
|
return;
|
|
393
389
|
}
|
|
394
|
-
if (
|
|
395
|
-
|
|
390
|
+
if (w === "ArrowDown") {
|
|
391
|
+
O ? M(Ie == null ? void 0 : Ie.value) : Q(), p.preventDefault();
|
|
396
392
|
return;
|
|
397
393
|
}
|
|
398
|
-
if (
|
|
399
|
-
|
|
394
|
+
if (w === "ArrowUp") {
|
|
395
|
+
O ? M(Ne == null ? void 0 : Ne.value) : Q(), p.preventDefault();
|
|
400
396
|
return;
|
|
401
397
|
}
|
|
402
|
-
if (
|
|
403
|
-
|
|
398
|
+
if (w === "Tab") {
|
|
399
|
+
O && g && !(g != null && g.disabled) ? je(g == null ? void 0 : g.value) : z();
|
|
404
400
|
return;
|
|
405
401
|
}
|
|
406
|
-
if (
|
|
407
|
-
|
|
402
|
+
if (w === "Home") {
|
|
403
|
+
M(D == null ? void 0 : D.value), p.preventDefault();
|
|
408
404
|
return;
|
|
409
405
|
}
|
|
410
|
-
if (
|
|
411
|
-
|
|
406
|
+
if (w === "End") {
|
|
407
|
+
M(Re == null ? void 0 : Re.value), p.preventDefault();
|
|
412
408
|
return;
|
|
413
409
|
}
|
|
414
|
-
|
|
410
|
+
w === "Escape" && (z(), p.preventDefault());
|
|
415
411
|
},
|
|
416
|
-
value:
|
|
417
|
-
variant:
|
|
418
|
-
|
|
412
|
+
value: _,
|
|
413
|
+
//variant: multiple ? "unstyled" : variant,
|
|
414
|
+
variant: X,
|
|
415
|
+
...W
|
|
419
416
|
}
|
|
420
417
|
};
|
|
421
418
|
},
|
|
422
|
-
getItemProps: (
|
|
419
|
+
getItemProps: (i, c) => {
|
|
423
420
|
var Ue;
|
|
424
421
|
const {
|
|
425
|
-
_fixed:
|
|
426
|
-
_focus:
|
|
427
|
-
children:
|
|
428
|
-
disabled:
|
|
429
|
-
label:
|
|
430
|
-
value:
|
|
431
|
-
fixed:
|
|
432
|
-
getValue:
|
|
422
|
+
_fixed: m,
|
|
423
|
+
_focus: P,
|
|
424
|
+
children: R,
|
|
425
|
+
disabled: S,
|
|
426
|
+
label: X,
|
|
427
|
+
value: W,
|
|
428
|
+
fixed: p,
|
|
429
|
+
getValue: w = ke,
|
|
433
430
|
onClick: g,
|
|
434
|
-
onMouseOver:
|
|
435
|
-
sx
|
|
436
|
-
...
|
|
437
|
-
} =
|
|
431
|
+
onMouseOver: V,
|
|
432
|
+
//sx,
|
|
433
|
+
...fe
|
|
434
|
+
} = i, k = c ? W : (Ue = w(W)) == null ? void 0 : Ue.toString(), B = k === Y, Le = b.findIndex((re) => re.value === k) >= 0, ne = R || X || k;
|
|
438
435
|
return {
|
|
439
436
|
item: {
|
|
440
|
-
...typeof
|
|
437
|
+
...typeof ne != "string" || !o ? { children: ne } : {
|
|
441
438
|
dangerouslySetInnerHTML: {
|
|
442
|
-
__html:
|
|
439
|
+
__html: Tt(ne, _)
|
|
443
440
|
}
|
|
444
441
|
},
|
|
445
|
-
"aria-selected":
|
|
446
|
-
"aria-disabled":
|
|
442
|
+
"aria-selected": G.includes(k),
|
|
443
|
+
"aria-disabled": S,
|
|
447
444
|
_disabled: { opacity: 0.4, cursor: "not-allowed", userSelect: "none" },
|
|
448
|
-
|
|
449
|
-
var
|
|
450
|
-
|
|
445
|
+
onMouseDown: (re) => {
|
|
446
|
+
var Ye;
|
|
447
|
+
h(g, re), S ? (Ye = F.current) == null || Ye.focus() : je(k);
|
|
451
448
|
},
|
|
452
|
-
onMouseOver: (
|
|
453
|
-
|
|
449
|
+
onMouseOver: (re) => {
|
|
450
|
+
h(V, re), M(k), U.current = "mouse";
|
|
454
451
|
},
|
|
455
452
|
sx: {
|
|
456
|
-
|
|
453
|
+
//...sx,
|
|
457
454
|
mark: {
|
|
458
455
|
color: "inherit",
|
|
459
456
|
bg: "transparent",
|
|
460
|
-
...
|
|
457
|
+
...Ge(o) ? o : {
|
|
461
458
|
fontWeight: o ? "extrabold" : "inherit"
|
|
462
459
|
}
|
|
463
460
|
}
|
|
464
461
|
},
|
|
465
|
-
...
|
|
466
|
-
...
|
|
467
|
-
...
|
|
462
|
+
...B && (P || Gt()),
|
|
463
|
+
...p && m,
|
|
464
|
+
...fe
|
|
468
465
|
},
|
|
469
466
|
root: {
|
|
470
|
-
isValidSuggestion:
|
|
471
|
-
value:
|
|
467
|
+
isValidSuggestion: Le,
|
|
468
|
+
value: k
|
|
472
469
|
}
|
|
473
470
|
};
|
|
474
471
|
},
|
|
475
|
-
inputRef:
|
|
476
|
-
interactionRef:
|
|
477
|
-
isLoading:
|
|
478
|
-
isOpen:
|
|
472
|
+
inputRef: F,
|
|
473
|
+
interactionRef: U,
|
|
474
|
+
isLoading: Ce,
|
|
475
|
+
isOpen: O,
|
|
479
476
|
itemList: E,
|
|
480
|
-
listRef:
|
|
481
|
-
onClose:
|
|
482
|
-
onOpen:
|
|
483
|
-
placement:
|
|
484
|
-
query:
|
|
485
|
-
removeItem:
|
|
486
|
-
resetItems:
|
|
487
|
-
setQuery:
|
|
488
|
-
tags:
|
|
489
|
-
value:
|
|
490
|
-
values:
|
|
477
|
+
listRef: ee,
|
|
478
|
+
onClose: z,
|
|
479
|
+
onOpen: Q,
|
|
480
|
+
placement: q,
|
|
481
|
+
query: _,
|
|
482
|
+
removeItem: Ve,
|
|
483
|
+
resetItems: ct,
|
|
484
|
+
setQuery: te,
|
|
485
|
+
tags: Ke,
|
|
486
|
+
value: H,
|
|
487
|
+
values: G
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
var it = {
|
|
491
|
+
color: void 0,
|
|
492
|
+
size: void 0,
|
|
493
|
+
className: void 0,
|
|
494
|
+
style: void 0,
|
|
495
|
+
attr: void 0
|
|
496
|
+
}, qe = I.createContext && /* @__PURE__ */ I.createContext(it), Ht = ["attr", "size", "title"];
|
|
497
|
+
function Vt(e, t) {
|
|
498
|
+
if (e == null) return {};
|
|
499
|
+
var n = Kt(e, t), r, o;
|
|
500
|
+
if (Object.getOwnPropertySymbols) {
|
|
501
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
502
|
+
for (o = 0; o < s.length; o++)
|
|
503
|
+
r = s[o], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (n[r] = e[r]);
|
|
504
|
+
}
|
|
505
|
+
return n;
|
|
506
|
+
}
|
|
507
|
+
function Kt(e, t) {
|
|
508
|
+
if (e == null) return {};
|
|
509
|
+
var n = {};
|
|
510
|
+
for (var r in e)
|
|
511
|
+
if (Object.prototype.hasOwnProperty.call(e, r)) {
|
|
512
|
+
if (t.indexOf(r) >= 0) continue;
|
|
513
|
+
n[r] = e[r];
|
|
514
|
+
}
|
|
515
|
+
return n;
|
|
516
|
+
}
|
|
517
|
+
function me() {
|
|
518
|
+
return me = Object.assign ? Object.assign.bind() : function(e) {
|
|
519
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
520
|
+
var n = arguments[t];
|
|
521
|
+
for (var r in n)
|
|
522
|
+
Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
523
|
+
}
|
|
524
|
+
return e;
|
|
525
|
+
}, me.apply(this, arguments);
|
|
526
|
+
}
|
|
527
|
+
function et(e, t) {
|
|
528
|
+
var n = Object.keys(e);
|
|
529
|
+
if (Object.getOwnPropertySymbols) {
|
|
530
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
531
|
+
t && (r = r.filter(function(o) {
|
|
532
|
+
return Object.getOwnPropertyDescriptor(e, o).enumerable;
|
|
533
|
+
})), n.push.apply(n, r);
|
|
534
|
+
}
|
|
535
|
+
return n;
|
|
536
|
+
}
|
|
537
|
+
function ge(e) {
|
|
538
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
539
|
+
var n = arguments[t] != null ? arguments[t] : {};
|
|
540
|
+
t % 2 ? et(Object(n), !0).forEach(function(r) {
|
|
541
|
+
Qt(e, r, n[r]);
|
|
542
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : et(Object(n)).forEach(function(r) {
|
|
543
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
return e;
|
|
547
|
+
}
|
|
548
|
+
function Qt(e, t, n) {
|
|
549
|
+
return t = Ut(t), t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
|
|
550
|
+
}
|
|
551
|
+
function Ut(e) {
|
|
552
|
+
var t = Yt(e, "string");
|
|
553
|
+
return typeof t == "symbol" ? t : t + "";
|
|
554
|
+
}
|
|
555
|
+
function Yt(e, t) {
|
|
556
|
+
if (typeof e != "object" || !e) return e;
|
|
557
|
+
var n = e[Symbol.toPrimitive];
|
|
558
|
+
if (n !== void 0) {
|
|
559
|
+
var r = n.call(e, t || "default");
|
|
560
|
+
if (typeof r != "object") return r;
|
|
561
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
562
|
+
}
|
|
563
|
+
return (t === "string" ? String : Number)(e);
|
|
564
|
+
}
|
|
565
|
+
function lt(e) {
|
|
566
|
+
return e && e.map((t, n) => /* @__PURE__ */ I.createElement(t.tag, ge({
|
|
567
|
+
key: n
|
|
568
|
+
}, t.attr), lt(t.child)));
|
|
569
|
+
}
|
|
570
|
+
function Xt(e) {
|
|
571
|
+
return (t) => /* @__PURE__ */ I.createElement(Jt, me({
|
|
572
|
+
attr: ge({}, e.attr)
|
|
573
|
+
}, t), lt(e.child));
|
|
574
|
+
}
|
|
575
|
+
function Jt(e) {
|
|
576
|
+
var t = (n) => {
|
|
577
|
+
var {
|
|
578
|
+
attr: r,
|
|
579
|
+
size: o,
|
|
580
|
+
title: s
|
|
581
|
+
} = e, u = Vt(e, Ht), l = o || n.size || "1em", f;
|
|
582
|
+
return n.className && (f = n.className), e.className && (f = (f ? f + " " : "") + e.className), /* @__PURE__ */ I.createElement("svg", me({
|
|
583
|
+
stroke: "currentColor",
|
|
584
|
+
fill: "currentColor",
|
|
585
|
+
strokeWidth: "0"
|
|
586
|
+
}, n.attr, r, u, {
|
|
587
|
+
className: f,
|
|
588
|
+
style: ge(ge({
|
|
589
|
+
color: e.color || n.color
|
|
590
|
+
}, n.style), e.style),
|
|
591
|
+
height: l,
|
|
592
|
+
width: l,
|
|
593
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
594
|
+
}), s && /* @__PURE__ */ I.createElement("title", null, s), e.children);
|
|
491
595
|
};
|
|
596
|
+
return qe !== void 0 ? /* @__PURE__ */ I.createElement(qe.Consumer, null, (n) => t(n)) : t(it);
|
|
597
|
+
}
|
|
598
|
+
function Zt(e) {
|
|
599
|
+
return Xt({ tag: "svg", attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M18 6 6 18" }, child: [] }, { tag: "path", attr: { d: "m6 6 12 12" }, child: [] }] })(e);
|
|
492
600
|
}
|
|
493
|
-
const
|
|
601
|
+
const qt = L.forwardRef(function(t, n) {
|
|
602
|
+
return /* @__PURE__ */ a(ht, { variant: "ghost", "aria-label": "Close", ref: n, ...t, children: t.children ?? /* @__PURE__ */ a(Zt, {}) });
|
|
603
|
+
}), en = L.forwardRef(function(t, n) {
|
|
604
|
+
const { portalled: r = !0, portalRef: o, ...s } = t;
|
|
605
|
+
return /* @__PURE__ */ a(vt, { disabled: !r, container: o, children: /* @__PURE__ */ a(N.Positioner, { children: /* @__PURE__ */ a(N.Content, { ref: n, ...s }) }) });
|
|
606
|
+
});
|
|
607
|
+
L.forwardRef(function(t, n) {
|
|
608
|
+
return /* @__PURE__ */ a(N.Arrow, { ...t, ref: n, children: /* @__PURE__ */ a(N.ArrowTip, {}) });
|
|
609
|
+
});
|
|
610
|
+
L.forwardRef(function(t, n) {
|
|
611
|
+
return /* @__PURE__ */ a(
|
|
612
|
+
N.CloseTrigger,
|
|
613
|
+
{
|
|
614
|
+
position: "absolute",
|
|
615
|
+
top: "1",
|
|
616
|
+
insetEnd: "1",
|
|
617
|
+
...t,
|
|
618
|
+
asChild: !0,
|
|
619
|
+
ref: n,
|
|
620
|
+
children: /* @__PURE__ */ a(qt, { size: "sm" })
|
|
621
|
+
}
|
|
622
|
+
);
|
|
623
|
+
});
|
|
624
|
+
N.Title;
|
|
625
|
+
N.Description;
|
|
626
|
+
N.Footer;
|
|
627
|
+
N.Header;
|
|
628
|
+
const tn = N.Root, nn = N.Body;
|
|
629
|
+
N.Trigger;
|
|
630
|
+
const rn = K(
|
|
494
631
|
(e, t) => {
|
|
495
|
-
const n =
|
|
632
|
+
const n = $t(e), {
|
|
496
633
|
children: r,
|
|
497
634
|
isOpen: o,
|
|
498
|
-
onClose:
|
|
499
|
-
onOpen:
|
|
500
|
-
placement:
|
|
501
|
-
resetItems:
|
|
502
|
-
removeItem:
|
|
635
|
+
onClose: s,
|
|
636
|
+
onOpen: u,
|
|
637
|
+
placement: l,
|
|
638
|
+
resetItems: f,
|
|
639
|
+
removeItem: v
|
|
503
640
|
} = n;
|
|
504
|
-
|
|
505
|
-
resetItems:
|
|
506
|
-
removeItem:
|
|
641
|
+
pt(t, () => ({
|
|
642
|
+
resetItems: f,
|
|
643
|
+
removeItem: v
|
|
507
644
|
}));
|
|
508
|
-
const { matchWidth:
|
|
509
|
-
return /* @__PURE__ */
|
|
510
|
-
|
|
645
|
+
const { matchWidth: y = !0 } = n.autoCompleteProps;
|
|
646
|
+
return /* @__PURE__ */ a(xt, { value: n, children: /* @__PURE__ */ a(
|
|
647
|
+
tn,
|
|
511
648
|
{
|
|
512
|
-
|
|
513
|
-
isOpen: o,
|
|
514
|
-
onClose: l,
|
|
515
|
-
onOpen: i,
|
|
649
|
+
open: o,
|
|
516
650
|
autoFocus: !1,
|
|
517
|
-
placement:
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
children: /* @__PURE__ */ p(gt.div, { w: "full", ref: t, children: r })
|
|
651
|
+
positioning: { placement: l, sameWidth: y },
|
|
652
|
+
present: o,
|
|
653
|
+
children: /* @__PURE__ */ a(yt.div, { w: "full", ref: t, children: r })
|
|
521
654
|
}
|
|
522
655
|
) });
|
|
523
656
|
}
|
|
524
657
|
);
|
|
525
|
-
|
|
526
|
-
const
|
|
658
|
+
rn.displayName = "AutoComplete";
|
|
659
|
+
const on = K(
|
|
527
660
|
(e, t) => {
|
|
528
661
|
const {
|
|
529
662
|
focusedValue: n,
|
|
530
663
|
getItemProps: r,
|
|
531
664
|
interactionRef: o
|
|
532
|
-
} =
|
|
533
|
-
|
|
534
|
-
var
|
|
535
|
-
|
|
665
|
+
} = $(), s = se(), u = We(t, s), l = r(e), { isValidSuggestion: f, value: v } = l.root, y = n === v;
|
|
666
|
+
j(() => {
|
|
667
|
+
var T;
|
|
668
|
+
y && o.current === "keyboard" && ((T = s == null ? void 0 : s.current) == null || T.scrollIntoView({
|
|
536
669
|
behavior: "smooth",
|
|
537
670
|
block: "nearest"
|
|
538
671
|
}));
|
|
539
|
-
}, [
|
|
540
|
-
typeof
|
|
672
|
+
}, [y, o]), j(() => {
|
|
673
|
+
typeof v != "string" && console.warn("wow"), typeof v != "string" && de(e.getValue) && console.error(
|
|
541
674
|
"You must define the `getValue` prop, when an Item's value is not a string"
|
|
542
675
|
);
|
|
543
676
|
}, []);
|
|
544
|
-
const { children:
|
|
545
|
-
return
|
|
677
|
+
const { children: d, dangerouslySetInnerHTML: C, ...A } = l.item, x = ve(A, ["groupId"]);
|
|
678
|
+
return f ? /* @__PURE__ */ a(he, { ref: u, ...ut, ...x, children: d || /* @__PURE__ */ a("span", { dangerouslySetInnerHTML: C }) }) : null;
|
|
546
679
|
}
|
|
547
680
|
);
|
|
548
|
-
|
|
549
|
-
const
|
|
681
|
+
on.displayName = "AutoCompleteItem";
|
|
682
|
+
const ut = {
|
|
550
683
|
mx: "2",
|
|
551
684
|
px: "2",
|
|
552
685
|
py: "2",
|
|
553
686
|
rounded: "md",
|
|
554
687
|
cursor: "pointer"
|
|
555
688
|
};
|
|
556
|
-
function
|
|
689
|
+
function sn(e) {
|
|
557
690
|
const { alwaysDisplay: t, children: n, ...r } = e, {
|
|
558
691
|
autoCompleteProps: o,
|
|
559
|
-
getItemProps:
|
|
560
|
-
query:
|
|
561
|
-
filteredResults:
|
|
562
|
-
} =
|
|
692
|
+
getItemProps: s,
|
|
693
|
+
query: u,
|
|
694
|
+
filteredResults: l
|
|
695
|
+
} = $(), { children: f, ...v } = s(
|
|
563
696
|
{
|
|
564
697
|
...e,
|
|
565
|
-
value:
|
|
566
|
-
children:
|
|
567
|
-
value:
|
|
698
|
+
value: u,
|
|
699
|
+
children: h(n, {
|
|
700
|
+
value: u
|
|
568
701
|
})
|
|
569
702
|
},
|
|
570
703
|
!0
|
|
571
|
-
).item,
|
|
572
|
-
return o.creatable &&
|
|
704
|
+
).item, y = l.some((A) => A.value === u), d = Me(u) ? t : !0;
|
|
705
|
+
return o.creatable && d && !y ? /* @__PURE__ */ a(he, { ...ut, ...v, ...r, children: f || `Add ${u}` }) : null;
|
|
573
706
|
}
|
|
574
|
-
|
|
575
|
-
const
|
|
707
|
+
sn.displayName = "AutoCompleteCreatable";
|
|
708
|
+
const ln = K(
|
|
576
709
|
(e, t) => {
|
|
577
|
-
const { children: n, showDivider: r, ...o } = e,
|
|
578
|
-
return /* @__PURE__ */
|
|
579
|
-
/* @__PURE__ */
|
|
710
|
+
const { children: n, showDivider: r, ...o } = e, s = ve(o, ["groupSibling"]), { getGroupProps: u } = $(), { group: l } = u(e), f = cn(e);
|
|
711
|
+
return /* @__PURE__ */ Z(Te, { ref: t, ...l, ...s, children: [
|
|
712
|
+
/* @__PURE__ */ a(Xe, { ...f.top }),
|
|
580
713
|
n,
|
|
581
|
-
/* @__PURE__ */
|
|
714
|
+
/* @__PURE__ */ a(Xe, { ...f.bottom })
|
|
582
715
|
] });
|
|
583
716
|
}
|
|
584
|
-
),
|
|
585
|
-
(e, t) => /* @__PURE__ */
|
|
717
|
+
), un = K(
|
|
718
|
+
(e, t) => /* @__PURE__ */ a(he, { ...an, ...e, ref: t })
|
|
586
719
|
);
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
const
|
|
720
|
+
ln.displayName = "AutoCompleteGroup";
|
|
721
|
+
un.displayName = "AutoCompleteGroupTitle";
|
|
722
|
+
const an = {
|
|
590
723
|
ml: 5,
|
|
591
724
|
my: 1,
|
|
592
725
|
fontSize: "xs",
|
|
593
726
|
letterSpacing: "wider",
|
|
594
727
|
fontWeight: "extrabold",
|
|
595
728
|
textTransform: "uppercase"
|
|
596
|
-
},
|
|
597
|
-
const { getGroupProps: t } =
|
|
729
|
+
}, cn = (e) => {
|
|
730
|
+
const { getGroupProps: t } = $(), n = e.groupSibling, {
|
|
598
731
|
divider: { hasFirstChild: r, hasLastChild: o }
|
|
599
|
-
} = t(e),
|
|
732
|
+
} = t(e), s = {
|
|
600
733
|
my: 2,
|
|
601
734
|
borderColor: e.dividerColor
|
|
602
|
-
},
|
|
603
|
-
...
|
|
735
|
+
}, u = {
|
|
736
|
+
...s,
|
|
604
737
|
mb: 4,
|
|
605
738
|
display: !e.showDivider || r ? "none" : ""
|
|
606
|
-
},
|
|
607
|
-
...
|
|
739
|
+
}, l = {
|
|
740
|
+
...s,
|
|
608
741
|
display: !e.showDivider || o || n ? "none" : ""
|
|
609
742
|
};
|
|
610
|
-
return { top:
|
|
611
|
-
},
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
743
|
+
return { top: u, bottom: l };
|
|
744
|
+
}, fn = L.forwardRef(
|
|
745
|
+
function(t, n) {
|
|
746
|
+
const {
|
|
747
|
+
startElement: r,
|
|
748
|
+
startElementProps: o,
|
|
749
|
+
endElement: s,
|
|
750
|
+
endElementProps: u,
|
|
751
|
+
children: l,
|
|
752
|
+
startOffset: f = "6px",
|
|
753
|
+
endOffset: v = "6px",
|
|
754
|
+
...y
|
|
755
|
+
} = t;
|
|
756
|
+
return /* @__PURE__ */ Z(bt, { ref: n, ...y, children: [
|
|
757
|
+
r && /* @__PURE__ */ a(Je, { pointerEvents: "none", ...o, children: r }),
|
|
758
|
+
L.cloneElement(l, {
|
|
759
|
+
...r && {
|
|
760
|
+
ps: `calc(var(--input-height) - ${f})`
|
|
761
|
+
},
|
|
762
|
+
...s && { pe: `calc(var(--input-height) - ${v})` },
|
|
763
|
+
...l.props
|
|
764
|
+
}),
|
|
765
|
+
s && /* @__PURE__ */ a(Je, { placement: "end", ...u, children: s })
|
|
766
|
+
] });
|
|
767
|
+
}
|
|
768
|
+
), pn = K((e, t) => {
|
|
769
|
+
const { isLoading: n } = $(), { loadingIcon: r, ...o } = e, s = ve(o, ["children", "wrapStyles", "hidePlaceholder"]), u = /* @__PURE__ */ a(wt, { ...s, ref: t });
|
|
770
|
+
return n ? /* @__PURE__ */ a(fn, { endElement: r || /* @__PURE__ */ a(nt, {}), children: u }) : u;
|
|
771
|
+
}), dn = K(
|
|
618
772
|
(e, t) => {
|
|
619
773
|
const {
|
|
620
774
|
autoCompleteProps: n,
|
|
621
775
|
inputRef: r,
|
|
622
776
|
getInputProps: o,
|
|
623
|
-
tags:
|
|
624
|
-
setQuery:
|
|
625
|
-
value:
|
|
626
|
-
itemList:
|
|
627
|
-
} =
|
|
628
|
-
children:
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
i(k);
|
|
777
|
+
tags: s,
|
|
778
|
+
setQuery: u,
|
|
779
|
+
value: l,
|
|
780
|
+
itemList: f
|
|
781
|
+
} = $(), {
|
|
782
|
+
children: v,
|
|
783
|
+
hidePlaceholder: y,
|
|
784
|
+
...d
|
|
785
|
+
} = e, { value: C } = d;
|
|
786
|
+
j(() => {
|
|
787
|
+
if (l !== void 0 && (typeof l == "string" || l instanceof String)) {
|
|
788
|
+
const ue = f.find((H) => H.value === l), Se = ue === void 0 ? l : ue.label;
|
|
789
|
+
u(Se);
|
|
637
790
|
}
|
|
638
|
-
}, [
|
|
639
|
-
C !== void 0 && (typeof C == "string" || C instanceof String) &&
|
|
791
|
+
}, [l]), j(() => {
|
|
792
|
+
C !== void 0 && (typeof C == "string" || C instanceof String) && u(C);
|
|
640
793
|
}, [C]);
|
|
641
|
-
const
|
|
642
|
-
let { wrapper:
|
|
643
|
-
const { ref:
|
|
644
|
-
|
|
645
|
-
...
|
|
646
|
-
placeholder: Array.isArray(
|
|
794
|
+
const A = {};
|
|
795
|
+
let { wrapper: x, input: T } = o(d, A);
|
|
796
|
+
const { ref: be, ...ie } = x, Ce = We(t, r), q = h(v, { tags: s });
|
|
797
|
+
y && (T = {
|
|
798
|
+
...T,
|
|
799
|
+
placeholder: Array.isArray(q) && q.length ? void 0 : T.placeholder
|
|
647
800
|
});
|
|
648
|
-
const
|
|
649
|
-
|
|
801
|
+
const le = /* @__PURE__ */ a(
|
|
802
|
+
pn,
|
|
650
803
|
{
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
ref: oe
|
|
804
|
+
...T,
|
|
805
|
+
ref: Ce
|
|
654
806
|
}
|
|
655
|
-
),
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
qe,
|
|
659
|
-
{
|
|
660
|
-
as: Ke,
|
|
661
|
-
...j,
|
|
662
|
-
ref: oe
|
|
663
|
-
}
|
|
664
|
-
)
|
|
807
|
+
), we = /* @__PURE__ */ Z(Te, { ...ie, ref: be, children: [
|
|
808
|
+
q,
|
|
809
|
+
le
|
|
665
810
|
] });
|
|
666
|
-
return /* @__PURE__ */
|
|
811
|
+
return /* @__PURE__ */ a(Ct, { children: n.multiple ? we : le });
|
|
667
812
|
}
|
|
668
813
|
);
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
/* @__PURE__ */ p(pe, { ...en, ...n, children: "No options found!" })
|
|
814
|
+
dn.displayName = "Input";
|
|
815
|
+
const mn = (e) => {
|
|
816
|
+
const { getEmptyStateProps: t, defaultEmptyStateProps: n } = $(), r = t(
|
|
817
|
+
/* @__PURE__ */ a(he, { ...gn, ...n, children: "No options found!" })
|
|
674
818
|
);
|
|
675
|
-
return /* @__PURE__ */
|
|
676
|
-
},
|
|
819
|
+
return /* @__PURE__ */ a(Te, { ...e, children: r });
|
|
820
|
+
}, gn = {
|
|
677
821
|
fontSize: "sm",
|
|
678
822
|
align: "center",
|
|
679
823
|
justify: "center",
|
|
680
824
|
fontWeight: "bold",
|
|
681
825
|
fontStyle: "italic"
|
|
682
|
-
},
|
|
826
|
+
}, tt = [
|
|
683
827
|
"AutoCompleteGroup",
|
|
684
828
|
"AutoCompleteItem",
|
|
685
829
|
"AutoCompleteCreatable"
|
|
686
|
-
],
|
|
687
|
-
const t =
|
|
688
|
-
var
|
|
689
|
-
if (((
|
|
690
|
-
const
|
|
691
|
-
return
|
|
692
|
-
groupSibling:
|
|
830
|
+
], hn = (e) => {
|
|
831
|
+
const t = I.Children.map(e, (o, s) => {
|
|
832
|
+
var u;
|
|
833
|
+
if (((u = o == null ? void 0 : o.type) == null ? void 0 : u.displayName) === "AutoCompleteGroup") {
|
|
834
|
+
const l = I.Children.toArray(e)[s + 1];
|
|
835
|
+
return I.cloneElement(o, {
|
|
836
|
+
groupSibling: l ? l.type.displayName === "AutoCompleteGroup" : !1
|
|
693
837
|
});
|
|
694
838
|
}
|
|
695
839
|
return o;
|
|
696
|
-
}), n =
|
|
840
|
+
}), n = I.Children.toArray(t).filter(
|
|
697
841
|
(o) => {
|
|
698
|
-
var
|
|
699
|
-
return !
|
|
700
|
-
(
|
|
842
|
+
var s;
|
|
843
|
+
return !tt.includes(
|
|
844
|
+
(s = o == null ? void 0 : o.type) == null ? void 0 : s.displayName
|
|
701
845
|
);
|
|
702
846
|
}
|
|
703
847
|
);
|
|
704
|
-
return [
|
|
848
|
+
return [I.Children.toArray(t).filter(
|
|
705
849
|
(o) => {
|
|
706
|
-
var
|
|
707
|
-
return
|
|
708
|
-
(
|
|
850
|
+
var s;
|
|
851
|
+
return tt.includes(
|
|
852
|
+
(s = o == null ? void 0 : o.type) == null ? void 0 : s.displayName
|
|
709
853
|
);
|
|
710
854
|
}
|
|
711
855
|
), n];
|
|
712
|
-
},
|
|
856
|
+
}, vn = K(
|
|
713
857
|
(e, t) => {
|
|
714
|
-
const { children: n, loadingState: r, ...o } = e, { listRef:
|
|
715
|
-
return /* @__PURE__ */
|
|
716
|
-
|
|
717
|
-
!
|
|
718
|
-
|
|
719
|
-
/* @__PURE__ */
|
|
720
|
-
|
|
858
|
+
const { children: n, loadingState: r, ...o } = e, { listRef: s, isLoading: u } = $(), l = We(t, s), [f, v] = hn(n);
|
|
859
|
+
return /* @__PURE__ */ a(en, { width: "auto", children: /* @__PURE__ */ Z(nn, { ref: l, w: "inherit", ...yn, ...o, children: [
|
|
860
|
+
u && /* @__PURE__ */ a(St, { children: r || /* @__PURE__ */ a(nt, { size: "md" }) }),
|
|
861
|
+
!u && /* @__PURE__ */ Z(ft, { children: [
|
|
862
|
+
f,
|
|
863
|
+
/* @__PURE__ */ a(mn, {}),
|
|
864
|
+
v
|
|
721
865
|
] })
|
|
722
|
-
] });
|
|
866
|
+
] }) });
|
|
723
867
|
}
|
|
724
868
|
);
|
|
725
|
-
|
|
726
|
-
const
|
|
727
|
-
py: "4",
|
|
728
|
-
opacity: "0",
|
|
869
|
+
vn.displayName = "AutoCompleteList";
|
|
870
|
+
const yn = {
|
|
871
|
+
// py: "4",
|
|
872
|
+
//opacity: "0",
|
|
873
|
+
px: "0px",
|
|
729
874
|
bg: "#232934",
|
|
730
875
|
rounded: "md",
|
|
731
876
|
maxH: "350px",
|
|
@@ -739,46 +884,55 @@ const on = {
|
|
|
739
884
|
_focus: {
|
|
740
885
|
boxShadow: "none"
|
|
741
886
|
}
|
|
742
|
-
},
|
|
887
|
+
}, bn = L.forwardRef(
|
|
888
|
+
function(t, n) {
|
|
889
|
+
const {
|
|
890
|
+
startElement: r,
|
|
891
|
+
endElement: o,
|
|
892
|
+
onClose: s,
|
|
893
|
+
closable: u = !!s,
|
|
894
|
+
children: l,
|
|
895
|
+
...f
|
|
896
|
+
} = t;
|
|
897
|
+
return /* @__PURE__ */ Z(J.Root, { ref: n, ...f, children: [
|
|
898
|
+
r && /* @__PURE__ */ a(J.StartElement, { children: r }),
|
|
899
|
+
/* @__PURE__ */ a(J.Label, { children: l }),
|
|
900
|
+
o && /* @__PURE__ */ a(J.EndElement, { children: o }),
|
|
901
|
+
u && /* @__PURE__ */ a(J.EndElement, { children: /* @__PURE__ */ a(J.CloseTrigger, { onClick: s }) })
|
|
902
|
+
] });
|
|
903
|
+
}
|
|
904
|
+
), In = dt((e) => {
|
|
743
905
|
const { label: t, onRemove: n, disabled: r, ...o } = e;
|
|
744
|
-
return /* @__PURE__ */
|
|
745
|
-
|
|
906
|
+
return /* @__PURE__ */ a(
|
|
907
|
+
bn,
|
|
746
908
|
{
|
|
747
909
|
borderRadius: "md",
|
|
748
910
|
fontWeight: "normal",
|
|
749
|
-
|
|
911
|
+
closable: !0,
|
|
912
|
+
onClose: () => !r && h(n),
|
|
913
|
+
...r && Cn,
|
|
750
914
|
...o,
|
|
751
|
-
children:
|
|
752
|
-
/* @__PURE__ */ p(It, { children: t }),
|
|
753
|
-
/* @__PURE__ */ p(
|
|
754
|
-
wt,
|
|
755
|
-
{
|
|
756
|
-
onClick: () => !r && m(n),
|
|
757
|
-
cursor: "pointer",
|
|
758
|
-
...r && Je
|
|
759
|
-
}
|
|
760
|
-
)
|
|
761
|
-
]
|
|
915
|
+
children: t
|
|
762
916
|
}
|
|
763
|
-
)
|
|
764
|
-
}),
|
|
917
|
+
);
|
|
918
|
+
}), Cn = {
|
|
765
919
|
cursor: "text",
|
|
766
920
|
userSelect: "none",
|
|
767
921
|
opacity: 0.4,
|
|
768
922
|
_focus: { boxShadow: "none" }
|
|
769
923
|
};
|
|
770
924
|
export {
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
925
|
+
rn as AutoComplete,
|
|
926
|
+
sn as AutoCompleteCreatable,
|
|
927
|
+
ln as AutoCompleteGroup,
|
|
928
|
+
un as AutoCompleteGroupTitle,
|
|
929
|
+
dn as AutoCompleteInput,
|
|
930
|
+
on as AutoCompleteItem,
|
|
931
|
+
vn as AutoCompleteList,
|
|
932
|
+
xt as AutoCompleteProvider,
|
|
933
|
+
In as AutoCompleteTag,
|
|
934
|
+
ut as baseItemStyles,
|
|
935
|
+
Ot as createContext,
|
|
936
|
+
$t as useAutoComplete,
|
|
937
|
+
$ as useAutoCompleteContext
|
|
784
938
|
};
|