@box/combobox-with-api 1.29.0 → 1.30.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 +155 -154
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +104 -104
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +79 -74
- package/dist/styles/dynamic-loading-tree.css +1 -1
- package/package.json +7 -7
|
@@ -1,73 +1,74 @@
|
|
|
1
1
|
import { LoadingIndicator as $ } from "@box/blueprint-web";
|
|
2
2
|
import { InlineError as P, Tree as ee } from "@box/tree";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { RootTreeNode as m, hasValidLevel as le, getServiceNode as
|
|
5
|
-
import { t as
|
|
6
|
-
import { jsx as f, jsxs as
|
|
7
|
-
import '../styles/dynamic-loading-tree.css';const
|
|
8
|
-
container:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
import { forwardRef as te, useReducer as ae, useState as D, useMemo as z, useCallback as u, useEffect as F } from "react";
|
|
4
|
+
import { RootTreeNode as m, hasValidLevel as le, getServiceNode as L } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
|
|
5
|
+
import { t as ne, i as se, A as d } from "./treeReducer.js";
|
|
6
|
+
import { jsx as f, jsxs as oe } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/dynamic-loading-tree.css';const de = "_container_15bxn_2", re = "_disabled_15bxn_13", ie = "_label_15bxn_16", ce = "_hiddenLabel_15bxn_28", me = "_comboboxContainer_15bxn_31", ue = "_withComboboxButtons_15bxn_47", pe = "_textInputWrapper_15bxn_63", be = "_textInput_15bxn_63", _e = "_comboboxButtons_15bxn_88", ye = "_withChips_15bxn_95", he = "_popover_15bxn_109", ve = "_loadingIndicator_15bxn_173", fe = "_noResultOption_15bxn_176", V = {
|
|
8
|
+
container: de,
|
|
9
|
+
disabled: re,
|
|
10
|
+
label: ie,
|
|
11
|
+
hiddenLabel: ce,
|
|
12
|
+
comboboxContainer: me,
|
|
13
|
+
withComboboxButtons: ue,
|
|
14
|
+
textInputWrapper: pe,
|
|
15
|
+
textInput: be,
|
|
16
|
+
comboboxButtons: _e,
|
|
16
17
|
withChips: ye,
|
|
17
18
|
popover: he,
|
|
18
|
-
loadingIndicator:
|
|
19
|
-
noResultOption:
|
|
20
|
-
},
|
|
21
|
-
const i = [...
|
|
19
|
+
loadingIndicator: ve,
|
|
20
|
+
noResultOption: fe
|
|
21
|
+
}, xe = (o) => {
|
|
22
|
+
const i = [...o.children], {
|
|
22
23
|
metadata: c
|
|
23
|
-
} =
|
|
24
|
+
} = o;
|
|
24
25
|
return {
|
|
25
|
-
...
|
|
26
|
+
...o,
|
|
26
27
|
children: i,
|
|
27
28
|
metadata: {
|
|
28
|
-
...
|
|
29
|
+
...o.metadata,
|
|
29
30
|
variant: c.variant,
|
|
30
|
-
isLoading:
|
|
31
|
+
isLoading: o.status === "loading" && !o.children.length,
|
|
31
32
|
labelName: c.labelName || "",
|
|
32
33
|
labelValue: c.labelValue || ""
|
|
33
34
|
}
|
|
34
35
|
};
|
|
35
|
-
}, ge = (
|
|
36
|
+
}, ge = (o, i) => {
|
|
36
37
|
let c;
|
|
37
|
-
return
|
|
38
|
-
},
|
|
39
|
-
ariaLabel:
|
|
38
|
+
return o.children.length && o.status === "loading" && (c = L(i.id, i.metadata.displayValue, "loading")), o.status === "error" && (c = L(i.id, i.metadata.displayValue, "reload")), o.status === "success" && o.marker && (c = L(i.id, i.metadata.displayValue, "loadMore")), c;
|
|
39
|
+
}, Te = /* @__PURE__ */ te(({
|
|
40
|
+
ariaLabel: o,
|
|
40
41
|
onSelect: i,
|
|
41
42
|
selectedNodes: c,
|
|
42
43
|
defaultFetcher: b,
|
|
43
|
-
levels:
|
|
44
|
-
selectableLevels:
|
|
45
|
-
multiselect:
|
|
46
|
-
open:
|
|
44
|
+
levels: R,
|
|
45
|
+
selectableLevels: x,
|
|
46
|
+
multiselect: O,
|
|
47
|
+
open: k,
|
|
47
48
|
searchInput: p,
|
|
48
49
|
noResultMessage: q,
|
|
49
50
|
loadingAriaLabel: G
|
|
50
51
|
}, H) => {
|
|
51
|
-
const [
|
|
52
|
+
const [h, n] = ae(ne, se), [_, J] = D({
|
|
52
53
|
nodes: [],
|
|
53
54
|
selectedIds: []
|
|
54
|
-
}), [E,
|
|
55
|
-
const
|
|
56
|
-
return [...Object.values(e).map((
|
|
57
|
-
const l =
|
|
58
|
-
return
|
|
59
|
-
}), ...
|
|
60
|
-
}, [
|
|
61
|
-
const
|
|
55
|
+
}), [E, y] = D(!1), [g, S] = D(!1), I = z(() => Math.max(...x), [x]), w = u((e = h) => {
|
|
56
|
+
const a = [];
|
|
57
|
+
return [...Object.values(e).map((t) => {
|
|
58
|
+
const l = xe(t), r = ge(t, l);
|
|
59
|
+
return r && (a.push(r), l.children.push(r.id)), l;
|
|
60
|
+
}), ...a];
|
|
61
|
+
}, [h]), B = u((e) => {
|
|
62
|
+
const a = e.ancestors?.find((l) => l.level === e.level - 1), s = R.find((l) => l.level === e.level);
|
|
62
63
|
return e.level === 1 || p === "" ? e.displayValue : {
|
|
63
|
-
labelName:
|
|
64
|
-
labelValue:
|
|
64
|
+
labelName: s.displayName,
|
|
65
|
+
labelValue: a.displayName
|
|
65
66
|
};
|
|
66
|
-
}, [
|
|
67
|
+
}, [R, p]), v = u((e) => ({
|
|
67
68
|
id: e.value,
|
|
68
69
|
name: e.displayValue,
|
|
69
70
|
parent: m.id,
|
|
70
|
-
isBranch: e.level !==
|
|
71
|
+
isBranch: e.level !== I,
|
|
71
72
|
children: [],
|
|
72
73
|
metadata: {
|
|
73
74
|
variant: "content",
|
|
@@ -77,46 +78,46 @@ import '../styles/dynamic-loading-tree.css';const re = "_container_1wa8l_2", de
|
|
|
77
78
|
marker: e.marker,
|
|
78
79
|
ancestors: e.ancestors
|
|
79
80
|
}
|
|
80
|
-
}), [
|
|
81
|
-
|
|
82
|
-
type:
|
|
81
|
+
}), [I]), T = u((e, a) => {
|
|
82
|
+
n({
|
|
83
|
+
type: d.RESET,
|
|
83
84
|
payload: {
|
|
84
85
|
id: m.id,
|
|
85
86
|
items: []
|
|
86
87
|
}
|
|
87
|
-
}),
|
|
88
|
-
type:
|
|
88
|
+
}), n({
|
|
89
|
+
type: d.LOAD_SUCCESS,
|
|
89
90
|
payload: {
|
|
90
91
|
id: m.id,
|
|
91
92
|
items: e,
|
|
92
|
-
marker:
|
|
93
|
+
marker: a
|
|
93
94
|
}
|
|
94
|
-
}),
|
|
95
|
-
}, [
|
|
96
|
-
|
|
97
|
-
type:
|
|
95
|
+
}), y(!1);
|
|
96
|
+
}, [n, y]), C = u(() => {
|
|
97
|
+
n({
|
|
98
|
+
type: d.LOAD_ERROR,
|
|
98
99
|
payload: {
|
|
99
100
|
id: m.id
|
|
100
101
|
}
|
|
101
|
-
}),
|
|
102
|
-
}, [
|
|
103
|
-
const
|
|
104
|
-
return
|
|
102
|
+
}), y(!1), S(!0);
|
|
103
|
+
}, [n, y, S]), j = u((e, a) => {
|
|
104
|
+
const s = new Set(e.map((t) => t.id));
|
|
105
|
+
return a.filter((t) => t != null && s.has(t));
|
|
105
106
|
}, []);
|
|
106
107
|
F(() => {
|
|
107
|
-
const e =
|
|
108
|
+
const e = w(h);
|
|
108
109
|
J({
|
|
109
110
|
nodes: e,
|
|
110
111
|
selectedIds: j(e, c)
|
|
111
112
|
});
|
|
112
|
-
}, [j,
|
|
113
|
-
if (!
|
|
113
|
+
}, [j, w, c, h, g]), F(() => {
|
|
114
|
+
if (!k)
|
|
114
115
|
return;
|
|
115
116
|
const {
|
|
116
117
|
signal: e
|
|
117
118
|
} = new AbortController();
|
|
118
|
-
|
|
119
|
-
type:
|
|
119
|
+
y(!0), S(!1), p ? (n({
|
|
120
|
+
type: d.RESET,
|
|
120
121
|
payload: {
|
|
121
122
|
id: m.id,
|
|
122
123
|
items: []
|
|
@@ -128,40 +129,40 @@ import '../styles/dynamic-loading-tree.css';const re = "_container_1wa8l_2", de
|
|
|
128
129
|
level: null,
|
|
129
130
|
onlySelectableOptions: !1,
|
|
130
131
|
ancestorId: null
|
|
131
|
-
}).then((
|
|
132
|
-
const
|
|
132
|
+
}).then((a) => {
|
|
133
|
+
const s = a.options.filter((t) => t.selectable).map((t) => {
|
|
133
134
|
const {
|
|
134
135
|
labelName: l,
|
|
135
|
-
labelValue:
|
|
136
|
-
} = B(
|
|
136
|
+
labelValue: r
|
|
137
|
+
} = B(t);
|
|
137
138
|
return {
|
|
138
|
-
id:
|
|
139
|
-
name:
|
|
139
|
+
id: t.value,
|
|
140
|
+
name: t.displayValue,
|
|
140
141
|
parent: m.id,
|
|
141
|
-
isBranch:
|
|
142
|
+
isBranch: t.level < I,
|
|
142
143
|
children: [],
|
|
143
144
|
metadata: {
|
|
144
|
-
variant:
|
|
145
|
-
displayValue:
|
|
146
|
-
level:
|
|
147
|
-
selectable:
|
|
148
|
-
ancestors:
|
|
145
|
+
variant: t.level === 1 ? "content" : "labeled",
|
|
146
|
+
displayValue: t.displayValue,
|
|
147
|
+
level: t.level,
|
|
148
|
+
selectable: t.selectable,
|
|
149
|
+
ancestors: t.ancestors,
|
|
149
150
|
labelName: l,
|
|
150
|
-
labelValue:
|
|
151
|
+
labelValue: r
|
|
151
152
|
}
|
|
152
153
|
};
|
|
153
154
|
});
|
|
154
|
-
T(
|
|
155
|
+
T(s, a.marker);
|
|
155
156
|
}).catch(() => {
|
|
156
|
-
|
|
157
|
-
})) : (
|
|
158
|
-
type:
|
|
157
|
+
C();
|
|
158
|
+
})) : (n({
|
|
159
|
+
type: d.RESET,
|
|
159
160
|
payload: {
|
|
160
161
|
id: m.id,
|
|
161
162
|
items: []
|
|
162
163
|
}
|
|
163
|
-
}),
|
|
164
|
-
type:
|
|
164
|
+
}), n({
|
|
165
|
+
type: d.LOAD_DATA,
|
|
165
166
|
payload: {
|
|
166
167
|
id: m.id
|
|
167
168
|
}
|
|
@@ -172,24 +173,24 @@ import '../styles/dynamic-loading-tree.css';const re = "_container_1wa8l_2", de
|
|
|
172
173
|
level: 1,
|
|
173
174
|
onlySelectableOptions: !1,
|
|
174
175
|
ancestorId: null
|
|
175
|
-
}).then((
|
|
176
|
-
const
|
|
177
|
-
T(
|
|
176
|
+
}).then((a) => {
|
|
177
|
+
const s = a.options.map(v);
|
|
178
|
+
T(s, a.marker);
|
|
178
179
|
}).catch(() => {
|
|
179
|
-
|
|
180
|
+
C();
|
|
180
181
|
}));
|
|
181
|
-
}, [b, v,
|
|
182
|
+
}, [b, v, k, p, R, I, B, T, C]);
|
|
182
183
|
const K = u((e) => {
|
|
183
184
|
const {
|
|
184
|
-
isExpanded:
|
|
185
|
-
isDisabled:
|
|
186
|
-
element:
|
|
185
|
+
isExpanded: a,
|
|
186
|
+
isDisabled: s,
|
|
187
|
+
element: t
|
|
187
188
|
} = e;
|
|
188
|
-
if (!
|
|
189
|
-
|
|
190
|
-
type:
|
|
189
|
+
if (!a || s) {
|
|
190
|
+
n({
|
|
191
|
+
type: d.RESET,
|
|
191
192
|
payload: {
|
|
192
|
-
id:
|
|
193
|
+
id: t.id,
|
|
193
194
|
items: []
|
|
194
195
|
}
|
|
195
196
|
});
|
|
@@ -197,130 +198,130 @@ import '../styles/dynamic-loading-tree.css';const re = "_container_1wa8l_2", de
|
|
|
197
198
|
}
|
|
198
199
|
const {
|
|
199
200
|
level: l
|
|
200
|
-
} =
|
|
201
|
-
id:
|
|
202
|
-
marker:
|
|
203
|
-
} =
|
|
204
|
-
signal:
|
|
201
|
+
} = t.metadata, {
|
|
202
|
+
id: r,
|
|
203
|
+
marker: N
|
|
204
|
+
} = t, {
|
|
205
|
+
signal: A
|
|
205
206
|
} = new AbortController();
|
|
206
|
-
|
|
207
|
-
type:
|
|
207
|
+
n({
|
|
208
|
+
type: d.LOAD_DATA,
|
|
208
209
|
payload: {
|
|
209
|
-
id:
|
|
210
|
+
id: r
|
|
210
211
|
}
|
|
211
212
|
}), b({
|
|
212
|
-
signal:
|
|
213
|
-
marker:
|
|
213
|
+
signal: A,
|
|
214
|
+
marker: N,
|
|
214
215
|
searchInput: "",
|
|
215
216
|
level: l + 1,
|
|
216
|
-
ancestorId:
|
|
217
|
+
ancestorId: r,
|
|
217
218
|
onlySelectableOptions: !1
|
|
218
219
|
}).then((U) => {
|
|
219
|
-
const Z = U.options.map((W) => (
|
|
220
|
-
|
|
221
|
-
type:
|
|
220
|
+
const Z = U.options.map((W) => (t.children.push(W.value), v(W)));
|
|
221
|
+
n({
|
|
222
|
+
type: d.LOAD_SUCCESS,
|
|
222
223
|
payload: {
|
|
223
|
-
id:
|
|
224
|
+
id: r,
|
|
224
225
|
items: Z,
|
|
225
226
|
marker: U.marker
|
|
226
227
|
}
|
|
227
228
|
});
|
|
228
229
|
}).catch(() => {
|
|
229
|
-
|
|
230
|
-
type:
|
|
230
|
+
n({
|
|
231
|
+
type: d.LOAD_ERROR,
|
|
231
232
|
payload: {
|
|
232
|
-
id:
|
|
233
|
+
id: r
|
|
233
234
|
}
|
|
234
235
|
});
|
|
235
236
|
});
|
|
236
237
|
}, [b, v]), M = u((e) => {
|
|
237
|
-
|
|
238
|
-
const
|
|
239
|
-
level:
|
|
240
|
-
} =
|
|
241
|
-
id:
|
|
238
|
+
g && (S(!1), y(!0));
|
|
239
|
+
const a = h[e], {
|
|
240
|
+
level: s
|
|
241
|
+
} = a.metadata, {
|
|
242
|
+
id: t,
|
|
242
243
|
marker: l
|
|
243
|
-
} =
|
|
244
|
-
signal:
|
|
244
|
+
} = a, {
|
|
245
|
+
signal: r
|
|
245
246
|
} = new AbortController();
|
|
246
|
-
|
|
247
|
-
type:
|
|
247
|
+
n({
|
|
248
|
+
type: d.LOAD_DATA,
|
|
248
249
|
payload: {
|
|
249
|
-
id:
|
|
250
|
+
id: t
|
|
250
251
|
}
|
|
251
252
|
}), b({
|
|
252
|
-
signal:
|
|
253
|
+
signal: r,
|
|
253
254
|
marker: l,
|
|
254
255
|
searchInput: p,
|
|
255
|
-
level: p === "" ?
|
|
256
|
-
ancestorId:
|
|
256
|
+
level: p === "" ? s + 1 : null,
|
|
257
|
+
ancestorId: t !== m.id ? t.toString() : null,
|
|
257
258
|
onlySelectableOptions: !1
|
|
258
|
-
}).then((
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
type:
|
|
259
|
+
}).then((N) => {
|
|
260
|
+
const A = N.options.map(v);
|
|
261
|
+
n({
|
|
262
|
+
type: d.LOAD_SUCCESS,
|
|
262
263
|
payload: {
|
|
263
|
-
id:
|
|
264
|
-
items:
|
|
265
|
-
marker:
|
|
264
|
+
id: t,
|
|
265
|
+
items: A,
|
|
266
|
+
marker: N.marker
|
|
266
267
|
}
|
|
267
|
-
}),
|
|
268
|
+
}), y(!1);
|
|
268
269
|
}).catch(() => {
|
|
269
|
-
|
|
270
|
-
type:
|
|
270
|
+
n({
|
|
271
|
+
type: d.LOAD_ERROR,
|
|
271
272
|
payload: {
|
|
272
|
-
id:
|
|
273
|
+
id: t,
|
|
273
274
|
marker: l
|
|
274
275
|
}
|
|
275
276
|
});
|
|
276
277
|
});
|
|
277
|
-
}, [b,
|
|
278
|
+
}, [b, g, v, p, h]), {
|
|
278
279
|
isTreeEmpty: Q,
|
|
279
280
|
focusedId: X
|
|
280
281
|
} = z(() => {
|
|
281
|
-
const
|
|
282
|
+
const a = _.nodes.find(({
|
|
282
283
|
id: l
|
|
283
|
-
}) => l === m.id)?.children ?? [],
|
|
284
|
+
}) => l === m.id)?.children ?? [], s = a[0], t = !O && _.selectedIds.length === 0 && s != null;
|
|
284
285
|
return {
|
|
285
|
-
isTreeEmpty:
|
|
286
|
-
focusedId:
|
|
286
|
+
isTreeEmpty: _.nodes.length === 0 || a.length === 0,
|
|
287
|
+
focusedId: t ? s : void 0
|
|
287
288
|
};
|
|
288
|
-
}, [
|
|
289
|
+
}, [O, _.nodes, _.selectedIds.length]), Y = u((e) => {
|
|
289
290
|
const {
|
|
290
|
-
metadata:
|
|
291
|
+
metadata: a
|
|
291
292
|
} = e.element;
|
|
292
|
-
le(
|
|
293
|
-
}, [
|
|
294
|
-
return
|
|
293
|
+
le(a) && x.includes(a.level) ? i(e) : (e.isSelected = !1, e.treeState.selectedIds.delete(e.element.id));
|
|
294
|
+
}, [x, i]);
|
|
295
|
+
return g ? /* @__PURE__ */ f(P, {
|
|
295
296
|
onReload: () => {
|
|
296
297
|
M("root");
|
|
297
298
|
}
|
|
298
|
-
}) : /* @__PURE__ */
|
|
299
|
+
}) : /* @__PURE__ */ oe("div", {
|
|
299
300
|
children: [E && /* @__PURE__ */ f("div", {
|
|
300
|
-
className:
|
|
301
|
+
className: V.noResultOption,
|
|
301
302
|
children: /* @__PURE__ */ f($, {
|
|
302
303
|
"aria-label": G,
|
|
303
|
-
className:
|
|
304
|
+
className: V.loadingIndicator
|
|
304
305
|
})
|
|
305
306
|
}), Q && !E ? /* @__PURE__ */ f("div", {
|
|
306
|
-
className:
|
|
307
|
+
className: V.noResultOption,
|
|
307
308
|
children: q
|
|
308
309
|
}) : !E && /* @__PURE__ */ f(ee, {
|
|
309
310
|
ref: H,
|
|
310
|
-
"aria-label":
|
|
311
|
-
data:
|
|
311
|
+
"aria-label": o,
|
|
312
|
+
data: _.nodes,
|
|
312
313
|
focusedId: X,
|
|
313
|
-
multiSelect:
|
|
314
|
+
multiSelect: O,
|
|
314
315
|
onExpand: K,
|
|
315
316
|
onLoadData: M,
|
|
316
317
|
onNodeSelect: Y,
|
|
317
|
-
selectedIds:
|
|
318
|
+
selectedIds: _.selectedIds,
|
|
318
319
|
size: "large",
|
|
319
320
|
togglableSelect: !0
|
|
320
321
|
})]
|
|
321
322
|
});
|
|
322
323
|
});
|
|
323
324
|
export {
|
|
324
|
-
|
|
325
|
-
|
|
325
|
+
Te as D,
|
|
326
|
+
V as s
|
|
326
327
|
};
|
package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { ComboboxItemValue as
|
|
2
|
-
import { Combobox as d, useForkRef as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { Size6 as V, Size1 as
|
|
5
|
-
import
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { useIntl as
|
|
1
|
+
import { ComboboxItemValue as ue } from "@ariakit/react";
|
|
2
|
+
import { Combobox as d, useForkRef as de, LoadingIndicator as pe, InlineNotice as me, Text as he } from "@box/blueprint-web";
|
|
3
|
+
import { Search as fe, Loader as ge } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
+
import { Size6 as V, Size1 as be, IconIconOnLightSecondary as Oe } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import N from "clsx";
|
|
6
|
+
import { forwardRef as B, useRef as L, useState as xe, useCallback as k, useMemo as y, useEffect as _e } from "react";
|
|
7
|
+
import { useIntl as W, FormattedMessage as F } from "react-intl";
|
|
8
8
|
import a from "./messages.js";
|
|
9
|
-
import { useAsyncList as
|
|
10
|
-
import { useControllableState as
|
|
11
|
-
import { useTrackVisibility as
|
|
12
|
-
import { jsx as r, jsxs as
|
|
13
|
-
import '../../../../styles/combobox-with-api-pagination.css';const
|
|
14
|
-
disabled:
|
|
15
|
-
highlightOptionText:
|
|
16
|
-
selected:
|
|
17
|
-
option:
|
|
18
|
-
errorComboboxOption:
|
|
19
|
-
errorComboboxOptionText:
|
|
20
|
-
},
|
|
21
|
-
onTryAgain:
|
|
9
|
+
import { useAsyncList as Ce } from "./use-async-list.js";
|
|
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 Le } from "react/jsx-runtime";
|
|
13
|
+
import '../../../../styles/combobox-with-api-pagination.css';const ye = "_disabled_19k3s_8", Ee = "_highlightOptionText_19k3s_12", Ie = "_selected_19k3s_24", ve = "_option_19k3s_35", Me = "_errorComboboxOption_19k3s_39", Se = "_errorComboboxOptionText_19k3s_44", i = {
|
|
14
|
+
disabled: ye,
|
|
15
|
+
highlightOptionText: Ee,
|
|
16
|
+
selected: Ie,
|
|
17
|
+
option: ve,
|
|
18
|
+
errorComboboxOption: Me,
|
|
19
|
+
errorComboboxOptionText: Se
|
|
20
|
+
}, D = /* @__PURE__ */ B(({
|
|
21
|
+
onTryAgain: v
|
|
22
22
|
}, p) => {
|
|
23
23
|
const {
|
|
24
24
|
formatMessage: m
|
|
25
|
-
} =
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
children: [/* @__PURE__ */ r(
|
|
25
|
+
} = W();
|
|
26
|
+
return /* @__PURE__ */ P(Le, {
|
|
27
|
+
children: [/* @__PURE__ */ r(me, {
|
|
28
28
|
variant: "error",
|
|
29
29
|
variantIconAriaLabel: m(a.loadingResultsErrorIconLabel),
|
|
30
|
-
children: /* @__PURE__ */ r(
|
|
30
|
+
children: /* @__PURE__ */ r(F, {
|
|
31
31
|
...a.loadingResultsErrorMessage
|
|
32
32
|
})
|
|
33
33
|
}), /* @__PURE__ */ r(d.Option, {
|
|
34
34
|
ref: p,
|
|
35
35
|
className: i.errorComboboxOption,
|
|
36
|
-
onClick:
|
|
37
|
-
children: /* @__PURE__ */
|
|
36
|
+
onClick: v,
|
|
37
|
+
children: /* @__PURE__ */ P(he, {
|
|
38
38
|
as: "span",
|
|
39
39
|
className: i.errorComboboxOptionText,
|
|
40
40
|
color: "textOnLightLink",
|
|
41
41
|
variant: "bodyDefaultBold",
|
|
42
|
-
children: [/* @__PURE__ */ r(
|
|
42
|
+
children: [/* @__PURE__ */ r(F, {
|
|
43
43
|
...a.loadingResultsErrorAction
|
|
44
|
-
}), /* @__PURE__ */ r(
|
|
44
|
+
}), /* @__PURE__ */ r(ge, {
|
|
45
45
|
color: "currentColor",
|
|
46
46
|
height: "12px",
|
|
47
47
|
width: "12px"
|
|
@@ -49,42 +49,42 @@ import '../../../../styles/combobox-with-api-pagination.css';const Le = "_disabl
|
|
|
49
49
|
})
|
|
50
50
|
})]
|
|
51
51
|
});
|
|
52
|
-
}),
|
|
53
|
-
color:
|
|
52
|
+
}), E = "__LOADING__", I = "__LOADING_ERROR__", Te = "0px 0px 20px 0px", Ve = /* @__PURE__ */ r(fe, {
|
|
53
|
+
color: Oe,
|
|
54
54
|
height: V,
|
|
55
55
|
role: "presentation",
|
|
56
56
|
style: {
|
|
57
|
-
padding:
|
|
57
|
+
padding: be,
|
|
58
58
|
boxSizing: "border-box"
|
|
59
59
|
},
|
|
60
60
|
width: V
|
|
61
|
-
}),
|
|
61
|
+
}), qe = /* @__PURE__ */ B(function(p, m) {
|
|
62
62
|
const {
|
|
63
|
-
dataTargetId:
|
|
64
|
-
defaultFetcher:
|
|
65
|
-
initialOpen:
|
|
66
|
-
onInputValueChange:
|
|
67
|
-
value:
|
|
68
|
-
onValueChange:
|
|
63
|
+
dataTargetId: w,
|
|
64
|
+
defaultFetcher: z,
|
|
65
|
+
initialOpen: G = !1,
|
|
66
|
+
onInputValueChange: j,
|
|
67
|
+
value: U,
|
|
68
|
+
onValueChange: q,
|
|
69
69
|
onOpenChange: h,
|
|
70
|
-
noResultMessage:
|
|
71
|
-
defaultValue:
|
|
72
|
-
loadingAriaLabel:
|
|
70
|
+
noResultMessage: H,
|
|
71
|
+
defaultValue: J = [],
|
|
72
|
+
loadingAriaLabel: K,
|
|
73
73
|
multiselect: s = !1,
|
|
74
|
-
disabled:
|
|
74
|
+
disabled: f,
|
|
75
75
|
className: Q,
|
|
76
|
-
displaySingleSelectionAsChip:
|
|
76
|
+
displaySingleSelectionAsChip: g = !0,
|
|
77
77
|
...X
|
|
78
78
|
} = p, {
|
|
79
79
|
formatMessage: c
|
|
80
|
-
} =
|
|
80
|
+
} = W(), b = L(null), O = L(!0), [Y, M] = xe(G), e = Ce({
|
|
81
81
|
async load({
|
|
82
82
|
marker: o,
|
|
83
83
|
searchInput: t,
|
|
84
|
-
signal:
|
|
84
|
+
signal: R
|
|
85
85
|
}) {
|
|
86
|
-
const l = await
|
|
87
|
-
signal:
|
|
86
|
+
const l = await z({
|
|
87
|
+
signal: R,
|
|
88
88
|
marker: o,
|
|
89
89
|
searchInput: t
|
|
90
90
|
});
|
|
@@ -93,73 +93,73 @@ import '../../../../styles/combobox-with-api-pagination.css';const Le = "_disabl
|
|
|
93
93
|
marker: l.marker
|
|
94
94
|
};
|
|
95
95
|
}
|
|
96
|
-
}),
|
|
97
|
-
|
|
98
|
-
}, []), [n, x] =
|
|
99
|
-
prop:
|
|
100
|
-
defaultProp:
|
|
101
|
-
onChange:
|
|
102
|
-
}),
|
|
103
|
-
|
|
104
|
-
}, [h]),
|
|
105
|
-
o === void 0 ? (x([]), (!
|
|
106
|
-
},
|
|
96
|
+
}), S = L(!1), Z = k(() => {
|
|
97
|
+
S.current || (e.reload(), S.current = !0);
|
|
98
|
+
}, []), [n, x] = Re({
|
|
99
|
+
prop: U,
|
|
100
|
+
defaultProp: J,
|
|
101
|
+
onChange: q
|
|
102
|
+
}), _ = !s && n.length === 1, $ = _ && !f, ee = k((o) => {
|
|
103
|
+
M(o), h?.(o);
|
|
104
|
+
}, [h]), oe = (o) => {
|
|
105
|
+
f || (o === void 0 ? (x([]), (!O.current || !g) && (e.search(""), O.current = !0)) : Array.isArray(o) ? x(o) : (x([o]), s || (M(!1), h?.(!1))));
|
|
106
|
+
}, te = y(() => n.length === 0 ? s ? [] : void 0 : s ? n : n[0], [s, n]), C = y(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), re = (o) => {
|
|
107
107
|
const {
|
|
108
108
|
value: t,
|
|
109
|
-
displayValue:
|
|
109
|
+
displayValue: R,
|
|
110
110
|
...l
|
|
111
111
|
} = o;
|
|
112
|
-
if (t ===
|
|
112
|
+
if (t === E)
|
|
113
113
|
return e.hasNextPage ? /* @__PURE__ */ r(d.Option, {
|
|
114
114
|
...l,
|
|
115
|
-
ref:
|
|
115
|
+
ref: se,
|
|
116
116
|
disabled: !0,
|
|
117
117
|
value: t,
|
|
118
|
-
children: /* @__PURE__ */ r(
|
|
118
|
+
children: /* @__PURE__ */ r(pe, {
|
|
119
119
|
"aria-label": c(a.loadingMoreAriaLabel),
|
|
120
120
|
style: {
|
|
121
121
|
position: "unset"
|
|
122
122
|
}
|
|
123
123
|
})
|
|
124
124
|
}) : null;
|
|
125
|
-
if (t ===
|
|
126
|
-
return /* @__PURE__ */ r(
|
|
125
|
+
if (t === I && e.hasError && !e.isEmpty)
|
|
126
|
+
return /* @__PURE__ */ r(D, {
|
|
127
127
|
onTryAgain: () => {
|
|
128
|
-
e.loadMore(),
|
|
128
|
+
e.loadMore(), b.current?.focus();
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
|
-
if (
|
|
131
|
+
if (C.some((A) => A.value === t))
|
|
132
132
|
return null;
|
|
133
|
-
const
|
|
133
|
+
const ce = n.some((A) => A.value === t);
|
|
134
134
|
return /* @__PURE__ */ r(d.Option, {
|
|
135
135
|
...l,
|
|
136
136
|
className: i.option,
|
|
137
137
|
value: t,
|
|
138
|
-
children: /* @__PURE__ */ r(
|
|
139
|
-
className:
|
|
140
|
-
value:
|
|
138
|
+
children: /* @__PURE__ */ r(ue, {
|
|
139
|
+
className: N(i.highlightOptionText, ce && i.selected),
|
|
140
|
+
value: R || t
|
|
141
141
|
})
|
|
142
142
|
});
|
|
143
|
-
},
|
|
144
|
-
if (
|
|
145
|
-
|
|
143
|
+
}, ne = (o) => {
|
|
144
|
+
if (j?.(o), _ && o === "") {
|
|
145
|
+
O.current = !1;
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
e.search(o);
|
|
149
|
-
},
|
|
150
|
-
e.reload(),
|
|
149
|
+
}, ae = () => {
|
|
150
|
+
e.reload(), b.current?.focus();
|
|
151
151
|
};
|
|
152
152
|
let u;
|
|
153
|
-
e.hasError && !e.isLoading ? u = /* @__PURE__ */ r(
|
|
154
|
-
onTryAgain:
|
|
155
|
-
}) : e.isEmpty && !e.isLoading ? u =
|
|
156
|
-
const [
|
|
157
|
-
rootRef:
|
|
153
|
+
e.hasError && !e.isLoading ? u = /* @__PURE__ */ r(D, {
|
|
154
|
+
onTryAgain: ae
|
|
155
|
+
}) : e.isEmpty && !e.isLoading ? u = H || c(a.noResults) : u = void 0;
|
|
156
|
+
const [se, {
|
|
157
|
+
rootRef: ie,
|
|
158
158
|
isVisible: T
|
|
159
|
-
}] =
|
|
159
|
+
}] = Ae({
|
|
160
160
|
rootMargin: Te
|
|
161
161
|
});
|
|
162
|
-
|
|
162
|
+
_e(() => {
|
|
163
163
|
if (!(T && e.hasNextPage))
|
|
164
164
|
return;
|
|
165
165
|
const t = setTimeout(() => {
|
|
@@ -169,46 +169,46 @@ import '../../../../styles/combobox-with-api-pagination.css';const Le = "_disabl
|
|
|
169
169
|
clearTimeout(t);
|
|
170
170
|
};
|
|
171
171
|
}, [T]);
|
|
172
|
-
const
|
|
172
|
+
const le = y(() => {
|
|
173
173
|
const o = e.hasNextPage ? {
|
|
174
|
-
displayValue: y,
|
|
175
|
-
value: y
|
|
176
|
-
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
177
174
|
displayValue: E,
|
|
178
175
|
value: E
|
|
176
|
+
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
177
|
+
displayValue: I,
|
|
178
|
+
value: I
|
|
179
179
|
} : null;
|
|
180
|
-
return [...e.items, ...
|
|
181
|
-
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items,
|
|
180
|
+
return [...e.items, ...C, o, t].filter(Boolean);
|
|
181
|
+
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items, C]);
|
|
182
182
|
return /* @__PURE__ */ r(d, {
|
|
183
183
|
...X,
|
|
184
|
-
ref:
|
|
184
|
+
ref: de(b, m),
|
|
185
185
|
as: "input",
|
|
186
|
-
className:
|
|
187
|
-
[i.disabled]:
|
|
188
|
-
}
|
|
186
|
+
className: N(Q, {
|
|
187
|
+
[i.disabled]: $
|
|
188
|
+
}),
|
|
189
189
|
clearButtonAriaLabel: c(a.clearButtonAriaLabel),
|
|
190
190
|
clearOnBlur: !1,
|
|
191
|
-
"data-target-id":
|
|
192
|
-
disabled:
|
|
193
|
-
displaySingleSelectionAsChip:
|
|
191
|
+
"data-target-id": w,
|
|
192
|
+
disabled: f || _ && g,
|
|
193
|
+
displaySingleSelectionAsChip: g,
|
|
194
194
|
displayValue: (o) => o.displayValue || o.value,
|
|
195
195
|
endComboboxIcon: Ve,
|
|
196
196
|
focusLoop: !1,
|
|
197
|
-
getPopoverRef:
|
|
197
|
+
getPopoverRef: ie,
|
|
198
198
|
loading: e.isReloading,
|
|
199
|
-
loadingAriaLabel:
|
|
199
|
+
loadingAriaLabel: K || c(a.loadingAriaLabel),
|
|
200
200
|
multiselect: s,
|
|
201
201
|
noResultMessage: u,
|
|
202
202
|
onFocus: Z,
|
|
203
|
-
onInputValueChange:
|
|
204
|
-
onOpenChange:
|
|
205
|
-
onValueChange:
|
|
203
|
+
onInputValueChange: ne,
|
|
204
|
+
onOpenChange: ee,
|
|
205
|
+
onValueChange: oe,
|
|
206
206
|
open: Y,
|
|
207
|
-
options:
|
|
208
|
-
renderOption:
|
|
209
|
-
value:
|
|
207
|
+
options: le,
|
|
208
|
+
renderOption: re,
|
|
209
|
+
value: te
|
|
210
210
|
});
|
|
211
211
|
});
|
|
212
212
|
export {
|
|
213
|
-
|
|
213
|
+
qe as ComboboxWithApiPagination
|
|
214
214
|
};
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { useComboboxStore as H, ComboboxProvider as J, PopoverAnchor as Q, Combobox as Y, ComboboxCancel as Z, ComboboxPopover as _, ComboboxItem as $ } from "@ariakit/react";
|
|
2
2
|
import { useLabelable as ee, ChipsGroup as oe, InputChip as te, IconButton as le } from "@box/blueprint-web";
|
|
3
3
|
import { XMark as ae, Search as re } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
-
import { Size6 as
|
|
4
|
+
import { Size6 as w, Size1 as se, IconIconOnLightSecondary as ne } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
5
|
import p from "clsx";
|
|
6
|
-
import { forwardRef as ie, useId as ce, useState as
|
|
6
|
+
import { forwardRef as ie, useId as ce, useState as L, useRef as y } from "react";
|
|
7
7
|
import { useIntl as ue } from "react-intl";
|
|
8
|
-
import
|
|
8
|
+
import N from "../combobox-with-api-pagination/messages.js";
|
|
9
9
|
import { useControllableState as me } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
|
|
10
|
-
import { s as
|
|
11
|
-
import { jsxs as
|
|
12
|
-
const
|
|
10
|
+
import { s as t, D as de } from "../../../../chunks/dynamic-loading-tree.js";
|
|
11
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
12
|
+
const pe = () => /* @__PURE__ */ o(re, {
|
|
13
13
|
color: ne,
|
|
14
|
-
height:
|
|
14
|
+
height: w,
|
|
15
15
|
role: "presentation",
|
|
16
16
|
style: {
|
|
17
17
|
padding: se,
|
|
18
18
|
boxSizing: "border-box"
|
|
19
19
|
},
|
|
20
|
-
width:
|
|
21
|
-
}), Oe = /* @__PURE__ */ ie(function(
|
|
20
|
+
width: w
|
|
21
|
+
}), Oe = /* @__PURE__ */ ie(function(A, he) {
|
|
22
22
|
const {
|
|
23
|
-
className:
|
|
24
|
-
closeOnSelection:
|
|
25
|
-
dataTargetId:
|
|
26
|
-
defaultFetcher:
|
|
27
|
-
defaultValue:
|
|
28
|
-
disabled:
|
|
29
|
-
hideLabel:
|
|
23
|
+
className: O,
|
|
24
|
+
closeOnSelection: R = !1,
|
|
25
|
+
dataTargetId: T,
|
|
26
|
+
defaultFetcher: B,
|
|
27
|
+
defaultValue: z = [],
|
|
28
|
+
disabled: s,
|
|
29
|
+
hideLabel: b,
|
|
30
30
|
initialOpen: D = !1,
|
|
31
31
|
label: M,
|
|
32
32
|
levels: P,
|
|
33
33
|
loadingAriaLabel: W,
|
|
34
|
-
multiselect:
|
|
34
|
+
multiselect: h = !1,
|
|
35
35
|
noResultMessage: k,
|
|
36
36
|
onValueChange: E,
|
|
37
37
|
onOpenChange: F,
|
|
@@ -40,65 +40,70 @@ const de = () => /* @__PURE__ */ o(re, {
|
|
|
40
40
|
selectableLevels: K,
|
|
41
41
|
treeAriaLabel: U,
|
|
42
42
|
value: X
|
|
43
|
-
} =
|
|
44
|
-
formatMessage:
|
|
45
|
-
} = ue(),
|
|
43
|
+
} = A, {
|
|
44
|
+
formatMessage: f
|
|
45
|
+
} = ue(), i = ce(), [C, g] = L(D), [a, c] = me({
|
|
46
46
|
prop: X,
|
|
47
|
-
defaultProp:
|
|
47
|
+
defaultProp: z,
|
|
48
48
|
onChange: E
|
|
49
|
-
}), [
|
|
49
|
+
}), [v, x] = L(""), I = y(null), u = H({
|
|
50
50
|
includesBaseElement: !0,
|
|
51
51
|
virtualFocus: !1,
|
|
52
|
-
value:
|
|
52
|
+
value: v,
|
|
53
53
|
setValue: (e) => {
|
|
54
|
-
|
|
54
|
+
x(e);
|
|
55
55
|
},
|
|
56
|
-
open:
|
|
56
|
+
open: C,
|
|
57
57
|
setOpen: (e) => {
|
|
58
|
-
|
|
58
|
+
g(e), F?.(e);
|
|
59
59
|
}
|
|
60
|
-
}),
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
store:
|
|
60
|
+
}), V = a.length > 0, S = a.length > 0, q = ee(M, i), m = y(null);
|
|
61
|
+
return /* @__PURE__ */ n(J, {
|
|
62
|
+
store: u,
|
|
63
63
|
children: [/* @__PURE__ */ o(Q, {
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
className: p(
|
|
64
|
+
children: /* @__PURE__ */ n("div", {
|
|
65
|
+
className: p(t.container, O, {
|
|
66
|
+
[t.disabled]: s
|
|
67
|
+
}),
|
|
66
68
|
children: [/* @__PURE__ */ o(q, {
|
|
67
|
-
className: p(
|
|
68
|
-
[
|
|
69
|
+
className: p(t.label, {
|
|
70
|
+
[t.hiddenLabel]: b
|
|
69
71
|
}),
|
|
70
|
-
hideLabel:
|
|
72
|
+
hideLabel: b
|
|
71
73
|
}), /* @__PURE__ */ o("div", {
|
|
72
|
-
children: /* @__PURE__ */
|
|
73
|
-
className: p(
|
|
74
|
-
[
|
|
75
|
-
[
|
|
74
|
+
children: /* @__PURE__ */ n("div", {
|
|
75
|
+
className: p(t.comboboxContainer, {
|
|
76
|
+
[t.withChips]: S,
|
|
77
|
+
[t.withComboboxButtons]: V
|
|
76
78
|
}),
|
|
77
|
-
children: [
|
|
79
|
+
children: [S && /* @__PURE__ */ o(oe, {
|
|
78
80
|
children: a.map((e) => /* @__PURE__ */ o(te, {
|
|
79
81
|
label: e.displayValue,
|
|
80
82
|
onDelete: () => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
+
if (s)
|
|
84
|
+
return;
|
|
85
|
+
const l = a.filter((r) => r.value !== e.value);
|
|
86
|
+
c(l);
|
|
83
87
|
},
|
|
84
88
|
tooltip: e.displayValue
|
|
85
89
|
}, e.value))
|
|
86
|
-
}), /* @__PURE__ */
|
|
87
|
-
className:
|
|
90
|
+
}), /* @__PURE__ */ n("div", {
|
|
91
|
+
className: t.textInputWrapper,
|
|
88
92
|
children: [/* @__PURE__ */ o(Y, {
|
|
89
|
-
ref:
|
|
93
|
+
ref: I,
|
|
90
94
|
"aria-haspopup": "tree",
|
|
91
|
-
className:
|
|
92
|
-
"data-target-id":
|
|
93
|
-
disabled:
|
|
94
|
-
id:
|
|
95
|
+
className: t.textInput,
|
|
96
|
+
"data-target-id": T,
|
|
97
|
+
disabled: s,
|
|
98
|
+
id: i,
|
|
95
99
|
placeholder: j,
|
|
96
|
-
store:
|
|
100
|
+
store: u
|
|
97
101
|
}), /* @__PURE__ */ o("div", {
|
|
98
|
-
className:
|
|
99
|
-
children:
|
|
102
|
+
className: t.comboboxButtons,
|
|
103
|
+
children: V ? /* @__PURE__ */ o(Z, {
|
|
104
|
+
disabled: s,
|
|
100
105
|
onClick: () => {
|
|
101
|
-
|
|
106
|
+
c([]);
|
|
102
107
|
},
|
|
103
108
|
render: (e) => /* @__PURE__ */ o(le, {
|
|
104
109
|
...e,
|
|
@@ -106,16 +111,16 @@ const de = () => /* @__PURE__ */ o(re, {
|
|
|
106
111
|
icon: ae,
|
|
107
112
|
size: "x-small"
|
|
108
113
|
}),
|
|
109
|
-
store:
|
|
110
|
-
}) : /* @__PURE__ */ o(
|
|
114
|
+
store: u
|
|
115
|
+
}) : /* @__PURE__ */ o(pe, {})
|
|
111
116
|
})]
|
|
112
117
|
})]
|
|
113
118
|
})
|
|
114
119
|
})]
|
|
115
120
|
})
|
|
116
121
|
}), /* @__PURE__ */ o(_, {
|
|
117
|
-
"aria-labelledby":
|
|
118
|
-
className:
|
|
122
|
+
"aria-labelledby": i,
|
|
123
|
+
className: t.popover,
|
|
119
124
|
fitViewport: !0,
|
|
120
125
|
gutter: 8,
|
|
121
126
|
portal: !0,
|
|
@@ -123,37 +128,37 @@ const de = () => /* @__PURE__ */ o(re, {
|
|
|
123
128
|
sameWidth: !0,
|
|
124
129
|
children: /* @__PURE__ */ o($, {
|
|
125
130
|
onFocusVisible: (e) => {
|
|
126
|
-
|
|
131
|
+
m.current?.firstChild?.focus();
|
|
127
132
|
},
|
|
128
133
|
onKeyDown: (e) => {
|
|
129
134
|
if (e.key === "ArrowUp") {
|
|
130
|
-
const
|
|
131
|
-
document.activeElement ===
|
|
135
|
+
const l = m.current?.firstChild;
|
|
136
|
+
document.activeElement === l && (l.blur(), I.current?.focus());
|
|
132
137
|
}
|
|
133
138
|
},
|
|
134
|
-
children: /* @__PURE__ */ o(
|
|
135
|
-
ref:
|
|
139
|
+
children: /* @__PURE__ */ o(de, {
|
|
140
|
+
ref: m,
|
|
136
141
|
ariaLabel: U,
|
|
137
|
-
defaultFetcher:
|
|
142
|
+
defaultFetcher: B,
|
|
138
143
|
levels: P,
|
|
139
|
-
loadingAriaLabel: W ||
|
|
140
|
-
multiselect:
|
|
141
|
-
noResultMessage: k ||
|
|
144
|
+
loadingAriaLabel: W || f(N.loadingAriaLabel),
|
|
145
|
+
multiselect: h,
|
|
146
|
+
noResultMessage: k || f(N.noResults),
|
|
142
147
|
onSelect: (e) => {
|
|
143
148
|
const {
|
|
144
|
-
metadata:
|
|
149
|
+
metadata: l
|
|
145
150
|
} = e.element;
|
|
146
151
|
let r = [];
|
|
147
|
-
e.isSelected ? (
|
|
152
|
+
e.isSelected ? (h && (r = a.filter((d) => d.value !== e.element.id)), r.push({
|
|
148
153
|
value: e.element.id,
|
|
149
|
-
displayValue:
|
|
150
|
-
level:
|
|
151
|
-
selectable:
|
|
152
|
-
ancestors:
|
|
153
|
-
}),
|
|
154
|
+
displayValue: l.displayValue,
|
|
155
|
+
level: l.level,
|
|
156
|
+
selectable: l.selectable,
|
|
157
|
+
ancestors: l.ancestors
|
|
158
|
+
}), R && r.length > a.length && g(!1)) : r = a.filter((d) => d.value !== e.element.id), c(r), x("");
|
|
154
159
|
},
|
|
155
|
-
open:
|
|
156
|
-
searchInput:
|
|
160
|
+
open: C,
|
|
161
|
+
searchInput: v.trimStart(),
|
|
157
162
|
selectableLevels: K,
|
|
158
163
|
selectedNodes: a.map((e) => e.value)
|
|
159
164
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._container_15bxn_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_15bxn_2._disabled_15bxn_13{opacity:.6}._container_15bxn_2 ._label_15bxn_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_15bxn_2 ._label_15bxn_16:not(._hiddenLabel_15bxn_28){margin-block-end:var(--space-2)}._container_15bxn_2 ._comboboxContainer_15bxn_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_15bxn_2 ._comboboxContainer_15bxn_31._withComboboxButtons_15bxn_47{padding-inline-end:var(--space-10)}._container_15bxn_2 ._comboboxContainer_15bxn_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_15bxn_2 ._comboboxContainer_15bxn_31:not(:disabled)._error_15bxn_55,._container_15bxn_2 ._comboboxContainer_15bxn_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_15bxn_2 ._comboboxContainer_15bxn_31 ._textInputWrapper_15bxn_63{display:flex;flex:content;gap:var(--space-2);align-items:center}._container_15bxn_2 ._comboboxContainer_15bxn_31 ._textInputWrapper_15bxn_63 ._textInput_15bxn_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_15bxn_2 ._comboboxContainer_15bxn_31 ._textInputWrapper_15bxn_63 ._errorIcon_15bxn_85 path{fill:var(--icon-icon-error-on-light)}._container_15bxn_2 ._comboboxContainer_15bxn_31 ._textInputWrapper_15bxn_63 ._comboboxButtons_15bxn_88{position:absolute;top:var(--space-2);right:var(--space-2);display:flex;align-items:center}._container_15bxn_2 ._comboboxContainer_15bxn_31._withChips_15bxn_95{max-height:calc(2 * var(--space-2) + 3 * var(--space-6));padding-block:calc((40px - var(--space-7)) / 2 - var(--border-1))}._container_15bxn_2 ._comboboxContainer_15bxn_31._withChips_15bxn_95:not(:disabled)._error_15bxn_55{padding-block:calc((40px - var(--space-7)) / 2 - var(--border-2))}._container_15bxn_2 ._comboboxContainer_15bxn_31._withChips_15bxn_95:not(:disabled):has(input:focus){padding-block:calc((40px - var(--space-7)) / 2 - var(--border-2))}._container_15bxn_2 ._inlineError_15bxn_105{margin-block-start:var(--space-2)}._popover_15bxn_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_15bxn_109 ul{padding-inline-start:0}._popover_15bxn_109 ._option_15bxn_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_15bxn_109 ._option_15bxn_135[aria-disabled]{opacity:.6}._popover_15bxn_109 ._option_15bxn_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_15bxn_109 ._option_15bxn_135:hover{background-color:var(--surface-menu-surface-hover)}._popover_15bxn_109 ._option_15bxn_135 ._indicator_15bxn_158{position:absolute;top:0;left:var(--space-2);display:flex;align-items:center;justify-content:center;height:var(--size-9)}._popover_15bxn_109 ._option_15bxn_135 ._indicator_15bxn_158 ._indicatorIcon_15bxn_167 path{fill:var(--icon-icon-on-light)}._popover_15bxn_109 ._optionWithIndicator_15bxn_170{padding-inline:var(--space-10) var(--space-2)}._popover_15bxn_109 ._loadingIndicator_15bxn_173{position:unset}._popover_15bxn_109 ._noResultOption_15bxn_176{color:var(--text-text-on-light);text-align:center;-webkit-user-select:none;user-select:none}
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/combobox-with-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@ariakit/react": "0.4.15",
|
|
6
|
-
"@box/blueprint-web": "^12.133.
|
|
7
|
-
"@box/blueprint-web-assets": "^4.99.
|
|
6
|
+
"@box/blueprint-web": "^12.133.1",
|
|
7
|
+
"@box/blueprint-web-assets": "^4.99.8",
|
|
8
8
|
"lodash": "^4.17.15",
|
|
9
9
|
"react": "^17.0.0 || ^18.0.0",
|
|
10
10
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
11
11
|
"react-intl": "^6.4.2"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@box/tree": "^1.27.
|
|
14
|
+
"@box/tree": "^1.27.1",
|
|
15
15
|
"react-accessible-treeview": "2.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@box/blueprint-web": "^12.133.
|
|
19
|
-
"@box/blueprint-web-assets": "^4.99.
|
|
20
|
-
"@box/storybook-utils": "^0.16.
|
|
18
|
+
"@box/blueprint-web": "^12.133.1",
|
|
19
|
+
"@box/blueprint-web-assets": "^4.99.8",
|
|
20
|
+
"@box/storybook-utils": "^0.16.34",
|
|
21
21
|
"react": "^18.3.0",
|
|
22
22
|
"react-dom": "^18.3.0"
|
|
23
23
|
},
|