"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var vdom_1 = require("@dojo/framework/core/vdom");
var css = require("../theme/default/card.m.css");
var theme_1 = require("../middleware/theme");
var factory = vdom_1.create({ theme: theme_1.default })
    .properties()
    .children();
exports.Card = factory(function Card(_a) {
    var children = _a.children, properties = _a.properties, theme = _a.middleware.theme;
    var themeCss = theme.classes(css);
    var _b = properties(), onAction = _b.onAction, mediaSrc = _b.mediaSrc, mediaTitle = _b.mediaTitle, square = _b.square, title = _b.title, subtitle = _b.subtitle;
    var _c = children()[0] || {}, header = _c.header, content = _c.content, actionButtons = _c.actionButtons, actionIcons = _c.actionIcons;
    return (vdom_1.tsx("div", { key: "root", classes: [theme.variant(), themeCss.root] },
        header && (vdom_1.tsx("div", { key: "header", classes: themeCss.header }, header)),
        vdom_1.tsx("div", { key: "content", classes: [themeCss.content, onAction ? themeCss.primary : null], onClick: function () { return onAction && onAction(); } },
            mediaSrc && (vdom_1.tsx("div", { title: mediaTitle, classes: [
                    themeCss.media,
                    square ? themeCss.mediaSquare : themeCss.media16by9
                ], styles: {
                    backgroundImage: "url(\"" + mediaSrc + "\")"
                } })),
            title && (vdom_1.tsx("div", { classes: themeCss.titleWrapper },
                vdom_1.tsx("h2", { classes: themeCss.title }, title),
                subtitle && vdom_1.tsx("h3", { classes: themeCss.subtitle }, subtitle))),
            content && vdom_1.tsx("div", { classes: themeCss.contentWrapper }, content)),
        (actionButtons || actionIcons) && (vdom_1.tsx("div", { key: "actions", classes: themeCss.actions },
            actionButtons && vdom_1.tsx("div", { classes: themeCss.actionButtons }, actionButtons),
            actionIcons && vdom_1.tsx("div", { classes: themeCss.actionIcons }, actionIcons)))));
});
exports.default = exports.Card;

/*# sourceMappingURL=index.js.map*/