import { h, Host } from "@stencil/core";
/**
 * Component to display list of CMS page results
 */
export class KlevuCmsList {
  constructor() {
    this.pages = undefined;
    this.link = undefined;
    this.caption = "CMS pages";
  }
  render() {
    var _a;
    return (h(Host, null, h("klevu-typography", { class: "caption", variant: "h3" }, this.caption), (_a = this.pages) === null || _a === void 0 ? void 0 :
      _a.map((page) => {
        if (this.link) {
          return (h("klevu-list", { url: page.url, condensed: true, noXPadding: true }, h("span", { slot: "primary" }, page.name)));
        }
        return (h("klevu-list", { onClick: () => this.klevuCmsPageClick.emit(page), condensed: true, noXPadding: true }, h("span", { slot: "primary" }, page.name)));
      })));
  }
  static get is() { return "klevu-cms-list"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["klevu-cms-list.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["klevu-cms-list.css"]
    };
  }
  static get properties() {
    return {
      "pages": {
        "type": "unknown",
        "mutable": false,
        "complexType": {
          "original": "Array<Partial<KlevuRecord>>",
          "resolved": "Partial<KlevuRecord>[]",
          "references": {
            "Array": {
              "location": "global",
              "id": "global::Array"
            },
            "Partial": {
              "location": "global",
              "id": "global::Partial"
            },
            "KlevuRecord": {
              "location": "import",
              "path": "@klevu/core",
              "id": "../klevu-core/dist/cjs/index.d.ts::KlevuRecord"
            }
          }
        },
        "required": true,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "List of Klevu results records with type of Page"
        }
      },
      "link": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean | undefined",
          "references": {}
        },
        "required": false,
        "optional": true,
        "docs": {
          "tags": [],
          "text": "Should use url parameter from link to create anchor"
        },
        "attribute": "link",
        "reflect": false
      },
      "caption": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "string",
          "resolved": "string",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Caption of the listing"
        },
        "attribute": "caption",
        "reflect": false,
        "defaultValue": "\"CMS pages\""
      }
    };
  }
  static get events() {
    return [{
        "method": "klevuCmsPageClick",
        "name": "klevuCmsPageClick",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": ""
        },
        "complexType": {
          "original": "Partial<KlevuRecord>",
          "resolved": "{ [x: string]: any; brand?: string | undefined; category?: string | undefined; currency?: string | undefined; deliveryInfo?: string | undefined; discount?: string | undefined; freeShipping?: string | undefined; groupPrices?: string | undefined; hideAddToCart?: string | undefined; hideGroupPrices?: string | undefined; id?: string | undefined; image?: string | undefined; imageHover?: string | undefined; imageUrl?: string | undefined; inStock?: string | undefined; itemGroupId?: string | undefined; klevu_category?: string | undefined; klevu_manual_boosting?: number | undefined; klevu_bulk_boosting?: number | undefined; klevu_selflearning_boosting?: number | undefined; name?: string | undefined; price?: string | undefined; rating?: number | undefined; salePrice?: string | undefined; shortDesc?: string | undefined; sku?: string | undefined; score?: number | undefined; startPrice?: string | undefined; storeBaseCurrency?: string | undefined; swatchesInfo?: string | undefined; tags?: string | undefined; toPrice?: string | undefined; totalVariants?: number | undefined; type?: string | undefined; typeOfRecord?: KlevuAnyTypeOfRecord | undefined; url?: string | undefined; weight?: string | undefined; swatches?: { id: string; color: string; swatchImage: string; image: string; numberOfAdditionalVariants: string; }[] | undefined; }",
          "references": {
            "Partial": {
              "location": "global",
              "id": "global::Partial"
            },
            "KlevuRecord": {
              "location": "import",
              "path": "@klevu/core",
              "id": "../klevu-core/dist/cjs/index.d.ts::KlevuRecord"
            }
          }
        }
      }];
  }
}
//# sourceMappingURL=klevu-cms-list.js.map
