@box/metadata-editor 0.80.4 → 0.80.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.js CHANGED
@@ -1,43 +1,47 @@
1
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 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
- import { MetadataEmptyState as x } from "./lib/components/metadata-empty-state/metadata-empty-state.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";
17
- import { U as V } from "../chunks/types.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";
3
+ import { FilterDropdownMenu as m } from "./lib/components/filter-dropdown-menu/index.js";
4
+ import { FilterInstancesDropdown as f } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
5
+ import { MULTI_VALUE_DEFAULT_OPTION as x, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as i, MULTI_VALUE_DEFAULT_VALUE as l } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
6
+ import { MetadataEmptyState as s } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
7
+ import { CustomInstanceNewField as I } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
8
+ import { DeleteConfirmationModal as u } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
9
+ import { MetadataInstanceFormAutofillButton as T } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
10
+ import { MetadataInstanceFormHeader as E } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
11
+ import { MetadataInstanceForm as c } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
12
+ import { J as D } from "../chunks/utils.js";
13
+ import { MetadataInstanceList as V } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
14
+ import { MetadataInstanceHeader as N } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
15
+ import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
16
+ import { defaultInitialValues as g, defaultMetadataValueMap as v } from "./lib/defaults.js";
17
+ import { MetadataEditor as J } from "./lib/metadata-editor.js";
18
+ import { U as W } from "../chunks/types.js";
19
+ import { withApiWrapper as B } from "./lib/utils/api-wrapper.js";
20
+ import { AutofillContext as Y, AutofillContextProvider as j, useAutofill as k } from "./lib/utils/autofill-context.js";
20
21
  export {
21
22
  e as AddMetadataTemplateDropdown,
22
- y as AutofillContext,
23
- B as AutofillContextProvider,
23
+ Y as AutofillContext,
24
+ j as AutofillContextProvider,
24
25
  r as ComboboxWithApiPagination,
25
- l as CustomInstanceNewField,
26
- M as DeleteConfirmationModal,
27
- n as FilterDropdownMenu,
28
- d as FilterInstancesDropdown,
29
- h as JSONPatchOp,
30
- O as MetadataEditor,
31
- x as MetadataEmptyState,
32
- F as MetadataInstanceForm,
33
- c as MetadataInstanceFormAutofillButton,
34
- A as MetadataInstanceFormHeader,
35
- b as MetadataInstanceHeader,
36
- P as MetadataInstanceList,
37
- v as UnsavedChangesModal,
38
- V as UpdateMode,
39
- H as defaultInitialValues,
40
- J as defaultMetadataValueMap,
41
- L as useAutofill,
42
- j as withApiWrapper
26
+ I as CustomInstanceNewField,
27
+ u as DeleteConfirmationModal,
28
+ m as FilterDropdownMenu,
29
+ f as FilterInstancesDropdown,
30
+ D as JSONPatchOp,
31
+ x as MULTI_VALUE_DEFAULT_OPTION,
32
+ i as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
33
+ l as MULTI_VALUE_DEFAULT_VALUE,
34
+ J as MetadataEditor,
35
+ s as MetadataEmptyState,
36
+ c as MetadataInstanceForm,
37
+ T as MetadataInstanceFormAutofillButton,
38
+ E as MetadataInstanceFormHeader,
39
+ N as MetadataInstanceHeader,
40
+ V as MetadataInstanceList,
41
+ h as UnsavedChangesModal,
42
+ W as UpdateMode,
43
+ g as defaultInitialValues,
44
+ v as defaultMetadataValueMap,
45
+ k as useAutofill,
46
+ B as withApiWrapper
43
47
  };
@@ -1,13 +1,13 @@
1
1
  import "../../../../../../styles/ai-suggestion-field.css";
2
- import { Text as l, IconButton as c, DropdownMenu as a } from "@box/blueprint-web";
2
+ import { Text as s, IconButton as c, DropdownMenu as a } from "@box/blueprint-web";
3
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";
4
+ import { useIntl as I, FormattedMessage as r } from "react-intl";
5
5
  import t from "./messages.js";
6
- import { formatSuggestionValue as _ } from "./utils.js";
6
+ import { formatSuggestionValue as w } from "./utils.js";
7
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 = {
8
+ const C = "_wrapperGradient_t2yak_1", _ = "_wrapper_t2yak_1", b = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", o = {
9
9
  wrapperGradient: C,
10
- wrapper: I,
10
+ wrapper: _,
11
11
  buttons: b,
12
12
  selectTrigger: k
13
13
  };
@@ -16,16 +16,16 @@ function D({
16
16
  onAiSuggestionAppend: g,
17
17
  onAiSuggestionReplace: d,
18
18
  onAiSuggestionIgnore: p,
19
- type: o,
19
+ type: n,
20
20
  isSameValue: h
21
21
  }) {
22
- const s = w();
22
+ const l = I();
23
23
  return /* @__PURE__ */ e("div", {
24
- className: n.wrapperGradient,
24
+ className: o.wrapperGradient,
25
25
  children: /* @__PURE__ */ e("div", {
26
- className: n.wrapper,
26
+ className: o.wrapper,
27
27
  children: h ? /* @__PURE__ */ i(u, {
28
- children: [/* @__PURE__ */ e(l, {
28
+ children: [/* @__PURE__ */ e(s, {
29
29
  as: "p",
30
30
  color: "textOnLightSecondary",
31
31
  variant: "caption",
@@ -33,9 +33,9 @@ function D({
33
33
  ...t.sameValueAiSuggestionCaption
34
34
  })
35
35
  }), /* @__PURE__ */ e("div", {
36
- className: n.buttons,
36
+ className: o.buttons,
37
37
  children: /* @__PURE__ */ e(c, {
38
- "aria-label": s.formatMessage(t.aiSuggestionConfirm),
38
+ "aria-label": l.formatMessage(t.aiSuggestionConfirm),
39
39
  icon: m,
40
40
  onClick: p,
41
41
  size: "x-small",
@@ -44,37 +44,38 @@ function D({
44
44
  })]
45
45
  }) : /* @__PURE__ */ i(u, {
46
46
  children: [/* @__PURE__ */ i("div", {
47
- children: [/* @__PURE__ */ e(l, {
47
+ children: [/* @__PURE__ */ e(s, {
48
48
  as: "p",
49
49
  color: "textOnLightSecondary",
50
50
  variant: "caption",
51
51
  children: /* @__PURE__ */ e(r, {
52
52
  ...t.aiSuggestionCaption
53
53
  })
54
- }), /* @__PURE__ */ e(l, {
54
+ }), /* @__PURE__ */ e(s, {
55
55
  as: "p",
56
- children: _(S, {
57
- type: o,
58
- locale: s.locale
56
+ children: w(S, {
57
+ type: n,
58
+ locale: l.locale
59
59
  })
60
60
  })]
61
61
  }), /* @__PURE__ */ i("div", {
62
- className: n.buttons,
62
+ className: o.buttons,
63
63
  children: [/* @__PURE__ */ e(c, {
64
- "aria-label": s.formatMessage(o === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
64
+ "aria-label": l.formatMessage(n === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
65
+ "data-target-id": n === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
65
66
  icon: m,
66
- onClick: o === "multiSelect" ? g : d,
67
+ onClick: n === "multiSelect" ? g : d,
67
68
  size: "x-small"
68
69
  }), /* @__PURE__ */ i(a.Root, {
69
70
  children: [/* @__PURE__ */ e(a.Trigger, {
70
- className: n.selectTrigger,
71
+ className: o.selectTrigger,
71
72
  children: /* @__PURE__ */ e(c, {
72
- "aria-label": s.formatMessage(t.aiSuggestionOptions),
73
+ "aria-label": l.formatMessage(t.aiSuggestionOptions),
73
74
  icon: f,
74
75
  "data-target-id": "IconButton-aiSuggestionOptions"
75
76
  })
76
77
  }), /* @__PURE__ */ i(a.Content, {
77
- children: [o === "multiSelect" && /* @__PURE__ */ e(a.Item, {
78
+ children: [n === "multiSelect" && /* @__PURE__ */ e(a.Item, {
78
79
  onSelect: g,
79
80
  "data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
80
81
  children: /* @__PURE__ */ e(r, {
@@ -0,0 +1,12 @@
1
+ const e = "Multiple values", t = {
2
+ id: "MD-editor-dummy-Multiple values",
3
+ key: e
4
+ }, L = {
5
+ id: "MD-editor-dummy--Multiple values-tax",
6
+ key: e
7
+ };
8
+ export {
9
+ t as MULTI_VALUE_DEFAULT_OPTION,
10
+ L as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
11
+ e as MULTI_VALUE_DEFAULT_VALUE
12
+ };
@@ -1,22 +1,23 @@
1
1
  import "../../../../../../styles/update-mode-field-wrapper.css";
2
- import { IconButton as I, Radio as d } from "@box/blueprint-web";
3
- import { Settings as R, XMark as w } from "@box/blueprint-web-assets/icons/Fill";
4
- import A from "clsx";
5
- import { useFormikContext as E, getIn as C, Field as S } from "formik";
6
- import _, { useState as B } from "react";
7
- import { useIntl as U } from "react-intl";
8
- import { U as i } from "../../../../../../chunks/types.js";
2
+ import { IconButton as b, Radio as i } from "@box/blueprint-web";
3
+ import { Settings as A, XMark as E } from "@box/blueprint-web-assets/icons/Fill";
4
+ import R from "clsx";
5
+ import { useFormikContext as U, getIn as _, Field as w } from "formik";
6
+ import C, { useState as S } from "react";
7
+ import { useIntl as B } from "react-intl";
8
+ import { U as r } from "../../../../../../chunks/types.js";
9
9
  import { messages as l } from "./messages.js";
10
- import { jsxs as s, jsx as o } from "react/jsx-runtime";
11
- const $ = "_wrapperContianer_1n09p_1", N = "_fieldContainer_1n09p_6", k = "_field_1n09p_6", x = "_collapseButton_1n09p_13", G = "_radioContainer_1n09p_19", V = "_additionalFieldContainer_1n09p_22", j = "_hidden_1n09p_26", t = {
10
+ import { MULTI_VALUE_DEFAULT_OPTION as N } from "./mulitple-values-utils.js";
11
+ import { jsxs as p, jsx as o } from "react/jsx-runtime";
12
+ const $ = "_wrapperContianer_1n09p_1", L = "_fieldContainer_1n09p_6", O = "_field_1n09p_6", V = "_collapseButton_1n09p_13", k = "_radioContainer_1n09p_19", x = "_additionalFieldContainer_1n09p_22", G = "_hidden_1n09p_26", t = {
12
13
  wrapperContianer: $,
13
- fieldContainer: N,
14
- field: k,
15
- collapseButton: x,
16
- radioContainer: G,
17
- additionalFieldContainer: V,
18
- hidden: j
19
- }, y = (e) => e === i.ReplaceEntered, L = (e, a) => e === "string" || e === "multiSelect" || a, O = ({
14
+ fieldContainer: L,
15
+ field: O,
16
+ collapseButton: V,
17
+ radioContainer: k,
18
+ additionalFieldContainer: x,
19
+ hidden: G
20
+ }, j = (e) => e === r.ReplaceEntered, y = (e, a) => e === "string" || e === "multiSelect" || a, T = ({
20
21
  children: e,
21
22
  fieldNamePrefix: a,
22
23
  fieldType: f,
@@ -25,68 +26,68 @@ const $ = "_wrapperContianer_1n09p_1", N = "_fieldContainer_1n09p_6", k = "_fiel
25
26
  const {
26
27
  setFieldValue: M,
27
28
  values: m
28
- } = E(), [p, h] = B(!0), n = U(), u = `${a}.updateMode.mode`, v = C(m, u), r = e && _.Children.only(e), b = C(m, `${a}.options`, []).map(({
29
- key: c
30
- }) => c);
31
- return /* @__PURE__ */ s("div", {
29
+ } = U(), [c, h] = S(!0), n = B(), u = `${a}.updateMode.mode`, v = _(m, u), s = e && C.Children.only(e), I = _(m, `${a}.options`, []).filter((d) => d.id !== N.id).map(({
30
+ key: d
31
+ }) => d);
32
+ return /* @__PURE__ */ p("div", {
32
33
  className: t.wrapperContianer,
33
- children: [/* @__PURE__ */ s("div", {
34
+ children: [/* @__PURE__ */ p("div", {
34
35
  className: t.fieldContainer,
35
36
  children: [/* @__PURE__ */ o("span", {
36
37
  className: t.field,
37
38
  children: e
38
- }), /* @__PURE__ */ o(I, {
39
+ }), /* @__PURE__ */ o(b, {
39
40
  "aria-label": n.formatMessage(l.toggleUpdateModeSelectiorAriaLabel),
40
41
  className: t.collapseButton,
41
- "data-testid": `${r.props.label}-update-mode-toggle`,
42
- icon: p ? R : w,
42
+ "data-testid": `${s.props.label}-update-mode-toggle`,
43
+ icon: c ? A : E,
43
44
  onClick: () => {
44
- h(!p);
45
+ h(!c);
45
46
  },
46
47
  size: "small",
47
48
  "data-target-id": "IconButton-toggleUpdateModeSelectiorAriaLabel"
48
49
  })]
49
- }), /* @__PURE__ */ s("div", {
50
- className: A(t.radioContainer, {
51
- [t.hidden]: p
50
+ }), /* @__PURE__ */ p("div", {
51
+ className: R(t.radioContainer, {
52
+ [t.hidden]: c
52
53
  }),
53
- children: [/* @__PURE__ */ o(S, {
54
+ children: [/* @__PURE__ */ o(w, {
54
55
  name: `${a}.updateMode.mode`,
55
56
  children: ({
56
- field: c
57
- }) => /* @__PURE__ */ s(d.Group, {
58
- "data-testid": `${r.props.label}-radio-group`,
57
+ field: d
58
+ }) => /* @__PURE__ */ p(i.Group, {
59
+ "data-testid": `${s.props.label}-radio-group`,
59
60
  loop: !0,
60
61
  onValueChange: (F) => M(u, F),
61
62
  orientation: "vertical",
62
- value: c.value,
63
- children: [L(f, g) && /* @__PURE__ */ o(d.Item, {
63
+ value: d.value,
64
+ children: [y(f, g) && /* @__PURE__ */ o(i.Item, {
64
65
  label: n.formatMessage(l.append),
65
- value: i.Append
66
- }), /* @__PURE__ */ o(d.Item, {
66
+ value: r.Append
67
+ }), /* @__PURE__ */ o(i.Item, {
67
68
  label: n.formatMessage(l.clearAndReplace),
68
- value: i.ClearAndReplace
69
- }), /* @__PURE__ */ o(d.Item, {
69
+ value: r.ClearAndReplace
70
+ }), /* @__PURE__ */ o(i.Item, {
70
71
  label: n.formatMessage(l.removeEntered),
71
- value: i.RemoveEntered
72
- }), /* @__PURE__ */ o(d.Item, {
72
+ value: r.RemoveEntered
73
+ }), /* @__PURE__ */ o(i.Item, {
73
74
  label: n.formatMessage(l.replaceEntered),
74
- value: i.ReplaceEntered
75
+ value: r.ReplaceEntered
75
76
  })]
76
77
  })
77
- }), y(v) && r && /* @__PURE__ */ o("div", {
78
+ }), j(v) && s && /* @__PURE__ */ o("div", {
78
79
  className: t.additionalFieldContainer,
79
- children: /* @__PURE__ */ _.cloneElement(r, {
80
+ children: /* @__PURE__ */ C.cloneElement(s, {
80
81
  // This field edits ${fieldNamePrefix}.updateMode.value, the '.value' is added by the field component
81
82
  updateModePrefix: `${a}.updateMode`,
82
- options: b,
83
+ options: I,
83
84
  label: n.formatMessage(l.with)
84
85
  })
85
86
  })]
86
87
  })]
87
88
  });
88
89
  };
89
- O.displayName = "UpdateModeFieldWrapper";
90
+ T.displayName = "UpdateModeFieldWrapper";
90
91
  export {
91
- O as UpdateModeFieldWrapper
92
+ T as UpdateModeFieldWrapper
92
93
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.80.4",
3
+ "version": "0.80.6",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.14",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "a0915a3746214234c39d00067ebf7fff64fae0cc"
56
+ "gitHead": "232199453ce176fabe32818df8d2fc599a3d9ae8"
57
57
  }
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from './lib/components/add-metadata-template-dropdown';
2
2
  export * from './lib/components/combobox-with-api-pagination';
3
3
  export * from './lib/components/filter-dropdown-menu';
4
4
  export * from './lib/components/filter-instances-dropdown';
5
+ export * from './lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils';
5
6
  export * from './lib/components/metadata-empty-state/metadata-empty-state';
6
7
  export * from './lib/components/metadata-instance-editor';
7
8
  export * from './lib/components/metadata-instance-list';
@@ -9,5 +10,5 @@ export * from './lib/components/unsaved-changes-modal';
9
10
  export * from './lib/defaults';
10
11
  export * from './lib/metadata-editor';
11
12
  export * from './lib/types';
12
- export * from './lib/utils/autofill-context';
13
13
  export * from './lib/utils/api-wrapper';
14
+ export * from './lib/utils/autofill-context';
@@ -0,0 +1,9 @@
1
+ export declare const MULTI_VALUE_DEFAULT_VALUE = "Multiple values";
2
+ export declare const MULTI_VALUE_DEFAULT_OPTION: {
3
+ id: string;
4
+ key: string;
5
+ };
6
+ export declare const MULTI_VALUE_DEFAULT_TAXONOMY_OPTION: {
7
+ id: string;
8
+ key: string;
9
+ };