@box/combobox-with-api 0.37.0 → 0.38.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,145 +1,147 @@
1
- import { useComboboxStore as G, ComboboxProvider as X, PopoverAnchor as q, Combobox as H, ComboboxCancel as J, ComboboxPopover as K } from "@ariakit/react";
2
- import { useLabelable as Q, ChipsGroup as U, InputChip as Y, IconButton as Z } from "@box/blueprint-web";
3
- import { XMark as _, Search as $ } from "@box/blueprint-web-assets/icons/Fill";
4
- import { IconIconOnLightSecondary as ee, Size6 as g, Size1 as oe } from "@box/blueprint-web-assets/tokens/tokens";
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
5
  import p from "clsx";
6
- import { forwardRef as le, useId as te, useState as V, useRef as ae, useCallback as se } from "react";
7
- import { useIntl as re } from "react-intl";
8
- import I from "../combobox-with-api-pagination/messages.js";
9
- import { useControllableState as ne } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
10
- import { s as l, D as ie } from "../../../../chunks/dynamic-loading-tree.js";
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
11
  import { jsxs as r, jsx as o } from "react/jsx-runtime";
12
- const ce = () => /* @__PURE__ */ o($, {
13
- color: ee,
12
+ const ue = () => /* @__PURE__ */ o(ee, {
13
+ color: oe,
14
14
  height: g,
15
15
  role: "presentation",
16
16
  style: {
17
- padding: oe,
17
+ padding: te,
18
18
  boxSizing: "border-box"
19
19
  },
20
20
  width: g
21
- }), Se = /* @__PURE__ */ le(function(S, me) {
21
+ }), we = /* @__PURE__ */ le(function(S, pe) {
22
22
  const {
23
- defaultFetcher: w,
24
- value: L,
25
- onValueChange: N,
26
- noResultMessage: y,
27
- defaultValue: A = [],
28
- loadingAriaLabel: R,
29
- multiselect: b = !1,
30
- className: B,
31
- levels: z,
32
- selectableLevels: M,
33
- label: O,
23
+ className: w,
24
+ dataTargetId: L,
25
+ defaultFetcher: N,
26
+ defaultValue: y = [],
27
+ disabled: A,
34
28
  hideLabel: d,
35
- treeAriaLabel: P,
36
- portalElement: W,
37
- placeholder: k,
38
- disabled: 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
39
40
  } = S, {
40
41
  formatMessage: h
41
- } = re(), n = te(), [f, T] = V(!1), [t, i] = ne({
42
- prop: L,
43
- defaultProp: A,
44
- onChange: N
45
- }), [x, c] = V(""), j = ae(null), E = se((e) => {
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) => {
46
47
  c(e);
47
- }, [c]), u = G({
48
+ }, [c]), u = X({
48
49
  includesBaseElement: !0,
49
50
  virtualFocus: !1,
50
51
  value: x,
51
- setValue: E,
52
+ setValue: F,
52
53
  open: f,
53
- setOpen: T
54
- }), C = t.length > 0, v = t.length > 0, F = Q(O, n);
55
- return /* @__PURE__ */ r(X, {
54
+ setOpen: j
55
+ }), C = l.length > 0, v = l.length > 0, G = U(R, n);
56
+ return /* @__PURE__ */ r(q, {
56
57
  store: u,
57
- children: [/* @__PURE__ */ o(q, {
58
+ children: [/* @__PURE__ */ o(H, {
58
59
  children: /* @__PURE__ */ r("div", {
59
- className: p(l.container, B),
60
- children: [/* @__PURE__ */ o(F, {
61
- className: p(l.label, {
62
- [l.hiddenLabel]: d
60
+ className: p(t.container, w),
61
+ children: [/* @__PURE__ */ o(G, {
62
+ className: p(t.label, {
63
+ [t.hiddenLabel]: d
63
64
  }),
64
65
  hideLabel: d
65
66
  }), /* @__PURE__ */ r("div", {
66
- className: p(l.comboboxContainer, {
67
- [l.withChips]: v,
68
- [l.withComboboxButtons]: C
67
+ className: p(t.comboboxContainer, {
68
+ [t.withChips]: v,
69
+ [t.withComboboxButtons]: C
69
70
  }),
70
- children: [v && /* @__PURE__ */ o(U, {
71
- children: t.map((e) => /* @__PURE__ */ o(Y, {
71
+ children: [v && /* @__PURE__ */ o(Y, {
72
+ children: l.map((e) => /* @__PURE__ */ o(Z, {
72
73
  label: e.displayValue,
73
74
  onDelete: () => {
74
- const a = t.filter((s) => s.value !== e.value);
75
+ const a = l.filter((s) => s.value !== e.value);
75
76
  i(a);
76
77
  },
77
78
  tooltip: e.displayValue
78
79
  }, e.value))
79
80
  }), /* @__PURE__ */ r("div", {
80
- className: l.textInputWrapper,
81
- children: [/* @__PURE__ */ o(H, {
82
- ref: j,
83
- className: l.textInput,
84
- disabled: D,
81
+ className: t.textInputWrapper,
82
+ children: [/* @__PURE__ */ o(J, {
83
+ ref: E,
84
+ className: t.textInput,
85
+ "data-target-id": L,
86
+ disabled: A,
85
87
  id: n,
86
- placeholder: k,
88
+ placeholder: P,
87
89
  store: u
88
90
  }), /* @__PURE__ */ o("div", {
89
- className: l.comboboxButtons,
90
- children: C ? /* @__PURE__ */ o(J, {
91
+ className: t.comboboxButtons,
92
+ children: C ? /* @__PURE__ */ o(K, {
91
93
  onClick: () => {
92
94
  i([]);
93
95
  },
94
- render: (e) => /* @__PURE__ */ o(Z, {
96
+ render: (e) => /* @__PURE__ */ o(_, {
95
97
  ...e,
96
98
  "aria-label": "Clear selection",
97
- icon: _,
99
+ icon: $,
98
100
  size: "x-small"
99
101
  }),
100
102
  store: u
101
- }) : /* @__PURE__ */ o(ce, {})
103
+ }) : /* @__PURE__ */ o(ue, {})
102
104
  })]
103
105
  })]
104
106
  })]
105
107
  })
106
- }), /* @__PURE__ */ o(K, {
108
+ }), /* @__PURE__ */ o(Q, {
107
109
  "aria-labelledby": n,
108
- className: l.popover,
110
+ className: t.popover,
109
111
  fitViewport: !0,
110
112
  gutter: 8,
111
113
  modal: !0,
112
114
  portal: !0,
113
- portalElement: W,
115
+ portalElement: T,
114
116
  sameWidth: !0,
115
- children: /* @__PURE__ */ o(ie, {
116
- ariaLabel: P,
117
- defaultFetcher: w,
118
- levels: z,
119
- loadingAriaLabel: R || h(I.loadingAriaLabel),
117
+ children: /* @__PURE__ */ o(ce, {
118
+ ariaLabel: k,
119
+ defaultFetcher: N,
120
+ levels: B,
121
+ loadingAriaLabel: z || h(V.loadingAriaLabel),
120
122
  multiselect: b,
121
- noResultMessage: y || h(I.noResults),
123
+ noResultMessage: M || h(V.noResults),
122
124
  onSelect: (e) => {
123
125
  const {
124
126
  metadata: a
125
127
  } = e.element;
126
128
  let s = [];
127
- e.isSelected ? (b && (s = t.filter((m) => m.value !== e.element.id)), s.push({
129
+ e.isSelected ? (b && (s = l.filter((m) => m.value !== e.element.id)), s.push({
128
130
  value: e.element.id,
129
131
  displayValue: a.displayValue,
130
132
  level: a.level,
131
133
  selectable: a.selectable,
132
134
  ancestors: a.ancestors
133
- })) : s = t.filter((m) => m.value !== e.element.id), i(s), c("");
135
+ })) : s = l.filter((m) => m.value !== e.element.id), i(s), c("");
134
136
  },
135
137
  open: f,
136
138
  searchInput: x.trimStart(),
137
- selectableLevels: M,
138
- selectedNodes: t.map((e) => e.value)
139
+ selectableLevels: W,
140
+ selectedNodes: l.map((e) => e.value)
139
141
  })
140
142
  })]
141
143
  });
142
144
  });
143
145
  export {
144
- Se as ComboboxWithApiTreeView
146
+ we as ComboboxWithApiTreeView
145
147
  };
@@ -14,4 +14,5 @@ export declare const ComboboxWithApiPagination: import('react').ForwardRefExotic
14
14
  portalElement?: HTMLElement | (() => HTMLElement);
15
15
  experimentalVirtualization?: boolean;
16
16
  className?: string;
17
+ dataTargetId?: string;
17
18
  } & import('@box/blueprint-web').Labelable & import('react').RefAttributes<HTMLInputElement>>;
@@ -46,4 +46,5 @@ export type ComboboxWithApiPaginationProps<T extends BaseOptionType> = {
46
46
  portalElement?: HTMLElement | (() => HTMLElement);
47
47
  experimentalVirtualization?: boolean;
48
48
  className?: string;
49
+ dataTargetId?: string;
49
50
  } & Labelable;
@@ -18,4 +18,5 @@ export declare const ComboboxWithApiTreeView: import('react').ForwardRefExoticCo
18
18
  className?: string;
19
19
  hideLabel?: boolean;
20
20
  treeAriaLabel?: string;
21
+ dataTargetId?: string;
21
22
  } & import('@box/blueprint-web').Labelable & import('react').RefAttributes<HTMLInputElement>>;
@@ -57,4 +57,5 @@ export type ComboboxWithApiTreeViewProps<T extends TreeOptionType> = {
57
57
  className?: string;
58
58
  hideLabel?: boolean;
59
59
  treeAriaLabel?: string;
60
+ dataTargetId?: string;
60
61
  } & Labelable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/combobox-with-api",
3
- "version": "0.37.0",
3
+ "version": "0.38.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.48.0",
14
+ "@box/tree": "^0.48.2",
15
15
  "react-accessible-treeview": "2.9.0"
16
16
  },
17
17
  "devDependencies": {
18
- "@box/blueprint-web": "^11.12.0",
18
+ "@box/blueprint-web": "^12.1.0",
19
19
  "@box/blueprint-web-assets": "^4.44.0",
20
20
  "@box/storybook-utils": "^0.12.3",
21
21
  "react": "^18.3.0",