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