import { Component, Element, Host, Prop, h } from '@stencil/core';
import { guid } from '../../utils';
/** @slot - A slot for adding text to the label. */
export class Label {
  constructor() {
    //--------------------------------------------------------------------------
    //
    //  Props
    //
    //--------------------------------------------------------------------------
    /**
     * Displays red asterisk if true. Has no impact on form submission.
     *
     * **Note:** A required label without text will display a red asterisk with no
     * context. To prevent this the implementation should not render the label
     * at all if no text is present to display.
     */
    this.required = false;
    /** Displays label in bold or medium font-weight. */
    this.weight = 'semibold';
  }
  //--------------------------------------------------------------------------
  //
  //  Lifecycle Methods
  //
  //--------------------------------------------------------------------------
  render() {
    const iconGuid = `icon-${guid()}`;
    const tooltipGuid = `tooltip-${guid()}`;
    return (h(Host, null,
      h("slot", null),
      this.tooltip && (h("abds-icon", { "aria-describedby": tooltipGuid, icon: "information-circle", id: iconGuid, size: "md", "stroke-width": "medium", tabIndex: 0 })),
      this.tooltip && (h("abds-tooltip", { for: iconGuid, id: tooltipGuid, placement: "top" }, this.tooltip))));
  }
  static get is() { return "abds-label"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() { return {
    "$": ["label.css"]
  }; }
  static get styleUrls() { return {
    "$": ["label.css"]
  }; }
  static get properties() { return {
    "required": {
      "type": "boolean",
      "mutable": false,
      "complexType": {
        "original": "boolean",
        "resolved": "boolean",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Displays red asterisk if true. Has no impact on form submission.\n\n**Note:** A required label without text will display a red asterisk with no\ncontext. To prevent this the implementation should not render the label\nat all if no text is present to display."
      },
      "attribute": "required",
      "reflect": true,
      "defaultValue": "false"
    },
    "tooltip": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "string",
        "resolved": "string",
        "references": {}
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Tooltip text to display on abds-icon hover."
      },
      "attribute": "tooltip",
      "reflect": true
    },
    "weight": {
      "type": "string",
      "mutable": false,
      "complexType": {
        "original": "Weight",
        "resolved": "\"medium\" | \"semibold\"",
        "references": {
          "Weight": {
            "location": "import",
            "path": "./types"
          }
        }
      },
      "required": false,
      "optional": false,
      "docs": {
        "tags": [],
        "text": "Displays label in bold or medium font-weight."
      },
      "attribute": "weight",
      "reflect": true,
      "defaultValue": "'semibold'"
    }
  }; }
  static get elementRef() { return "host"; }
}
//# sourceMappingURL=label.js.map