"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const element_1 = require("../../../../client/element");
const propHandler_1 = require("../../../../client/propHandler");
const style_1 = require("../../../../client/style");
const DEFAULT_STYLE = {
    color: 'currentColor',
    boxSizing: 'border-box',
};
class Button extends element_1.Element {
    constructor($props, $system) {
        super($props, $system);
        const { id, className, style, innerText, tabIndex, title, draggable, data = {}, } = this.$props;
        const $element = this.$system.api.document.createElement('button');
        if (id !== undefined) {
            $element.id = id;
        }
        if (className !== undefined) {
            $element.className = className;
        }
        if (innerText) {
            $element.innerText = innerText;
        }
        if (tabIndex !== undefined) {
            $element.tabIndex = tabIndex;
        }
        if (title) {
            $element.title = title;
        }
        if (data !== undefined) {
            for (const key in data) {
                const d = data[key];
                $element.dataset[key] = d;
            }
        }
        (0, style_1.applyStyle)($element, Object.assign(Object.assign({}, DEFAULT_STYLE), style));
        this.$element = $element;
        this._prop_handler = Object.assign({}, (0, propHandler_1.htmlPropHandler)(this, this.$element, DEFAULT_STYLE));
    }
    onPropChanged(prop, current) {
        this._prop_handler[prop](current);
    }
}
exports.default = Button;
//# sourceMappingURL=Component.js.map