"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const jsx_runtime_1 = require("react/jsx-runtime");
const uikit_1 = require("@gravity-ui/uikit");
const components_1 = require("../../components/index.js");
const theme_1 = require("../../gravity-blocks/context/theme/index.js");
const utils_1 = require("../../utils/index.js");
const Content_1 = tslib_1.__importDefault(require("../Content/Content.js"));
const b = (0, utils_1.block)('background-card');
const BackgroundCard = (props) => {
    const { url, title, text, border, background, paddingBottom, backgroundColor, additionalInfo, theme: cardTheme = 'default', links, buttons, analyticsEvents, urlTitle, colSizes = { all: 12, md: 12 }, controlPosition = 'content', list, size = 's', } = props;
    const titleId = (0, uikit_1.useUniqId)();
    const theme = (0, theme_1.useTheme)();
    const hasBackgroundColor = backgroundColor || cardTheme !== 'default';
    const borderType = hasBackgroundColor ? 'none' : border;
    const areControlsInFooter = !paddingBottom && controlPosition === 'footer';
    return ((0, jsx_runtime_1.jsx)(components_1.CardBase, { className: b({ padding: paddingBottom, theme: cardTheme }), contentClassName: b('content'), url: url, border: borderType, analyticsEvents: analyticsEvents, urlTitle: urlTitle, children: (0, jsx_runtime_1.jsxs)(components_1.CardBase.Content, { children: [(0, jsx_runtime_1.jsx)(components_1.BackgroundImage, { className: b('image'), ...(0, utils_1.getThemedValue)(background, theme), style: { backgroundColor } }), (0, jsx_runtime_1.jsx)(Content_1.default, { titleId: titleId, title: title, text: text, additionalInfo: additionalInfo, size: size, theme: cardTheme, links: links, buttons: buttons, list: list, colSizes: colSizes, controlPosition: areControlsInFooter ? 'bottom' : 'default' })] }) }));
};
exports.default = BackgroundCard;
//# sourceMappingURL=BackgroundCard.js.map
