var _a;
import { __decorate, __extends } from "tslib";
import Component from 'vue-class-component';
import { Prop } from 'vue-property-decorator';
import { TEXTAREA_AUTO_HEIGHT } from '../../directives/directive-names';
import { MTextareaAutoHeight } from '../../directives/textarea-auto-height/textarea-auto-height';
import { InputLabel } from '../../mixins/input-label/input-label';
import { InputManagement } from '../../mixins/input-management/input-management';
import { InputState } from '../../mixins/input-state/input-state';
import { InputWidth } from '../../mixins/input-width/input-width';
import uuid from '../../utils/uuid/uuid';
import { ModulVue } from '../../utils/vue/vue';
import { MCharacterCount } from '../character-count/character-count';
import { TEXTAREA_NAME } from '../component-names';
import { MInputStyle } from '../input-style/input-style';
import { MValidationMessage } from '../validation-message/validation-message';
import WithRender from './textarea.html?style=./textarea.scss';
var MTextarea = /** @class */ (function (_super) {
    __extends(MTextarea, _super);
    function MTextarea() {
        var _this = _super !== null && _super.apply(this, arguments) || this;
        _this.internalTextareaHeight = '0';
        return _this;
    }
    Object.defineProperty(MTextarea.prototype, "valueLength", {
        get: function () {
            return this.internalValue.length;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTextarea.prototype, "maxLengthNumber", {
        get: function () {
            return !this.lengthOverflow && this.maxLength > 0 ? this.maxLength : Infinity;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTextarea.prototype, "hasTextareaError", {
        get: function () {
            return this.as().hasError;
        },
        enumerable: false,
        configurable: true
    });
    Object.defineProperty(MTextarea.prototype, "isTextareaValid", {
        get: function () {
            return this.as().isValid;
        },
        enumerable: false,
        configurable: true
    });
    __decorate([
        Prop()
    ], MTextarea.prototype, "characterCount", void 0);
    __decorate([
        Prop({ default: 0 })
    ], MTextarea.prototype, "maxLength", void 0);
    __decorate([
        Prop({ default: true })
    ], MTextarea.prototype, "lengthOverflow", void 0);
    __decorate([
        Prop({ default: 0 })
    ], MTextarea.prototype, "characterCountThreshold", void 0);
    __decorate([
        Prop({ default: function () { return "mTextarea-" + uuid.generate(); } })
    ], MTextarea.prototype, "id", void 0);
    __decorate([
        Prop({ default: function () { return uuid.generate(); } })
    ], MTextarea.prototype, "inputAriaDescribedby", void 0);
    __decorate([
        Prop()
    ], MTextarea.prototype, "inputAriaActivedescendant", void 0);
    __decorate([
        Prop()
    ], MTextarea.prototype, "inputAriaAutocomplete", void 0);
    __decorate([
        Prop()
    ], MTextarea.prototype, "inputAriaControls", void 0);
    MTextarea = __decorate([
        WithRender,
        Component({
            components: {
                MInputStyle: MInputStyle,
                MValidationMessage: MValidationMessage,
                MCharacterCount: MCharacterCount
            },
            directives: (_a = {},
                _a[TEXTAREA_AUTO_HEIGHT] = MTextareaAutoHeight,
                _a),
            mixins: [
                InputState,
                InputManagement,
                InputWidth,
                InputLabel
            ]
        })
    ], MTextarea);
    return MTextarea;
}(ModulVue));
export { MTextarea };
var TextareaPlugin = {
    install: function (v, options) {
        v.component(TEXTAREA_NAME, MTextarea);
    }
};
export default TextareaPlugin;
//# sourceMappingURL=textarea.js.map