import { unsafeCSS, LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import compentStyle from "./input-chip.css.js";
import { classMap } from "lit/directives/class-map.js";
import "../../icons/icon-close-google.js";
import { customElement } from "../../decorator.js";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
    if (decorator = decorators[i])
      result = (kind ? decorator(target, key, result) : decorator(result)) || result;
  if (kind && result) __defProp(target, key, result);
  return result;
};
let ObcInputChip = class extends LitElement {
  constructor() {
    super(...arguments);
    this.label = "Label";
    this.disabled = false;
    this.showIcon = false;
  }
  handleRemove() {
    if (this.disabled) return;
    this.dispatchEvent(
      new CustomEvent("remove-chip", {
        detail: {
          label: this.label
        },
        bubbles: true,
        composed: true
      })
    );
  }
  renderLeadingIcon() {
    console.log("renderLeadingIcon called, showIcon:", this.showIcon);
    if (this.showIcon) {
      return html`
        <div class="chip-icon-wrapper">
          <slot></slot>
        </div>
      `;
    }
    return html``;
  }
  render() {
    console.log("render called, showIcon:", this.showIcon);
    return html`
      <button
        class=${classMap({
      wrapper: true,
      "status-enabled": !this.disabled
    })}
        @click=${this.handleRemove}
        ?disabled=${this.disabled}
        aria-label="Remove ${this.label}"
      >
        <div class="chip-container">
          ${this.renderLeadingIcon()}

          <div class="chip-label-container">
            <span class="chip-label">${this.label}</span>
          </div>

          <div class="chip-icon-wrapper">
            <obi-close-google class="chip-icon"></obi-close-google>
          </div>
        </div>
      </button>
    `;
  }
};
ObcInputChip.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: String })
], ObcInputChip.prototype, "label", 2);
__decorateClass([
  property({ type: Boolean })
], ObcInputChip.prototype, "disabled", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcInputChip.prototype, "showIcon", 2);
ObcInputChip = __decorateClass([
  customElement("obc-input-chip")
], ObcInputChip);
export {
  ObcInputChip
};
//# sourceMappingURL=input-chip.js.map
