/**
 * @license
 * Copyright Tyler Technologies, Inc. 
 * License: Apache-2.0
 */
import { BaseComponentDelegate } from '../core/delegates/base-component-delegate';
import { BUTTON_CONSTANTS } from './button-constants';
export class ButtonComponentDelegate extends BaseComponentDelegate {
    constructor(config) {
        super(config);
    }
    _build() {
        var _a, _b, _c;
        const component = document.createElement(BUTTON_CONSTANTS.elementName);
        if ((_a = this._config.options) === null || _a === void 0 ? void 0 : _a.variant) {
            component.variant = this._config.options.variant;
        }
        if ((_b = this._config.options) === null || _b === void 0 ? void 0 : _b.type) {
            component.type = this._config.options.type;
        }
        if ((_c = this._config.options) === null || _c === void 0 ? void 0 : _c.text) {
            component.textContent = this._config.options.text;
        }
        return component;
    }
    onClick(listener) {
        this._element.addEventListener('click', listener);
    }
    onFocus(listener) {
        this._element.addEventListener('focus', evt => listener(evt));
    }
    onBlur(listener) {
        this._element.addEventListener('blur', evt => listener(evt));
    }
}
