import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { v4 as uuidv4 } from 'uuid';
import { block } from "../../utils/index.js";
import { getQaAttrubutes } from "../../utils/blocks.js";
import YFMWrapper from "../YFMWrapper/YFMWrapper.js";
import ItemIcon from "./ContentListItemIcon.js";
import './ContentList.css';
const b = block('content-list');
function getHeadingLevel(size) {
    switch (size) {
        case 's':
            return 'h4';
        case 'l':
        default:
            return 'h3';
    }
}
const ContentList = ({ list, size = 'l', qa, theme }) => {
    const qaAttributes = getQaAttrubutes(qa, ['image', 'title', 'text']);
    return (_jsx("div", { className: b({ size, theme }), "data-qa": qa, children: list?.map((item) => {
            const { icon, title, text } = item;
            return (_jsxs("div", { className: b('item', { 'without-title': !title }), children: [_jsx(ItemIcon, { icon: icon, className: b('icon'), qa: qaAttributes.image }), _jsxs("div", { children: [title &&
                                React.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, _jsx(YFMWrapper, { content: title, modifiers: { constructor: true } })), text && (_jsx(YFMWrapper, { className: b('text'), content: text, modifiers: { constructor: true }, qa: qaAttributes.text }))] })] }, uuidv4()));
        }) }));
};
export default ContentList;
//# sourceMappingURL=ContentList.js.map
