"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 isEmpty_1 = tslib_1.__importDefault(require("lodash/isEmpty.js"));
const components_1 = require("../../components/index.js");
const ChildrenItemWrap_1 = tslib_1.__importDefault(require("../../components/editor/ChildrenItemWrap/ChildrenItemWrap.js"));
const ChildrensWrap_1 = tslib_1.__importDefault(require("../../components/editor/ChildrensWrap/ChildrensWrap.js"));
const theme_1 = require("../../gravity-blocks/context/theme/index.js");
const grid_1 = require("../../gravity-blocks/grid/index.js");
const utils_1 = require("../../utils/index.js");
const DEFAULT_SIZES = {
    all: 12,
    sm: 6,
    md: 4,
};
const b = (0, utils_1.block)('card-layout-block');
const CardLayout = ({ title, description, animated, colSizes = DEFAULT_SIZES, children, className, titleClassName, background, centered = false, }) => {
    const theme = (0, theme_1.useTheme)();
    const { border, ...backgroundImageProps } = (0, utils_1.getThemedValue)(background || {}, theme);
    return ((0, jsx_runtime_1.jsx)(components_1.AnimateBlock, { className: b(null, className), animate: animated, children: (0, jsx_runtime_1.jsxs)(grid_1.Grid, { children: [(title || description) && ((0, jsx_runtime_1.jsx)(grid_1.Row, { children: (0, jsx_runtime_1.jsx)(components_1.Title, { title: title, subtitle: description, className: b('title', { centered }, titleClassName), colJustifyContent: centered ? grid_1.GridJustifyContent.Center : grid_1.GridJustifyContent.Start }) })), (0, jsx_runtime_1.jsxs)("div", { className: b('content', {
                        'with-background': !(0, isEmpty_1.default)(background),
                    }), children: [(0, jsx_runtime_1.jsx)(components_1.BackgroundImage, { className: b('image', { border }), ...backgroundImageProps }), (0, jsx_runtime_1.jsx)(ChildrensWrap_1.default, { children: (0, jsx_runtime_1.jsx)(grid_1.Row, { children: React.Children.map(children, (child, index) => ((0, jsx_runtime_1.jsx)(grid_1.Col, { sizes: colSizes, className: b('item'), children: (0, jsx_runtime_1.jsx)(ChildrenItemWrap_1.default, { className: b('item-wrap'), index: index, children: child }) }, index))) }) })] })] }) }));
};
exports.default = CardLayout;
//# sourceMappingURL=CardLayout.js.map
