import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './chunk-8105bee0.js';

class RadioGroup {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.change = createEvent(this, "change", 7);
    }
    componentDidLoad() {
        const isRadioChecked = this.host.querySelector('materials-radio[checked]');
        this.value = isRadioChecked ? isRadioChecked.value : null;
        this.materialsRadioNodes = Array.from(this.host.querySelectorAll('materials-radio'));
        this.materialsRadioNodes.forEach((radioEl) => {
            radioEl.addEventListener('change', (value) => this.handleEvent(value));
        });
    }
    handleEvent(event) {
        event.stopPropagation();
        this.value = event.detail;
        this.cleanNeighbors(this.value);
        this.change.emit(this.value);
    }
    cleanNeighbors(except) {
        this.materialsRadioNodes.filter(el => !except || el.value !== except).forEach(el => el.checked = false);
    }
    render() {
        return (h(Host, { class: { 'linebreak': this.linebreak } }, this.label && h("span", null, this.label), h("slot", null)));
    }
    get host() { return getElement(this); }
    static get style() { return ":host linebreak{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}"; }
}

export { RadioGroup as materials_radio_group };
