import { unsafeCSS, LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import compentStyle from "./filter-chip.css.js";
import "../../icons/icon-placeholder.js";
import "../../icons/icon-check-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;
};
var ChipState = /* @__PURE__ */ ((ChipState2) => {
  ChipState2["Unchecked"] = "unchecked";
  ChipState2["Checked"] = "checked";
  return ChipState2;
})(ChipState || {});
let ObcFilterChip = class extends LitElement {
  constructor() {
    super(...arguments);
    this.disabled = false;
    this.label = "Label";
    this.checked = false;
    this.showIcon = false;
  }
  handleClick() {
    if (this.disabled) return;
    this.checked = !this.checked;
    this.dispatchEvent(
      new CustomEvent("chip-toggle", {
        detail: {
          label: this.label,
          checked: this.checked
        }
      })
    );
  }
  renderLeadingIcon() {
    const icons = [];
    if (this.checked) {
      icons.push(html`
        <div class="chip-icon-wrapper">
          <obi-check-google class="chip-icon"></obi-check-google>
        </div>
      `);
    }
    if (this.showIcon) {
      icons.push(html`
        <div class="chip-icon-wrapper">
          <slot></slot>
        </div>
      `);
    }
    return icons;
  }
  render() {
    return html`
      <button
        class=${classMap({
      wrapper: true,
      "state-checked": this.checked,
      "state-unchecked": !this.checked,
      "status-enabled": !this.disabled
    })}
        @click=${this.handleClick}
        ?disabled=${this.disabled}
        aria-disabled=${this.disabled ? "true" : "false"}
        aria-pressed=${this.checked}
        aria-label=${this.label}
        role="checkbox"
      >
        <div class="chip-container">
          ${this.renderLeadingIcon()}
          <div class="chip-label-container">
            <span class="chip-label">${this.label}</span>
          </div>
        </div>
      </button>
    `;
  }
};
ObcFilterChip.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: Boolean })
], ObcFilterChip.prototype, "disabled", 2);
__decorateClass([
  property({ type: String })
], ObcFilterChip.prototype, "label", 2);
__decorateClass([
  property({ type: Boolean })
], ObcFilterChip.prototype, "checked", 2);
__decorateClass([
  property({ type: Boolean })
], ObcFilterChip.prototype, "showIcon", 2);
ObcFilterChip = __decorateClass([
  customElement("obc-filter-chip")
], ObcFilterChip);
export {
  ChipState,
  ObcFilterChip
};
//# sourceMappingURL=filter-chip.js.map
