'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-a5939648.js');

const ruxToastStackCss = ":host{position:fixed;z-index:100;max-width:100%;max-height:100%;margin:var(--spacing-3, 0.75rem);margin-block-start:var(--spacing-0, 0rem);overflow:hidden}:host([position=top-right]){top:0;right:0}:host([position=top-left]){top:0;left:0}:host([position=bottom-right]){bottom:0;right:0}:host([position=bottom-left]){bottom:0;left:0}";

const RuxToastStack = class {
  constructor(hostRef) {
    index.registerInstance(this, hostRef);
    this.position = 'top-right';
  }
  /**
   * adds an individual toast to the stack with the set props passed in as an object
   */
  async addToast(props) {
    var _a;
    const toast = document.createElement('rux-toast');
    toast.style.transition = 'opacity 800ms ease-in 1s';
    for (const key in props) {
      if (props.hasOwnProperty(key)) {
        switch (key) {
          case 'message':
            toast.message = props[key];
            break;
          case 'hideClose':
            toast.hideClose = props[key];
            break;
          case 'closeAfter':
            toast.closeAfter = props[key];
            break;
        }
      }
    }
    (_a = this.el) === null || _a === void 0 ? void 0 : _a.insertBefore(toast, this.el.firstChild); // add as first child
  }
  get _toastsArray() {
    const toasts = Array.from(this.el.querySelectorAll('rux-toast'));
    return toasts;
  }
  render() {
    return (index.h(index.Host, null, index.h("div", { class: "rux-toast-stack" }, index.h("slot", null))));
  }
  get el() { return index.getElement(this); }
};
RuxToastStack.style = ruxToastStackCss;

exports.rux_toast_stack = RuxToastStack;
