@box/metadata-editor 0.78.8 → 0.79.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 (66) hide show
  1. package/chunks/utils.js +40 -41
  2. package/chunks/utils2.js +43 -0
  3. package/esm/index.js +34 -30
  4. package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +81 -60
  5. package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.js +8 -0
  6. package/esm/lib/components/metadata-editor-fields/components/metadata-date-field/metadata-date-field.js +1 -1
  7. package/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +1 -1
  8. package/esm/lib/components/metadata-editor-fields/components/metadata-float-field/metadata-float-field.js +1 -1
  9. package/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +1 -1
  10. package/esm/lib/components/metadata-editor-fields/components/metadata-string-field/metadata-string-field.js +1 -1
  11. package/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +1 -1
  12. package/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +51 -50
  13. package/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -1
  14. package/esm/lib/components/metadata-editor-fields/utils.js +1 -1
  15. package/esm/lib/components/metadata-instance-editor/index.js +12 -8
  16. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.js +40 -0
  17. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +85 -86
  18. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/utils.js +6 -39
  19. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.js +18 -0
  20. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +68 -0
  21. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.js +0 -12
  22. package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +26 -61
  23. package/i18n/bn-IN.js +2 -0
  24. package/i18n/da-DK.js +2 -0
  25. package/i18n/de-DE.js +2 -0
  26. package/i18n/en-AU.js +2 -0
  27. package/i18n/en-CA.js +2 -0
  28. package/i18n/en-GB.js +2 -0
  29. package/i18n/en-US.js +2 -0
  30. package/i18n/en-US.properties +4 -0
  31. package/i18n/en-x-pseudo.js +2 -0
  32. package/i18n/es-419.js +2 -0
  33. package/i18n/es-ES.js +2 -0
  34. package/i18n/fi-FI.js +2 -0
  35. package/i18n/fr-CA.js +2 -0
  36. package/i18n/fr-FR.js +2 -0
  37. package/i18n/hi-IN.js +2 -0
  38. package/i18n/it-IT.js +2 -0
  39. package/i18n/ja-JP.js +2 -0
  40. package/i18n/json/src/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.json +1 -1
  41. package/i18n/json/src/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.json +1 -0
  42. package/i18n/json/src/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.json +1 -1
  43. package/i18n/ko-KR.js +2 -0
  44. package/i18n/nb-NO.js +2 -0
  45. package/i18n/nl-NL.js +2 -0
  46. package/i18n/pl-PL.js +2 -0
  47. package/i18n/pt-BR.js +2 -0
  48. package/i18n/ru-RU.js +2 -0
  49. package/i18n/sv-SE.js +2 -0
  50. package/i18n/tr-TR.js +2 -0
  51. package/i18n/zh-CN.js +2 -0
  52. package/i18n/zh-TW.js +2 -0
  53. package/package.json +3 -3
  54. package/styles/metadata-instance-form-autofill-button.css +1 -0
  55. package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.d.ts +1 -1
  56. package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/messages.d.ts +10 -0
  57. package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/types.d.ts +1 -0
  58. package/types/lib/components/metadata-instance-editor/index.d.ts +3 -1
  59. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form-card-wrapper.d.ts +2 -0
  60. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +20 -3
  61. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/messages.d.ts +18 -0
  62. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.d.ts +2 -0
  63. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/types.d.ts +7 -0
  64. package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/messages.d.ts +0 -15
  65. package/types/lib/types.d.ts +0 -1
  66. package/types/lib/utils/autofill-context.d.ts +1 -1
package/chunks/utils.js CHANGED
@@ -1,43 +1,42 @@
1
- import "../styles/utils.css";
2
- import { BoxAiLogo as s } from "@box/blueprint-web-assets/icons/Logo";
3
- import g from "../esm/lib/components/interactive-text/interactive-text.js";
4
- import { convertISOStringToUTCDate as i } from "../esm/lib/utils/convertDate.js";
5
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
6
- const _ = "_noAttributesText_1ggnw_1", p = "_fieldWrapper_1ggnw_5", b = "_hasSuggestion_1ggnw_10", x = "_error_1ggnw_18", d = "_dateField_1ggnw_30", m = "_suggestionApplied_1ggnw_34", u = "_comboboxContainer_1ggnw_34", T = "_labelWrapper_1ggnw_48", w = "_labelText_1ggnw_54", S = "_labelIcon_1ggnw_57", t = {
7
- noAttributesText: _,
8
- fieldWrapper: p,
9
- hasSuggestion: b,
10
- error: x,
11
- dateField: d,
12
- suggestionApplied: m,
13
- comboboxContainer: u,
14
- labelWrapper: T,
15
- labelText: w,
16
- labelIcon: S
17
- }, C = (e, n, l = !1, a = "label") => (r) => /* @__PURE__ */ c("div", {
18
- className: t.labelWrapper,
19
- children: [n ? /* @__PURE__ */ o(g, {
20
- as: a,
21
- className: t.labelText,
22
- tooltipText: n,
23
- ...r,
24
- children: e
25
- }) : /* @__PURE__ */ o("label", {
26
- className: t.labelText,
27
- ...r,
28
- children: e
29
- }), l && /* @__PURE__ */ o(s, {
30
- className: t.labelIcon
31
- })]
32
- }), F = (e) => {
33
- try {
34
- return i(e).toISOString();
35
- } catch {
36
- return null;
37
- }
38
- };
1
+ import h from "lodash/isEmpty";
2
+ import O from "lodash/isArray";
3
+ import { TEMPLATE_CUSTOM_PROPERTIES as f } from "../esm/lib/constants.js";
4
+ const n = {
5
+ ADD: "add",
6
+ REMOVE: "remove",
7
+ REPLACE: "replace",
8
+ TEST: "test"
9
+ }, p = (e) => e.value === void 0 || e.value === null || e.value === "" || O(e.value) && h(e.value), S = (e, a) => {
10
+ const o = [], c = e.metadata.fields, r = a.templateKey === f, E = new Map(a.fields.map((t) => [t.key, t])), m = new Map(c.map((t) => [t.key, t]));
11
+ return c.forEach((t) => {
12
+ const s = E.get(t.key);
13
+ s ? JSON.stringify(t) === JSON.stringify(s) || (!r && p(s) && !p(t) ? o.push(v(t.key, u(t))) : (
14
+ // template instance
15
+ (!r && t.value !== s.value && s.value !== null && !p(t) || // custom instance
16
+ r && t.value !== s.value) && (o.push(y(s.key, u(s))), o.push(M(t.key, u(t))))
17
+ )) : o.push(v(t.key, t.value));
18
+ }), a.fields.forEach((t) => {
19
+ const s = m.get(t.key);
20
+ (!s || !r && p(s) && !p(t)) && (o.push(y(t.key, u(t))), o.push(k(t.key)));
21
+ }), o;
22
+ }, u = (e) => e.type === "float" ? Number(e.value) : e.type === "taxonomy" ? e.value.map((a) => a.value) : e.value, y = (e, a) => ({
23
+ op: n.TEST,
24
+ path: `/${e}`,
25
+ value: a
26
+ }), v = (e, a) => ({
27
+ op: n.ADD,
28
+ path: `/${e}`,
29
+ value: a
30
+ }), k = (e) => ({
31
+ op: n.REMOVE,
32
+ path: `/${e}`
33
+ }), M = (e, a) => ({
34
+ op: n.REPLACE,
35
+ path: `/${e}`,
36
+ value: a
37
+ });
39
38
  export {
40
- C as g,
41
- t as s,
42
- F as t
39
+ n as J,
40
+ S as c,
41
+ u as g
43
42
  };
@@ -0,0 +1,43 @@
1
+ import "../styles/utils.css";
2
+ import { BoxAiLogo as s } from "@box/blueprint-web-assets/icons/Logo";
3
+ import g from "../esm/lib/components/interactive-text/interactive-text.js";
4
+ import { convertISOStringToUTCDate as i } from "../esm/lib/utils/convertDate.js";
5
+ import { jsxs as c, jsx as o } from "react/jsx-runtime";
6
+ const _ = "_noAttributesText_1ggnw_1", p = "_fieldWrapper_1ggnw_5", b = "_hasSuggestion_1ggnw_10", x = "_error_1ggnw_18", d = "_dateField_1ggnw_30", m = "_suggestionApplied_1ggnw_34", u = "_comboboxContainer_1ggnw_34", T = "_labelWrapper_1ggnw_48", w = "_labelText_1ggnw_54", S = "_labelIcon_1ggnw_57", t = {
7
+ noAttributesText: _,
8
+ fieldWrapper: p,
9
+ hasSuggestion: b,
10
+ error: x,
11
+ dateField: d,
12
+ suggestionApplied: m,
13
+ comboboxContainer: u,
14
+ labelWrapper: T,
15
+ labelText: w,
16
+ labelIcon: S
17
+ }, C = (e, n, l = !1, a = "label") => (r) => /* @__PURE__ */ c("div", {
18
+ className: t.labelWrapper,
19
+ children: [n ? /* @__PURE__ */ o(g, {
20
+ as: a,
21
+ className: t.labelText,
22
+ tooltipText: n,
23
+ ...r,
24
+ children: e
25
+ }) : /* @__PURE__ */ o("label", {
26
+ className: t.labelText,
27
+ ...r,
28
+ children: e
29
+ }), l && /* @__PURE__ */ o(s, {
30
+ className: t.labelIcon
31
+ })]
32
+ }), F = (e) => {
33
+ try {
34
+ return i(e).toISOString();
35
+ } catch {
36
+ return null;
37
+ }
38
+ };
39
+ export {
40
+ C as g,
41
+ t as s,
42
+ F as t
43
+ };
package/esm/index.js CHANGED
@@ -1,39 +1,43 @@
1
- import { AddMetadataTemplateDropdown as o } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
1
+ import { AddMetadataTemplateDropdown as e } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
2
2
  import { ComboboxWithApiPagination as r } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
3
- import { FilterDropdownMenu as d } from "./lib/components/filter-dropdown-menu/index.js";
4
- import { FilterInstancesDropdown as m } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
3
+ import { FilterDropdownMenu as n } from "./lib/components/filter-dropdown-menu/index.js";
4
+ import { FilterInstancesDropdown as d } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
5
5
  import { MetadataEmptyState as x } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
6
- import { DeleteConfirmationModal as l } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
7
- import { MetadataInstanceFormHeader as M } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
8
- import { CustomInstanceNewField as I } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
9
- import { MetadataInstanceForm as A } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
10
- import { MetadataInstanceList as w } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
11
- import { MetadataInstanceHeader as D } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
12
- import { UnsavedChangesModal as U } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
13
- import { defaultInitialValues as g, defaultMetadataValueMap as v } from "./lib/defaults.js";
14
- import { MetadataEditor as H } from "./lib/metadata-editor.js";
6
+ import { CustomInstanceNewField as l } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
7
+ import { DeleteConfirmationModal as M } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
8
+ import { MetadataInstanceFormAutofillButton as c } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
9
+ import { MetadataInstanceFormHeader as A } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
10
+ import { MetadataInstanceForm as F } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
11
+ import { J as h } from "../chunks/utils.js";
12
+ import { MetadataInstanceList as P } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
13
+ import { MetadataInstanceHeader as b } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
14
+ import { UnsavedChangesModal as v } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
15
+ import { defaultInitialValues as H, defaultMetadataValueMap as J } from "./lib/defaults.js";
16
+ import { MetadataEditor as O } from "./lib/metadata-editor.js";
15
17
  import { U as V } from "../chunks/types.js";
16
- import { AutofillContext as y, AutofillContextProvider as L, useAutofill as N } from "./lib/utils/autofill-context.js";
17
- import { withApiWrapper as T } from "./lib/utils/api-wrapper.js";
18
+ import { AutofillContext as y, AutofillContextProvider as B, useAutofill as L } from "./lib/utils/autofill-context.js";
19
+ import { withApiWrapper as j } from "./lib/utils/api-wrapper.js";
18
20
  export {
19
- o as AddMetadataTemplateDropdown,
21
+ e as AddMetadataTemplateDropdown,
20
22
  y as AutofillContext,
21
- L as AutofillContextProvider,
23
+ B as AutofillContextProvider,
22
24
  r as ComboboxWithApiPagination,
23
- I as CustomInstanceNewField,
24
- l as DeleteConfirmationModal,
25
- d as FilterDropdownMenu,
26
- m as FilterInstancesDropdown,
27
- H as MetadataEditor,
25
+ l as CustomInstanceNewField,
26
+ M as DeleteConfirmationModal,
27
+ n as FilterDropdownMenu,
28
+ d as FilterInstancesDropdown,
29
+ h as JSONPatchOp,
30
+ O as MetadataEditor,
28
31
  x as MetadataEmptyState,
29
- A as MetadataInstanceForm,
30
- M as MetadataInstanceFormHeader,
31
- D as MetadataInstanceHeader,
32
- w as MetadataInstanceList,
33
- U as UnsavedChangesModal,
32
+ F as MetadataInstanceForm,
33
+ c as MetadataInstanceFormAutofillButton,
34
+ A as MetadataInstanceFormHeader,
35
+ b as MetadataInstanceHeader,
36
+ P as MetadataInstanceList,
37
+ v as UnsavedChangesModal,
34
38
  V as UpdateMode,
35
- g as defaultInitialValues,
36
- v as defaultMetadataValueMap,
37
- N as useAutofill,
38
- T as withApiWrapper
39
+ H as defaultInitialValues,
40
+ J as defaultMetadataValueMap,
41
+ L as useAutofill,
42
+ j as withApiWrapper
39
43
  };
@@ -1,81 +1,102 @@
1
1
  import "../../../../../../styles/ai-suggestion-field.css";
2
- import { Text as g, IconButton as d, DropdownMenu as t } from "@box/blueprint-web";
3
- import { Checkmark as u, Ellipsis as S } from "@box/blueprint-web-assets/icons/Fill";
4
- import { useIntl as h, FormattedMessage as n } from "react-intl";
5
- import r from "./messages.js";
6
- import { formatSuggestionValue as w } from "./utils.js";
7
- import { jsx as e, jsxs as a } from "react/jsx-runtime";
8
- const _ = "_wrapperGradient_t2yak_1", I = "_wrapper_t2yak_1", f = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", o = {
9
- wrapperGradient: _,
2
+ import { Text as l, IconButton as c, DropdownMenu as a } from "@box/blueprint-web";
3
+ import { Checkmark as m, Ellipsis as f } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { useIntl as w, FormattedMessage as r } from "react-intl";
5
+ import t from "./messages.js";
6
+ import { formatSuggestionValue as _ } from "./utils.js";
7
+ import { jsx as e, jsxs as i, Fragment as u } from "react/jsx-runtime";
8
+ const C = "_wrapperGradient_t2yak_1", I = "_wrapper_t2yak_1", b = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", n = {
9
+ wrapperGradient: C,
10
10
  wrapper: I,
11
- buttons: f,
11
+ buttons: b,
12
12
  selectTrigger: k
13
13
  };
14
14
  function D({
15
- aiSuggestion: p,
16
- onAiSuggestionAppend: l,
17
- onAiSuggestionReplace: c,
18
- onAiSuggestionIgnore: m,
19
- type: i
15
+ aiSuggestion: S,
16
+ onAiSuggestionAppend: g,
17
+ onAiSuggestionReplace: d,
18
+ onAiSuggestionIgnore: p,
19
+ type: o,
20
+ isSameValue: h
20
21
  }) {
21
- const s = h();
22
+ const s = w();
22
23
  return /* @__PURE__ */ e("div", {
23
- className: o.wrapperGradient,
24
- children: /* @__PURE__ */ a("div", {
25
- className: o.wrapper,
26
- children: [/* @__PURE__ */ a("div", {
27
- children: [/* @__PURE__ */ e(g, {
24
+ className: n.wrapperGradient,
25
+ children: /* @__PURE__ */ e("div", {
26
+ className: n.wrapper,
27
+ children: h ? /* @__PURE__ */ i(u, {
28
+ children: [/* @__PURE__ */ e(l, {
28
29
  as: "p",
29
30
  color: "textOnLightSecondary",
30
31
  variant: "caption",
31
- children: /* @__PURE__ */ e(n, {
32
- ...r.aiSuggestionCaption
32
+ children: /* @__PURE__ */ e(r, {
33
+ ...t.sameValueAiSuggestionCaption
33
34
  })
34
- }), /* @__PURE__ */ e(g, {
35
- as: "p",
36
- children: w(p, {
37
- type: i,
38
- locale: s.locale
35
+ }), /* @__PURE__ */ e("div", {
36
+ className: n.buttons,
37
+ children: /* @__PURE__ */ e(c, {
38
+ "aria-label": s.formatMessage(t.aiSuggestionConfirm),
39
+ icon: m,
40
+ onClick: p,
41
+ size: "x-small",
42
+ "data-target-id": "IconButton-aiSuggestionConfirm"
39
43
  })
40
44
  })]
41
- }), /* @__PURE__ */ a("div", {
42
- className: o.buttons,
43
- children: [/* @__PURE__ */ e(d, {
44
- "aria-label": s.formatMessage(i === "multiSelect" ? r.aiSuggestionAppend : r.aiSuggestionClearAndReplace),
45
- icon: u,
46
- onClick: i === "multiSelect" ? l : c,
47
- size: "x-small"
48
- }), /* @__PURE__ */ a(t.Root, {
49
- children: [/* @__PURE__ */ e(t.Trigger, {
50
- className: o.selectTrigger,
51
- children: /* @__PURE__ */ e(d, {
52
- "aria-label": s.formatMessage(r.aiSuggestionOptions),
53
- icon: S,
54
- "data-target-id": "IconButton-aiSuggestionOptions"
45
+ }) : /* @__PURE__ */ i(u, {
46
+ children: [/* @__PURE__ */ i("div", {
47
+ children: [/* @__PURE__ */ e(l, {
48
+ as: "p",
49
+ color: "textOnLightSecondary",
50
+ variant: "caption",
51
+ children: /* @__PURE__ */ e(r, {
52
+ ...t.aiSuggestionCaption
55
53
  })
56
- }), /* @__PURE__ */ a(t.Content, {
57
- children: [i === "multiSelect" && /* @__PURE__ */ e(t.Item, {
58
- onSelect: l,
59
- "data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
60
- children: /* @__PURE__ */ e(n, {
61
- ...r.aiSuggestionAppend
62
- })
63
- }), /* @__PURE__ */ e(t.Item, {
64
- onSelect: c,
65
- "data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
66
- children: /* @__PURE__ */ e(n, {
67
- ...r.aiSuggestionClearAndReplace
68
- })
69
- }), /* @__PURE__ */ e(t.Separator, {}), /* @__PURE__ */ e(t.Item, {
70
- onSelect: m,
71
- "data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
72
- children: /* @__PURE__ */ e(n, {
73
- ...r.aiSuggestionIgnore
54
+ }), /* @__PURE__ */ e(l, {
55
+ as: "p",
56
+ children: _(S, {
57
+ type: o,
58
+ locale: s.locale
59
+ })
60
+ })]
61
+ }), /* @__PURE__ */ i("div", {
62
+ className: n.buttons,
63
+ children: [/* @__PURE__ */ e(c, {
64
+ "aria-label": s.formatMessage(o === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
65
+ icon: m,
66
+ onClick: o === "multiSelect" ? g : d,
67
+ size: "x-small"
68
+ }), /* @__PURE__ */ i(a.Root, {
69
+ children: [/* @__PURE__ */ e(a.Trigger, {
70
+ className: n.selectTrigger,
71
+ children: /* @__PURE__ */ e(c, {
72
+ "aria-label": s.formatMessage(t.aiSuggestionOptions),
73
+ icon: f,
74
+ "data-target-id": "IconButton-aiSuggestionOptions"
74
75
  })
76
+ }), /* @__PURE__ */ i(a.Content, {
77
+ children: [o === "multiSelect" && /* @__PURE__ */ e(a.Item, {
78
+ onSelect: g,
79
+ "data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
80
+ children: /* @__PURE__ */ e(r, {
81
+ ...t.aiSuggestionAppend
82
+ })
83
+ }), /* @__PURE__ */ e(a.Item, {
84
+ onSelect: d,
85
+ "data-target-id": "DropdownMenu.Item-aiSuggestionClearAndReplace",
86
+ children: /* @__PURE__ */ e(r, {
87
+ ...t.aiSuggestionClearAndReplace
88
+ })
89
+ }), /* @__PURE__ */ e(a.Separator, {}), /* @__PURE__ */ e(a.Item, {
90
+ onSelect: p,
91
+ "data-target-id": "DropdownMenu.Item-aiSuggestionIgnore",
92
+ children: /* @__PURE__ */ e(r, {
93
+ ...t.aiSuggestionIgnore
94
+ })
95
+ })]
75
96
  })]
76
97
  })]
77
98
  })]
78
- })]
99
+ })
79
100
  })
80
101
  });
81
102
  }
@@ -4,6 +4,10 @@ const i = e({
4
4
  id: "metadataEditor.aiSuggestionField.aiSuggestionCaption",
5
5
  defaultMessage: "Box AI suggestion:"
6
6
  },
7
+ sameValueAiSuggestionCaption: {
8
+ id: "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption",
9
+ defaultMessage: "Box AI suggests the same value as above"
10
+ },
7
11
  aiSuggestionOptions: {
8
12
  id: "metadataEditor.aiSuggestionField.aiSuggestionOptions",
9
13
  defaultMessage: "Options"
@@ -19,6 +23,10 @@ const i = e({
19
23
  aiSuggestionIgnore: {
20
24
  id: "metadataEditor.aiSuggestionField.ignoreLabel",
21
25
  defaultMessage: "Ignore"
26
+ },
27
+ aiSuggestionConfirm: {
28
+ id: "metadataEditor.aiSuggestionField.dismissLabel",
29
+ defaultMessage: "Confirm"
22
30
  }
23
31
  });
24
32
  export {
@@ -4,7 +4,7 @@ import { forwardRef as w, useMemo as S } from "react";
4
4
  import { useIntl as V } from "react-intl";
5
5
  import { convertIsoStringToCalendarDate as N, convertCalendarDateToISOString as O } from "../../../../utils/convertDate.js";
6
6
  import a from "../../../../messages.js";
7
- import { g as B } from "../../../../../../chunks/utils.js";
7
+ import { g as B } from "../../../../../../chunks/utils2.js";
8
8
  import { jsx as t } from "react/jsx-runtime";
9
9
  const H = /* @__PURE__ */ w(({
10
10
  className: i,
@@ -3,7 +3,7 @@ import { useFormikContext as C, getIn as L, Field as P } from "formik";
3
3
  import { forwardRef as $ } from "react";
4
4
  import { useIntl as b, FormattedMessage as j } from "react-intl";
5
5
  import d from "../../../../messages.js";
6
- import { g as w } from "../../../../../../chunks/utils.js";
6
+ import { g as w } from "../../../../../../chunks/utils2.js";
7
7
  import { jsx as t, jsxs as I } from "react/jsx-runtime";
8
8
  const U = /* @__PURE__ */ $(({
9
9
  className: i,
@@ -1,7 +1,7 @@
1
1
  import { TextInput as T } from "@box/blueprint-web";
2
2
  import { useFormikContext as V, getIn as $, Field as b } from "formik";
3
3
  import { forwardRef as B, useRef as I } from "react";
4
- import { g as M } from "../../../../../../chunks/utils.js";
4
+ import { g as M } from "../../../../../../chunks/utils2.js";
5
5
  import { fieldDefaultProps as O } from "../constants.js";
6
6
  import { useFloatValidation as j } from "./use-float-validation.js";
7
7
  import { jsx as r } from "react/jsx-runtime";
@@ -3,7 +3,7 @@ import { useFormikContext as x, getIn as M, Field as $ } from "formik";
3
3
  import { forwardRef as I } from "react";
4
4
  import { useIntl as j } from "react-intl";
5
5
  import k from "../../../../messages.js";
6
- import { g as D } from "../../../../../../chunks/utils.js";
6
+ import { g as D } from "../../../../../../chunks/utils2.js";
7
7
  import { fieldDefaultProps as O } from "../constants.js";
8
8
  import { jsx as t } from "react/jsx-runtime";
9
9
  const E = /* @__PURE__ */ I(({
@@ -3,7 +3,7 @@ import { Field as g } from "formik";
3
3
  import { forwardRef as h } from "react";
4
4
  import { useIntl as F } from "react-intl";
5
5
  import x from "../../../../messages.js";
6
- import { g as M } from "../../../../../../chunks/utils.js";
6
+ import { g as M } from "../../../../../../chunks/utils2.js";
7
7
  import { fieldDefaultProps as b } from "../constants.js";
8
8
  import { jsx as e } from "react/jsx-runtime";
9
9
  const v = /* @__PURE__ */ h(({
@@ -3,7 +3,7 @@ import { forwardRef as $ } from "react";
3
3
  import { useIntl as j } from "react-intl";
4
4
  import w from "../../../../messages.js";
5
5
  import { ComboboxWithApiPagination as A } from "../../../combobox-with-api-pagination/combobox-with-api-pagination.js";
6
- import { g as K } from "../../../../../../chunks/utils.js";
6
+ import { g as K } from "../../../../../../chunks/utils2.js";
7
7
  import { jsx as e } from "react/jsx-runtime";
8
8
  const E = /* @__PURE__ */ $(({
9
9
  description: l,
@@ -1,79 +1,80 @@
1
1
  import I from "clsx";
2
- import { useFormikContext as V } from "formik";
3
- import v from "lodash/isUndefined";
4
- import { forwardRef as C, useState as F, useCallback as P, useEffect as R } from "react";
5
- import { AiSuggestionField as T } from "./components/ai-suggestion-field/ai-suggestion-field.js";
6
- import { UpdateModeFieldWrapper as U } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
- import { editorFieldTypes as b } from "./editor-field-types.js";
8
- import { s as n } from "../../../../chunks/utils.js";
9
- import { jsx as a, jsxs as j } from "react/jsx-runtime";
10
- const L = /* @__PURE__ */ C(({
11
- disableForm: d,
12
- portalElement: u,
2
+ import { useFormikContext as v } from "formik";
3
+ import C from "lodash/isUndefined";
4
+ import { forwardRef as P, useState as N, useCallback as R, useEffect as T, useMemo as U } from "react";
5
+ import { AiSuggestionField as b } from "./components/ai-suggestion-field/ai-suggestion-field.js";
6
+ import { UpdateModeFieldWrapper as j } from "./components/update-mode-field-wrapper/update-mode-field-wrapper.js";
7
+ import { editorFieldTypes as $ } from "./editor-field-types.js";
8
+ import { s as n } from "../../../../chunks/utils2.js";
9
+ import { jsx as a, jsxs as B } from "react/jsx-runtime";
10
+ const X = /* @__PURE__ */ P(({
11
+ disableForm: g,
12
+ portalElement: c,
13
13
  field: e,
14
- index: M,
15
- taxonomyOptionsFetcher: g
16
- }, c) => {
17
- var x;
14
+ index: V,
15
+ taxonomyOptionsFetcher: m
16
+ }, f) => {
17
+ var M;
18
18
  const {
19
- setFieldValue: m
20
- } = V(), [N, f] = F(!0), [p, S] = F(!1), r = b[e.type], {
19
+ setFieldValue: S
20
+ } = v(), [A, p] = N(!0), [r, y] = N(!1), l = $[e.type], {
21
21
  aiSuggestion: t,
22
- type: A,
23
- value: y
24
- } = e, W = r && !e.hidden, k = !v(e.updateMode), s = `metadata.fields[${M}]`, w = e.type === "taxonomy" && ((x = e.optionsRules) == null ? void 0 : x.multiSelect), i = t && N, E = I({
25
- [n.suggestionApplied]: p,
22
+ type: h,
23
+ value: d
24
+ } = e, W = l && !e.hidden, k = !C(e.updateMode), s = `metadata.fields[${V}]`, w = e.type === "taxonomy" && ((M = e.optionsRules) == null ? void 0 : M.multiSelect), i = t && A, E = I({
25
+ [n.suggestionApplied]: r,
26
26
  [n.hasSuggestion]: i,
27
- [n.dateField]: A === "date"
28
- }), o = P((l) => {
29
- m(`${s}.value`, l), f(!1), S(!0);
30
- }, [s, m]);
31
- R(() => {
32
- !i || y || o(t);
27
+ [n.dateField]: h === "date"
28
+ }), o = R((u) => {
29
+ S(`${s}.value`, u), p(!1), y(!0);
30
+ }, [s, S]);
31
+ T(() => {
32
+ !i || d || o(t);
33
33
  }, [i, t, o]);
34
- const h = () => {
35
- p && S(!1);
34
+ const x = U(() => t && d === t, [A]), F = () => {
35
+ r && y(!1), x && p(!1);
36
36
  };
37
- return W ? k ? /* @__PURE__ */ a(U, {
37
+ return W ? k ? /* @__PURE__ */ a(j, {
38
38
  fieldNamePrefix: s,
39
39
  fieldType: e.type,
40
40
  isTaxonomyMultiSelect: w,
41
- children: /* @__PURE__ */ a(r, {
42
- ref: c,
41
+ children: /* @__PURE__ */ a(l, {
42
+ ref: f,
43
43
  description: e.description,
44
- disableForm: d,
44
+ disableForm: g,
45
45
  fieldNamePrefix: s,
46
46
  isAiSuggestionApplied: !1,
47
47
  label: e.displayName,
48
- onValueEdited: h,
49
- portalElement: u,
50
- taxonomyOptionsFetcher: g
48
+ onValueEdited: F,
49
+ portalElement: c,
50
+ taxonomyOptionsFetcher: m
51
51
  })
52
- }, e.key) : /* @__PURE__ */ j("div", {
52
+ }, e.key) : /* @__PURE__ */ B("div", {
53
53
  className: n.fieldWrapper,
54
- children: [/* @__PURE__ */ a(r, {
55
- ref: c,
54
+ children: [/* @__PURE__ */ a(l, {
55
+ ref: f,
56
56
  className: E,
57
57
  description: e.description,
58
- disableForm: d,
58
+ disableForm: g,
59
59
  fieldNamePrefix: s,
60
- isAiSuggestionApplied: p,
60
+ isAiSuggestionApplied: r,
61
61
  label: e.displayName,
62
- onValueEdited: h,
63
- portalElement: u,
64
- taxonomyOptionsFetcher: g
65
- }), i && /* @__PURE__ */ a(T, {
62
+ onValueEdited: F,
63
+ portalElement: c,
64
+ taxonomyOptionsFetcher: m
65
+ }), i && /* @__PURE__ */ a(b, {
66
66
  aiSuggestion: t,
67
+ isSameValue: x,
67
68
  onAiSuggestionAppend: () => {
68
- const l = [...new Set([y, t].flat().filter(Boolean))];
69
- o(l);
69
+ const u = [...new Set([d, t].flat().filter(Boolean))];
70
+ o(u);
70
71
  },
71
- onAiSuggestionIgnore: () => f(!1),
72
+ onAiSuggestionIgnore: () => p(!1),
72
73
  onAiSuggestionReplace: () => o(t),
73
- type: A
74
+ type: h
74
75
  })]
75
76
  }, e.key) : null;
76
77
  });
77
78
  export {
78
- L as MetadataEditorFieldWrapper
79
+ X as MetadataEditorFieldWrapper
79
80
  };
@@ -4,7 +4,7 @@ import { useFormikContext as d, getIn as p, FieldArray as u } from "formik";
4
4
  import { FormattedMessage as x } from "react-intl";
5
5
  import g from "../../messages.js";
6
6
  import { MetadataEditorFieldWrapper as h } from "./metadata-editor-field-wrapper.js";
7
- import { s as F } from "../../../../chunks/utils.js";
7
+ import { s as F } from "../../../../chunks/utils2.js";
8
8
  import { jsx as t } from "react/jsx-runtime";
9
9
  const C = (m) => {
10
10
  const {
@@ -1,6 +1,6 @@
1
1
  import "@box/blueprint-web-assets/icons/Logo";
2
2
  import "../interactive-text/interactive-text.js";
3
- import { g as m, t as p } from "../../../../chunks/utils.js";
3
+ import { g as m, t as p } from "../../../../chunks/utils2.js";
4
4
  import "../../utils/convertDate.js";
5
5
  import "react/jsx-runtime";
6
6
  export {
@@ -1,10 +1,14 @@
1
- import { DeleteConfirmationModal as t } from "./subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
2
- import { MetadataInstanceFormHeader as r } from "./subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
3
- import { CustomInstanceNewField as n } from "./subcomponents/custom-instance-new-field/custom-instance-new-field.js";
4
- import { MetadataInstanceForm as f } from "./subcomponents/metadata-instance-form/metadata-instance-form.js";
1
+ import { CustomInstanceNewField as e } from "./subcomponents/custom-instance-new-field/custom-instance-new-field.js";
2
+ import { DeleteConfirmationModal as r } from "./subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
3
+ import { MetadataInstanceFormAutofillButton as n } from "./subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
4
+ import { MetadataInstanceFormHeader as p } from "./subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
5
+ import { MetadataInstanceForm as s } from "./subcomponents/metadata-instance-form/metadata-instance-form.js";
6
+ import { J as c } from "../../../../chunks/utils.js";
5
7
  export {
6
- n as CustomInstanceNewField,
7
- t as DeleteConfirmationModal,
8
- f as MetadataInstanceForm,
9
- r as MetadataInstanceFormHeader
8
+ e as CustomInstanceNewField,
9
+ r as DeleteConfirmationModal,
10
+ c as JSONPatchOp,
11
+ s as MetadataInstanceForm,
12
+ n as MetadataInstanceFormAutofillButton,
13
+ p as MetadataInstanceFormHeader
10
14
  };