@box/metadata-editor 0.50.1 → 0.50.3

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,31 +1,35 @@
1
- import { AddMetadataTemplateDropdown as a } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
1
+ import { AddMetadataTemplateDropdown as o } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
2
2
  import { FilterDropdownMenu as r } from "./lib/components/filter-dropdown-menu/index.js";
3
3
  import { MetadataEmptyState as m } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
4
- import { DeleteConfirmationModal as p } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
5
- import { MetadataInstanceFormHeader as x } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
6
- import { CustomInstanceNewField as M } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
7
- import { MetadataInstanceForm as i } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
4
+ import { DeleteConfirmationModal as f } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
5
+ import { MetadataInstanceFormHeader as l } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
6
+ import { CustomInstanceNewField as i } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
7
+ import { MetadataInstanceForm as s } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
8
8
  import { MetadataInstanceList as I } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
9
- import { MetadataInstanceHeader as F } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
10
- import { SingleLevelTaxonomyField as C } from "./lib/components/metadata-taxonomy-field/single-level-taxonomy-field.js";
11
- import { UnsavedChangesModal as U } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
12
- import { defaultInitialValues as v, defaultMetadataValueMap as y } from "./lib/defaults.js";
13
- import { MetadataEditor as H } from "./lib/metadata-editor.js";
14
- import { U as S } from "../chunks/types.js";
9
+ import { MetadataInstanceHeader as C } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
10
+ import { SingleLevelTaxonomyField as A } from "./lib/components/metadata-taxonomy-field/single-level-taxonomy-field.js";
11
+ import { UnsavedChangesModal as w } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
12
+ import { defaultInitialValues as U, defaultMetadataValueMap as g } from "./lib/defaults.js";
13
+ import { MetadataEditor as E } from "./lib/metadata-editor.js";
14
+ import { U as L } from "../chunks/types.js";
15
+ import { AutofillContext as T, AutofillContextProvider as V, useAutofill as h } from "./lib/utils/autofill-context.js";
15
16
  export {
16
- a as AddMetadataTemplateDropdown,
17
- M as CustomInstanceNewField,
18
- p as DeleteConfirmationModal,
17
+ o as AddMetadataTemplateDropdown,
18
+ T as AutofillContext,
19
+ V as AutofillContextProvider,
20
+ i as CustomInstanceNewField,
21
+ f as DeleteConfirmationModal,
19
22
  r as FilterDropdownMenu,
20
- H as MetadataEditor,
23
+ E as MetadataEditor,
21
24
  m as MetadataEmptyState,
22
- i as MetadataInstanceForm,
23
- x as MetadataInstanceFormHeader,
24
- F as MetadataInstanceHeader,
25
+ s as MetadataInstanceForm,
26
+ l as MetadataInstanceFormHeader,
27
+ C as MetadataInstanceHeader,
25
28
  I as MetadataInstanceList,
26
- C as SingleLevelTaxonomyField,
27
- U as UnsavedChangesModal,
28
- S as UpdateMode,
29
- v as defaultInitialValues,
30
- y as defaultMetadataValueMap
29
+ A as SingleLevelTaxonomyField,
30
+ w as UnsavedChangesModal,
31
+ L as UpdateMode,
32
+ U as defaultInitialValues,
33
+ g as defaultMetadataValueMap,
34
+ h as useAutofill
31
35
  };
@@ -1,10 +1,10 @@
1
1
  import "../../../../../../styles/metadata-instance-form.css";
2
2
  import { Card as b } from "@box/blueprint-web";
3
3
  import { Formik as O } from "formik";
4
- import { useState as v, useMemo as y } from "react";
5
- import { TEMPLATE_CUSTOM_PROPERTIES as A } from "../../../../constants.js";
6
- import { useAutofill as N } from "../../../../utils/autofill-context.js";
7
- import { TemplateInstance as T } from "../../../metadata-editor-fields/metadata-editor-fields.js";
4
+ import { useState as y, useMemo as A } from "react";
5
+ import { TEMPLATE_CUSTOM_PROPERTIES as N } from "../../../../constants.js";
6
+ import { useAutofill as T } from "../../../../utils/autofill-context.js";
7
+ import { TemplateInstance as v } from "../../../metadata-editor-fields/metadata-editor-fields.js";
8
8
  import { MetadataEmptyState as L } from "../../../metadata-empty-state/metadata-empty-state.js";
9
9
  import { UnsavedChangesModal as U } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
10
10
  import { CustomInstance as _ } from "../custom-instance/custom-instance.js";
@@ -12,7 +12,7 @@ import { DeleteConfirmationModal as x } from "../delete-confirmation-modal/delet
12
12
  import { MetadataInstanceFormFooter as P } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
13
13
  import { MetadataInstanceFormHeader as j } from "../metadata-instance-form-header/metadata-instance-form-header.js";
14
14
  import { createJSONPatch as R } from "./utils.js";
15
- import { jsx as t, jsxs as l, Fragment as k } from "react/jsx-runtime";
15
+ import { jsx as a, jsxs as l, Fragment as k } from "react/jsx-runtime";
16
16
  const B = "_metadataInstanceForm_1hu4u_1", H = {
17
17
  metadataInstanceForm: B
18
18
  }, ae = (d) => {
@@ -26,53 +26,53 @@ const B = "_metadataInstanceForm_1hu4u_1", H = {
26
26
  selectedTemplateInstance: e,
27
27
  setIsUnsavedChangesModalOpen: s,
28
28
  onUnsavedChangesModalCancel: C
29
- } = d, [h, m] = v(!1), {
29
+ } = d, [h, m] = y(!1), {
30
30
  isFetchingSuggestions: F
31
- } = N(), n = c || F, i = e.templateKey === A, r = (a) => {
32
- g(e.id, R(a, e)), s(!1);
33
- }, M = (a) => {
34
- a ? s(!0) : f();
31
+ } = T(), n = c || F, i = e.templateKey === N, r = (t) => {
32
+ g(t, R(t, e)), s(!1);
33
+ }, M = (t) => {
34
+ t ? s(!0) : f();
35
35
  }, I = () => {
36
36
  m(!0);
37
37
  }, S = {
38
38
  metadata: {
39
39
  ...e
40
40
  }
41
- }, D = y(() => {
42
- const a = e.fields.length === 0;
43
- return i ? /* @__PURE__ */ t(_, {
41
+ }, D = A(() => {
42
+ const t = e.fields.length === 0;
43
+ return i ? /* @__PURE__ */ a(_, {
44
44
  isLoading: n
45
- }) : a ? /* @__PURE__ */ t(L, {
45
+ }) : t ? /* @__PURE__ */ a(L, {
46
46
  isBoxAiSuggestionsFeatureEnabled: o,
47
47
  level: "instance"
48
- }) : /* @__PURE__ */ t(T, {
48
+ }) : /* @__PURE__ */ a(v, {
49
49
  disableForm: n
50
50
  });
51
51
  }, [i, e.fields.length, n, o]);
52
- return /* @__PURE__ */ t(O, {
52
+ return /* @__PURE__ */ a(O, {
53
53
  initialValues: S,
54
54
  onSubmit: r,
55
55
  children: ({
56
- values: a,
56
+ values: t,
57
57
  dirty: E
58
58
  }) => /* @__PURE__ */ l(k, {
59
59
  children: [/* @__PURE__ */ l(b, {
60
60
  className: H.metadataInstanceForm,
61
- children: [/* @__PURE__ */ t(j, {
61
+ children: [/* @__PURE__ */ a(j, {
62
62
  isAiSuggestionsFeatureEnabled: o && !i,
63
63
  isLoading: n,
64
64
  templateName: e.displayName
65
- }), D, /* @__PURE__ */ t(P, {
65
+ }), D, /* @__PURE__ */ a(P, {
66
66
  isLoading: n,
67
67
  onCancel: () => M(E),
68
68
  onDelete: I
69
69
  })]
70
- }), /* @__PURE__ */ t(U, {
70
+ }), /* @__PURE__ */ a(U, {
71
71
  onCancel: C,
72
72
  onDismiss: () => s(!1),
73
- onSaveAndContinue: () => r(a),
73
+ onSaveAndContinue: () => r(t),
74
74
  open: p
75
- }), /* @__PURE__ */ t(x, {
75
+ }), /* @__PURE__ */ a(x, {
76
76
  onConfirm: () => u(e.id),
77
77
  onDismiss: () => m(!1),
78
78
  open: h,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.50.1",
3
+ "version": "0.50.3",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.5",
6
6
  "@box/blueprint-web": "^7.20.0",
@@ -13,8 +13,8 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.5",
16
- "@box/blueprint-web": "^7.24.1",
17
- "@box/blueprint-web-assets": "^4.21.5",
16
+ "@box/blueprint-web": "^7.25.0",
17
+ "@box/blueprint-web-assets": "^4.22.0",
18
18
  "@box/storybook-utils": "^0.6.1",
19
19
  "@testing-library/react": "^15.0.6",
20
20
  "react": "^18.3.0",
@@ -52,5 +52,5 @@
52
52
  "**/*.css"
53
53
  ],
54
54
  "license": "SEE LICENSE IN LICENSE",
55
- "gitHead": "8463bedb52cb3c061d48d6608e22d9aa0a7d2bfb"
55
+ "gitHead": "be431fa97e1dcbe48c7720e44c90f6f8f291d913"
56
56
  }
package/types/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from './lib/components/unsaved-changes-modal';
8
8
  export * from './lib/defaults';
9
9
  export * from './lib/metadata-editor';
10
10
  export * from './lib/types';
11
+ export * from './lib/utils/autofill-context';
@@ -1,13 +1,13 @@
1
- import { type MetadataTemplate, type MetadataTemplateInstance } from '../../../../types';
1
+ import { type MetadataTemplateInstance } from '../../../../types';
2
+ import { type FormValues } from '../../types';
2
3
  export type MetadataInstanceFormProps = {
3
4
  isAiSuggestionsFeatureEnabled: boolean;
4
5
  isLoading: boolean;
5
6
  isUnsavedChangesModalOpen: boolean;
6
- /** The MetadataTemplate is used when creating a new instance, while MetadataTemplateInstance is applied when editing an existing one. */
7
- selectedTemplateInstance: MetadataTemplateInstance | MetadataTemplate;
7
+ selectedTemplateInstance: MetadataTemplateInstance;
8
8
  onCancel: () => void;
9
9
  onDelete: (id: string) => void;
10
- onSubmit: (id: string, operations: JSONPatchOperations) => void;
10
+ onSubmit: (values: FormValues, operations: JSONPatchOperations) => void;
11
11
  setIsUnsavedChangesModalOpen: (isUnsavedChangesModalOpen: boolean) => void;
12
12
  /** Callback invoked when clicking Cancel button on the UnsavedChangesModal - can be used to reset form values */
13
13
  onUnsavedChangesModalCancel?: () => void;
@@ -1,4 +1,4 @@
1
- import { type MetadataTemplate, type MetadataTemplateInstance } from '../../../../types';
1
+ import { type MetadataTemplateInstance } from '../../../../types';
2
2
  import { type FormValues } from '../../types';
3
3
  import { type JSONPatchOperations } from './types';
4
4
  /**
@@ -9,4 +9,4 @@ import { type JSONPatchOperations } from './types';
9
9
  * @param formValues
10
10
  * @param originalData
11
11
  */
12
- export declare const createJSONPatch: (formValues: FormValues, originalData: MetadataTemplateInstance | MetadataTemplate) => JSONPatchOperations;
12
+ export declare const createJSONPatch: (formValues: FormValues, originalData: MetadataTemplateInstance) => JSONPatchOperations;