@drmhse/authos-react 0.1.4 → 0.2.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/README.md CHANGED
@@ -32,10 +32,10 @@ function App() {
32
32
  ```
33
33
 
34
34
  That's it. You now have:
35
- - Email/password authentication with MFA support
36
- - Automatic session management
37
- - User dropdown with logout
38
- - Conditional rendering based on auth state
35
+ - Email/password authentication with MFA support
36
+ - Automatic session management
37
+ - User dropdown with logout
38
+ - Conditional rendering based on auth state
39
39
 
40
40
  ## Usage Modes
41
41
 
@@ -150,6 +150,22 @@ Registration form for new users.
150
150
  />
151
151
  ```
152
152
 
153
+ ### MagicLinkSignIn
154
+
155
+ Sign-in component for Magic Links (passwordless).
156
+
157
+ ```tsx
158
+ <MagicLinkSignIn onSuccess={() => console.log('Magic link sent!')} />
159
+ ```
160
+
161
+ ### PasskeySignIn
162
+
163
+ Sign-in component for Passkeys (WebAuthn).
164
+
165
+ ```tsx
166
+ <PasskeySignIn onSuccess={() => console.log('Authenticated!')} />
167
+ ```
168
+
153
169
  ### SignedIn / SignedOut
154
170
 
155
171
  Conditional rendering based on authentication state. Inspired by Clerk's API.
@@ -347,7 +363,40 @@ export default async function Dashboard() {
347
363
 
348
364
  ## Styling
349
365
 
350
- All components use data attributes for styling hooks. Use CSS selectors:
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.
351
400
 
352
401
  ```css
353
402
  [data-authos-signin] { /* Container */ }
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
@@ -129,6 +193,8 @@ interface SignUpProps {
129
193
  onError?: (error: Error) => void;
130
194
  /** Organization slug for registration context */
131
195
  orgSlug?: string;
196
+ /** Service slug for registration context (used with orgSlug for tenant attribution) */
197
+ serviceSlug?: string;
132
198
  /** Whether to show the "sign in" link */
133
199
  showSignIn?: boolean;
134
200
  /** Custom class name for the form container */
@@ -440,7 +506,7 @@ declare function SignIn({ onSuccess, onError, showForgotPassword, showSignUp, cl
440
506
  * }
441
507
  * ```
442
508
  */
443
- declare function SignUp({ onSuccess, onError, orgSlug, showSignIn, className }: SignUpProps): react_jsx_runtime.JSX.Element;
509
+ declare function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn, className }: SignUpProps): react_jsx_runtime.JSX.Element;
444
510
 
445
511
  /**
446
512
  * 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
@@ -129,6 +193,8 @@ interface SignUpProps {
129
193
  onError?: (error: Error) => void;
130
194
  /** Organization slug for registration context */
131
195
  orgSlug?: string;
196
+ /** Service slug for registration context (used with orgSlug for tenant attribution) */
197
+ serviceSlug?: string;
132
198
  /** Whether to show the "sign in" link */
133
199
  showSignIn?: boolean;
134
200
  /** Custom class name for the form container */
@@ -440,7 +506,7 @@ declare function SignIn({ onSuccess, onError, showForgotPassword, showSignUp, cl
440
506
  * }
441
507
  * ```
442
508
  */
443
- declare function SignUp({ onSuccess, onError, orgSlug, showSignIn, className }: SignUpProps): react_jsx_runtime.JSX.Element;
509
+ declare function SignUp({ onSuccess, onError, orgSlug, serviceSlug, showSignIn, className }: SignUpProps): react_jsx_runtime.JSX.Element;
444
510
 
445
511
  /**
446
512
  * Component for switching between organizations.