UNPKG

@trail-ui/react

Version:
53 lines (50 loc) 1.24 kB
import { Pagination } from "./chunk-YN7ZAPCO.mjs"; import { useFocusHandler } from "./chunk-F5W73ZFA.mjs"; // src/editable-table/pagination/pagination.tsx import { jsx } from "react/jsx-runtime"; function EditableTablePagination({ totalResults, pagination, table, onPageChange, onPageSizeChange, paginationSizeOptions }) { var _a; const { resetFocus } = useFocusHandler({ cellType: "none" /* none */, columnIndex: -1, groupId: null, rowId: null, rowIndex: -1 }); return /* @__PURE__ */ jsx( Pagination, { totalCount: totalResults, size: pagination.pageSize, currentPage: pagination.pageIndex + 1, selectedCount: (_a = table.getSelectedRowModel()) == null ? void 0 : _a.rows.length, onPageChange: (page) => { table.setPageIndex(page - 1); onPageChange == null ? void 0 : onPageChange(page); resetFocus(); }, onPageSizeChange: (size) => { table.setPageSize(size); table.setPageIndex(0); onPageSizeChange == null ? void 0 : onPageSizeChange(size); resetFocus(); }, readsResults: true, sizeOptions: paginationSizeOptions } ); } export { EditableTablePagination };