@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
|
2
|
-
import {
|
3
|
-
import z from "
|
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 {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
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
|
14
|
-
import { jsx as
|
15
|
-
const
|
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:
|
32
|
-
taxonomyOptionsFetcher:
|
33
|
-
} = E, P = v ??
|
31
|
+
setIsUnsavedChangesModalOpen: f,
|
32
|
+
taxonomyOptionsFetcher: l
|
33
|
+
} = E, P = v ?? ro, [R, u] = F(!1), {
|
34
34
|
isFetchingSuggestions: a,
|
35
|
-
isLongLoading:
|
35
|
+
isLongLoading: g,
|
36
36
|
getAiSuggestions: U,
|
37
|
-
clearState:
|
37
|
+
clearState: d,
|
38
38
|
suggestions: B
|
39
|
-
} =
|
40
|
-
|
41
|
-
|
42
|
-
}, [
|
43
|
-
const p = (o == null ? void 0 : o.templateKey) === G, w = async (
|
44
|
-
await N(
|
45
|
-
}, K = (
|
46
|
-
|
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 =
|
54
|
-
|
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 =
|
58
|
-
const
|
57
|
+
const V = z(() => {
|
58
|
+
const r = (o == null ? void 0 : o.fields.length) === 0;
|
59
59
|
if (p)
|
60
|
-
return /* @__PURE__ */
|
60
|
+
return /* @__PURE__ */ t(I, {
|
61
61
|
isLoading: a
|
62
62
|
});
|
63
|
-
if (
|
64
|
-
return /* @__PURE__ */
|
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__ */
|
70
|
-
className:
|
71
|
-
children: [/* @__PURE__ */
|
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:
|
75
|
-
}), /* @__PURE__ */
|
74
|
+
isLongLoading: g
|
75
|
+
}), /* @__PURE__ */ t(Q, {
|
76
76
|
disableForm: a,
|
77
|
-
portalElement: i ??
|
78
|
-
taxonomyOptionsFetcher:
|
77
|
+
portalElement: i ?? C,
|
78
|
+
taxonomyOptionsFetcher: l
|
79
79
|
})]
|
80
80
|
});
|
81
|
-
}, [o == null ? void 0 : o.fields.length, p, a,
|
82
|
-
return /* @__PURE__ */
|
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:
|
86
|
+
values: r,
|
87
87
|
dirty: n
|
88
|
-
}) => /* @__PURE__ */
|
89
|
-
children: [/* @__PURE__ */
|
88
|
+
}) => /* @__PURE__ */ c(J, {
|
89
|
+
children: [/* @__PURE__ */ t(P, {
|
90
90
|
areAiSuggestionsAvailable: S,
|
91
91
|
className: e.metadataInstanceForm,
|
92
92
|
formRef: h,
|
93
|
-
formValues:
|
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__ */
|
107
|
-
onBackToEdit: () =>
|
106
|
+
}), /* @__PURE__ */ t(Y, {
|
107
|
+
onBackToEdit: () => f(!1),
|
108
108
|
onDiscardChanges: L,
|
109
109
|
open: b
|
110
|
-
}), /* @__PURE__ */
|
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
|
-
|
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.
|
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.
|
18
|
-
"@box/blueprint-web-assets": "^4.
|
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": "
|
56
|
+
"gitHead": "4186e6a642af66984f1fb57cad2b9188d4b8f89a"
|
57
57
|
}
|