"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DataGridPaginationContainer = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const MenuItem_1 = require("../MenuItem");
const Select_1 = require("../Select");
const Typography_1 = require("../Typography");
const classNames_1 = require("../utils/classNames");
const cva_1 = require("../utils/cva");
const constants_1 = require("./constants");
const styles_1 = require("./styles");
const useLogic_1 = require("./useLogic");
const rootCva = (0, cva_1.cva)(constants_1.paginationClassnames.root, {
    variants: {
        leadingContent: {
            true: constants_1.paginationClassnames.leadingContent,
        },
    },
});
const DataGridPaginationContainer = ({ pagination, className, formattedRange, rowsPerPageOptions = constants_1.DEFAULT_ROWS_PER_PAGE_OPTION, onSetCountPerPage, rowsPerPage = constants_1.DEFAULT_ROWS_PER_PAGE, isDisabled, }) => {
    const { handleChangeRowsPerPage } = (0, useLogic_1.useLogic)({ onSetCountPerPage });
    return ((0, jsx_runtime_1.jsxs)(styles_1.PaginationWrapper, { className: (0, classNames_1.classNames)(className, rootCva({
            leadingContent: Boolean(onSetCountPerPage || formattedRange),
        })), children: [(onSetCountPerPage || formattedRange) && ((0, jsx_runtime_1.jsxs)(styles_1.RangeWrapper, { children: [onSetCountPerPage && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Typography_1.Typography, { variant: "body1", children: "\u0421\u0442\u0440\u043E\u043A \u043D\u0430 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0435:" }), (0, jsx_runtime_1.jsx)(Select_1.Select, { size: "small", value: rowsPerPage, disabled: isDisabled, isShowClearButton: false, onChange: handleChangeRowsPerPage, children: rowsPerPageOptions.map((option) => ((0, jsx_runtime_1.jsx)(MenuItem_1.MenuItem, { value: option, children: option }, option))) })] })), formattedRange && (0, jsx_runtime_1.jsx)(styles_1.Range, { variant: "body1", children: formattedRange() })] })), pagination && pagination] }));
};
exports.DataGridPaginationContainer = DataGridPaginationContainer;
