@box/metadata-editor 1.15.4 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/chunks/filter-dropdown-menu.module.js +9 -12
  2. package/dist/chunks/metadata-instance-form-card-wrapper.js +32 -32
  3. package/dist/chunks/taxonomy-ancestor-status-pill.js +37 -38
  4. package/dist/chunks/types.js +3 -3
  5. package/dist/chunks/utils2.js +28 -30
  6. package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +93 -96
  7. package/dist/esm/lib/components/combobox-with-api-pagination/request.js +2 -2
  8. package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +3 -4
  9. package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +21 -24
  10. package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +59 -61
  11. package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +39 -40
  12. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +37 -37
  13. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +9 -9
  14. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +35 -36
  15. package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +52 -52
  16. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +22 -23
  17. package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -2
  18. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +31 -32
  19. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +22 -22
  20. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +114 -114
  21. package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +96 -98
  22. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +29 -29
  23. package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +39 -40
  24. package/dist/esm/lib/constants.js +3 -3
  25. package/dist/i18n/en-x-pseudo.js +128 -128
  26. package/dist/i18n/en-x-pseudo.properties +128 -128
  27. package/dist/styles/autofill-overlay.css +1 -1
  28. package/dist/styles/filter-dropdown-menu.css +1 -1
  29. package/dist/styles/taxonomy-ancestor-status-pill.css +1 -1
  30. package/package.json +9 -9
@@ -1,6 +1,6 @@
1
- let C = /* @__PURE__ */ function(E) {
1
+ let C = /* @__PURE__ */ (function(E) {
2
2
  return E.NOT_STARTED = "NOT_STARTED", E.IN_PROGRESS = "IN_PROGRESS", E.ERROR = "ERROR", E.SUCCESS = "SUCCESS", E.CANCELLED = "CANCELLED", E;
3
- }({});
3
+ })({});
4
4
  export {
5
5
  C as RequestStates
6
6
  };
@@ -1,9 +1,9 @@
1
1
  import { useReducer as O } from "react";
2
2
  import { RequestStates as u } from "./request.js";
3
3
  import { isAbortError as I } from "./utils/is-abort-error.js";
4
- var s = /* @__PURE__ */ function(r) {
4
+ var s = /* @__PURE__ */ (function(r) {
5
5
  return r.LOAD_MORE = "LOAD_MORE", r.RELOAD = "RELOAD", r.SEARCH = "SEARCH", r.SET_ERROR = "SET_ERROR", r.SET_LOADING = "SET_LOADING", r;
6
- }(s || {});
6
+ })(s || {});
7
7
  function a(r, e) {
8
8
  switch (e.type) {
9
9
  case s.LOAD_MORE:
@@ -63,8 +63,7 @@ function m(r, e) {
63
63
  return E(r, e) || S(r, e);
64
64
  }
65
65
  function p(r, e) {
66
- var t;
67
- E(r, e) && e.abortController.abort(), S(r, e) && ((t = r.abortController) == null || t.abort());
66
+ E(r, e) && e.abortController.abort(), S(r, e) && r.abortController?.abort();
68
67
  }
69
68
  function h(r, e) {
70
69
  return S(r, e);
@@ -1,40 +1,37 @@
1
- import * as s from "react";
1
+ import * as o from "react";
2
2
  function a(e) {
3
- const n = s.useRef(e);
4
- return s.useEffect(() => {
5
- n.current = e;
6
- }), s.useMemo(() => (...o) => {
7
- var t;
8
- return (t = n.current) == null ? void 0 : t.call(n, ...o);
9
- }, []);
3
+ const c = o.useRef(e);
4
+ return o.useEffect(() => {
5
+ c.current = e;
6
+ }), o.useMemo(() => (...t) => c.current?.(...t), []);
10
7
  }
11
- function R({
8
+ function v({
12
9
  prop: e,
13
- defaultProp: n,
14
- onChange: o = () => {
10
+ defaultProp: c,
11
+ onChange: t = () => {
15
12
  }
16
13
  }) {
17
- const [t, c] = C({
18
- defaultProp: n,
19
- onChange: o
20
- }), r = e !== void 0, i = r ? e : t, l = a(o), d = s.useCallback((u) => {
14
+ const [n, s] = R({
15
+ defaultProp: c,
16
+ onChange: t
17
+ }), r = e !== void 0, i = r ? e : n, l = a(t), d = o.useCallback((u) => {
21
18
  if (r) {
22
19
  const f = typeof u == "function" ? u(e) : u;
23
20
  f !== e && l(f);
24
21
  } else
25
- c(u);
26
- }, [r, e, c, l]);
22
+ s(u);
23
+ }, [r, e, s, l]);
27
24
  return [i, d];
28
25
  }
29
- function C({
26
+ function R({
30
27
  defaultProp: e,
31
- onChange: n
28
+ onChange: c
32
29
  }) {
33
- const o = s.useState(e), [t] = o, c = s.useRef(t), r = a(n);
34
- return s.useEffect(() => {
35
- c.current !== t && (r(t), c.current = t);
36
- }, [t, c, r]), o;
30
+ const t = o.useState(e), [n] = t, s = o.useRef(n), r = a(c);
31
+ return o.useEffect(() => {
32
+ s.current !== n && (r(n), s.current = n);
33
+ }, [n, s, r]), t;
37
34
  }
38
35
  export {
39
- R as useControllableState
36
+ v as useControllableState
40
37
  };
@@ -1,87 +1,85 @@
1
- import { useState as C, useRef as y, useCallback as a } from "react";
2
- const k = "0px", p = [0];
3
- function w() {
4
- const o = /* @__PURE__ */ new Map();
5
- function b({
6
- root: c,
7
- rootMargin: s,
8
- threshold: u
1
+ import { useState as y, useRef as R, useCallback as f } from "react";
2
+ const k = "0px", g = [0];
3
+ function C() {
4
+ const b = /* @__PURE__ */ new Map();
5
+ function a({
6
+ root: s,
7
+ rootMargin: t,
8
+ threshold: c
9
9
  }) {
10
- let r = o.get(c);
11
- r || (r = /* @__PURE__ */ new Map(), o.set(c, r));
10
+ let r = b.get(s);
11
+ r || (r = /* @__PURE__ */ new Map(), b.set(s, r));
12
12
  const i = JSON.stringify({
13
- rootMargin: s,
14
- threshold: u
13
+ rootMargin: t,
14
+ threshold: c
15
15
  });
16
- let e = r.get(i);
17
- if (!e) {
18
- const n = /* @__PURE__ */ new Map();
19
- e = {
20
- observer: new IntersectionObserver((R) => {
21
- R.forEach((v) => {
22
- const t = n.get(v.target);
23
- t == null || t(v);
16
+ let n = r.get(i);
17
+ if (!n) {
18
+ const e = /* @__PURE__ */ new Map();
19
+ n = {
20
+ observer: new IntersectionObserver((O) => {
21
+ O.forEach((v) => {
22
+ e.get(v.target)?.(v);
24
23
  });
25
24
  }, {
26
- root: c,
27
- rootMargin: s,
28
- threshold: u
25
+ root: s,
26
+ rootMargin: t,
27
+ threshold: c
29
28
  }),
30
- entryCallbacks: n
31
- }, r.set(i, e);
29
+ entryCallbacks: e
30
+ }, r.set(i, n);
32
31
  }
33
32
  return {
34
- observe: (n, l) => {
35
- e == null || e.entryCallbacks.set(n, l), e == null || e.observer.observe(n);
33
+ observe: (e, l) => {
34
+ n?.entryCallbacks.set(e, l), n?.observer.observe(e);
36
35
  },
37
- unobserve: (n) => {
38
- e == null || e.entryCallbacks.delete(n), e == null || e.observer.unobserve(n);
36
+ unobserve: (e) => {
37
+ n?.entryCallbacks.delete(e), n?.observer.unobserve(e);
39
38
  }
40
39
  };
41
40
  }
42
41
  return {
43
- getObserver: b
42
+ getObserver: a
44
43
  };
45
44
  }
46
- const M = w();
47
- function T(o) {
48
- const b = (o == null ? void 0 : o.rootMargin) ?? k, c = (o == null ? void 0 : o.threshold) ?? p, s = y(null), u = y(null), r = y(null), [i, e] = C(), n = a(() => {
49
- const t = s.current;
50
- if (!t) {
51
- e(void 0);
45
+ const E = C();
46
+ function p(b) {
47
+ const a = b?.rootMargin ?? k, s = b?.threshold ?? g, t = R(null), c = R(null), r = R(null), [i, n] = y(), e = f(() => {
48
+ const o = t.current;
49
+ if (!o) {
50
+ n(void 0);
52
51
  return;
53
52
  }
54
- const f = M.getObserver({
55
- root: u.current,
56
- rootMargin: b,
57
- threshold: c
53
+ const u = E.getObserver({
54
+ root: c.current,
55
+ rootMargin: a,
56
+ threshold: s
58
57
  });
59
- f.observe(t, (E) => {
60
- e(E);
61
- }), r.current = f;
62
- }, [b, c]), l = a(() => {
63
- const t = r.current, f = s.current;
64
- f && (t == null || t.unobserve(f)), r.current = null;
65
- }, []), R = a((t) => {
66
- l(), s.current = t, n();
67
- }, [n, l]), v = a((t) => {
68
- l(), u.current = t, n();
69
- }, [n, l]);
70
- return [R, {
58
+ u.observe(o, (h) => {
59
+ n(h);
60
+ }), r.current = u;
61
+ }, [a, s]), l = f(() => {
62
+ const o = r.current, u = t.current;
63
+ u && o?.unobserve(u), r.current = null;
64
+ }, []), O = f((o) => {
65
+ l(), t.current = o, e();
66
+ }, [e, l]), v = f((o) => {
67
+ l(), c.current = o, e();
68
+ }, [e, l]);
69
+ return [O, {
71
70
  entry: i,
72
71
  rootRef: v
73
72
  }];
74
73
  }
75
- function V(o) {
76
- var i;
77
- const [b, c] = T(o), s = !!((i = c.entry) != null && i.isIntersecting), [u, r] = C(s);
78
- return s && !u && r(!0), [b, {
79
- ...c,
80
- isVisible: s,
81
- wasEverVisible: u
74
+ function w(b) {
75
+ const [a, s] = p(b), t = !!s.entry?.isIntersecting, [c, r] = y(t);
76
+ return t && !c && r(!0), [a, {
77
+ ...s,
78
+ isVisible: t,
79
+ wasEverVisible: c
82
80
  }];
83
81
  }
84
82
  export {
85
- w as createObserverCache,
86
- V as useTrackVisibility
83
+ C as createObserverCache,
84
+ w as useTrackVisibility
87
85
  };
@@ -1,14 +1,14 @@
1
- import { TriggerButton as v, Text as C, ScrollableContainer as N, Divider as j } from "@box/blueprint-web";
1
+ import { TriggerButton as v, Text as N, ScrollableContainer as C, Divider as j } from "@box/blueprint-web";
2
2
  import { useIntl as x } from "react-intl";
3
3
  import { SelectProvider as B, Select as b, SelectPopover as z, SelectItem as g, SelectItemCheck as I } from "@ariakit/react";
4
4
  import { Space1 as k } from "@box/blueprint-web-assets/tokens/px-tokens";
5
5
  import { useEffect as M } from "react";
6
6
  import S from "clsx";
7
7
  import { Checkmark as p } from "@box/blueprint-web-assets/icons/Fill";
8
- import { getVisibleTemplates as y, getTemplateDisplayName as _ } from "../../utils/utils.js";
8
+ import { getVisibleTemplates as y, getTemplateDisplayName as u } from "../../utils/utils.js";
9
9
  import s from "./messages.js";
10
- import { jsxs as o, jsx as e } from "react/jsx-runtime";
11
- import '../../../../styles/filter-instances-dropdown.css';const D = "_details_106jz_2", w = "_triggerContainer_106jz_6", F = "_triggerButton_106jz_11", O = "_popover_106jz_17", P = "_divider_106jz_34", L = "_scrollableContainer_106jz_37", V = "_item_106jz_41", E = "_indicator_106jz_68", G = "_indicatorIcon_106jz_77", R = "_testContainer_106jz_81", t = {
10
+ import { jsxs as o, jsx as t } from "react/jsx-runtime";
11
+ import '../../../../styles/filter-instances-dropdown.css';const D = "_details_106jz_2", w = "_triggerContainer_106jz_6", F = "_triggerButton_106jz_11", O = "_popover_106jz_17", P = "_divider_106jz_34", L = "_scrollableContainer_106jz_37", V = "_item_106jz_41", E = "_indicator_106jz_68", G = "_indicatorIcon_106jz_77", e = {
12
12
  details: D,
13
13
  triggerContainer: w,
14
14
  triggerButton: F,
@@ -17,78 +17,77 @@ import '../../../../styles/filter-instances-dropdown.css';const D = "_details_10
17
17
  scrollableContainer: L,
18
18
  item: V,
19
19
  indicator: E,
20
- indicatorIcon: G,
21
- testContainer: R
22
- }, q = parseInt(k, 10);
23
- function $({
24
- appliedTemplates: u,
25
- selectedTemplates: c,
26
- setSelectedTemplates: l
20
+ indicatorIcon: G
21
+ }, R = parseInt(k, 10);
22
+ function Z({
23
+ appliedTemplates: _,
24
+ selectedTemplates: l,
25
+ setSelectedTemplates: c
27
26
  }) {
28
- const a = x(), d = a.formatMessage(s.customMetadataName), n = y(u), i = c.length, m = n.length, h = i === 0 ? a.formatMessage(s.allTemplatesTriggerButtonText) : a.formatMessage(s.selectedTemplatesTriggerButtonText, {
27
+ const a = x(), d = a.formatMessage(s.customMetadataName), n = y(_), i = l.length, m = n.length, h = i === 0 ? a.formatMessage(s.allTemplatesTriggerButtonText) : a.formatMessage(s.selectedTemplatesTriggerButtonText, {
29
28
  selectedTemplatesNumber: i,
30
29
  visibleTemplatesNumber: m
31
30
  }), T = () => {
32
- l([]);
31
+ c([]);
33
32
  };
34
33
  return M(() => {
35
- i === m && l([]);
34
+ i === m && c([]);
36
35
  }, [i, m]), /* @__PURE__ */ o(B, {
37
- setValue: l,
38
- value: c,
36
+ setValue: c,
37
+ value: l,
39
38
  children: [/* @__PURE__ */ o("div", {
40
- className: t.triggerContainer,
41
- children: [/* @__PURE__ */ e(b, {
42
- render: /* @__PURE__ */ e(v, {
39
+ className: e.triggerContainer,
40
+ children: [/* @__PURE__ */ t(b, {
41
+ render: /* @__PURE__ */ t(v, {
43
42
  caretDirection: "down",
44
- className: t.triggerButton,
43
+ className: e.triggerButton,
45
44
  label: h,
46
45
  size: "small",
47
46
  variant: "tertiary",
48
47
  "data-target-id": "TriggerButton-allTemplatesTriggerButtonText|selectedTemplatesTriggerButtonText"
49
48
  })
50
- }), n.length > 0 && /* @__PURE__ */ e(C, {
49
+ }), n.length > 0 && /* @__PURE__ */ t(N, {
51
50
  as: "p",
52
- className: t.details,
51
+ className: e.details,
53
52
  color: "textOnLightSecondary",
54
53
  "data-testid": "detailsList",
55
54
  variant: "caption",
56
- children: n.filter((r) => c.some((f) => f === r.id)).map((r) => _(r, d)).join(", ")
55
+ children: n.filter((r) => l.some((f) => f === r.id)).map((r) => u(r, d)).join(", ")
57
56
  })]
58
- }), /* @__PURE__ */ e(z, {
59
- className: t.popover,
60
- gutter: q,
61
- children: /* @__PURE__ */ o(N, {
62
- className: t.scrollableContainer,
57
+ }), /* @__PURE__ */ t(z, {
58
+ className: e.popover,
59
+ gutter: R,
60
+ children: /* @__PURE__ */ o(C, {
61
+ className: e.scrollableContainer,
63
62
  children: [/* @__PURE__ */ o(g, {
64
63
  autoFocus: i === 0,
65
- className: t.item,
64
+ className: e.item,
66
65
  hideOnClick: !0,
67
66
  onClick: T,
68
- children: [i === 0 && /* @__PURE__ */ e(p, {
69
- className: S(t.indicator, t.indicatorIcon)
67
+ children: [i === 0 && /* @__PURE__ */ t(p, {
68
+ className: S(e.indicator, e.indicatorIcon)
70
69
  }), a.formatMessage(s.allTemplatesTriggerButtonText)]
71
- }), /* @__PURE__ */ e(j, {
72
- className: t.divider
70
+ }), /* @__PURE__ */ t(j, {
71
+ className: e.divider
73
72
  }), n.map((r) => /* @__PURE__ */ o(g, {
74
- className: t.item,
73
+ className: e.item,
75
74
  hideOnClick: !0,
76
75
  value: r.id,
77
- children: [/* @__PURE__ */ e(I, {
78
- className: t.indicator,
76
+ children: [/* @__PURE__ */ t(I, {
77
+ className: e.indicator,
79
78
  style: {
80
79
  width: "none",
81
80
  height: "none"
82
81
  },
83
- children: /* @__PURE__ */ e(p, {
84
- className: t.indicatorIcon
82
+ children: /* @__PURE__ */ t(p, {
83
+ className: e.indicatorIcon
85
84
  })
86
- }), _(r, d)]
85
+ }), u(r, d)]
87
86
  }, r.id))]
88
87
  })
89
88
  })]
90
89
  });
91
90
  }
92
91
  export {
93
- $ as FilterInstancesDropdown
92
+ Z as FilterInstancesDropdown
94
93
  };
@@ -1,56 +1,56 @@
1
1
  import { Select as l, SELECT_EMPTY_VALUE as o } from "@box/blueprint-web";
2
- import { useFormikContext as C, getIn as L, Field as P } from "formik";
3
- import { forwardRef as S } from "react";
4
- import { useIntl as $, FormattedMessage as b } from "react-intl";
5
- import m from "../../../../messages.js";
6
- import { g as j } from "../../../../../../chunks/utils2.js";
7
- import { jsx as t, jsxs as w } from "react/jsx-runtime";
8
- const U = /* @__PURE__ */ S(({
9
- className: c,
10
- isAiSuggestionApplied: u,
11
- description: p,
12
- disableForm: f,
13
- fieldNamePrefix: s,
14
- updateModePrefix: g,
15
- label: n,
16
- onValueEdited: h,
17
- options: v,
18
- portalElement: E
19
- }, F) => {
2
+ import { useFormikContext as C, getIn as L, Field as O } from "formik";
3
+ import { forwardRef as P } from "react";
4
+ import { useIntl as S, FormattedMessage as $ } from "react-intl";
5
+ import i from "../../../../messages.js";
6
+ import { g as b } from "../../../../../../chunks/utils2.js";
7
+ import { jsx as t, jsxs as j } from "react/jsx-runtime";
8
+ const U = /* @__PURE__ */ P(({
9
+ className: m,
10
+ isAiSuggestionApplied: c,
11
+ description: u,
12
+ disableForm: p,
13
+ fieldNamePrefix: r,
14
+ updateModePrefix: f,
15
+ label: s,
16
+ onValueEdited: g,
17
+ options: h,
18
+ portalElement: v
19
+ }, E) => {
20
20
  const {
21
- setFieldValue: M,
22
- values: x
23
- } = C(), V = $(), d = `${g ?? s}.value`, r = v || L(x, `${s}.options`, []).map(({
21
+ setFieldValue: F,
22
+ values: M
23
+ } = C(), x = S(), n = `${f ?? r}.value`, V = h || L(M, `${r}.options`, []).map(({
24
24
  key: a
25
- }) => a), i = V.formatMessage(m.selectValuePlaceholder);
25
+ }) => a), d = x.formatMessage(i.selectValuePlaceholder);
26
26
  return /* @__PURE__ */ t("div", {
27
- "data-testid": `${n}-field`,
28
- children: /* @__PURE__ */ t(P, {
29
- name: d,
27
+ "data-testid": `${s}-field`,
28
+ children: /* @__PURE__ */ t(O, {
29
+ name: n,
30
30
  children: ({
31
31
  field: a
32
32
  }) => /* @__PURE__ */ t(l, {
33
- ref: F,
34
- className: c,
33
+ ref: E,
34
+ className: m,
35
35
  "data-target-id": "Select-MetadataEditorEnumField",
36
- disabled: f,
37
- label: j(n, p, u),
36
+ disabled: p,
37
+ label: b(s, u, c),
38
38
  onValueChange: (e) => {
39
- M(d, e === o ? "" : e), h();
39
+ F(n, e === o ? "" : e), g();
40
40
  },
41
- placeholder: i,
41
+ placeholder: d,
42
42
  ...a,
43
43
  value: a.value === o ? "" : a.value,
44
- children: /* @__PURE__ */ w(l.Content, {
45
- container: E,
44
+ children: /* @__PURE__ */ j(l.Content, {
45
+ container: v,
46
46
  onEscapeKeyDown: (e) => e.stopPropagation(),
47
47
  children: [/* @__PURE__ */ t(l.Option, {
48
- text: i,
48
+ text: d,
49
49
  value: o,
50
- children: /* @__PURE__ */ t(b, {
51
- ...m.selectValuePlaceholder
50
+ children: /* @__PURE__ */ t($, {
51
+ ...i.selectValuePlaceholder
52
52
  })
53
- }), r == null ? void 0 : r.map((e) => /* @__PURE__ */ t(l.Option, {
53
+ }), V?.map((e) => /* @__PURE__ */ t(l.Option, {
54
54
  text: e,
55
55
  value: e,
56
56
  children: e
@@ -1,15 +1,15 @@
1
- import { useIntl as o } from "react-intl";
2
- import n from "../../../../messages.js";
3
- const s = (t) => t != null && t.length ? /^[-+]?\d+(\.\d+)?$/.test(t) : !0, l = () => {
4
- const t = o();
1
+ import { useIntl as r } from "react-intl";
2
+ import o from "../../../../messages.js";
3
+ const a = (t) => t?.length ? /^[-+]?\d+(\.\d+)?$/.test(t) : !0, i = () => {
4
+ const t = r();
5
5
  return {
6
- validateFloats: (r) => {
7
- if (!s(r))
8
- return t.formatMessage(n.floatFieldInvalidValue);
6
+ validateFloats: (e) => {
7
+ if (!a(e))
8
+ return t.formatMessage(o.floatFieldInvalidValue);
9
9
  }
10
10
  };
11
11
  };
12
12
  export {
13
- s as isFloatOrBlank,
14
- l as useFloatValidation
13
+ a as isFloatOrBlank,
14
+ i as useFloatValidation
15
15
  };
@@ -1,53 +1,52 @@
1
- import { Combobox as x } from "@box/blueprint-web";
2
- import { useFormikContext as V, getIn as w, Field as $ } from "formik";
3
- import { forwardRef as I } from "react";
4
- import { useIntl as S } from "react-intl";
5
- import j from "../../../../messages.js";
6
- import { g as k } from "../../../../../../chunks/utils2.js";
1
+ import { Combobox as M } from "@box/blueprint-web";
2
+ import { useFormikContext as x, getIn as V, Field as w } from "formik";
3
+ import { forwardRef as $ } from "react";
4
+ import { useIntl as I } from "react-intl";
5
+ import S from "../../../../messages.js";
6
+ import { g as j } from "../../../../../../chunks/utils2.js";
7
7
  import { jsx as t } from "react/jsx-runtime";
8
- const B = /* @__PURE__ */ I(({
9
- className: n,
10
- isAiSuggestionApplied: s,
11
- description: m,
12
- disableForm: d,
8
+ const A = /* @__PURE__ */ $(({
9
+ className: i,
10
+ isAiSuggestionApplied: n,
11
+ description: s,
12
+ disableForm: m,
13
13
  fieldNamePrefix: o,
14
14
  label: a,
15
- onValueEdited: u,
16
- options: c,
17
- portalElement: f,
18
- updateModePrefix: p
19
- }, g) => {
15
+ onValueEdited: d,
16
+ options: u,
17
+ portalElement: c,
18
+ updateModePrefix: f
19
+ }, p) => {
20
20
  const {
21
- setFieldValue: h,
22
- values: F
23
- } = V(), b = S(), l = `${p ?? o}.value`, v = c || w(F, `${o}.options`, []).map(({
21
+ setFieldValue: g,
22
+ values: h
23
+ } = x(), F = I(), l = `${f ?? o}.value`, b = u || V(h, `${o}.options`, []).map(({
24
24
  key: e
25
- }) => e), C = (e, r) => r.toLowerCase().includes(e.toLowerCase());
25
+ }) => e), v = (e, r) => r.toLowerCase().includes(e.toLowerCase());
26
26
  return /* @__PURE__ */ t("div", {
27
27
  "data-testid": `${a}-field`,
28
- children: /* @__PURE__ */ t($, {
28
+ children: /* @__PURE__ */ t(w, {
29
29
  name: l,
30
30
  children: ({
31
31
  field: e
32
32
  }) => {
33
- var i;
34
- const L = (((i = e.value) == null ? void 0 : i.length) || 0) === 0 ? b.formatMessage(j.multiselectPlaceholder) : "";
35
- return /* @__PURE__ */ t(x, {
36
- ref: g,
33
+ const C = (e.value?.length || 0) === 0 ? F.formatMessage(S.multiselectPlaceholder) : "";
34
+ return /* @__PURE__ */ t(M, {
35
+ ref: p,
37
36
  as: "input",
38
- className: n,
37
+ className: i,
39
38
  "data-target-id": "Combobox-MetadataEditorMultiSelectField",
40
- disabled: d,
41
- filterFn: C,
42
- label: k(a, m, s),
39
+ disabled: m,
40
+ filterFn: v,
41
+ label: j(a, s, n),
43
42
  multiselect: !0,
44
43
  name: e.name,
45
- onValueChange: (M) => {
46
- h(l, M), u();
44
+ onValueChange: (L) => {
45
+ g(l, L), d();
47
46
  },
48
- options: v,
49
- placeholder: L,
50
- portalElement: f,
47
+ options: b,
48
+ placeholder: C,
49
+ portalElement: c,
51
50
  value: e.value
52
51
  });
53
52
  }
@@ -55,6 +54,6 @@ const B = /* @__PURE__ */ I(({
55
54
  });
56
55
  });
57
56
  export {
58
- B as MetadataMultiSelectField,
59
- B as default
57
+ A as MetadataMultiSelectField,
58
+ A as default
60
59
  };