/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, ElementRef, EventEmitter, forwardRef, Input, Output, ViewChild } from '@angular/core';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { FormFieldAbstract } from '../form/form-field.abstract';
import { getBooleanValue } from '../../utils/get-boolean-value.util';
var TextAreaComponent = /** @class */ (function (_super) {
    tslib_1.__extends(TextAreaComponent, _super);
    function TextAreaComponent() {
        var _this = _super.call(this) || this;
        _this.onBlurEmitter = new EventEmitter();
        _this.onChangeEmitter = new EventEmitter();
        _this.onFocusEmitter = new EventEmitter();
        return _this;
    }
    /**
     * @return {?}
     */
    TextAreaComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        this.initValues();
    };
    /**
     * @return {?}
     */
    TextAreaComponent.prototype.initValues = /**
     * @return {?}
     */
    function () {
        var defaultProps = TextAreaComponent.defaultProps;
        this.className = this.classNameInput || defaultProps.className;
        this.disabled = getBooleanValue(this.disabledInput, defaultProps.disabled);
        this.floatLabel = this.floatLabelInput || defaultProps.floatLabel;
        this.hasCounter = getBooleanValue(this.hasCounterInput, defaultProps.hasCounter);
        this.id = this.idInput || defaultProps.id;
        this.maxLength = this.maxLengthInput || defaultProps.maxLength;
        this.minLength = this.minLengthInput || defaultProps.minLength;
        this.name = this.nameInput || defaultProps.name;
        this.placeholder = this.placeholderInput || defaultProps.placeholder;
        this.required = getBooleanValue(this.requiredInput, defaultProps.required);
        this.rows = this.rowsInput || defaultProps.rows;
        this.value = this.valueInput || defaultProps.value;
        this.isFocused = false;
        this.isTouched = false;
    };
    /**
     * @param {?} event
     * @return {?}
     */
    TextAreaComponent.prototype.onBlur = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        var nativeElement = this.formControlWrapperRef.nativeElement;
        var relatedTarget = event.relatedTarget;
        if (!this.floatLabel || relatedTarget !== nativeElement) {
            this.isTouched = true;
            this.isFocused = false;
            this.onBlurEmitter.emit(event);
        }
    };
    /**
     * @param {?} event
     * @return {?}
     */
    TextAreaComponent.prototype.onFocus = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        if (!this.disabled) {
            this.isFocused = true;
            this.onTouched();
            this.onFocusEmitter.emit(event);
            this.textAreaRef.nativeElement.focus();
        }
    };
    /**
     * @param {?} event
     * @return {?}
     */
    TextAreaComponent.prototype.onChange = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        var value = event.target.value;
        this.value = value;
        this.onChangeEmitter.emit(event);
        this.onTextAreaChange(value);
    };
    /**
     * @param {?} isDisabled
     * @return {?}
     */
    TextAreaComponent.prototype.setDisabledState = /**
     * @param {?} isDisabled
     * @return {?}
     */
    function (isDisabled) {
        this.disabled = isDisabled;
    };
    /**
     * @param {?} value
     * @return {?}
     */
    TextAreaComponent.prototype.writeValue = /**
     * @param {?} value
     * @return {?}
     */
    function (value) {
        this.value = value;
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    TextAreaComponent.prototype.registerOnChange = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onTextAreaChange = fn;
    };
    /**
     * @param {?} fn
     * @return {?}
     */
    TextAreaComponent.prototype.registerOnTouched = /**
     * @param {?} fn
     * @return {?}
     */
    function (fn) {
        this.onTouched = fn;
    };
    /**
     * @param {?} value
     * @return {?}
     */
    TextAreaComponent.prototype.onTextAreaChange = /**
     * @param {?} value
     * @return {?}
     */
    function (value) { };
    /**
     * @return {?}
     */
    TextAreaComponent.prototype.onTouched = /**
     * @return {?}
     */
    function () { };
    TextAreaComponent.defaultProps = {
        className: '',
        disabled: false,
        floatLabel: '',
        hasCounter: false,
        id: '',
        maxLength: 500,
        minLength: 0,
        name: '',
        placeholder: '',
        required: false,
        rows: 1,
        value: ''
    };
    TextAreaComponent.decorators = [
        { type: Component, args: [{
                    providers: [{
                            provide: FormFieldAbstract,
                            useExisting: forwardRef((/**
                             * @return {?}
                             */
                            function () { return TextAreaComponent; }))
                        }, {
                            multi: true,
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef((/**
                             * @return {?}
                             */
                            function () { return TextAreaComponent; }))
                        }],
                    selector: 'materialize-textarea',
                    template: "<div class=\"form-control-container\"\n  tabindex=\"1\"\n\n  (blur)=\"onBlur($event)\"\n  (focus)=\"onFocus($event)\"\n  \n  [ngClass]=\"className\"\n  [class.float-label]=\"floatLabel\"\n  [class.active]=\"value || placeholder\"\n  [class.focused]=\"isFocused\"\n  [class.disabled]=\"disabled\"\n\n  #formControlWrapper>\n\n  <div class=\"form-control-wrapper\">\n    <div class=\"form-control-float-label\">{{ floatLabel }}</div>\n\n    <textarea class=\"form-control\"\n      (input)=\"onChange($event)\"\n      (blur)=\"onBlur($event)\"\n      (focus)=\"onFocus($event)\"\n\n      [disabled]=\"disabled\"\n      [id]=\"id\"\n      [maxLength]=\"maxLength\"\n      [minLength]=\"minLength\"\n      [name]=\"name\"\n      [placeholder]=\"placeholder\"\n      [required]=\"required\"\n      [rows]=\"rows\"\n      [value]=\"value\"\n\n      #textArea>\n    </textarea>\n\n    <materialize-icon className=\"form-icon-error\" name=\"error\" size=\"lg\"></materialize-icon>\n  </div>\n</div>\n\n<materialize-form-message type=\"info\" *ngIf=\"hasCounter\">{{ value.length }} / {{ maxLength }}</materialize-form-message>\n",
                    styles: [".form-control-container{background-color:#f4f3f4;border-bottom:1px solid #6a6a6a;border-radius:4px 4px 0 0;display:flex;flex-direction:row;outline:0;position:relative}.form-control-container::after{background-color:#5707eb;bottom:-1px;content:'';height:2px;left:50%;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);transition:width 250ms;width:0;z-index:10}.float-label.form-control-container .form-control{padding-top:24px}.active.form-control-container .form-control-float-label,.focused.form-control-container .form-control-float-label{font-size:12px;top:0;-webkit-transform:unset;transform:unset}.focused.form-control-container .form-control-float-label{color:#5707eb}.focused.form-control-container::after{width:100%}.focused.form-control-container .form-label{color:#5707eb}.focused.form-control-container .form-control{caret-color:#5707eb}.disabled.form-control-container .form-control-wrapper{border-bottom-color:#f4f3f4;cursor:not-allowed}.disabled.form-control-container .form-control,.disabled.form-control-container .form-control-float-label{cursor:not-allowed}.disabled.form-control-container .form-control,.disabled.form-control-container .form-control-float-label,.disabled.form-control-container .form-label{color:#dcdbdc}.form-control-wrapper{position:relative;width:100%}.form-control-wrapper ::ng-deep .form-icon-error{color:#a22027;display:none;position:absolute;right:12px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);z-index:10}.form-control{background-color:transparent;border:0;box-sizing:border-box;color:#000;font-family:Roboto;font-size:16px;font-weight:300;height:100%;max-width:100%;outline:0;padding:12px;resize:vertical;width:100%}.ng-touched.ng-dirty.ng-invalid:host .form-control-container::after{background-color:#a22027;width:100%}.ng-touched.ng-dirty.ng-invalid:host .form-control-float-label{color:#a22027}.ng-touched.ng-dirty.ng-invalid:host .form-control{caret-color:#a22027;padding-right:48px}.ng-touched.ng-dirty.ng-invalid:host .form-control-wrapper ::ng-deep .form-icon-error{display:block}.form-control-float-label{background-color:#f4f3f4;color:#6a6a6a;cursor:text;font-family:Roboto;font-size:16px;font-weight:300;left:0;padding:8px 12px 6px;position:absolute;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);transition:250ms;width:100%;z-index:10}"]
                }] }
    ];
    /** @nocollapse */
    TextAreaComponent.ctorParameters = function () { return []; };
    TextAreaComponent.propDecorators = {
        formControlWrapperRef: [{ type: ViewChild, args: ['formControlWrapper',] }],
        textAreaRef: [{ type: ViewChild, args: ['textArea',] }],
        onFocusEmitter: [{ type: Output, args: ['onFocus',] }],
        onChangeEmitter: [{ type: Output, args: ['onChange',] }],
        onBlurEmitter: [{ type: Output, args: ['onBlur',] }],
        classNameInput: [{ type: Input, args: ['className',] }],
        disabledInput: [{ type: Input, args: ['disabled',] }],
        floatLabelInput: [{ type: Input, args: ['floatLabel',] }],
        hasCounterInput: [{ type: Input, args: ['hasCounter',] }],
        idInput: [{ type: Input, args: ['id',] }],
        maxLengthInput: [{ type: Input, args: ['maxLength',] }],
        minLengthInput: [{ type: Input, args: ['minLength',] }],
        nameInput: [{ type: Input, args: ['name',] }],
        placeholderInput: [{ type: Input, args: ['placeholder',] }],
        requiredInput: [{ type: Input, args: ['required',] }],
        rowsInput: [{ type: Input, args: ['rows',] }],
        valueInput: [{ type: Input, args: ['value',] }]
    };
    return TextAreaComponent;
}(FormFieldAbstract));
export { TextAreaComponent };
if (false) {
    /** @type {?} */
    TextAreaComponent.defaultProps;
    /** @type {?} */
    TextAreaComponent.prototype.formControlWrapperRef;
    /** @type {?} */
    TextAreaComponent.prototype.textAreaRef;
    /** @type {?} */
    TextAreaComponent.prototype.onFocusEmitter;
    /** @type {?} */
    TextAreaComponent.prototype.onChangeEmitter;
    /** @type {?} */
    TextAreaComponent.prototype.onBlurEmitter;
    /** @type {?} */
    TextAreaComponent.prototype.classNameInput;
    /** @type {?} */
    TextAreaComponent.prototype.disabledInput;
    /** @type {?} */
    TextAreaComponent.prototype.floatLabelInput;
    /** @type {?} */
    TextAreaComponent.prototype.hasCounterInput;
    /** @type {?} */
    TextAreaComponent.prototype.idInput;
    /** @type {?} */
    TextAreaComponent.prototype.maxLengthInput;
    /** @type {?} */
    TextAreaComponent.prototype.minLengthInput;
    /** @type {?} */
    TextAreaComponent.prototype.nameInput;
    /** @type {?} */
    TextAreaComponent.prototype.placeholderInput;
    /** @type {?} */
    TextAreaComponent.prototype.requiredInput;
    /** @type {?} */
    TextAreaComponent.prototype.rowsInput;
    /** @type {?} */
    TextAreaComponent.prototype.valueInput;
    /** @type {?} */
    TextAreaComponent.prototype.className;
    /** @type {?} */
    TextAreaComponent.prototype.disabled;
    /** @type {?} */
    TextAreaComponent.prototype.floatLabel;
    /** @type {?} */
    TextAreaComponent.prototype.hasCounter;
    /** @type {?} */
    TextAreaComponent.prototype.id;
    /** @type {?} */
    TextAreaComponent.prototype.isFocused;
    /** @type {?} */
    TextAreaComponent.prototype.isTouched;
    /** @type {?} */
    TextAreaComponent.prototype.minLength;
    /** @type {?} */
    TextAreaComponent.prototype.maxLength;
    /** @type {?} */
    TextAreaComponent.prototype.name;
    /** @type {?} */
    TextAreaComponent.prototype.rows;
    /** @type {?} */
    TextAreaComponent.prototype.placeholder;
    /** @type {?} */
    TextAreaComponent.prototype.required;
    /** @type {?} */
    TextAreaComponent.prototype.value;
}
//# sourceMappingURL=data:application/json;base64, 