@box/metadata-view 0.48.9 → 0.48.11

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.
@@ -1,60 +1,61 @@
1
- import { Row as L, Cell as a, Text as s, ActionCell as x } from "@box/blueprint-web";
2
- import I from "lodash/get";
3
- import { ItemTypeIcon as N } from "@box/item-icon";
1
+ import { Row as L, Cell as o, Text as s, ActionCell as x } from "@box/blueprint-web";
2
+ import N from "lodash/get";
3
+ import { ItemTypeIcon as p } from "@box/item-icon";
4
4
  import E from "clsx";
5
5
  import { I as n } from "./types.js";
6
- import { THUMBNAIL_LIST_VIEW_HEIGHTS as q } from "../esm/lib/components/constants.js";
7
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
8
- import { ItemActionMenu as z } from "../esm/lib/components/item-action-menu/item-action-menu.js";
9
- import '../styles/index.css';const y = "_tableHeaderActionsWrapper_zlqta_1", R = "_tableHeaderActions_zlqta_1", g = "_tableRow_zlqta_33", w = "_selectAllCheckbox_zlqta_42", U = "_tableNameCell_zlqta_47", k = "_tableNameCellSubtitle_zlqta_53", B = "_infiniteScrollTableContainerFullHeight_zlqta_58", W = "_iconCell_zlqta_64", i = {
10
- tableHeaderActionsWrapper: y,
11
- tableHeaderActions: R,
12
- tableRow: g,
13
- selectAllCheckbox: w,
14
- tableNameCell: U,
15
- tableNameCellSubtitle: k,
16
- infiniteScrollTableContainerFullHeight: B,
17
- iconCell: W
18
- }, J = ({
6
+ import { THUMBNAIL_LIST_VIEW_HEIGHTS as y } from "../esm/lib/components/constants.js";
7
+ import { jsxs as b, jsx as e } from "react/jsx-runtime";
8
+ import { ItemActionMenu as R } from "../esm/lib/components/item-action-menu/item-action-menu.js";
9
+ import '../styles/index.css';const g = "_tableHeaderActionsWrapper_o1i04_1", w = "_tableHeaderActions_o1i04_1", U = "_tableRow_o1i04_33", k = "_selectAllCheckbox_o1i04_42", B = "_tableNameCell_o1i04_47", W = "_tableNameCellSubtitle_o1i04_53", j = "_tableNameCellIconInline_o1i04_58", F = "_infiniteScrollTableContainerFullHeight_o1i04_62", M = "_iconCell_o1i04_68", r = {
10
+ tableHeaderActionsWrapper: g,
11
+ tableHeaderActions: w,
12
+ tableRow: U,
13
+ selectAllCheckbox: k,
14
+ tableNameCell: B,
15
+ tableNameCellSubtitle: W,
16
+ tableNameCellIconInline: j,
17
+ infiniteScrollTableContainerFullHeight: F,
18
+ iconCell: M
19
+ }, K = ({
19
20
  item: l,
20
21
  columns: h,
21
22
  iconColumnVariant: t,
22
23
  isSelectAllEnabled: C,
23
- itemActionMenuProps: b,
24
+ itemActionMenuProps: d,
24
25
  zoomLevel: u = 0
25
- }) => /* @__PURE__ */ d(L, {
26
- className: i.tableRow,
26
+ }) => /* @__PURE__ */ b(L, {
27
+ className: r.tableRow,
27
28
  id: l.id,
28
- children: [t === n.COLUMN ? /* @__PURE__ */ e(a, {
29
+ children: [t === n.COLUMN ? /* @__PURE__ */ e(o, {
29
30
  style: {
30
- height: q[u]
31
+ height: y[u]
31
32
  },
32
- children: /* @__PURE__ */ e(N, {
33
- className: i.iconCell,
33
+ children: /* @__PURE__ */ e(p, {
34
+ className: r.iconCell,
34
35
  item: l
35
36
  })
36
- }, `item-type-icon-${l.id}`) : null, h.map((o) => {
37
+ }, `item-type-icon-${l.id}`) : null, h.map((a) => {
37
38
  const {
38
39
  cellRenderer: _,
39
- id: r,
40
+ id: i,
40
41
  isItemMetadata: T,
41
42
  subtitle: f,
42
43
  textValue: S,
43
44
  type: H
44
- } = o, c = `${S}-${l.id}`, A = T ? r.split(".")[1] : r, m = I(l, A);
45
- if (r === "name" && (t === n.INLINE || t === n.INLINE_SUBTITLE))
46
- return /* @__PURE__ */ e(a, {
47
- children: /* @__PURE__ */ d("div", {
48
- className: i.tableNameCell,
49
- children: [/* @__PURE__ */ e(N, {
45
+ } = a, c = `${S}-${l.id}`, A = T ? i.split(".")[1] : i, I = N(l, A);
46
+ if (i === "name" && (t === n.INLINE || t === n.INLINE_SUBTITLE))
47
+ return /* @__PURE__ */ e(o, {
48
+ children: /* @__PURE__ */ b("div", {
49
+ className: r.tableNameCell,
50
+ children: [/* @__PURE__ */ e(p, {
50
51
  item: l
51
- }), /* @__PURE__ */ d("div", {
52
+ }), /* @__PURE__ */ b("div", {
52
53
  className: E({
53
- [i.tableNameCellSubtitle]: t === n.INLINE_SUBTITLE
54
+ [r.tableNameCellSubtitle]: t === n.INLINE_SUBTITLE
54
55
  }),
55
56
  children: [/* @__PURE__ */ e(s, {
56
57
  as: "span",
57
- children: m
58
+ children: I
58
59
  }), t === n.INLINE_SUBTITLE ? /* @__PURE__ */ e(s, {
59
60
  as: "span",
60
61
  color: "textOnLightSecondary",
@@ -64,30 +65,30 @@ import '../styles/index.css';const y = "_tableHeaderActionsWrapper_zlqta_1", R =
64
65
  })
65
66
  }, c);
66
67
  if (_)
67
- return /* @__PURE__ */ e(a, {
68
- children: _(l, o)
68
+ return /* @__PURE__ */ e(o, {
69
+ children: _(l, a)
69
70
  }, c);
70
71
  if (H === "multiSelect") {
71
- const p = I(l, r);
72
- return /* @__PURE__ */ e(a, {
73
- children: p ? p.join(" ") : ""
72
+ const m = N(l, i);
73
+ return /* @__PURE__ */ e(o, {
74
+ children: m ? m.join(" ") : ""
74
75
  }, c);
75
76
  }
76
- return /* @__PURE__ */ e(a, {
77
+ return /* @__PURE__ */ e(o, {
77
78
  children: /* @__PURE__ */ e(s, {
78
79
  as: "span",
79
- children: m
80
+ children: I
80
81
  })
81
82
  }, c);
82
83
  }), C && /* @__PURE__ */ e(x, {
83
- children: (o) => b ? /* @__PURE__ */ e(z, {
84
- ...b,
84
+ children: (a) => d ? /* @__PURE__ */ e(R, {
85
+ ...d,
85
86
  item: l,
86
- onOpenChange: o
87
+ onOpenChange: a
87
88
  }) : null
88
89
  })]
89
90
  }, l.id);
90
91
  export {
91
- J as T,
92
- i as s
92
+ K as T,
93
+ r as s
93
94
  };
@@ -17,7 +17,7 @@ import '../../../../styles/action-bar.css';const b = "_actionBar_dsa2b_1", A = "
17
17
  isViewModeButtonDisabled: m,
18
18
  onViewModeClick: d,
19
19
  onZoomLevelChange: l,
20
- sortableColumnNames: f,
20
+ sortableColumns: f,
21
21
  sortDropdownProps: a,
22
22
  viewMode: i,
23
23
  zoomLevel: w,
@@ -37,7 +37,7 @@ import '../../../../styles/action-bar.css';const b = "_actionBar_dsa2b_1", A = "
37
37
  className: t.additionalActions,
38
38
  children: [a && /* @__PURE__ */ o(h, {
39
39
  ...a,
40
- sortableColumnNames: f
40
+ sortableColumns: f
41
41
  }), (c || i === r.GRID) && /* @__PURE__ */ o(R, {
42
42
  onZoomLevelChange: l,
43
43
  zoomLevel: w
@@ -4,12 +4,12 @@ import { useIntl as T } from "react-intl";
4
4
  import { V as p } from "../../../../chunks/types.js";
5
5
  import { THUMBNAIL_GRID_VIEW_SIZES as E } from "../constants.js";
6
6
  import b from "./messages.js";
7
- import { jsx as e, jsxs as M } from "react/jsx-runtime";
8
- import { ItemActionMenu as R } from "../item-action-menu/item-action-menu.js";
9
- import '../../../../styles/metadata-grid.css';const f = "_itemThumbnail_93ess_1", L = {
10
- itemThumbnail: f
11
- }, A = 188, G = 250, g = 8, x = 5, U = (m) => A + G * (g - m) / x, N = ({
12
- items: m,
7
+ import { jsx as e, jsxs as R } from "react/jsx-runtime";
8
+ import { ItemActionMenu as f } from "../item-action-menu/item-action-menu.js";
9
+ import '../../../../styles/metadata-grid.css';const L = "_itemThumbnail_93ess_1", M = {
10
+ itemThumbnail: L
11
+ }, A = 188, G = 250, g = 8, x = 5, U = (r) => A + G * (g - r) / x, N = ({
12
+ items: r,
13
13
  itemActionMenuProps: n,
14
14
  zoomLevel: c,
15
15
  ...d
@@ -19,38 +19,38 @@ import '../../../../styles/metadata-grid.css';const f = "_itemThumbnail_93ess_1"
19
19
  } = T();
20
20
  return /* @__PURE__ */ e(i, {
21
21
  "aria-label": _(b.gridView),
22
- selectionMode: "multiple",
23
22
  style: {
24
23
  gridTemplateColumns: `repeat(auto-fit, minmax(${U(E[c])}px, 1fr))`
25
24
  },
26
25
  ...d,
27
- children: m.map((t, D) => {
28
- var s, l, a;
26
+ children: r.map((t, D) => {
27
+ var o, a, l;
29
28
  const {
30
- name: r,
29
+ name: m,
31
30
  createdAt: u
32
- } = t, o = "thumbnailURLs" in t ? ((s = t.thumbnailURLs) == null ? void 0 : s.large) || ((l = t.thumbnailURLs) == null ? void 0 : l.medium) || ((a = t.thumbnailURLs) == null ? void 0 : a.small) : void 0;
33
- return /* @__PURE__ */ M(i.Item, {
31
+ } = t, s = "thumbnailURLs" in t ? ((o = t.thumbnailURLs) == null ? void 0 : o.large) || ((a = t.thumbnailURLs) == null ? void 0 : a.medium) || ((l = t.thumbnailURLs) == null ? void 0 : l.small) : void 0;
32
+ return /* @__PURE__ */ R(i.Item, {
33
+ textValue: m,
34
34
  children: [/* @__PURE__ */ e(i.Thumbnail, {
35
- className: L.itemThumbnail,
36
- children: o ? /* @__PURE__ */ e("img", {
37
- alt: r,
38
- src: o
35
+ className: M.itemThumbnail,
36
+ children: s ? /* @__PURE__ */ e("img", {
37
+ alt: m,
38
+ src: s
39
39
  }) : /* @__PURE__ */ e(h, {
40
40
  item: t
41
41
  })
42
42
  }), /* @__PURE__ */ e(i.Header, {
43
- children: r
43
+ children: m
44
44
  }), /* @__PURE__ */ e(i.Subtitle, {
45
45
  children: u
46
- }), n ? /* @__PURE__ */ e(i.Actions, {
47
- children: (I) => /* @__PURE__ */ e(R, {
46
+ }), /* @__PURE__ */ e(i.Actions, {
47
+ children: n ? (I) => /* @__PURE__ */ e(f, {
48
48
  ...n,
49
49
  item: t,
50
50
  onOpenChange: I,
51
51
  viewMode: p.GRID
52
- })
53
- }) : null]
52
+ }) : null
53
+ })]
54
54
  }, t.id);
55
55
  })
56
56
  });
@@ -1,42 +1,45 @@
1
- import { TableBody as C, Row as S, Cell as I, ActionCell as b, Text as u } from "@box/blueprint-web";
2
- import { ItemTypeIcon as y } from "@box/item-icon";
3
- import g from "clsx";
4
- import $ from "lodash/get";
5
- import c from "react";
6
- import { I as h } from "../../../../../chunks/types.js";
1
+ import { TableBody as C, Row as b, Cell as m, ActionCell as g, Text as p } from "@box/blueprint-web";
2
+ import { ItemTypeIcon as E } from "@box/item-icon";
3
+ import y from "clsx";
4
+ import L from "lodash/get";
5
+ import I from "react";
6
+ import { I as c } from "../../../../../chunks/types.js";
7
7
  import { THUMBNAIL_LIST_VIEW_HEIGHTS as x } from "../../constants.js";
8
- import { s as p, T as R } from "../../../../../chunks/index.js";
9
- import { jsx as r, jsxs as N } from "react/jsx-runtime";
8
+ import { s as N, T as R } from "../../../../../chunks/index.js";
9
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
10
10
  import { InlineEditingCell as w } from "./inline-editing-cell/inline-editing-cell.js";
11
11
  import { ItemActionMenu as B } from "../../item-action-menu/item-action-menu.js";
12
12
  import { GhostTableRow as _ } from "./ghost-table-row/ghost-table-row.js";
13
- const E = (t, e, n) => {
14
- const l = n ? e.split(".")[1] : e;
15
- return $(t, l);
16
- }, k = /* @__PURE__ */ c.memo(({
13
+ const $ = (t, e, l) => {
14
+ const n = l ? e.split(".")[1] : e;
15
+ return L(t, n);
16
+ }, U = /* @__PURE__ */ I.memo(({
17
17
  item: t,
18
18
  column: e,
19
- iconColumnVariant: n
19
+ iconColumnVariant: l
20
20
  }) => {
21
21
  const {
22
- id: l,
22
+ id: n,
23
23
  isItemMetadata: s,
24
24
  subtitle: i,
25
- textValue: m
26
- } = e, d = `${m}-${t.id}`;
27
- return /* @__PURE__ */ r(I, {
28
- children: /* @__PURE__ */ N("div", {
29
- className: p.tableNameCell,
30
- children: [/* @__PURE__ */ r(y, {
25
+ textValue: h
26
+ } = e, d = `${h}-${t.id}`;
27
+ return /* @__PURE__ */ r(m, {
28
+ children: /* @__PURE__ */ u("div", {
29
+ className: N.tableNameCell,
30
+ children: [/* @__PURE__ */ r(E, {
31
+ className: y({
32
+ [N.tableNameCellIconInline]: [c.INLINE_SUBTITLE, c.INLINE].includes(l)
33
+ }),
31
34
  item: t
32
- }), /* @__PURE__ */ N("div", {
33
- className: g({
34
- [p.tableNameCellSubtitle]: n === h.INLINE_SUBTITLE
35
+ }), /* @__PURE__ */ u("div", {
36
+ className: y({
37
+ [N.tableNameCellSubtitle]: l === c.INLINE_SUBTITLE
35
38
  }),
36
- children: [/* @__PURE__ */ r(u, {
39
+ children: [/* @__PURE__ */ r(p, {
37
40
  as: "span",
38
- children: E(t, l, s)
39
- }), n === h.INLINE_SUBTITLE && /* @__PURE__ */ r(u, {
41
+ children: $(t, n, s)
42
+ }), l === c.INLINE_SUBTITLE && /* @__PURE__ */ r(p, {
40
43
  as: "span",
41
44
  color: "textOnLightSecondary",
42
45
  children: i
@@ -44,108 +47,108 @@ const E = (t, e, n) => {
44
47
  })]
45
48
  })
46
49
  }, d);
47
- }), M = /* @__PURE__ */ c.memo(({
50
+ }), k = /* @__PURE__ */ I.memo(({
48
51
  item: t,
49
52
  column: e
50
53
  }) => {
51
- var l;
52
- const n = `${e.textValue}-${t.id}`;
53
- return /* @__PURE__ */ r(I, {
54
- children: (l = e.cellRenderer) == null ? void 0 : l.call(e, t, e)
55
- }, n);
56
- }), U = /* @__PURE__ */ c.memo(({
54
+ var n;
55
+ const l = `${e.textValue}-${t.id}`;
56
+ return /* @__PURE__ */ r(m, {
57
+ children: (n = e.cellRenderer) == null ? void 0 : n.call(e, t, e)
58
+ }, l);
59
+ }), M = /* @__PURE__ */ I.memo(({
57
60
  item: t,
58
61
  column: e
59
62
  }) => {
60
- const n = `${e.textValue}-${t.id}`, l = $(t, e.id);
61
- return l ? /* @__PURE__ */ r(I, {
62
- children: l.join(" ")
63
- }, n) : /* @__PURE__ */ r(I, {}, n);
64
- }), W = /* @__PURE__ */ c.memo(({
63
+ const l = `${e.textValue}-${t.id}`, n = L(t, e.id);
64
+ return n ? /* @__PURE__ */ r(m, {
65
+ children: n.join(" ")
66
+ }, l) : /* @__PURE__ */ r(m, {}, l);
67
+ }), W = /* @__PURE__ */ I.memo(({
65
68
  item: t,
66
69
  column: e
67
70
  }) => {
68
71
  const {
69
- id: n,
70
- isItemMetadata: l,
72
+ id: l,
73
+ isItemMetadata: n,
71
74
  textValue: s
72
75
  } = e, i = `${s}-${t.id}`;
73
- return /* @__PURE__ */ r(I, {
74
- children: /* @__PURE__ */ r(u, {
76
+ return /* @__PURE__ */ r(m, {
77
+ children: /* @__PURE__ */ r(p, {
75
78
  as: "span",
76
- children: E(t, n, l)
79
+ children: $(t, l, n)
77
80
  })
78
81
  }, i);
79
- }), j = /* @__PURE__ */ c.memo(({
82
+ }), j = /* @__PURE__ */ I.memo(({
80
83
  item: t,
81
84
  column: e,
82
- iconColumnVariant: n,
83
- onInlineEditChange: l
85
+ iconColumnVariant: l,
86
+ onInlineEditChange: n
84
87
  }) => {
85
88
  const {
86
89
  cellRenderer: s,
87
90
  id: i,
88
- isInlineEditingEnabled: m,
91
+ isInlineEditingEnabled: h,
89
92
  type: d
90
93
  } = e;
91
- return i === "item.name" && (n === h.INLINE || n === h.INLINE_SUBTITLE) ? /* @__PURE__ */ r(k, {
94
+ return i === "item.name" && (l === c.INLINE || l === c.INLINE_SUBTITLE) ? /* @__PURE__ */ r(U, {
92
95
  column: e,
93
- iconColumnVariant: n,
96
+ iconColumnVariant: l,
94
97
  item: t
95
- }) : s ? /* @__PURE__ */ r(M, {
98
+ }) : s ? /* @__PURE__ */ r(k, {
96
99
  column: e,
97
100
  item: t
98
- }) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ r(w, {
101
+ }) : h && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ r(w, {
99
102
  column: e,
100
103
  item: t,
101
- onInlineEditChange: l
102
- }, `${e.id}-${t.id}`) : d === "multiSelect" ? /* @__PURE__ */ r(U, {
104
+ onInlineEditChange: n
105
+ }, `${e.id}-${t.id}`) : d === "multiSelect" ? /* @__PURE__ */ r(M, {
103
106
  column: e,
104
107
  item: t
105
108
  }) : /* @__PURE__ */ r(W, {
106
109
  column: e,
107
110
  item: t
108
111
  });
109
- }), D = /* @__PURE__ */ c.memo(({
112
+ }), D = /* @__PURE__ */ I.memo(({
110
113
  item: t,
111
114
  zoomLevel: e
112
- }) => /* @__PURE__ */ r(I, {
115
+ }) => /* @__PURE__ */ r(m, {
113
116
  style: {
114
117
  height: x[e]
115
118
  },
116
- children: /* @__PURE__ */ r(y, {
117
- className: p.iconCell,
119
+ children: /* @__PURE__ */ r(E, {
120
+ className: N.iconCell,
118
121
  item: t
119
122
  })
120
- }, `item-type-icon-${t.id}`)), G = /* @__PURE__ */ c.memo(({
123
+ }, `item-type-icon-${t.id}`)), G = /* @__PURE__ */ I.memo(({
121
124
  item: t,
122
125
  itemActionMenuProps: e
123
- }) => /* @__PURE__ */ r(b, {
124
- children: (n) => e ? /* @__PURE__ */ r(B, {
126
+ }) => /* @__PURE__ */ r(g, {
127
+ children: (l) => e ? /* @__PURE__ */ r(B, {
125
128
  ...e,
126
129
  item: t,
127
- onOpenChange: n
130
+ onOpenChange: l
128
131
  }) : null
129
132
  })), Z = ({
130
133
  columns: t,
131
134
  iconColumnVariant: e,
132
- isSelectAllEnabled: n,
133
- items: l,
135
+ isSelectAllEnabled: l,
136
+ items: n,
134
137
  itemActionMenuProps: s,
135
138
  virtualItems: i,
136
- columnCount: m,
139
+ columnCount: h,
137
140
  zoomLevel: d,
138
141
  onInlineEditChange: T
139
142
  }) => {
140
- const L = e === h.COLUMN;
143
+ const S = e === c.COLUMN;
141
144
  if (i) {
142
145
  const o = (a) => /* @__PURE__ */ r(_, {
143
- columnLength: m || 0,
146
+ columnLength: h || 0,
144
147
  rowKey: `ghost-${a}`
145
148
  }), f = (a) => /* @__PURE__ */ r(R, {
146
149
  columns: t,
147
150
  iconColumnVariant: e,
148
- isSelectAllEnabled: n,
151
+ isSelectAllEnabled: l,
149
152
  item: a,
150
153
  itemActionMenuProps: s,
151
154
  zoomLevel: d
@@ -154,18 +157,18 @@ const E = (t, e, n) => {
154
157
  items: i,
155
158
  children: ({
156
159
  index: a
157
- }) => a >= l.length ? o(a) : f(l[a])
160
+ }) => a >= n.length ? o(a) : f(n[a])
158
161
  });
159
162
  }
160
163
  return /* @__PURE__ */ r(C, {
161
- items: l.map((o) => ({
164
+ items: n.map((o) => ({
162
165
  key: o.id,
163
166
  ...o
164
167
  })),
165
- children: (o) => /* @__PURE__ */ N(S, {
166
- className: p.tableRow,
168
+ children: (o) => /* @__PURE__ */ u(b, {
169
+ className: N.tableRow,
167
170
  id: o.id,
168
- children: [L && /* @__PURE__ */ r(D, {
171
+ children: [S && /* @__PURE__ */ r(D, {
169
172
  item: o,
170
173
  zoomLevel: d
171
174
  }), t.map((f) => /* @__PURE__ */ r(j, {
@@ -173,7 +176,7 @@ const E = (t, e, n) => {
173
176
  iconColumnVariant: e,
174
177
  item: o,
175
178
  onInlineEditChange: T
176
- }, `${f.textValue}-${o.id}`)), n && /* @__PURE__ */ r(G, {
179
+ }, `${f.textValue}-${o.id}`)), l && /* @__PURE__ */ r(G, {
177
180
  item: o,
178
181
  itemActionMenuProps: s
179
182
  })]
@@ -1,48 +1,47 @@
1
1
  import { Table as T } from "@box/blueprint-web";
2
- import { I as d } from "../../../../chunks/types.js";
3
- import { GhostTableBody as x } from "./table-body/ghost-table-body.js";
4
- import B from "./table-body/table-body-with-data.js";
2
+ import { I as x } from "../../../../chunks/types.js";
3
+ import { GhostTableBody as B } from "./table-body/ghost-table-body.js";
4
+ import d from "./table-body/table-body-with-data.js";
5
5
  import j from "./messages.js";
6
6
  import { jsxs as y, jsx as i } from "react/jsx-runtime";
7
7
  const O = ({
8
8
  tableHeader: s,
9
9
  columns: t,
10
- iconColumnVariant: n,
10
+ iconColumnVariant: e,
11
11
  isSelectAllEnabled: r,
12
12
  itemActionMenuProps: c,
13
13
  items: f,
14
- isLoading: l,
14
+ isLoading: m,
15
15
  formatMessage: h,
16
- tableProps: p,
16
+ tableProps: C,
17
17
  virtualItems: o,
18
- style: u,
19
- columnCount: C,
20
- zoomLevel: g,
18
+ style: g,
19
+ columnCount: p,
20
+ zoomLevel: u,
21
21
  onInlineEditChange: a
22
22
  }) => {
23
- const m = C || (() => {
24
- let e = t.length;
25
- return n === d.COLUMN && (e += 1), r && (e += 1), e;
26
- })(), b = l && !(o != null && o.length);
23
+ const l = p || (() => {
24
+ let n = t.length;
25
+ return e === x.COLUMN && (n += 1), r && (n += 1), n;
26
+ })(), b = m && !(o != null && o.length);
27
27
  return /* @__PURE__ */ y(T, {
28
28
  "aria-label": h(j.listView),
29
29
  selectionBehavior: "toggle",
30
- selectionMode: "multiple",
31
- style: u,
32
- ...p,
33
- children: [s, b ? /* @__PURE__ */ i(x, {
34
- columnLength: m
35
- }) : /* @__PURE__ */ i(B, {
36
- columnCount: m,
30
+ style: g,
31
+ ...C,
32
+ children: [s, b ? /* @__PURE__ */ i(B, {
33
+ columnLength: l
34
+ }) : /* @__PURE__ */ i(d, {
35
+ columnCount: l,
37
36
  columns: t,
38
- iconColumnVariant: n,
39
- isLoading: l,
37
+ iconColumnVariant: e,
38
+ isLoading: m,
40
39
  isSelectAllEnabled: r,
41
40
  itemActionMenuProps: c,
42
41
  items: f,
43
42
  onInlineEditChange: a,
44
43
  virtualItems: o,
45
- zoomLevel: g
44
+ zoomLevel: u
46
45
  })]
47
46
  });
48
47
  };
@@ -1,35 +1,44 @@
1
- import { DropdownMenu as r, TriggerButton as D } from "@box/blueprint-web";
2
- import { ArrowUp as f, ArrowDown as l } from "@box/blueprint-web-assets/icons/Fill";
1
+ import { DropdownMenu as e, TriggerButton as w } from "@box/blueprint-web";
2
+ import { ArrowUp as h, ArrowDown as D } from "@box/blueprint-web-assets/icons/Fill";
3
3
  import { useState as s } from "react";
4
- import { jsxs as u, jsx as i } from "react/jsx-runtime";
4
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
5
5
  const S = ({
6
- sortableColumnNames: t,
7
- initialSortByColumn: g = t[0],
8
- initialSortDirection: p = "ascending",
9
- onSortChange: c
6
+ sortableColumns: o,
7
+ initialSortByColumnId: p = o[0].id,
8
+ initialSortDirection: m = "ascending",
9
+ onSortChange: a
10
10
  }) => {
11
- const [o, a] = s(p), [e, h] = s(g), w = (n) => {
12
- if (n === e) {
13
- const d = o === "ascending" ? "descending" : "ascending";
14
- a(d), c(n, d);
11
+ const d = new Map(o.map((n) => [n.id, n.textValue])), [t, g] = s(m), [c, u] = s(p), l = (n) => {
12
+ if (n === c) {
13
+ const i = t === "ascending" ? "descending" : "ascending";
14
+ g(i), a({
15
+ column: n,
16
+ direction: i
17
+ });
15
18
  } else
16
- h(n), a("ascending"), c(n, "ascending");
19
+ u(n), g("ascending"), a({
20
+ column: n,
21
+ direction: "ascending"
22
+ });
17
23
  };
18
- return /* @__PURE__ */ u(r.Root, {
19
- children: [/* @__PURE__ */ i(r.Trigger, {
20
- children: /* @__PURE__ */ i(D, {
21
- caretDirection: o === "ascending" ? "up" : "down",
22
- label: e,
23
- startIcon: o === "ascending" ? f : l,
24
+ return /* @__PURE__ */ f(e.Root, {
25
+ children: [/* @__PURE__ */ r(e.Trigger, {
26
+ children: /* @__PURE__ */ r(w, {
27
+ caretDirection: t === "ascending" ? "up" : "down",
28
+ label: d.get(c),
29
+ startIcon: t === "ascending" ? h : D,
24
30
  variant: "tertiary"
25
31
  })
26
- }), /* @__PURE__ */ i(r.Content, {
27
- children: /* @__PURE__ */ i(r.RadioGroup, {
28
- onValueChange: w,
29
- value: e,
30
- children: t.map((n) => /* @__PURE__ */ i(r.RadioSelectItem, {
32
+ }), /* @__PURE__ */ r(e.Content, {
33
+ children: /* @__PURE__ */ r(e.RadioGroup, {
34
+ onValueChange: l,
35
+ value: d.get(c),
36
+ children: o.map(({
37
+ id: n,
38
+ textValue: i
39
+ }) => /* @__PURE__ */ r(e.RadioSelectItem, {
31
40
  value: n,
32
- children: n
41
+ children: i
33
42
  }, n))
34
43
  })
35
44
  })]
@@ -1,5 +1,5 @@
1
- import { I as _, V as o } from "../../chunks/types.js";
2
- import { ActionBar as x } from "./components/action-bar/action-bar.js";
1
+ import { I as R, V as t } from "../../chunks/types.js";
2
+ import { ActionBar as g } from "./components/action-bar/action-bar.js";
3
3
  import "./components/filter-row/filter-row.js";
4
4
  import "../../chunks/form-filter-chip.js";
5
5
  import "./components/filter-row/metadata-filter-chip.js";
@@ -8,8 +8,8 @@ import "./components/filter-row/predefinedFilters/index.js";
8
8
  import "./components/filter-sidepanel/filter.js";
9
9
  import "./components/filter-sidepanel/filter-side-panel.js";
10
10
  import "./components/item-action-menu/item-action-menu.js";
11
- import { MetadataGrid as E } from "./components/metadata-grid/metadata-grid.js";
12
- import { MetadataTable as N } from "./components/metadata-table/metadata-table.js";
11
+ import { MetadataGrid as k } from "./components/metadata-grid/metadata-grid.js";
12
+ import { MetadataTable as x } from "./components/metadata-table/metadata-table.js";
13
13
  import "./components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js";
14
14
  import "./components/metadata-table/table-renderer.js";
15
15
  import "./components/metadata-value/metadata-file-chip.js";
@@ -17,84 +17,88 @@ import "./components/metadata-value/metadata-file-field.js";
17
17
  import "./components/metadata-value/metadata-location-field.js";
18
18
  import "./components/metadata-value/metadata-radio-field.js";
19
19
  import "./components/metadata-value/metadata-search-field.js";
20
- import { Pagination as R } from "./components/pagination/pagination.js";
20
+ import { Pagination as D } from "./components/pagination/pagination.js";
21
21
  import "./components/pagination/marker-based-pagination.js";
22
22
  import "./components/pagination/offset-based-pagination.js";
23
23
  import "./components/pagination/pagination-controls.js";
24
24
  import "./components/sort-dropdown/sort-dropdown.js";
25
- import { SwitchCase as b, Case as a } from "./components/switch-case/switch-case.js";
26
- import { TooltipProvider as g } from "@box/blueprint-web";
27
- import { useState as h, useRef as k } from "react";
28
- import { jsx as t, jsxs as u, Fragment as D } from "react/jsx-runtime";
29
- import { ErrorState as G } from "./components/error-state/error-state.js";
30
- import j from "./components/empty-state/empty-state.js";
31
- import '../../styles/metadata-view.css';const Z = "_container_nykl3_5", z = "_contentContainer_nykl3_14", M = {
25
+ import { SwitchCase as E, Case as a } from "./components/switch-case/switch-case.js";
26
+ import { TooltipProvider as G } from "@box/blueprint-web";
27
+ import { useState as u, useRef as N } from "react";
28
+ import { jsx as o, jsxs as M, Fragment as b } from "react/jsx-runtime";
29
+ import { ErrorState as j } from "./components/error-state/error-state.js";
30
+ import A from "./components/empty-state/empty-state.js";
31
+ import '../../styles/metadata-view.css';const Z = "_container_nykl3_5", z = "_contentContainer_nykl3_14", I = {
32
32
  container: Z,
33
33
  contentContainer: z
34
34
  };
35
- function ht({
36
- actionBarProps: i,
35
+ function Mo({
36
+ actionBarProps: n,
37
37
  columns: c,
38
- tableProps: p,
39
- hasError: I,
38
+ tableProps: l,
39
+ hasError: w,
40
40
  onRefresh: S,
41
- initialViewMode: V = o.LIST,
42
- paginationProps: l,
41
+ initialViewMode: V = t.LIST,
42
+ paginationProps: p,
43
43
  isLoading: s,
44
+ isSelectionEnabled: i,
44
45
  ...r
45
46
  }) {
46
- const [e, d] = h(V), [m, w] = h(0), f = k(null), v = () => {
47
- e === o.LIST ? d(o.GRID) : d(o.LIST);
48
- }, y = !s && r.items.length === 0, L = i && i.sortDropdownProps && c.filter((n) => n.type !== "multiSelect" && n.type !== "enum").map((n) => n.textValue), {
47
+ const [e, d] = u(V), [m, v] = u(0), f = N(null), y = () => {
48
+ e === t.LIST ? d(t.GRID) : d(t.LIST);
49
+ }, L = !s && r.items.length === 0, T = n && n.sortDropdownProps && c.filter((h) => h.type !== "multiSelect" && h.type !== "enum"), {
49
50
  iconColumnVariant: C
50
- } = p || {}, T = C && C === _.COLUMN;
51
- return /* @__PURE__ */ t(g, {
52
- children: /* @__PURE__ */ t("div", {
51
+ } = l || {}, _ = C && C === R.COLUMN;
52
+ return /* @__PURE__ */ o(G, {
53
+ children: /* @__PURE__ */ o("div", {
53
54
  ref: f,
54
- className: M.container,
55
- children: I ? /* @__PURE__ */ t(G, {
55
+ className: I.container,
56
+ children: w ? /* @__PURE__ */ o(j, {
56
57
  onRefresh: S
57
- }) : /* @__PURE__ */ u(D, {
58
- children: [/* @__PURE__ */ t(x, {
59
- ...i,
58
+ }) : /* @__PURE__ */ M(b, {
59
+ children: [/* @__PURE__ */ o(g, {
60
+ ...n,
60
61
  containerRef: f,
61
- isIconColumnEnabled: T,
62
- onViewModeClick: v,
63
- onZoomLevelChange: w,
64
- sortableColumnNames: L,
62
+ isIconColumnEnabled: _,
63
+ onViewModeClick: y,
64
+ onZoomLevelChange: v,
65
+ sortableColumns: T,
65
66
  viewMode: e,
66
67
  zoomLevel: m
67
- }), /* @__PURE__ */ t("div", {
68
- className: M.contentContainer,
69
- children: /* @__PURE__ */ u(b, {
70
- children: [/* @__PURE__ */ t(a, {
71
- condition: y,
72
- children: /* @__PURE__ */ t(j, {})
73
- }), /* @__PURE__ */ t(a, {
74
- condition: e === o.LIST,
75
- children: /* @__PURE__ */ t(N, {
68
+ }), /* @__PURE__ */ o("div", {
69
+ className: I.contentContainer,
70
+ children: /* @__PURE__ */ M(E, {
71
+ children: [/* @__PURE__ */ o(a, {
72
+ condition: L,
73
+ children: /* @__PURE__ */ o(A, {})
74
+ }), /* @__PURE__ */ o(a, {
75
+ condition: e === t.LIST,
76
+ children: /* @__PURE__ */ o(x, {
76
77
  columns: c,
77
78
  isLoading: s,
79
+ isSelectAllEnabled: i,
80
+ selectionMode: i ? "multiple" : "none",
78
81
  zoomLevel: m,
79
82
  ...r,
80
- ...p
83
+ ...l
81
84
  })
82
- }), /* @__PURE__ */ t(a, {
83
- condition: e === o.GRID,
84
- children: /* @__PURE__ */ t(E, {
85
+ }), /* @__PURE__ */ o(a, {
86
+ condition: e === t.GRID,
87
+ children: /* @__PURE__ */ o(k, {
88
+ selectionMode: i ? "multiple" : "none",
85
89
  zoomLevel: m,
86
90
  ...r
87
91
  })
88
92
  })]
89
93
  })
90
- }), l && /* @__PURE__ */ t(R, {
91
- ...l
94
+ }), p && /* @__PURE__ */ o(D, {
95
+ ...p
92
96
  })]
93
97
  })
94
98
  })
95
99
  });
96
100
  }
97
101
  export {
98
- ht as MetadataView,
99
- ht as default
102
+ Mo as MetadataView,
103
+ Mo as default
100
104
  };
@@ -1 +1 @@
1
- ._tableHeaderActionsWrapper_zlqta_1{position:absolute;top:0;right:var(--size-4);bottom:0;display:flex;gap:var(--space-2);align-items:center;justify-content:center;padding:0 var(--space-2);background:var(--item-background);margin-block:var(--space-2)}._tableHeaderActionsWrapper_zlqta_1:before{position:absolute;left:0;z-index:0;display:block;width:0;height:50%;box-shadow:-.25rem 0 .625rem .625rem var(--item-background);content:""}._tableHeaderActions_zlqta_1{position:sticky;right:0;width:var(--size-6);padding:0}._tableRow_zlqta_33:after{height:100%!important}._tableRow_zlqta_33[aria-selected=true]:after{height:100%!important}._selectAllCheckbox_zlqta_42 svg{transform:none!important}._tableNameCell_zlqta_47{display:flex;gap:var(--space-3);align-items:center}._tableNameCellSubtitle_zlqta_53{display:flex;flex-direction:column}._infiniteScrollTableContainerFullHeight_zlqta_58{width:100%;height:100%;overflow:auto}._iconCell_zlqta_64{width:100%!important;height:100%!important}
1
+ ._tableHeaderActionsWrapper_o1i04_1{position:absolute;top:0;right:var(--size-4);bottom:0;display:flex;gap:var(--space-2);align-items:center;justify-content:center;padding:0 var(--space-2);background:var(--item-background);margin-block:var(--space-2)}._tableHeaderActionsWrapper_o1i04_1:before{position:absolute;left:0;z-index:0;display:block;width:0;height:50%;box-shadow:-.25rem 0 .625rem .625rem var(--item-background);content:""}._tableHeaderActions_o1i04_1{position:sticky;right:0;width:var(--size-6);padding:0}._tableRow_o1i04_33:after{height:100%!important}._tableRow_o1i04_33[aria-selected=true]:after{height:100%!important}._selectAllCheckbox_o1i04_42 svg{transform:none!important}._tableNameCell_o1i04_47{display:flex;gap:var(--space-3);align-items:center}._tableNameCellSubtitle_o1i04_53{display:flex;flex-direction:column}._tableNameCellIconInline_o1i04_58{min-width:var(--size-8)}._infiniteScrollTableContainerFullHeight_o1i04_62{width:100%;height:100%;overflow:auto}._iconCell_o1i04_68{width:100%!important;height:100%!important}
@@ -1,4 +1,4 @@
1
- import { ViewMode } from '../../types';
1
+ import { Column, ViewMode } from '../../types';
2
2
  import { FilterRowProps } from '../filter-row';
3
3
  import { SortDropdownProps } from '../sort-dropdown';
4
4
  import { FilterGroup } from '../filter-row/types';
@@ -13,7 +13,7 @@ export interface ActionBarProps extends Omit<FilterRowProps, 'filterGroups'> {
13
13
  zoomLevel?: number;
14
14
  }
15
15
  interface ActionBarInternalProps extends ActionBarProps {
16
- sortableColumnNames: string[];
16
+ sortableColumns: Column[];
17
17
  }
18
- export declare const ActionBar: ({ isIconColumnEnabled, isViewModeButtonDisabled, onViewModeClick, onZoomLevelChange, sortableColumnNames, sortDropdownProps, viewMode, zoomLevel, ...rest }: ActionBarInternalProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const ActionBar: ({ isIconColumnEnabled, isViewModeButtonDisabled, onViewModeClick, onZoomLevelChange, sortableColumns, sortDropdownProps, viewMode, zoomLevel, ...rest }: ActionBarInternalProps) => import("react/jsx-runtime").JSX.Element;
19
19
  export {};
@@ -1,11 +1,12 @@
1
- import { SortDirection } from 'react-aria-components';
1
+ import { SortDescriptor, SortDirection } from 'react-aria-components';
2
+ import { Column } from '../../types';
2
3
  export interface SortDropdownProps {
3
- initialSortByColumn?: string;
4
+ initialSortByColumnId?: string;
4
5
  initialSortDirection?: SortDirection;
5
- onSortChange: (sortByColumn: string, sortDirection: SortDirection) => void;
6
+ onSortChange: (sortDescriptor: SortDescriptor) => void;
6
7
  }
7
8
  interface SortDropdownInternalProps extends SortDropdownProps {
8
- sortableColumnNames: string[];
9
+ sortableColumns: Column[];
9
10
  }
10
- export declare const SortDropdown: ({ sortableColumnNames, initialSortByColumn, initialSortDirection, onSortChange, }: SortDropdownInternalProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const SortDropdown: ({ sortableColumns, initialSortByColumnId, initialSortDirection, onSortChange, }: SortDropdownInternalProps) => import("react/jsx-runtime").JSX.Element;
11
12
  export {};
@@ -1,3 +1,4 @@
1
+ import { Selection } from 'react-aria-components';
1
2
  import { ActionBarProps, MetadataTableProps, PaginationProps } from './components';
2
3
  import { ViewMode, Column, MetadataProps } from './types';
3
4
  export interface MetadataViewProps extends MetadataProps {
@@ -6,8 +7,11 @@ export interface MetadataViewProps extends MetadataProps {
6
7
  hasError?: boolean;
7
8
  initialViewMode?: ViewMode;
8
9
  onRefresh?: () => void;
9
- tableProps?: Omit<MetadataTableProps, 'columns' | 'items' | 'itemActionMenuProps'>;
10
+ onSelectionChange?: (keys: Selection) => void;
11
+ selectedKeys?: 'all' | Iterable<string | number>;
12
+ isSelectionEnabled?: boolean;
13
+ tableProps?: Omit<MetadataTableProps, 'columns' | 'isSelectAllEnabled' | 'items' | 'itemActionMenuProps' | 'onSelectionChange' | 'selectedKeys'>;
10
14
  paginationProps?: PaginationProps;
11
15
  }
12
- export declare function MetadataView({ actionBarProps, columns, tableProps, hasError, onRefresh, initialViewMode, paginationProps, isLoading, ...rest }: MetadataViewProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function MetadataView({ actionBarProps, columns, tableProps, hasError, onRefresh, initialViewMode, paginationProps, isLoading, isSelectionEnabled, ...rest }: MetadataViewProps): import("react/jsx-runtime").JSX.Element;
13
17
  export default MetadataView;
@@ -23,7 +23,7 @@ export declare const mockFilterOptionsWithInvalidType: FilterOption[];
23
23
  export declare const mockFilterOptionsWithSomeChipsHidden: FilterOption[];
24
24
  export declare const mockMetadata: Item[];
25
25
  export declare const mockMetadataWithThumbnail: Item[];
26
- export declare const mockSortableColumnNames: string[];
26
+ export declare const mockSortableColumns: Column[];
27
27
  export declare const mockSortDropdownProps: SortDropdownProps;
28
28
  export declare const mockFilterGroups: FilterGroup[];
29
29
  export declare const mockTypedPaginationPropsMarker: PaginationProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.48.9",
3
+ "version": "0.48.11",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^11.12.0",
@@ -23,7 +23,7 @@
23
23
  "@box/box-item-type-selector": "^0.69.7",
24
24
  "@box/eslint-plugin-blueprint": "*",
25
25
  "@box/item-icon": "^0.23.7",
26
- "@box/metadata-filter": "^1.26.4",
26
+ "@box/metadata-filter": "^1.26.5",
27
27
  "@box/storybook-utils": "0.14.2",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",