| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  | <script lang="ts"> | 
					
						
							|  |  |  |   import { Modal } from "flowbite-svelte" | 
					
						
							|  |  |  |   import { UIEventSource } from "../../Logic/UIEventSource" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Basically a flowbite-svelte modal made more ergonomical | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   export let fullscreen: boolean = false | 
					
						
							| 
									
										
										
										
											2024-11-05 00:18:16 +01:00
										 |  |  |   export let bodyPadding = "p-4 md:p-5 " | 
					
						
							|  |  |  |   export let shown: UIEventSource<boolean> | 
					
						
							|  |  |  |   export let dismissable = true | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * Default: 50 | 
					
						
							|  |  |  |    */ | 
					
						
							| 
									
										
										
										
											2024-11-07 11:19:15 +01:00
										 |  |  |   export let zIndex: string = "z-50" | 
					
						
							| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-19 14:44:55 +02:00
										 |  |  |   const shared = | 
					
						
							|  |  |  |     "in-page normal-background dark:bg-gray-800 rounded-lg border-gray-200 dark:border-gray-700 border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700 shadow-md" | 
					
						
							| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  |   let defaultClass = "relative flex flex-col mx-auto w-full divide-y " + shared | 
					
						
							|  |  |  |   if (fullscreen) { | 
					
						
							|  |  |  |     defaultClass = shared | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-11-07 11:19:15 +01:00
										 |  |  |   let dialogClass = "fixed top-0 start-0 end-0 h-modal inset-0 w-full p-4 flex " + zIndex | 
					
						
							| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  |   if (fullscreen) { | 
					
						
							|  |  |  |     dialogClass += " h-full-child" | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   let bodyClass = bodyPadding + " h-full space-y-4 flex-1 overflow-y-auto overscroll-contain" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   let headerClass = "flex justify-between items-center p-2 px-4 md:px-5 rounded-t-lg" | 
					
						
							| 
									
										
										
										
											2024-09-04 02:48:36 +02:00
										 |  |  |   if (!$$slots.header) { | 
					
						
							|  |  |  |     headerClass = "hidden" | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  |   let _shown = false | 
					
						
							| 
									
										
										
										
											2024-10-19 14:44:55 +02:00
										 |  |  |   shown.addCallbackAndRun((sh) => { | 
					
						
							| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  |     _shown = sh | 
					
						
							|  |  |  |   }) | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-10-19 14:44:55 +02:00
										 |  |  | <Modal | 
					
						
							|  |  |  |   open={_shown} | 
					
						
							|  |  |  |   on:close={() => shown.set(false)} | 
					
						
							|  |  |  |   outsideclose | 
					
						
							|  |  |  |   size="xl" | 
					
						
							|  |  |  |   {dismissable} | 
					
						
							|  |  |  |   {defaultClass} | 
					
						
							|  |  |  |   {bodyClass} | 
					
						
							|  |  |  |   {dialogClass} | 
					
						
							|  |  |  |   {headerClass} | 
					
						
							|  |  |  |   color="none" | 
					
						
							|  |  |  | > | 
					
						
							| 
									
										
										
										
											2024-09-04 02:48:36 +02:00
										 |  |  |   <svelte:fragment slot="header"> | 
					
						
							|  |  |  |     {#if $$slots.header} | 
					
						
							|  |  |  |       <h1 class="page-header w-full"> | 
					
						
							|  |  |  |         <slot name="header" /> | 
					
						
							|  |  |  |       </h1> | 
					
						
							|  |  |  |     {/if} | 
					
						
							|  |  |  |   </svelte:fragment> | 
					
						
							| 
									
										
										
										
											2024-09-04 01:50:34 +02:00
										 |  |  |   <slot /> | 
					
						
							|  |  |  |   {#if $$slots.footer} | 
					
						
							|  |  |  |     <slot name="footer" /> | 
					
						
							|  |  |  |   {/if} | 
					
						
							|  |  |  | </Modal> |