@insforge/react 0.3.5 → 0.4.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.
Files changed (63) hide show
  1. package/README.md +485 -604
  2. package/dist/atoms.cjs +818 -0
  3. package/dist/atoms.cjs.map +1 -0
  4. package/dist/atoms.d.cts +222 -0
  5. package/dist/atoms.d.ts +72 -237
  6. package/dist/atoms.js +382 -456
  7. package/dist/atoms.js.map +1 -1
  8. package/dist/components.cjs +2254 -0
  9. package/dist/components.cjs.map +1 -0
  10. package/dist/{components.d.mts → components.d.cts} +10 -32
  11. package/dist/components.d.ts +9 -31
  12. package/dist/components.js +1046 -1180
  13. package/dist/components.js.map +1 -1
  14. package/dist/forms.cjs +1287 -0
  15. package/dist/forms.cjs.map +1 -0
  16. package/dist/forms.d.cts +138 -0
  17. package/dist/forms.d.ts +115 -162
  18. package/dist/forms.js +728 -921
  19. package/dist/forms.js.map +1 -1
  20. package/dist/{hooks.mjs → hooks.cjs} +15 -13
  21. package/dist/hooks.cjs.map +1 -0
  22. package/dist/{hooks.d.mts → hooks.d.cts} +1 -1
  23. package/dist/hooks.js +9 -15
  24. package/dist/hooks.js.map +1 -1
  25. package/dist/index.cjs +2674 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/{index.d.mts → index.d.cts} +10 -10
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js +1093 -1235
  30. package/dist/index.js.map +1 -1
  31. package/dist/{lib.mjs → lib.cjs} +13 -11
  32. package/dist/lib.cjs.map +1 -0
  33. package/dist/{lib.d.mts → lib.d.cts} +1 -8
  34. package/dist/lib.d.ts +1 -8
  35. package/dist/lib.js +4 -17
  36. package/dist/lib.js.map +1 -1
  37. package/dist/{router.mjs → router.cjs} +14 -16
  38. package/dist/router.cjs.map +1 -0
  39. package/dist/router.js +10 -16
  40. package/dist/router.js.map +1 -1
  41. package/dist/styles.css +655 -2
  42. package/dist/types.cjs +4 -0
  43. package/dist/{types.mjs.map → types.cjs.map} +1 -1
  44. package/dist/{types.d.mts → types.d.cts} +2 -2
  45. package/dist/types.d.ts +2 -2
  46. package/dist/types.js +0 -1
  47. package/package.json +106 -98
  48. package/dist/atoms.d.mts +0 -387
  49. package/dist/atoms.mjs +0 -861
  50. package/dist/atoms.mjs.map +0 -1
  51. package/dist/components.mjs +0 -2327
  52. package/dist/components.mjs.map +0 -1
  53. package/dist/forms.d.mts +0 -185
  54. package/dist/forms.mjs +0 -1468
  55. package/dist/forms.mjs.map +0 -1
  56. package/dist/hooks.mjs.map +0 -1
  57. package/dist/index.mjs +0 -2724
  58. package/dist/index.mjs.map +0 -1
  59. package/dist/lib.mjs.map +0 -1
  60. package/dist/router.mjs.map +0 -1
  61. package/dist/types.mjs +0 -3
  62. package/src/styles.css +0 -15
  63. /package/dist/{router.d.mts → router.d.cts} +0 -0
package/dist/atoms.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { AuthContainerProps, AuthHeaderProps, AuthErrorBannerProps, AuthFormFieldProps, AuthPasswordFieldProps, AuthPasswordStrengthIndicatorProps, AuthConfig, AuthSubmitButtonProps, AuthLinkProps, AuthDividerProps, AuthOAuthButtonProps, AuthOAuthProvidersProps, AuthVerificationCodeInputProps } from './types.js';
3
- import 'react';
4
- import '@insforge/shared-schemas';
2
+ import { ReactNode, InputHTMLAttributes, CSSProperties } from 'react';
3
+ import { AuthConfig } from './types.js';
4
+ import { OAuthProvidersSchema } from '@insforge/shared-schemas';
5
5
 
6
6
  /**
7
7
  * Insforge branding component for authentication pages.
@@ -24,24 +24,13 @@ declare function AuthBranding(): react_jsx_runtime.JSX.Element;
24
24
  * <AuthHeader title="Sign In" />
25
25
  * <form>...</form>
26
26
  * </AuthContainer>
27
- *
28
- * // With custom styling
29
- * <AuthContainer
30
- * appearance={{
31
- * cardClassName: "bg-gray-50"
32
- * }}
33
- * >
34
- * <AuthHeader title="Sign In" />
35
- * <form>...</form>
36
- * </AuthContainer>
37
27
  * ```
38
28
  *
39
29
  * @param {ReactNode} children - Form content
40
- * @param {object} [appearance] - Tailwind CSS classes for styling
41
- * - `appearance.containerClassName`: Outer container element
42
- * - `appearance.cardClassName`: Inner card element (white background area)
43
30
  */
44
- declare function AuthContainer({ children, appearance }: AuthContainerProps): react_jsx_runtime.JSX.Element;
31
+ declare function AuthContainer({ children }: {
32
+ children: ReactNode;
33
+ }): react_jsx_runtime.JSX.Element;
45
34
 
46
35
  /**
47
36
  * Header component for authentication forms displaying title and optional subtitle.
@@ -49,44 +38,26 @@ declare function AuthContainer({ children, appearance }: AuthContainerProps): re
49
38
  * @component
50
39
  * @example
51
40
  * ```tsx
52
- * // Basic usage
53
41
  * <AuthHeader
54
42
  * title="Welcome Back"
55
43
  * subtitle="Sign in to continue"
56
44
  * />
57
- *
58
- * // With custom styling
59
- * <AuthHeader
60
- * title="Welcome Back"
61
- * appearance={{
62
- * titleClassName: "text-purple-900 text-3xl",
63
- * subtitleClassName: "text-purple-700"
64
- * }}
65
- * />
66
45
  * ```
67
46
  *
68
47
  * @param {string} title - Main heading text
69
48
  * @param {string} [subtitle] - Optional subheading text
70
- * @param {object} [appearance] - Tailwind CSS classes for styling
71
- * - `appearance.containerClassName`: Container element
72
- * - `appearance.titleClassName`: Title element
73
- * - `appearance.subtitleClassName`: Subtitle element
74
49
  */
75
- declare function AuthHeader({ title, subtitle, appearance }: AuthHeaderProps): react_jsx_runtime.JSX.Element;
50
+ declare function AuthHeader({ title, subtitle }: {
51
+ title: string;
52
+ subtitle?: string;
53
+ }): react_jsx_runtime.JSX.Element;
76
54
 
77
55
  /**
78
56
  * Error message banner for authentication forms.
79
- *
80
- * @component
81
- * @example
82
- * ```tsx
83
- * <AuthErrorBanner error={error} />
84
- * ```
85
- *
86
- * @param {string} error - Error message to display
87
- * @param {string} [className] - Banner element classes
88
57
  */
89
- declare function AuthErrorBanner({ error, className }: AuthErrorBannerProps): react_jsx_runtime.JSX.Element | null;
58
+ declare function AuthErrorBanner({ error }: {
59
+ error?: string;
60
+ }): react_jsx_runtime.JSX.Element | null;
90
61
 
91
62
  /**
92
63
  * Standard form input field with label for authentication forms.
@@ -94,107 +65,43 @@ declare function AuthErrorBanner({ error, className }: AuthErrorBannerProps): re
94
65
  * @component
95
66
  * @example
96
67
  * ```tsx
97
- * // Basic usage
98
68
  * <AuthFormField
99
69
  * id="email"
100
70
  * type="email"
101
71
  * label="Email Address"
102
72
  * />
103
- *
104
- * // With custom styling
105
- * <AuthFormField
106
- * id="email"
107
- * label="Email"
108
- * appearance={{
109
- * containerClassName: "flex flex-col justify-center items-stretch gap-1",
110
- * inputClassName: "border-blue-500 focus:ring-blue-500",
111
- * labelClassName: "text-blue-900 font-semibold"
112
- * }}
113
- * />
114
73
  * ```
115
74
  *
116
75
  * @param {string} label - Label text
117
76
  * @param {string} id - Input element ID
118
- * @param {object} [appearance] - Tailwind CSS classes for styling
119
- * - `appearance.containerClassName`: Container element
120
- * - `appearance.labelClassName`: Label element
121
- * - `appearance.inputClassName`: Input element
122
77
  */
123
- declare function AuthFormField({ label, id, appearance, ...props }: AuthFormFieldProps): react_jsx_runtime.JSX.Element;
78
+ declare function AuthFormField({ label, id, ...props }: {
79
+ label: string;
80
+ id: string;
81
+ } & InputHTMLAttributes<HTMLInputElement>): react_jsx_runtime.JSX.Element;
124
82
 
83
+ interface AuthPasswordFieldProps extends InputHTMLAttributes<HTMLInputElement> {
84
+ label?: string;
85
+ id: string;
86
+ showStrengthIndicator?: boolean;
87
+ authConfig: AuthConfig;
88
+ forgotPasswordLink?: {
89
+ href: string;
90
+ text?: string;
91
+ };
92
+ }
125
93
  /**
126
94
  * Password input field with visibility toggle and optional strength indicator.
127
- *
128
- * @component
129
- * @example
130
- * ```tsx
131
- * // With forgot password link
132
- * <AuthPasswordField
133
- * id="password"
134
- * label="Password"
135
- * forgotPasswordLink={{ href: '/forgot-password' }}
136
- * authConfig={config}
137
- * />
138
- *
139
- * // With custom styling
140
- * <AuthPasswordField
141
- * id="password"
142
- * label="Password"
143
- * authConfig={config}
144
- * appearance={{
145
- * inputClassName: "border-blue-500",
146
- * labelClassName: "text-blue-900"
147
- * }}
148
- * />
149
- * ```
150
- *
151
- * @param {string} label - Label text
152
- * @param {string} id - Input element ID
153
- * @param {boolean} [showStrengthIndicator] - Show password strength requirements
154
- * @param {object} [forgotPasswordLink] - Forgot password link config
155
- * @param {object} [appearance] - Tailwind CSS classes for styling
156
- * - `appearance.containerClassName`: Container element
157
- * - `appearance.labelClassName`: Label element
158
- * - `appearance.inputClassName`: Input element
159
95
  */
160
- declare function AuthPasswordField({ label, id, showStrengthIndicator, authConfig, forgotPasswordLink, value, appearance, onFocus, ...props }: AuthPasswordFieldProps): react_jsx_runtime.JSX.Element;
96
+ declare function AuthPasswordField({ label, id, showStrengthIndicator, authConfig, forgotPasswordLink, value, onFocus, ...props }: AuthPasswordFieldProps): react_jsx_runtime.JSX.Element;
161
97
 
162
98
  /**
163
99
  * Password strength indicator showing requirement checklist.
164
- *
165
- * @component
166
- * @example
167
- * ```tsx
168
- * <AuthPasswordStrengthIndicator
169
- * password={password}
170
- * config={authConfig}
171
- * />
172
- *
173
- * // With custom styling
174
- * <AuthPasswordStrengthIndicator
175
- * password={password}
176
- * config={authConfig}
177
- * appearance={{
178
- * requirementClassName: "text-lg"
179
- * }}
180
- * />
181
- * ```
182
- *
183
- * @param {string} password - Current password value
184
- * @param {object} config - Email auth configuration
185
- * @param {object} [appearance] - Tailwind CSS classes for styling
186
- * - `appearance.containerClassName`: Container element
187
- * - `appearance.requirementClassName`: Requirement text elements
188
100
  */
189
- declare function AuthPasswordStrengthIndicator({ password, config, appearance, }: AuthPasswordStrengthIndicatorProps): react_jsx_runtime.JSX.Element;
190
- /**
191
- * Validates that a password meets all strength requirements based on email auth configuration.
192
- *
193
- * @param password - The password string to validate
194
- * @param config - Email authentication configuration from backend
195
- * @returns true if all requirements are met, false otherwise
196
- */
197
- declare function validatePasswordStrength(password: string, config: AuthConfig): boolean;
101
+ declare function AuthPasswordStrengthIndicator({ password, config, }: {
102
+ password: string;
103
+ config: AuthConfig;
104
+ }): react_jsx_runtime.JSX.Element;
198
105
 
199
106
  /**
200
107
  * Primary submit button for authentication forms with loading and confirmed states.
@@ -202,24 +109,22 @@ declare function validatePasswordStrength(password: string, config: AuthConfig):
202
109
  * @component
203
110
  * @example
204
111
  * ```tsx
205
- * // Basic usage
206
112
  * <AuthSubmitButton isLoading={loading}>
207
113
  * Sign In
208
114
  * </AuthSubmitButton>
209
- *
210
- * // With custom styling
211
- * <AuthSubmitButton className="bg-purple-600 hover:bg-purple-700">
212
- * Sign In
213
- * </AuthSubmitButton>
214
115
  * ```
215
116
  *
216
117
  * @param {ReactNode} children - Button text
217
118
  * @param {boolean} [isLoading] - Loading state (shows spinner)
218
119
  * @param {boolean} [confirmed] - Confirmed state (shows checkmark)
219
120
  * @param {boolean} [disabled] - Disabled state
220
- * @param {string} [className] - Button element classes
221
121
  */
222
- declare function AuthSubmitButton({ children, isLoading, confirmed, disabled, className, }: AuthSubmitButtonProps): react_jsx_runtime.JSX.Element;
122
+ declare function AuthSubmitButton({ children, isLoading, confirmed, disabled, }: {
123
+ children: ReactNode;
124
+ isLoading?: boolean;
125
+ confirmed?: boolean;
126
+ disabled?: boolean;
127
+ }): react_jsx_runtime.JSX.Element;
223
128
 
224
129
  /**
225
130
  * Call-to-action link component for navigation between auth pages.
@@ -232,63 +137,44 @@ declare function AuthSubmitButton({ children, isLoading, confirmed, disabled, cl
232
137
  * linkText="Sign up"
233
138
  * href="/sign-up"
234
139
  * />
235
- *
236
- * // With custom styling
237
- * <AuthLink
238
- * text="Don't have an account?"
239
- * linkText="Sign up"
240
- * href="/sign-up"
241
- * appearance={{
242
- * linkClassName: "text-blue-500"
243
- * }}
244
- * />
245
140
  * ```
246
141
  *
247
142
  * @param {string} text - Regular text before the link
248
143
  * @param {string} linkText - Clickable link text
249
144
  * @param {string} href - Link URL
250
- * @param {object} [appearance] - Tailwind CSS classes for styling
251
- * - `appearance.containerClassName`: Container element
252
- * - `appearance.linkClassName`: Link element
253
145
  */
254
- declare function AuthLink({ text, linkText, href, appearance }: AuthLinkProps): react_jsx_runtime.JSX.Element;
146
+ declare function AuthLink({ text, linkText, href, }: {
147
+ text?: string;
148
+ linkText: string;
149
+ href: string;
150
+ }): react_jsx_runtime.JSX.Element;
255
151
 
256
152
  /**
257
153
  * Visual divider with optional centered text for auth forms.
258
- *
259
- * @component
260
- * @example
261
- * ```tsx
262
- * <AuthDivider text="or" />
263
- * ```
264
- *
265
- * @param {string} [text='or'] - Centered text
266
- * @param {string} [className] - Divider element classes
267
154
  */
268
- declare function AuthDivider({ text, className }: AuthDividerProps): react_jsx_runtime.JSX.Element;
155
+ declare function AuthDivider({ text }: {
156
+ text?: string;
157
+ }): react_jsx_runtime.JSX.Element;
269
158
 
159
+ interface AuthOAuthButtonProps {
160
+ provider: OAuthProvidersSchema;
161
+ onClick: (provider: OAuthProvidersSchema) => void;
162
+ disabled?: boolean;
163
+ loading?: boolean;
164
+ displayMode?: 'full' | 'short' | 'icon';
165
+ style?: CSSProperties;
166
+ }
270
167
  /**
271
168
  * OAuth provider button with adaptive display modes.
272
- *
273
- * @component
274
- * @example
275
- * ```tsx
276
- * <AuthOAuthButton
277
- * provider="google"
278
- * onClick={handleOAuth}
279
- * displayMode="full"
280
- * />
281
- * ```
282
- *
283
- * @param {OAuthProvider} provider - Provider identifier (e.g., 'google', 'github')
284
- * @param {function} onClick - Click handler
285
- * @param {boolean} [disabled] - Disabled state
286
- * @param {boolean} [loading] - Loading state (shows spinner)
287
- * @param {string} [displayMode='full'] - Display mode ('full' | 'short' | 'icon')
288
- * @param {string} [className] - Button element classes
289
169
  */
290
- declare function AuthOAuthButton({ provider, onClick, disabled, loading, displayMode, style, className }: AuthOAuthButtonProps): react_jsx_runtime.JSX.Element | null;
170
+ declare function AuthOAuthButton({ provider, onClick, disabled, loading, displayMode, style, }: AuthOAuthButtonProps): react_jsx_runtime.JSX.Element | null;
291
171
 
172
+ interface AuthOAuthProvidersProps {
173
+ providers: OAuthProvidersSchema[];
174
+ onClick: (provider: OAuthProvidersSchema) => void;
175
+ disabled?: boolean;
176
+ loading?: OAuthProvidersSchema | null;
177
+ }
292
178
  /**
293
179
  * Smart OAuth provider grid with adaptive layout.
294
180
  *
@@ -296,72 +182,21 @@ declare function AuthOAuthButton({ provider, onClick, disabled, loading, display
296
182
  * - 1 provider: Full-width
297
183
  * - 2 or 4 providers: Two columns
298
184
  * - 3+ providers: Three columns
299
- *
300
- * @component
301
- * @example
302
- * ```tsx
303
- * <AuthOAuthProviders
304
- * providers={['google', 'github', 'discord']}
305
- * onClick={handleOAuth}
306
- * loading={currentProvider}
307
- * />
308
- *
309
- * // With custom styling
310
- * <AuthOAuthProviders
311
- * providers={['google', 'github']}
312
- * onClick={handleOAuth}
313
- * loading={currentProvider}
314
- * appearance={{
315
- * buttonClassName: "hover:bg-blue-50"
316
- * }}
317
- * />
318
- * ```
319
- *
320
- * @param {OAuthProvider[]} providers - Provider identifiers array
321
- * @param {function} onClick - Provider click handler
322
- * @param {boolean} [disabled] - Disabled state for all buttons
323
- * @param {OAuthProvider | null} loading - Currently loading provider
324
- * @param {object} [appearance] - Tailwind CSS classes for styling
325
- * - `appearance.containerClassName`: Grid container element
326
- * - `appearance.buttonClassName`: OAuth button elements
327
185
  */
328
- declare function AuthOAuthProviders({ providers, onClick, disabled, loading, appearance, }: AuthOAuthProvidersProps): react_jsx_runtime.JSX.Element | null;
186
+ declare function AuthOAuthProviders({ providers, onClick, disabled, loading, }: AuthOAuthProvidersProps): react_jsx_runtime.JSX.Element | null;
329
187
 
188
+ interface AuthVerificationCodeInputProps {
189
+ length?: number;
190
+ value: string;
191
+ email: string;
192
+ onChange: (value: string) => void;
193
+ disabled?: boolean;
194
+ onComplete?: (code: string) => void;
195
+ }
330
196
  /**
331
197
  * 6-digit verification code input component with auto-focus and paste support.
332
- *
333
- * @component
334
- * @example
335
- * ```tsx
336
- * const [code, setCode] = useState('');
337
- *
338
- * <AuthVerificationCodeInput
339
- * email="user@example.com"
340
- * value={code}
341
- * onChange={setCode}
342
- * />
343
- *
344
- * // With custom styling
345
- * <AuthVerificationCodeInput
346
- * email="user@example.com"
347
- * value={code}
348
- * onChange={setCode}
349
- * appearance={{
350
- * inputClassName: "border-blue-500"
351
- * }}
352
- * />
353
- * ```
354
- *
355
- * @param {string} email - Email address to display in instructions
356
- * @param {string} value - Current code value
357
- * @param {function} onChange - Code change handler
358
- * @param {number} [length=6] - Number of digits
359
- * @param {boolean} [disabled] - Disabled state
360
- * @param {object} [appearance] - Tailwind CSS classes for styling
361
- * - `appearance.containerClassName`: Container element
362
- * - `appearance.inputClassName`: Input elements
363
198
  */
364
- declare function AuthVerificationCodeInput({ length, value, email, onChange, disabled, onComplete, appearance, }: AuthVerificationCodeInputProps): react_jsx_runtime.JSX.Element;
199
+ declare function AuthVerificationCodeInput({ length, value, email, onChange, disabled, onComplete, }: AuthVerificationCodeInputProps): react_jsx_runtime.JSX.Element;
365
200
 
366
201
  type VerificationMethod = 'code' | 'link';
367
202
  interface AuthEmailVerificationStepProps {
@@ -384,4 +219,4 @@ interface AuthEmailVerificationStepProps {
384
219
  */
385
220
  declare function AuthEmailVerificationStep({ email, description, method, onVerifyCode, }: AuthEmailVerificationStepProps): react_jsx_runtime.JSX.Element;
386
221
 
387
- export { AuthBranding, AuthContainer, AuthDivider, AuthEmailVerificationStep, AuthErrorBanner, AuthFormField, AuthHeader, AuthLink, AuthOAuthButton, AuthOAuthProviders, AuthPasswordField, AuthPasswordStrengthIndicator, AuthSubmitButton, AuthVerificationCodeInput, validatePasswordStrength };
222
+ export { AuthBranding, AuthContainer, AuthDivider, AuthEmailVerificationStep, AuthErrorBanner, AuthFormField, AuthHeader, AuthLink, AuthOAuthButton, AuthOAuthProviders, AuthPasswordField, AuthPasswordStrengthIndicator, AuthSubmitButton, AuthVerificationCodeInput };