"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "PaginationSelectPerPage", {
    enumerable: true,
    get: function() {
        return PaginationSelectPerPage;
    }
});
const _react = /*#__PURE__*/ _interop_require_default(require("react"));
const _utils = require("../../utils");
const _Paginationtokens = require("../../Pagination.tokens");
const _PaginationSelectPerPagestyles = require("./PaginationSelectPerPage.styles");
function _interop_require_default(obj) {
    return obj && obj.__esModule ? obj : {
        default: obj
    };
}
const PaginationSelectPerPage = ({ perPageValue, perPageList = _utils.defaultValues.perPageList, textPerPage = _utils.defaultValues.textPerPage, onChangeValue, size, listWidth, ...rest })=>{
    const handleSelectChange = (newValue)=>{
        if (newValue && !Array.isArray(newValue) && onChangeValue) {
            onChangeValue(Number(newValue));
        }
    };
    const transformedList = perPageList.map((num)=>({
            label: num.toString(),
            value: num.toString()
        }));
    return /*#__PURE__*/ _react.default.createElement(_PaginationSelectPerPagestyles.SelectPerPageRoot, rest, /*#__PURE__*/ _react.default.createElement(_PaginationSelectPerPagestyles.SelectPerPageTypography, null, textPerPage), /*#__PURE__*/ _react.default.createElement(_PaginationSelectPerPagestyles.SelectPerPageSelect, {
        className: _Paginationtokens.classes.selectWrapper,
        items: transformedList,
        value: perPageValue?.toString(),
        onChange: handleSelectChange,
        target: "button-like",
        size: size,
        listWidth: listWidth,
        flip: true,
        shift: true
    }));
};
