import { __decorate } from "tslib";
import { Component, Input, Output, EventEmitter, ChangeDetectorRef, OnInit, AfterViewInit, } from '@angular/core';
var ButtonComponent = /** @class */ (function () {
    function ButtonComponent(ref) {
        var _this = this;
        this.ref = ref;
        this.pDisabled = false;
        this.initialized = false;
        this.isDisabled = false;
        this.color = undefined;
        this.iconSuffix = false;
        this.fontSet = 'material-icons';
        this.loading = false;
        this.action = new EventEmitter();
        this.onClick = function ($event) {
            if (_this.loading) {
                return;
            }
            _this.action.emit($event);
        };
    }
    Object.defineProperty(ButtonComponent.prototype, "disabled", {
        set: function (value) {
            this.pDisabled = value || false;
            if (this.initialized) {
                this.onChanges();
            }
        },
        enumerable: true,
        configurable: true
    });
    ButtonComponent.prototype.ngOnInit = function () {
    };
    ButtonComponent.prototype.ngAfterViewInit = function () {
        this.initialized = true;
        this.onChanges();
    };
    ButtonComponent.prototype.onChanges = function () {
        this.isDisabled = this.pDisabled;
        this.ref.detectChanges();
    };
    ButtonComponent.ctorParameters = function () { return [
        { type: ChangeDetectorRef }
    ]; };
    __decorate([
        Input()
    ], ButtonComponent.prototype, "color", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "title", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "icon", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "width", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "size", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "tooltip", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "iconSuffix", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "fontSet", void 0);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "disabled", null);
    __decorate([
        Input()
    ], ButtonComponent.prototype, "loading", void 0);
    __decorate([
        Output()
    ], ButtonComponent.prototype, "action", void 0);
    ButtonComponent = __decorate([
        Component({
            selector: 'sd-button',
            template: "<button *ngIf=\"title\" [ngStyle]=\"{'width':width}\" class=\"c-button\" [ngClass]=\"{'c-sm': size === 'sm', 'c-lg': size === 'lg'}\" type=\"button\" \r\n  (click)=\"onClick($event)\" [color]=\"color\" [disabled]=\"isDisabled\" matTooltipPosition=\"above\"\r\n  [matTooltip]=\"tooltip\" mat-raised-button>\r\n  <mat-icon [fontSet]=\"fontSet\">{{icon}}</mat-icon>\r\n  <span class=\"d-none d-sm-inline\">{{title}}</span>\r\n</button>\r\n<button *ngIf=\"!title\" [ngStyle]=\"{'width':width}\" class=\"c-button\" [ngClass]=\"{'c-sm': size === 'sm', 'c-lg': size === 'lg'}\" type=\"button\" \r\n  (click)=\"onClick($event)\" [color]=\"color\" [disabled]=\"isDisabled\" matTooltipPosition=\"above\"\r\n  [matTooltip]=\"tooltip\" mat-icon-button>\r\n  <mat-icon [fontSet]=\"fontSet\">{{icon}}</mat-icon>\r\n</button>",
            styles: ["button.c-button{font-size:16px;height:38px;line-height:24px;padding:6px 16px!important}button.c-button.c-sm{font-size:14px!important;line-height:20px!important;padding:6px 12px!important;height:30px;font-weight:400}button.c-button.c-sm mat-icon{height:20px!important;width:20px!important;font-size:20px!important}button.c-button.c-lg{font-size:16px!important;line-height:24px!important;padding:6px 16px!important;height:48px}button.c-button.c-lg mat-icon{height:16px!important;width:16px!important;font-size:16px!important}button.c-button:focus{outline:0}button:focus{outline:0!important}.mat-raised-button[disabled][disabled]{background-color:rgba(0,0,0,.12)!important;color:rgba(0,0,0,.26)!important}.mat-button.mat-gray,.mat-stroked-button.mat-gray{color:#eceff1}.mat-button.mat-gray:hover,.mat-stroked-button.mat-gray:hover{background-color:#495057}.mat-fab.mat-gray,.mat-flat-button.mat-gray,.mat-mini-fab.mat-gray,.mat-raised-button.mat-gray{color:#495057;background-color:#eceff1}.mat-icon-button.mat-gray{color:#eceff1}.mat-button.mat-accent,.mat-stroked-button.mat-accent{color:#2f6bff}.mat-button.mat-accent:hover,.mat-stroked-button.mat-accent:hover{background-color:#fff}.mat-fab.mat-accent,.mat-flat-button.mat-accent,.mat-mini-fab.mat-accent,.mat-raised-button.mat-accent{color:#fff;background-color:#2f6bff}.mat-icon-button.mat-accent{color:#2f6bff}.mat-button.mat-secondary,.mat-stroked-button.mat-secondary{color:#ebeef5}.mat-button.mat-secondary:hover,.mat-stroked-button.mat-secondary:hover{background-color:#2f6bff}.mat-fab.mat-secondary,.mat-flat-button.mat-secondary,.mat-mini-fab.mat-secondary,.mat-raised-button.mat-secondary{color:#2f6bff;background-color:#ebeef5}.mat-button.mat-tertiary,.mat-icon-button.mat-secondary,.mat-stroked-button.mat-tertiary{color:#ebeef5}.mat-button.mat-tertiary:hover,.mat-stroked-button.mat-tertiary:hover{background-color:#2f3136}.mat-fab.mat-tertiary,.mat-flat-button.mat-tertiary,.mat-mini-fab.mat-tertiary,.mat-raised-button.mat-tertiary{color:#2f3136;background-color:#ebeef5}.mat-icon-button.mat-tertiary{color:#ebeef5}.mat-button.mat-positive,.mat-stroked-button.mat-positive{color:#00bc3c}.mat-button.mat-positive:hover,.mat-stroked-button.mat-positive:hover{background-color:#fff}.mat-fab.mat-positive,.mat-flat-button.mat-positive,.mat-mini-fab.mat-positive,.mat-raised-button.mat-positive{color:#fff;background-color:#00bc3c}.mat-icon-button.mat-positive{color:#00bc3c}.mat-button.mat-negative,.mat-stroked-button.mat-negative{color:#fceaeb}.mat-button.mat-negative:hover,.mat-stroked-button.mat-negative:hover{background-color:#f5222d}.mat-fab.mat-negative,.mat-flat-button.mat-negative,.mat-mini-fab.mat-negative,.mat-raised-button.mat-negative{color:#f5222d;background-color:#fceaeb}.mat-icon-button.mat-negative{color:#fceaeb}"]
        })
    ], ButtonComponent);
    return ButtonComponent;
}());
export { ButtonComponent };
//# sourceMappingURL=data:application/json;base64, 