@box/metadata-view 1.1.0 → 1.2.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.
@@ -1,51 +1,53 @@
1
- import { Row as L, Cell as n, Text as r, ActionCell as E } from "@box/blueprint-web";
1
+ import { Row as E, Cell as n, Text as r, ActionCell as y } from "@box/blueprint-web";
2
2
  import I from "lodash/get";
3
3
  import { ItemTypeIcon as C } from "@box/item-icon";
4
- import y from "clsx";
4
+ import R from "clsx";
5
5
  import { I as o } from "./types.js";
6
- import { THUMBNAIL_LIST_VIEW_HEIGHTS as R } from "../esm/lib/components/constants.js";
6
+ import { THUMBNAIL_LIST_VIEW_HEIGHTS as g } from "../esm/lib/components/constants.js";
7
7
  import { jsxs as b, jsx as e } from "react/jsx-runtime";
8
- import { ItemActionMenu as g } from "../esm/lib/components/item-action-menu/item-action-menu.js";
9
- import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k = "_tableHeaderActions_1a999_1", U = "_tableRow_1a999_33", B = "_selectAllCheckbox_1a999_42", W = "_tableNameCell_1a999_47", j = "_tableNameCellTitle_1a999_53", F = "_hasSubtitle_1a999_57", M = "_tableNameCellText_1a999_62", $ = "_tableNameCellIconInline_1a999_67", v = "_infiniteScrollTableContainerFullHeight_1a999_71", O = "_iconCell_1a999_77", t = {
10
- tableHeaderActionsWrapper: w,
11
- tableHeaderActions: k,
12
- tableRow: U,
13
- selectAllCheckbox: B,
14
- tableNameCell: W,
15
- tableNameCellTitle: j,
16
- hasSubtitle: F,
17
- tableNameCellText: M,
18
- tableNameCellIconInline: $,
19
- infiniteScrollTableContainerFullHeight: v,
20
- iconCell: O
21
- }, Y = ({
22
- item: l,
23
- columns: h,
8
+ import { ItemActionMenu as w } from "../esm/lib/components/item-action-menu/item-action-menu.js";
9
+ import '../styles/index.css';const k = "_tableHeaderActionsWrapper_1a999_1", U = "_tableHeaderActions_1a999_1", B = "_tableRow_1a999_33", W = "_selectAllCheckbox_1a999_42", j = "_tableNameCell_1a999_47", F = "_tableNameCellTitle_1a999_53", M = "_hasSubtitle_1a999_57", $ = "_tableNameCellText_1a999_62", v = "_tableNameCellIconInline_1a999_67", O = "_infiniteScrollTableContainerFullHeight_1a999_71", D = "_iconCell_1a999_77", t = {
10
+ tableHeaderActionsWrapper: k,
11
+ tableHeaderActions: U,
12
+ tableRow: B,
13
+ selectAllCheckbox: W,
14
+ tableNameCell: j,
15
+ tableNameCellTitle: F,
16
+ hasSubtitle: M,
17
+ tableNameCellText: $,
18
+ tableNameCellIconInline: v,
19
+ infiniteScrollTableContainerFullHeight: O,
20
+ iconCell: D
21
+ }, Z = ({
22
+ areSelectionCheckboxesDisabled: h,
23
+ columns: T,
24
24
  iconColumnVariant: a,
25
- isSelectAllEnabled: T,
25
+ isSelectAllEnabled: p,
26
+ item: l,
26
27
  itemActionMenuProps: _,
27
- areSelectionCheckboxesDisabled: p,
28
- zoomLevel: u = 0
29
- }) => /* @__PURE__ */ b(L, {
28
+ onTableRowClick: u,
29
+ zoomLevel: x = 0
30
+ }) => /* @__PURE__ */ b(E, {
30
31
  className: t.tableRow,
31
32
  id: l.id,
33
+ onAction: () => u(l),
32
34
  children: [a === o.COLUMN ? /* @__PURE__ */ e(n, {
33
35
  style: {
34
- height: R[u]
36
+ height: g[x]
35
37
  },
36
38
  children: /* @__PURE__ */ e(C, {
37
39
  className: t.iconCell,
38
40
  item: l
39
41
  })
40
- }, `item-type-icon-${l.id}`) : null, h.map((c) => {
42
+ }, `item-type-icon-${l.id}`) : null, T.map((c) => {
41
43
  const {
42
44
  cellRenderer: d,
43
45
  id: s,
44
- isItemMetadata: x,
45
- subtitle: f,
46
- textValue: S,
46
+ isItemMetadata: f,
47
+ subtitle: S,
48
+ textValue: A,
47
49
  type: H
48
- } = c, i = `${S}-${l.id}`, A = x ? s.split(".")[1] : s, m = I(l, A);
50
+ } = c, i = `${A}-${l.id}`, L = f ? s.split(".")[1] : s, m = I(l, L);
49
51
  if (s === "name" && (a === o.INLINE || a === o.INLINE_SUBTITLE))
50
52
  return /* @__PURE__ */ e(n, {
51
53
  children: /* @__PURE__ */ b("div", {
@@ -53,7 +55,7 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
53
55
  children: [/* @__PURE__ */ e(C, {
54
56
  item: l
55
57
  }), /* @__PURE__ */ b("div", {
56
- className: y(t.tableNameCellTitle, {
58
+ className: R(t.tableNameCellTitle, {
57
59
  [t.hasSubtitle]: a === o.INLINE_SUBTITLE
58
60
  }),
59
61
  children: [/* @__PURE__ */ e(r, {
@@ -64,7 +66,7 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
64
66
  as: "span",
65
67
  className: t.tableNameCellText,
66
68
  color: "textOnLightSecondary",
67
- children: f
69
+ children: S
68
70
  }) : null]
69
71
  })]
70
72
  })
@@ -85,9 +87,9 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
85
87
  children: m
86
88
  })
87
89
  }, i);
88
- }), T && /* @__PURE__ */ e(E, {
89
- isCheckboxDisabled: p,
90
- children: (c) => _ ? /* @__PURE__ */ e(g, {
90
+ }), p && /* @__PURE__ */ e(y, {
91
+ isCheckboxDisabled: h,
92
+ children: (c) => _ ? /* @__PURE__ */ e(w, {
91
93
  ..._,
92
94
  item: l,
93
95
  onOpenChange: c
@@ -95,6 +97,6 @@ import '../styles/index.css';const w = "_tableHeaderActionsWrapper_1a999_1", k =
95
97
  })]
96
98
  }, l.id);
97
99
  export {
98
- Y as T,
100
+ Z as T,
99
101
  t as s
100
102
  };
@@ -1,48 +1,50 @@
1
- import { useRef as E } from "react";
2
- import { useIntl as B } from "react-intl";
3
- import { Text as O, ListCheckbox as P, TableHeader as U, Column as j } from "@box/blueprint-web";
4
- import { useInfiniteScrollTableItems as k } from "./hooks/useInfiniteScrollTableItems.js";
1
+ import { useRef as B } from "react";
2
+ import { useIntl as O } from "react-intl";
3
+ import { Text as P, ListCheckbox as U, TableHeader as j, Column as k } from "@box/blueprint-web";
4
+ import F from "lodash/noop";
5
+ import { useInfiniteScrollTableItems as G } from "./hooks/useInfiniteScrollTableItems.js";
5
6
  import { TableRenderer as R } from "./table-renderer.js";
6
- import { I as F } from "../../../../chunks/types.js";
7
- import { THUMBNAIL_WIDTHS as G } from "../constants.js";
7
+ import { I as L } from "../../../../chunks/types.js";
8
+ import { THUMBNAIL_WIDTHS as V } from "../constants.js";
8
9
  import { s } from "../../../../chunks/index.js";
9
- import L from "./messages.js";
10
+ import X from "./messages.js";
10
11
  import { jsx as e } from "react/jsx-runtime";
11
12
  import "./table-body/inline-editing-cell/inline-editing-cell.js";
12
- const V = 40, ae = ({
13
- columns: o,
14
- isLoading: l = !1,
15
- iconColumnVariant: n,
16
- isSelectAllEnabled: m,
17
- items: d,
18
- itemActionMenuProps: w,
13
+ const Y = 40, le = ({
14
+ areSelectionCheckboxesDisabled: i = !1,
15
+ columns: n,
16
+ hasNextPage: w = !1,
17
+ iconColumnVariant: m,
19
18
  isInfiniteScrollEnabled: x = !1,
20
- areSelectionCheckboxesDisabled: c = !1,
21
- hasNextPage: g = !1,
22
- onInlineEditChange: y,
23
- onGetNextPage: W,
24
- placeholderRowsCount: A,
25
- zoomLevel: r,
26
- ...C
19
+ isLoading: l = !1,
20
+ isSelectAllEnabled: d,
21
+ itemActionMenuProps: g,
22
+ items: c,
23
+ onGetNextPage: y,
24
+ onInlineEditChange: W,
25
+ onTableRowClick: A = F,
26
+ placeholderRowsCount: C,
27
+ zoomLevel: a,
28
+ ...N
27
29
  }) => {
28
30
  var H;
29
31
  const {
30
32
  formatMessage: f
31
- } = B(), p = E(null), {
33
+ } = O(), p = B(null), {
32
34
  virtualItemsToDisplay: h,
33
- getTableHeight: N
34
- } = k({
35
- items: d,
36
- hasNextPage: g,
35
+ getTableHeight: _
36
+ } = G({
37
+ items: c,
38
+ hasNextPage: w,
37
39
  isLoading: l,
38
40
  parentRef: p,
39
- onGetNextPage: W,
40
- placeholderRowsCount: A
41
- }), a = [], _ = 0;
42
- if (n === F.COLUMN) {
43
- r = r || _;
44
- const t = parseInt(G[r], 10) + 24;
45
- a.push({
41
+ onGetNextPage: y,
42
+ placeholderRowsCount: C
43
+ }), r = [], v = 0;
44
+ if (m === L.COLUMN) {
45
+ a = a || v;
46
+ const t = parseInt(V[a], 10) + 24;
47
+ r.push({
46
48
  id: "item-type-icon",
47
49
  isRowHeader: !1,
48
50
  hideHeader: !1,
@@ -50,61 +52,62 @@ const V = 40, ae = ({
50
52
  maxWidth: t
51
53
  });
52
54
  }
53
- const v = o.map((t) => {
55
+ const D = n.map((t) => {
54
56
  const {
55
57
  id: b,
56
- isRowHeader: M,
58
+ isRowHeader: S,
57
59
  headerRenderer: T,
58
- textValue: i,
60
+ textValue: o,
59
61
  type: I,
60
- ...S
62
+ ...E
61
63
  } = t;
62
64
  return {
63
- ...S,
64
- children: T ? T(i, t) : /* @__PURE__ */ e(O, {
65
+ ...E,
66
+ children: T ? T(o, t) : /* @__PURE__ */ e(P, {
65
67
  as: "span",
66
- children: i
68
+ children: o
67
69
  }),
68
- isRowHeader: b === "name" || M,
70
+ isRowHeader: b === "name" || S,
69
71
  id: b,
70
- textValue: i,
72
+ textValue: o,
71
73
  allowsSorting: I !== "multiSelect" && I !== "enum"
72
74
  };
73
75
  });
74
- a.push(...v), m && a.push({
76
+ r.push(...D), d && r.push({
75
77
  id: "actions",
76
78
  className: s.tableHeaderActions,
77
79
  children: /* @__PURE__ */ e("div", {
78
80
  className: s.tableHeaderActionsWrapper,
79
- children: /* @__PURE__ */ e(P, {
80
- "aria-label": f(L.selectAll),
81
+ children: /* @__PURE__ */ e(U, {
82
+ "aria-label": f(X.selectAll),
81
83
  className: s.selectAllCheckbox,
82
- isDisabled: l || c
84
+ isDisabled: l || i
83
85
  })
84
86
  }),
85
87
  isRowHeader: !1,
86
88
  hideHeader: !1,
87
89
  allowsSorting: !1
88
90
  });
89
- const D = /* @__PURE__ */ e(U, {
90
- columns: a,
91
- children: (t) => /* @__PURE__ */ e(j, {
91
+ const M = /* @__PURE__ */ e(j, {
92
+ columns: r,
93
+ children: (t) => /* @__PURE__ */ e(k, {
92
94
  ...t
93
95
  })
94
96
  }), u = {
95
- columnCount: a.length,
96
- columns: o,
97
+ columnCount: r.length,
98
+ columns: n,
97
99
  formatMessage: f,
98
- iconColumnVariant: n,
100
+ iconColumnVariant: m,
99
101
  isLoading: l,
100
- isSelectAllEnabled: m,
101
- areSelectionCheckboxesDisabled: c,
102
- itemActionMenuProps: w,
103
- items: d,
104
- onInlineEditChange: y,
105
- tableHeader: D,
106
- tableProps: C,
107
- zoomLevel: r
102
+ isSelectAllEnabled: d,
103
+ areSelectionCheckboxesDisabled: i,
104
+ itemActionMenuProps: g,
105
+ items: c,
106
+ onInlineEditChange: W,
107
+ onTableRowClick: A,
108
+ tableHeader: M,
109
+ tableProps: N,
110
+ zoomLevel: a
108
111
  };
109
112
  return x ? /* @__PURE__ */ e("div", {
110
113
  ref: p,
@@ -113,7 +116,7 @@ const V = 40, ae = ({
113
116
  style: {
114
117
  position: "relative",
115
118
  width: "100%",
116
- height: N() + V
119
+ height: _() + Y
117
120
  },
118
121
  children: /* @__PURE__ */ e(R, {
119
122
  ...u,
@@ -133,5 +136,5 @@ const V = 40, ae = ({
133
136
  });
134
137
  };
135
138
  export {
136
- ae as MetadataTable
139
+ le as MetadataTable
137
140
  };
@@ -1,193 +1,196 @@
1
- import { TableBody as C, Row as L, Cell as h, ActionCell as g, Text as u } from "@box/blueprint-web";
2
- import { ItemTypeIcon as y } from "@box/item-icon";
1
+ import { TableBody as $, Row as g, Cell as h, ActionCell as S, Text as u } from "@box/blueprint-web";
2
+ import { ItemTypeIcon as b } from "@box/item-icon";
3
3
  import R from "clsx";
4
- import $ from "lodash/get";
4
+ import x from "lodash/get";
5
5
  import I from "react";
6
6
  import { I as N } from "../../../../../chunks/types.js";
7
- import { THUMBNAIL_LIST_VIEW_HEIGHTS as S } from "../../constants.js";
8
- import { s as i, T as w } from "../../../../../chunks/index.js";
7
+ import { THUMBNAIL_LIST_VIEW_HEIGHTS as w } from "../../constants.js";
8
+ import { s as i, T as B } from "../../../../../chunks/index.js";
9
9
  import { jsx as l, jsxs as T } from "react/jsx-runtime";
10
- import { InlineEditingCell as B } from "./inline-editing-cell/inline-editing-cell.js";
11
- import { ItemActionMenu as _ } from "../../item-action-menu/item-action-menu.js";
12
- import { GhostTableRow as k } from "./ghost-table-row/ghost-table-row.js";
13
- const b = (t, e, r) => {
14
- const n = r ? e.split(".")[1] : e;
15
- return $(t, n);
16
- }, M = /* @__PURE__ */ I.memo(({
17
- item: t,
10
+ import { InlineEditingCell as _ } from "./inline-editing-cell/inline-editing-cell.js";
11
+ import { ItemActionMenu as M } from "../../item-action-menu/item-action-menu.js";
12
+ import { GhostTableRow as U } from "./ghost-table-row/ghost-table-row.js";
13
+ const E = (e, t, r) => {
14
+ const n = r ? t.split(".")[1] : t;
15
+ return x(e, n);
16
+ }, W = /* @__PURE__ */ I.memo(({
18
17
  column: e,
19
- iconColumnVariant: r
18
+ iconColumnVariant: t,
19
+ item: r
20
20
  }) => {
21
21
  const {
22
22
  id: n,
23
- isItemMetadata: s,
24
- subtitle: a,
23
+ isItemMetadata: a,
24
+ subtitle: s,
25
25
  textValue: m
26
- } = e, d = `${m}-${t.id}`;
26
+ } = e, d = `${m}-${r.id}`;
27
27
  return /* @__PURE__ */ l(h, {
28
28
  children: /* @__PURE__ */ T("div", {
29
29
  className: i.tableNameCell,
30
- children: [/* @__PURE__ */ l(y, {
30
+ children: [/* @__PURE__ */ l(b, {
31
31
  className: i.tableNameCellIconInline,
32
- item: t
32
+ item: r
33
33
  }), /* @__PURE__ */ T("div", {
34
34
  className: R(i.tableNameCellTitle, {
35
- [i.hasSubtitle]: r === N.INLINE_SUBTITLE
35
+ [i.hasSubtitle]: t === N.INLINE_SUBTITLE
36
36
  }),
37
37
  children: [/* @__PURE__ */ l(u, {
38
38
  as: "span",
39
39
  className: i.tableNameCellText,
40
- children: b(t, n, s)
41
- }), r === N.INLINE_SUBTITLE && /* @__PURE__ */ l(u, {
40
+ children: E(r, n, a)
41
+ }), t === N.INLINE_SUBTITLE && /* @__PURE__ */ l(u, {
42
42
  as: "span",
43
43
  className: i.tableNameCellText,
44
44
  color: "textOnLightSecondary",
45
- children: a
45
+ children: s
46
46
  })]
47
47
  })]
48
48
  })
49
49
  }, d);
50
- }), U = /* @__PURE__ */ I.memo(({
51
- item: t,
52
- column: e
50
+ }), k = /* @__PURE__ */ I.memo(({
51
+ column: e,
52
+ item: t
53
53
  }) => {
54
54
  var n;
55
55
  const r = `${e.textValue}-${t.id}`;
56
56
  return /* @__PURE__ */ l(h, {
57
57
  children: (n = e.cellRenderer) == null ? void 0 : n.call(e, t, e)
58
58
  }, r);
59
- }), W = /* @__PURE__ */ I.memo(({
60
- item: t,
61
- column: e
59
+ }), j = /* @__PURE__ */ I.memo(({
60
+ column: e,
61
+ item: t
62
62
  }) => {
63
- const r = `${e.textValue}-${t.id}`, n = $(t, e.id);
63
+ const r = `${e.textValue}-${t.id}`, n = x(t, e.id);
64
64
  return n ? /* @__PURE__ */ l(h, {
65
65
  children: n.join(" ")
66
66
  }, r) : /* @__PURE__ */ l(h, {}, r);
67
- }), j = /* @__PURE__ */ I.memo(({
68
- item: t,
69
- column: e
67
+ }), D = /* @__PURE__ */ I.memo(({
68
+ column: e,
69
+ item: t
70
70
  }) => {
71
71
  const {
72
72
  id: r,
73
73
  isItemMetadata: n,
74
- textValue: s
75
- } = e, a = `${s}-${t.id}`;
74
+ textValue: a
75
+ } = e, s = `${a}-${t.id}`;
76
76
  return /* @__PURE__ */ l(h, {
77
77
  children: /* @__PURE__ */ l(u, {
78
78
  as: "span",
79
- children: b(t, r, n)
79
+ children: E(t, r, n)
80
80
  })
81
- }, a);
82
- }), D = /* @__PURE__ */ I.memo(({
83
- item: t,
81
+ }, s);
82
+ }), G = /* @__PURE__ */ I.memo(({
84
83
  column: e,
85
- iconColumnVariant: r,
84
+ iconColumnVariant: t,
85
+ item: r,
86
86
  onInlineEditChange: n
87
87
  }) => {
88
88
  const {
89
- cellRenderer: s,
90
- id: a,
89
+ cellRenderer: a,
90
+ id: s,
91
91
  isInlineEditingEnabled: m,
92
92
  type: d
93
93
  } = e;
94
- return a === "item.name" && (r === N.INLINE || r === N.INLINE_SUBTITLE) ? /* @__PURE__ */ l(M, {
94
+ return s === "item.name" && (t === N.INLINE || t === N.INLINE_SUBTITLE) ? /* @__PURE__ */ l(W, {
95
95
  column: e,
96
- iconColumnVariant: r,
97
- item: t
98
- }) : s ? /* @__PURE__ */ l(U, {
96
+ iconColumnVariant: t,
97
+ item: r
98
+ }) : a ? /* @__PURE__ */ l(k, {
99
99
  column: e,
100
- item: t
101
- }) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ l(B, {
100
+ item: r
101
+ }) : m && (d === "multiSelect" || d === "enum") ? /* @__PURE__ */ l(_, {
102
102
  column: e,
103
- item: t,
103
+ item: r,
104
104
  onInlineEditChange: n
105
- }, `${e.id}-${t.id}`) : d === "multiSelect" ? /* @__PURE__ */ l(W, {
105
+ }, `${e.id}-${r.id}`) : d === "multiSelect" ? /* @__PURE__ */ l(j, {
106
106
  column: e,
107
- item: t
108
- }) : /* @__PURE__ */ l(j, {
107
+ item: r
108
+ }) : /* @__PURE__ */ l(D, {
109
109
  column: e,
110
- item: t
110
+ item: r
111
111
  });
112
- }), G = /* @__PURE__ */ I.memo(({
113
- item: t,
114
- zoomLevel: e
112
+ }), H = /* @__PURE__ */ I.memo(({
113
+ item: e,
114
+ zoomLevel: t
115
115
  }) => /* @__PURE__ */ l(h, {
116
116
  style: {
117
- height: S[e]
117
+ height: w[t]
118
118
  },
119
- children: /* @__PURE__ */ l(y, {
119
+ children: /* @__PURE__ */ l(b, {
120
120
  className: i.iconCell,
121
- item: t
121
+ item: e
122
122
  })
123
- }, `item-type-icon-${t.id}`)), H = /* @__PURE__ */ I.memo(({
124
- item: t,
125
- itemActionMenuProps: e,
123
+ }, `item-type-icon-${e.id}`)), A = /* @__PURE__ */ I.memo(({
124
+ item: e,
125
+ itemActionMenuProps: t,
126
126
  isCheckboxDisabled: r
127
- }) => /* @__PURE__ */ l(g, {
127
+ }) => /* @__PURE__ */ l(S, {
128
128
  isCheckboxDisabled: r,
129
- children: (n) => e ? /* @__PURE__ */ l(_, {
130
- ...e,
131
- item: t,
129
+ children: (n) => t ? /* @__PURE__ */ l(M, {
130
+ ...t,
131
+ item: e,
132
132
  onOpenChange: n
133
133
  }) : null
134
- })), z = ({
135
- columns: t,
136
- iconColumnVariant: e,
137
- isSelectAllEnabled: r,
138
- items: n,
139
- itemActionMenuProps: s,
140
- areSelectionCheckboxesDisabled: a,
141
- virtualItems: m,
142
- columnCount: d,
143
- zoomLevel: p,
144
- onInlineEditChange: x
134
+ })), P = ({
135
+ areSelectionCheckboxesDisabled: e,
136
+ columnCount: t,
137
+ columns: r,
138
+ iconColumnVariant: n,
139
+ isSelectAllEnabled: a,
140
+ items: s,
141
+ itemActionMenuProps: m,
142
+ onInlineEditChange: d,
143
+ onTableRowClick: p,
144
+ virtualItems: C,
145
+ zoomLevel: y
145
146
  }) => {
146
- const E = e === N.COLUMN;
147
- if (m) {
148
- const o = (c) => /* @__PURE__ */ l(k, {
149
- columnLength: d || 0,
147
+ const L = n === N.COLUMN;
148
+ if (C) {
149
+ const o = (c) => /* @__PURE__ */ l(U, {
150
+ columnLength: t || 0,
150
151
  rowKey: `ghost-${c}`
151
- }), f = (c) => /* @__PURE__ */ l(w, {
152
- areSelectionCheckboxesDisabled: a,
153
- columns: t,
154
- iconColumnVariant: e,
155
- isSelectAllEnabled: r,
152
+ }), f = (c) => /* @__PURE__ */ l(B, {
153
+ areSelectionCheckboxesDisabled: e,
154
+ columns: r,
155
+ iconColumnVariant: n,
156
+ isSelectAllEnabled: a,
156
157
  item: c,
157
- itemActionMenuProps: s,
158
- zoomLevel: p
158
+ itemActionMenuProps: m,
159
+ onTableRowClick: p,
160
+ zoomLevel: y
159
161
  });
160
- return /* @__PURE__ */ l(C, {
161
- items: m,
162
+ return /* @__PURE__ */ l($, {
163
+ items: C,
162
164
  children: ({
163
165
  index: c
164
- }) => c >= n.length ? o(c) : f(n[c])
166
+ }) => c >= s.length ? o(c) : f(s[c])
165
167
  });
166
168
  }
167
- return /* @__PURE__ */ l(C, {
168
- items: n.map((o) => ({
169
+ return /* @__PURE__ */ l($, {
170
+ items: s.map((o) => ({
169
171
  key: o.id,
170
172
  ...o
171
173
  })),
172
- children: (o) => /* @__PURE__ */ T(L, {
174
+ children: (o) => /* @__PURE__ */ T(g, {
173
175
  className: i.tableRow,
174
176
  id: o.id,
175
- children: [E && /* @__PURE__ */ l(G, {
177
+ onAction: () => p(o),
178
+ children: [L && /* @__PURE__ */ l(H, {
176
179
  item: o,
177
- zoomLevel: p
178
- }), t.map((f) => /* @__PURE__ */ l(D, {
180
+ zoomLevel: y
181
+ }), r.map((f) => /* @__PURE__ */ l(G, {
179
182
  column: f,
180
- iconColumnVariant: e,
183
+ iconColumnVariant: n,
181
184
  item: o,
182
- onInlineEditChange: x
183
- }, `${f.textValue}-${o.id}`)), r && /* @__PURE__ */ l(H, {
184
- isCheckboxDisabled: a,
185
+ onInlineEditChange: d
186
+ }, `${f.textValue}-${o.id}`)), a && /* @__PURE__ */ l(A, {
187
+ isCheckboxDisabled: e,
185
188
  item: o,
186
- itemActionMenuProps: s
189
+ itemActionMenuProps: m
187
190
  })]
188
191
  }, o.id)
189
192
  });
190
193
  };
191
194
  export {
192
- z as default
195
+ P as default
193
196
  };
@@ -1,52 +1,54 @@
1
- import { Table as x } from "@box/blueprint-web";
2
- import { I as B } from "../../../../chunks/types.js";
3
- import { GhostTableBody as d } from "./table-body/ghost-table-body.js";
4
- import j from "./table-body/table-body-with-data.js";
5
- import y from "./messages.js";
6
- import { jsxs as G, jsx as i } from "react/jsx-runtime";
7
- const R = ({
8
- tableHeader: s,
1
+ import { Table as B } from "@box/blueprint-web";
2
+ import { I as d } from "../../../../chunks/types.js";
3
+ import { GhostTableBody as j } from "./table-body/ghost-table-body.js";
4
+ import y from "./table-body/table-body-with-data.js";
5
+ import G from "./messages.js";
6
+ import { jsxs as V, jsx as i } from "react/jsx-runtime";
7
+ const U = ({
8
+ columnCount: s,
9
9
  columns: t,
10
+ formatMessage: c,
10
11
  iconColumnVariant: e,
11
- isSelectAllEnabled: r,
12
- areSelectionCheckboxesDisabled: c,
13
- itemActionMenuProps: f,
14
- items: h,
15
- isLoading: m,
16
- formatMessage: C,
17
- tableProps: g,
12
+ isLoading: r,
13
+ isSelectAllEnabled: m,
14
+ areSelectionCheckboxesDisabled: f,
15
+ itemActionMenuProps: h,
16
+ items: C,
17
+ onInlineEditChange: g,
18
+ onTableRowClick: p,
19
+ style: u,
20
+ tableHeader: a,
21
+ tableProps: b,
18
22
  virtualItems: o,
19
- style: p,
20
- columnCount: u,
21
- zoomLevel: a,
22
- onInlineEditChange: b
23
+ zoomLevel: T
23
24
  }) => {
24
- const l = u || (() => {
25
+ const l = s || (() => {
25
26
  let n = t.length;
26
- return e === B.COLUMN && (n += 1), r && (n += 1), n;
27
- })(), T = m && !(o != null && o.length);
28
- return /* @__PURE__ */ G(x, {
29
- "aria-label": C(y.listView),
27
+ return e === d.COLUMN && (n += 1), m && (n += 1), n;
28
+ })(), x = r && !(o != null && o.length);
29
+ return /* @__PURE__ */ V(B, {
30
+ "aria-label": c(G.listView),
30
31
  selectionBehavior: "toggle",
31
- style: p,
32
- ...g,
33
- children: [s, T ? /* @__PURE__ */ i(d, {
32
+ style: u,
33
+ ...b,
34
+ children: [a, x ? /* @__PURE__ */ i(j, {
34
35
  columnLength: l
35
- }) : /* @__PURE__ */ i(j, {
36
- areSelectionCheckboxesDisabled: c,
36
+ }) : /* @__PURE__ */ i(y, {
37
+ areSelectionCheckboxesDisabled: f,
37
38
  columnCount: l,
38
39
  columns: t,
39
40
  iconColumnVariant: e,
40
- isLoading: m,
41
- isSelectAllEnabled: r,
42
- itemActionMenuProps: f,
43
- items: h,
44
- onInlineEditChange: b,
41
+ isLoading: r,
42
+ isSelectAllEnabled: m,
43
+ itemActionMenuProps: h,
44
+ items: C,
45
+ onInlineEditChange: g,
46
+ onTableRowClick: p,
45
47
  virtualItems: o,
46
- zoomLevel: a
48
+ zoomLevel: T
47
49
  })]
48
50
  });
49
51
  };
50
52
  export {
51
- R as TableRenderer
53
+ U as TableRenderer
52
54
  };
@@ -1,15 +1,17 @@
1
1
  import { TableProps } from '@box/blueprint-web';
2
+ import { Item } from '@box/types';
2
3
  import { IconColumnVariant, Column, MetadataProps } from '../../types';
3
4
  import { InlineEditingCellProps } from './table-body/inline-editing-cell';
4
5
  export interface MetadataTableProps extends TableProps, MetadataProps, Pick<InlineEditingCellProps, 'onInlineEditChange'> {
6
+ areSelectionCheckboxesDisabled?: boolean;
5
7
  columns: Column[];
8
+ hasNextPage?: boolean;
6
9
  iconColumnVariant?: IconColumnVariant;
7
- isSelectAllEnabled?: boolean;
8
- areSelectionCheckboxesDisabled?: boolean;
9
10
  isInfiniteScrollEnabled?: boolean;
10
- hasNextPage?: boolean;
11
+ isSelectAllEnabled?: boolean;
11
12
  onGetNextPage?: () => void;
13
+ onTableRowClick?: (item: Item) => void;
12
14
  placeholderRowsCount?: number;
13
15
  zoomLevel?: number;
14
16
  }
15
- export declare const MetadataTable: ({ columns, isLoading, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps, isInfiniteScrollEnabled, areSelectionCheckboxesDisabled, hasNextPage, onInlineEditChange, onGetNextPage, placeholderRowsCount, zoomLevel, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
17
+ export declare const MetadataTable: ({ areSelectionCheckboxesDisabled, columns, hasNextPage, iconColumnVariant, isInfiniteScrollEnabled, isLoading, isSelectAllEnabled, itemActionMenuProps, items, onGetNextPage, onInlineEditChange, onTableRowClick, placeholderRowsCount, zoomLevel, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,8 +5,8 @@ import { IconColumnVariant, Column } from '../../../types';
5
5
  import { MetadataTableProps } from '../metadata-table';
6
6
  import { InlineEditingCellProps } from './inline-editing-cell';
7
7
  interface TableBodyWithDataProps extends Omit<MetadataTableProps, keyof TableProps>, Pick<InlineEditingCellProps, 'onInlineEditChange'> {
8
- virtualItems?: VirtualItem[];
9
8
  columnCount?: number;
9
+ virtualItems?: VirtualItem[];
10
10
  }
11
11
  type CellProps = {
12
12
  item: Item;
@@ -14,5 +14,5 @@ type CellProps = {
14
14
  iconColumnVariant: IconColumnVariant;
15
15
  };
16
16
  export type DataCellProps = CellProps & Pick<InlineEditingCellProps, 'onInlineEditChange'>;
17
- declare const TableBodyWithData: ({ columns, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps, areSelectionCheckboxesDisabled, virtualItems, columnCount, zoomLevel, onInlineEditChange, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
17
+ declare const TableBodyWithData: ({ areSelectionCheckboxesDisabled, columnCount, columns, iconColumnVariant, isSelectAllEnabled, items, itemActionMenuProps, onInlineEditChange, onTableRowClick, virtualItems, zoomLevel, }: TableBodyWithDataProps) => import("react/jsx-runtime").JSX.Element;
18
18
  export default TableBodyWithData;
@@ -1,12 +1,13 @@
1
1
  import { Item } from '@box/types';
2
2
  import { MetadataTableProps } from '../../metadata-table';
3
3
  export interface TableRowProps {
4
- item: Item;
4
+ areSelectionCheckboxesDisabled?: MetadataTableProps['areSelectionCheckboxesDisabled'];
5
5
  columns: MetadataTableProps['columns'];
6
6
  iconColumnVariant: MetadataTableProps['iconColumnVariant'];
7
7
  isSelectAllEnabled: MetadataTableProps['isSelectAllEnabled'];
8
+ item: Item;
8
9
  itemActionMenuProps: MetadataTableProps['itemActionMenuProps'];
9
- areSelectionCheckboxesDisabled?: MetadataTableProps['areSelectionCheckboxesDisabled'];
10
10
  zoomLevel?: number;
11
+ onTableRowClick: MetadataTableProps['onTableRowClick'];
11
12
  }
12
- export declare const TableRow: ({ item, columns, iconColumnVariant, isSelectAllEnabled, itemActionMenuProps, areSelectionCheckboxesDisabled, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const TableRow: ({ areSelectionCheckboxesDisabled, columns, iconColumnVariant, isSelectAllEnabled, item, itemActionMenuProps, onTableRowClick, zoomLevel, }: TableRowProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,22 +1,24 @@
1
1
  import { VirtualItem } from '@tanstack/react-virtual';
2
2
  import { useIntl } from 'react-intl';
3
3
  import { TableProps } from '@box/blueprint-web';
4
+ import { Item } from '@box/types';
4
5
  import { IconColumnVariant, Column, MetadataProps } from '../../types';
5
6
  import { InlineEditingCellProps } from './table-body/inline-editing-cell';
6
7
  export interface TableRendererProps extends Pick<InlineEditingCellProps, 'onInlineEditChange'> {
7
- tableHeader: React.ReactNode;
8
8
  columns: Column[];
9
+ columnCount?: number;
10
+ formatMessage: ReturnType<typeof useIntl>['formatMessage'];
9
11
  iconColumnVariant?: IconColumnVariant;
12
+ isLoading?: boolean;
10
13
  isSelectAllEnabled?: boolean;
11
14
  areSelectionCheckboxesDisabled?: boolean;
12
15
  itemActionMenuProps?: MetadataProps['itemActionMenuProps'];
13
16
  items: MetadataProps['items'];
14
- isLoading?: boolean;
15
- formatMessage: ReturnType<typeof useIntl>['formatMessage'];
17
+ onTableRowClick: (item: Item) => void;
18
+ style?: React.CSSProperties;
19
+ tableHeader: React.ReactNode;
16
20
  tableProps: TableProps;
17
21
  virtualItems?: VirtualItem[];
18
- style?: React.CSSProperties;
19
- columnCount?: number;
20
22
  zoomLevel?: number;
21
23
  }
22
- export declare const TableRenderer: ({ tableHeader, columns, iconColumnVariant, isSelectAllEnabled, areSelectionCheckboxesDisabled, itemActionMenuProps, items, isLoading, formatMessage, tableProps, virtualItems, style, columnCount: passedColumnCount, zoomLevel, onInlineEditChange, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const TableRenderer: ({ columnCount: passedColumnCount, columns, formatMessage, iconColumnVariant, isLoading, isSelectAllEnabled, areSelectionCheckboxesDisabled, itemActionMenuProps, items, onInlineEditChange, onTableRowClick, style, tableHeader, tableProps, virtualItems, zoomLevel, }: TableRendererProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "1.1.0",
3
+ "version": "1.2.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.81.4",
21
+ "@box/blueprint-web": "^12.82.0",
22
22
  "@box/blueprint-web-assets": "^4.71.0",
23
- "@box/box-item-type-selector": "^0.77.0",
23
+ "@box/box-item-type-selector": "^0.77.1",
24
24
  "@box/eslint-plugin-blueprint": "1.0.5",
25
- "@box/item-icon": "^1.1.0",
26
- "@box/metadata-filter": "^1.37.0",
25
+ "@box/item-icon": "^1.1.1",
26
+ "@box/metadata-filter": "^1.37.1",
27
27
  "@box/storybook-utils": "0.14.7",
28
28
  "@box/types": "0.2.1",
29
29
  "@tanstack/react-virtual": "^3.10.8",