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();\r\n<ng-template\r\n    #radioButtonRender\r\n    let-value=\"value\"\r\n    let-label=\"label\"\r\n    let-inputIdAppend=\"inputIdAppend\"\r\n>\r\n    @if (label) {\r\n        @let inputId = (_field.id || _field.name) + inputIdAppend;\r\n        <s-radiobutton\r\n            [name]=\"_field.name\"\r\n            [value]=\"value\"\r\n            [formControl]=\"formControl()\"\r\n            [inputId]=\"inputId\"\r\n            [label]=\"label\"\r\n            (focusedInput)=\"_field.onFocus ? _field.onFocus($event) : null\"\r\n            (inputFocusLost)=\"_field.onBlur ? _field.onBlur($event) : null\"\r\n        />\r\n    }\r\n</ng-template>\r\n\r\n<s-field-label [field]=\"_field\"></s-field-label>\r\n\r\n@if (_field.verticalAlignment) {\r\n    <div class=\"flex flex-col gap-2\">\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\r\n            \"\r\n        />\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\r\n            \"\r\n        />\r\n        @if (!_field.showClear && !!_field.required && !_field.required()) {\r\n            <ng-template\r\n                *ngTemplateOutlet=\"\r\n                    radioButtonRender;\r\n                    context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\r\n                \"\r\n            />\r\n        }\r\n        <div>\r\n            @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\r\n                <s-button\r\n                    [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\r\n                    (clicked)=\"onClear()\"\r\n                    priority=\"link\"\r\n                >\r\n                </s-button>\r\n            }\r\n        </div>\r\n    </div>\r\n} @else {\r\n    <div class=\"horizontal-radio-buttons-container flex flex-wrap gap-2\">\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\r\n            \"\r\n        />\r\n\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\r\n            \"\r\n        />\r\n\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\r\n            \"\r\n        />\r\n\r\n        @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\r\n            <s-button\r\n                [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\r\n                (clicked)=\"onClear()\"\r\n                priority=\"link\"\r\n            >\r\n            </s-button>\r\n        }\r\n    </div>\r\n}\r\n", styles: [".horizontal-radio-buttons-container{gap:20px 40px;align-items:center;.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", "ariaLabel"], 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();\r\n<ng-template\r\n    #radioButtonRender\r\n    let-value=\"value\"\r\n    let-label=\"label\"\r\n    let-inputIdAppend=\"inputIdAppend\"\r\n>\r\n    @if (label) {\r\n        @let inputId = (_field.id || _field.name) + inputIdAppend;\r\n        <s-radiobutton\r\n            [name]=\"_field.name\"\r\n            [value]=\"value\"\r\n            [formControl]=\"formControl()\"\r\n            [inputId]=\"inputId\"\r\n            [label]=\"label\"\r\n            (focusedInput)=\"_field.onFocus ? _field.onFocus($event) : null\"\r\n            (inputFocusLost)=\"_field.onBlur ? _field.onBlur($event) : null\"\r\n        />\r\n    }\r\n</ng-template>\r\n\r\n<s-field-label [field]=\"_field\"></s-field-label>\r\n\r\n@if (_field.verticalAlignment) {\r\n    <div class=\"flex flex-col gap-2\">\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\r\n            \"\r\n        />\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\r\n            \"\r\n        />\r\n        @if (!_field.showClear && !!_field.required && !_field.required()) {\r\n            <ng-template\r\n                *ngTemplateOutlet=\"\r\n                    radioButtonRender;\r\n                    context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\r\n                \"\r\n            />\r\n        }\r\n        <div>\r\n            @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\r\n                <s-button\r\n                    [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\r\n                    (clicked)=\"onClear()\"\r\n                    priority=\"link\"\r\n                >\r\n                </s-button>\r\n            }\r\n        </div>\r\n    </div>\r\n} @else {\r\n    <div class=\"horizontal-radio-buttons-container flex flex-wrap gap-2\">\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: true, label: _field.optionsLabel.true, inputIdAppend: '-1' }\r\n            \"\r\n        />\r\n\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: false, label: _field.optionsLabel.false, inputIdAppend: '-2' }\r\n            \"\r\n        />\r\n\r\n        <ng-template\r\n            *ngTemplateOutlet=\"\r\n                radioButtonRender;\r\n                context: { value: null, label: _field.optionsLabel.empty, inputIdAppend: '-3' }\r\n            \"\r\n        />\r\n\r\n        @if (_field.showClear && !_field.required?.() && !formControl().disabled) {\r\n            <s-button\r\n                [label]=\"_field.optionsLabel.clear || 'Clear selection'\"\r\n                (clicked)=\"onClear()\"\r\n                priority=\"link\"\r\n            >\r\n            </s-button>\r\n        }\r\n    </div>\r\n}\r\n", styles: [".horizontal-radio-buttons-container{gap:20px 40px;align-items:center;.radio-button-item{margin:0}}\n"] }]
        }] });
//# sourceMappingURL=data:application/json;base64, 