import { Component, forwardRef, Input } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { EvoBaseControl } from '../../common/evo-base-control';
import { EvoControlStates } from '../../common/evo-control-state-manager/evo-control-states.enum';
import * as i0 from "@angular/core";
import * as i1 from "../evo-control-error/evo-control-error.component";
import * as i2 from "@angular/forms";
import * as i3 from "../../directives/evo-ui-class.directive";
import * as i4 from "@angular/common";
export class EvoTextareaComponent extends EvoBaseControl {
    constructor() {
        super(...arguments);
        this.placeholder = '';
        this.rows = 3;
        this.disabled = false;
        this.focused = false;
        this.onChange = (_) => { };
        this.onTouched = () => { };
    }
    get value() {
        return this._value;
    }
    get textareaClasses() {
        return {
            'focused': this.focused,
            'disabled': this.disabled,
            'valid': this.currentState[EvoControlStates.valid],
            'invalid': this.currentState[EvoControlStates.invalid],
        };
    }
    set value(value) {
        this._value = value.trim();
        this.onChange(this.value);
    }
    onFocus() {
        if (!this.focused) {
            this.focused = true;
        }
    }
    onBlur() {
        this.focused = false;
        this.onTouched();
    }
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouched = fn;
    }
    setDisabledState(isDisabled) {
        this.disabled = isDisabled;
    }
    writeValue(value) {
        this.value = value;
    }
}
EvoTextareaComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EvoTextareaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
EvoTextareaComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: EvoTextareaComponent, selector: "evo-textarea", inputs: { placeholder: "placeholder", rows: "rows" }, providers: [
        {
            provide: NG_VALUE_ACCESSOR,
            useExisting: forwardRef(() => EvoTextareaComponent),
            multi: true,
        },
    ], usesInheritance: true, ngImport: i0, template: "<textarea [(ngModel)]=\"value\"\n          [evoUiClass]=\"textareaClasses\"\n          [placeholder]=\"placeholder\"\n          [rows]=\"rows\"\n          [disabled]=\"disabled\"\n          (focus)=\"onFocus()\"\n          (blur)=\"onBlur()\"\n          class=\"evo-textarea\"></textarea>\n<evo-control-error *ngIf=\"showErrors\"\n                   [errors]=\"control.errors\"\n                   [errorsMessages]=\"errorsMessages\"></evo-control-error>\n", styles: ["@keyframes evo-fx-blink{50%{transform:scale(1);opacity:1}to{opacity:0}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes gradient{0%{background-position:0 50%}50%{background-position:50vw 50%}to{background-position:100vw 50%}}@keyframes evo-fx-blink{50%{transform:scale(1);opacity:1}to{opacity:0}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes gradient{0%{background-position:0 50%}50%{background-position:50vw 50%}to{background-position:100vw 50%}}:host{display:inline-block;--evo-input-prefix-content-margin: 0 12px}.evo-input{position:relative;cursor:text;--evo-input-height: 48px;--evo-input-border-radius: 4px;--evo-input-font-size: 16px;display:flex;align-items:center;height:var(--evo-input-height);color:#212121;font-weight:400;font-size:var(--evo-input-font-size);font-family:var(--evo-font);white-space:nowrap;background-color:#fff;border:1px solid #C6C6C6;border-radius:var(--evo-input-border-radius);outline:none;transition:color .3s,box-shadow .3s,background .3s,border .3s}.evo-input_focused{border:solid 1px #74706F}.evo-input_disabled{color:#b0b0b0!important;background-color:#f9fafb!important;border:1px solid #E3E3E3!important;cursor:default;pointer-events:none}.evo-input_invalid{border-color:#ff1817!important}.evo-input_theme-rounded:not(.evo-input_size-small){border-radius:256px}.evo-input_theme-rounded:not(.evo-input_size-small) .evo-input__field{border-radius:256px}.evo-input_size-small{height:32px}.evo-input_size-small .evo-input__field{padding:0 8px}.evo-input_size-small .evo-input__tooltip,.evo-input_size-small .evo-input__loading-spinner{flex:0 0 16px;width:16px;height:16px;margin:0 10px}.evo-input_size-small .evo-input__icon{margin-right:10px}.evo-input_size-small .evo-input__icon img{max-height:16px}.evo-input_size-small .evo-input__tooltip-container{top:100%}.evo-input_size-small .evo-input__tooltip-container:before{left:calc(100% - 28px)}@media (min-width: 1200px){.evo-input_size-small .evo-input__tooltip-container{top:calc(100% + 4px)}.evo-input_size-small .evo-input__tooltip-container:before{left:calc(50% - 6px)}}.evo-input_size-small .evo-input__prefix-icon{width:16px;height:16px}.evo-input_size-small .evo-input__prefix-icon:empty{display:none}.evo-input_size-small .evo-input__icon-clear{width:16px;height:16px}.evo-input__prefix-icon{display:flex;flex-shrink:0;justify-content:center;align-items:center;width:24px;height:24px;margin-left:12px;fill:#91b1b8}.evo-input__prefix-icon:empty{display:none}.evo-input__prefix-content{display:inline-flex;flex-shrink:0;justify-content:center;align-items:center;margin:var(--evo-input-prefix-content-margin)}.evo-input__prefix-content:empty{display:none}.evo-input__prefix-content:not(:empty)~.evo-input__field{padding-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.evo-input__field{flex-grow:1;width:100%;height:100%;margin:0;padding:0 8px 0 16px;color:inherit;font-weight:inherit;font-size:inherit;border:none;border-radius:4px;outline:none}.evo-input__field::-webkit-input-placeholder{color:#9b9b9b}.evo-input__field::-moz-placeholder{color:#9b9b9b;opacity:1}.evo-input__field:-ms-input-placeholder{color:#9b9b9b}.evo-input__field:disabled{color:#b0b0b0;background-color:#f9fafb!important}.evo-input__field:not(:last-child){padding-right:0}.evo-input__prefix{padding-left:20px;font-size:16px;transition:color .2s}.evo-input__prefix_focused{color:#000}.evo-input__prefix:not(:empty)~.evo-input__field{padding-left:0}.evo-input__tooltip,.evo-input__icon-clear{width:24px;height:24px;margin:0 10px;cursor:pointer;-webkit-user-select:none;user-select:none;fill:#91b1b8}.evo-input__icon{margin:0 20px 0 10px}.evo-input__icon img{display:block;width:100%;max-width:60px;height:auto;max-height:22px}.evo-input__tooltip-container{position:absolute;top:calc(100% - 2px);left:0;z-index:1;display:flex;width:100%;padding:10px 10px 10px 20px;color:#212121;line-height:normal;white-space:normal;background-color:#fff8e6;border-radius:4px;box-shadow:0 4px 12px #0003;cursor:default}.evo-input__tooltip-container[hidden]{display:none!important}.evo-input__tooltip-container:before{position:absolute;top:-20px;left:calc(100% - 34px);border:10px solid transparent;border-bottom:10px solid #FFF8E6;pointer-events:none;content:\"\"}@media (min-width: 1200px){.evo-input__tooltip-container{left:calc(50% - 22px)}.evo-input__tooltip-container:before{left:calc(50% - 12px)}}.evo-input__clearable{display:flex;justify-content:center;align-items:center}.evo-input__clearable+.evo-input__additional{margin-left:-10px}.evo-input__additional{display:flex;justify-content:center;align-items:center}.evo-input__additional:not(:last-child) .evo-input__icon{margin-right:10px}.evo-input__additional+.evo-input__loading-spinner{margin-left:0}.evo-input__loading-spinner{margin:0 20px;flex:0 0 16px;width:16px;height:16px;border:2px solid #C6C6C6;border-top-color:#21c68b;border-radius:50%;animation:spin .8s linear infinite}:host{display:inline-block}.evo-textarea{--evo-input-height: 48px;--evo-input-border-radius: 4px;--evo-input-font-size: 16px;display:flex;align-items:center;height:var(--evo-input-height);color:#212121;font-weight:400;font-size:var(--evo-input-font-size);font-family:var(--evo-font);white-space:nowrap;background-color:#fff;border:1px solid #C6C6C6;border-radius:var(--evo-input-border-radius);outline:none;transition:color .3s,box-shadow .3s,background .3s,border .3s;width:100%;height:auto;padding:16px;white-space:normal;transition:box-shadow .3s,border .3s;resize:vertical}.evo-textarea_focused{border:solid 1px #74706F}.evo-textarea_disabled{color:#b0b0b0!important;background-color:#f9fafb!important;border:1px solid #E3E3E3!important;cursor:default;pointer-events:none}.evo-textarea_invalid{border-color:#ff1817!important}.evo-textarea::placeholder{color:#9b9b9b}.evo-textarea[disabled]{white-space:normal;background:#F9FAFB}\n"], components: [{ type: i1.EvoControlErrorComponent, selector: "evo-control-error", inputs: ["errors", "errorsMessages", "showCount"] }], directives: [{ type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i3.EvoUiClassDirective, selector: "[evoUiClass]", inputs: ["class", "evoUiClass"] }, { type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EvoTextareaComponent, decorators: [{
            type: Component,
            args: [{ selector: 'evo-textarea', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => EvoTextareaComponent),
                            multi: true,
                        },
                    ], template: "<textarea [(ngModel)]=\"value\"\n          [evoUiClass]=\"textareaClasses\"\n          [placeholder]=\"placeholder\"\n          [rows]=\"rows\"\n          [disabled]=\"disabled\"\n          (focus)=\"onFocus()\"\n          (blur)=\"onBlur()\"\n          class=\"evo-textarea\"></textarea>\n<evo-control-error *ngIf=\"showErrors\"\n                   [errors]=\"control.errors\"\n                   [errorsMessages]=\"errorsMessages\"></evo-control-error>\n", styles: ["@keyframes evo-fx-blink{50%{transform:scale(1);opacity:1}to{opacity:0}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes gradient{0%{background-position:0 50%}50%{background-position:50vw 50%}to{background-position:100vw 50%}}@keyframes evo-fx-blink{50%{transform:scale(1);opacity:1}to{opacity:0}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes gradient{0%{background-position:0 50%}50%{background-position:50vw 50%}to{background-position:100vw 50%}}:host{display:inline-block;--evo-input-prefix-content-margin: 0 12px}.evo-input{position:relative;cursor:text;--evo-input-height: 48px;--evo-input-border-radius: 4px;--evo-input-font-size: 16px;display:flex;align-items:center;height:var(--evo-input-height);color:#212121;font-weight:400;font-size:var(--evo-input-font-size);font-family:var(--evo-font);white-space:nowrap;background-color:#fff;border:1px solid #C6C6C6;border-radius:var(--evo-input-border-radius);outline:none;transition:color .3s,box-shadow .3s,background .3s,border .3s}.evo-input_focused{border:solid 1px #74706F}.evo-input_disabled{color:#b0b0b0!important;background-color:#f9fafb!important;border:1px solid #E3E3E3!important;cursor:default;pointer-events:none}.evo-input_invalid{border-color:#ff1817!important}.evo-input_theme-rounded:not(.evo-input_size-small){border-radius:256px}.evo-input_theme-rounded:not(.evo-input_size-small) .evo-input__field{border-radius:256px}.evo-input_size-small{height:32px}.evo-input_size-small .evo-input__field{padding:0 8px}.evo-input_size-small .evo-input__tooltip,.evo-input_size-small .evo-input__loading-spinner{flex:0 0 16px;width:16px;height:16px;margin:0 10px}.evo-input_size-small .evo-input__icon{margin-right:10px}.evo-input_size-small .evo-input__icon img{max-height:16px}.evo-input_size-small .evo-input__tooltip-container{top:100%}.evo-input_size-small .evo-input__tooltip-container:before{left:calc(100% - 28px)}@media (min-width: 1200px){.evo-input_size-small .evo-input__tooltip-container{top:calc(100% + 4px)}.evo-input_size-small .evo-input__tooltip-container:before{left:calc(50% - 6px)}}.evo-input_size-small .evo-input__prefix-icon{width:16px;height:16px}.evo-input_size-small .evo-input__prefix-icon:empty{display:none}.evo-input_size-small .evo-input__icon-clear{width:16px;height:16px}.evo-input__prefix-icon{display:flex;flex-shrink:0;justify-content:center;align-items:center;width:24px;height:24px;margin-left:12px;fill:#91b1b8}.evo-input__prefix-icon:empty{display:none}.evo-input__prefix-content{display:inline-flex;flex-shrink:0;justify-content:center;align-items:center;margin:var(--evo-input-prefix-content-margin)}.evo-input__prefix-content:empty{display:none}.evo-input__prefix-content:not(:empty)~.evo-input__field{padding-left:0;border-top-left-radius:0;border-bottom-left-radius:0}.evo-input__field{flex-grow:1;width:100%;height:100%;margin:0;padding:0 8px 0 16px;color:inherit;font-weight:inherit;font-size:inherit;border:none;border-radius:4px;outline:none}.evo-input__field::-webkit-input-placeholder{color:#9b9b9b}.evo-input__field::-moz-placeholder{color:#9b9b9b;opacity:1}.evo-input__field:-ms-input-placeholder{color:#9b9b9b}.evo-input__field:disabled{color:#b0b0b0;background-color:#f9fafb!important}.evo-input__field:not(:last-child){padding-right:0}.evo-input__prefix{padding-left:20px;font-size:16px;transition:color .2s}.evo-input__prefix_focused{color:#000}.evo-input__prefix:not(:empty)~.evo-input__field{padding-left:0}.evo-input__tooltip,.evo-input__icon-clear{width:24px;height:24px;margin:0 10px;cursor:pointer;-webkit-user-select:none;user-select:none;fill:#91b1b8}.evo-input__icon{margin:0 20px 0 10px}.evo-input__icon img{display:block;width:100%;max-width:60px;height:auto;max-height:22px}.evo-input__tooltip-container{position:absolute;top:calc(100% - 2px);left:0;z-index:1;display:flex;width:100%;padding:10px 10px 10px 20px;color:#212121;line-height:normal;white-space:normal;background-color:#fff8e6;border-radius:4px;box-shadow:0 4px 12px #0003;cursor:default}.evo-input__tooltip-container[hidden]{display:none!important}.evo-input__tooltip-container:before{position:absolute;top:-20px;left:calc(100% - 34px);border:10px solid transparent;border-bottom:10px solid #FFF8E6;pointer-events:none;content:\"\"}@media (min-width: 1200px){.evo-input__tooltip-container{left:calc(50% - 22px)}.evo-input__tooltip-container:before{left:calc(50% - 12px)}}.evo-input__clearable{display:flex;justify-content:center;align-items:center}.evo-input__clearable+.evo-input__additional{margin-left:-10px}.evo-input__additional{display:flex;justify-content:center;align-items:center}.evo-input__additional:not(:last-child) .evo-input__icon{margin-right:10px}.evo-input__additional+.evo-input__loading-spinner{margin-left:0}.evo-input__loading-spinner{margin:0 20px;flex:0 0 16px;width:16px;height:16px;border:2px solid #C6C6C6;border-top-color:#21c68b;border-radius:50%;animation:spin .8s linear infinite}:host{display:inline-block}.evo-textarea{--evo-input-height: 48px;--evo-input-border-radius: 4px;--evo-input-font-size: 16px;display:flex;align-items:center;height:var(--evo-input-height);color:#212121;font-weight:400;font-size:var(--evo-input-font-size);font-family:var(--evo-font);white-space:nowrap;background-color:#fff;border:1px solid #C6C6C6;border-radius:var(--evo-input-border-radius);outline:none;transition:color .3s,box-shadow .3s,background .3s,border .3s;width:100%;height:auto;padding:16px;white-space:normal;transition:box-shadow .3s,border .3s;resize:vertical}.evo-textarea_focused{border:solid 1px #74706F}.evo-textarea_disabled{color:#b0b0b0!important;background-color:#f9fafb!important;border:1px solid #E3E3E3!important;cursor:default;pointer-events:none}.evo-textarea_invalid{border-color:#ff1817!important}.evo-textarea::placeholder{color:#9b9b9b}.evo-textarea[disabled]{white-space:normal;background:#F9FAFB}\n"] }]
        }], propDecorators: { placeholder: [{
                type: Input
            }], rows: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 