@box/metadata-editor 1.15.4 → 1.17.0
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/filter-dropdown-menu.module.js +9 -12
- package/dist/chunks/metadata-instance-form-card-wrapper.js +32 -32
- package/dist/chunks/taxonomy-ancestor-status-pill.js +37 -38
- package/dist/chunks/types.js +3 -3
- package/dist/chunks/utils2.js +28 -30
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +93 -96
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +2 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +3 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +21 -24
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +59 -61
- package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +39 -40
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +37 -37
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +9 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +35 -36
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +52 -52
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +22 -23
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +31 -32
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +22 -22
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +114 -114
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +96 -98
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +29 -29
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +39 -40
- package/dist/esm/lib/constants.js +3 -3
- package/dist/i18n/en-x-pseudo.js +128 -128
- package/dist/i18n/en-x-pseudo.properties +128 -128
- package/dist/styles/autofill-overlay.css +1 -1
- package/dist/styles/filter-dropdown-menu.css +1 -1
- package/dist/styles/taxonomy-ancestor-status-pill.css +1 -1
- package/package.json +9 -9
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import '../styles/filter-dropdown-menu.css';const c = "_content_2vpjl_2", e = "_scrollableContainer_2vpjl_21",
|
|
1
|
+
import '../styles/filter-dropdown-menu.css';const c = "_content_2vpjl_2", e = "_scrollableContainer_2vpjl_21", n = "_item_2vpjl_26", o = "_option_2vpjl_36", t = "_search_2vpjl_57", s = "_searchIcon_2vpjl_62", r = "_clearSearchIcon_2vpjl_76", _ = "_searchInput_2vpjl_84", a = "_searchDivider_2vpjl_138", l = {
|
|
2
2
|
content: c,
|
|
3
3
|
scrollableContainer: e,
|
|
4
|
-
item:
|
|
5
|
-
option:
|
|
6
|
-
search:
|
|
7
|
-
searchIcon:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
firefoxDefaultOpacityFix: s,
|
|
12
|
-
divider: i,
|
|
13
|
-
searchDivider: p
|
|
4
|
+
item: n,
|
|
5
|
+
option: o,
|
|
6
|
+
search: t,
|
|
7
|
+
searchIcon: s,
|
|
8
|
+
clearSearchIcon: r,
|
|
9
|
+
searchInput: _,
|
|
10
|
+
searchDivider: a
|
|
14
11
|
};
|
|
15
12
|
export {
|
|
16
|
-
|
|
13
|
+
l as s
|
|
17
14
|
};
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { useBlueprintModernization as
|
|
2
|
-
import
|
|
3
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
|
4
|
-
import { MetadataInstanceFormFooter as
|
|
5
|
-
import { MetadataInstanceFormHeader as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import '../styles/metadata-instance-form-card-wrapper.css';const
|
|
8
|
-
metadataInstanceForm:
|
|
9
|
-
wrapperGradient:
|
|
1
|
+
import { useBlueprintModernization as A, Card as E } from "@box/blueprint-web";
|
|
2
|
+
import M from "clsx";
|
|
3
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as S } from "../esm/lib/constants.js";
|
|
4
|
+
import { MetadataInstanceFormFooter as b } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js";
|
|
5
|
+
import { MetadataInstanceFormHeader as w } from "../esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
|
|
6
|
+
import { jsx as a, jsxs as v } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/metadata-instance-form-card-wrapper.css';const x = "_metadataInstanceForm_moyil_1", D = "_wrapperGradient_moyil_7", L = "_suggestionsFetching_moyil_17", N = "_metadataInstanceFormContent_moyil_23", O = "_showOverlay_moyil_30", s = {
|
|
8
|
+
metadataInstanceForm: x,
|
|
9
|
+
wrapperGradient: D,
|
|
10
10
|
suggestionsFetching: L,
|
|
11
11
|
metadataInstanceFormContent: N,
|
|
12
12
|
showOverlay: O
|
|
13
|
-
},
|
|
13
|
+
}, z = (n) => {
|
|
14
14
|
const {
|
|
15
15
|
areAiSuggestionsAvailable: o,
|
|
16
16
|
children: i,
|
|
17
17
|
className: r,
|
|
18
18
|
formRef: m,
|
|
19
|
-
isAdvancedExtractAgentEnabled:
|
|
19
|
+
isAdvancedExtractAgentEnabled: l = !1,
|
|
20
20
|
isAiSuggestionsFeatureEnabled: d,
|
|
21
|
-
isBetaLanguageEnabled:
|
|
22
|
-
isLargeFile:
|
|
23
|
-
isDeleteButtonDisabled:
|
|
24
|
-
suggestions:
|
|
21
|
+
isBetaLanguageEnabled: c,
|
|
22
|
+
isLargeFile: g = !1,
|
|
23
|
+
isDeleteButtonDisabled: p,
|
|
24
|
+
suggestions: u,
|
|
25
25
|
isFetchingSuggestions: e,
|
|
26
|
-
isFormDirty:
|
|
27
|
-
selectedTemplateInstance:
|
|
26
|
+
isFormDirty: F = !1,
|
|
27
|
+
selectedTemplateInstance: t,
|
|
28
28
|
getAiSuggestions: _,
|
|
29
29
|
handleCancel: h,
|
|
30
30
|
handleDelete: f
|
|
31
31
|
} = n, {
|
|
32
32
|
enableModernizedComponents: y
|
|
33
|
-
} =
|
|
34
|
-
return /* @__PURE__ */
|
|
33
|
+
} = A(), I = t?.templateKey === S, C = !!u[t?.templateKey];
|
|
34
|
+
return /* @__PURE__ */ a("div", {
|
|
35
35
|
className: e && s.wrapperGradient,
|
|
36
36
|
"data-modern": y,
|
|
37
|
-
children: /* @__PURE__ */
|
|
37
|
+
children: /* @__PURE__ */ v(E, {
|
|
38
38
|
ref: m,
|
|
39
|
-
className:
|
|
39
|
+
className: M(r, {
|
|
40
40
|
[s.suggestionsFetching]: e
|
|
41
41
|
}),
|
|
42
|
-
children: [/* @__PURE__ */
|
|
42
|
+
children: [/* @__PURE__ */ a(w, {
|
|
43
43
|
areAiSuggestionsAvailable: o,
|
|
44
|
-
hasSuggestions:
|
|
45
|
-
isAdvancedExtractAgentEnabled:
|
|
46
|
-
isAiSuggestionsFeatureEnabled: d && !
|
|
47
|
-
isBetaLanguageEnabled:
|
|
48
|
-
isLargeFile:
|
|
44
|
+
hasSuggestions: C,
|
|
45
|
+
isAdvancedExtractAgentEnabled: l,
|
|
46
|
+
isAiSuggestionsFeatureEnabled: d && !I,
|
|
47
|
+
isBetaLanguageEnabled: c,
|
|
48
|
+
isLargeFile: g,
|
|
49
49
|
isLoading: e,
|
|
50
50
|
onAutofill: _,
|
|
51
|
-
templateName:
|
|
52
|
-
}),
|
|
53
|
-
isDeleteButtonDisabled:
|
|
51
|
+
templateName: t?.displayName
|
|
52
|
+
}), t && i, /* @__PURE__ */ a(b, {
|
|
53
|
+
isDeleteButtonDisabled: p,
|
|
54
54
|
isLoading: e,
|
|
55
|
-
onCancel: () => h(
|
|
55
|
+
onCancel: () => h(F),
|
|
56
56
|
onDelete: f
|
|
57
57
|
})]
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
z as M,
|
|
63
63
|
s
|
|
64
64
|
};
|
|
@@ -1,41 +1,40 @@
|
|
|
1
|
-
import { Popover as t, FilterChip as
|
|
1
|
+
import { Popover as t, FilterChip as v, InlineNotice as A, TextButton as T, LoadingIndicator as I } from "@box/blueprint-web";
|
|
2
2
|
import { Loader as W } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
3
|
import V from "lodash/orderBy";
|
|
4
4
|
import { useState as s } from "react";
|
|
5
|
-
import { useIntl as B, FormattedMessage as
|
|
5
|
+
import { useIntl as B, FormattedMessage as y } from "react-intl";
|
|
6
6
|
import a from "../esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-entry/taxonomy-entry/messages.js";
|
|
7
7
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
8
|
-
import '../styles/taxonomy-ancestor-status-pill.css';const N = "_popoverContentContainer_1vfhn_2", w = "_popoverMainContent_1vfhn_7", E = "_loadingIndicatorWrapper_1vfhn_11", D = "_errorMessageWrapper_1vfhn_18", P = "_errorMessageWrapperText_1vfhn_23", R = "
|
|
8
|
+
import '../styles/taxonomy-ancestor-status-pill.css';const N = "_popoverContentContainer_1vfhn_2", w = "_popoverMainContent_1vfhn_7", E = "_loadingIndicatorWrapper_1vfhn_11", D = "_errorMessageWrapper_1vfhn_18", P = "_errorMessageWrapperText_1vfhn_23", R = "_taxonomyAncestorTable_1vfhn_37", k = "_taxonomyValueGroup_1vfhn_80", K = "_taxonomyValueButton_1vfhn_85", G = "_taxonomyValueLabel_1vfhn_95", n = {
|
|
9
9
|
popoverContentContainer: N,
|
|
10
10
|
popoverMainContent: w,
|
|
11
11
|
loadingIndicatorWrapper: E,
|
|
12
12
|
errorMessageWrapper: D,
|
|
13
13
|
errorMessageWrapperText: P,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}, j = {
|
|
14
|
+
taxonomyAncestorTable: R,
|
|
15
|
+
taxonomyValueGroup: k,
|
|
16
|
+
taxonomyValueButton: K,
|
|
17
|
+
taxonomyValueLabel: G
|
|
18
|
+
}, O = {
|
|
20
19
|
right: 24
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
},
|
|
24
|
-
(
|
|
20
|
+
}, j = (r) => {
|
|
21
|
+
r.stopPropagation();
|
|
22
|
+
}, S = (r) => {
|
|
23
|
+
(r.key === "ArrowLeft" || r.key === "ArrowRight") && r.stopPropagation();
|
|
25
24
|
};
|
|
26
|
-
function
|
|
27
|
-
taxonomyNodeFetcher:
|
|
28
|
-
scope:
|
|
25
|
+
function X({
|
|
26
|
+
taxonomyNodeFetcher: r,
|
|
27
|
+
scope: _,
|
|
29
28
|
taxonomyKey: f,
|
|
30
29
|
value: x,
|
|
31
30
|
displayValue: c
|
|
32
31
|
}) {
|
|
33
32
|
const {
|
|
34
33
|
formatMessage: i
|
|
35
|
-
} = B(), [C, b] = s([]), [p, d] = s(!1), [m, g] = s(!1), [M, h] = s(!1), L = V(C, (o) => o.level),
|
|
34
|
+
} = B(), [C, b] = s([]), [p, d] = s(!1), [m, g] = s(!1), [M, h] = s(!1), L = V(C, (o) => o.level), u = async () => {
|
|
36
35
|
d(!0), g(!1), h(!0);
|
|
37
36
|
try {
|
|
38
|
-
const o = await
|
|
37
|
+
const o = await r(_, f, x);
|
|
39
38
|
b(o);
|
|
40
39
|
} catch {
|
|
41
40
|
g(!0);
|
|
@@ -47,56 +46,56 @@ function Y({
|
|
|
47
46
|
onOpenChange: h,
|
|
48
47
|
open: M,
|
|
49
48
|
children: [/* @__PURE__ */ e(t.Trigger, {
|
|
50
|
-
children: /* @__PURE__ */ e(
|
|
49
|
+
children: /* @__PURE__ */ e(v.ChipButton, {
|
|
51
50
|
"aria-checked": void 0,
|
|
52
|
-
className:
|
|
53
|
-
disabled: !
|
|
54
|
-
onClick:
|
|
55
|
-
onKeyDown:
|
|
51
|
+
className: n.taxonomyValueButton,
|
|
52
|
+
disabled: !r,
|
|
53
|
+
onClick: u,
|
|
54
|
+
onKeyDown: S,
|
|
56
55
|
role: void 0,
|
|
57
56
|
value: c,
|
|
58
|
-
children: /* @__PURE__ */ e(
|
|
59
|
-
className:
|
|
57
|
+
children: /* @__PURE__ */ e(v.Label, {
|
|
58
|
+
className: n.taxonomyValueLabel,
|
|
60
59
|
children: c
|
|
61
60
|
})
|
|
62
61
|
})
|
|
63
62
|
}), /* @__PURE__ */ e(t.ContentContainer, {
|
|
64
63
|
align: "start",
|
|
65
|
-
className:
|
|
66
|
-
collisionPadding:
|
|
67
|
-
onEscapeKeyDown:
|
|
64
|
+
className: n.popoverContentContainer,
|
|
65
|
+
collisionPadding: O,
|
|
66
|
+
onEscapeKeyDown: j,
|
|
68
67
|
children: /* @__PURE__ */ l(t.MainContent, {
|
|
69
|
-
className:
|
|
68
|
+
className: n.popoverMainContent,
|
|
70
69
|
children: [m && /* @__PURE__ */ l("div", {
|
|
71
|
-
className:
|
|
70
|
+
className: n.errorMessageWrapper,
|
|
72
71
|
children: [/* @__PURE__ */ e(A, {
|
|
73
72
|
variant: "error",
|
|
74
73
|
variantIconAriaLabel: i(a.loadingResultsErrorIconLabel),
|
|
75
|
-
children: /* @__PURE__ */ e(
|
|
74
|
+
children: /* @__PURE__ */ e(y, {
|
|
76
75
|
...a.loadingResultsErrorMessage
|
|
77
76
|
})
|
|
78
77
|
}), /* @__PURE__ */ e(T, {
|
|
79
|
-
className:
|
|
78
|
+
className: n.errorMessageWrapperText,
|
|
80
79
|
icon: W,
|
|
81
|
-
onClick:
|
|
80
|
+
onClick: u,
|
|
82
81
|
"data-target-id": "TextButton-loadingResultsErrorAction",
|
|
83
82
|
children: i(a.loadingResultsErrorAction)
|
|
84
83
|
})]
|
|
85
84
|
}), p && /* @__PURE__ */ e("div", {
|
|
86
|
-
className:
|
|
85
|
+
className: n.loadingIndicatorWrapper,
|
|
87
86
|
children: /* @__PURE__ */ e(I, {
|
|
88
87
|
"aria-label": i(a.loadingAriaLabel),
|
|
89
88
|
size: "large"
|
|
90
89
|
})
|
|
91
90
|
}), !m && !p && /* @__PURE__ */ e("table", {
|
|
92
|
-
className:
|
|
91
|
+
className: n.taxonomyAncestorTable,
|
|
93
92
|
children: /* @__PURE__ */ e("tbody", {
|
|
94
93
|
children: L.map((o) => /* @__PURE__ */ l("tr", {
|
|
95
94
|
children: [/* @__PURE__ */ e("th", {
|
|
96
95
|
scope: "row",
|
|
97
96
|
children: o.levelName
|
|
98
97
|
}), /* @__PURE__ */ e("td", {
|
|
99
|
-
children: o.levelValue || /* @__PURE__ */ e(
|
|
98
|
+
children: o.levelValue || /* @__PURE__ */ e(y, {
|
|
100
99
|
...a.emptyAncestorLevelValue
|
|
101
100
|
})
|
|
102
101
|
})]
|
|
@@ -108,6 +107,6 @@ function Y({
|
|
|
108
107
|
});
|
|
109
108
|
}
|
|
110
109
|
export {
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
X as T,
|
|
111
|
+
n as s
|
|
113
112
|
};
|
package/dist/chunks/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
let n = /* @__PURE__ */ function(e) {
|
|
1
|
+
let n = /* @__PURE__ */ (function(e) {
|
|
2
2
|
return e.ClearAndReplace = "clearAndReplace", e.RemoveEntered = "removeEntered", e.ReplaceEntered = "replaceEntered", e.Append = "append", e;
|
|
3
|
-
}({}), r = /* @__PURE__ */ function(e) {
|
|
3
|
+
})({}), r = /* @__PURE__ */ (function(e) {
|
|
4
4
|
return e.Initial = "INITIAL", e.Pending = "PENDING", e.Applied = "APPLIED", e;
|
|
5
|
-
}({});
|
|
5
|
+
})({});
|
|
6
6
|
export {
|
|
7
7
|
r as A,
|
|
8
8
|
n as U
|
package/dist/chunks/utils2.js
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
import { BoxAiLogo as
|
|
1
|
+
import { BoxAiLogo as n } from "@box/blueprint-web-assets/icons/Logo";
|
|
2
2
|
import i from "../esm/lib/components/interactive-text/interactive-text.js";
|
|
3
|
-
import { convertISOStringtoRFC3339String as
|
|
4
|
-
import { jsxs as
|
|
5
|
-
import '../styles/utils.css';const
|
|
6
|
-
noAttributesText:
|
|
7
|
-
fieldWrapper:
|
|
8
|
-
hasSuggestion:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
suggestionApplied: x,
|
|
12
|
-
comboboxContainer: m,
|
|
3
|
+
import { convertISOStringtoRFC3339String as g } from "../esm/lib/utils/convertDate.js";
|
|
4
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
5
|
+
import '../styles/utils.css';const p = "_noAttributesText_fefg3_2", _ = "_fieldWrapper_fefg3_6", f = "_hasSuggestion_fefg3_11", b = "_dateField_fefg3_33", d = "_suggestionApplied_fefg3_37", u = "_labelWrapper_fefg3_52", x = "_labelText_fefg3_58", m = "_labelIcon_fefg3_61", l = {
|
|
6
|
+
noAttributesText: p,
|
|
7
|
+
fieldWrapper: _,
|
|
8
|
+
hasSuggestion: f,
|
|
9
|
+
dateField: b,
|
|
10
|
+
suggestionApplied: d,
|
|
13
11
|
labelWrapper: u,
|
|
14
|
-
labelText:
|
|
15
|
-
labelIcon:
|
|
16
|
-
},
|
|
17
|
-
className:
|
|
18
|
-
children: [e ? /* @__PURE__ */
|
|
19
|
-
as:
|
|
20
|
-
className:
|
|
12
|
+
labelText: x,
|
|
13
|
+
labelIcon: m
|
|
14
|
+
}, W = (t, e, a = !1, o = "label") => (r) => /* @__PURE__ */ c("div", {
|
|
15
|
+
className: l.labelWrapper,
|
|
16
|
+
children: [e ? /* @__PURE__ */ s(i, {
|
|
17
|
+
as: o,
|
|
18
|
+
className: l.labelText,
|
|
21
19
|
tooltipText: e,
|
|
22
|
-
...
|
|
20
|
+
...r,
|
|
23
21
|
children: t
|
|
24
|
-
}) : /* @__PURE__ */
|
|
25
|
-
className:
|
|
26
|
-
...
|
|
22
|
+
}) : /* @__PURE__ */ s("label", {
|
|
23
|
+
className: l.labelText,
|
|
24
|
+
...r,
|
|
27
25
|
children: t
|
|
28
|
-
}),
|
|
29
|
-
className:
|
|
26
|
+
}), a && /* @__PURE__ */ s(n, {
|
|
27
|
+
className: l.labelIcon
|
|
30
28
|
})]
|
|
31
|
-
}),
|
|
29
|
+
}), I = (t) => {
|
|
32
30
|
try {
|
|
33
|
-
const e =
|
|
34
|
-
return isNaN(
|
|
31
|
+
const e = g(t), a = new Date(e);
|
|
32
|
+
return isNaN(a.getTime()) ? null : e;
|
|
35
33
|
} catch {
|
|
36
34
|
return null;
|
|
37
35
|
}
|
|
38
36
|
};
|
|
39
37
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
W as g,
|
|
39
|
+
l as s,
|
|
40
|
+
I as t
|
|
43
41
|
};
|
package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js
CHANGED
|
@@ -1,46 +1,45 @@
|
|
|
1
1
|
import { ComboboxItemValue as te } from "@ariakit/react";
|
|
2
|
-
import { Combobox as
|
|
2
|
+
import { Combobox as d, useForkRef as re, LoadingIndicator as ne, InlineNotice as ie, Text as se } from "@box/blueprint-web";
|
|
3
3
|
import { Search as ae, Loader as le } from "@box/blueprint-web-assets/icons/Fill";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { useIntl as
|
|
4
|
+
import { Size6 as M, Size1 as ce, IconIconOnLightSecondary as ue } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
+
import V from "clsx";
|
|
6
|
+
import { forwardRef as k, useRef as C, useCallback as de, useMemo as R, useEffect as pe } from "react";
|
|
7
|
+
import { useIntl as F, FormattedMessage as T } from "react-intl";
|
|
8
8
|
import i from "./messages.js";
|
|
9
|
-
import { useAsyncList as
|
|
9
|
+
import { useAsyncList as me } from "./use-async-list.js";
|
|
10
10
|
import { useControllableState as he } from "./utils/use-controllable-state.js";
|
|
11
11
|
import { useTrackVisibility as fe } from "./utils/use-intersection-observer.js";
|
|
12
|
-
import { jsx as r, jsxs as
|
|
13
|
-
import '../../../../styles/combobox-with-api-pagination.css';const be = "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
highlightOptionText: _e,
|
|
12
|
+
import { jsx as r, jsxs as S, Fragment as ge } from "react/jsx-runtime";
|
|
13
|
+
import '../../../../styles/combobox-with-api-pagination.css';const be = "_disabled_19k3s_8", xe = "_highlightOptionText_19k3s_12", Oe = "_selected_19k3s_24", _e = "_option_19k3s_35", Ce = "_errorComboboxOption_19k3s_39", Re = "_errorComboboxOptionText_19k3s_44", s = {
|
|
14
|
+
disabled: be,
|
|
15
|
+
highlightOptionText: xe,
|
|
17
16
|
selected: Oe,
|
|
18
|
-
option:
|
|
17
|
+
option: _e,
|
|
19
18
|
errorComboboxOption: Ce,
|
|
20
|
-
errorComboboxOptionText:
|
|
21
|
-
},
|
|
22
|
-
onTryAgain:
|
|
19
|
+
errorComboboxOptionText: Re
|
|
20
|
+
}, N = /* @__PURE__ */ k(({
|
|
21
|
+
onTryAgain: y
|
|
23
22
|
}, p) => {
|
|
24
23
|
const {
|
|
25
|
-
formatMessage:
|
|
26
|
-
} =
|
|
27
|
-
return /* @__PURE__ */
|
|
24
|
+
formatMessage: m
|
|
25
|
+
} = F();
|
|
26
|
+
return /* @__PURE__ */ S(ge, {
|
|
28
27
|
children: [/* @__PURE__ */ r(ie, {
|
|
29
28
|
variant: "error",
|
|
30
|
-
variantIconAriaLabel:
|
|
31
|
-
children: /* @__PURE__ */ r(
|
|
29
|
+
variantIconAriaLabel: m(i.loadingResultsErrorIconLabel),
|
|
30
|
+
children: /* @__PURE__ */ r(T, {
|
|
32
31
|
...i.loadingResultsErrorMessage
|
|
33
32
|
})
|
|
34
|
-
}), /* @__PURE__ */ r(
|
|
33
|
+
}), /* @__PURE__ */ r(d.Option, {
|
|
35
34
|
ref: p,
|
|
36
|
-
className:
|
|
37
|
-
onClick:
|
|
38
|
-
children: /* @__PURE__ */
|
|
35
|
+
className: s.errorComboboxOption,
|
|
36
|
+
onClick: y,
|
|
37
|
+
children: /* @__PURE__ */ S(se, {
|
|
39
38
|
as: "span",
|
|
40
|
-
className:
|
|
39
|
+
className: s.errorComboboxOptionText,
|
|
41
40
|
color: "textOnLightLink",
|
|
42
41
|
variant: "bodyDefaultBold",
|
|
43
|
-
children: [/* @__PURE__ */ r(
|
|
42
|
+
children: [/* @__PURE__ */ r(T, {
|
|
44
43
|
...i.loadingResultsErrorAction
|
|
45
44
|
}), /* @__PURE__ */ r(le, {
|
|
46
45
|
color: "currentColor",
|
|
@@ -50,115 +49,113 @@ import '../../../../styles/combobox-with-api-pagination.css';const be = "_contai
|
|
|
50
49
|
})
|
|
51
50
|
})]
|
|
52
51
|
});
|
|
53
|
-
}),
|
|
54
|
-
color:
|
|
55
|
-
height:
|
|
52
|
+
}), A = "__LOADING__", L = "__LOADING_ERROR__", Ae = "0px 0px 20px 0px", Le = /* @__PURE__ */ r(ae, {
|
|
53
|
+
color: ue,
|
|
54
|
+
height: M,
|
|
56
55
|
role: "presentation",
|
|
57
56
|
style: {
|
|
58
|
-
padding:
|
|
57
|
+
padding: ce,
|
|
59
58
|
boxSizing: "border-box"
|
|
60
59
|
},
|
|
61
|
-
width:
|
|
62
|
-
}),
|
|
60
|
+
width: M
|
|
61
|
+
}), De = /* @__PURE__ */ k(function(p, m) {
|
|
63
62
|
const {
|
|
64
|
-
defaultFetcher:
|
|
65
|
-
onInputValueChange:
|
|
63
|
+
defaultFetcher: P,
|
|
64
|
+
onInputValueChange: D,
|
|
66
65
|
value: w,
|
|
67
66
|
onValueChange: B,
|
|
68
67
|
noResultMessage: W,
|
|
69
68
|
defaultValue: z = [],
|
|
70
69
|
loadingAriaLabel: G,
|
|
71
|
-
multiselect:
|
|
70
|
+
multiselect: a = !1,
|
|
72
71
|
disabled: j,
|
|
73
72
|
className: U,
|
|
74
|
-
displaySingleSelectionAsChip:
|
|
73
|
+
displaySingleSelectionAsChip: E = !0,
|
|
75
74
|
...q
|
|
76
75
|
} = p, {
|
|
77
|
-
formatMessage:
|
|
78
|
-
} =
|
|
76
|
+
formatMessage: c
|
|
77
|
+
} = F(), h = C(null), f = C(!0), e = me({
|
|
79
78
|
async load({
|
|
80
79
|
marker: o,
|
|
81
80
|
searchInput: t,
|
|
82
|
-
signal:
|
|
81
|
+
signal: O
|
|
83
82
|
}) {
|
|
84
|
-
const
|
|
85
|
-
signal:
|
|
83
|
+
const l = await P({
|
|
84
|
+
signal: O,
|
|
86
85
|
marker: o,
|
|
87
86
|
searchInput: t
|
|
88
87
|
});
|
|
89
88
|
return {
|
|
90
|
-
items:
|
|
91
|
-
marker:
|
|
89
|
+
items: l.options,
|
|
90
|
+
marker: l.marker
|
|
92
91
|
};
|
|
93
92
|
}
|
|
94
|
-
}),
|
|
95
|
-
|
|
96
|
-
}, []), [n,
|
|
93
|
+
}), v = C(!1), H = de(() => {
|
|
94
|
+
v.current || (e.reload(), v.current = !0);
|
|
95
|
+
}, []), [n, g] = he({
|
|
97
96
|
prop: w,
|
|
98
97
|
defaultProp: z,
|
|
99
98
|
onChange: B
|
|
100
|
-
}),
|
|
101
|
-
o === void 0 ? (
|
|
102
|
-
}, K =
|
|
99
|
+
}), b = !a && n.length === 1, J = (o) => {
|
|
100
|
+
o === void 0 ? (g([]), (!f.current || !E) && (e.search(""), f.current = !0)) : Array.isArray(o) ? g(o) : g([o]);
|
|
101
|
+
}, K = R(() => n.length === 0 ? a ? [] : void 0 : a ? n : n[0], [a, n]), x = R(() => n.filter((o) => !e.items.some((t) => t.value === o.value)), [n, e.items]), Q = (o) => {
|
|
103
102
|
const {
|
|
104
103
|
value: t,
|
|
105
|
-
displayValue:
|
|
106
|
-
...
|
|
104
|
+
displayValue: O,
|
|
105
|
+
...l
|
|
107
106
|
} = o;
|
|
108
|
-
if (t ===
|
|
109
|
-
return e.hasNextPage ? /* @__PURE__ */ r(
|
|
110
|
-
...
|
|
107
|
+
if (t === A)
|
|
108
|
+
return e.hasNextPage ? /* @__PURE__ */ r(d.Option, {
|
|
109
|
+
...l,
|
|
111
110
|
ref: Z,
|
|
112
111
|
disabled: !0,
|
|
113
112
|
value: t,
|
|
114
113
|
children: /* @__PURE__ */ r(ne, {
|
|
115
|
-
"aria-label":
|
|
114
|
+
"aria-label": c(i.loadingMoreAriaLabel),
|
|
116
115
|
style: {
|
|
117
116
|
position: "unset"
|
|
118
117
|
}
|
|
119
118
|
})
|
|
120
119
|
}) : null;
|
|
121
|
-
if (t ===
|
|
122
|
-
return /* @__PURE__ */ r(
|
|
120
|
+
if (t === L && e.hasError && !e.isEmpty)
|
|
121
|
+
return /* @__PURE__ */ r(N, {
|
|
123
122
|
onTryAgain: () => {
|
|
124
|
-
|
|
125
|
-
e.loadMore(), (s = g.current) == null || s.focus();
|
|
123
|
+
e.loadMore(), h.current?.focus();
|
|
126
124
|
}
|
|
127
125
|
});
|
|
128
|
-
if (
|
|
126
|
+
if (x.some((_) => _.value === t))
|
|
129
127
|
return null;
|
|
130
|
-
const oe = n.some((
|
|
131
|
-
return /* @__PURE__ */ r(
|
|
132
|
-
...
|
|
133
|
-
className:
|
|
128
|
+
const oe = n.some((_) => _.value === t);
|
|
129
|
+
return /* @__PURE__ */ r(d.Option, {
|
|
130
|
+
...l,
|
|
131
|
+
className: s.option,
|
|
134
132
|
value: t,
|
|
135
133
|
children: /* @__PURE__ */ r(te, {
|
|
136
|
-
className:
|
|
137
|
-
value:
|
|
134
|
+
className: V(s.highlightOptionText, oe && s.selected),
|
|
135
|
+
value: O || t
|
|
138
136
|
})
|
|
139
137
|
});
|
|
140
138
|
}, X = (o) => {
|
|
141
|
-
if (
|
|
142
|
-
|
|
139
|
+
if (D?.(o), b && o === "") {
|
|
140
|
+
f.current = !1;
|
|
143
141
|
return;
|
|
144
142
|
}
|
|
145
143
|
e.search(o);
|
|
146
144
|
}, Y = () => {
|
|
147
|
-
|
|
148
|
-
e.reload(), (o = g.current) == null || o.focus();
|
|
145
|
+
e.reload(), h.current?.focus();
|
|
149
146
|
};
|
|
150
|
-
let
|
|
151
|
-
e.hasError && !e.isLoading ?
|
|
147
|
+
let u;
|
|
148
|
+
e.hasError && !e.isLoading ? u = /* @__PURE__ */ r(N, {
|
|
152
149
|
onTryAgain: Y
|
|
153
|
-
}) : e.isEmpty && !e.isLoading ?
|
|
150
|
+
}) : e.isEmpty && !e.isLoading ? u = W || c(i.noResults) : u = void 0;
|
|
154
151
|
const [Z, {
|
|
155
152
|
rootRef: $,
|
|
156
|
-
isVisible:
|
|
153
|
+
isVisible: I
|
|
157
154
|
}] = fe({
|
|
158
|
-
rootMargin:
|
|
155
|
+
rootMargin: Ae
|
|
159
156
|
});
|
|
160
|
-
|
|
161
|
-
if (!(
|
|
157
|
+
pe(() => {
|
|
158
|
+
if (!(I && e.hasNextPage))
|
|
162
159
|
return;
|
|
163
160
|
const t = setTimeout(() => {
|
|
164
161
|
e.loadMore();
|
|
@@ -166,35 +163,35 @@ import '../../../../styles/combobox-with-api-pagination.css';const be = "_contai
|
|
|
166
163
|
return () => {
|
|
167
164
|
clearTimeout(t);
|
|
168
165
|
};
|
|
169
|
-
}, [
|
|
170
|
-
const ee =
|
|
166
|
+
}, [I]);
|
|
167
|
+
const ee = R(() => {
|
|
171
168
|
const o = e.hasNextPage ? {
|
|
169
|
+
displayValue: A,
|
|
170
|
+
value: A
|
|
171
|
+
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
172
172
|
displayValue: L,
|
|
173
173
|
value: L
|
|
174
|
-
} : null, t = !o && e.hasError && !e.isEmpty ? {
|
|
175
|
-
displayValue: y,
|
|
176
|
-
value: y
|
|
177
174
|
} : null;
|
|
178
|
-
return [...e.items, ...
|
|
179
|
-
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items,
|
|
180
|
-
return /* @__PURE__ */ r(
|
|
175
|
+
return [...e.items, ...x, o, t].filter(Boolean);
|
|
176
|
+
}, [e.hasNextPage, e.hasError, e.isEmpty, e.items, x]);
|
|
177
|
+
return /* @__PURE__ */ r(d, {
|
|
181
178
|
as: "input",
|
|
182
179
|
...q,
|
|
183
|
-
ref: re(
|
|
184
|
-
className:
|
|
185
|
-
[
|
|
180
|
+
ref: re(h, m),
|
|
181
|
+
className: V({
|
|
182
|
+
[s.disabled]: b
|
|
186
183
|
}, U),
|
|
187
|
-
clearButtonAriaLabel:
|
|
188
|
-
disabled: j ||
|
|
189
|
-
displaySingleSelectionAsChip:
|
|
184
|
+
clearButtonAriaLabel: c(i.clearButtonAriaLabel),
|
|
185
|
+
disabled: j || b,
|
|
186
|
+
displaySingleSelectionAsChip: E,
|
|
190
187
|
displayValue: (o) => o.displayValue || o.value,
|
|
191
|
-
endComboboxIcon:
|
|
188
|
+
endComboboxIcon: Le,
|
|
192
189
|
focusLoop: !1,
|
|
193
190
|
getPopoverRef: $,
|
|
194
191
|
loading: e.isReloading,
|
|
195
|
-
loadingAriaLabel: G ||
|
|
196
|
-
multiselect:
|
|
197
|
-
noResultMessage:
|
|
192
|
+
loadingAriaLabel: G || c(i.loadingAriaLabel),
|
|
193
|
+
multiselect: a,
|
|
194
|
+
noResultMessage: u,
|
|
198
195
|
onFocus: H,
|
|
199
196
|
onInputValueChange: X,
|
|
200
197
|
onValueChange: J,
|
|
@@ -204,5 +201,5 @@ import '../../../../styles/combobox-with-api-pagination.css';const be = "_contai
|
|
|
204
201
|
});
|
|
205
202
|
});
|
|
206
203
|
export {
|
|
207
|
-
|
|
204
|
+
De as ComboboxWithApiPagination
|
|
208
205
|
};
|