import { Component, Input } from '@angular/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { RadioGroupComponent } from './radio-group/radio-group.component';
export class RadioComponent {
    constructor(group) {
        this.group = group;
    }
    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.decorators = [
    { type: Component, args: [{
                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:all .5s ease-in}.transition-fast{transition:all .2s ease-in}:host-context(ui-radio-group-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-context(ui-radio-group-input-layout)>label{flex:1;cursor:pointer;display:flex;align-items:center;padding:var(--field-padding)}:host-context(ui-radio-group-input-layout)>label input+span{flex:1;padding:3px 29px 3px 0}:host-context(ui-radio-group-input-layout)>label input+span:before{top:50%;right:0;left:auto;transform:translateY(-50%)}:host-context(ui-radio-group-input-layout)>label input:checked+span:before,:host-context(ui-radio-group-input-layout)>label input:not(:checked)+span:before{border-radius:50%}:host-context(ui-radio-group-input-layout)>label input:checked+span:after,:host-context(ui-radio-group-input-layout)>label input:not(:checked)+span:after{right:6px;left:auto;top:50%;transform:translateY(-50%)}@media not all and (pointer:coarse){:host-context(ui-radio-group-input-layout):hover{--field-bg:var(--field-bg-hover)}}:host-context(ui-radio-group-right){display:flex;flex-flow:column;justify-content:center}:host-context(ui-radio-group-right)>label{flex:1;cursor:pointer;display:flex;align-items:center}:host-context(ui-radio-group-right)>label input+span{flex:1;padding:3px 29px 3px 0}:host-context(ui-radio-group-right)>label input+span:before{top:50%;right:0;left:auto;transform:translateY(-50%)}:host-context(ui-radio-group-right)>label input:checked+span:before,:host-context(ui-radio-group-right)>label input:not(:checked)+span:before{border-radius:50%}:host-context(ui-radio-group-right)>label input:checked+span:after,:host-context(ui-radio-group-right)>label input:not(:checked)+span:after{right:6px;left:auto;top:50%;transform:translateY(-50%)}:host{display:block;padding:0 0 15px;line-height:1.3}input:checked,input:not(:checked){position:absolute;width:20px;height:20px;opacity:.00001}input:checked+span,input:not(:checked)+span{display:block;position:relative;cursor:pointer;padding:3px 0 3px 29px;-webkit-user-select:none;-moz-user-select:none;user-select:none}input:checked+span:before,input:not(:checked)+span:before{content:\"\";position:absolute;left:0;top:2px;width:20px;height:20px;border:var(--checkRadioBorderWidth) solid var(--checkRadioBorderColor);background:var(--checkRadioBackground);box-shadow:var(--checkRadioShadow);transition:all .2s}input:checked+span:after,input:not(:checked)+span:after{content:\"\";position:absolute;transition:all .2s}input:focus+span:before{border-color:var(--checkRadioBorderColorFocus)}input:focus:not(:focus-visible)+span:before{border-color:var(--checkRadioBorderColor);box-shadow:none!important}input:hover+span:before{border-color:var(--checkRadioBorderColorHover)}input:checked+span:before,input:not(:checked)+span:before{border-radius:50%}input:checked+span:after,input:not(:checked)+span:after{left:6px;top:8px;width:8px;height:8px;border-radius:50%;background:var(--color-primary-contrast)}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:checked:focus+span:before{border-color:var(--checkRadioBorderColorFocus);box-shadow:0 0 0 6px var(--color-contrast-5)}input:disabled:checked+span,input:disabled:not(:checked)+span{color:var(--checkRadioLabelDisabled);cursor:default}input:disabled:checked+span:before,input:disabled:not(:checked)+span:before{border-color:var(--checkRadioBackgroundDisabled);background:var(--checkRadioBackgroundDisabled)}input:disabled:checked+span:after{color:var(--checkRadioMarkColorDisabled)}input:disabled+span{color:var(--checkRadioLabelDisabled)}input.invalid+span:before{border-color:var(--color-error)}"]
            },] }
];
RadioComponent.ctorParameters = () => [
    { type: RadioGroupComponent }
];
RadioComponent.propDecorators = {
    value: [{ type: Input }],
    alignRight: [{ type: Input }],
    setDisabled: [{ type: Input, args: ['disabled',] }]
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmFkaW8uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vdWkta2l0L3NyYy9saWIvZm9ybS9yYWRpby9yYWRpby5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFDLFNBQVMsRUFBRSxLQUFLLEVBQVMsTUFBTSxlQUFlLENBQUM7QUFDdkQsT0FBTyxFQUFDLHFCQUFxQixFQUFDLE1BQU0sdUJBQXVCLENBQUM7QUFDNUQsT0FBTyxFQUFDLG1CQUFtQixFQUFDLE1BQU0scUNBQXFDLENBQUM7QUFReEUsTUFBTSxPQUFPLGNBQWM7SUFVekIsWUFBbUIsS0FBMEI7UUFBMUIsVUFBSyxHQUFMLEtBQUssQ0FBcUI7SUFDN0MsQ0FBQztJQUxELElBQXVCLFdBQVcsQ0FBQyxLQUFjO1FBQy9DLElBQUksQ0FBQyxRQUFRLEdBQUcscUJBQXFCLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDL0MsQ0FBQztJQUtELFFBQVE7SUFDUixDQUFDO0lBRUQsSUFBSSxZQUFZOztRQUNkLE9BQU8sSUFBSSxDQUFDLFFBQVEsS0FBSSxNQUFBLElBQUksQ0FBQyxLQUFLLDBDQUFFLFFBQVEsQ0FBQSxDQUFDO0lBQy9DLENBQUM7SUFFRCxXQUFXO1FBQ1QsSUFBSSxDQUFDLEtBQUssQ0FBQyxXQUFXLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDO0l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