import { __decorate } from "tslib";
import { Component, HostBinding, Input } from '@angular/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { RadioGroupComponent } from './radio-group/radio-group.component';
let RadioComponent = class RadioComponent {
    constructor(group) {
        this.group = group;
    }
    set setInputLayout(value) {
        this.inputLayout = coerceBooleanProperty(value);
    }
    set setDisabled(value) {
        this.disabled = coerceBooleanProperty(value);
    }
    ngOnInit() {
    }
    get viewDisabled() {
        var _a;
        return this.disabled || ((_a = this.group) === null || _a === void 0 ? void 0 : _a.disabled);
    }
    updateValue() {
        this.group.updateValue(this.value);
    }
};
RadioComponent.ctorParameters = () => [
    { type: RadioGroupComponent }
];
__decorate([
    Input()
], RadioComponent.prototype, "value", void 0);
__decorate([
    HostBinding('class.input-layout')
], RadioComponent.prototype, "inputLayout", void 0);
__decorate([
    Input('inputLayout')
], RadioComponent.prototype, "setInputLayout", null);
__decorate([
    Input('disabled')
], RadioComponent.prototype, "setDisabled", null);
RadioComponent = __decorate([
    Component({
        selector: 'ui-radio',
        template: "<label>\n  <input type=\"radio\"\n         [ngModel]=\"group.value\"\n         (ngModelChange)=\"updateValue()\"\n         [value]=\"value\"\n         [name]=\"group.name\"\n         [disabled]=\"viewDisabled\">\n  <span>\n    <ng-content></ng-content>\n  </span>\n</label>\n",
        styles: [".transition{transition:.5s ease-in}.transition-fast{transition:.2s ease-in}:host{display:block;padding:0 0 15px;line-height:1.3}:host.input-layout{display:flex;flex-flow:column;justify-content:center;min-height:var(--field-height);padding:0;background:var(--field-bg);box-sizing:border-box;border-radius:var(--radius-regular);transition:background .2s ease-in-out}:host.input-layout>label{flex:1;cursor:pointer;display:flex;align-items:center;padding:var(--field-padding)}:host.input-layout>label input+span{flex:1;padding:3px 36px 3px 0}:host.input-layout>label input+span:before{right:0;left:auto}:host.input-layout>label input:checked+span:before,:host.input-layout>label input:not(:checked)+span:before{border-radius:50%}:host.input-layout>label input:checked+span:after,:host.input-layout>label input:not(:checked)+span:after{right:7px;left:auto}@media not all and (pointer:coarse){:host.input-layout:hover{--field-bg:var(--field-bg-hover)}}input:checked,input:not(:checked){position:absolute;left:-9999px}input:checked+span,input:not(:checked)+span{display:block;position:relative;cursor:pointer;padding:3px 0 3px 36px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}input:checked+span:before,input:not(:checked)+span:before{content:\"\";position:absolute;left:0;top:0;width:24px;height:24px;border:var(--checkRadioBorderWidth) solid var(--checkRadioBorderColor);background:var(--checkRadioBackground);box-shadow:var(--checkRadioShadow);transition:.2s;border-radius:50%}input:checked+span:after,input:not(:checked)+span:after{content:\"\";position:absolute;transition:.2s;left:7px;top:7px;width:10px;height:10px;border-radius:50%;background:var(--color-primary-contrast)}input:checked+span:hover:before,input:not(:checked)+span:hover:before{border-color:var(--checkRadioBorderColor)}input:not(:checked)+span:after{opacity:0;transform:scale(0)}input:checked+span:after{opacity:1;transform:scale(1)}input:checked+span:before{background:var(--color-primary);border-color:var(--color-primary)}input:disabled+span,input:disabled:checked+span,input:disabled:not(:checked)+span{color:var(--checkRadioLabelDisabled)}input:disabled:checked+span:before,input:disabled:not(:checked)+span:before{box-shadow:none;border-color:var(--checkRadioBackgroundDisabled);background:var(--checkRadioBackgroundDisabled)}input:disabled:checked+span:after{color:var(--checkRadioMarkColorDisabled)}input:checked:focus+span:before,input:not(:checked):focus+span:before{box-shadow:0 0 0 2px var(--checkRadioBorderColorFocus)}input.invalid+span:before{border-color:var(--color-error)}.error{font-size:.875rem;color:var(--color-error);padding-left:35px}"]
    })
], RadioComponent);
export { RadioComponent };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFkaW8uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGNiZGV2L3VpLWtpdC8iLCJzb3VyY2VzIjpbImxpYi9mb3JtL3JhZGlvL3JhZGlvLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxF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