import { Host, h } from '@stencil/core';
/**
 * @slot (default) - where all toasts go
 */
export class RuxToastStack {
  constructor() {
    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 (h(Host, null, h("div", { class: "rux-toast-stack" }, h("slot", null))));
  }
  static get is() { return "rux-toast-stack"; }
  static get encapsulation() { return "shadow"; }
  static get originalStyleUrls() {
    return {
      "$": ["rux-toast-stack.scss"]
    };
  }
  static get styleUrls() {
    return {
      "$": ["rux-toast-stack.css"]
    };
  }
  static get properties() {
    return {
      "position": {
        "type": "string",
        "mutable": false,
        "complexType": {
          "original": "ToastStackPosition",
          "resolved": "\"bottom-left\" | \"bottom-right\" | \"top-left\" | \"top-right\"",
          "references": {
            "ToastStackPosition": {
              "location": "local",
              "path": "/Users/micahjones/Desktop/releases/astro/packages/web-components/src/components/rux-toast-stack/rux-toast-stack.tsx"
            }
          }
        },
        "required": false,
        "optional": false,
        "docs": {
          "tags": [],
          "text": "position of toast stack in viewport"
        },
        "attribute": "position",
        "reflect": true,
        "defaultValue": "'top-right'"
      }
    };
  }
  static get methods() {
    return {
      "addToast": {
        "complexType": {
          "signature": "(props: { [x: string]: any; hasOwnProperty: (arg0: string) => any; }) => Promise<void>",
          "parameters": [{
              "tags": [],
              "text": ""
            }],
          "references": {
            "Promise": {
              "location": "global"
            }
          },
          "return": "Promise<void>"
        },
        "docs": {
          "text": "adds an individual toast to the stack with the set props passed in as an object",
          "tags": []
        }
      }
    };
  }
  static get elementRef() { return "el"; }
}
