import React, { forwardRef } from "react";
import { cx } from "../../utils";
import { base, CellLeft, CellRight, CellContentWrapper, CellContent } from "./Cell.styles";
import { classes } from "./Cell.tokens";
import { base as viewCSS } from "./variations/_view/base";
import { base as sizeCSS } from "./variations/_size/base";
import { CellTextbox } from "./ui/CellTextbox/CellTextbox";
export var cellRoot = function cellRoot(Root) {
    return /*#__PURE__*/ forwardRef(function(param, outerRootRef) {
        var size = param.size, view = param.view, contentLeft = param.contentLeft, contentRight = param.contentRight, _param_alignContentLeft = param.alignContentLeft, alignContentLeft = _param_alignContentLeft === void 0 ? 'center' : _param_alignContentLeft, _param_alignContentRight = param.alignContentRight, alignContentRight = _param_alignContentRight === void 0 ? 'center' : _param_alignContentRight, children = param.children, title = param.title, subtitle = param.subtitle, label = param.label, description = param.description, content = param.content, _param_stretching = param.stretching, stretching = _param_stretching === void 0 ? 'filled' : _param_stretching, className = param.className;
        var stretchingClass = classes["".concat(stretching, "Stretching")];
        // Импорт  старых свойств
        var titleText = title || description;
        var contentLeftDeprecated = contentLeft || content;
        return /*#__PURE__*/ React.createElement(Root, {
            ref: outerRootRef,
            size: size,
            view: view,
            className: cx(stretchingClass, classes.cellRoot, className)
        }, contentLeftDeprecated && /*#__PURE__*/ React.createElement(CellLeft, {
            align: alignContentLeft
        }, contentLeftDeprecated), /*#__PURE__*/ React.createElement(CellContentWrapper, null, /*#__PURE__*/ React.createElement(CellContent, {
            className: "cell-content"
        }, titleText || subtitle || label ? /*#__PURE__*/ React.createElement(CellTextbox, {
            label: label,
            title: titleText,
            subtitle: subtitle
        }) : children), contentRight && /*#__PURE__*/ React.createElement(CellRight, {
            align: alignContentRight
        }, contentRight)));
    });
};
export var cellConfig = {
    name: 'Cell',
    tag: 'div',
    layout: cellRoot,
    base: base,
    variations: {
        view: {
            css: viewCSS
        },
        size: {
            css: sizeCSS
        }
    },
    defaults: {
        view: 'default',
        size: 'm'
    }
};
