import { h, } from "@stencil/core";
import { getThumbnail } from "../utils";
export class Facet {
  constructor() {
    this.callSetFacet = () => this.setFacet();
    this.detail = true;
    this.image = undefined;
    this.label = undefined;
    this.value = undefined;
    this.widget = "item";
  }
  setFacet() {
    this.glFormFacet.emit({
      label: this.label,
      value: this.value,
    });
  }
  render() {
    if (this.widget === "header")
      return h("ion-list-header", null, this.label);
    return (h("ion-item", { button: true, onClick: this.callSetFacet, detail: this.detail }, getThumbnail(this), h("ion-label", { "text-wrap": true }, this.label)));
  }
  static get is() { return "gl-facet"; }
  static get properties() {
    return {
      "detail": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Show the detail arrow in the item."
        },
        "attribute": "detail",
        "reflect": false,
        "defaultValue": "true"
      },
      "image": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Image URL for the item."
        },
        "attribute": "image",
        "reflect": false
      },
      "label": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Text for the item."
        },
        "attribute": "label",
        "reflect": false
      },
      "value": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "The value of the facet used to refer to it in fields and other\nfacets. When the facet is selected, the value is emitted as\npart of the `glFormFacet` event."
        },
        "attribute": "value",
        "reflect": false
      },
      "widget": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "\"header\" | \"item\"",
          "resolved": "\"header\" | \"item\"",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Widget to use for displaying the facet. A value of `header` renders\nan `ion-list-header` instead of an `ion-item`."
        },
        "attribute": "widget",
        "reflect": false,
        "defaultValue": "\"item\""
      }
    };
  }
  static get events() {
    return [{
        "method": "glFormFacet",
        "name": "glFormFacet",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Emitted when the facet is selected by the user."
        },
        "complexType": {
          "original": "any",
          "resolved": "any",
          "references": {}
        }
      }];
  }
  static get elementRef() { return "el"; }
}
//# sourceMappingURL=facet.js.map
