'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7e93c7c3.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 = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.klevuBadgeClose = index.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 (index.h(index.Host, { style: style, class: { closable: Boolean(this.closable) }, onClick: __classPrivateFieldGet(this, _KlevuBadge_close, "f").bind(this) }, this.closable && index.h("span", { part: "material-icon" }, "close"), index.h("klevu-typography", { variant: "body-xs" }, index.h("slot", null))));
  }
};
_KlevuBadge_close = new WeakMap();
KlevuBadge.style = klevuBadgeCss;

exports.klevu_badge = KlevuBadge;

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