@box/metadata-view 1.26.1 → 1.28.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 (26) hide show
  1. package/dist/chunks/index.js +41 -41
  2. package/dist/chunks/types.js +3 -3
  3. package/dist/esm/lib/components/filter-row/initial-field-values.js +12 -13
  4. package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +1 -0
  5. package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -2
  6. package/dist/esm/lib/components/filter-row/select-filter-chip.js +39 -40
  7. package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +36 -36
  8. package/dist/esm/lib/components/filter-sidepanel/filter.js +7 -4
  9. package/dist/esm/lib/components/item-action-menu/item-action-menu.js +103 -103
  10. package/dist/esm/lib/components/metadata-grid/metadata-grid.js +29 -30
  11. package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -3
  12. package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +13 -16
  13. package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +140 -144
  14. package/dist/esm/lib/components/metadata-table/table-renderer.js +35 -35
  15. package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +14 -15
  16. package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +13 -14
  17. package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -13
  18. package/dist/esm/lib/components/metadata-value/metadata-location-field.js +31 -32
  19. package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +10 -11
  20. package/dist/esm/lib/components/metadata-value/metadata-search-field.js +22 -23
  21. package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +35 -35
  22. package/dist/esm/lib/metadata-view.js +59 -59
  23. package/dist/i18n/en-x-pseudo.js +31 -31
  24. package/dist/i18n/en-x-pseudo.properties +31 -31
  25. package/dist/styles/action-bar.css +1 -1
  26. package/package.json +12 -12
@@ -1,127 +1,127 @@
1
- import T, { useMemo as j } from "react";
2
- import { useIntl as y } from "react-intl";
3
- import { IconButton as I, Tooltip as z, DropdownMenu as r, GridList as f } from "@box/blueprint-web";
4
- import { Ellipsis as W } from "@box/blueprint-web-assets/icons/Fill";
5
- import { V as h } from "../../../../chunks/types.js";
6
- import { getDataTargetId as l } from "./identifier.js";
7
- import $ from "./messages.js";
8
- import { jsxs as i, jsx as n } from "react/jsx-runtime";
9
- import '../../../../styles/item-action-menu.css';const G = "_tableActionBar_akgtp_1", V = "_actionItemIcon_akgtp_6", g = {
10
- tableActionBar: G,
11
- actionItemIcon: V
1
+ import x, { useMemo as N } from "react";
2
+ import { useIntl as j } from "react-intl";
3
+ import { IconButton as p, Tooltip as y, DropdownMenu as e, GridList as I } from "@box/blueprint-web";
4
+ import { Ellipsis as T } from "@box/blueprint-web-assets/icons/Fill";
5
+ import { V as b } from "../../../../chunks/types.js";
6
+ import { getDataTargetId as r } from "./identifier.js";
7
+ import _ from "./messages.js";
8
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
9
+ import '../../../../styles/item-action-menu.css';const z = "_tableActionBar_akgtp_1", G = "_actionItemIcon_akgtp_6", A = {
10
+ tableActionBar: z,
11
+ actionItemIcon: G
12
12
  };
13
- function A(c) {
14
- return (t) => {
15
- t.stopPropagation(), c();
13
+ function R(a) {
14
+ return (i) => {
15
+ i.stopPropagation(), a();
16
16
  };
17
17
  }
18
- function x({
19
- item: c,
20
- label: t,
21
- onClick: m,
22
- icon: o,
18
+ function L({
19
+ item: a,
20
+ label: i,
21
+ onClick: s,
22
+ icon: n,
23
23
  isDisabled: d
24
24
  }) {
25
- const p = A(() => {
26
- m(c);
27
- }), s = j(() => (d == null ? void 0 : d(c)) ?? !1, [d, c]);
28
- return /* @__PURE__ */ i(r.Item, {
29
- "data-target-id": l(r.Item, t),
30
- disabled: s,
31
- onClick: p,
32
- children: [/* @__PURE__ */ n(o, {
33
- className: g.actionItemIcon
34
- }), t]
35
- }, t);
25
+ const u = R(() => {
26
+ s(a);
27
+ }), m = N(() => d?.(a) ?? !1, [d, a]);
28
+ return /* @__PURE__ */ l(e.Item, {
29
+ "data-target-id": r(e.Item, i),
30
+ disabled: m,
31
+ onClick: u,
32
+ children: [/* @__PURE__ */ t(n, {
33
+ className: A.actionItemIcon
34
+ }), i]
35
+ }, i);
36
36
  }
37
- function O({
38
- actions: c,
39
- inlineActions: t,
40
- isDisabled: m,
41
- item: o,
37
+ function K({
38
+ actions: a,
39
+ inlineActions: i,
40
+ isDisabled: s,
41
+ item: n,
42
42
  onOpenChange: d,
43
- subMenuActions: p,
44
- subMenuTrigger: s,
45
- viewMode: b = h.LIST
43
+ subMenuActions: u,
44
+ subMenuTrigger: m,
45
+ viewMode: g = b.LIST
46
46
  }) {
47
47
  const {
48
- formatMessage: k
49
- } = y(), {
50
- label: N,
51
- icon: _
52
- } = s || {};
53
- return /* @__PURE__ */ i("div", {
54
- className: g.tableActionBar,
55
- children: [b === h.LIST && (t == null ? void 0 : t.map(({
56
- onClick: a,
57
- label: e,
58
- icon: M,
59
- isDisabled: u,
60
- getTooltipContent: B
48
+ formatMessage: B
49
+ } = j(), {
50
+ label: W,
51
+ icon: S
52
+ } = m || {};
53
+ return /* @__PURE__ */ l("div", {
54
+ className: A.tableActionBar,
55
+ children: [g === b.LIST && i?.map(({
56
+ onClick: o,
57
+ label: c,
58
+ icon: f,
59
+ isDisabled: h,
60
+ getTooltipContent: $
61
61
  }) => {
62
- const S = B == null ? void 0 : B(o), L = `${o.id}-${e}`, C = (u == null ? void 0 : u(o)) ?? !1, R = /* @__PURE__ */ n(I, {
63
- accessibleWhenDisabled: C && !!S || void 0,
64
- "aria-label": e,
65
- "data-target-id": l(I, e),
62
+ const M = $?.(n), k = `${n.id}-${c}`, C = h?.(n) ?? !1, D = /* @__PURE__ */ t(p, {
63
+ accessibleWhenDisabled: C && !!M || void 0,
64
+ "aria-label": c,
65
+ "data-target-id": r(p, c),
66
66
  disabled: C,
67
- icon: M,
68
- onClick: A(() => a(o)),
67
+ icon: f,
68
+ onClick: R(() => o(n)),
69
69
  size: "large"
70
70
  });
71
- return S ? /* @__PURE__ */ n(z, {
72
- content: S,
73
- children: R
74
- }, L) : /* @__PURE__ */ n(T.Fragment, {
75
- children: R
76
- }, L);
77
- })), c ? /* @__PURE__ */ i(r.Root, {
71
+ return M ? /* @__PURE__ */ t(y, {
72
+ content: M,
73
+ children: D
74
+ }, k) : /* @__PURE__ */ t(x.Fragment, {
75
+ children: D
76
+ }, k);
77
+ }), a ? /* @__PURE__ */ l(e.Root, {
78
78
  onOpenChange: d,
79
- children: [/* @__PURE__ */ n(r.Trigger, {
80
- children: b === h.LIST ? /* @__PURE__ */ n(I, {
81
- "aria-label": k($.actionMenu),
82
- "data-target-id": l(I, "openActionMenu"),
83
- disabled: m,
84
- icon: W,
79
+ children: [/* @__PURE__ */ t(e.Trigger, {
80
+ children: g === b.LIST ? /* @__PURE__ */ t(p, {
81
+ "aria-label": B(_.actionMenu),
82
+ "data-target-id": r(p, "openActionMenu"),
83
+ disabled: s,
84
+ icon: T,
85
85
  size: "large"
86
- }) : /* @__PURE__ */ n(f.ActionIconButton, {
87
- "aria-label": k($.actionMenu),
88
- "data-target-id": l(f.ActionIconButton, "openActionMenu"),
89
- disabled: m,
90
- icon: W
86
+ }) : /* @__PURE__ */ t(I.ActionIconButton, {
87
+ "aria-label": B(_.actionMenu),
88
+ "data-target-id": r(I.ActionIconButton, "openActionMenu"),
89
+ disabled: s,
90
+ icon: T
91
91
  })
92
- }), /* @__PURE__ */ i(r.Content, {
92
+ }), /* @__PURE__ */ l(e.Content, {
93
93
  align: "start",
94
- children: [c.map((a) => /* @__PURE__ */ n(x, {
95
- item: o,
96
- ...a
97
- }, a.label)), p && s && /* @__PURE__ */ i(r.SubMenuRoot, {
98
- children: [/* @__PURE__ */ i(r.SubMenuTrigger, {
99
- "data-target-id": l(r.SubMenuTrigger, "openActionSubmenu"),
100
- children: [_ && /* @__PURE__ */ n(_, {
101
- className: g.actionItemIcon
102
- }), N]
103
- }), /* @__PURE__ */ n(r.SubMenuContent, {
104
- children: p.map((a) => /* @__PURE__ */ n(x, {
105
- item: o,
106
- ...a
107
- }, a.label))
94
+ children: [a.map((o) => /* @__PURE__ */ t(L, {
95
+ item: n,
96
+ ...o
97
+ }, o.label)), u && m && /* @__PURE__ */ l(e.SubMenuRoot, {
98
+ children: [/* @__PURE__ */ l(e.SubMenuTrigger, {
99
+ "data-target-id": r(e.SubMenuTrigger, "openActionSubmenu"),
100
+ children: [S && /* @__PURE__ */ t(S, {
101
+ className: A.actionItemIcon
102
+ }), W]
103
+ }), /* @__PURE__ */ t(e.SubMenuContent, {
104
+ children: u.map((o) => /* @__PURE__ */ t(L, {
105
+ item: n,
106
+ ...o
107
+ }, o.label))
108
108
  })]
109
109
  })]
110
110
  })]
111
- }) : null, b === h.GRID && (t == null ? void 0 : t.map(({
112
- onClick: a,
113
- label: e,
114
- icon: M,
115
- isDisabled: u
116
- }) => /* @__PURE__ */ n(f.ActionIconButton, {
117
- "aria-label": e,
118
- "data-target-id": l(f.ActionIconButton, e),
119
- disabled: (u == null ? void 0 : u(o)) ?? !1,
120
- icon: M,
121
- onClick: () => a(o)
122
- }, `${o.id}-${e}`)))]
111
+ }) : null, g === b.GRID && i?.map(({
112
+ onClick: o,
113
+ label: c,
114
+ icon: f,
115
+ isDisabled: h
116
+ }) => /* @__PURE__ */ t(I.ActionIconButton, {
117
+ "aria-label": c,
118
+ "data-target-id": r(I.ActionIconButton, c),
119
+ disabled: h?.(n) ?? !1,
120
+ icon: f,
121
+ onClick: () => o(n)
122
+ }, `${n.id}-${c}`))]
123
123
  });
124
124
  }
125
125
  export {
126
- O as ItemActionMenu
126
+ K as ItemActionMenu
127
127
  };
@@ -1,57 +1,56 @@
1
1
  import { GridList as i } from "@box/blueprint-web";
2
- import { ItemTypeIcon as T } from "@box/item-icon";
3
- import { useIntl as b } from "react-intl";
4
- import { V as E } from "../../../../chunks/types.js";
5
- import { THUMBNAIL_GRID_VIEW_SIZES as p } from "../constants.js";
6
- import R from "./messages.js";
7
- import { jsx as t, jsxs as f } from "react/jsx-runtime";
8
- import { ItemActionMenu as L } from "../item-action-menu/item-action-menu.js";
9
- import '../../../../styles/metadata-grid.css';const M = "_itemThumbnail_93ess_1", A = {
10
- itemThumbnail: M
11
- }, G = 188, g = 250, x = 8, D = 5, S = (r) => G + g * (x - r) / D, N = ({
2
+ import { ItemTypeIcon as u } from "@box/item-icon";
3
+ import { useIntl as I } from "react-intl";
4
+ import { V as h } from "../../../../chunks/types.js";
5
+ import { THUMBNAIL_GRID_VIEW_SIZES as T } from "../constants.js";
6
+ import b from "./messages.js";
7
+ import { jsx as t, jsxs as E } from "react/jsx-runtime";
8
+ import { ItemActionMenu as p } from "../item-action-menu/item-action-menu.js";
9
+ import '../../../../styles/metadata-grid.css';const R = "_itemThumbnail_93ess_1", f = {
10
+ itemThumbnail: R
11
+ }, L = 188, M = 250, A = 8, G = 5, g = (r) => L + M * (A - r) / G, O = ({
12
12
  items: r,
13
13
  itemActionMenuProps: n,
14
- zoomLevel: c,
15
- areSelectionCheckboxesDisabled: _,
16
- ...d
14
+ zoomLevel: o,
15
+ areSelectionCheckboxesDisabled: l,
16
+ ...a
17
17
  }) => {
18
18
  const {
19
- formatMessage: u
20
- } = b();
19
+ formatMessage: c
20
+ } = I();
21
21
  return /* @__PURE__ */ t(i, {
22
- "aria-label": u(R.gridView),
22
+ "aria-label": c(b.gridView),
23
23
  items: r,
24
24
  style: {
25
- gridTemplateColumns: `repeat(auto-fit, minmax(${S(p[c])}px, 1fr))`
25
+ gridTemplateColumns: `repeat(auto-fit, minmax(${g(T[o])}px, 1fr))`
26
26
  },
27
- ...d,
27
+ ...a,
28
28
  children: (e) => {
29
- var o, l, a;
30
29
  const {
31
30
  name: m,
32
- createdAt: I
33
- } = e, s = "thumbnailURLs" in e ? ((o = e.thumbnailURLs) == null ? void 0 : o.large) || ((l = e.thumbnailURLs) == null ? void 0 : l.medium) || ((a = e.thumbnailURLs) == null ? void 0 : a.small) : void 0;
34
- return /* @__PURE__ */ f(i.Item, {
31
+ createdAt: _
32
+ } = e, s = "thumbnailURLs" in e ? e.thumbnailURLs?.large || e.thumbnailURLs?.medium || e.thumbnailURLs?.small : void 0;
33
+ return /* @__PURE__ */ E(i.Item, {
35
34
  textValue: m,
36
35
  children: [/* @__PURE__ */ t(i.Thumbnail, {
37
- className: A.itemThumbnail,
36
+ className: f.itemThumbnail,
38
37
  children: s ? /* @__PURE__ */ t("img", {
39
38
  alt: m,
40
39
  src: s
41
- }) : /* @__PURE__ */ t(T, {
40
+ }) : /* @__PURE__ */ t(u, {
42
41
  item: e
43
42
  })
44
43
  }), /* @__PURE__ */ t(i.Header, {
45
44
  children: m
46
45
  }), /* @__PURE__ */ t(i.Subtitle, {
47
- children: I
46
+ children: _
48
47
  }), /* @__PURE__ */ t(i.Actions, {
49
- isSelectionCheckboxDisabled: _,
50
- children: n ? (h) => /* @__PURE__ */ t(L, {
48
+ isSelectionCheckboxDisabled: l,
49
+ children: n ? (d) => /* @__PURE__ */ t(p, {
51
50
  ...n,
52
51
  item: e,
53
- onOpenChange: h,
54
- viewMode: E.GRID
52
+ onOpenChange: d,
53
+ viewMode: h.GRID
55
54
  }) : null
56
55
  })]
57
56
  });
@@ -59,5 +58,5 @@ import '../../../../styles/metadata-grid.css';const M = "_itemThumbnail_93ess_1"
59
58
  });
60
59
  };
61
60
  export {
62
- N as MetadataGrid
61
+ O as MetadataGrid
63
62
  };
@@ -1,6 +1,6 @@
1
- function e(n) {
2
- return !!n.HeaderActions || (n == null ? void 0 : n.selectionMode) && n.selectionMode !== "none";
1
+ function n(e) {
2
+ return !!e.HeaderActions || e?.selectionMode && e.selectionMode !== "none";
3
3
  }
4
4
  export {
5
- e as getShouldRenderActionColumn
5
+ n as getShouldRenderActionColumn
6
6
  };
@@ -1,33 +1,30 @@
1
- import { useRef as S, useMemo as h, useEffect as z } from "react";
2
- import { useVirtualizer as T } from "@tanstack/react-virtual";
3
- import { Size14 as p } from "@box/blueprint-web-assets/tokens/px-tokens";
4
- const b = parseInt(p, 10), _ = ({
1
+ import { useRef as g, useMemo as S, useEffect as h } from "react";
2
+ import { useVirtualizer as z } from "@tanstack/react-virtual";
3
+ import { Size14 as T } from "@box/blueprint-web-assets/tokens/px-tokens";
4
+ const p = parseInt(T, 10), K = ({
5
5
  items: t,
6
6
  hasNextPage: e = !1,
7
7
  isLoading: r = !1,
8
8
  parentRef: l,
9
- approximateRowHeight: a = b,
9
+ approximateRowHeight: m = p,
10
10
  onGetNextPage: o,
11
11
  placeholderRowsCount: c = 20
12
12
  }) => {
13
- const s = S(0), f = h(() => t.length + (r || e ? c : 0), [t, e, r, c]), u = T({
14
- count: f,
13
+ const s = g(0), a = S(() => t.length + (r || e ? c : 0), [t, e, r, c]), u = z({
14
+ count: a,
15
15
  getScrollElement: () => l.current,
16
- getItemKey: (I) => {
17
- var m;
18
- return ((m = t[I]) == null ? void 0 : m.id) || `table-item-${I}`;
19
- },
20
- estimateSize: () => a
16
+ getItemKey: (I) => t[I]?.id || `table-item-${I}`,
17
+ estimateSize: () => m
21
18
  }), n = u.getVirtualItems();
22
- z(() => {
19
+ h(() => {
23
20
  s.current = t.length;
24
21
  }, [t.length]), (t.length === 0 || t.length > 0 && s.current === 0) && l.current && (l.current.scrollTop = 0);
25
- const i = n[n.length - 1], g = !!i && i.index >= t.length - 1;
26
- return !r && g && e && o && o(), {
22
+ const i = n[n.length - 1], f = !!i && i.index >= t.length - 1;
23
+ return !r && f && e && o && o(), {
27
24
  totalVirtualSize: u.getTotalSize(),
28
25
  virtualItemsToDisplay: n
29
26
  };
30
27
  };
31
28
  export {
32
- _ as useInfiniteScrollTableItems
29
+ K as useInfiniteScrollTableItems
33
30
  };