@immich/ui 0.30.0 → 0.30.1
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 +58 -65
- 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/internal/Button.svelte +177 -177
- package/dist/internal/Child.svelte +21 -21
- package/dist/internal/Select.svelte +151 -158
- package/dist/internal/Text.svelte +42 -50
- package/dist/site/SiteFooter.svelte +60 -76
- package/dist/site/SiteFooterLink.svelte +14 -14
- package/dist/theme/default.css +40 -40
- package/dist/utilities/byte-units.js +2 -13
- package/package.json +77 -77
|
@@ -1,193 +1,193 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import Icon from '../components/Icon/Icon.svelte';
|
|
3
|
+
import LoadingSpinner from '../components/LoadingSpinner/LoadingSpinner.svelte';
|
|
4
|
+
import type { ButtonProps, Size } from '../types.js';
|
|
5
|
+
import { cleanClass } from '../utils.js';
|
|
6
|
+
import { Button as ButtonPrimitive } from 'bits-ui';
|
|
7
|
+
import type { HTMLAnchorAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
8
|
+
import { twMerge } from 'tailwind-merge';
|
|
9
|
+
import { tv } from 'tailwind-variants';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
type InternalButtonProps = ButtonProps & {
|
|
12
|
+
/** when true, button width to height ratio is 1:1 */
|
|
13
|
+
icon?: boolean;
|
|
14
|
+
};
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
16
|
+
let {
|
|
17
|
+
ref = $bindable(null),
|
|
18
|
+
type = 'button',
|
|
19
|
+
href,
|
|
20
|
+
external,
|
|
21
|
+
variant = 'filled',
|
|
22
|
+
color = 'primary',
|
|
23
|
+
shape = 'semi-round',
|
|
24
|
+
size = 'medium',
|
|
25
|
+
loading = false,
|
|
26
|
+
fullWidth = false,
|
|
27
|
+
leadingIcon,
|
|
28
|
+
trailingIcon,
|
|
29
|
+
icon = false,
|
|
30
|
+
class: className = '',
|
|
31
|
+
children,
|
|
32
|
+
...restProps
|
|
33
|
+
}: InternalButtonProps = $props();
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const disabled = $derived((restProps as HTMLButtonAttributes).disabled || loading);
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
37
|
+
const buttonVariants = tv({
|
|
38
|
+
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-1 rounded-md text-sm font-medium whitespace-nowrap transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none',
|
|
39
|
+
variants: {
|
|
40
|
+
disabled: {
|
|
41
|
+
true: 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50',
|
|
42
|
+
false: 'cursor-pointer',
|
|
43
|
+
},
|
|
44
|
+
shape: {
|
|
45
|
+
rectangle: 'rounded-none',
|
|
46
|
+
'semi-round': 'rounded-xl',
|
|
47
|
+
round: 'rounded-full',
|
|
48
|
+
},
|
|
49
|
+
fullWidth: {
|
|
50
|
+
true: 'w-full',
|
|
51
|
+
},
|
|
52
|
+
textPadding: {
|
|
53
|
+
tiny: 'px-3 py-1',
|
|
54
|
+
small: 'px-4 py-2',
|
|
55
|
+
medium: 'px-5 py-2',
|
|
56
|
+
large: 'px-8 py-2.5',
|
|
57
|
+
giant: 'px-10 py-3',
|
|
58
|
+
},
|
|
59
|
+
textSize: {
|
|
60
|
+
tiny: 'text-xs',
|
|
61
|
+
small: 'text-sm',
|
|
62
|
+
medium: 'text-base',
|
|
63
|
+
large: 'text-lg',
|
|
64
|
+
giant: 'text-xl',
|
|
65
|
+
},
|
|
66
|
+
iconSize: {
|
|
67
|
+
tiny: 'h-6 w-6',
|
|
68
|
+
small: 'h-8 w-8',
|
|
69
|
+
medium: 'h-10 w-10',
|
|
70
|
+
large: 'h-12 w-12',
|
|
71
|
+
giant: 'h-14 w-14',
|
|
72
|
+
},
|
|
73
|
+
roundedSize: {
|
|
74
|
+
tiny: 'rounded-lg',
|
|
75
|
+
small: 'rounded-lg',
|
|
76
|
+
medium: 'rounded-xl',
|
|
77
|
+
large: 'rounded-xl',
|
|
78
|
+
giant: 'rounded-2xl',
|
|
79
|
+
},
|
|
80
|
+
filledColor: {
|
|
81
|
+
primary: 'bg-primary text-light hover:bg-primary/80',
|
|
82
|
+
secondary: 'bg-dark text-light hover:bg-dark/80',
|
|
83
|
+
success: 'bg-success text-light hover:bg-success/80',
|
|
84
|
+
danger: 'bg-danger text-light hover:bg-danger/80',
|
|
85
|
+
warning: 'bg-warning text-light hover:bg-warning/80',
|
|
86
|
+
info: 'bg-info text-light hover:bg-info/80',
|
|
87
|
+
},
|
|
88
|
+
outlineColor: {
|
|
89
|
+
primary: 'border-primary bg-primary/10 text-primary hover:bg-primary/20 border',
|
|
90
|
+
secondary: 'border-dark bg-dark/10 text-dark hover:bg-dark/20 border',
|
|
91
|
+
success: 'border-success bg-success/10 text-success hover:bg-success/20 border',
|
|
92
|
+
danger: 'border-danger bg-danger/10 text-danger hover:bg-danger/20 border',
|
|
93
|
+
warning: 'border-warning bg-warning/10 text-warning hover:bg-warning/20 border',
|
|
94
|
+
info: 'border-info bg-info/10 text-info hover:bg-info/20 border',
|
|
95
|
+
},
|
|
96
|
+
ghostColor: {
|
|
97
|
+
primary: 'text-primary hover:bg-primary/10',
|
|
98
|
+
secondary: 'text-dark hover:bg-dark/10',
|
|
99
|
+
success: 'text-success hover:bg-success/10',
|
|
100
|
+
danger: 'text-danger hover:bg-danger/10',
|
|
101
|
+
warning: 'text-warning hover:bg-warning/10',
|
|
102
|
+
info: 'text-info hover:bg-info/10',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
const spinnerSizes: Record<Size, Size> = {
|
|
108
|
+
tiny: 'tiny',
|
|
109
|
+
small: 'tiny',
|
|
110
|
+
medium: 'small',
|
|
111
|
+
large: 'medium',
|
|
112
|
+
giant: 'large',
|
|
113
|
+
};
|
|
114
114
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
115
|
+
const classList = $derived(
|
|
116
|
+
cleanClass(
|
|
117
|
+
twMerge(
|
|
118
|
+
buttonVariants({
|
|
119
|
+
shape,
|
|
120
|
+
fullWidth,
|
|
121
|
+
textPadding: icon ? undefined : size,
|
|
122
|
+
textSize: size,
|
|
123
|
+
iconSize: icon ? size : undefined,
|
|
124
|
+
disabled,
|
|
125
|
+
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
126
|
+
filledColor: variant === 'filled' ? color : undefined,
|
|
127
|
+
outlineColor: variant === 'outline' ? color : undefined,
|
|
128
|
+
ghostColor: variant === 'ghost' ? color : undefined,
|
|
129
|
+
}),
|
|
130
|
+
className,
|
|
131
|
+
),
|
|
132
|
+
),
|
|
133
|
+
);
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
const iconSizes = {
|
|
136
|
+
tiny: 'h-4 w-4',
|
|
137
|
+
small: 'h-4 w-4',
|
|
138
|
+
medium: 'h-4 w-4',
|
|
139
|
+
large: 'h-6 w-6',
|
|
140
|
+
giant: 'h-8 w-8',
|
|
141
|
+
};
|
|
142
142
|
</script>
|
|
143
143
|
|
|
144
144
|
{#snippet content()}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
{#if leadingIcon && !loading}
|
|
146
|
+
<div>
|
|
147
|
+
<Icon size="100%" class={iconSizes[size]} icon={leadingIcon} aria-hidden />
|
|
148
|
+
</div>
|
|
149
|
+
{/if}
|
|
150
|
+
{@render children?.()}
|
|
151
|
+
{#if trailingIcon}
|
|
152
|
+
<Icon size="100%" class={iconSizes[size]} icon={trailingIcon} aria-hidden />
|
|
153
|
+
{/if}
|
|
154
154
|
{/snippet}
|
|
155
155
|
|
|
156
156
|
{#if href}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
157
|
+
<a
|
|
158
|
+
bind:this={ref}
|
|
159
|
+
{href}
|
|
160
|
+
class={classList}
|
|
161
|
+
aria-disabled={disabled}
|
|
162
|
+
target={external ? '_blank' : undefined}
|
|
163
|
+
rel={external ? 'noopener noreferrer' : undefined}
|
|
164
|
+
{...restProps as HTMLAnchorAttributes}
|
|
165
|
+
>
|
|
166
|
+
{#if loading}
|
|
167
|
+
<div class="flex items-center justify-center gap-2">
|
|
168
|
+
<LoadingSpinner {color} size={spinnerSizes[size]} />
|
|
169
|
+
{@render content()}
|
|
170
|
+
</div>
|
|
171
|
+
{:else}
|
|
172
|
+
{@render content()}
|
|
173
|
+
{/if}
|
|
174
|
+
</a>
|
|
175
175
|
{:else}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
176
|
+
<ButtonPrimitive.Root
|
|
177
|
+
bind:ref
|
|
178
|
+
class={classList}
|
|
179
|
+
type={type as HTMLButtonAttributes['type']}
|
|
180
|
+
{...restProps as HTMLButtonAttributes}
|
|
181
|
+
{disabled}
|
|
182
|
+
aria-disabled={disabled}
|
|
183
|
+
>
|
|
184
|
+
{#if loading}
|
|
185
|
+
<div class="flex items-center justify-center gap-2">
|
|
186
|
+
<LoadingSpinner {color} size={spinnerSizes[size]} />
|
|
187
|
+
{@render content()}
|
|
188
|
+
</div>
|
|
189
|
+
{:else}
|
|
190
|
+
{@render content()}
|
|
191
|
+
{/if}
|
|
192
|
+
</ButtonPrimitive.Root>
|
|
193
193
|
{/if}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import { ChildKey } from '../constants.js';
|
|
3
|
+
import type { ChildData } from '../types.js';
|
|
4
|
+
import { withPrefix } from '../utils.js';
|
|
5
|
+
import { getContext, type Snippet } from 'svelte';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
type ContextType = {
|
|
8
|
+
register: (key: ChildKey, data: () => ChildData) => void;
|
|
9
|
+
};
|
|
10
|
+
type Props = {
|
|
11
|
+
for: ChildKey;
|
|
12
|
+
as: ChildKey;
|
|
13
|
+
class?: string;
|
|
14
|
+
children: Snippet;
|
|
15
|
+
};
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const { for: key, as, children, class: className }: Props = $props();
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
const context = getContext<ContextType>(withPrefix(key));
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
const data = $derived({ snippet: children, class: className });
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if (context) {
|
|
24
|
+
context.register(as, () => data);
|
|
25
|
+
} else {
|
|
26
|
+
console.log('Unable to find context for key:', key);
|
|
27
|
+
}
|
|
28
28
|
</script>
|