runeforge 0.0.42 → 0.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,8 @@
5
5
  let {
6
6
  title = '',
7
7
  onClose,
8
+ closeOnClickOutside = true,
9
+ onClickOutside,
8
10
  children,
9
11
  class: additionalClass,
10
12
  width,
@@ -14,6 +16,10 @@
14
16
  }: {
15
17
  title?: string;
16
18
  onClose?: () => void;
19
+ /** Whether clicking the backdrop (outside the modal box) closes the modal. */
20
+ closeOnClickOutside?: boolean;
21
+ /** Callback invoked when clicking outside the modal. Defaults to `onClose`. */
22
+ onClickOutside?: () => void;
17
23
  children: Snippet;
18
24
  /** Extra classes merged onto the modal box, e.g. Tailwind size utilities
19
25
  * like `max-w-4xl` or `w-11/12`. */
@@ -26,6 +32,8 @@
26
32
  maxHeight?: string;
27
33
  } = $props();
28
34
 
35
+ const handleClickOutside = $derived(onClickOutside ?? onClose);
36
+
29
37
  const boxStyle = $derived(
30
38
  [
31
39
  width ? `width:${width}` : '',
@@ -59,9 +67,9 @@
59
67
  {@render children()}
60
68
  </div>
61
69
 
62
- {#if onClose}
70
+ {#if closeOnClickOutside && handleClickOutside}
63
71
  <div class="modal-backdrop">
64
- <button onclick={onClose} aria-label="Cerrar"></button>
72
+ <button onclick={handleClickOutside} aria-label="Cerrar"></button>
65
73
  </div>
66
74
  {/if}
67
75
  </dialog>
@@ -2,6 +2,10 @@ import type { Snippet } from 'svelte';
2
2
  type $$ComponentProps = {
3
3
  title?: string;
4
4
  onClose?: () => void;
5
+ /** Whether clicking the backdrop (outside the modal box) closes the modal. */
6
+ closeOnClickOutside?: boolean;
7
+ /** Callback invoked when clicking outside the modal. Defaults to `onClose`. */
8
+ onClickOutside?: () => void;
5
9
  children: Snippet;
6
10
  /** Extra classes merged onto the modal box, e.g. Tailwind size utilities
7
11
  * like `max-w-4xl` or `w-11/12`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runeforge",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "SvelteKit toolkit for building metadata-driven CRUD interfaces with tables, forms, and actions",
5
5
  "license": "MIT",
6
6
  "author": "Ezequiel Puerta",