@drmhse/authos-react 0.1.5 → 0.2.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 +36 -1
- package/dist/index.d.mts +79 -1
- package/dist/index.d.ts +79 -1
- package/dist/index.js +675 -67
- package/dist/index.mjs +675 -67
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -363,7 +363,40 @@ export default async function Dashboard() {
|
|
|
363
363
|
|
|
364
364
|
## Styling
|
|
365
365
|
|
|
366
|
-
|
|
366
|
+
AuthOS components come with **polished default styling** out of the box, similar to best-in-class auth providers. The styling is fully customizable via the `appearance` option or by overriding CSS variables.
|
|
367
|
+
|
|
368
|
+
### Customization
|
|
369
|
+
|
|
370
|
+
You can customize the theme colors, fonts, and more by passing an `appearance` object to `AuthOSProvider`.
|
|
371
|
+
|
|
372
|
+
```tsx
|
|
373
|
+
<AuthOSProvider config={{
|
|
374
|
+
baseURL: '...',
|
|
375
|
+
appearance: {
|
|
376
|
+
variables: {
|
|
377
|
+
colorPrimary: '#0066cc',
|
|
378
|
+
colorBackground: '#f5f5f5',
|
|
379
|
+
borderRadius: '0.25rem',
|
|
380
|
+
fontFamily: 'Inter, sans-serif',
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
}}>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
### CSS Variables
|
|
387
|
+
|
|
388
|
+
You can also override these CSS variables in your own stylesheet:
|
|
389
|
+
|
|
390
|
+
```css
|
|
391
|
+
:root {
|
|
392
|
+
--authos-color-primary: #0066cc;
|
|
393
|
+
--authos-border-radius: 4px;
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
### Headless Styling
|
|
398
|
+
|
|
399
|
+
If you prefer to completely style the components yourself, you can target the data attributes. The default styles have low specificity, so your CSS classes will easily override them.
|
|
367
400
|
|
|
368
401
|
```css
|
|
369
402
|
[data-authos-signin] { /* Container */ }
|
|
@@ -374,6 +407,8 @@ All components use data attributes for styling hooks. Use CSS selectors:
|
|
|
374
407
|
[data-authos-oauth] { /* OAuth button */ }
|
|
375
408
|
[data-authos-oauth][data-provider="github"] { /* GitHub button */ }
|
|
376
409
|
[data-authos-divider] { /* "or" divider */ }
|
|
410
|
+
[data-authos-magic-link] { /* Magic Link container */ }
|
|
411
|
+
[data-authos-passkey] { /* Passkey container */ }
|
|
377
412
|
```
|
|
378
413
|
|
|
379
414
|
## Security Considerations
|
package/dist/index.d.mts
CHANGED
|
@@ -37,12 +37,76 @@ interface AuthOSConfig extends SsoClientOptions {
|
|
|
37
37
|
* @example '/dashboard'
|
|
38
38
|
*/
|
|
39
39
|
afterSignInUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* URL to redirect to after successful sign-up.
|
|
42
|
+
* If not set, user stays on current page.
|
|
40
43
|
/**
|
|
41
44
|
* URL to redirect to after successful sign-up.
|
|
42
45
|
* If not set, user stays on current page.
|
|
43
46
|
* @example '/onboarding'
|
|
44
47
|
*/
|
|
45
48
|
afterSignUpUrl?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Appearance customization options.
|
|
51
|
+
* Use to override default theme colors, fonts, and styling.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* appearance: {
|
|
55
|
+
* variables: {
|
|
56
|
+
* colorPrimary: '#0066cc',
|
|
57
|
+
* borderRadius: '0.25rem',
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
appearance?: AppearanceOptions;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Appearance variables for customizing the visual theme.
|
|
66
|
+
* All properties are optional and use CSS color/size values.
|
|
67
|
+
*/
|
|
68
|
+
interface AppearanceVariables {
|
|
69
|
+
/** Primary brand color (e.g., '#6366f1') */
|
|
70
|
+
colorPrimary?: string;
|
|
71
|
+
/** Primary color on hover */
|
|
72
|
+
colorPrimaryHover?: string;
|
|
73
|
+
/** Text color on primary background */
|
|
74
|
+
colorPrimaryForeground?: string;
|
|
75
|
+
/** Error/danger color */
|
|
76
|
+
colorDanger?: string;
|
|
77
|
+
/** Success color */
|
|
78
|
+
colorSuccess?: string;
|
|
79
|
+
/** Warning color */
|
|
80
|
+
colorWarning?: string;
|
|
81
|
+
/** Main background color */
|
|
82
|
+
colorBackground?: string;
|
|
83
|
+
/** Surface/card background color */
|
|
84
|
+
colorSurface?: string;
|
|
85
|
+
/** Main text color */
|
|
86
|
+
colorForeground?: string;
|
|
87
|
+
/** Muted/secondary text color */
|
|
88
|
+
colorMuted?: string;
|
|
89
|
+
/** Border color */
|
|
90
|
+
colorBorder?: string;
|
|
91
|
+
/** Input background color */
|
|
92
|
+
colorInput?: string;
|
|
93
|
+
/** Input border color */
|
|
94
|
+
colorInputBorder?: string;
|
|
95
|
+
/** Focus ring color */
|
|
96
|
+
colorRing?: string;
|
|
97
|
+
/** Font family */
|
|
98
|
+
fontFamily?: string;
|
|
99
|
+
/** Base font size */
|
|
100
|
+
fontSize?: string;
|
|
101
|
+
/** Border radius */
|
|
102
|
+
borderRadius?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Appearance configuration for customizing component styling.
|
|
106
|
+
*/
|
|
107
|
+
interface AppearanceOptions {
|
|
108
|
+
/** CSS variable overrides */
|
|
109
|
+
variables?: AppearanceVariables;
|
|
46
110
|
}
|
|
47
111
|
/**
|
|
48
112
|
* Configuration options for the AuthOS React provider
|
|
@@ -135,6 +199,19 @@ interface SignUpProps {
|
|
|
135
199
|
showSignIn?: boolean;
|
|
136
200
|
/** Custom class name for the form container */
|
|
137
201
|
className?: string;
|
|
202
|
+
/**
|
|
203
|
+
* OAuth providers to display as buttons.
|
|
204
|
+
* Set to false to hide all OAuth buttons, or provide an array of providers.
|
|
205
|
+
* @default false (no OAuth buttons shown by default)
|
|
206
|
+
* @example ['github', 'google', 'microsoft']
|
|
207
|
+
*/
|
|
208
|
+
providers?: ('github' | 'google' | 'microsoft')[] | false;
|
|
209
|
+
/**
|
|
210
|
+
* Show a divider between OAuth and email/password forms.
|
|
211
|
+
* Only visible when providers are enabled.
|
|
212
|
+
* @default true
|
|
213
|
+
*/
|
|
214
|
+
showDivider?: boolean;
|
|
138
215
|
}
|
|
139
216
|
/**
|
|
140
217
|
* Props for the OrganizationSwitcher component
|
|
@@ -437,12 +514,13 @@ declare function SignIn({ onSuccess, onError, showForgotPassword, showSignUp, cl
|
|
|
437
514
|
* <SignUp
|
|
438
515
|
* onSuccess={() => console.log('Registration successful!')}
|
|
439
516
|
* onError={(error) => console.error('Registration failed:', error)}
|
|
517
|
+
* providers={['github', 'google']}
|
|
440
518
|
* />
|
|
441
519
|
* );
|
|
442
520
|
* }
|
|
443
521
|
* ```
|
|
444
522
|
*/
|
|
445
|
-
declare function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn, className }: SignUpProps): react_jsx_runtime.JSX.Element;
|
|
523
|
+
declare function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn, className, providers, showDivider, }: SignUpProps): react_jsx_runtime.JSX.Element;
|
|
446
524
|
|
|
447
525
|
/**
|
|
448
526
|
* Component for switching between organizations.
|
package/dist/index.d.ts
CHANGED
|
@@ -37,12 +37,76 @@ interface AuthOSConfig extends SsoClientOptions {
|
|
|
37
37
|
* @example '/dashboard'
|
|
38
38
|
*/
|
|
39
39
|
afterSignInUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* URL to redirect to after successful sign-up.
|
|
42
|
+
* If not set, user stays on current page.
|
|
40
43
|
/**
|
|
41
44
|
* URL to redirect to after successful sign-up.
|
|
42
45
|
* If not set, user stays on current page.
|
|
43
46
|
* @example '/onboarding'
|
|
44
47
|
*/
|
|
45
48
|
afterSignUpUrl?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Appearance customization options.
|
|
51
|
+
* Use to override default theme colors, fonts, and styling.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* appearance: {
|
|
55
|
+
* variables: {
|
|
56
|
+
* colorPrimary: '#0066cc',
|
|
57
|
+
* borderRadius: '0.25rem',
|
|
58
|
+
* }
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
appearance?: AppearanceOptions;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Appearance variables for customizing the visual theme.
|
|
66
|
+
* All properties are optional and use CSS color/size values.
|
|
67
|
+
*/
|
|
68
|
+
interface AppearanceVariables {
|
|
69
|
+
/** Primary brand color (e.g., '#6366f1') */
|
|
70
|
+
colorPrimary?: string;
|
|
71
|
+
/** Primary color on hover */
|
|
72
|
+
colorPrimaryHover?: string;
|
|
73
|
+
/** Text color on primary background */
|
|
74
|
+
colorPrimaryForeground?: string;
|
|
75
|
+
/** Error/danger color */
|
|
76
|
+
colorDanger?: string;
|
|
77
|
+
/** Success color */
|
|
78
|
+
colorSuccess?: string;
|
|
79
|
+
/** Warning color */
|
|
80
|
+
colorWarning?: string;
|
|
81
|
+
/** Main background color */
|
|
82
|
+
colorBackground?: string;
|
|
83
|
+
/** Surface/card background color */
|
|
84
|
+
colorSurface?: string;
|
|
85
|
+
/** Main text color */
|
|
86
|
+
colorForeground?: string;
|
|
87
|
+
/** Muted/secondary text color */
|
|
88
|
+
colorMuted?: string;
|
|
89
|
+
/** Border color */
|
|
90
|
+
colorBorder?: string;
|
|
91
|
+
/** Input background color */
|
|
92
|
+
colorInput?: string;
|
|
93
|
+
/** Input border color */
|
|
94
|
+
colorInputBorder?: string;
|
|
95
|
+
/** Focus ring color */
|
|
96
|
+
colorRing?: string;
|
|
97
|
+
/** Font family */
|
|
98
|
+
fontFamily?: string;
|
|
99
|
+
/** Base font size */
|
|
100
|
+
fontSize?: string;
|
|
101
|
+
/** Border radius */
|
|
102
|
+
borderRadius?: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Appearance configuration for customizing component styling.
|
|
106
|
+
*/
|
|
107
|
+
interface AppearanceOptions {
|
|
108
|
+
/** CSS variable overrides */
|
|
109
|
+
variables?: AppearanceVariables;
|
|
46
110
|
}
|
|
47
111
|
/**
|
|
48
112
|
* Configuration options for the AuthOS React provider
|
|
@@ -135,6 +199,19 @@ interface SignUpProps {
|
|
|
135
199
|
showSignIn?: boolean;
|
|
136
200
|
/** Custom class name for the form container */
|
|
137
201
|
className?: string;
|
|
202
|
+
/**
|
|
203
|
+
* OAuth providers to display as buttons.
|
|
204
|
+
* Set to false to hide all OAuth buttons, or provide an array of providers.
|
|
205
|
+
* @default false (no OAuth buttons shown by default)
|
|
206
|
+
* @example ['github', 'google', 'microsoft']
|
|
207
|
+
*/
|
|
208
|
+
providers?: ('github' | 'google' | 'microsoft')[] | false;
|
|
209
|
+
/**
|
|
210
|
+
* Show a divider between OAuth and email/password forms.
|
|
211
|
+
* Only visible when providers are enabled.
|
|
212
|
+
* @default true
|
|
213
|
+
*/
|
|
214
|
+
showDivider?: boolean;
|
|
138
215
|
}
|
|
139
216
|
/**
|
|
140
217
|
* Props for the OrganizationSwitcher component
|
|
@@ -437,12 +514,13 @@ declare function SignIn({ onSuccess, onError, showForgotPassword, showSignUp, cl
|
|
|
437
514
|
* <SignUp
|
|
438
515
|
* onSuccess={() => console.log('Registration successful!')}
|
|
439
516
|
* onError={(error) => console.error('Registration failed:', error)}
|
|
517
|
+
* providers={['github', 'google']}
|
|
440
518
|
* />
|
|
441
519
|
* );
|
|
442
520
|
* }
|
|
443
521
|
* ```
|
|
444
522
|
*/
|
|
445
|
-
declare function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn, className }: SignUpProps): react_jsx_runtime.JSX.Element;
|
|
523
|
+
declare function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn, className, providers, showDivider, }: SignUpProps): react_jsx_runtime.JSX.Element;
|
|
446
524
|
|
|
447
525
|
/**
|
|
448
526
|
* Component for switching between organizations.
|