@box/combobox-with-api 0.51.31 → 0.52.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.
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +147 -141
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +94 -89
- package/dist/i18n/en-x-pseudo.js +8 -8
- package/dist/i18n/en-x-pseudo.properties +8 -8
- package/dist/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +2 -0
- package/dist/types/lib/components/combobox-with-api-pagination/types.d.ts +2 -0
- package/dist/types/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.d.ts +3 -0
- package/dist/types/lib/components/combobox-with-api-tree-view/types.d.ts +3 -0
- package/package.json +3 -3
package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import { ComboboxItemValue as
|
|
2
|
-
import { Combobox as m, useForkRef as
|
|
3
|
-
import { Search as
|
|
4
|
-
import { IconIconOnLightSecondary as
|
|
5
|
-
import
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { useIntl as
|
|
1
|
+
import { ComboboxItemValue as ce } from "@ariakit/react";
|
|
2
|
+
import { Combobox as m, useForkRef as ue, LoadingIndicator as de, InlineNotice as pe, Text as me } from "@box/blueprint-web";
|
|
3
|
+
import { Search as fe, Loader as he } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
+
import { IconIconOnLightSecondary as ge, Size6 as V, Size1 as be } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import N from "clsx";
|
|
6
|
+
import { forwardRef as B, useRef as A, useState as xe, useCallback as k, useMemo as C, useEffect as Oe } from "react";
|
|
7
|
+
import { useIntl as W, FormattedMessage as F } from "react-intl";
|
|
8
8
|
import a from "./messages.js";
|
|
9
|
-
import { useAsyncList as
|
|
10
|
-
import { useControllableState as
|
|
11
|
-
import { useTrackVisibility as
|
|
12
|
-
import { jsx as r, jsxs as
|
|
13
|
-
import '../../../../styles/combobox-with-api-pagination.css';const
|
|
14
|
-
container:
|
|
15
|
-
disabled:
|
|
16
|
-
highlightOptionText:
|
|
17
|
-
selected:
|
|
18
|
-
option:
|
|
19
|
-
errorComboboxOption:
|
|
20
|
-
errorComboboxOptionText:
|
|
21
|
-
},
|
|
22
|
-
onTryAgain:
|
|
23
|
-
},
|
|
9
|
+
import { useAsyncList as _e } from "./use-async-list.js";
|
|
10
|
+
import { useControllableState as ye } from "./utils/use-controllable-state.js";
|
|
11
|
+
import { useTrackVisibility as ve } from "./utils/use-intersection-observer.js";
|
|
12
|
+
import { jsx as r, jsxs as P, Fragment as Re } from "react/jsx-runtime";
|
|
13
|
+
import '../../../../styles/combobox-with-api-pagination.css';const Ae = "_container_syvk5_1", Ce = "_disabled_syvk5_7", Le = "_highlightOptionText_syvk5_11", Ee = "_selected_syvk5_23", Ie = "_option_syvk5_34", Me = "_errorComboboxOption_syvk5_38", Te = "_errorComboboxOptionText_syvk5_43", c = {
|
|
14
|
+
container: Ae,
|
|
15
|
+
disabled: Ce,
|
|
16
|
+
highlightOptionText: Le,
|
|
17
|
+
selected: Ee,
|
|
18
|
+
option: Ie,
|
|
19
|
+
errorComboboxOption: Me,
|
|
20
|
+
errorComboboxOptionText: Te
|
|
21
|
+
}, D = /* @__PURE__ */ B(({
|
|
22
|
+
onTryAgain: I
|
|
23
|
+
}, f) => {
|
|
24
24
|
const {
|
|
25
25
|
formatMessage: h
|
|
26
|
-
} =
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
children: [/* @__PURE__ */ r(
|
|
26
|
+
} = W();
|
|
27
|
+
return /* @__PURE__ */ P(Re, {
|
|
28
|
+
children: [/* @__PURE__ */ r(pe, {
|
|
29
29
|
variant: "error",
|
|
30
30
|
variantIconAriaLabel: h(a.loadingResultsErrorIconLabel),
|
|
31
|
-
children: /* @__PURE__ */ r(
|
|
31
|
+
children: /* @__PURE__ */ r(F, {
|
|
32
32
|
...a.loadingResultsErrorMessage
|
|
33
33
|
})
|
|
34
34
|
}), /* @__PURE__ */ r(m.Option, {
|
|
35
|
-
ref:
|
|
36
|
-
className:
|
|
37
|
-
onClick:
|
|
38
|
-
children: /* @__PURE__ */
|
|
35
|
+
ref: f,
|
|
36
|
+
className: c.errorComboboxOption,
|
|
37
|
+
onClick: I,
|
|
38
|
+
children: /* @__PURE__ */ P(me, {
|
|
39
39
|
as: "span",
|
|
40
|
-
className:
|
|
40
|
+
className: c.errorComboboxOptionText,
|
|
41
41
|
color: "textOnLightLink",
|
|
42
42
|
variant: "bodyDefaultBold",
|
|
43
|
-
children: [/* @__PURE__ */ r(
|
|
43
|
+
children: [/* @__PURE__ */ r(F, {
|
|
44
44
|
...a.loadingResultsErrorAction
|
|
45
|
-
}), /* @__PURE__ */ r(
|
|
45
|
+
}), /* @__PURE__ */ r(he, {
|
|
46
46
|
color: "currentColor",
|
|
47
47
|
height: "12px",
|
|
48
48
|
width: "12px"
|
|
@@ -50,162 +50,168 @@ import '../../../../styles/combobox-with-api-pagination.css';const xe = "_contai
|
|
|
50
50
|
})
|
|
51
51
|
})]
|
|
52
52
|
});
|
|
53
|
-
}),
|
|
54
|
-
color:
|
|
55
|
-
height:
|
|
53
|
+
}), L = "__LOADING__", E = "__LOADING_ERROR__", Se = "0px 0px 20px 0px", Ve = /* @__PURE__ */ r(fe, {
|
|
54
|
+
color: ge,
|
|
55
|
+
height: V,
|
|
56
56
|
role: "presentation",
|
|
57
57
|
style: {
|
|
58
|
-
padding:
|
|
58
|
+
padding: be,
|
|
59
59
|
boxSizing: "border-box"
|
|
60
60
|
},
|
|
61
|
-
width:
|
|
62
|
-
}),
|
|
61
|
+
width: V
|
|
62
|
+
}), qe = /* @__PURE__ */ B(function(f, h) {
|
|
63
63
|
const {
|
|
64
|
-
dataTargetId:
|
|
65
|
-
defaultFetcher:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
} =
|
|
64
|
+
dataTargetId: w,
|
|
65
|
+
defaultFetcher: z,
|
|
66
|
+
initialOpen: G = !1,
|
|
67
|
+
onInputValueChange: g,
|
|
68
|
+
value: j,
|
|
69
|
+
onValueChange: U,
|
|
70
|
+
onOpenChange: s,
|
|
71
|
+
noResultMessage: q,
|
|
72
|
+
defaultValue: H = [],
|
|
73
|
+
loadingAriaLabel: J,
|
|
74
|
+
multiselect: i = !1,
|
|
75
|
+
disabled: K,
|
|
76
|
+
className: Q,
|
|
77
|
+
displaySingleSelectionAsChip: b = !0,
|
|
78
|
+
...X
|
|
79
|
+
} = f, {
|
|
80
|
+
formatMessage: d
|
|
81
|
+
} = W(), x = A(null), O = A(!0), [Y, M] = xe(G), o = _e({
|
|
80
82
|
async load({
|
|
81
|
-
marker:
|
|
83
|
+
marker: e,
|
|
82
84
|
searchInput: t,
|
|
83
|
-
signal:
|
|
85
|
+
signal: R
|
|
84
86
|
}) {
|
|
85
|
-
const
|
|
86
|
-
signal:
|
|
87
|
-
marker:
|
|
87
|
+
const u = await z({
|
|
88
|
+
signal: R,
|
|
89
|
+
marker: e,
|
|
88
90
|
searchInput: t
|
|
89
91
|
});
|
|
90
92
|
return {
|
|
91
|
-
items:
|
|
92
|
-
marker:
|
|
93
|
+
items: u.options,
|
|
94
|
+
marker: u.marker
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
}, []), [n,
|
|
98
|
-
prop:
|
|
99
|
-
defaultProp:
|
|
100
|
-
onChange:
|
|
101
|
-
}),
|
|
102
|
-
|
|
103
|
-
},
|
|
97
|
+
}), T = A(!1), Z = k(() => {
|
|
98
|
+
T.current || (o.reload(), T.current = !0);
|
|
99
|
+
}, []), [n, _] = ye({
|
|
100
|
+
prop: j,
|
|
101
|
+
defaultProp: H,
|
|
102
|
+
onChange: U
|
|
103
|
+
}), y = !i && n.length === 1, $ = k((e) => {
|
|
104
|
+
M(e), s == null || s(e);
|
|
105
|
+
}, [s]), ee = (e) => {
|
|
106
|
+
e === void 0 ? (_([]), (!O.current || !b) && (o.search(""), O.current = !0)) : Array.isArray(e) ? _(e) : (_([e]), i || (M(!1), s == null || s(!1)));
|
|
107
|
+
}, oe = C(() => n.length === 0 ? i ? [] : void 0 : i ? n : n[0], [i, n]), v = C(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), te = (e) => {
|
|
104
108
|
const {
|
|
105
109
|
value: t,
|
|
106
|
-
displayValue:
|
|
107
|
-
...
|
|
108
|
-
} =
|
|
109
|
-
if (t ===
|
|
110
|
-
return
|
|
111
|
-
...
|
|
112
|
-
ref:
|
|
110
|
+
displayValue: R,
|
|
111
|
+
...u
|
|
112
|
+
} = e;
|
|
113
|
+
if (t === L)
|
|
114
|
+
return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
|
|
115
|
+
...u,
|
|
116
|
+
ref: se,
|
|
113
117
|
disabled: !0,
|
|
114
118
|
value: t,
|
|
115
|
-
children: /* @__PURE__ */ r(
|
|
116
|
-
"aria-label":
|
|
119
|
+
children: /* @__PURE__ */ r(de, {
|
|
120
|
+
"aria-label": d(a.loadingMoreAriaLabel),
|
|
117
121
|
style: {
|
|
118
122
|
position: "unset"
|
|
119
123
|
}
|
|
120
124
|
})
|
|
121
125
|
}) : null;
|
|
122
|
-
if (t ===
|
|
123
|
-
return /* @__PURE__ */ r(
|
|
126
|
+
if (t === E && o.hasError && !o.isEmpty)
|
|
127
|
+
return /* @__PURE__ */ r(D, {
|
|
124
128
|
onTryAgain: () => {
|
|
125
|
-
var
|
|
126
|
-
|
|
129
|
+
var l;
|
|
130
|
+
o.loadMore(), (l = x.current) == null || l.focus();
|
|
127
131
|
}
|
|
128
132
|
});
|
|
129
|
-
if (
|
|
133
|
+
if (v.some((l) => l.value === t))
|
|
130
134
|
return null;
|
|
131
|
-
const
|
|
135
|
+
const le = n.some((l) => l.value === t);
|
|
132
136
|
return /* @__PURE__ */ r(m.Option, {
|
|
133
|
-
...
|
|
134
|
-
className:
|
|
137
|
+
...u,
|
|
138
|
+
className: c.option,
|
|
135
139
|
value: t,
|
|
136
|
-
children: /* @__PURE__ */ r(
|
|
137
|
-
className:
|
|
138
|
-
value:
|
|
140
|
+
children: /* @__PURE__ */ r(ce, {
|
|
141
|
+
className: N(c.highlightOptionText, le && c.selected),
|
|
142
|
+
value: R || t
|
|
139
143
|
})
|
|
140
144
|
});
|
|
141
|
-
},
|
|
142
|
-
if (
|
|
143
|
-
|
|
145
|
+
}, re = (e) => {
|
|
146
|
+
if (g == null || g(e), y && e === "") {
|
|
147
|
+
O.current = !1;
|
|
144
148
|
return;
|
|
145
149
|
}
|
|
146
|
-
|
|
147
|
-
},
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
+
o.search(e);
|
|
151
|
+
}, ne = () => {
|
|
152
|
+
var e;
|
|
153
|
+
o.reload(), (e = x.current) == null || e.focus();
|
|
150
154
|
};
|
|
151
|
-
let
|
|
152
|
-
|
|
153
|
-
onTryAgain:
|
|
154
|
-
}) :
|
|
155
|
-
const [
|
|
156
|
-
rootRef:
|
|
157
|
-
isVisible:
|
|
158
|
-
}] =
|
|
159
|
-
rootMargin:
|
|
155
|
+
let p;
|
|
156
|
+
o.hasError && !o.isLoading ? p = /* @__PURE__ */ r(D, {
|
|
157
|
+
onTryAgain: ne
|
|
158
|
+
}) : o.isEmpty && !o.isLoading ? p = q || d(a.noResults) : p = void 0;
|
|
159
|
+
const [se, {
|
|
160
|
+
rootRef: ae,
|
|
161
|
+
isVisible: S
|
|
162
|
+
}] = ve({
|
|
163
|
+
rootMargin: Se
|
|
160
164
|
});
|
|
161
|
-
|
|
162
|
-
if (!(
|
|
165
|
+
Oe(() => {
|
|
166
|
+
if (!(S && o.hasNextPage))
|
|
163
167
|
return;
|
|
164
168
|
const t = setTimeout(() => {
|
|
165
|
-
|
|
169
|
+
o.loadMore();
|
|
166
170
|
}, 100);
|
|
167
171
|
return () => {
|
|
168
172
|
clearTimeout(t);
|
|
169
173
|
};
|
|
170
|
-
}, [
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
displayValue: A,
|
|
174
|
-
value: A
|
|
175
|
-
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
174
|
+
}, [S]);
|
|
175
|
+
const ie = C(() => {
|
|
176
|
+
const e = o.hasNextPage ? {
|
|
176
177
|
displayValue: L,
|
|
177
178
|
value: L
|
|
179
|
+
} : null, t = !e && o.hasError && !o.isEmpty ? {
|
|
180
|
+
displayValue: E,
|
|
181
|
+
value: E
|
|
178
182
|
} : null;
|
|
179
|
-
return [...
|
|
180
|
-
}, [
|
|
183
|
+
return [...o.items, ...v, e, t].filter(Boolean);
|
|
184
|
+
}, [o.hasNextPage, o.hasError, o.isEmpty, o.items, v]);
|
|
181
185
|
return /* @__PURE__ */ r(m, {
|
|
182
|
-
...
|
|
183
|
-
ref:
|
|
186
|
+
...X,
|
|
187
|
+
ref: ue(x, h),
|
|
184
188
|
as: "input",
|
|
185
|
-
className:
|
|
186
|
-
[
|
|
187
|
-
},
|
|
188
|
-
clearButtonAriaLabel:
|
|
189
|
+
className: N({
|
|
190
|
+
[c.disabled]: y
|
|
191
|
+
}, Q),
|
|
192
|
+
clearButtonAriaLabel: d(a.clearButtonAriaLabel),
|
|
189
193
|
clearOnBlur: !1,
|
|
190
|
-
"data-target-id":
|
|
191
|
-
disabled:
|
|
192
|
-
displaySingleSelectionAsChip:
|
|
193
|
-
displayValue: (
|
|
194
|
-
endComboboxIcon:
|
|
194
|
+
"data-target-id": w,
|
|
195
|
+
disabled: K || y && b,
|
|
196
|
+
displaySingleSelectionAsChip: b,
|
|
197
|
+
displayValue: (e) => e.displayValue || e.value,
|
|
198
|
+
endComboboxIcon: Ve,
|
|
195
199
|
focusLoop: !1,
|
|
196
|
-
getPopoverRef:
|
|
197
|
-
loading:
|
|
198
|
-
loadingAriaLabel:
|
|
199
|
-
multiselect:
|
|
200
|
-
noResultMessage:
|
|
201
|
-
onFocus:
|
|
202
|
-
onInputValueChange:
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
200
|
+
getPopoverRef: ae,
|
|
201
|
+
loading: o.isReloading,
|
|
202
|
+
loadingAriaLabel: J || d(a.loadingAriaLabel),
|
|
203
|
+
multiselect: i,
|
|
204
|
+
noResultMessage: p,
|
|
205
|
+
onFocus: Z,
|
|
206
|
+
onInputValueChange: re,
|
|
207
|
+
onOpenChange: $,
|
|
208
|
+
onValueChange: ee,
|
|
209
|
+
open: Y,
|
|
210
|
+
options: ie,
|
|
211
|
+
renderOption: te,
|
|
212
|
+
value: oe
|
|
207
213
|
});
|
|
208
214
|
});
|
|
209
215
|
export {
|
|
210
|
-
|
|
216
|
+
qe as ComboboxWithApiPagination
|
|
211
217
|
};
|
|
@@ -1,156 +1,161 @@
|
|
|
1
|
-
import { useComboboxStore as
|
|
2
|
-
import { useLabelable as
|
|
3
|
-
import { XMark as
|
|
4
|
-
import { IconIconOnLightSecondary as
|
|
5
|
-
import
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { useIntl as
|
|
8
|
-
import
|
|
9
|
-
import { useControllableState as
|
|
10
|
-
import { s as a, D as
|
|
11
|
-
import { jsxs as n, jsx as
|
|
12
|
-
const
|
|
13
|
-
color:
|
|
14
|
-
height:
|
|
1
|
+
import { useComboboxStore as H, ComboboxProvider as J, PopoverAnchor as Q, Combobox as Y, ComboboxCancel as Z, ComboboxPopover as _, ComboboxItem as $ } from "@ariakit/react";
|
|
2
|
+
import { useLabelable as ee, ChipsGroup as oe, InputChip as te, IconButton as le } from "@box/blueprint-web";
|
|
3
|
+
import { XMark as ae, Search as se } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
+
import { IconIconOnLightSecondary as re, Size6 as w, Size1 as ne } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import d from "clsx";
|
|
6
|
+
import { forwardRef as ie, useId as ce, useState as L, useRef as y } from "react";
|
|
7
|
+
import { useIntl as ue } from "react-intl";
|
|
8
|
+
import N from "../combobox-with-api-pagination/messages.js";
|
|
9
|
+
import { useControllableState as me } from "../combobox-with-api-pagination/utils/use-controllable-state.js";
|
|
10
|
+
import { s as a, D as pe } from "../../../../chunks/dynamic-loading-tree.js";
|
|
11
|
+
import { jsxs as n, jsx as l } from "react/jsx-runtime";
|
|
12
|
+
const de = () => /* @__PURE__ */ l(se, {
|
|
13
|
+
color: re,
|
|
14
|
+
height: w,
|
|
15
15
|
role: "presentation",
|
|
16
16
|
style: {
|
|
17
|
-
padding:
|
|
17
|
+
padding: ne,
|
|
18
18
|
boxSizing: "border-box"
|
|
19
19
|
},
|
|
20
|
-
width:
|
|
21
|
-
}),
|
|
20
|
+
width: w
|
|
21
|
+
}), Re = /* @__PURE__ */ ie(function(A, he) {
|
|
22
22
|
const {
|
|
23
|
-
className:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
className: R,
|
|
24
|
+
closeOnSelection: O = !1,
|
|
25
|
+
dataTargetId: B,
|
|
26
|
+
defaultFetcher: z,
|
|
27
|
+
defaultValue: D = [],
|
|
28
|
+
disabled: M,
|
|
29
|
+
hideLabel: b,
|
|
30
|
+
initialOpen: P = !1,
|
|
31
|
+
label: T,
|
|
32
|
+
levels: W,
|
|
33
|
+
loadingAriaLabel: k,
|
|
32
34
|
multiselect: h = !1,
|
|
33
|
-
noResultMessage:
|
|
34
|
-
onValueChange:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
noResultMessage: E,
|
|
36
|
+
onValueChange: F,
|
|
37
|
+
onOpenChange: i,
|
|
38
|
+
placeholder: j,
|
|
39
|
+
portalElement: G,
|
|
40
|
+
selectableLevels: K,
|
|
41
|
+
treeAriaLabel: U,
|
|
42
|
+
value: X
|
|
43
|
+
} = A, {
|
|
41
44
|
formatMessage: f
|
|
42
|
-
} =
|
|
43
|
-
prop:
|
|
44
|
-
defaultProp:
|
|
45
|
-
onChange:
|
|
46
|
-
}), [x,
|
|
47
|
-
u(e);
|
|
48
|
-
}, [u]), m = X({
|
|
45
|
+
} = ue(), c = ce(), [C, g] = L(P), [s, u] = me({
|
|
46
|
+
prop: X,
|
|
47
|
+
defaultProp: D,
|
|
48
|
+
onChange: F
|
|
49
|
+
}), [x, v] = L(""), V = y(null), m = H({
|
|
49
50
|
includesBaseElement: !0,
|
|
50
51
|
virtualFocus: !1,
|
|
51
52
|
value: x,
|
|
52
|
-
setValue:
|
|
53
|
+
setValue: (e) => {
|
|
54
|
+
v(e);
|
|
55
|
+
},
|
|
53
56
|
open: C,
|
|
54
|
-
setOpen:
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
setOpen: (e) => {
|
|
58
|
+
g(e), i == null || i(e);
|
|
59
|
+
}
|
|
60
|
+
}), I = s.length > 0, S = s.length > 0, q = ee(T, c), p = y(null);
|
|
61
|
+
return /* @__PURE__ */ n(J, {
|
|
57
62
|
store: m,
|
|
58
|
-
children: [/* @__PURE__ */
|
|
63
|
+
children: [/* @__PURE__ */ l(Q, {
|
|
59
64
|
children: /* @__PURE__ */ n("div", {
|
|
60
|
-
className:
|
|
61
|
-
children: [/* @__PURE__ */
|
|
62
|
-
className:
|
|
63
|
-
[a.hiddenLabel]:
|
|
65
|
+
className: d(a.container, R),
|
|
66
|
+
children: [/* @__PURE__ */ l(q, {
|
|
67
|
+
className: d(a.label, {
|
|
68
|
+
[a.hiddenLabel]: b
|
|
64
69
|
}),
|
|
65
|
-
hideLabel:
|
|
70
|
+
hideLabel: b
|
|
66
71
|
}), /* @__PURE__ */ n("div", {
|
|
67
|
-
className:
|
|
68
|
-
[a.withChips]:
|
|
69
|
-
[a.withComboboxButtons]:
|
|
72
|
+
className: d(a.comboboxContainer, {
|
|
73
|
+
[a.withChips]: S,
|
|
74
|
+
[a.withComboboxButtons]: I
|
|
70
75
|
}),
|
|
71
|
-
children: [
|
|
72
|
-
children: s.map((e) => /* @__PURE__ */
|
|
76
|
+
children: [S && /* @__PURE__ */ l(oe, {
|
|
77
|
+
children: s.map((e) => /* @__PURE__ */ l(te, {
|
|
73
78
|
label: e.displayValue,
|
|
74
79
|
onDelete: () => {
|
|
75
|
-
const o = s.filter((
|
|
76
|
-
|
|
80
|
+
const o = s.filter((t) => t.value !== e.value);
|
|
81
|
+
u(o);
|
|
77
82
|
},
|
|
78
83
|
tooltip: e.displayValue
|
|
79
84
|
}, e.value))
|
|
80
85
|
}), /* @__PURE__ */ n("div", {
|
|
81
86
|
className: a.textInputWrapper,
|
|
82
|
-
children: [/* @__PURE__ */
|
|
83
|
-
ref:
|
|
87
|
+
children: [/* @__PURE__ */ l(Y, {
|
|
88
|
+
ref: V,
|
|
84
89
|
"aria-haspopup": "tree",
|
|
85
90
|
className: a.textInput,
|
|
86
|
-
"data-target-id":
|
|
87
|
-
disabled:
|
|
88
|
-
id:
|
|
89
|
-
placeholder:
|
|
91
|
+
"data-target-id": B,
|
|
92
|
+
disabled: M,
|
|
93
|
+
id: c,
|
|
94
|
+
placeholder: j,
|
|
90
95
|
store: m
|
|
91
|
-
}), /* @__PURE__ */
|
|
96
|
+
}), /* @__PURE__ */ l("div", {
|
|
92
97
|
className: a.comboboxButtons,
|
|
93
|
-
children:
|
|
98
|
+
children: I ? /* @__PURE__ */ l(Z, {
|
|
94
99
|
onClick: () => {
|
|
95
|
-
|
|
100
|
+
u([]);
|
|
96
101
|
},
|
|
97
|
-
render: (e) => /* @__PURE__ */
|
|
102
|
+
render: (e) => /* @__PURE__ */ l(le, {
|
|
98
103
|
...e,
|
|
99
104
|
"aria-label": "Clear selection",
|
|
100
|
-
icon:
|
|
105
|
+
icon: ae,
|
|
101
106
|
size: "x-small"
|
|
102
107
|
}),
|
|
103
108
|
store: m
|
|
104
|
-
}) : /* @__PURE__ */
|
|
109
|
+
}) : /* @__PURE__ */ l(de, {})
|
|
105
110
|
})]
|
|
106
111
|
})]
|
|
107
112
|
})]
|
|
108
113
|
})
|
|
109
|
-
}), /* @__PURE__ */
|
|
110
|
-
"aria-labelledby":
|
|
114
|
+
}), /* @__PURE__ */ l(_, {
|
|
115
|
+
"aria-labelledby": c,
|
|
111
116
|
className: a.popover,
|
|
112
117
|
fitViewport: !0,
|
|
113
118
|
gutter: 8,
|
|
114
119
|
portal: !0,
|
|
115
|
-
portalElement:
|
|
120
|
+
portalElement: G,
|
|
116
121
|
sameWidth: !0,
|
|
117
|
-
children: /* @__PURE__ */
|
|
122
|
+
children: /* @__PURE__ */ l($, {
|
|
118
123
|
onFocusVisible: (e) => {
|
|
119
|
-
var
|
|
120
|
-
const o = (
|
|
124
|
+
var t;
|
|
125
|
+
const o = (t = p.current) == null ? void 0 : t.firstChild;
|
|
121
126
|
o == null || o.focus();
|
|
122
127
|
},
|
|
123
128
|
onKeyDown: (e) => {
|
|
124
|
-
var o,
|
|
129
|
+
var o, t;
|
|
125
130
|
if (e.key === "ArrowUp") {
|
|
126
131
|
const r = (o = p.current) == null ? void 0 : o.firstChild;
|
|
127
|
-
document.activeElement === r && (r.blur(), (
|
|
132
|
+
document.activeElement === r && (r.blur(), (t = V.current) == null || t.focus());
|
|
128
133
|
}
|
|
129
134
|
},
|
|
130
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ l(pe, {
|
|
131
136
|
ref: p,
|
|
132
|
-
ariaLabel:
|
|
133
|
-
defaultFetcher:
|
|
134
|
-
levels:
|
|
135
|
-
loadingAriaLabel:
|
|
137
|
+
ariaLabel: U,
|
|
138
|
+
defaultFetcher: z,
|
|
139
|
+
levels: W,
|
|
140
|
+
loadingAriaLabel: k || f(N.loadingAriaLabel),
|
|
136
141
|
multiselect: h,
|
|
137
|
-
noResultMessage:
|
|
142
|
+
noResultMessage: E || f(N.noResults),
|
|
138
143
|
onSelect: (e) => {
|
|
139
144
|
const {
|
|
140
145
|
metadata: o
|
|
141
146
|
} = e.element;
|
|
142
|
-
let
|
|
143
|
-
e.isSelected ? (h && (
|
|
147
|
+
let t = [];
|
|
148
|
+
e.isSelected ? (h && (t = s.filter((r) => r.value !== e.element.id)), t.push({
|
|
144
149
|
value: e.element.id,
|
|
145
150
|
displayValue: o.displayValue,
|
|
146
151
|
level: o.level,
|
|
147
152
|
selectable: o.selectable,
|
|
148
153
|
ancestors: o.ancestors
|
|
149
|
-
})) :
|
|
154
|
+
}), O && t.length > s.length && g(!1)) : t = s.filter((r) => r.value !== e.element.id), u(t), v("");
|
|
150
155
|
},
|
|
151
156
|
open: C,
|
|
152
157
|
searchInput: x.trimStart(),
|
|
153
|
-
selectableLevels:
|
|
158
|
+
selectableLevels: K,
|
|
154
159
|
selectedNodes: s.map((e) => e.value)
|
|
155
160
|
})
|
|
156
161
|
})
|
|
@@ -158,5 +163,5 @@ const pe = () => /* @__PURE__ */ t(le, {
|
|
|
158
163
|
});
|
|
159
164
|
});
|
|
160
165
|
export {
|
|
161
|
-
|
|
166
|
+
Re as ComboboxWithApiTreeView
|
|
162
167
|
};
|
package/dist/i18n/en-x-pseudo.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
"comboboxWithApi.apiError": "⟦萬萬萬萬萬萬萬萬萬萬萬萬
|
|
3
|
-
"comboboxWithApiPagination.clearButtonAriaLabel": "⟦萬萬萬萬萬萬萬
|
|
4
|
-
"comboboxWithApiPagination.errorAction": "⟦萬
|
|
5
|
-
"comboboxWithApiPagination.errorIconLabel": "⟦萬
|
|
6
|
-
"comboboxWithApiPagination.errorMessage": "⟦萬萬萬萬萬萬
|
|
7
|
-
"comboboxWithApiPagination.loadingAriaLabel": "⟦萬萬
|
|
8
|
-
"comboboxWithApiPagination.loadingMoreAriaLabel": "⟦萬萬萬萬
|
|
9
|
-
"comboboxWithApiPagination.noResults": "⟦萬萬萬萬
|
|
2
|
+
"comboboxWithApi.apiError": "⟦萬萬萬萬萬萬萬萬萬萬萬萬 Ćόüĺďń'ţ ļøąď ґěśùļŧś. Çľіçĸ ťο τгγ ăĝăίи. 國國國國國國國國國國國國⟧",
|
|
3
|
+
"comboboxWithApiPagination.clearButtonAriaLabel": "⟦萬萬萬萬萬萬萬 Ćĺëäґ ιпΡůτ åńď şèľėĉτіŏη 國國國國國國國⟧",
|
|
4
|
+
"comboboxWithApiPagination.errorAction": "⟦萬 Ŕëĺóǻď 國⟧",
|
|
5
|
+
"comboboxWithApiPagination.errorIconLabel": "⟦萬 Ēѓгоя 國⟧",
|
|
6
|
+
"comboboxWithApiPagination.errorMessage": "⟦萬萬萬萬萬萬 ₣äįľεď τσ ļóäď õΡŧίöʼnѕ 國國國國國國⟧",
|
|
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 = ⟦萬萬萬萬萬萬萬
|
|
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 = ⟦萬萬萬萬萬萬
|
|
10
|
+
comboboxWithApiPagination.errorMessage = ⟦萬萬萬萬萬萬 ₣äįľεď τσ ļóäď õΡŧίöʼnѕ 國國國國國國⟧
|
|
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 = ⟦萬萬萬萬
|
|
14
|
+
comboboxWithApiPagination.loadingMoreAriaLabel = ⟦萬萬萬萬 Ŀõάďïπġ mōŗę... 國國國國⟧
|
|
15
15
|
# Message displayed when no results are found in the combobox
|
|
16
|
-
comboboxWithApiPagination.noResults = ⟦萬萬萬萬
|
|
16
|
+
comboboxWithApiPagination.noResults = ⟦萬萬萬萬 Ņσ гěşūļŧś ƒöůńď 國國國國⟧
|
package/dist/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare const ComboboxWithApiPagination: import('react').ForwardRefExotic
|
|
|
7
7
|
onInputValueChange?: (inputValue: string) => void;
|
|
8
8
|
multiselect?: boolean;
|
|
9
9
|
onValueChange?: (selectedOptions: BaseOptionType[]) => void;
|
|
10
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
11
|
+
initialOpen?: boolean;
|
|
10
12
|
value?: BaseOptionType[];
|
|
11
13
|
defaultValue?: BaseOptionType[];
|
|
12
14
|
disabled?: boolean;
|
|
@@ -39,6 +39,8 @@ export type ComboboxWithApiPaginationProps<T extends BaseOptionType> = {
|
|
|
39
39
|
onInputValueChange?: (inputValue: string) => void;
|
|
40
40
|
multiselect?: boolean;
|
|
41
41
|
onValueChange?: (selectedOptions: T[]) => void;
|
|
42
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
43
|
+
initialOpen?: boolean;
|
|
42
44
|
value?: T[];
|
|
43
45
|
defaultValue?: T[];
|
|
44
46
|
disabled?: boolean;
|
package/dist/types/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ export declare const ComboboxWithApiTreeView: import('react').ForwardRefExoticCo
|
|
|
9
9
|
onInputValueChange?: (inputValue: string) => void;
|
|
10
10
|
multiselect?: boolean;
|
|
11
11
|
onValueChange?: (selectedOptions: TreeOptionType[]) => void;
|
|
12
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
13
|
+
initialOpen?: boolean;
|
|
14
|
+
closeOnSelection?: boolean;
|
|
12
15
|
value?: TreeOptionType[];
|
|
13
16
|
defaultValue?: TreeOptionType[];
|
|
14
17
|
disabled?: boolean;
|
|
@@ -48,6 +48,9 @@ export type ComboboxWithApiTreeViewProps<T extends TreeOptionType> = {
|
|
|
48
48
|
onInputValueChange?: (inputValue: string) => void;
|
|
49
49
|
multiselect?: boolean;
|
|
50
50
|
onValueChange?: (selectedOptions: T[]) => void;
|
|
51
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
52
|
+
initialOpen?: boolean;
|
|
53
|
+
closeOnSelection?: boolean;
|
|
51
54
|
value?: T[];
|
|
52
55
|
defaultValue?: T[];
|
|
53
56
|
disabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/combobox-with-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.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.
|
|
14
|
+
"@box/tree": "^0.57.0",
|
|
15
15
|
"react-accessible-treeview": "2.9.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@box/blueprint-web": "^12.59.
|
|
18
|
+
"@box/blueprint-web": "^12.59.1",
|
|
19
19
|
"@box/blueprint-web-assets": "^4.63.0",
|
|
20
20
|
"@box/storybook-utils": "^0.13.18",
|
|
21
21
|
"react": "^18.3.0",
|