import { Host, h } from "@stencil/core";
export class SpwFieldLabel {
    constructor() {
        /** Texte à afficher au-dessus du champ de saisie */
        this.label = '';
        /** Indique si le champ est requis */
        this.required = false;
        /** Positionnement du tooltip */
        this.tooltipDirection = 'top';
        /** Curseur du tooltip */
        this.tooltipCursor = 'help';
        this.handleClick = () => {
            const rootNode = this.el.getRootNode();
            const targetElement = rootNode.getElementById(this.name);
            if (targetElement) {
                targetElement.focus();
            }
        };
    }
    get hasTooltip() {
        return !!(this.tooltipText || this.tooltipTitle);
    }
    render() {
        return (h(Host, { key: 'cb454d092cd78fb71bf1167a4e387ad9fd416d69' }, h("label", { key: '641218aa7a026e9dd5805d51926b88ae94692926', class: "spw-field-label", htmlFor: this.name, onClick: this.handleClick }, h("span", { key: '53de42be7abcc40b2418489bc13bcd449dcb342f', class: "spw-field-label__text" }, this.label), this.hasTooltip && (h("spw-tooltip", { key: 'c1f0fdbb0e3742a3f303846b89078a727d69bc04', tooltipTitle: this.tooltipTitle, tooltipText: this.tooltipText, maxWidth: this.tooltipMaxWidth, direction: this.tooltipDirection, cursor: this.tooltipCursor }, h("spw-icon", { key: '01b65ea5af7cbf012902ee0b9d50bede9451d0aa', variant: "fa-regular", icon: "fa-circle-info", class: "spw-field-label__icon" }))), this.required && h("span", { key: '5eb8fd2d808a54133da51de5eaa7f7277d08c393', class: "spw-field-label__required" }, "*"))));
    }
    static get is() { return "spw-field-label"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["spw-field-label.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["spw-field-label.css"]
        };
    }
    static get properties() {
        return {
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "L'attribut id de l'\u00E9l\u00E9ment input"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "name"
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Texte \u00E0 afficher au-dessus du champ de saisie"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "label",
                "defaultValue": "''"
            },
            "required": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Indique si le champ est requis"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "required",
                "defaultValue": "false"
            },
            "tooltipTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Titre du tooltip"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "tooltip-title"
            },
            "tooltipText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Texte du tooltip"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "tooltip-text"
            },
            "tooltipMaxWidth": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Largeur maximale du tooltip"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "tooltip-max-width"
            },
            "tooltipDirection": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'top' | 'bottom' | 'left' | 'right'",
                    "resolved": "\"bottom\" | \"left\" | \"right\" | \"top\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Positionnement du tooltip"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "tooltip-direction",
                "defaultValue": "'top'"
            },
            "tooltipCursor": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "'pointer' | 'default' | 'help' | 'disabled'",
                    "resolved": "\"default\" | \"disabled\" | \"help\" | \"pointer\"",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Curseur du tooltip"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "tooltip-cursor",
                "defaultValue": "'help'"
            }
        };
    }
    static get elementRef() { return "el"; }
}
