@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
@@ -0,0 +1,40 @@
1
+ import { Card as F } from "@box/blueprint-web";
2
+ import { TEMPLATE_CUSTOM_PROPERTIES as A } from "../../../../constants.js";
3
+ import { MetadataInstanceFormFooter as S } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
4
+ import { MetadataInstanceFormHeader as c } from "../metadata-instance-form-header/metadata-instance-form-header.js";
5
+ import { jsxs as C, jsx as o } from "react/jsx-runtime";
6
+ const x = (t) => {
7
+ const {
8
+ areAiSuggestionsAvailable: i,
9
+ children: r,
10
+ className: s,
11
+ formRef: n,
12
+ isAiSuggestionsFeatureEnabled: m,
13
+ isDeleteButtonDisabled: l,
14
+ isFetchingSuggestions: a,
15
+ isFormDirty: d = !1,
16
+ selectedTemplateInstance: e,
17
+ getAiSuggestions: g,
18
+ handleCancel: u,
19
+ handleDelete: f
20
+ } = t, p = (e == null ? void 0 : e.templateKey) === A;
21
+ return /* @__PURE__ */ C(F, {
22
+ ref: n,
23
+ className: s,
24
+ children: [/* @__PURE__ */ o(c, {
25
+ areAiSuggestionsAvailable: i,
26
+ isAiSuggestionsFeatureEnabled: m && !p,
27
+ isLoading: a,
28
+ onAutofill: g,
29
+ templateName: e == null ? void 0 : e.displayName
30
+ }), e && r, /* @__PURE__ */ o(S, {
31
+ isDeleteButtonDisabled: l,
32
+ isLoading: a,
33
+ onCancel: () => u(d),
34
+ onDelete: f
35
+ })]
36
+ });
37
+ };
38
+ export {
39
+ x as MetadataInstanceFormCardWrapper
40
+ };
@@ -1,101 +1,100 @@
1
1
  import "../../../../../../styles/metadata-instance-form.css";
2
- import { Card as P } from "@box/blueprint-web";
3
- import { Formik as U, Form as _ } from "formik";
4
- import { useState as d, useEffect as p, useRef as L, useMemo as R } from "react";
5
- import { TEMPLATE_CUSTOM_PROPERTIES as B } from "../../../../constants.js";
6
- import { useAutofill as K } from "../../../../utils/autofill-context.js";
7
- import { TemplateInstance as j } from "../../../metadata-editor-fields/metadata-editor-fields.js";
8
- import { MetadataEmptyState as k } from "../../../metadata-empty-state/metadata-empty-state.js";
9
- import { UnsavedChangesModal as $ } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
10
- import { CustomInstance as w } from "../custom-instance/custom-instance.js";
11
- import { DeleteConfirmationModal as H } from "../delete-confirmation-modal/delete-confirmation-modal.js";
12
- import { MetadataInstanceFormFooter as J } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
13
- import { MetadataInstanceFormHeader as V } from "../metadata-instance-form-header/metadata-instance-form-header.js";
14
- import { createJSONPatch as q } from "./utils.js";
15
- import { jsx as t, jsxs as u } from "react/jsx-runtime";
16
- const z = "_metadataInstanceForm_1hu4u_1", G = {
17
- metadataInstanceForm: z
18
- }, ce = (f) => {
2
+ import { Formik as B, Form as K } from "formik";
3
+ import { useState as d, useEffect as g, useRef as W, useMemo as j } from "react";
4
+ import { TEMPLATE_CUSTOM_PROPERTIES as k } from "../../../../constants.js";
5
+ import { useAutofill as L } from "../../../../utils/autofill-context.js";
6
+ import { TemplateInstance as V } from "../../../metadata-editor-fields/metadata-editor-fields.js";
7
+ import { MetadataEmptyState as $ } from "../../../metadata-empty-state/metadata-empty-state.js";
8
+ import { UnsavedChangesModal as w } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
9
+ import { CustomInstance as J } from "../custom-instance/custom-instance.js";
10
+ import { DeleteConfirmationModal as q } from "../delete-confirmation-modal/delete-confirmation-modal.js";
11
+ import { c as z } from "../../../../../../chunks/utils.js";
12
+ import { MetadataInstanceFormCardWrapper as G } from "./metadata-instance-form-card-wrapper.js";
13
+ import { jsx as r, jsxs as H } from "react/jsx-runtime";
14
+ const Q = "_metadataInstanceForm_1hu4u_1", X = {
15
+ metadataInstanceForm: Q
16
+ }, uo = (c) => {
19
17
  const {
20
- areAiSuggestionsAvailable: g,
21
- isAiSuggestionsFeatureEnabled: o,
22
- isDeleteButtonDisabled: h,
23
- isUnsavedChangesModalOpen: C = !1,
24
- onCancel: F,
25
- onDelete: S,
26
- onDiscardUnsavedChanges: M,
27
- onSubmit: E,
28
- selectedTemplateInstance: e,
29
- setIsUnsavedChangesModalOpen: i,
30
- taxonomyOptionsFetcher: I
31
- } = f, [D, r] = d(!1), {
18
+ areAiSuggestionsAvailable: h,
19
+ customRef: a,
20
+ isAiSuggestionsFeatureEnabled: i,
21
+ isDeleteButtonDisabled: C,
22
+ isUnsavedChangesModalOpen: F = !1,
23
+ MetadataInstanceFormCustomWrapper: M,
24
+ selectedTemplateInstance: o,
25
+ onCancel: S,
26
+ onDelete: E,
27
+ onDiscardUnsavedChanges: D,
28
+ onSubmit: y,
29
+ setIsUnsavedChangesModalOpen: s,
30
+ taxonomyOptionsFetcher: e
31
+ } = c, b = M ?? G, [O, m] = d(!1), {
32
32
  isFetchingSuggestions: n,
33
- getAiSuggestions: y,
34
- clearSuggestions: m
35
- } = K();
36
- p(() => m(), [m]);
37
- const s = e.templateKey === B, b = async (a) => {
38
- await E(a, q(a, e));
39
- }, A = (a) => {
40
- a ? i(!0) : F();
41
- }, O = () => {
42
- r(!0);
43
- }, T = {
33
+ getAiSuggestions: A,
34
+ clearSuggestions: u
35
+ } = L();
36
+ g(() => u(), [u]);
37
+ const f = (o == null ? void 0 : o.templateKey) === k, v = async (t) => {
38
+ await y(t, z(t, o));
39
+ }, x = (t) => {
40
+ t ? s(!0) : S();
41
+ }, P = () => {
42
+ m(!0);
43
+ }, R = {
44
44
  metadata: {
45
- ...e
45
+ ...o
46
46
  }
47
- }, l = L(null), [c, v] = d(null);
48
- p(() => {
49
- v(l.current);
50
- }, [e.templateKey, e.scope]);
51
- const N = R(() => {
52
- const a = e.fields.length === 0;
53
- return s ? /* @__PURE__ */ t(w, {
47
+ }, l = W(null), [p, U] = d(null);
48
+ g(() => {
49
+ U(a ?? l.current);
50
+ }, [a, o == null ? void 0 : o.templateKey, o == null ? void 0 : o.scope]);
51
+ const _ = j(() => {
52
+ const t = (o == null ? void 0 : o.fields.length) === 0;
53
+ return f ? /* @__PURE__ */ r(J, {
54
54
  isLoading: n
55
- }) : a ? /* @__PURE__ */ t(k, {
56
- isBoxAiSuggestionsFeatureEnabled: o,
55
+ }) : t ? /* @__PURE__ */ r($, {
56
+ isBoxAiSuggestionsFeatureEnabled: i,
57
57
  level: "instance"
58
- }) : /* @__PURE__ */ t(j, {
58
+ }) : /* @__PURE__ */ r(V, {
59
59
  disableForm: n,
60
- portalElement: c,
61
- taxonomyOptionsFetcher: I
60
+ portalElement: a ?? p,
61
+ taxonomyOptionsFetcher: e
62
62
  });
63
- }, [s, e.fields.length, n, o, c]);
64
- return /* @__PURE__ */ t(U, {
65
- initialValues: T,
66
- onSubmit: b,
63
+ }, [o == null ? void 0 : o.fields.length, f, n, a, p, e, i]);
64
+ return /* @__PURE__ */ r(B, {
65
+ initialValues: R,
66
+ onSubmit: v,
67
67
  children: ({
68
- values: a,
69
- dirty: x
70
- }) => /* @__PURE__ */ u(_, {
71
- children: [/* @__PURE__ */ u(P, {
72
- ref: l,
73
- className: G.metadataInstanceForm,
74
- children: [/* @__PURE__ */ t(V, {
75
- areAiSuggestionsAvailable: g,
76
- isAiSuggestionsFeatureEnabled: o && !s,
77
- isLoading: n,
78
- onAutofill: y,
79
- templateName: e.displayName
80
- }), N, /* @__PURE__ */ t(J, {
81
- isDeleteButtonDisabled: h,
82
- isLoading: n,
83
- onCancel: () => A(x),
84
- onDelete: O
85
- })]
86
- }), /* @__PURE__ */ t($, {
87
- onBackToEdit: () => i(!1),
88
- onDiscardChanges: M,
89
- open: C
90
- }), /* @__PURE__ */ t(H, {
91
- onConfirm: () => S(e),
92
- onDismiss: () => r(!1),
93
- open: D,
94
- templateName: e.displayName
68
+ values: t,
69
+ dirty: N
70
+ }) => /* @__PURE__ */ H(K, {
71
+ children: [/* @__PURE__ */ r(b, {
72
+ areAiSuggestionsAvailable: h,
73
+ className: X.metadataInstanceForm,
74
+ formRef: l,
75
+ formValues: t,
76
+ getAiSuggestions: A,
77
+ handleCancel: x,
78
+ handleDelete: P,
79
+ isAiSuggestionsFeatureEnabled: i,
80
+ isDeleteButtonDisabled: C,
81
+ isFetchingSuggestions: n,
82
+ isFormDirty: N,
83
+ selectedTemplateInstance: o,
84
+ children: o && _
85
+ }), /* @__PURE__ */ r(w, {
86
+ onBackToEdit: () => s(!1),
87
+ onDiscardChanges: D,
88
+ open: F
89
+ }), /* @__PURE__ */ r(q, {
90
+ onConfirm: () => E(o),
91
+ onDismiss: () => m(!1),
92
+ open: O,
93
+ templateName: o == null ? void 0 : o.displayName
95
94
  })]
96
95
  })
97
- }, `${e.scope}.${e.templateKey}`);
96
+ }, `${o == null ? void 0 : o.scope}.${o == null ? void 0 : o.templateKey}`);
98
97
  };
99
98
  export {
100
- ce as MetadataInstanceForm
99
+ uo as MetadataInstanceForm
101
100
  };
@@ -1,41 +1,8 @@
1
- import h from "lodash/isEmpty";
2
- import O from "lodash/isArray";
3
- import { TEMPLATE_CUSTOM_PROPERTIES as f } from "../../../../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
- });
1
+ import "lodash/isEmpty";
2
+ import "lodash/isArray";
3
+ import { c as m, g as i } from "../../../../../../chunks/utils.js";
4
+ import "../../../../constants.js";
38
5
  export {
39
- S as createJSONPatch,
40
- u as getFormatedFieldValue
6
+ m as createJSONPatch,
7
+ i as getFormatedFieldValue
41
8
  };
@@ -0,0 +1,18 @@
1
+ import { defineMessages as t } from "react-intl";
2
+ const e = t({
3
+ autofillButton: {
4
+ id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButton",
5
+ defaultMessage: "Autofill"
6
+ },
7
+ autofillButtonTooltip: {
8
+ id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButtonTooltip",
9
+ defaultMessage: "Autofill with Box AI"
10
+ },
11
+ loadingButtonAriaLabel: {
12
+ id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.loadingButtonAriaLabel",
13
+ defaultMessage: "Loading..."
14
+ }
15
+ });
16
+ export {
17
+ e as default
18
+ };
@@ -0,0 +1,68 @@
1
+ import "../../../../../../styles/metadata-instance-form-autofill-button.css";
2
+ import { LoadingIndicator as M, IconButton as v, Tooltip as L, Button as k } from "@box/blueprint-web";
3
+ import { BoxAiLogo as p } from "@box/blueprint-web-assets/icons/Logo";
4
+ import { useFormikContext as x, getIn as i } from "formik";
5
+ import { useEffect as K } from "react";
6
+ import { useIntl as h } from "react-intl";
7
+ import { useAutofill as C } from "../../../../utils/autofill-context.js";
8
+ import n from "./messages.js";
9
+ import { jsx as r } from "react/jsx-runtime";
10
+ const F = "_loadingIndicator_1vv9u_1", _ = {
11
+ loadingIndicator: F
12
+ }, z = ({
13
+ areAiSuggestionsAvailable: B,
14
+ isLoading: l,
15
+ variant: b = "secondary-button",
16
+ onAutofill: I
17
+ }) => {
18
+ const {
19
+ isSubmitting: y,
20
+ values: e,
21
+ setFieldValue: m
22
+ } = x(), t = h(), {
23
+ suggestions: o
24
+ } = C();
25
+ K(() => {
26
+ if (o) {
27
+ const a = i(e, "metadata.fields"), s = i(e, "metadata.templateKey");
28
+ m("metadata.fields", a == null ? void 0 : a.map((c) => {
29
+ var f;
30
+ const g = (f = o == null ? void 0 : o[s]) == null ? void 0 : f[c.key];
31
+ return g ? {
32
+ ...c,
33
+ aiSuggestion: g
34
+ } : c;
35
+ }));
36
+ }
37
+ }, [o, m]);
38
+ const d = () => {
39
+ const a = i(e, "metadata.templateKey"), s = i(e, "metadata.scope");
40
+ I(a, s);
41
+ }, u = !B || y || l, A = l ? /* @__PURE__ */ r(M, {
42
+ "aria-label": t.formatMessage(n.loadingButtonAriaLabel),
43
+ className: _.loadingIndicator
44
+ }) : /* @__PURE__ */ r(v, {
45
+ "aria-label": t.formatMessage(n.loadingButtonAriaLabel),
46
+ disabled: u,
47
+ icon: p,
48
+ onClick: d,
49
+ variant: "icon-logo",
50
+ "data-target-id": "IconButton-loadingButtonAriaLabel"
51
+ });
52
+ return /* @__PURE__ */ r(L, {
53
+ content: t.formatMessage(n.autofillButtonTooltip),
54
+ children: b === "secondary-button" ? /* @__PURE__ */ r(k, {
55
+ disabled: u,
56
+ icon: p,
57
+ loading: l,
58
+ loadingAriaLabel: t.formatMessage(n.loadingButtonAriaLabel),
59
+ onClick: d,
60
+ variant: "secondary",
61
+ "data-target-id": "Button-autofillButton",
62
+ children: t.formatMessage(n.autofillButton)
63
+ }) : A
64
+ });
65
+ };
66
+ export {
67
+ z as MetadataInstanceFormAutofillButton
68
+ };
@@ -1,20 +1,8 @@
1
1
  import { defineMessages as t } from "react-intl";
2
2
  const e = t({
3
- autofillButton: {
4
- id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButton",
5
- defaultMessage: "Autofill"
6
- },
7
- autofillButtonTooltip: {
8
- id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.autofillButtonTooltip",
9
- defaultMessage: "Autofill with Box AI"
10
- },
11
3
  customInstanceTitle: {
12
4
  id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.customInstanceTitle",
13
5
  defaultMessage: "Custom Metadata"
14
- },
15
- loadingButtonAriaLabel: {
16
- id: "metadataEditor.metadataInstanceEditor.metadataInstanceFormHeader.loadingButtonAriaLabel",
17
- defaultMessage: "Loading..."
18
6
  }
19
7
  });
20
8
  export {
@@ -1,67 +1,32 @@
1
1
  import "../../../../../../styles/metadata-instance-form-header.css";
2
- import { Tooltip as _, Button as b } from "@box/blueprint-web";
3
- import { BoxAiLogo as A } from "@box/blueprint-web-assets/icons/Logo";
4
- import { useFormikContext as M, getIn as o } from "formik";
5
- import { useEffect as h } from "react";
6
- import { useIntl as v } from "react-intl";
7
- import { useAutofill as K } from "../../../../utils/autofill-context.js";
8
- import T from "../../../interactive-header-text/interactive-header-text.js";
9
- import s from "./messages.js";
10
- import { jsxs as k, jsx as m } from "react/jsx-runtime";
11
- const j = "_metadataInstanceFormHeader_13lxr_1", C = "_title_13lxr_9", f = {
12
- metadataInstanceFormHeader: j,
13
- title: C
14
- }, J = ({
15
- areAiSuggestionsAvailable: p,
16
- isAiSuggestionsFeatureEnabled: g,
17
- isLoading: l,
18
- templateName: I,
19
- onAutofill: x
2
+ import { useIntl as l } from "react-intl";
3
+ import i from "../../../interactive-header-text/interactive-header-text.js";
4
+ import { MetadataInstanceFormAutofillButton as d } from "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
5
+ import I from "./messages.js";
6
+ import { jsxs as f, jsx as t } from "react/jsx-runtime";
7
+ const p = "_metadataInstanceFormHeader_13lxr_1", u = "_title_13lxr_9", e = {
8
+ metadataInstanceFormHeader: p,
9
+ title: u
10
+ }, j = ({
11
+ areAiSuggestionsAvailable: a,
12
+ isAiSuggestionsFeatureEnabled: r,
13
+ isLoading: s,
14
+ templateName: o,
15
+ onAutofill: n
20
16
  }) => {
21
- const {
22
- isSubmitting: B,
23
- values: e,
24
- setFieldValue: c
25
- } = M(), a = v(), {
26
- suggestions: t
27
- } = K();
28
- h(() => {
29
- if (t) {
30
- const n = o(e, "metadata.fields"), r = o(e, "metadata.templateKey");
31
- c("metadata.fields", n.map((i) => {
32
- var u;
33
- const d = (u = t == null ? void 0 : t[r]) == null ? void 0 : u[i.key];
34
- return d ? {
35
- ...i,
36
- aiSuggestion: d
37
- } : i;
38
- }));
39
- }
40
- }, [t, c]);
41
- const y = () => {
42
- const n = o(e, "metadata.templateKey"), r = o(e, "metadata.scope");
43
- x(n, r);
44
- }, F = I ?? a.formatMessage(s.customInstanceTitle), H = !p || B || l;
45
- return /* @__PURE__ */ k("div", {
46
- className: f.metadataInstanceFormHeader,
47
- children: [/* @__PURE__ */ m(T, {
48
- className: f.title,
49
- title: F
50
- }), g && /* @__PURE__ */ m(_, {
51
- content: a.formatMessage(s.autofillButtonTooltip),
52
- children: /* @__PURE__ */ m(b, {
53
- disabled: H,
54
- icon: A,
55
- loading: l,
56
- loadingAriaLabel: a.formatMessage(s.loadingButtonAriaLabel),
57
- onClick: y,
58
- variant: "secondary",
59
- "data-target-id": "Button-autofillButton",
60
- children: a.formatMessage(s.autofillButton)
61
- })
62
- })]
17
+ const m = l(), c = o ?? m.formatMessage(I.customInstanceTitle);
18
+ return /* @__PURE__ */ f("div", {
19
+ className: e.metadataInstanceFormHeader,
20
+ children: [/* @__PURE__ */ t(i, {
21
+ className: e.title,
22
+ title: c
23
+ }), r ? /* @__PURE__ */ t(d, {
24
+ areAiSuggestionsAvailable: a,
25
+ isLoading: s,
26
+ onAutofill: n
27
+ }) : null]
63
28
  });
64
29
  };
65
30
  export {
66
- J as MetadataInstanceFormHeader
31
+ j as MetadataInstanceFormHeader
67
32
  };
package/i18n/bn-IN.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "বিকল্প",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "সংযুক্ত করুন",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "পরিষ্কার করুন এবং প্রতিস্থাপন করুন",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "উপেক্ষা করুন",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "আপনি কি সত্যিই \"{templateName}\" মেটাডেটা টেমপ্লেট এবং এই ফাইল থেকে এটির সব মান মুছে ফেলতে চান?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "মুছে দেওয়া নিশ্চিত করতে মেটাডেটা টেমপ্লেটর নাম লিখুন",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "মুছে দেওয়ার পর মেটাডেটার মানগুলো আর পুনরুদ্ধার করা যাবে না।",
package/i18n/da-DK.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Indstillingsmuligheder",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Tilføj",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Ryd og Erstat",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignorer",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Er du sikker på, at du vil slette \"{templateName}\" metadataskabelon og alle dens værdier fra denne fil?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Indtast navnet på metadata-skabelonen for at bekræfte sletning",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Når metadata-værdier er slettet, kan de ikke gendannes.",
package/i18n/de-DE.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Optionen",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Anfügen",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Löschen und ersetzen",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignorieren",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Möchten Sie die Metadaten-Vorlage „{templateName}“ und alle ihre Werte aus dieser Datei wirklich löschen?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Geben Sie den Namen der Metadaten-Vorlage ein, um das Löschen zu bestätigen",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Nach dem Löschen können die Metadaten-Werte nicht wiederhergestellt werden.",
package/i18n/en-AU.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Options",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Append",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Clear and Replace",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignore",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Are you sure you want to delete the \"{templateName}\" Metadata template, and all of its values from this file?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Type the Metadata Template's name to confirm deletion",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Once deleted, Metadata values cannot be restored.",
package/i18n/en-CA.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Options",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Append",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Clear and Replace",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignore",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Are you sure you want to delete the \"{templateName}\" Metadata template, and all of its values from this file?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Type the Metadata Template’s name to confirm deletion",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Once deleted, Metadata values cannot be restored.",
package/i18n/en-GB.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Options",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Append",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Clear and Replace",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignore",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Are you sure you want to delete the \"{templateName}\" Metadata template, and all of its values from this file?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Type the Metadata Template's name to confirm deletion",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Once deleted, Metadata values cannot be restored.",
package/i18n/en-US.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Options",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Append",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Clear and Replace",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignore",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Are you sure you want to delete the \"{templateName}\" Metadata template, and all of its values from this file?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Type the Metadata Template’s name to confirm deletion",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Once deleted, Metadata values cannot be restored.",
@@ -84,8 +84,12 @@ metadataEditor.aiSuggestionField.aiSuggestionOptions = Options
84
84
  metadataEditor.aiSuggestionField.appendLabel = Append
85
85
  # Label for clearing the current value and applying the AI suggestion
86
86
  metadataEditor.aiSuggestionField.clearAndReplaceLabel = Clear and Replace
87
+ # Label for confirming the message informing that AI suggestion is the same as already applied value
88
+ metadataEditor.aiSuggestionField.dismissLabel = Confirm
87
89
  # Label for ignoring the AI suggestion
88
90
  metadataEditor.aiSuggestionField.ignoreLabel = Ignore
91
+ # Label informing that AI suggestion value is the same as already existing value
92
+ metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption = Box AI suggests the same value as above
89
93
  # Paragraph asking user are they sure that they want to delete the template
90
94
  metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph = Are you sure you want to delete the "{templateName}" Metadata template, and all of its values from this file?
91
95
  # Label informing how to confirm deletion of the template
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "⟦萬萬 ÒΡτīòπś 國國⟧",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "⟦萬 ÄΡΡéлď 國⟧",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "⟦萬萬萬萬萬 Čļèαř ăήď ŖēΡļāçê 國國國國國⟧",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "⟦萬 Ĩĝлóŗė 國⟧",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬 Άяĕ γøũ şũгë γоμ ẁáητ ţο ďêļęťε τħé \"{templateName}\" Μετάďάťά ŧёmΡļãτè, āηď ǻļľ οƒ įţś νăĺűеś ƒѓőm ŧĥιş ƒϊļě? 國國國國國國國國國國國國國國國國國國國國國國國國國國國國國⟧",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬萬 ŤУΡĕ τħε Мêťâďāţâ ŦĕmΡľăτē’ŝ ήàmĕ ţσ çôлƒĩŕm ďęľëŧϊőņ 國國國國國國國國國國國國國國國⟧",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "⟦萬萬萬萬萬萬萬萬萬萬萬萬萬萬 Οʼn¢ë ďèľёţěď, Μëţäďáţá νăļůεŝ ćåŋηøτ вê гēşţōŗèď. 國國國國國國國國國國國國國國⟧",
package/i18n/es-419.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Opciones",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Anexar",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Eliminar y reemplazar",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignorar",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "¿Seguro que deseas eliminar la plantilla de metadatos \"{templateName}\" y todos sus valores de este archivo?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Escriba el nombre de la plantilla de metadatos para confirmar que se ha eliminado.",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Una vez eliminados, los valores de metadatos no se podrán recuperar.",
package/i18n/es-ES.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Opciones",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Anexar",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Eliminar y reemplazar",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ignorar",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "¿Seguro que deseas eliminar la plantilla de metadatos \"{templateName}\" y todos sus valores de este archivo?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Escriba el nombre de la plantilla de metadatos para confirmar que se ha eliminado.",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Una vez eliminados, los valores de metadatos no se podrán recuperar.",
package/i18n/fi-FI.js CHANGED
@@ -42,7 +42,9 @@ export default {
42
42
  "metadataEditor.aiSuggestionField.aiSuggestionOptions": "Vaihtoehdot",
43
43
  "metadataEditor.aiSuggestionField.appendLabel": "Liitä",
44
44
  "metadataEditor.aiSuggestionField.clearAndReplaceLabel": "Tyhjennä ja korvaa",
45
+ "metadataEditor.aiSuggestionField.dismissLabel": "Confirm",
45
46
  "metadataEditor.aiSuggestionField.ignoreLabel": "Ohita",
47
+ "metadataEditor.aiSuggestionField.sameValueAiSuggestionCaption": "Box AI suggests the same value as above",
46
48
  "metadataEditor.editInstance.deleteConfirmationModal.body.firstParagraph": "Oletko varma, että haluat poistaa \"{templateName}\" Metatietomallin ja kaikki sen arvot tästä tiedostosta?",
47
49
  "metadataEditor.editInstance.deleteConfirmationModal.body.inputFieldLabel": "Vahvista poisto kirjoittamalla metatietomallin nimi",
48
50
  "metadataEditor.editInstance.deleteConfirmationModal.body.secondParagraph": "Metatietoarvoja ei voi palauttaa, kun ne on poistettu.",