import { MXInputBaseValueComponent, MXLookComponent, AXComponent, AXFocusableComponent, AXClearableComponent, AXValuableComponent } from '@acorex/cdk/common';
import * as i0 from '@angular/core';
import { forwardRef, HostBinding, Input, ViewChild, ChangeDetectionStrategy, ViewEncapsulation, Component, NgModule } from '@angular/core';
import * as i1 from '@angular/forms';
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
import { classes } from 'polytype';
import { CommonModule } from '@angular/common';

/**
 * A component that provides a multi-line text input field with support for resizing, validation, and custom styling.
 */
class AXTextAreaComponent extends classes((MXInputBaseValueComponent), MXLookComponent) {
    constructor() {
        super(...arguments);
        /**
         * Specifies the number of rows for the component, typically used for configuring the size of a text area or similar input field.
         */
        this.rows = 0;
        /**
         * Indicates whether the component allows resizing.
         */
        this.allowResize = true;
    }
    /** @ignore */
    _handleModelChange(value) {
        this.commitValue(value, true);
    }
    get __hostName() {
        return this.name;
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXTextAreaComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: AXTextAreaComponent, isStandalone: true, selector: "ax-text-area", inputs: { disabled: "disabled", tabIndex: "tabIndex", readonly: "readonly", value: "value", state: "state", name: "name", placeholder: "placeholder", maxLength: "maxLength", look: "look", rows: "rows", allowResize: "allowResize", showCounter: "showCounter", classNames: ["class", "classNames"] }, outputs: { onBlur: "onBlur", onFocus: "onFocus", valueChange: "valueChange", stateChange: "stateChange", onValueChanged: "onValueChanged", readonlyChange: "readonlyChange", disabledChange: "disabledChange", onKeyDown: "onKeyDown", onKeyUp: "onKeyUp", onKeyPress: "onKeyPress" }, host: { properties: { "attr.name": "this.__hostName" } }, providers: [
            { provide: AXComponent, useExisting: AXTextAreaComponent },
            { provide: AXFocusableComponent, useExisting: AXTextAreaComponent },
            { provide: AXClearableComponent, useExisting: AXTextAreaComponent },
            { provide: AXValuableComponent, useExisting: AXTextAreaComponent },
            {
                provide: NG_VALUE_ACCESSOR,
                useExisting: forwardRef(() => AXTextAreaComponent),
                multi: true,
            },
        ], viewQueries: [{ propertyName: "input", first: true, predicate: ["input"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div\n  class=\"ax-editor-container {{ classNames }} ax-{{ look }}\"\n  [class.ax-state-disabled]=\"disabled\"\n  [class.ax-state-readonly]=\"readonly\"\n>\n  <textarea\n    #input\n    [id]=\"id\"\n    type=\"text\"\n    [rows]=\"rows\"\n    [attr.placeholder]=\"placeholder\"\n    [attr.maxlength]=\"maxLength\"\n    [class.ax-state-disabled]=\"disabled\"\n    [class.ax-state-readonly]=\"readonly\"\n    [class.ax-state-no-resizing]=\"!allowResize\"\n    [disabled]=\"disabled\"\n    [readonly]=\"readonly\"\n    [tabindex]=\"tabIndex\"\n    [ngModel]=\"value\"\n    (ngModelChange)=\"_handleModelChange($event)\"\n    (keydown)=\"emitOnKeydownEvent($event)\"\n    (keyup)=\"emitOnKeyupEvent($event)\"\n    (keypress)=\"emitOnKeypressEvent($event)\"\n    (focus)=\"emitOnFocusEvent($event)\"\n    (blur)=\"emitOnBlurEvent($event)\"\n  ></textarea>\n  @if (showCounter) {\n    <div class=\"ax-counter\">\n      {{ input.value.length }}\n      @if (maxLength) {\n        <span>/ {{ maxLength }}</span>\n      }\n    </div>\n  }\n</div>\n<ng-content select=\"ax-validation-rule\"> </ng-content>\n<div class=\"ax-error-container\"></div>\n", styles: ["ax-text-area{height:auto!important;width:100%;border-radius:var(--ax-comp-editor-border-radius)}ax-text-area .ax-editor-container{--ax-comp-editor-height: auto;padding:0}ax-text-area textarea{height:fit-content;width:100%;background-color:inherit;padding-block:var(--ax-comp-editor-space-block-size);padding-inline-start:var(--ax-comp-editor-space-start-size);padding-inline-end:var(--ax-comp-editor-space-end-size);font-size:.875rem;line-height:1.625}ax-text-area textarea:focus-visible,ax-text-area textarea:focus{outline:none}ax-text-area textarea.ax-state-disabled{cursor:not-allowed;opacity:.5}ax-text-area textarea.ax-state-no-resizing{resize:none}ax-text-area>ax-prefix,ax-text-area>ax-suffix{margin-bottom:.5rem;padding:.75rem}ax-text-area .ax-counter{position:absolute;bottom:.25rem;inset-inline-end:.5rem;color:rgb(var(--ax-sys-body-text-color),.5)}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXTextAreaComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-text-area', inputs: ['disabled', 'tabIndex', 'readonly', 'value', 'state', 'name', 'placeholder', 'maxLength', 'look'], outputs: [
                        'onBlur',
                        'onFocus',
                        'valueChange',
                        'stateChange',
                        'onValueChanged',
                        'readonlyChange',
                        'disabledChange',
                        'onKeyDown',
                        'onKeyUp',
                        'onKeyPress',
                    ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
                        { provide: AXComponent, useExisting: AXTextAreaComponent },
                        { provide: AXFocusableComponent, useExisting: AXTextAreaComponent },
                        { provide: AXClearableComponent, useExisting: AXTextAreaComponent },
                        { provide: AXValuableComponent, useExisting: AXTextAreaComponent },
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => AXTextAreaComponent),
                            multi: true,
                        },
                    ], imports: [FormsModule], template: "<div\n  class=\"ax-editor-container {{ classNames }} ax-{{ look }}\"\n  [class.ax-state-disabled]=\"disabled\"\n  [class.ax-state-readonly]=\"readonly\"\n>\n  <textarea\n    #input\n    [id]=\"id\"\n    type=\"text\"\n    [rows]=\"rows\"\n    [attr.placeholder]=\"placeholder\"\n    [attr.maxlength]=\"maxLength\"\n    [class.ax-state-disabled]=\"disabled\"\n    [class.ax-state-readonly]=\"readonly\"\n    [class.ax-state-no-resizing]=\"!allowResize\"\n    [disabled]=\"disabled\"\n    [readonly]=\"readonly\"\n    [tabindex]=\"tabIndex\"\n    [ngModel]=\"value\"\n    (ngModelChange)=\"_handleModelChange($event)\"\n    (keydown)=\"emitOnKeydownEvent($event)\"\n    (keyup)=\"emitOnKeyupEvent($event)\"\n    (keypress)=\"emitOnKeypressEvent($event)\"\n    (focus)=\"emitOnFocusEvent($event)\"\n    (blur)=\"emitOnBlurEvent($event)\"\n  ></textarea>\n  @if (showCounter) {\n    <div class=\"ax-counter\">\n      {{ input.value.length }}\n      @if (maxLength) {\n        <span>/ {{ maxLength }}</span>\n      }\n    </div>\n  }\n</div>\n<ng-content select=\"ax-validation-rule\"> </ng-content>\n<div class=\"ax-error-container\"></div>\n", styles: ["ax-text-area{height:auto!important;width:100%;border-radius:var(--ax-comp-editor-border-radius)}ax-text-area .ax-editor-container{--ax-comp-editor-height: auto;padding:0}ax-text-area textarea{height:fit-content;width:100%;background-color:inherit;padding-block:var(--ax-comp-editor-space-block-size);padding-inline-start:var(--ax-comp-editor-space-start-size);padding-inline-end:var(--ax-comp-editor-space-end-size);font-size:.875rem;line-height:1.625}ax-text-area textarea:focus-visible,ax-text-area textarea:focus{outline:none}ax-text-area textarea.ax-state-disabled{cursor:not-allowed;opacity:.5}ax-text-area textarea.ax-state-no-resizing{resize:none}ax-text-area>ax-prefix,ax-text-area>ax-suffix{margin-bottom:.5rem;padding:.75rem}ax-text-area .ax-counter{position:absolute;bottom:.25rem;inset-inline-end:.5rem;color:rgb(var(--ax-sys-body-text-color),.5)}\n"] }]
        }], propDecorators: { input: [{
                type: ViewChild,
                args: ['input']
            }], rows: [{
                type: Input
            }], allowResize: [{
                type: Input
            }], showCounter: [{
                type: Input
            }], maxLength: [{
                type: Input
            }], classNames: [{
                type: Input,
                args: ['class']
            }], __hostName: [{
                type: HostBinding,
                args: ['attr.name']
            }] } });

class AXTextAreaModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXTextAreaModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: AXTextAreaModule, imports: [CommonModule, FormsModule, AXTextAreaComponent], exports: [AXTextAreaComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXTextAreaModule, imports: [CommonModule, FormsModule, AXTextAreaComponent] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXTextAreaModule, decorators: [{
            type: NgModule,
            args: [{
                    imports: [CommonModule, FormsModule, AXTextAreaComponent],
                    exports: [AXTextAreaComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { AXTextAreaComponent, AXTextAreaModule };
//# sourceMappingURL=acorex-components-text-area.mjs.map
