@box/metadata-editor 0.45.0 → 0.46.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 +65 -0
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +76 -0
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.js +4 -0
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +26 -0
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +13 -0
- package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +49 -45
- package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +21 -19
- package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +28 -26
- package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +27 -25
- package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +22 -20
- package/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +12 -0
- package/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +22 -43
- package/esm/lib/test-utils/sample-data.js +8 -8
- package/i18n/bn-IN.js +5 -0
- package/i18n/da-DK.js +5 -0
- package/i18n/de-DE.js +5 -0
- package/i18n/en-AU.js +5 -0
- package/i18n/en-CA.js +5 -0
- package/i18n/en-GB.js +5 -0
- package/i18n/en-US.js +5 -0
- package/i18n/en-US.properties +10 -0
- package/i18n/en-x-pseudo.js +5 -0
- package/i18n/es-419.js +5 -0
- package/i18n/es-ES.js +5 -0
- package/i18n/fi-FI.js +5 -0
- package/i18n/fr-CA.js +5 -0
- package/i18n/fr-FR.js +5 -0
- package/i18n/hi-IN.js +5 -0
- package/i18n/it-IT.js +5 -0
- package/i18n/ja-JP.js +5 -0
- package/i18n/json/src/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.json +1 -0
- package/i18n/ko-KR.js +5 -0
- package/i18n/nb-NO.js +5 -0
- package/i18n/nl-NL.js +5 -0
- package/i18n/pl-PL.js +5 -0
- package/i18n/pt-BR.js +5 -0
- package/i18n/ru-RU.js +5 -0
- package/i18n/sv-SE.js +5 -0
- package/i18n/tr-TR.js +5 -0
- package/i18n/zh-CN.js +5 -0
- package/i18n/zh-TW.js +5 -0
- package/package.json +5 -5
- package/styles/ai-suggestion-field.css +1 -0
- package/styles/metadata-editor-field-wrapper.css +1 -0
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.d.ts +2 -0
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/index.d.ts +1 -0
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.d.ts +28 -0
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/types.d.ts +21 -0
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.d.ts +3 -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 -1
- package/types/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.d.ts +2 -0
- package/types/lib/components/metadata-editor-fields/metadata-editor-fields.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/types.d.ts +6 -1
- package/types/lib/test-utils/sample-data.d.ts +2 -2
- package/types/lib/types.d.ts +2 -1
- package/styles/metadata-editor-fields.css +0 -1
@@ -0,0 +1,65 @@
|
|
1
|
+
import "../styles/metadata-editor-field-wrapper.css";
|
2
|
+
import S from "clsx";
|
3
|
+
import { useFormikContext as x } from "formik";
|
4
|
+
import _ from "lodash/isUndefined";
|
5
|
+
import { useState as h } from "react";
|
6
|
+
import { AiSuggestionField as A } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
|
7
|
+
import { UpdateModeFieldWrapper as v } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
8
|
+
import { editorFieldTypes as k } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
|
9
|
+
import { jsx as o, jsxs as F } from "react/jsx-runtime";
|
10
|
+
const W = "_noAttributesText_vykxc_1", M = "_fieldWrapper_vykxc_5", N = "_hasSuggestion_vykxc_5", T = "_error_vykxc_13", u = {
|
11
|
+
noAttributesText: W,
|
12
|
+
fieldWrapper: M,
|
13
|
+
hasSuggestion: N,
|
14
|
+
error: T
|
15
|
+
}, E = ({
|
16
|
+
disableForm: a,
|
17
|
+
portalElement: n,
|
18
|
+
field: e,
|
19
|
+
index: p
|
20
|
+
}) => {
|
21
|
+
const {
|
22
|
+
setFieldValue: d
|
23
|
+
} = x(), [g, r] = h(!0), i = k[e.type], c = i && !e.hidden, m = !_(e.updateMode), s = `metadata.fields[${p}]`;
|
24
|
+
if (!c)
|
25
|
+
return null;
|
26
|
+
if (m)
|
27
|
+
return /* @__PURE__ */ o(v, {
|
28
|
+
fieldNamePrefix: s,
|
29
|
+
fieldType: e.type,
|
30
|
+
children: /* @__PURE__ */ o(i, {
|
31
|
+
disableForm: a,
|
32
|
+
fieldNamePrefix: s,
|
33
|
+
label: e.displayName,
|
34
|
+
portalElement: n
|
35
|
+
})
|
36
|
+
}, e.key);
|
37
|
+
const {
|
38
|
+
aiSuggestion: t,
|
39
|
+
value: f
|
40
|
+
} = e, l = t && g;
|
41
|
+
return /* @__PURE__ */ F("div", {
|
42
|
+
className: u.fieldWrapper,
|
43
|
+
children: [/* @__PURE__ */ o(i, {
|
44
|
+
className: S(l && u.hasSuggestion),
|
45
|
+
disableForm: a,
|
46
|
+
fieldNamePrefix: `metadata.fields[${p}]`,
|
47
|
+
label: e.displayName,
|
48
|
+
portalElement: n
|
49
|
+
}), l && /* @__PURE__ */ o(A, {
|
50
|
+
aiSuggestion: t,
|
51
|
+
onAiSuggestionAppend: () => {
|
52
|
+
const y = e.type === "multiSelect" ? [f, t].flat() : t;
|
53
|
+
d(`${s}.value`, y), r(!1);
|
54
|
+
},
|
55
|
+
onAiSuggestionIgnore: () => r(!1),
|
56
|
+
onAiSuggestionReplace: () => {
|
57
|
+
d(`${s}.value`, t), r(!1);
|
58
|
+
}
|
59
|
+
})]
|
60
|
+
}, e.key);
|
61
|
+
};
|
62
|
+
export {
|
63
|
+
E as M,
|
64
|
+
u as s
|
65
|
+
};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import "../../../../../../styles/ai-suggestion-field.css";
|
2
|
+
import { Text as l, IconButton as c, DropdownMenu as r } from "@box/blueprint-web";
|
3
|
+
import { Checkmark as d, Ellipsis as u } from "@box/blueprint-web-assets/icons/Fill";
|
4
|
+
import { useIntl as h, FormattedMessage as n } from "react-intl";
|
5
|
+
import t from "./messages.js";
|
6
|
+
import { formatSuggestionValue as S } from "./utils.js";
|
7
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
8
|
+
const _ = "_wrapperGradient_1izxt_1", f = "_wrapper_1izxt_1", x = "_buttons_1izxt_18", w = "_selectTrigger_1izxt_22", o = {
|
9
|
+
wrapperGradient: _,
|
10
|
+
wrapper: f,
|
11
|
+
buttons: x,
|
12
|
+
selectTrigger: w
|
13
|
+
};
|
14
|
+
function M({
|
15
|
+
aiSuggestion: p,
|
16
|
+
onAiSuggestionAppend: a,
|
17
|
+
onAiSuggestionReplace: g,
|
18
|
+
onAiSuggestionIgnore: m
|
19
|
+
}) {
|
20
|
+
const s = h();
|
21
|
+
return /* @__PURE__ */ e("div", {
|
22
|
+
className: o.wrapperGradient,
|
23
|
+
children: /* @__PURE__ */ i("div", {
|
24
|
+
className: o.wrapper,
|
25
|
+
children: [/* @__PURE__ */ i("div", {
|
26
|
+
children: [/* @__PURE__ */ e(l, {
|
27
|
+
as: "p",
|
28
|
+
color: "textOnLightSecondary",
|
29
|
+
variant: "caption",
|
30
|
+
children: /* @__PURE__ */ e(n, {
|
31
|
+
...t.aiSuggestionCaption
|
32
|
+
})
|
33
|
+
}), /* @__PURE__ */ e(l, {
|
34
|
+
as: "p",
|
35
|
+
children: S(p)
|
36
|
+
})]
|
37
|
+
}), /* @__PURE__ */ i("div", {
|
38
|
+
className: o.buttons,
|
39
|
+
children: [/* @__PURE__ */ e(c, {
|
40
|
+
"aria-label": s.formatMessage(t.aiSuggestionAppend),
|
41
|
+
icon: d,
|
42
|
+
onClick: a,
|
43
|
+
size: "x-small"
|
44
|
+
}), /* @__PURE__ */ i(r.Root, {
|
45
|
+
children: [/* @__PURE__ */ e(r.Trigger, {
|
46
|
+
className: o.selectTrigger,
|
47
|
+
children: /* @__PURE__ */ e(c, {
|
48
|
+
"aria-label": s.formatMessage(t.aiSuggestionOptions),
|
49
|
+
icon: u
|
50
|
+
})
|
51
|
+
}), /* @__PURE__ */ i(r.Content, {
|
52
|
+
children: [/* @__PURE__ */ e(r.Item, {
|
53
|
+
onSelect: a,
|
54
|
+
children: /* @__PURE__ */ e(n, {
|
55
|
+
...t.aiSuggestionAppend
|
56
|
+
})
|
57
|
+
}), /* @__PURE__ */ e(r.Item, {
|
58
|
+
onSelect: g,
|
59
|
+
children: /* @__PURE__ */ e(n, {
|
60
|
+
...t.aiSuggestionClearAndReplace
|
61
|
+
})
|
62
|
+
}), /* @__PURE__ */ e(r.Separator, {}), /* @__PURE__ */ e(r.Item, {
|
63
|
+
onSelect: m,
|
64
|
+
children: /* @__PURE__ */ e(n, {
|
65
|
+
...t.aiSuggestionIgnore
|
66
|
+
})
|
67
|
+
})]
|
68
|
+
})]
|
69
|
+
})]
|
70
|
+
})]
|
71
|
+
})
|
72
|
+
});
|
73
|
+
}
|
74
|
+
export {
|
75
|
+
M as AiSuggestionField
|
76
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { defineMessages as e } from "react-intl";
|
2
|
+
const i = e({
|
3
|
+
aiSuggestionCaption: {
|
4
|
+
id: "metadataEditor.aiSuggestionField.aiSuggestionCaption",
|
5
|
+
defaultMessage: "Box AI suggestion:"
|
6
|
+
},
|
7
|
+
aiSuggestionOptions: {
|
8
|
+
id: "metadataEditor.aiSuggestionField.aiSuggestionOptions",
|
9
|
+
defaultMessage: "Options"
|
10
|
+
},
|
11
|
+
aiSuggestionAppend: {
|
12
|
+
id: "metadataEditor.aiSuggestionField.appendLabel",
|
13
|
+
defaultMessage: "Append"
|
14
|
+
},
|
15
|
+
aiSuggestionClearAndReplace: {
|
16
|
+
id: "metadataEditor.aiSuggestionField.clearAndReplaceLabel",
|
17
|
+
defaultMessage: "Clear and Replace"
|
18
|
+
},
|
19
|
+
aiSuggestionIgnore: {
|
20
|
+
id: "metadataEditor.aiSuggestionField.ignoreLabel",
|
21
|
+
defaultMessage: "Ignore"
|
22
|
+
}
|
23
|
+
});
|
24
|
+
export {
|
25
|
+
i as default
|
26
|
+
};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
function n(t) {
|
2
|
+
if (t == null)
|
3
|
+
return null;
|
4
|
+
if (typeof t == "number")
|
5
|
+
return t.toString();
|
6
|
+
if (Array.isArray(t))
|
7
|
+
return t.join(", ");
|
8
|
+
const r = new Date(t);
|
9
|
+
return !isNaN(r.getTime()) && r.toISOString() === t ? r.toLocaleDateString() : t;
|
10
|
+
}
|
11
|
+
export {
|
12
|
+
n as formatSuggestionValue
|
13
|
+
};
|
@@ -1,60 +1,64 @@
|
|
1
|
-
import { DateI18nProvider as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useMemo as
|
4
|
-
import { useIntl as
|
5
|
-
import { convertToDatePickerValue as
|
6
|
-
import { useDateInternationalization as
|
7
|
-
import
|
1
|
+
import { DateI18nProvider as P, DatePicker as x } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as F, getIn as T, Field as V } from "formik";
|
3
|
+
import { useMemo as b } from "react";
|
4
|
+
import { useIntl as A } from "react-intl";
|
5
|
+
import { convertToDatePickerValue as C, convertToFormikValue as L } from "./date-conversion-utils.js";
|
6
|
+
import { useDateInternationalization as I } from "./use-date-internationalization.js";
|
7
|
+
import o from "../../../../messages.js";
|
8
8
|
import { jsx as t } from "react/jsx-runtime";
|
9
|
-
const
|
10
|
-
disableForm:
|
11
|
-
fieldNamePrefix:
|
12
|
-
label:
|
13
|
-
portalElement:
|
9
|
+
const q = ({
|
10
|
+
disableForm: c,
|
11
|
+
fieldNamePrefix: m,
|
12
|
+
label: i,
|
13
|
+
portalElement: d,
|
14
|
+
className: u
|
14
15
|
}) => {
|
15
|
-
const
|
16
|
-
values:
|
17
|
-
setFieldTouched:
|
18
|
-
setFieldValue:
|
19
|
-
} =
|
20
|
-
localTimezone:
|
21
|
-
} =
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
16
|
+
const a = `${m}.value`, e = A(), {
|
17
|
+
values: f,
|
18
|
+
setFieldTouched: h,
|
19
|
+
setFieldValue: p
|
20
|
+
} = F(), {
|
21
|
+
localTimezone: D
|
22
|
+
} = I(e.locale), r = T(f, a), s = b(() => C(r), [r]);
|
23
|
+
console.log(0, r, s);
|
24
|
+
const M = {
|
25
|
+
clearDatePickerAriaLabel: e.formatMessage(o.clearSelectedDate),
|
26
|
+
nextMonthAriaLabel: e.formatMessage(o.switchToNextMonth),
|
27
|
+
openCalendarDropdownAriaLabel: e.formatMessage(o.openCalendar),
|
28
|
+
previousMonthAriaLabel: e.formatMessage(o.switchToNextMonth)
|
29
|
+
}, g = (l) => {
|
30
|
+
const n = L(l, D);
|
31
|
+
p(a, n);
|
32
|
+
}, k = () => {
|
33
|
+
h(a, !0);
|
31
34
|
};
|
32
35
|
return /* @__PURE__ */ t("div", {
|
33
|
-
"data-testid": `${
|
34
|
-
children: /* @__PURE__ */ t(
|
36
|
+
"data-testid": `${i}-field`,
|
37
|
+
children: /* @__PURE__ */ t(P, {
|
35
38
|
locale: e.locale,
|
36
|
-
children: /* @__PURE__ */ t(
|
37
|
-
name:
|
39
|
+
children: /* @__PURE__ */ t(V, {
|
40
|
+
name: a,
|
38
41
|
children: ({
|
39
|
-
field:
|
42
|
+
field: l,
|
40
43
|
meta: n
|
41
|
-
}) => /* @__PURE__ */ t(
|
42
|
-
...
|
43
|
-
...
|
44
|
-
calendarAriaLabel: e.formatMessage(
|
44
|
+
}) => /* @__PURE__ */ t(x, {
|
45
|
+
...l,
|
46
|
+
...M,
|
47
|
+
calendarAriaLabel: e.formatMessage(o.selectDate),
|
48
|
+
className: u,
|
45
49
|
error: n.error,
|
46
|
-
isDisabled:
|
47
|
-
label:
|
48
|
-
onBlur: () =>
|
49
|
-
onChange: (
|
50
|
-
portalElement:
|
51
|
-
value:
|
50
|
+
isDisabled: c,
|
51
|
+
label: i,
|
52
|
+
onBlur: () => k(),
|
53
|
+
onChange: (v) => g(v),
|
54
|
+
portalElement: d,
|
55
|
+
value: s
|
52
56
|
})
|
53
57
|
})
|
54
58
|
})
|
55
59
|
});
|
56
60
|
};
|
57
61
|
export {
|
58
|
-
|
59
|
-
|
62
|
+
q as MetadataDateField,
|
63
|
+
q as default
|
60
64
|
};
|
@@ -1,42 +1,44 @@
|
|
1
1
|
import { Select as l, SELECT_EMPTY_VALUE as r } from "@box/blueprint-web";
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useIntl as
|
2
|
+
import { useFormikContext as x, getIn as E, Field as F } from "formik";
|
3
|
+
import { useIntl as M, FormattedMessage as V } from "react-intl";
|
4
4
|
import d from "../../../../messages.js";
|
5
|
-
import { jsx as t, jsxs as
|
6
|
-
const
|
7
|
-
|
5
|
+
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
6
|
+
const T = ({
|
7
|
+
className: m,
|
8
|
+
disableForm: i,
|
8
9
|
fieldNamePrefix: n,
|
9
10
|
label: o,
|
10
|
-
options:
|
11
|
-
portalElement:
|
11
|
+
options: h,
|
12
|
+
portalElement: v
|
12
13
|
}) => {
|
13
14
|
const {
|
14
|
-
setFieldValue:
|
15
|
-
values:
|
16
|
-
} =
|
15
|
+
setFieldValue: p,
|
16
|
+
values: g
|
17
|
+
} = x(), f = M(), c = `${n}.value`, s = h || E(g, `${n}.options`, []).map(({
|
17
18
|
key: a
|
18
|
-
}) => a), u =
|
19
|
+
}) => a), u = f.formatMessage(d.selectValuePlaceholder);
|
19
20
|
return /* @__PURE__ */ t("div", {
|
20
21
|
"data-testid": `${o}-field`,
|
21
|
-
children: /* @__PURE__ */ t(
|
22
|
+
children: /* @__PURE__ */ t(F, {
|
22
23
|
name: c,
|
23
24
|
children: ({
|
24
25
|
field: a
|
25
26
|
}) => /* @__PURE__ */ t(l, {
|
26
|
-
|
27
|
+
className: m,
|
28
|
+
disabled: i,
|
27
29
|
label: o,
|
28
30
|
onValueChange: (e) => {
|
29
|
-
|
31
|
+
p(c, e === r ? "" : e);
|
30
32
|
},
|
31
33
|
placeholder: u,
|
32
34
|
...a,
|
33
35
|
value: a.value === r ? "" : a.value,
|
34
|
-
children: /* @__PURE__ */
|
35
|
-
container:
|
36
|
+
children: /* @__PURE__ */ C(l.Content, {
|
37
|
+
container: v,
|
36
38
|
children: [/* @__PURE__ */ t(l.Option, {
|
37
39
|
text: u,
|
38
40
|
value: r,
|
39
|
-
children: /* @__PURE__ */ t(
|
41
|
+
children: /* @__PURE__ */ t(V, {
|
40
42
|
...d.selectValuePlaceholder
|
41
43
|
})
|
42
44
|
}), s == null ? void 0 : s.map((e) => /* @__PURE__ */ t(l.Option, {
|
@@ -50,6 +52,6 @@ const S = ({
|
|
50
52
|
});
|
51
53
|
};
|
52
54
|
export {
|
53
|
-
|
54
|
-
|
55
|
+
T as MetadataEnumField,
|
56
|
+
T as default
|
55
57
|
};
|
@@ -1,47 +1,49 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useRef as
|
4
|
-
import { fieldDefaultProps as
|
5
|
-
import { useFloatValidation as
|
1
|
+
import { TextInput as v } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as g, getIn as x, Field as C } from "formik";
|
3
|
+
import { useRef as T } from "react";
|
4
|
+
import { fieldDefaultProps as V } from "../constants.js";
|
5
|
+
import { useFloatValidation as $ } from "./use-float-validation.js";
|
6
6
|
import { jsx as r } from "react/jsx-runtime";
|
7
|
-
const
|
7
|
+
const D = ({
|
8
8
|
label: o,
|
9
9
|
fieldNamePrefix: l,
|
10
|
-
disableForm: n
|
10
|
+
disableForm: n,
|
11
|
+
className: i
|
11
12
|
}) => {
|
12
13
|
const {
|
13
|
-
values:
|
14
|
-
setFieldValue:
|
15
|
-
setFieldTouched:
|
16
|
-
} =
|
17
|
-
validateFloats:
|
18
|
-
} =
|
19
|
-
a.current = e,
|
20
|
-
},
|
21
|
-
|
14
|
+
values: d,
|
15
|
+
setFieldValue: s,
|
16
|
+
setFieldTouched: u
|
17
|
+
} = g(), t = `${l}.value`, c = x(d, t), a = T(c), {
|
18
|
+
validateFloats: m
|
19
|
+
} = $(), f = (e) => {
|
20
|
+
a.current = e, s(t, e);
|
21
|
+
}, p = (e) => {
|
22
|
+
u(e, !0);
|
22
23
|
};
|
23
24
|
return /* @__PURE__ */ r("div", {
|
24
25
|
"data-testid": `${o}-field`,
|
25
|
-
children: /* @__PURE__ */ r(
|
26
|
+
children: /* @__PURE__ */ r(C, {
|
26
27
|
name: `${t}`,
|
27
|
-
validate: () =>
|
28
|
+
validate: () => m(a.current),
|
28
29
|
children: ({
|
29
30
|
field: e,
|
30
|
-
meta:
|
31
|
-
}) => /* @__PURE__ */ r(
|
32
|
-
...
|
31
|
+
meta: h
|
32
|
+
}) => /* @__PURE__ */ r(v, {
|
33
|
+
...V,
|
33
34
|
...e,
|
35
|
+
className: i,
|
34
36
|
disabled: n,
|
35
|
-
error:
|
37
|
+
error: h.error,
|
36
38
|
label: o,
|
37
|
-
onBlur: () =>
|
38
|
-
onChange: (
|
39
|
+
onBlur: () => p(t),
|
40
|
+
onChange: (F) => f(F.currentTarget.value),
|
39
41
|
placeholder: "0"
|
40
42
|
})
|
41
43
|
})
|
42
44
|
});
|
43
45
|
};
|
44
46
|
export {
|
45
|
-
|
46
|
-
|
47
|
+
D as MetadataFloatField,
|
48
|
+
D as default
|
47
49
|
};
|
@@ -1,43 +1,45 @@
|
|
1
|
-
import { TooltipProvider as
|
2
|
-
import { useFormikContext as
|
3
|
-
import { useIntl as
|
4
|
-
import
|
5
|
-
import { fieldDefaultProps as
|
1
|
+
import { TooltipProvider as v, Combobox as F } from "@box/blueprint-web";
|
2
|
+
import { useFormikContext as g, getIn as C, Field as x } from "formik";
|
3
|
+
import { useIntl as M } from "react-intl";
|
4
|
+
import $ from "../../../../messages.js";
|
5
|
+
import { fieldDefaultProps as b } from "../constants.js";
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
7
|
-
const
|
8
|
-
|
7
|
+
const k = ({
|
8
|
+
className: s,
|
9
|
+
disableForm: a,
|
9
10
|
fieldNamePrefix: l,
|
10
11
|
label: r,
|
11
|
-
portalElement:
|
12
|
-
options:
|
12
|
+
portalElement: n,
|
13
|
+
options: m
|
13
14
|
}) => {
|
14
15
|
const {
|
15
|
-
setFieldValue:
|
16
|
-
values:
|
17
|
-
} =
|
16
|
+
setFieldValue: u,
|
17
|
+
values: d
|
18
|
+
} = g(), c = M(), i = `${l}.value`, p = m || C(d, `${l}.options`, []).map(({
|
18
19
|
key: e
|
19
|
-
}) => e),
|
20
|
+
}) => e), f = (e, t) => t.toLowerCase().includes(e.toLowerCase());
|
20
21
|
return /* @__PURE__ */ o("div", {
|
21
22
|
"data-testid": `${r}-field`,
|
22
|
-
children: /* @__PURE__ */ o(
|
23
|
+
children: /* @__PURE__ */ o(x, {
|
23
24
|
name: i,
|
24
25
|
children: ({
|
25
26
|
field: e
|
26
27
|
}) => {
|
27
28
|
var t;
|
28
|
-
return /* @__PURE__ */ o(
|
29
|
-
children: /* @__PURE__ */ o(
|
30
|
-
|
29
|
+
return /* @__PURE__ */ o(v, {
|
30
|
+
children: /* @__PURE__ */ o(F, {
|
31
|
+
...b,
|
31
32
|
as: "input",
|
32
|
-
|
33
|
-
|
33
|
+
className: s,
|
34
|
+
disabled: a,
|
35
|
+
filterFn: f,
|
34
36
|
label: r,
|
35
37
|
multiselect: !0,
|
36
38
|
name: e.name,
|
37
|
-
onValueChange: (
|
38
|
-
options:
|
39
|
-
placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ?
|
40
|
-
portalElement:
|
39
|
+
onValueChange: (h) => u(i, h),
|
40
|
+
options: p,
|
41
|
+
placeholder: ((t = e.value) == null ? void 0 : t.length) === 0 ? c.formatMessage($.multiselectPlaceholder) : "",
|
42
|
+
portalElement: n,
|
41
43
|
value: e.value
|
42
44
|
})
|
43
45
|
});
|
@@ -46,6 +48,6 @@ const j = ({
|
|
46
48
|
});
|
47
49
|
};
|
48
50
|
export {
|
49
|
-
|
50
|
-
|
51
|
+
k as MetadataMultiSelectField,
|
52
|
+
k as default
|
51
53
|
};
|
@@ -1,35 +1,37 @@
|
|
1
|
-
import { TextInput as
|
2
|
-
import { Field as
|
3
|
-
import { useIntl as
|
4
|
-
import
|
5
|
-
import { fieldDefaultProps as
|
1
|
+
import { TextInput as s } from "@box/blueprint-web";
|
2
|
+
import { Field as f } from "formik";
|
3
|
+
import { useIntl as n } from "react-intl";
|
4
|
+
import p from "../../../../messages.js";
|
5
|
+
import { fieldDefaultProps as c } from "../constants.js";
|
6
6
|
import { jsx as e } from "react/jsx-runtime";
|
7
|
-
const
|
7
|
+
const u = ({
|
8
8
|
label: r,
|
9
9
|
fieldNamePrefix: t,
|
10
|
-
disableForm: a
|
10
|
+
disableForm: a,
|
11
|
+
className: o
|
11
12
|
}) => {
|
12
|
-
const
|
13
|
+
const i = n(), d = `${t}.value`;
|
13
14
|
return /* @__PURE__ */ e("div", {
|
14
15
|
"data-testid": `${r}-field`,
|
15
|
-
children: /* @__PURE__ */ e(
|
16
|
-
name:
|
16
|
+
children: /* @__PURE__ */ e(f, {
|
17
|
+
name: d,
|
17
18
|
children: ({
|
18
|
-
field:
|
19
|
-
meta:
|
20
|
-
}) => /* @__PURE__ */ e(
|
21
|
-
...
|
22
|
-
...
|
19
|
+
field: l,
|
20
|
+
meta: m
|
21
|
+
}) => /* @__PURE__ */ e(s, {
|
22
|
+
...c,
|
23
|
+
...l,
|
24
|
+
className: o,
|
23
25
|
disabled: a,
|
24
|
-
error:
|
26
|
+
error: m.error,
|
25
27
|
label: r,
|
26
|
-
placeholder:
|
28
|
+
placeholder: i.formatMessage(p.setValuePlaceholder)
|
27
29
|
})
|
28
30
|
})
|
29
31
|
});
|
30
32
|
};
|
31
|
-
|
33
|
+
u.displayName = "MetadataStringField";
|
32
34
|
export {
|
33
|
-
|
34
|
-
|
35
|
+
u as MetadataStringField,
|
36
|
+
u as default
|
35
37
|
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import "clsx";
|
2
|
+
import "formik";
|
3
|
+
import "lodash/isUndefined";
|
4
|
+
import "react";
|
5
|
+
import "./components/ai-suggestion-field/ai-suggestion-field.js";
|
6
|
+
import "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
7
|
+
import "./editor-field-types.js";
|
8
|
+
import { M as f } from "../../../../chunks/metadata-editor-field-wrapper.js";
|
9
|
+
import "react/jsx-runtime";
|
10
|
+
export {
|
11
|
+
f as MetadataEditorFieldWrapper
|
12
|
+
};
|