@immich/ui 0.14.2 → 0.15.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.
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}: Props = $props();
|
|
31
31
|
|
|
32
32
|
const containerStyles = tv({
|
|
33
|
-
base: 'w-full overflow-hidden
|
|
33
|
+
base: 'w-full overflow-hidden shadow-sm',
|
|
34
34
|
variants: {
|
|
35
35
|
shape: {
|
|
36
36
|
rectangle: '',
|
|
@@ -124,16 +124,7 @@
|
|
|
124
124
|
{/if}
|
|
125
125
|
{/snippet}
|
|
126
126
|
|
|
127
|
-
<div
|
|
128
|
-
class={cleanClass(
|
|
129
|
-
containerStyles({
|
|
130
|
-
shape,
|
|
131
|
-
border: !color,
|
|
132
|
-
}),
|
|
133
|
-
className,
|
|
134
|
-
)}
|
|
135
|
-
{...restProps}
|
|
136
|
-
>
|
|
127
|
+
<div class={cleanClass(containerStyles({ shape, border: !color }), className)} {...restProps}>
|
|
137
128
|
<div class={cleanClass(cardStyles({ color }))}>
|
|
138
129
|
{#if headerChild}
|
|
139
130
|
{@render header()}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Icon from '../components/Icon/Icon.svelte';
|
|
2
3
|
import LoadingSpinner from '../components/LoadingSpinner/LoadingSpinner.svelte';
|
|
3
4
|
import type { ButtonProps, Size } from '../types.js';
|
|
4
5
|
import { cleanClass } from '../utils.js';
|
|
@@ -21,6 +22,8 @@
|
|
|
21
22
|
size = 'medium',
|
|
22
23
|
loading = false,
|
|
23
24
|
fullWidth = false,
|
|
25
|
+
leadingIcon,
|
|
26
|
+
trailingIcon,
|
|
24
27
|
icon = false,
|
|
25
28
|
class: className = '',
|
|
26
29
|
children,
|
|
@@ -30,8 +33,12 @@
|
|
|
30
33
|
const disabled = $derived((restProps as HTMLButtonAttributes).disabled || loading);
|
|
31
34
|
|
|
32
35
|
const buttonVariants = tv({
|
|
33
|
-
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-
|
|
36
|
+
base: 'ring-offset-background focus-visible:ring-ring flex items-center justify-center gap-1 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2',
|
|
34
37
|
variants: {
|
|
38
|
+
disabled: {
|
|
39
|
+
true: 'disabled:pointer-events-none disabled:opacity-50 aria-disabled:opacity-50',
|
|
40
|
+
false: '',
|
|
41
|
+
},
|
|
35
42
|
shape: {
|
|
36
43
|
rectangle: 'rounded-none',
|
|
37
44
|
'semi-round': 'rounded-xl',
|
|
@@ -112,6 +119,7 @@
|
|
|
112
119
|
textPadding: icon ? undefined : size,
|
|
113
120
|
textSize: size,
|
|
114
121
|
iconSize: icon ? size : undefined,
|
|
122
|
+
disabled,
|
|
115
123
|
roundedSize: shape === 'semi-round' ? size : undefined,
|
|
116
124
|
filledColor: variant === 'filled' ? color : undefined,
|
|
117
125
|
outlineColor: variant === 'outline' ? color : undefined,
|
|
@@ -123,9 +131,26 @@
|
|
|
123
131
|
);
|
|
124
132
|
</script>
|
|
125
133
|
|
|
134
|
+
{#snippet content()}
|
|
135
|
+
{#if leadingIcon && !loading}
|
|
136
|
+
<Icon size="1.15rem" icon={leadingIcon} />
|
|
137
|
+
{/if}
|
|
138
|
+
{@render children?.()}
|
|
139
|
+
{#if trailingIcon}
|
|
140
|
+
<Icon size="1.15rem" icon={trailingIcon} />
|
|
141
|
+
{/if}
|
|
142
|
+
{/snippet}
|
|
143
|
+
|
|
126
144
|
{#if href}
|
|
127
|
-
<a {href} class={classList} {...restProps as HTMLAnchorAttributes}>
|
|
128
|
-
{
|
|
145
|
+
<a {href} class={classList} aria-disabled={disabled} {...restProps as HTMLAnchorAttributes}>
|
|
146
|
+
{#if loading}
|
|
147
|
+
<div class="flex items-center justify-center gap-2">
|
|
148
|
+
<LoadingSpinner {color} size={spinnerSizes[size]} />
|
|
149
|
+
{@render content()}
|
|
150
|
+
</div>
|
|
151
|
+
{:else}
|
|
152
|
+
{@render content()}
|
|
153
|
+
{/if}
|
|
129
154
|
</a>
|
|
130
155
|
{:else}
|
|
131
156
|
<ButtonPrimitive.Root
|
|
@@ -138,10 +163,10 @@
|
|
|
138
163
|
{#if loading}
|
|
139
164
|
<div class="flex items-center justify-center gap-2">
|
|
140
165
|
<LoadingSpinner {color} size={spinnerSizes[size]} />
|
|
141
|
-
{@render
|
|
166
|
+
{@render content()}
|
|
142
167
|
</div>
|
|
143
168
|
{:else}
|
|
144
|
-
{@render
|
|
169
|
+
{@render content()}
|
|
145
170
|
{/if}
|
|
146
171
|
</ButtonPrimitive.Root>
|
|
147
172
|
{/if}
|
package/dist/types.d.ts
CHANGED