@box/metadata-view 1.54.8 → 1.54.10

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 (109) hide show
  1. package/dist/chunks/action-bar.js +48 -0
  2. package/dist/chunks/empty-state.js +24 -0
  3. package/dist/chunks/error-state.js +23 -0
  4. package/dist/chunks/filter-row.module.js +6 -8
  5. package/dist/chunks/filter-side-panel.js +65 -0
  6. package/dist/chunks/header.js +56 -0
  7. package/dist/chunks/inline-editing-cell.js +34 -0
  8. package/dist/chunks/item-action-menu.js +86 -0
  9. package/dist/chunks/metadata-grid.js +44 -0
  10. package/dist/chunks/metadata-location-field.js +35 -0
  11. package/dist/chunks/metadata-view.js +102 -0
  12. package/dist/chunks/pagination-controls.js +40 -0
  13. package/dist/chunks/table-row.js +72 -0
  14. package/dist/chunks/types.js +6 -11
  15. package/dist/chunks/types2.js +4 -0
  16. package/dist/chunks/zoom-button.js +20 -0
  17. package/dist/esm/index.js +29 -59
  18. package/dist/esm/lib/components/action-bar/action-bar.js +2 -62
  19. package/dist/esm/lib/components/action-bar/index.js +2 -4
  20. package/dist/esm/lib/components/action-bar/messages.js +22 -24
  21. package/dist/esm/lib/components/action-bar/zoom-button.js +2 -30
  22. package/dist/esm/lib/components/constants.js +14 -6
  23. package/dist/esm/lib/components/empty-state/empty-state.js +2 -30
  24. package/dist/esm/lib/components/empty-state/index.js +2 -4
  25. package/dist/esm/lib/components/empty-state/messages.js +10 -12
  26. package/dist/esm/lib/components/error-state/error-state.js +2 -31
  27. package/dist/esm/lib/components/error-state/index.js +2 -4
  28. package/dist/esm/lib/components/error-state/messages.js +10 -12
  29. package/dist/esm/lib/components/filter-row/advanced-field-content.js +30 -52
  30. package/dist/esm/lib/components/filter-row/advanced-filter-context.js +3 -6
  31. package/dist/esm/lib/components/filter-row/all-filters-chip.js +31 -49
  32. package/dist/esm/lib/components/filter-row/filter-row.js +35 -59
  33. package/dist/esm/lib/components/filter-row/form-filter-chip.js +84 -113
  34. package/dist/esm/lib/components/filter-row/index.js +6 -12
  35. package/dist/esm/lib/components/filter-row/initial-field-values.js +31 -51
  36. package/dist/esm/lib/components/filter-row/is-blank-or-not-blank-filter.js +2 -4
  37. package/dist/esm/lib/components/filter-row/is-filter-selected.js +37 -58
  38. package/dist/esm/lib/components/filter-row/messages.js +38 -40
  39. package/dist/esm/lib/components/filter-row/metadata-filter-chip.js +74 -103
  40. package/dist/esm/lib/components/filter-row/predefinedFilters/index.js +2 -6
  41. package/dist/esm/lib/components/filter-row/predefinedFilters/predefined-filter-options-factory.js +14 -21
  42. package/dist/esm/lib/components/filter-row/predefinedFilters/use-predefined-filter.js +58 -71
  43. package/dist/esm/lib/components/filter-row/select-filter-chip.js +41 -58
  44. package/dist/esm/lib/components/filter-row/use-form-filter-chip.js +36 -40
  45. package/dist/esm/lib/components/filter-sidepanel/filter-side-panel.js +2 -82
  46. package/dist/esm/lib/components/filter-sidepanel/filter.js +95 -140
  47. package/dist/esm/lib/components/filter-sidepanel/index.js +3 -6
  48. package/dist/esm/lib/components/filter-sidepanel/messages.js +18 -20
  49. package/dist/esm/lib/components/header/header.js +2 -82
  50. package/dist/esm/lib/components/header/index.js +2 -4
  51. package/dist/esm/lib/components/header/messages.js +14 -16
  52. package/dist/esm/lib/components/index.js +26 -53
  53. package/dist/esm/lib/components/item-action-menu/identifier.js +4 -7
  54. package/dist/esm/lib/components/item-action-menu/index.js +2 -4
  55. package/dist/esm/lib/components/item-action-menu/item-action-menu.js +2 -127
  56. package/dist/esm/lib/components/item-action-menu/messages.js +5 -9
  57. package/dist/esm/lib/components/metadata-grid/index.js +2 -4
  58. package/dist/esm/lib/components/metadata-grid/messages.js +5 -9
  59. package/dist/esm/lib/components/metadata-grid/metadata-grid.js +2 -62
  60. package/dist/esm/lib/components/metadata-table/actionColumn.js +3 -5
  61. package/dist/esm/lib/components/metadata-table/hooks/useInfiniteScrollTableItems.js +24 -29
  62. package/dist/esm/lib/components/metadata-table/index.js +4 -8
  63. package/dist/esm/lib/components/metadata-table/messages.js +14 -16
  64. package/dist/esm/lib/components/metadata-table/metadata-table.js +89 -127
  65. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-body.js +10 -19
  66. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/ghost-table-row.js +8 -19
  67. package/dist/esm/lib/components/metadata-table/table-body/ghost-table-row/index.js +2 -4
  68. package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/index.js +2 -4
  69. package/dist/esm/lib/components/metadata-table/table-body/inline-editing-cell/inline-editing-cell.js +2 -56
  70. package/dist/esm/lib/components/metadata-table/table-body/table-body-with-data.js +135 -209
  71. package/dist/esm/lib/components/metadata-table/table-body/table-row/index.js +2 -4
  72. package/dist/esm/lib/components/metadata-table/table-body/table-row/table-row.js +2 -12
  73. package/dist/esm/lib/components/metadata-table/table-renderer.js +34 -55
  74. package/dist/esm/lib/components/metadata-value/index.js +6 -12
  75. package/dist/esm/lib/components/metadata-value/messages.js +15 -17
  76. package/dist/esm/lib/components/metadata-value/metadata-checkbox-field.js +24 -34
  77. package/dist/esm/lib/components/metadata-value/metadata-file-chip.js +14 -22
  78. package/dist/esm/lib/components/metadata-value/metadata-file-field.js +12 -19
  79. package/dist/esm/lib/components/metadata-value/metadata-location-field.js +2 -48
  80. package/dist/esm/lib/components/metadata-value/metadata-radio-field.js +26 -37
  81. package/dist/esm/lib/components/metadata-value/metadata-search-field.js +19 -30
  82. package/dist/esm/lib/components/pagination/index.js +4 -9
  83. package/dist/esm/lib/components/pagination/marker-based-pagination.js +12 -19
  84. package/dist/esm/lib/components/pagination/messages.js +19 -21
  85. package/dist/esm/lib/components/pagination/offset-based-pagination.js +22 -31
  86. package/dist/esm/lib/components/pagination/pagination-controls.js +2 -53
  87. package/dist/esm/lib/components/pagination/pagination.js +20 -35
  88. package/dist/esm/lib/components/pagination/utils.js +4 -6
  89. package/dist/esm/lib/components/sort-dropdown/index.js +2 -4
  90. package/dist/esm/lib/components/sort-dropdown/sort-dropdown.js +37 -56
  91. package/dist/esm/lib/components/switch-case/index.js +2 -5
  92. package/dist/esm/lib/components/switch-case/switch-case.js +4 -12
  93. package/dist/esm/lib/hooks/use-header.js +41 -37
  94. package/dist/esm/lib/index.js +28 -59
  95. package/dist/esm/lib/metadata-view.js +2 -151
  96. package/dist/styles/action-bar.css +1 -1
  97. package/dist/styles/empty-state.css +1 -1
  98. package/dist/styles/filter-row.css +1 -1
  99. package/dist/styles/header.css +1 -1
  100. package/dist/styles/inline-editing-cell.css +1 -1
  101. package/dist/styles/item-action-menu.css +1 -1
  102. package/dist/styles/metadata-grid.css +1 -1
  103. package/dist/styles/metadata-view.css +1 -1
  104. package/dist/styles/pagination-controls.css +1 -1
  105. package/dist/styles/table-row.css +1 -0
  106. package/dist/styles/zoom-button.css +1 -1
  107. package/package.json +17 -17
  108. package/dist/chunks/index.js +0 -105
  109. package/dist/styles/index.css +0 -1
@@ -0,0 +1,48 @@
1
+ import { r as e } from "./types.js";
2
+ import { FilterRow as t } from "../esm/lib/components/filter-row/filter-row.js";
3
+ import { SortDropdown as n } from "../esm/lib/components/sort-dropdown/sort-dropdown.js";
4
+ import { t as r } from "./zoom-button.js";
5
+ import i from "../esm/lib/components/action-bar/messages.js";
6
+ import { Button as a } from "@box/blueprint-web";
7
+ import { Grid as o } from "@box/blueprint-web-assets/icons/Fill";
8
+ import { useIntl as s } from "react-intl";
9
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
10
+ import '../styles/action-bar.css';var u = {
11
+ actionBar: "_actionBar_bbxsv_1",
12
+ filterRow: "_filterRow_bbxsv_8",
13
+ additionalActions: "_additionalActions_bbxsv_13",
14
+ viewModeButtonContainer: "_viewModeButtonContainer_bbxsv_24"
15
+ }, d = ({ isIconColumnEnabled: d, isViewModeButtonDisabled: f, onSortDescriptorChange: p, onViewModeClick: m, onZoomLevelChange: h, sortableColumns: g, sortDescriptor: _, sortDropdownProps: v, viewMode: y, zoomLevel: b, ...x }) => {
16
+ let { formatMessage: S } = s();
17
+ return /* @__PURE__ */ l("div", {
18
+ className: u.actionBar,
19
+ children: [/* @__PURE__ */ c("div", {
20
+ className: u.filterRow,
21
+ children: /* @__PURE__ */ c(t, { ...x })
22
+ }), /* @__PURE__ */ l("div", {
23
+ className: u.additionalActions,
24
+ children: [
25
+ v && /* @__PURE__ */ c(n, {
26
+ ...v,
27
+ onSortDescriptorChange: p,
28
+ sortableColumns: g,
29
+ sortDescriptor: _
30
+ }),
31
+ (d || y === e.GRID) && /* @__PURE__ */ c(r, {
32
+ onZoomLevelChange: h,
33
+ zoomLevel: b
34
+ }),
35
+ !f && /* @__PURE__ */ c("div", {
36
+ className: u.viewModeButtonContainer,
37
+ children: /* @__PURE__ */ c(a, {
38
+ "aria-label": y === e.GRID ? S(i.switchToListView) : S(i.switchToGridView),
39
+ endIcon: o,
40
+ onClick: m,
41
+ variant: y === e.GRID ? "primary" : "tertiary"
42
+ })
43
+ })
44
+ ]
45
+ })]
46
+ });
47
+ };
48
+ export { d as t };
@@ -0,0 +1,24 @@
1
+ import e from "../esm/lib/components/empty-state/messages.js";
2
+ import { EmptyState as t, Text as n } from "@box/blueprint-web";
3
+ import { useIntl as r } from "react-intl";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ import { OpenBook as a } from "@box/blueprint-web-assets/illustrations/Medium";
6
+ import '../styles/empty-state.css';var o = { emptyStateContainer: "_emptyStateContainer_10mhj_1" }, s = () => {
7
+ let { formatMessage: s } = r();
8
+ return /* @__PURE__ */ i("div", {
9
+ className: o.emptyStateContainer,
10
+ children: /* @__PURE__ */ i(t, {
11
+ body: /* @__PURE__ */ i(n, {
12
+ as: "p",
13
+ children: s(e.emptyStateBody)
14
+ }),
15
+ heading: /* @__PURE__ */ i(n, {
16
+ as: "h2",
17
+ variant: "titleMedium",
18
+ children: s(e.emptyStateHeading)
19
+ }),
20
+ illustration: a
21
+ })
22
+ });
23
+ };
24
+ export { s as t };
@@ -0,0 +1,23 @@
1
+ import e from "../esm/lib/components/error-state/messages.js";
2
+ import { EmptyState as t, Text as n } from "@box/blueprint-web";
3
+ import { useIntl as r } from "react-intl";
4
+ import { jsx as i } from "react/jsx-runtime";
5
+ import { Unplugged as a } from "@box/blueprint-web-assets/illustrations/Medium";
6
+ import '../styles/error-state.css';var o = { emptyStateContainer: "_emptyStateContainer_qf21p_1" }, s = ({ onRefresh: s }) => {
7
+ let { formatMessage: c } = r();
8
+ return /* @__PURE__ */ i("div", {
9
+ className: o.emptyStateContainer,
10
+ children: /* @__PURE__ */ i(t, {
11
+ body: /* @__PURE__ */ i(n, {
12
+ as: "p",
13
+ children: c(e.errorMessage)
14
+ }),
15
+ illustration: a,
16
+ children: /* @__PURE__ */ i(t.PrimaryAction, {
17
+ onClick: s,
18
+ children: c(e.refreshButton)
19
+ })
20
+ })
21
+ });
22
+ };
23
+ export { s as t };
@@ -1,9 +1,7 @@
1
- import '../styles/filter-row.css';const o = "_popoverFooter_1q01l_1", p = "_popoverContent_1q01l_9", t = "_filterChipGroup_1q01l_13", e = "_filterChipIcon_1q01l_18", r = {
2
- popoverFooter: o,
3
- popoverContent: p,
4
- filterChipGroup: t,
5
- filterChipIcon: e
6
- };
7
- export {
8
- r as s
1
+ import '../styles/filter-row.css';var e = {
2
+ popoverFooter: "_popoverFooter_1q01l_1",
3
+ popoverContent: "_popoverContent_1q01l_9",
4
+ filterChipGroup: "_filterChipGroup_1q01l_13",
5
+ filterChipIcon: "_filterChipIcon_1q01l_18"
9
6
  };
7
+ export { e as t };
@@ -0,0 +1,65 @@
1
+ import { Filter as e } from "../esm/lib/components/filter-sidepanel/filter.js";
2
+ import t from "../esm/lib/components/filter-sidepanel/messages.js";
3
+ import { Accordion as n, SidePanel as r } from "@box/blueprint-web";
4
+ import { useState as i } from "react";
5
+ import { useIntl as a } from "react-intl";
6
+ import { useFormikContext as o } from "formik";
7
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
8
+ import l from "lodash/noop";
9
+ import '../styles/filter-side-panel.css';var u = {
10
+ sidePanelContent: "_sidePanelContent_1j6pr_1",
11
+ staticPosition: "_staticPosition_1j6pr_1"
12
+ }, d = ({ containerRef: d, filterGroups: f, isOpen: p, onIsOpenChange: m = l, getInitialFormValues: h }) => {
13
+ let { formatMessage: g } = a(), { handleSubmit: _, resetForm: v, values: y } = o(), [b] = i(y), [x, S] = i(null);
14
+ return /* @__PURE__ */ s(r, {
15
+ onOpenChange: (e) => {
16
+ v({ values: b }), m(e);
17
+ },
18
+ open: p,
19
+ variant: "overlay",
20
+ children: /* @__PURE__ */ s(r.Overlay, {
21
+ container: d?.current,
22
+ children: /* @__PURE__ */ c(r.Content, {
23
+ className: u.sidePanelContent,
24
+ children: [
25
+ /* @__PURE__ */ s(r.Header, {
26
+ className: u.staticPosition,
27
+ children: g(t.filtersHeader)
28
+ }),
29
+ /* @__PURE__ */ s(r.ScrollableContainer, {
30
+ ref: S,
31
+ children: /* @__PURE__ */ s(n, {
32
+ defaultValue: f.map((e, t) => `item-${t}`),
33
+ type: "multiple",
34
+ children: f.map((t, r) => /* @__PURE__ */ s(n.Item, {
35
+ ...t.toggleable ? {} : { fixed: "true" },
36
+ title: t.title,
37
+ value: `item-${r}`,
38
+ children: t.filters.map((t) => /* @__PURE__ */ s(e, {
39
+ ...t,
40
+ parentRef: x
41
+ }, t.id))
42
+ }, `accordion-item-${t.title || "unnamed"}`))
43
+ })
44
+ }),
45
+ /* @__PURE__ */ c(r.Footer, {
46
+ className: u.staticPosition,
47
+ children: [/* @__PURE__ */ s(r.Footer.SecondaryButton, {
48
+ onClick: () => {
49
+ v({ values: h() });
50
+ },
51
+ children: g(t.clearAllButton)
52
+ }), /* @__PURE__ */ s(r.Footer.PrimaryButton, {
53
+ onClick: () => {
54
+ _(), m(!1);
55
+ },
56
+ children: g(t.showResultsButton)
57
+ })]
58
+ }),
59
+ /* @__PURE__ */ s(r.Close, { "aria-label": g(t.closeAriaLabel) })
60
+ ]
61
+ })
62
+ })
63
+ });
64
+ };
65
+ export { d as t };
@@ -0,0 +1,56 @@
1
+ import { Case as e, SwitchCase as t } from "../esm/lib/components/switch-case/switch-case.js";
2
+ import n from "../esm/lib/components/header/messages.js";
3
+ import { IconButton as r, PageHeader as i, Status as a, Text as o } from "@box/blueprint-web";
4
+ import { XMark as s } from "@box/blueprint-web-assets/icons/Fill";
5
+ import { useIntl as c } from "react-intl";
6
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
7
+ import '../styles/header.css';var d = {
8
+ viewHeader: "_viewHeader_11wvf_1",
9
+ titleBar: "_titleBar_11wvf_5",
10
+ clearSelectionButton: "_clearSelectionButton_11wvf_11"
11
+ };
12
+ function f({ title: f, itemCount: p, isItemCountVisible: m = !0, onClearSelection: h, selectionCount: g = 0, isSelectionCountVisible: _ = !0, selectedItemName: v, rightSlot: y }) {
13
+ let { formatMessage: b } = c(), x = _ && g > 0, S = m && p != null;
14
+ if (!(f || x || y)) return null;
15
+ let [C, w] = v ? [n.singleItemSelected, { name: v }] : [n.itemsSelected, { count: g }], T = b(C, {
16
+ ...w,
17
+ b: (e) => /* @__PURE__ */ l(o, {
18
+ color: "textOnLightDefault",
19
+ variant: "bodyLargeBold",
20
+ as: "span",
21
+ children: e
22
+ })
23
+ });
24
+ return /* @__PURE__ */ u(i.Root, {
25
+ variant: "inline",
26
+ sticky: !1,
27
+ className: d.viewHeader,
28
+ children: [/* @__PURE__ */ u(t, { children: [/* @__PURE__ */ u(e, {
29
+ condition: x,
30
+ children: [/* @__PURE__ */ l(i.Corner, { children: /* @__PURE__ */ l(r, {
31
+ "aria-label": b(n.clearSelectionAriaLabel),
32
+ icon: s,
33
+ onClick: h,
34
+ size: "small",
35
+ variant: "small-utility",
36
+ className: d.clearSelectionButton
37
+ }) }), /* @__PURE__ */ l(i.StartElements, { children: /* @__PURE__ */ l(o, {
38
+ as: "span",
39
+ color: "textOnLightSecondary",
40
+ variant: "bodyLarge",
41
+ children: T
42
+ }) })]
43
+ }), /* @__PURE__ */ l(e, {
44
+ condition: !!f,
45
+ children: /* @__PURE__ */ u("div", {
46
+ className: d.titleBar,
47
+ children: [f, S && /* @__PURE__ */ l(a, {
48
+ className: d.itemCount,
49
+ colorIndex: 0,
50
+ text: String(p)
51
+ })]
52
+ })
53
+ })] }), y && /* @__PURE__ */ l(i.EndElements, { children: y })]
54
+ });
55
+ }
56
+ export { f as t };
@@ -0,0 +1,34 @@
1
+ import e from "../esm/lib/components/metadata-table/messages.js";
2
+ import { Button as t, Cell as n, DropdownMenu as r } from "@box/blueprint-web";
3
+ import { CaretDown as i } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { useIntl as a } from "react-intl";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import c from "lodash/get";
7
+ import l from "lodash/isEqual";
8
+ import '../styles/inline-editing-cell.css';var u = { inlineEditingCell: "_inlineEditingCell_1iieg_1" }, d = ({ column: d, item: f, onInlineEditChange: p }) => {
9
+ let { formatMessage: m } = a(), { type: h, inlineEditingOptions: g, id: _ } = d, v = c(f, _), y = typeof v == "string" ? [v] : v || [], b = m(e.unselectedOptionLabel), x = [{
10
+ value: null,
11
+ label: b
12
+ }, ...(g ?? []).map((e) => ({
13
+ value: e,
14
+ label: e
15
+ }))], S = (e) => {
16
+ if (!p) return;
17
+ let t;
18
+ t = h === "multiSelect" ? e === null ? [] : y.includes(e) ? y.filter((t) => t !== e) : [...y, e] : e, (h === "multiSelect" ? !l(t, y) : t !== y[0]) && p(f, t, _);
19
+ }, C = (e) => e === null ? y.length === 0 : y.includes(e);
20
+ return /* @__PURE__ */ o(n, { children: /* @__PURE__ */ s(r.Root, { children: [/* @__PURE__ */ o(r.Trigger, { children: /* @__PURE__ */ o(t, {
21
+ className: u.inlineEditingCell,
22
+ endIcon: i,
23
+ variant: "secondary",
24
+ children: y.length > 0 ? y.join(", ") : b
25
+ }) }), /* @__PURE__ */ o(r.Content, {
26
+ align: "start",
27
+ children: x.map((e) => /* @__PURE__ */ o(r.CheckboxItem, {
28
+ checked: C(e.value),
29
+ onSelect: () => S(e.value),
30
+ children: e.label
31
+ }, e.value ?? b))
32
+ })] }) });
33
+ };
34
+ export { d as t };
@@ -0,0 +1,86 @@
1
+ import { r as e } from "./types.js";
2
+ import { getDataTargetId as t } from "../esm/lib/components/item-action-menu/identifier.js";
3
+ import n from "../esm/lib/components/item-action-menu/messages.js";
4
+ import { DropdownMenu as r, GridList as i, IconButton as a, Tooltip as o } from "@box/blueprint-web";
5
+ import s, { useMemo as c } from "react";
6
+ import { Ellipsis as l } from "@box/blueprint-web-assets/icons/Fill";
7
+ import { useIntl as u } from "react-intl";
8
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
9
+ import '../styles/item-action-menu.css';var p = {
10
+ tableActionBar: "_tableActionBar_akgtp_1",
11
+ actionItemIcon: "_actionItemIcon_akgtp_6"
12
+ };
13
+ function m(e) {
14
+ return (t) => {
15
+ t.stopPropagation(), e();
16
+ };
17
+ }
18
+ function h({ item: e, label: n, onClick: i, icon: a, isDisabled: o }) {
19
+ let s = m(() => {
20
+ i(e);
21
+ }), l = c(() => o?.(e) ?? !1, [o, e]);
22
+ return /* @__PURE__ */ f(r.Item, {
23
+ "data-target-id": t(r.Item, n),
24
+ disabled: l,
25
+ onClick: s,
26
+ children: [/* @__PURE__ */ d(a, { className: p.actionItemIcon }), n]
27
+ }, n);
28
+ }
29
+ function g({ actions: c, inlineActions: g, isDisabled: _, item: v, onOpenChange: y, subMenuActions: b, subMenuTrigger: x, viewMode: S = e.LIST }) {
30
+ let { formatMessage: C } = u(), { label: w, icon: T } = x || {};
31
+ return /* @__PURE__ */ f("div", {
32
+ className: p.tableActionBar,
33
+ children: [
34
+ S === e.LIST && g?.map(({ onClick: e, label: n, icon: r, isDisabled: i, getTooltipContent: c }) => {
35
+ let l = c?.(v), u = `${v.id}-${n}`, f = i?.(v) ?? !1, p = /* @__PURE__ */ d(a, {
36
+ accessibleWhenDisabled: f && !!l || void 0,
37
+ "aria-label": n,
38
+ "data-target-id": t(a, n),
39
+ disabled: f,
40
+ icon: r,
41
+ onClick: m(() => e(v)),
42
+ size: "large"
43
+ });
44
+ return l ? /* @__PURE__ */ d(o, {
45
+ content: l,
46
+ children: p
47
+ }, u) : /* @__PURE__ */ d(s.Fragment, { children: p }, u);
48
+ }),
49
+ c ? /* @__PURE__ */ f(r.Root, {
50
+ onOpenChange: y,
51
+ children: [/* @__PURE__ */ d(r.Trigger, { children: S === e.LIST ? /* @__PURE__ */ d(a, {
52
+ "aria-label": C(n.actionMenu),
53
+ "data-target-id": t(a, "openActionMenu"),
54
+ disabled: _,
55
+ icon: l,
56
+ size: "large"
57
+ }) : /* @__PURE__ */ d(i.ActionIconButton, {
58
+ "aria-label": C(n.actionMenu),
59
+ "data-target-id": t(i.ActionIconButton, "openActionMenu"),
60
+ disabled: _,
61
+ icon: l
62
+ }) }), /* @__PURE__ */ f(r.Content, {
63
+ align: "start",
64
+ children: [c.map((e) => /* @__PURE__ */ d(h, {
65
+ item: v,
66
+ ...e
67
+ }, e.label)), b && x && /* @__PURE__ */ f(r.SubMenuRoot, { children: [/* @__PURE__ */ f(r.SubMenuTrigger, {
68
+ "data-target-id": t(r.SubMenuTrigger, "openActionSubmenu"),
69
+ children: [T && /* @__PURE__ */ d(T, { className: p.actionItemIcon }), w]
70
+ }), /* @__PURE__ */ d(r.SubMenuContent, { children: b.map((e) => /* @__PURE__ */ d(h, {
71
+ item: v,
72
+ ...e
73
+ }, e.label)) })] })]
74
+ })]
75
+ }) : null,
76
+ S === e.GRID && g?.map(({ onClick: e, label: n, icon: r, isDisabled: a }) => /* @__PURE__ */ d(i.ActionIconButton, {
77
+ "aria-label": n,
78
+ "data-target-id": t(i.ActionIconButton, n),
79
+ disabled: a?.(v) ?? !1,
80
+ icon: r,
81
+ onClick: () => e(v)
82
+ }, `${v.id}-${n}`))
83
+ ]
84
+ });
85
+ }
86
+ export { g as t };
@@ -0,0 +1,44 @@
1
+ import { r as e } from "./types.js";
2
+ import { t } from "./item-action-menu.js";
3
+ import { THUMBNAIL_GRID_VIEW_SIZES as n } from "../esm/lib/components/constants.js";
4
+ import r from "../esm/lib/components/metadata-grid/messages.js";
5
+ import { GridList as i } from "@box/blueprint-web";
6
+ import { useIntl as a } from "react-intl";
7
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
+ import { ItemTypeIcon as c } from "@box/item-icon";
9
+ import '../styles/metadata-grid.css';var l = { itemThumbnail: "_itemThumbnail_93ess_1" }, u = 188, d = 250, f = 8, p = 5, m = (e) => u + d * (f - e) / p, h = ({ items: u, itemActionMenuProps: d, zoomLevel: f, areSelectionCheckboxesDisabled: p, ...h }) => {
10
+ let { formatMessage: g } = a();
11
+ return /* @__PURE__ */ o(i, {
12
+ "aria-label": g(r.gridView),
13
+ items: u,
14
+ style: { gridTemplateColumns: `repeat(auto-fit, minmax(${m(n[f])}px, 1fr))` },
15
+ ...h,
16
+ children: (n) => {
17
+ let { name: r, createdAt: a } = n, u = "thumbnailURLs" in n ? n.thumbnailURLs?.large || n.thumbnailURLs?.medium || n.thumbnailURLs?.small : void 0;
18
+ return /* @__PURE__ */ s(i.Item, {
19
+ textValue: r,
20
+ children: [
21
+ /* @__PURE__ */ o(i.Thumbnail, {
22
+ className: l.itemThumbnail,
23
+ children: u ? /* @__PURE__ */ o("img", {
24
+ alt: r,
25
+ src: u
26
+ }) : /* @__PURE__ */ o(c, { item: n })
27
+ }),
28
+ /* @__PURE__ */ o(i.Header, { children: r }),
29
+ /* @__PURE__ */ o(i.Subtitle, { children: a }),
30
+ /* @__PURE__ */ o(i.Actions, {
31
+ isSelectionCheckboxDisabled: p,
32
+ children: d ? (r) => /* @__PURE__ */ o(t, {
33
+ ...d,
34
+ item: n,
35
+ onOpenChange: r,
36
+ viewMode: e.GRID
37
+ }) : null
38
+ })
39
+ ]
40
+ });
41
+ }
42
+ });
43
+ };
44
+ export { h as t };
@@ -0,0 +1,35 @@
1
+ import e from "../esm/lib/components/metadata-value/messages.js";
2
+ import { useIntl as t } from "react-intl";
3
+ import { useFormikContext as n } from "formik";
4
+ import { jsx as r } from "react/jsx-runtime";
5
+ import i from "lodash/noop";
6
+ import { FolderShared as a } from "@box/blueprint-web-assets/icons/Content";
7
+ import { ContentField as o } from "@box/content-field";
8
+ import '../styles/metadata-location-field.css';var s = { metadataLocationFieldTrigger: "_metadataLocationFieldTrigger_1d3ch_1" }, c = ({ id: c, triggerSetValueCallback: l = i, renderer: u = (e) => e }) => {
9
+ let { formatMessage: d } = t(), { values: f, setFieldValue: p } = n(), m = f.metadata.fields[c].value.enum?.[0];
10
+ return u(/* @__PURE__ */ r("div", {
11
+ className: s.metadataLocationFieldTrigger,
12
+ children: /* @__PURE__ */ r(o, {
13
+ "data-target-id": `ContentField-filter_${c}`,
14
+ icon: m?.isFolderShared ? a : void 0,
15
+ onClear: () => {
16
+ p(`metadata.fields.${c}.value.enum`, []);
17
+ },
18
+ onClick: () => {
19
+ l((e, t, n = !1) => {
20
+ p(`metadata.fields.${c}.value.enum[0]`, {
21
+ folderId: e,
22
+ folderName: t,
23
+ isFolderShared: n
24
+ });
25
+ });
26
+ },
27
+ placeholder: d(e.selectFolderHint),
28
+ title: m?.folderName ? {
29
+ titleValue: m.folderName,
30
+ type: "constant"
31
+ } : void 0
32
+ })
33
+ }));
34
+ };
35
+ export { c as t };
@@ -0,0 +1,102 @@
1
+ import { r as e, t } from "./types.js";
2
+ import { t as n } from "./action-bar.js";
3
+ import { t as r } from "./metadata-grid.js";
4
+ import { MetadataTable as i } from "../esm/lib/components/metadata-table/metadata-table.js";
5
+ import { Pagination as a } from "../esm/lib/components/pagination/pagination.js";
6
+ import { Case as o, SwitchCase as s } from "../esm/lib/components/switch-case/switch-case.js";
7
+ import { t as c } from "./header.js";
8
+ import { t as l } from "./empty-state.js";
9
+ import { t as u } from "./error-state.js";
10
+ import { useHeader as d } from "../esm/lib/hooks/use-header.js";
11
+ import { TooltipProvider as f } from "@box/blueprint-web";
12
+ import { useCallback as p, useRef as m, useState as h } from "react";
13
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
14
+ import '../styles/metadata-view.css';var y = {
15
+ container: "_container_1o9go_5",
16
+ contentContainer: "_contentContainer_1o9go_15"
17
+ };
18
+ function b({ actionBarProps: b, columns: x, tableProps: S, hasError: C, headerProps: w, onRefresh: T, onSelectionChange: E, onViewModeChange: D, selectedKeys: O, initialViewMode: k = e.LIST, paginationProps: A, isLoading: j, isSelectAllEnabled: M = !0, isSelectionEnabled: N, areSelectionCheckboxesDisabled: P, ...F }) {
19
+ let [I, L] = h(k), [R, z] = h(void 0), [B, V] = h(0), H = m(null), { headerSelectionProps: U, handleSelectionChange: W, selectionResetKey: G } = d({
20
+ headerProps: w,
21
+ items: F.items,
22
+ selectedKeys: O,
23
+ isSelectionEnabled: N,
24
+ onSelectionChange: E
25
+ }), K = () => {
26
+ L((t) => {
27
+ let n = t === e.LIST ? e.GRID : e.LIST;
28
+ return D?.(n), n;
29
+ });
30
+ }, q = !j && F.items.length === 0, J = b && b.sortDropdownProps && x.filter((e) => e.type !== "multiSelect" && e.type !== "enum" && e.allowsSorting === !0), { iconColumnVariant: Y } = S || {}, X = Y && Y === t.COLUMN, Z = S?.onSortChange, Q = p(({ column: e, direction: t }) => {
31
+ z({
32
+ column: e,
33
+ direction: t
34
+ }), Z?.({
35
+ column: e,
36
+ direction: t
37
+ });
38
+ }, [Z]), $ = {
39
+ ...S,
40
+ sortDescriptor: R,
41
+ onSortChange: Q
42
+ };
43
+ return /* @__PURE__ */ _(f, { children: /* @__PURE__ */ _("div", {
44
+ ref: H,
45
+ className: y.container,
46
+ children: C ? /* @__PURE__ */ _(u, { onRefresh: T }) : /* @__PURE__ */ v(g, { children: [
47
+ w && /* @__PURE__ */ _(c, {
48
+ ...w,
49
+ ...U
50
+ }),
51
+ /* @__PURE__ */ _(n, {
52
+ ...b,
53
+ containerRef: H,
54
+ isIconColumnEnabled: X,
55
+ onSortDescriptorChange: z,
56
+ onViewModeClick: K,
57
+ onZoomLevelChange: V,
58
+ sortableColumns: J,
59
+ sortDescriptor: R,
60
+ viewMode: I,
61
+ zoomLevel: B
62
+ }),
63
+ /* @__PURE__ */ _("div", {
64
+ className: y.contentContainer,
65
+ children: /* @__PURE__ */ v(s, { children: [
66
+ /* @__PURE__ */ _(o, {
67
+ condition: q,
68
+ children: /* @__PURE__ */ _(l, {})
69
+ }),
70
+ /* @__PURE__ */ _(o, {
71
+ condition: I === e.LIST,
72
+ children: /* @__PURE__ */ _(i, {
73
+ areSelectionCheckboxesDisabled: P,
74
+ columns: x,
75
+ isLoading: j,
76
+ isSelectAllEnabled: M,
77
+ onSelectionChange: W,
78
+ selectedKeys: O,
79
+ selectionMode: N ? "multiple" : "none",
80
+ zoomLevel: B,
81
+ ...F,
82
+ ...$
83
+ }, G)
84
+ }),
85
+ /* @__PURE__ */ _(o, {
86
+ condition: I === e.GRID,
87
+ children: /* @__PURE__ */ _(r, {
88
+ areSelectionCheckboxesDisabled: P,
89
+ onSelectionChange: W,
90
+ selectedKeys: O,
91
+ selectionMode: N ? "multiple" : "none",
92
+ zoomLevel: B,
93
+ ...F
94
+ }, G)
95
+ })
96
+ ] })
97
+ }),
98
+ A && /* @__PURE__ */ _(a, { ...A })
99
+ ] })
100
+ }) });
101
+ }
102
+ export { b as t };
@@ -0,0 +1,40 @@
1
+ import e from "../esm/lib/components/pagination/messages.js";
2
+ import { Button as t } from "@box/blueprint-web";
3
+ import { FormattedMessage as n, useIntl as r } from "react-intl";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import '../styles/pagination-controls.css';var o = {
6
+ pagination: "_pagination_1ozaq_1",
7
+ paginationButtonContainer: "_paginationButtonContainer_1ozaq_9"
8
+ }, s = ({ handleNextClick: s, handlePreviousClick: c, hasNextPage: l, hasPageEntryStatus: u, hasPreviousPage: d, offset: f = 0, pageSize: p = 0, totalCount: m = 0 }) => {
9
+ let { formatMessage: h } = r(), g = f + 1, _ = Math.min(f + p, m);
10
+ return /* @__PURE__ */ a("div", {
11
+ "aria-label": h(e.paginationAriaLabel),
12
+ "aria-live": "polite",
13
+ className: o.pagination,
14
+ children: [u && /* @__PURE__ */ i("div", {
15
+ className: o.paginationText,
16
+ children: /* @__PURE__ */ i(n, {
17
+ ...e.pageEntryStatus,
18
+ values: {
19
+ startEntryIndex: g,
20
+ endEntryIndex: _,
21
+ totalCount: m
22
+ }
23
+ })
24
+ }), /* @__PURE__ */ a("div", {
25
+ className: o.paginationButtonContainer,
26
+ children: [/* @__PURE__ */ i(t, {
27
+ disabled: !d,
28
+ onClick: c,
29
+ variant: "secondary",
30
+ children: h(e.previousPageButton)
31
+ }), /* @__PURE__ */ i(t, {
32
+ disabled: !l,
33
+ onClick: s,
34
+ variant: "secondary",
35
+ children: h(e.nextPageButton)
36
+ })]
37
+ })]
38
+ });
39
+ };
40
+ export { s as t };
@@ -0,0 +1,72 @@
1
+ import { t as e } from "./types.js";
2
+ import { t } from "./item-action-menu.js";
3
+ import { THUMBNAIL_LIST_VIEW_HEIGHTS as n } from "../esm/lib/components/constants.js";
4
+ import { ActionCell as r, Cell as i, Row as a, Text as o } from "@box/blueprint-web";
5
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
6
+ import { ItemTypeIcon as l } from "@box/item-icon";
7
+ import u from "clsx";
8
+ import d from "lodash/get";
9
+ import '../styles/table-row.css';var f = {
10
+ tableHeaderActionsWrapper: "_tableHeaderActionsWrapper_1sntd_1",
11
+ tableHeaderActions: "_tableHeaderActions_1sntd_1",
12
+ tableRow: "_tableRow_1sntd_33",
13
+ isClickable: "_isClickable_1sntd_41",
14
+ selectAllCheckbox: "_selectAllCheckbox_1sntd_45",
15
+ tableNameCell: "_tableNameCell_1sntd_50",
16
+ tableNameCellTitle: "_tableNameCellTitle_1sntd_56",
17
+ hasSubtitle: "_hasSubtitle_1sntd_60",
18
+ tableNameCellText: "_tableNameCellText_1sntd_65",
19
+ tableNameCellIconInline: "_tableNameCellIconInline_1sntd_70",
20
+ iconCell: "_iconCell_1sntd_74"
21
+ }, p = ({ areSelectionCheckboxesDisabled: p, columns: m, iconColumnVariant: h, item: g, itemActionMenuProps: _, onTableRowClick: v, shouldRenderActionColumn: y, zoomLevel: b = 0 }) => /* @__PURE__ */ c(a, {
22
+ className: u(f.tableRow, { [f.isClickable]: v }),
23
+ id: g.id,
24
+ onAction: () => v?.(g),
25
+ children: [
26
+ h === e.COLUMN ? /* @__PURE__ */ s(i, {
27
+ style: { height: n[b] },
28
+ children: /* @__PURE__ */ s(l, {
29
+ className: f.iconCell,
30
+ item: g
31
+ })
32
+ }, `item-type-icon-${g.id}`) : null,
33
+ m.map((t) => {
34
+ let { cellRenderer: n, id: r, isItemMetadata: a, subtitle: p, textValue: m, type: _ } = t, v = `${m}-${g.id}`;
35
+ if (n) return /* @__PURE__ */ s(i, { children: n(g, t) }, v);
36
+ let y = d(g, a ? r.split(".")[1] : r);
37
+ if (r === "name" && (h === e.INLINE || h === e.INLINE_SUBTITLE)) return /* @__PURE__ */ s(i, { children: /* @__PURE__ */ c("div", {
38
+ className: f.tableNameCell,
39
+ children: [/* @__PURE__ */ s(l, { item: g }), /* @__PURE__ */ c("div", {
40
+ className: u(f.tableNameCellTitle, { [f.hasSubtitle]: h === e.INLINE_SUBTITLE }),
41
+ children: [/* @__PURE__ */ s(o, {
42
+ as: "span",
43
+ className: f.tableNameCellText,
44
+ children: y
45
+ }), h === e.INLINE_SUBTITLE ? /* @__PURE__ */ s(o, {
46
+ as: "span",
47
+ className: f.tableNameCellText,
48
+ color: "textOnLightSecondary",
49
+ children: p
50
+ }) : null]
51
+ })]
52
+ }) }, v);
53
+ if (_ === "multiSelect") {
54
+ let e = d(g, r);
55
+ return /* @__PURE__ */ s(i, { children: e ? e.join(" ") : "" }, v);
56
+ }
57
+ return /* @__PURE__ */ s(i, { children: /* @__PURE__ */ s(o, {
58
+ as: "span",
59
+ children: y
60
+ }) }, v);
61
+ }),
62
+ y && /* @__PURE__ */ s(r, {
63
+ isCheckboxDisabled: p,
64
+ children: (e) => _ ? /* @__PURE__ */ s(t, {
65
+ ..._,
66
+ item: g,
67
+ onOpenChange: e
68
+ }) : null
69
+ })
70
+ ]
71
+ }, g.id);
72
+ export { f as n, p as t };
@@ -1,11 +1,6 @@
1
- const L = "all";
2
- let l = /* @__PURE__ */ (function(t) {
3
- return t.INLINE = "inline", t.COLUMN = "column", t.INLINE_SUBTITLE = "inline-subtitle", t;
4
- })({}), e = /* @__PURE__ */ (function(t) {
5
- return t.GRID = "grid", t.LIST = "list", t;
6
- })({});
7
- export {
8
- l as I,
9
- L as S,
10
- e as V
11
- };
1
+ var e = "all", t = /* @__PURE__ */ function(e) {
2
+ return e.INLINE = "inline", e.COLUMN = "column", e.INLINE_SUBTITLE = "inline-subtitle", e;
3
+ }({}), n = /* @__PURE__ */ function(e) {
4
+ return e.GRID = "grid", e.LIST = "list", e;
5
+ }({});
6
+ export { e as n, n as r, t };