@authrim/sveltekit 0.1.0 → 0.1.2
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 +191 -191
- package/README.md +527 -531
- package/dist/components/AuthProvider.svelte +56 -56
- package/dist/components/ProtectedRoute.svelte +71 -71
- package/dist/components/SignInButton.svelte +93 -93
- package/dist/components/SignOutButton.svelte +72 -72
- package/dist/components/UserProfile.svelte +71 -71
- package/dist/ui/account/LinkAccountButton.svelte +133 -133
- package/dist/ui/account/LinkedAccountsList.svelte +233 -233
- package/dist/ui/account/UnlinkAccountButton.svelte +179 -179
- package/dist/ui/forms/EmailCodeForm.svelte +224 -224
- package/dist/ui/forms/PasskeyConditionalInput.svelte +173 -173
- package/dist/ui/forms/SocialLoginButtons.svelte +209 -209
- package/dist/ui/helpers/AuthError.svelte +124 -124
- package/dist/ui/helpers/AuthLoading.svelte +83 -83
- package/dist/ui/helpers/OTPInput.svelte +214 -214
- package/dist/ui/helpers/ResendCodeButton.svelte +140 -140
- package/dist/ui/passkey/PasskeyDeleteButton.svelte +177 -177
- package/dist/ui/passkey/PasskeyList.svelte +225 -225
- package/dist/ui/passkey/PasskeyRegisterButton.svelte +52 -52
- package/dist/ui/session/SessionExpiryIndicator.svelte +109 -109
- package/dist/ui/session/SessionList.svelte +231 -231
- package/dist/ui/session/SessionRevokeButton.svelte +72 -72
- package/dist/ui/shared/Badge.svelte +100 -100
- package/dist/ui/shared/Button.svelte +213 -213
- package/dist/ui/shared/Card.svelte +85 -85
- package/dist/ui/shared/Input.svelte +192 -192
- package/dist/ui/shared/Spinner.svelte +75 -75
- package/dist/ui/styles/base.css +168 -168
- package/dist/ui/styles/theme.css +279 -279
- package/dist/ui/templates/AccountSettingsTemplate.svelte +205 -205
- package/dist/ui/templates/LoginTemplate.svelte +234 -234
- package/dist/ui/templates/SignUpTemplate.svelte +345 -345
- package/package.json +112 -111
|
@@ -1,209 +1,209 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
SocialLoginButtons Component
|
|
3
|
-
Social provider login buttons with provider icons
|
|
4
|
-
-->
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { createEventDispatcher } from 'svelte';
|
|
7
|
-
import type { SocialProvider } from '../../types.js';
|
|
8
|
-
import Spinner from '../shared/Spinner.svelte';
|
|
9
|
-
|
|
10
|
-
export let providers: SocialProvider[] = [];
|
|
11
|
-
export let layout: 'horizontal' | 'vertical' | 'grid' = 'vertical';
|
|
12
|
-
export let loading = false;
|
|
13
|
-
export let loadingProvider: SocialProvider | undefined = undefined;
|
|
14
|
-
export let disabled = false;
|
|
15
|
-
export let compact = false;
|
|
16
|
-
let className = '';
|
|
17
|
-
export { className as class };
|
|
18
|
-
|
|
19
|
-
const dispatch = createEventDispatcher<{
|
|
20
|
-
click: { provider: SocialProvider };
|
|
21
|
-
}>();
|
|
22
|
-
|
|
23
|
-
const providerConfig: Record<SocialProvider, { name: string; color: string }> = {
|
|
24
|
-
google: { name: 'Google', color: '#4285F4' },
|
|
25
|
-
apple: { name: 'Apple', color: '#000000' },
|
|
26
|
-
microsoft: { name: 'Microsoft', color: '#00A4EF' },
|
|
27
|
-
github: { name: 'GitHub', color: '#24292F' },
|
|
28
|
-
facebook: { name: 'Facebook', color: '#1877F2' },
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function handleClick(provider: SocialProvider) {
|
|
32
|
-
if (!disabled && !loading) {
|
|
33
|
-
dispatch('click', { provider });
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
</script>
|
|
37
|
-
|
|
38
|
-
<div
|
|
39
|
-
class="authrim-social authrim-social--{layout} {className}"
|
|
40
|
-
class:authrim-social--compact={compact}
|
|
41
|
-
{...$$restProps}
|
|
42
|
-
>
|
|
43
|
-
{#each providers as provider}
|
|
44
|
-
{@const config = providerConfig[provider] || { name: provider, color: '#666' }}
|
|
45
|
-
{@const isLoading = loading && loadingProvider === provider}
|
|
46
|
-
<button
|
|
47
|
-
type="button"
|
|
48
|
-
class="authrim-social__btn"
|
|
49
|
-
class:authrim-social__btn--loading={isLoading}
|
|
50
|
-
disabled={disabled || loading}
|
|
51
|
-
on:click={() => handleClick(provider)}
|
|
52
|
-
style="--provider-color: {config.color}"
|
|
53
|
-
>
|
|
54
|
-
{#if isLoading}
|
|
55
|
-
<span class="authrim-social__spinner">
|
|
56
|
-
<Spinner size="sm" />
|
|
57
|
-
</span>
|
|
58
|
-
{:else}
|
|
59
|
-
<span class="authrim-social__icon">
|
|
60
|
-
{#if provider === 'google'}
|
|
61
|
-
<svg viewBox="0 0 24 24">
|
|
62
|
-
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
|
|
63
|
-
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
|
|
64
|
-
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
|
|
65
|
-
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
|
|
66
|
-
</svg>
|
|
67
|
-
{:else if provider === 'apple'}
|
|
68
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
69
|
-
<path d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"/>
|
|
70
|
-
</svg>
|
|
71
|
-
{:else if provider === 'microsoft'}
|
|
72
|
-
<svg viewBox="0 0 24 24">
|
|
73
|
-
<path fill="#F25022" d="M1 1h10v10H1z"/>
|
|
74
|
-
<path fill="#00A4EF" d="M13 1h10v10H13z"/>
|
|
75
|
-
<path fill="#7FBA00" d="M1 13h10v10H1z"/>
|
|
76
|
-
<path fill="#FFB900" d="M13 13h10v10H13z"/>
|
|
77
|
-
</svg>
|
|
78
|
-
{:else if provider === 'github'}
|
|
79
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
80
|
-
<path d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"/>
|
|
81
|
-
</svg>
|
|
82
|
-
{:else if provider === 'facebook'}
|
|
83
|
-
<svg viewBox="0 0 24 24" fill="#1877F2">
|
|
84
|
-
<path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>
|
|
85
|
-
</svg>
|
|
86
|
-
{:else}
|
|
87
|
-
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
88
|
-
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
|
|
89
|
-
</svg>
|
|
90
|
-
{/if}
|
|
91
|
-
</span>
|
|
92
|
-
{/if}
|
|
93
|
-
{#if !compact}
|
|
94
|
-
<span class="authrim-social__label">
|
|
95
|
-
Continue with {config.name}
|
|
96
|
-
</span>
|
|
97
|
-
{/if}
|
|
98
|
-
</button>
|
|
99
|
-
{/each}
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<style>
|
|
103
|
-
.authrim-social {
|
|
104
|
-
display: flex;
|
|
105
|
-
gap: var(--authrim-space-3);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.authrim-social--vertical {
|
|
109
|
-
flex-direction: column;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.authrim-social--horizontal {
|
|
113
|
-
flex-direction: row;
|
|
114
|
-
justify-content: center;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.authrim-social--grid {
|
|
118
|
-
display: grid;
|
|
119
|
-
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.authrim-social--compact {
|
|
123
|
-
gap: var(--authrim-space-2);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.authrim-social--compact.authrim-social--horizontal,
|
|
127
|
-
.authrim-social--compact.authrim-social--grid {
|
|
128
|
-
justify-content: center;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.authrim-social__btn {
|
|
132
|
-
position: relative;
|
|
133
|
-
display: flex;
|
|
134
|
-
align-items: center;
|
|
135
|
-
justify-content: center;
|
|
136
|
-
gap: var(--authrim-space-3);
|
|
137
|
-
height: 48px;
|
|
138
|
-
padding: 0 var(--authrim-space-5);
|
|
139
|
-
font-family: var(--authrim-font-sans);
|
|
140
|
-
font-size: var(--authrim-text-sm);
|
|
141
|
-
font-weight: 500;
|
|
142
|
-
color: var(--authrim-color-text);
|
|
143
|
-
background: var(--authrim-color-bg);
|
|
144
|
-
border: 1.5px solid var(--authrim-color-border);
|
|
145
|
-
border-radius: var(--authrim-radius-md);
|
|
146
|
-
cursor: pointer;
|
|
147
|
-
transition:
|
|
148
|
-
background-color var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
149
|
-
border-color var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
150
|
-
box-shadow var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
151
|
-
transform var(--authrim-duration-fast) var(--authrim-ease-default);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.authrim-social--compact .authrim-social__btn {
|
|
155
|
-
width: 48px;
|
|
156
|
-
height: 48px;
|
|
157
|
-
padding: 0;
|
|
158
|
-
border-radius: var(--authrim-radius-md);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.authrim-social__btn:hover:not(:disabled) {
|
|
162
|
-
background: var(--authrim-color-bg-subtle);
|
|
163
|
-
border-color: var(--authrim-color-border-strong);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
.authrim-social__btn:active:not(:disabled) {
|
|
167
|
-
transform: scale(0.98);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.authrim-social__btn:focus-visible {
|
|
171
|
-
outline: none;
|
|
172
|
-
box-shadow: var(--authrim-shadow-focus);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.authrim-social__btn:disabled {
|
|
176
|
-
opacity: 0.5;
|
|
177
|
-
cursor: not-allowed;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
.authrim-social__spinner {
|
|
181
|
-
position: absolute;
|
|
182
|
-
display: flex;
|
|
183
|
-
align-items: center;
|
|
184
|
-
justify-content: center;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.authrim-social__btn--loading .authrim-social__icon,
|
|
188
|
-
.authrim-social__btn--loading .authrim-social__label {
|
|
189
|
-
visibility: hidden;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.authrim-social__icon {
|
|
193
|
-
display: flex;
|
|
194
|
-
align-items: center;
|
|
195
|
-
justify-content: center;
|
|
196
|
-
width: 20px;
|
|
197
|
-
height: 20px;
|
|
198
|
-
flex-shrink: 0;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
.authrim-social__icon svg {
|
|
202
|
-
width: 100%;
|
|
203
|
-
height: 100%;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
.authrim-social__label {
|
|
207
|
-
white-space: nowrap;
|
|
208
|
-
}
|
|
209
|
-
</style>
|
|
1
|
+
<!--
|
|
2
|
+
SocialLoginButtons Component
|
|
3
|
+
Social provider login buttons with provider icons
|
|
4
|
+
-->
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import { createEventDispatcher } from 'svelte';
|
|
7
|
+
import type { SocialProvider } from '../../types.js';
|
|
8
|
+
import Spinner from '../shared/Spinner.svelte';
|
|
9
|
+
|
|
10
|
+
export let providers: SocialProvider[] = [];
|
|
11
|
+
export let layout: 'horizontal' | 'vertical' | 'grid' = 'vertical';
|
|
12
|
+
export let loading = false;
|
|
13
|
+
export let loadingProvider: SocialProvider | undefined = undefined;
|
|
14
|
+
export let disabled = false;
|
|
15
|
+
export let compact = false;
|
|
16
|
+
let className = '';
|
|
17
|
+
export { className as class };
|
|
18
|
+
|
|
19
|
+
const dispatch = createEventDispatcher<{
|
|
20
|
+
click: { provider: SocialProvider };
|
|
21
|
+
}>();
|
|
22
|
+
|
|
23
|
+
const providerConfig: Record<SocialProvider, { name: string; color: string }> = {
|
|
24
|
+
google: { name: 'Google', color: '#4285F4' },
|
|
25
|
+
apple: { name: 'Apple', color: '#000000' },
|
|
26
|
+
microsoft: { name: 'Microsoft', color: '#00A4EF' },
|
|
27
|
+
github: { name: 'GitHub', color: '#24292F' },
|
|
28
|
+
facebook: { name: 'Facebook', color: '#1877F2' },
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function handleClick(provider: SocialProvider) {
|
|
32
|
+
if (!disabled && !loading) {
|
|
33
|
+
dispatch('click', { provider });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class="authrim-social authrim-social--{layout} {className}"
|
|
40
|
+
class:authrim-social--compact={compact}
|
|
41
|
+
{...$$restProps}
|
|
42
|
+
>
|
|
43
|
+
{#each providers as provider}
|
|
44
|
+
{@const config = providerConfig[provider] || { name: provider, color: '#666' }}
|
|
45
|
+
{@const isLoading = loading && loadingProvider === provider}
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
class="authrim-social__btn"
|
|
49
|
+
class:authrim-social__btn--loading={isLoading}
|
|
50
|
+
disabled={disabled || loading}
|
|
51
|
+
on:click={() => handleClick(provider)}
|
|
52
|
+
style="--provider-color: {config.color}"
|
|
53
|
+
>
|
|
54
|
+
{#if isLoading}
|
|
55
|
+
<span class="authrim-social__spinner">
|
|
56
|
+
<Spinner size="sm" />
|
|
57
|
+
</span>
|
|
58
|
+
{:else}
|
|
59
|
+
<span class="authrim-social__icon">
|
|
60
|
+
{#if provider === 'google'}
|
|
61
|
+
<svg viewBox="0 0 24 24">
|
|
62
|
+
<path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/>
|
|
63
|
+
<path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/>
|
|
64
|
+
<path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/>
|
|
65
|
+
<path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/>
|
|
66
|
+
</svg>
|
|
67
|
+
{:else if provider === 'apple'}
|
|
68
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
69
|
+
<path d="M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701"/>
|
|
70
|
+
</svg>
|
|
71
|
+
{:else if provider === 'microsoft'}
|
|
72
|
+
<svg viewBox="0 0 24 24">
|
|
73
|
+
<path fill="#F25022" d="M1 1h10v10H1z"/>
|
|
74
|
+
<path fill="#00A4EF" d="M13 1h10v10H13z"/>
|
|
75
|
+
<path fill="#7FBA00" d="M1 13h10v10H1z"/>
|
|
76
|
+
<path fill="#FFB900" d="M13 13h10v10H13z"/>
|
|
77
|
+
</svg>
|
|
78
|
+
{:else if provider === 'github'}
|
|
79
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
80
|
+
<path d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"/>
|
|
81
|
+
</svg>
|
|
82
|
+
{:else if provider === 'facebook'}
|
|
83
|
+
<svg viewBox="0 0 24 24" fill="#1877F2">
|
|
84
|
+
<path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>
|
|
85
|
+
</svg>
|
|
86
|
+
{:else}
|
|
87
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
88
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/>
|
|
89
|
+
</svg>
|
|
90
|
+
{/if}
|
|
91
|
+
</span>
|
|
92
|
+
{/if}
|
|
93
|
+
{#if !compact}
|
|
94
|
+
<span class="authrim-social__label">
|
|
95
|
+
Continue with {config.name}
|
|
96
|
+
</span>
|
|
97
|
+
{/if}
|
|
98
|
+
</button>
|
|
99
|
+
{/each}
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
<style>
|
|
103
|
+
.authrim-social {
|
|
104
|
+
display: flex;
|
|
105
|
+
gap: var(--authrim-space-3);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.authrim-social--vertical {
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.authrim-social--horizontal {
|
|
113
|
+
flex-direction: row;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.authrim-social--grid {
|
|
118
|
+
display: grid;
|
|
119
|
+
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.authrim-social--compact {
|
|
123
|
+
gap: var(--authrim-space-2);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.authrim-social--compact.authrim-social--horizontal,
|
|
127
|
+
.authrim-social--compact.authrim-social--grid {
|
|
128
|
+
justify-content: center;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.authrim-social__btn {
|
|
132
|
+
position: relative;
|
|
133
|
+
display: flex;
|
|
134
|
+
align-items: center;
|
|
135
|
+
justify-content: center;
|
|
136
|
+
gap: var(--authrim-space-3);
|
|
137
|
+
height: 48px;
|
|
138
|
+
padding: 0 var(--authrim-space-5);
|
|
139
|
+
font-family: var(--authrim-font-sans);
|
|
140
|
+
font-size: var(--authrim-text-sm);
|
|
141
|
+
font-weight: 500;
|
|
142
|
+
color: var(--authrim-color-text);
|
|
143
|
+
background: var(--authrim-color-bg);
|
|
144
|
+
border: 1.5px solid var(--authrim-color-border);
|
|
145
|
+
border-radius: var(--authrim-radius-md);
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
transition:
|
|
148
|
+
background-color var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
149
|
+
border-color var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
150
|
+
box-shadow var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
151
|
+
transform var(--authrim-duration-fast) var(--authrim-ease-default);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.authrim-social--compact .authrim-social__btn {
|
|
155
|
+
width: 48px;
|
|
156
|
+
height: 48px;
|
|
157
|
+
padding: 0;
|
|
158
|
+
border-radius: var(--authrim-radius-md);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.authrim-social__btn:hover:not(:disabled) {
|
|
162
|
+
background: var(--authrim-color-bg-subtle);
|
|
163
|
+
border-color: var(--authrim-color-border-strong);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.authrim-social__btn:active:not(:disabled) {
|
|
167
|
+
transform: scale(0.98);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.authrim-social__btn:focus-visible {
|
|
171
|
+
outline: none;
|
|
172
|
+
box-shadow: var(--authrim-shadow-focus);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.authrim-social__btn:disabled {
|
|
176
|
+
opacity: 0.5;
|
|
177
|
+
cursor: not-allowed;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.authrim-social__spinner {
|
|
181
|
+
position: absolute;
|
|
182
|
+
display: flex;
|
|
183
|
+
align-items: center;
|
|
184
|
+
justify-content: center;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.authrim-social__btn--loading .authrim-social__icon,
|
|
188
|
+
.authrim-social__btn--loading .authrim-social__label {
|
|
189
|
+
visibility: hidden;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.authrim-social__icon {
|
|
193
|
+
display: flex;
|
|
194
|
+
align-items: center;
|
|
195
|
+
justify-content: center;
|
|
196
|
+
width: 20px;
|
|
197
|
+
height: 20px;
|
|
198
|
+
flex-shrink: 0;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
.authrim-social__icon svg {
|
|
202
|
+
width: 100%;
|
|
203
|
+
height: 100%;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.authrim-social__label {
|
|
207
|
+
white-space: nowrap;
|
|
208
|
+
}
|
|
209
|
+
</style>
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
AuthError Component
|
|
3
|
-
Error message display with dismiss capability
|
|
4
|
-
-->
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { createEventDispatcher } from 'svelte';
|
|
7
|
-
|
|
8
|
-
export let message: string;
|
|
9
|
-
export let dismissible = true;
|
|
10
|
-
let className = '';
|
|
11
|
-
export { className as class };
|
|
12
|
-
|
|
13
|
-
const dispatch = createEventDispatcher<{ dismiss: void }>();
|
|
14
|
-
</script>
|
|
15
|
-
|
|
16
|
-
<div
|
|
17
|
-
class="authrim-error {className}"
|
|
18
|
-
role="alert"
|
|
19
|
-
aria-live="assertive"
|
|
20
|
-
{...$$restProps}
|
|
21
|
-
>
|
|
22
|
-
<div class="authrim-error__icon">
|
|
23
|
-
<svg viewBox="0 0 20 20" fill="currentColor">
|
|
24
|
-
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/>
|
|
25
|
-
</svg>
|
|
26
|
-
</div>
|
|
27
|
-
|
|
28
|
-
<p class="authrim-error__message">{message}</p>
|
|
29
|
-
|
|
30
|
-
{#if dismissible}
|
|
31
|
-
<button
|
|
32
|
-
type="button"
|
|
33
|
-
class="authrim-error__dismiss"
|
|
34
|
-
on:click={() => dispatch('dismiss')}
|
|
35
|
-
aria-label="Dismiss error"
|
|
36
|
-
>
|
|
37
|
-
<svg viewBox="0 0 20 20" fill="currentColor">
|
|
38
|
-
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"/>
|
|
39
|
-
</svg>
|
|
40
|
-
</button>
|
|
41
|
-
{/if}
|
|
42
|
-
</div>
|
|
43
|
-
|
|
44
|
-
<style>
|
|
45
|
-
.authrim-error {
|
|
46
|
-
display: flex;
|
|
47
|
-
align-items: flex-start;
|
|
48
|
-
gap: var(--authrim-space-3);
|
|
49
|
-
padding: var(--authrim-space-4);
|
|
50
|
-
background: var(--authrim-color-error-subtle);
|
|
51
|
-
border: 1.5px solid var(--authrim-color-error);
|
|
52
|
-
border-radius: var(--authrim-radius-md);
|
|
53
|
-
animation: slide-up var(--authrim-duration-normal) var(--authrim-ease-bounce);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
@keyframes slide-up {
|
|
57
|
-
from {
|
|
58
|
-
opacity: 0;
|
|
59
|
-
transform: translateY(8px);
|
|
60
|
-
}
|
|
61
|
-
to {
|
|
62
|
-
opacity: 1;
|
|
63
|
-
transform: translateY(0);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.authrim-error__icon {
|
|
68
|
-
flex-shrink: 0;
|
|
69
|
-
width: 20px;
|
|
70
|
-
height: 20px;
|
|
71
|
-
color: var(--authrim-color-error);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.authrim-error__icon svg {
|
|
75
|
-
width: 100%;
|
|
76
|
-
height: 100%;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.authrim-error__message {
|
|
80
|
-
flex: 1;
|
|
81
|
-
margin: 0;
|
|
82
|
-
font-size: var(--authrim-text-sm);
|
|
83
|
-
color: var(--authrim-color-error-text);
|
|
84
|
-
line-height: var(--authrim-leading-snug);
|
|
85
|
-
letter-spacing: var(--authrim-tracking-tight);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.authrim-error__dismiss {
|
|
89
|
-
flex-shrink: 0;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
justify-content: center;
|
|
93
|
-
width: 24px;
|
|
94
|
-
height: 24px;
|
|
95
|
-
padding: 0;
|
|
96
|
-
margin: -2px -4px -2px 0;
|
|
97
|
-
background: transparent;
|
|
98
|
-
border: none;
|
|
99
|
-
border-radius: var(--authrim-radius-sm);
|
|
100
|
-
color: var(--authrim-color-error-text);
|
|
101
|
-
cursor: pointer;
|
|
102
|
-
transition:
|
|
103
|
-
background-color var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
104
|
-
transform var(--authrim-duration-fast) var(--authrim-ease-default);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.authrim-error__dismiss:hover {
|
|
108
|
-
background: rgba(225, 29, 72, 0.15);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.authrim-error__dismiss:active {
|
|
112
|
-
transform: scale(0.9);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.authrim-error__dismiss:focus-visible {
|
|
116
|
-
outline: none;
|
|
117
|
-
box-shadow: 0 0 0 2px var(--authrim-color-error);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
.authrim-error__dismiss svg {
|
|
121
|
-
width: 16px;
|
|
122
|
-
height: 16px;
|
|
123
|
-
}
|
|
124
|
-
</style>
|
|
1
|
+
<!--
|
|
2
|
+
AuthError Component
|
|
3
|
+
Error message display with dismiss capability
|
|
4
|
+
-->
|
|
5
|
+
<script lang="ts">
|
|
6
|
+
import { createEventDispatcher } from 'svelte';
|
|
7
|
+
|
|
8
|
+
export let message: string;
|
|
9
|
+
export let dismissible = true;
|
|
10
|
+
let className = '';
|
|
11
|
+
export { className as class };
|
|
12
|
+
|
|
13
|
+
const dispatch = createEventDispatcher<{ dismiss: void }>();
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
class="authrim-error {className}"
|
|
18
|
+
role="alert"
|
|
19
|
+
aria-live="assertive"
|
|
20
|
+
{...$$restProps}
|
|
21
|
+
>
|
|
22
|
+
<div class="authrim-error__icon">
|
|
23
|
+
<svg viewBox="0 0 20 20" fill="currentColor">
|
|
24
|
+
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"/>
|
|
25
|
+
</svg>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<p class="authrim-error__message">{message}</p>
|
|
29
|
+
|
|
30
|
+
{#if dismissible}
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
class="authrim-error__dismiss"
|
|
34
|
+
on:click={() => dispatch('dismiss')}
|
|
35
|
+
aria-label="Dismiss error"
|
|
36
|
+
>
|
|
37
|
+
<svg viewBox="0 0 20 20" fill="currentColor">
|
|
38
|
+
<path d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"/>
|
|
39
|
+
</svg>
|
|
40
|
+
</button>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
.authrim-error {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
gap: var(--authrim-space-3);
|
|
49
|
+
padding: var(--authrim-space-4);
|
|
50
|
+
background: var(--authrim-color-error-subtle);
|
|
51
|
+
border: 1.5px solid var(--authrim-color-error);
|
|
52
|
+
border-radius: var(--authrim-radius-md);
|
|
53
|
+
animation: slide-up var(--authrim-duration-normal) var(--authrim-ease-bounce);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@keyframes slide-up {
|
|
57
|
+
from {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
transform: translateY(8px);
|
|
60
|
+
}
|
|
61
|
+
to {
|
|
62
|
+
opacity: 1;
|
|
63
|
+
transform: translateY(0);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.authrim-error__icon {
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
width: 20px;
|
|
70
|
+
height: 20px;
|
|
71
|
+
color: var(--authrim-color-error);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.authrim-error__icon svg {
|
|
75
|
+
width: 100%;
|
|
76
|
+
height: 100%;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.authrim-error__message {
|
|
80
|
+
flex: 1;
|
|
81
|
+
margin: 0;
|
|
82
|
+
font-size: var(--authrim-text-sm);
|
|
83
|
+
color: var(--authrim-color-error-text);
|
|
84
|
+
line-height: var(--authrim-leading-snug);
|
|
85
|
+
letter-spacing: var(--authrim-tracking-tight);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.authrim-error__dismiss {
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
width: 24px;
|
|
94
|
+
height: 24px;
|
|
95
|
+
padding: 0;
|
|
96
|
+
margin: -2px -4px -2px 0;
|
|
97
|
+
background: transparent;
|
|
98
|
+
border: none;
|
|
99
|
+
border-radius: var(--authrim-radius-sm);
|
|
100
|
+
color: var(--authrim-color-error-text);
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
transition:
|
|
103
|
+
background-color var(--authrim-duration-fast) var(--authrim-ease-default),
|
|
104
|
+
transform var(--authrim-duration-fast) var(--authrim-ease-default);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.authrim-error__dismiss:hover {
|
|
108
|
+
background: rgba(225, 29, 72, 0.15);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.authrim-error__dismiss:active {
|
|
112
|
+
transform: scale(0.9);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.authrim-error__dismiss:focus-visible {
|
|
116
|
+
outline: none;
|
|
117
|
+
box-shadow: 0 0 0 2px var(--authrim-color-error);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.authrim-error__dismiss svg {
|
|
121
|
+
width: 16px;
|
|
122
|
+
height: 16px;
|
|
123
|
+
}
|
|
124
|
+
</style>
|