import { useLocalStorage } from './useLocalStorage.mjs';

const itemsPerPageOptions = [
    10,
    15,
    25,
    50,
    100
];
const DEFAULT_ITEMS_PER_PAGE = 15;
const useItemsPerPage = ({ viewId, defaultItemsPerPage = DEFAULT_ITEMS_PER_PAGE })=>{
    const [itemsPerPage, setItemsPerPage] = useLocalStorage(`${viewId}_itemsPerPage`, defaultItemsPerPage);
    const handleItemsPerPageChange = (e)=>{
        const value = parseInt(e.target.value, 10);
        if (!Number.isNaN(value)) {
            setItemsPerPage(value);
        }
    };
    return [
        itemsPerPage,
        handleItemsPerPageChange
    ];
};

export { DEFAULT_ITEMS_PER_PAGE, itemsPerPageOptions, useItemsPerPage };
//# sourceMappingURL=useItemsPerPage.mjs.map
