@immich/ui 0.22.6 → 0.22.8
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/MultiSelect/MultiSelect.svelte +3 -4
- package/dist/components/MultiSelect/MultiSelect.svelte.d.ts +1 -1
- package/dist/components/Select/Select.svelte +5 -3
- package/dist/components/Stack/Stack.svelte +12 -0
- package/dist/internal/Select.svelte +10 -4
- package/dist/internal/Select.svelte.d.ts +1 -1
- package/dist/types.d.ts +1 -2
- package/package.json +1 -1
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
type T = SelectItem;
|
|
6
6
|
|
|
7
|
-
let {
|
|
7
|
+
let { onChange, values = $bindable([]), ...restProps }: MultiSelectProps<T> = $props();
|
|
8
8
|
|
|
9
9
|
const handleChange = (items: T[]) => {
|
|
10
|
-
|
|
11
|
-
onChange?.(value);
|
|
10
|
+
onChange?.(items);
|
|
12
11
|
};
|
|
13
12
|
</script>
|
|
14
13
|
|
|
15
|
-
<InternalSelect multiple onChange={handleChange} {...restProps} />
|
|
14
|
+
<InternalSelect multiple bind:values onChange={handleChange} {...restProps} />
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { MultiSelectProps, SelectItem } from '../../types.js';
|
|
2
|
-
declare const MultiSelect: import("svelte").Component<MultiSelectProps<SelectItem>, {}, "
|
|
2
|
+
declare const MultiSelect: import("svelte").Component<MultiSelectProps<SelectItem>, {}, "values">;
|
|
3
3
|
type MultiSelect = ReturnType<typeof MultiSelect>;
|
|
4
4
|
export default MultiSelect;
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
type T = SelectItem;
|
|
6
6
|
|
|
7
|
-
let { value = $bindable(),
|
|
7
|
+
let { onChange, value = $bindable(), ...restProps }: SelectProps<T> = $props();
|
|
8
|
+
|
|
9
|
+
let values = $derived(value ? [value] : []);
|
|
8
10
|
|
|
9
11
|
const handleChange = (items: T[]) => {
|
|
10
|
-
value = items[0]
|
|
12
|
+
value = items[0];
|
|
11
13
|
onChange?.(value);
|
|
12
14
|
};
|
|
13
15
|
</script>
|
|
14
16
|
|
|
15
|
-
<InternalSelect onChange={handleChange} {...restProps} />
|
|
17
|
+
<InternalSelect bind:values onChange={handleChange} {...restProps} />
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
direction = 'column',
|
|
9
9
|
wrap = false,
|
|
10
10
|
class: className,
|
|
11
|
+
fullWidth,
|
|
12
|
+
fullHeight,
|
|
11
13
|
gap = 2,
|
|
12
14
|
children,
|
|
13
15
|
}: StackProps = $props();
|
|
@@ -24,6 +26,14 @@
|
|
|
24
26
|
center: 'items-center',
|
|
25
27
|
end: 'items-end',
|
|
26
28
|
},
|
|
29
|
+
fullWidth: {
|
|
30
|
+
true: 'w-full',
|
|
31
|
+
false: '',
|
|
32
|
+
},
|
|
33
|
+
fullHeight: {
|
|
34
|
+
true: 'h-full',
|
|
35
|
+
false: '',
|
|
36
|
+
},
|
|
27
37
|
gap: {
|
|
28
38
|
0: 'gap-0',
|
|
29
39
|
1: 'gap-1',
|
|
@@ -50,6 +60,8 @@
|
|
|
50
60
|
direction,
|
|
51
61
|
gap,
|
|
52
62
|
wrap,
|
|
63
|
+
fullHeight,
|
|
64
|
+
fullWidth,
|
|
53
65
|
}),
|
|
54
66
|
className,
|
|
55
67
|
)}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
type Props = {
|
|
16
16
|
multiple?: boolean;
|
|
17
|
-
values
|
|
17
|
+
values: T[];
|
|
18
18
|
asLabel?: (items: T[]) => string;
|
|
19
19
|
onChange?: (values: T[]) => void;
|
|
20
20
|
} & SelectCommonProps<T>;
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
let {
|
|
23
23
|
data,
|
|
24
24
|
shape,
|
|
25
|
-
color = 'primary',
|
|
26
25
|
size = 'medium',
|
|
27
26
|
multiple = false,
|
|
28
27
|
values = $bindable([]),
|
|
@@ -73,6 +72,10 @@
|
|
|
73
72
|
|
|
74
73
|
onChange?.(values);
|
|
75
74
|
};
|
|
75
|
+
|
|
76
|
+
let internalValue = $derived(
|
|
77
|
+
multiple ? values.map(({ value }) => value) : (values[0]?.value ?? ''),
|
|
78
|
+
);
|
|
76
79
|
</script>
|
|
77
80
|
|
|
78
81
|
<div class={cleanClass('flex flex-col gap-1', className)} bind:this={ref}>
|
|
@@ -80,7 +83,11 @@
|
|
|
80
83
|
<Label id={labelId} for={inputId} {label} {...labelProps} />
|
|
81
84
|
{/if}
|
|
82
85
|
|
|
83
|
-
<Select.Root
|
|
86
|
+
<Select.Root
|
|
87
|
+
type={multiple ? 'multiple' : 'single'}
|
|
88
|
+
bind:value={internalValue as never}
|
|
89
|
+
{onValueChange}
|
|
90
|
+
>
|
|
84
91
|
<Select.Trigger
|
|
85
92
|
{disabled}
|
|
86
93
|
class="w-full items-center gap-1 rounded-lg focus-visible:outline-none"
|
|
@@ -92,7 +99,6 @@
|
|
|
92
99
|
id={inputId}
|
|
93
100
|
{size}
|
|
94
101
|
{shape}
|
|
95
|
-
{color}
|
|
96
102
|
{placeholder}
|
|
97
103
|
value={selectedLabel}
|
|
98
104
|
readonly
|
package/dist/types.d.ts
CHANGED
|
@@ -120,7 +120,6 @@ export type SelectItem = {
|
|
|
120
120
|
export type SelectCommonProps<T extends SelectItem> = {
|
|
121
121
|
data: string[] | T[];
|
|
122
122
|
size?: Size;
|
|
123
|
-
color?: Color;
|
|
124
123
|
shape?: Shape;
|
|
125
124
|
placeholder?: string;
|
|
126
125
|
class?: string;
|
|
@@ -130,7 +129,7 @@ export type SelectProps<T extends SelectItem> = SelectCommonProps<T> & {
|
|
|
130
129
|
onChange?: (value: T) => void;
|
|
131
130
|
};
|
|
132
131
|
export type MultiSelectProps<T extends SelectItem> = SelectCommonProps<T> & {
|
|
133
|
-
|
|
132
|
+
values?: T[];
|
|
134
133
|
onChange?: (values: T[]) => void;
|
|
135
134
|
};
|
|
136
135
|
export {};
|