@immich/ui 0.23.5 → 0.23.7

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.
@@ -12,14 +12,13 @@
12
12
  import type { ModalSize } from '../../types.js';
13
13
  import { cleanClass } from '../../utils.js';
14
14
  import { Dialog } from 'bits-ui';
15
- import { type Snippet } from 'svelte';
15
+ import { tick, type Snippet } from 'svelte';
16
16
  import { tv } from 'tailwind-variants';
17
17
 
18
18
  type Props = {
19
19
  title: string;
20
20
  size?: ModalSize;
21
21
  class?: string;
22
- open?: boolean;
23
22
  icon?: string | boolean;
24
23
  expandable?: boolean;
25
24
  children: Snippet;
@@ -29,7 +28,6 @@
29
28
  let {
30
29
  title,
31
30
  size = 'medium',
32
- open = true,
33
31
  icon = true,
34
32
  onClose,
35
33
  class: className,
@@ -54,23 +52,24 @@
54
52
  const bodyChildren = $derived(getChildSnippet(ChildKey.ModalBody));
55
53
  const footerChildren = $derived(getChildSnippet(ChildKey.ModalFooter));
56
54
 
57
- const onChange = (value: boolean) => {
58
- if (!value) {
59
- onClose?.();
60
- }
55
+ const handleClose = async () => {
56
+ // wait for bits-ui to complete its event cycle
57
+ await tick();
58
+ await new Promise((resolve) => setTimeout(resolve, 10));
59
+
60
+ onClose?.();
61
61
  };
62
62
  </script>
63
63
 
64
- <Dialog.Root {open} onOpenChange={onChange}>
64
+ <Dialog.Root open={true}>
65
65
  <Dialog.Portal>
66
66
  <Dialog.Overlay class="fixed start-0 top-0 flex h-dvh w-screen bg-black/30" />
67
67
  <Dialog.Content
68
68
  onkeydown={(e) => {
69
- if (e.key === 'Escape' && open) {
70
- // Stop propagation to ensure modals close before immich-web takes over
69
+ if (e.key === 'Escape') {
71
70
  e.stopPropagation();
72
- open = false;
73
- onClose?.();
71
+ e.preventDefault();
72
+ handleClose();
74
73
  }
75
74
  }}
76
75
  class={cleanClass(
@@ -87,9 +86,7 @@
87
86
  <Logo variant="icon" size="tiny" />
88
87
  {/if}
89
88
  <CardTitle tag="p" class="text-dark/90 grow text-lg font-semibold">{title}</CardTitle>
90
- <Dialog.Close>
91
- <CloseButton class="-me-2" />
92
- </Dialog.Close>
89
+ <CloseButton class="-me-2" onclick={() => handleClose()} />
93
90
  </div>
94
91
  </CardHeader>
95
92
 
@@ -4,7 +4,6 @@ type Props = {
4
4
  title: string;
5
5
  size?: ModalSize;
6
6
  class?: string;
7
- open?: boolean;
8
7
  icon?: string | boolean;
9
8
  expandable?: boolean;
10
9
  children: Snippet;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.23.5",
3
+ "version": "0.23.7",
4
4
  "license": "GNU Affero General Public License version 3",
5
5
  "scripts": {
6
6
  "create": "node scripts/create.js",
@@ -57,7 +57,7 @@
57
57
  "prettier-plugin-svelte": "^3.2.6",
58
58
  "prettier-plugin-tailwindcss": "^0.6.11",
59
59
  "publint": "^0.3.0",
60
- "svelte": "^5.0.0",
60
+ "svelte": "^5.37.0",
61
61
  "svelte-check": "^4.0.0",
62
62
  "svelte-highlight": "^7.8.0",
63
63
  "tailwindcss": "^4.1.7",