@insforge/react 0.4.0 → 0.4.5

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/dist/types.d.cts CHANGED
@@ -1,8 +1,16 @@
1
- import { ReactNode, InputHTMLAttributes, CSSProperties, FormEvent } from 'react';
2
- import { GetPublicAuthConfigResponse, OAuthProvidersSchema } from '@insforge/shared-schemas';
1
+ import { ReactNode } from 'react';
2
+ import { GetPublicAuthConfigResponse, VerificationMethodSchema, OAuthProvidersSchema } from '@insforge/shared-schemas';
3
3
 
4
+ /**
5
+ * Meta Types - Core types used across the package
6
+ * Component-specific props are exported from their respective modules:
7
+ * - Atom props: @insforge/react/atoms
8
+ * - Form props: @insforge/react/forms
9
+ * - Component props: @insforge/react/components
10
+ */
4
11
  type OAuthProvider = OAuthProvidersSchema;
5
12
  type AuthConfig = GetPublicAuthConfigResponse;
13
+ type EmailVerificationMethod = VerificationMethodSchema;
6
14
  /**
7
15
  * Insforge User type
8
16
  */
@@ -12,152 +20,6 @@ interface InsforgeUser {
12
20
  name?: string;
13
21
  avatarUrl?: string;
14
22
  }
15
- /**
16
- * Base appearance props for styling components
17
- */
18
- interface BaseAppearance {
19
- containerClassName?: string;
20
- [key: string]: string | undefined;
21
- }
22
- /**
23
- * Props for AuthContainer component
24
- */
25
- interface AuthContainerProps {
26
- children: ReactNode;
27
- appearance?: {
28
- containerClassName?: string;
29
- cardClassName?: string;
30
- };
31
- }
32
- /**
33
- * Props for AuthHeader component
34
- */
35
- interface AuthHeaderProps {
36
- title: string;
37
- subtitle?: string;
38
- appearance?: {
39
- containerClassName?: string;
40
- titleClassName?: string;
41
- subtitleClassName?: string;
42
- };
43
- }
44
- /**
45
- * Props for AuthErrorBanner component
46
- */
47
- interface AuthErrorBannerProps {
48
- error: string;
49
- className?: string;
50
- }
51
- /**
52
- * Props for AuthFormField component
53
- */
54
- interface AuthFormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
55
- label: string;
56
- id: string;
57
- appearance?: {
58
- containerClassName?: string;
59
- labelClassName?: string;
60
- inputClassName?: string;
61
- };
62
- }
63
- /**
64
- * Props for AuthPasswordField component
65
- */
66
- interface AuthPasswordFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
67
- label: string;
68
- id: string;
69
- showStrengthIndicator?: boolean;
70
- authConfig: AuthConfig;
71
- forgotPasswordLink?: {
72
- href: string;
73
- text?: string;
74
- };
75
- appearance?: {
76
- containerClassName?: string;
77
- labelClassName?: string;
78
- inputClassName?: string;
79
- };
80
- }
81
- /**
82
- * Props for AuthPasswordStrengthIndicator component
83
- */
84
- interface AuthPasswordStrengthIndicatorProps {
85
- password: string;
86
- config: AuthConfig;
87
- appearance?: {
88
- containerClassName?: string;
89
- requirementClassName?: string;
90
- };
91
- }
92
- /**
93
- * Props for AuthSubmitButton component
94
- */
95
- interface AuthSubmitButtonProps {
96
- children: ReactNode;
97
- isLoading?: boolean;
98
- confirmed?: boolean;
99
- disabled?: boolean;
100
- className?: string;
101
- }
102
- /**
103
- * Props for AuthLink component
104
- */
105
- interface AuthLinkProps {
106
- text: string;
107
- linkText: string;
108
- href: string;
109
- appearance?: {
110
- containerClassName?: string;
111
- linkClassName?: string;
112
- };
113
- }
114
- /**
115
- * Props for AuthDivider component
116
- */
117
- interface AuthDividerProps {
118
- text?: string;
119
- className?: string;
120
- }
121
- /**
122
- * Props for AuthOAuthButton component
123
- */
124
- interface AuthOAuthButtonProps {
125
- provider: OAuthProvider;
126
- onClick: (provider: OAuthProvider) => void;
127
- disabled?: boolean;
128
- loading?: boolean;
129
- displayMode?: 'full' | 'short' | 'icon';
130
- style?: CSSProperties;
131
- className?: string;
132
- }
133
- /**
134
- * Props for AuthOAuthProviders component
135
- */
136
- interface AuthOAuthProvidersProps {
137
- providers: OAuthProvider[];
138
- onClick: (provider: OAuthProvider) => void;
139
- disabled?: boolean;
140
- loading: OAuthProvider | null;
141
- appearance?: {
142
- containerClassName?: string;
143
- buttonClassName?: string;
144
- };
145
- }
146
- /**
147
- * Props for AuthVerificationCodeInput component
148
- */
149
- interface AuthVerificationCodeInputProps {
150
- length?: number;
151
- value: string;
152
- email: string;
153
- onChange: (value: string) => void;
154
- disabled?: boolean;
155
- onComplete?: (code: string) => void;
156
- appearance?: {
157
- containerClassName?: string;
158
- inputClassName?: string;
159
- };
160
- }
161
23
  /**
162
24
  * Configuration for an OAuth provider
163
25
  */
@@ -166,469 +28,5 @@ interface OAuthProviderConfig {
166
28
  svg: ReactNode;
167
29
  className: string;
168
30
  }
169
- /**
170
- * Hierarchical appearance configuration for SignIn/SignUp forms
171
- */
172
- interface SignInAppearance {
173
- /** Container (outermost wrapper) className */
174
- container?: string;
175
- /** Card (inner box) className */
176
- card?: string;
177
- /** Header section appearance */
178
- header?: {
179
- /** Header container className */
180
- container?: string;
181
- /** Title text className */
182
- title?: string;
183
- /** Subtitle text className */
184
- subtitle?: string;
185
- };
186
- /** Error banner className */
187
- errorBanner?: string;
188
- /** Form section appearance */
189
- form?: {
190
- /** Form container className */
191
- container?: string;
192
- /** Email field appearance */
193
- emailField?: {
194
- /** Email field container className */
195
- container?: string;
196
- /** Email label className */
197
- label?: string;
198
- /** Email input className */
199
- input?: string;
200
- };
201
- /** Password field appearance */
202
- passwordField?: {
203
- /** Password field container className */
204
- container?: string;
205
- /** Password label className */
206
- label?: string;
207
- /** Password input className */
208
- input?: string;
209
- /** Forgot password link className */
210
- forgotPasswordLink?: string;
211
- /** Password strength indicator appearance */
212
- strengthIndicator?: {
213
- /** Strength indicator container className */
214
- container?: string;
215
- /** Strength requirement item className */
216
- requirement?: string;
217
- };
218
- };
219
- };
220
- /** Submit button className */
221
- button?: string;
222
- /** Sign up/in link section appearance */
223
- link?: {
224
- /** Link section container className */
225
- container?: string;
226
- /** Link text className */
227
- text?: string;
228
- /** Anchor link className */
229
- link?: string;
230
- };
231
- /** Divider className */
232
- divider?: string;
233
- /** OAuth providers section appearance */
234
- oauth?: {
235
- /** OAuth container className */
236
- container?: string;
237
- /** OAuth button className */
238
- button?: string;
239
- };
240
- }
241
- /**
242
- * Props for SignInForm component
243
- */
244
- interface SignInFormProps {
245
- email: string;
246
- password: string;
247
- onEmailChange: (email: string) => void;
248
- onPasswordChange: (password: string) => void;
249
- onSubmit: (e: FormEvent<HTMLFormElement>) => void;
250
- error?: string;
251
- loading?: boolean;
252
- oauthLoading?: OAuthProvider | null;
253
- availableProviders?: OAuthProvider[];
254
- onOAuthClick?: (provider: OAuthProvider) => void;
255
- authConfig: AuthConfig;
256
- /** Hierarchical appearance configuration for deep customization */
257
- appearance?: SignInAppearance;
258
- title?: string;
259
- subtitle?: string;
260
- emailLabel?: string;
261
- emailPlaceholder?: string;
262
- passwordLabel?: string;
263
- passwordPlaceholder?: string;
264
- forgotPasswordText?: string;
265
- forgotPasswordUrl?: string;
266
- submitButtonText?: string;
267
- loadingButtonText?: string;
268
- signUpText?: string;
269
- signUpLinkText?: string;
270
- signUpUrl?: string;
271
- dividerText?: string;
272
- showVerificationStep?: boolean;
273
- onVerifyCode?: (code: string) => Promise<void>;
274
- verificationDescription?: string;
275
- }
276
- /**
277
- * Hierarchical appearance configuration for SignUp forms
278
- * Allows deep customization of all nested components
279
- */
280
- interface SignUpAppearance {
281
- /** Container (outermost wrapper) className */
282
- container?: string;
283
- /** Card (inner box) className */
284
- card?: string;
285
- /** Header section appearance */
286
- header?: {
287
- /** Header container className */
288
- container?: string;
289
- /** Title text className */
290
- title?: string;
291
- /** Subtitle text className */
292
- subtitle?: string;
293
- };
294
- /** Error banner className */
295
- errorBanner?: string;
296
- /** Form section appearance */
297
- form?: {
298
- /** Form container className */
299
- container?: string;
300
- /** Email field appearance */
301
- emailField?: {
302
- /** Email field container className */
303
- container?: string;
304
- /** Email label className */
305
- label?: string;
306
- /** Email input className */
307
- input?: string;
308
- };
309
- /** Password field appearance */
310
- passwordField?: {
311
- /** Password field container className */
312
- container?: string;
313
- /** Password label className */
314
- label?: string;
315
- /** Password input className */
316
- input?: string;
317
- /** Password strength indicator appearance */
318
- strengthIndicator?: {
319
- /** Strength indicator container className */
320
- container?: string;
321
- /** Strength requirement item className */
322
- requirement?: string;
323
- };
324
- };
325
- };
326
- /** Submit button className */
327
- button?: string;
328
- /** Sign in link section appearance */
329
- link?: {
330
- /** Link section container className */
331
- container?: string;
332
- /** Link text className */
333
- text?: string;
334
- /** Anchor link className */
335
- link?: string;
336
- };
337
- /** Divider className */
338
- divider?: string;
339
- /** OAuth providers section appearance */
340
- oauth?: {
341
- /** OAuth container className */
342
- container?: string;
343
- /** OAuth button className */
344
- button?: string;
345
- };
346
- }
347
- /**
348
- * Props for SignUpForm component
349
- */
350
- interface SignUpFormProps {
351
- email: string;
352
- password: string;
353
- onEmailChange: (email: string) => void;
354
- onPasswordChange: (password: string) => void;
355
- onSubmit: (e: FormEvent<HTMLFormElement>) => void;
356
- error?: string;
357
- loading?: boolean;
358
- oauthLoading?: OAuthProvider | null;
359
- availableProviders?: OAuthProvider[];
360
- onOAuthClick?: (provider: OAuthProvider) => void;
361
- authConfig: AuthConfig;
362
- /** Hierarchical appearance configuration for deep customization */
363
- appearance?: SignUpAppearance;
364
- title?: string;
365
- subtitle?: string;
366
- emailLabel?: string;
367
- emailPlaceholder?: string;
368
- passwordLabel?: string;
369
- passwordPlaceholder?: string;
370
- submitButtonText?: string;
371
- loadingButtonText?: string;
372
- signInText?: string;
373
- signInLinkText?: string;
374
- signInUrl?: string;
375
- dividerText?: string;
376
- showVerificationStep?: boolean;
377
- onVerifyCode?: (code: string) => Promise<void>;
378
- verificationDescription?: string;
379
- }
380
- /**
381
- * Hierarchical appearance configuration for ForgotPassword forms
382
- */
383
- interface ForgotPasswordAppearance {
384
- /** Container (outermost wrapper) className */
385
- container?: string;
386
- /** Card (inner box) className */
387
- card?: string;
388
- /** Header section appearance */
389
- header?: {
390
- /** Header container className */
391
- container?: string;
392
- /** Title text className */
393
- title?: string;
394
- /** Subtitle text className */
395
- subtitle?: string;
396
- };
397
- /** Error banner className */
398
- errorBanner?: string;
399
- /** Form section appearance */
400
- form?: {
401
- /** Form container className */
402
- container?: string;
403
- /** Email field appearance */
404
- emailField?: {
405
- /** Email field container className */
406
- container?: string;
407
- /** Email label className */
408
- label?: string;
409
- /** Email input className */
410
- input?: string;
411
- };
412
- };
413
- /** Submit button className */
414
- button?: string;
415
- /** Back to sign in link section appearance */
416
- link?: {
417
- /** Link section container className */
418
- container?: string;
419
- /** Link text className */
420
- text?: string;
421
- /** Anchor link className */
422
- link?: string;
423
- };
424
- }
425
- /**
426
- * Props for ForgotPasswordForm component
427
- */
428
- interface ForgotPasswordFormProps {
429
- email: string;
430
- onEmailChange: (email: string) => void;
431
- onSubmit: (e: FormEvent<HTMLFormElement>) => void;
432
- error?: string;
433
- loading?: boolean;
434
- success?: boolean;
435
- /** Hierarchical appearance configuration for deep customization */
436
- appearance?: ForgotPasswordAppearance;
437
- title?: string;
438
- subtitle?: string;
439
- emailLabel?: string;
440
- emailPlaceholder?: string;
441
- submitButtonText?: string;
442
- loadingButtonText?: string;
443
- backToSignInText?: string;
444
- backToSignInUrl?: string;
445
- successTitle?: string;
446
- successMessage?: string;
447
- }
448
- /**
449
- * Hierarchical appearance configuration for ResetPassword forms
450
- */
451
- interface ResetPasswordAppearance {
452
- /** Container (outermost wrapper) className */
453
- container?: string;
454
- /** Card (inner box) className */
455
- card?: string;
456
- /** Header section appearance */
457
- header?: {
458
- /** Header container className */
459
- container?: string;
460
- /** Title text className */
461
- title?: string;
462
- /** Subtitle text className */
463
- subtitle?: string;
464
- };
465
- /** Error banner className */
466
- errorBanner?: string;
467
- /** Form section appearance */
468
- form?: {
469
- /** Form container className */
470
- container?: string;
471
- /** New password field appearance */
472
- newPasswordField?: {
473
- /** Password field container className */
474
- container?: string;
475
- /** Password label className */
476
- label?: string;
477
- /** Password input className */
478
- input?: string;
479
- /** Password strength indicator appearance */
480
- strengthIndicator?: {
481
- /** Strength indicator container className */
482
- container?: string;
483
- /** Strength requirement item className */
484
- requirement?: string;
485
- };
486
- };
487
- /** Confirm password field appearance */
488
- confirmPasswordField?: {
489
- /** Password field container className */
490
- container?: string;
491
- /** Password label className */
492
- label?: string;
493
- /** Password input className */
494
- input?: string;
495
- };
496
- };
497
- /** Submit button className */
498
- button?: string;
499
- /** Back to sign in text/link className */
500
- link?: {
501
- container?: string;
502
- text?: string;
503
- link?: string;
504
- };
505
- }
506
- /**
507
- * Props for ResetPasswordForm component
508
- */
509
- interface ResetPasswordFormProps {
510
- newPassword: string;
511
- confirmPassword: string;
512
- onNewPasswordChange: (password: string) => void;
513
- onConfirmPasswordChange: (password: string) => void;
514
- onSubmit: (e: FormEvent<HTMLFormElement>) => void;
515
- error?: string;
516
- loading?: boolean;
517
- success?: boolean;
518
- authConfig: AuthConfig;
519
- /** Hierarchical appearance configuration for deep customization */
520
- appearance?: ResetPasswordAppearance;
521
- title?: string;
522
- subtitle?: string;
523
- newPasswordLabel?: string;
524
- newPasswordPlaceholder?: string;
525
- confirmPasswordLabel?: string;
526
- confirmPasswordPlaceholder?: string;
527
- submitButtonText?: string;
528
- loadingButtonText?: string;
529
- backToSignInText?: string;
530
- backToSignInUrl?: string;
531
- successTitle?: string;
532
- successMessage?: string;
533
- }
534
- /**
535
- * Props for VerifyEmailStatus component
536
- */
537
- interface VerifyEmailStatusProps {
538
- status: 'verifying' | 'success' | 'error';
539
- error?: string;
540
- appearance?: {
541
- containerClassName?: string;
542
- cardClassName?: string;
543
- };
544
- verifyingTitle?: string;
545
- successTitle?: string;
546
- successMessage?: string;
547
- errorTitle?: string;
548
- }
549
- /**
550
- * Props for the SignIn component
551
- */
552
- interface SignInProps {
553
- afterSignInUrl?: string;
554
- /** Hierarchical appearance configuration for deep customization */
555
- appearance?: SignInAppearance;
556
- title?: string;
557
- subtitle?: string;
558
- emailLabel?: string;
559
- emailPlaceholder?: string;
560
- passwordLabel?: string;
561
- passwordPlaceholder?: string;
562
- forgotPasswordText?: string;
563
- forgotPasswordUrl?: string;
564
- submitButtonText?: string;
565
- loadingButtonText?: string;
566
- signUpText?: string;
567
- signUpLinkText?: string;
568
- signUpUrl?: string;
569
- dividerText?: string;
570
- onSuccess?: (user: {
571
- id: string;
572
- email: string;
573
- name: string;
574
- }, accessToken: string, redirectTo?: string) => void;
575
- onError?: (error: Error) => void;
576
- }
577
- /**
578
- * Props for the SignUp component
579
- */
580
- interface SignUpProps {
581
- afterSignUpUrl?: string;
582
- /** Hierarchical appearance configuration for deep customization */
583
- appearance?: SignUpAppearance;
584
- title?: string;
585
- subtitle?: string;
586
- emailLabel?: string;
587
- emailPlaceholder?: string;
588
- passwordLabel?: string;
589
- passwordPlaceholder?: string;
590
- submitButtonText?: string;
591
- loadingButtonText?: string;
592
- signInText?: string;
593
- signInLinkText?: string;
594
- signInUrl?: string;
595
- dividerText?: string;
596
- onSuccess?: (user: {
597
- id: string;
598
- email: string;
599
- name: string;
600
- }, accessToken: string, redirectTo?: string) => void;
601
- onError?: (error: Error) => void;
602
- }
603
- /**
604
- * Props for Protect component
605
- */
606
- interface ProtectProps {
607
- children: ReactNode;
608
- fallback?: ReactNode;
609
- redirectTo?: string;
610
- condition?: (user: InsforgeUser) => boolean;
611
- onRedirect?: (url: string) => void;
612
- }
613
- /**
614
- * Props for conditional rendering components (SignedIn, SignedOut)
615
- */
616
- interface ConditionalProps {
617
- children: ReactNode;
618
- }
619
- /**
620
- * Props for UserButton component
621
- */
622
- interface UserButtonProps {
623
- afterSignOutUrl?: string;
624
- mode?: 'detailed' | 'simple';
625
- appearance?: {
626
- containerClassName?: string;
627
- buttonClassName?: string;
628
- nameClassName?: string;
629
- emailClassName?: string;
630
- dropdownClassName?: string;
631
- };
632
- }
633
31
 
634
- export type { AuthConfig, AuthContainerProps, AuthDividerProps, AuthErrorBannerProps, AuthFormFieldProps, AuthHeaderProps, AuthLinkProps, AuthOAuthButtonProps, AuthOAuthProvidersProps, AuthPasswordFieldProps, AuthPasswordStrengthIndicatorProps, AuthSubmitButtonProps, AuthVerificationCodeInputProps, BaseAppearance, ConditionalProps, ForgotPasswordAppearance, ForgotPasswordFormProps, InsforgeUser, OAuthProvider, OAuthProviderConfig, ProtectProps, ResetPasswordAppearance, ResetPasswordFormProps, SignInAppearance, SignInFormProps, SignInProps, SignUpAppearance, SignUpFormProps, SignUpProps, UserButtonProps, VerifyEmailStatusProps };
32
+ export type { AuthConfig, EmailVerificationMethod, InsforgeUser, OAuthProvider, OAuthProviderConfig };