'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const __chunk_1 = require('./chunk-78439bef.js');

class ListItemCheckbox {
    constructor(hostRef) {
        __chunk_1.registerInstance(this, hostRef);
        this.disabled = false;
        /**
         * Coupe le text par defaut.
         */
        this.textWrap = false;
        this.change = __chunk_1.createEvent(this, "change", 7);
    }
    componentDidLoad() {
        this.materialsCheckbox = this.host.shadowRoot.querySelector('materials-checkbox');
        this.checkboxInput = this.materialsCheckbox.shadowRoot.querySelector('.mdc-checkbox__native-control');
    }
    toggleCheckbox() {
        if (!this.disabled) {
            this.checked = !this.checked;
            this.checkboxInput.checked = this.checked;
            this.change.emit(this.checked);
        }
    }
    render() {
        return (__chunk_1.h("materials-list-item", { disabled: this.disabled, onClick: () => this.toggleCheckbox(), itemEndStyle: this.itemEndStyle, itemStartStyle: this.itemStartStyle, noPadding: this.noPadding, size: this.size }, __chunk_1.h("materials-checkbox", { slot: "item-start", id: "materials-checkbox", color: this.color, value: this.value, checked: this.checked, disabled: this.disabled, onChange: (e) => {
                e.preventDefault();
                e.stopPropagation();
            } }), __chunk_1.h("label", { class: { 'mdc-typography': true, 'gmv-label-nowrap': !this.textWrap }, title: this.label }, this.label), __chunk_1.h("div", { slot: "item-start" }, __chunk_1.h("slot", { name: "item-start" })), __chunk_1.h("div", { slot: "item-end" }, __chunk_1.h("slot", { name: "item-end" }))));
    }
    get host() { return __chunk_1.getElement(this); }
    static get style() { return ":host .gmv-label-nowrap{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}"; }
}

exports.materials_list_item_checkbox = ListItemCheckbox;
