import { unsafeCSS, LitElement, nothing, html } from "lit";
import { property, state } from "lit/decorators.js";
import compentStyle from "./navigation-item-group.css.js";
import { ObcNavigationMenuVariant } from "../navigation-menu/navigation-menu.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;
};
let ObcNavigationItemGroup = class extends LitElement {
  constructor() {
    super(...arguments);
    this.label = "Label";
    this.checked = false;
    this.variant = ObcNavigationMenuVariant.Full;
    this.hug = false;
    this.hasIcon = false;
    this.openContainer = false;
  }
  onClickGroup() {
    if (this.openContainer) {
      this.close();
    } else {
      this.open();
    }
  }
  /**
   * Opens the flyout panel and emits the `open` event.
   * @fires open
   */
  open() {
    this.openContainer = true;
    this.dispatchEvent(new CustomEvent("open"));
  }
  close() {
    this.openContainer = false;
    this.querySelectorAll("obc-navigation-item-group").forEach((item) => {
      item.close();
    });
  }
  render() {
    return html`
      <obc-navigation-item
        @click=${this.onClickGroup}
        .checked=${this.checked}
        .groupSelected=${this.openContainer}
        .href=${this.href}
        .label=${this.label}
        .variant=${this.variant}
        group
        id="group-item"
        ?hasIcon=${this.hasIcon}
      >
        ${this.hasIcon ? html`<slot name="icon" slot="icon"></slot>` : nothing}
      </obc-navigation-item>
      <div
        part="flyout"
        id="flyout-wrapper"
        class=${classMap({
      hug: this.hug,
      [this.variant]: true,
      open: this.openContainer
    })}
      >
        <div class="content">
          <slot></slot>
        </div>
      </div>
      <div
        class=${classMap({
      shadow: true,
      open: this.openContainer,
      hug: this.hug
    })}
      ></div>
    `;
  }
};
ObcNavigationItemGroup.styles = unsafeCSS(compentStyle);
__decorateClass([
  property({ type: String })
], ObcNavigationItemGroup.prototype, "label", 2);
__decorateClass([
  property({ type: String })
], ObcNavigationItemGroup.prototype, "href", 2);
__decorateClass([
  property({ type: Boolean })
], ObcNavigationItemGroup.prototype, "checked", 2);
__decorateClass([
  property({ type: String })
], ObcNavigationItemGroup.prototype, "variant", 2);
__decorateClass([
  property({ type: Boolean })
], ObcNavigationItemGroup.prototype, "hug", 2);
__decorateClass([
  property({ type: Boolean })
], ObcNavigationItemGroup.prototype, "hasIcon", 2);
__decorateClass([
  state()
], ObcNavigationItemGroup.prototype, "openContainer", 2);
ObcNavigationItemGroup = __decorateClass([
  customElement("obc-navigation-item-group")
], ObcNavigationItemGroup);
export {
  ObcNavigationItemGroup
};
//# sourceMappingURL=navigation-item-group.js.map
