@box/metadata-editor 0.92.7 → 0.93.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.
@@ -1,18 +1,18 @@
1
- import { Formik as _, Form as $ } from "formik";
2
- import { useState as C, useEffect as F, useRef as J, useMemo as q } from "react";
3
- import z from "clsx";
1
+ import _ from "clsx";
2
+ import { Formik as $, Form as J } from "formik";
3
+ import { useState as F, useEffect as M, useRef as q, useMemo as z } from "react";
4
4
  import { TEMPLATE_CUSTOM_PROPERTIES as G } from "../../../../constants.js";
5
- import { AutofillOverlay as H } from "../autofill-overlay/autofill-overlay.js";
6
- import { useAutofill as Q } from "../../../../utils/autofill-context.js";
7
- import { TemplateInstance as X } from "../../../metadata-editor-fields/metadata-editor-fields.js";
8
- import { MetadataEmptyState as Y } from "../../../metadata-empty-state/metadata-empty-state.js";
9
- import { UnsavedChangesModal as Z } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
5
+ import { useAutofill as H } from "../../../../utils/autofill-context.js";
6
+ import { TemplateInstance as Q } from "../../../metadata-editor-fields/metadata-editor-fields.js";
7
+ import { MetadataEmptyState as X } from "../../../metadata-empty-state/metadata-empty-state.js";
8
+ import { UnsavedChangesModal as Y } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
9
+ import { AutofillOverlay as Z } from "../autofill-overlay/autofill-overlay.js";
10
10
  import { CustomInstance as I } from "../custom-instance/custom-instance.js";
11
11
  import { DeleteConfirmationModal as T } from "../delete-confirmation-modal/delete-confirmation-modal.js";
12
12
  import { c as oo } from "../../../../../../chunks/utils.js";
13
- import { s as e, M as to } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
14
- import { jsx as r, jsxs as M } from "react/jsx-runtime";
15
- const Co = (E) => {
13
+ import { s as e, M as ro } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
14
+ import { jsx as t, jsxs as c } from "react/jsx-runtime";
15
+ const Fo = (E) => {
16
16
  const {
17
17
  areAiSuggestionsAvailable: S,
18
18
  customRef: i,
@@ -28,69 +28,69 @@ const Co = (E) => {
28
28
  onDelete: x,
29
29
  onDiscardUnsavedChanges: L,
30
30
  onSubmit: N,
31
- setIsUnsavedChangesModalOpen: l,
32
- taxonomyOptionsFetcher: f
33
- } = E, P = v ?? to, [R, u] = C(!1), {
31
+ setIsUnsavedChangesModalOpen: f,
32
+ taxonomyOptionsFetcher: l
33
+ } = E, P = v ?? ro, [R, u] = F(!1), {
34
34
  isFetchingSuggestions: a,
35
- isLongLoading: d,
35
+ isLongLoading: g,
36
36
  getAiSuggestions: U,
37
- clearState: g,
37
+ clearState: d,
38
38
  suggestions: B
39
- } = Q();
40
- F(() => () => {
41
- g();
42
- }, [g, o.id]);
43
- const p = (o == null ? void 0 : o.templateKey) === G, w = async (t) => {
44
- await N(t, oo(t, o));
45
- }, K = (t) => {
46
- t ? l(!0) : A();
39
+ } = H();
40
+ M(() => () => {
41
+ d();
42
+ }, [d, o == null ? void 0 : o.id]);
43
+ const p = (o == null ? void 0 : o.templateKey) === G, w = async (r) => {
44
+ await N(r, oo(r, o));
45
+ }, K = (r) => {
46
+ r ? f(!0) : A();
47
47
  }, W = () => {
48
48
  u(!0);
49
49
  }, j = {
50
50
  metadata: {
51
51
  ...o
52
52
  }
53
- }, h = J(null), [c, k] = C(null);
54
- F(() => {
53
+ }, h = q(null), [C, k] = F(null);
54
+ M(() => {
55
55
  k(i ?? h.current);
56
56
  }, [i, o == null ? void 0 : o.templateKey, o == null ? void 0 : o.scope]);
57
- const V = q(() => {
58
- const t = (o == null ? void 0 : o.fields.length) === 0;
57
+ const V = z(() => {
58
+ const r = (o == null ? void 0 : o.fields.length) === 0;
59
59
  if (p)
60
- return /* @__PURE__ */ r(I, {
60
+ return /* @__PURE__ */ t(I, {
61
61
  isLoading: a
62
62
  });
63
- if (t)
64
- return /* @__PURE__ */ r(Y, {
63
+ if (r)
64
+ return /* @__PURE__ */ t(X, {
65
65
  isBoxAiSuggestionsFeatureEnabled: s,
66
66
  level: "instance"
67
67
  });
68
68
  const n = !!(a || m);
69
- return /* @__PURE__ */ M("div", {
70
- className: z(e.metadataInstanceFormContent, n && e.showOverlay),
71
- children: [/* @__PURE__ */ r(H, {
69
+ return /* @__PURE__ */ c("div", {
70
+ className: _(e.metadataInstanceFormContent, n && e.showOverlay),
71
+ children: [/* @__PURE__ */ t(Z, {
72
72
  errorCode: m,
73
73
  isFetchingSuggestions: a,
74
- isLongLoading: d
75
- }), /* @__PURE__ */ r(X, {
74
+ isLongLoading: g
75
+ }), /* @__PURE__ */ t(Q, {
76
76
  disableForm: a,
77
- portalElement: i ?? c,
78
- taxonomyOptionsFetcher: f
77
+ portalElement: i ?? C,
78
+ taxonomyOptionsFetcher: l
79
79
  })]
80
80
  });
81
- }, [o == null ? void 0 : o.fields.length, p, a, d, i, c, f, s]);
82
- return /* @__PURE__ */ r(_, {
81
+ }, [o == null ? void 0 : o.fields.length, p, a, g, i, C, l, s]);
82
+ return /* @__PURE__ */ t($, {
83
83
  initialValues: j,
84
84
  onSubmit: w,
85
85
  children: ({
86
- values: t,
86
+ values: r,
87
87
  dirty: n
88
- }) => /* @__PURE__ */ M($, {
89
- children: [/* @__PURE__ */ r(P, {
88
+ }) => /* @__PURE__ */ c(J, {
89
+ children: [/* @__PURE__ */ t(P, {
90
90
  areAiSuggestionsAvailable: S,
91
91
  className: e.metadataInstanceForm,
92
92
  formRef: h,
93
- formValues: t,
93
+ formValues: r,
94
94
  getAiSuggestions: U,
95
95
  handleCancel: K,
96
96
  handleDelete: W,
@@ -103,11 +103,11 @@ const Co = (E) => {
103
103
  selectedTemplateInstance: o,
104
104
  suggestions: B,
105
105
  children: o && V
106
- }), /* @__PURE__ */ r(Z, {
107
- onBackToEdit: () => l(!1),
106
+ }), /* @__PURE__ */ t(Y, {
107
+ onBackToEdit: () => f(!1),
108
108
  onDiscardChanges: L,
109
109
  open: b
110
- }), /* @__PURE__ */ r(T, {
110
+ }), /* @__PURE__ */ t(T, {
111
111
  onConfirm: () => x(o),
112
112
  onDismiss: () => u(!1),
113
113
  open: R,
@@ -117,5 +117,5 @@ const Co = (E) => {
117
117
  }, `${o == null ? void 0 : o.scope}.${o == null ? void 0 : o.templateKey}`);
118
118
  };
119
119
  export {
120
- Co as MetadataInstanceForm
120
+ Fo as MetadataInstanceForm
121
121
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-editor",
3
- "version": "0.92.7",
3
+ "version": "0.93.0",
4
4
  "peerDependencies": {
5
5
  "@ariakit/react": "0.4.15",
6
6
  "@box/blueprint-web": "^7.30.3",
@@ -14,8 +14,8 @@
14
14
  "devDependencies": {
15
15
  "@ariakit/react": "0.4.15",
16
16
  "@box/babel-plugin-target-attributes": "1.3.0",
17
- "@box/blueprint-web": "^9.18.4",
18
- "@box/blueprint-web-assets": "^4.33.2",
17
+ "@box/blueprint-web": "^9.18.5",
18
+ "@box/blueprint-web-assets": "^4.34.0",
19
19
  "@box/storybook-utils": "^0.8.3",
20
20
  "@testing-library/react": "^15.0.6",
21
21
  "react": "^18.3.0",
@@ -53,5 +53,5 @@
53
53
  "**/*.css"
54
54
  ],
55
55
  "license": "SEE LICENSE IN LICENSE",
56
- "gitHead": "d7f83c86ae66cd916b95f273500e784040c3105e"
56
+ "gitHead": "4186e6a642af66984f1fb57cad2b9188d4b8f89a"
57
57
  }