"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const React = tslib_1.__importStar(require("react"));
const uuid_1 = require("uuid");
const utils_1 = require("../../utils/index.js");
const blocks_1 = require("../../utils/blocks.js");
const YFMWrapper_1 = tslib_1.__importDefault(require("../YFMWrapper/YFMWrapper.js"));
const ContentListItemIcon_1 = tslib_1.__importDefault(require("./ContentListItemIcon.js"));
const b = (0, utils_1.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 = (0, blocks_1.getQaAttrubutes)(qa, ['image', 'title', 'text']);
    return ((0, jsx_runtime_1.jsx)("div", { className: b({ size, theme }), "data-qa": qa, children: list?.map((item) => {
            const { icon, title, text } = item;
            return ((0, jsx_runtime_1.jsxs)("div", { className: b('item', { 'without-title': !title }), children: [(0, jsx_runtime_1.jsx)(ContentListItemIcon_1.default, { icon: icon, className: b('icon'), qa: qaAttributes.image }), (0, jsx_runtime_1.jsxs)("div", { children: [title &&
                                React.createElement(getHeadingLevel(size), { className: b('title'), 'data-qa': qaAttributes.title }, (0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { content: title, modifiers: { constructor: true } })), text && ((0, jsx_runtime_1.jsx)(YFMWrapper_1.default, { className: b('text'), content: text, modifiers: { constructor: true }, qa: qaAttributes.text }))] })] }, (0, uuid_1.v4)()));
        }) }));
};
exports.default = ContentList;
//# sourceMappingURL=ContentList.js.map
