@box/metadata-view 0.9.0 → 0.10.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.
@@ -1,95 +1,75 @@
1
- import { Text as m, ListCheckbox as x, Table as _, TableHeader as C, Column as k, TableBody as y, Row as g, Cell as b, ActionCell as w } from "@box/blueprint-web";
2
- import R from "lodash/get";
3
- import { useIntl as T } from "react-intl";
4
- import { ItemActionMenu as N } from "../item-action-menu/item-action-menu.js";
5
- import f from "./messages.js";
6
- import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
- import '../../../../styles/metadata-table.css';const W = "_tableHeaderActionsWrapper_hf6y3_1", I = "_tableHeaderActions_hf6y3_1", M = "_selectAllCheckbox_hf6y3_33", o = {
8
- tableHeaderActionsWrapper: W,
9
- tableHeaderActions: I,
10
- selectAllCheckbox: M
11
- }, q = ({
12
- columns: c,
13
- isSelectAllEnabled: n,
14
- items: A,
15
- itemActionMenuProps: i,
16
- ...H
1
+ import { Text as A, ListCheckbox as H, Table as x, TableHeader as u, Column as _ } from "@box/blueprint-web";
2
+ import { useIntl as g } from "react-intl";
3
+ import y from "./table-body/ghost-table-body.js";
4
+ import C from "./table-body/table-body-with-data.js";
5
+ import h from "./messages.js";
6
+ import { jsx as e, jsxs as T } from "react/jsx-runtime";
7
+ import '../../../../styles/metadata-table.css';const k = "_tableHeaderActionsWrapper_hf6y3_1", W = "_tableHeaderActions_hf6y3_1", w = "_selectAllCheckbox_hf6y3_33", s = {
8
+ tableHeaderActionsWrapper: k,
9
+ tableHeaderActions: W,
10
+ selectAllCheckbox: w
11
+ }, D = ({
12
+ columns: r,
13
+ isLoading: o,
14
+ isSelectAllEnabled: c,
15
+ items: m,
16
+ itemActionMenuProps: b,
17
+ ...p
17
18
  }) => {
18
19
  const {
19
- formatMessage: d
20
- } = T(), h = c.map((e) => {
20
+ formatMessage: i
21
+ } = g(), l = r.map((a) => {
21
22
  const {
22
- id: a,
23
- headerRenderer: r,
23
+ id: n,
24
+ headerRenderer: d,
24
25
  textValue: t,
25
- ...s
26
- } = e;
26
+ ...f
27
+ } = a;
27
28
  return {
28
- children: r ? r(t, e) : /* @__PURE__ */ l(m, {
29
+ children: d ? d(t, a) : /* @__PURE__ */ e(A, {
29
30
  as: "span",
30
31
  children: t
31
32
  }),
32
- isRowHeader: a === "name",
33
- id: a,
33
+ isRowHeader: n === "name",
34
+ id: n,
34
35
  textValue: t,
35
- ...s
36
+ ...f
36
37
  };
37
38
  });
38
- return n && h.push({
39
+ return c && l.push({
39
40
  id: "actions",
40
- className: o.tableHeaderActions,
41
- children: /* @__PURE__ */ l("div", {
42
- className: o.tableHeaderActionsWrapper,
43
- children: /* @__PURE__ */ l(x, {
44
- "aria-label": d(f.selectAll),
45
- className: o.selectAllCheckbox
41
+ className: s.tableHeaderActions,
42
+ children: /* @__PURE__ */ e("div", {
43
+ className: s.tableHeaderActionsWrapper,
44
+ children: /* @__PURE__ */ e(H, {
45
+ "aria-label": i(h.selectAll),
46
+ className: s.selectAllCheckbox,
47
+ isDisabled: o
46
48
  })
47
49
  }),
48
50
  isRowHeader: !1,
49
51
  hideHeader: !1,
50
52
  allowsSorting: !1
51
- }), /* @__PURE__ */ u(_, {
52
- "aria-label": d(f.listView),
53
+ }), /* @__PURE__ */ T(x, {
54
+ "aria-label": i(h.listView),
53
55
  selectionBehavior: "toggle",
54
56
  selectionMode: "multiple",
55
- ...H,
56
- children: [/* @__PURE__ */ l(C, {
57
- columns: h,
58
- children: (e) => /* @__PURE__ */ l(k, {
59
- ...e
57
+ ...p,
58
+ children: [/* @__PURE__ */ e(u, {
59
+ columns: l,
60
+ children: (a) => /* @__PURE__ */ e(_, {
61
+ ...a
60
62
  })
61
- }), /* @__PURE__ */ l(y, {
62
- items: A.map((e) => ({
63
- key: e.id,
64
- ...e
65
- })),
66
- children: (e) => /* @__PURE__ */ u(g, {
67
- id: e.id,
68
- children: [c.map((a) => {
69
- const {
70
- cellRenderer: r,
71
- id: t,
72
- textValue: s
73
- } = a, p = `${s}-${e.id}`;
74
- return r ? /* @__PURE__ */ l(b, {
75
- children: r(e, a)
76
- }, p) : /* @__PURE__ */ l(b, {
77
- children: /* @__PURE__ */ l(m, {
78
- as: "span",
79
- children: R(e, t)
80
- })
81
- }, p);
82
- }), n && /* @__PURE__ */ l(w, {
83
- children: (a) => i ? /* @__PURE__ */ l(N, {
84
- ...i,
85
- item: e,
86
- onOpenChange: a
87
- }) : null
88
- })]
89
- }, e.id)
63
+ }), o ? /* @__PURE__ */ e(y, {
64
+ columnLength: l.length
65
+ }) : /* @__PURE__ */ e(C, {
66
+ columns: r,
67
+ isSelectAllEnabled: c ?? !1,
68
+ itemActionMenuProps: b,
69
+ items: m
90
70
  })]
91
71
  });
92
72
  };
93
73
  export {
94
- q as default
74
+ D as default
95
75
  };
@@ -0,0 +1,28 @@
1
+ import { TableBody as i, Row as h, Cell as d, Ghost as m } from "@box/blueprint-web";
2
+ import { Size5 as n } from "@box/blueprint-web-assets/tokens/tokens";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ const s = 20, g = ({
5
+ columnLength: o,
6
+ rowLength: a = s
7
+ }) => /* @__PURE__ */ t(i, {
8
+ items: Array.from({
9
+ length: a
10
+ }, (e, r) => ({
11
+ key: r
12
+ })),
13
+ children: (e) => /* @__PURE__ */ t(h, {
14
+ "data-testid": "metadata-table-ghost-row",
15
+ children: Array.from({
16
+ length: o
17
+ }, (r, l) => /* @__PURE__ */ t(d, {
18
+ children: /* @__PURE__ */ t(m, {
19
+ height: n,
20
+ variant: "rectangle",
21
+ width: "100%"
22
+ })
23
+ }, l))
24
+ }, e.key)
25
+ });
26
+ export {
27
+ g as default
28
+ };
@@ -0,0 +1,42 @@
1
+ import { TableBody as h, Row as m, Cell as t, Text as p, ActionCell as f } from "@box/blueprint-web";
2
+ import x from "lodash/get";
3
+ import { ItemActionMenu as y } from "../../item-action-menu/item-action-menu.js";
4
+ import { jsx as e, jsxs as T } from "react/jsx-runtime";
5
+ const C = ({
6
+ columns: i,
7
+ isSelectAllEnabled: a,
8
+ items: c,
9
+ itemActionMenuProps: n
10
+ }) => /* @__PURE__ */ e(h, {
11
+ items: c.map((r) => ({
12
+ key: r.id,
13
+ ...r
14
+ })),
15
+ children: (r) => /* @__PURE__ */ T(m, {
16
+ id: r.id,
17
+ children: [i.map((l) => {
18
+ const {
19
+ cellRenderer: d,
20
+ id: s,
21
+ textValue: u
22
+ } = l, o = `${u}-${r.id}`;
23
+ return d ? /* @__PURE__ */ e(t, {
24
+ children: d(r, l)
25
+ }, o) : /* @__PURE__ */ e(t, {
26
+ children: /* @__PURE__ */ e(p, {
27
+ as: "span",
28
+ children: x(r, s)
29
+ })
30
+ }, o);
31
+ }), a && /* @__PURE__ */ e(f, {
32
+ children: (l) => n ? /* @__PURE__ */ e(y, {
33
+ ...n,
34
+ item: r,
35
+ onOpenChange: l
36
+ }) : null
37
+ })]
38
+ }, r.id)
39
+ });
40
+ export {
41
+ C as default
42
+ };
@@ -4,9 +4,10 @@ import { ItemActionMenuProps } from '../item-action-menu/item-action-menu';
4
4
  import { Column } from '../../types';
5
5
  export interface MetadataTableProps extends TableProps {
6
6
  columns: Column[];
7
+ isLoading?: boolean;
7
8
  isSelectAllEnabled?: boolean;
8
9
  items: Item[];
9
10
  itemActionMenuProps?: Omit<ItemActionMenuProps, 'item' | 'onOpenChange'>;
10
11
  }
11
- declare const MetadataTable: ({ columns, isSelectAllEnabled, items, itemActionMenuProps, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const MetadataTable: ({ columns, isLoading, isSelectAllEnabled, items, itemActionMenuProps, ...tableProps }: MetadataTableProps) => import("react/jsx-runtime").JSX.Element;
12
13
  export default MetadataTable;
@@ -0,0 +1,6 @@
1
+ export interface GhostTableBodyProps {
2
+ columnLength: number;
3
+ rowLength?: number;
4
+ }
5
+ declare const GhostTableBody: ({ columnLength, rowLength }: GhostTableBodyProps) => import("react/jsx-runtime").JSX.Element;
6
+ export default GhostTableBody;
@@ -0,0 +1,11 @@
1
+ import { Item } from '@box/types';
2
+ import { Column } from '../../../types';
3
+ import { ItemActionMenuProps } from '../../item-action-menu/item-action-menu';
4
+ export interface BodyProps {
5
+ columns: Column[];
6
+ isSelectAllEnabled: boolean;
7
+ items: Item[];
8
+ itemActionMenuProps?: Omit<ItemActionMenuProps, 'item' | 'onOpenChange'>;
9
+ }
10
+ declare const TableBodyWithData: ({ columns, isSelectAllEnabled, items, itemActionMenuProps }: BodyProps) => import("react/jsx-runtime").JSX.Element;
11
+ export default TableBodyWithData;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/metadata-view",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "peerDependencies": {
6
6
  "@box/blueprint-web": "^11.12.0",