'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../../_virtual/_tslib.js');
var React = require('react');
var styles = require('../styles.js');
var utils = require('../utils.js');
var index = require('../../../utils/index.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

const WidePagination = (_a) => {
    var { totalItems, rowsPerPage, currentPage, onChangePage, paginationLimiter = 3 } = _a, props = _tslib.__rest(_a, ["totalItems", "rowsPerPage", "currentPage", "onChangePage", "paginationLimiter"]);
    const appendTestId = index.getId(props['data-testid']);
    const appendTrackId = index.getId(props['data-trackid']);
    const numberOfPages = utils.getNumberOfPages(totalItems, rowsPerPage);
    const pageRange = utils.getPageRangeList(currentPage, numberOfPages, paginationLimiter);
    const buttons = pageRange.map((page, index) => {
        if (page === -1) {
            return React__default['default'].createElement(styles.Ellipsis, { key: index }, "...");
        }
        return (React__default['default'].createElement(styles.PaginationButton, { key: index, "data-active": currentPage === page, onClick: () => onChangePage(page), "data-testid": appendTestId(`page-${page}`), "data-trackid": appendTrackId(`page-${page}`), role: "button" }, page));
    });
    return React__default['default'].createElement(React__default['default'].Fragment, null, buttons);
};

exports['default'] = WidePagination;
