import { Component, ElementRef, Input, ViewChild } from '@angular/core';
import * as i0 from "@angular/core";
import * as i1 from "../cs-select/cs-select.component";
import * as i2 from "../select.service";
import * as i3 from "../../../ui-kit/tooltip/tooltip.directive";
export class CsOptionComponent {
    constructor(csSelect, select) {
        this.csSelect = csSelect;
        this.select = select;
        this.optionTooltip = '';
        this.value = '';
    }
    ngAfterViewInit() {
        this.select.add({
            name: this.csSelect.name,
            placeholder: this.option.nativeElement.innerHTML,
            value: this.value,
            color: this.color,
        });
    }
    change(event) {
        this.csSelect.writeValue(this.value, true);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CsOptionComponent, deps: [{ token: i1.CsSelectComponent }, { token: i2.SelectService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CsOptionComponent, selector: "cs-option", inputs: { value: "value", color: "color", backgroundColor: "backgroundColor", optionTooltip: "optionTooltip" }, viewQueries: [{ propertyName: "option", first: true, predicate: ["options"], descendants: true, read: ElementRef }], ngImport: i0, template: "<div class=\"list\">\n  <label>\n    <input type=\"radio\" tabindex=\"0\" [value]=\"value\" [name]=\"csSelect.name\" (click)=\"change($event)\" [checked]=\"csSelect.val === value\"  [appTooltip]=\"optionTooltip\" placement=\"bottom-left\" delay=\"0\" [tooltipMandatory]=\"true\" />\n    <span class=\"value\" #options [style.color]=\"color\">\n      <ng-content></ng-content>\n    </span>\n  </label>\n</div>\n", styles: [".list label{line-height:23px;font-size:13px;font-weight:400;border-radius:4px;display:flex;position:relative;margin:0;align-items:center}.list label input[type=radio]{position:absolute;margin:0;height:100%;width:100%;opacity:0;cursor:pointer}.list label input[type=radio]:checked+span,.list label input[type=radio]:hover+span{background:#dcdcdc}.list label span.value{color:#747576;font-size:14px;line-height:21px;font-weight:400;max-width:100%;white-space:nowrap;overflow:hidden;display:block;text-overflow:ellipsis;padding:5px 15px;width:100%;text-transform:none;cursor:pointer;text-align:left}\n"], dependencies: [{ kind: "directive", type: i3.ToolTipDirective, selector: "[appTooltip]", inputs: ["appTooltip", "placement", "type", "tooltipMandatory", "showTooltip", "animate"] }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CsOptionComponent, decorators: [{
            type: Component,
            args: [{ selector: 'cs-option', template: "<div class=\"list\">\n  <label>\n    <input type=\"radio\" tabindex=\"0\" [value]=\"value\" [name]=\"csSelect.name\" (click)=\"change($event)\" [checked]=\"csSelect.val === value\"  [appTooltip]=\"optionTooltip\" placement=\"bottom-left\" delay=\"0\" [tooltipMandatory]=\"true\" />\n    <span class=\"value\" #options [style.color]=\"color\">\n      <ng-content></ng-content>\n    </span>\n  </label>\n</div>\n", styles: [".list label{line-height:23px;font-size:13px;font-weight:400;border-radius:4px;display:flex;position:relative;margin:0;align-items:center}.list label input[type=radio]{position:absolute;margin:0;height:100%;width:100%;opacity:0;cursor:pointer}.list label input[type=radio]:checked+span,.list label input[type=radio]:hover+span{background:#dcdcdc}.list label span.value{color:#747576;font-size:14px;line-height:21px;font-weight:400;max-width:100%;white-space:nowrap;overflow:hidden;display:block;text-overflow:ellipsis;padding:5px 15px;width:100%;text-transform:none;cursor:pointer;text-align:left}\n"] }]
        }], ctorParameters: function () { return [{ type: i1.CsSelectComponent }, { type: i2.SelectService }]; }, propDecorators: { value: [{
                type: Input
            }], color: [{
                type: Input
            }], backgroundColor: [{
                type: Input
            }], optionTooltip: [{
                type: Input
            }], option: [{
                type: ViewChild,
                args: ['options', { read: ElementRef, static: false }]
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3Mtb3B0aW9uLmNvbXBvbmVudC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL3Z4LXdvcmtmbG93LWVuZ2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