@immich/ui 0.30.0 → 0.31.0
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.
- package/README.md +9 -17
- package/dist/actions/shortcut.js +1 -1
- package/dist/components/Alert/Alert.svelte +92 -94
- package/dist/components/AppShell/AppShell.svelte +26 -26
- package/dist/components/AppShell/AppShellHeader.svelte +8 -8
- package/dist/components/AppShell/AppShellSidebar.svelte +20 -20
- package/dist/components/AppShell/PageLayout.svelte +29 -35
- package/dist/components/Avatar/Avatar.svelte +45 -55
- package/dist/components/Button/Button.svelte +3 -3
- package/dist/components/Card/Card.svelte +131 -135
- package/dist/components/Card/CardBody.svelte +9 -9
- package/dist/components/Card/CardDescription.svelte +9 -9
- package/dist/components/Card/CardFooter.svelte +9 -9
- package/dist/components/Card/CardHeader.svelte +9 -9
- package/dist/components/Card/CardTitle.svelte +14 -14
- package/dist/components/Checkbox/Checkbox.svelte +109 -110
- package/dist/components/CloseButton/CloseButton.svelte +12 -17
- package/dist/components/Code/Code.svelte +72 -65
- package/dist/components/Code/Code.svelte.d.ts +1 -1
- package/dist/components/CodeBlock/CodeBlock.svelte +74 -0
- package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +14 -0
- package/dist/components/CommandPalette/CommandPalette.svelte +126 -131
- package/dist/components/CommandPalette/CommandPaletteItem.svelte +61 -61
- package/dist/components/ConfirmModal/ConfirmModal.svelte +48 -48
- package/dist/components/Container/Container.svelte +25 -25
- package/dist/components/Field/Field.svelte +21 -21
- package/dist/components/FormatBytes/FormatBytes.svelte +9 -9
- package/dist/components/Heading/Heading.svelte +41 -47
- package/dist/components/HelperText/HelperText.svelte +17 -17
- package/dist/components/Icon/Icon.svelte +37 -42
- package/dist/components/IconButton/IconButton.svelte +6 -13
- package/dist/components/Input/Input.svelte +149 -152
- package/dist/components/Kbd/Kbd.svelte +25 -25
- package/dist/components/Label/Label.svelte +6 -6
- package/dist/components/Link/Link.svelte +18 -25
- package/dist/components/LoadingSpinner/LoadingSpinner.svelte +46 -46
- package/dist/components/Logo/Logo.svelte +53 -53
- package/dist/components/Modal/Modal.svelte +110 -114
- package/dist/components/Modal/ModalBody.svelte +8 -8
- package/dist/components/Modal/ModalFooter.svelte +8 -8
- package/dist/components/Modal/ModalHeader.svelte +8 -8
- package/dist/components/MultiSelect/MultiSelect.svelte +7 -7
- package/dist/components/Navbar/NavbarGroup.svelte +5 -5
- package/dist/components/Navbar/NavbarItem.svelte +59 -61
- package/dist/components/PasswordInput/PasswordInput.svelte +29 -31
- package/dist/components/Scrollable/Scrollable.svelte +49 -49
- package/dist/components/Select/Select.svelte +9 -9
- package/dist/components/Stack/HStack.svelte +4 -4
- package/dist/components/Stack/Stack.svelte +62 -62
- package/dist/components/Stack/VStack.svelte +4 -4
- package/dist/components/SupporterBadge/SupporterBadge.svelte +80 -80
- package/dist/components/Switch/Switch.svelte +95 -96
- package/dist/components/Text/Text.svelte +27 -34
- package/dist/components/Textarea/Textarea.svelte +103 -104
- package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +30 -43
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/Button.svelte +177 -177
- package/dist/internal/Child.svelte +21 -21
- package/dist/internal/Select.svelte +151 -158
- package/dist/internal/Text.svelte +50 -50
- package/dist/internal/Text.svelte.d.ts +2 -1
- package/dist/services/translation.svelte.d.ts +2 -0
- package/dist/services/translation.svelte.js +4 -0
- package/dist/site/SiteFooter.svelte +60 -76
- package/dist/site/SiteFooterLink.svelte +14 -14
- package/dist/site/constants.d.ts +7 -3
- package/dist/site/constants.js +17 -3
- package/dist/theme/default.css +40 -40
- package/dist/utilities/byte-units.js +2 -13
- package/package.json +77 -77
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
import type { Color, Size } from '../../types.js';
|
|
3
|
+
import { cleanClass } from '../../utils.js';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
6
|
+
import { tv } from 'tailwind-variants';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
type Props = {
|
|
9
|
+
size?: Size;
|
|
10
|
+
color?: Color;
|
|
11
|
+
class?: string;
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
} & HTMLAttributes<HTMLElement>;
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const { class: className, size = 'small', children, ...restProps }: Props = $props();
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
const styles = tv({
|
|
18
|
+
base: 'bg-subtle text-dark flex flex-col rounded-md border border-b-2 px-1 font-mono shadow',
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
21
|
+
tiny: 'text-xs',
|
|
22
|
+
small: 'text-sm',
|
|
23
|
+
medium: 'text-base',
|
|
24
|
+
large: 'text-lg',
|
|
25
|
+
giant: 'text-xl',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
31
|
<kbd class={cleanClass(styles({ size }), className)} {...restProps}>
|
|
32
|
-
|
|
32
|
+
{@render children?.()}
|
|
33
33
|
</kbd>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { styles } from '../../styles.js';
|
|
3
|
+
import type { LabelProps } from '../../types.js';
|
|
4
|
+
import { cleanClass } from '../../utils.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const { label, size, color, class: className, children, ...restProps }: LabelProps = $props();
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<label class={cleanClass(styles.label({ size, color }), className)} {...restProps}>
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
{#if label}{label}{/if}
|
|
11
|
+
{@render children?.()}
|
|
12
12
|
</label>
|
|
@@ -1,33 +1,26 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { cleanClass } from '../../utils.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
type Props = {
|
|
7
|
+
class?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
href: string;
|
|
10
|
+
underline?: boolean;
|
|
11
|
+
external?: boolean;
|
|
12
|
+
} & HTMLAnchorAttributes;
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
href,
|
|
16
|
-
class: className,
|
|
17
|
-
underline = true,
|
|
18
|
-
external,
|
|
19
|
-
children,
|
|
20
|
-
...restProps
|
|
21
|
-
}: Props = $props();
|
|
14
|
+
const { href, class: className, underline = true, external, children, ...restProps }: Props = $props();
|
|
22
15
|
</script>
|
|
23
16
|
|
|
24
17
|
<a
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
{href}
|
|
19
|
+
draggable="false"
|
|
20
|
+
class={cleanClass(underline && 'underline', className)}
|
|
21
|
+
target={external ? '_blank' : undefined}
|
|
22
|
+
rel={external ? 'noopener noreferrer' : undefined}
|
|
23
|
+
{...restProps}
|
|
31
24
|
>
|
|
32
|
-
|
|
25
|
+
{@render children()}
|
|
33
26
|
</a>
|
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Color, Size } from '../../types.js';
|
|
3
|
+
import { cleanClass } from '../../utils.js';
|
|
4
|
+
import { tv } from 'tailwind-variants';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
size?: Size;
|
|
8
|
+
color?: Color;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
let { size = 'medium', color = 'primary', class: className }: Props = $props();
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
const styles = tv({
|
|
15
|
+
base: 'fill-primary animate-spin text-gray-400 dark:text-gray-600',
|
|
16
|
+
variants: {
|
|
17
|
+
size: {
|
|
18
|
+
tiny: 'h-3',
|
|
19
|
+
small: 'h-4',
|
|
20
|
+
medium: 'h-5',
|
|
21
|
+
large: 'h-6',
|
|
22
|
+
giant: 'h-12',
|
|
23
|
+
},
|
|
24
|
+
color: {
|
|
25
|
+
primary: 'fill-primary',
|
|
26
|
+
secondary: 'fill-dark',
|
|
27
|
+
success: 'fill-success',
|
|
28
|
+
danger: 'fill-danger',
|
|
29
|
+
warning: 'fill-warning',
|
|
30
|
+
info: 'fill-info',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
34
|
</script>
|
|
35
35
|
|
|
36
36
|
<div>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
<svg
|
|
38
|
+
role="status"
|
|
39
|
+
class={cleanClass(styles({ color, size }), className)}
|
|
40
|
+
viewBox="0 0 100 101"
|
|
41
|
+
fill="none"
|
|
42
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
43
|
+
data-testid="loading-spinner"
|
|
44
|
+
>
|
|
45
|
+
<path
|
|
46
|
+
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
|
|
47
|
+
fill="currentColor"
|
|
48
|
+
/>
|
|
49
|
+
<path
|
|
50
|
+
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
|
|
51
|
+
fill="currentFill"
|
|
52
|
+
/>
|
|
53
|
+
</svg>
|
|
54
54
|
</div>
|
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
import futoDark from '../../assets/immich-logo-futo-dark.svg';
|
|
3
|
+
import futoLight from '../../assets/immich-logo-futo-light.svg';
|
|
4
|
+
import inlineDark from '../../assets/immich-logo-inline-dark.svg';
|
|
5
|
+
import inlineLight from '../../assets/immich-logo-inline-light.svg';
|
|
6
|
+
import stackedDark from '../../assets/immich-logo-stacked-dark.svg';
|
|
7
|
+
import stackedLight from '../../assets/immich-logo-stacked-light.svg';
|
|
8
|
+
import icon from '../../assets/immich-logo.svg';
|
|
9
|
+
import { theme } from '../../services/theme.svelte.js';
|
|
10
|
+
import { Theme, type Size } from '../../types.js';
|
|
11
|
+
import { cleanClass } from '../../utils.js';
|
|
12
|
+
import { tv } from 'tailwind-variants';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
type Props = {
|
|
15
|
+
size?: Size | 'landing';
|
|
16
|
+
variant?: 'stacked' | 'inline' | 'logo' | 'icon' | 'stacked-futo';
|
|
17
|
+
class?: string;
|
|
18
|
+
};
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const { variant = 'logo', size = 'medium', class: className }: Props = $props();
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
const getUrl = (variant: Props['variant']): string => {
|
|
23
|
+
switch (variant) {
|
|
24
|
+
case 'stacked': {
|
|
25
|
+
return theme.value === Theme.Light ? stackedLight : stackedDark;
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
case 'inline': {
|
|
29
|
+
return theme.value === Theme.Light ? inlineLight : inlineDark;
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
case 'stacked-futo': {
|
|
33
|
+
return theme.value === Theme.Light ? futoLight : futoDark;
|
|
34
|
+
}
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
default: {
|
|
37
|
+
return icon;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
const styles = tv({
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
tiny: 'h-8',
|
|
46
|
+
small: 'h-10',
|
|
47
|
+
medium: 'h-12',
|
|
48
|
+
large: 'h-16',
|
|
49
|
+
giant: 'h-24',
|
|
50
|
+
landing: 'h-64',
|
|
51
|
+
},
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
variant: {
|
|
54
|
+
stacked: '',
|
|
55
|
+
inline: '',
|
|
56
|
+
'stacked-futo': '',
|
|
57
|
+
logo: 'bg-light aspect-square rounded-full shadow-lg',
|
|
58
|
+
icon: 'aspect-square',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
const src = $derived(getUrl(variant));
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<img {src} class={cleanClass(styles({ size, variant }), className)} alt="Immich logo" />
|
|
@@ -1,131 +1,127 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
import { withChildrenSnippets } from '../../common/use-child.svelte.js';
|
|
3
|
+
import Card from '../Card/Card.svelte';
|
|
4
|
+
import CardBody from '../Card/CardBody.svelte';
|
|
5
|
+
import CardFooter from '../Card/CardFooter.svelte';
|
|
6
|
+
import CardHeader from '../Card/CardHeader.svelte';
|
|
7
|
+
import CardTitle from '../Card/CardTitle.svelte';
|
|
8
|
+
import CloseButton from '../CloseButton/CloseButton.svelte';
|
|
9
|
+
import Icon from '../Icon/Icon.svelte';
|
|
10
|
+
import Logo from '../Logo/Logo.svelte';
|
|
11
|
+
import { ChildKey } from '../../constants.js';
|
|
12
|
+
import type { ModalSize } from '../../types.js';
|
|
13
|
+
import { cleanClass } from '../../utils.js';
|
|
14
|
+
import { Dialog } from 'bits-ui';
|
|
15
|
+
import { tick, type Snippet } from 'svelte';
|
|
16
|
+
import { tv } from 'tailwind-variants';
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
type Props = {
|
|
19
|
+
title?: string;
|
|
20
|
+
icon?: string | boolean;
|
|
21
|
+
size?: ModalSize;
|
|
22
|
+
class?: string;
|
|
23
|
+
expandable?: boolean;
|
|
24
|
+
closeOnEsc?: boolean;
|
|
25
|
+
closeOnBackdropClick?: boolean;
|
|
26
|
+
children: Snippet;
|
|
27
|
+
onClose?: () => void;
|
|
28
|
+
};
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
let {
|
|
31
|
+
size = 'medium',
|
|
32
|
+
onClose,
|
|
33
|
+
icon = true,
|
|
34
|
+
title,
|
|
35
|
+
class: className,
|
|
36
|
+
closeOnEsc = true,
|
|
37
|
+
closeOnBackdropClick = false,
|
|
38
|
+
children,
|
|
39
|
+
}: Props = $props();
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
41
|
+
const modalStyles = tv({
|
|
42
|
+
base: 'bg-light dark:bg-subtle border-subtle shadow-primary/20 flex rounded-none border shadow-sm sm:rounded-2xl dark:border-white/10',
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
tiny: 'h-full sm:h-min md:max-w-sm',
|
|
46
|
+
small: 'h-full sm:h-min md:max-w-md',
|
|
47
|
+
medium: 'h-full sm:h-min md:max-w-(--breakpoint-sm)',
|
|
48
|
+
large: 'h-full sm:h-min md:max-w-(--breakpoint-md)',
|
|
49
|
+
giant: 'h-full sm:h-min md:max-w-(--breakpoint-lg)',
|
|
50
|
+
full: 'h-full w-full',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const { getChildren: getChildSnippet } = withChildrenSnippets(ChildKey.Modal);
|
|
56
|
+
const headerChildren = $derived(getChildSnippet(ChildKey.ModalHeader));
|
|
57
|
+
const bodyChildren = $derived(getChildSnippet(ChildKey.ModalBody));
|
|
58
|
+
const footerChildren = $derived(getChildSnippet(ChildKey.ModalFooter));
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const handleClose = async () => {
|
|
61
|
+
// wait for bits-ui to complete its event cycle
|
|
62
|
+
await tick();
|
|
63
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
onClose?.();
|
|
66
|
+
};
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
let cardRef = $state<HTMLElement | null>(null);
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
const handleCloseOnClick = (event: Event) => {
|
|
71
|
+
if (!closeOnBackdropClick || cardRef?.contains(event.target as Node)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
onClose?.();
|
|
76
|
+
};
|
|
77
77
|
</script>
|
|
78
78
|
|
|
79
79
|
<Dialog.Root open={true}>
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<CloseButton class="-me-2" onclick={() => handleClose()} />
|
|
113
|
-
</div>
|
|
114
|
-
{/if}
|
|
115
|
-
</CardHeader>
|
|
80
|
+
<Dialog.Portal>
|
|
81
|
+
<Dialog.Overlay class="fixed start-0 top-0 flex h-dvh w-screen bg-black/30" />
|
|
82
|
+
<Dialog.Content
|
|
83
|
+
onkeydown={(e) => {
|
|
84
|
+
if (e.key === 'Escape') {
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
if (closeOnEsc) {
|
|
88
|
+
handleClose();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}}
|
|
92
|
+
onclick={handleCloseOnClick}
|
|
93
|
+
class={cleanClass('fixed start-0 top-0 flex h-dvh w-screen items-center justify-center overflow-hidden sm:p-4')}
|
|
94
|
+
>
|
|
95
|
+
<div class={cleanClass('flex h-full w-full flex-col items-center justify-center')}>
|
|
96
|
+
<Card bind:ref={cardRef} class={cleanClass(modalStyles({ size }), className)}>
|
|
97
|
+
<CardHeader class="border-b border-gray-200 px-5 py-3 dark:border-white/10">
|
|
98
|
+
{#if headerChildren}
|
|
99
|
+
{@render headerChildren.snippet()}
|
|
100
|
+
{:else if title}
|
|
101
|
+
<div class="flex items-center justify-between gap-2">
|
|
102
|
+
{#if typeof icon === 'string'}
|
|
103
|
+
<Icon {icon} size="1.5rem" aria-hidden />
|
|
104
|
+
{:else if icon}
|
|
105
|
+
<Logo variant="icon" size="tiny" />
|
|
106
|
+
{/if}
|
|
107
|
+
<CardTitle tag="p" class="text-dark/90 grow text-lg font-semibold">{title}</CardTitle>
|
|
108
|
+
<CloseButton class="-me-2" onclick={() => handleClose()} />
|
|
109
|
+
</div>
|
|
110
|
+
{/if}
|
|
111
|
+
</CardHeader>
|
|
116
112
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
113
|
+
<CardBody class="grow px-5">
|
|
114
|
+
{@render bodyChildren?.snippet()}
|
|
115
|
+
</CardBody>
|
|
120
116
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
117
|
+
{#if footerChildren}
|
|
118
|
+
<CardFooter class="border-t border-gray-200 dark:border-white/10">
|
|
119
|
+
{@render footerChildren.snippet()}
|
|
120
|
+
</CardFooter>
|
|
121
|
+
{/if}
|
|
122
|
+
</Card>
|
|
123
|
+
</div>
|
|
124
|
+
</Dialog.Content>
|
|
125
|
+
</Dialog.Portal>
|
|
130
126
|
</Dialog.Root>
|
|
131
127
|
{@render children?.()}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ChildKey } from '../../constants.js';
|
|
3
|
+
import Child from '../../internal/Child.svelte';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type Props = {
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
let { children }: Props = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<Child for={ChildKey.Modal} as={ChildKey.ModalBody}>
|
|
14
|
-
|
|
14
|
+
{@render children?.()}
|
|
15
15
|
</Child>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ChildKey } from '../../constants.js';
|
|
3
|
+
import Child from '../../internal/Child.svelte';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type Props = {
|
|
7
|
+
children: Snippet;
|
|
8
|
+
};
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
let { children }: Props = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<Child for={ChildKey.Modal} as={ChildKey.ModalFooter}>
|
|
14
|
-
|
|
14
|
+
{@render children?.()}
|
|
15
15
|
</Child>
|