@immich/ui 0.54.0 → 0.56.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/dist/components/BasicModal/BasicModal.svelte +38 -0
- package/dist/components/BasicModal/BasicModal.svelte.d.ts +14 -0
- package/dist/components/ConfirmModal/ConfirmModal.svelte +4 -4
- package/dist/components/ConfirmModal/ConfirmModal.svelte.d.ts +1 -2
- package/dist/components/FormModal/FormModal.svelte +19 -5
- package/dist/components/FormModal/FormModal.svelte.d.ts +6 -1
- package/dist/components/Textarea/Textarea.svelte +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Button from '../Button/Button.svelte';
|
|
3
|
+
import Modal from '../Modal/Modal.svelte';
|
|
4
|
+
import ModalBody from '../Modal/ModalBody.svelte';
|
|
5
|
+
import ModalFooter from '../Modal/ModalFooter.svelte';
|
|
6
|
+
import { t } from '../../services/translation.svelte.js';
|
|
7
|
+
import type { Color, ModalSize } from '../../types.js';
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
|
|
10
|
+
type Props = {
|
|
11
|
+
title: string;
|
|
12
|
+
icon?: string | boolean;
|
|
13
|
+
closeText?: string;
|
|
14
|
+
closeColor?: Color;
|
|
15
|
+
size?: ModalSize;
|
|
16
|
+
onClose: () => void;
|
|
17
|
+
children: Snippet;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
title,
|
|
22
|
+
icon,
|
|
23
|
+
closeText = t('close'),
|
|
24
|
+
closeColor = 'secondary',
|
|
25
|
+
size = 'small',
|
|
26
|
+
onClose = () => {},
|
|
27
|
+
children,
|
|
28
|
+
}: Props = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Modal {title} {onClose} {size} {icon}>
|
|
32
|
+
<ModalBody {children} />
|
|
33
|
+
<ModalFooter>
|
|
34
|
+
<Button shape="round" color={closeColor} fullWidth onclick={onClose}>
|
|
35
|
+
{closeText}
|
|
36
|
+
</Button>
|
|
37
|
+
</ModalFooter>
|
|
38
|
+
</Modal>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Color, ModalSize } from '../../types.js';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
type Props = {
|
|
4
|
+
title: string;
|
|
5
|
+
icon?: string | boolean;
|
|
6
|
+
closeText?: string;
|
|
7
|
+
closeColor?: Color;
|
|
8
|
+
size?: ModalSize;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
};
|
|
12
|
+
declare const BasicModal: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type BasicModal = ReturnType<typeof BasicModal>;
|
|
14
|
+
export default BasicModal;
|
|
@@ -11,13 +11,12 @@
|
|
|
11
11
|
interface Props {
|
|
12
12
|
title?: string;
|
|
13
13
|
icon?: string | boolean;
|
|
14
|
-
prompt?: string;
|
|
14
|
+
prompt?: string | Snippet;
|
|
15
15
|
confirmText?: string;
|
|
16
16
|
confirmColor?: Color;
|
|
17
17
|
disabled?: boolean;
|
|
18
18
|
size?: ModalSize;
|
|
19
19
|
onClose: (confirmed: boolean) => void;
|
|
20
|
-
promptSnippet?: Snippet;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
let {
|
|
@@ -29,7 +28,6 @@
|
|
|
29
28
|
disabled = false,
|
|
30
29
|
size = 'small',
|
|
31
30
|
onClose,
|
|
32
|
-
promptSnippet,
|
|
33
31
|
}: Props = $props();
|
|
34
32
|
|
|
35
33
|
const handleConfirm = () => {
|
|
@@ -39,8 +37,10 @@
|
|
|
39
37
|
|
|
40
38
|
<Modal {title} onClose={() => onClose(false)} {size} {icon}>
|
|
41
39
|
<ModalBody>
|
|
42
|
-
{#if
|
|
40
|
+
{#if typeof prompt === 'string'}
|
|
43
41
|
<p>{prompt}</p>
|
|
42
|
+
{:else}
|
|
43
|
+
{@render prompt()}
|
|
44
44
|
{/if}
|
|
45
45
|
</ModalBody>
|
|
46
46
|
|
|
@@ -3,13 +3,12 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
title?: string;
|
|
5
5
|
icon?: string | boolean;
|
|
6
|
-
prompt?: string;
|
|
6
|
+
prompt?: string | Snippet;
|
|
7
7
|
confirmText?: string;
|
|
8
8
|
confirmColor?: Color;
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
size?: ModalSize;
|
|
11
11
|
onClose: (confirmed: boolean) => void;
|
|
12
|
-
promptSnippet?: Snippet;
|
|
13
12
|
}
|
|
14
13
|
declare const ConfirmModal: import("svelte").Component<Props, {}, "">;
|
|
15
14
|
type ConfirmModal = ReturnType<typeof ConfirmModal>;
|
|
@@ -14,12 +14,15 @@
|
|
|
14
14
|
icon?: string | boolean;
|
|
15
15
|
submitText?: string;
|
|
16
16
|
submitColor?: Color;
|
|
17
|
+
cancelText?: string;
|
|
18
|
+
cancelColor?: Color;
|
|
17
19
|
disabled?: boolean;
|
|
18
20
|
size?: ModalSize;
|
|
19
21
|
preventDefault?: boolean;
|
|
20
22
|
onClose: () => void;
|
|
23
|
+
onReset?: (event: Event) => void;
|
|
21
24
|
onSubmit: (event: SubmitEvent) => void;
|
|
22
|
-
children: Snippet
|
|
25
|
+
children: Snippet<[{ formId: string }]>;
|
|
23
26
|
};
|
|
24
27
|
|
|
25
28
|
let {
|
|
@@ -27,10 +30,13 @@
|
|
|
27
30
|
icon,
|
|
28
31
|
submitText = t('save'),
|
|
29
32
|
submitColor = 'primary',
|
|
33
|
+
cancelText = t('cancel'),
|
|
34
|
+
cancelColor = 'secondary',
|
|
30
35
|
disabled = false,
|
|
31
36
|
size = 'small',
|
|
32
37
|
preventDefault = true,
|
|
33
38
|
onClose = () => {},
|
|
39
|
+
onReset,
|
|
34
40
|
onSubmit,
|
|
35
41
|
children,
|
|
36
42
|
}: Props = $props();
|
|
@@ -43,19 +49,27 @@
|
|
|
43
49
|
onSubmit(event);
|
|
44
50
|
};
|
|
45
51
|
|
|
52
|
+
const onreset = (event: Event) => {
|
|
53
|
+
if (preventDefault) {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
onReset?.(event);
|
|
58
|
+
};
|
|
59
|
+
|
|
46
60
|
const formId = generateId();
|
|
47
61
|
</script>
|
|
48
62
|
|
|
49
63
|
<Modal {title} {onClose} {size} {icon}>
|
|
50
64
|
<ModalBody>
|
|
51
|
-
<form {onsubmit} id={formId}>
|
|
52
|
-
{@render children()}
|
|
65
|
+
<form {onsubmit} {onreset} id={formId}>
|
|
66
|
+
{@render children({ formId })}
|
|
53
67
|
</form>
|
|
54
68
|
</ModalBody>
|
|
55
69
|
<ModalFooter>
|
|
56
70
|
<HStack fullWidth>
|
|
57
|
-
<Button shape="round" color=
|
|
58
|
-
{
|
|
71
|
+
<Button shape="round" color={cancelColor} fullWidth onclick={onClose}>
|
|
72
|
+
{cancelText}
|
|
59
73
|
</Button>
|
|
60
74
|
<Button shape="round" type="submit" tabindex={1} color={submitColor} fullWidth {disabled} form={formId}>
|
|
61
75
|
{submitText}
|
|
@@ -5,12 +5,17 @@ type Props = {
|
|
|
5
5
|
icon?: string | boolean;
|
|
6
6
|
submitText?: string;
|
|
7
7
|
submitColor?: Color;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
cancelColor?: Color;
|
|
8
10
|
disabled?: boolean;
|
|
9
11
|
size?: ModalSize;
|
|
10
12
|
preventDefault?: boolean;
|
|
11
13
|
onClose: () => void;
|
|
14
|
+
onReset?: (event: Event) => void;
|
|
12
15
|
onSubmit: (event: SubmitEvent) => void;
|
|
13
|
-
children: Snippet
|
|
16
|
+
children: Snippet<[{
|
|
17
|
+
formId: string;
|
|
18
|
+
}]>;
|
|
14
19
|
};
|
|
15
20
|
declare const FormModal: import("svelte").Component<Props, {}, "">;
|
|
16
21
|
type FormModal = ReturnType<typeof FormModal>;
|
|
@@ -59,6 +59,17 @@
|
|
|
59
59
|
element.style.minHeight = '0';
|
|
60
60
|
element.style.height = 'auto';
|
|
61
61
|
element.style.height = `${element.scrollHeight}px`;
|
|
62
|
+
|
|
63
|
+
// Show scrollbar only if there is a max-height and content exceeds it
|
|
64
|
+
const maxHeight = Number.parseFloat(getComputedStyle(element).maxHeight);
|
|
65
|
+
const hasMaxHeight = maxHeight !== undefined;
|
|
66
|
+
if (hasMaxHeight && element.scrollHeight > maxHeight) {
|
|
67
|
+
element.style.overflow = 'auto';
|
|
68
|
+
} else if (hasMaxHeight && element.scrollHeight <= maxHeight) {
|
|
69
|
+
element.style.overflow = 'hidden';
|
|
70
|
+
} else {
|
|
71
|
+
element.style.overflow = '';
|
|
72
|
+
}
|
|
62
73
|
}
|
|
63
74
|
};
|
|
64
75
|
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { default as AppShellHeader } from './components/AppShell/AppShellHeader.
|
|
|
17
17
|
export { default as AppShellSidebar } from './components/AppShell/AppShellSidebar.svelte';
|
|
18
18
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
19
19
|
export { default as Badge } from './components/Badge/Badge.svelte';
|
|
20
|
+
export { default as BasicModal } from './components/BasicModal/BasicModal.svelte';
|
|
20
21
|
export { default as Breadcrumbs } from './components/Breadcrumbs/Breadcrumbs.svelte';
|
|
21
22
|
export { default as Button } from './components/Button/Button.svelte';
|
|
22
23
|
export { default as Card } from './components/Card/Card.svelte';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { default as AppShellHeader } from './components/AppShell/AppShellHeader.
|
|
|
19
19
|
export { default as AppShellSidebar } from './components/AppShell/AppShellSidebar.svelte';
|
|
20
20
|
export { default as Avatar } from './components/Avatar/Avatar.svelte';
|
|
21
21
|
export { default as Badge } from './components/Badge/Badge.svelte';
|
|
22
|
+
export { default as BasicModal } from './components/BasicModal/BasicModal.svelte';
|
|
22
23
|
export { default as Breadcrumbs } from './components/Breadcrumbs/Breadcrumbs.svelte';
|
|
23
24
|
export { default as Button } from './components/Button/Button.svelte';
|
|
24
25
|
export { default as Card } from './components/Card/Card.svelte';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@immich/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.56.0",
|
|
4
4
|
"license": "GNU Affero General Public License version 3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@immich/svelte-markdown-preprocess": "^0.1.0"
|
|
59
59
|
},
|
|
60
60
|
"volta": {
|
|
61
|
-
"node": "24.
|
|
61
|
+
"node": "24.12.0"
|
|
62
62
|
},
|
|
63
63
|
"scripts": {
|
|
64
64
|
"create": "node scripts/create.js",
|