@box/metadata-editor 0.52.8 → 0.52.10
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/chunks/metadata-editor-field-wrapper.js +26 -24
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +24 -20
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.js +12 -10
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +52 -51
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-footer/metadata-instance-form-footer.js +15 -18
- package/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js +25 -28
- package/package.json +3 -3
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.d.ts +1 -1
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/types.d.ts +5 -1
- package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.d.ts +5 -2
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/types.d.ts +0 -1
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.d.ts +1 -1
- package/types/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/types.d.ts +2 -1
@@ -1,18 +1,18 @@
|
|
1
1
|
import "../styles/metadata-editor-field-wrapper.css";
|
2
|
-
import
|
3
|
-
import { useFormikContext as
|
4
|
-
import
|
5
|
-
import { useState as
|
6
|
-
import { AiSuggestionField as
|
7
|
-
import { UpdateModeFieldWrapper as
|
8
|
-
import { editorFieldTypes as
|
9
|
-
import { jsx as o, jsxs as
|
10
|
-
const
|
11
|
-
noAttributesText:
|
12
|
-
fieldWrapper:
|
13
|
-
hasSuggestion:
|
14
|
-
error:
|
15
|
-
},
|
2
|
+
import x from "clsx";
|
3
|
+
import { useFormikContext as _ } from "formik";
|
4
|
+
import h from "lodash/isUndefined";
|
5
|
+
import { useState as A } from "react";
|
6
|
+
import { AiSuggestionField as v } from "../esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js";
|
7
|
+
import { UpdateModeFieldWrapper as k } from "../esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js";
|
8
|
+
import { editorFieldTypes as F } from "../esm/lib/components/metadata-editor-fields/editor-field-types.js";
|
9
|
+
import { jsx as o, jsxs as W } from "react/jsx-runtime";
|
10
|
+
const M = "_noAttributesText_vykxc_1", N = "_fieldWrapper_vykxc_5", T = "_hasSuggestion_vykxc_5", b = "_error_vykxc_13", u = {
|
11
|
+
noAttributesText: M,
|
12
|
+
fieldWrapper: N,
|
13
|
+
hasSuggestion: T,
|
14
|
+
error: b
|
15
|
+
}, R = ({
|
16
16
|
disableForm: n,
|
17
17
|
portalElement: a,
|
18
18
|
field: e,
|
@@ -20,11 +20,11 @@ const W = "_noAttributesText_vykxc_1", M = "_fieldWrapper_vykxc_5", N = "_hasSug
|
|
20
20
|
}) => {
|
21
21
|
const {
|
22
22
|
setFieldValue: d
|
23
|
-
} =
|
23
|
+
} = _(), [l, i] = A(!0), r = F[e.type], g = r && !e.hidden, m = !h(e.updateMode), s = `metadata.fields[${p}]`;
|
24
24
|
if (!g)
|
25
25
|
return null;
|
26
26
|
if (m)
|
27
|
-
return /* @__PURE__ */ o(
|
27
|
+
return /* @__PURE__ */ o(k, {
|
28
28
|
fieldNamePrefix: s,
|
29
29
|
fieldType: e.type,
|
30
30
|
children: /* @__PURE__ */ o(r, {
|
@@ -37,31 +37,33 @@ const W = "_noAttributesText_vykxc_1", M = "_fieldWrapper_vykxc_5", N = "_hasSug
|
|
37
37
|
}, e.key);
|
38
38
|
const {
|
39
39
|
aiSuggestion: t,
|
40
|
-
|
40
|
+
type: f,
|
41
|
+
value: y
|
41
42
|
} = e, c = t && l;
|
42
|
-
return /* @__PURE__ */
|
43
|
+
return /* @__PURE__ */ W("div", {
|
43
44
|
className: u.fieldWrapper,
|
44
45
|
children: [/* @__PURE__ */ o(r, {
|
45
|
-
className:
|
46
|
+
className: x(c && u.hasSuggestion),
|
46
47
|
description: e.description,
|
47
48
|
disableForm: n,
|
48
49
|
fieldNamePrefix: `metadata.fields[${p}]`,
|
49
50
|
label: e.displayName,
|
50
51
|
portalElement: a
|
51
|
-
}), c && /* @__PURE__ */ o(
|
52
|
+
}), c && /* @__PURE__ */ o(v, {
|
52
53
|
aiSuggestion: t,
|
53
54
|
onAiSuggestionAppend: () => {
|
54
|
-
const
|
55
|
-
d(`${s}.value`,
|
55
|
+
const S = e.type === "multiSelect" ? [y, t].flat() : t;
|
56
|
+
d(`${s}.value`, S), i(!1);
|
56
57
|
},
|
57
58
|
onAiSuggestionIgnore: () => i(!1),
|
58
59
|
onAiSuggestionReplace: () => {
|
59
60
|
d(`${s}.value`, t), i(!1);
|
60
|
-
}
|
61
|
+
},
|
62
|
+
type: f
|
61
63
|
})]
|
62
64
|
}, e.key);
|
63
65
|
};
|
64
66
|
export {
|
65
|
-
|
67
|
+
R as M,
|
66
68
|
u as s
|
67
69
|
};
|
@@ -1,23 +1,24 @@
|
|
1
1
|
import "../../../../../../styles/ai-suggestion-field.css";
|
2
2
|
import { Text as l, IconButton as c, DropdownMenu as r } from "@box/blueprint-web";
|
3
|
-
import { Checkmark as
|
4
|
-
import { useIntl as
|
3
|
+
import { Checkmark as u, Ellipsis as h } from "@box/blueprint-web-assets/icons/Fill";
|
4
|
+
import { useIntl as S, FormattedMessage as n } from "react-intl";
|
5
5
|
import t from "./messages.js";
|
6
|
-
import { formatSuggestionValue as
|
6
|
+
import { formatSuggestionValue as _ } from "./utils.js";
|
7
7
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
8
|
-
const
|
9
|
-
wrapperGradient:
|
10
|
-
wrapper:
|
11
|
-
buttons:
|
12
|
-
selectTrigger:
|
8
|
+
const f = "_wrapperGradient_1izxt_1", x = "_wrapper_1izxt_1", w = "_buttons_1izxt_18", b = "_selectTrigger_1izxt_22", o = {
|
9
|
+
wrapperGradient: f,
|
10
|
+
wrapper: x,
|
11
|
+
buttons: w,
|
12
|
+
selectTrigger: b
|
13
13
|
};
|
14
|
-
function
|
14
|
+
function N({
|
15
15
|
aiSuggestion: p,
|
16
|
-
onAiSuggestionAppend:
|
16
|
+
onAiSuggestionAppend: s,
|
17
17
|
onAiSuggestionReplace: g,
|
18
|
-
onAiSuggestionIgnore: m
|
18
|
+
onAiSuggestionIgnore: m,
|
19
|
+
type: d
|
19
20
|
}) {
|
20
|
-
const
|
21
|
+
const a = S();
|
21
22
|
return /* @__PURE__ */ e("div", {
|
22
23
|
className: o.wrapperGradient,
|
23
24
|
children: /* @__PURE__ */ i("div", {
|
@@ -32,25 +33,28 @@ function M({
|
|
32
33
|
})
|
33
34
|
}), /* @__PURE__ */ e(l, {
|
34
35
|
as: "p",
|
35
|
-
children:
|
36
|
+
children: _(p, {
|
37
|
+
type: d,
|
38
|
+
locale: a.locale
|
39
|
+
})
|
36
40
|
})]
|
37
41
|
}), /* @__PURE__ */ i("div", {
|
38
42
|
className: o.buttons,
|
39
43
|
children: [/* @__PURE__ */ e(c, {
|
40
|
-
"aria-label":
|
41
|
-
icon:
|
42
|
-
onClick:
|
44
|
+
"aria-label": a.formatMessage(t.aiSuggestionAppend),
|
45
|
+
icon: u,
|
46
|
+
onClick: s,
|
43
47
|
size: "x-small"
|
44
48
|
}), /* @__PURE__ */ i(r.Root, {
|
45
49
|
children: [/* @__PURE__ */ e(r.Trigger, {
|
46
50
|
className: o.selectTrigger,
|
47
51
|
children: /* @__PURE__ */ e(c, {
|
48
|
-
"aria-label":
|
49
|
-
icon:
|
52
|
+
"aria-label": a.formatMessage(t.aiSuggestionOptions),
|
53
|
+
icon: h
|
50
54
|
})
|
51
55
|
}), /* @__PURE__ */ i(r.Content, {
|
52
56
|
children: [/* @__PURE__ */ e(r.Item, {
|
53
|
-
onSelect:
|
57
|
+
onSelect: s,
|
54
58
|
children: /* @__PURE__ */ e(n, {
|
55
59
|
...t.aiSuggestionAppend
|
56
60
|
})
|
@@ -72,5 +76,5 @@ function M({
|
|
72
76
|
});
|
73
77
|
}
|
74
78
|
export {
|
75
|
-
|
79
|
+
N as AiSuggestionField
|
76
80
|
};
|
@@ -1,13 +1,15 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
if (
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
import { DateFormatter as i } from "@box/blueprint-web";
|
2
|
+
function f(r, {
|
3
|
+
type: n = "string",
|
4
|
+
locale: e = "en"
|
5
|
+
} = {}) {
|
6
|
+
if (n === "date" && typeof r == "string") {
|
7
|
+
const t = new Date(r);
|
8
|
+
if (!isNaN(t.getTime()))
|
9
|
+
return new i(e).format(t);
|
10
|
+
}
|
11
|
+
return r == null ? null : typeof r == "number" ? r.toString() : Array.isArray(r) ? r.join(", ") : r;
|
10
12
|
}
|
11
13
|
export {
|
12
|
-
|
14
|
+
f as formatSuggestionValue
|
13
15
|
};
|
@@ -1,92 +1,93 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form.css";
|
2
|
-
import { Card as
|
3
|
-
import { Formik as
|
4
|
-
import { useState as d, useRef as
|
2
|
+
import { Card as O } from "@box/blueprint-web";
|
3
|
+
import { Formik as N, Form as T } from "formik";
|
4
|
+
import { useState as d, useRef as v, useEffect as P, useMemo as U } from "react";
|
5
5
|
import { TEMPLATE_CUSTOM_PROPERTIES as _ } from "../../../../constants.js";
|
6
6
|
import { useAutofill as x } from "../../../../utils/autofill-context.js";
|
7
|
-
import { TemplateInstance as
|
8
|
-
import { MetadataEmptyState as
|
9
|
-
import { UnsavedChangesModal as
|
10
|
-
import { CustomInstance as
|
11
|
-
import { DeleteConfirmationModal as
|
12
|
-
import { MetadataInstanceFormFooter as
|
13
|
-
import { MetadataInstanceFormHeader as
|
14
|
-
import { createJSONPatch as
|
7
|
+
import { TemplateInstance as L } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
8
|
+
import { MetadataEmptyState as R } from "../../../metadata-empty-state/metadata-empty-state.js";
|
9
|
+
import { UnsavedChangesModal as j } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
10
|
+
import { CustomInstance as k } from "../custom-instance/custom-instance.js";
|
11
|
+
import { DeleteConfirmationModal as w } from "../delete-confirmation-modal/delete-confirmation-modal.js";
|
12
|
+
import { MetadataInstanceFormFooter as B } from "../metadata-instance-form-footer/metadata-instance-form-footer.js";
|
13
|
+
import { MetadataInstanceFormHeader as H } from "../metadata-instance-form-header/metadata-instance-form-header.js";
|
14
|
+
import { createJSONPatch as J } from "./utils.js";
|
15
15
|
import { jsx as n, jsxs as f } from "react/jsx-runtime";
|
16
|
-
const
|
17
|
-
metadataInstanceForm:
|
18
|
-
},
|
16
|
+
const K = "_metadataInstanceForm_1hu4u_1", V = {
|
17
|
+
metadataInstanceForm: K
|
18
|
+
}, ie = (p) => {
|
19
19
|
const {
|
20
20
|
isAiSuggestionsFeatureEnabled: o,
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
onSubmit: F,
|
21
|
+
isUnsavedChangesModalOpen: u = !1,
|
22
|
+
onCancel: g,
|
23
|
+
onDelete: C,
|
24
|
+
onSubmit: h,
|
26
25
|
selectedTemplateInstance: e,
|
27
26
|
setIsUnsavedChangesModalOpen: s,
|
28
|
-
onUnsavedChangesModalCancel:
|
29
|
-
} = p, [
|
30
|
-
isFetchingSuggestions:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
27
|
+
onUnsavedChangesModalCancel: F
|
28
|
+
} = p, [M, m] = d(!1), {
|
29
|
+
isFetchingSuggestions: a,
|
30
|
+
getAiSuggestions: S
|
31
|
+
} = x(), i = e.templateKey === _, r = async (t) => {
|
32
|
+
await h(t, J(t, e)), s(!1);
|
33
|
+
}, I = (t) => {
|
34
|
+
t ? s(!0) : g();
|
35
|
+
}, E = () => {
|
36
36
|
m(!0);
|
37
|
-
},
|
37
|
+
}, A = {
|
38
38
|
metadata: {
|
39
39
|
...e
|
40
40
|
}
|
41
|
-
}, l =
|
41
|
+
}, l = v(null), [c, D] = d(null);
|
42
42
|
P(() => {
|
43
|
-
|
43
|
+
D(l.current);
|
44
44
|
}, []);
|
45
|
-
const
|
45
|
+
const b = U(() => {
|
46
46
|
const t = e.fields.length === 0;
|
47
|
-
return i ? /* @__PURE__ */ n(
|
47
|
+
return i ? /* @__PURE__ */ n(k, {
|
48
48
|
isLoading: a
|
49
|
-
}) : t ? /* @__PURE__ */ n(
|
49
|
+
}) : t ? /* @__PURE__ */ n(R, {
|
50
50
|
isBoxAiSuggestionsFeatureEnabled: o,
|
51
51
|
level: "instance"
|
52
|
-
}) : /* @__PURE__ */ n(
|
52
|
+
}) : /* @__PURE__ */ n(L, {
|
53
53
|
disableForm: a,
|
54
54
|
portalElement: c
|
55
55
|
});
|
56
56
|
}, [i, e.fields.length, a, o, c]);
|
57
|
-
return /* @__PURE__ */ n(
|
58
|
-
initialValues:
|
57
|
+
return /* @__PURE__ */ n(N, {
|
58
|
+
initialValues: A,
|
59
59
|
onSubmit: r,
|
60
60
|
children: ({
|
61
61
|
values: t,
|
62
|
-
dirty:
|
63
|
-
}) => /* @__PURE__ */ f(
|
64
|
-
children: [/* @__PURE__ */ f(
|
62
|
+
dirty: y
|
63
|
+
}) => /* @__PURE__ */ f(T, {
|
64
|
+
children: [/* @__PURE__ */ f(O, {
|
65
65
|
ref: l,
|
66
|
-
className:
|
67
|
-
children: [/* @__PURE__ */ n(
|
66
|
+
className: V.metadataInstanceForm,
|
67
|
+
children: [/* @__PURE__ */ n(H, {
|
68
68
|
isAiSuggestionsFeatureEnabled: o && !i,
|
69
69
|
isLoading: a,
|
70
|
+
onAutofill: S,
|
70
71
|
templateName: e.displayName
|
71
|
-
}),
|
72
|
+
}), b, /* @__PURE__ */ n(B, {
|
72
73
|
isLoading: a,
|
73
|
-
onCancel: () =>
|
74
|
-
onDelete:
|
74
|
+
onCancel: () => I(y),
|
75
|
+
onDelete: E
|
75
76
|
})]
|
76
|
-
}), /* @__PURE__ */ n(
|
77
|
-
onCancel:
|
77
|
+
}), /* @__PURE__ */ n(j, {
|
78
|
+
onCancel: F,
|
78
79
|
onDismiss: () => s(!1),
|
79
80
|
onSaveAndContinue: () => r(t),
|
80
|
-
open:
|
81
|
-
}), /* @__PURE__ */ n(
|
82
|
-
onConfirm: () =>
|
81
|
+
open: u
|
82
|
+
}), /* @__PURE__ */ n(w, {
|
83
|
+
onConfirm: () => C(e),
|
83
84
|
onDismiss: () => m(!1),
|
84
|
-
open:
|
85
|
+
open: M,
|
85
86
|
templateName: e.displayName
|
86
87
|
})]
|
87
88
|
})
|
88
89
|
});
|
89
90
|
};
|
90
91
|
export {
|
91
|
-
|
92
|
+
ie as MetadataInstanceForm
|
92
93
|
};
|
@@ -1,35 +1,32 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form-footer.css";
|
2
|
-
import { TextButton as
|
3
|
-
import { useFormikContext as
|
2
|
+
import { TextButton as u, Button as r } from "@box/blueprint-web";
|
3
|
+
import { useFormikContext as b } from "formik";
|
4
4
|
import { useIntl as F } from "react-intl";
|
5
|
-
import { useAutofill as f } from "../../../../utils/autofill-context.js";
|
6
5
|
import o from "./messages.js";
|
7
6
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
8
|
-
const
|
9
|
-
metadataInstanceFormFooter:
|
10
|
-
buttonsContainer:
|
11
|
-
buttons:
|
12
|
-
},
|
7
|
+
const g = "_metadataInstanceFormFooter_17478_1", f = "_buttonsContainer_17478_8", _ = "_buttons_17478_8", a = {
|
8
|
+
metadataInstanceFormFooter: g,
|
9
|
+
buttonsContainer: f,
|
10
|
+
buttons: _
|
11
|
+
}, x = ({
|
13
12
|
isLoading: m,
|
14
13
|
onCancel: c,
|
15
14
|
onDelete: l
|
16
15
|
}) => {
|
17
16
|
const t = F(), {
|
18
|
-
isSubmitting:
|
17
|
+
isSubmitting: s,
|
19
18
|
submitForm: d
|
20
|
-
} =
|
21
|
-
isFetchingSuggestions: u
|
22
|
-
} = f(), n = m || a || u;
|
19
|
+
} = b(), n = m || s;
|
23
20
|
return /* @__PURE__ */ e("div", {
|
24
|
-
className:
|
21
|
+
className: a.metadataInstanceFormFooter,
|
25
22
|
children: /* @__PURE__ */ i("div", {
|
26
|
-
className:
|
27
|
-
children: [/* @__PURE__ */ e(
|
23
|
+
className: a.buttonsContainer,
|
24
|
+
children: [/* @__PURE__ */ e(u, {
|
28
25
|
disabled: n,
|
29
26
|
onClick: l,
|
30
27
|
children: t.formatMessage(o.deleteButton)
|
31
28
|
}), /* @__PURE__ */ i("div", {
|
32
|
-
className:
|
29
|
+
className: a.buttons,
|
33
30
|
children: [/* @__PURE__ */ e(r, {
|
34
31
|
disabled: n,
|
35
32
|
onClick: c,
|
@@ -38,7 +35,7 @@ const _ = "_metadataInstanceFormFooter_17478_1", p = "_buttonsContainer_17478_8"
|
|
38
35
|
children: t.formatMessage(o.cancelButton)
|
39
36
|
}), /* @__PURE__ */ e(r, {
|
40
37
|
disabled: n,
|
41
|
-
loading:
|
38
|
+
loading: s,
|
42
39
|
loadingAriaLabel: t.formatMessage(o.loadingAriaLabel),
|
43
40
|
onClick: d,
|
44
41
|
size: "large",
|
@@ -49,5 +46,5 @@ const _ = "_metadataInstanceFormFooter_17478_1", p = "_buttonsContainer_17478_8"
|
|
49
46
|
});
|
50
47
|
};
|
51
48
|
export {
|
52
|
-
|
49
|
+
x as MetadataInstanceFormFooter
|
53
50
|
};
|
@@ -1,43 +1,40 @@
|
|
1
1
|
import "../../../../../../styles/metadata-instance-form-header.css";
|
2
|
-
import { Text as h, Tooltip as
|
2
|
+
import { Text as h, Tooltip as F, Button as x } from "@box/blueprint-web";
|
3
3
|
import { BoxAiLogo as B } from "@box/blueprint-web-assets/icons/Logo";
|
4
|
-
import { useFormikContext as M, getIn as
|
4
|
+
import { useFormikContext as M, getIn as n } from "formik";
|
5
5
|
import { useIntl as _ } from "react-intl";
|
6
|
-
import { useAutofill as y } from "../../../../utils/autofill-context.js";
|
7
6
|
import e from "./messages.js";
|
8
|
-
import { jsxs as
|
9
|
-
const
|
10
|
-
metadataInstanceFormHeader:
|
11
|
-
title:
|
12
|
-
},
|
13
|
-
isAiSuggestionsFeatureEnabled:
|
14
|
-
isLoading:
|
15
|
-
templateName: r
|
7
|
+
import { jsxs as y, jsx as a } from "react/jsx-runtime";
|
8
|
+
const H = "_metadataInstanceFormHeader_1b2cc_1", v = "_title_1b2cc_8", i = {
|
9
|
+
metadataInstanceFormHeader: H,
|
10
|
+
title: v
|
11
|
+
}, N = ({
|
12
|
+
isAiSuggestionsFeatureEnabled: l,
|
13
|
+
isLoading: o,
|
14
|
+
templateName: r,
|
15
|
+
onAutofill: m
|
16
16
|
}) => {
|
17
17
|
const {
|
18
|
-
isSubmitting:
|
19
|
-
values:
|
20
|
-
setFieldValue:
|
21
|
-
} = M(), {
|
22
|
-
|
23
|
-
|
24
|
-
} =
|
25
|
-
|
26
|
-
c("metadata.fields", b);
|
27
|
-
}, g = r ?? t.formatMessage(e.customInstanceTitle), p = m || u;
|
28
|
-
return /* @__PURE__ */ H("div", {
|
18
|
+
isSubmitting: c,
|
19
|
+
values: s,
|
20
|
+
setFieldValue: d
|
21
|
+
} = M(), t = _(), f = async () => {
|
22
|
+
const p = n(s, "metadata.fields"), I = n(s, "metadata.templateKey"), b = await m(I, p);
|
23
|
+
d("metadata.fields", b);
|
24
|
+
}, u = r ?? t.formatMessage(e.customInstanceTitle), g = c || o;
|
25
|
+
return /* @__PURE__ */ y("div", {
|
29
26
|
className: i.metadataInstanceFormHeader,
|
30
27
|
children: [/* @__PURE__ */ a(h, {
|
31
28
|
as: "h1",
|
32
29
|
className: i.title,
|
33
30
|
variant: "titleMedium",
|
34
|
-
children:
|
35
|
-
}),
|
31
|
+
children: u
|
32
|
+
}), l && /* @__PURE__ */ a(F, {
|
36
33
|
content: t.formatMessage(e.autofillButtonTooltip),
|
37
|
-
children: /* @__PURE__ */ a(
|
38
|
-
disabled:
|
34
|
+
children: /* @__PURE__ */ a(x, {
|
35
|
+
disabled: g,
|
39
36
|
icon: B,
|
40
|
-
loading:
|
37
|
+
loading: o,
|
41
38
|
loadingAriaLabel: t.formatMessage(e.loadingButtonAriaLabel),
|
42
39
|
onClick: f,
|
43
40
|
variant: "secondary",
|
@@ -47,5 +44,5 @@ const v = "_metadataInstanceFormHeader_1b2cc_1", S = "_title_1b2cc_8", i = {
|
|
47
44
|
});
|
48
45
|
};
|
49
46
|
export {
|
50
|
-
|
47
|
+
N as MetadataInstanceFormHeader
|
51
48
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.52.
|
3
|
+
"version": "0.52.10",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.20.0",
|
@@ -13,7 +13,7 @@
|
|
13
13
|
},
|
14
14
|
"devDependencies": {
|
15
15
|
"@ariakit/react": "0.4.5",
|
16
|
-
"@box/blueprint-web": "^7.29.
|
16
|
+
"@box/blueprint-web": "^7.29.2",
|
17
17
|
"@box/blueprint-web-assets": "^4.25.0",
|
18
18
|
"@box/storybook-utils": "^0.6.1",
|
19
19
|
"@testing-library/react": "^15.0.6",
|
@@ -52,5 +52,5 @@
|
|
52
52
|
"**/*.css"
|
53
53
|
],
|
54
54
|
"license": "SEE LICENSE IN LICENSE",
|
55
|
-
"gitHead": "
|
55
|
+
"gitHead": "0d9819fc38a244c6102693de49d13f092b173e08"
|
56
56
|
}
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { type AiSuggestionFieldProps } from './types';
|
2
|
-
export declare function AiSuggestionField({ aiSuggestion, onAiSuggestionAppend, onAiSuggestionReplace, onAiSuggestionIgnore, }: AiSuggestionFieldProps): import("react/jsx-runtime").JSX.Element;
|
2
|
+
export declare function AiSuggestionField({ aiSuggestion, onAiSuggestionAppend, onAiSuggestionReplace, onAiSuggestionIgnore, type, }: AiSuggestionFieldProps): import("react/jsx-runtime").JSX.Element;
|
package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/types.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type MetadataFieldValue } from '../../../../types';
|
1
|
+
import { type MetadataFieldValue, type MetadataTemplateFieldType } from '../../../../types';
|
2
2
|
export interface AiSuggestionFieldProps {
|
3
3
|
/**
|
4
4
|
* Represents the AI suggestion to be displayed or processed.
|
@@ -18,4 +18,8 @@ export interface AiSuggestionFieldProps {
|
|
18
18
|
* This function does not accept any parameters and does not return any value.
|
19
19
|
*/
|
20
20
|
onAiSuggestionIgnore: () => void;
|
21
|
+
/**
|
22
|
+
* Type of the metadata field to display the suggestion for.
|
23
|
+
*/
|
24
|
+
type: MetadataTemplateFieldType;
|
21
25
|
}
|
package/types/lib/components/metadata-editor-fields/components/ai-suggestion-field/utils.d.ts
CHANGED
@@ -1,3 +1,6 @@
|
|
1
1
|
import { type ReactElement } from 'react';
|
2
|
-
import { type MetadataFieldValue } from '../../../../types';
|
3
|
-
export declare function formatSuggestionValue(value: MetadataFieldValue
|
2
|
+
import { type MetadataFieldValue, type MetadataTemplateFieldType } from '../../../../types';
|
3
|
+
export declare function formatSuggestionValue(value: MetadataFieldValue, { type, locale }?: {
|
4
|
+
type?: MetadataTemplateFieldType;
|
5
|
+
locale?: string;
|
6
|
+
}): null | ReactElement | string;
|
@@ -2,7 +2,6 @@ import { type MetadataTemplateInstance } from '../../../../types';
|
|
2
2
|
import { type FormValues } from '../../types';
|
3
3
|
export type MetadataInstanceFormProps = {
|
4
4
|
isAiSuggestionsFeatureEnabled: boolean;
|
5
|
-
isLoading: boolean;
|
6
5
|
isUnsavedChangesModalOpen: boolean;
|
7
6
|
/** The MetadataTemplate is used when creating a new instance, while MetadataTemplateInstance is applied when editing an existing one. */
|
8
7
|
selectedTemplateInstance: MetadataTemplateInstance;
|
@@ -1,2 +1,2 @@
|
|
1
1
|
import { type MetadataInstanceFormHeaderProps } from './types';
|
2
|
-
export declare const MetadataInstanceFormHeader: ({ isAiSuggestionsFeatureEnabled, isLoading, templateName, }: MetadataInstanceFormHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
2
|
+
export declare const MetadataInstanceFormHeader: ({ isAiSuggestionsFeatureEnabled, isLoading, templateName, onAutofill, }: MetadataInstanceFormHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,6 +1,7 @@
|
|
1
|
+
import { type MetadataTemplateField, type MetadataTemplateInstance } from '../../../../types';
|
1
2
|
export type MetadataInstanceFormHeaderProps = {
|
2
3
|
isAiSuggestionsFeatureEnabled: boolean;
|
3
4
|
isLoading: boolean;
|
4
|
-
onAutofill?: () =>
|
5
|
+
onAutofill?: (templateKey: MetadataTemplateInstance['templateKey'], fields: MetadataTemplateField[]) => Promise<MetadataTemplateField[]>;
|
5
6
|
templateName?: string;
|
6
7
|
};
|