@box/metadata-editor 0.80.3 → 0.80.5
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/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 +3 -3
- 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
|
};
|
@@ -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.5",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.14",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -14,7 +14,7 @@
|
|
14
14
|
"devDependencies": {
|
15
15
|
"@ariakit/react": "0.4.14",
|
16
16
|
"@box/babel-plugin-target-attributes": "1.3.0",
|
17
|
-
"@box/blueprint-web": "^9.
|
17
|
+
"@box/blueprint-web": "^9.6.0",
|
18
18
|
"@box/blueprint-web-assets": "^4.31.0",
|
19
19
|
"@box/storybook-utils": "^0.8.0",
|
20
20
|
"@testing-library/react": "^15.0.6",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "ba8435e9c738173a37e34695c39d91f0bf18a5a5"
|
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';
|