@box/metadata-view 0.23.0 → 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.
@@ -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 l } from "@box/blueprint-web";
2
- import { Grid as p } from "@box/blueprint-web-assets/icons/Fill";
3
- import { useIntl as f } from "react-intl";
4
- import { V as r } from "../../../../chunks/types.js";
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 h } from "./sort-dropdown.js";
7
- import { jsxs as s, jsx as i } from "react/jsx-runtime";
8
- import { FilterRow as B } from "../filter-row/filter-row.js";
9
- import '../../../../styles/action-bar.css';const _ = "_actionBar_1bpah_1", w = "_additionalActions_1bpah_6", c = {
10
- actionBar: _,
11
- additionalActions: w
12
- }, I = ({
13
- onViewModeClick: m,
14
- viewMode: o,
15
- sortableColumnNames: e,
16
- sortDropdownProps: t,
17
- ...d
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
- } = f();
22
- return /* @__PURE__ */ s("div", {
23
- className: c.actionBar,
22
+ } = p();
23
+ return /* @__PURE__ */ c("div", {
24
+ className: o.actionBar,
24
25
  children: [/* @__PURE__ */ i("div", {
25
- children: /* @__PURE__ */ i(B, {
26
- ...d
26
+ className: o.filterRow,
27
+ children: /* @__PURE__ */ i(_, {
28
+ ...l
27
29
  })
28
- }), /* @__PURE__ */ s("div", {
29
- className: c.additionalActions,
30
- children: [t && /* @__PURE__ */ i(h, {
31
- ...t,
32
- sortableColumnNames: e
33
- }), /* @__PURE__ */ i(l, {
34
- "aria-label": o === r.GRID ? a(n.switchToListView) : a(n.switchToGridView),
35
- icon: p,
36
- onClick: m,
37
- variant: o === r.GRID ? "primary" : "tertiary"
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
- I as ActionBar,
44
- I as default
45
+ y as ActionBar,
46
+ y as default
45
47
  };
@@ -1,12 +1,12 @@
1
- import { FilterChip as n } from "@box/blueprint-web";
2
- import { Formik as C, Form as v } from "formik";
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 R } from "./initial-field-values.js";
6
- import { StringFilterChip as j } from "./string-filter-chip.js";
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 G = (e, a, m) => {
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: a
21
+ selected: n
22
22
  }, e.id);
23
23
  case "date":
24
24
  case "enum":
25
25
  case "multiSelect":
26
- return /* @__PURE__ */ p(n.Chip, {
26
+ return /* @__PURE__ */ p(a.Chip, {
27
27
  value: e.id,
28
- children: [i && /* @__PURE__ */ r(n.Icon, {
28
+ children: [i && /* @__PURE__ */ r(a.Icon, {
29
29
  icon: i
30
- }), /* @__PURE__ */ r(n.Label, {
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: a,
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, ...a], d = c.flatMap(({
53
+ }, c = [...f, ...n], d = c.flatMap(({
54
54
  filters: t
55
- }) => t), g = R(d), u = b(null);
56
- return /* @__PURE__ */ r(C, {
57
- initialValues: g,
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(n.Group, {
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) => G(t, o.includes(t.id), u))]
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 { Popover as o, FilterChip as t, Button as m } from "@box/blueprint-web";
2
- import { MetadataStringField as v } from "@box/metadata-filter";
3
- import { useState as g } from "react";
4
- import { useIntl as F } from "react-intl";
5
- import { useFormikContext as C } from "formik";
6
- import c from "./messages.js";
7
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
8
- import '../../../../styles/string-filter-chip.css';const b = "_popoverFooter_1tgko_1", k = {
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
- P as StringFilterChip
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 C } from "./components/metadata-grid/metadata-grid.js";
5
- import { SwitchCase as I, Case as n } from "./components/switch-case/switch-case.js";
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 s, jsx as t } from "react/jsx-runtime";
8
- import { ActionBar as T } from "./components/action-bar/action-bar.js";
9
- import y from "./components/empty-state/empty-state.js";
10
- import L from "./components/metadata-table/metadata-table.js";
11
- import '../../styles/metadata-view.css';const g = {};
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: c,
16
+ columns: l,
15
17
  tableProps: m,
16
- hasError: l,
17
- onRefresh: p,
18
- initialViewMode: f = o.LIST,
18
+ hasError: p,
19
+ onRefresh: f,
20
+ initialViewMode: h = o.LIST,
19
21
  ...r
20
22
  }) {
21
- const [e, d] = w(f), h = () => {
22
- e === o.LIST ? d(o.GRID) : d(o.LIST);
23
- }, M = !m.isLoading && r.items.length === 0, S = a.sortDropdownProps && c.filter((i) => i.type !== "multiSelect" && i.type !== "enum").map((i) => i.textValue);
24
- return /* @__PURE__ */ s("div", {
25
- className: g.container,
26
- children: [/* @__PURE__ */ t(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: h,
30
+ onViewModeClick: C,
29
31
  sortableColumnNames: S,
30
32
  viewMode: e
31
- }), /* @__PURE__ */ s(I, {
32
- children: [/* @__PURE__ */ t(n, {
33
- condition: l,
34
- children: /* @__PURE__ */ t(u, {
35
- onRefresh: p
36
- })
37
- }), /* @__PURE__ */ t(n, {
38
- condition: M,
39
- children: /* @__PURE__ */ t(y, {})
40
- }), /* @__PURE__ */ t(n, {
41
- condition: e === o.LIST,
42
- children: /* @__PURE__ */ t(L, {
43
- ...r,
44
- ...m
45
- })
46
- }), /* @__PURE__ */ t(n, {
47
- condition: e === o.GRID,
48
- children: /* @__PURE__ */ t(C, {
49
- ...r
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
- ._actionBar_1bpah_1{display:flex;justify-content:space-between}._additionalActions_1bpah_6{display:flex}
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
- ._popoverFooter_1tgko_1{display:flex;flex-direction:row;gap:var(--space-2);align-items:center;justify-content:flex-end}
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.0",
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.3",
23
- "@box/metadata-filter": "^1.14.3",
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"