var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
  if (kind === "a" && !f)
    throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
    throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _KlevuSuggestionsList_instances, _KlevuSuggestionsList_suggestionClick;
import { h, Host } from "@stencil/core";
import { stripTags } from "../../utils/utils";
import { partsExports } from "../../utils/partsExports";
/**
 * Simple component to list suggestions. Takes in a parameter suggestions that will be rendered as a list
 * @csspart suggestions-list-caption The caption to the list of suggestions
 */
export class KlevuSuggestionsList {
  constructor() {
    _KlevuSuggestionsList_instances.add(this);
    this.caption = "Search suggestions";
    this.suggestions = [];
  }
  render() {
    if (this.suggestions.length === 0)
      return null;
    return (h(Host, null, h("klevu-typography", { class: "caption", variant: "h3", part: "suggestions-list-caption" }, this.caption), this.suggestions.map((s) => (h("klevu-list", { condensed: true, noXPadding: true, exportparts: partsExports("klevu-list") }, h("span", { slot: "primary", innerHTML: s, onClick: () => __classPrivateFieldGet(this, _KlevuSuggestionsList_instances, "m", _KlevuSuggestionsList_suggestionClick).call(this, stripTags(s)) }))))));
  }
  static get is() { return "klevu-suggestions-list"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["klevu-suggestions-list.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["klevu-suggestions-list.css"]
    };
  }
  static get properties() {
    return {
      "caption": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Caption on the list"
        },
        "attribute": "caption",
        "reflect": false,
        "defaultValue": "\"Search suggestions\""
      },
      "suggestions": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "string[]",
          "resolved": "string[]",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Suggestions to render in list"
        },
        "defaultValue": "[]"
      }
    };
  }
  static get events() {
    return [{
        "method": "klevuSuggestionClicked",
        "name": "klevuSuggestionClicked",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Event that is emitted when a suggestion is clicked"
        },
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        }
      }];
  }
}
_KlevuSuggestionsList_instances = new WeakSet(), _KlevuSuggestionsList_suggestionClick = function _KlevuSuggestionsList_suggestionClick(suggestion) {
  this.klevuSuggestionClicked.emit(suggestion);
};
//# sourceMappingURL=klevu-suggestions-list.js.map
