import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useUniqId } from '@gravity-ui/uikit';
import { Buttons, ContentList, Links, Title, YFMWrapper } from "../../components/index.js";
import { Col } from "../../gravity-blocks/grid/index.js";
import { block } from "../../utils/index.js";
import { getQaAttrubutes } from "../../utils/blocks.js";
import './Content.css';
const b = block('content');
function getTextSize(size) {
    switch (size) {
        case 's':
            return 's';
        case 'm':
            return 'sm';
        case 'l':
            return 'm';
        case 'xl':
            return 'l';
        default:
            return 'm';
    }
}
const Content = (props) => {
    const { title, titleId: titleIdFromProps, text, textId, additionalInfo, size = 'l', links, buttons, colSizes = { all: 12, sm: 8 }, centered, theme, className, list, qa, controlPosition, } = props;
    const qaAttributes = getQaAttrubutes(qa, ['links', 'link', 'buttons', 'button', 'list']);
    const titleProps = !title || typeof title === 'string'
        ? { text: title, textSize: getTextSize(size) }
        : title;
    const hasTitle = Boolean(title);
    const defaultTitleId = useUniqId();
    const titleId = titleIdFromProps || defaultTitleId;
    return (_jsxs(Col, { className: b({ size, centered, theme, 'control-position': controlPosition }, className), reset: true, sizes: colSizes, qa: qaAttributes.container, children: [title && (_jsx(Title, { className: b('title'), title: titleProps, colSizes: { all: 12 }, id: titleId })), text && (_jsx("div", { className: b('text', { ['without-title']: !hasTitle }), children: _jsx(YFMWrapper, { content: text, modifiers: { constructor: true, [`constructor-size-${size}`]: true }, id: textId, qa: qaAttributes.list }) })), list?.length ? (_jsx("div", { className: b('list'), children: _jsx(ContentList, { list: list, size: size, qa: qaAttributes.list, theme: theme }) })) : null, additionalInfo && (_jsx("div", { className: b('notice'), children: _jsx(YFMWrapper, { content: additionalInfo, modifiers: {
                        constructor: true,
                        'constructor-notice': true,
                        [`constructor-size-${size}`]: true,
                    } }) })), links && (_jsx(Links, { className: b('links'), size: size, links: links, titleId: titleId, qa: qaAttributes.links, linkQa: qaAttributes.link })), buttons && (_jsx(Buttons, { className: b('buttons'), size: size, buttons: buttons, titleId: titleId, qa: qaAttributes.buttons, buttonQa: qaAttributes.button }))] }));
};
export default Content;
//# sourceMappingURL=Content.js.map
