import { unsafeCSS, LitElement, nothing, html } from "lit";
import { property } from "lit/decorators.js";
import compentStyle from "./navigation-item.css.js";
import { classMap } from "lit/directives/class-map.js";
import { ifDefined } from "lit/directives/if-defined.js";
import "../../icons/icon-arrow-flyout-google.js";
import { ObcNavigationMenuVariant } from "../navigation-menu/navigation-menu.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 ObcNavigationItem = class extends LitElement {
  constructor() {
    super(...arguments);
    this.label = "Label";
    this.checked = false;
    this.variant = ObcNavigationMenuVariant.Full;
    this.group = false;
    this.groupSelected = false;
    this.hasIcon = false;
  }
  /**
   * Fired when the navigation item is clicked (either as a link or button).
   * @fires click {CustomEvent<void>}
   */
  onClick() {
    dispatchEvent(new CustomEvent("click"));
  }
  render() {
    const showFlyout = this.group && this.variant !== ObcNavigationMenuVariant.IconOnly;
    const isCompact = this.variant === ObcNavigationMenuVariant.Compact;
    return html`
      <a
        class="${classMap({
      wrapper: true,
      checked: this.checked,
      "group-selected": this.groupSelected && this.group,
      "has-icon": this.hasIcon,
      [this.variant]: true
    })}"
        href=${ifDefined(this.href)}
        @click=${this.onClick}
      >
        <div class="visible-wrapper">
          ${this.hasIcon ? html`<slot name="icon" class="icon leading"></slot>` : nothing}
          ${![
      ObcNavigationMenuVariant.IconOnly,
      ObcNavigationMenuVariant.IconOnlyLarge
    ].includes(this.variant) ? html`
                <span
                  part="label"
                  class=${classMap({
      label: true,
      "label-flyout": showFlyout && !isCompact
    })}
                >
                  ${this.label}
                </span>
              ` : nothing}
          ${showFlyout ? html`
                <div class="flyout-wrapper">
                  <obi-arrow-flyout-google
                    class="icon trailing"
                  ></obi-arrow-flyout-google>
                </div>
              ` : nothing}
        </div>
      </a>
    `;
  }
};
ObcNavigationItem.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: String })
], ObcNavigationItem.prototype, "label", 2);
__decorateClass([
  property({ type: String })
], ObcNavigationItem.prototype, "href", 2);
__decorateClass([
  property({ type: Boolean })
], ObcNavigationItem.prototype, "checked", 2);
__decorateClass([
  property({ type: String })
], ObcNavigationItem.prototype, "variant", 2);
__decorateClass([
  property({ type: Boolean })
], ObcNavigationItem.prototype, "group", 2);
__decorateClass([
  property({ type: Boolean })
], ObcNavigationItem.prototype, "groupSelected", 2);
__decorateClass([
  property({ type: Boolean, reflect: true })
], ObcNavigationItem.prototype, "hasIcon", 2);
ObcNavigationItem = __decorateClass([
  customElement("obc-navigation-item")
], ObcNavigationItem);
export {
  ObcNavigationItem
};
//# sourceMappingURL=navigation-item.js.map
