import { unsafeCSS, LitElement } from "lit";
import { html, literal } from "lit/static-html.js";
import { property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { customElement } from "../../decorator.js";
import iconStyle from "./button.css.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 ButtonVariant = /* @__PURE__ */ ((ButtonVariant2) => {
  ButtonVariant2["normal"] = "normal";
  ButtonVariant2["raised"] = "raised";
  ButtonVariant2["flat"] = "flat";
  return ButtonVariant2;
})(ButtonVariant || {});
var segmentPosition = /* @__PURE__ */ ((segmentPosition2) => {
  segmentPosition2["single"] = "single";
  segmentPosition2["start"] = "start";
  segmentPosition2["middle"] = "middle";
  segmentPosition2["end"] = "end";
  return segmentPosition2;
})(segmentPosition || {});
let ObcButton = class extends LitElement {
  constructor() {
    super(...arguments);
    this.variant = "normal";
    this.fullWidth = false;
    this.disabled = false;
    this.showLeadingIcon = false;
    this.showTrailingIcon = false;
    this.href = void 0;
    this.target = void 0;
    this.segmentPosition = "single";
  }
  renderLeadingIcon() {
    if (this.showLeadingIcon) {
      return html`
        <span class="icon leading" part="icon leading">
          <slot name="leading-icon"></slot>
        </span>
      `;
    }
    return html``;
  }
  renderTrailingIcon() {
    if (this.showTrailingIcon) {
      return html`
        <span class="icon trailing" part="icon trailing">
          <slot name="trailing-icon"></slot>
        </span>
      `;
    }
    return html``;
  }
  render() {
    const tag = this.href ? literal`a` : literal`button`;
    return html`
      <${tag}
        class=${classMap({
      wrapper: true,
      ["variant-" + this.variant]: true,
      hasIconLeading: this.showLeadingIcon,
      hasIconTrailing: this.showTrailingIcon,
      "full-width": this.fullWidth,
      ["segment-position-" + this.segmentPosition]: true
    })}
        ?disabled=${this.disabled}
        href=${ifDefined(this.href)}
        target=${ifDefined(this.target)}
        part="wrapper"
      >
        <div class="visible-wrapper" part="visible-wrapper">
          ${this.renderLeadingIcon()}
          <span class="label" part="label">
            <slot></slot>
          </span>
          ${this.renderTrailingIcon()}
        </div>
      </${tag}>
    `;
  }
};
ObcButton.styles = unsafeCSS(iconStyle);
__decorateClass([
  property({ type: String })
], ObcButton.prototype, "variant", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcButton.prototype, "fullWidth", 2);
__decorateClass([
  property({ type: Boolean })
], ObcButton.prototype, "disabled", 2);
__decorateClass([
  property({ type: Boolean })
], ObcButton.prototype, "showLeadingIcon", 2);
__decorateClass([
  property({ type: Boolean })
], ObcButton.prototype, "showTrailingIcon", 2);
__decorateClass([
  property({ type: String })
], ObcButton.prototype, "href", 2);
__decorateClass([
  property({ type: String })
], ObcButton.prototype, "target", 2);
__decorateClass([
  property({ type: String })
], ObcButton.prototype, "segmentPosition", 2);
ObcButton = __decorateClass([
  customElement("obc-button")
], ObcButton);
export {
  ButtonVariant,
  ObcButton,
  segmentPosition
};
//# sourceMappingURL=button.js.map
