@box/combobox-with-api 0.36.0 → 0.36.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.
|
@@ -2,7 +2,7 @@ import { useComboboxStore as G, ComboboxProvider as X, PopoverAnchor as q, Combo
|
|
|
2
2
|
import { useLabelable as Q, ChipsGroup as U, InputChip as Y, IconButton as Z } from "@box/blueprint-web";
|
|
3
3
|
import { XMark as _, Search as $ } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
4
|
import { IconIconOnLightSecondary as ee, Size6 as g, Size1 as oe } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import
|
|
5
|
+
import p from "clsx";
|
|
6
6
|
import { forwardRef as le, useId as te, useState as V, useRef as ae, useCallback as se } from "react";
|
|
7
7
|
import { useIntl as re } from "react-intl";
|
|
8
8
|
import I from "../combobox-with-api-pagination/messages.js";
|
|
@@ -26,44 +26,44 @@ const ce = () => /* @__PURE__ */ o($, {
|
|
|
26
26
|
noResultMessage: y,
|
|
27
27
|
defaultValue: A = [],
|
|
28
28
|
loadingAriaLabel: R,
|
|
29
|
-
multiselect:
|
|
29
|
+
multiselect: b = !1,
|
|
30
30
|
className: B,
|
|
31
31
|
levels: z,
|
|
32
32
|
selectableLevels: M,
|
|
33
33
|
label: O,
|
|
34
|
-
hideLabel:
|
|
34
|
+
hideLabel: d,
|
|
35
35
|
treeAriaLabel: P,
|
|
36
36
|
portalElement: W,
|
|
37
37
|
placeholder: k,
|
|
38
38
|
disabled: D
|
|
39
39
|
} = S, {
|
|
40
|
-
formatMessage:
|
|
41
|
-
} = re(), n = te(), [
|
|
40
|
+
formatMessage: h
|
|
41
|
+
} = re(), n = te(), [f, T] = V(!1), [t, i] = ne({
|
|
42
42
|
prop: L,
|
|
43
43
|
defaultProp: A,
|
|
44
44
|
onChange: N
|
|
45
|
-
}), [
|
|
46
|
-
|
|
47
|
-
}, [
|
|
45
|
+
}), [x, c] = V(""), j = ae(null), E = se((e) => {
|
|
46
|
+
c(e);
|
|
47
|
+
}, [c]), u = G({
|
|
48
48
|
includesBaseElement: !0,
|
|
49
49
|
virtualFocus: !1,
|
|
50
|
-
value:
|
|
50
|
+
value: x,
|
|
51
51
|
setValue: E,
|
|
52
|
-
open:
|
|
52
|
+
open: f,
|
|
53
53
|
setOpen: T
|
|
54
54
|
}), C = t.length > 0, v = t.length > 0, F = Q(O, n);
|
|
55
55
|
return /* @__PURE__ */ r(X, {
|
|
56
|
-
store:
|
|
56
|
+
store: u,
|
|
57
57
|
children: [/* @__PURE__ */ o(q, {
|
|
58
58
|
children: /* @__PURE__ */ r("div", {
|
|
59
|
-
className:
|
|
59
|
+
className: p(l.container, B),
|
|
60
60
|
children: [/* @__PURE__ */ o(F, {
|
|
61
|
-
className:
|
|
62
|
-
[l.hiddenLabel]:
|
|
61
|
+
className: p(l.label, {
|
|
62
|
+
[l.hiddenLabel]: d
|
|
63
63
|
}),
|
|
64
|
-
hideLabel:
|
|
64
|
+
hideLabel: d
|
|
65
65
|
}), /* @__PURE__ */ r("div", {
|
|
66
|
-
className:
|
|
66
|
+
className: p(l.comboboxContainer, {
|
|
67
67
|
[l.withChips]: v,
|
|
68
68
|
[l.withComboboxButtons]: C
|
|
69
69
|
}),
|
|
@@ -84,7 +84,7 @@ const ce = () => /* @__PURE__ */ o($, {
|
|
|
84
84
|
disabled: D,
|
|
85
85
|
id: n,
|
|
86
86
|
placeholder: k,
|
|
87
|
-
store:
|
|
87
|
+
store: u
|
|
88
88
|
}), /* @__PURE__ */ o("div", {
|
|
89
89
|
className: l.comboboxButtons,
|
|
90
90
|
children: C ? /* @__PURE__ */ o(J, {
|
|
@@ -97,7 +97,7 @@ const ce = () => /* @__PURE__ */ o($, {
|
|
|
97
97
|
icon: _,
|
|
98
98
|
size: "x-small"
|
|
99
99
|
}),
|
|
100
|
-
store:
|
|
100
|
+
store: u
|
|
101
101
|
}) : /* @__PURE__ */ o(ce, {})
|
|
102
102
|
})]
|
|
103
103
|
})]
|
|
@@ -116,24 +116,24 @@ const ce = () => /* @__PURE__ */ o($, {
|
|
|
116
116
|
ariaLabel: P,
|
|
117
117
|
defaultFetcher: w,
|
|
118
118
|
levels: z,
|
|
119
|
-
loadingAriaLabel: R ||
|
|
120
|
-
multiselect:
|
|
121
|
-
noResultMessage: y ||
|
|
119
|
+
loadingAriaLabel: R || h(I.loadingAriaLabel),
|
|
120
|
+
multiselect: b,
|
|
121
|
+
noResultMessage: y || h(I.noResults),
|
|
122
122
|
onSelect: (e) => {
|
|
123
123
|
const {
|
|
124
124
|
metadata: a
|
|
125
125
|
} = e.element;
|
|
126
126
|
let s = [];
|
|
127
|
-
e.isSelected ? (
|
|
127
|
+
e.isSelected ? (b && (s = t.filter((m) => m.value !== e.element.id)), s.push({
|
|
128
128
|
value: e.element.id,
|
|
129
129
|
displayValue: a.displayValue,
|
|
130
130
|
level: a.level,
|
|
131
131
|
selectable: a.selectable,
|
|
132
132
|
ancestors: a.ancestors
|
|
133
|
-
})) : s = t.filter((
|
|
133
|
+
})) : s = t.filter((m) => m.value !== e.element.id), i(s), c("");
|
|
134
134
|
},
|
|
135
|
-
open:
|
|
136
|
-
searchInput:
|
|
135
|
+
open: f,
|
|
136
|
+
searchInput: x.trimStart(),
|
|
137
137
|
selectableLevels: M,
|
|
138
138
|
selectedNodes: t.map((e) => e.value)
|
|
139
139
|
})
|