@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.
Files changed (71) hide show
  1. package/README.md +9 -17
  2. package/dist/actions/shortcut.js +1 -1
  3. package/dist/components/Alert/Alert.svelte +92 -94
  4. package/dist/components/AppShell/AppShell.svelte +26 -26
  5. package/dist/components/AppShell/AppShellHeader.svelte +8 -8
  6. package/dist/components/AppShell/AppShellSidebar.svelte +20 -20
  7. package/dist/components/AppShell/PageLayout.svelte +29 -35
  8. package/dist/components/Avatar/Avatar.svelte +45 -55
  9. package/dist/components/Button/Button.svelte +3 -3
  10. package/dist/components/Card/Card.svelte +131 -135
  11. package/dist/components/Card/CardBody.svelte +9 -9
  12. package/dist/components/Card/CardDescription.svelte +9 -9
  13. package/dist/components/Card/CardFooter.svelte +9 -9
  14. package/dist/components/Card/CardHeader.svelte +9 -9
  15. package/dist/components/Card/CardTitle.svelte +14 -14
  16. package/dist/components/Checkbox/Checkbox.svelte +109 -110
  17. package/dist/components/CloseButton/CloseButton.svelte +12 -17
  18. package/dist/components/Code/Code.svelte +72 -65
  19. package/dist/components/Code/Code.svelte.d.ts +1 -1
  20. package/dist/components/CodeBlock/CodeBlock.svelte +74 -0
  21. package/dist/components/CodeBlock/CodeBlock.svelte.d.ts +14 -0
  22. package/dist/components/CommandPalette/CommandPalette.svelte +126 -131
  23. package/dist/components/CommandPalette/CommandPaletteItem.svelte +61 -61
  24. package/dist/components/ConfirmModal/ConfirmModal.svelte +48 -48
  25. package/dist/components/Container/Container.svelte +25 -25
  26. package/dist/components/Field/Field.svelte +21 -21
  27. package/dist/components/FormatBytes/FormatBytes.svelte +9 -9
  28. package/dist/components/Heading/Heading.svelte +41 -47
  29. package/dist/components/HelperText/HelperText.svelte +17 -17
  30. package/dist/components/Icon/Icon.svelte +37 -42
  31. package/dist/components/IconButton/IconButton.svelte +6 -13
  32. package/dist/components/Input/Input.svelte +149 -152
  33. package/dist/components/Kbd/Kbd.svelte +25 -25
  34. package/dist/components/Label/Label.svelte +6 -6
  35. package/dist/components/Link/Link.svelte +18 -25
  36. package/dist/components/LoadingSpinner/LoadingSpinner.svelte +46 -46
  37. package/dist/components/Logo/Logo.svelte +53 -53
  38. package/dist/components/Modal/Modal.svelte +110 -114
  39. package/dist/components/Modal/ModalBody.svelte +8 -8
  40. package/dist/components/Modal/ModalFooter.svelte +8 -8
  41. package/dist/components/Modal/ModalHeader.svelte +8 -8
  42. package/dist/components/MultiSelect/MultiSelect.svelte +7 -7
  43. package/dist/components/Navbar/NavbarGroup.svelte +5 -5
  44. package/dist/components/Navbar/NavbarItem.svelte +59 -61
  45. package/dist/components/PasswordInput/PasswordInput.svelte +29 -31
  46. package/dist/components/Scrollable/Scrollable.svelte +49 -49
  47. package/dist/components/Select/Select.svelte +9 -9
  48. package/dist/components/Stack/HStack.svelte +4 -4
  49. package/dist/components/Stack/Stack.svelte +62 -62
  50. package/dist/components/Stack/VStack.svelte +4 -4
  51. package/dist/components/SupporterBadge/SupporterBadge.svelte +80 -80
  52. package/dist/components/Switch/Switch.svelte +95 -96
  53. package/dist/components/Text/Text.svelte +27 -34
  54. package/dist/components/Textarea/Textarea.svelte +103 -104
  55. package/dist/components/ThemeSwitcher/ThemeSwitcher.svelte +30 -43
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +1 -0
  58. package/dist/internal/Button.svelte +177 -177
  59. package/dist/internal/Child.svelte +21 -21
  60. package/dist/internal/Select.svelte +151 -158
  61. package/dist/internal/Text.svelte +50 -50
  62. package/dist/internal/Text.svelte.d.ts +2 -1
  63. package/dist/services/translation.svelte.d.ts +2 -0
  64. package/dist/services/translation.svelte.js +4 -0
  65. package/dist/site/SiteFooter.svelte +60 -76
  66. package/dist/site/SiteFooterLink.svelte +14 -14
  67. package/dist/site/constants.d.ts +7 -3
  68. package/dist/site/constants.js +17 -3
  69. package/dist/theme/default.css +40 -40
  70. package/dist/utilities/byte-units.js +2 -13
  71. package/package.json +77 -77
@@ -1,193 +1,193 @@
1
1
  <script lang="ts">
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';
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
- type InternalButtonProps = ButtonProps & {
12
- /** when true, button width to height ratio is 1:1 */
13
- icon?: boolean;
14
- };
11
+ type InternalButtonProps = ButtonProps & {
12
+ /** when true, button width to height ratio is 1:1 */
13
+ icon?: boolean;
14
+ };
15
15
 
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();
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
- const disabled = $derived((restProps as HTMLButtonAttributes).disabled || loading);
35
+ const disabled = $derived((restProps as HTMLButtonAttributes).disabled || loading);
36
36
 
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
- });
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
- const spinnerSizes: Record<Size, Size> = {
108
- tiny: 'tiny',
109
- small: 'tiny',
110
- medium: 'small',
111
- large: 'medium',
112
- giant: 'large',
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
- 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
- );
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
- 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
- };
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
- {#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}
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
- <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>
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
- <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>
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
- 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';
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
- 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
- };
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
- const { for: key, as, children, class: className }: Props = $props();
17
+ const { for: key, as, children, class: className }: Props = $props();
18
18
 
19
- const context = getContext<ContextType>(withPrefix(key));
19
+ const context = getContext<ContextType>(withPrefix(key));
20
20
 
21
- const data = $derived({ snippet: children, class: className });
21
+ const data = $derived({ snippet: children, class: className });
22
22
 
23
- if (context) {
24
- context.register(as, () => data);
25
- } else {
26
- console.log('Unable to find context for key:', key);
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>