@box/metadata-editor 0.80.4 → 0.80.6
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 +41 -37
- package/esm/lib/components/metadata-editor-fields/components/ai-suggestion-field/ai-suggestion-field.js +24 -23
- package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js +12 -0
- package/esm/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/update-mode-field-wrapper.js +47 -46
- package/package.json +2 -2
- package/types/index.d.ts +2 -1
- package/types/lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.d.ts +9 -0
package/esm/index.js
CHANGED
@@ -1,43 +1,47 @@
|
|
1
1
|
import { AddMetadataTemplateDropdown as e } from "./lib/components/add-metadata-template-dropdown/add-metadata-template-dropdown.js";
|
2
2
|
import { ComboboxWithApiPagination as r } from "./lib/components/combobox-with-api-pagination/combobox-with-api-pagination.js";
|
3
|
-
import { FilterDropdownMenu as
|
4
|
-
import { FilterInstancesDropdown as
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import {
|
17
|
-
import {
|
18
|
-
import {
|
19
|
-
import { withApiWrapper as
|
3
|
+
import { FilterDropdownMenu as m } from "./lib/components/filter-dropdown-menu/index.js";
|
4
|
+
import { FilterInstancesDropdown as f } from "./lib/components/filter-instances-dropdown/filter-instances-dropdown.js";
|
5
|
+
import { MULTI_VALUE_DEFAULT_OPTION as x, MULTI_VALUE_DEFAULT_TAXONOMY_OPTION as i, MULTI_VALUE_DEFAULT_VALUE as l } from "./lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils.js";
|
6
|
+
import { MetadataEmptyState as s } from "./lib/components/metadata-empty-state/metadata-empty-state.js";
|
7
|
+
import { CustomInstanceNewField as I } from "./lib/components/metadata-instance-editor/subcomponents/custom-instance-new-field/custom-instance-new-field.js";
|
8
|
+
import { DeleteConfirmationModal as u } from "./lib/components/metadata-instance-editor/subcomponents/delete-confirmation-modal/delete-confirmation-modal.js";
|
9
|
+
import { MetadataInstanceFormAutofillButton as T } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-autofill-button/metadata-instance-form-autofill-button.js";
|
10
|
+
import { MetadataInstanceFormHeader as E } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form-header/metadata-instance-form-header.js";
|
11
|
+
import { MetadataInstanceForm as c } from "./lib/components/metadata-instance-editor/subcomponents/metadata-instance-form/metadata-instance-form.js";
|
12
|
+
import { J as D } from "../chunks/utils.js";
|
13
|
+
import { MetadataInstanceList as V } from "./lib/components/metadata-instance-list/metadata-instance-list.js";
|
14
|
+
import { MetadataInstanceHeader as N } from "./lib/components/metadata-instance-list/subcomponents/metadata-instance-header/metadata-instance-header.js";
|
15
|
+
import { UnsavedChangesModal as h } from "./lib/components/unsaved-changes-modal/unsaved-changes-modal.js";
|
16
|
+
import { defaultInitialValues as g, defaultMetadataValueMap as v } from "./lib/defaults.js";
|
17
|
+
import { MetadataEditor as J } from "./lib/metadata-editor.js";
|
18
|
+
import { U as W } from "../chunks/types.js";
|
19
|
+
import { withApiWrapper as B } from "./lib/utils/api-wrapper.js";
|
20
|
+
import { AutofillContext as Y, AutofillContextProvider as j, useAutofill as k } from "./lib/utils/autofill-context.js";
|
20
21
|
export {
|
21
22
|
e as AddMetadataTemplateDropdown,
|
22
|
-
|
23
|
-
|
23
|
+
Y as AutofillContext,
|
24
|
+
j as AutofillContextProvider,
|
24
25
|
r as ComboboxWithApiPagination,
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
26
|
+
I as CustomInstanceNewField,
|
27
|
+
u as DeleteConfirmationModal,
|
28
|
+
m as FilterDropdownMenu,
|
29
|
+
f as FilterInstancesDropdown,
|
30
|
+
D as JSONPatchOp,
|
31
|
+
x as MULTI_VALUE_DEFAULT_OPTION,
|
32
|
+
i as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
|
33
|
+
l as MULTI_VALUE_DEFAULT_VALUE,
|
34
|
+
J as MetadataEditor,
|
35
|
+
s as MetadataEmptyState,
|
36
|
+
c as MetadataInstanceForm,
|
37
|
+
T as MetadataInstanceFormAutofillButton,
|
38
|
+
E as MetadataInstanceFormHeader,
|
39
|
+
N as MetadataInstanceHeader,
|
40
|
+
V as MetadataInstanceList,
|
41
|
+
h as UnsavedChangesModal,
|
42
|
+
W as UpdateMode,
|
43
|
+
g as defaultInitialValues,
|
44
|
+
v as defaultMetadataValueMap,
|
45
|
+
k as useAutofill,
|
46
|
+
B as withApiWrapper
|
43
47
|
};
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import "../../../../../../styles/ai-suggestion-field.css";
|
2
|
-
import { Text as
|
2
|
+
import { Text as s, IconButton as c, DropdownMenu as a } from "@box/blueprint-web";
|
3
3
|
import { Checkmark as m, Ellipsis as f } from "@box/blueprint-web-assets/icons/Fill";
|
4
|
-
import { useIntl as
|
4
|
+
import { useIntl as I, FormattedMessage as r } from "react-intl";
|
5
5
|
import t from "./messages.js";
|
6
|
-
import { formatSuggestionValue as
|
6
|
+
import { formatSuggestionValue as w } from "./utils.js";
|
7
7
|
import { jsx as e, jsxs as i, Fragment as u } from "react/jsx-runtime";
|
8
|
-
const C = "_wrapperGradient_t2yak_1",
|
8
|
+
const C = "_wrapperGradient_t2yak_1", _ = "_wrapper_t2yak_1", b = "_buttons_t2yak_18", k = "_selectTrigger_t2yak_22", o = {
|
9
9
|
wrapperGradient: C,
|
10
|
-
wrapper:
|
10
|
+
wrapper: _,
|
11
11
|
buttons: b,
|
12
12
|
selectTrigger: k
|
13
13
|
};
|
@@ -16,16 +16,16 @@ function D({
|
|
16
16
|
onAiSuggestionAppend: g,
|
17
17
|
onAiSuggestionReplace: d,
|
18
18
|
onAiSuggestionIgnore: p,
|
19
|
-
type:
|
19
|
+
type: n,
|
20
20
|
isSameValue: h
|
21
21
|
}) {
|
22
|
-
const
|
22
|
+
const l = I();
|
23
23
|
return /* @__PURE__ */ e("div", {
|
24
|
-
className:
|
24
|
+
className: o.wrapperGradient,
|
25
25
|
children: /* @__PURE__ */ e("div", {
|
26
|
-
className:
|
26
|
+
className: o.wrapper,
|
27
27
|
children: h ? /* @__PURE__ */ i(u, {
|
28
|
-
children: [/* @__PURE__ */ e(
|
28
|
+
children: [/* @__PURE__ */ e(s, {
|
29
29
|
as: "p",
|
30
30
|
color: "textOnLightSecondary",
|
31
31
|
variant: "caption",
|
@@ -33,9 +33,9 @@ function D({
|
|
33
33
|
...t.sameValueAiSuggestionCaption
|
34
34
|
})
|
35
35
|
}), /* @__PURE__ */ e("div", {
|
36
|
-
className:
|
36
|
+
className: o.buttons,
|
37
37
|
children: /* @__PURE__ */ e(c, {
|
38
|
-
"aria-label":
|
38
|
+
"aria-label": l.formatMessage(t.aiSuggestionConfirm),
|
39
39
|
icon: m,
|
40
40
|
onClick: p,
|
41
41
|
size: "x-small",
|
@@ -44,37 +44,38 @@ function D({
|
|
44
44
|
})]
|
45
45
|
}) : /* @__PURE__ */ i(u, {
|
46
46
|
children: [/* @__PURE__ */ i("div", {
|
47
|
-
children: [/* @__PURE__ */ e(
|
47
|
+
children: [/* @__PURE__ */ e(s, {
|
48
48
|
as: "p",
|
49
49
|
color: "textOnLightSecondary",
|
50
50
|
variant: "caption",
|
51
51
|
children: /* @__PURE__ */ e(r, {
|
52
52
|
...t.aiSuggestionCaption
|
53
53
|
})
|
54
|
-
}), /* @__PURE__ */ e(
|
54
|
+
}), /* @__PURE__ */ e(s, {
|
55
55
|
as: "p",
|
56
|
-
children:
|
57
|
-
type:
|
58
|
-
locale:
|
56
|
+
children: w(S, {
|
57
|
+
type: n,
|
58
|
+
locale: l.locale
|
59
59
|
})
|
60
60
|
})]
|
61
61
|
}), /* @__PURE__ */ i("div", {
|
62
|
-
className:
|
62
|
+
className: o.buttons,
|
63
63
|
children: [/* @__PURE__ */ e(c, {
|
64
|
-
"aria-label":
|
64
|
+
"aria-label": l.formatMessage(n === "multiSelect" ? t.aiSuggestionAppend : t.aiSuggestionClearAndReplace),
|
65
|
+
"data-target-id": n === "multiSelect" ? "IconButton-aiSuggestionAppend" : "IconButton-aiSuggestionClearAndReplace",
|
65
66
|
icon: m,
|
66
|
-
onClick:
|
67
|
+
onClick: n === "multiSelect" ? g : d,
|
67
68
|
size: "x-small"
|
68
69
|
}), /* @__PURE__ */ i(a.Root, {
|
69
70
|
children: [/* @__PURE__ */ e(a.Trigger, {
|
70
|
-
className:
|
71
|
+
className: o.selectTrigger,
|
71
72
|
children: /* @__PURE__ */ e(c, {
|
72
|
-
"aria-label":
|
73
|
+
"aria-label": l.formatMessage(t.aiSuggestionOptions),
|
73
74
|
icon: f,
|
74
75
|
"data-target-id": "IconButton-aiSuggestionOptions"
|
75
76
|
})
|
76
77
|
}), /* @__PURE__ */ i(a.Content, {
|
77
|
-
children: [
|
78
|
+
children: [n === "multiSelect" && /* @__PURE__ */ e(a.Item, {
|
78
79
|
onSelect: g,
|
79
80
|
"data-target-id": "DropdownMenu.Item-aiSuggestionAppend",
|
80
81
|
children: /* @__PURE__ */ e(r, {
|
@@ -0,0 +1,12 @@
|
|
1
|
+
const e = "Multiple values", t = {
|
2
|
+
id: "MD-editor-dummy-Multiple values",
|
3
|
+
key: e
|
4
|
+
}, L = {
|
5
|
+
id: "MD-editor-dummy--Multiple values-tax",
|
6
|
+
key: e
|
7
|
+
};
|
8
|
+
export {
|
9
|
+
t as MULTI_VALUE_DEFAULT_OPTION,
|
10
|
+
L as MULTI_VALUE_DEFAULT_TAXONOMY_OPTION,
|
11
|
+
e as MULTI_VALUE_DEFAULT_VALUE
|
12
|
+
};
|
@@ -1,22 +1,23 @@
|
|
1
1
|
import "../../../../../../styles/update-mode-field-wrapper.css";
|
2
|
-
import { IconButton as
|
3
|
-
import { Settings as
|
4
|
-
import
|
5
|
-
import { useFormikContext as
|
6
|
-
import
|
7
|
-
import { useIntl as
|
8
|
-
import { U as
|
2
|
+
import { IconButton as b, Radio as i } from "@box/blueprint-web";
|
3
|
+
import { Settings as A, XMark as E } from "@box/blueprint-web-assets/icons/Fill";
|
4
|
+
import R from "clsx";
|
5
|
+
import { useFormikContext as U, getIn as _, Field as w } from "formik";
|
6
|
+
import C, { useState as S } from "react";
|
7
|
+
import { useIntl as B } from "react-intl";
|
8
|
+
import { U as r } from "../../../../../../chunks/types.js";
|
9
9
|
import { messages as l } from "./messages.js";
|
10
|
-
import {
|
11
|
-
|
10
|
+
import { MULTI_VALUE_DEFAULT_OPTION as N } from "./mulitple-values-utils.js";
|
11
|
+
import { jsxs as p, jsx as o } from "react/jsx-runtime";
|
12
|
+
const $ = "_wrapperContianer_1n09p_1", L = "_fieldContainer_1n09p_6", O = "_field_1n09p_6", V = "_collapseButton_1n09p_13", k = "_radioContainer_1n09p_19", x = "_additionalFieldContainer_1n09p_22", G = "_hidden_1n09p_26", t = {
|
12
13
|
wrapperContianer: $,
|
13
|
-
fieldContainer:
|
14
|
-
field:
|
15
|
-
collapseButton:
|
16
|
-
radioContainer:
|
17
|
-
additionalFieldContainer:
|
18
|
-
hidden:
|
19
|
-
},
|
14
|
+
fieldContainer: L,
|
15
|
+
field: O,
|
16
|
+
collapseButton: V,
|
17
|
+
radioContainer: k,
|
18
|
+
additionalFieldContainer: x,
|
19
|
+
hidden: G
|
20
|
+
}, j = (e) => e === r.ReplaceEntered, y = (e, a) => e === "string" || e === "multiSelect" || a, T = ({
|
20
21
|
children: e,
|
21
22
|
fieldNamePrefix: a,
|
22
23
|
fieldType: f,
|
@@ -25,68 +26,68 @@ const $ = "_wrapperContianer_1n09p_1", N = "_fieldContainer_1n09p_6", k = "_fiel
|
|
25
26
|
const {
|
26
27
|
setFieldValue: M,
|
27
28
|
values: m
|
28
|
-
} =
|
29
|
-
key:
|
30
|
-
}) =>
|
31
|
-
return /* @__PURE__ */
|
29
|
+
} = U(), [c, h] = S(!0), n = B(), u = `${a}.updateMode.mode`, v = _(m, u), s = e && C.Children.only(e), I = _(m, `${a}.options`, []).filter((d) => d.id !== N.id).map(({
|
30
|
+
key: d
|
31
|
+
}) => d);
|
32
|
+
return /* @__PURE__ */ p("div", {
|
32
33
|
className: t.wrapperContianer,
|
33
|
-
children: [/* @__PURE__ */
|
34
|
+
children: [/* @__PURE__ */ p("div", {
|
34
35
|
className: t.fieldContainer,
|
35
36
|
children: [/* @__PURE__ */ o("span", {
|
36
37
|
className: t.field,
|
37
38
|
children: e
|
38
|
-
}), /* @__PURE__ */ o(
|
39
|
+
}), /* @__PURE__ */ o(b, {
|
39
40
|
"aria-label": n.formatMessage(l.toggleUpdateModeSelectiorAriaLabel),
|
40
41
|
className: t.collapseButton,
|
41
|
-
"data-testid": `${
|
42
|
-
icon:
|
42
|
+
"data-testid": `${s.props.label}-update-mode-toggle`,
|
43
|
+
icon: c ? A : E,
|
43
44
|
onClick: () => {
|
44
|
-
h(!
|
45
|
+
h(!c);
|
45
46
|
},
|
46
47
|
size: "small",
|
47
48
|
"data-target-id": "IconButton-toggleUpdateModeSelectiorAriaLabel"
|
48
49
|
})]
|
49
|
-
}), /* @__PURE__ */
|
50
|
-
className:
|
51
|
-
[t.hidden]:
|
50
|
+
}), /* @__PURE__ */ p("div", {
|
51
|
+
className: R(t.radioContainer, {
|
52
|
+
[t.hidden]: c
|
52
53
|
}),
|
53
|
-
children: [/* @__PURE__ */ o(
|
54
|
+
children: [/* @__PURE__ */ o(w, {
|
54
55
|
name: `${a}.updateMode.mode`,
|
55
56
|
children: ({
|
56
|
-
field:
|
57
|
-
}) => /* @__PURE__ */
|
58
|
-
"data-testid": `${
|
57
|
+
field: d
|
58
|
+
}) => /* @__PURE__ */ p(i.Group, {
|
59
|
+
"data-testid": `${s.props.label}-radio-group`,
|
59
60
|
loop: !0,
|
60
61
|
onValueChange: (F) => M(u, F),
|
61
62
|
orientation: "vertical",
|
62
|
-
value:
|
63
|
-
children: [
|
63
|
+
value: d.value,
|
64
|
+
children: [y(f, g) && /* @__PURE__ */ o(i.Item, {
|
64
65
|
label: n.formatMessage(l.append),
|
65
|
-
value:
|
66
|
-
}), /* @__PURE__ */ o(
|
66
|
+
value: r.Append
|
67
|
+
}), /* @__PURE__ */ o(i.Item, {
|
67
68
|
label: n.formatMessage(l.clearAndReplace),
|
68
|
-
value:
|
69
|
-
}), /* @__PURE__ */ o(
|
69
|
+
value: r.ClearAndReplace
|
70
|
+
}), /* @__PURE__ */ o(i.Item, {
|
70
71
|
label: n.formatMessage(l.removeEntered),
|
71
|
-
value:
|
72
|
-
}), /* @__PURE__ */ o(
|
72
|
+
value: r.RemoveEntered
|
73
|
+
}), /* @__PURE__ */ o(i.Item, {
|
73
74
|
label: n.formatMessage(l.replaceEntered),
|
74
|
-
value:
|
75
|
+
value: r.ReplaceEntered
|
75
76
|
})]
|
76
77
|
})
|
77
|
-
}),
|
78
|
+
}), j(v) && s && /* @__PURE__ */ o("div", {
|
78
79
|
className: t.additionalFieldContainer,
|
79
|
-
children: /* @__PURE__ */
|
80
|
+
children: /* @__PURE__ */ C.cloneElement(s, {
|
80
81
|
// This field edits ${fieldNamePrefix}.updateMode.value, the '.value' is added by the field component
|
81
82
|
updateModePrefix: `${a}.updateMode`,
|
82
|
-
options:
|
83
|
+
options: I,
|
83
84
|
label: n.formatMessage(l.with)
|
84
85
|
})
|
85
86
|
})]
|
86
87
|
})]
|
87
88
|
});
|
88
89
|
};
|
89
|
-
|
90
|
+
T.displayName = "UpdateModeFieldWrapper";
|
90
91
|
export {
|
91
|
-
|
92
|
+
T as UpdateModeFieldWrapper
|
92
93
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.80.
|
3
|
+
"version": "0.80.6",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.14",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "232199453ce176fabe32818df8d2fc599a3d9ae8"
|
57
57
|
}
|
package/types/index.d.ts
CHANGED
@@ -2,6 +2,7 @@ export * from './lib/components/add-metadata-template-dropdown';
|
|
2
2
|
export * from './lib/components/combobox-with-api-pagination';
|
3
3
|
export * from './lib/components/filter-dropdown-menu';
|
4
4
|
export * from './lib/components/filter-instances-dropdown';
|
5
|
+
export * from './lib/components/metadata-editor-fields/components/update-mode-field-wrapper/mulitple-values-utils';
|
5
6
|
export * from './lib/components/metadata-empty-state/metadata-empty-state';
|
6
7
|
export * from './lib/components/metadata-instance-editor';
|
7
8
|
export * from './lib/components/metadata-instance-list';
|
@@ -9,5 +10,5 @@ export * from './lib/components/unsaved-changes-modal';
|
|
9
10
|
export * from './lib/defaults';
|
10
11
|
export * from './lib/metadata-editor';
|
11
12
|
export * from './lib/types';
|
12
|
-
export * from './lib/utils/autofill-context';
|
13
13
|
export * from './lib/utils/api-wrapper';
|
14
|
+
export * from './lib/utils/autofill-context';
|