import { useMemo } from 'react';
import { noop } from '../shared/utils/noop.mjs';
import { useItemsPerPage, itemsPerPageOptions } from './useItemsPerPage.mjs';
import { usePagination } from './usePagination.mjs';

const useDisplayPagination = ({ items, defaultItemsPerPage = 15, viewId })=>{
    const [itemsPerPage, handleItemsPerPageChange] = useItemsPerPage({
        viewId,
        defaultItemsPerPage
    });
    const { currentPage, setCurrentPage } = usePagination({
        itemsCount: items.length,
        itemsPerPage
    });
    const metadata = useMemo(()=>({
            total: items.length,
            cursor: 'none'
        }), [
        items.length
    ]);
    return {
        items,
        currentPage,
        setCurrentPage,
        loadNext: noop,
        metadata,
        rowsPerPage: itemsPerPage,
        rowsPerPageOptions: itemsPerPageOptions,
        onRowsPerPageChange: handleItemsPerPageChange
    };
};

export { useDisplayPagination };
//# sourceMappingURL=useDisplayPagination.mjs.map
