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 _KlevuChip_instances, _KlevuChip_close;
import { Host, h } from "@stencil/core";
/**
 * Chip component that is used to display selected value in a listing. Gives also ability to remove the chip.
 *
 * Has selected and removable attributes that can be used to display the chip in selected state and also to remove the chip.
 *
 * @cssprop --klevu-chip-radius --klevu-border-radius-xxl Border radius of the chip
 * @cssprop --klevu-chip-border --klevu-color-neutral-5 Border color of the chip
 * @cssprop --klevu-chip-selected-background klevu-color-primary-with-opacity Selected background color of the chip
 * @cssprop --klevu-chip-selected-border --klevu-color-primary Selected border color of the chip
 */
export class KlevuChip {
  constructor() {
    _KlevuChip_instances.add(this);
    this.selected = false;
    this.removable = false;
  }
  render() {
    return (h(Host, { class: { removable: Boolean(this.removable), selected: Boolean(this.selected) } }, this.removable && h("klevu-icon", { name: "close", onClick: __classPrivateFieldGet(this, _KlevuChip_instances, "m", _KlevuChip_close).bind(this) }), h("klevu-typography", { variant: "body-xs" }, h("slot", null))));
  }
  static get is() { return "klevu-chip"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["klevu-chip.css"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["klevu-chip.css"]
    };
  }
  static get properties() {
    return {
      "selected": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Selected state of the chip"
        },
        "attribute": "selected",
        "reflect": false,
        "defaultValue": "false"
      },
      "removable": {
        "type": "boolean",
        "mutable": false,
        "complexType": {
          "original": "boolean",
          "resolved": "boolean",
          "references": {}
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "Removable state of the chip"
        },
        "attribute": "removable",
        "reflect": false,
        "defaultValue": "false"
      }
    };
  }
  static get events() {
    return [{
        "method": "klevuChipRemove",
        "name": "klevuChipRemove",
        "bubbles": true,
        "cancelable": true,
        "composed": true,
        "docs": {
          "tags": [],
          "text": "Event that is fired when chip is removed"
        },
        "complexType": {
          "original": "void",
          "resolved": "void",
          "references": {}
        }
      }];
  }
}
_KlevuChip_instances = new WeakSet(), _KlevuChip_close = function _KlevuChip_close(event) {
  if (this.removable) {
    const emittedEvent = this.klevuChipRemove.emit();
    if (emittedEvent.defaultPrevented) {
      event.stopPropagation();
      return false;
    }
  }
};
//# sourceMappingURL=klevu-chip.js.map
