@box/combobox-with-api 0.44.4 → 0.44.8

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.
@@ -1,313 +1,319 @@
1
- import { LoadingIndicator as X } from "@box/blueprint-web";
2
- import { InlineError as Y, Tree as Z } from "@box/tree";
3
- import { useReducer as $, useState as O, useMemo as P, useCallback as p, useEffect as W } from "react";
4
- import { getServiceNode as R, RootTreeNode as c, hasValidLevel as F } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
5
- import { t as ee, i as ae, A as s } from "./treeReducer.js";
6
- import { jsx as h, jsxs as te } from "react/jsx-runtime";
7
- import '../styles/dynamic-loading-tree.css';const oe = "_container_z81ug_1", ne = "_disabled_z81ug_12", le = "_label_z81ug_15", se = "_hiddenLabel_z81ug_27", re = "_comboboxContainer_z81ug_30", ie = "_withComboboxButtons_z81ug_46", de = "_error_z81ug_54", ce = "_textInputWrapper_z81ug_62", ue = "_textInput_z81ug_62", pe = "_errorIcon_z81ug_84", me = "_comboboxButtons_z81ug_87", _e = "_withChips_z81ug_94", be = "_inlineError_z81ug_104", ge = "_popover_z81ug_108", ye = "_option_z81ug_134", he = "_indicator_z81ug_157", ve = "_indicatorIcon_z81ug_166", Ie = "_optionWithIndicator_z81ug_169", fe = "_loadingIndicator_z81ug_172", Se = "_noResultOption_z81ug_175", x = {
8
- container: oe,
9
- disabled: ne,
10
- label: le,
11
- hiddenLabel: se,
12
- comboboxContainer: re,
13
- withComboboxButtons: ie,
14
- error: de,
15
- textInputWrapper: ce,
16
- textInput: ue,
17
- errorIcon: pe,
18
- comboboxButtons: me,
19
- withChips: _e,
20
- inlineError: be,
21
- popover: ge,
22
- option: ye,
23
- indicator: he,
24
- indicatorIcon: ve,
25
- optionWithIndicator: Ie,
26
- loadingIndicator: fe,
27
- noResultOption: Se
28
- }, Te = ({
29
- ariaLabel: j,
30
- onSelect: z,
31
- selectedNodes: T,
32
- defaultFetcher: m,
33
- levels: S,
34
- selectableLevels: v,
1
+ import { LoadingIndicator as Y } from "@box/blueprint-web";
2
+ import { InlineError as Z, Tree as $ } from "@box/tree";
3
+ import { forwardRef as F, useReducer as P, useState as A, useMemo as ee, useCallback as p, useEffect as j } from "react";
4
+ import { RootTreeNode as u, hasValidLevel as te, getServiceNode as D } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
5
+ import { t as ae, i as oe, A as r } from "./treeReducer.js";
6
+ import { jsx as v, jsxs as ne } from "react/jsx-runtime";
7
+ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se = "_disabled_z81ug_12", re = "_label_z81ug_15", ie = "_hiddenLabel_z81ug_27", de = "_comboboxContainer_z81ug_30", ce = "_withComboboxButtons_z81ug_46", ue = "_error_z81ug_54", me = "_textInputWrapper_z81ug_62", pe = "_textInput_z81ug_62", _e = "_errorIcon_z81ug_84", be = "_comboboxButtons_z81ug_87", ge = "_withChips_z81ug_94", ye = "_inlineError_z81ug_104", he = "_popover_z81ug_108", ve = "_option_z81ug_134", fe = "_indicator_z81ug_157", Ie = "_indicatorIcon_z81ug_166", Se = "_optionWithIndicator_z81ug_169", Ee = "_loadingIndicator_z81ug_172", Oe = "_noResultOption_z81ug_175", C = {
8
+ container: le,
9
+ disabled: se,
10
+ label: re,
11
+ hiddenLabel: ie,
12
+ comboboxContainer: de,
13
+ withComboboxButtons: ce,
14
+ error: ue,
15
+ textInputWrapper: me,
16
+ textInput: pe,
17
+ errorIcon: _e,
18
+ comboboxButtons: be,
19
+ withChips: ge,
20
+ inlineError: ye,
21
+ popover: he,
22
+ option: ve,
23
+ indicator: fe,
24
+ indicatorIcon: Ie,
25
+ optionWithIndicator: Se,
26
+ loadingIndicator: Ee,
27
+ noResultOption: Oe
28
+ }, Re = (l) => {
29
+ const i = [...l.children], {
30
+ metadata: d
31
+ } = l;
32
+ return {
33
+ ...l,
34
+ children: i,
35
+ metadata: {
36
+ ...l.metadata,
37
+ variant: d.variant,
38
+ isLoading: l.status === "loading" && !l.children.length,
39
+ labelName: d.labelName || "",
40
+ labelValue: d.labelValue || ""
41
+ }
42
+ };
43
+ }, Ne = (l, i) => {
44
+ let d;
45
+ return l.children.length && l.status === "loading" && (d = D(i.id, i.metadata.displayValue, "loading")), l.status === "error" && (d = D(i.id, i.metadata.displayValue, "reload")), l.status === "success" && l.marker && (d = D(i.id, i.metadata.displayValue, "loadMore")), d;
46
+ }, Le = /* @__PURE__ */ F(({
47
+ ariaLabel: l,
48
+ onSelect: i,
49
+ selectedNodes: d,
50
+ defaultFetcher: _,
51
+ levels: R,
52
+ selectableLevels: f,
35
53
  multiselect: M,
36
- open: A,
37
- searchInput: u,
54
+ open: L,
55
+ searchInput: m,
38
56
  noResultMessage: U,
39
57
  loadingAriaLabel: q
40
- }) => {
41
- const [b, n] = $(ee, ae), [y, G] = O({
58
+ }, G) => {
59
+ const [g, n] = P(ae, oe), [h, H] = A({
42
60
  nodes: [],
43
61
  selectedIds: []
44
- }), [E, _] = O(!1), [N, I] = O(!1), f = P(() => Math.max(...v), [v]), D = p((a = b) => {
45
- const t = [];
46
- return [...Object.values(a).map((e) => {
47
- const r = [...e.children], {
48
- metadata: o
49
- } = e, l = {
50
- ...e,
51
- children: r,
52
- metadata: {
53
- ...e.metadata,
54
- variant: o.variant,
55
- isLoading: e.status === "loading" && !e.children.length,
56
- labelName: o.labelName || "",
57
- labelValue: o.labelValue || ""
58
- }
59
- };
60
- let d;
61
- return e.children.length && e.status === "loading" && (d = R(l.id, l.metadata.displayValue, "loading")), e.status === "error" && (d = R(l.id, l.metadata.displayValue, "reload")), e.status === "success" && e.marker && (d = R(l.id, l.metadata.displayValue, "loadMore")), d && (t.push(d), l.children.push(d.id)), l;
62
- }), ...t];
63
- }, [b]), C = p((a) => {
64
- var r;
65
- const t = (r = a.ancestors) == null ? void 0 : r.find((o) => o.level === a.level - 1), i = S.find((o) => o.level === a.level);
66
- return a.level === 1 || u === "" ? a.displayValue : {
67
- labelName: i.displayName,
68
- labelValue: t.displayName
62
+ }), [N, b] = A(!1), [I, S] = A(!1), E = ee(() => Math.max(...f), [f]), k = p((e = g) => {
63
+ const a = [];
64
+ return [...Object.values(e).map((t) => {
65
+ const s = Re(t), o = Ne(t, s);
66
+ return o && (a.push(o), s.children.push(o.id)), s;
67
+ }), ...a];
68
+ }, [g]), V = p((e) => {
69
+ var s;
70
+ const a = (s = e.ancestors) == null ? void 0 : s.find((o) => o.level === e.level - 1), c = R.find((o) => o.level === e.level);
71
+ return e.level === 1 || m === "" ? e.displayValue : {
72
+ labelName: c.displayName,
73
+ labelValue: a.displayName
69
74
  };
70
- }, [S, u]), g = p((a) => ({
71
- id: a.value,
72
- name: a.displayValue,
73
- parent: c.id,
74
- isBranch: a.level !== f,
75
+ }, [R, m]), y = p((e) => ({
76
+ id: e.value,
77
+ name: e.displayValue,
78
+ parent: u.id,
79
+ isBranch: e.level !== E,
75
80
  children: [],
76
81
  metadata: {
77
82
  variant: "content",
78
- displayValue: a.displayValue,
79
- level: a.level,
80
- selectable: a.selectable,
81
- marker: a.marker,
82
- ancestors: a.ancestors
83
+ displayValue: e.displayValue,
84
+ level: e.level,
85
+ selectable: e.selectable,
86
+ marker: e.marker,
87
+ ancestors: e.ancestors
83
88
  }
84
- }), [f]), L = p((a, t) => {
89
+ }), [E]), x = p((e, a) => {
85
90
  n({
86
- type: s.RESET,
91
+ type: r.RESET,
87
92
  payload: {
88
- id: c.id,
93
+ id: u.id,
89
94
  items: []
90
95
  }
91
96
  }), n({
92
- type: s.LOAD_SUCCESS,
97
+ type: r.LOAD_SUCCESS,
93
98
  payload: {
94
- id: c.id,
95
- items: a,
96
- marker: t
99
+ id: u.id,
100
+ items: e,
101
+ marker: a
97
102
  }
98
- }), _(!1);
99
- }, [n, _]), k = p(() => {
103
+ }), b(!1);
104
+ }, [n, b]), T = p(() => {
100
105
  n({
101
- type: s.LOAD_ERROR,
106
+ type: r.LOAD_ERROR,
102
107
  payload: {
103
- id: c.id
108
+ id: u.id
104
109
  }
105
- }), _(!1), I(!0);
106
- }, [n, _, I]);
107
- W(() => {
108
- G({
109
- nodes: D(b),
110
- selectedIds: T
110
+ }), b(!1), S(!0);
111
+ }, [n, b, S]);
112
+ j(() => {
113
+ H({
114
+ nodes: k(g),
115
+ selectedIds: d
111
116
  });
112
- }, [D, T, b, N]), W(() => {
113
- if (!A)
117
+ }, [k, d, g, I]), j(() => {
118
+ if (!L)
114
119
  return;
115
120
  const {
116
- signal: a
121
+ signal: e
117
122
  } = new AbortController();
118
- _(!0), I(!1), u ? (n({
119
- type: s.RESET,
123
+ b(!0), S(!1), m ? (n({
124
+ type: r.RESET,
120
125
  payload: {
121
- id: c.id,
126
+ id: u.id,
122
127
  items: []
123
128
  }
124
- }), m({
125
- signal: a,
129
+ }), _({
130
+ signal: e,
126
131
  marker: null,
127
- searchInput: u,
132
+ searchInput: m,
128
133
  level: null,
129
134
  onlySelectableOptions: !1,
130
135
  ancestorId: null
131
- }).then((t) => {
132
- const i = t.options.filter((e) => e.selectable).map((e) => {
136
+ }).then((a) => {
137
+ const c = a.options.filter((t) => t.selectable).map((t) => {
133
138
  const {
134
- labelName: r,
139
+ labelName: s,
135
140
  labelValue: o
136
- } = C(e);
141
+ } = V(t);
137
142
  return {
138
- id: e.value,
139
- name: e.displayValue,
140
- parent: c.id,
141
- isBranch: e.level < f,
143
+ id: t.value,
144
+ name: t.displayValue,
145
+ parent: u.id,
146
+ isBranch: t.level < E,
142
147
  children: [],
143
148
  metadata: {
144
- variant: e.level === 1 ? "content" : "labeled",
145
- displayValue: e.displayValue,
146
- level: e.level,
147
- selectable: e.selectable,
148
- ancestors: e.ancestors,
149
- labelName: r,
149
+ variant: t.level === 1 ? "content" : "labeled",
150
+ displayValue: t.displayValue,
151
+ level: t.level,
152
+ selectable: t.selectable,
153
+ ancestors: t.ancestors,
154
+ labelName: s,
150
155
  labelValue: o
151
156
  }
152
157
  };
153
158
  });
154
- L(i, t.marker);
159
+ x(c, a.marker);
155
160
  }).catch(() => {
156
- k();
161
+ T();
157
162
  })) : (n({
158
- type: s.RESET,
163
+ type: r.RESET,
159
164
  payload: {
160
- id: c.id,
165
+ id: u.id,
161
166
  items: []
162
167
  }
163
168
  }), n({
164
- type: s.LOAD_DATA,
169
+ type: r.LOAD_DATA,
165
170
  payload: {
166
- id: c.id
171
+ id: u.id
167
172
  }
168
- }), m({
169
- signal: a,
173
+ }), _({
174
+ signal: e,
170
175
  marker: null,
171
176
  searchInput: "",
172
177
  level: 1,
173
178
  onlySelectableOptions: !1,
174
179
  ancestorId: null
175
- }).then((t) => {
176
- const i = t.options.map(g);
177
- L(i, t.marker);
180
+ }).then((a) => {
181
+ const c = a.options.map(y);
182
+ x(c, a.marker);
178
183
  }).catch(() => {
179
- k();
184
+ T();
180
185
  }));
181
- }, [m, g, A, u, S, f, C]);
182
- const H = p((a) => {
186
+ }, [_, y, L, m, R, E, V, x, T]);
187
+ const J = p((e) => {
183
188
  const {
184
- isExpanded: t,
185
- isDisabled: i,
186
- element: e
187
- } = a;
188
- if (!t || i) {
189
+ isExpanded: a,
190
+ isDisabled: c,
191
+ element: t
192
+ } = e;
193
+ if (!a || c) {
189
194
  n({
190
- type: s.RESET,
195
+ type: r.RESET,
191
196
  payload: {
192
- id: e.id,
197
+ id: t.id,
193
198
  items: []
194
199
  }
195
200
  });
196
201
  return;
197
202
  }
198
203
  const {
199
- level: r
200
- } = e.metadata, {
204
+ level: s
205
+ } = t.metadata, {
201
206
  id: o,
202
- marker: l
203
- } = e, {
204
- signal: d
207
+ marker: O
208
+ } = t, {
209
+ signal: z
205
210
  } = new AbortController();
206
211
  n({
207
- type: s.LOAD_DATA,
212
+ type: r.LOAD_DATA,
208
213
  payload: {
209
214
  id: o
210
215
  }
211
- }), m({
212
- signal: d,
213
- marker: l,
216
+ }), _({
217
+ signal: z,
218
+ marker: O,
214
219
  searchInput: "",
215
- level: r + 1,
220
+ level: s + 1,
216
221
  ancestorId: o,
217
222
  onlySelectableOptions: !1
218
- }).then((w) => {
219
- const Q = w.options.map((B) => (e.children.push(B.value), g(B)));
223
+ }).then((B) => {
224
+ const X = B.options.map((W) => (t.children.push(W.value), y(W)));
220
225
  n({
221
- type: s.LOAD_SUCCESS,
226
+ type: r.LOAD_SUCCESS,
222
227
  payload: {
223
228
  id: o,
224
- items: Q,
225
- marker: w.marker
229
+ items: X,
230
+ marker: B.marker
226
231
  }
227
232
  });
228
233
  }).catch(() => {
229
234
  n({
230
- type: s.LOAD_ERROR,
235
+ type: r.LOAD_ERROR,
231
236
  payload: {
232
237
  id: o
233
238
  }
234
239
  });
235
240
  });
236
- }, [m, g]), V = p((a) => {
237
- N && (I(!1), _(!0));
238
- const t = b[a], {
239
- level: i
240
- } = t.metadata, {
241
- id: e,
242
- marker: r
243
- } = t, {
241
+ }, [_, y]), w = p((e) => {
242
+ I && (S(!1), b(!0));
243
+ const a = g[e], {
244
+ level: c
245
+ } = a.metadata, {
246
+ id: t,
247
+ marker: s
248
+ } = a, {
244
249
  signal: o
245
250
  } = new AbortController();
246
251
  n({
247
- type: s.LOAD_DATA,
252
+ type: r.LOAD_DATA,
248
253
  payload: {
249
- id: e
254
+ id: t
250
255
  }
251
- }), m({
256
+ }), _({
252
257
  signal: o,
253
- marker: r,
254
- searchInput: u,
255
- level: u === "" ? i + 1 : null,
256
- ancestorId: e !== c.id ? e.toString() : null,
258
+ marker: s,
259
+ searchInput: m,
260
+ level: m === "" ? c + 1 : null,
261
+ ancestorId: t !== u.id ? t.toString() : null,
257
262
  onlySelectableOptions: !1
258
- }).then((l) => {
259
- const d = l.options.map(g);
263
+ }).then((O) => {
264
+ const z = O.options.map(y);
260
265
  n({
261
- type: s.LOAD_SUCCESS,
266
+ type: r.LOAD_SUCCESS,
262
267
  payload: {
263
- id: e,
264
- items: d,
265
- marker: l.marker
268
+ id: t,
269
+ items: z,
270
+ marker: O.marker
266
271
  }
267
- }), _(!1);
272
+ }), b(!1);
268
273
  }).catch(() => {
269
274
  n({
270
- type: s.LOAD_ERROR,
275
+ type: r.LOAD_ERROR,
271
276
  payload: {
272
- id: e,
273
- marker: r
277
+ id: t,
278
+ marker: s
274
279
  }
275
280
  });
276
281
  });
277
- }, [m, g, u, b]), J = y.nodes.length === 0 || y.nodes[0].children.length === 0 && y.nodes[0].id === c.id, K = p((a) => {
282
+ }, [_, I, y, m, g]), K = h.nodes.length === 0 || h.nodes[0].children.length === 0 && h.nodes[0].id === u.id, Q = p((e) => {
278
283
  const {
279
- metadata: t
280
- } = a.element;
281
- F(t) && v.includes(t.level) ? z(a) : (a.isSelected = !1, a.treeState.selectedIds.delete(a.element.id));
282
- }, [v, z]);
283
- return N ? /* @__PURE__ */ h(Y, {
284
+ metadata: a
285
+ } = e.element;
286
+ te(a) && f.includes(a.level) ? i(e) : (e.isSelected = !1, e.treeState.selectedIds.delete(e.element.id));
287
+ }, [f, i]);
288
+ return I ? /* @__PURE__ */ v(Z, {
284
289
  onReload: () => {
285
- V("root");
290
+ w("root");
286
291
  }
287
- }) : /* @__PURE__ */ te("div", {
288
- children: [E && /* @__PURE__ */ h("div", {
289
- className: x.noResultOption,
290
- children: /* @__PURE__ */ h(X, {
292
+ }) : /* @__PURE__ */ ne("div", {
293
+ children: [N && /* @__PURE__ */ v("div", {
294
+ className: C.noResultOption,
295
+ children: /* @__PURE__ */ v(Y, {
291
296
  "aria-label": q,
292
- className: x.loadingIndicator
297
+ className: C.loadingIndicator
293
298
  })
294
- }), J && !E ? /* @__PURE__ */ h("div", {
295
- className: x.noResultOption,
299
+ }), K && !N ? /* @__PURE__ */ v("div", {
300
+ className: C.noResultOption,
296
301
  children: U
297
- }) : !E && /* @__PURE__ */ h(Z, {
298
- "aria-label": j,
299
- data: y.nodes,
302
+ }) : !N && /* @__PURE__ */ v($, {
303
+ ref: G,
304
+ "aria-label": l,
305
+ data: h.nodes,
300
306
  multiSelect: M,
301
- onExpand: H,
302
- onLoadData: V,
303
- onNodeSelect: K,
304
- selectedIds: y.selectedIds,
307
+ onExpand: J,
308
+ onLoadData: w,
309
+ onNodeSelect: Q,
310
+ selectedIds: h.selectedIds,
305
311
  size: "large",
306
312
  togglableSelect: !0
307
313
  })]
308
314
  });
309
- };
315
+ });
310
316
  export {
311
- Te as D,
312
- x as s
317
+ Le as D,
318
+ C as s
313
319
  };
@@ -1,147 +1,162 @@
1
- import { useComboboxStore as X, ComboboxProvider as q, PopoverAnchor as H, Combobox as J, ComboboxCancel as K, ComboboxPopover as Q } from "@ariakit/react";
2
- import { useLabelable as U, ChipsGroup as Y, InputChip as Z, IconButton as _ } from "@box/blueprint-web";
3
- import { XMark as $, Search as ee } from "@box/blueprint-web-assets/icons/Fill";
4
- import { IconIconOnLightSecondary as oe, Size6 as g, Size1 as te } from "@box/blueprint-web-assets/tokens/tokens";
5
- import p from "clsx";
6
- import { forwardRef as le, useId as ae, useState as I, useRef as se, useCallback as re } from "react";
7
- import { useIntl as ne } from "react-intl";
8
- import V from "../combobox-with-api-pagination/messages.js";
9
- import { useControllableState as ie } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
10
- import { s as t, D as ce } from "../../../../chunks/dynamic-loading-tree.js";
11
- import { jsxs as r, jsx as o } from "react/jsx-runtime";
12
- const ue = () => /* @__PURE__ */ o(ee, {
13
- color: oe,
14
- height: g,
1
+ import { useComboboxStore as X, ComboboxProvider as q, PopoverAnchor as H, Combobox as J, ComboboxCancel as Q, ComboboxPopover as Y, ComboboxItem as Z } from "@ariakit/react";
2
+ import { useLabelable as _, ChipsGroup as $, InputChip as ee, IconButton as oe } from "@box/blueprint-web";
3
+ import { XMark as te, Search as le } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { IconIconOnLightSecondary as ae, Size6 as V, Size1 as se } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import b from "clsx";
6
+ import { forwardRef as re, useId as ne, useState as w, useRef as S, useCallback as ie } from "react";
7
+ import { useIntl as ce } from "react-intl";
8
+ import L from "../combobox-with-api-pagination/messages.js";
9
+ import { useControllableState as ue } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
10
+ import { s as a, D as me } from "../../../../chunks/dynamic-loading-tree.js";
11
+ import { jsxs as n, jsx as t } from "react/jsx-runtime";
12
+ const pe = () => /* @__PURE__ */ t(le, {
13
+ color: ae,
14
+ height: V,
15
15
  role: "presentation",
16
16
  style: {
17
- padding: te,
17
+ padding: se,
18
18
  boxSizing: "border-box"
19
19
  },
20
- width: g
21
- }), we = /* @__PURE__ */ le(function(S, pe) {
20
+ width: V
21
+ }), ye = /* @__PURE__ */ re(function(y, de) {
22
22
  const {
23
- className: w,
24
- dataTargetId: L,
25
- defaultFetcher: N,
26
- defaultValue: y = [],
27
- disabled: A,
23
+ className: N,
24
+ dataTargetId: A,
25
+ defaultFetcher: R,
26
+ defaultValue: B = [],
27
+ disabled: k,
28
28
  hideLabel: d,
29
- label: R,
30
- levels: B,
31
- loadingAriaLabel: z,
32
- multiselect: b = !1,
33
- noResultMessage: M,
34
- onValueChange: O,
35
- placeholder: P,
36
- portalElement: T,
37
- selectableLevels: W,
38
- treeAriaLabel: k,
39
- value: D
40
- } = S, {
41
- formatMessage: h
42
- } = ne(), n = ae(), [f, j] = I(!1), [l, i] = ie({
43
- prop: D,
44
- defaultProp: y,
45
- onChange: O
46
- }), [x, c] = I(""), E = se(null), F = re((e) => {
47
- c(e);
48
- }, [c]), u = X({
29
+ label: z,
30
+ levels: D,
31
+ loadingAriaLabel: M,
32
+ multiselect: h = !1,
33
+ noResultMessage: O,
34
+ onValueChange: P,
35
+ placeholder: T,
36
+ portalElement: W,
37
+ selectableLevels: E,
38
+ treeAriaLabel: F,
39
+ value: j
40
+ } = y, {
41
+ formatMessage: f
42
+ } = ce(), i = ne(), [C, G] = w(!1), [s, c] = ue({
43
+ prop: j,
44
+ defaultProp: B,
45
+ onChange: P
46
+ }), [x, u] = w(""), v = S(null), K = ie((e) => {
47
+ u(e);
48
+ }, [u]), m = X({
49
49
  includesBaseElement: !0,
50
50
  virtualFocus: !1,
51
51
  value: x,
52
- setValue: F,
53
- open: f,
54
- setOpen: j
55
- }), C = l.length > 0, v = l.length > 0, G = U(R, n);
56
- return /* @__PURE__ */ r(q, {
57
- store: u,
58
- children: [/* @__PURE__ */ o(H, {
59
- children: /* @__PURE__ */ r("div", {
60
- className: p(t.container, w),
61
- children: [/* @__PURE__ */ o(G, {
62
- className: p(t.label, {
63
- [t.hiddenLabel]: d
52
+ setValue: K,
53
+ open: C,
54
+ setOpen: G
55
+ }), g = s.length > 0, I = s.length > 0, U = _(z, i), p = S(null);
56
+ return /* @__PURE__ */ n(q, {
57
+ store: m,
58
+ children: [/* @__PURE__ */ t(H, {
59
+ children: /* @__PURE__ */ n("div", {
60
+ className: b(a.container, N),
61
+ children: [/* @__PURE__ */ t(U, {
62
+ className: b(a.label, {
63
+ [a.hiddenLabel]: d
64
64
  }),
65
65
  hideLabel: d
66
- }), /* @__PURE__ */ r("div", {
67
- className: p(t.comboboxContainer, {
68
- [t.withChips]: v,
69
- [t.withComboboxButtons]: C
66
+ }), /* @__PURE__ */ n("div", {
67
+ className: b(a.comboboxContainer, {
68
+ [a.withChips]: I,
69
+ [a.withComboboxButtons]: g
70
70
  }),
71
- children: [v && /* @__PURE__ */ o(Y, {
72
- children: l.map((e) => /* @__PURE__ */ o(Z, {
71
+ children: [I && /* @__PURE__ */ t($, {
72
+ children: s.map((e) => /* @__PURE__ */ t(ee, {
73
73
  label: e.displayValue,
74
74
  onDelete: () => {
75
- const a = l.filter((s) => s.value !== e.value);
76
- i(a);
75
+ const o = s.filter((l) => l.value !== e.value);
76
+ c(o);
77
77
  },
78
78
  tooltip: e.displayValue
79
79
  }, e.value))
80
- }), /* @__PURE__ */ r("div", {
81
- className: t.textInputWrapper,
82
- children: [/* @__PURE__ */ o(J, {
83
- ref: E,
84
- className: t.textInput,
85
- "data-target-id": L,
86
- disabled: A,
87
- id: n,
88
- placeholder: P,
89
- store: u
90
- }), /* @__PURE__ */ o("div", {
91
- className: t.comboboxButtons,
92
- children: C ? /* @__PURE__ */ o(K, {
80
+ }), /* @__PURE__ */ n("div", {
81
+ className: a.textInputWrapper,
82
+ children: [/* @__PURE__ */ t(J, {
83
+ ref: v,
84
+ "aria-haspopup": "tree",
85
+ className: a.textInput,
86
+ "data-target-id": A,
87
+ disabled: k,
88
+ id: i,
89
+ placeholder: T,
90
+ store: m
91
+ }), /* @__PURE__ */ t("div", {
92
+ className: a.comboboxButtons,
93
+ children: g ? /* @__PURE__ */ t(Q, {
93
94
  onClick: () => {
94
- i([]);
95
+ c([]);
95
96
  },
96
- render: (e) => /* @__PURE__ */ o(_, {
97
+ render: (e) => /* @__PURE__ */ t(oe, {
97
98
  ...e,
98
99
  "aria-label": "Clear selection",
99
- icon: $,
100
+ icon: te,
100
101
  size: "x-small"
101
102
  }),
102
- store: u
103
- }) : /* @__PURE__ */ o(ue, {})
103
+ store: m
104
+ }) : /* @__PURE__ */ t(pe, {})
104
105
  })]
105
106
  })]
106
107
  })]
107
108
  })
108
- }), /* @__PURE__ */ o(Q, {
109
- "aria-labelledby": n,
110
- className: t.popover,
109
+ }), /* @__PURE__ */ t(Y, {
110
+ "aria-labelledby": i,
111
+ className: a.popover,
111
112
  fitViewport: !0,
112
113
  gutter: 8,
113
- modal: !0,
114
114
  portal: !0,
115
- portalElement: T,
115
+ portalElement: W,
116
116
  sameWidth: !0,
117
- children: /* @__PURE__ */ o(ce, {
118
- ariaLabel: k,
119
- defaultFetcher: N,
120
- levels: B,
121
- loadingAriaLabel: z || h(V.loadingAriaLabel),
122
- multiselect: b,
123
- noResultMessage: M || h(V.noResults),
124
- onSelect: (e) => {
125
- const {
126
- metadata: a
127
- } = e.element;
128
- let s = [];
129
- e.isSelected ? (b && (s = l.filter((m) => m.value !== e.element.id)), s.push({
130
- value: e.element.id,
131
- displayValue: a.displayValue,
132
- level: a.level,
133
- selectable: a.selectable,
134
- ancestors: a.ancestors
135
- })) : s = l.filter((m) => m.value !== e.element.id), i(s), c("");
117
+ children: /* @__PURE__ */ t(Z, {
118
+ onFocusVisible: (e) => {
119
+ var l;
120
+ const o = (l = p.current) == null ? void 0 : l.firstChild;
121
+ o == null || o.focus();
136
122
  },
137
- open: f,
138
- searchInput: x.trimStart(),
139
- selectableLevels: W,
140
- selectedNodes: l.map((e) => e.value)
123
+ onKeyDown: (e) => {
124
+ var o, l;
125
+ if (e.key === "ArrowUp") {
126
+ const r = (o = p.current) == null ? void 0 : o.firstChild;
127
+ document.activeElement === r && (r.blur(), (l = v.current) == null || l.focus());
128
+ }
129
+ },
130
+ children: /* @__PURE__ */ t(me, {
131
+ ref: p,
132
+ ariaLabel: F,
133
+ defaultFetcher: R,
134
+ levels: D,
135
+ loadingAriaLabel: M || f(L.loadingAriaLabel),
136
+ multiselect: h,
137
+ noResultMessage: O || f(L.noResults),
138
+ onSelect: (e) => {
139
+ const {
140
+ metadata: o
141
+ } = e.element;
142
+ let l = [];
143
+ e.isSelected ? (h && (l = s.filter((r) => r.value !== e.element.id)), l.push({
144
+ value: e.element.id,
145
+ displayValue: o.displayValue,
146
+ level: o.level,
147
+ selectable: o.selectable,
148
+ ancestors: o.ancestors
149
+ })) : l = s.filter((r) => r.value !== e.element.id), c(l), u("");
150
+ },
151
+ open: C,
152
+ searchInput: x.trimStart(),
153
+ selectableLevels: E,
154
+ selectedNodes: s.map((e) => e.value)
155
+ })
141
156
  })
142
157
  })]
143
158
  });
144
159
  });
145
160
  export {
146
- we as ComboboxWithApiTreeView
161
+ ye as ComboboxWithApiTreeView
147
162
  };
@@ -14,4 +14,4 @@ export interface DynamicLoadingTreeProps {
14
14
  noResultMessage: string | React.ReactElement;
15
15
  loadingAriaLabel: string;
16
16
  }
17
- export declare const DynamicLoadingTree: ({ ariaLabel, onSelect, selectedNodes, defaultFetcher, levels, selectableLevels, multiselect, open, searchInput, noResultMessage, loadingAriaLabel, }: DynamicLoadingTreeProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const DynamicLoadingTree: import('react').ForwardRefExoticComponent<DynamicLoadingTreeProps & import('react').RefAttributes<HTMLDivElement>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/combobox-with-api",
3
- "version": "0.44.4",
3
+ "version": "0.44.8",
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": "^0.50.2",
14
+ "@box/tree": "^0.50.4",
15
15
  "react-accessible-treeview": "2.9.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@box/blueprint-web": "^12.9.4",
19
- "@box/blueprint-web-assets": "^4.52.0",
20
- "@box/storybook-utils": "^0.13.5",
18
+ "@box/blueprint-web": "^12.10.0",
19
+ "@box/blueprint-web-assets": "^4.53.0",
20
+ "@box/storybook-utils": "^0.13.6",
21
21
  "react": "^18.3.0",
22
22
  "react-dom": "^18.3.0"
23
23
  },