import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { d as defineCustomElement$2 } from './klevu-typography2.js';

const klevuBadgeCss = ":host{display:inline-block;padding:var(--klevu-spacing-02) var(--klevu-spacing-05);background:var(--klevu-badge-background);border-radius:var(--klevu-border-radius-xxl, var(--klevu-badge-border-radius));align-items:center}:host(.closable){display:inline-flex;cursor:pointer;user-select:none}span[part=\"material-icon\"]{position:relative;top:1px;left:-4px;font-size:0.7em;margin-right:var(--klevu-spacing-01)}klevu-typography{line-height:1}";

var __classPrivateFieldGet = (undefined && undefined.__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 _KlevuBadge_close;
const KlevuBadge$1 = /*@__PURE__*/ proxyCustomElement(class KlevuBadge extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.__attachShadow();
    this.klevuBadgeClose = createEvent(this, "klevuBadgeClose", 7);
    _KlevuBadge_close.set(this, () => {
      if (this.closable) {
        this.klevuBadgeClose.emit();
      }
    });
    this.accent = undefined;
    this.neutral = undefined;
    this.closable = undefined;
  }
  render() {
    let style = {};
    if (this.accent || this.neutral) {
      style = {
        "--klevu-badge-background": this.accent
          ? `var(--klevu-color-accent-${this.accent})`
          : `var(--klevu-color-neutral-${this.neutral})`,
      };
    }
    return (h(Host, { style: style, class: { closable: Boolean(this.closable) }, onClick: __classPrivateFieldGet(this, _KlevuBadge_close, "f").bind(this) }, this.closable && h("span", { part: "material-icon" }, "close"), h("klevu-typography", { variant: "body-xs" }, h("slot", null))));
  }
  static get style() { return klevuBadgeCss; }
}, [1, "klevu-badge", {
    "accent": [2],
    "neutral": [2],
    "closable": [4]
  }]);
_KlevuBadge_close = new WeakMap();
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["klevu-badge", "klevu-typography"];
  components.forEach(tagName => { switch (tagName) {
    case "klevu-badge":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, KlevuBadge$1);
      }
      break;
    case "klevu-typography":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}
defineCustomElement$1();

const KlevuBadge = KlevuBadge$1;
const defineCustomElement = defineCustomElement$1;

export { KlevuBadge, defineCustomElement };

//# sourceMappingURL=klevu-badge.js.map