import { h } from "@stencil/core";
export class SpwLink {
    constructor() {
        /** Attribut target (détermine où ouvrir le lien) */
        this.target = '_self';
        /** Position de l'icône à l'intérieur du lien (gauche ou droite) */
        this.iconPosition = 'right';
        /** Si désactivé, le lien n'est pas cliquable */
        this.disabled = false;
        /** Permet de choisir la surface d'arrière-plan du lien */
        this.surface = 'light';
        this.onClick = (ev) => {
            if (this.disabled) {
                ev.preventDefault();
                return;
            }
            this.spwClick.emit(ev);
        };
    }
    get elementClass() {
        return {
            'spw-link': true,
            'spw-link--has-icon-right': this.icon && this.iconPosition === 'right',
            'spw-link--has-icon-left': this.icon && this.iconPosition === 'left',
            [`spw-link--surface-${this.surface}`]: true,
            'spw-link--has-icon': !!this.icon,
        };
    }
    render() {
        const { href, rel, download, target, icon, iconPosition, accAriaLabel, disabled } = this;
        const ariaAttributes = {
            'aria-label': accAriaLabel,
            'aria-disabled': disabled ? 'true' : null,
        };
        const iconClass = `spw-icon--${iconPosition}`;
        const iconElement = icon ? h("spw-icon", { class: iconClass, icon: icon }) : null;
        return (h("a", Object.assign({ key: '32378b05b827025261ac14fabf52d5d03539f52a', href: disabled ? undefined : href, rel: rel, download: download, target: target, class: this.elementClass, onClick: this.onClick }, ariaAttributes), iconPosition === 'left' && iconElement, h("div", { key: 'e522dcbaecc16fb7c901bfd32587b19192148613', class: "spw-link__inner" }, h("slot", { key: '702b2c9d307fd53dd60dbf197c9cced7892455ba' })), iconPosition === 'right' && iconElement));
    }
    static get is() { return "spw-link"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["spw-link.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["spw-link.css"]
        };
    }
    static get properties() {
        return {
            "href": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Sp\u00E9cifie le lien href"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "href"
            },
            "target": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Attribut target (d\u00E9termine o\u00F9 ouvrir le lien)"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "target",
                "defaultValue": "'_self'"
            },
            "rel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Remplit l'attribut rel"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "rel"
            },
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Si rempli, permet d'utiliser une r\u00E9f\u00E9rence d'ic\u00F4ne font-awesome"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "icon"
            },
            "download": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Permet de t\u00E9l\u00E9charger un fichier au lieu de naviguer vers le lien"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "download"
            },
            "iconPosition": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'left' | 'right'",
                    "resolved": "\"left\" | \"right\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Position de l'ic\u00F4ne \u00E0 l'int\u00E9rieur du lien (gauche ou droite)"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "icon-position",
                "defaultValue": "'right'"
            },
            "disabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Si d\u00E9sactiv\u00E9, le lien n'est pas cliquable"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "disabled",
                "defaultValue": "false"
            },
            "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"
            },
            "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 lien"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "surface",
                "defaultValue": "'light'"
            }
        };
    }
    static get events() {
        return [{
                "method": "spwClick",
                "name": "spwClick",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "\u00C9v\u00E9nement d\u00E9clench\u00E9 lors du clic sur le lien"
                },
                "complexType": {
                    "original": "MouseEvent",
                    "resolved": "MouseEvent",
                    "references": {
                        "MouseEvent": {
                            "location": "global",
                            "id": "global::MouseEvent"
                        }
                    }
                }
            }];
    }
    static get elementRef() { return "el"; }
}
