import { Host, h } from "@stencil/core";
export class SpwBreadcrumb {
    constructor() {
        /** Permet de limiter le breadcrumb à x éléments visibles */
        this.maxItems = 9999;
        /** Permet de sélectionner la variante de breadcrumb */
        this.variant = 'default';
        /** Permet de choisir la surface d'arrière-plan du breadcrumb */
        this.surface = 'light';
        /** Permet de déterminer la font-size des éléments de breadcrumb */
        this.fontSize = 'small';
    }
    componentDidLoad() {
        this.updateBreadcrumbVisibility();
    }
    componentDidUpdate() {
        this.updateBreadcrumbVisibility();
    }
    updateBreadcrumbVisibility() {
        const items = this.host.querySelectorAll('spw-breadcrumb-item');
        const totalItems = items.length;
        items.forEach(item => {
            item.classList.remove('hidden-item', 'collapsed-item');
        });
        if (totalItems > this.maxItems) {
            const visibleAtStart = this.maxItems - 1;
            items.forEach((item, index) => {
                if (index >= visibleAtStart && index < totalItems - 1) {
                    if (index === totalItems - 2) {
                        item.classList.add('collapsed-item');
                    }
                    else {
                        item.classList.add('hidden-item');
                    }
                }
            });
        }
    }
    render() {
        const elementClass = {
            'spw-breadcrumb': true,
            [`spw-breadcrumb--surface-${this.surface}`]: true,
            [`spw-breadcrumb--font-size-${this.fontSize}`]: true,
            [`spw-breadcrumb--${this.variant}`]: true,
        };
        return (h(Host, { key: '72cd3232357b54b5fa081df2c605ea039b791fd7' }, h("nav", { key: '214606d2a4d13a2d629d9d88aa8a5182be5006c3', "aria-label": this.accAriaLabel, class: elementClass }, h("div", { key: '4ea1cedcd9fcd650e8198c1d613959bbee9f155e', role: "list", class: "spw-breadcrumb__list" }, h("slot", { key: '8cc4da01764ace42c2de886f453e3c322c2f0483' })))));
    }
    static get is() { return "spw-breadcrumb"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["spw-breadcrumb.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["spw-breadcrumb.css"]
        };
    }
    static get properties() {
        return {
            "variant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'multiline' | 'one-line' | 'default'",
                    "resolved": "\"default\" | \"multiline\" | \"one-line\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Permet de s\u00E9lectionner la variante de breadcrumb"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "variant",
                "defaultValue": "'default'"
            },
            "surface": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'light' | 'dark'",
                    "resolved": "\"dark\" | \"light\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Permet de choisir la surface d'arri\u00E8re-plan du breadcrumb"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "surface",
                "defaultValue": "'light'"
            },
            "fontSize": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'small' | 'default'",
                    "resolved": "\"default\" | \"small\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Permet de d\u00E9terminer la font-size des \u00E9l\u00E9ments de breadcrumb"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "font-size",
                "defaultValue": "'small'"
            },
            "accAriaLabel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Remplit l'attribut aria-label, utilis\u00E9 \u00E0 des fins d'accessibilit\u00E9"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "acc-aria-label"
            }
        };
    }
    static get elementRef() { return "host"; }
}
