@immich/ui 0.62.1 → 0.63.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.
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
size?: ModalSize;
|
|
21
21
|
preventDefault?: boolean;
|
|
22
22
|
onClose: () => void;
|
|
23
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
23
24
|
onReset?: (event: Event) => void;
|
|
24
25
|
onSubmit: (event: SubmitEvent) => void;
|
|
25
26
|
children: Snippet<[{ formId: string }]>;
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
size = 'small',
|
|
37
38
|
preventDefault = true,
|
|
38
39
|
onClose = () => {},
|
|
40
|
+
onOpenAutoFocus,
|
|
39
41
|
onReset,
|
|
40
42
|
onSubmit,
|
|
41
43
|
children,
|
|
@@ -60,7 +62,7 @@
|
|
|
60
62
|
const formId = generateId();
|
|
61
63
|
</script>
|
|
62
64
|
|
|
63
|
-
<Modal {title} {onClose} {size} {icon}>
|
|
65
|
+
<Modal {title} {onClose} {size} {icon} {onOpenAutoFocus}>
|
|
64
66
|
<ModalBody>
|
|
65
67
|
<form {onsubmit} {onreset} id={formId}>
|
|
66
68
|
{@render children({ formId })}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
children: Snippet;
|
|
29
29
|
onClose?: () => void;
|
|
30
30
|
onEscapeKeydown?: (event: KeyboardEvent) => void;
|
|
31
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
let {
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
closeOnEsc = true,
|
|
41
42
|
closeOnBackdropClick = false,
|
|
42
43
|
children,
|
|
44
|
+
onOpenAutoFocus,
|
|
43
45
|
}: Props = $props();
|
|
44
46
|
|
|
45
47
|
const modalStyles = tv({
|
|
@@ -105,6 +107,7 @@
|
|
|
105
107
|
<Dialog.Portal>
|
|
106
108
|
<Dialog.Overlay class="{zIndex.ModalBackdrop} fixed start-0 top-0 flex h-dvh max-h-dvh w-screen bg-black/30" />
|
|
107
109
|
<Dialog.Content
|
|
110
|
+
{onOpenAutoFocus}
|
|
108
111
|
onEscapeKeydown={handleEscapeKeydown}
|
|
109
112
|
{escapeKeydownBehavior}
|
|
110
113
|
{interactOutsideBehavior}
|
|
@@ -11,6 +11,7 @@ type Props = {
|
|
|
11
11
|
children: Snippet;
|
|
12
12
|
onClose?: () => void;
|
|
13
13
|
onEscapeKeydown?: (event: KeyboardEvent) => void;
|
|
14
|
+
onOpenAutoFocus?: (event: Event) => void;
|
|
14
15
|
};
|
|
15
16
|
declare const Modal: import("svelte").Component<Props, {}, "">;
|
|
16
17
|
type Modal = ReturnType<typeof Modal>;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { getLocale } from '../state/locale-state.svelte.js';
|
|
9
9
|
import { styleVariants } from '../styles.js';
|
|
10
10
|
import type { Shape, Size } from '../types.js';
|
|
11
|
-
import { cleanClass
|
|
11
|
+
import { cleanClass } from '../utilities/internal.js';
|
|
12
12
|
import type { DateValue } from '@internationalized/date';
|
|
13
13
|
import { mdiCalendar, mdiChevronLeft, mdiChevronRight } from '@mdi/js';
|
|
14
14
|
import { DatePicker } from 'bits-ui';
|
|
@@ -38,10 +38,6 @@
|
|
|
38
38
|
const { readOnly, required, invalid, disabled, label, ...labelProps } = $derived(context());
|
|
39
39
|
const size = $derived(initialSize ?? labelProps.size ?? 'small');
|
|
40
40
|
|
|
41
|
-
const id = generateId();
|
|
42
|
-
const inputId = `datepicker-${id}`;
|
|
43
|
-
const labelId = `label-${id}`;
|
|
44
|
-
|
|
45
41
|
const containerStyles = tv({
|
|
46
42
|
base: cleanClass(styleVariants.inputContainerCommon, 'flex w-full items-center'),
|
|
47
43
|
variants: {
|
|
@@ -67,10 +63,6 @@
|
|
|
67
63
|
</script>
|
|
68
64
|
|
|
69
65
|
<div class={cleanClass('flex w-full flex-col gap-1', className)}>
|
|
70
|
-
{#if label}
|
|
71
|
-
<Label id={labelId} for={inputId} {label} requiredIndicator={required === 'indicator'} {...labelProps} {size} />
|
|
72
|
-
{/if}
|
|
73
|
-
|
|
74
66
|
<DatePicker.Root
|
|
75
67
|
onValueChange={onChange}
|
|
76
68
|
minValue={minDate}
|
|
@@ -80,9 +72,22 @@
|
|
|
80
72
|
locale={getLocale()}
|
|
81
73
|
{disabled}
|
|
82
74
|
>
|
|
75
|
+
{#if label}
|
|
76
|
+
<DatePicker.Label>
|
|
77
|
+
{#snippet child({ props })}
|
|
78
|
+
<Label
|
|
79
|
+
{...labelProps}
|
|
80
|
+
{...props}
|
|
81
|
+
class={cleanClass(labelProps.class, props.class)}
|
|
82
|
+
requiredIndicator={required === 'indicator'}
|
|
83
|
+
{label}
|
|
84
|
+
{size}
|
|
85
|
+
/>
|
|
86
|
+
{/snippet}
|
|
87
|
+
</DatePicker.Label>
|
|
88
|
+
{/if}
|
|
89
|
+
|
|
83
90
|
<DatePicker.Input
|
|
84
|
-
id={inputId}
|
|
85
|
-
aria-labelledby={labelId}
|
|
86
91
|
class={containerStyles({
|
|
87
92
|
shape,
|
|
88
93
|
roundedSize: shape === 'semi-round' ? size : undefined,
|