import { Host, h } from "@stencil/core";
export class SpwLightboxItem {
    constructor() {
        /** Texte alternatif de l'image */
        this.alt = '';
        /** Icône Font Awesome du copyright */
        this.copyrightIcon = 'fa-copyright';
        /** Permet de spécifier une variante de Font Awesome pour l'icône de copyright */
        this.copyrightIconVariant = 'fa-light';
        /** Target du lien du copyright */
        this.copyrightTarget = '_blank';
        /** Texte du label aria du bouton déclencheur */
        this.textOpenImage = "Ouvrir l'image";
        /** Affiche une icône de loupe en superposition au survol */
        this.isHover = true;
        /** Icône affichée au survol de l'image (référence Font Awesome) */
        this.hoverIcon = 'fa-magnifying-glass';
    }
    getIndex() {
        const parent = this.hostElement.closest('spw-lightbox');
        if (!parent)
            return 0;
        const siblings = Array.from(parent.querySelectorAll('spw-lightbox-item'));
        return siblings.indexOf(this.hostElement);
    }
    handleClick() {
        this.spwLightboxItemClick.emit({
            src: this.src,
            alt: this.alt,
            captionTitle: this.captionTitle || '',
            captionText: this.captionText || '',
            index: this.getIndex(),
        });
    }
    handleKeydown(event) {
        if (event.key === 'Enter' || event.key === ' ') {
            event.preventDefault();
            this.handleClick();
        }
    }
    render() {
        return (h(Host, { key: 'e0a1b9ba9e2a4c33e939eb44ad70d5b9474b7f98' }, h("div", { key: '8fa6be30d88c4ad0985b21699eca9b1733c95002', class: { 'spw-lightbox-item__wrapper': true, 'spw-lightbox-item__wrapper--hoverable': this.isHover }, role: "button", tabindex: "0", "aria-label": this.alt || this.textOpenImage, onClick: () => this.handleClick(), onKeyDown: (e) => this.handleKeydown(e) }, h("slot", { key: '780cc51e40ecd7509c618a3610168f9742f274ef' }, h("img", { key: '230ce5be541a1bb669576f3fab40bda4332cb16f', class: "spw-lightbox-item__img", src: this.src, alt: this.alt, loading: "lazy" })), this.isHover && (h("div", { key: '7b02bc0d790df3f55a31ec9cb51cdd47241ba17f', class: "spw-lightbox-item__hover-overlay" }, h("spw-icon", { key: '8a3398b30350959fedc6babd7d36cf102e7c31be', icon: this.hoverIcon }))))));
    }
    static get is() { return "spw-lightbox-item"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["spw-lightbox-item.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["spw-lightbox-item.css"]
        };
    }
    static get properties() {
        return {
            "src": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "URL de l'image \u00E0 afficher dans la lightbox"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "src"
            },
            "alt": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Texte alternatif de l'image"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "alt",
                "defaultValue": "''"
            },
            "captionTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Titre de la l\u00E9gende affich\u00E9e en superposition de l'image"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "caption-title"
            },
            "captionText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Texte de la l\u00E9gende affich\u00E9e en superposition de l'image"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "caption-text"
            },
            "copyrightText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Texte du copyright \u00E0 afficher sur l'image"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "copyright-text"
            },
            "copyrightIcon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Ic\u00F4ne Font Awesome du copyright"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "copyright-icon",
                "defaultValue": "'fa-copyright'"
            },
            "copyrightIconVariant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'fa-solid' | 'fa-brands' | 'fa-regular' | 'fa-light'",
                    "resolved": "\"fa-brands\" | \"fa-light\" | \"fa-regular\" | \"fa-solid\"",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Permet de sp\u00E9cifier une variante de Font Awesome pour l'ic\u00F4ne de copyright"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "copyright-icon-variant",
                "defaultValue": "'fa-light'"
            },
            "copyrightHref": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Lien du copyright"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "copyright-href"
            },
            "copyrightTarget": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Target du lien du copyright"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "copyright-target",
                "defaultValue": "'_blank'"
            },
            "textOpenImage": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Texte du label aria du bouton d\u00E9clencheur"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "text-open-image",
                "defaultValue": "\"Ouvrir l'image\""
            },
            "isHover": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Affiche une ic\u00F4ne de loupe en superposition au survol"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "is-hover",
                "defaultValue": "true"
            },
            "hoverIcon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Ic\u00F4ne affich\u00E9e au survol de l'image (r\u00E9f\u00E9rence Font Awesome)"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "hover-icon",
                "defaultValue": "'fa-magnifying-glass'"
            }
        };
    }
    static get events() {
        return [{
                "method": "spwLightboxItemClick",
                "name": "spwLightboxItemClick",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "complexType": {
                    "original": "{ src: string; alt: string; captionTitle: string; captionText: string; index: number }",
                    "resolved": "{ src: string; alt: string; captionTitle: string; captionText: string; index: number; }",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "hostElement"; }
}
