import { MXBaseComponent, AXComponent } from '@acorex/cdk/common';
import * as i0 from '@angular/core';
import { EventEmitter, Input, Output, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';

/**
 * Represents a label component that provides a way to display text labels within the application.
 *
 * @category Components
 */
class AXLabelComponent extends MXBaseComponent {
    constructor() {
        super(...arguments);
        /**
         * Emitted when the `required` property changes.
         *
         * @event
         */
        this.requiredChange = new EventEmitter();
        /**
         *  @ignore
         */
        this._required = null;
    }
    /**
     * Determines if the field is required.
     *
     * @defaultValue false
     */
    get required() {
        return this._required;
    }
    /**
     * Sets whether the field is required.
     *
     * @param v - A boolean indicating if the field is required.
     */
    set required(v) {
        this.setOption({
            name: 'required',
            value: v,
            afterCallback: () => {
                this.cdr.markForCheck();
            },
        });
    }
    /**
     * Gets the form control or component associated with the label.
     */
    get for() {
        return this._for;
    }
    /**
     * Sets the form control or component associated with the label.
     *
     * @param v The `MXValueComponent` to associate with the label.
     */
    set for(v) {
        this.setOption({
            name: 'for',
            value: v,
            afterCallback: () => {
                this.cdr.markForCheck();
            },
        });
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXLabelComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.15", type: AXLabelComponent, isStandalone: true, selector: "ax-label", inputs: { required: "required", for: "for" }, outputs: { requiredChange: "requiredChange" }, providers: [
            { provide: MXBaseComponent, useExisting: AXLabelComponent },
            { provide: AXComponent, useExisting: AXLabelComponent },
        ], usesInheritance: true, ngImport: i0, template: "<label (click)=\"for?.focus()\" [class.ax-cursor-pointer]=\"for\" [attr.for]=\"for?.getHostElement().id\">\n  <ng-content></ng-content>\n  @if (required || for?.isRequired) {\n    <span class=\"ax-state-required\">&nbsp;*</span>\n  }\n</label>\n", styles: ["ax-label{color:rgb(var(--ax-comp-label-text-color, var(--ax-sys-color-on-lightest-surface)))}ax-label label{margin-bottom:.5rem;display:block;cursor:inherit;font-size:.875rem;line-height:1.25rem;font-weight:500}ax-label label .ax-state-required{color:rgba(var(--ax-comp-label-required-text-color, var(--ax-sys-color-danger-surface)))}ax-label.ax-state-error{color:rgba(var(--ax-comp-label-error-text-color, var(--ax-sys-color-danger-surface)))!important}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: AXLabelComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-label', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [
                        { provide: MXBaseComponent, useExisting: AXLabelComponent },
                        { provide: AXComponent, useExisting: AXLabelComponent },
                    ], template: "<label (click)=\"for?.focus()\" [class.ax-cursor-pointer]=\"for\" [attr.for]=\"for?.getHostElement().id\">\n  <ng-content></ng-content>\n  @if (required || for?.isRequired) {\n    <span class=\"ax-state-required\">&nbsp;*</span>\n  }\n</label>\n", styles: ["ax-label{color:rgb(var(--ax-comp-label-text-color, var(--ax-sys-color-on-lightest-surface)))}ax-label label{margin-bottom:.5rem;display:block;cursor:inherit;font-size:.875rem;line-height:1.25rem;font-weight:500}ax-label label .ax-state-required{color:rgba(var(--ax-comp-label-required-text-color, var(--ax-sys-color-danger-surface)))}ax-label.ax-state-error{color:rgba(var(--ax-comp-label-error-text-color, var(--ax-sys-color-danger-surface)))!important}\n"] }]
        }], propDecorators: { requiredChange: [{
                type: Output
            }], required: [{
                type: Input
            }], for: [{
                type: Input
            }] } });

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

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

export { AXLabelComponent, AXLabelModule };
//# sourceMappingURL=acorex-components-label.mjs.map
