@box/combobox-with-api 0.40.4 → 0.41.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,17 +1,17 @@
1
- import L from "lodash/debounce";
2
- import { useState as e, useMemo as S, useCallback as V, useEffect as T } from "react";
1
+ import { useState as e, useMemo as L, useCallback as S, useEffect as V } from "react";
2
+ import T from "lodash/debounce";
3
3
  import { ComboboxWithApi as w } from "./combobox-with-api.js";
4
4
  import { jsx as Q } from "react/jsx-runtime";
5
5
  const W = "AbortError", _ = (b) => {
6
6
  const {
7
7
  debounceTime: l = 250,
8
8
  fetcher: u,
9
- onInputValueChange: s,
10
9
  includeTextInputOption: f = !1,
10
+ onInputValueChange: s,
11
11
  ...h
12
- } = b, [m, p] = e(!1), [d, y] = e(!1), [E, g] = e(!1), [o, x] = e(""), [A, r] = e([]), i = S(() => L(x, l), [l]), C = (n) => {
12
+ } = b, [m, p] = e(!1), [d, y] = e(!1), [E, g] = e(!1), [o, x] = e(""), [A, r] = e([]), i = L(() => T(x, l), [l]), C = (n) => {
13
13
  i(n), s == null || s(n);
14
- }, a = V(async (n) => {
14
+ }, a = S(async (n) => {
15
15
  const c = n.trim();
16
16
  if (c) {
17
17
  y(!1), p(!0);
@@ -31,7 +31,7 @@ const W = "AbortError", _ = (b) => {
31
31
  }, [u, f]), I = () => {
32
32
  a(o);
33
33
  };
34
- return T(() => (o.trim().length ? a(o) : (r([]), g(!1)), () => i.cancel()), [i, a, o]), /* @__PURE__ */ Q(w, {
34
+ return V(() => (o.trim().length ? a(o) : (r([]), g(!1)), () => i.cancel()), [i, a, o]), /* @__PURE__ */ Q(w, {
35
35
  ...h,
36
36
  isEmpty: E,
37
37
  isError: d,
@@ -1,19 +1,19 @@
1
- import { Combobox as f } from "@box/blueprint-web";
1
+ import { useMemo as f } from "react";
2
2
  import v from "lodash/uniqBy";
3
- import { useMemo as b } from "react";
3
+ import { Combobox as b } from "@box/blueprint-web";
4
4
  import g from "./combobox-with-api-error.js";
5
5
  import { jsx as n } from "react/jsx-runtime";
6
6
  const h = (m) => {
7
7
  const {
8
- isError: u,
9
- isEmpty: p,
8
+ isEmpty: u,
9
+ isError: p,
10
10
  isLoading: r,
11
11
  noResultMessage: i,
12
- options: t,
13
12
  onTryAgain: a,
13
+ options: t,
14
14
  value: e,
15
15
  ...l
16
- } = m, c = b(() => {
16
+ } = m, c = f(() => {
17
17
  if (Array.isArray(e)) {
18
18
  const d = [...t, ...e].reverse();
19
19
  return v(d, (s) => (typeof s == "string" ? s : s.value).toLocaleLowerCase().trim()).reverse();
@@ -21,9 +21,9 @@ const h = (m) => {
21
21
  return t;
22
22
  }, [t, e]);
23
23
  let o;
24
- return u && !r ? o = /* @__PURE__ */ n(g, {
24
+ return p && !r ? o = /* @__PURE__ */ n(g, {
25
25
  onTryAgain: a
26
- }) : p && i && !r ? o = i : o = void 0, /* @__PURE__ */ n(f, {
26
+ }) : u && i && !r ? o = i : o = void 0, /* @__PURE__ */ n(b, {
27
27
  ...l,
28
28
  hideSelectedOptions: !0,
29
29
  loading: r,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/combobox-with-api",
3
- "version": "0.40.4",
3
+ "version": "0.41.0",
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.48.11",
14
+ "@box/tree": "^0.48.12",
15
15
  "react-accessible-treeview": "2.9.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@box/blueprint-web": "^12.4.0",
19
- "@box/blueprint-web-assets": "^4.47.0",
20
- "@box/storybook-utils": "^0.12.6",
18
+ "@box/blueprint-web": "^12.5.0",
19
+ "@box/blueprint-web-assets": "^4.47.2",
20
+ "@box/storybook-utils": "^0.13.0",
21
21
  "react": "^18.3.0",
22
22
  "react-dom": "^18.3.0"
23
23
  },