import { r as registerInstance, c as createEvent, h, H as Host } from './index-92f6d7ee.js';

const bsModalCss = ".bs-modal{background-color:var(--bs-bg-base-elevated);border-radius:4px;box-shadow:var(--bs-shadow-contentHigh);left:1.5rem;max-height:calc(100% - 3rem);opacity:0;overflow:auto;padding:1.5rem;position:fixed;right:1.5rem;top:50%;transform:translateY(-50%);transition-duration:75ms;transition-property:opacity;transition-timing-function:ease-in-out;z-index:9999}.bs-modal:where([data-shown]){opacity:1}@media (min-width: 752px){.bs-modal{left:50%;margin:0;max-height:40.625rem;transform:translate(-50%, -50%);width:35rem}}bs-modal{display:block}.close-button-container{display:flex;justify-content:flex-end;margin-bottom:1.5rem}.close-button{cursor:pointer}";

const BsModal = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.close = createEvent(this, "close", 7);
    this.enterend = createEvent(this, "enterend", 3);
    this.leaveend = createEvent(this, "leaveend", 3);
    this.isVisible = false;
    this.alert = false;
    this.closeButton = true;
    this.enterControlled = false;
    this.enterTrigger = false;
    this.leaveTrigger = false;
  }
  /** Close the modal on Escape key. */
  handleEscape(ev) {
    if (this.isVisible && ev.key === 'Escape') {
      this.close.emit();
    }
  }
  handleEnterEnd() {
    this.isVisible = true;
    this.enterend.emit();
  }
  render() {
    return (h(Host, null, h("bs-overlay", { enterControlled: this.enterControlled, enterTrigger: this.enterTrigger, leaveTrigger: this.leaveTrigger }), h("bs-transition", { enterAttribute: 'data-shown', enterDuration: 75, enterControlled: this.enterControlled, enterTrigger: this.enterTrigger, leaveTrigger: this.leaveTrigger, onEnterend: () => this.handleEnterEnd(), onLeaveend: () => this.leaveend.emit() }, h("div", { class: "bs-modal", role: this.alert ? 'alertdialog' : 'dialog', "aria-modal": "true" }, this.closeButton && (h("div", { class: "close-button-container" }, h("button", { type: "button", title: "Close", "aria-label": "Close", onClick: () => this.close.emit() }, h("bs-icon-close", { class: "close-button" })))), h("slot", null)))));
  }
};
BsModal.style = bsModalCss;

export { BsModal as bs_modal };

//# sourceMappingURL=bs-modal.entry.js.map