"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.usePagination = void 0;
const tslib_1 = require("tslib");
const React = tslib_1.__importStar(require("react"));
const perPageOptions = [
    {
        title: '10',
        value: 10,
    },
    {
        title: '20',
        value: 20,
    },
];
const usePagination = (dataCount, wizardPerPage, setWizardPerPage) => {
    const [perPage, setPerPage] = React.useState(wizardPerPage || 10);
    const [page, setPage] = React.useState(1);
    const { onSetPage, onPerPageSelect } = React.useMemo(() => ({
        onSetPage: (evt, pageNumber) => setPage(pageNumber),
        onPerPageSelect: (evt, perPage) => {
            setPerPage(perPage);
            setWizardPerPage && setWizardPerPage(perPage);
        },
    }), [setWizardPerPage]);
    const showPagination = dataCount > 10;
    return {
        showPagination,
        perPage,
        page,
        onSetPage,
        onPerPageSelect,
        perPageOptions,
    };
};
exports.usePagination = usePagination;
//# sourceMappingURL=usePagination.js.map