import { Host, h } from "@stencil/core";
export class SpwAccordion {
    constructor() {
        /** Couleur de fond appliquée à tous les accordion-item enfants */
        this.background = 'white';
        /** Variant de l'accordéon */
        this.variant = 'default';
    }
    componentDidLoad() {
        this.applyBackgroundToChildren();
        this.applyVariantToChildren();
    }
    backgroundChanged() {
        this.applyBackgroundToChildren();
    }
    variantChanged() {
        this.applyVariantToChildren();
    }
    applyBackgroundToChildren() {
        const accordionItems = this.el.querySelectorAll('spw-accordion-item');
        accordionItems.forEach((item) => {
            if (this.background) {
                item.style.setProperty('--spw-accordion-item-background', this.background);
            }
            else {
                item.style.removeProperty('--spw-accordion-item-background');
            }
        });
    }
    applyVariantToChildren() {
        const accordionItems = this.el.querySelectorAll('spw-accordion-item');
        accordionItems.forEach((item) => {
            item.variant = this.variant;
        });
    }
    render() {
        return (h(Host, { key: '843b0bffbfb004440ddae3d36948d4473d6228d3' }, h("div", { key: '7b8388a01b29c3e4a3958d0609c48943de6aee6b', class: "spw-accordion" }, h("slot", { key: '00086c16ea6c0cf3dcd15ceae433d5d8645e00de' }))));
    }
    static get is() { return "spw-accordion"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["spw-accordion.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["spw-accordion.css"]
        };
    }
    static get properties() {
        return {
            "background": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Couleur de fond appliqu\u00E9e \u00E0 tous les accordion-item enfants"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "background",
                "defaultValue": "'white'"
            },
            "variant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'default' | 'separated'",
                    "resolved": "\"default\" | \"separated\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Variant de l'accord\u00E9on"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "variant",
                "defaultValue": "'default'"
            }
        };
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "background",
                "methodName": "backgroundChanged"
            }, {
                "propName": "variant",
                "methodName": "variantChanged"
            }];
    }
}
