@box/metadata-view 0.19.0 → 0.20.0

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.
Files changed (80) hide show
  1. package/dist/chunks/table-body-with-data.js +44 -47
  2. package/dist/chunks/types.js +9 -0
  3. package/dist/esm/index.js +5 -2
  4. package/dist/esm/lib/components/action-bar/action-bar.js +35 -22
  5. package/dist/esm/lib/components/action-bar/messages.js +14 -0
  6. package/dist/esm/lib/components/item-action-menu/item-action-menu.js +77 -63
  7. package/dist/esm/lib/components/metadata-grid/index.js +1 -0
  8. package/dist/esm/lib/components/metadata-grid/messages.js +10 -0
  9. package/dist/esm/lib/components/metadata-grid/metadata-grid.js +45 -0
  10. package/dist/esm/lib/components/metadata-table/metadata-table.js +18 -17
  11. package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +3 -2
  12. package/dist/esm/lib/components/switch-case/switch-case.js +14 -0
  13. package/dist/esm/lib/metadata-view.js +51 -28
  14. package/dist/i18n/bn-IN.js +5 -2
  15. package/dist/i18n/bn-IN.properties +16 -0
  16. package/dist/i18n/da-DK.js +5 -2
  17. package/dist/i18n/da-DK.properties +16 -0
  18. package/dist/i18n/de-DE.js +5 -2
  19. package/dist/i18n/de-DE.properties +16 -0
  20. package/dist/i18n/en-AU.js +3 -0
  21. package/dist/i18n/en-AU.properties +16 -0
  22. package/dist/i18n/en-CA.js +3 -0
  23. package/dist/i18n/en-CA.properties +16 -0
  24. package/dist/i18n/en-GB.js +3 -0
  25. package/dist/i18n/en-GB.properties +16 -0
  26. package/dist/i18n/en-US.js +3 -0
  27. package/dist/i18n/en-US.properties +6 -0
  28. package/dist/i18n/en-x-pseudo.js +18 -15
  29. package/dist/i18n/en-x-pseudo.properties +23 -7
  30. package/dist/i18n/es-419.js +5 -2
  31. package/dist/i18n/es-419.properties +16 -0
  32. package/dist/i18n/es-ES.js +5 -2
  33. package/dist/i18n/es-ES.properties +16 -0
  34. package/dist/i18n/fi-FI.js +5 -2
  35. package/dist/i18n/fi-FI.properties +16 -0
  36. package/dist/i18n/fr-CA.js +5 -2
  37. package/dist/i18n/fr-CA.properties +16 -0
  38. package/dist/i18n/fr-FR.js +5 -2
  39. package/dist/i18n/fr-FR.properties +16 -0
  40. package/dist/i18n/hi-IN.js +5 -2
  41. package/dist/i18n/hi-IN.properties +16 -0
  42. package/dist/i18n/it-IT.js +6 -3
  43. package/dist/i18n/it-IT.properties +17 -1
  44. package/dist/i18n/ja-JP.js +5 -2
  45. package/dist/i18n/ja-JP.properties +16 -0
  46. package/dist/i18n/json/src/lib/components/action-bar/messages.json +1 -0
  47. package/dist/i18n/json/src/lib/components/metadata-grid/messages.json +1 -0
  48. package/dist/i18n/ko-KR.js +5 -2
  49. package/dist/i18n/ko-KR.properties +16 -0
  50. package/dist/i18n/nb-NO.js +6 -3
  51. package/dist/i18n/nb-NO.properties +17 -1
  52. package/dist/i18n/nl-NL.js +5 -2
  53. package/dist/i18n/nl-NL.properties +16 -0
  54. package/dist/i18n/pl-PL.js +5 -2
  55. package/dist/i18n/pl-PL.properties +16 -0
  56. package/dist/i18n/pt-BR.js +5 -2
  57. package/dist/i18n/pt-BR.properties +16 -0
  58. package/dist/i18n/ru-RU.js +5 -2
  59. package/dist/i18n/ru-RU.properties +16 -0
  60. package/dist/i18n/sv-SE.js +5 -2
  61. package/dist/i18n/sv-SE.properties +16 -0
  62. package/dist/i18n/tr-TR.js +5 -2
  63. package/dist/i18n/tr-TR.properties +16 -0
  64. package/dist/i18n/zh-CN.js +5 -2
  65. package/dist/i18n/zh-CN.properties +16 -0
  66. package/dist/i18n/zh-TW.js +5 -2
  67. package/dist/i18n/zh-TW.properties +16 -0
  68. package/dist/styles/metadata-grid.css +1 -0
  69. package/dist/types/index.d.ts +1 -0
  70. package/dist/types/lib/components/action-bar/action-bar.d.ts +5 -3
  71. package/dist/types/lib/components/action-bar/messages.d.ts +13 -0
  72. package/dist/types/lib/components/item-action-menu/item-action-menu.d.ts +3 -1
  73. package/dist/types/lib/components/metadata-grid/index.d.ts +0 -0
  74. package/dist/types/lib/components/metadata-grid/messages.d.ts +8 -0
  75. package/dist/types/lib/components/metadata-grid/metadata-grid.d.ts +4 -0
  76. package/dist/types/lib/components/metadata-table/metadata-table.d.ts +2 -7
  77. package/dist/types/lib/components/switch-case/switch-case.d.ts +12 -0
  78. package/dist/types/lib/metadata-view.d.ts +7 -5
  79. package/dist/types/lib/types.d.ts +10 -0
  80. package/package.json +5 -5
@@ -1,80 +1,77 @@
1
- import { TableBody as L, Row as x, Cell as c, Text as i, ActionCell as A } from "@box/blueprint-web";
1
+ import { TableBody as C, Row as x, Cell as c, Text as o, ActionCell as A } from "@box/blueprint-web";
2
2
  import h from "lodash/get";
3
3
  import { ItemTypeIcon as p } from "@box/item-icon";
4
- import E from "clsx";
5
- import { jsx as l, jsxs as o } from "react/jsx-runtime";
6
- import { ItemActionMenu as f } from "../esm/lib/components/item-action-menu/item-action-menu.js";
7
- import '../styles/table-body-with-data.css';let a = /* @__PURE__ */ function(t) {
8
- return t.INLINE = "inline", t.COLUMN = "column", t.INLINE_SUBTITLE = "inline-subtitle", t;
9
- }({});
10
- const C = "_tableHeaderActionsWrapper_r2hj7_1", S = "_tableHeaderActions_r2hj7_1", y = "_selectAllCheckbox_r2hj7_33", j = "_tableNameCell_r2hj7_38", B = "_tableNameCellSubTitle_r2hj7_44", I = {
11
- tableHeaderActionsWrapper: C,
4
+ import f from "clsx";
5
+ import { I as t } from "./types.js";
6
+ import { jsx as l, jsxs as d } from "react/jsx-runtime";
7
+ import { ItemActionMenu as L } from "../esm/lib/components/item-action-menu/item-action-menu.js";
8
+ import '../styles/table-body-with-data.css';const y = "_tableHeaderActionsWrapper_r2hj7_1", S = "_tableHeaderActions_r2hj7_1", j = "_selectAllCheckbox_r2hj7_33", E = "_tableNameCell_r2hj7_38", H = "_tableNameCellSubTitle_r2hj7_44", N = {
9
+ tableHeaderActionsWrapper: y,
12
10
  tableHeaderActions: S,
13
- selectAllCheckbox: y,
14
- tableNameCell: j,
15
- tableNameCellSubTitle: B
16
- }, g = ({
17
- columns: t,
11
+ selectAllCheckbox: j,
12
+ tableNameCell: E,
13
+ tableNameCellSubTitle: H
14
+ }, O = ({
15
+ columns: m,
18
16
  iconColumnVariant: r,
19
17
  isSelectAllEnabled: _,
20
- items: T,
21
- itemActionMenuProps: b
22
- }) => /* @__PURE__ */ l(L, {
23
- items: T.map((e) => ({
18
+ items: I,
19
+ itemActionMenuProps: i
20
+ }) => /* @__PURE__ */ l(C, {
21
+ items: I.map((e) => ({
24
22
  key: e.id,
25
23
  ...e
26
24
  })),
27
- children: (e) => /* @__PURE__ */ o(x, {
25
+ children: (e) => /* @__PURE__ */ d(x, {
28
26
  id: e.id,
29
- children: [r === a.COLUMN ? /* @__PURE__ */ l(c, {
27
+ children: [r === t.COLUMN ? /* @__PURE__ */ l(c, {
30
28
  children: /* @__PURE__ */ l(p, {
31
29
  item: e
32
30
  })
33
- }, `item-type-icon-${e.id}`) : null, t.map((s) => {
31
+ }, `item-type-icon-${e.id}`) : null, m.map((a) => {
34
32
  const {
35
- cellRenderer: N,
36
- id: n,
37
- subTitle: m,
33
+ cellRenderer: b,
34
+ id: s,
35
+ subTitle: T,
38
36
  textValue: u
39
- } = s, d = `${u}-${e.id}`;
40
- return n === "name" && (r === a.INLINE || r === a.INLINE_SUBTITLE) ? /* @__PURE__ */ l(c, {
41
- children: /* @__PURE__ */ o("div", {
42
- className: I.tableNameCell,
37
+ } = a, n = `${u}-${e.id}`;
38
+ return s === "name" && (r === t.INLINE || r === t.INLINE_SUBTITLE) ? /* @__PURE__ */ l(c, {
39
+ children: /* @__PURE__ */ d("div", {
40
+ className: N.tableNameCell,
43
41
  children: [/* @__PURE__ */ l(p, {
44
42
  item: e
45
- }), /* @__PURE__ */ o("div", {
46
- className: E({
47
- [I.tableNameCellSubTitle]: r === a.INLINE_SUBTITLE
43
+ }), /* @__PURE__ */ d("div", {
44
+ className: f({
45
+ [N.tableNameCellSubTitle]: r === t.INLINE_SUBTITLE
48
46
  }),
49
- children: [/* @__PURE__ */ l(i, {
47
+ children: [/* @__PURE__ */ l(o, {
50
48
  as: "span",
51
- children: h(e, n)
52
- }), r === a.INLINE_SUBTITLE ? /* @__PURE__ */ l(i, {
49
+ children: h(e, s)
50
+ }), r === t.INLINE_SUBTITLE ? /* @__PURE__ */ l(o, {
53
51
  as: "span",
54
52
  color: "textOnLightSecondary",
55
- children: m
53
+ children: T
56
54
  }) : null]
57
55
  })]
58
56
  })
59
- }, d) : N ? /* @__PURE__ */ l(c, {
60
- children: N(e, s)
61
- }, d) : /* @__PURE__ */ l(c, {
62
- children: /* @__PURE__ */ l(i, {
57
+ }, n) : b ? /* @__PURE__ */ l(c, {
58
+ children: b(e, a)
59
+ }, n) : /* @__PURE__ */ l(c, {
60
+ children: /* @__PURE__ */ l(o, {
63
61
  as: "span",
64
- children: h(e, n)
62
+ children: h(e, s)
65
63
  })
66
- }, d);
64
+ }, n);
67
65
  }), _ && /* @__PURE__ */ l(A, {
68
- children: (s) => b ? /* @__PURE__ */ l(f, {
69
- ...b,
66
+ children: (a) => i ? /* @__PURE__ */ l(L, {
67
+ ...i,
70
68
  item: e,
71
- onOpenChange: s
69
+ onOpenChange: a
72
70
  }) : null
73
71
  })]
74
72
  }, e.id)
75
73
  });
76
74
  export {
77
- a as I,
78
- g as T,
79
- I as s
75
+ O as T,
76
+ N as s
80
77
  };
@@ -0,0 +1,9 @@
1
+ let e = /* @__PURE__ */ function(t) {
2
+ return t.INLINE = "inline", t.COLUMN = "column", t.INLINE_SUBTITLE = "inline-subtitle", t;
3
+ }({}), i = /* @__PURE__ */ function(t) {
4
+ return t.GRID = "grid", t.LIST = "list", t;
5
+ }({});
6
+ export {
7
+ e as I,
8
+ i as V
9
+ };
package/dist/esm/index.js CHANGED
@@ -1,4 +1,7 @@
1
- import { MetadataView as t } from "./lib/metadata-view.js";
1
+ import { MetadataView as e } from "./lib/metadata-view.js";
2
+ import { I as t, V } from "../chunks/types.js";
2
3
  export {
3
- t as MetadataView
4
+ t as IconColumnVariant,
5
+ e as MetadataView,
6
+ V as ViewMode
4
7
  };
@@ -1,24 +1,37 @@
1
- import { Text as o } from "@box/blueprint-web";
2
- import { jsxs as e, jsx as r } from "react/jsx-runtime";
3
- import { FilterRow as i } from "../filter-row/filter-row.js";
4
- import '../../../../styles/action-bar.css';const a = "_actionBar_17enr_1", c = {
5
- actionBar: a
6
- }, d = ({
7
- filterRowProps: t
8
- }) => /* @__PURE__ */ e("div", {
9
- className: c.actionBar,
10
- children: [/* @__PURE__ */ r("div", {
11
- children: /* @__PURE__ */ r(i, {
12
- ...t
13
- })
14
- }), /* @__PURE__ */ r("div", {
15
- children: /* @__PURE__ */ r(o, {
16
- as: "span",
17
- children: "placeholder to be replaced with buttons from other tickets"
18
- })
19
- })]
20
- });
1
+ import { Button as n } from "@box/blueprint-web";
2
+ import { Grid as m } from "@box/blueprint-web-assets/icons/Fill";
3
+ import { useIntl as c } from "react-intl";
4
+ import { V as t } from "../../../../chunks/types.js";
5
+ import a from "./messages.js";
6
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
7
+ import { FilterRow as d } from "../filter-row/filter-row.js";
8
+ import '../../../../styles/action-bar.css';const f = "_actionBar_17enr_1", p = {
9
+ actionBar: f
10
+ }, x = ({
11
+ onViewModeClick: s,
12
+ viewMode: i,
13
+ ...e
14
+ }) => {
15
+ const {
16
+ formatMessage: o
17
+ } = c();
18
+ return /* @__PURE__ */ l("div", {
19
+ className: p.actionBar,
20
+ children: [/* @__PURE__ */ r("div", {
21
+ children: /* @__PURE__ */ r(d, {
22
+ ...e
23
+ })
24
+ }), /* @__PURE__ */ r("div", {
25
+ children: /* @__PURE__ */ r(n, {
26
+ "aria-label": i === t.GRID ? o(a.switchToListView) : o(a.switchToGridView),
27
+ icon: m,
28
+ onClick: s,
29
+ variant: i === t.GRID ? "primary" : "tertiary"
30
+ })
31
+ })]
32
+ });
33
+ };
21
34
  export {
22
- d as ActionBar,
23
- d as default
35
+ x as ActionBar,
36
+ x as default
24
37
  };
@@ -0,0 +1,14 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const t = e({
3
+ switchToGridView: {
4
+ id: "groupSharedFeatures.metadataView.actionBar.switchToGridView",
5
+ defaultMessage: "Switch to Grid View"
6
+ },
7
+ switchToListView: {
8
+ id: "groupSharedFeatures.metadataView.actionBar.switchToListView",
9
+ defaultMessage: "Switch to List View"
10
+ }
11
+ });
12
+ export {
13
+ t as default
14
+ };
@@ -1,84 +1,98 @@
1
- import { useIntl as M } from "react-intl";
2
- import { IconButton as p, DropdownMenu as t } from "@box/blueprint-web";
3
- import { Ellipsis as _ } from "@box/blueprint-web-assets/icons/Fill";
4
- import k from "./messages.js";
5
- import { jsxs as a, jsx as e } from "react/jsx-runtime";
6
- import '../../../../styles/item-action-menu.css';const B = "_tableActionBar_akgtp_1", C = "_actionItemIcon_akgtp_6", m = {
7
- tableActionBar: B,
8
- actionItemIcon: C
1
+ import { useIntl as _ } from "react-intl";
2
+ import { IconButton as h, DropdownMenu as n, GridList as M } from "@box/blueprint-web";
3
+ import { Ellipsis as S } from "@box/blueprint-web-assets/icons/Fill";
4
+ import B from "./messages.js";
5
+ import { V as u } from "../../../../chunks/types.js";
6
+ import { jsxs as e, jsx as o } from "react/jsx-runtime";
7
+ import '../../../../styles/item-action-menu.css';const L = "_tableActionBar_akgtp_1", T = "_actionItemIcon_akgtp_6", d = {
8
+ tableActionBar: L,
9
+ actionItemIcon: T
9
10
  };
10
- function b({
11
- item: c,
12
- label: o,
13
- onClick: l,
11
+ function k({
12
+ item: l,
13
+ label: t,
14
+ onClick: m,
14
15
  icon: r
15
16
  }) {
16
- const i = () => {
17
- l(c);
17
+ const I = () => {
18
+ m(l);
18
19
  };
19
- return /* @__PURE__ */ a(t.Item, {
20
- onClick: i,
21
- children: [/* @__PURE__ */ e(r, {
22
- className: m.actionItemIcon
23
- }), o]
24
- }, o);
20
+ return /* @__PURE__ */ e(n.Item, {
21
+ onClick: I,
22
+ children: [/* @__PURE__ */ o(r, {
23
+ className: d.actionItemIcon
24
+ }), t]
25
+ }, t);
25
26
  }
26
- function R({
27
- actions: c,
28
- inlineActions: o,
29
- isDisabled: l,
27
+ function G({
28
+ actions: l,
29
+ inlineActions: t,
30
+ isDisabled: m,
30
31
  item: r,
31
- onOpenChange: i,
32
- subMenuActions: s,
33
- subMenuTrigger: u
32
+ onOpenChange: I,
33
+ subMenuActions: p,
34
+ subMenuTrigger: b,
35
+ viewMode: i = u.LIST
34
36
  }) {
35
37
  const {
36
- formatMessage: g
37
- } = M(), {
38
- label: h,
39
- icon: I
40
- } = u || {};
41
- return /* @__PURE__ */ a("div", {
42
- className: m.tableActionBar,
43
- children: [o == null ? void 0 : o.map(({
44
- onClick: n,
45
- label: d,
46
- icon: f
47
- }) => /* @__PURE__ */ e(p, {
48
- "aria-label": d,
49
- icon: f,
50
- onClick: () => n(r),
38
+ formatMessage: f
39
+ } = _(), {
40
+ label: C,
41
+ icon: g
42
+ } = b || {};
43
+ return /* @__PURE__ */ e("div", {
44
+ className: d.tableActionBar,
45
+ children: [i === u.LIST && (t == null ? void 0 : t.map(({
46
+ onClick: a,
47
+ label: c,
48
+ icon: s
49
+ }) => /* @__PURE__ */ o(h, {
50
+ "aria-label": c,
51
+ icon: s,
52
+ onClick: () => a(r),
51
53
  size: "large"
52
- }, `${r.id}-${d}`)), c ? /* @__PURE__ */ a(t.Root, {
53
- onOpenChange: i,
54
- children: [/* @__PURE__ */ e(t.Trigger, {
55
- children: /* @__PURE__ */ e(p, {
56
- "aria-label": g(k.actionMenu),
57
- disabled: l,
58
- icon: _,
54
+ }, `${r.id}-${c}`))), l ? /* @__PURE__ */ e(n.Root, {
55
+ onOpenChange: I,
56
+ children: [/* @__PURE__ */ o(n.Trigger, {
57
+ children: i === u.LIST ? /* @__PURE__ */ o(h, {
58
+ "aria-label": f(B.actionMenu),
59
+ disabled: m,
60
+ icon: S,
59
61
  size: "large"
62
+ }) : /* @__PURE__ */ o(M.ActionIconButton, {
63
+ "aria-label": f(B.actionMenu),
64
+ disabled: m,
65
+ icon: S
60
66
  })
61
- }), /* @__PURE__ */ a(t.Content, {
67
+ }), /* @__PURE__ */ e(n.Content, {
62
68
  align: "start",
63
- children: [c.map((n) => /* @__PURE__ */ e(b, {
69
+ children: [l.map((a) => /* @__PURE__ */ o(k, {
64
70
  item: r,
65
- ...n
66
- }, n.label)), s && u && /* @__PURE__ */ a(t.SubMenuRoot, {
67
- children: [/* @__PURE__ */ a(t.SubMenuTrigger, {
68
- children: [I && /* @__PURE__ */ e(I, {
69
- className: m.actionItemIcon
70
- }), h]
71
- }), /* @__PURE__ */ e(t.SubMenuContent, {
72
- children: s.map((n) => /* @__PURE__ */ e(b, {
71
+ ...a
72
+ }, a.label)), p && b && /* @__PURE__ */ e(n.SubMenuRoot, {
73
+ children: [/* @__PURE__ */ e(n.SubMenuTrigger, {
74
+ children: [g && /* @__PURE__ */ o(g, {
75
+ className: d.actionItemIcon
76
+ }), C]
77
+ }), /* @__PURE__ */ o(n.SubMenuContent, {
78
+ children: p.map((a) => /* @__PURE__ */ o(k, {
73
79
  item: r,
74
- ...n
75
- }, n.label))
80
+ ...a
81
+ }, a.label))
76
82
  })]
77
83
  })]
78
84
  })]
79
- }) : null]
85
+ }) : null, i === u.GRID && (t == null ? void 0 : t.map(({
86
+ onClick: a,
87
+ label: c,
88
+ icon: s
89
+ }) => /* @__PURE__ */ o(M.ActionIconButton, {
90
+ "aria-label": c,
91
+ icon: s,
92
+ onClick: () => a(r)
93
+ }, `${r.id}-${c}`)))]
80
94
  });
81
95
  }
82
96
  export {
83
- R as ItemActionMenu
97
+ G as ItemActionMenu
84
98
  };
@@ -0,0 +1,10 @@
1
+ import { defineMessages as e } from "react-intl";
2
+ const s = e({
3
+ gridView: {
4
+ id: "groupSharedFeatures.metadataView.gridList.gridView",
5
+ defaultMessage: "Grid View"
6
+ }
7
+ });
8
+ export {
9
+ s as default
10
+ };
@@ -0,0 +1,45 @@
1
+ import { GridList as i } from "@box/blueprint-web";
2
+ import { ItemTypeIcon as a } from "@box/item-icon";
3
+ import { useIntl as l } from "react-intl";
4
+ import { V as s } from "../../../../chunks/types.js";
5
+ import d from "./messages.js";
6
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
7
+ import { ItemActionMenu as u } from "../item-action-menu/item-action-menu.js";
8
+ import '../../../../styles/metadata-grid.css';const h = "_itemThumbnail_1j3e6_1", p = {
9
+ itemThumbnail: h
10
+ }, w = ({
11
+ items: m,
12
+ itemActionMenuProps: t
13
+ }) => {
14
+ const {
15
+ formatMessage: n
16
+ } = l();
17
+ return /* @__PURE__ */ e(i, {
18
+ "aria-label": n(d.gridView),
19
+ selectionMode: "multiple",
20
+ children: m.map((r, f) => /* @__PURE__ */ c(i.Item, {
21
+ children: [/* @__PURE__ */ e(i.Thumbnail, {
22
+ className: p.itemThumbnail,
23
+ children: /* @__PURE__ */ e(a, {
24
+ dimension: 128,
25
+ item: r
26
+ })
27
+ }), /* @__PURE__ */ e(i.Header, {
28
+ children: r.name
29
+ }), /* @__PURE__ */ e(i.Subtitle, {
30
+ children: r.createdAt
31
+ }), /* @__PURE__ */ e(i.Actions, {
32
+ children: (o) => t ? /* @__PURE__ */ e(u, {
33
+ ...t,
34
+ item: r,
35
+ onOpenChange: o,
36
+ viewMode: s.GRID
37
+ }) : null
38
+ })]
39
+ }, r.id))
40
+ });
41
+ };
42
+ export {
43
+ w as MetadataGrid,
44
+ w as default
45
+ };
@@ -1,11 +1,12 @@
1
1
  import { Text as x, ListCheckbox as T, Table as g, TableHeader as w, Column as W } from "@box/blueprint-web";
2
2
  import { useIntl as y } from "react-intl";
3
3
  import C from "./table-body/ghost-table-body.js";
4
- import { I as M, s as l, T as N } from "../../../../chunks/table-body-with-data.js";
4
+ import { s as r, T as M } from "../../../../chunks/table-body-with-data.js";
5
+ import { I as N } from "../../../../chunks/types.js";
5
6
  import h from "./messages.js";
6
7
  import { jsx as e, jsxs as R } from "react/jsx-runtime";
7
- const v = ({
8
- columns: r,
8
+ const L = ({
9
+ columns: l,
9
10
  isLoading: i,
10
11
  iconColumnVariant: o,
11
12
  isSelectAllEnabled: d,
@@ -14,18 +15,18 @@ const v = ({
14
15
  ...u
15
16
  }) => {
16
17
  const {
17
- formatMessage: n
18
+ formatMessage: m
18
19
  } = y(), a = [];
19
- o === M.COLUMN && a.push({
20
+ o === N.COLUMN && a.push({
20
21
  id: "item-type-icon",
21
22
  isRowHeader: !1,
22
23
  hideHeader: !1,
23
24
  maxWidth: 60,
24
25
  minWidth: 60
25
26
  });
26
- const b = r.map((s) => {
27
+ const b = l.map((s) => {
27
28
  const {
28
- id: m,
29
+ id: n,
29
30
  headerRenderer: c,
30
31
  textValue: t,
31
32
  ...H
@@ -35,20 +36,20 @@ const v = ({
35
36
  as: "span",
36
37
  children: t
37
38
  }),
38
- isRowHeader: m === "name",
39
- id: m,
39
+ isRowHeader: n === "name",
40
+ id: n,
40
41
  textValue: t,
41
42
  ...H
42
43
  };
43
44
  });
44
45
  return a.push(...b), d && a.push({
45
46
  id: "actions",
46
- className: l.tableHeaderActions,
47
+ className: r.tableHeaderActions,
47
48
  children: /* @__PURE__ */ e("div", {
48
- className: l.tableHeaderActionsWrapper,
49
+ className: r.tableHeaderActionsWrapper,
49
50
  children: /* @__PURE__ */ e(T, {
50
- "aria-label": n(h.selectAll),
51
- className: l.selectAllCheckbox,
51
+ "aria-label": m(h.selectAll),
52
+ className: r.selectAllCheckbox,
52
53
  isDisabled: i
53
54
  })
54
55
  }),
@@ -56,7 +57,7 @@ const v = ({
56
57
  hideHeader: !1,
57
58
  allowsSorting: !1
58
59
  }), /* @__PURE__ */ R(g, {
59
- "aria-label": n(h.listView),
60
+ "aria-label": m(h.listView),
60
61
  selectionBehavior: "toggle",
61
62
  selectionMode: "multiple",
62
63
  ...u,
@@ -67,8 +68,8 @@ const v = ({
67
68
  })
68
69
  }), i ? /* @__PURE__ */ e(C, {
69
70
  columnLength: a.length
70
- }) : /* @__PURE__ */ e(N, {
71
- columns: r,
71
+ }) : /* @__PURE__ */ e(M, {
72
+ columns: l,
72
73
  iconColumnVariant: o,
73
74
  isSelectAllEnabled: d,
74
75
  itemActionMenuProps: f,
@@ -77,5 +78,5 @@ const v = ({
77
78
  });
78
79
  };
79
80
  export {
80
- v as default
81
+ L as default
81
82
  };
@@ -2,9 +2,10 @@ import "@box/blueprint-web";
2
2
  import "lodash/get";
3
3
  import "@box/item-icon";
4
4
  import "clsx";
5
- import { T as f } from "../../../../../chunks/table-body-with-data.js";
5
+ import "../../../../../chunks/types.js";
6
+ import { T as d } from "../../../../../chunks/table-body-with-data.js";
6
7
  import "react/jsx-runtime";
7
8
  import "../../item-action-menu/item-action-menu.js";
8
9
  export {
9
- f as default
10
+ d as default
10
11
  };
@@ -0,0 +1,14 @@
1
+ import e from "react";
2
+ const i = ({
3
+ condition: r,
4
+ children: n
5
+ }) => r ? n : null, s = ({
6
+ children: r
7
+ }) => {
8
+ const t = e.Children.toArray(r).find((o) => o.props.condition);
9
+ return t ? t.props.children : null;
10
+ };
11
+ export {
12
+ i as Case,
13
+ s as SwitchCase
14
+ };
@@ -1,33 +1,56 @@
1
- import o from "./components/error-state/error-state.js";
2
- import m from "./components/pagination/pagination.js";
3
- import { jsxs as e, jsx as r, Fragment as s } from "react/jsx-runtime";
4
- import { ActionBar as f } from "./components/action-bar/action-bar.js";
5
- import c from "./components/empty-state/empty-state.js";
6
- import p from "./components/metadata-table/metadata-table.js";
7
- import '../../styles/metadata-view.css';const d = {};
8
- function l(t) {
9
- return !t.isLoading && t.items.length === 0 ? /* @__PURE__ */ r(c, {}) : /* @__PURE__ */ r(p, {
10
- ...t
11
- });
12
- }
13
- function x({
14
- filterRowProps: t,
15
- metadataTableProps: a,
16
- hasError: i,
17
- onRefresh: n
1
+ import { useState as h } from "react";
2
+ import M from "./components/error-state/error-state.js";
3
+ import S from "./components/pagination/pagination.js";
4
+ import { MetadataGrid as w } from "./components/metadata-grid/metadata-grid.js";
5
+ import { V as t } from "../../chunks/types.js";
6
+ import { SwitchCase as I, Case as e } from "./components/switch-case/switch-case.js";
7
+ import { jsxs as m, jsx as o } from "react/jsx-runtime";
8
+ import { ActionBar as T } from "./components/action-bar/action-bar.js";
9
+ import V from "./components/empty-state/empty-state.js";
10
+ import C from "./components/metadata-table/metadata-table.js";
11
+ import '../../styles/metadata-view.css';const L = {};
12
+ function b({
13
+ actionBarProps: d,
14
+ tableProps: r,
15
+ hasError: c,
16
+ onRefresh: s,
17
+ initialViewMode: l = t.LIST,
18
+ ...n
18
19
  }) {
19
- return /* @__PURE__ */ e("div", {
20
- className: d.container,
21
- children: [/* @__PURE__ */ r(f, {
22
- filterRowProps: t
23
- }), i ? /* @__PURE__ */ r(o, {
24
- onRefresh: n
25
- }) : /* @__PURE__ */ e(s, {
26
- children: [l(a), /* @__PURE__ */ r(m, {})]
27
- })]
20
+ const [i, a] = h(l), p = () => {
21
+ i === t.LIST ? a(t.GRID) : a(t.LIST);
22
+ }, f = !r.isLoading && n.items.length === 0;
23
+ return /* @__PURE__ */ m("div", {
24
+ className: L.container,
25
+ children: [/* @__PURE__ */ o(T, {
26
+ ...d,
27
+ onViewModeClick: p,
28
+ viewMode: i
29
+ }), /* @__PURE__ */ m(I, {
30
+ children: [/* @__PURE__ */ o(e, {
31
+ condition: c,
32
+ children: /* @__PURE__ */ o(M, {
33
+ onRefresh: s
34
+ })
35
+ }), /* @__PURE__ */ o(e, {
36
+ condition: f,
37
+ children: /* @__PURE__ */ o(V, {})
38
+ }), /* @__PURE__ */ o(e, {
39
+ condition: i === t.LIST,
40
+ children: /* @__PURE__ */ o(C, {
41
+ ...n,
42
+ ...r
43
+ })
44
+ }), /* @__PURE__ */ o(e, {
45
+ condition: i === t.GRID,
46
+ children: /* @__PURE__ */ o(w, {
47
+ ...n
48
+ })
49
+ })]
50
+ }), /* @__PURE__ */ o(S, {})]
28
51
  });
29
52
  }
30
53
  export {
31
- x as MetadataView,
32
- x as default
54
+ b as MetadataView,
55
+ b as default
33
56
  };