@box/combobox-with-api 0.44.20 → 0.45.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.
@@ -1,78 +1,78 @@
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,
1
+ import { LoadingIndicator as Z } from "@box/blueprint-web";
2
+ import { InlineError as $, Tree as F } from "@box/tree";
3
+ import { forwardRef as P, useReducer as ee, useState as A, useMemo as te, useCallback as m, useEffect as j } from "react";
4
+ import { RootTreeNode as u, hasValidLevel as ae, getServiceNode as D } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
5
+ import { t as oe, i as ne, A as r } from "./treeReducer.js";
6
+ import { jsx as v, jsxs as le } from "react/jsx-runtime";
7
+ import '../styles/dynamic-loading-tree.css';const se = "_container_z81ug_1", re = "_disabled_z81ug_12", ie = "_label_z81ug_15", de = "_hiddenLabel_z81ug_27", ce = "_comboboxContainer_z81ug_30", ue = "_withComboboxButtons_z81ug_46", me = "_error_z81ug_54", pe = "_textInputWrapper_z81ug_62", _e = "_textInput_z81ug_62", be = "_errorIcon_z81ug_84", ge = "_comboboxButtons_z81ug_87", ye = "_withChips_z81ug_94", he = "_inlineError_z81ug_104", ve = "_popover_z81ug_108", fe = "_option_z81ug_134", Ie = "_indicator_z81ug_157", Se = "_indicatorIcon_z81ug_166", Ee = "_optionWithIndicator_z81ug_169", Ne = "_loadingIndicator_z81ug_172", Oe = "_noResultOption_z81ug_175", C = {
8
+ container: se,
9
+ disabled: re,
10
+ label: ie,
11
+ hiddenLabel: de,
12
+ comboboxContainer: ce,
13
+ withComboboxButtons: ue,
14
+ error: me,
15
+ textInputWrapper: pe,
16
+ textInput: _e,
17
+ errorIcon: be,
18
+ comboboxButtons: ge,
19
+ withChips: ye,
20
+ inlineError: he,
21
+ popover: ve,
22
+ option: fe,
23
+ indicator: Ie,
24
+ indicatorIcon: Se,
25
+ optionWithIndicator: Ee,
26
+ loadingIndicator: Ne,
27
27
  noResultOption: Oe
28
28
  }, Re = (l) => {
29
- const i = [...l.children], {
30
- metadata: d
29
+ const d = [...l.children], {
30
+ metadata: c
31
31
  } = l;
32
32
  return {
33
33
  ...l,
34
- children: i,
34
+ children: d,
35
35
  metadata: {
36
36
  ...l.metadata,
37
- variant: d.variant,
37
+ variant: c.variant,
38
38
  isLoading: l.status === "loading" && !l.children.length,
39
- labelName: d.labelName || "",
40
- labelValue: d.labelValue || ""
39
+ labelName: c.labelName || "",
40
+ labelValue: c.labelValue || ""
41
41
  }
42
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(({
43
+ }, xe = (l, d) => {
44
+ let c;
45
+ return l.children.length && l.status === "loading" && (c = D(d.id, d.metadata.displayValue, "loading")), l.status === "error" && (c = D(d.id, d.metadata.displayValue, "reload")), l.status === "success" && l.marker && (c = D(d.id, d.metadata.displayValue, "loadMore")), c;
46
+ }, Ve = /* @__PURE__ */ P(({
47
47
  ariaLabel: l,
48
- onSelect: i,
49
- selectedNodes: d,
48
+ onSelect: d,
49
+ selectedNodes: c,
50
50
  defaultFetcher: _,
51
- levels: R,
51
+ levels: O,
52
52
  selectableLevels: f,
53
53
  multiselect: M,
54
54
  open: L,
55
- searchInput: m,
55
+ searchInput: p,
56
56
  noResultMessage: U,
57
57
  loadingAriaLabel: q
58
58
  }, G) => {
59
- const [g, n] = P(ae, oe), [h, H] = A({
59
+ const [g, n] = ee(oe, ne), [h, H] = A({
60
60
  nodes: [],
61
61
  selectedIds: []
62
- }), [N, b] = A(!1), [I, S] = A(!1), E = ee(() => Math.max(...f), [f]), k = p((e = g) => {
62
+ }), [R, b] = A(!1), [I, S] = A(!1), E = te(() => Math.max(...f), [f]), V = m((e = g) => {
63
63
  const a = [];
64
64
  return [...Object.values(e).map((t) => {
65
- const s = Re(t), o = Ne(t, s);
65
+ const s = Re(t), o = xe(t, s);
66
66
  return o && (a.push(o), s.children.push(o.id)), s;
67
67
  }), ...a];
68
- }, [g]), V = p((e) => {
68
+ }, [g]), k = m((e) => {
69
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,
70
+ const a = (s = e.ancestors) == null ? void 0 : s.find((o) => o.level === e.level - 1), i = O.find((o) => o.level === e.level);
71
+ return e.level === 1 || p === "" ? e.displayValue : {
72
+ labelName: i.displayName,
73
73
  labelValue: a.displayName
74
74
  };
75
- }, [R, m]), y = p((e) => ({
75
+ }, [O, p]), y = m((e) => ({
76
76
  id: e.value,
77
77
  name: e.displayValue,
78
78
  parent: u.id,
@@ -86,7 +86,7 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
86
86
  marker: e.marker,
87
87
  ancestors: e.ancestors
88
88
  }
89
- }), [E]), x = p((e, a) => {
89
+ }), [E]), x = m((e, a) => {
90
90
  n({
91
91
  type: r.RESET,
92
92
  payload: {
@@ -101,26 +101,30 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
101
101
  marker: a
102
102
  }
103
103
  }), b(!1);
104
- }, [n, b]), T = p(() => {
104
+ }, [n, b]), T = m(() => {
105
105
  n({
106
106
  type: r.LOAD_ERROR,
107
107
  payload: {
108
108
  id: u.id
109
109
  }
110
110
  }), b(!1), S(!0);
111
- }, [n, b, S]);
111
+ }, [n, b, S]), J = m((e, a) => {
112
+ const i = new Set(e.map((t) => t.id));
113
+ return a.filter((t) => i.has(t));
114
+ }, []);
112
115
  j(() => {
116
+ const e = V(g);
113
117
  H({
114
- nodes: k(g),
115
- selectedIds: d
118
+ nodes: e,
119
+ selectedIds: J(e, c)
116
120
  });
117
- }, [k, d, g, I]), j(() => {
121
+ }, [V, c, g, I]), j(() => {
118
122
  if (!L)
119
123
  return;
120
124
  const {
121
125
  signal: e
122
126
  } = new AbortController();
123
- b(!0), S(!1), m ? (n({
127
+ b(!0), S(!1), p ? (n({
124
128
  type: r.RESET,
125
129
  payload: {
126
130
  id: u.id,
@@ -129,16 +133,16 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
129
133
  }), _({
130
134
  signal: e,
131
135
  marker: null,
132
- searchInput: m,
136
+ searchInput: p,
133
137
  level: null,
134
138
  onlySelectableOptions: !1,
135
139
  ancestorId: null
136
140
  }).then((a) => {
137
- const c = a.options.filter((t) => t.selectable).map((t) => {
141
+ const i = a.options.filter((t) => t.selectable).map((t) => {
138
142
  const {
139
143
  labelName: s,
140
144
  labelValue: o
141
- } = V(t);
145
+ } = k(t);
142
146
  return {
143
147
  id: t.value,
144
148
  name: t.displayValue,
@@ -156,7 +160,7 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
156
160
  }
157
161
  };
158
162
  });
159
- x(c, a.marker);
163
+ x(i, a.marker);
160
164
  }).catch(() => {
161
165
  T();
162
166
  })) : (n({
@@ -178,19 +182,19 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
178
182
  onlySelectableOptions: !1,
179
183
  ancestorId: null
180
184
  }).then((a) => {
181
- const c = a.options.map(y);
182
- x(c, a.marker);
185
+ const i = a.options.map(y);
186
+ x(i, a.marker);
183
187
  }).catch(() => {
184
188
  T();
185
189
  }));
186
- }, [_, y, L, m, R, E, V, x, T]);
187
- const J = p((e) => {
190
+ }, [_, y, L, p, O, E, k, x, T]);
191
+ const K = m((e) => {
188
192
  const {
189
193
  isExpanded: a,
190
- isDisabled: c,
194
+ isDisabled: i,
191
195
  element: t
192
196
  } = e;
193
- if (!a || c) {
197
+ if (!a || i) {
194
198
  n({
195
199
  type: r.RESET,
196
200
  payload: {
@@ -204,7 +208,7 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
204
208
  level: s
205
209
  } = t.metadata, {
206
210
  id: o,
207
- marker: O
211
+ marker: N
208
212
  } = t, {
209
213
  signal: z
210
214
  } = new AbortController();
@@ -215,18 +219,18 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
215
219
  }
216
220
  }), _({
217
221
  signal: z,
218
- marker: O,
222
+ marker: N,
219
223
  searchInput: "",
220
224
  level: s + 1,
221
225
  ancestorId: o,
222
226
  onlySelectableOptions: !1
223
227
  }).then((B) => {
224
- const X = B.options.map((W) => (t.children.push(W.value), y(W)));
228
+ const Y = B.options.map((W) => (t.children.push(W.value), y(W)));
225
229
  n({
226
230
  type: r.LOAD_SUCCESS,
227
231
  payload: {
228
232
  id: o,
229
- items: X,
233
+ items: Y,
230
234
  marker: B.marker
231
235
  }
232
236
  });
@@ -238,10 +242,10 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
238
242
  }
239
243
  });
240
244
  });
241
- }, [_, y]), w = p((e) => {
245
+ }, [_, y]), w = m((e) => {
242
246
  I && (S(!1), b(!0));
243
247
  const a = g[e], {
244
- level: c
248
+ level: i
245
249
  } = a.metadata, {
246
250
  id: t,
247
251
  marker: s
@@ -256,18 +260,18 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
256
260
  }), _({
257
261
  signal: o,
258
262
  marker: s,
259
- searchInput: m,
260
- level: m === "" ? c + 1 : null,
263
+ searchInput: p,
264
+ level: p === "" ? i + 1 : null,
261
265
  ancestorId: t !== u.id ? t.toString() : null,
262
266
  onlySelectableOptions: !1
263
- }).then((O) => {
264
- const z = O.options.map(y);
267
+ }).then((N) => {
268
+ const z = N.options.map(y);
265
269
  n({
266
270
  type: r.LOAD_SUCCESS,
267
271
  payload: {
268
272
  id: t,
269
273
  items: z,
270
- marker: O.marker
274
+ marker: N.marker
271
275
  }
272
276
  }), b(!1);
273
277
  }).catch(() => {
@@ -279,34 +283,34 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
279
283
  }
280
284
  });
281
285
  });
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) => {
286
+ }, [_, I, y, p, g]), Q = h.nodes.length === 0 || h.nodes[0].children.length === 0 && h.nodes[0].id === u.id, X = m((e) => {
283
287
  const {
284
288
  metadata: a
285
289
  } = 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, {
290
+ ae(a) && f.includes(a.level) ? d(e) : (e.isSelected = !1, e.treeState.selectedIds.delete(e.element.id));
291
+ }, [f, d]);
292
+ return I ? /* @__PURE__ */ v($, {
289
293
  onReload: () => {
290
294
  w("root");
291
295
  }
292
- }) : /* @__PURE__ */ ne("div", {
293
- children: [N && /* @__PURE__ */ v("div", {
296
+ }) : /* @__PURE__ */ le("div", {
297
+ children: [R && /* @__PURE__ */ v("div", {
294
298
  className: C.noResultOption,
295
- children: /* @__PURE__ */ v(Y, {
299
+ children: /* @__PURE__ */ v(Z, {
296
300
  "aria-label": q,
297
301
  className: C.loadingIndicator
298
302
  })
299
- }), K && !N ? /* @__PURE__ */ v("div", {
303
+ }), Q && !R ? /* @__PURE__ */ v("div", {
300
304
  className: C.noResultOption,
301
305
  children: U
302
- }) : !N && /* @__PURE__ */ v($, {
306
+ }) : !R && /* @__PURE__ */ v(F, {
303
307
  ref: G,
304
308
  "aria-label": l,
305
309
  data: h.nodes,
306
310
  multiSelect: M,
307
- onExpand: J,
311
+ onExpand: K,
308
312
  onLoadData: w,
309
- onNodeSelect: Q,
313
+ onNodeSelect: X,
310
314
  selectedIds: h.selectedIds,
311
315
  size: "large",
312
316
  togglableSelect: !0
@@ -314,6 +318,6 @@ import '../styles/dynamic-loading-tree.css';const le = "_container_z81ug_1", se
314
318
  });
315
319
  });
316
320
  export {
317
- Le as D,
321
+ Ve as D,
318
322
  C as s
319
323
  };
@@ -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": "⟦萬萬萬萬 Ĺòäďĭňğ mõѓê... 國國國國⟧",
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 = ⟦萬萬萬萬 Ĺòäďĭňğ mõѓê... 國國國國⟧
14
+ comboboxWithApiPagination.loadingMoreAriaLabel = ⟦萬萬萬萬 Ŀοäďĩйġ mőřę... 國國國國⟧
15
15
  # Message displayed when no results are found in the combobox
16
- comboboxWithApiPagination.noResults = ⟦萬萬萬萬 Иό ґęśüľŧş ƒóµиď 國國國國⟧
16
+ comboboxWithApiPagination.noResults = ⟦萬萬萬萬 Ňσ ґєşūľŧѕ ƒòųлď 國國國國⟧
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/combobox-with-api",
3
- "version": "0.44.20",
3
+ "version": "0.45.0",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.15",
6
6
  "@box/blueprint-web": "^10.3.1",
@@ -11,11 +11,11 @@
11
11
  "react-intl": "^6.4.2"
12
12
  },
13
13
  "dependencies": {
14
- "@box/tree": "^0.50.10",
14
+ "@box/tree": "^0.51.0",
15
15
  "react-accessible-treeview": "2.9.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@box/blueprint-web": "^12.15.0",
18
+ "@box/blueprint-web": "^12.16.0",
19
19
  "@box/blueprint-web-assets": "^4.54.0",
20
20
  "@box/storybook-utils": "^0.13.7",
21
21
  "react": "^18.3.0",