@box/metadata-view 1.17.3 → 1.18.1
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/esm/lib/components/item-action-menu/identifier.js +8 -0
- package/dist/esm/lib/components/item-action-menu/item-action-menu.js +91 -84
- package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +6 -5
- package/dist/esm/lib/components/metadata-value/metadata-location-field.js +16 -15
- package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +16 -14
- package/dist/esm/lib/components/metadata-value/metadata-search-field.js +12 -11
- package/dist/types/lib/components/item-action-menu/identifier.d.ts +5 -0
- package/package.json +5 -5
|
@@ -1,110 +1,117 @@
|
|
|
1
1
|
import { useMemo as $ } from "react";
|
|
2
2
|
import { useIntl as x } from "react-intl";
|
|
3
|
-
import { IconButton as
|
|
4
|
-
import { Ellipsis as
|
|
5
|
-
import { V as
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import { IconButton as f, DropdownMenu as r, GridList as g } from "@box/blueprint-web";
|
|
4
|
+
import { Ellipsis as T } from "@box/blueprint-web-assets/icons/Fill";
|
|
5
|
+
import { V as M } from "../../../../chunks/types.js";
|
|
6
|
+
import _ from "./messages.js";
|
|
7
|
+
import { getDataTargetId as d } from "./identifier.js";
|
|
8
|
+
import { jsxs as p, jsx as a } from "react/jsx-runtime";
|
|
9
|
+
import '../../../../styles/item-action-menu.css';const A = "_tableActionBar_akgtp_1", N = "_actionItemIcon_akgtp_6", B = {
|
|
10
|
+
tableActionBar: A,
|
|
11
|
+
actionItemIcon: N
|
|
11
12
|
};
|
|
12
|
-
function
|
|
13
|
-
return (
|
|
14
|
-
|
|
13
|
+
function b(c) {
|
|
14
|
+
return (t) => {
|
|
15
|
+
t.stopPropagation(), c();
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
18
|
function L({
|
|
18
|
-
item:
|
|
19
|
-
label:
|
|
20
|
-
onClick:
|
|
21
|
-
icon:
|
|
22
|
-
isDisabled:
|
|
19
|
+
item: c,
|
|
20
|
+
label: t,
|
|
21
|
+
onClick: l,
|
|
22
|
+
icon: o,
|
|
23
|
+
isDisabled: m
|
|
23
24
|
}) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
}), I = $(() => (
|
|
27
|
-
return /* @__PURE__ */
|
|
25
|
+
const i = b(() => {
|
|
26
|
+
l(c);
|
|
27
|
+
}), I = $(() => (m == null ? void 0 : m(c)) ?? !1, [m, c]);
|
|
28
|
+
return /* @__PURE__ */ p(r.Item, {
|
|
29
|
+
"data-target-id": d(r.Item, t),
|
|
28
30
|
disabled: I,
|
|
29
|
-
onClick:
|
|
30
|
-
children: [/* @__PURE__ */
|
|
31
|
-
className:
|
|
32
|
-
}),
|
|
33
|
-
},
|
|
31
|
+
onClick: i,
|
|
32
|
+
children: [/* @__PURE__ */ a(o, {
|
|
33
|
+
className: B.actionItemIcon
|
|
34
|
+
}), t]
|
|
35
|
+
}, t);
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
actions:
|
|
37
|
-
inlineActions:
|
|
38
|
-
isDisabled:
|
|
39
|
-
item:
|
|
40
|
-
onOpenChange:
|
|
41
|
-
subMenuActions:
|
|
37
|
+
function W({
|
|
38
|
+
actions: c,
|
|
39
|
+
inlineActions: t,
|
|
40
|
+
isDisabled: l,
|
|
41
|
+
item: o,
|
|
42
|
+
onOpenChange: m,
|
|
43
|
+
subMenuActions: i,
|
|
42
44
|
subMenuTrigger: I,
|
|
43
|
-
viewMode: h =
|
|
45
|
+
viewMode: h = M.LIST
|
|
44
46
|
}) {
|
|
45
47
|
const {
|
|
46
48
|
formatMessage: k
|
|
47
49
|
} = x(), {
|
|
48
|
-
label:
|
|
49
|
-
icon:
|
|
50
|
+
label: s,
|
|
51
|
+
icon: C
|
|
50
52
|
} = I || {};
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
className:
|
|
53
|
-
children: [h ===
|
|
54
|
-
onClick:
|
|
55
|
-
label:
|
|
56
|
-
icon:
|
|
57
|
-
isDisabled:
|
|
58
|
-
}) => /* @__PURE__ */
|
|
59
|
-
"aria-label":
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
return /* @__PURE__ */ p("div", {
|
|
54
|
+
className: B.tableActionBar,
|
|
55
|
+
children: [h === M.LIST && (t == null ? void 0 : t.map(({
|
|
56
|
+
onClick: n,
|
|
57
|
+
label: e,
|
|
58
|
+
icon: S,
|
|
59
|
+
isDisabled: u
|
|
60
|
+
}) => /* @__PURE__ */ a(f, {
|
|
61
|
+
"aria-label": e,
|
|
62
|
+
"data-target-id": d(f, e),
|
|
63
|
+
disabled: (u == null ? void 0 : u(o)) ?? !1,
|
|
64
|
+
icon: S,
|
|
65
|
+
onClick: b(() => n(o)),
|
|
63
66
|
size: "large"
|
|
64
|
-
}, `${
|
|
65
|
-
onOpenChange:
|
|
66
|
-
children: [/* @__PURE__ */
|
|
67
|
-
children: h ===
|
|
68
|
-
"aria-label": k(
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
}, `${o.id}-${e}`))), c ? /* @__PURE__ */ p(r.Root, {
|
|
68
|
+
onOpenChange: m,
|
|
69
|
+
children: [/* @__PURE__ */ a(r.Trigger, {
|
|
70
|
+
children: h === M.LIST ? /* @__PURE__ */ a(f, {
|
|
71
|
+
"aria-label": k(_.actionMenu),
|
|
72
|
+
"data-target-id": d(f, "openActionMenu"),
|
|
73
|
+
disabled: l,
|
|
74
|
+
icon: T,
|
|
71
75
|
size: "large"
|
|
72
|
-
}) : /* @__PURE__ */
|
|
73
|
-
"aria-label": k(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
}) : /* @__PURE__ */ a(g.ActionIconButton, {
|
|
77
|
+
"aria-label": k(_.actionMenu),
|
|
78
|
+
"data-target-id": d(g.ActionIconButton, "openActionMenu"),
|
|
79
|
+
disabled: l,
|
|
80
|
+
icon: T
|
|
76
81
|
})
|
|
77
|
-
}), /* @__PURE__ */
|
|
82
|
+
}), /* @__PURE__ */ p(r.Content, {
|
|
78
83
|
align: "start",
|
|
79
|
-
children: [
|
|
80
|
-
item:
|
|
81
|
-
...
|
|
82
|
-
},
|
|
83
|
-
children: [/* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
children: [c.map((n) => /* @__PURE__ */ a(L, {
|
|
85
|
+
item: o,
|
|
86
|
+
...n
|
|
87
|
+
}, n.label)), i && I && /* @__PURE__ */ p(r.SubMenuRoot, {
|
|
88
|
+
children: [/* @__PURE__ */ p(r.SubMenuTrigger, {
|
|
89
|
+
"data-target-id": d(r.SubMenuTrigger, "openActionSubmenu"),
|
|
90
|
+
children: [C && /* @__PURE__ */ a(C, {
|
|
91
|
+
className: B.actionItemIcon
|
|
92
|
+
}), s]
|
|
93
|
+
}), /* @__PURE__ */ a(r.SubMenuContent, {
|
|
94
|
+
children: i.map((n) => /* @__PURE__ */ a(L, {
|
|
95
|
+
item: o,
|
|
96
|
+
...n
|
|
97
|
+
}, n.label))
|
|
92
98
|
})]
|
|
93
99
|
})]
|
|
94
100
|
})]
|
|
95
|
-
}) : null, h ===
|
|
96
|
-
onClick:
|
|
97
|
-
label:
|
|
98
|
-
icon:
|
|
99
|
-
isDisabled:
|
|
100
|
-
}) => /* @__PURE__ */
|
|
101
|
-
"aria-label":
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
}) : null, h === M.GRID && (t == null ? void 0 : t.map(({
|
|
102
|
+
onClick: n,
|
|
103
|
+
label: e,
|
|
104
|
+
icon: S,
|
|
105
|
+
isDisabled: u
|
|
106
|
+
}) => /* @__PURE__ */ a(g.ActionIconButton, {
|
|
107
|
+
"aria-label": e,
|
|
108
|
+
"data-target-id": d(g.ActionIconButton, e),
|
|
109
|
+
disabled: (u == null ? void 0 : u(o)) ?? !1,
|
|
110
|
+
icon: S,
|
|
111
|
+
onClick: () => n(o)
|
|
112
|
+
}, `${o.id}-${e}`)))]
|
|
106
113
|
});
|
|
107
114
|
}
|
|
108
115
|
export {
|
|
109
|
-
|
|
116
|
+
W as ItemActionMenu
|
|
110
117
|
};
|
|
@@ -5,12 +5,12 @@ const b = ({
|
|
|
5
5
|
id: a,
|
|
6
6
|
name: i
|
|
7
7
|
}) => {
|
|
8
|
-
var
|
|
8
|
+
var n, s, r;
|
|
9
9
|
const {
|
|
10
|
-
values:
|
|
10
|
+
values: d,
|
|
11
11
|
setFieldValue: u
|
|
12
|
-
} = C(), h = ((
|
|
13
|
-
const t = new Set(
|
|
12
|
+
} = C(), h = ((n = d.metadata.fields[a]) == null ? void 0 : n.options) || [], l = ((r = (s = d.metadata.fields[a]) == null ? void 0 : s.value) == null ? void 0 : r.enum) || [], f = (e, o) => {
|
|
13
|
+
const t = new Set(l);
|
|
14
14
|
o ? t.add(e) : t.delete(e), u(`metadata.fields.${a}.value.enum`, Array.from(t));
|
|
15
15
|
};
|
|
16
16
|
return /* @__PURE__ */ m(c.Legend, {
|
|
@@ -18,9 +18,10 @@ const b = ({
|
|
|
18
18
|
children: h.map(({
|
|
19
19
|
key: e
|
|
20
20
|
}) => {
|
|
21
|
-
const o =
|
|
21
|
+
const o = l.includes(e);
|
|
22
22
|
return /* @__PURE__ */ m(c.Item, {
|
|
23
23
|
checked: o,
|
|
24
|
+
"data-target-id": `CheckboxItem-filter_${a}_${e}`,
|
|
24
25
|
label: e,
|
|
25
26
|
onCheckedChange: (t) => {
|
|
26
27
|
f(e, t === !0);
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
import { ContentField as f } from "@box/blueprint-web";
|
|
2
2
|
import { useFormikContext as u } from "formik";
|
|
3
3
|
import p from "lodash/noop";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
4
|
+
import { useIntl as C } from "react-intl";
|
|
5
|
+
import h from "./messages.js";
|
|
6
6
|
import { jsx as i } from "react/jsx-runtime";
|
|
7
7
|
import '../../../../styles/metadata-location-field.css';const v = "_metadataLocationFieldTrigger_1d3ch_1", L = {
|
|
8
8
|
metadataLocationFieldTrigger: v
|
|
9
|
-
},
|
|
10
|
-
id:
|
|
9
|
+
}, N = ({
|
|
10
|
+
id: e,
|
|
11
11
|
triggerSetValueCallback: n = p,
|
|
12
|
-
renderer:
|
|
12
|
+
renderer: l = (a) => a
|
|
13
13
|
}) => {
|
|
14
14
|
var r;
|
|
15
15
|
const {
|
|
16
16
|
formatMessage: a
|
|
17
|
-
} =
|
|
18
|
-
values:
|
|
17
|
+
} = C(), {
|
|
18
|
+
values: s,
|
|
19
19
|
setFieldValue: o
|
|
20
|
-
} = u(),
|
|
21
|
-
o(`metadata.fields.${
|
|
20
|
+
} = u(), t = (r = s.metadata.fields[e].value.enum) == null ? void 0 : r[0], m = () => {
|
|
21
|
+
o(`metadata.fields.${e}.value.enum`, []);
|
|
22
22
|
}, d = () => {
|
|
23
23
|
n((c, F, g = !1) => {
|
|
24
|
-
o(`metadata.fields.${
|
|
24
|
+
o(`metadata.fields.${e}.value.enum[0]`, {
|
|
25
25
|
folderId: c,
|
|
26
26
|
folderName: F,
|
|
27
27
|
isFolderShared: g
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
};
|
|
31
|
-
return
|
|
31
|
+
return l(/* @__PURE__ */ i("div", {
|
|
32
32
|
className: L.metadataLocationFieldTrigger,
|
|
33
33
|
children: /* @__PURE__ */ i(f, {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
"data-target-id": `ContentField-filter_${e}`,
|
|
35
|
+
hintText: a(h.selectFolderHint),
|
|
36
|
+
isSharedFolder: t == null ? void 0 : t.isFolderShared,
|
|
36
37
|
onClick: d,
|
|
37
38
|
onClickClearButton: m,
|
|
38
|
-
title:
|
|
39
|
+
title: t == null ? void 0 : t.folderName
|
|
39
40
|
})
|
|
40
41
|
}));
|
|
41
42
|
};
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
N as MetadataLocationField
|
|
44
45
|
};
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { useFormikContext as v } from "formik";
|
|
2
2
|
import { Radio as a } from "@box/blueprint-web";
|
|
3
|
-
import { jsx as
|
|
4
|
-
const
|
|
3
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
4
|
+
const R = ({
|
|
5
5
|
id: t,
|
|
6
6
|
name: i,
|
|
7
|
-
placeholder:
|
|
7
|
+
placeholder: l
|
|
8
8
|
}) => {
|
|
9
|
-
var
|
|
9
|
+
var r, m, s, u;
|
|
10
10
|
const {
|
|
11
|
-
values:
|
|
12
|
-
setFieldValue:
|
|
13
|
-
} = v(), f = ((
|
|
14
|
-
return /* @__PURE__ */
|
|
11
|
+
values: d,
|
|
12
|
+
setFieldValue: n
|
|
13
|
+
} = v(), f = ((s = (m = (r = d.metadata.fields[t]) == null ? void 0 : r.value) == null ? void 0 : m.enum) == null ? void 0 : s[0]) || "", p = ((u = d.metadata.fields[t]) == null ? void 0 : u.options) || [];
|
|
14
|
+
return /* @__PURE__ */ o(a.Legend, {
|
|
15
15
|
header: i,
|
|
16
16
|
children: /* @__PURE__ */ c(a.Group, {
|
|
17
17
|
loop: !0,
|
|
18
18
|
name: i,
|
|
19
19
|
onValueChange: (e) => {
|
|
20
|
-
|
|
20
|
+
n(`metadata.fields.${t}.value.enum[0]`, e);
|
|
21
21
|
},
|
|
22
22
|
value: f,
|
|
23
|
-
children: [
|
|
24
|
-
|
|
23
|
+
children: [l && /* @__PURE__ */ o(a.Item, {
|
|
24
|
+
"data-target-id": `RadioItem-filter_${t}_placeholder`,
|
|
25
|
+
label: l,
|
|
25
26
|
value: ""
|
|
26
|
-
},
|
|
27
|
+
}, l), p.map(({
|
|
27
28
|
key: e
|
|
28
|
-
}) => /* @__PURE__ */
|
|
29
|
+
}) => /* @__PURE__ */ o(a.Item, {
|
|
30
|
+
"data-target-id": `RadioItem-filter_${t}_${e}`,
|
|
29
31
|
label: e,
|
|
30
32
|
value: e
|
|
31
33
|
}, e))]
|
|
@@ -33,5 +35,5 @@ const b = ({
|
|
|
33
35
|
});
|
|
34
36
|
};
|
|
35
37
|
export {
|
|
36
|
-
|
|
38
|
+
R as MetadataRadioField
|
|
37
39
|
};
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
import { SearchInput as i } from "@box/blueprint-web";
|
|
2
2
|
import { useFormikContext as c } from "formik";
|
|
3
3
|
import { useIntl as f } from "react-intl";
|
|
4
|
-
import
|
|
5
|
-
import { jsx as
|
|
6
|
-
const
|
|
4
|
+
import n from "./messages.js";
|
|
5
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
6
|
+
const b = ({
|
|
7
7
|
id: e,
|
|
8
|
-
name:
|
|
8
|
+
name: s,
|
|
9
9
|
placeholder: m
|
|
10
10
|
}) => {
|
|
11
|
-
var o,
|
|
11
|
+
var o, l;
|
|
12
12
|
const {
|
|
13
13
|
formatMessage: t
|
|
14
14
|
} = f(), {
|
|
15
15
|
values: u,
|
|
16
16
|
setFieldValue: r
|
|
17
|
-
} = c(), a = (
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
} = c(), a = (l = (o = u.metadata.fields[e]) == null ? void 0 : o.value) == null ? void 0 : l.enum;
|
|
18
|
+
return /* @__PURE__ */ d(i.Controlled, {
|
|
19
|
+
"data-target-id": `SearchInputControlled-filter_${e}`,
|
|
19
20
|
id: e,
|
|
20
|
-
name:
|
|
21
|
+
name: s,
|
|
21
22
|
onChange: (p) => r(`metadata.fields.${e}.value.enum[0]`, p.target.value),
|
|
22
23
|
onClearInput: () => r(`metadata.fields.${e}.value.enum`, []),
|
|
23
24
|
placeholder: m,
|
|
24
|
-
searchInputAriaLabel: t(
|
|
25
|
-
searchInputClearAriaLabel: t(
|
|
25
|
+
searchInputAriaLabel: t(n.searchInputAriaLabel),
|
|
26
|
+
searchInputClearAriaLabel: t(n.searchInputClearAriaLabel),
|
|
26
27
|
value: (a == null ? void 0 : a[0]) || ""
|
|
27
28
|
});
|
|
28
29
|
};
|
|
29
30
|
export {
|
|
30
|
-
|
|
31
|
+
b as MetadataSearchField
|
|
31
32
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.1",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^12.76.2",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"react-intl": "^6.4.2"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@box/blueprint-web": "^12.
|
|
21
|
+
"@box/blueprint-web": "^12.99.0",
|
|
22
22
|
"@box/blueprint-web-assets": "^4.82.0",
|
|
23
|
-
"@box/box-item-type-selector": "^1.11.
|
|
23
|
+
"@box/box-item-type-selector": "^1.11.3",
|
|
24
24
|
"@box/eslint-plugin-blueprint": "1.0.5",
|
|
25
|
-
"@box/item-icon": "^2.2.
|
|
26
|
-
"@box/metadata-filter": "^1.
|
|
25
|
+
"@box/item-icon": "^2.2.3",
|
|
26
|
+
"@box/metadata-filter": "^1.49.1",
|
|
27
27
|
"@box/storybook-utils": "0.14.19",
|
|
28
28
|
"@box/types": "2.0.0",
|
|
29
29
|
"@tanstack/react-virtual": "^3.10.8",
|