glasslikeui 0.2.2 → 1.1.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.
- package/LICENSE +21 -21
- package/README.md +215 -1
- package/dist/actions/a11ySync.d.ts +9 -0
- package/dist/actions/a11ySync.js +49 -0
- package/dist/actions/deviceMotion.d.ts +31 -0
- package/dist/actions/deviceMotion.js +142 -0
- package/dist/actions/dragSnap.d.ts +47 -0
- package/dist/actions/dragSnap.js +222 -0
- package/dist/actions/index.d.ts +5 -0
- package/dist/actions/index.js +5 -0
- package/dist/actions/scrollEdge.d.ts +21 -0
- package/dist/actions/scrollEdge.js +61 -0
- package/dist/actions/viewTransition.d.ts +23 -0
- package/dist/actions/viewTransition.js +34 -0
- package/dist/components/glass/Glass.svelte +164 -0
- package/dist/components/glass/Glass.svelte.d.ts +19 -0
- package/dist/components/glass/GlassCard.svelte +71 -64
- package/dist/components/glass/GlassCard.svelte.d.ts +4 -2
- package/dist/components/glass/GlassDimLayer.svelte +37 -0
- package/dist/components/glass/GlassDimLayer.svelte.d.ts +8 -0
- package/dist/components/glass/GlassEffectContainer.svelte +58 -0
- package/dist/components/glass/GlassEffectContainer.svelte.d.ts +12 -0
- package/dist/components/glass/GlassMorph.svelte +42 -0
- package/dist/components/glass/GlassMorph.svelte.d.ts +10 -0
- package/dist/components/glass/GlassSection.svelte +82 -76
- package/dist/components/glass/GlassSection.svelte.d.ts +4 -2
- package/dist/components/glass/LensFilters.svelte +41 -0
- package/dist/components/glass/LensFilters.svelte.d.ts +18 -0
- package/dist/components/glass/Sheet.svelte +266 -236
- package/dist/components/glass/Sheet.svelte.d.ts +6 -2
- package/dist/components/glass/index.d.ts +5 -5
- package/dist/components/glass/index.js +5 -5
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/interactive/Badge.svelte +52 -60
- package/dist/components/interactive/Badge.svelte.d.ts +2 -2
- package/dist/components/interactive/Button.svelte +168 -191
- package/dist/components/interactive/Button.svelte.d.ts +4 -4
- package/dist/components/interactive/IconButton.svelte +74 -85
- package/dist/components/interactive/IconButton.svelte.d.ts +4 -4
- package/dist/components/interactive/TabView.svelte +112 -22
- package/dist/components/interactive/TabView.svelte.d.ts +1 -1
- package/dist/components/layout/Divider.svelte +31 -31
- package/dist/components/layout/Divider.svelte.d.ts +1 -1
- package/dist/components/layout/Grid.svelte +52 -52
- package/dist/components/layout/Grid.svelte.d.ts +1 -1
- package/dist/components/layout/HStack.svelte +76 -76
- package/dist/components/layout/HStack.svelte.d.ts +1 -1
- package/dist/components/layout/ScrollView.svelte +83 -60
- package/dist/components/layout/ScrollView.svelte.d.ts +5 -1
- package/dist/components/layout/Spacer.svelte +18 -18
- package/dist/components/layout/Spacer.svelte.d.ts +1 -1
- package/dist/components/layout/VStack.svelte +56 -56
- package/dist/components/layout/VStack.svelte.d.ts +1 -1
- package/dist/components/layout/ZStack.svelte +51 -51
- package/dist/components/layout/ZStack.svelte.d.ts +1 -1
- package/dist/components/list/List.svelte +50 -50
- package/dist/components/list/List.svelte.d.ts +1 -1
- package/dist/components/list/ListRow.svelte +181 -181
- package/dist/components/list/ListRow.svelte.d.ts +1 -1
- package/dist/components/media/SymbolImage.svelte +46 -46
- package/dist/components/media/SymbolImage.svelte.d.ts +1 -1
- package/dist/components/navigation/NavigationBar.svelte +195 -106
- package/dist/components/navigation/NavigationBar.svelte.d.ts +2 -1
- package/dist/components/navigation/NavigationLink.svelte +45 -45
- package/dist/components/navigation/NavigationLink.svelte.d.ts +1 -1
- package/dist/components/typography/Text.svelte +98 -97
- package/dist/components/typography/Text.svelte.d.ts +2 -2
- package/dist/constants/colors.js +2 -2
- package/dist/constants/index.d.ts +1 -5
- package/dist/constants/index.js +1 -5
- package/dist/constants/sizes.js +4 -4
- package/dist/constants/variants.d.ts +23 -0
- package/dist/constants/variants.js +18 -0
- package/dist/icons/index.js +10 -7
- package/dist/index.d.ts +2 -4
- package/dist/index.js +2 -7
- package/dist/styles/glasslikeui.css +192 -0
- package/dist/styles/lens.css +93 -0
- package/dist/styles/squircle.css +17 -0
- package/dist/styles/typography.css +27 -0
- package/dist/test-setup.d.ts +1 -0
- package/dist/test-setup.js +6 -0
- package/package.json +50 -38
- package/dist/components/glass/LiquidGlass.svelte +0 -123
- package/dist/components/glass/LiquidGlass.svelte.d.ts +0 -17
- package/dist/constants/materials.d.ts +0 -13
- package/dist/constants/materials.js +0 -43
- package/dist/styles/liquidglass.css +0 -139
|
@@ -1,60 +1,52 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
interface Props {
|
|
3
|
-
label: string;
|
|
4
|
-
variant?: 'default' | 'accent'
|
|
5
|
-
size?: 'sm' | 'md';
|
|
6
|
-
class?: string;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
let {
|
|
10
|
-
label,
|
|
11
|
-
variant = 'default',
|
|
12
|
-
size = 'md',
|
|
13
|
-
class: className = ''
|
|
14
|
-
}: Props = $props();
|
|
15
|
-
</script>
|
|
16
|
-
|
|
17
|
-
<span class="badge variant-{variant} size-{size} {className}">
|
|
18
|
-
{label}
|
|
19
|
-
</span>
|
|
20
|
-
|
|
21
|
-
<style>
|
|
22
|
-
.badge {
|
|
23
|
-
display: inline-flex;
|
|
24
|
-
align-items: center;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
border-radius: var(--glass-radius-full);
|
|
27
|
-
font-weight: 500;
|
|
28
|
-
white-space: nowrap;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.badge.size-sm {
|
|
32
|
-
padding: 4px 10px;
|
|
33
|
-
font-size: 0.6875rem;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.badge.size-md {
|
|
37
|
-
padding: 6px 14px;
|
|
38
|
-
font-size: 0.75rem;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.badge.variant-default {
|
|
42
|
-
background: var(--glass-badge-bg);
|
|
43
|
-
color: var(--color-text-secondary);
|
|
44
|
-
border: 1px solid var(--glass-border);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.badge.variant-accent {
|
|
48
|
-
background:
|
|
49
|
-
color: var(--color-accent);
|
|
50
|
-
border: 1px solid
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.badge.variant-glass {
|
|
54
|
-
background: var(--glass-button-bg);
|
|
55
|
-
backdrop-filter: blur(8px);
|
|
56
|
-
-webkit-backdrop-filter: blur(8px);
|
|
57
|
-
color: var(--color-text);
|
|
58
|
-
border: 1px solid var(--glass-border);
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
label: string;
|
|
4
|
+
variant?: 'default' | 'accent';
|
|
5
|
+
size?: 'sm' | 'md';
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
label,
|
|
11
|
+
variant = 'default',
|
|
12
|
+
size = 'md',
|
|
13
|
+
class: className = ''
|
|
14
|
+
}: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<span class="badge variant-{variant} size-{size} {className}">
|
|
18
|
+
{label}
|
|
19
|
+
</span>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.badge {
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
border-radius: var(--glass-radius-full);
|
|
27
|
+
font-weight: 500;
|
|
28
|
+
white-space: nowrap;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.badge.size-sm {
|
|
32
|
+
padding: 4px 10px;
|
|
33
|
+
font-size: 0.6875rem;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.badge.size-md {
|
|
37
|
+
padding: 6px 14px;
|
|
38
|
+
font-size: 0.75rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.badge.variant-default {
|
|
42
|
+
background: var(--glass-badge-bg);
|
|
43
|
+
color: var(--color-text-secondary);
|
|
44
|
+
border: 1px solid var(--glass-border);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.badge.variant-accent {
|
|
48
|
+
background: var(--color-accent-15);
|
|
49
|
+
color: var(--color-accent);
|
|
50
|
+
border: 1px solid var(--color-accent-25);
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
label: string;
|
|
3
|
-
variant?: 'default' | 'accent'
|
|
3
|
+
variant?: 'default' | 'accent';
|
|
4
4
|
size?: 'sm' | 'md';
|
|
5
5
|
class?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const Badge: import("svelte").Component<Props, {},
|
|
7
|
+
declare const Badge: import("svelte").Component<Props, {}, string>;
|
|
8
8
|
type Badge = ReturnType<typeof Badge>;
|
|
9
9
|
export default Badge;
|
|
@@ -1,191 +1,168 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children: Snippet;
|
|
6
|
-
variant?: 'filled' | '
|
|
7
|
-
size?: 'sm' | 'md' | 'lg';
|
|
8
|
-
fullWidth?: boolean;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
href?: string;
|
|
11
|
-
onclick?: (e: MouseEvent) => void;
|
|
12
|
-
class?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
let {
|
|
16
|
-
children,
|
|
17
|
-
variant = 'filled',
|
|
18
|
-
size = 'md',
|
|
19
|
-
fullWidth = false,
|
|
20
|
-
disabled = false,
|
|
21
|
-
href,
|
|
22
|
-
onclick,
|
|
23
|
-
class: className = ''
|
|
24
|
-
}: Props = $props();
|
|
25
|
-
|
|
26
|
-
const sizeStyles = {
|
|
27
|
-
sm: { padding: '8px 16px', fontSize: '0.875rem' },
|
|
28
|
-
md: { padding: '12px 24px', fontSize: '1rem' },
|
|
29
|
-
lg: { padding: '16px 32px', fontSize: '1.0625rem' }
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const styles = $derived(sizeStyles[size]);
|
|
33
|
-
</script>
|
|
34
|
-
|
|
35
|
-
{#if href}
|
|
36
|
-
<a
|
|
37
|
-
{href}
|
|
38
|
-
class="button variant-{variant} size-{size} {className}"
|
|
39
|
-
class:full-width={fullWidth}
|
|
40
|
-
class:disabled
|
|
41
|
-
onclick={onclick}
|
|
42
|
-
style="
|
|
43
|
-
--btn-padding: {styles.padding};
|
|
44
|
-
--btn-font-size: {styles.fontSize};
|
|
45
|
-
"
|
|
46
|
-
>
|
|
47
|
-
{@render children()}
|
|
48
|
-
</a>
|
|
49
|
-
{:else}
|
|
50
|
-
<button
|
|
51
|
-
class="button variant-{variant} size-{size} {className}"
|
|
52
|
-
class:full-width={fullWidth}
|
|
53
|
-
{disabled}
|
|
54
|
-
{onclick}
|
|
55
|
-
style="
|
|
56
|
-
--btn-padding: {styles.padding};
|
|
57
|
-
--btn-font-size: {styles.fontSize};
|
|
58
|
-
"
|
|
59
|
-
>
|
|
60
|
-
{@render children()}
|
|
61
|
-
</button>
|
|
62
|
-
{/if}
|
|
63
|
-
|
|
64
|
-
<style>
|
|
65
|
-
.button {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
justify-content: center;
|
|
69
|
-
gap: 8px;
|
|
70
|
-
padding: var(--btn-padding);
|
|
71
|
-
font-size: var(--btn-font-size);
|
|
72
|
-
font-weight: 500;
|
|
73
|
-
font-family: inherit;
|
|
74
|
-
border: none;
|
|
75
|
-
border-radius: var(--glass-radius-full);
|
|
76
|
-
cursor: pointer;
|
|
77
|
-
text-decoration: none;
|
|
78
|
-
transition: all var(--transition-fast);
|
|
79
|
-
position: relative;
|
|
80
|
-
overflow: hidden;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.button.full-width {
|
|
84
|
-
width: 100%;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.button.disabled {
|
|
88
|
-
opacity: 0.5;
|
|
89
|
-
pointer-events: none;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/* Filled variant */
|
|
93
|
-
.button.variant-filled {
|
|
94
|
-
background: var(--color-accent);
|
|
95
|
-
color: white;
|
|
96
|
-
box-shadow: 0 4px 16px -4px var(--color-accent-50);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.button.variant-filled:hover {
|
|
100
|
-
background: var(--color-accent-hover);
|
|
101
|
-
box-shadow: 0 8px 28px -6px var(--color-accent-50);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.button.variant-filled:active {
|
|
105
|
-
background: var(--color-accent-active);
|
|
106
|
-
box-shadow: 0 2px 10px -4px var(--color-accent-50);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/*
|
|
110
|
-
.button.variant-
|
|
111
|
-
background:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.button.variant-tinted:active {
|
|
172
|
-
background: var(--color-accent-10);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/* Destructive variant */
|
|
176
|
-
.button.variant-destructive {
|
|
177
|
-
background: var(--color-danger, #ef4444);
|
|
178
|
-
color: white;
|
|
179
|
-
box-shadow: 0 4px 16px -4px color-mix(in srgb, var(--color-danger, #ef4444) 50%, transparent);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.button.variant-destructive:hover {
|
|
183
|
-
background: var(--color-danger-hover, #dc2626);
|
|
184
|
-
box-shadow: 0 8px 28px -6px color-mix(in srgb, var(--color-danger, #ef4444) 50%, transparent);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.button.variant-destructive:active {
|
|
188
|
-
background: color-mix(in srgb, var(--color-danger, #ef4444) 85%, black);
|
|
189
|
-
box-shadow: 0 2px 10px -4px color-mix(in srgb, var(--color-danger, #ef4444) 50%, transparent);
|
|
190
|
-
}
|
|
191
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
variant?: 'filled' | 'outlined' | 'plain' | 'tinted' | 'destructive';
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
href?: string | undefined;
|
|
11
|
+
onclick?: ((e: MouseEvent) => void) | undefined;
|
|
12
|
+
class?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
children,
|
|
17
|
+
variant = 'filled',
|
|
18
|
+
size = 'md',
|
|
19
|
+
fullWidth = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
href,
|
|
22
|
+
onclick,
|
|
23
|
+
class: className = ''
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
const sizeStyles = {
|
|
27
|
+
sm: { padding: '8px 16px', fontSize: '0.875rem' },
|
|
28
|
+
md: { padding: '12px 24px', fontSize: '1rem' },
|
|
29
|
+
lg: { padding: '16px 32px', fontSize: '1.0625rem' }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const styles = $derived(sizeStyles[size]);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
{#if href}
|
|
36
|
+
<a
|
|
37
|
+
{href}
|
|
38
|
+
class="button variant-{variant} size-{size} {className}"
|
|
39
|
+
class:full-width={fullWidth}
|
|
40
|
+
class:disabled
|
|
41
|
+
onclick={onclick}
|
|
42
|
+
style="
|
|
43
|
+
--btn-padding: {styles.padding};
|
|
44
|
+
--btn-font-size: {styles.fontSize};
|
|
45
|
+
"
|
|
46
|
+
>
|
|
47
|
+
{@render children()}
|
|
48
|
+
</a>
|
|
49
|
+
{:else}
|
|
50
|
+
<button
|
|
51
|
+
class="button variant-{variant} size-{size} {className}"
|
|
52
|
+
class:full-width={fullWidth}
|
|
53
|
+
{disabled}
|
|
54
|
+
{onclick}
|
|
55
|
+
style="
|
|
56
|
+
--btn-padding: {styles.padding};
|
|
57
|
+
--btn-font-size: {styles.fontSize};
|
|
58
|
+
"
|
|
59
|
+
>
|
|
60
|
+
{@render children()}
|
|
61
|
+
</button>
|
|
62
|
+
{/if}
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.button {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
gap: 8px;
|
|
70
|
+
padding: var(--btn-padding);
|
|
71
|
+
font-size: var(--btn-font-size);
|
|
72
|
+
font-weight: 500;
|
|
73
|
+
font-family: inherit;
|
|
74
|
+
border: none;
|
|
75
|
+
border-radius: var(--glass-radius-full);
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
text-decoration: none;
|
|
78
|
+
transition: all var(--transition-fast);
|
|
79
|
+
position: relative;
|
|
80
|
+
overflow: hidden;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.button.full-width {
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.button.disabled {
|
|
88
|
+
opacity: 0.5;
|
|
89
|
+
pointer-events: none;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Filled variant */
|
|
93
|
+
.button.variant-filled {
|
|
94
|
+
background: var(--color-accent);
|
|
95
|
+
color: white;
|
|
96
|
+
box-shadow: 0 4px 16px -4px var(--color-accent-50);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.button.variant-filled:hover {
|
|
100
|
+
background: var(--color-accent-hover);
|
|
101
|
+
box-shadow: 0 8px 28px -6px var(--color-accent-50);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.button.variant-filled:active {
|
|
105
|
+
background: var(--color-accent-active);
|
|
106
|
+
box-shadow: 0 2px 10px -4px var(--color-accent-50);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Outlined variant */
|
|
110
|
+
.button.variant-outlined {
|
|
111
|
+
background: transparent;
|
|
112
|
+
color: var(--color-accent);
|
|
113
|
+
border: 1.5px solid var(--color-accent);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.button.variant-outlined:hover {
|
|
117
|
+
background: var(--color-accent-10);
|
|
118
|
+
border-color: var(--color-accent-hover);
|
|
119
|
+
color: var(--color-accent-hover);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.button.variant-outlined:active {
|
|
123
|
+
background: var(--color-accent-15);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Plain variant */
|
|
127
|
+
.button.variant-plain {
|
|
128
|
+
background: transparent;
|
|
129
|
+
color: var(--color-accent);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.button.variant-plain:hover {
|
|
133
|
+
color: var(--color-accent-hover);
|
|
134
|
+
text-decoration: underline;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Tinted variant */
|
|
138
|
+
.button.variant-tinted {
|
|
139
|
+
background: var(--color-accent-15);
|
|
140
|
+
color: var(--color-accent);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.button.variant-tinted:hover {
|
|
144
|
+
background: var(--color-accent-25);
|
|
145
|
+
color: var(--color-accent-hover);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.button.variant-tinted:active {
|
|
149
|
+
background: var(--color-accent-10);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Destructive variant */
|
|
153
|
+
.button.variant-destructive {
|
|
154
|
+
background: var(--color-danger);
|
|
155
|
+
color: white;
|
|
156
|
+
box-shadow: 0 4px 16px -4px color-mix(in srgb, var(--color-danger) 50%, transparent);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.button.variant-destructive:hover {
|
|
160
|
+
background: var(--color-danger-hover);
|
|
161
|
+
box-shadow: 0 8px 28px -6px color-mix(in srgb, var(--color-danger) 50%, transparent);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.button.variant-destructive:active {
|
|
165
|
+
background: var(--color-danger-active);
|
|
166
|
+
box-shadow: 0 2px 10px -4px color-mix(in srgb, var(--color-danger) 50%, transparent);
|
|
167
|
+
}
|
|
168
|
+
</style>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
interface Props {
|
|
3
3
|
children: Snippet;
|
|
4
|
-
variant?: 'filled' | '
|
|
4
|
+
variant?: 'filled' | 'outlined' | 'plain' | 'tinted' | 'destructive';
|
|
5
5
|
size?: 'sm' | 'md' | 'lg';
|
|
6
6
|
fullWidth?: boolean;
|
|
7
7
|
disabled?: boolean;
|
|
8
|
-
href?: string;
|
|
9
|
-
onclick?: (e: MouseEvent) => void;
|
|
8
|
+
href?: string | undefined;
|
|
9
|
+
onclick?: ((e: MouseEvent) => void) | undefined;
|
|
10
10
|
class?: string;
|
|
11
11
|
}
|
|
12
|
-
declare const Button: import("svelte").Component<Props, {},
|
|
12
|
+
declare const Button: import("svelte").Component<Props, {}, string>;
|
|
13
13
|
type Button = ReturnType<typeof Button>;
|
|
14
14
|
export default Button;
|
|
@@ -1,85 +1,74 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import type { Snippet } from 'svelte';
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
children: Snippet;
|
|
6
|
-
variant?: 'plain' | '
|
|
7
|
-
size?: 'sm' | 'md' | 'lg';
|
|
8
|
-
label?: string;
|
|
9
|
-
onclick?: (e: MouseEvent) => void;
|
|
10
|
-
class?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
let {
|
|
14
|
-
children,
|
|
15
|
-
variant = 'plain',
|
|
16
|
-
size = 'md',
|
|
17
|
-
label = '',
|
|
18
|
-
onclick,
|
|
19
|
-
class: className = ''
|
|
20
|
-
}: Props = $props();
|
|
21
|
-
|
|
22
|
-
const sizeMap = {
|
|
23
|
-
sm: 32,
|
|
24
|
-
md: 40,
|
|
25
|
-
lg: 48
|
|
26
|
-
};
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<button
|
|
30
|
-
class="icon-button variant-{variant} size-{size} {className}"
|
|
31
|
-
aria-label={label}
|
|
32
|
-
title={label}
|
|
33
|
-
{onclick}
|
|
34
|
-
style="--btn-size: {sizeMap[size]}px"
|
|
35
|
-
>
|
|
36
|
-
{@render children()}
|
|
37
|
-
</button>
|
|
38
|
-
|
|
39
|
-
<style>
|
|
40
|
-
.icon-button {
|
|
41
|
-
display: flex;
|
|
42
|
-
align-items: center;
|
|
43
|
-
justify-content: center;
|
|
44
|
-
width: var(--btn-size);
|
|
45
|
-
height: var(--btn-size);
|
|
46
|
-
border: none;
|
|
47
|
-
border-radius: var(--glass-radius-full);
|
|
48
|
-
cursor: pointer;
|
|
49
|
-
transition: all var(--transition-fast);
|
|
50
|
-
background: transparent;
|
|
51
|
-
color: var(--color-text-secondary);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.icon-button:hover {
|
|
55
|
-
color: var(--color-text);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.icon-button.variant-plain {
|
|
59
|
-
background: transparent;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.icon-button.variant-plain:hover {
|
|
63
|
-
background: var(--glass-hover-subtle);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.icon-button.variant-
|
|
67
|
-
background: var(--
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.icon-button.variant-filled {
|
|
78
|
-
background: var(--color-accent);
|
|
79
|
-
color: white;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.icon-button.variant-filled:hover {
|
|
83
|
-
background: var(--color-accent-hover);
|
|
84
|
-
}
|
|
85
|
-
</style>
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
variant?: 'plain' | 'filled';
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
label?: string | undefined;
|
|
9
|
+
onclick?: ((e: MouseEvent) => void) | undefined;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
variant = 'plain',
|
|
16
|
+
size = 'md',
|
|
17
|
+
label = '',
|
|
18
|
+
onclick,
|
|
19
|
+
class: className = ''
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
|
|
22
|
+
const sizeMap = {
|
|
23
|
+
sm: 32,
|
|
24
|
+
md: 40,
|
|
25
|
+
lg: 48
|
|
26
|
+
};
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
class="icon-button variant-{variant} size-{size} {className}"
|
|
31
|
+
aria-label={label}
|
|
32
|
+
title={label}
|
|
33
|
+
{onclick}
|
|
34
|
+
style="--btn-size: {sizeMap[size]}px"
|
|
35
|
+
>
|
|
36
|
+
{@render children()}
|
|
37
|
+
</button>
|
|
38
|
+
|
|
39
|
+
<style>
|
|
40
|
+
.icon-button {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: center;
|
|
44
|
+
width: var(--btn-size);
|
|
45
|
+
height: var(--btn-size);
|
|
46
|
+
border: none;
|
|
47
|
+
border-radius: var(--glass-radius-full);
|
|
48
|
+
cursor: pointer;
|
|
49
|
+
transition: all var(--transition-fast);
|
|
50
|
+
background: transparent;
|
|
51
|
+
color: var(--color-text-secondary);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.icon-button:hover {
|
|
55
|
+
color: var(--color-text);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.icon-button.variant-plain {
|
|
59
|
+
background: transparent;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.icon-button.variant-plain:hover {
|
|
63
|
+
background: var(--glass-hover-subtle);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.icon-button.variant-filled {
|
|
67
|
+
background: var(--color-accent);
|
|
68
|
+
color: white;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.icon-button.variant-filled:hover {
|
|
72
|
+
background: var(--color-accent-hover);
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
interface Props {
|
|
3
3
|
children: Snippet;
|
|
4
|
-
variant?: 'plain' | '
|
|
4
|
+
variant?: 'plain' | 'filled';
|
|
5
5
|
size?: 'sm' | 'md' | 'lg';
|
|
6
|
-
label?: string;
|
|
7
|
-
onclick?: (e: MouseEvent) => void;
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
onclick?: ((e: MouseEvent) => void) | undefined;
|
|
8
8
|
class?: string;
|
|
9
9
|
}
|
|
10
|
-
declare const IconButton: import("svelte").Component<Props, {},
|
|
10
|
+
declare const IconButton: import("svelte").Component<Props, {}, string>;
|
|
11
11
|
type IconButton = ReturnType<typeof IconButton>;
|
|
12
12
|
export default IconButton;
|