@box/combobox-with-api 0.48.3 → 0.49.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.
@@ -3,7 +3,7 @@ import { Combobox as m, useForkRef as ne, LoadingIndicator as ae, InlineNotice a
3
3
  import { Search as le, Loader as ce } from "@box/blueprint-web-assets/icons/Fill";
4
4
  import { IconIconOnLightSecondary as ue, Size6 as T, Size1 as de } from "@box/blueprint-web-assets/tokens/tokens";
5
5
  import S from "clsx";
6
- import { forwardRef as F, useRef as v, useCallback as me, useMemo as R, useEffect as pe } from "react";
6
+ import { forwardRef as F, useRef as R, useCallback as me, useMemo as C, useEffect as pe } from "react";
7
7
  import { useIntl as P, FormattedMessage as V } from "react-intl";
8
8
  import a from "./messages.js";
9
9
  import { useAsyncList as he } from "./use-async-list.js";
@@ -19,7 +19,7 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
19
19
  errorComboboxOption: Re,
20
20
  errorComboboxOptionText: Ce
21
21
  }, k = /* @__PURE__ */ F(({
22
- onTryAgain: L
22
+ onTryAgain: E
23
23
  }, p) => {
24
24
  const {
25
25
  formatMessage: h
@@ -34,7 +34,7 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
34
34
  }), /* @__PURE__ */ r(m.Option, {
35
35
  ref: p,
36
36
  className: s.errorComboboxOption,
37
- onClick: L,
37
+ onClick: E,
38
38
  children: /* @__PURE__ */ N(se, {
39
39
  as: "span",
40
40
  className: s.errorComboboxOptionText,
@@ -50,7 +50,7 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
50
50
  })
51
51
  })]
52
52
  });
53
- }), C = "__LOADING__", A = "__LOADING_ERROR__", Ae = "0px 0px 20px 0px", Le = /* @__PURE__ */ r(le, {
53
+ }), A = "__LOADING__", L = "__LOADING_ERROR__", Ae = "0px 0px 20px 0px", Le = /* @__PURE__ */ r(le, {
54
54
  color: ue,
55
55
  height: T,
56
56
  role: "presentation",
@@ -72,18 +72,18 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
72
72
  multiselect: l = !1,
73
73
  disabled: U,
74
74
  className: q,
75
- displaySingleSelectionAsChip: E = !0,
75
+ displaySingleSelectionAsChip: g = !0,
76
76
  ...H
77
77
  } = p, {
78
78
  formatMessage: u
79
- } = P(), g = v(null), b = v(!0), e = he({
79
+ } = P(), b = R(null), x = R(!0), e = he({
80
80
  async load({
81
81
  marker: o,
82
82
  searchInput: t,
83
- signal: y
83
+ signal: v
84
84
  }) {
85
85
  const c = await B({
86
- signal: y,
86
+ signal: v,
87
87
  marker: o,
88
88
  searchInput: t
89
89
  });
@@ -92,21 +92,21 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
92
92
  marker: c.marker
93
93
  };
94
94
  }
95
- }), I = v(!1), J = me(() => {
95
+ }), I = R(!1), J = me(() => {
96
96
  I.current || (e.reload(), I.current = !0);
97
- }, []), [n, x] = fe({
97
+ }, []), [n, O] = fe({
98
98
  prop: w,
99
99
  defaultProp: G,
100
100
  onChange: W
101
- }), O = !l && n.length === 1, K = (o) => {
102
- o === void 0 ? (x([]), b.current || (e.search(""), b.current = !0)) : Array.isArray(o) ? x(o) : x([o]);
103
- }, Q = R(() => n.length === 0 ? l ? [] : void 0 : l ? n : n[0], [l, n]), _ = R(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), X = (o) => {
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) => {
104
104
  const {
105
105
  value: t,
106
- displayValue: y,
106
+ displayValue: v,
107
107
  ...c
108
108
  } = o;
109
- if (t === C)
109
+ if (t === A)
110
110
  return e.hasNextPage ? /* @__PURE__ */ r(m.Option, {
111
111
  ...c,
112
112
  ref: $,
@@ -119,14 +119,14 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
119
119
  }
120
120
  })
121
121
  }) : null;
122
- if (t === A && e.hasError && !e.isEmpty)
122
+ if (t === L && e.hasError && !e.isEmpty)
123
123
  return /* @__PURE__ */ r(k, {
124
124
  onTryAgain: () => {
125
125
  var i;
126
- e.loadMore(), (i = g.current) == null || i.focus();
126
+ e.loadMore(), (i = b.current) == null || i.focus();
127
127
  }
128
128
  });
129
- if (_.some((i) => i.value === t))
129
+ if (y.some((i) => i.value === t))
130
130
  return null;
131
131
  const te = n.some((i) => i.value === t);
132
132
  return /* @__PURE__ */ r(m.Option, {
@@ -135,18 +135,18 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
135
135
  value: t,
136
136
  children: /* @__PURE__ */ r(re, {
137
137
  className: S(s.highlightOptionText, te && s.selected),
138
- value: y || t
138
+ value: v || t
139
139
  })
140
140
  });
141
141
  }, Y = (o) => {
142
- if (f == null || f(o), O && o === "") {
143
- b.current = !1;
142
+ if (f == null || f(o), _ && o === "") {
143
+ x.current = !1;
144
144
  return;
145
145
  }
146
146
  e.search(o);
147
147
  }, Z = () => {
148
148
  var o;
149
- e.reload(), (o = g.current) == null || o.focus();
149
+ e.reload(), (o = b.current) == null || o.focus();
150
150
  };
151
151
  let d;
152
152
  e.hasError && !e.isLoading ? d = /* @__PURE__ */ r(k, {
@@ -168,28 +168,28 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
168
168
  clearTimeout(t);
169
169
  };
170
170
  }, [M]);
171
- const oe = R(() => {
171
+ const oe = C(() => {
172
172
  const o = e.hasNextPage ? {
173
- displayValue: C,
174
- value: C
175
- } : null, t = !o && e.hasError && !e.isEmpty ? {
176
173
  displayValue: A,
177
174
  value: A
175
+ } : null, t = !o && e.hasError && !e.isEmpty ? {
176
+ displayValue: L,
177
+ value: L
178
178
  } : null;
179
- return [...e.items, ..._, o, t].filter(Boolean);
180
- }, [e.hasNextPage, e.hasError, e.isEmpty, e.items, _]);
179
+ return [...e.items, ...y, o, t].filter(Boolean);
180
+ }, [e.hasNextPage, e.hasError, e.isEmpty, e.items, y]);
181
181
  return /* @__PURE__ */ r(m, {
182
182
  ...H,
183
- ref: ne(g, h),
183
+ ref: ne(b, h),
184
184
  as: "input",
185
185
  className: S({
186
- [s.disabled]: O
186
+ [s.disabled]: _
187
187
  }, q),
188
188
  clearButtonAriaLabel: u(a.clearButtonAriaLabel),
189
189
  clearOnBlur: !1,
190
190
  "data-target-id": D,
191
- disabled: U || O && E,
192
- displaySingleSelectionAsChip: E,
191
+ disabled: U || _ && g,
192
+ displaySingleSelectionAsChip: g,
193
193
  displayValue: (o) => o.displayValue || o.value,
194
194
  endComboboxIcon: Le,
195
195
  focusLoop: !1,
@@ -1,10 +1,10 @@
1
1
  export default {
2
- "comboboxWithApi.apiError": "⟦萬萬萬萬萬萬萬萬萬萬萬萬 Ċòμĺďŋ'ŧ ļôāď ŕëŝúĺţş. Ĉĺìск ťò ŧяÿ αĝàįη. 國國國國國國國國國國國國⟧",
3
- "comboboxWithApiPagination.clearButtonAriaLabel": "⟦萬萬萬萬萬萬萬 Çĺéåѓ іиΡμŧ ǻʼnď śëĺėćţіóή 國國國國國國國⟧",
4
- "comboboxWithApiPagination.errorAction": "⟦萬 Řëĺøåď 國⟧",
5
- "comboboxWithApiPagination.errorIconLabel": "⟦萬 Ёяґòґ 國⟧",
6
- "comboboxWithApiPagination.errorMessage": "⟦萬萬萬萬萬萬 ₣āĭĺεď ŧõ ļøǻď όΡτîόʼnŝ 國國國國國國⟧",
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 = ⟦萬萬萬萬萬萬萬 Çĺéåѓ іиΡμŧ ǻʼnď śëĺėćţіóή 國國國國國國國⟧
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 = ⟦萬萬萬萬萬萬 ₣āĭĺεď ŧõ ļøǻď όΡτîόʼnŝ 國國國國國國⟧
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.48.3",
3
+ "version": "0.49.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.53.1",
14
+ "@box/tree": "^0.54.0",
15
15
  "react-accessible-treeview": "2.9.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@box/blueprint-web": "^12.25.0",
18
+ "@box/blueprint-web": "^12.26.0",
19
19
  "@box/blueprint-web-assets": "^4.57.0",
20
20
  "@box/storybook-utils": "^0.13.11",
21
21
  "react": "^18.3.0",