"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var vdom_1 = require("@dojo/framework/core/vdom");
var i18n_1 = require("@dojo/framework/core/middleware/i18n");
var theme_1 = require("../middleware/theme");
var trigger_popup_1 = require("../trigger-popup");
var button_1 = require("../button");
var buttonCss = require("../theme/default/button.m.css");
var css = require("../theme/default/popup-confirmation.m.css");
var PopupConfirmation_1 = require("./nls/PopupConfirmation");
var factory = vdom_1.create({ theme: theme_1.default, i18n: i18n_1.default })
    .properties()
    .children();
exports.default = factory(function PopupConfirmation(_a) {
    var _b = _a.middleware, theme = _b.theme, i18n = _b.i18n, properties = _a.properties, children = _a.children;
    var _c = properties(), onCancel = _c.onCancel, onConfirm = _c.onConfirm, classes = _c.classes, inheritedTheme = _c.theme, variant = _c.variant, otherProperties = tslib_1.__rest(_c, ["onCancel", "onConfirm", "classes", "theme", "variant"]);
    var _d = tslib_1.__read(children(), 1), _e = _d[0], content = _e.content, trigger = _e.trigger;
    var themedCss = theme.classes(css);
    var messages = i18n.localize(PopupConfirmation_1.default).messages;
    return (vdom_1.tsx("div", { classes: [themedCss.root, theme.variant()] },
        vdom_1.tsx(trigger_popup_1.default, tslib_1.__assign({ classes: classes, theme: inheritedTheme, variant: variant, key: "trigger-popup" }, otherProperties), {
            trigger: trigger,
            content: function (close, position) { return (vdom_1.tsx("div", { classes: [
                    themedCss.popupContainer,
                    position === 'above' ? themedCss.above : themedCss.below
                ] },
                vdom_1.tsx("div", { classes: themedCss.popup },
                    vdom_1.tsx("div", { classes: themedCss.popupContent }, content),
                    vdom_1.tsx("div", { classes: themedCss.popupControls },
                        vdom_1.tsx(button_1.default, { classes: classes, key: "cancel-button", type: "button", theme: theme.compose(buttonCss, css, 'cancel'), variant: variant, onClick: function () {
                                close();
                                onCancel && onCancel();
                            } }, messages.no),
                        vdom_1.tsx(button_1.default, { classes: classes, key: "confirm-button", type: "button", theme: theme.compose(buttonCss, css, 'confirm'), variant: variant, onClick: function () {
                                close();
                                onConfirm && onConfirm();
                            } }, messages.yes))))); }
        })));
});

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