@immich/ui 0.23.4 → 0.23.6

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.
@@ -10,6 +10,7 @@
10
10
 
11
11
  interface Props {
12
12
  title?: string;
13
+ icon?: string | boolean;
13
14
  prompt?: string;
14
15
  confirmText?: string;
15
16
  confirmColor?: Color;
@@ -21,6 +22,7 @@
21
22
 
22
23
  let {
23
24
  title = t('confirm'),
25
+ icon,
24
26
  prompt = t('prompt_default'),
25
27
  confirmText = t('confirm'),
26
28
  confirmColor = 'danger',
@@ -35,7 +37,7 @@
35
37
  };
36
38
  </script>
37
39
 
38
- <Modal {title} onClose={() => onClose(false)} {size}>
40
+ <Modal {title} onClose={() => onClose(false)} {size} {icon}>
39
41
  <ModalBody>
40
42
  {#if promptSnippet}{@render promptSnippet()}{:else}
41
43
  <p>{prompt}</p>
@@ -2,6 +2,7 @@ import type { Color } from '../../types.js';
2
2
  import type { Snippet } from 'svelte';
3
3
  interface Props {
4
4
  title?: string;
5
+ icon?: string | boolean;
5
6
  prompt?: string;
6
7
  confirmText?: string;
7
8
  confirmColor?: Color;
@@ -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;
@@ -10,8 +10,7 @@ class ModalManager {
10
10
  const deferred = new Promise((resolve) => {
11
11
  onClose = async (...args) => {
12
12
  await unmount(modal);
13
- // make sure bits-ui clean up finishes before resolving
14
- setTimeout(() => resolve(args?.[0]), 0);
13
+ resolve(args?.[0]);
15
14
  };
16
15
  modal = mount(Component, {
17
16
  target: document.body,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/ui",
3
- "version": "0.23.4",
3
+ "version": "0.23.6",
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",