@box/combobox-with-api 0.51.31 → 0.52.1

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,48 +1,48 @@
1
- import { ComboboxItemValue as re } from "@ariakit/react";
2
- import { Combobox as m, useForkRef as ne, LoadingIndicator as ae, InlineNotice as ie, Text as se } from "@box/blueprint-web";
3
- import { Search as le, Loader as ce } from "@box/blueprint-web-assets/icons/Fill";
4
- import { IconIconOnLightSecondary as ue, Size6 as T, Size1 as de } from "@box/blueprint-web-assets/tokens/tokens";
5
- import S from "clsx";
6
- import { forwardRef as F, useRef as R, useCallback as me, useMemo as C, useEffect as pe } from "react";
7
- import { useIntl as P, FormattedMessage as V } from "react-intl";
1
+ import { ComboboxItemValue as ce } from "@ariakit/react";
2
+ import { Combobox as m, useForkRef as ue, LoadingIndicator as de, InlineNotice as pe, Text as me } from "@box/blueprint-web";
3
+ import { Search as fe, Loader as he } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { IconIconOnLightSecondary as ge, Size6 as V, Size1 as be } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import N from "clsx";
6
+ import { forwardRef as B, useRef as A, useState as xe, useCallback as k, useMemo as C, useEffect as Oe } from "react";
7
+ import { useIntl as W, FormattedMessage as F } from "react-intl";
8
8
  import a from "./messages.js";
9
- import { useAsyncList as he } from "./use-async-list.js";
10
- import { useControllableState as fe } from "./utils/use-controllable-state.js";
11
- import { useTrackVisibility as ge } from "./utils/use-intersection-observer.js";
12
- import { jsx as r, jsxs as N, Fragment as be } from "react/jsx-runtime";
13
- import '../../../../styles/combobox-with-api-pagination.css';const xe = "_container_syvk5_1", Oe = "_disabled_syvk5_7", _e = "_highlightOptionText_syvk5_11", ye = "_selected_syvk5_23", ve = "_option_syvk5_34", Re = "_errorComboboxOption_syvk5_38", Ce = "_errorComboboxOptionText_syvk5_43", s = {
14
- container: xe,
15
- disabled: Oe,
16
- highlightOptionText: _e,
17
- selected: ye,
18
- option: ve,
19
- errorComboboxOption: Re,
20
- errorComboboxOptionText: Ce
21
- }, k = /* @__PURE__ */ F(({
22
- onTryAgain: E
23
- }, p) => {
9
+ import { useAsyncList as _e } from "./use-async-list.js";
10
+ import { useControllableState as ye } from "./utils/use-controllable-state.js";
11
+ import { useTrackVisibility as ve } from "./utils/use-intersection-observer.js";
12
+ import { jsx as r, jsxs as P, Fragment as Re } from "react/jsx-runtime";
13
+ import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_container_syvk5_1", Ce = "_disabled_syvk5_7", Le = "_highlightOptionText_syvk5_11", Ee = "_selected_syvk5_23", Ie = "_option_syvk5_34", Me = "_errorComboboxOption_syvk5_38", Te = "_errorComboboxOptionText_syvk5_43", c = {
14
+ container: Ae,
15
+ disabled: Ce,
16
+ highlightOptionText: Le,
17
+ selected: Ee,
18
+ option: Ie,
19
+ errorComboboxOption: Me,
20
+ errorComboboxOptionText: Te
21
+ }, D = /* @__PURE__ */ B(({
22
+ onTryAgain: I
23
+ }, f) => {
24
24
  const {
25
25
  formatMessage: h
26
- } = P();
27
- return /* @__PURE__ */ N(be, {
28
- children: [/* @__PURE__ */ r(ie, {
26
+ } = W();
27
+ return /* @__PURE__ */ P(Re, {
28
+ children: [/* @__PURE__ */ r(pe, {
29
29
  variant: "error",
30
30
  variantIconAriaLabel: h(a.loadingResultsErrorIconLabel),
31
- children: /* @__PURE__ */ r(V, {
31
+ children: /* @__PURE__ */ r(F, {
32
32
  ...a.loadingResultsErrorMessage
33
33
  })
34
34
  }), /* @__PURE__ */ r(m.Option, {
35
- ref: p,
36
- className: s.errorComboboxOption,
37
- onClick: E,
38
- children: /* @__PURE__ */ N(se, {
35
+ ref: f,
36
+ className: c.errorComboboxOption,
37
+ onClick: I,
38
+ children: /* @__PURE__ */ P(me, {
39
39
  as: "span",
40
- className: s.errorComboboxOptionText,
40
+ className: c.errorComboboxOptionText,
41
41
  color: "textOnLightLink",
42
42
  variant: "bodyDefaultBold",
43
- children: [/* @__PURE__ */ r(V, {
43
+ children: [/* @__PURE__ */ r(F, {
44
44
  ...a.loadingResultsErrorAction
45
- }), /* @__PURE__ */ r(ce, {
45
+ }), /* @__PURE__ */ r(he, {
46
46
  color: "currentColor",
47
47
  height: "12px",
48
48
  width: "12px"
@@ -50,162 +50,168 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
50
50
  })
51
51
  })]
52
52
  });
53
- }), A = "__LOADING__", L = "__LOADING_ERROR__", Ae = "0px 0px 20px 0px", Le = /* @__PURE__ */ r(le, {
54
- color: ue,
55
- height: T,
53
+ }), L = "__LOADING__", E = "__LOADING_ERROR__", Se = "0px 0px 20px 0px", Ve = /* @__PURE__ */ r(fe, {
54
+ color: ge,
55
+ height: V,
56
56
  role: "presentation",
57
57
  style: {
58
- padding: de,
58
+ padding: be,
59
59
  boxSizing: "border-box"
60
60
  },
61
- width: T
62
- }), we = /* @__PURE__ */ F(function(p, h) {
61
+ width: V
62
+ }), qe = /* @__PURE__ */ B(function(f, h) {
63
63
  const {
64
- dataTargetId: D,
65
- defaultFetcher: B,
66
- onInputValueChange: f,
67
- value: w,
68
- onValueChange: W,
69
- noResultMessage: z,
70
- defaultValue: G = [],
71
- loadingAriaLabel: j,
72
- multiselect: l = !1,
73
- disabled: U,
74
- className: q,
75
- displaySingleSelectionAsChip: g = !0,
76
- ...H
77
- } = p, {
78
- formatMessage: u
79
- } = P(), b = R(null), x = R(!0), e = he({
64
+ dataTargetId: w,
65
+ defaultFetcher: z,
66
+ initialOpen: G = !1,
67
+ onInputValueChange: g,
68
+ value: j,
69
+ onValueChange: U,
70
+ onOpenChange: s,
71
+ noResultMessage: q,
72
+ defaultValue: H = [],
73
+ loadingAriaLabel: J,
74
+ multiselect: i = !1,
75
+ disabled: K,
76
+ className: Q,
77
+ displaySingleSelectionAsChip: b = !0,
78
+ ...X
79
+ } = f, {
80
+ formatMessage: d
81
+ } = W(), x = A(null), O = A(!0), [Y, M] = xe(G), o = _e({
80
82
  async load({
81
- marker: o,
83
+ marker: e,
82
84
  searchInput: t,
83
- signal: v
85
+ signal: R
84
86
  }) {
85
- const c = await B({
86
- signal: v,
87
- marker: o,
87
+ const u = await z({
88
+ signal: R,
89
+ marker: e,
88
90
  searchInput: t
89
91
  });
90
92
  return {
91
- items: c.options,
92
- marker: c.marker
93
+ items: u.options,
94
+ marker: u.marker
93
95
  };
94
96
  }
95
- }), I = R(!1), J = me(() => {
96
- I.current || (e.reload(), I.current = !0);
97
- }, []), [n, O] = fe({
98
- prop: w,
99
- defaultProp: G,
100
- onChange: W
101
- }), _ = !l && n.length === 1, K = (o) => {
102
- o === void 0 ? (O([]), (!x.current || !g) && (e.search(""), x.current = !0)) : Array.isArray(o) ? O(o) : O([o]);
103
- }, Q = C(() => n.length === 0 ? l ? [] : void 0 : l ? n : n[0], [l, n]), y = C(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), X = (o) => {
97
+ }), T = A(!1), Z = k(() => {
98
+ T.current || (o.reload(), T.current = !0);
99
+ }, []), [n, _] = ye({
100
+ prop: j,
101
+ defaultProp: H,
102
+ onChange: U
103
+ }), y = !i && n.length === 1, $ = k((e) => {
104
+ M(e), s == null || s(e);
105
+ }, [s]), ee = (e) => {
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 = C(() => n.length === 0 ? i ? [] : void 0 : i ? n : n[0], [i, n]), v = C(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), te = (e) => {
104
108
  const {
105
109
  value: t,
106
- displayValue: v,
107
- ...c
108
- } = o;
109
- if (t === A)
110
- return e.hasNextPage ? /* @__PURE__ */ r(m.Option, {
111
- ...c,
112
- ref: $,
110
+ displayValue: R,
111
+ ...u
112
+ } = e;
113
+ if (t === L)
114
+ return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
115
+ ...u,
116
+ ref: se,
113
117
  disabled: !0,
114
118
  value: t,
115
- children: /* @__PURE__ */ r(ae, {
116
- "aria-label": u(a.loadingMoreAriaLabel),
119
+ children: /* @__PURE__ */ r(de, {
120
+ "aria-label": d(a.loadingMoreAriaLabel),
117
121
  style: {
118
122
  position: "unset"
119
123
  }
120
124
  })
121
125
  }) : null;
122
- if (t === L && e.hasError && !e.isEmpty)
123
- return /* @__PURE__ */ r(k, {
126
+ if (t === E && o.hasError && !o.isEmpty)
127
+ return /* @__PURE__ */ r(D, {
124
128
  onTryAgain: () => {
125
- var i;
126
- e.loadMore(), (i = b.current) == null || i.focus();
129
+ var l;
130
+ o.loadMore(), (l = x.current) == null || l.focus();
127
131
  }
128
132
  });
129
- if (y.some((i) => i.value === t))
133
+ if (v.some((l) => l.value === t))
130
134
  return null;
131
- const te = n.some((i) => i.value === t);
135
+ const le = n.some((l) => l.value === t);
132
136
  return /* @__PURE__ */ r(m.Option, {
133
- ...c,
134
- className: s.option,
137
+ ...u,
138
+ className: c.option,
135
139
  value: t,
136
- children: /* @__PURE__ */ r(re, {
137
- className: S(s.highlightOptionText, te && s.selected),
138
- value: v || t
140
+ children: /* @__PURE__ */ r(ce, {
141
+ className: N(c.highlightOptionText, le && c.selected),
142
+ value: R || t
139
143
  })
140
144
  });
141
- }, Y = (o) => {
142
- if (f == null || f(o), _ && o === "") {
143
- x.current = !1;
145
+ }, re = (e) => {
146
+ if (g == null || g(e), y && e === "") {
147
+ O.current = !1;
144
148
  return;
145
149
  }
146
- e.search(o);
147
- }, Z = () => {
148
- var o;
149
- e.reload(), (o = b.current) == null || o.focus();
150
+ o.search(e);
151
+ }, ne = () => {
152
+ var e;
153
+ o.reload(), (e = x.current) == null || e.focus();
150
154
  };
151
- let d;
152
- e.hasError && !e.isLoading ? d = /* @__PURE__ */ r(k, {
153
- onTryAgain: Z
154
- }) : e.isEmpty && !e.isLoading ? d = z || u(a.noResults) : d = void 0;
155
- const [$, {
156
- rootRef: ee,
157
- isVisible: M
158
- }] = ge({
159
- rootMargin: Ae
155
+ let p;
156
+ o.hasError && !o.isLoading ? p = /* @__PURE__ */ r(D, {
157
+ onTryAgain: ne
158
+ }) : o.isEmpty && !o.isLoading ? p = q || d(a.noResults) : p = void 0;
159
+ const [se, {
160
+ rootRef: ae,
161
+ isVisible: S
162
+ }] = ve({
163
+ rootMargin: Se
160
164
  });
161
- pe(() => {
162
- if (!(M && e.hasNextPage))
165
+ Oe(() => {
166
+ if (!(S && o.hasNextPage))
163
167
  return;
164
168
  const t = setTimeout(() => {
165
- e.loadMore();
169
+ o.loadMore();
166
170
  }, 100);
167
171
  return () => {
168
172
  clearTimeout(t);
169
173
  };
170
- }, [M]);
171
- const oe = C(() => {
172
- const o = e.hasNextPage ? {
173
- displayValue: A,
174
- value: A
175
- } : null, t = !o && e.hasError && !e.isEmpty ? {
174
+ }, [S]);
175
+ const ie = C(() => {
176
+ const e = o.hasNextPage ? {
176
177
  displayValue: L,
177
178
  value: L
179
+ } : null, t = !e && o.hasError && !o.isEmpty ? {
180
+ displayValue: E,
181
+ value: E
178
182
  } : null;
179
- return [...e.items, ...y, o, t].filter(Boolean);
180
- }, [e.hasNextPage, e.hasError, e.isEmpty, e.items, y]);
183
+ return [...o.items, ...v, e, t].filter(Boolean);
184
+ }, [o.hasNextPage, o.hasError, o.isEmpty, o.items, v]);
181
185
  return /* @__PURE__ */ r(m, {
182
- ...H,
183
- ref: ne(b, h),
186
+ ...X,
187
+ ref: ue(x, h),
184
188
  as: "input",
185
- className: S({
186
- [s.disabled]: _
187
- }, q),
188
- clearButtonAriaLabel: u(a.clearButtonAriaLabel),
189
+ className: N({
190
+ [c.disabled]: y
191
+ }, Q),
192
+ clearButtonAriaLabel: d(a.clearButtonAriaLabel),
189
193
  clearOnBlur: !1,
190
- "data-target-id": D,
191
- disabled: U || _ && g,
192
- displaySingleSelectionAsChip: g,
193
- displayValue: (o) => o.displayValue || o.value,
194
- endComboboxIcon: Le,
194
+ "data-target-id": w,
195
+ disabled: K || y && b,
196
+ displaySingleSelectionAsChip: b,
197
+ displayValue: (e) => e.displayValue || e.value,
198
+ endComboboxIcon: Ve,
195
199
  focusLoop: !1,
196
- getPopoverRef: ee,
197
- loading: e.isReloading,
198
- loadingAriaLabel: j || u(a.loadingAriaLabel),
199
- multiselect: l,
200
- noResultMessage: d,
201
- onFocus: J,
202
- onInputValueChange: Y,
203
- onValueChange: K,
204
- options: oe,
205
- renderOption: X,
206
- value: Q
200
+ getPopoverRef: ae,
201
+ loading: o.isReloading,
202
+ loadingAriaLabel: J || d(a.loadingAriaLabel),
203
+ multiselect: i,
204
+ noResultMessage: p,
205
+ onFocus: Z,
206
+ onInputValueChange: re,
207
+ onOpenChange: $,
208
+ onValueChange: ee,
209
+ open: Y,
210
+ options: ie,
211
+ renderOption: te,
212
+ value: oe
207
213
  });
208
214
  });
209
215
  export {
210
- we as ComboboxWithApiPagination
216
+ qe as ComboboxWithApiPagination
211
217
  };
@@ -1,156 +1,161 @@
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,
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
+ import { useLabelable as ee, ChipsGroup as oe, InputChip as te, IconButton as le } from "@box/blueprint-web";
3
+ import { XMark as ae, Search as se } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { IconIconOnLightSecondary as re, Size6 as w, Size1 as ne } from "@box/blueprint-web-assets/tokens/tokens";
5
+ import d from "clsx";
6
+ import { forwardRef as ie, useId as ce, useState as L, useRef as y } from "react";
7
+ import { useIntl as ue } from "react-intl";
8
+ import N from "../combobox-with-api-pagination/messages.js";
9
+ import { useControllableState as me } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
10
+ import { s as a, D as pe } from "../../../../chunks/dynamic-loading-tree.js";
11
+ import { jsxs as n, jsx as l } from "react/jsx-runtime";
12
+ const de = () => /* @__PURE__ */ l(se, {
13
+ color: re,
14
+ height: w,
15
15
  role: "presentation",
16
16
  style: {
17
- padding: se,
17
+ padding: ne,
18
18
  boxSizing: "border-box"
19
19
  },
20
- width: V
21
- }), ye = /* @__PURE__ */ re(function(y, de) {
20
+ width: w
21
+ }), Re = /* @__PURE__ */ ie(function(A, he) {
22
22
  const {
23
- className: N,
24
- dataTargetId: A,
25
- defaultFetcher: R,
26
- defaultValue: B = [],
27
- disabled: k,
28
- hideLabel: d,
29
- label: z,
30
- levels: D,
31
- loadingAriaLabel: M,
23
+ className: R,
24
+ closeOnSelection: O = !1,
25
+ dataTargetId: B,
26
+ defaultFetcher: z,
27
+ defaultValue: D = [],
28
+ disabled: M,
29
+ hideLabel: b,
30
+ initialOpen: P = !1,
31
+ label: T,
32
+ levels: W,
33
+ loadingAriaLabel: k,
32
34
  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, {
35
+ noResultMessage: E,
36
+ onValueChange: F,
37
+ onOpenChange: i,
38
+ placeholder: j,
39
+ portalElement: G,
40
+ selectableLevels: K,
41
+ treeAriaLabel: U,
42
+ value: X
43
+ } = A, {
41
44
  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({
45
+ } = ue(), c = ce(), [C, g] = L(P), [s, u] = me({
46
+ prop: X,
47
+ defaultProp: D,
48
+ onChange: F
49
+ }), [x, v] = L(""), V = y(null), m = H({
49
50
  includesBaseElement: !0,
50
51
  virtualFocus: !1,
51
52
  value: x,
52
- setValue: K,
53
+ setValue: (e) => {
54
+ v(e);
55
+ },
53
56
  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
+ setOpen: (e) => {
58
+ g(e), i == null || i(e);
59
+ }
60
+ }), I = s.length > 0, S = s.length > 0, q = ee(T, c), p = y(null);
61
+ return /* @__PURE__ */ n(J, {
57
62
  store: m,
58
- children: [/* @__PURE__ */ t(H, {
63
+ children: [/* @__PURE__ */ l(Q, {
59
64
  children: /* @__PURE__ */ n("div", {
60
- className: b(a.container, N),
61
- children: [/* @__PURE__ */ t(U, {
62
- className: b(a.label, {
63
- [a.hiddenLabel]: d
65
+ className: d(a.container, R),
66
+ children: [/* @__PURE__ */ l(q, {
67
+ className: d(a.label, {
68
+ [a.hiddenLabel]: b
64
69
  }),
65
- hideLabel: d
70
+ hideLabel: b
66
71
  }), /* @__PURE__ */ n("div", {
67
- className: b(a.comboboxContainer, {
68
- [a.withChips]: I,
69
- [a.withComboboxButtons]: g
72
+ className: d(a.comboboxContainer, {
73
+ [a.withChips]: S,
74
+ [a.withComboboxButtons]: I
70
75
  }),
71
- children: [I && /* @__PURE__ */ t($, {
72
- children: s.map((e) => /* @__PURE__ */ t(ee, {
76
+ children: [S && /* @__PURE__ */ l(oe, {
77
+ children: s.map((e) => /* @__PURE__ */ l(te, {
73
78
  label: e.displayValue,
74
79
  onDelete: () => {
75
- const o = s.filter((l) => l.value !== e.value);
76
- c(o);
80
+ const o = s.filter((t) => t.value !== e.value);
81
+ u(o);
77
82
  },
78
83
  tooltip: e.displayValue
79
84
  }, e.value))
80
85
  }), /* @__PURE__ */ n("div", {
81
86
  className: a.textInputWrapper,
82
- children: [/* @__PURE__ */ t(J, {
83
- ref: v,
87
+ children: [/* @__PURE__ */ l(Y, {
88
+ ref: V,
84
89
  "aria-haspopup": "tree",
85
90
  className: a.textInput,
86
- "data-target-id": A,
87
- disabled: k,
88
- id: i,
89
- placeholder: T,
91
+ "data-target-id": B,
92
+ disabled: M,
93
+ id: c,
94
+ placeholder: j,
90
95
  store: m
91
- }), /* @__PURE__ */ t("div", {
96
+ }), /* @__PURE__ */ l("div", {
92
97
  className: a.comboboxButtons,
93
- children: g ? /* @__PURE__ */ t(Q, {
98
+ children: I ? /* @__PURE__ */ l(Z, {
94
99
  onClick: () => {
95
- c([]);
100
+ u([]);
96
101
  },
97
- render: (e) => /* @__PURE__ */ t(oe, {
102
+ render: (e) => /* @__PURE__ */ l(le, {
98
103
  ...e,
99
104
  "aria-label": "Clear selection",
100
- icon: te,
105
+ icon: ae,
101
106
  size: "x-small"
102
107
  }),
103
108
  store: m
104
- }) : /* @__PURE__ */ t(pe, {})
109
+ }) : /* @__PURE__ */ l(de, {})
105
110
  })]
106
111
  })]
107
112
  })]
108
113
  })
109
- }), /* @__PURE__ */ t(Y, {
110
- "aria-labelledby": i,
114
+ }), /* @__PURE__ */ l(_, {
115
+ "aria-labelledby": c,
111
116
  className: a.popover,
112
117
  fitViewport: !0,
113
118
  gutter: 8,
114
119
  portal: !0,
115
- portalElement: W,
120
+ portalElement: G,
116
121
  sameWidth: !0,
117
- children: /* @__PURE__ */ t(Z, {
122
+ children: /* @__PURE__ */ l($, {
118
123
  onFocusVisible: (e) => {
119
- var l;
120
- const o = (l = p.current) == null ? void 0 : l.firstChild;
124
+ var t;
125
+ const o = (t = p.current) == null ? void 0 : t.firstChild;
121
126
  o == null || o.focus();
122
127
  },
123
128
  onKeyDown: (e) => {
124
- var o, l;
129
+ var o, t;
125
130
  if (e.key === "ArrowUp") {
126
131
  const r = (o = p.current) == null ? void 0 : o.firstChild;
127
- document.activeElement === r && (r.blur(), (l = v.current) == null || l.focus());
132
+ document.activeElement === r && (r.blur(), (t = V.current) == null || t.focus());
128
133
  }
129
134
  },
130
- children: /* @__PURE__ */ t(me, {
135
+ children: /* @__PURE__ */ l(pe, {
131
136
  ref: p,
132
- ariaLabel: F,
133
- defaultFetcher: R,
134
- levels: D,
135
- loadingAriaLabel: M || f(L.loadingAriaLabel),
137
+ ariaLabel: U,
138
+ defaultFetcher: z,
139
+ levels: W,
140
+ loadingAriaLabel: k || f(N.loadingAriaLabel),
136
141
  multiselect: h,
137
- noResultMessage: O || f(L.noResults),
142
+ noResultMessage: E || f(N.noResults),
138
143
  onSelect: (e) => {
139
144
  const {
140
145
  metadata: o
141
146
  } = e.element;
142
- let l = [];
143
- e.isSelected ? (h && (l = s.filter((r) => r.value !== e.element.id)), l.push({
147
+ let t = [];
148
+ e.isSelected ? (h && (t = s.filter((r) => r.value !== e.element.id)), t.push({
144
149
  value: e.element.id,
145
150
  displayValue: o.displayValue,
146
151
  level: o.level,
147
152
  selectable: o.selectable,
148
153
  ancestors: o.ancestors
149
- })) : l = s.filter((r) => r.value !== e.element.id), c(l), u("");
154
+ }), O && t.length > s.length && g(!1)) : t = s.filter((r) => r.value !== e.element.id), u(t), v("");
150
155
  },
151
156
  open: C,
152
157
  searchInput: x.trimStart(),
153
- selectableLevels: E,
158
+ selectableLevels: K,
154
159
  selectedNodes: s.map((e) => e.value)
155
160
  })
156
161
  })
@@ -158,5 +163,5 @@ const pe = () => /* @__PURE__ */ t(le, {
158
163
  });
159
164
  });
160
165
  export {
161
- ye as ComboboxWithApiTreeView
166
+ Re as ComboboxWithApiTreeView
162
167
  };
@@ -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": "⟦萬萬萬萬萬萬 ₣äįľεď τσ ļóäď õΡŧίöʼnѕ 國國國國國國⟧",
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 = ⟦萬萬萬萬萬萬 ₣äįľεď τσ ļóäď õΡŧίöʼnѕ 國國國國國國⟧
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 = ⟦萬萬萬萬 Ņσ гěşūļŧś ƒöůńď 國國國國⟧
@@ -7,6 +7,8 @@ export declare const ComboboxWithApiPagination: import('react').ForwardRefExotic
7
7
  onInputValueChange?: (inputValue: string) => void;
8
8
  multiselect?: boolean;
9
9
  onValueChange?: (selectedOptions: BaseOptionType[]) => void;
10
+ onOpenChange?: (isOpen: boolean) => void;
11
+ initialOpen?: boolean;
10
12
  value?: BaseOptionType[];
11
13
  defaultValue?: BaseOptionType[];
12
14
  disabled?: boolean;
@@ -39,6 +39,8 @@ export type ComboboxWithApiPaginationProps<T extends BaseOptionType> = {
39
39
  onInputValueChange?: (inputValue: string) => void;
40
40
  multiselect?: boolean;
41
41
  onValueChange?: (selectedOptions: T[]) => void;
42
+ onOpenChange?: (isOpen: boolean) => void;
43
+ initialOpen?: boolean;
42
44
  value?: T[];
43
45
  defaultValue?: T[];
44
46
  disabled?: boolean;
@@ -9,6 +9,9 @@ export declare const ComboboxWithApiTreeView: import('react').ForwardRefExoticCo
9
9
  onInputValueChange?: (inputValue: string) => void;
10
10
  multiselect?: boolean;
11
11
  onValueChange?: (selectedOptions: TreeOptionType[]) => void;
12
+ onOpenChange?: (isOpen: boolean) => void;
13
+ initialOpen?: boolean;
14
+ closeOnSelection?: boolean;
12
15
  value?: TreeOptionType[];
13
16
  defaultValue?: TreeOptionType[];
14
17
  disabled?: boolean;
@@ -48,6 +48,9 @@ export type ComboboxWithApiTreeViewProps<T extends TreeOptionType> = {
48
48
  onInputValueChange?: (inputValue: string) => void;
49
49
  multiselect?: boolean;
50
50
  onValueChange?: (selectedOptions: T[]) => void;
51
+ onOpenChange?: (isOpen: boolean) => void;
52
+ initialOpen?: boolean;
53
+ closeOnSelection?: boolean;
51
54
  value?: T[];
52
55
  defaultValue?: T[];
53
56
  disabled?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/combobox-with-api",
3
- "version": "0.51.31",
3
+ "version": "0.52.1",
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.56.15",
14
+ "@box/tree": "^0.57.0",
15
15
  "react-accessible-treeview": "2.9.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@box/blueprint-web": "^12.59.0",
18
+ "@box/blueprint-web": "^12.59.1",
19
19
  "@box/blueprint-web-assets": "^4.63.0",
20
20
  "@box/storybook-utils": "^0.13.18",
21
21
  "react": "^18.3.0",