import { unsafeCSS, LitElement, html } from "lit";
import { property } from "lit/decorators.js";
import componentStyle from "./toggle-button-option.css.js";
import { classMap } from "lit/directives/class-map.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 ObcToggleButtonOptionType = /* @__PURE__ */ ((ObcToggleButtonOptionType2) => {
  ObcToggleButtonOptionType2["icon"] = "icon";
  ObcToggleButtonOptionType2["text"] = "text";
  ObcToggleButtonOptionType2["iconTextUnder"] = "icon-text-under";
  ObcToggleButtonOptionType2["iconText"] = "text-icon";
  return ObcToggleButtonOptionType2;
})(ObcToggleButtonOptionType || {});
var ObcToggleButtonOptionVariant = /* @__PURE__ */ ((ObcToggleButtonOptionVariant2) => {
  ObcToggleButtonOptionVariant2["flat"] = "flat";
  ObcToggleButtonOptionVariant2["regular"] = "regular";
  ObcToggleButtonOptionVariant2["normal"] = "normal";
  return ObcToggleButtonOptionVariant2;
})(ObcToggleButtonOptionVariant || {});
let ObcToggleButtonOption = class extends LitElement {
  constructor() {
    super(...arguments);
    this.value = "value";
    this.selected = false;
    this.activated = false;
    this.type = "text";
    this.variant = "regular";
    this.hugText = false;
    this.showDivider = true;
    this.disabled = false;
    this.large = false;
  }
  /**
   * Fired when the option is clicked and not already selected.
   * @fires selected {CustomEvent<{value: string}>}
   */
  onClick(event) {
    if (this.disabled) {
      event.preventDefault();
      return;
    }
    if (!this.selected) {
      this.dispatchEvent(
        new CustomEvent("selected", { detail: { value: this.value } })
      );
    }
  }
  render() {
    const isInlineLabel = this.type === "text" || this.type === "text-icon";
    const hasIcon = this.type !== "text";
    const hasLabel = this.type !== "icon";
    const isIconTextUnder = this.type === "icon-text-under";
    return html`
      <button
        class=${classMap({
      wrapper: true,
      selected: this.selected,
      "inline-label": isInlineLabel,
      "type-flat": this.variant === "flat",
      "type-regular": this.variant === "regular",
      "type-normal": this.variant === "normal",
      "icon-text-under": isIconTextUnder,
      "hug-text": this.hugText,
      disabled: this.disabled,
      activated: this.activated,
      large: this.large
    })}
        ?disabled=${this.disabled}
        @click=${this.onClick}
      >
        <div class="visible-wrapper" part="visible-wrapper">
          ${hasIcon ? html`<div class="icon" part="icon">
                <slot name="icon"></slot>
              </div>` : ""}
          ${hasLabel && !isIconTextUnder ? html`<div class="label"><slot></slot></div>` : ""}
        </div>
        ${hasLabel && isIconTextUnder ? html`<div class="label-container">
              <div class="label"><slot></slot></div>
            </div>` : ""}
      </button>
    `;
  }
};
ObcToggleButtonOption.styles = unsafeCSS(componentStyle);
__decorateClass([
  property({ type: String })
], ObcToggleButtonOption.prototype, "value", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcToggleButtonOption.prototype, "selected", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcToggleButtonOption.prototype, "activated", 2);
__decorateClass([
  property({ type: String })
], ObcToggleButtonOption.prototype, "type", 2);
__decorateClass([
  property({ type: String })
], ObcToggleButtonOption.prototype, "variant", 2);
__decorateClass([
  property({ type: Boolean })
], ObcToggleButtonOption.prototype, "hugText", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcToggleButtonOption.prototype, "showDivider", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcToggleButtonOption.prototype, "disabled", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcToggleButtonOption.prototype, "large", 2);
ObcToggleButtonOption = __decorateClass([
  customElement("obc-toggle-button-option")
], ObcToggleButtonOption);
export {
  ObcToggleButtonOption,
  ObcToggleButtonOptionType,
  ObcToggleButtonOptionVariant
};
//# sourceMappingURL=toggle-button-option.js.map
