@box/metadata-editor 0.60.4 → 0.61.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/chunks/metadata-editor-field-wrapper.js +34 -32
- package/esm/index.js +18 -16
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +33 -32
- package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +27 -25
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +26 -25
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +33 -31
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +32 -30
- package/esm/lib/components/metadata-editor-fields/editor-field-types.js +28 -22
- package/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +27 -22
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +20 -20
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +39 -33
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +16 -16
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.js +2 -2
- package/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +19 -15
- package/esm/lib/utils/api-wrapper.js +19 -0
- package/esm/lib/utils/autofill-context.js +33 -32
- package/i18n/en-US.js +2 -2
- package/i18n/en-US.properties +2 -2
- package/i18n/json/src/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/messages.json +1 -1
- package/package.json +2 -2
- package/types/index.d.ts +1 -0
- package/types/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.d.ts +1 -4
- package/types/lib/components/metadata-editor-fields/editor-field-types.d.ts +5 -5
- package/types/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.d.ts +4 -2
- package/types/lib/components/metadata-instance-list/subcomponents/metadata-instance/types.d.ts +1 -1
- package/types/lib/components/metadata-instance-list/types.d.ts +1 -1
- package/types/lib/test-utils/sample-data.d.ts +2 -1
- package/types/lib/utils/api-wrapper.d.ts +2 -0
- package/types/lib/utils/autofill-context.d.ts +5 -3
@@ -1,34 +1,35 @@
|
|
1
1
|
import "../styles/metadata-editor-field-wrapper.css";
|
2
|
-
import
|
3
|
-
import { useFormikContext as
|
4
|
-
import
|
5
|
-
import { useState as
|
6
|
-
import { AiSuggestionField as
|
7
|
-
import { UpdateModeFieldWrapper as
|
8
|
-
import { editorFieldTypes as
|
9
|
-
import { jsx as o, jsxs as
|
10
|
-
const
|
11
|
-
noAttributesText:
|
12
|
-
fieldWrapper:
|
13
|
-
hasSuggestion:
|
14
|
-
error:
|
15
|
-
dateField:
|
16
|
-
},
|
2
|
+
import y from "clsx";
|
3
|
+
import { useFormikContext as F } from "formik";
|
4
|
+
import h from "lodash/isUndefined";
|
5
|
+
import { forwardRef as A, useState as W } from "react";
|
6
|
+
import { AiSuggestionField as M } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
|
7
|
+
import { UpdateModeFieldWrapper as N } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
8
|
+
import { editorFieldTypes as q } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
|
9
|
+
import { jsx as o, jsxs as T } from "react/jsx-runtime";
|
10
|
+
const b = "_noAttributesText_1xlmq_1", v = "_fieldWrapper_1xlmq_5", P = "_hasSuggestion_1xlmq_5", $ = "_error_1xlmq_13", k = "_dateField_1xlmq_25", a = {
|
11
|
+
noAttributesText: b,
|
12
|
+
fieldWrapper: v,
|
13
|
+
hasSuggestion: P,
|
14
|
+
error: $,
|
15
|
+
dateField: k
|
16
|
+
}, B = /* @__PURE__ */ A(({
|
17
17
|
disableForm: n,
|
18
18
|
portalElement: p,
|
19
19
|
field: e,
|
20
20
|
index: d
|
21
|
-
}) => {
|
21
|
+
}, l) => {
|
22
22
|
const {
|
23
|
-
setFieldValue:
|
24
|
-
} =
|
25
|
-
if (!
|
23
|
+
setFieldValue: m
|
24
|
+
} = F(), [c, i] = W(!0), r = q[e.type], g = r && !e.hidden, f = !h(e.updateMode), s = `metadata.fields[${d}]`;
|
25
|
+
if (!g)
|
26
26
|
return null;
|
27
|
-
if (
|
28
|
-
return /* @__PURE__ */ o(
|
27
|
+
if (f)
|
28
|
+
return /* @__PURE__ */ o(N, {
|
29
29
|
fieldNamePrefix: s,
|
30
30
|
fieldType: e.type,
|
31
31
|
children: /* @__PURE__ */ o(r, {
|
32
|
+
ref: l,
|
32
33
|
description: e.description,
|
33
34
|
disableForm: n,
|
34
35
|
fieldNamePrefix: s,
|
@@ -39,13 +40,14 @@ const q = "_noAttributesText_1xlmq_1", T = "_fieldWrapper_1xlmq_5", b = "_hasSug
|
|
39
40
|
const {
|
40
41
|
aiSuggestion: t,
|
41
42
|
type: _,
|
42
|
-
value:
|
43
|
-
} = e,
|
44
|
-
return /* @__PURE__ */
|
43
|
+
value: x
|
44
|
+
} = e, u = t && c;
|
45
|
+
return /* @__PURE__ */ T("div", {
|
45
46
|
className: a.fieldWrapper,
|
46
47
|
children: [/* @__PURE__ */ o(r, {
|
47
|
-
|
48
|
-
|
48
|
+
ref: l,
|
49
|
+
className: y({
|
50
|
+
[a.hasSuggestions]: u,
|
49
51
|
[a.dateField]: e.type === "date"
|
50
52
|
}),
|
51
53
|
description: e.description,
|
@@ -53,21 +55,21 @@ const q = "_noAttributesText_1xlmq_1", T = "_fieldWrapper_1xlmq_5", b = "_hasSug
|
|
53
55
|
fieldNamePrefix: `metadata.fields[${d}]`,
|
54
56
|
label: e.displayName,
|
55
57
|
portalElement: p
|
56
|
-
}),
|
58
|
+
}), u && /* @__PURE__ */ o(M, {
|
57
59
|
aiSuggestion: t,
|
58
60
|
onAiSuggestionAppend: () => {
|
59
|
-
const
|
60
|
-
|
61
|
+
const S = e.type === "multiSelect" ? [x, t].flat() : t;
|
62
|
+
m(`${s}.value`, S), i(!1);
|
61
63
|
},
|
62
64
|
onAiSuggestionIgnore: () => i(!1),
|
63
65
|
onAiSuggestionReplace: () => {
|
64
|
-
|
66
|
+
m(`${s}.value`, t), i(!1);
|
65
67
|
},
|
66
68
|
type: _
|
67
69
|
})]
|
68
70
|
}, e.key);
|
69
|
-
};
|
71
|
+
});
|
70
72
|
export {
|
71
|
-
|
73
|
+
B as M,
|
72
74
|
a as s
|
73
75
|
};
|
package/esm/index.js
CHANGED
@@ -1,35 +1,37 @@
|
|
1
1
|
import { AddMetadataTemplateDropdown as o } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
|
2
2
|
import { FilterDropdownMenu as r } from "./lib/components/filter-dropdown-menu/index.js";
|
3
|
-
import { SingleLevelTaxonomyField as
|
3
|
+
import { SingleLevelTaxonomyField as p } from "./lib/components/metadata-editor-fields/components/metadata-taxonomy-field/single-level-taxonomy-field.js";
|
4
4
|
import { MetadataEmptyState as f } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
|
5
5
|
import { DeleteConfirmationModal as l } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
|
6
6
|
import { MetadataInstanceFormHeader as i } 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
8
|
import { MetadataInstanceForm as I } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
|
9
|
-
import { MetadataInstanceList as
|
10
|
-
import { MetadataInstanceHeader as
|
11
|
-
import { UnsavedChangesModal as
|
9
|
+
import { MetadataInstanceList as A } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
|
10
|
+
import { MetadataInstanceHeader as F } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
|
11
|
+
import { UnsavedChangesModal as v } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
|
12
12
|
import { defaultInitialValues as U, defaultMetadataValueMap as g } from "./lib/defaults.js";
|
13
|
-
import { MetadataEditor as
|
14
|
-
import { U as
|
15
|
-
import { AutofillContext as
|
13
|
+
import { MetadataEditor as y } from "./lib/metadata-editor.js";
|
14
|
+
import { U as H } from "../chunks/types.js";
|
15
|
+
import { AutofillContext as S, AutofillContextProvider as T, useAutofill as V } from "./lib/utils/autofill-context.js";
|
16
|
+
import { withApiWrapper as P } from "./lib/utils/api-wrapper.js";
|
16
17
|
export {
|
17
18
|
o as AddMetadataTemplateDropdown,
|
18
|
-
|
19
|
-
|
19
|
+
S as AutofillContext,
|
20
|
+
T as AutofillContextProvider,
|
20
21
|
s as CustomInstanceNewField,
|
21
22
|
l as DeleteConfirmationModal,
|
22
23
|
r as FilterDropdownMenu,
|
23
|
-
|
24
|
+
y as MetadataEditor,
|
24
25
|
f as MetadataEmptyState,
|
25
26
|
I as MetadataInstanceForm,
|
26
27
|
i as MetadataInstanceFormHeader,
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
F as MetadataInstanceHeader,
|
29
|
+
A as MetadataInstanceList,
|
30
|
+
p as SingleLevelTaxonomyField,
|
31
|
+
v as UnsavedChangesModal,
|
32
|
+
H as UpdateMode,
|
32
33
|
U as defaultInitialValues,
|
33
34
|
g as defaultMetadataValueMap,
|
34
|
-
|
35
|
+
V as useAutofill,
|
36
|
+
P as withApiWrapper
|
35
37
|
};
|
@@ -1,71 +1,72 @@
|
|
1
|
-
import { DateI18nProvider as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useMemo as
|
4
|
-
import { useIntl as
|
5
|
-
import { convertToDatePickerValue as
|
6
|
-
import { useDateInternationalization as
|
1
|
+
import { DateI18nProvider as P, DatePicker as F } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as V, getIn as b, Field as A } from "formik";
|
3
|
+
import { forwardRef as C, useMemo as I } from "react";
|
4
|
+
import { useIntl as L } from "react-intl";
|
5
|
+
import { convertToDatePickerValue as w, convertToFormikValue as N } from "./date-conversion-utils.js";
|
6
|
+
import { useDateInternationalization as z } from "./use-date-internationalization.js";
|
7
7
|
import a from "../../../../messages.js";
|
8
|
-
import
|
8
|
+
import B from "../../../interactive-text/interactive-text.js";
|
9
9
|
import { jsx as o } from "react/jsx-runtime";
|
10
|
-
const
|
10
|
+
const H = /* @__PURE__ */ C(({
|
11
11
|
description: s,
|
12
12
|
disableForm: m,
|
13
13
|
fieldNamePrefix: d,
|
14
14
|
label: r,
|
15
15
|
portalElement: f,
|
16
16
|
className: u
|
17
|
-
}) => {
|
18
|
-
const t = `${d}.value`, e =
|
19
|
-
values:
|
20
|
-
setFieldTouched:
|
21
|
-
setFieldValue:
|
22
|
-
} =
|
23
|
-
localTimezone:
|
24
|
-
} =
|
17
|
+
}, h) => {
|
18
|
+
const t = `${d}.value`, e = L(), {
|
19
|
+
values: p,
|
20
|
+
setFieldTouched: D,
|
21
|
+
setFieldValue: M
|
22
|
+
} = V(), {
|
23
|
+
localTimezone: g
|
24
|
+
} = z(e.locale), c = b(p, t), k = I(() => w(c), [c]), v = {
|
25
25
|
clearDatePickerAriaLabel: e.formatMessage(a.clearSelectedDate),
|
26
26
|
nextMonthAriaLabel: e.formatMessage(a.switchToNextMonth),
|
27
27
|
openCalendarDropdownAriaLabel: e.formatMessage(a.openCalendar),
|
28
28
|
previousMonthAriaLabel: e.formatMessage(a.switchToNextMonth)
|
29
|
-
},
|
30
|
-
const l =
|
31
|
-
|
32
|
-
},
|
33
|
-
|
29
|
+
}, x = (n) => {
|
30
|
+
const l = N(n, g);
|
31
|
+
M(t, l);
|
32
|
+
}, T = () => {
|
33
|
+
D(t, !0);
|
34
34
|
};
|
35
35
|
return /* @__PURE__ */ o("div", {
|
36
36
|
"data-testid": `${r}-field`,
|
37
|
-
children: /* @__PURE__ */ o(
|
37
|
+
children: /* @__PURE__ */ o(P, {
|
38
38
|
locale: e.locale,
|
39
|
-
children: /* @__PURE__ */ o(
|
39
|
+
children: /* @__PURE__ */ o(A, {
|
40
40
|
name: t,
|
41
41
|
children: ({
|
42
42
|
field: n,
|
43
43
|
meta: l
|
44
|
-
}) => /* @__PURE__ */ o(
|
44
|
+
}) => /* @__PURE__ */ o(F, {
|
45
45
|
...n,
|
46
|
-
...
|
46
|
+
...v,
|
47
|
+
ref: h,
|
47
48
|
calendarAriaLabel: e.formatMessage(a.selectDate),
|
48
49
|
className: u,
|
49
50
|
error: l.error,
|
50
51
|
isDisabled: m,
|
51
52
|
label: s ? ({
|
52
53
|
...i
|
53
|
-
}) =>
|
54
|
+
}) => B({
|
54
55
|
as: "span",
|
55
56
|
tooltipText: s,
|
56
57
|
children: r,
|
57
58
|
...i
|
58
59
|
}) : r,
|
59
|
-
onBlur: () =>
|
60
|
-
onChange: (i) =>
|
60
|
+
onBlur: () => T(),
|
61
|
+
onChange: (i) => x(i),
|
61
62
|
portalElement: f,
|
62
|
-
value:
|
63
|
+
value: k
|
63
64
|
})
|
64
65
|
})
|
65
66
|
})
|
66
67
|
});
|
67
|
-
};
|
68
|
+
});
|
68
69
|
export {
|
69
|
-
|
70
|
-
|
70
|
+
H as MetadataDateField,
|
71
|
+
H as default
|
71
72
|
};
|
@@ -1,54 +1,56 @@
|
|
1
1
|
import { Select as l, SELECT_EMPTY_VALUE as s } from "@box/blueprint-web";
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useIntl as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
|
2
|
+
import { useFormikContext as F, getIn as M, Field as V } from "formik";
|
3
|
+
import { useIntl as C, FormattedMessage as T } from "react-intl";
|
4
|
+
import { forwardRef as I } from "react";
|
5
|
+
import u from "../../../../messages.js";
|
6
|
+
import $ from "../../../interactive-text/interactive-text.js";
|
7
|
+
import { jsx as t, jsxs as j } from "react/jsx-runtime";
|
8
|
+
const R = /* @__PURE__ */ I(({
|
8
9
|
className: i,
|
9
10
|
description: n,
|
10
11
|
disableForm: h,
|
11
|
-
fieldNamePrefix:
|
12
|
+
fieldNamePrefix: m,
|
12
13
|
label: r,
|
13
14
|
options: v,
|
14
|
-
portalElement:
|
15
|
-
}) => {
|
15
|
+
portalElement: f
|
16
|
+
}, p) => {
|
16
17
|
const {
|
17
18
|
setFieldValue: x,
|
18
|
-
values:
|
19
|
-
} =
|
19
|
+
values: g
|
20
|
+
} = F(), E = C(), c = `${m}.value`, o = v || M(g, `${m}.options`, []).map(({
|
20
21
|
key: a
|
21
|
-
}) => a),
|
22
|
+
}) => a), d = E.formatMessage(u.selectValuePlaceholder);
|
22
23
|
return /* @__PURE__ */ t("div", {
|
23
24
|
"data-testid": `${r}-field`,
|
24
|
-
children: /* @__PURE__ */ t(
|
25
|
-
name:
|
25
|
+
children: /* @__PURE__ */ t(V, {
|
26
|
+
name: c,
|
26
27
|
children: ({
|
27
28
|
field: a
|
28
29
|
}) => /* @__PURE__ */ t(l, {
|
30
|
+
ref: p,
|
29
31
|
className: i,
|
30
32
|
disabled: h,
|
31
33
|
label: n ? ({
|
32
34
|
...e
|
33
|
-
}) =>
|
35
|
+
}) => $({
|
34
36
|
as: "label",
|
35
37
|
tooltipText: n,
|
36
38
|
children: r,
|
37
39
|
...e
|
38
40
|
}) : r,
|
39
41
|
onValueChange: (e) => {
|
40
|
-
x(
|
42
|
+
x(c, e === s ? "" : e);
|
41
43
|
},
|
42
|
-
placeholder:
|
44
|
+
placeholder: d,
|
43
45
|
...a,
|
44
46
|
value: a.value === s ? "" : a.value,
|
45
|
-
children: /* @__PURE__ */
|
46
|
-
container:
|
47
|
+
children: /* @__PURE__ */ j(l.Content, {
|
48
|
+
container: f,
|
47
49
|
children: [/* @__PURE__ */ t(l.Option, {
|
48
|
-
text:
|
50
|
+
text: d,
|
49
51
|
value: s,
|
50
|
-
children: /* @__PURE__ */ t(
|
51
|
-
...
|
52
|
+
children: /* @__PURE__ */ t(T, {
|
53
|
+
...u.selectValuePlaceholder
|
52
54
|
})
|
53
55
|
}), o == null ? void 0 : o.map((e) => /* @__PURE__ */ t(l.Option, {
|
54
56
|
text: e,
|
@@ -59,8 +61,8 @@ const A = ({
|
|
59
61
|
})
|
60
62
|
})
|
61
63
|
});
|
62
|
-
};
|
64
|
+
});
|
63
65
|
export {
|
64
|
-
|
65
|
-
|
66
|
+
R as MetadataEnumField,
|
67
|
+
R as default
|
66
68
|
};
|
@@ -1,59 +1,60 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useRef as
|
4
|
-
import
|
5
|
-
import { fieldDefaultProps as
|
6
|
-
import { useFloatValidation as
|
1
|
+
import { TextInput as T } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as g, getIn as C, Field as I } from "formik";
|
3
|
+
import { forwardRef as R, useRef as V } from "react";
|
4
|
+
import $ from "../../../interactive-text/interactive-text.js";
|
5
|
+
import { fieldDefaultProps as b } from "../constants.js";
|
6
|
+
import { useFloatValidation as B } from "./use-float-validation.js";
|
7
7
|
import { jsx as a } from "react/jsx-runtime";
|
8
|
-
const
|
8
|
+
const N = /* @__PURE__ */ R(({
|
9
9
|
className: i,
|
10
10
|
description: l,
|
11
11
|
label: r,
|
12
12
|
fieldNamePrefix: d,
|
13
13
|
disableForm: s
|
14
|
-
}) => {
|
14
|
+
}, u) => {
|
15
15
|
const {
|
16
|
-
values:
|
16
|
+
values: f,
|
17
17
|
setFieldValue: m,
|
18
18
|
setFieldTouched: c
|
19
|
-
} =
|
20
|
-
validateFloats:
|
21
|
-
} =
|
19
|
+
} = g(), t = `${d}.value`, p = C(f, t), n = V(p), {
|
20
|
+
validateFloats: h
|
21
|
+
} = B(), F = (e) => {
|
22
22
|
n.current = e, m(t, e);
|
23
|
-
},
|
23
|
+
}, v = (e) => {
|
24
24
|
c(e, !0);
|
25
25
|
};
|
26
26
|
return /* @__PURE__ */ a("div", {
|
27
27
|
"data-testid": `${r}-field`,
|
28
|
-
children: /* @__PURE__ */ a(
|
28
|
+
children: /* @__PURE__ */ a(I, {
|
29
29
|
name: `${t}`,
|
30
|
-
validate: () =>
|
30
|
+
validate: () => h(n.current),
|
31
31
|
children: ({
|
32
32
|
field: e,
|
33
|
-
meta:
|
34
|
-
}) => /* @__PURE__ */ a(
|
35
|
-
|
33
|
+
meta: x
|
34
|
+
}) => /* @__PURE__ */ a(T, {
|
35
|
+
...b,
|
36
36
|
...e,
|
37
|
+
ref: u,
|
37
38
|
className: i,
|
38
39
|
disabled: s,
|
39
|
-
error:
|
40
|
+
error: x.error,
|
40
41
|
label: l ? ({
|
41
42
|
...o
|
42
|
-
}) =>
|
43
|
+
}) => $({
|
43
44
|
as: "label",
|
44
45
|
tooltipText: l,
|
45
46
|
children: r,
|
46
47
|
...o
|
47
48
|
}) : r,
|
48
|
-
onBlur: () =>
|
49
|
-
onChange: (o) =>
|
49
|
+
onBlur: () => v(t),
|
50
|
+
onChange: (o) => F(o.currentTarget.value),
|
50
51
|
placeholder: "0",
|
51
52
|
type: "number"
|
52
53
|
})
|
53
54
|
})
|
54
55
|
});
|
55
|
-
};
|
56
|
+
});
|
56
57
|
export {
|
57
|
-
|
58
|
-
|
58
|
+
N as MetadataFloatField,
|
59
|
+
N as default
|
59
60
|
};
|
@@ -1,62 +1,64 @@
|
|
1
|
-
import { TooltipProvider as
|
2
|
-
import { useFormikContext as
|
1
|
+
import { TooltipProvider as g, Combobox as x } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as C, getIn as b, Field as w } from "formik";
|
3
3
|
import { useIntl as I } from "react-intl";
|
4
|
-
import M from "
|
5
|
-
import T from "
|
6
|
-
import
|
4
|
+
import { forwardRef as M } from "react";
|
5
|
+
import T from "../../../../messages.js";
|
6
|
+
import $ from "../../../interactive-text/interactive-text.js";
|
7
|
+
import { fieldDefaultProps as L } from "../constants.js";
|
7
8
|
import { jsx as o } from "react/jsx-runtime";
|
8
|
-
const
|
9
|
+
const q = /* @__PURE__ */ M(({
|
9
10
|
className: s,
|
10
11
|
description: a,
|
11
12
|
disableForm: m,
|
12
13
|
fieldNamePrefix: i,
|
13
|
-
label:
|
14
|
-
portalElement:
|
15
|
-
options:
|
16
|
-
}) => {
|
14
|
+
label: r,
|
15
|
+
portalElement: d,
|
16
|
+
options: u
|
17
|
+
}, p) => {
|
17
18
|
const {
|
18
19
|
setFieldValue: c,
|
19
|
-
values:
|
20
|
-
} =
|
20
|
+
values: f
|
21
|
+
} = C(), h = I(), n = `${i}.value`, v = u || b(f, `${i}.options`, []).map(({
|
21
22
|
key: e
|
22
|
-
}) => e),
|
23
|
+
}) => e), F = (e, t) => t.toLowerCase().includes(e.toLowerCase());
|
23
24
|
return /* @__PURE__ */ o("div", {
|
24
|
-
"data-testid": `${
|
25
|
-
children: /* @__PURE__ */ o(
|
25
|
+
"data-testid": `${r}-field`,
|
26
|
+
children: /* @__PURE__ */ o(w, {
|
26
27
|
name: n,
|
27
28
|
children: ({
|
28
29
|
field: e
|
29
30
|
}) => {
|
30
31
|
var t;
|
31
|
-
return /* @__PURE__ */ o(
|
32
|
-
children: /* @__PURE__ */ o(
|
33
|
-
|
32
|
+
return /* @__PURE__ */ o(g, {
|
33
|
+
children: /* @__PURE__ */ o(x, {
|
34
|
+
...L,
|
35
|
+
ref: p,
|
34
36
|
as: "input",
|
35
37
|
className: s,
|
36
38
|
disabled: m,
|
37
|
-
filterFn:
|
39
|
+
filterFn: F,
|
38
40
|
label: a ? ({
|
39
|
-
...
|
40
|
-
}) =>
|
41
|
+
...l
|
42
|
+
}) => $({
|
41
43
|
as: "label",
|
42
44
|
tooltipText: a,
|
43
|
-
children:
|
44
|
-
...
|
45
|
-
}) :
|
45
|
+
children: r,
|
46
|
+
...l
|
47
|
+
}) : r,
|
46
48
|
multiselect: !0,
|
47
49
|
name: e.name,
|
48
|
-
onValueChange: (
|
49
|
-
options:
|
50
|
-
placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ?
|
51
|
-
portalElement:
|
50
|
+
onValueChange: (l) => c(n, l),
|
51
|
+
options: v,
|
52
|
+
placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? h.formatMessage(T.multiselectPlaceholder) : "",
|
53
|
+
portalElement: d,
|
52
54
|
value: e.value
|
53
55
|
})
|
54
56
|
});
|
55
57
|
}
|
56
58
|
})
|
57
59
|
});
|
58
|
-
};
|
60
|
+
});
|
59
61
|
export {
|
60
|
-
|
61
|
-
|
62
|
+
q as MetadataMultiSelectField,
|
63
|
+
q as default
|
62
64
|
};
|
@@ -1,46 +1,48 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { Field as
|
3
|
-
import { useIntl as
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import {
|
8
|
-
|
9
|
-
|
1
|
+
import { TextInput as p } from "@box/blueprint-web";
|
2
|
+
import { Field as c } from "formik";
|
3
|
+
import { useIntl as u } from "react-intl";
|
4
|
+
import { forwardRef as h } from "react";
|
5
|
+
import x from "../../../../messages.js";
|
6
|
+
import g from "../../../interactive-text/interactive-text.js";
|
7
|
+
import { fieldDefaultProps as v } from "../constants.js";
|
8
|
+
import { jsx as r } from "react/jsx-runtime";
|
9
|
+
const F = /* @__PURE__ */ h(({
|
10
|
+
description: t,
|
10
11
|
label: e,
|
11
|
-
fieldNamePrefix:
|
12
|
-
disableForm:
|
12
|
+
fieldNamePrefix: o,
|
13
|
+
disableForm: a,
|
13
14
|
className: i
|
14
|
-
}) => {
|
15
|
-
const
|
16
|
-
return /* @__PURE__ */
|
15
|
+
}, l) => {
|
16
|
+
const m = u(), d = `${o}.value`;
|
17
|
+
return /* @__PURE__ */ r("div", {
|
17
18
|
"data-testid": `${e}-field`,
|
18
|
-
children: /* @__PURE__ */
|
19
|
+
children: /* @__PURE__ */ r(c, {
|
19
20
|
name: d,
|
20
21
|
children: ({
|
21
|
-
field:
|
22
|
+
field: f,
|
22
23
|
meta: s
|
23
|
-
}) => /* @__PURE__ */
|
24
|
-
...
|
25
|
-
...
|
24
|
+
}) => /* @__PURE__ */ r(p, {
|
25
|
+
...v,
|
26
|
+
...f,
|
27
|
+
ref: l,
|
26
28
|
className: i,
|
27
|
-
disabled:
|
29
|
+
disabled: a,
|
28
30
|
error: s.error,
|
29
|
-
label:
|
30
|
-
...
|
31
|
-
}) =>
|
31
|
+
label: t ? ({
|
32
|
+
...n
|
33
|
+
}) => g({
|
32
34
|
as: "label",
|
33
|
-
tooltipText:
|
35
|
+
tooltipText: t,
|
34
36
|
children: e,
|
35
|
-
...
|
37
|
+
...n
|
36
38
|
}) : e,
|
37
|
-
placeholder:
|
39
|
+
placeholder: m.formatMessage(x.setValuePlaceholder)
|
38
40
|
})
|
39
41
|
})
|
40
42
|
});
|
41
|
-
};
|
42
|
-
|
43
|
+
});
|
44
|
+
F.displayName = "MetadataStringField";
|
43
45
|
export {
|
44
|
-
|
45
|
-
|
46
|
+
F as MetadataStringField,
|
47
|
+
F as default
|
46
48
|
};
|