var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
    if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
    if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
    return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _PlayDropdownMenu_instances, _PlayDropdownMenu_toggleMenu, _PlayDropdownMenu_closeMenu;
import { LitElement, css, html } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
import { cssReset } from '../utils/css-reset.js';
/**
 * @slot menu - Menu list items. to-do: extract menu component instead of
 *              assuming li.
 * @slot trigger - Button. to-do: use a button.
 */
let PlayDropdownMenu = class PlayDropdownMenu extends LitElement {
    constructor() {
        super(...arguments);
        _PlayDropdownMenu_instances.add(this);
        this.direction = 'up';
        this.isOpen = false;
    }
    render() {
        return html `
      <div @click=${__classPrivateFieldGet(this, _PlayDropdownMenu_instances, "m", _PlayDropdownMenu_toggleMenu)}>
        <slot name="trigger"></slot>
      </div>
      <div class="menu ${this.isOpen ? 'open' : ''}">
        <div class="scrim" @click=${__classPrivateFieldGet(this, _PlayDropdownMenu_instances, "m", _PlayDropdownMenu_closeMenu)}></div>
        <ol @click=${__classPrivateFieldGet(this, _PlayDropdownMenu_instances, "m", _PlayDropdownMenu_closeMenu)}>
          <slot name="menu"></slot>
        </ol>
      </div>
    `;
    }
};
_PlayDropdownMenu_instances = new WeakSet();
_PlayDropdownMenu_toggleMenu = function _PlayDropdownMenu_toggleMenu() {
    this.isOpen = !this.isOpen;
};
_PlayDropdownMenu_closeMenu = function _PlayDropdownMenu_closeMenu() {
    this.isOpen = false;
};
PlayDropdownMenu.styles = css `
    ${cssReset}

    :host ol {
      position: absolute;
      right: 0;
      background-color: var(--color-neutral-background);
      border-radius: 8px;
      box-shadow: var(--shadow-m);
      display: flex;
      flex-direction: column;
      margin: 0;
      padding-top: 8px;
      padding-bottom: 8px;
      padding-left: 0;
      list-style: none;
      height: min-content;
    }

    :host([direction='up']) ol {
      top: 8px;
      transform: translateY(-100%);
    }

    :host([direction='down']) ol {
      bottom: 8px;
      transform: translateY(100%);
    }

    :host .menu {
      visibility: hidden;
      opacity: 0;
    }

    :host .menu.open {
      visibility: visible;
      opacity: 1;
      transition-duration: 0.1s;
      transition-property: opacity;
      transition-timing-function: ease-out;
    }

    :host([direction='up']) .open ol {
      top: -8px;
      transition-duration: 0.1s;
      transition-property: top;
      transition-timing-function: ease-out;
    }

    :host([direction='down']) .open ol {
      bottom: -8px;
      transition-duration: 0.1s;
      transition-property: bottom;
      transition-timing-function: ease-out;
    }

    :host {
      position: relative;
    }

    :host .scrim {
      position: fixed;
      inset: 0;
      display: none;
    }

    :host .open .scrim {
      display: block;
    }
  `;
__decorate([
    property({ type: String })
], PlayDropdownMenu.prototype, "direction", void 0);
__decorate([
    state()
], PlayDropdownMenu.prototype, "isOpen", void 0);
PlayDropdownMenu = __decorate([
    customElement('play-dropdown-menu')
], PlayDropdownMenu);
export { PlayDropdownMenu };
//# sourceMappingURL=play-dropdown-menu.js.map