@box/metadata-template-editor 1.20.9 → 1.20.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/dist/chunks/chip.js +21 -0
- package/dist/chunks/dropdown-field-configuration.js +62 -0
- package/dist/chunks/field-context-menu.js +90 -0
- package/dist/chunks/field-selector.js +23 -0
- package/dist/chunks/field-type-dropdown.js +31 -0
- package/dist/chunks/levels-chain.js +125 -0
- package/dist/chunks/metadata-field-configurator.module.js +17 -16
- package/dist/chunks/metadata-field-list.js +229 -0
- package/dist/chunks/metadata-template-editor-form.js +107 -0
- package/dist/chunks/metadata-template-editor-modal.js +77 -0
- package/dist/chunks/metadata-template-editor.js +157 -0
- package/dist/chunks/sortable-option-list.js +231 -0
- package/dist/chunks/taxonomy-field-configuration.js +126 -0
- package/dist/chunks/taxonomy-field-configurator-initial-state.js +48 -0
- package/dist/chunks/taxonomy-selector.js +90 -0
- package/dist/chunks/types.js +22 -33
- package/dist/esm/index.js +13 -34
- package/dist/esm/lib/components/field-selector/field-selector.js +2 -39
- package/dist/esm/lib/components/field-selector/index.js +2 -4
- package/dist/esm/lib/components/field-selector/messages.js +10 -12
- package/dist/esm/lib/components/field-type-dropdown/field-type-dropdown.js +2 -47
- package/dist/esm/lib/components/field-type-dropdown/index.js +2 -4
- package/dist/esm/lib/components/field-type-dropdown/messages.js +10 -12
- package/dist/esm/lib/components/field-type-tiles/field-type-tiles.js +32 -39
- package/dist/esm/lib/components/field-type-tiles/index.js +2 -4
- package/dist/esm/lib/components/field-type-tiles/messages.js +10 -12
- package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/confirmation-modal.js +32 -45
- package/dist/esm/lib/components/metadata-field-configurator/components/confirmation-modal/messages.js +14 -16
- package/dist/esm/lib/components/metadata-field-configurator/components/field-action-slot/field-action-slot.js +62 -79
- package/dist/esm/lib/components/metadata-field-configurator/components/field-context-menu/field-context-menu.js +2 -115
- package/dist/esm/lib/components/metadata-field-configurator/components/field-edit-content/field-edit-content.js +83 -100
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/chip.js +2 -33
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/index.js +2 -4
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.js +2 -118
- package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/utils.js +16 -33
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/__mocks__/getInitialValues.js +34 -32
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-default-values.js +10 -14
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/dropdown-field-configuration.js +2 -66
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/dropdown/sortable-option-list.js +2 -294
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/index.js +3 -6
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-default-values.js +11 -15
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configuration.js +2 -149
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-field-configurator-initial-state.js +2 -54
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector-messages.js +34 -36
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/taxonomy-selector.js +2 -103
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/useTaxonomySelect.js +15 -19
- package/dist/esm/lib/components/metadata-field-configurator/components/type-specific-configuration/taxonomy/utils.js +2 -4
- package/dist/esm/lib/components/metadata-field-configurator/context/field-configurator-context.js +60 -66
- package/dist/esm/lib/components/metadata-field-configurator/context/field-extensions-context.js +5 -8
- package/dist/esm/lib/components/metadata-field-configurator/context/taxonomy-options-context.js +14 -20
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldConfiguratorBehavior.js +99 -118
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useFieldValidation.js +52 -66
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useTaxonomyFetch.js +23 -26
- package/dist/esm/lib/components/metadata-field-configurator/hooks/useTemplateFieldSchema.js +34 -43
- package/dist/esm/lib/components/metadata-field-configurator/index.js +5 -11
- package/dist/esm/lib/components/metadata-field-configurator/messages/configurator-messages.js +131 -134
- package/dist/esm/lib/components/metadata-field-configurator/messages/dropdown-messages.js +34 -36
- package/dist/esm/lib/components/metadata-field-configurator/messages/levels-chain-messages.js +14 -16
- package/dist/esm/lib/components/metadata-field-configurator/messages/taxonomy-messages.js +34 -36
- package/dist/esm/lib/components/metadata-field-configurator/metadata-field-configurator.js +94 -153
- package/dist/esm/lib/components/metadata-field-configurator/utils.js +42 -49
- package/dist/esm/lib/components/metadata-field-list/index.js +2 -5
- package/dist/esm/lib/components/metadata-field-list/metadata-field-list.js +2 -279
- package/dist/esm/lib/components/metadata-template-editor-form/metadata-template-editor-form.js +2 -137
- package/dist/esm/lib/components/metadata-template-editor-modal/index.js +2 -4
- package/dist/esm/lib/components/metadata-template-editor-modal/metadata-template-editor-modal.js +2 -103
- package/dist/esm/lib/hooks/useMetadataTemplateFormSchema.js +13 -15
- package/dist/esm/lib/hooks/useTemplateNameSchema.js +8 -10
- package/dist/esm/lib/index.js +7 -14
- package/dist/esm/lib/messages.js +114 -116
- package/dist/esm/lib/metadata-template-editor.js +2 -182
- package/dist/esm/lib/utils/constants.js +2 -8
- package/dist/esm/lib/utils/field-options/field-type-icon.js +14 -33
- package/dist/esm/lib/utils/field-options/index.js +4 -9
- package/dist/esm/lib/utils/field-options/messages.js +43 -46
- package/dist/esm/lib/utils/field-options/useFieldOptions.js +14 -18
- package/dist/esm/lib/utils/key-generation.js +16 -27
- package/dist/esm/lib/utils/template-type-conversion/convertLocalConfiguratorToTemplateField.js +63 -77
- package/dist/esm/lib/utils/template-type-conversion/convertTemplateFieldToLocalConfigurator.js +69 -89
- package/dist/esm/lib/utils/template-type-conversion/generateJSONPatchTemplateOperations.js +150 -169
- package/dist/esm/lib/utils/template-type-conversion/mapFieldsWithUniqueKeys.js +8 -13
- package/dist/styles/chip.css +1 -1
- package/dist/styles/dropdown-field-configuration.css +1 -1
- package/dist/styles/field-context-menu.css +1 -1
- package/dist/styles/levels-chain.css +1 -1
- package/dist/styles/metadata-field-configurator.css +1 -1
- package/dist/styles/metadata-field-list.css +1 -1
- package/dist/styles/metadata-template-editor-form.css +1 -1
- package/dist/styles/metadata-template-editor-modal.css +1 -1
- package/dist/styles/metadata-template-editor.css +1 -1
- package/dist/styles/sortable-option-list.css +1 -1
- package/dist/styles/taxonomy-field-configuration.css +1 -1
- package/dist/styles/taxonomy-field-configurator-initial-state.css +1 -1
- package/dist/styles/taxonomy-selector.css +1 -1
- package/package.json +6 -6
|
@@ -1,80 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
children: /* @__PURE__ */ t(a.icon, {
|
|
63
|
-
"aria-hidden": "true"
|
|
64
|
-
})
|
|
65
|
-
}, a.label))]
|
|
66
|
-
}), /* @__PURE__ */ t(x, {
|
|
67
|
-
index: i,
|
|
68
|
-
maxIndex: u,
|
|
69
|
-
isHidden: m,
|
|
70
|
-
onReorderFields: p,
|
|
71
|
-
onToggleVisibility: S,
|
|
72
|
-
onRequestDelete: v,
|
|
73
|
-
onRequestDuplicate: g
|
|
74
|
-
})]
|
|
75
|
-
})]
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
export {
|
|
79
|
-
B as FieldActionSlot
|
|
1
|
+
import { general as e } from "../../messages/configurator-messages.js";
|
|
2
|
+
import { t } from "../../../../../../chunks/metadata-field-configurator.module.js";
|
|
3
|
+
import { t as n } from "../../../../../../chunks/field-context-menu.js";
|
|
4
|
+
import { Status as r, Tabs as i } from "@box/blueprint-web";
|
|
5
|
+
import { useIntl as a } from "react-intl";
|
|
6
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { DragDots as l } from "@box/blueprint-web-assets/icons/Fill";
|
|
8
|
+
import "react";
|
|
9
|
+
import { SurfaceStatusSurfaceGray as u } from "@box/blueprint-web-assets/tokens/tokens";
|
|
10
|
+
import { Hidden as d, Pencil as f } from "@box/blueprint-web-assets/icons/Line";
|
|
11
|
+
var p = ({ isExpanded: p, isHidden: m, index: h, maxIndex: g, dndDragHandleProps: _, onDragStart: v, onDragEnd: y, onTouchStart: b, onReorderFields: x, onToggleVisibility: S, onRequestDelete: C, onRequestDuplicate: w, extensions: T }) => {
|
|
12
|
+
let E = a();
|
|
13
|
+
return /* @__PURE__ */ c(o, { children: [
|
|
14
|
+
m && /* @__PURE__ */ s(r, {
|
|
15
|
+
icon: d,
|
|
16
|
+
iconPosition: "left",
|
|
17
|
+
color: u,
|
|
18
|
+
text: E.formatMessage(e.hiddenStatus).toUpperCase()
|
|
19
|
+
}),
|
|
20
|
+
p === !1 && /* @__PURE__ */ s("div", {
|
|
21
|
+
draggable: !_,
|
|
22
|
+
className: t.dragHandle,
|
|
23
|
+
onDragStart: !_ && v ? (e) => v(e, h) : void 0,
|
|
24
|
+
onDragEnd: !_ && y ? (e) => y(e, h) : void 0,
|
|
25
|
+
onTouchStart: !_ && b ? (e) => b(e, h) : void 0,
|
|
26
|
+
..._?.listeners ?? {},
|
|
27
|
+
..._?.attributes ?? {},
|
|
28
|
+
"aria-label": E.formatMessage(e.dragAndDropFieldAriaLabel),
|
|
29
|
+
tabIndex: _ ? void 0 : -1,
|
|
30
|
+
children: /* @__PURE__ */ s(l, {
|
|
31
|
+
fontSize: 20,
|
|
32
|
+
"aria-label": E.formatMessage(e.dragAndDropFieldAriaLabel)
|
|
33
|
+
})
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ c("div", {
|
|
36
|
+
className: t.expandedToolbarActions,
|
|
37
|
+
children: [T.length > 0 && /* @__PURE__ */ c(i.TabList, {
|
|
38
|
+
variant: "contentSwitcher",
|
|
39
|
+
containerClassname: t.extensionTabsContainer,
|
|
40
|
+
children: [/* @__PURE__ */ s(i.Tab, {
|
|
41
|
+
id: "edit",
|
|
42
|
+
variant: "contentSwitcher",
|
|
43
|
+
"aria-label": E.formatMessage(e.editTabAriaLabel),
|
|
44
|
+
children: /* @__PURE__ */ s(f, { "aria-hidden": "true" })
|
|
45
|
+
}), T.map((e, t) => /* @__PURE__ */ s(i.Tab, {
|
|
46
|
+
id: `ext-${t}`,
|
|
47
|
+
variant: "contentSwitcher",
|
|
48
|
+
"aria-label": e.label,
|
|
49
|
+
children: /* @__PURE__ */ s(e.icon, { "aria-hidden": "true" })
|
|
50
|
+
}, e.label))]
|
|
51
|
+
}), /* @__PURE__ */ s(n, {
|
|
52
|
+
index: h,
|
|
53
|
+
maxIndex: g,
|
|
54
|
+
isHidden: m,
|
|
55
|
+
onReorderFields: x,
|
|
56
|
+
onToggleVisibility: S,
|
|
57
|
+
onRequestDelete: C,
|
|
58
|
+
onRequestDuplicate: w
|
|
59
|
+
})]
|
|
60
|
+
})
|
|
61
|
+
] });
|
|
80
62
|
};
|
|
63
|
+
export { p as FieldActionSlot };
|
|
@@ -1,115 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ArrowUp as F, ArrowDown as C, TwoFiles as N, Visible as T, Hidden as A, Trash as L } from "@box/blueprint-web-assets/icons/Line";
|
|
4
|
-
import { IconIconErrorOnLight as D } from "@box/blueprint-web-assets/tokens/tokens";
|
|
5
|
-
import m from "react";
|
|
6
|
-
import { useIntl as k, FormattedMessage as l } from "react-intl";
|
|
7
|
-
import { general as n } from "../../messages/configurator-messages.js";
|
|
8
|
-
import { jsxs as i, jsx as e } from "react/jsx-runtime";
|
|
9
|
-
import '../../../../../../styles/field-context-menu.css';const O = "_contextMenuTrigger_102vn_1", U = "_menuItem_102vn_5", E = "_contextMenu_102vn_1", R = "_divider_102vn_14", r = {
|
|
10
|
-
contextMenuTrigger: O,
|
|
11
|
-
menuItem: U,
|
|
12
|
-
contextMenu: E,
|
|
13
|
-
divider: R
|
|
14
|
-
}, J = ({
|
|
15
|
-
index: a,
|
|
16
|
-
maxIndex: d,
|
|
17
|
-
isHidden: s,
|
|
18
|
-
onReorderFields: c,
|
|
19
|
-
onToggleVisibility: u,
|
|
20
|
-
onRequestDelete: h,
|
|
21
|
-
onRequestDuplicate: g
|
|
22
|
-
}) => {
|
|
23
|
-
const o = k(), [M, p] = m.useState(!1), f = m.useRef(null), v = () => {
|
|
24
|
-
a > 0 && c(a, a - 1);
|
|
25
|
-
}, I = () => {
|
|
26
|
-
c(a, a + 1);
|
|
27
|
-
};
|
|
28
|
-
return /* @__PURE__ */ i(t.Root, {
|
|
29
|
-
open: M,
|
|
30
|
-
onOpenChange: p,
|
|
31
|
-
modal: !1,
|
|
32
|
-
children: [/* @__PURE__ */ e(t.Trigger, {
|
|
33
|
-
className: r.contextMenuTrigger,
|
|
34
|
-
children: /* @__PURE__ */ e(b, {
|
|
35
|
-
icon: w,
|
|
36
|
-
"aria-label": o.formatMessage(n.contextMenuAriaLabel),
|
|
37
|
-
size: "large"
|
|
38
|
-
})
|
|
39
|
-
}), /* @__PURE__ */ i(t.Content, {
|
|
40
|
-
ref: f,
|
|
41
|
-
align: "end",
|
|
42
|
-
className: r.contextMenu,
|
|
43
|
-
children: [/* @__PURE__ */ e(t.Item, {
|
|
44
|
-
disabled: a === 0,
|
|
45
|
-
onClick: v,
|
|
46
|
-
"aria-label": o.formatMessage(n.moveUpAriaLabel),
|
|
47
|
-
children: /* @__PURE__ */ i("div", {
|
|
48
|
-
className: r.menuItem,
|
|
49
|
-
children: [/* @__PURE__ */ e(F, {
|
|
50
|
-
"aria-hidden": "true"
|
|
51
|
-
}), /* @__PURE__ */ e(l, {
|
|
52
|
-
...n.moveUp
|
|
53
|
-
})]
|
|
54
|
-
})
|
|
55
|
-
}), /* @__PURE__ */ e(t.Item, {
|
|
56
|
-
disabled: a === d,
|
|
57
|
-
onClick: I,
|
|
58
|
-
"aria-label": o.formatMessage(n.moveDownAriaLabel),
|
|
59
|
-
children: /* @__PURE__ */ i("div", {
|
|
60
|
-
className: r.menuItem,
|
|
61
|
-
children: [/* @__PURE__ */ e(C, {
|
|
62
|
-
"aria-hidden": "true"
|
|
63
|
-
}), /* @__PURE__ */ e(l, {
|
|
64
|
-
...n.moveDown
|
|
65
|
-
})]
|
|
66
|
-
})
|
|
67
|
-
}), /* @__PURE__ */ e(t.Item, {
|
|
68
|
-
onClick: g,
|
|
69
|
-
"aria-label": o.formatMessage(n.duplicateFieldAriaLabel),
|
|
70
|
-
children: /* @__PURE__ */ i("div", {
|
|
71
|
-
className: r.menuItem,
|
|
72
|
-
children: [/* @__PURE__ */ e(N, {
|
|
73
|
-
"aria-hidden": "true"
|
|
74
|
-
}), /* @__PURE__ */ e(l, {
|
|
75
|
-
...n.duplicateField
|
|
76
|
-
})]
|
|
77
|
-
})
|
|
78
|
-
}), /* @__PURE__ */ e(t.Item, {
|
|
79
|
-
onClick: () => u(!s),
|
|
80
|
-
"aria-label": o.formatMessage(s ? n.showField : n.hideField),
|
|
81
|
-
children: /* @__PURE__ */ i("div", {
|
|
82
|
-
className: r.menuItem,
|
|
83
|
-
children: [s ? /* @__PURE__ */ e(T, {
|
|
84
|
-
"aria-hidden": "true"
|
|
85
|
-
}) : /* @__PURE__ */ e(A, {
|
|
86
|
-
"aria-hidden": "true"
|
|
87
|
-
}), /* @__PURE__ */ e(l, {
|
|
88
|
-
...s ? n.showField : n.hideField
|
|
89
|
-
})]
|
|
90
|
-
})
|
|
91
|
-
}), /* @__PURE__ */ e(x, {
|
|
92
|
-
className: r.divider
|
|
93
|
-
}), /* @__PURE__ */ e(t.Item, {
|
|
94
|
-
onClick: h,
|
|
95
|
-
"aria-label": o.formatMessage(n.deleteFieldAriaLabel),
|
|
96
|
-
children: /* @__PURE__ */ i("div", {
|
|
97
|
-
className: r.menuItem,
|
|
98
|
-
children: [/* @__PURE__ */ e(L, {
|
|
99
|
-
color: D,
|
|
100
|
-
"aria-hidden": "true"
|
|
101
|
-
}), /* @__PURE__ */ e(_, {
|
|
102
|
-
as: "span",
|
|
103
|
-
color: "textOnLightError",
|
|
104
|
-
children: /* @__PURE__ */ e(l, {
|
|
105
|
-
...n.deleteField
|
|
106
|
-
})
|
|
107
|
-
})]
|
|
108
|
-
})
|
|
109
|
-
})]
|
|
110
|
-
})]
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
export {
|
|
114
|
-
J as FieldContextMenu
|
|
115
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../chunks/field-context-menu.js";
|
|
2
|
+
export { e as FieldContextMenu };
|
|
@@ -1,101 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useFieldConfigurator as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
children: /* @__PURE__ */ e(u, {
|
|
84
|
-
name: "description",
|
|
85
|
-
id: t,
|
|
86
|
-
label: T,
|
|
87
|
-
placeholder: r.formatMessage(i.fieldDescriptionInputPlaceholder),
|
|
88
|
-
value: a.description ?? "",
|
|
89
|
-
error: f("description"),
|
|
90
|
-
hideLabel: !0,
|
|
91
|
-
disabled: a.isFieldReadOnly,
|
|
92
|
-
onChange: m,
|
|
93
|
-
onBlur: p
|
|
94
|
-
})
|
|
95
|
-
})]
|
|
96
|
-
})
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
export {
|
|
100
|
-
z as FieldEditContent
|
|
1
|
+
import { a as e } from "../../../../../../chunks/types.js";
|
|
2
|
+
import { useFieldOptions as t } from "../../../../utils/field-options/useFieldOptions.js";
|
|
3
|
+
import { general as n } from "../../messages/configurator-messages.js";
|
|
4
|
+
import { useFieldConfigurator as r } from "../../context/field-configurator-context.js";
|
|
5
|
+
import { getConfigurationByType as i } from "../../utils.js";
|
|
6
|
+
import { t as a } from "../../../../../../chunks/metadata-field-configurator.module.js";
|
|
7
|
+
import { Select as o, TextInput as s, TextWithInfoBadge as c, TooltipProvider as l } from "@box/blueprint-web";
|
|
8
|
+
import { useIntl as u } from "react-intl";
|
|
9
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
10
|
+
import { useMemo as p } from "react";
|
|
11
|
+
var m = ({ nameInputId: m, descriptionInputId: h, isTypeEditable: g, externalErrors: _, externalTouched: v, handleTypeChange: y }) => {
|
|
12
|
+
let b = u(), x = t(), { values: S, errors: C, touched: w, handleChange: T, handleBlur: E } = r(), D = (e) => {
|
|
13
|
+
if (_ && v?.[e]) return _[e];
|
|
14
|
+
let t = C[e];
|
|
15
|
+
if (w[e] && t != null && typeof t == "string") return t;
|
|
16
|
+
}, O = p(() => /* @__PURE__ */ d(l, { children: /* @__PURE__ */ d(c, {
|
|
17
|
+
infoBadgeAriaLabel: b.formatMessage(n.descriptionLearnMoreBadgeAriaLabel),
|
|
18
|
+
infoText: b.formatMessage(n.descriptionInfoTooltip),
|
|
19
|
+
children: /* @__PURE__ */ d("label", {
|
|
20
|
+
className: a.labelWithTooltip,
|
|
21
|
+
htmlFor: h,
|
|
22
|
+
children: b.formatMessage(n.fieldDescriptionLabel)
|
|
23
|
+
})
|
|
24
|
+
}) }), [b, h]);
|
|
25
|
+
return /* @__PURE__ */ d("fieldset", {
|
|
26
|
+
disabled: S.isFieldReadOnly,
|
|
27
|
+
className: a.fieldset,
|
|
28
|
+
children: /* @__PURE__ */ f("div", {
|
|
29
|
+
className: a.expandedContent,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ f("div", {
|
|
32
|
+
className: a.basic,
|
|
33
|
+
children: [/* @__PURE__ */ d(s, {
|
|
34
|
+
name: "name",
|
|
35
|
+
id: m,
|
|
36
|
+
label: b.formatMessage(n.fieldNameLabel),
|
|
37
|
+
placeholder: b.formatMessage(n.fieldNameInputPlaceholder),
|
|
38
|
+
value: S.name,
|
|
39
|
+
error: D("name"),
|
|
40
|
+
onChange: T,
|
|
41
|
+
onBlur: E,
|
|
42
|
+
disabled: S.isFieldReadOnly,
|
|
43
|
+
required: !0
|
|
44
|
+
}), /* @__PURE__ */ d(o, {
|
|
45
|
+
name: "type",
|
|
46
|
+
label: b.formatMessage(n.fieldTypeLabel),
|
|
47
|
+
placeholder: b.formatMessage(n.fieldTypePlaceholder),
|
|
48
|
+
value: S.type,
|
|
49
|
+
"aria-readonly": !g,
|
|
50
|
+
readonly: !g,
|
|
51
|
+
disabled: S.isFieldReadOnly,
|
|
52
|
+
onValueChange: y,
|
|
53
|
+
className: a.fieldTypeSelect,
|
|
54
|
+
required: !0,
|
|
55
|
+
children: /* @__PURE__ */ d(o.Content, { children: x.availableFieldTypes.map((e) => /* @__PURE__ */ d(o.Option, {
|
|
56
|
+
text: typeof e.label == "string" ? e.label : String(e.label),
|
|
57
|
+
value: e.type
|
|
58
|
+
}, e.type)) })
|
|
59
|
+
})]
|
|
60
|
+
}),
|
|
61
|
+
[e.Dropdown, e.Taxonomy].includes(S.type) && /* @__PURE__ */ d("div", {
|
|
62
|
+
className: a.typeSpecific,
|
|
63
|
+
children: i(S.type)
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ d("div", {
|
|
66
|
+
className: a.description,
|
|
67
|
+
children: /* @__PURE__ */ d(s, {
|
|
68
|
+
name: "description",
|
|
69
|
+
id: h,
|
|
70
|
+
label: O,
|
|
71
|
+
placeholder: b.formatMessage(n.fieldDescriptionInputPlaceholder),
|
|
72
|
+
value: S.description ?? "",
|
|
73
|
+
error: D("description"),
|
|
74
|
+
hideLabel: !0,
|
|
75
|
+
disabled: S.isFieldReadOnly,
|
|
76
|
+
onChange: T,
|
|
77
|
+
onBlur: E
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
});
|
|
101
83
|
};
|
|
84
|
+
export { m as FieldEditContent };
|
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { useIntl as a } from "react-intl";
|
|
4
|
-
import c from "../../messages/levels-chain-messages.js";
|
|
5
|
-
import { jsx as d } from "react/jsx-runtime";
|
|
6
|
-
import '../../../../../../styles/chip.css';const m = "_chip_x2zx9_1", p = "_selected_x2zx9_12", l = {
|
|
7
|
-
chip: m,
|
|
8
|
-
selected: p
|
|
9
|
-
};
|
|
10
|
-
let o = /* @__PURE__ */ (function(e) {
|
|
11
|
-
return e.Selected = "selected", e.Unselected = "unselected", e;
|
|
12
|
-
})({});
|
|
13
|
-
const S = ({
|
|
14
|
-
value: e,
|
|
15
|
-
selected: t = !1
|
|
16
|
-
}) => {
|
|
17
|
-
const {
|
|
18
|
-
formatMessage: s
|
|
19
|
-
} = a(), r = s(t ? c.chipSelected : c.chipNotSelected);
|
|
20
|
-
return /* @__PURE__ */ d(n, {
|
|
21
|
-
as: "span",
|
|
22
|
-
className: i(l.chip, {
|
|
23
|
-
[l.selected]: t
|
|
24
|
-
}),
|
|
25
|
-
"data-state": t ? o.Selected : o.Unselected,
|
|
26
|
-
"aria-label": `${e}: ${r}`,
|
|
27
|
-
children: e
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
S as Chip,
|
|
32
|
-
o as ChipState
|
|
33
|
-
};
|
|
1
|
+
import { n as e, t } from "../../../../../../chunks/chip.js";
|
|
2
|
+
export { t as Chip, e as ChipState };
|
package/dist/esm/lib/components/metadata-field-configurator/components/levels-chain/levels-chain.js
CHANGED
|
@@ -1,118 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { IconIconOnLightSecondary as k } from "@box/blueprint-web-assets/tokens/tokens";
|
|
4
|
-
import { useState as u, useRef as b, useMemo as v, useEffect as A, useLayoutEffect as q } from "react";
|
|
5
|
-
import { FormattedMessage as F } from "react-intl";
|
|
6
|
-
import O from "../../messages/levels-chain-messages.js";
|
|
7
|
-
import { Chip as L } from "./chip.js";
|
|
8
|
-
import { getHideCounts as $ } from "./utils.js";
|
|
9
|
-
import { jsx as l, jsxs as m } from "react/jsx-runtime";
|
|
10
|
-
import '../../../../../../styles/levels-chain.css';const D = "_levelsChain_1wuki_1", y = {
|
|
11
|
-
levelsChain: D
|
|
12
|
-
};
|
|
13
|
-
function G(t) {
|
|
14
|
-
const a = Math.ceil(t.length / 2);
|
|
15
|
-
return [t.slice(0, a), t.slice(a)];
|
|
16
|
-
}
|
|
17
|
-
const te = ({
|
|
18
|
-
levels: t = [],
|
|
19
|
-
selectedLevels: a = []
|
|
20
|
-
}) => {
|
|
21
|
-
const [n, h] = G(t), [r, C] = u(!1), [w, E] = u([]), [R, M] = u([]), [W, H] = u(0), [x, I] = u(0), s = b(null), g = b(null), S = v(() => {
|
|
22
|
-
const e = s.current ? window.getComputedStyle(s.current) : {
|
|
23
|
-
gap: "11px"
|
|
24
|
-
};
|
|
25
|
-
return parseInt(e.gap, 10);
|
|
26
|
-
}, [s.current]), f = /* @__PURE__ */ l(_, {
|
|
27
|
-
color: k,
|
|
28
|
-
"aria-hidden": "true"
|
|
29
|
-
});
|
|
30
|
-
A(() => {
|
|
31
|
-
C(!1);
|
|
32
|
-
}, [t]), q(() => {
|
|
33
|
-
if (s.current && !r && t.length > 0) {
|
|
34
|
-
const e = s.current;
|
|
35
|
-
I(e.clientWidth);
|
|
36
|
-
const i = e.querySelectorAll("li"), o = Array.from(i).slice(0, n.length), z = Array.from(i).slice(n.length + 1);
|
|
37
|
-
E(o.map((p) => p.getBoundingClientRect().width)), M(z.map((p) => p.getBoundingClientRect().width)), g.current && H(g.current.getBoundingClientRect().width), C(!0);
|
|
38
|
-
}
|
|
39
|
-
}, [n, h, r, t.length]), A(() => {
|
|
40
|
-
const e = () => {
|
|
41
|
-
s.current && I(s.current.clientWidth);
|
|
42
|
-
};
|
|
43
|
-
return window.addEventListener("resize", e), () => {
|
|
44
|
-
window.removeEventListener("resize", e);
|
|
45
|
-
};
|
|
46
|
-
}, []);
|
|
47
|
-
const [d, c] = v(() => $({
|
|
48
|
-
isMeasured: r,
|
|
49
|
-
leftLevelWidths: w,
|
|
50
|
-
rightLevelWidths: R,
|
|
51
|
-
containerWidthPx: x,
|
|
52
|
-
buttonWidthPx: W,
|
|
53
|
-
gapBetweenItems: S
|
|
54
|
-
}), [r, w, R, x, W, S]), B = v(() => {
|
|
55
|
-
const e = n.slice(n.length - d), i = h.slice(0, c);
|
|
56
|
-
return [...e, ...i];
|
|
57
|
-
}, [d, c, n, h]), T = B.some((e) => a.includes(e.level)), j = () => r ? d > 0 || c > 0 ? {} : {
|
|
58
|
-
display: "none"
|
|
59
|
-
} : {
|
|
60
|
-
position: "absolute",
|
|
61
|
-
visibility: "hidden"
|
|
62
|
-
};
|
|
63
|
-
return t.length === 0 ? /* @__PURE__ */ l("div", {
|
|
64
|
-
role: "alert",
|
|
65
|
-
children: /* @__PURE__ */ l(F, {
|
|
66
|
-
...O.noLevels
|
|
67
|
-
})
|
|
68
|
-
}) : /* @__PURE__ */ m("ul", {
|
|
69
|
-
ref: s,
|
|
70
|
-
className: y.levelsChain,
|
|
71
|
-
"data-testid": "taxonomy-levels-chain",
|
|
72
|
-
children: [n.map((e, i) => {
|
|
73
|
-
const o = r && i >= n.length - d;
|
|
74
|
-
return /* @__PURE__ */ m("li", {
|
|
75
|
-
className: y.left,
|
|
76
|
-
style: {
|
|
77
|
-
display: o ? "none" : void 0
|
|
78
|
-
},
|
|
79
|
-
"aria-hidden": o,
|
|
80
|
-
children: [/* @__PURE__ */ l(L, {
|
|
81
|
-
value: e.name,
|
|
82
|
-
selected: a.includes(e.level)
|
|
83
|
-
}), n.length + h.length > 1 ? f : null]
|
|
84
|
-
}, e.level);
|
|
85
|
-
}), /* @__PURE__ */ m("li", {
|
|
86
|
-
ref: g,
|
|
87
|
-
style: j(),
|
|
88
|
-
"aria-hidden": !(d > 0 || c > 0),
|
|
89
|
-
tabIndex: r && (d > 0 || c > 0) ? 0 : -1,
|
|
90
|
-
children: [/* @__PURE__ */ l(N, {
|
|
91
|
-
content: B.map((e) => e.name).join(" > "),
|
|
92
|
-
children: /* @__PURE__ */ l(P, {
|
|
93
|
-
as: "span",
|
|
94
|
-
children: /* @__PURE__ */ l(L, {
|
|
95
|
-
value: `+${d + c}`,
|
|
96
|
-
selected: T
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
}), f]
|
|
100
|
-
}), h.map((e, i) => {
|
|
101
|
-
const o = r && i < c;
|
|
102
|
-
return /* @__PURE__ */ m("li", {
|
|
103
|
-
className: y.right,
|
|
104
|
-
style: {
|
|
105
|
-
display: o ? "none" : void 0
|
|
106
|
-
},
|
|
107
|
-
"aria-hidden": o,
|
|
108
|
-
children: [/* @__PURE__ */ l(L, {
|
|
109
|
-
value: e.name,
|
|
110
|
-
selected: a.includes(e.level)
|
|
111
|
-
}), i < h.length - 1 && f]
|
|
112
|
-
}, e.level);
|
|
113
|
-
})]
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
export {
|
|
117
|
-
te as LevelsChain
|
|
118
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../chunks/levels-chain.js";
|
|
2
|
+
export { e as LevelsChain };
|