@box/metadata-editor 0.62.0 → 0.64.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/chunks/metadata-editor-field-wrapper.js +55 -50
- package/esm/index.js +26 -26
- package/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +140 -135
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +37 -43
- package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +38 -44
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +30 -36
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +39 -47
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +28 -34
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +54 -0
- package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +49 -48
- package/esm/lib/components/metadata-editor-fields/editor-field-types.js +19 -15
- package/esm/lib/components/metadata-editor-fields/utils.js +13 -0
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +48 -46
- package/esm/lib/defaults.js +2 -1
- package/esm/lib/messages.js +4 -0
- package/i18n/bn-IN.js +1 -0
- package/i18n/da-DK.js +1 -0
- package/i18n/de-DE.js +1 -0
- package/i18n/en-AU.js +1 -0
- package/i18n/en-CA.js +1 -0
- package/i18n/en-GB.js +1 -0
- package/i18n/en-US.js +1 -0
- package/i18n/en-US.properties +2 -0
- package/i18n/en-x-pseudo.js +1 -0
- package/i18n/es-419.js +1 -0
- package/i18n/es-ES.js +1 -0
- package/i18n/fi-FI.js +1 -0
- package/i18n/fr-CA.js +1 -0
- package/i18n/fr-FR.js +1 -0
- package/i18n/hi-IN.js +1 -0
- package/i18n/it-IT.js +1 -0
- package/i18n/ja-JP.js +1 -0
- package/i18n/json/src/lib/messages.json +1 -1
- package/i18n/ko-KR.js +1 -0
- package/i18n/nb-NO.js +1 -0
- package/i18n/nl-NL.js +1 -0
- package/i18n/pl-PL.js +1 -0
- package/i18n/pt-BR.js +1 -0
- package/i18n/ru-RU.js +1 -0
- package/i18n/sv-SE.js +1 -0
- package/i18n/tr-TR.js +1 -0
- package/i18n/zh-CN.js +1 -0
- package/i18n/zh-TW.js +1 -0
- package/package.json +2 -2
- package/types/index.d.ts +1 -1
- package/types/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.d.ts +16 -2
- package/types/lib/components/combobox-with-api-pagination/index.d.ts +1 -1
- package/types/lib/components/combobox-with-api-pagination/types.d.ts +5 -8
- package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.d.ts +3 -0
- package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/types.d.ts +6 -21
- package/types/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.d.ts +2 -1
- package/types/lib/components/metadata-editor-fields/editor-field-types.d.ts +1 -0
- package/types/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.d.ts +1 -0
- package/types/lib/components/metadata-editor-fields/types.d.ts +5 -0
- package/types/lib/components/metadata-editor-fields/utils.d.ts +3 -0
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +4 -2
- package/types/lib/components/metadata-instance-editor/types.d.ts +2 -4
- package/types/lib/messages.d.ts +5 -0
- package/types/lib/test-utils/sample-data.d.ts +4 -1
- package/types/lib/types.d.ts +11 -3
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/index.js +0 -4
- package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.js +0 -8
- package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/index.d.ts +0 -2
- package/types/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.d.ts +0 -5
@@ -1,75 +1,80 @@
|
|
1
1
|
import "../styles/metadata-editor-field-wrapper.css";
|
2
|
-
import
|
3
|
-
import { useFormikContext as
|
4
|
-
import
|
5
|
-
import { forwardRef as
|
6
|
-
import { AiSuggestionField as
|
7
|
-
import { UpdateModeFieldWrapper as
|
8
|
-
import { editorFieldTypes as
|
9
|
-
import { jsx as
|
10
|
-
const
|
11
|
-
noAttributesText:
|
12
|
-
fieldWrapper:
|
13
|
-
hasSuggestion:
|
2
|
+
import A from "clsx";
|
3
|
+
import { useFormikContext as M } from "formik";
|
4
|
+
import W from "lodash/isUndefined";
|
5
|
+
import { forwardRef as T, useState as q } from "react";
|
6
|
+
import { AiSuggestionField as N } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
|
7
|
+
import { UpdateModeFieldWrapper as b } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
8
|
+
import { editorFieldTypes as v } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
|
9
|
+
import { jsx as s, jsxs as k } from "react/jsx-runtime";
|
10
|
+
const w = "_noAttributesText_1xlmq_1", P = "_fieldWrapper_1xlmq_5", U = "_hasSuggestion_1xlmq_5", $ = "_error_1xlmq_13", j = "_dateField_1xlmq_25", n = {
|
11
|
+
noAttributesText: w,
|
12
|
+
fieldWrapper: P,
|
13
|
+
hasSuggestion: U,
|
14
14
|
error: $,
|
15
|
-
dateField:
|
16
|
-
},
|
17
|
-
disableForm:
|
15
|
+
dateField: j
|
16
|
+
}, H = /* @__PURE__ */ T(({
|
17
|
+
disableForm: a,
|
18
18
|
portalElement: p,
|
19
19
|
field: e,
|
20
|
-
index:
|
21
|
-
|
20
|
+
index: g,
|
21
|
+
taxonomyOptionsFetcher: l
|
22
|
+
}, d) => {
|
23
|
+
var c;
|
22
24
|
const {
|
23
|
-
setFieldValue:
|
24
|
-
} =
|
25
|
-
if (!
|
25
|
+
setFieldValue: u
|
26
|
+
} = M(), [S, i] = q(!0), r = v[e.type], x = r && !e.hidden, _ = !W(e.updateMode), t = `metadata.fields[${g}]`, y = e.type === "taxonomy" && ((c = e.optionsRules) == null ? void 0 : c.multiSelect);
|
27
|
+
if (!x)
|
26
28
|
return null;
|
27
|
-
if (
|
28
|
-
return /* @__PURE__ */
|
29
|
-
fieldNamePrefix:
|
29
|
+
if (_)
|
30
|
+
return /* @__PURE__ */ s(b, {
|
31
|
+
fieldNamePrefix: t,
|
30
32
|
fieldType: e.type,
|
31
|
-
|
32
|
-
|
33
|
+
isTaxonomyMultiSelect: y,
|
34
|
+
children: /* @__PURE__ */ s(r, {
|
35
|
+
ref: d,
|
33
36
|
description: e.description,
|
34
|
-
disableForm:
|
35
|
-
fieldNamePrefix:
|
37
|
+
disableForm: a,
|
38
|
+
fieldNamePrefix: t,
|
36
39
|
label: e.displayName,
|
37
|
-
portalElement: p
|
40
|
+
portalElement: p,
|
41
|
+
taxonomyOptionsFetcher: l
|
38
42
|
})
|
39
43
|
}, e.key);
|
40
44
|
const {
|
41
|
-
aiSuggestion:
|
42
|
-
type:
|
43
|
-
value:
|
44
|
-
} = e,
|
45
|
-
return /* @__PURE__ */
|
46
|
-
className:
|
47
|
-
children: [/* @__PURE__ */
|
48
|
-
ref:
|
49
|
-
className:
|
50
|
-
[
|
51
|
-
[
|
45
|
+
aiSuggestion: o,
|
46
|
+
type: f,
|
47
|
+
value: F
|
48
|
+
} = e, m = o && S;
|
49
|
+
return /* @__PURE__ */ k("div", {
|
50
|
+
className: n.fieldWrapper,
|
51
|
+
children: [/* @__PURE__ */ s(r, {
|
52
|
+
ref: d,
|
53
|
+
className: A({
|
54
|
+
[n.hasSuggestions]: m,
|
55
|
+
[n.dateField]: e.type === "date"
|
52
56
|
}),
|
53
57
|
description: e.description,
|
54
|
-
disableForm:
|
55
|
-
fieldNamePrefix:
|
58
|
+
disableForm: a,
|
59
|
+
fieldNamePrefix: t,
|
56
60
|
label: e.displayName,
|
57
|
-
portalElement: p
|
58
|
-
|
59
|
-
|
61
|
+
portalElement: p,
|
62
|
+
taxonomyOptionsFetcher: l
|
63
|
+
}), m && /* @__PURE__ */ s(N, {
|
64
|
+
aiSuggestion: o,
|
60
65
|
onAiSuggestionAppend: () => {
|
61
|
-
const
|
62
|
-
|
66
|
+
const h = e.type === "multiSelect" ? [F, o].flat() : o;
|
67
|
+
u(`${t}.value`, h), i(!1);
|
63
68
|
},
|
64
69
|
onAiSuggestionIgnore: () => i(!1),
|
65
70
|
onAiSuggestionReplace: () => {
|
66
|
-
|
71
|
+
u(`${t}.value`, o), i(!1);
|
67
72
|
},
|
68
|
-
type:
|
73
|
+
type: f
|
69
74
|
})]
|
70
75
|
}, e.key);
|
71
76
|
});
|
72
77
|
export {
|
73
|
-
|
74
|
-
|
78
|
+
H as M,
|
79
|
+
n as s
|
75
80
|
};
|
package/esm/index.js
CHANGED
@@ -1,37 +1,37 @@
|
|
1
1
|
import { AddMetadataTemplateDropdown as o } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
|
2
|
-
import {
|
3
|
-
import {
|
2
|
+
import { ComboboxWithApiPagination as r } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
|
3
|
+
import { FilterDropdownMenu as d } from "./lib/components/filter-dropdown-menu/index.js";
|
4
4
|
import { MetadataEmptyState as f } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
|
5
|
-
import { DeleteConfirmationModal as
|
6
|
-
import { MetadataInstanceFormHeader as
|
5
|
+
import { DeleteConfirmationModal as x } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
|
6
|
+
import { MetadataInstanceFormHeader as l } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
|
7
7
|
import { CustomInstanceNewField as s } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
|
8
|
-
import { MetadataInstanceForm as
|
9
|
-
import { MetadataInstanceList as
|
10
|
-
import { MetadataInstanceHeader as
|
11
|
-
import { UnsavedChangesModal as
|
12
|
-
import { defaultInitialValues as U, defaultMetadataValueMap as
|
13
|
-
import { MetadataEditor as
|
8
|
+
import { MetadataInstanceForm as A } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
|
9
|
+
import { MetadataInstanceList as I } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
|
10
|
+
import { MetadataInstanceHeader as w } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
|
11
|
+
import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
|
12
|
+
import { defaultInitialValues as U, defaultMetadataValueMap as b } from "./lib/defaults.js";
|
13
|
+
import { MetadataEditor as v } from "./lib/metadata-editor.js";
|
14
14
|
import { U as H } from "../chunks/types.js";
|
15
|
-
import { AutofillContext as
|
16
|
-
import { withApiWrapper as
|
15
|
+
import { AutofillContext as V, AutofillContextProvider as W, useAutofill as y } from "./lib/utils/autofill-context.js";
|
16
|
+
import { withApiWrapper as N } from "./lib/utils/api-wrapper.js";
|
17
17
|
export {
|
18
18
|
o as AddMetadataTemplateDropdown,
|
19
|
-
|
20
|
-
|
19
|
+
V as AutofillContext,
|
20
|
+
W as AutofillContextProvider,
|
21
|
+
r as ComboboxWithApiPagination,
|
21
22
|
s as CustomInstanceNewField,
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
x as DeleteConfirmationModal,
|
24
|
+
d as FilterDropdownMenu,
|
25
|
+
v as MetadataEditor,
|
25
26
|
f as MetadataEmptyState,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
v as UnsavedChangesModal,
|
27
|
+
A as MetadataInstanceForm,
|
28
|
+
l as MetadataInstanceFormHeader,
|
29
|
+
w as MetadataInstanceHeader,
|
30
|
+
I as MetadataInstanceList,
|
31
|
+
h as UnsavedChangesModal,
|
32
32
|
H as UpdateMode,
|
33
33
|
U as defaultInitialValues,
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
b as defaultMetadataValueMap,
|
35
|
+
y as useAutofill,
|
36
|
+
N as withApiWrapper
|
37
37
|
};
|
@@ -1,48 +1,49 @@
|
|
1
1
|
import "../../../../styles/combobox-with-api-pagination.css";
|
2
|
-
import { ComboboxItemValue as
|
3
|
-
import { Combobox as
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import {
|
9
|
-
import
|
10
|
-
import
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
2
|
+
import { ComboboxItemValue as $ } from "@ariakit/react";
|
3
|
+
import { Combobox as m, LoadingIndicator as oo, InlineNotice as eo, Text as to } from "@box/blueprint-web";
|
4
|
+
import { useForkRef as ro } from "@box/blueprint-web/lib-esm/utils/useForkRef";
|
5
|
+
import { Search as no, Loader as io } from "@box/blueprint-web-assets/icons/Fill";
|
6
|
+
import { IconIconOnLightSecondary as ao, Size6 as M, Size1 as so } from "@box/blueprint-web-assets/tokens/tokens";
|
7
|
+
import lo from "clsx";
|
8
|
+
import { forwardRef as S, useRef as C, useCallback as co, useMemo as L, useEffect as uo } from "react";
|
9
|
+
import { useIntl as F, FormattedMessage as T } from "react-intl";
|
10
|
+
import i from "./messages.js";
|
11
|
+
import { useAsyncList as mo } from "./use-async-list.js";
|
12
|
+
import { useControllableState as po } from "./utils/use-controllable-state.js";
|
13
|
+
import { useTrackVisibility as ho } from "./utils/use-intersection-observer.js";
|
14
|
+
import { jsx as r, jsxs as V, Fragment as fo } from "react/jsx-runtime";
|
15
|
+
const bo = "_container_181ao_1", go = "_disabled_181ao_7", xo = "_highlightOptionText_181ao_11", Oo = "_option_181ao_24", _o = "_errorComboboxOption_181ao_28", Ro = "_errorComboboxOptionText_181ao_33", c = {
|
16
|
+
container: bo,
|
17
|
+
disabled: go,
|
18
|
+
highlightOptionText: xo,
|
19
|
+
option: Oo,
|
20
|
+
errorComboboxOption: _o,
|
21
|
+
errorComboboxOptionText: Ro
|
22
|
+
}, N = /* @__PURE__ */ S(({
|
23
|
+
onTryAgain: y
|
24
|
+
}, p) => {
|
24
25
|
const {
|
25
|
-
formatMessage:
|
26
|
-
} =
|
27
|
-
return /* @__PURE__ */
|
28
|
-
children: [/* @__PURE__ */ r(
|
26
|
+
formatMessage: h
|
27
|
+
} = F();
|
28
|
+
return /* @__PURE__ */ V(fo, {
|
29
|
+
children: [/* @__PURE__ */ r(eo, {
|
29
30
|
variant: "error",
|
30
|
-
variantIconAriaLabel:
|
31
|
-
children: /* @__PURE__ */ r(
|
32
|
-
...
|
31
|
+
variantIconAriaLabel: h(i.loadingResultsErrorIconLabel),
|
32
|
+
children: /* @__PURE__ */ r(T, {
|
33
|
+
...i.loadingResultsErrorMessage
|
33
34
|
})
|
34
|
-
}), /* @__PURE__ */ r(
|
35
|
-
ref:
|
36
|
-
className:
|
37
|
-
onClick:
|
38
|
-
children: /* @__PURE__ */
|
35
|
+
}), /* @__PURE__ */ r(m.Option, {
|
36
|
+
ref: p,
|
37
|
+
className: c.errorComboboxOption,
|
38
|
+
onClick: y,
|
39
|
+
children: /* @__PURE__ */ V(to, {
|
39
40
|
as: "span",
|
40
|
-
className:
|
41
|
+
className: c.errorComboboxOptionText,
|
41
42
|
color: "textOnLightLink",
|
42
43
|
variant: "bodyDefaultBold",
|
43
|
-
children: [/* @__PURE__ */ r(
|
44
|
-
...
|
45
|
-
}), /* @__PURE__ */ r(
|
44
|
+
children: [/* @__PURE__ */ r(T, {
|
45
|
+
...i.loadingResultsErrorAction
|
46
|
+
}), /* @__PURE__ */ r(io, {
|
46
47
|
color: "currentColor",
|
47
48
|
height: "12px",
|
48
49
|
width: "12px"
|
@@ -50,110 +51,114 @@ const mo = "_container_181ao_1", po = "_disabled_181ao_7", bo = "_highlightOptio
|
|
50
51
|
})
|
51
52
|
})]
|
52
53
|
});
|
53
|
-
}),
|
54
|
-
color:
|
55
|
-
height:
|
54
|
+
}), A = "__LOADING__", E = "__LOADING_ERROR__", Co = "0px 0px 20px 0px", Lo = /* @__PURE__ */ r(no, {
|
55
|
+
color: ao,
|
56
|
+
height: M,
|
56
57
|
role: "presentation",
|
57
58
|
style: {
|
58
|
-
padding:
|
59
|
+
padding: so,
|
59
60
|
boxSizing: "border-box"
|
60
61
|
},
|
61
|
-
width:
|
62
|
-
}),
|
62
|
+
width: M
|
63
|
+
}), wo = /* @__PURE__ */ S(function(p, h) {
|
63
64
|
const {
|
64
|
-
defaultFetcher:
|
65
|
-
onInputValueChange:
|
66
|
-
value:
|
67
|
-
onValueChange:
|
68
|
-
noResultMessage:
|
69
|
-
defaultValue:
|
70
|
-
loadingAriaLabel:
|
71
|
-
multiselect:
|
72
|
-
disabled:
|
73
|
-
...
|
74
|
-
} =
|
75
|
-
formatMessage:
|
76
|
-
} =
|
65
|
+
defaultFetcher: P,
|
66
|
+
onInputValueChange: f,
|
67
|
+
value: k,
|
68
|
+
onValueChange: D,
|
69
|
+
noResultMessage: w,
|
70
|
+
defaultValue: B = [],
|
71
|
+
loadingAriaLabel: W,
|
72
|
+
multiselect: s = !1,
|
73
|
+
disabled: z,
|
74
|
+
...G
|
75
|
+
} = p, {
|
76
|
+
formatMessage: u
|
77
|
+
} = F(), b = C(null), g = C(!0), o = mo({
|
77
78
|
async load({
|
78
79
|
marker: e,
|
79
80
|
searchInput: t,
|
80
|
-
signal:
|
81
|
+
signal: R
|
81
82
|
}) {
|
82
|
-
const
|
83
|
-
signal:
|
83
|
+
const l = await P({
|
84
|
+
signal: R,
|
84
85
|
marker: e,
|
85
86
|
searchInput: t
|
86
87
|
});
|
87
88
|
return {
|
88
|
-
items:
|
89
|
-
marker:
|
89
|
+
items: l.options,
|
90
|
+
marker: l.marker
|
90
91
|
};
|
91
92
|
}
|
92
|
-
}),
|
93
|
-
|
94
|
-
}, []), [n,
|
95
|
-
prop:
|
96
|
-
defaultProp:
|
97
|
-
onChange:
|
98
|
-
}),
|
99
|
-
e === void 0 ?
|
100
|
-
},
|
93
|
+
}), v = C(!1), j = co(() => {
|
94
|
+
v.current || (o.reload(), v.current = !0);
|
95
|
+
}, []), [n, x] = po({
|
96
|
+
prop: k,
|
97
|
+
defaultProp: B,
|
98
|
+
onChange: D
|
99
|
+
}), O = !s && n.length === 1, U = (e) => {
|
100
|
+
e === void 0 ? (x([]), g.current || (o.search(""), g.current = !0)) : Array.isArray(e) ? x(e) : x([e]);
|
101
|
+
}, q = L(() => n.length === 0 ? s ? [] : void 0 : s ? n : n[0], [s, n]), _ = L(() => n.filter((e) => !o.items.some((t) => t.value === e.value)), [n, o.items]), H = (e) => {
|
101
102
|
const {
|
102
103
|
value: t,
|
103
|
-
displayValue:
|
104
|
-
...
|
104
|
+
displayValue: R,
|
105
|
+
...l
|
105
106
|
} = e;
|
106
|
-
if (t ===
|
107
|
-
return o.hasNextPage ? /* @__PURE__ */ r(
|
108
|
-
...
|
109
|
-
ref:
|
107
|
+
if (t === A)
|
108
|
+
return o.hasNextPage ? /* @__PURE__ */ r(m.Option, {
|
109
|
+
...l,
|
110
|
+
ref: Q,
|
110
111
|
disabled: !0,
|
111
112
|
value: t,
|
112
|
-
children: /* @__PURE__ */ r(
|
113
|
-
"aria-label":
|
113
|
+
children: /* @__PURE__ */ r(oo, {
|
114
|
+
"aria-label": u(i.loadingMoreAriaLabel),
|
114
115
|
style: {
|
115
116
|
position: "unset"
|
116
117
|
}
|
117
118
|
})
|
118
119
|
}) : null;
|
119
|
-
if (t ===
|
120
|
-
return /* @__PURE__ */ r(
|
120
|
+
if (t === E && o.hasError && !o.isEmpty)
|
121
|
+
return /* @__PURE__ */ r(N, {
|
121
122
|
onTryAgain: () => {
|
122
|
-
var
|
123
|
-
o.loadMore(), (
|
123
|
+
var a;
|
124
|
+
o.loadMore(), (a = b.current) == null || a.focus();
|
124
125
|
}
|
125
126
|
});
|
126
|
-
if (
|
127
|
+
if (_.some((a) => a.value === t))
|
127
128
|
return null;
|
128
|
-
const
|
129
|
-
return /* @__PURE__ */ r(
|
130
|
-
...
|
131
|
-
className:
|
132
|
-
disabled:
|
129
|
+
const Z = () => n.some((a) => a.value === t);
|
130
|
+
return /* @__PURE__ */ r(m.Option, {
|
131
|
+
...l,
|
132
|
+
className: c.option,
|
133
|
+
disabled: Z(),
|
133
134
|
value: t,
|
134
|
-
children: /* @__PURE__ */ r(
|
135
|
-
className:
|
136
|
-
value:
|
135
|
+
children: /* @__PURE__ */ r($, {
|
136
|
+
className: c.highlightOptionText,
|
137
|
+
value: R || t
|
137
138
|
})
|
138
139
|
});
|
139
|
-
},
|
140
|
-
|
141
|
-
|
140
|
+
}, J = (e) => {
|
141
|
+
if (f == null || f(e), O && e === "") {
|
142
|
+
g.current = !1;
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
o.search(e);
|
146
|
+
}, K = () => {
|
142
147
|
var e;
|
143
|
-
o.reload(), (e =
|
148
|
+
o.reload(), (e = b.current) == null || e.focus();
|
144
149
|
};
|
145
|
-
let
|
146
|
-
o.hasError && !o.isLoading ?
|
147
|
-
onTryAgain:
|
148
|
-
}) : o.isEmpty && !o.isLoading ?
|
149
|
-
const [
|
150
|
-
rootRef:
|
151
|
-
isVisible:
|
152
|
-
}] =
|
153
|
-
rootMargin:
|
150
|
+
let d;
|
151
|
+
o.hasError && !o.isLoading ? d = /* @__PURE__ */ r(N, {
|
152
|
+
onTryAgain: K
|
153
|
+
}) : o.isEmpty && !o.isLoading ? d = w || u(i.noResults) : d = void 0;
|
154
|
+
const [Q, {
|
155
|
+
rootRef: X,
|
156
|
+
isVisible: I
|
157
|
+
}] = ho({
|
158
|
+
rootMargin: Co
|
154
159
|
});
|
155
|
-
|
156
|
-
if (!(
|
160
|
+
uo(() => {
|
161
|
+
if (!(I && o.hasNextPage))
|
157
162
|
return;
|
158
163
|
const t = setTimeout(() => {
|
159
164
|
o.loadMore();
|
@@ -161,42 +166,42 @@ const mo = "_container_181ao_1", po = "_disabled_181ao_7", bo = "_highlightOptio
|
|
161
166
|
return () => {
|
162
167
|
clearTimeout(t);
|
163
168
|
};
|
164
|
-
}, [
|
165
|
-
const
|
169
|
+
}, [I]);
|
170
|
+
const Y = L(() => {
|
166
171
|
const e = o.hasNextPage ? {
|
167
|
-
displayValue:
|
168
|
-
value:
|
172
|
+
displayValue: A,
|
173
|
+
value: A
|
169
174
|
} : null, t = !e && o.hasError && !o.isEmpty ? {
|
170
|
-
displayValue:
|
171
|
-
value:
|
175
|
+
displayValue: E,
|
176
|
+
value: E
|
172
177
|
} : null;
|
173
|
-
return [...o.items, ...
|
174
|
-
}, [o.hasNextPage, o.hasError, o.isEmpty, o.items,
|
175
|
-
return /* @__PURE__ */ r(
|
178
|
+
return [...o.items, ..._, e, t].filter(Boolean);
|
179
|
+
}, [o.hasNextPage, o.hasError, o.isEmpty, o.items, _]);
|
180
|
+
return /* @__PURE__ */ r(m, {
|
176
181
|
as: "input",
|
177
|
-
...
|
178
|
-
ref:
|
179
|
-
className:
|
180
|
-
[
|
182
|
+
...G,
|
183
|
+
ref: ro(b, h),
|
184
|
+
className: lo({
|
185
|
+
[c.disabled]: O
|
181
186
|
}),
|
182
|
-
clearButtonAriaLabel:
|
183
|
-
disabled:
|
187
|
+
clearButtonAriaLabel: u(i.clearButtonAriaLabel),
|
188
|
+
disabled: z || O,
|
184
189
|
displayValue: (e) => e.displayValue || e.value,
|
185
|
-
endComboboxIcon:
|
190
|
+
endComboboxIcon: Lo,
|
186
191
|
focusLoop: !1,
|
187
|
-
getPopoverRef:
|
192
|
+
getPopoverRef: X,
|
188
193
|
loading: o.isReloading,
|
189
|
-
loadingAriaLabel:
|
190
|
-
multiselect:
|
191
|
-
noResultMessage:
|
192
|
-
onFocus:
|
193
|
-
onInputValueChange:
|
194
|
-
onValueChange:
|
195
|
-
options:
|
196
|
-
renderOption:
|
197
|
-
value:
|
194
|
+
loadingAriaLabel: W || u(i.loadingAriaLabel),
|
195
|
+
multiselect: s,
|
196
|
+
noResultMessage: d,
|
197
|
+
onFocus: j,
|
198
|
+
onInputValueChange: J,
|
199
|
+
onValueChange: U,
|
200
|
+
options: Y,
|
201
|
+
renderOption: H,
|
202
|
+
value: q
|
198
203
|
});
|
199
|
-
};
|
204
|
+
});
|
200
205
|
export {
|
201
|
-
|
206
|
+
wo as ComboboxWithApiPagination
|
202
207
|
};
|
@@ -1,65 +1,59 @@
|
|
1
|
-
import { DateI18nProvider as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { forwardRef as C, useMemo as
|
4
|
-
import { useIntl as
|
5
|
-
import { convertToDatePickerValue as
|
6
|
-
import { useDateInternationalization as
|
1
|
+
import { DateI18nProvider as x, DatePicker as L } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as T, getIn as V, Field as A } from "formik";
|
3
|
+
import { forwardRef as C, useMemo as w } from "react";
|
4
|
+
import { useIntl as I } from "react-intl";
|
5
|
+
import { convertToDatePickerValue as N, convertToFormikValue as z } from "./date-conversion-utils.js";
|
6
|
+
import { useDateInternationalization as B } from "./use-date-internationalization.js";
|
7
7
|
import a from "../../../../messages.js";
|
8
|
-
import
|
9
|
-
import { jsx as
|
10
|
-
const
|
8
|
+
import { getFieldLabel as O } from "../../utils.js";
|
9
|
+
import { jsx as r } from "react/jsx-runtime";
|
10
|
+
const J = /* @__PURE__ */ C(({
|
11
11
|
description: s,
|
12
|
-
disableForm:
|
13
|
-
fieldNamePrefix:
|
14
|
-
label:
|
15
|
-
portalElement:
|
12
|
+
disableForm: c,
|
13
|
+
fieldNamePrefix: m,
|
14
|
+
label: i,
|
15
|
+
portalElement: d,
|
16
|
+
updateModePrefix: f,
|
16
17
|
className: u
|
17
18
|
}, h) => {
|
18
|
-
const
|
19
|
+
const o = `${f ?? m}.value`, e = I(), {
|
19
20
|
values: p,
|
20
21
|
setFieldTouched: D,
|
21
22
|
setFieldValue: M
|
22
|
-
} =
|
23
|
+
} = T(), {
|
23
24
|
localTimezone: g
|
24
|
-
} =
|
25
|
+
} = B(e.locale), n = V(p, o), k = w(() => N(n), [n]), v = {
|
25
26
|
clearDatePickerAriaLabel: e.formatMessage(a.clearSelectedDate),
|
26
27
|
nextMonthAriaLabel: e.formatMessage(a.switchToNextMonth),
|
27
28
|
openCalendarDropdownAriaLabel: e.formatMessage(a.openCalendar),
|
28
29
|
previousMonthAriaLabel: e.formatMessage(a.switchToNextMonth)
|
29
|
-
},
|
30
|
-
const l =
|
31
|
-
M(
|
32
|
-
},
|
33
|
-
D(
|
30
|
+
}, b = (t) => {
|
31
|
+
const l = z(t, g);
|
32
|
+
M(o, l);
|
33
|
+
}, F = () => {
|
34
|
+
D(o, !0);
|
34
35
|
};
|
35
|
-
return /* @__PURE__ */
|
36
|
-
"data-testid": `${
|
37
|
-
children: /* @__PURE__ */
|
36
|
+
return /* @__PURE__ */ r("div", {
|
37
|
+
"data-testid": `${i}-field`,
|
38
|
+
children: /* @__PURE__ */ r(x, {
|
38
39
|
locale: e.locale,
|
39
|
-
children: /* @__PURE__ */
|
40
|
-
name:
|
40
|
+
children: /* @__PURE__ */ r(A, {
|
41
|
+
name: o,
|
41
42
|
children: ({
|
42
|
-
field:
|
43
|
+
field: t,
|
43
44
|
meta: l
|
44
|
-
}) => /* @__PURE__ */
|
45
|
-
...
|
45
|
+
}) => /* @__PURE__ */ r(L, {
|
46
|
+
...t,
|
46
47
|
...v,
|
47
48
|
ref: h,
|
48
49
|
calendarAriaLabel: e.formatMessage(a.selectDate),
|
49
50
|
className: u,
|
50
51
|
error: l.error,
|
51
|
-
isDisabled:
|
52
|
-
label: s
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
tooltipText: s,
|
57
|
-
children: r,
|
58
|
-
...i
|
59
|
-
}) : r,
|
60
|
-
onBlur: () => T(),
|
61
|
-
onChange: (i) => x(i),
|
62
|
-
portalElement: f,
|
52
|
+
isDisabled: c,
|
53
|
+
label: O(i, s),
|
54
|
+
onBlur: () => F(),
|
55
|
+
onChange: (P) => b(P),
|
56
|
+
portalElement: d,
|
63
57
|
value: k
|
64
58
|
})
|
65
59
|
})
|
@@ -67,6 +61,6 @@ const H = /* @__PURE__ */ C(({
|
|
67
61
|
});
|
68
62
|
});
|
69
63
|
export {
|
70
|
-
|
71
|
-
|
64
|
+
J as MetadataDateField,
|
65
|
+
J as default
|
72
66
|
};
|