| class CustomModals extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| .modal { | |
| position: fixed; | |
| inset: 0; | |
| z-index: 50; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| background-color: rgba(0, 0, 0, 0.5); | |
| backdrop-filter: blur(4px); | |
| opacity: 0; | |
| pointer-events: none; | |
| transition: opacity 0.25s ease; | |
| } | |
| .modal-content { | |
| background-color: white; | |
| width: 100%; | |
| max-width: 24rem; | |
| border-radius: 0.5rem; | |
| box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); | |
| padding: 1.5rem; | |
| transform: translateY(-2.5rem); | |
| transition: transform 0.25s ease; | |
| } | |
| .modal:not(.opacity-0) { | |
| opacity: 1; | |
| pointer-events: auto; | |
| } | |
| .modal-content:not(.translate-y-10) { | |
| transform: translateY(0); | |
| } | |
| </style> | |
| <!-- Loading Modal --> | |
| <div id="loading-modal" class="modal"> | |
| <div class="modal-content text-center"> | |
| <div class="animate-spin h-12 w-12 text-indigo-600 mx-auto"> | |
| <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><path d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg> | |
| </div> | |
| <p id="loading-message" class="text-sm font-medium text-slate-700 mt-4">Loading...</p> | |
| </div> | |
| </div> | |
| <!-- Other modals would be defined here --> | |
| `; | |
| } | |
| } | |
| customElements.define('custom-modals', CustomModals); |