import { __rest } from '../../_virtual/_tslib.js';
import React__default from 'react';
import { PaginationControl } from './styles.js';
import { IconButton } from '../IconButton/index.js';
import { getNumberOfPages } from './utils.js';
import WidePagination from './components/WidePagination.js';
import NarrowPagination from './components/NarrowPagination.js';
import { getId } from '../../utils/index.js';
import ChevronLeft from '../../icons/ChevronLeft.js';
import ChevronRight from '../../icons/ChevronRight.js';

function Pagination(_a) {
    var { rowsPerPage, totalItems, currentPage, onChangePage, variant = 'wide', alignment = 'right', paginationLimiter, narrowPaginationText } = _a, props = __rest(_a, ["rowsPerPage", "totalItems", "currentPage", "onChangePage", "variant", "alignment", "paginationLimiter", "narrowPaginationText"]);
    const appendTestId = getId(props['data-testid']);
    const appendTrackId = getId(props['data-trackid']);
    const numberOfPages = getNumberOfPages(totalItems, rowsPerPage);
    return (React__default.createElement(PaginationControl, { alignment: alignment, "data-testid": props['data-testid'], "data-trackid": props['data-trackid'], role: "navigation" },
        React__default.createElement(IconButton, { icon: React__default.createElement(ChevronLeft, null), variant: "ghost-tertiary", size: "x-small", disabled: currentPage === 1, onClick: () => onChangePage(currentPage - 1), "data-testid": appendTestId('button-previous'), "data-trackid": appendTrackId('button-previous') }),
        variant === 'wide' ? (React__default.createElement(WidePagination, { variant: "wide", rowsPerPage: rowsPerPage, onChangePage: onChangePage, currentPage: currentPage, totalItems: totalItems, paginationLimiter: paginationLimiter, "data-testid": appendTestId('wide-pagination'), "data-trackid": appendTrackId('wide-pagination') })) : (React__default.createElement(NarrowPagination, { variant: "narrow", rowsPerPage: rowsPerPage, onChangePage: onChangePage, currentPage: currentPage, totalItems: totalItems, narrowPaginationText: narrowPaginationText, "data-testid": appendTestId('narrow-pagination'), "data-trackid": appendTrackId('narrow-pagination') })),
        React__default.createElement(IconButton, { icon: React__default.createElement(ChevronRight, null), variant: "ghost-tertiary", size: "x-small", disabled: currentPage === numberOfPages, onClick: () => onChangePage(currentPage + 1), "data-testid": appendTestId('button-next'), "data-trackid": appendTrackId('button-next') })));
}

export { Pagination };
