@box/combobox-with-api 1.15.9 → 1.17.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/dist/chunks/dynamic-loading-tree.js +133 -142
- package/dist/chunks/treeReducer.js +2 -2
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-container.js +33 -33
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +110 -113
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +2 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +3 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +21 -24
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +59 -61
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +97 -100
- package/dist/esm/lib/components/combobox-with-api-tree-view/index.js +22 -22
- package/dist/i18n/en-x-pseudo.js +8 -8
- package/dist/i18n/en-x-pseudo.properties +8 -8
- package/package.json +7 -7
|
@@ -1,82 +1,73 @@
|
|
|
1
1
|
import { LoadingIndicator as Z } from "@box/blueprint-web";
|
|
2
2
|
import { InlineError as $, Tree as F } from "@box/tree";
|
|
3
|
-
import { forwardRef as P, useReducer as ee, useState as A, useMemo as ae, useCallback as
|
|
3
|
+
import { forwardRef as P, useReducer as ee, useState as A, useMemo as ae, useCallback as u, useEffect as U } from "react";
|
|
4
4
|
import { RootTreeNode as m, hasValidLevel as te, getServiceNode as D } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
|
|
5
|
-
import { t as le, i as
|
|
5
|
+
import { t as le, i as se, A as o } from "./treeReducer.js";
|
|
6
6
|
import { jsx as f, jsxs as ne } from "react/jsx-runtime";
|
|
7
|
-
import '../styles/dynamic-loading-tree.css';const
|
|
8
|
-
container:
|
|
9
|
-
|
|
10
|
-
label: ie,
|
|
7
|
+
import '../styles/dynamic-loading-tree.css';const oe = "_container_1wa8l_2", re = "_label_1wa8l_16", de = "_hiddenLabel_1wa8l_28", ie = "_comboboxContainer_1wa8l_31", ce = "_withComboboxButtons_1wa8l_47", me = "_textInputWrapper_1wa8l_63", ue = "_textInput_1wa8l_63", pe = "_comboboxButtons_1wa8l_88", be = "_withChips_1wa8l_95", ye = "_popover_1wa8l_109", _e = "_loadingIndicator_1wa8l_173", he = "_noResultOption_1wa8l_176", C = {
|
|
8
|
+
container: oe,
|
|
9
|
+
label: re,
|
|
11
10
|
hiddenLabel: de,
|
|
12
|
-
comboboxContainer:
|
|
13
|
-
withComboboxButtons:
|
|
14
|
-
|
|
15
|
-
textInputWrapper: _e,
|
|
11
|
+
comboboxContainer: ie,
|
|
12
|
+
withComboboxButtons: ce,
|
|
13
|
+
textInputWrapper: me,
|
|
16
14
|
textInput: ue,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
indicatorIcon: ge,
|
|
25
|
-
optionWithIndicator: Se,
|
|
26
|
-
loadingIndicator: Ee,
|
|
27
|
-
noResultOption: Ne
|
|
28
|
-
}, Oe = (n) => {
|
|
29
|
-
const d = [...n.children], {
|
|
15
|
+
comboboxButtons: pe,
|
|
16
|
+
withChips: be,
|
|
17
|
+
popover: ye,
|
|
18
|
+
loadingIndicator: _e,
|
|
19
|
+
noResultOption: he
|
|
20
|
+
}, ve = (s) => {
|
|
21
|
+
const i = [...s.children], {
|
|
30
22
|
metadata: c
|
|
31
|
-
} =
|
|
23
|
+
} = s;
|
|
32
24
|
return {
|
|
33
|
-
...
|
|
34
|
-
children:
|
|
25
|
+
...s,
|
|
26
|
+
children: i,
|
|
35
27
|
metadata: {
|
|
36
|
-
...
|
|
28
|
+
...s.metadata,
|
|
37
29
|
variant: c.variant,
|
|
38
|
-
isLoading:
|
|
30
|
+
isLoading: s.status === "loading" && !s.children.length,
|
|
39
31
|
labelName: c.labelName || "",
|
|
40
32
|
labelValue: c.labelValue || ""
|
|
41
33
|
}
|
|
42
34
|
};
|
|
43
|
-
},
|
|
35
|
+
}, fe = (s, i) => {
|
|
44
36
|
let c;
|
|
45
|
-
return
|
|
46
|
-
},
|
|
47
|
-
ariaLabel:
|
|
48
|
-
onSelect:
|
|
37
|
+
return s.children.length && s.status === "loading" && (c = D(i.id, i.metadata.displayValue, "loading")), s.status === "error" && (c = D(i.id, i.metadata.displayValue, "reload")), s.status === "success" && s.marker && (c = D(i.id, i.metadata.displayValue, "loadMore")), c;
|
|
38
|
+
}, Ie = /* @__PURE__ */ P(({
|
|
39
|
+
ariaLabel: s,
|
|
40
|
+
onSelect: i,
|
|
49
41
|
selectedNodes: c,
|
|
50
|
-
defaultFetcher:
|
|
51
|
-
levels:
|
|
52
|
-
selectableLevels:
|
|
53
|
-
multiselect:
|
|
42
|
+
defaultFetcher: b,
|
|
43
|
+
levels: w,
|
|
44
|
+
selectableLevels: g,
|
|
45
|
+
multiselect: W,
|
|
54
46
|
open: L,
|
|
55
|
-
searchInput:
|
|
47
|
+
searchInput: p,
|
|
56
48
|
noResultMessage: z,
|
|
57
49
|
loadingAriaLabel: q
|
|
58
50
|
}, G) => {
|
|
59
|
-
const [
|
|
51
|
+
const [_, l] = ee(le, se), [v, H] = A({
|
|
60
52
|
nodes: [],
|
|
61
53
|
selectedIds: []
|
|
62
|
-
}), [
|
|
54
|
+
}), [I, y] = A(!1), [S, N] = A(!1), O = ae(() => Math.max(...g), [g]), V = u((e = _) => {
|
|
63
55
|
const t = [];
|
|
64
56
|
return [...Object.values(e).map((a) => {
|
|
65
|
-
const
|
|
66
|
-
return
|
|
57
|
+
const n = ve(a), d = fe(a, n);
|
|
58
|
+
return d && (t.push(d), n.children.push(d.id)), n;
|
|
67
59
|
}), ...t];
|
|
68
|
-
}, [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
labelName: i.displayName,
|
|
60
|
+
}, [_]), k = u((e) => {
|
|
61
|
+
const t = e.ancestors?.find((n) => n.level === e.level - 1), r = w.find((n) => n.level === e.level);
|
|
62
|
+
return e.level === 1 || p === "" ? e.displayValue : {
|
|
63
|
+
labelName: r.displayName,
|
|
73
64
|
labelValue: t.displayName
|
|
74
65
|
};
|
|
75
|
-
}, [
|
|
66
|
+
}, [w, p]), h = u((e) => ({
|
|
76
67
|
id: e.value,
|
|
77
68
|
name: e.displayValue,
|
|
78
69
|
parent: m.id,
|
|
79
|
-
isBranch: e.level !==
|
|
70
|
+
isBranch: e.level !== O,
|
|
80
71
|
children: [],
|
|
81
72
|
metadata: {
|
|
82
73
|
variant: "content",
|
|
@@ -86,68 +77,68 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_1wa8l_2", re
|
|
|
86
77
|
marker: e.marker,
|
|
87
78
|
ancestors: e.ancestors
|
|
88
79
|
}
|
|
89
|
-
}), [
|
|
90
|
-
|
|
91
|
-
type:
|
|
80
|
+
}), [O]), x = u((e, t) => {
|
|
81
|
+
l({
|
|
82
|
+
type: o.RESET,
|
|
92
83
|
payload: {
|
|
93
84
|
id: m.id,
|
|
94
85
|
items: []
|
|
95
86
|
}
|
|
96
|
-
}),
|
|
97
|
-
type:
|
|
87
|
+
}), l({
|
|
88
|
+
type: o.LOAD_SUCCESS,
|
|
98
89
|
payload: {
|
|
99
90
|
id: m.id,
|
|
100
91
|
items: e,
|
|
101
92
|
marker: t
|
|
102
93
|
}
|
|
103
|
-
}),
|
|
104
|
-
}, [
|
|
105
|
-
|
|
106
|
-
type:
|
|
94
|
+
}), y(!1);
|
|
95
|
+
}, [l, y]), E = u(() => {
|
|
96
|
+
l({
|
|
97
|
+
type: o.LOAD_ERROR,
|
|
107
98
|
payload: {
|
|
108
99
|
id: m.id
|
|
109
100
|
}
|
|
110
|
-
}),
|
|
111
|
-
}, [
|
|
112
|
-
const
|
|
113
|
-
return t.filter((a) =>
|
|
101
|
+
}), y(!1), N(!0);
|
|
102
|
+
}, [l, y, N]), J = u((e, t) => {
|
|
103
|
+
const r = new Set(e.map((a) => a.id));
|
|
104
|
+
return t.filter((a) => r.has(a));
|
|
114
105
|
}, []);
|
|
115
|
-
|
|
116
|
-
const e = V(
|
|
106
|
+
U(() => {
|
|
107
|
+
const e = V(_);
|
|
117
108
|
H({
|
|
118
109
|
nodes: e,
|
|
119
110
|
selectedIds: J(e, c)
|
|
120
111
|
});
|
|
121
|
-
}, [V, c,
|
|
112
|
+
}, [V, c, _, S]), U(() => {
|
|
122
113
|
if (!L)
|
|
123
114
|
return;
|
|
124
115
|
const {
|
|
125
116
|
signal: e
|
|
126
117
|
} = new AbortController();
|
|
127
|
-
|
|
128
|
-
type:
|
|
118
|
+
y(!0), N(!1), p ? (l({
|
|
119
|
+
type: o.RESET,
|
|
129
120
|
payload: {
|
|
130
121
|
id: m.id,
|
|
131
122
|
items: []
|
|
132
123
|
}
|
|
133
|
-
}),
|
|
124
|
+
}), b({
|
|
134
125
|
signal: e,
|
|
135
126
|
marker: null,
|
|
136
|
-
searchInput:
|
|
127
|
+
searchInput: p,
|
|
137
128
|
level: null,
|
|
138
129
|
onlySelectableOptions: !1,
|
|
139
130
|
ancestorId: null
|
|
140
131
|
}).then((t) => {
|
|
141
|
-
const
|
|
132
|
+
const r = t.options.filter((a) => a.selectable).map((a) => {
|
|
142
133
|
const {
|
|
143
|
-
labelName:
|
|
144
|
-
labelValue:
|
|
134
|
+
labelName: n,
|
|
135
|
+
labelValue: d
|
|
145
136
|
} = k(a);
|
|
146
137
|
return {
|
|
147
138
|
id: a.value,
|
|
148
139
|
name: a.displayValue,
|
|
149
140
|
parent: m.id,
|
|
150
|
-
isBranch: a.level <
|
|
141
|
+
isBranch: a.level < O,
|
|
151
142
|
children: [],
|
|
152
143
|
metadata: {
|
|
153
144
|
variant: a.level === 1 ? "content" : "labeled",
|
|
@@ -155,26 +146,26 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_1wa8l_2", re
|
|
|
155
146
|
level: a.level,
|
|
156
147
|
selectable: a.selectable,
|
|
157
148
|
ancestors: a.ancestors,
|
|
158
|
-
labelName:
|
|
159
|
-
labelValue:
|
|
149
|
+
labelName: n,
|
|
150
|
+
labelValue: d
|
|
160
151
|
}
|
|
161
152
|
};
|
|
162
153
|
});
|
|
163
|
-
|
|
154
|
+
x(r, t.marker);
|
|
164
155
|
}).catch(() => {
|
|
165
|
-
|
|
166
|
-
})) : (
|
|
167
|
-
type:
|
|
156
|
+
E();
|
|
157
|
+
})) : (l({
|
|
158
|
+
type: o.RESET,
|
|
168
159
|
payload: {
|
|
169
160
|
id: m.id,
|
|
170
161
|
items: []
|
|
171
162
|
}
|
|
172
|
-
}),
|
|
173
|
-
type:
|
|
163
|
+
}), l({
|
|
164
|
+
type: o.LOAD_DATA,
|
|
174
165
|
payload: {
|
|
175
166
|
id: m.id
|
|
176
167
|
}
|
|
177
|
-
}),
|
|
168
|
+
}), b({
|
|
178
169
|
signal: e,
|
|
179
170
|
marker: null,
|
|
180
171
|
searchInput: "",
|
|
@@ -182,21 +173,21 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_1wa8l_2", re
|
|
|
182
173
|
onlySelectableOptions: !1,
|
|
183
174
|
ancestorId: null
|
|
184
175
|
}).then((t) => {
|
|
185
|
-
const
|
|
186
|
-
|
|
176
|
+
const r = t.options.map(h);
|
|
177
|
+
x(r, t.marker);
|
|
187
178
|
}).catch(() => {
|
|
188
|
-
|
|
179
|
+
E();
|
|
189
180
|
}));
|
|
190
|
-
}, [
|
|
191
|
-
const K =
|
|
181
|
+
}, [b, h, L, p, w, O, k, x, E]);
|
|
182
|
+
const K = u((e) => {
|
|
192
183
|
const {
|
|
193
184
|
isExpanded: t,
|
|
194
|
-
isDisabled:
|
|
185
|
+
isDisabled: r,
|
|
195
186
|
element: a
|
|
196
187
|
} = e;
|
|
197
|
-
if (!t ||
|
|
198
|
-
|
|
199
|
-
type:
|
|
188
|
+
if (!t || r) {
|
|
189
|
+
l({
|
|
190
|
+
type: o.RESET,
|
|
200
191
|
payload: {
|
|
201
192
|
id: a.id,
|
|
202
193
|
items: []
|
|
@@ -205,109 +196,109 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_1wa8l_2", re
|
|
|
205
196
|
return;
|
|
206
197
|
}
|
|
207
198
|
const {
|
|
208
|
-
level:
|
|
199
|
+
level: n
|
|
209
200
|
} = a.metadata, {
|
|
210
|
-
id:
|
|
211
|
-
marker:
|
|
201
|
+
id: d,
|
|
202
|
+
marker: R
|
|
212
203
|
} = a, {
|
|
213
204
|
signal: T
|
|
214
205
|
} = new AbortController();
|
|
215
|
-
|
|
216
|
-
type:
|
|
206
|
+
l({
|
|
207
|
+
type: o.LOAD_DATA,
|
|
217
208
|
payload: {
|
|
218
|
-
id:
|
|
209
|
+
id: d
|
|
219
210
|
}
|
|
220
|
-
}),
|
|
211
|
+
}), b({
|
|
221
212
|
signal: T,
|
|
222
|
-
marker:
|
|
213
|
+
marker: R,
|
|
223
214
|
searchInput: "",
|
|
224
|
-
level:
|
|
225
|
-
ancestorId:
|
|
215
|
+
level: n + 1,
|
|
216
|
+
ancestorId: d,
|
|
226
217
|
onlySelectableOptions: !1
|
|
227
|
-
}).then((
|
|
228
|
-
const Y =
|
|
229
|
-
|
|
230
|
-
type:
|
|
218
|
+
}).then((j) => {
|
|
219
|
+
const Y = j.options.map((M) => (a.children.push(M.value), h(M)));
|
|
220
|
+
l({
|
|
221
|
+
type: o.LOAD_SUCCESS,
|
|
231
222
|
payload: {
|
|
232
|
-
id:
|
|
223
|
+
id: d,
|
|
233
224
|
items: Y,
|
|
234
|
-
marker:
|
|
225
|
+
marker: j.marker
|
|
235
226
|
}
|
|
236
227
|
});
|
|
237
228
|
}).catch(() => {
|
|
238
|
-
|
|
239
|
-
type:
|
|
229
|
+
l({
|
|
230
|
+
type: o.LOAD_ERROR,
|
|
240
231
|
payload: {
|
|
241
|
-
id:
|
|
232
|
+
id: d
|
|
242
233
|
}
|
|
243
234
|
});
|
|
244
235
|
});
|
|
245
|
-
}, [
|
|
246
|
-
|
|
247
|
-
const t =
|
|
248
|
-
level:
|
|
236
|
+
}, [b, h]), B = u((e) => {
|
|
237
|
+
S && (N(!1), y(!0));
|
|
238
|
+
const t = _[e], {
|
|
239
|
+
level: r
|
|
249
240
|
} = t.metadata, {
|
|
250
241
|
id: a,
|
|
251
|
-
marker:
|
|
242
|
+
marker: n
|
|
252
243
|
} = t, {
|
|
253
|
-
signal:
|
|
244
|
+
signal: d
|
|
254
245
|
} = new AbortController();
|
|
255
|
-
|
|
256
|
-
type:
|
|
246
|
+
l({
|
|
247
|
+
type: o.LOAD_DATA,
|
|
257
248
|
payload: {
|
|
258
249
|
id: a
|
|
259
250
|
}
|
|
260
|
-
}),
|
|
261
|
-
signal:
|
|
262
|
-
marker:
|
|
263
|
-
searchInput:
|
|
264
|
-
level:
|
|
251
|
+
}), b({
|
|
252
|
+
signal: d,
|
|
253
|
+
marker: n,
|
|
254
|
+
searchInput: p,
|
|
255
|
+
level: p === "" ? r + 1 : null,
|
|
265
256
|
ancestorId: a !== m.id ? a.toString() : null,
|
|
266
257
|
onlySelectableOptions: !1
|
|
267
|
-
}).then((
|
|
268
|
-
const T =
|
|
269
|
-
|
|
270
|
-
type:
|
|
258
|
+
}).then((R) => {
|
|
259
|
+
const T = R.options.map(h);
|
|
260
|
+
l({
|
|
261
|
+
type: o.LOAD_SUCCESS,
|
|
271
262
|
payload: {
|
|
272
263
|
id: a,
|
|
273
264
|
items: T,
|
|
274
|
-
marker:
|
|
265
|
+
marker: R.marker
|
|
275
266
|
}
|
|
276
|
-
}),
|
|
267
|
+
}), y(!1);
|
|
277
268
|
}).catch(() => {
|
|
278
|
-
|
|
279
|
-
type:
|
|
269
|
+
l({
|
|
270
|
+
type: o.LOAD_ERROR,
|
|
280
271
|
payload: {
|
|
281
272
|
id: a,
|
|
282
|
-
marker:
|
|
273
|
+
marker: n
|
|
283
274
|
}
|
|
284
275
|
});
|
|
285
276
|
});
|
|
286
|
-
}, [
|
|
277
|
+
}, [b, S, h, p, _]), Q = v.nodes.length === 0 || v.nodes[0].children.length === 0 && v.nodes[0].id === m.id, X = u((e) => {
|
|
287
278
|
const {
|
|
288
279
|
metadata: t
|
|
289
280
|
} = e.element;
|
|
290
|
-
te(t) &&
|
|
291
|
-
}, [
|
|
292
|
-
return
|
|
281
|
+
te(t) && g.includes(t.level) ? i(e) : (e.isSelected = !1, e.treeState.selectedIds.delete(e.element.id));
|
|
282
|
+
}, [g, i]);
|
|
283
|
+
return S ? /* @__PURE__ */ f($, {
|
|
293
284
|
onReload: () => {
|
|
294
285
|
B("root");
|
|
295
286
|
}
|
|
296
287
|
}) : /* @__PURE__ */ ne("div", {
|
|
297
|
-
children: [
|
|
288
|
+
children: [I && /* @__PURE__ */ f("div", {
|
|
298
289
|
className: C.noResultOption,
|
|
299
290
|
children: /* @__PURE__ */ f(Z, {
|
|
300
291
|
"aria-label": q,
|
|
301
292
|
className: C.loadingIndicator
|
|
302
293
|
})
|
|
303
|
-
}), Q && !
|
|
294
|
+
}), Q && !I ? /* @__PURE__ */ f("div", {
|
|
304
295
|
className: C.noResultOption,
|
|
305
296
|
children: z
|
|
306
|
-
}) : !
|
|
297
|
+
}) : !I && /* @__PURE__ */ f(F, {
|
|
307
298
|
ref: G,
|
|
308
|
-
"aria-label":
|
|
299
|
+
"aria-label": s,
|
|
309
300
|
data: v.nodes,
|
|
310
|
-
multiSelect:
|
|
301
|
+
multiSelect: W,
|
|
311
302
|
onExpand: K,
|
|
312
303
|
onLoadData: B,
|
|
313
304
|
onNodeSelect: X,
|
|
@@ -318,6 +309,6 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_1wa8l_2", re
|
|
|
318
309
|
});
|
|
319
310
|
});
|
|
320
311
|
export {
|
|
321
|
-
|
|
312
|
+
Ie as D,
|
|
322
313
|
C as s
|
|
323
314
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RootTreeNode as n } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
|
|
2
|
-
let s = /* @__PURE__ */ function(r) {
|
|
2
|
+
let s = /* @__PURE__ */ (function(r) {
|
|
3
3
|
return r.LOAD_DATA = "LOAD_DATA", r.LOAD_ERROR = "LOAD_DATA_ERROR", r.LOAD_SUCCESS = "LOAD_DATA_SUCCESS", r.LOAD_MORE = "LOAD_DATA_SUCCESS", r.RESET = "RESET", r;
|
|
4
|
-
}({});
|
|
4
|
+
})({});
|
|
5
5
|
const R = (r, A) => {
|
|
6
6
|
const {
|
|
7
7
|
id: e,
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as o, useMemo as y, useCallback as Q, useEffect as T } from "react";
|
|
2
2
|
import w from "lodash/debounce";
|
|
3
3
|
import { ComboboxWithApi as D } from "./combobox-with-api.js";
|
|
4
4
|
import { jsx as W } from "react/jsx-runtime";
|
|
5
|
-
const j = "AbortError", _ = (
|
|
5
|
+
const j = "AbortError", _ = (b) => {
|
|
6
6
|
const {
|
|
7
7
|
debounceTime: u = 250,
|
|
8
|
-
defaultOptions:
|
|
9
|
-
fetcher:
|
|
10
|
-
includeTextInputOption:
|
|
11
|
-
onInputValueChange:
|
|
12
|
-
...
|
|
13
|
-
} =
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
|
|
8
|
+
defaultOptions: r,
|
|
9
|
+
fetcher: l,
|
|
10
|
+
includeTextInputOption: f = !1,
|
|
11
|
+
onInputValueChange: O,
|
|
12
|
+
...C
|
|
13
|
+
} = b, [p, m] = o(!1), [I, h] = o(!1), [E, g] = o(!1), [e, x] = o(""), [d, a] = o([]), i = y(() => w(x, u), [u]), A = (n) => {
|
|
14
|
+
i(n), O?.(n);
|
|
15
|
+
}, c = Q(async (n) => {
|
|
16
|
+
const s = n.trim();
|
|
17
|
+
if (s) {
|
|
18
|
+
h(!1), m(!0);
|
|
19
19
|
try {
|
|
20
|
-
const t = await
|
|
21
|
-
if ((t.length > 0 ? typeof t[0] == "string" : !0) &&
|
|
22
|
-
const
|
|
23
|
-
a([
|
|
20
|
+
const t = await l(s);
|
|
21
|
+
if ((t.length > 0 ? typeof t[0] == "string" : !0) && f) {
|
|
22
|
+
const S = s.toLocaleLowerCase();
|
|
23
|
+
a([S, ...t]);
|
|
24
24
|
} else
|
|
25
|
-
|
|
25
|
+
g(t?.length === 0), a(t);
|
|
26
26
|
} catch (t) {
|
|
27
|
-
|
|
27
|
+
t?.name !== j && h(!0);
|
|
28
28
|
} finally {
|
|
29
|
-
|
|
29
|
+
m(!1);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
}, [
|
|
33
|
-
|
|
32
|
+
}, [l, f]), V = () => {
|
|
33
|
+
c(e);
|
|
34
34
|
};
|
|
35
|
-
T(() => (e.trim().length ?
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}, [e,
|
|
35
|
+
T(() => (e.trim().length ? c(e) : (a([]), g(!1)), () => i.cancel()), [i, c, e]);
|
|
36
|
+
const L = y(() => {
|
|
37
|
+
const n = e.trim().length > 0;
|
|
38
|
+
return r?.length > 0 && !n ? r : d;
|
|
39
|
+
}, [e, r, d]);
|
|
40
40
|
return /* @__PURE__ */ W(D, {
|
|
41
|
-
...
|
|
42
|
-
isEmpty:
|
|
43
|
-
isError:
|
|
41
|
+
...C,
|
|
42
|
+
isEmpty: E,
|
|
43
|
+
isError: I,
|
|
44
44
|
isLoading: p,
|
|
45
45
|
loading: p,
|
|
46
|
-
onInputValueChange:
|
|
47
|
-
onTryAgain:
|
|
48
|
-
options:
|
|
46
|
+
onInputValueChange: A,
|
|
47
|
+
onTryAgain: V,
|
|
48
|
+
options: L
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
51
|
export {
|