import { Component, forwardRef, Input } from '@angular/core';
import { EvoBaseControl } from '../../../common/evo-base-control';
import { NG_VALUE_ACCESSOR } from '@angular/forms';
import { isEqual } from 'lodash-es';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
export class EvoRadioshapeComponent extends EvoBaseControl {
    constructor() {
        super(...arguments);
        this.name = Math.random();
        this.onChange = (_) => { };
        this.onTouch = () => { };
    }
    get checked() {
        return this.control ? isEqual(this.control.value, this.value) || this.forceChecked : this.forceChecked;
    }
    handleOnChange() {
        this.onChange(this.value);
    }
    registerOnChange(fn) {
        this.onChange = fn;
    }
    registerOnTouched(fn) {
        this.onTouch = fn;
    }
    setDisabledState(isDisabled) {
        this.disabled = isDisabled;
    }
    writeValue(obj) {
    }
}
EvoRadioshapeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EvoRadioshapeComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
EvoRadioshapeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: EvoRadioshapeComponent, selector: "evo-radioshape", inputs: { forceChecked: "forceChecked", value: "value", name: "name" }, providers: [
        {
            provide: NG_VALUE_ACCESSOR,
            useExisting: forwardRef(() => EvoRadioshapeComponent),
            multi: true,
        },
    ], usesInheritance: true, ngImport: i0, template: "<div class=\"evo-radioshape\" [ngClass]=\"{'evo-radioshape_checked': checked, 'evo-radioshape_disabled': disabled}\">\n    <label class=\"evo-radioshape__label\" *ngIf=\"value || forceChecked\">\n        <input class=\"evo-radioshape__input\"\n               type=\"radio\"\n               (change)=\"handleOnChange()\"\n               [name]=\"name\"\n               [value]=\"value\"\n               [checked]=\"checked\"\n               [disabled]=\"disabled\">\n        <span class=\"evo-radioshape__control\"></span>\n    </label>\n    <div class=\"evo-radioshape__content\">\n        <ng-content></ng-content>\n    </div>\n</div>\n", styles: [".evo-radioshape{display:flex;align-items:center;width:100%;padding:24px;background-color:#f4f6f8;border-radius:8px;transition:background-color .2s,box-shadow .2s,opacity .2s}.evo-radioshape_checked{background-color:#fff;box-shadow:inset 0 0 0 2px #21c68b}.evo-radioshape_disabled{opacity:.5}.evo-radioshape__label{display:table;flex-shrink:0;margin:0 16px 0 0;border-radius:50%}.evo-radioshape__content{flex:1}.evo-radioshape__control{position:relative;display:block;width:20px;height:20px;padding:4px;background-color:#fff;border:2px solid #C6C6C6;border-radius:50%;cursor:pointer}.evo-radioshape__control:before{position:absolute;top:50%;left:50%;display:none;box-sizing:border-box;width:10px;height:10px;margin-top:-5px;margin-left:-5px;background-color:#0986e2;border-radius:50%;content:\"\"}.evo-radioshape__input{display:none}.evo-radioshape__input[disabled]~.evo-radioshape__control{background-color:#f4f6f8;cursor:not-allowed}.evo-radioshape__input:checked[disabled]~.evo-radioshape__control{background-color:#fff}.evo-radioshape__input:checked[disabled]~.evo-radioshape__control:before{background-color:#c6c6c6}.evo-radioshape__input:checked~.evo-radioshape__control:before{display:block}\n"], directives: [{ type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: EvoRadioshapeComponent, decorators: [{
            type: Component,
            args: [{ selector: 'evo-radioshape', providers: [
                        {
                            provide: NG_VALUE_ACCESSOR,
                            useExisting: forwardRef(() => EvoRadioshapeComponent),
                            multi: true,
                        },
                    ], template: "<div class=\"evo-radioshape\" [ngClass]=\"{'evo-radioshape_checked': checked, 'evo-radioshape_disabled': disabled}\">\n    <label class=\"evo-radioshape__label\" *ngIf=\"value || forceChecked\">\n        <input class=\"evo-radioshape__input\"\n               type=\"radio\"\n               (change)=\"handleOnChange()\"\n               [name]=\"name\"\n               [value]=\"value\"\n               [checked]=\"checked\"\n               [disabled]=\"disabled\">\n        <span class=\"evo-radioshape__control\"></span>\n    </label>\n    <div class=\"evo-radioshape__content\">\n        <ng-content></ng-content>\n    </div>\n</div>\n", styles: [".evo-radioshape{display:flex;align-items:center;width:100%;padding:24px;background-color:#f4f6f8;border-radius:8px;transition:background-color .2s,box-shadow .2s,opacity .2s}.evo-radioshape_checked{background-color:#fff;box-shadow:inset 0 0 0 2px #21c68b}.evo-radioshape_disabled{opacity:.5}.evo-radioshape__label{display:table;flex-shrink:0;margin:0 16px 0 0;border-radius:50%}.evo-radioshape__content{flex:1}.evo-radioshape__control{position:relative;display:block;width:20px;height:20px;padding:4px;background-color:#fff;border:2px solid #C6C6C6;border-radius:50%;cursor:pointer}.evo-radioshape__control:before{position:absolute;top:50%;left:50%;display:none;box-sizing:border-box;width:10px;height:10px;margin-top:-5px;margin-left:-5px;background-color:#0986e2;border-radius:50%;content:\"\"}.evo-radioshape__input{display:none}.evo-radioshape__input[disabled]~.evo-radioshape__control{background-color:#f4f6f8;cursor:not-allowed}.evo-radioshape__input:checked[disabled]~.evo-radioshape__control{background-color:#fff}.evo-radioshape__input:checked[disabled]~.evo-radioshape__control:before{background-color:#c6c6c6}.evo-radioshape__input:checked~.evo-radioshape__control:before{display:block}\n"] }]
        }], propDecorators: { forceChecked: [{
                type: Input
            }], value: [{
                type: Input
            }], name: [{
                type: Input
            }] } });
//# sourceMappingURL=data:application/json;base64, 