'use strict';

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

const index = require('./index-305226cb.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) {
    index.registerInstance(this, hostRef);
    this.close = index.createEvent(this, "close", 7);
    this.enterend = index.createEvent(this, "enterend", 3);
    this.leaveend = index.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 (index.h(index.Host, null, index.h("bs-overlay", { enterControlled: this.enterControlled, enterTrigger: this.enterTrigger, leaveTrigger: this.leaveTrigger }), index.h("bs-transition", { enterAttribute: 'data-shown', enterDuration: 75, enterControlled: this.enterControlled, enterTrigger: this.enterTrigger, leaveTrigger: this.leaveTrigger, onEnterend: () => this.handleEnterEnd(), onLeaveend: () => this.leaveend.emit() }, index.h("div", { class: "bs-modal", role: this.alert ? 'alertdialog' : 'dialog', "aria-modal": "true" }, this.closeButton && (index.h("div", { class: "close-button-container" }, index.h("button", { type: "button", title: "Close", "aria-label": "Close", onClick: () => this.close.emit() }, index.h("bs-icon-close", { class: "close-button" })))), index.h("slot", null)))));
  }
};
BsModal.style = bsModalCss;

exports.bs_modal = BsModal;

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