@box/metadata-view 0.23.1 → 0.23.2
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/string-filter-chip.js +69 -0
- package/dist/esm/lib/components/action-bar/action-bar.js +35 -33
- package/dist/esm/lib/components/filter-row/filter-row.js +17 -16
- package/dist/esm/lib/components/filter-row/string-filter-chip.js +9 -65
- package/dist/esm/lib/metadata-view.js +44 -39
- package/dist/styles/action-bar.css +1 -1
- package/dist/styles/metadata-view.css +1 -0
- package/dist/styles/string-filter-chip.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Popover as o, FilterChip as t, Button as m } from "@box/blueprint-web";
|
|
2
|
+
import { MetadataStringField as C } from "@box/metadata-filter";
|
|
3
|
+
import { useState as v } from "react";
|
|
4
|
+
import { useIntl as F } from "react-intl";
|
|
5
|
+
import { useFormikContext as g } from "formik";
|
|
6
|
+
import c from "../esm/lib/components/filter-row/messages.js";
|
|
7
|
+
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
8
|
+
import '../styles/string-filter-chip.css';const y = "_popoverFooter_6tqyh_1", _ = "_filterChipGroup_6tqyh_9", b = {
|
|
9
|
+
popoverFooter: y,
|
|
10
|
+
filterChipGroup: _
|
|
11
|
+
}, O = ({
|
|
12
|
+
formRef: d,
|
|
13
|
+
id: r,
|
|
14
|
+
name: n,
|
|
15
|
+
selected: h,
|
|
16
|
+
icon: a
|
|
17
|
+
}) => {
|
|
18
|
+
const {
|
|
19
|
+
formatMessage: l
|
|
20
|
+
} = F(), [f, s] = v(!1), p = g(), u = () => {
|
|
21
|
+
p.handleSubmit(), s(!1);
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ e("div", {
|
|
24
|
+
children: /* @__PURE__ */ i(o.Root, {
|
|
25
|
+
onOpenChange: s,
|
|
26
|
+
open: f,
|
|
27
|
+
children: [/* @__PURE__ */ e(o.Trigger, {
|
|
28
|
+
children: /* @__PURE__ */ i(t.TriggerChip, {
|
|
29
|
+
selected: h,
|
|
30
|
+
value: r,
|
|
31
|
+
children: [a && /* @__PURE__ */ e(t.Icon, {
|
|
32
|
+
icon: a
|
|
33
|
+
}), /* @__PURE__ */ e(t.Label, {
|
|
34
|
+
children: n
|
|
35
|
+
}), /* @__PURE__ */ e(t.DropdownIndicator, {})]
|
|
36
|
+
}, r)
|
|
37
|
+
}), /* @__PURE__ */ i(o.ContentContainer, {
|
|
38
|
+
align: "start",
|
|
39
|
+
container: d.current,
|
|
40
|
+
children: [/* @__PURE__ */ e(o.MainContent, {
|
|
41
|
+
children: /* @__PURE__ */ e(C, {
|
|
42
|
+
fieldNamePrefix: `metadata.fields.${r}`,
|
|
43
|
+
label: n
|
|
44
|
+
})
|
|
45
|
+
}), /* @__PURE__ */ i(o.Footer, {
|
|
46
|
+
className: b.popoverFooter,
|
|
47
|
+
children: [/* @__PURE__ */ e(m, {
|
|
48
|
+
onClick: () => {
|
|
49
|
+
p.setFieldValue(`metadata.fields.${r}.value.enum`, []);
|
|
50
|
+
},
|
|
51
|
+
size: "small",
|
|
52
|
+
variant: "secondary",
|
|
53
|
+
children: l(c.clearButton)
|
|
54
|
+
}), /* @__PURE__ */ e(m, {
|
|
55
|
+
onClick: u,
|
|
56
|
+
size: "small",
|
|
57
|
+
type: "submit",
|
|
58
|
+
variant: "primary",
|
|
59
|
+
children: l(c.applyButton)
|
|
60
|
+
})]
|
|
61
|
+
})]
|
|
62
|
+
})]
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
export {
|
|
67
|
+
O as S,
|
|
68
|
+
b as s
|
|
69
|
+
};
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import { Button as
|
|
2
|
-
import { Grid as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { V as
|
|
1
|
+
import { Button as d } from "@box/blueprint-web";
|
|
2
|
+
import { Grid as f } from "@box/blueprint-web-assets/icons/Fill";
|
|
3
|
+
import { useIntl as p } from "react-intl";
|
|
4
|
+
import { V as s } from "../../../../chunks/types.js";
|
|
5
5
|
import n from "./messages.js";
|
|
6
|
-
import { SortDropdown as
|
|
7
|
-
import { jsxs as
|
|
8
|
-
import { FilterRow as
|
|
9
|
-
import '../../../../styles/action-bar.css';const
|
|
10
|
-
actionBar:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
import { SortDropdown as w } from "./sort-dropdown.js";
|
|
7
|
+
import { jsxs as c, jsx as i } from "react/jsx-runtime";
|
|
8
|
+
import { FilterRow as _ } from "../filter-row/filter-row.js";
|
|
9
|
+
import '../../../../styles/action-bar.css';const R = "_actionBar_1jgp4_1", B = "_filterRow_1jgp4_8", g = "_additionalActions_1jgp4_13", o = {
|
|
10
|
+
actionBar: R,
|
|
11
|
+
filterRow: B,
|
|
12
|
+
additionalActions: g
|
|
13
|
+
}, y = ({
|
|
14
|
+
onViewModeClick: e,
|
|
15
|
+
viewMode: t,
|
|
16
|
+
sortableColumnNames: m,
|
|
17
|
+
sortDropdownProps: r,
|
|
18
|
+
...l
|
|
18
19
|
}) => {
|
|
19
20
|
const {
|
|
20
21
|
formatMessage: a
|
|
21
|
-
} =
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
className:
|
|
22
|
+
} = p();
|
|
23
|
+
return /* @__PURE__ */ c("div", {
|
|
24
|
+
className: o.actionBar,
|
|
24
25
|
children: [/* @__PURE__ */ i("div", {
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
className: o.filterRow,
|
|
27
|
+
children: /* @__PURE__ */ i(_, {
|
|
28
|
+
...l
|
|
27
29
|
})
|
|
28
|
-
}), /* @__PURE__ */
|
|
29
|
-
className:
|
|
30
|
-
children: [
|
|
31
|
-
...
|
|
32
|
-
sortableColumnNames:
|
|
33
|
-
}), /* @__PURE__ */ i(
|
|
34
|
-
"aria-label":
|
|
35
|
-
icon:
|
|
36
|
-
onClick:
|
|
37
|
-
variant:
|
|
30
|
+
}), /* @__PURE__ */ c("div", {
|
|
31
|
+
className: o.additionalActions,
|
|
32
|
+
children: [r && /* @__PURE__ */ i(w, {
|
|
33
|
+
...r,
|
|
34
|
+
sortableColumnNames: m
|
|
35
|
+
}), /* @__PURE__ */ i(d, {
|
|
36
|
+
"aria-label": t === s.GRID ? a(n.switchToListView) : a(n.switchToGridView),
|
|
37
|
+
icon: f,
|
|
38
|
+
onClick: e,
|
|
39
|
+
variant: t === s.GRID ? "primary" : "tertiary"
|
|
38
40
|
})]
|
|
39
41
|
})]
|
|
40
42
|
});
|
|
41
43
|
};
|
|
42
44
|
export {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
y as ActionBar,
|
|
46
|
+
y as default
|
|
45
47
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { FilterChip as
|
|
2
|
-
import { Formik as
|
|
1
|
+
import { FilterChip as a } from "@box/blueprint-web";
|
|
2
|
+
import { Formik as g, Form as v } from "formik";
|
|
3
3
|
import { useState as I, useRef as b } from "react";
|
|
4
4
|
import w from "./all-filters-chip.js";
|
|
5
|
-
import { getInitialFieldValues as
|
|
6
|
-
import {
|
|
5
|
+
import { getInitialFieldValues as G } from "./initial-field-values.js";
|
|
6
|
+
import { s as R, S as j } from "../../../../chunks/string-filter-chip.js";
|
|
7
7
|
import { usePredefinedFilter as x } from "./use-predefined-filter.js";
|
|
8
8
|
import { jsx as r, jsxs as p } from "react/jsx-runtime";
|
|
9
|
-
const
|
|
9
|
+
const y = (e, n, m) => {
|
|
10
10
|
const {
|
|
11
11
|
icon: i
|
|
12
12
|
} = e;
|
|
@@ -18,16 +18,16 @@ const G = (e, a, m) => {
|
|
|
18
18
|
icon: i,
|
|
19
19
|
id: e.id,
|
|
20
20
|
name: e.name,
|
|
21
|
-
selected:
|
|
21
|
+
selected: n
|
|
22
22
|
}, e.id);
|
|
23
23
|
case "date":
|
|
24
24
|
case "enum":
|
|
25
25
|
case "multiSelect":
|
|
26
|
-
return /* @__PURE__ */ p(
|
|
26
|
+
return /* @__PURE__ */ p(a.Chip, {
|
|
27
27
|
value: e.id,
|
|
28
|
-
children: [i && /* @__PURE__ */ r(
|
|
28
|
+
children: [i && /* @__PURE__ */ r(a.Icon, {
|
|
29
29
|
icon: i
|
|
30
|
-
}), /* @__PURE__ */ r(
|
|
30
|
+
}), /* @__PURE__ */ r(a.Label, {
|
|
31
31
|
children: e.name
|
|
32
32
|
})]
|
|
33
33
|
}, e.id);
|
|
@@ -36,7 +36,7 @@ const G = (e, a, m) => {
|
|
|
36
36
|
}
|
|
37
37
|
}, _ = ({
|
|
38
38
|
disabledPredefinedFilters: e = [],
|
|
39
|
-
filterGroups:
|
|
39
|
+
filterGroups: n,
|
|
40
40
|
isAllFiltersDisabled: m,
|
|
41
41
|
onFilterSubmit: i
|
|
42
42
|
}) => {
|
|
@@ -50,21 +50,22 @@ const G = (e, a, m) => {
|
|
|
50
50
|
}) => {
|
|
51
51
|
const l = Object.entries(t).filter(F).map(([s]) => s);
|
|
52
52
|
h(l), i(t);
|
|
53
|
-
}, c = [...f, ...
|
|
53
|
+
}, c = [...f, ...n], d = c.flatMap(({
|
|
54
54
|
filters: t
|
|
55
|
-
}) => t),
|
|
56
|
-
return /* @__PURE__ */ r(
|
|
57
|
-
initialValues:
|
|
55
|
+
}) => t), C = G(d), u = b(null);
|
|
56
|
+
return /* @__PURE__ */ r(g, {
|
|
57
|
+
initialValues: C,
|
|
58
58
|
onSubmit: S,
|
|
59
59
|
children: /* @__PURE__ */ r(v, {
|
|
60
60
|
ref: u,
|
|
61
|
-
children: /* @__PURE__ */ p(
|
|
61
|
+
children: /* @__PURE__ */ p(a.Group, {
|
|
62
|
+
className: R.filterChipGroup,
|
|
62
63
|
name: "metadata-view-filters",
|
|
63
64
|
type: "multiple",
|
|
64
65
|
children: [m ? null : /* @__PURE__ */ r(w, {
|
|
65
66
|
activeFilterCount: o.length,
|
|
66
67
|
filterGroups: c
|
|
67
|
-
}), d.filter((t) => t.shouldRenderChip).map((t) =>
|
|
68
|
+
}), d.filter((t) => t.shouldRenderChip).map((t) => y(t, o.includes(t.id), u))]
|
|
68
69
|
})
|
|
69
70
|
})
|
|
70
71
|
});
|
|
@@ -1,67 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
popoverFooter: b
|
|
10
|
-
}, P = ({
|
|
11
|
-
formRef: d,
|
|
12
|
-
id: r,
|
|
13
|
-
name: i,
|
|
14
|
-
selected: f,
|
|
15
|
-
icon: a
|
|
16
|
-
}) => {
|
|
17
|
-
const {
|
|
18
|
-
formatMessage: l
|
|
19
|
-
} = F(), [h, s] = g(!1), p = C(), u = () => {
|
|
20
|
-
p.handleSubmit(), s(!1);
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */ e("div", {
|
|
23
|
-
children: /* @__PURE__ */ n(o.Root, {
|
|
24
|
-
onOpenChange: s,
|
|
25
|
-
open: h,
|
|
26
|
-
children: [/* @__PURE__ */ e(o.Trigger, {
|
|
27
|
-
children: /* @__PURE__ */ n(t.TriggerChip, {
|
|
28
|
-
selected: f,
|
|
29
|
-
value: r,
|
|
30
|
-
children: [a && /* @__PURE__ */ e(t.Icon, {
|
|
31
|
-
icon: a
|
|
32
|
-
}), /* @__PURE__ */ e(t.Label, {
|
|
33
|
-
children: i
|
|
34
|
-
}), /* @__PURE__ */ e(t.DropdownIndicator, {})]
|
|
35
|
-
}, r)
|
|
36
|
-
}), /* @__PURE__ */ n(o.ContentContainer, {
|
|
37
|
-
align: "start",
|
|
38
|
-
container: d.current,
|
|
39
|
-
children: [/* @__PURE__ */ e(o.MainContent, {
|
|
40
|
-
children: /* @__PURE__ */ e(v, {
|
|
41
|
-
fieldNamePrefix: `metadata.fields.${r}`,
|
|
42
|
-
label: i
|
|
43
|
-
})
|
|
44
|
-
}), /* @__PURE__ */ n(o.Footer, {
|
|
45
|
-
className: k.popoverFooter,
|
|
46
|
-
children: [/* @__PURE__ */ e(m, {
|
|
47
|
-
onClick: () => {
|
|
48
|
-
p.setFieldValue(`metadata.fields.${r}.value.enum`, []);
|
|
49
|
-
},
|
|
50
|
-
size: "small",
|
|
51
|
-
variant: "secondary",
|
|
52
|
-
children: l(c.clearButton)
|
|
53
|
-
}), /* @__PURE__ */ e(m, {
|
|
54
|
-
onClick: u,
|
|
55
|
-
size: "small",
|
|
56
|
-
type: "submit",
|
|
57
|
-
variant: "primary",
|
|
58
|
-
children: l(c.applyButton)
|
|
59
|
-
})]
|
|
60
|
-
})]
|
|
61
|
-
})]
|
|
62
|
-
})
|
|
63
|
-
});
|
|
64
|
-
};
|
|
1
|
+
import "@box/blueprint-web";
|
|
2
|
+
import "@box/metadata-filter";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-intl";
|
|
5
|
+
import "formik";
|
|
6
|
+
import { S as f } from "../../../../chunks/string-filter-chip.js";
|
|
7
|
+
import "./messages.js";
|
|
8
|
+
import "react/jsx-runtime";
|
|
65
9
|
export {
|
|
66
|
-
|
|
10
|
+
f as StringFilterChip
|
|
67
11
|
};
|
|
@@ -1,54 +1,59 @@
|
|
|
1
1
|
import { useState as w } from "react";
|
|
2
2
|
import u from "./components/error-state/error-state.js";
|
|
3
3
|
import V from "./components/pagination/pagination.js";
|
|
4
|
-
import { MetadataGrid as
|
|
5
|
-
import { SwitchCase as
|
|
4
|
+
import { MetadataGrid as I } from "./components/metadata-grid/metadata-grid.js";
|
|
5
|
+
import { SwitchCase as T, Case as i } from "./components/switch-case/switch-case.js";
|
|
6
6
|
import { V as o } from "../../chunks/types.js";
|
|
7
|
-
import { jsxs as
|
|
8
|
-
import { ActionBar as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import '../../styles/metadata-view.css';const
|
|
7
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
8
|
+
import { ActionBar as y } from "./components/action-bar/action-bar.js";
|
|
9
|
+
import L from "./components/empty-state/empty-state.js";
|
|
10
|
+
import g from "./components/metadata-table/metadata-table.js";
|
|
11
|
+
import '../../styles/metadata-view.css';const x = "_contentContainer_19ns1_8", s = {
|
|
12
|
+
contentContainer: x
|
|
13
|
+
};
|
|
12
14
|
function A({
|
|
13
15
|
actionBarProps: a,
|
|
14
|
-
columns:
|
|
16
|
+
columns: l,
|
|
15
17
|
tableProps: m,
|
|
16
|
-
hasError:
|
|
17
|
-
onRefresh:
|
|
18
|
-
initialViewMode:
|
|
18
|
+
hasError: p,
|
|
19
|
+
onRefresh: f,
|
|
20
|
+
initialViewMode: h = o.LIST,
|
|
19
21
|
...r
|
|
20
22
|
}) {
|
|
21
|
-
const [e,
|
|
22
|
-
e === o.LIST ?
|
|
23
|
-
}, M = !m.isLoading && r.items.length === 0, S = a.sortDropdownProps &&
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
className:
|
|
26
|
-
children: [/* @__PURE__ */ t(
|
|
23
|
+
const [e, c] = w(h), C = () => {
|
|
24
|
+
e === o.LIST ? c(o.GRID) : c(o.LIST);
|
|
25
|
+
}, M = !m.isLoading && r.items.length === 0, S = a.sortDropdownProps && l.filter((n) => n.type !== "multiSelect" && n.type !== "enum").map((n) => n.textValue);
|
|
26
|
+
return /* @__PURE__ */ d("div", {
|
|
27
|
+
className: s.container,
|
|
28
|
+
children: [/* @__PURE__ */ t(y, {
|
|
27
29
|
...a,
|
|
28
|
-
onViewModeClick:
|
|
30
|
+
onViewModeClick: C,
|
|
29
31
|
sortableColumnNames: S,
|
|
30
32
|
viewMode: e
|
|
31
|
-
}), /* @__PURE__ */
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
children: /* @__PURE__ */ t(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
}), /* @__PURE__ */ t("div", {
|
|
34
|
+
className: s.contentContainer,
|
|
35
|
+
children: /* @__PURE__ */ d(T, {
|
|
36
|
+
children: [/* @__PURE__ */ t(i, {
|
|
37
|
+
condition: p,
|
|
38
|
+
children: /* @__PURE__ */ t(u, {
|
|
39
|
+
onRefresh: f
|
|
40
|
+
})
|
|
41
|
+
}), /* @__PURE__ */ t(i, {
|
|
42
|
+
condition: M,
|
|
43
|
+
children: /* @__PURE__ */ t(L, {})
|
|
44
|
+
}), /* @__PURE__ */ t(i, {
|
|
45
|
+
condition: e === o.LIST,
|
|
46
|
+
children: /* @__PURE__ */ t(g, {
|
|
47
|
+
...r,
|
|
48
|
+
...m
|
|
49
|
+
})
|
|
50
|
+
}), /* @__PURE__ */ t(i, {
|
|
51
|
+
condition: e === o.GRID,
|
|
52
|
+
children: /* @__PURE__ */ t(I, {
|
|
53
|
+
...r
|
|
54
|
+
})
|
|
55
|
+
})]
|
|
56
|
+
})
|
|
52
57
|
}), /* @__PURE__ */ t(V, {})]
|
|
53
58
|
});
|
|
54
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._actionBar_1jgp4_1{display:flex;justify-content:space-between;padding:var(--space-4) 0}@media (max-width: 390px){._filterRow_1jgp4_8{display:none}}._additionalActions_1jgp4_13{display:flex;height:var(--size-8)}@media (max-width: 390px){._additionalActions_1jgp4_13{flex-grow:1;justify-content:space-between}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._contentContainer_19ns1_8{overflow:auto}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._popoverFooter_6tqyh_1{display:flex;flex-direction:row;gap:var(--space-2);align-items:center;justify-content:flex-end}._filterChipGroup_6tqyh_9{display:flex;flex-wrap:wrap}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/metadata-view",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.2",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@box/blueprint-web": "^11.12.0",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@box/blueprint-web": "^11.12.0",
|
|
20
20
|
"@box/blueprint-web-assets": "^4.57.0",
|
|
21
21
|
"@box/eslint-plugin-blueprint": "*",
|
|
22
|
-
"@box/item-icon": "^0.13.
|
|
23
|
-
"@box/metadata-filter": "^1.14.
|
|
22
|
+
"@box/item-icon": "^0.13.5",
|
|
23
|
+
"@box/metadata-filter": "^1.14.5",
|
|
24
24
|
"@box/storybook-utils": "0.13.11",
|
|
25
25
|
"@box/types": "0.2.0",
|
|
26
26
|
"react-intl": "^6.4.2"
|