import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { EVO_BUTTON_THEMES_MAP } from '../../constants/evo-button-themes-map';
import * as i0 from "@angular/core";
import * as i1 from "../../../evo-loader/evo-circular-loader.component";
import * as i2 from "../../../../directives/evo-ui-class.directive";
import * as i3 from "@angular/common";
export class EvoButtonComponent {
    constructor(elRef) {
        this.elRef = elRef;
        this.size = 'normal';
        this.color = 'success';
        this.shape = 'rounded';
        this._isOutline = false;
        this._isDisabled = false;
        this._isLoading = false;
    }
    /**
     * `theme` is a complex prop, that sets a number of inner parameters, described in `EvoButtonThemeParams`
     */
    set theme(value) {
        var _a;
        const selectedTheme = (_a = EVO_BUTTON_THEMES_MAP.get(value)) !== null && _a !== void 0 ? _a : EVO_BUTTON_THEMES_MAP.get('rounded-solid');
        this.shape = selectedTheme.shape;
        this._isOutline = selectedTheme.isOutline;
    }
    set disabled(value) {
        this._isDisabled = value;
        if (!this.isLoading) {
            this.elRef.nativeElement.disabled = value;
        }
    }
    set loading(value) {
        this._isLoading = value;
        if (!this._isDisabled) {
            this.elRef.nativeElement.disabled = value;
        }
    }
    get isLoading() {
        return this._isLoading;
    }
    get buttonClasses() {
        const classes = [];
        if (this.color) {
            classes.push(`color_${this.color}`);
        }
        if (this.shape) {
            classes.push(`shape_${this.shape}`);
        }
        if (this.size) {
            classes.push(`size_${this.size}`);
        }
        if (this._isOutline) {
            classes.push(`is-outline`);
        }
        if (this._isDisabled) {
            classes.push('is-disabled');
        }
        if (this.isLoading) {
            classes.push('is-loading');
        }
        return classes;
    }
    get buttonStyles() {
        const result = {};
        if (this.isLoading) {
            result['visibility'] = 'hidden';
        }
        return result;
    }
}
EvoButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EvoButtonComponent, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
EvoButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: EvoButtonComponent, selector: "button[evoButton], a[evoButton]", inputs: { size: "size", color: "color", theme: "theme", disabled: "disabled", loading: "loading" }, ngImport: i0, template: "<div class=\"evo-button\" [evoUiClass]=\"buttonClasses\">\n    <span class=\"evo-button__content\" [ngStyle]=\"buttonStyles\">\n        <ng-content></ng-content>\n    </span>\n    <evo-circular-loader class=\"evo-button__loader\" *ngIf=\"isLoading\"></evo-circular-loader>\n</div>\n", styles: [":host{display:inline-block;margin:0;padding:0;vertical-align:top;background:none;border:0;outline:none;--evo-button-background-color: transparent;--evo-button-background-gradient: none;--evo-button-text-color: none;--evo-button-border-color: none;--evo-button-hover-text-color: none;--evo-button-hover-shadow: none;--evo-button-overflow: hidden}.evo-button{--inner-button-primary-color: #21C68B;--inner-button-secondary-color: #FFFFFF;--inner-text-color: var(--inner-button-secondary-color);--inner-background-color: var(--inner-button-primary-color);--inner-border-color: var(--inner-button-primary-color);display:flex;justify-content:center;align-items:center;height:40px;padding:0 24px;font-size:16px;line-height:1;white-space:nowrap;text-align:center;color:var(--inner-text-color);fill:var(--inner-text-color);border:none;outline:none;cursor:pointer;-webkit-user-select:none;user-select:none;position:relative;overflow:hidden;box-sizing:border-box;z-index:auto;transition:box-shadow .3s,color .3s}.evo-button__content{position:relative;display:flex;flex-flow:row nowrap;align-items:center;overflow:var(--evo-button-overflow);z-index:3}.evo-button__loader{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;padding:4px 0;z-index:2;--evo-circular-loader-color: var(--inner-text-color)}.evo-button:before{content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;background-color:var(--inner-background-color);border:solid 1px var(--inner-border-color);border-radius:inherit;transition:background .3s,color .3s,border .3s}.evo-button:after{content:\"\";position:absolute;top:0;right:0;bottom:0;left:0;z-index:2;opacity:0;transition:opacity .3s,background-color .3s}.evo-button:hover{box-shadow:var(--evo-button-hover-shadow)}.evo-button:hover:after{opacity:.2;background-color:#fff}.evo-button:focus:after,.evo-button:active:after{opacity:.1;background-color:#000}.evo-button:disabled,.evo-button_is-disabled{--inner-text-color: #FFFFFF !important;--inner-background-color: #C6C6C6 !important;--inner-border-color: transparent !important;pointer-events:none}.evo-button:disabled .evo-button:after,.evo-button_is-disabled .evo-button:after{display:none}.evo-button_is-outline:not(.evo-button_is-outline:hover):not(.evo-button_is-outline_is-disabled):not(.evo-button_is-outline:active){--inner-text-color: var(--inner-button-primary-color);--inner-background-color: transparent;--inner-border-color: var(--inner-button-primary-color)}.evo-button_is-outline:hover{--inner-text-color: var(--inner-button-secondary-color);--inner-background-color: var(--inner-button-primary-color)}.evo-button_is-outline:hover:not(:focus):not(:active):after{background:transparent;border:none}.evo-button_is-loading{position:relative;pointer-events:none}.evo-button.evo-button_shape_rounded{border-radius:30px;font-weight:500;font-family:var(--evo-font-secondary);text-transform:uppercase}.evo-button.evo-button_shape_rectangle{border-radius:4px;padding:0 12px;font-weight:600;font-family:var(--evo-font);text-transform:unset}.evo-button.evo-button_shape_semi-rectangle{border-radius:8px;padding:0 8px;font-weight:700;font-family:var(--evo-font);text-transform:unset}.evo-button.evo-button_color_secondary{--inner-button-primary-color: #231F20;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_color_success{--inner-button-primary-color: #21C68B;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_color_bonus{--inner-button-primary-color: #C72AAE;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_color_text{--inner-button-primary-color: #212121;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_color_link{--inner-button-primary-color: #0986E2;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_color_error{--inner-button-primary-color: #FF1817;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_color_white{--inner-button-primary-color: #FFFFFF;--inner-button-secondary-color: #212121}.evo-button.evo-button_color_primary{--inner-button-primary-color: #F05023;--inner-button-secondary-color: #FFFFFF}.evo-button.evo-button_size_small.evo-button_shape_rounded{height:32px;padding:0 16px;font-family:var(--evo-font-secondary);font-style:normal;font-weight:500;font-size:14px;line-height:20px}.evo-button.evo-button_size_normal.evo-button_shape_rounded{height:40px;padding:0 24px;font-family:var(--evo-font-secondary);font-style:normal;font-weight:500;font-size:16px;line-height:20px}.evo-button.evo-button_size_large.evo-button_shape_rounded{height:56px;padding:0 40px;font-family:var(--evo-font-secondary);font-style:normal;font-weight:500;font-size:18px;line-height:20px}.evo-button.evo-button_size_small.evo-button_shape_rectangle,.evo-button.evo-button_size_normal.evo-button_shape_rectangle,.evo-button.evo-button_size_large.evo-button_shape_rectangle{height:32px;font-family:var(--evo-font);font-style:normal;font-size:14px;line-height:24px;font-weight:600}.evo-button.evo-button_size_small.evo-button_shape_semi-rectangle,.evo-button.evo-button_size_normal.evo-button_shape_semi-rectangle,.evo-button.evo-button_size_large.evo-button_shape_semi-rectangle{height:24px;font-family:var(--evo-font);font-style:normal;font-size:12px;line-height:18px;font-weight:700}.evo-button.evo-button_color_white.evo-button_shape_rounded:not(.evo-button.evo-button_color_white.evo-button_shape_rounded:disabled):is(.evo-button.evo-button_color_white.evo-button_shape_rounded:hover):after{z-index:3}.evo-button.evo-button_color_custom:not(.evo-button_is-disabled):not(.evo-button_is-outline){--inner-button-secondary-color: var(--evo-button-text-color)}.evo-button.evo-button_color_custom:not(.evo-button_is-disabled):not(.evo-button_is-outline):hover{--inner-button-secondary-color: var(--evo-button-hover-text-color)}.evo-button.evo-button_color_custom:not(.evo-button_is-disabled):not(.evo-button_is-outline):before{background-color:var(--evo-button-background-color);background-image:var(--evo-button-background-gradient);border-color:transparent}.evo-button.evo-button_color_custom:not(.evo-button_is-disabled).evo-button_is-outline{--inner-button-primary-color: var(--evo-button-border-color)}.evo-button.evo-button_color_custom:not(.evo-button_is-disabled).evo-button_is-outline:hover:before,.evo-button.evo-button_color_custom:not(.evo-button_is-disabled).evo-button_is-outline:active:before{background-color:var(--evo-button-background-color);background-image:var(--evo-button-background-gradient)}\n"], components: [{ type: i1.EvoCircularLoaderComponent, selector: "evo-circular-loader" }], directives: [{ type: i2.EvoUiClassDirective, selector: "[evoUiClass]", inputs: ["class", "evoUiClass"] }, { type: i3.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: EvoButtonComponent, decorators: [{
            type: Component,
            args: [{
                    selector: 'button[evoButton], a[evoButton]',
                    templateUrl: './evo-button.component.html',
                    styleUrls: ['./evo-button.component.scss'],
                    changeDetection: ChangeDetectionStrategy.OnPush,
                }]
        }], ctorParameters: function () { return [{ type: i0.ElementRef }]; }, propDecorators: { size: [{
                type: Input
            }], color: [{
                type: Input
            }], theme: [{
                type: Input
            }], disabled: [{
                type: Input
            }], loading: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 