import { unsafeCSS, LitElement, nothing } from "lit";
import { customElement } from "../../decorator.js";
import compentStyle from "./table-header-item.css.js";
import { property } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import "../../icons/icon-chevron-up-google.js";
import "../../icons/icon-chevron-down-google.js";
import { literal, html } from "lit/static-html.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 ObcTableHeaderItemType = /* @__PURE__ */ ((ObcTableHeaderItemType2) => {
  ObcTableHeaderItemType2["Regular"] = "Regular";
  ObcTableHeaderItemType2["IconOnly"] = "IconOnly";
  ObcTableHeaderItemType2["Narrow"] = "Narrow";
  return ObcTableHeaderItemType2;
})(ObcTableHeaderItemType || {});
var ObcTableHeaderItemSortDirection = /* @__PURE__ */ ((ObcTableHeaderItemSortDirection2) => {
  ObcTableHeaderItemSortDirection2["None"] = "none";
  ObcTableHeaderItemSortDirection2["Asc"] = "asc";
  ObcTableHeaderItemSortDirection2["Desc"] = "desc";
  return ObcTableHeaderItemSortDirection2;
})(ObcTableHeaderItemSortDirection || {});
let ObcTableHeaderItem = class extends LitElement {
  constructor() {
    super(...arguments);
    this.type = "Regular";
    this.disabled = false;
    this.hasLeadingIcon = false;
    this.sortDirection = "none";
    this.showDivider = false;
    this.checked = false;
    this.sortable = false;
  }
  render() {
    const classes = {
      wrapper: true,
      [`style-${(this.type ?? "Regular").toLowerCase()}`]: true,
      sortable: this.sortable,
      disabled: this.disabled,
      "has-leading-icon": this.hasLeadingIcon,
      "sorted-asc": this.sortDirection === "asc",
      "sorted-desc": this.sortDirection === "desc",
      checked: this.checked
    };
    const tag = this.sortable ? literal`button` : literal`div`;
    return html`
      <${tag}
        class=${classMap(classes)}
        ?disabled=${this.disabled}
        part="wrapper"
      >
        <div class="visible-wrapper" part="visible-wrapper">
          ${this.hasLeadingIcon ? html`<span class="leading" part="leading"
                  ><slot name="leading-icon"></slot
                ></span>` : nothing}
          ${this.type !== "IconOnly" ? html`<span class="label" part="label"><slot></slot></span>` : nothing}
          ${this.sortable ? html`<span class="trailing sort-icon" part="sort-icon"
                  >${this._renderSortIcon()}</span
                >` : nothing}
        </div>
        ${this.showDivider ? html`<div class="divider" part="divider"></div>` : nothing}
      </${tag}>
    `;
  }
  _renderSortIcon() {
    switch (this.sortDirection) {
      case "asc":
        return html`<obi-chevron-up-google></obi-chevron-up-google>`;
      case "desc":
        return html`<obi-chevron-down-google></obi-chevron-down-google>`;
      default:
        return nothing;
    }
  }
};
ObcTableHeaderItem.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: String })
], ObcTableHeaderItem.prototype, "type", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTableHeaderItem.prototype, "disabled", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTableHeaderItem.prototype, "hasLeadingIcon", 2);
__decorateClass([
  property({ type: String })
], ObcTableHeaderItem.prototype, "sortDirection", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTableHeaderItem.prototype, "showDivider", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTableHeaderItem.prototype, "checked", 2);
__decorateClass([
  property({ type: Boolean })
], ObcTableHeaderItem.prototype, "sortable", 2);
ObcTableHeaderItem = __decorateClass([
  customElement("obc-table-header-item")
], ObcTableHeaderItem);
export {
  ObcTableHeaderItem,
  ObcTableHeaderItemSortDirection,
  ObcTableHeaderItemType
};
//# sourceMappingURL=table-header-item.js.map
