@box/combobox-with-api 1.4.7 → 1.5.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/chunks/dynamic-loading-tree.js +157 -157
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +33 -33
- package/dist/i18n/en-x-pseudo.js +8 -8
- package/dist/i18n/en-x-pseudo.properties +8 -8
- package/dist/styles/combobox-with-api-pagination.css +1 -1
- package/dist/styles/dynamic-loading-tree.css +1 -1
- package/package.json +5 -5
|
@@ -1,82 +1,82 @@
|
|
|
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
|
|
4
|
-
import { RootTreeNode as
|
|
5
|
-
import { t as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import '../styles/dynamic-loading-tree.css';const se = "
|
|
3
|
+
import { forwardRef as P, useReducer as ee, useState as A, useMemo as ae, useCallback as p, useEffect as M } from "react";
|
|
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 oe, A as r } from "./treeReducer.js";
|
|
6
|
+
import { jsx as f, jsxs as ne } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/dynamic-loading-tree.css';const se = "_container_1wa8l_2", re = "_disabled_1wa8l_13", ie = "_label_1wa8l_16", de = "_hiddenLabel_1wa8l_28", ce = "_comboboxContainer_1wa8l_31", me = "_withComboboxButtons_1wa8l_47", pe = "_error_1wa8l_55", _e = "_textInputWrapper_1wa8l_63", ue = "_textInput_1wa8l_63", be = "_errorIcon_1wa8l_85", ye = "_comboboxButtons_1wa8l_88", he = "_withChips_1wa8l_95", ve = "_inlineError_1wa8l_105", fe = "_popover_1wa8l_109", Ie = "_option_1wa8l_135", we = "_indicator_1wa8l_158", ge = "_indicatorIcon_1wa8l_167", Se = "_optionWithIndicator_1wa8l_170", Ee = "_loadingIndicator_1wa8l_173", Ne = "_noResultOption_1wa8l_176", C = {
|
|
8
8
|
container: se,
|
|
9
9
|
disabled: re,
|
|
10
10
|
label: ie,
|
|
11
11
|
hiddenLabel: de,
|
|
12
12
|
comboboxContainer: ce,
|
|
13
|
-
withComboboxButtons:
|
|
14
|
-
error:
|
|
15
|
-
textInputWrapper:
|
|
16
|
-
textInput:
|
|
13
|
+
withComboboxButtons: me,
|
|
14
|
+
error: pe,
|
|
15
|
+
textInputWrapper: _e,
|
|
16
|
+
textInput: ue,
|
|
17
17
|
errorIcon: be,
|
|
18
|
-
comboboxButtons:
|
|
19
|
-
withChips:
|
|
20
|
-
inlineError:
|
|
21
|
-
popover:
|
|
22
|
-
option:
|
|
23
|
-
indicator:
|
|
24
|
-
indicatorIcon:
|
|
25
|
-
optionWithIndicator:
|
|
26
|
-
loadingIndicator:
|
|
27
|
-
noResultOption:
|
|
28
|
-
},
|
|
29
|
-
const d = [...
|
|
18
|
+
comboboxButtons: ye,
|
|
19
|
+
withChips: he,
|
|
20
|
+
inlineError: ve,
|
|
21
|
+
popover: fe,
|
|
22
|
+
option: Ie,
|
|
23
|
+
indicator: we,
|
|
24
|
+
indicatorIcon: ge,
|
|
25
|
+
optionWithIndicator: Se,
|
|
26
|
+
loadingIndicator: Ee,
|
|
27
|
+
noResultOption: Ne
|
|
28
|
+
}, Oe = (n) => {
|
|
29
|
+
const d = [...n.children], {
|
|
30
30
|
metadata: c
|
|
31
|
-
} =
|
|
31
|
+
} = n;
|
|
32
32
|
return {
|
|
33
|
-
...
|
|
33
|
+
...n,
|
|
34
34
|
children: d,
|
|
35
35
|
metadata: {
|
|
36
|
-
...
|
|
36
|
+
...n.metadata,
|
|
37
37
|
variant: c.variant,
|
|
38
|
-
isLoading:
|
|
38
|
+
isLoading: n.status === "loading" && !n.children.length,
|
|
39
39
|
labelName: c.labelName || "",
|
|
40
40
|
labelValue: c.labelValue || ""
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
},
|
|
43
|
+
}, Re = (n, d) => {
|
|
44
44
|
let c;
|
|
45
|
-
return
|
|
45
|
+
return n.children.length && n.status === "loading" && (c = D(d.id, d.metadata.displayValue, "loading")), n.status === "error" && (c = D(d.id, d.metadata.displayValue, "reload")), n.status === "success" && n.marker && (c = D(d.id, d.metadata.displayValue, "loadMore")), c;
|
|
46
46
|
}, Ve = /* @__PURE__ */ P(({
|
|
47
|
-
ariaLabel:
|
|
47
|
+
ariaLabel: n,
|
|
48
48
|
onSelect: d,
|
|
49
49
|
selectedNodes: c,
|
|
50
|
-
defaultFetcher:
|
|
51
|
-
levels:
|
|
52
|
-
selectableLevels:
|
|
53
|
-
multiselect:
|
|
50
|
+
defaultFetcher: u,
|
|
51
|
+
levels: N,
|
|
52
|
+
selectableLevels: I,
|
|
53
|
+
multiselect: U,
|
|
54
54
|
open: L,
|
|
55
|
-
searchInput:
|
|
56
|
-
noResultMessage:
|
|
55
|
+
searchInput: _,
|
|
56
|
+
noResultMessage: z,
|
|
57
57
|
loadingAriaLabel: q
|
|
58
58
|
}, G) => {
|
|
59
|
-
const [
|
|
59
|
+
const [y, o] = ee(le, oe), [v, H] = A({
|
|
60
60
|
nodes: [],
|
|
61
61
|
selectedIds: []
|
|
62
|
-
}), [
|
|
63
|
-
const
|
|
64
|
-
return [...Object.values(e).map((
|
|
65
|
-
const s =
|
|
66
|
-
return
|
|
67
|
-
}), ...
|
|
68
|
-
}, [
|
|
62
|
+
}), [O, b] = A(!1), [w, g] = A(!1), S = ae(() => Math.max(...I), [I]), V = p((e = y) => {
|
|
63
|
+
const t = [];
|
|
64
|
+
return [...Object.values(e).map((a) => {
|
|
65
|
+
const s = Oe(a), l = Re(a, s);
|
|
66
|
+
return l && (t.push(l), s.children.push(l.id)), s;
|
|
67
|
+
}), ...t];
|
|
68
|
+
}, [y]), k = p((e) => {
|
|
69
69
|
var s;
|
|
70
|
-
const
|
|
71
|
-
return e.level === 1 ||
|
|
70
|
+
const t = (s = e.ancestors) == null ? void 0 : s.find((l) => l.level === e.level - 1), i = N.find((l) => l.level === e.level);
|
|
71
|
+
return e.level === 1 || _ === "" ? e.displayValue : {
|
|
72
72
|
labelName: i.displayName,
|
|
73
|
-
labelValue:
|
|
73
|
+
labelValue: t.displayName
|
|
74
74
|
};
|
|
75
|
-
}, [
|
|
75
|
+
}, [N, _]), h = p((e) => ({
|
|
76
76
|
id: e.value,
|
|
77
77
|
name: e.displayValue,
|
|
78
|
-
parent:
|
|
79
|
-
isBranch: e.level !==
|
|
78
|
+
parent: m.id,
|
|
79
|
+
isBranch: e.level !== S,
|
|
80
80
|
children: [],
|
|
81
81
|
metadata: {
|
|
82
82
|
variant: "content",
|
|
@@ -86,119 +86,119 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_z81ug_1", re
|
|
|
86
86
|
marker: e.marker,
|
|
87
87
|
ancestors: e.ancestors
|
|
88
88
|
}
|
|
89
|
-
}), [
|
|
90
|
-
|
|
89
|
+
}), [S]), R = p((e, t) => {
|
|
90
|
+
o({
|
|
91
91
|
type: r.RESET,
|
|
92
92
|
payload: {
|
|
93
|
-
id:
|
|
93
|
+
id: m.id,
|
|
94
94
|
items: []
|
|
95
95
|
}
|
|
96
|
-
}),
|
|
96
|
+
}), o({
|
|
97
97
|
type: r.LOAD_SUCCESS,
|
|
98
98
|
payload: {
|
|
99
|
-
id:
|
|
99
|
+
id: m.id,
|
|
100
100
|
items: e,
|
|
101
|
-
marker:
|
|
101
|
+
marker: t
|
|
102
102
|
}
|
|
103
103
|
}), b(!1);
|
|
104
|
-
}, [
|
|
105
|
-
|
|
104
|
+
}, [o, b]), x = p(() => {
|
|
105
|
+
o({
|
|
106
106
|
type: r.LOAD_ERROR,
|
|
107
107
|
payload: {
|
|
108
|
-
id:
|
|
108
|
+
id: m.id
|
|
109
109
|
}
|
|
110
|
-
}), b(!1),
|
|
111
|
-
}, [
|
|
112
|
-
const i = new Set(e.map((
|
|
113
|
-
return
|
|
110
|
+
}), b(!1), g(!0);
|
|
111
|
+
}, [o, b, g]), J = p((e, t) => {
|
|
112
|
+
const i = new Set(e.map((a) => a.id));
|
|
113
|
+
return t.filter((a) => i.has(a));
|
|
114
114
|
}, []);
|
|
115
|
-
|
|
116
|
-
const e = V(
|
|
115
|
+
M(() => {
|
|
116
|
+
const e = V(y);
|
|
117
117
|
H({
|
|
118
118
|
nodes: e,
|
|
119
119
|
selectedIds: J(e, c)
|
|
120
120
|
});
|
|
121
|
-
}, [V, c,
|
|
121
|
+
}, [V, c, y, w]), M(() => {
|
|
122
122
|
if (!L)
|
|
123
123
|
return;
|
|
124
124
|
const {
|
|
125
125
|
signal: e
|
|
126
126
|
} = new AbortController();
|
|
127
|
-
b(!0),
|
|
127
|
+
b(!0), g(!1), _ ? (o({
|
|
128
128
|
type: r.RESET,
|
|
129
129
|
payload: {
|
|
130
|
-
id:
|
|
130
|
+
id: m.id,
|
|
131
131
|
items: []
|
|
132
132
|
}
|
|
133
|
-
}),
|
|
133
|
+
}), u({
|
|
134
134
|
signal: e,
|
|
135
135
|
marker: null,
|
|
136
|
-
searchInput:
|
|
136
|
+
searchInput: _,
|
|
137
137
|
level: null,
|
|
138
138
|
onlySelectableOptions: !1,
|
|
139
139
|
ancestorId: null
|
|
140
|
-
}).then((
|
|
141
|
-
const i =
|
|
140
|
+
}).then((t) => {
|
|
141
|
+
const i = t.options.filter((a) => a.selectable).map((a) => {
|
|
142
142
|
const {
|
|
143
143
|
labelName: s,
|
|
144
|
-
labelValue:
|
|
145
|
-
} = k(
|
|
144
|
+
labelValue: l
|
|
145
|
+
} = k(a);
|
|
146
146
|
return {
|
|
147
|
-
id:
|
|
148
|
-
name:
|
|
149
|
-
parent:
|
|
150
|
-
isBranch:
|
|
147
|
+
id: a.value,
|
|
148
|
+
name: a.displayValue,
|
|
149
|
+
parent: m.id,
|
|
150
|
+
isBranch: a.level < S,
|
|
151
151
|
children: [],
|
|
152
152
|
metadata: {
|
|
153
|
-
variant:
|
|
154
|
-
displayValue:
|
|
155
|
-
level:
|
|
156
|
-
selectable:
|
|
157
|
-
ancestors:
|
|
153
|
+
variant: a.level === 1 ? "content" : "labeled",
|
|
154
|
+
displayValue: a.displayValue,
|
|
155
|
+
level: a.level,
|
|
156
|
+
selectable: a.selectable,
|
|
157
|
+
ancestors: a.ancestors,
|
|
158
158
|
labelName: s,
|
|
159
|
-
labelValue:
|
|
159
|
+
labelValue: l
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
});
|
|
163
|
-
|
|
163
|
+
R(i, t.marker);
|
|
164
164
|
}).catch(() => {
|
|
165
|
-
|
|
166
|
-
})) : (
|
|
165
|
+
x();
|
|
166
|
+
})) : (o({
|
|
167
167
|
type: r.RESET,
|
|
168
168
|
payload: {
|
|
169
|
-
id:
|
|
169
|
+
id: m.id,
|
|
170
170
|
items: []
|
|
171
171
|
}
|
|
172
|
-
}),
|
|
172
|
+
}), o({
|
|
173
173
|
type: r.LOAD_DATA,
|
|
174
174
|
payload: {
|
|
175
|
-
id:
|
|
175
|
+
id: m.id
|
|
176
176
|
}
|
|
177
|
-
}),
|
|
177
|
+
}), u({
|
|
178
178
|
signal: e,
|
|
179
179
|
marker: null,
|
|
180
180
|
searchInput: "",
|
|
181
181
|
level: 1,
|
|
182
182
|
onlySelectableOptions: !1,
|
|
183
183
|
ancestorId: null
|
|
184
|
-
}).then((
|
|
185
|
-
const i =
|
|
186
|
-
|
|
184
|
+
}).then((t) => {
|
|
185
|
+
const i = t.options.map(h);
|
|
186
|
+
R(i, t.marker);
|
|
187
187
|
}).catch(() => {
|
|
188
|
-
|
|
188
|
+
x();
|
|
189
189
|
}));
|
|
190
|
-
}, [
|
|
191
|
-
const K =
|
|
190
|
+
}, [u, h, L, _, N, S, k, R, x]);
|
|
191
|
+
const K = p((e) => {
|
|
192
192
|
const {
|
|
193
|
-
isExpanded:
|
|
193
|
+
isExpanded: t,
|
|
194
194
|
isDisabled: i,
|
|
195
|
-
element:
|
|
195
|
+
element: a
|
|
196
196
|
} = e;
|
|
197
|
-
if (!
|
|
198
|
-
|
|
197
|
+
if (!t || i) {
|
|
198
|
+
o({
|
|
199
199
|
type: r.RESET,
|
|
200
200
|
payload: {
|
|
201
|
-
id:
|
|
201
|
+
id: a.id,
|
|
202
202
|
items: []
|
|
203
203
|
}
|
|
204
204
|
});
|
|
@@ -206,112 +206,112 @@ import '../styles/dynamic-loading-tree.css';const se = "_container_z81ug_1", re
|
|
|
206
206
|
}
|
|
207
207
|
const {
|
|
208
208
|
level: s
|
|
209
|
-
} =
|
|
210
|
-
id:
|
|
211
|
-
marker:
|
|
212
|
-
} =
|
|
213
|
-
signal:
|
|
209
|
+
} = a.metadata, {
|
|
210
|
+
id: l,
|
|
211
|
+
marker: E
|
|
212
|
+
} = a, {
|
|
213
|
+
signal: T
|
|
214
214
|
} = new AbortController();
|
|
215
|
-
|
|
215
|
+
o({
|
|
216
216
|
type: r.LOAD_DATA,
|
|
217
217
|
payload: {
|
|
218
|
-
id:
|
|
218
|
+
id: l
|
|
219
219
|
}
|
|
220
|
-
}),
|
|
221
|
-
signal:
|
|
222
|
-
marker:
|
|
220
|
+
}), u({
|
|
221
|
+
signal: T,
|
|
222
|
+
marker: E,
|
|
223
223
|
searchInput: "",
|
|
224
224
|
level: s + 1,
|
|
225
|
-
ancestorId:
|
|
225
|
+
ancestorId: l,
|
|
226
226
|
onlySelectableOptions: !1
|
|
227
|
-
}).then((
|
|
228
|
-
const Y =
|
|
229
|
-
|
|
227
|
+
}).then((W) => {
|
|
228
|
+
const Y = W.options.map((j) => (a.children.push(j.value), h(j)));
|
|
229
|
+
o({
|
|
230
230
|
type: r.LOAD_SUCCESS,
|
|
231
231
|
payload: {
|
|
232
|
-
id:
|
|
232
|
+
id: l,
|
|
233
233
|
items: Y,
|
|
234
|
-
marker:
|
|
234
|
+
marker: W.marker
|
|
235
235
|
}
|
|
236
236
|
});
|
|
237
237
|
}).catch(() => {
|
|
238
|
-
|
|
238
|
+
o({
|
|
239
239
|
type: r.LOAD_ERROR,
|
|
240
240
|
payload: {
|
|
241
|
-
id:
|
|
241
|
+
id: l
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
244
|
});
|
|
245
|
-
}, [
|
|
246
|
-
|
|
247
|
-
const
|
|
245
|
+
}, [u, h]), B = p((e) => {
|
|
246
|
+
w && (g(!1), b(!0));
|
|
247
|
+
const t = y[e], {
|
|
248
248
|
level: i
|
|
249
|
-
} =
|
|
250
|
-
id:
|
|
249
|
+
} = t.metadata, {
|
|
250
|
+
id: a,
|
|
251
251
|
marker: s
|
|
252
|
-
} =
|
|
253
|
-
signal:
|
|
252
|
+
} = t, {
|
|
253
|
+
signal: l
|
|
254
254
|
} = new AbortController();
|
|
255
|
-
|
|
255
|
+
o({
|
|
256
256
|
type: r.LOAD_DATA,
|
|
257
257
|
payload: {
|
|
258
|
-
id:
|
|
258
|
+
id: a
|
|
259
259
|
}
|
|
260
|
-
}),
|
|
261
|
-
signal:
|
|
260
|
+
}), u({
|
|
261
|
+
signal: l,
|
|
262
262
|
marker: s,
|
|
263
|
-
searchInput:
|
|
264
|
-
level:
|
|
265
|
-
ancestorId:
|
|
263
|
+
searchInput: _,
|
|
264
|
+
level: _ === "" ? i + 1 : null,
|
|
265
|
+
ancestorId: a !== m.id ? a.toString() : null,
|
|
266
266
|
onlySelectableOptions: !1
|
|
267
|
-
}).then((
|
|
268
|
-
const
|
|
269
|
-
|
|
267
|
+
}).then((E) => {
|
|
268
|
+
const T = E.options.map(h);
|
|
269
|
+
o({
|
|
270
270
|
type: r.LOAD_SUCCESS,
|
|
271
271
|
payload: {
|
|
272
|
-
id:
|
|
273
|
-
items:
|
|
274
|
-
marker:
|
|
272
|
+
id: a,
|
|
273
|
+
items: T,
|
|
274
|
+
marker: E.marker
|
|
275
275
|
}
|
|
276
276
|
}), b(!1);
|
|
277
277
|
}).catch(() => {
|
|
278
|
-
|
|
278
|
+
o({
|
|
279
279
|
type: r.LOAD_ERROR,
|
|
280
280
|
payload: {
|
|
281
|
-
id:
|
|
281
|
+
id: a,
|
|
282
282
|
marker: s
|
|
283
283
|
}
|
|
284
284
|
});
|
|
285
285
|
});
|
|
286
|
-
}, [
|
|
286
|
+
}, [u, w, h, _, y]), Q = v.nodes.length === 0 || v.nodes[0].children.length === 0 && v.nodes[0].id === m.id, X = p((e) => {
|
|
287
287
|
const {
|
|
288
|
-
metadata:
|
|
288
|
+
metadata: t
|
|
289
289
|
} = e.element;
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
return
|
|
290
|
+
te(t) && I.includes(t.level) ? d(e) : (e.isSelected = !1, e.treeState.selectedIds.delete(e.element.id));
|
|
291
|
+
}, [I, d]);
|
|
292
|
+
return w ? /* @__PURE__ */ f($, {
|
|
293
293
|
onReload: () => {
|
|
294
|
-
|
|
294
|
+
B("root");
|
|
295
295
|
}
|
|
296
|
-
}) : /* @__PURE__ */
|
|
297
|
-
children: [
|
|
296
|
+
}) : /* @__PURE__ */ ne("div", {
|
|
297
|
+
children: [O && /* @__PURE__ */ f("div", {
|
|
298
298
|
className: C.noResultOption,
|
|
299
|
-
children: /* @__PURE__ */
|
|
299
|
+
children: /* @__PURE__ */ f(Z, {
|
|
300
300
|
"aria-label": q,
|
|
301
301
|
className: C.loadingIndicator
|
|
302
302
|
})
|
|
303
|
-
}), Q && !
|
|
303
|
+
}), Q && !O ? /* @__PURE__ */ f("div", {
|
|
304
304
|
className: C.noResultOption,
|
|
305
|
-
children:
|
|
306
|
-
}) : !
|
|
305
|
+
children: z
|
|
306
|
+
}) : !O && /* @__PURE__ */ f(F, {
|
|
307
307
|
ref: G,
|
|
308
|
-
"aria-label":
|
|
309
|
-
data:
|
|
310
|
-
multiSelect:
|
|
308
|
+
"aria-label": n,
|
|
309
|
+
data: v.nodes,
|
|
310
|
+
multiSelect: U,
|
|
311
311
|
onExpand: K,
|
|
312
|
-
onLoadData:
|
|
312
|
+
onLoadData: B,
|
|
313
313
|
onNodeSelect: X,
|
|
314
|
-
selectedIds:
|
|
314
|
+
selectedIds: v.selectedIds,
|
|
315
315
|
size: "large",
|
|
316
316
|
togglableSelect: !0
|
|
317
317
|
})]
|
package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js
CHANGED
|
@@ -3,18 +3,18 @@ import { Combobox as m, useForkRef as ue, LoadingIndicator as de, InlineNotice a
|
|
|
3
3
|
import { Search as fe, Loader as he } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
4
|
import { IconIconOnLightSecondary as ge, Size6 as V, Size1 as be } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
5
|
import N from "clsx";
|
|
6
|
-
import { forwardRef as B, useRef as
|
|
6
|
+
import { forwardRef as B, useRef as L, useState as xe, useCallback as k, useMemo as y, useEffect as Oe } from "react";
|
|
7
7
|
import { useIntl as W, FormattedMessage as F } from "react-intl";
|
|
8
8
|
import a from "./messages.js";
|
|
9
9
|
import { useAsyncList as _e } from "./use-async-list.js";
|
|
10
|
-
import { useControllableState as
|
|
11
|
-
import { useTrackVisibility as
|
|
12
|
-
import { jsx as r, jsxs as P, Fragment as
|
|
13
|
-
import '../../../../styles/combobox-with-api-pagination.css';const
|
|
14
|
-
container:
|
|
15
|
-
disabled:
|
|
16
|
-
highlightOptionText:
|
|
17
|
-
selected:
|
|
10
|
+
import { useControllableState as Re } from "./utils/use-controllable-state.js";
|
|
11
|
+
import { useTrackVisibility as Ae } from "./utils/use-intersection-observer.js";
|
|
12
|
+
import { jsx as r, jsxs as P, Fragment as Ce } from "react/jsx-runtime";
|
|
13
|
+
import '../../../../styles/combobox-with-api-pagination.css';const Le = "_container_19k3s_2", ye = "_disabled_19k3s_8", Ee = "_highlightOptionText_19k3s_12", ve = "_selected_19k3s_24", Ie = "_option_19k3s_35", Me = "_errorComboboxOption_19k3s_39", Te = "_errorComboboxOptionText_19k3s_44", c = {
|
|
14
|
+
container: Le,
|
|
15
|
+
disabled: ye,
|
|
16
|
+
highlightOptionText: Ee,
|
|
17
|
+
selected: ve,
|
|
18
18
|
option: Ie,
|
|
19
19
|
errorComboboxOption: Me,
|
|
20
20
|
errorComboboxOptionText: Te
|
|
@@ -24,7 +24,7 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
24
24
|
const {
|
|
25
25
|
formatMessage: h
|
|
26
26
|
} = W();
|
|
27
|
-
return /* @__PURE__ */ P(
|
|
27
|
+
return /* @__PURE__ */ P(Ce, {
|
|
28
28
|
children: [/* @__PURE__ */ r(pe, {
|
|
29
29
|
variant: "error",
|
|
30
30
|
variantIconAriaLabel: h(a.loadingResultsErrorIconLabel),
|
|
@@ -50,7 +50,7 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
50
50
|
})
|
|
51
51
|
})]
|
|
52
52
|
});
|
|
53
|
-
}),
|
|
53
|
+
}), E = "__LOADING__", v = "__LOADING_ERROR__", Se = "0px 0px 20px 0px", Ve = /* @__PURE__ */ r(fe, {
|
|
54
54
|
color: ge,
|
|
55
55
|
height: V,
|
|
56
56
|
role: "presentation",
|
|
@@ -78,14 +78,14 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
78
78
|
...X
|
|
79
79
|
} = f, {
|
|
80
80
|
formatMessage: d
|
|
81
|
-
} = W(), x =
|
|
81
|
+
} = W(), x = L(null), O = L(!0), [Y, M] = xe(G), o = _e({
|
|
82
82
|
async load({
|
|
83
83
|
marker: e,
|
|
84
84
|
searchInput: t,
|
|
85
|
-
signal:
|
|
85
|
+
signal: C
|
|
86
86
|
}) {
|
|
87
87
|
const u = await z({
|
|
88
|
-
signal:
|
|
88
|
+
signal: C,
|
|
89
89
|
marker: e,
|
|
90
90
|
searchInput: t
|
|
91
91
|
});
|
|
@@ -94,23 +94,23 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
94
94
|
marker: u.marker
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
}), T =
|
|
97
|
+
}), T = L(!1), Z = k(() => {
|
|
98
98
|
T.current || (o.reload(), T.current = !0);
|
|
99
|
-
}, []), [n, _] =
|
|
99
|
+
}, []), [n, _] = Re({
|
|
100
100
|
prop: j,
|
|
101
101
|
defaultProp: H,
|
|
102
102
|
onChange: U
|
|
103
|
-
}),
|
|
103
|
+
}), R = !i && n.length === 1, $ = k((e) => {
|
|
104
104
|
M(e), s == null || s(e);
|
|
105
105
|
}, [s]), ee = (e) => {
|
|
106
106
|
e === void 0 ? (_([]), (!O.current || !b) && (o.search(""), O.current = !0)) : Array.isArray(e) ? _(e) : (_([e]), i || (M(!1), s == null || s(!1)));
|
|
107
|
-
}, oe =
|
|
107
|
+
}, oe = y(() => n.length === 0 ? i ? [] : void 0 : i ? n : n[0], [i, n]), A = y(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), te = (e) => {
|
|
108
108
|
const {
|
|
109
109
|
value: t,
|
|
110
|
-
displayValue:
|
|
110
|
+
displayValue: C,
|
|
111
111
|
...u
|
|
112
112
|
} = e;
|
|
113
|
-
if (t ===
|
|
113
|
+
if (t === E)
|
|
114
114
|
return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
|
|
115
115
|
...u,
|
|
116
116
|
ref: se,
|
|
@@ -123,14 +123,14 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
123
123
|
}
|
|
124
124
|
})
|
|
125
125
|
}) : null;
|
|
126
|
-
if (t ===
|
|
126
|
+
if (t === v && o.hasError && !o.isEmpty)
|
|
127
127
|
return /* @__PURE__ */ r(D, {
|
|
128
128
|
onTryAgain: () => {
|
|
129
129
|
var l;
|
|
130
130
|
o.loadMore(), (l = x.current) == null || l.focus();
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
|
-
if (
|
|
133
|
+
if (A.some((l) => l.value === t))
|
|
134
134
|
return null;
|
|
135
135
|
const le = n.some((l) => l.value === t);
|
|
136
136
|
return /* @__PURE__ */ r(m.Option, {
|
|
@@ -139,11 +139,11 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
139
139
|
value: t,
|
|
140
140
|
children: /* @__PURE__ */ r(ce, {
|
|
141
141
|
className: N(c.highlightOptionText, le && c.selected),
|
|
142
|
-
value:
|
|
142
|
+
value: C || t
|
|
143
143
|
})
|
|
144
144
|
});
|
|
145
145
|
}, re = (e) => {
|
|
146
|
-
if (g == null || g(e),
|
|
146
|
+
if (g == null || g(e), R && e === "") {
|
|
147
147
|
O.current = !1;
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
@@ -159,7 +159,7 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
159
159
|
const [se, {
|
|
160
160
|
rootRef: ae,
|
|
161
161
|
isVisible: S
|
|
162
|
-
}] =
|
|
162
|
+
}] = Ae({
|
|
163
163
|
rootMargin: Se
|
|
164
164
|
});
|
|
165
165
|
Oe(() => {
|
|
@@ -172,27 +172,27 @@ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_contai
|
|
|
172
172
|
clearTimeout(t);
|
|
173
173
|
};
|
|
174
174
|
}, [S]);
|
|
175
|
-
const ie =
|
|
175
|
+
const ie = y(() => {
|
|
176
176
|
const e = o.hasNextPage ? {
|
|
177
|
-
displayValue: L,
|
|
178
|
-
value: L
|
|
179
|
-
} : null, t = !e && o.hasError && !o.isEmpty ? {
|
|
180
177
|
displayValue: E,
|
|
181
178
|
value: E
|
|
179
|
+
} : null, t = !e && o.hasError && !o.isEmpty ? {
|
|
180
|
+
displayValue: v,
|
|
181
|
+
value: v
|
|
182
182
|
} : null;
|
|
183
|
-
return [...o.items, ...
|
|
184
|
-
}, [o.hasNextPage, o.hasError, o.isEmpty, o.items,
|
|
183
|
+
return [...o.items, ...A, e, t].filter(Boolean);
|
|
184
|
+
}, [o.hasNextPage, o.hasError, o.isEmpty, o.items, A]);
|
|
185
185
|
return /* @__PURE__ */ r(m, {
|
|
186
186
|
...X,
|
|
187
187
|
ref: ue(x, h),
|
|
188
188
|
as: "input",
|
|
189
189
|
className: N({
|
|
190
|
-
[c.disabled]:
|
|
190
|
+
[c.disabled]: R
|
|
191
191
|
}, Q),
|
|
192
192
|
clearButtonAriaLabel: d(a.clearButtonAriaLabel),
|
|
193
193
|
clearOnBlur: !1,
|
|
194
194
|
"data-target-id": w,
|
|
195
|
-
disabled: K ||
|
|
195
|
+
disabled: K || R && b,
|
|
196
196
|
displaySingleSelectionAsChip: b,
|
|
197
197
|
displayValue: (e) => e.displayValue || e.value,
|
|
198
198
|
endComboboxIcon: Ve,
|
package/dist/i18n/en-x-pseudo.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
"comboboxWithApi.apiError": "⟦萬萬萬萬萬萬萬萬萬萬萬萬
|
|
3
|
-
"comboboxWithApiPagination.clearButtonAriaLabel": "⟦萬萬萬萬萬萬萬
|
|
4
|
-
"comboboxWithApiPagination.errorAction": "⟦萬
|
|
5
|
-
"comboboxWithApiPagination.errorIconLabel": "⟦萬
|
|
6
|
-
"comboboxWithApiPagination.errorMessage": "⟦萬萬萬萬萬萬
|
|
7
|
-
"comboboxWithApiPagination.loadingAriaLabel": "⟦萬萬
|
|
8
|
-
"comboboxWithApiPagination.loadingMoreAriaLabel": "⟦萬萬萬萬
|
|
9
|
-
"comboboxWithApiPagination.noResults": "⟦萬萬萬萬
|
|
2
|
+
"comboboxWithApi.apiError": "⟦萬萬萬萬萬萬萬萬萬萬萬萬 Čоŭļďл'ţ ļøåď гεşùľŧѕ. Çľîċк ţō ťґγ äĝâій. 國國國國國國國國國國國國⟧",
|
|
3
|
+
"comboboxWithApiPagination.clearButtonAriaLabel": "⟦萬萬萬萬萬萬萬 Ĉĺęăг íŋΡûŧ ąňď şéľęćτїóņ 國國國國國國國⟧",
|
|
4
|
+
"comboboxWithApiPagination.errorAction": "⟦萬 Γęļøάď 國⟧",
|
|
5
|
+
"comboboxWithApiPagination.errorIconLabel": "⟦萬 Ėŗґóř 國⟧",
|
|
6
|
+
"comboboxWithApiPagination.errorMessage": "⟦萬萬萬萬萬萬 ₣åĭľéď ťō ľòáď оΡťīŏńѕ 國國國國國國⟧",
|
|
7
|
+
"comboboxWithApiPagination.loadingAriaLabel": "⟦萬萬 Ľőãďĩήĝ... 國國⟧",
|
|
8
|
+
"comboboxWithApiPagination.loadingMoreAriaLabel": "⟦萬萬萬萬 Ľòąďιŋġ mŏгε... 國國國國⟧",
|
|
9
|
+
"comboboxWithApiPagination.noResults": "⟦萬萬萬萬 Иö ѓěśùļτŝ ƒσμйď 國國國國⟧"
|
|
10
10
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Error message displayed as combobox item when an API failed and the suggestions could not load
|
|
2
|
-
comboboxWithApi.apiError = ⟦萬萬萬萬萬萬萬萬萬萬萬萬
|
|
2
|
+
comboboxWithApi.apiError = ⟦萬萬萬萬萬萬萬萬萬萬萬萬 Čоŭļďл'ţ ļøåď гεşùľŧѕ. Çľîċк ţō ťґγ äĝâій. 國國國國國國國國國國國國⟧
|
|
3
3
|
# Aria label for the clear button visible at the end of the combobox. When clicked, it will clear all text in the input, as well as the current selection.
|
|
4
|
-
comboboxWithApiPagination.clearButtonAriaLabel = ⟦萬萬萬萬萬萬萬
|
|
4
|
+
comboboxWithApiPagination.clearButtonAriaLabel = ⟦萬萬萬萬萬萬萬 Ĉĺęăг íŋΡûŧ ąňď şéľęćτїóņ 國國國國國國國⟧
|
|
5
5
|
# Error message displayed resembling button that calls to action to reload the results
|
|
6
|
-
comboboxWithApiPagination.errorAction = ⟦萬
|
|
6
|
+
comboboxWithApiPagination.errorAction = ⟦萬 Γęļøάď 國⟧
|
|
7
7
|
# Aria-label text for the error icon in the loading results error message
|
|
8
|
-
comboboxWithApiPagination.errorIconLabel = ⟦萬
|
|
8
|
+
comboboxWithApiPagination.errorIconLabel = ⟦萬 Ėŗґóř 國⟧
|
|
9
9
|
# Error message displayed as inline notice that informs the user that the options failed to load
|
|
10
|
-
comboboxWithApiPagination.errorMessage = ⟦萬萬萬萬萬萬
|
|
10
|
+
comboboxWithApiPagination.errorMessage = ⟦萬萬萬萬萬萬 ₣åĭľéď ťō ľòáď оΡťīŏńѕ 國國國國國國⟧
|
|
11
11
|
# Visually hidden aria-label text for the loading spinner
|
|
12
|
-
comboboxWithApiPagination.loadingAriaLabel = ⟦萬萬
|
|
12
|
+
comboboxWithApiPagination.loadingAriaLabel = ⟦萬萬 Ľőãďĩήĝ... 國國⟧
|
|
13
13
|
# Visually hidden aria-label text for the loading spinner show when loading more results from infinite scrolling list
|
|
14
|
-
comboboxWithApiPagination.loadingMoreAriaLabel = ⟦萬萬萬萬
|
|
14
|
+
comboboxWithApiPagination.loadingMoreAriaLabel = ⟦萬萬萬萬 Ľòąďιŋġ mŏгε... 國國國國⟧
|
|
15
15
|
# Message displayed when no results are found in the combobox
|
|
16
|
-
comboboxWithApiPagination.noResults = ⟦萬萬萬萬
|
|
16
|
+
comboboxWithApiPagination.noResults = ⟦萬萬萬萬 Иö ѓěśùļτŝ ƒσμйď 國國國國⟧
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_19k3s_2{display:flex;gap:var(--space-1);justify-content:center}._disabled_19k3s_8._disabled_19k3s_8{opacity:unset}._highlightOptionText_19k3s_12 [data-user-value]{font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);text-decoration:var(--body-default-bold-text-decoration)}._highlightOptionText_19k3s_12 [data-autocomplete-value]{color:var(--text-text-on-light-secondary)}._highlightOptionText_19k3s_12._selected_19k3s_24,._highlightOptionText_19k3s_12._selected_19k3s_24 span{color:var(--text-text-on-light);font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);text-decoration:var(--body-default-bold-text-decoration)}._option_19k3s_35:nth-last-child(1 of._option_19k3s_35){scroll-margin-block-end:var(--space-12)}._errorComboboxOption_19k3s_39[role=option]{display:flex;align-items:center;justify-content:center}._errorComboboxOption_19k3s_39[role=option] ._errorComboboxOptionText_19k3s_44{display:flex;gap:var(--space-1);align-items:center}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_1wa8l_2{font-weight:var(--body-default-font-weight);font-size:var(--body-default-font-size);font-family:var(--body-default-font-family);line-height:var(--body-default-line-height);letter-spacing:var(--body-default-letter-spacing);text-transform:var(--body-default-text-case);text-decoration:var(--body-default-text-decoration);display:flex;flex-direction:column}._container_1wa8l_2._disabled_1wa8l_13{opacity:.1}._container_1wa8l_2 ._label_1wa8l_16{font-weight:var(--body-default-bold-font-weight);font-size:var(--body-default-bold-font-size);font-family:var(--body-default-bold-font-family);line-height:var(--body-default-bold-line-height);letter-spacing:var(--body-default-bold-letter-spacing);text-transform:var(--body-default-bold-text-case);text-decoration:var(--body-default-bold-text-decoration);flex:0 0 fit-content;color:var(--text-text-on-light);overflow-wrap:break-word}._container_1wa8l_2 ._label_1wa8l_16:not(._hiddenLabel_1wa8l_28){margin-block-end:var(--space-2)}._container_1wa8l_2 ._comboboxContainer_1wa8l_31{position:relative;display:flex;flex-wrap:wrap;gap:var(--space-2);overflow-y:auto;background-color:var(--surface-dropdown-surface);border-top:var(--blueprint-combobox-border-top-width, var(--border-1)) solid var(--blueprint-combobox-border-color, var(--border-input-border));border-right:var(--blueprint-combobox-border-right-width, var(--border-1)) solid var(--blueprint-combobox-border-color, var(--border-input-border));border-bottom:var(--blueprint-combobox-border-bottom-width, var(--border-1)) solid var(--blueprint-combobox-border-color, var(--border-input-border));border-left:var(--blueprint-combobox-border-left-width, var(--border-1)) solid var(--blueprint-combobox-border-color, var(--border-input-border));border-radius:var(--blueprint-combobox-input-radius, var(--radius-2));box-shadow:var(--innershadow-1);padding-block:calc((40px - var(--space-5)) / 2 - var(--border-1));padding-inline:var(--space-3)}._container_1wa8l_2 ._comboboxContainer_1wa8l_31._withComboboxButtons_1wa8l_47{padding-inline-end:var(--space-10)}._container_1wa8l_2 ._comboboxContainer_1wa8l_31:not(:disabled):has(input:focus){background-color:var(--surface-dropdown-surface-focus);border:var(--border-2) solid var(--outline-focus-on-light);padding-block:calc((40px - var(--space-5)) / 2 - var(--border-2))}._container_1wa8l_2 ._comboboxContainer_1wa8l_31:not(:disabled)._error_1wa8l_55,._container_1wa8l_2 ._comboboxContainer_1wa8l_31:not(:disabled):has([aria-invalid=true]){background-color:var(--surface-dropdown-surface-error);border-top:var(--blueprint-combobox-border-error-top-width, var(--border-2)) solid var(--border-input-border-error);border-right:var(--blueprint-combobox-border-error-right-width, var(--border-2)) solid var(--border-input-border-error);border-bottom:var(--blueprint-combobox-border-error-bottom-width, var(--border-2)) solid var(--border-input-border-error);border-left:var(--blueprint-combobox-border-error-left-width, var(--border-2)) solid var(--border-input-border-error);padding-block:calc((40px - var(--space-5)) / 2 - var(--border-2))}._container_1wa8l_2 ._comboboxContainer_1wa8l_31 ._textInputWrapper_1wa8l_63{display:flex;flex:content;gap:var(--space-2);align-items:center}._container_1wa8l_2 ._comboboxContainer_1wa8l_31 ._textInputWrapper_1wa8l_63 ._textInput_1wa8l_63{font-weight:var(--body-default-font-weight);font-size:var(--body-default-font-size);font-family:var(--body-default-font-family);line-height:var(--body-default-line-height);letter-spacing:var(--body-default-letter-spacing);text-transform:var(--body-default-text-case);text-decoration:var(--body-default-text-decoration);width:100%;height:var(--space-5);padding:0;color:var(--text-text-on-light);background-color:transparent;border:none;outline:none}._container_1wa8l_2 ._comboboxContainer_1wa8l_31 ._textInputWrapper_1wa8l_63 ._errorIcon_1wa8l_85 path{fill:var(--icon-icon-error-on-light)}._container_1wa8l_2 ._comboboxContainer_1wa8l_31 ._textInputWrapper_1wa8l_63 ._comboboxButtons_1wa8l_88{position:absolute;top:var(--space-2);right:var(--space-2);display:flex;align-items:center}._container_1wa8l_2 ._comboboxContainer_1wa8l_31._withChips_1wa8l_95{max-height:calc(2 * var(--space-2) + 3 * var(--space-6));padding-block:calc((40px - var(--space-7)) / 2 - var(--border-1))}._container_1wa8l_2 ._comboboxContainer_1wa8l_31._withChips_1wa8l_95:not(:disabled)._error_1wa8l_55{padding-block:calc((40px - var(--space-7)) / 2 - var(--border-2))}._container_1wa8l_2 ._comboboxContainer_1wa8l_31._withChips_1wa8l_95:not(:disabled):has(input:focus){padding-block:calc((40px - var(--space-7)) / 2 - var(--border-2))}._container_1wa8l_2 ._inlineError_1wa8l_105{margin-block-start:var(--space-2)}._popover_1wa8l_109{font-weight:var(--body-default-font-weight);font-size:var(--body-default-font-size);font-family:var(--body-default-font-family);line-height:var(--body-default-line-height);letter-spacing:var(--body-default-letter-spacing);text-transform:var(--body-default-text-case);text-decoration:var(--body-default-text-decoration);z-index:380;max-height:300px;overflow:auto;background-color:var(--surface-menu-surface);border:var(--border-1) solid var(--border-card-border);border-radius:var(--radius-3);padding-block:var(--space-3);padding-inline:var(--space-3);box-shadow:var(--dropshadow-3)}._popover_1wa8l_109 ul{padding-inline-start:0}._popover_1wa8l_109 ._option_1wa8l_135{position:relative;box-sizing:border-box;width:100%;overflow-wrap:break-word;border:var(--border-2) solid transparent;border-radius:var(--radius-3);outline:none;cursor:pointer;-webkit-user-select:none;user-select:none;padding-block:var(--space-2);padding-inline:var(--space-2)}._popover_1wa8l_109 ._option_1wa8l_135[aria-disabled]{opacity:.1}._popover_1wa8l_109 ._option_1wa8l_135[data-active-item]:not([aria-disabled]){background-color:var(--surface-menu-surface-focus);border:var(--border-2) solid var(--outline-focus-on-light)}._popover_1wa8l_109 ._option_1wa8l_135:hover{background-color:var(--surface-menu-surface-hover)}._popover_1wa8l_109 ._option_1wa8l_135 ._indicator_1wa8l_158{position:absolute;top:0;left:var(--space-2);display:flex;align-items:center;justify-content:center;height:var(--size-9)}._popover_1wa8l_109 ._option_1wa8l_135 ._indicator_1wa8l_158 ._indicatorIcon_1wa8l_167 path{fill:var(--icon-icon-on-light)}._popover_1wa8l_109 ._optionWithIndicator_1wa8l_170{padding-inline:var(--space-10) var(--space-2)}._popover_1wa8l_109 ._loadingIndicator_1wa8l_173{position:unset}._popover_1wa8l_109 ._noResultOption_1wa8l_176{color:var(--text-text-on-light);text-align:center;-webkit-user-select:none;user-select:none}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/combobox-with-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@ariakit/react": "0.4.15",
|
|
6
6
|
"@box/blueprint-web": "^10.3.1",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"react-intl": "^6.4.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@box/tree": "^1.
|
|
14
|
+
"@box/tree": "^1.4.1",
|
|
15
15
|
"react-accessible-treeview": "2.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@box/blueprint-web": "^12.92.
|
|
19
|
-
"@box/blueprint-web-assets": "^4.76.
|
|
20
|
-
"@box/storybook-utils": "^0.14.
|
|
18
|
+
"@box/blueprint-web": "^12.92.1",
|
|
19
|
+
"@box/blueprint-web-assets": "^4.76.2",
|
|
20
|
+
"@box/storybook-utils": "^0.14.13",
|
|
21
21
|
"react": "^18.3.0",
|
|
22
22
|
"react-dom": "^18.3.0"
|
|
23
23
|
},
|