import { h, Host } from "@stencil/core";
import { normalizeHotkeyString } from "../../util/hotkeys";
/**
 * This component is used internally by `limel-tooltip`.
 *
 * @private
 */
export class TooltipContent {
    render() {
        let isLabelsTextLong = false;
        if (this.helperLabel && this.maxlength) {
            isLabelsTextLong =
                this.label.length + this.helperLabel.length > this.maxlength;
        }
        const style = this.maxlength
            ? { '--tooltip-max-width-of-text': `${this.maxlength}ch` }
            : undefined;
        return (h(Host, { key: '3994a2ea4040dfd7dfa969a3347d111994d769e1', class: { 'has-column-layout': isLabelsTextLong }, style: style }, h("div", { key: '8a7cfd75957eea1515a22928f4783f787f1288bc', class: "label" }, this.label), this.renderHelperLabel(), this.renderHotkey()));
    }
    renderHelperLabel() {
        if (!this.helperLabel) {
            return;
        }
        return h("div", { class: "helper-label" }, this.helperLabel);
    }
    renderHotkey() {
        if (!this.hotkey) {
            return;
        }
        const normalized = normalizeHotkeyString(this.hotkey);
        if (!normalized) {
            return;
        }
        return h("limel-hotkey", { value: normalized });
    }
    static get is() { return "limel-tooltip-content"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["tooltip-content.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["tooltip-content.css"]
        };
    }
    static get properties() {
        return {
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Read more in tooltip.tsx"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "attribute": "label"
            },
            "helperLabel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Read more in tooltip.tsx"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "attribute": "helper-label"
            },
            "maxlength": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Read more in tooltip.tsx"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "attribute": "maxlength"
            },
            "hotkey": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Read more in tooltip.tsx"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "attribute": "hotkey"
            }
        };
    }
}
