@box/combobox-with-api 1.42.33 → 1.42.34
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/chunks/combobox-with-api-error.js +18 -0
- package/dist/chunks/combobox-with-api-pagination.js +168 -0
- package/dist/chunks/combobox-with-api-pagination2.js +229 -0
- package/dist/chunks/combobox-with-api-tree-view.js +423 -0
- package/dist/chunks/dynamic-loading-tree.js +299 -326
- package/dist/chunks/treeReducer.js +60 -78
- package/dist/esm/index.js +6 -16
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-container.js +47 -52
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api-error.js +2 -26
- package/dist/esm/lib/components/combobox-with-api/combobox-with-api.js +16 -36
- package/dist/esm/lib/components/combobox-with-api/messages.js +6 -10
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +2 -214
- package/dist/esm/lib/components/combobox-with-api-pagination/index.js +3 -205
- package/dist/esm/lib/components/combobox-with-api-pagination/messages.js +31 -33
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +4 -6
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +113 -128
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/is-abort-error.js +8 -10
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +32 -34
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +72 -82
- package/dist/esm/lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js +133 -174
- package/dist/esm/lib/components/combobox-with-api-tree-view/dynamic-loading-tree.js +2 -10
- package/dist/esm/lib/components/combobox-with-api-tree-view/index.js +3 -464
- package/dist/esm/lib/components/combobox-with-api-tree-view/tree-utils.js +17 -26
- package/dist/esm/lib/components/combobox-with-api-tree-view/treeReducer.js +2 -6
- package/dist/styles/combobox-with-api-error.css +1 -1
- package/dist/styles/combobox-with-api-pagination.css +1 -1
- package/dist/styles/dynamic-loading-tree.css +1 -1
- package/package.json +7 -7
|
@@ -1,78 +1,60 @@
|
|
|
1
|
-
import { RootTreeNode as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
[e]: {
|
|
62
|
-
...r[e],
|
|
63
|
-
status: "success",
|
|
64
|
-
marker: t,
|
|
65
|
-
children: []
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
default:
|
|
69
|
-
return r;
|
|
70
|
-
}
|
|
71
|
-
}, E = {
|
|
72
|
-
[n.id]: n
|
|
73
|
-
};
|
|
74
|
-
export {
|
|
75
|
-
s as A,
|
|
76
|
-
E as i,
|
|
77
|
-
R as t
|
|
78
|
-
};
|
|
1
|
+
import { RootTreeNode as e } from "../esm/lib/components/combobox-with-api-tree-view/tree-utils.js";
|
|
2
|
+
var t = /* @__PURE__ */ function(e) {
|
|
3
|
+
return e.LOAD_DATA = "LOAD_DATA", e.LOAD_ERROR = "LOAD_DATA_ERROR", e.LOAD_SUCCESS = "LOAD_DATA_SUCCESS", e.LOAD_MORE = "LOAD_DATA_SUCCESS", e.RESET = "RESET", e;
|
|
4
|
+
}({}), n = (e, n) => {
|
|
5
|
+
let { id: r, items: i, marker: a } = n.payload;
|
|
6
|
+
switch (n.type) {
|
|
7
|
+
case t.LOAD_DATA: return {
|
|
8
|
+
...e,
|
|
9
|
+
[r]: {
|
|
10
|
+
...e[r],
|
|
11
|
+
status: "loading"
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
case t.LOAD_ERROR: return {
|
|
15
|
+
...e,
|
|
16
|
+
[r]: {
|
|
17
|
+
...e[r],
|
|
18
|
+
marker: a,
|
|
19
|
+
status: "error"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
case t.LOAD_SUCCESS: {
|
|
23
|
+
let { itemsWithParent: t, itemsIds: n } = i.reduce((e, t) => ({
|
|
24
|
+
itemsWithParent: {
|
|
25
|
+
...e.itemsWithParent,
|
|
26
|
+
[t.id]: {
|
|
27
|
+
...t,
|
|
28
|
+
parent: r,
|
|
29
|
+
children: []
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
itemsIds: [...e.itemsIds, t.id]
|
|
33
|
+
}), {
|
|
34
|
+
itemsWithParent: {},
|
|
35
|
+
itemsIds: []
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
...e,
|
|
39
|
+
[r]: {
|
|
40
|
+
...e[r],
|
|
41
|
+
status: "success",
|
|
42
|
+
marker: a,
|
|
43
|
+
children: [...e[r].children || [], ...n]
|
|
44
|
+
},
|
|
45
|
+
...t
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
case t.RESET: return {
|
|
49
|
+
...e,
|
|
50
|
+
[r]: {
|
|
51
|
+
...e[r],
|
|
52
|
+
status: "success",
|
|
53
|
+
marker: a,
|
|
54
|
+
children: []
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
default: return e;
|
|
58
|
+
}
|
|
59
|
+
}, r = { [e.id]: e };
|
|
60
|
+
export { n, t as r, r as t };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { ComboboxWithApiTreeView as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export {
|
|
7
|
-
t as ComboboxWithApi,
|
|
8
|
-
r as ComboboxWithApiPagination,
|
|
9
|
-
p as ComboboxWithApiTreeView,
|
|
10
|
-
b as apiResponse,
|
|
11
|
-
a as findNode,
|
|
12
|
-
h as findState,
|
|
13
|
-
s as mockFetcher,
|
|
14
|
-
f as mockTreeFetcher,
|
|
15
|
-
C as states
|
|
16
|
-
};
|
|
1
|
+
import { t as e } from "../chunks/combobox-with-api-pagination.js";
|
|
2
|
+
import { n as t, r as n, t as r } from "../chunks/combobox-with-api-pagination2.js";
|
|
3
|
+
import { ComboboxWithApiTreeView as i } from "./lib/components/combobox-with-api-tree-view/combobox-with-api-tree-view.js";
|
|
4
|
+
import { n as a, r as o, t as s } from "../chunks/combobox-with-api-tree-view.js";
|
|
5
|
+
import { ComboboxWithApiContainer as c } from "./lib/components/combobox-with-api/combobox-with-api-container.js";
|
|
6
|
+
export { c as ComboboxWithApi, e as ComboboxWithApiPagination, i as ComboboxWithApiTreeView, o as apiResponse, s as findNode, r as findState, t as mockFetcher, a as mockTreeFetcher, n as states };
|
|
@@ -1,53 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onTryAgain: V,
|
|
48
|
-
options: L
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
export {
|
|
52
|
-
_ as ComboboxWithApiContainer
|
|
1
|
+
import { ComboboxWithApi as e } from "./combobox-with-api.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r, useState as i } from "react";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
|
+
import o from "lodash/debounce";
|
|
5
|
+
var s = "AbortError", c = (c) => {
|
|
6
|
+
let { debounceTime: l = 250, defaultOptions: u, fetcher: d, includeTextInputOption: f = !1, onInputValueChange: p, ...m } = c, [h, g] = i(!1), [_, v] = i(!1), [y, b] = i(!1), [x, S] = i(""), [C, w] = i([]), T = r(() => o(S, l), [l]), E = (e) => {
|
|
7
|
+
T(e), p?.(e);
|
|
8
|
+
}, D = t(async (e) => {
|
|
9
|
+
let t = e.trim();
|
|
10
|
+
if (t) {
|
|
11
|
+
v(!1), g(!0);
|
|
12
|
+
try {
|
|
13
|
+
let e = await d(t);
|
|
14
|
+
(!(e.length > 0) || typeof e[0] == "string") && f ? w([t.toLocaleLowerCase(), ...e]) : (b(e?.length === 0), w(e));
|
|
15
|
+
} catch (e) {
|
|
16
|
+
e?.name !== s && v(!0);
|
|
17
|
+
} finally {
|
|
18
|
+
g(!1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, [d, f]), O = () => {
|
|
22
|
+
D(x);
|
|
23
|
+
};
|
|
24
|
+
n(() => (x.trim().length ? D(x) : (w([]), b(!1)), () => T.cancel()), [
|
|
25
|
+
T,
|
|
26
|
+
D,
|
|
27
|
+
x
|
|
28
|
+
]);
|
|
29
|
+
let k = r(() => {
|
|
30
|
+
let e = x.trim().length > 0;
|
|
31
|
+
return u?.length > 0 && !e ? u : C;
|
|
32
|
+
}, [
|
|
33
|
+
x,
|
|
34
|
+
u,
|
|
35
|
+
C
|
|
36
|
+
]);
|
|
37
|
+
return /* @__PURE__ */ a(e, {
|
|
38
|
+
...m,
|
|
39
|
+
isEmpty: y,
|
|
40
|
+
isError: _,
|
|
41
|
+
isLoading: h,
|
|
42
|
+
loading: h,
|
|
43
|
+
onInputValueChange: E,
|
|
44
|
+
onTryAgain: O,
|
|
45
|
+
options: k
|
|
46
|
+
});
|
|
53
47
|
};
|
|
48
|
+
export { c as ComboboxWithApiContainer };
|
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { FormattedMessage as s } from "react-intl";
|
|
4
|
-
import a from "./messages.js";
|
|
5
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
6
|
-
import '../../../../styles/combobox-with-api-error.css';const m = "_container_1ozsi_1", c = {
|
|
7
|
-
container: m
|
|
8
|
-
}, h = /* @__PURE__ */ n(({
|
|
9
|
-
onTryAgain: r
|
|
10
|
-
}, t) => /* @__PURE__ */ o(e.Option, {
|
|
11
|
-
onClick: r,
|
|
12
|
-
children: /* @__PURE__ */ o("div", {
|
|
13
|
-
ref: t,
|
|
14
|
-
className: c.container,
|
|
15
|
-
children: /* @__PURE__ */ o(i, {
|
|
16
|
-
as: "span",
|
|
17
|
-
color: "textOnLightLink",
|
|
18
|
-
children: /* @__PURE__ */ o(s, {
|
|
19
|
-
...a.loadingResultsError
|
|
20
|
-
})
|
|
21
|
-
})
|
|
22
|
-
})
|
|
23
|
-
}));
|
|
24
|
-
export {
|
|
25
|
-
h as default
|
|
26
|
-
};
|
|
1
|
+
import { t as e } from "../../../../chunks/combobox-with-api-error.js";
|
|
2
|
+
export { e as default };
|
|
@@ -1,37 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = m, c = f(() => {
|
|
17
|
-
if (Array.isArray(e)) {
|
|
18
|
-
const d = [...t, ...e].reverse();
|
|
19
|
-
return v(d, (s) => (typeof s == "string" ? s : s.value).toLocaleLowerCase().trim()).reverse();
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
}, [t, e]);
|
|
23
|
-
let o;
|
|
24
|
-
return p && !r ? o = /* @__PURE__ */ n(g, {
|
|
25
|
-
onTryAgain: a
|
|
26
|
-
}) : u && i && !r ? o = i : o = void 0, /* @__PURE__ */ n(b, {
|
|
27
|
-
...l,
|
|
28
|
-
hideSelectedOptions: !0,
|
|
29
|
-
loading: r,
|
|
30
|
-
noResultMessage: o,
|
|
31
|
-
options: c,
|
|
32
|
-
value: e
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
h as ComboboxWithApi
|
|
1
|
+
import { t as e } from "../../../../chunks/combobox-with-api-error.js";
|
|
2
|
+
import { Combobox as t } from "@box/blueprint-web";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import i from "lodash/uniqBy";
|
|
6
|
+
var a = (a) => {
|
|
7
|
+
let { isEmpty: o, isError: s, isLoading: c, noResultMessage: l, onTryAgain: u, options: d, value: f, ...p } = a, m = n(() => Array.isArray(f) ? i([...d, ...f].reverse(), (e) => (typeof e == "string" ? e : e.value).toLocaleLowerCase().trim()).reverse() : d, [d, f]), h;
|
|
8
|
+
return h = s && !c ? /* @__PURE__ */ r(e, { onTryAgain: u }) : o && l && !c ? l : void 0, /* @__PURE__ */ r(t, {
|
|
9
|
+
...p,
|
|
10
|
+
hideSelectedOptions: !0,
|
|
11
|
+
loading: c,
|
|
12
|
+
noResultMessage: h,
|
|
13
|
+
options: m,
|
|
14
|
+
value: f
|
|
15
|
+
});
|
|
37
16
|
};
|
|
17
|
+
export { a as ComboboxWithApi };
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { defineMessages as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
export {
|
|
9
|
-
o as default
|
|
10
|
-
};
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
|
2
|
+
var t = e({ loadingResultsError: {
|
|
3
|
+
id: "comboboxWithApi.apiError",
|
|
4
|
+
defaultMessage: "Couldn't load results. Click to try again."
|
|
5
|
+
} });
|
|
6
|
+
export { t as default };
|
package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js
CHANGED
|
@@ -1,214 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Search as fe, Loader as ge } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
-
import { Size6 as V, Size1 as be, IconIconOnLightSecondary as Oe } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import N from "clsx";
|
|
6
|
-
import { forwardRef as B, useRef as L, useState as xe, useCallback as k, useMemo as y, useEffect as _e } from "react";
|
|
7
|
-
import { useIntl as W, FormattedMessage as F } from "react-intl";
|
|
8
|
-
import a from "./messages.js";
|
|
9
|
-
import { useAsyncList as Ce } from "./use-async-list.js";
|
|
10
|
-
import { useControllableState as Re } from "./utils/use-controllable-state.js";
|
|
11
|
-
import { useTrackVisibility as Ae } from "./utils/use-intersection-observer.js";
|
|
12
|
-
import { jsx as r, jsxs as P, Fragment as Le } from "react/jsx-runtime";
|
|
13
|
-
import '../../../../styles/combobox-with-api-pagination.css';const ye = "_disabled_19k3s_8", Ee = "_highlightOptionText_19k3s_12", Ie = "_selected_19k3s_24", ve = "_option_19k3s_35", Me = "_errorComboboxOption_19k3s_39", Se = "_errorComboboxOptionText_19k3s_44", i = {
|
|
14
|
-
disabled: ye,
|
|
15
|
-
highlightOptionText: Ee,
|
|
16
|
-
selected: Ie,
|
|
17
|
-
option: ve,
|
|
18
|
-
errorComboboxOption: Me,
|
|
19
|
-
errorComboboxOptionText: Se
|
|
20
|
-
}, D = /* @__PURE__ */ B(({
|
|
21
|
-
onTryAgain: v
|
|
22
|
-
}, p) => {
|
|
23
|
-
const {
|
|
24
|
-
formatMessage: m
|
|
25
|
-
} = W();
|
|
26
|
-
return /* @__PURE__ */ P(Le, {
|
|
27
|
-
children: [/* @__PURE__ */ r(me, {
|
|
28
|
-
variant: "error",
|
|
29
|
-
variantIconAriaLabel: m(a.loadingResultsErrorIconLabel),
|
|
30
|
-
children: /* @__PURE__ */ r(F, {
|
|
31
|
-
...a.loadingResultsErrorMessage
|
|
32
|
-
})
|
|
33
|
-
}), /* @__PURE__ */ r(d.Option, {
|
|
34
|
-
ref: p,
|
|
35
|
-
className: i.errorComboboxOption,
|
|
36
|
-
onClick: v,
|
|
37
|
-
children: /* @__PURE__ */ P(he, {
|
|
38
|
-
as: "span",
|
|
39
|
-
className: i.errorComboboxOptionText,
|
|
40
|
-
color: "textOnLightLink",
|
|
41
|
-
variant: "bodyDefaultBold",
|
|
42
|
-
children: [/* @__PURE__ */ r(F, {
|
|
43
|
-
...a.loadingResultsErrorAction
|
|
44
|
-
}), /* @__PURE__ */ r(ge, {
|
|
45
|
-
color: "currentColor",
|
|
46
|
-
height: "12px",
|
|
47
|
-
width: "12px"
|
|
48
|
-
})]
|
|
49
|
-
})
|
|
50
|
-
})]
|
|
51
|
-
});
|
|
52
|
-
}), E = "__LOADING__", I = "__LOADING_ERROR__", Te = "0px 0px 20px 0px", Ve = /* @__PURE__ */ r(fe, {
|
|
53
|
-
color: Oe,
|
|
54
|
-
height: V,
|
|
55
|
-
role: "presentation",
|
|
56
|
-
style: {
|
|
57
|
-
padding: be,
|
|
58
|
-
boxSizing: "border-box"
|
|
59
|
-
},
|
|
60
|
-
width: V
|
|
61
|
-
}), qe = /* @__PURE__ */ B(function(p, m) {
|
|
62
|
-
const {
|
|
63
|
-
dataTargetId: w,
|
|
64
|
-
defaultFetcher: z,
|
|
65
|
-
initialOpen: G = !1,
|
|
66
|
-
onInputValueChange: j,
|
|
67
|
-
value: U,
|
|
68
|
-
onValueChange: q,
|
|
69
|
-
onOpenChange: h,
|
|
70
|
-
noResultMessage: H,
|
|
71
|
-
defaultValue: J = [],
|
|
72
|
-
loadingAriaLabel: K,
|
|
73
|
-
multiselect: s = !1,
|
|
74
|
-
disabled: f,
|
|
75
|
-
className: Q,
|
|
76
|
-
displaySingleSelectionAsChip: g = !0,
|
|
77
|
-
...X
|
|
78
|
-
} = p, {
|
|
79
|
-
formatMessage: c
|
|
80
|
-
} = W(), b = L(null), O = L(!0), [Y, M] = xe(G), e = Ce({
|
|
81
|
-
async load({
|
|
82
|
-
marker: o,
|
|
83
|
-
searchInput: t,
|
|
84
|
-
signal: R
|
|
85
|
-
}) {
|
|
86
|
-
const l = await z({
|
|
87
|
-
signal: R,
|
|
88
|
-
marker: o,
|
|
89
|
-
searchInput: t
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
items: l.options,
|
|
93
|
-
marker: l.marker
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
}), S = L(!1), Z = k(() => {
|
|
97
|
-
S.current || (e.reload(), S.current = !0);
|
|
98
|
-
}, []), [n, x] = Re({
|
|
99
|
-
prop: U,
|
|
100
|
-
defaultProp: J,
|
|
101
|
-
onChange: q
|
|
102
|
-
}), _ = !s && n.length === 1, $ = _ && !f, ee = k((o) => {
|
|
103
|
-
M(o), h?.(o);
|
|
104
|
-
}, [h]), oe = (o) => {
|
|
105
|
-
f || (o === void 0 ? (x([]), (!O.current || !g) && (e.search(""), O.current = !0)) : Array.isArray(o) ? x(o) : (x([o]), s || (M(!1), h?.(!1))));
|
|
106
|
-
}, te = y(() => n.length === 0 ? s ? [] : void 0 : s ? n : n[0], [s, n]), C = y(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), re = (o) => {
|
|
107
|
-
const {
|
|
108
|
-
value: t,
|
|
109
|
-
displayValue: R,
|
|
110
|
-
...l
|
|
111
|
-
} = o;
|
|
112
|
-
if (t === E)
|
|
113
|
-
return e.hasNextPage ? /* @__PURE__ */ r(d.Option, {
|
|
114
|
-
...l,
|
|
115
|
-
ref: se,
|
|
116
|
-
disabled: !0,
|
|
117
|
-
value: t,
|
|
118
|
-
children: /* @__PURE__ */ r(pe, {
|
|
119
|
-
"aria-label": c(a.loadingMoreAriaLabel),
|
|
120
|
-
style: {
|
|
121
|
-
position: "unset"
|
|
122
|
-
}
|
|
123
|
-
})
|
|
124
|
-
}) : null;
|
|
125
|
-
if (t === I && e.hasError && !e.isEmpty)
|
|
126
|
-
return /* @__PURE__ */ r(D, {
|
|
127
|
-
onTryAgain: () => {
|
|
128
|
-
e.loadMore(), b.current?.focus();
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
if (C.some((A) => A.value === t))
|
|
132
|
-
return null;
|
|
133
|
-
const ce = n.some((A) => A.value === t);
|
|
134
|
-
return /* @__PURE__ */ r(d.Option, {
|
|
135
|
-
...l,
|
|
136
|
-
className: i.option,
|
|
137
|
-
value: t,
|
|
138
|
-
children: /* @__PURE__ */ r(ue, {
|
|
139
|
-
className: N(i.highlightOptionText, ce && i.selected),
|
|
140
|
-
value: R || t
|
|
141
|
-
})
|
|
142
|
-
});
|
|
143
|
-
}, ne = (o) => {
|
|
144
|
-
if (j?.(o), _ && o === "") {
|
|
145
|
-
O.current = !1;
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
e.search(o);
|
|
149
|
-
}, ae = () => {
|
|
150
|
-
e.reload(), b.current?.focus();
|
|
151
|
-
};
|
|
152
|
-
let u;
|
|
153
|
-
e.hasError && !e.isLoading ? u = /* @__PURE__ */ r(D, {
|
|
154
|
-
onTryAgain: ae
|
|
155
|
-
}) : e.isEmpty && !e.isLoading ? u = H || c(a.noResults) : u = void 0;
|
|
156
|
-
const [se, {
|
|
157
|
-
rootRef: ie,
|
|
158
|
-
isVisible: T
|
|
159
|
-
}] = Ae({
|
|
160
|
-
rootMargin: Te
|
|
161
|
-
});
|
|
162
|
-
_e(() => {
|
|
163
|
-
if (!(T && e.hasNextPage))
|
|
164
|
-
return;
|
|
165
|
-
const t = setTimeout(() => {
|
|
166
|
-
e.loadMore();
|
|
167
|
-
}, 100);
|
|
168
|
-
return () => {
|
|
169
|
-
clearTimeout(t);
|
|
170
|
-
};
|
|
171
|
-
}, [T]);
|
|
172
|
-
const le = y(() => {
|
|
173
|
-
const o = e.hasNextPage ? {
|
|
174
|
-
displayValue: E,
|
|
175
|
-
value: E
|
|
176
|
-
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
177
|
-
displayValue: I,
|
|
178
|
-
value: I
|
|
179
|
-
} : null;
|
|
180
|
-
return [...e.items, ...C, o, t].filter(Boolean);
|
|
181
|
-
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items, C]);
|
|
182
|
-
return /* @__PURE__ */ r(d, {
|
|
183
|
-
...X,
|
|
184
|
-
ref: de(b, m),
|
|
185
|
-
as: "input",
|
|
186
|
-
className: N(Q, {
|
|
187
|
-
[i.disabled]: $
|
|
188
|
-
}),
|
|
189
|
-
clearButtonAriaLabel: c(a.clearButtonAriaLabel),
|
|
190
|
-
clearOnBlur: !1,
|
|
191
|
-
"data-target-id": w,
|
|
192
|
-
disabled: f || _ && g,
|
|
193
|
-
displaySingleSelectionAsChip: g,
|
|
194
|
-
displayValue: (o) => o.displayValue || o.value,
|
|
195
|
-
endComboboxIcon: Ve,
|
|
196
|
-
focusLoop: !1,
|
|
197
|
-
getPopoverRef: ie,
|
|
198
|
-
loading: e.isReloading,
|
|
199
|
-
loadingAriaLabel: K || c(a.loadingAriaLabel),
|
|
200
|
-
multiselect: s,
|
|
201
|
-
noResultMessage: u,
|
|
202
|
-
onFocus: Z,
|
|
203
|
-
onInputValueChange: ne,
|
|
204
|
-
onOpenChange: ee,
|
|
205
|
-
onValueChange: oe,
|
|
206
|
-
open: Y,
|
|
207
|
-
options: le,
|
|
208
|
-
renderOption: re,
|
|
209
|
-
value: te
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
export {
|
|
213
|
-
qe as ComboboxWithApiPagination
|
|
214
|
-
};
|
|
1
|
+
import { t as e } from "../../../../chunks/combobox-with-api-pagination.js";
|
|
2
|
+
export { e as ComboboxWithApiPagination };
|