@box/metadata-view 1.54.9 → 1.54.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.
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 +14 -14
  108. package/dist/chunks/index.js +0 -105
  109. package/dist/styles/index.css +0 -1
@@ -1,20 +1,13 @@
1
- import { BoxItemTypeSelector as m } from "@box/box-item-type-selector";
2
- import { useFormikContext as r } from "formik";
3
- import { jsx as i } from "react/jsx-runtime";
4
- const d = ({
5
- id: e
6
- }) => {
7
- const {
8
- values: t,
9
- setFieldValue: o
10
- } = r(), a = t.metadata.fields[e]?.value?.enum;
11
- return /* @__PURE__ */ i(m, {
12
- onSelectionChange: (l) => {
13
- o(`metadata.fields.${e}.value.enum`, l);
14
- },
15
- selected: a || []
16
- });
17
- };
18
- export {
19
- d as MetadataFileField
1
+ import { useFormikContext as e } from "formik";
2
+ import { BoxItemTypeSelector as t } from "@box/box-item-type-selector";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ var r = ({ id: r }) => {
5
+ let { values: i, setFieldValue: a } = e(), o = i.metadata.fields[r]?.value?.enum;
6
+ return /* @__PURE__ */ n(t, {
7
+ onSelectionChange: (e) => {
8
+ a(`metadata.fields.${r}.value.enum`, e);
9
+ },
10
+ selected: o || []
11
+ });
20
12
  };
13
+ export { r as MetadataFileField };
@@ -1,48 +1,2 @@
1
- import { useFormikContext as u } from "formik";
2
- import F from "lodash/noop";
3
- import { useIntl as g } from "react-intl";
4
- import { FolderShared as p } from "@box/blueprint-web-assets/icons/Content";
5
- import { ContentField as h } from "@box/content-field";
6
- import v from "./messages.js";
7
- import { jsx as l } from "react/jsx-runtime";
8
- import '../../../../styles/metadata-location-field.css';const C = "_metadataLocationFieldTrigger_1d3ch_1", L = {
9
- metadataLocationFieldTrigger: C
10
- }, y = ({
11
- id: e,
12
- triggerSetValueCallback: r = F,
13
- renderer: i = (t) => t
14
- }) => {
15
- const {
16
- formatMessage: t
17
- } = g(), {
18
- values: d,
19
- setFieldValue: o
20
- } = u(), a = d.metadata.fields[e].value.enum?.[0], n = () => {
21
- o(`metadata.fields.${e}.value.enum`, []);
22
- }, m = () => {
23
- r((s, c, f = !1) => {
24
- o(`metadata.fields.${e}.value.enum[0]`, {
25
- folderId: s,
26
- folderName: c,
27
- isFolderShared: f
28
- });
29
- });
30
- };
31
- return i(/* @__PURE__ */ l("div", {
32
- className: L.metadataLocationFieldTrigger,
33
- children: /* @__PURE__ */ l(h, {
34
- "data-target-id": `ContentField-filter_${e}`,
35
- icon: a?.isFolderShared ? p : void 0,
36
- onClear: n,
37
- onClick: m,
38
- placeholder: t(v.selectFolderHint),
39
- title: a?.folderName ? {
40
- titleValue: a.folderName,
41
- type: "constant"
42
- } : void 0
43
- })
44
- }));
45
- };
46
- export {
47
- y as MetadataLocationField
48
- };
1
+ import { t as e } from "../../../../chunks/metadata-location-field.js";
2
+ export { e as MetadataLocationField };
@@ -1,38 +1,27 @@
1
- import { useFormikContext as u } from "formik";
2
- import { Radio as a } from "@box/blueprint-web";
3
- import { jsx as o, jsxs as n } from "react/jsx-runtime";
4
- const c = ({
5
- id: t,
6
- name: i,
7
- placeholder: l
8
- }) => {
9
- const {
10
- values: d,
11
- setFieldValue: r
12
- } = u(), m = d.metadata.fields[t]?.value?.enum?.[0] || "", s = d.metadata.fields[t]?.options || [];
13
- return /* @__PURE__ */ o(a.Legend, {
14
- header: i,
15
- children: /* @__PURE__ */ n(a.Group, {
16
- loop: !0,
17
- name: i,
18
- onValueChange: (e) => {
19
- r(`metadata.fields.${t}.value.enum[0]`, e);
20
- },
21
- value: m,
22
- children: [l && /* @__PURE__ */ o(a.Item, {
23
- "data-target-id": `RadioItem-filter_${t}_placeholder`,
24
- label: l,
25
- value: ""
26
- }, l), s.map(({
27
- key: e
28
- }) => /* @__PURE__ */ o(a.Item, {
29
- "data-target-id": `RadioItem-filter_${t}_${e}`,
30
- label: e,
31
- value: e
32
- }, e))]
33
- })
34
- });
35
- };
36
- export {
37
- c as MetadataRadioField
1
+ import { Radio as e } from "@box/blueprint-web";
2
+ import { useFormikContext as t } from "formik";
3
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
4
+ var i = ({ id: i, name: a, placeholder: o }) => {
5
+ let { values: s, setFieldValue: c } = t(), l = s.metadata.fields[i]?.value?.enum?.[0] || "", u = s.metadata.fields[i]?.options || [];
6
+ return /* @__PURE__ */ n(e.Legend, {
7
+ header: a,
8
+ children: /* @__PURE__ */ r(e.Group, {
9
+ loop: !0,
10
+ name: a,
11
+ onValueChange: (e) => {
12
+ c(`metadata.fields.${i}.value.enum[0]`, e);
13
+ },
14
+ value: l,
15
+ children: [o && /* @__PURE__ */ n(e.Item, {
16
+ "data-target-id": `RadioItem-filter_${i}_placeholder`,
17
+ label: o,
18
+ value: ""
19
+ }, o), u.map(({ key: t }) => /* @__PURE__ */ n(e.Item, {
20
+ "data-target-id": `RadioItem-filter_${i}_${t}`,
21
+ label: t,
22
+ value: t
23
+ }, t))]
24
+ })
25
+ });
38
26
  };
27
+ export { i as MetadataRadioField };
@@ -1,31 +1,20 @@
1
- import { SearchInput as m } from "@box/blueprint-web";
2
- import { useFormikContext as i } from "formik";
3
- import { useIntl as p } from "react-intl";
4
- import r from "./messages.js";
5
- import { jsx as c } from "react/jsx-runtime";
6
- const v = ({
7
- id: e,
8
- name: l,
9
- placeholder: o
10
- }) => {
11
- const {
12
- formatMessage: a
13
- } = p(), {
14
- values: n,
15
- setFieldValue: t
16
- } = i(), s = n.metadata.fields[e]?.value?.enum;
17
- return /* @__PURE__ */ c(m.Controlled, {
18
- "data-target-id": `SearchInputControlled-filter_${e}`,
19
- id: e,
20
- name: l,
21
- onChange: (u) => t(`metadata.fields.${e}.value.enum[0]`, u.target.value),
22
- onClearInput: () => t(`metadata.fields.${e}.value.enum`, []),
23
- placeholder: o,
24
- searchInputAriaLabel: a(r.searchInputAriaLabel),
25
- searchInputClearAriaLabel: a(r.searchInputClearAriaLabel),
26
- value: s?.[0] || ""
27
- });
28
- };
29
- export {
30
- v as MetadataSearchField
1
+ import e from "./messages.js";
2
+ import { SearchInput as t } from "@box/blueprint-web";
3
+ import { useIntl as n } from "react-intl";
4
+ import { useFormikContext as r } from "formik";
5
+ import { jsx as i } from "react/jsx-runtime";
6
+ var a = ({ id: a, name: o, placeholder: s }) => {
7
+ let { formatMessage: c } = n(), { values: l, setFieldValue: u } = r(), d = l.metadata.fields[a]?.value?.enum;
8
+ return /* @__PURE__ */ i(t.Controlled, {
9
+ "data-target-id": `SearchInputControlled-filter_${a}`,
10
+ id: a,
11
+ name: o,
12
+ onChange: (e) => u(`metadata.fields.${a}.value.enum[0]`, e.target.value),
13
+ onClearInput: () => u(`metadata.fields.${a}.value.enum`, []),
14
+ placeholder: s,
15
+ searchInputAriaLabel: c(e.searchInputAriaLabel),
16
+ searchInputClearAriaLabel: c(e.searchInputClearAriaLabel),
17
+ value: d?.[0] || ""
18
+ });
31
19
  };
20
+ export { a as MetadataSearchField };
@@ -1,10 +1,5 @@
1
+ import { t as e } from "../../../../chunks/pagination-controls.js";
2
+ import { MarkerBasedPagination as t } from "./marker-based-pagination.js";
3
+ import { OffsetBasedPagination as n } from "./offset-based-pagination.js";
1
4
  import { Pagination as r } from "./pagination.js";
2
- import { MarkerBasedPagination as n } from "./marker-based-pagination.js";
3
- import { OffsetBasedPagination as i } from "./offset-based-pagination.js";
4
- import { PaginationControls as g } from "./pagination-controls.js";
5
- export {
6
- n as MarkerBasedPagination,
7
- i as OffsetBasedPagination,
8
- r as Pagination,
9
- g as PaginationControls
10
- };
5
+ export { t as MarkerBasedPagination, n as OffsetBasedPagination, r as Pagination, e as PaginationControls };
@@ -1,20 +1,13 @@
1
- import { PaginationControls as i } from "./pagination-controls.js";
2
- import { jsx as a } from "react/jsx-runtime";
3
- const c = ({
4
- hasNextMarker: t,
5
- hasPrevMarker: e,
6
- onMarkerBasedPageChange: o
7
- }) => /* @__PURE__ */ a(i, {
8
- handleNextClick: () => {
9
- o(1);
10
- },
11
- handlePreviousClick: () => {
12
- o(-1);
13
- },
14
- hasNextPage: t,
15
- hasPreviousPage: e
1
+ import { t as e } from "../../../../chunks/pagination-controls.js";
2
+ import { jsx as t } from "react/jsx-runtime";
3
+ var n = ({ hasNextMarker: n, hasPrevMarker: r, onMarkerBasedPageChange: i }) => /* @__PURE__ */ t(e, {
4
+ handleNextClick: () => {
5
+ i(1);
6
+ },
7
+ handlePreviousClick: () => {
8
+ i(-1);
9
+ },
10
+ hasNextPage: n,
11
+ hasPreviousPage: r
16
12
  });
17
- export {
18
- c as MarkerBasedPagination,
19
- c as default
20
- };
13
+ export { n as MarkerBasedPagination, n as default };
@@ -1,22 +1,20 @@
1
- import { defineMessages as a } from "react-intl";
2
- const t = a({
3
- nextPageButton: {
4
- id: "groupSharedFeatures.metadataView.pagination.nextPageButton",
5
- defaultMessage: "Next"
6
- },
7
- pageEntryStatus: {
8
- id: "groupSharedFeatures.metadataView.pagination.pageEntryStatus",
9
- defaultMessage: "Showing {startEntryIndex} to {endEntryIndex} of {totalCount} entries"
10
- },
11
- paginationAriaLabel: {
12
- id: "groupSharedFeatures.metadataView.pagination.paginationLabel",
13
- defaultMessage: "Pagination navigation controls and current page information"
14
- },
15
- previousPageButton: {
16
- id: "groupSharedFeatures.metadataView.pagination.previousPageButton",
17
- defaultMessage: "Previous"
18
- }
1
+ import { defineMessages as e } from "react-intl";
2
+ var t = e({
3
+ nextPageButton: {
4
+ id: "groupSharedFeatures.metadataView.pagination.nextPageButton",
5
+ defaultMessage: "Next"
6
+ },
7
+ pageEntryStatus: {
8
+ id: "groupSharedFeatures.metadataView.pagination.pageEntryStatus",
9
+ defaultMessage: "Showing {startEntryIndex} to {endEntryIndex} of {totalCount} entries"
10
+ },
11
+ paginationAriaLabel: {
12
+ id: "groupSharedFeatures.metadataView.pagination.paginationLabel",
13
+ defaultMessage: "Pagination navigation controls and current page information"
14
+ },
15
+ previousPageButton: {
16
+ id: "groupSharedFeatures.metadataView.pagination.previousPageButton",
17
+ defaultMessage: "Previous"
18
+ }
19
19
  });
20
- export {
21
- t as default
22
- };
20
+ export { t as default };
@@ -1,32 +1,23 @@
1
- import { PaginationControls as h } from "./pagination-controls.js";
2
- import { getOffsetForPage as c } from "./utils.js";
3
- import { jsx as P } from "react/jsx-runtime";
4
- const x = ({
5
- offset: n,
6
- onOffsetChange: o,
7
- pageSize: t,
8
- totalCount: r
9
- }) => {
10
- const e = Math.ceil(r / t);
11
- if (e <= 1)
12
- return null;
13
- const a = Math.floor(n / t) + 1, s = a > 0 ? Math.min(e, a) : 1, i = s < e, l = s > 1;
14
- return /* @__PURE__ */ P(h, {
15
- handleNextClick: () => {
16
- o(c(s + 1, t, r));
17
- },
18
- handlePreviousClick: () => {
19
- o(c(s - 1, t, r));
20
- },
21
- hasNextPage: i,
22
- hasPageEntryStatus: !0,
23
- hasPreviousPage: l,
24
- offset: n,
25
- pageSize: t,
26
- totalCount: r
27
- });
28
- };
29
- export {
30
- x as OffsetBasedPagination,
31
- x as default
1
+ import { t as e } from "../../../../chunks/pagination-controls.js";
2
+ import { getOffsetForPage as t } from "./utils.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ var r = ({ offset: r, onOffsetChange: i, pageSize: a, totalCount: o }) => {
5
+ let s = Math.ceil(o / a);
6
+ if (s <= 1) return null;
7
+ let c = Math.floor(r / a) + 1, l = c > 0 ? Math.min(s, c) : 1;
8
+ return /* @__PURE__ */ n(e, {
9
+ handleNextClick: () => {
10
+ i(t(l + 1, a, o));
11
+ },
12
+ handlePreviousClick: () => {
13
+ i(t(l - 1, a, o));
14
+ },
15
+ hasNextPage: l < s,
16
+ hasPageEntryStatus: !0,
17
+ hasPreviousPage: l > 1,
18
+ offset: r,
19
+ pageSize: a,
20
+ totalCount: o
21
+ });
32
22
  };
23
+ export { r as OffsetBasedPagination, r as default };
@@ -1,53 +1,2 @@
1
- import { Button as r } from "@box/blueprint-web";
2
- import { useIntl as x, FormattedMessage as B } from "react-intl";
3
- import n from "./messages.js";
4
- import { jsxs as s, jsx as a } from "react/jsx-runtime";
5
- import '../../../../styles/pagination-controls.css';const h = "_pagination_1ozaq_1", y = "_paginationButtonContainer_1ozaq_9", i = {
6
- pagination: h,
7
- paginationButtonContainer: y
8
- }, E = ({
9
- handleNextClick: l,
10
- handlePreviousClick: c,
11
- hasNextPage: d,
12
- hasPageEntryStatus: p,
13
- hasPreviousPage: g,
14
- offset: o = 0,
15
- pageSize: m = 0,
16
- totalCount: e = 0
17
- }) => {
18
- const {
19
- formatMessage: t
20
- } = x(), u = o + 1, v = Math.min(o + m, e);
21
- return /* @__PURE__ */ s("div", {
22
- "aria-label": t(n.paginationAriaLabel),
23
- "aria-live": "polite",
24
- className: i.pagination,
25
- children: [p && /* @__PURE__ */ a("div", {
26
- className: i.paginationText,
27
- children: /* @__PURE__ */ a(B, {
28
- ...n.pageEntryStatus,
29
- values: {
30
- startEntryIndex: u,
31
- endEntryIndex: v,
32
- totalCount: e
33
- }
34
- })
35
- }), /* @__PURE__ */ s("div", {
36
- className: i.paginationButtonContainer,
37
- children: [/* @__PURE__ */ a(r, {
38
- disabled: !g,
39
- onClick: c,
40
- variant: "secondary",
41
- children: t(n.previousPageButton)
42
- }), /* @__PURE__ */ a(r, {
43
- disabled: !d,
44
- onClick: l,
45
- variant: "secondary",
46
- children: t(n.nextPageButton)
47
- })]
48
- })]
49
- });
50
- };
51
- export {
52
- E as PaginationControls
53
- };
1
+ import { t as e } from "../../../../chunks/pagination-controls.js";
2
+ export { e as PaginationControls };
@@ -1,36 +1,21 @@
1
- import { MarkerBasedPagination as g } from "./marker-based-pagination.js";
2
- import { OffsetBasedPagination as p } from "./offset-based-pagination.js";
3
- import { jsx as a } from "react/jsx-runtime";
4
- import "./pagination-controls.js";
5
- const c = ({
6
- type: e,
7
- ...r
8
- }) => {
9
- if (e === "marker") {
10
- const {
11
- hasNextMarker: s,
12
- hasPrevMarker: f,
13
- onMarkerBasedPageChange: m
14
- } = r;
15
- return /* @__PURE__ */ a(g, {
16
- hasNextMarker: s,
17
- hasPrevMarker: f,
18
- onMarkerBasedPageChange: m
19
- });
20
- }
21
- const {
22
- offset: o,
23
- onOffsetChange: t,
24
- pageSize: n,
25
- totalCount: i
26
- } = r;
27
- return /* @__PURE__ */ a(p, {
28
- offset: o,
29
- onOffsetChange: t,
30
- pageSize: n,
31
- totalCount: i
32
- });
33
- };
34
- export {
35
- c as Pagination
1
+ import { MarkerBasedPagination as e } from "./marker-based-pagination.js";
2
+ import { OffsetBasedPagination as t } from "./offset-based-pagination.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ var r = ({ type: r, ...i }) => {
5
+ if (r === "marker") {
6
+ let { hasNextMarker: t, hasPrevMarker: r, onMarkerBasedPageChange: a } = i;
7
+ return /* @__PURE__ */ n(e, {
8
+ hasNextMarker: t,
9
+ hasPrevMarker: r,
10
+ onMarkerBasedPageChange: a
11
+ });
12
+ }
13
+ let { offset: a, onOffsetChange: o, pageSize: s, totalCount: c } = i;
14
+ return /* @__PURE__ */ n(t, {
15
+ offset: a,
16
+ onOffsetChange: o,
17
+ pageSize: s,
18
+ totalCount: c
19
+ });
36
20
  };
21
+ export { r as Pagination };
@@ -1,7 +1,5 @@
1
- const n = (f, e, t) => {
2
- const r = (f - 1) * e;
3
- return r <= 0 ? 0 : r >= t ? Math.max(t - e, 0) : r;
4
- };
5
- export {
6
- n as getOffsetForPage
1
+ var e = (e, t, n) => {
2
+ let r = (e - 1) * t;
3
+ return r <= 0 ? 0 : r >= n ? Math.max(n - t, 0) : r;
7
4
  };
5
+ export { e as getOffsetForPage };
@@ -1,4 +1,2 @@
1
- import { SortDropdown as p } from "./sort-dropdown.js";
2
- export {
3
- p as SortDropdown
4
- };
1
+ import { SortDropdown as e } from "./sort-dropdown.js";
2
+ export { e as SortDropdown };
@@ -1,57 +1,38 @@
1
- import { DropdownMenu as o, TriggerButton as D } from "@box/blueprint-web";
2
- import { ArrowUp as v, ArrowDown as M } from "@box/blueprint-web-assets/icons/Fill";
3
- import { useState as m } from "react";
4
- import { jsxs as R, jsx as c } from "react/jsx-runtime";
5
- const V = ({
6
- onSortDescriptorChange: d,
7
- sortableColumns: r,
8
- sortDescriptor: t,
9
- initialSortByColumnId: l = r[0].id,
10
- initialSortDirection: p = "ascending",
11
- onSortChange: u
12
- }) => {
13
- const s = new Map(r.map((n) => [n.id, n.textValue])), [w, h] = m(l), [f, g] = m(p), e = t?.column != null ? String(t.column) : w, a = t?.direction ?? f, x = (n) => {
14
- if (n === e) {
15
- const i = a === "ascending" ? "descending" : "ascending";
16
- g(i), d({
17
- column: n,
18
- direction: i
19
- }), u({
20
- column: n,
21
- direction: i
22
- });
23
- } else
24
- h(n), g("ascending"), d({
25
- column: n,
26
- direction: "ascending"
27
- }), u({
28
- column: n,
29
- direction: "ascending"
30
- });
31
- };
32
- return /* @__PURE__ */ R(o.Root, {
33
- children: [/* @__PURE__ */ c(o.Trigger, {
34
- children: /* @__PURE__ */ c(D, {
35
- caretDirection: a === "ascending" ? "up" : "down",
36
- label: s.get(e),
37
- startIcon: a === "ascending" ? v : M,
38
- variant: "tertiary"
39
- })
40
- }), /* @__PURE__ */ c(o.Content, {
41
- children: /* @__PURE__ */ c(o.RadioGroup, {
42
- onValueChange: x,
43
- value: e,
44
- children: r.map(({
45
- id: n,
46
- textValue: i
47
- }) => /* @__PURE__ */ c(o.RadioSelectItem, {
48
- value: n,
49
- children: i
50
- }, n))
51
- })
52
- })]
53
- });
54
- };
55
- export {
56
- V as SortDropdown
1
+ import { DropdownMenu as e, TriggerButton as t } from "@box/blueprint-web";
2
+ import { useState as n } from "react";
3
+ import { ArrowDown as r, ArrowUp as i } from "@box/blueprint-web-assets/icons/Fill";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ var s = ({ onSortDescriptorChange: s, sortableColumns: c, sortDescriptor: l, initialSortByColumnId: u = c[0].id, initialSortDirection: d = "ascending", onSortChange: f }) => {
6
+ let p = new Map(c.map((e) => [e.id, e.textValue])), [m, h] = n(u), [g, _] = n(d), v = l?.column == null ? m : String(l.column), y = l?.direction ?? g;
7
+ return /* @__PURE__ */ o(e.Root, { children: [/* @__PURE__ */ a(e.Trigger, { children: /* @__PURE__ */ a(t, {
8
+ caretDirection: y === "ascending" ? "up" : "down",
9
+ label: p.get(v),
10
+ startIcon: y === "ascending" ? i : r,
11
+ variant: "tertiary"
12
+ }) }), /* @__PURE__ */ a(e.Content, { children: /* @__PURE__ */ a(e.RadioGroup, {
13
+ onValueChange: (e) => {
14
+ if (e === v) {
15
+ let t = y === "ascending" ? "descending" : "ascending";
16
+ _(t), s({
17
+ column: e,
18
+ direction: t
19
+ }), f({
20
+ column: e,
21
+ direction: t
22
+ });
23
+ } else h(e), _("ascending"), s({
24
+ column: e,
25
+ direction: "ascending"
26
+ }), f({
27
+ column: e,
28
+ direction: "ascending"
29
+ });
30
+ },
31
+ value: v,
32
+ children: c.map(({ id: t, textValue: n }) => /* @__PURE__ */ a(e.RadioSelectItem, {
33
+ value: t,
34
+ children: n
35
+ }, t))
36
+ }) })] });
57
37
  };
38
+ export { s as SortDropdown };
@@ -1,5 +1,2 @@
1
- import { Case as o, SwitchCase as r } from "./switch-case.js";
2
- export {
3
- o as Case,
4
- r as SwitchCase
5
- };
1
+ import { Case as e, SwitchCase as t } from "./switch-case.js";
2
+ export { e as Case, t as SwitchCase };
@@ -1,14 +1,6 @@
1
1
  import e from "react";
2
- const i = ({
3
- condition: r,
4
- children: n
5
- }) => r ? n : null, s = ({
6
- children: r
7
- }) => {
8
- const t = e.Children.toArray(r).find((o) => o.props.condition);
9
- return t ? t.props.children : null;
10
- };
11
- export {
12
- i as Case,
13
- s as SwitchCase
2
+ var t = ({ condition: e, children: t }) => e ? t : null, n = ({ children: t }) => {
3
+ let n = e.Children.toArray(t).find((e) => e.props.condition);
4
+ return n ? n.props.children : null;
14
5
  };
6
+ export { t as Case, n as SwitchCase };