import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
import { d as defineCustomElement$2 } from './bs-button2.js';

const bsToastActionsCss = "bs-toast-actions{display:block}";

const BsToastActions$1 = /*@__PURE__*/ proxyCustomElement(class BsToastActions extends HTMLElement {
  constructor() {
    super();
    this.__registerHost();
    this.defaultDismiss = createEvent(this, "defaultDismiss", 7);
    this.isStacked = false;
    this.showDefault = false;
  }
  componentDidLoad() {
    if (this.actionsEl.childElementCount == 0) {
      this.showDefault = true;
    }
  }
  /** Stacks the actions when there are more than two (mobile only) */
  componentDidRender() {
    // Note: the default <slot> is counted as a child, so we're actually looking for 3 or more children
    if (this.actionsEl.childElementCount > 2) {
      this.isStacked = true;
    }
  }
  render() {
    return (h(Host, null, h("div", { ref: (el) => this.actionsEl = el, class: "bs-toast-actions", "data-stacked": this.isStacked }, this.showDefault && (h("bs-button", { size: "sm", "text-btn": true, onClick: () => this.defaultDismiss.emit() }, "Dismiss")), h("slot", null))));
  }
  static get style() { return bsToastActionsCss; }
}, [4, "bs-toast-actions", {
    "isStacked": [32],
    "showDefault": [32]
  }]);
function defineCustomElement$1() {
  if (typeof customElements === "undefined") {
    return;
  }
  const components = ["bs-toast-actions", "bs-button"];
  components.forEach(tagName => { switch (tagName) {
    case "bs-toast-actions":
      if (!customElements.get(tagName)) {
        customElements.define(tagName, BsToastActions$1);
      }
      break;
    case "bs-button":
      if (!customElements.get(tagName)) {
        defineCustomElement$2();
      }
      break;
  } });
}

const BsToastActions = BsToastActions$1;
const defineCustomElement = defineCustomElement$1;

export { BsToastActions, defineCustomElement };

//# sourceMappingURL=bs-toast-actions.js.map