@box/combobox-with-api 0.37.2 → 0.38.3
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.
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +76 -74
- package/dist/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +1 -0
- package/dist/types/lib/components/combobox-with-api-pagination/types.d.ts +1 -0
- package/dist/types/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.d.ts +1 -0
- package/dist/types/lib/components/combobox-with-api-tree-view/types.d.ts +1 -0
- package/package.json +5 -5
|
@@ -1,145 +1,147 @@
|
|
|
1
|
-
import { useComboboxStore as
|
|
2
|
-
import { useLabelable as
|
|
3
|
-
import { XMark as
|
|
4
|
-
import { IconIconOnLightSecondary as
|
|
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
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import
|
|
9
|
-
import { useControllableState as
|
|
10
|
-
import { s as
|
|
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
|
|
13
|
-
color:
|
|
12
|
+
const ue = () => /* @__PURE__ */ o(ee, {
|
|
13
|
+
color: oe,
|
|
14
14
|
height: g,
|
|
15
15
|
role: "presentation",
|
|
16
16
|
style: {
|
|
17
|
-
padding:
|
|
17
|
+
padding: te,
|
|
18
18
|
boxSizing: "border-box"
|
|
19
19
|
},
|
|
20
20
|
width: g
|
|
21
|
-
}),
|
|
21
|
+
}), we = /* @__PURE__ */ le(function(S, pe) {
|
|
22
22
|
const {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
} =
|
|
42
|
-
prop:
|
|
43
|
-
defaultProp:
|
|
44
|
-
onChange:
|
|
45
|
-
}), [x, c] =
|
|
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 =
|
|
48
|
+
}, [c]), u = X({
|
|
48
49
|
includesBaseElement: !0,
|
|
49
50
|
virtualFocus: !1,
|
|
50
51
|
value: x,
|
|
51
|
-
setValue:
|
|
52
|
+
setValue: F,
|
|
52
53
|
open: f,
|
|
53
|
-
setOpen:
|
|
54
|
-
}), C =
|
|
55
|
-
return /* @__PURE__ */ r(
|
|
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(
|
|
58
|
+
children: [/* @__PURE__ */ o(H, {
|
|
58
59
|
children: /* @__PURE__ */ r("div", {
|
|
59
|
-
className: p(
|
|
60
|
-
children: [/* @__PURE__ */ o(
|
|
61
|
-
className: p(
|
|
62
|
-
[
|
|
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(
|
|
67
|
-
[
|
|
68
|
-
[
|
|
67
|
+
className: p(t.comboboxContainer, {
|
|
68
|
+
[t.withChips]: v,
|
|
69
|
+
[t.withComboboxButtons]: C
|
|
69
70
|
}),
|
|
70
|
-
children: [v && /* @__PURE__ */ o(
|
|
71
|
-
children:
|
|
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 =
|
|
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:
|
|
81
|
-
children: [/* @__PURE__ */ o(
|
|
82
|
-
ref:
|
|
83
|
-
className:
|
|
84
|
-
|
|
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:
|
|
88
|
+
placeholder: P,
|
|
87
89
|
store: u
|
|
88
90
|
}), /* @__PURE__ */ o("div", {
|
|
89
|
-
className:
|
|
90
|
-
children: C ? /* @__PURE__ */ o(
|
|
91
|
+
className: t.comboboxButtons,
|
|
92
|
+
children: C ? /* @__PURE__ */ o(K, {
|
|
91
93
|
onClick: () => {
|
|
92
94
|
i([]);
|
|
93
95
|
},
|
|
94
|
-
render: (e) => /* @__PURE__ */ o(
|
|
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(
|
|
103
|
+
}) : /* @__PURE__ */ o(ue, {})
|
|
102
104
|
})]
|
|
103
105
|
})]
|
|
104
106
|
})]
|
|
105
107
|
})
|
|
106
|
-
}), /* @__PURE__ */ o(
|
|
108
|
+
}), /* @__PURE__ */ o(Q, {
|
|
107
109
|
"aria-labelledby": n,
|
|
108
|
-
className:
|
|
110
|
+
className: t.popover,
|
|
109
111
|
fitViewport: !0,
|
|
110
112
|
gutter: 8,
|
|
111
113
|
modal: !0,
|
|
112
114
|
portal: !0,
|
|
113
|
-
portalElement:
|
|
115
|
+
portalElement: T,
|
|
114
116
|
sameWidth: !0,
|
|
115
|
-
children: /* @__PURE__ */ o(
|
|
116
|
-
ariaLabel:
|
|
117
|
-
defaultFetcher:
|
|
118
|
-
levels:
|
|
119
|
-
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:
|
|
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 =
|
|
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 =
|
|
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:
|
|
138
|
-
selectedNodes:
|
|
139
|
+
selectableLevels: W,
|
|
140
|
+
selectedNodes: l.map((e) => e.value)
|
|
139
141
|
})
|
|
140
142
|
})]
|
|
141
143
|
});
|
|
142
144
|
});
|
|
143
145
|
export {
|
|
144
|
-
|
|
146
|
+
we as ComboboxWithApiTreeView
|
|
145
147
|
};
|
package/dist/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts
CHANGED
|
@@ -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>>;
|
package/dist/types/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.d.ts
CHANGED
|
@@ -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>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/combobox-with-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.3",
|
|
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.
|
|
14
|
+
"@box/tree": "^0.48.4",
|
|
15
15
|
"react-accessible-treeview": "2.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@box/blueprint-web": "^12.
|
|
19
|
-
"@box/blueprint-web-assets": "^4.
|
|
20
|
-
"@box/storybook-utils": "^0.12.
|
|
18
|
+
"@box/blueprint-web": "^12.1.1",
|
|
19
|
+
"@box/blueprint-web-assets": "^4.45.0",
|
|
20
|
+
"@box/storybook-utils": "^0.12.4",
|
|
21
21
|
"react": "^18.3.0",
|
|
22
22
|
"react-dom": "^18.3.0"
|
|
23
23
|
},
|