@box/metadata-editor 1.15.3 → 1.16.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.
- package/dist/chunks/filter-dropdown-menu.module.js +9 -12
- package/dist/chunks/metadata-instance-form-card-wrapper.js +32 -32
- package/dist/chunks/taxonomy-ancestor-status-pill.js +37 -38
- package/dist/chunks/types.js +3 -3
- package/dist/chunks/utils2.js +28 -30
- package/dist/esm/lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js +93 -96
- package/dist/esm/lib/components/combobox-with-api-pagination/request.js +2 -2
- package/dist/esm/lib/components/combobox-with-api-pagination/use-async-list.js +3 -4
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-controllable-state.js +21 -24
- package/dist/esm/lib/components/combobox-with-api-pagination/utils/use-intersection-observer.js +59 -61
- package/dist/esm/lib/components/filter-instances-dropdown/filter-instances-dropdown.js +39 -40
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-enum-field/metadata-enum-field.js +37 -37
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-float-field/use-float-validation.js +9 -9
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +35 -36
- package/dist/esm/lib/components/metadata-editor-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +52 -52
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-field-wrapper.js +22 -23
- package/dist/esm/lib/components/metadata-editor-fields/metadata-editor-fields.js +1 -2
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/autofill-overlay/autofill-overlay.js +31 -32
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/custom-instance/custom-instance.js +22 -22
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js +114 -114
- package/dist/esm/lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js +96 -98
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance/metadata-instance.js +29 -29
- package/dist/esm/lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js +39 -40
- package/dist/esm/lib/constants.js +3 -3
- package/dist/i18n/en-x-pseudo.js +129 -129
- package/dist/i18n/en-x-pseudo.properties +129 -129
- package/dist/styles/autofill-overlay.css +1 -1
- package/dist/styles/filter-dropdown-menu.css +1 -1
- package/dist/styles/taxonomy-ancestor-status-pill.css +1 -1
- package/package.json +9 -9
|
@@ -1,143 +1,143 @@
|
|
|
1
1
|
import "../custom-instance-new-field/custom-instance-new-field.js";
|
|
2
|
-
import { DeleteConfirmationModal as
|
|
2
|
+
import { DeleteConfirmationModal as J } from "../delete-confirmation-modal/delete-confirmation-modal.js";
|
|
3
3
|
import "../metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
|
|
4
4
|
import "../metadata-instance-form-header/metadata-instance-form-header.js";
|
|
5
|
-
import
|
|
6
|
-
import { Formik as
|
|
7
|
-
import
|
|
8
|
-
import { useState as S, useEffect as y, useRef as O, useMemo as
|
|
9
|
-
import { TEMPLATE_CUSTOM_PROPERTIES as
|
|
10
|
-
import { useAutofill as
|
|
11
|
-
import { TemplateInstance as
|
|
12
|
-
import { MetadataEmptyState as
|
|
13
|
-
import { AutofillOverlay as
|
|
14
|
-
import { CustomInstance as
|
|
15
|
-
import { c as
|
|
16
|
-
import { s as
|
|
17
|
-
import { jsx as
|
|
18
|
-
import { UnsavedChangesModal as
|
|
19
|
-
const
|
|
20
|
-
dirty:
|
|
21
|
-
onChange:
|
|
22
|
-
values:
|
|
5
|
+
import z from "clsx";
|
|
6
|
+
import { Formik as G, Form as H } from "formik";
|
|
7
|
+
import Q from "lodash/isEqual";
|
|
8
|
+
import { useState as S, useEffect as y, useRef as O, useMemo as X } from "react";
|
|
9
|
+
import { TEMPLATE_CUSTOM_PROPERTIES as Y } from "../../../../constants.js";
|
|
10
|
+
import { useAutofill as Z } from "../../../../utils/autofill-context.js";
|
|
11
|
+
import { TemplateInstance as ee } from "../../../metadata-editor-fields/metadata-editor-fields.js";
|
|
12
|
+
import { MetadataEmptyState as te } from "../../../metadata-empty-state/metadata-empty-state.js";
|
|
13
|
+
import { AutofillOverlay as ae } from "../autofill-overlay/autofill-overlay.js";
|
|
14
|
+
import { CustomInstance as oe } from "../custom-instance/custom-instance.js";
|
|
15
|
+
import { c as ne } from "../../../../../../chunks/utils.js";
|
|
16
|
+
import { s as d, M as se } from "../../../../../../chunks/metadata-instance-form-card-wrapper.js";
|
|
17
|
+
import { jsx as o, jsxs as D } from "react/jsx-runtime";
|
|
18
|
+
import { UnsavedChangesModal as re } from "../../../unsaved-changes-modal/unsaved-changes-modal.js";
|
|
19
|
+
const ie = ({
|
|
20
|
+
dirty: i,
|
|
21
|
+
onChange: l,
|
|
22
|
+
values: t
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
-
},
|
|
24
|
+
const s = O(t);
|
|
25
|
+
return i && !Q(s.current.metadata.fields, t.metadata.fields) && (s.current = t, l(t)), null;
|
|
26
|
+
}, Ie = (i) => {
|
|
27
27
|
const {
|
|
28
|
-
areAiSuggestionsAvailable:
|
|
29
|
-
customRef:
|
|
30
|
-
isLargeFile:
|
|
31
|
-
errorCode:
|
|
32
|
-
isAiSuggestionsFeatureEnabled:
|
|
33
|
-
isAdvancedExtractAgentEnabled:
|
|
34
|
-
isBetaLanguageEnabled:
|
|
35
|
-
isDeleteButtonDisabled:
|
|
36
|
-
isDeleteConfirmationModalCheckboxEnabled:
|
|
37
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
38
|
-
isUnsavedChangesModalOpen:
|
|
39
|
-
MetadataInstanceFormCustomWrapper:
|
|
40
|
-
selectedTemplateInstance:
|
|
41
|
-
onCancel:
|
|
42
|
-
onChange:
|
|
43
|
-
onDelete:
|
|
44
|
-
onDiscardUnsavedChanges:
|
|
45
|
-
onSubmit:
|
|
46
|
-
setIsUnsavedChangesModalOpen:
|
|
47
|
-
taxonomyOptionsFetcher:
|
|
48
|
-
} =
|
|
49
|
-
isFetchingSuggestions:
|
|
28
|
+
areAiSuggestionsAvailable: l,
|
|
29
|
+
customRef: t,
|
|
30
|
+
isLargeFile: s,
|
|
31
|
+
errorCode: m,
|
|
32
|
+
isAiSuggestionsFeatureEnabled: c,
|
|
33
|
+
isAdvancedExtractAgentEnabled: I = !1,
|
|
34
|
+
isBetaLanguageEnabled: x,
|
|
35
|
+
isDeleteButtonDisabled: A,
|
|
36
|
+
isDeleteConfirmationModalCheckboxEnabled: v,
|
|
37
|
+
isMultilevelTaxonomyFieldEnabled: p,
|
|
38
|
+
isUnsavedChangesModalOpen: T = !1,
|
|
39
|
+
MetadataInstanceFormCustomWrapper: L,
|
|
40
|
+
selectedTemplateInstance: e,
|
|
41
|
+
onCancel: R,
|
|
42
|
+
onChange: f,
|
|
43
|
+
onDelete: k,
|
|
44
|
+
onDiscardUnsavedChanges: N,
|
|
45
|
+
onSubmit: P,
|
|
46
|
+
setIsUnsavedChangesModalOpen: u,
|
|
47
|
+
taxonomyOptionsFetcher: g
|
|
48
|
+
} = i, U = L ?? se, [B, h] = S(!1), {
|
|
49
|
+
isFetchingSuggestions: n,
|
|
50
50
|
isLongLoading: C,
|
|
51
|
-
getAiSuggestions:
|
|
51
|
+
getAiSuggestions: w,
|
|
52
52
|
clearState: E,
|
|
53
|
-
suggestions:
|
|
54
|
-
} =
|
|
53
|
+
suggestions: K
|
|
54
|
+
} = Z();
|
|
55
55
|
y(() => () => {
|
|
56
56
|
E();
|
|
57
|
-
}, [E,
|
|
58
|
-
const F =
|
|
59
|
-
await
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
},
|
|
57
|
+
}, [E, e?.id]);
|
|
58
|
+
const F = e?.templateKey === Y, V = async (a) => {
|
|
59
|
+
await P(a, ne(a, e));
|
|
60
|
+
}, W = (a) => {
|
|
61
|
+
a ? u(!0) : R();
|
|
62
|
+
}, j = () => {
|
|
63
63
|
h(!0);
|
|
64
|
-
},
|
|
64
|
+
}, _ = {
|
|
65
65
|
metadata: {
|
|
66
|
-
...
|
|
66
|
+
...e
|
|
67
67
|
}
|
|
68
|
-
}, M = O(null), [b,
|
|
68
|
+
}, M = O(null), [b, $] = S(null);
|
|
69
69
|
y(() => {
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
const
|
|
73
|
-
const
|
|
70
|
+
$(t ?? M.current);
|
|
71
|
+
}, [t, e?.templateKey, e?.scope]);
|
|
72
|
+
const q = X(() => {
|
|
73
|
+
const a = e?.fields.length === 0;
|
|
74
74
|
if (F)
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
isLoading:
|
|
75
|
+
return /* @__PURE__ */ o(oe, {
|
|
76
|
+
isLoading: n
|
|
77
77
|
});
|
|
78
|
-
if (
|
|
79
|
-
return /* @__PURE__ */
|
|
80
|
-
isBoxAiSuggestionsFeatureEnabled:
|
|
78
|
+
if (a)
|
|
79
|
+
return /* @__PURE__ */ o(te, {
|
|
80
|
+
isBoxAiSuggestionsFeatureEnabled: c,
|
|
81
81
|
level: "instance"
|
|
82
82
|
});
|
|
83
|
-
const
|
|
83
|
+
const r = !!(n || m);
|
|
84
84
|
return /* @__PURE__ */ D("div", {
|
|
85
|
-
className:
|
|
86
|
-
children: [/* @__PURE__ */
|
|
87
|
-
errorCode:
|
|
88
|
-
isFetchingSuggestions:
|
|
85
|
+
className: z(d.metadataInstanceFormContent, r && d.showOverlay),
|
|
86
|
+
children: [/* @__PURE__ */ o(ae, {
|
|
87
|
+
errorCode: m,
|
|
88
|
+
isFetchingSuggestions: n,
|
|
89
89
|
isLongLoading: C
|
|
90
|
-
}), /* @__PURE__ */
|
|
91
|
-
disableForm:
|
|
92
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
93
|
-
portalElement:
|
|
94
|
-
taxonomyOptionsFetcher:
|
|
90
|
+
}), /* @__PURE__ */ o(ee, {
|
|
91
|
+
disableForm: n,
|
|
92
|
+
isMultilevelTaxonomyFieldEnabled: p,
|
|
93
|
+
portalElement: t ?? b,
|
|
94
|
+
taxonomyOptionsFetcher: g
|
|
95
95
|
})]
|
|
96
96
|
});
|
|
97
|
-
}, [
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
initialValues:
|
|
100
|
-
onSubmit:
|
|
97
|
+
}, [e?.fields.length, F, n, C, t, b, g, c, p, m]);
|
|
98
|
+
return /* @__PURE__ */ o(G, {
|
|
99
|
+
initialValues: _,
|
|
100
|
+
onSubmit: V,
|
|
101
101
|
children: ({
|
|
102
|
-
values:
|
|
103
|
-
dirty:
|
|
104
|
-
}) => /* @__PURE__ */ D(
|
|
105
|
-
children: [/* @__PURE__ */
|
|
106
|
-
areAiSuggestionsAvailable:
|
|
107
|
-
className:
|
|
102
|
+
values: a,
|
|
103
|
+
dirty: r
|
|
104
|
+
}) => /* @__PURE__ */ D(H, {
|
|
105
|
+
children: [/* @__PURE__ */ o(U, {
|
|
106
|
+
areAiSuggestionsAvailable: l,
|
|
107
|
+
className: d.metadataInstanceForm,
|
|
108
108
|
formRef: M,
|
|
109
|
-
formValues:
|
|
110
|
-
getAiSuggestions:
|
|
111
|
-
handleCancel:
|
|
112
|
-
handleDelete:
|
|
113
|
-
isAdvancedExtractAgentEnabled:
|
|
114
|
-
isAiSuggestionsFeatureEnabled:
|
|
115
|
-
isBetaLanguageEnabled:
|
|
116
|
-
isDeleteButtonDisabled:
|
|
117
|
-
isFetchingSuggestions:
|
|
118
|
-
isFormDirty:
|
|
119
|
-
isLargeFile:
|
|
120
|
-
selectedTemplateInstance:
|
|
121
|
-
suggestions:
|
|
122
|
-
children:
|
|
123
|
-
}),
|
|
124
|
-
dirty:
|
|
125
|
-
onChange:
|
|
126
|
-
values:
|
|
127
|
-
}), /* @__PURE__ */
|
|
128
|
-
onBackToEdit: () =>
|
|
129
|
-
onDiscardChanges:
|
|
130
|
-
open:
|
|
131
|
-
}), /* @__PURE__ */
|
|
132
|
-
isCheckboxEnabled:
|
|
133
|
-
onConfirm: () =>
|
|
109
|
+
formValues: a,
|
|
110
|
+
getAiSuggestions: w,
|
|
111
|
+
handleCancel: W,
|
|
112
|
+
handleDelete: j,
|
|
113
|
+
isAdvancedExtractAgentEnabled: I,
|
|
114
|
+
isAiSuggestionsFeatureEnabled: c,
|
|
115
|
+
isBetaLanguageEnabled: x,
|
|
116
|
+
isDeleteButtonDisabled: A,
|
|
117
|
+
isFetchingSuggestions: n,
|
|
118
|
+
isFormDirty: r,
|
|
119
|
+
isLargeFile: s,
|
|
120
|
+
selectedTemplateInstance: e,
|
|
121
|
+
suggestions: K,
|
|
122
|
+
children: e && q
|
|
123
|
+
}), f && /* @__PURE__ */ o(ie, {
|
|
124
|
+
dirty: r,
|
|
125
|
+
onChange: f,
|
|
126
|
+
values: a
|
|
127
|
+
}), /* @__PURE__ */ o(re, {
|
|
128
|
+
onBackToEdit: () => u(!1),
|
|
129
|
+
onDiscardChanges: N,
|
|
130
|
+
open: T
|
|
131
|
+
}), /* @__PURE__ */ o(J, {
|
|
132
|
+
isCheckboxEnabled: v,
|
|
133
|
+
onConfirm: () => k(e),
|
|
134
134
|
onDismiss: () => h(!1),
|
|
135
|
-
open:
|
|
136
|
-
templateName:
|
|
135
|
+
open: B,
|
|
136
|
+
templateName: e?.displayName
|
|
137
137
|
})]
|
|
138
138
|
})
|
|
139
|
-
}, `${
|
|
139
|
+
}, `${e?.scope}.${e?.templateKey}`);
|
|
140
140
|
};
|
|
141
141
|
export {
|
|
142
|
-
|
|
142
|
+
Ie as MetadataInstanceForm
|
|
143
143
|
};
|
|
@@ -1,126 +1,124 @@
|
|
|
1
|
-
import { Tooltip as
|
|
2
|
-
import { BoxAiAdvancedLogo24 as
|
|
3
|
-
import { useLocalStorageAIAgents as
|
|
4
|
-
import { useFormikContext as
|
|
5
|
-
import { useEffect as
|
|
6
|
-
import { useIntl as
|
|
7
|
-
import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as
|
|
8
|
-
import { autofillMessages as
|
|
9
|
-
import { useAutofill as
|
|
10
|
-
import { getTooltipContent as
|
|
1
|
+
import { Tooltip as b, Button as G, LoadingIndicator as E, IconButton as R, SplitButton as k, DropdownMenu as L, Text as v } from "@box/blueprint-web";
|
|
2
|
+
import { BoxAiAdvancedLogo24 as x, BoxAiLogo24 as D } from "@box/blueprint-web-assets/icons/Logo";
|
|
3
|
+
import { useLocalStorageAIAgents as K } from "@box/box-ai-agent-selector";
|
|
4
|
+
import { useFormikContext as O, getIn as f } from "formik";
|
|
5
|
+
import { useEffect as j, useMemo as w, forwardRef as F, useState as P } from "react";
|
|
6
|
+
import { useIntl as N } from "react-intl";
|
|
7
|
+
import { EXTRACT_AI_AGENT_LOCAL_STORAGE_KEY as Y, EXTRACT_AGENTS_MAP as C } from "../../../../constants.js";
|
|
8
|
+
import { autofillMessages as V } from "../../../../messages.js";
|
|
9
|
+
import { useAutofill as X } from "../../../../utils/autofill-context.js";
|
|
10
|
+
import { getTooltipContent as q } from "../../../../utils/utils.js";
|
|
11
11
|
import g from "./messages.js";
|
|
12
|
-
import { jsx as t, jsxs as
|
|
13
|
-
import '../../../../../../styles/metadata-instance-form-autofill-button.css';const
|
|
14
|
-
loadingIndicator:
|
|
15
|
-
actionMenuItem:
|
|
16
|
-
splitButtonIcon:
|
|
17
|
-
},
|
|
18
|
-
isButtonDisabled:
|
|
19
|
-
onAutofill:
|
|
20
|
-
onAgentChange:
|
|
21
|
-
storedAgent:
|
|
22
|
-
icon:
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
import { jsx as t, jsxs as z } from "react/jsx-runtime";
|
|
13
|
+
import '../../../../../../styles/metadata-instance-form-autofill-button.css';const H = "_loadingIndicator_i1hyy_1", J = "_actionMenuItem_i1hyy_11", Q = "_splitButtonIcon_i1hyy_17", S = {
|
|
14
|
+
loadingIndicator: H,
|
|
15
|
+
actionMenuItem: J,
|
|
16
|
+
splitButtonIcon: Q
|
|
17
|
+
}, U = /* @__PURE__ */ F(({
|
|
18
|
+
isButtonDisabled: p,
|
|
19
|
+
onAutofill: I,
|
|
20
|
+
onAgentChange: c,
|
|
21
|
+
storedAgent: A,
|
|
22
|
+
icon: e,
|
|
23
|
+
...B
|
|
24
|
+
}, _) => {
|
|
25
|
+
const n = N(), [u, a] = P(A || "standard"), i = (o) => {
|
|
26
|
+
a(o), c(o), setTimeout(() => {
|
|
27
|
+
I(o);
|
|
28
28
|
}, 0);
|
|
29
29
|
};
|
|
30
|
-
return /* @__PURE__ */ t(
|
|
31
|
-
...
|
|
32
|
-
ref:
|
|
33
|
-
disabled:
|
|
30
|
+
return /* @__PURE__ */ t(k, {
|
|
31
|
+
...B,
|
|
32
|
+
ref: _,
|
|
33
|
+
disabled: p,
|
|
34
34
|
dropdownTriggerAriaLabel: "See agent options.",
|
|
35
|
-
icon:
|
|
36
|
-
label:
|
|
37
|
-
onClick: () =>
|
|
35
|
+
icon: e,
|
|
36
|
+
label: n.formatMessage(g.autofillButton),
|
|
37
|
+
onClick: () => I(),
|
|
38
38
|
variant: "secondary",
|
|
39
|
-
children: /* @__PURE__ */ t(
|
|
40
|
-
onValueChange: (o) =>
|
|
41
|
-
value:
|
|
42
|
-
children: Object.entries(
|
|
43
|
-
const
|
|
44
|
-
return /* @__PURE__ */ t(
|
|
45
|
-
value:
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
-
className:
|
|
48
|
-
children: [/* @__PURE__ */ t(
|
|
39
|
+
children: /* @__PURE__ */ t(L.RadioGroup, {
|
|
40
|
+
onValueChange: (o) => i(o),
|
|
41
|
+
value: u,
|
|
42
|
+
children: Object.entries(C).map(([o, s]) => {
|
|
43
|
+
const r = s.ICON;
|
|
44
|
+
return /* @__PURE__ */ t(L.RadioSelectItem, {
|
|
45
|
+
value: s.AGENT_TYPE,
|
|
46
|
+
children: /* @__PURE__ */ z("div", {
|
|
47
|
+
className: S.actionMenuItem,
|
|
48
|
+
children: [/* @__PURE__ */ t(r, {
|
|
49
49
|
"aria-hidden": !0,
|
|
50
|
-
className:
|
|
51
|
-
}), /* @__PURE__ */ t(
|
|
50
|
+
className: S.splitButtonIcon
|
|
51
|
+
}), /* @__PURE__ */ t(v, {
|
|
52
52
|
as: "span",
|
|
53
|
-
children:
|
|
53
|
+
children: n.formatMessage(g[s.DISPLAY_MSG])
|
|
54
54
|
})]
|
|
55
55
|
})
|
|
56
56
|
}, o);
|
|
57
57
|
})
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
|
-
}),
|
|
61
|
-
areAiSuggestionsAvailable:
|
|
62
|
-
isBetaLanguageEnabled:
|
|
63
|
-
isLoading:
|
|
64
|
-
variant:
|
|
65
|
-
isAdvancedExtractAgentEnabled:
|
|
66
|
-
onAutofill:
|
|
60
|
+
}), ct = ({
|
|
61
|
+
areAiSuggestionsAvailable: p,
|
|
62
|
+
isBetaLanguageEnabled: I,
|
|
63
|
+
isLoading: c,
|
|
64
|
+
variant: A = "secondary-button",
|
|
65
|
+
isAdvancedExtractAgentEnabled: e = !1,
|
|
66
|
+
onAutofill: B
|
|
67
67
|
}) => {
|
|
68
68
|
const {
|
|
69
|
-
isSubmitting:
|
|
70
|
-
values:
|
|
71
|
-
setFieldValue:
|
|
72
|
-
} =
|
|
73
|
-
suggestions:
|
|
74
|
-
} =
|
|
75
|
-
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
} : c;
|
|
69
|
+
isSubmitting: _,
|
|
70
|
+
values: n,
|
|
71
|
+
setFieldValue: u
|
|
72
|
+
} = O(), a = N(), [i, o] = K(Y), {
|
|
73
|
+
suggestions: s
|
|
74
|
+
} = X();
|
|
75
|
+
j(() => {
|
|
76
|
+
if (s) {
|
|
77
|
+
const m = f(n, "metadata.fields"), y = f(n, "metadata.templateKey");
|
|
78
|
+
u("metadata.fields", m?.map((l) => {
|
|
79
|
+
const d = s?.[y]?.[l.key];
|
|
80
|
+
return d ? {
|
|
81
|
+
...l,
|
|
82
|
+
aiSuggestion: d
|
|
83
|
+
} : l;
|
|
85
84
|
}));
|
|
86
85
|
}
|
|
87
|
-
}, [
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
isButtonDisabled: M,
|
|
86
|
+
}, [s, u]);
|
|
87
|
+
const r = (m) => {
|
|
88
|
+
const y = f(n, "metadata.templateKey"), l = f(n, "metadata.scope"), d = m ? C[m]?.AGENT_ID : C[i]?.AGENT_ID;
|
|
89
|
+
B(y, l, e ? d : void 0);
|
|
90
|
+
}, h = !p || _ || c, M = i === "enhanced" && e ? x : D, T = w(() => q(e, i, a), [e, i, a]);
|
|
91
|
+
return A === "secondary-button" ? /* @__PURE__ */ t(b, {
|
|
92
|
+
content: T,
|
|
93
|
+
children: e ? /* @__PURE__ */ t(U, {
|
|
94
|
+
icon: M,
|
|
95
|
+
isButtonDisabled: h,
|
|
98
96
|
onAgentChange: o,
|
|
99
|
-
onAutofill:
|
|
100
|
-
storedAgent:
|
|
101
|
-
}) : /* @__PURE__ */ t(
|
|
102
|
-
disabled:
|
|
103
|
-
icon:
|
|
104
|
-
onClick: () =>
|
|
97
|
+
onAutofill: r,
|
|
98
|
+
storedAgent: i
|
|
99
|
+
}) : /* @__PURE__ */ t(G, {
|
|
100
|
+
disabled: h,
|
|
101
|
+
icon: M,
|
|
102
|
+
onClick: () => r(),
|
|
105
103
|
variant: "secondary",
|
|
106
104
|
"data-target-id": "Button-autofillButton",
|
|
107
|
-
children:
|
|
105
|
+
children: a.formatMessage(g.autofillButton)
|
|
108
106
|
})
|
|
109
|
-
}) : /* @__PURE__ */ t(
|
|
110
|
-
content:
|
|
111
|
-
children:
|
|
112
|
-
"aria-label":
|
|
113
|
-
className:
|
|
114
|
-
}) : /* @__PURE__ */ t(
|
|
115
|
-
"aria-label":
|
|
116
|
-
disabled:
|
|
117
|
-
icon:
|
|
118
|
-
onClick: () =>
|
|
107
|
+
}) : /* @__PURE__ */ t(b, {
|
|
108
|
+
content: T,
|
|
109
|
+
children: c ? /* @__PURE__ */ t(E, {
|
|
110
|
+
"aria-label": a.formatMessage(g.loadingButtonAriaLabel),
|
|
111
|
+
className: S.loadingIndicator
|
|
112
|
+
}) : /* @__PURE__ */ t(R, {
|
|
113
|
+
"aria-label": a.formatMessage(V.autofillButtonAriaLabel),
|
|
114
|
+
disabled: h,
|
|
115
|
+
icon: M,
|
|
116
|
+
onClick: () => r(),
|
|
119
117
|
variant: "icon-logo",
|
|
120
118
|
"data-target-id": "IconButton-autofillButtonAriaLabel"
|
|
121
119
|
})
|
|
122
120
|
});
|
|
123
121
|
};
|
|
124
122
|
export {
|
|
125
|
-
|
|
123
|
+
ct as MetadataInstanceFormAutofillButton
|
|
126
124
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { Card as S, Divider as
|
|
1
|
+
import { Card as S, Divider as n } from "@box/blueprint-web";
|
|
2
2
|
import { useState as b } from "react";
|
|
3
3
|
import { useAutofill as g } from "../../../../utils/autofill-context.js";
|
|
4
4
|
import { MetadataEmptyState as H } from "../../../metadata-empty-state/metadata-empty-state.js";
|
|
5
5
|
import { MetadataInstanceContent as _ } from "../metadata-instance-content/metadata-instance-content.js";
|
|
6
6
|
import { MetadataInstanceFooter as M } from "../metadata-instance-footer/metadata-instance-footer.js";
|
|
7
7
|
import { MetadataInstanceHeader as N } from "../metadata-instance-header/metadata-instance-header.js";
|
|
8
|
-
import { jsxs as
|
|
9
|
-
import '../../../../../../styles/metadata-instance.css';const x = "_topDivider_tzhlb_1", F = "_bottomDivider_tzhlb_5",
|
|
8
|
+
import { jsxs as r, jsx as o, Fragment as u } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../../../styles/metadata-instance.css';const x = "_topDivider_tzhlb_1", F = "_bottomDivider_tzhlb_5", p = {
|
|
10
10
|
topDivider: x,
|
|
11
11
|
bottomDivider: F
|
|
12
12
|
}, q = ({
|
|
13
|
-
areAiSuggestionsAvailable:
|
|
14
|
-
isAiSuggestionsFeatureEnabled:
|
|
13
|
+
areAiSuggestionsAvailable: y,
|
|
14
|
+
isAiSuggestionsFeatureEnabled: l,
|
|
15
15
|
isBetaLanguageEnabled: c,
|
|
16
|
-
onEdit:
|
|
17
|
-
templateInstance:
|
|
16
|
+
onEdit: d,
|
|
17
|
+
templateInstance: t,
|
|
18
18
|
taxonomyNodeFetcher: h,
|
|
19
19
|
isAdvancedExtractAgentEnabled: v = !1
|
|
20
20
|
}) => {
|
|
21
|
-
const i =
|
|
21
|
+
const i = t.fields, m = (e) => !e.value || Array.isArray(e.value) && e.value.length === 0, E = i.every(m), f = i.some(m), V = i.length > 0, [a, s] = b(!0), {
|
|
22
22
|
getAiSuggestions: A
|
|
23
23
|
} = g(), D = (e) => {
|
|
24
|
-
|
|
24
|
+
d(t), A(t.templateKey, t.scope, e);
|
|
25
25
|
};
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
children: [/* @__PURE__ */
|
|
28
|
-
areAiSuggestionsAvailable:
|
|
29
|
-
canEdit:
|
|
26
|
+
return /* @__PURE__ */ r(S, {
|
|
27
|
+
children: [/* @__PURE__ */ o(N, {
|
|
28
|
+
areAiSuggestionsAvailable: y,
|
|
29
|
+
canEdit: t.canEdit,
|
|
30
30
|
isAdvancedExtractAgentEnabled: v,
|
|
31
|
-
isAiSuggestionsFeatureEnabled:
|
|
31
|
+
isAiSuggestionsFeatureEnabled: l,
|
|
32
32
|
isBetaLanguageEnabled: c,
|
|
33
33
|
onAutofill: D,
|
|
34
|
-
onEdit: () =>
|
|
35
|
-
templateName:
|
|
36
|
-
}), /* @__PURE__ */
|
|
37
|
-
className:
|
|
38
|
-
}),
|
|
34
|
+
onEdit: () => d(t),
|
|
35
|
+
templateName: t?.displayName
|
|
36
|
+
}), /* @__PURE__ */ o(n, {
|
|
37
|
+
className: p.topDivider
|
|
38
|
+
}), a && E ? /* @__PURE__ */ o(H, {
|
|
39
39
|
isAnyEmptyValueHidden: V,
|
|
40
|
-
isBoxAiSuggestionsFeatureEnabled:
|
|
40
|
+
isBoxAiSuggestionsFeatureEnabled: l,
|
|
41
41
|
level: "instance",
|
|
42
42
|
onShowEmptyValues: () => s(!1)
|
|
43
|
-
}) : /* @__PURE__ */
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
-
shouldHideEmptyValues:
|
|
43
|
+
}) : /* @__PURE__ */ r(u, {
|
|
44
|
+
children: [/* @__PURE__ */ o(_, {
|
|
45
|
+
shouldHideEmptyValues: a,
|
|
46
46
|
taxonomyNodeFetcher: h,
|
|
47
|
-
templateInstance:
|
|
48
|
-
}), f && /* @__PURE__ */
|
|
49
|
-
children: [/* @__PURE__ */
|
|
50
|
-
className:
|
|
51
|
-
}), /* @__PURE__ */
|
|
52
|
-
isAnyEmptyValueHidden:
|
|
47
|
+
templateInstance: t
|
|
48
|
+
}), f && /* @__PURE__ */ r(u, {
|
|
49
|
+
children: [/* @__PURE__ */ o(n, {
|
|
50
|
+
className: p.bottomDivider
|
|
51
|
+
}), /* @__PURE__ */ o(M, {
|
|
52
|
+
isAnyEmptyValueHidden: a,
|
|
53
53
|
onHideEmptyValues: () => s(!0),
|
|
54
54
|
onShowEmptyValues: () => s(!1)
|
|
55
55
|
})]
|