import { Component, input } from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { FieldLabelComponent } from '../../../../components/field-label/field-label.component';
import { RadioButtonComponent } from '@seniorsistemas/angular-components/radio-button';
import { NgTemplateOutlet } from '@angular/common';
import { ButtonComponent } from '@seniorsistemas/angular-components/button';
import * as i0 from "@angular/core";
import * as i1 from "@angular/forms";
export class BooleanFieldComponent {
    field = input.required();
    formControl = input.required();
    onClear() {
        this.formControl().reset();
    }
    static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: BooleanFieldComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
    static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: BooleanFieldComponent, isStandalone: true, selector: "ng-component", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null }, formControl: { classPropertyName: "formControl", publicName: "formControl", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "@let _field = field();\n<ng-template\n    #radioButtonRender\n    let-value=\"value\"\n    let-label=\"label\"\n    let-inputIdAppend=\"inputIdAppend\"\n>\n    @let inputId = (_field.id || _field.name) + inputIdAppend;\n    <s-radiobutton\n        [name]=\"_field.name\"\n        [value]=\"value\"\n        [formControl]=\"formControl()\"\n        [inputId]=\"inputId\"\n        [label]=\"label\"\n        (focusedInput)=\"_field.onFocus ? _field.onFocus($event) : null\"\n        (inputFocusLost)=\"_field.onBlur ? _field.onBlur($event) : null\"\n    />\n</ng-template>\n\n<s-field-label [field]=\"_field\"></s-field-label>\n\n@if (_field.verticalAlignment) {\n    <div class=\"ui-g\">\n        <div class=\"ui-g-12\">\n            <ng-template\n                *ngTemplateOutlet=\"\n                    radioButtonRender;\n                    context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\n                \"\n            />\n        </div>\n        <div class=\"ui-g-12\">\n            <ng-template\n                *ngTemplateOutlet=\"\n                    radioButtonRender;\n                    context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\n                \"\n            />\n        </div>\n        @if (!_field.showClear && !!_field.required && !_field.required()) {\n            <div class=\"ui-g-12\">\n                <ng-template\n                    *ngTemplateOutlet=\"\n                        radioButtonRender;\n                        context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\n                    \"\n                />\n            </div>\n        }\n        <div>\n            @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\n                <s-button\n                    [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\n                    (clicked)=\"onClear()\"\n                    priority=\"link\"\n                >\n                </s-button>\n            }\n        </div>\n    </div>\n} @else {\n    <div class=\"ui-g horizontal-radio-buttons-container\">\n        <ng-template\n            *ngTemplateOutlet=\"\n                radioButtonRender;\n                context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\n            \"\n        />\n\n        <ng-template\n            *ngTemplateOutlet=\"\n                radioButtonRender;\n                context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\n            \"\n        />\n\n        <ng-template\n            *ngTemplateOutlet=\"\n                radioButtonRender;\n                context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\n            \"\n        />\n\n        @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\n            <s-button\n                style=\"margin-left: 40px\"\n                [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\n                (clicked)=\"onClear()\"\n                priority=\"link\"\n            >\n            </s-button>\n        }\n    </div>\n}\n\n", styles: [".horizontal-radio-buttons-container{gap:20px 40px;.radio-button-item{margin:0}}\n"], dependencies: [{ kind: "component", type: FieldLabelComponent, selector: "s-field-label", inputs: ["field", "fieldContainerRef"] }, { kind: "component", type: RadioButtonComponent, selector: "s-radiobutton", inputs: ["buttonDisabled", "label", "name", "value", "inputId"], outputs: ["buttonDisabledChange", "valueChange", "focusedInput", "inputFocusLost"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ButtonComponent, selector: "s-button", inputs: ["id", "label", "tooltip", "tooltipPosition", "iconClass", "rightIconClass", "caret", "styleClass", "baseZIndex", "disabled", "auxiliary", "type", "priority", "menuOptions", "size", "slide", "animation", "badge", "iconColor", "menuAriaLabel"], outputs: ["clicked"] }] });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: BooleanFieldComponent, decorators: [{
            type: Component,
            args: [{ standalone: true, imports: [FieldLabelComponent, RadioButtonComponent, ReactiveFormsModule, NgTemplateOutlet, ButtonComponent], template: "@let _field = field();\n<ng-template\n    #radioButtonRender\n    let-value=\"value\"\n    let-label=\"label\"\n    let-inputIdAppend=\"inputIdAppend\"\n>\n    @let inputId = (_field.id || _field.name) + inputIdAppend;\n    <s-radiobutton\n        [name]=\"_field.name\"\n        [value]=\"value\"\n        [formControl]=\"formControl()\"\n        [inputId]=\"inputId\"\n        [label]=\"label\"\n        (focusedInput)=\"_field.onFocus ? _field.onFocus($event) : null\"\n        (inputFocusLost)=\"_field.onBlur ? _field.onBlur($event) : null\"\n    />\n</ng-template>\n\n<s-field-label [field]=\"_field\"></s-field-label>\n\n@if (_field.verticalAlignment) {\n    <div class=\"ui-g\">\n        <div class=\"ui-g-12\">\n            <ng-template\n                *ngTemplateOutlet=\"\n                    radioButtonRender;\n                    context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\n                \"\n            />\n        </div>\n        <div class=\"ui-g-12\">\n            <ng-template\n                *ngTemplateOutlet=\"\n                    radioButtonRender;\n                    context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\n                \"\n            />\n        </div>\n        @if (!_field.showClear && !!_field.required && !_field.required()) {\n            <div class=\"ui-g-12\">\n                <ng-template\n                    *ngTemplateOutlet=\"\n                        radioButtonRender;\n                        context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\n                    \"\n                />\n            </div>\n        }\n        <div>\n            @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\n                <s-button\n                    [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\n                    (clicked)=\"onClear()\"\n                    priority=\"link\"\n                >\n                </s-button>\n            }\n        </div>\n    </div>\n} @else {\n    <div class=\"ui-g horizontal-radio-buttons-container\">\n        <ng-template\n            *ngTemplateOutlet=\"\n                radioButtonRender;\n                context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\n            \"\n        />\n\n        <ng-template\n            *ngTemplateOutlet=\"\n                radioButtonRender;\n                context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\n            \"\n        />\n\n        <ng-template\n            *ngTemplateOutlet=\"\n                radioButtonRender;\n                context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\n            \"\n        />\n\n        @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\n            <s-button\n                style=\"margin-left: 40px\"\n                [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\n                (clicked)=\"onClear()\"\n                priority=\"link\"\n            >\n            </s-button>\n        }\n    </div>\n}\n\n", styles: [".horizontal-radio-buttons-container{gap:20px 40px;.radio-button-item{margin:0}}\n"] }]
        }] });
//# sourceMappingURL=data:application/json;base64, 