function _object_without_properties(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys, key, i;
    if (typeof Reflect !== "undefined" && Reflect.ownKeys) {
        sourceKeys = Reflect.ownKeys(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
        return target;
    }
    target = _object_without_properties_loose(source, excluded);
    if (Object.getOwnPropertySymbols) {
        sourceKeys = Object.getOwnPropertySymbols(source);
        for(i = 0; i < sourceKeys.length; i++){
            key = sourceKeys[i];
            if (excluded.indexOf(key) >= 0) continue;
            if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
            target[key] = source[key];
        }
    }
    return target;
}
function _object_without_properties_loose(source, excluded) {
    if (source == null) return {};
    var target = {}, sourceKeys = Object.getOwnPropertyNames(source), key, i;
    for(i = 0; i < sourceKeys.length; i++){
        key = sourceKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        target[key] = source[key];
    }
    return target;
}
import React from "react";
import { defaultValues } from "../../utils";
import { classes } from "../../Pagination.tokens";
import { SelectPerPageRoot, SelectPerPageTypography, SelectPerPageSelect } from "./PaginationSelectPerPage.styles";
export var PaginationSelectPerPage = function PaginationSelectPerPage(_0) {
    var perPageValue = _0.perPageValue, _0_perPageList = _0.perPageList, perPageList = _0_perPageList === void 0 ? defaultValues.perPageList : _0_perPageList, _0_textPerPage = _0.textPerPage, textPerPage = _0_textPerPage === void 0 ? defaultValues.textPerPage : _0_textPerPage, onChangeValue = _0.onChangeValue, size = _0.size, listWidth = _0.listWidth, rest = _object_without_properties(_0, [
        "perPageValue",
        "perPageList",
        "textPerPage",
        "onChangeValue",
        "size",
        "listWidth"
    ]);
    var handleSelectChange = function handleSelectChange(newValue) {
        if (newValue && !Array.isArray(newValue) && onChangeValue) {
            onChangeValue(Number(newValue));
        }
    };
    var transformedList = perPageList.map(function(num) {
        return {
            label: num.toString(),
            value: num.toString()
        };
    });
    return /*#__PURE__*/ React.createElement(SelectPerPageRoot, rest, /*#__PURE__*/ React.createElement(SelectPerPageTypography, null, textPerPage), /*#__PURE__*/ React.createElement(SelectPerPageSelect, {
        className: classes.selectWrapper,
        items: transformedList,
        value: perPageValue === null || perPageValue === void 0 ? void 0 : perPageValue.toString(),
        onChange: handleSelectChange,
        target: "button-like",
        size: size,
        listWidth: listWidth,
        flip: true,
        shift: true
    }));
};
