"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var focus_1 = require("@dojo/framework/core/middleware/focus");
var vdom_1 = require("@dojo/framework/core/vdom");
var util_1 = require("../common/util");
var theme_1 = require("../middleware/theme");
var css = require("../theme/default/button.m.css");
var factory = vdom_1.create({ focus: focus_1.focus, theme: theme_1.theme }).properties();
exports.Button = factory(function Button(_a) {
    var children = _a.children, id = _a.id, _b = _a.middleware, focus = _b.focus, theme = _b.theme, properties = _a.properties;
    var _c = properties(), _d = _c.aria, aria = _d === void 0 ? {} : _d, disabled = _c.disabled, widgetId = _c.widgetId, name = _c.name, pressed = _c.pressed, _e = _c.type, type = _e === void 0 ? 'button' : _e, value = _c.value, onClick = _c.onClick, onOut = _c.onOut, onOver = _c.onOver, onDown = _c.onDown, onUp = _c.onUp, onBlur = _c.onBlur, onFocus = _c.onFocus, title = _c.title;
    var themeCss = theme.classes(css);
    var idBase = widgetId || "button-" + id;
    return (vdom_1.tsx("button", tslib_1.__assign({ classes: [
            theme.variant(),
            themeCss.root,
            disabled ? themeCss.disabled : null,
            pressed ? themeCss.pressed : null
        ], title: title, disabled: disabled, id: idBase, focus: focus.shouldFocus(), name: name, type: type, value: value, onblur: function () { return onBlur && onBlur(); }, onclick: function (event) {
            event.stopPropagation();
            onClick && onClick();
        }, onfocus: function () { return onFocus && onFocus(); }, onpointerenter: function () { return onOver && onOver(); }, onpointerleave: function () { return onOut && onOut(); }, onpointerdown: function () { return onDown && onDown(); }, onpointerup: function () { return onUp && onUp(); } }, util_1.formatAriaProperties(aria), { "aria-pressed": typeof pressed === 'boolean' ? (pressed ? 'true' : 'false') : undefined }),
        vdom_1.tsx("span", { classes: themeCss.label }, children())));
});
exports.default = exports.Button;

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