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