@aaspai/react 0.0.0 → 0.0.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.
Files changed (55) hide show
  1. package/README.md +720 -8
  2. package/dist/atoms.cjs +3565 -0
  3. package/dist/atoms.cjs.map +1 -0
  4. package/dist/atoms.d.cts +255 -0
  5. package/dist/atoms.d.ts +255 -0
  6. package/dist/atoms.js +3530 -0
  7. package/dist/atoms.js.map +1 -0
  8. package/dist/components.cjs +5397 -0
  9. package/dist/components.cjs.map +1 -0
  10. package/dist/components.d.cts +362 -0
  11. package/dist/components.d.ts +362 -0
  12. package/dist/components.js +5344 -0
  13. package/dist/components.js.map +1 -0
  14. package/dist/forms.cjs +3928 -0
  15. package/dist/forms.cjs.map +1 -0
  16. package/dist/forms.d.cts +135 -0
  17. package/dist/forms.d.ts +135 -0
  18. package/dist/forms.js +3903 -0
  19. package/dist/forms.js.map +1 -0
  20. package/dist/hooks.cjs +74 -0
  21. package/dist/hooks.cjs.map +1 -0
  22. package/dist/hooks.d.cts +138 -0
  23. package/dist/hooks.d.ts +138 -0
  24. package/dist/hooks.js +70 -0
  25. package/dist/hooks.js.map +1 -0
  26. package/dist/index.cjs +6030 -0
  27. package/dist/index.cjs.map +1 -0
  28. package/dist/index.d.cts +248 -0
  29. package/dist/index.d.ts +248 -0
  30. package/dist/index.js +5952 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/lib.cjs +139 -0
  33. package/dist/lib.cjs.map +1 -0
  34. package/dist/lib.d.cts +111 -0
  35. package/dist/lib.d.ts +111 -0
  36. package/dist/lib.js +128 -0
  37. package/dist/lib.js.map +1 -0
  38. package/dist/navigation.cjs +56 -0
  39. package/dist/navigation.cjs.map +1 -0
  40. package/dist/navigation.d.cts +65 -0
  41. package/dist/navigation.d.ts +65 -0
  42. package/dist/navigation.js +51 -0
  43. package/dist/navigation.js.map +1 -0
  44. package/dist/styles.css +839 -0
  45. package/dist/types.cjs +4 -0
  46. package/dist/types.cjs.map +1 -0
  47. package/dist/types.d.cts +17 -0
  48. package/dist/types.d.ts +17 -0
  49. package/dist/types.js +3 -0
  50. package/dist/types.js.map +1 -0
  51. package/package.json +67 -28
  52. package/index.cjs +0 -10
  53. package/index.d.ts +0 -6
  54. package/index.js +0 -5
  55. package/styles.css +0 -1
@@ -0,0 +1,255 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, InputHTMLAttributes, CSSProperties } from 'react';
3
+ import { AuthConfig, EmailVerificationMethod } from './types.cjs';
4
+ import { OAuthProvidersSchema } from '@aaspai/shared-schemas';
5
+ import '@aaspai/shared';
6
+
7
+ /**
8
+ * Aaspai branding component for authentication pages.
9
+ *
10
+ * @component
11
+ * @example
12
+ * ```tsx
13
+ * <AuthBranding />
14
+ * ```
15
+ */
16
+ declare function AuthBranding(): react_jsx_runtime.JSX.Element;
17
+
18
+ interface AuthContainerProps {
19
+ children: ReactNode;
20
+ }
21
+ /**
22
+ * Main container component for authentication forms.
23
+ *
24
+ * @component
25
+ * @example
26
+ * ```tsx
27
+ * <AuthContainer>
28
+ * <AuthHeader title="Sign In" />
29
+ * <form>...</form>
30
+ * </AuthContainer>
31
+ * ```
32
+ *
33
+ * @param {ReactNode} children - Form content
34
+ */
35
+ declare function AuthContainer({ children }: AuthContainerProps): react_jsx_runtime.JSX.Element;
36
+
37
+ interface AuthHeaderProps {
38
+ title: string;
39
+ subtitle?: string;
40
+ }
41
+ /**
42
+ * Header component for authentication forms displaying title and optional subtitle.
43
+ *
44
+ * @component
45
+ * @example
46
+ * ```tsx
47
+ * <AuthHeader
48
+ * title="Welcome Back"
49
+ * subtitle="Sign in to continue"
50
+ * />
51
+ * ```
52
+ *
53
+ * @param {string} title - Main heading text
54
+ * @param {string} [subtitle] - Optional subheading text
55
+ */
56
+ declare function AuthHeader({ title, subtitle }: AuthHeaderProps): react_jsx_runtime.JSX.Element;
57
+
58
+ interface AuthErrorBannerProps {
59
+ error: string;
60
+ }
61
+ /**
62
+ * Error message banner for authentication forms.
63
+ */
64
+ declare function AuthErrorBanner({ error }: {
65
+ error?: string;
66
+ }): react_jsx_runtime.JSX.Element | null;
67
+
68
+ interface AuthFormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
69
+ label: string;
70
+ id: string;
71
+ }
72
+ /**
73
+ * Standard form input field with label for authentication forms.
74
+ *
75
+ * @component
76
+ * @example
77
+ * ```tsx
78
+ * <AuthFormField
79
+ * id="email"
80
+ * type="email"
81
+ * label="Email Address"
82
+ * />
83
+ * ```
84
+ *
85
+ * @param {string} label - Label text
86
+ * @param {string} id - Input element ID
87
+ */
88
+ declare function AuthFormField({ label, id, ...props }: AuthFormFieldProps): react_jsx_runtime.JSX.Element;
89
+
90
+ interface AuthPasswordFieldProps extends InputHTMLAttributes<HTMLInputElement> {
91
+ label?: string;
92
+ id: string;
93
+ showStrengthIndicator?: boolean;
94
+ authConfig: AuthConfig;
95
+ forgotPasswordLink?: {
96
+ href: string;
97
+ text?: string;
98
+ };
99
+ }
100
+ /**
101
+ * Password input field with visibility toggle and optional strength indicator.
102
+ */
103
+ declare function AuthPasswordField({ label, id, showStrengthIndicator, authConfig, forgotPasswordLink, value, onFocus, ...props }: AuthPasswordFieldProps): react_jsx_runtime.JSX.Element;
104
+
105
+ interface AuthPasswordStrengthIndicatorProps {
106
+ password: string;
107
+ config: AuthConfig;
108
+ }
109
+ /**
110
+ * Password strength indicator showing requirement checklist.
111
+ */
112
+ declare function AuthPasswordStrengthIndicator({ password, config, }: AuthPasswordStrengthIndicatorProps): react_jsx_runtime.JSX.Element;
113
+
114
+ interface AuthSubmitButtonProps {
115
+ children: ReactNode;
116
+ isLoading?: boolean;
117
+ confirmed?: boolean;
118
+ disabled?: boolean;
119
+ type?: 'button' | 'submit';
120
+ onClick?: () => void;
121
+ }
122
+ /**
123
+ * Primary button for authentication forms with loading and confirmed states.
124
+ *
125
+ * Supports two modes:
126
+ * - **Form submit** (default): type="submit" - triggers form's onSubmit handler
127
+ * - **Action button**: type="button" + onClick - executes custom logic without form submission
128
+ *
129
+ * @component
130
+ * @example
131
+ * ```tsx
132
+ * // Form submit button (default)
133
+ * <AuthSubmitButton isLoading={loading}>
134
+ * Sign In
135
+ * </AuthSubmitButton>
136
+ *
137
+ * // Action button with click handler
138
+ * <AuthSubmitButton type="button" onClick={handleClick} isLoading={loading}>
139
+ * Verify Code
140
+ * </AuthSubmitButton>
141
+ * ```
142
+ */
143
+ declare function AuthSubmitButton({ children, isLoading, confirmed, disabled, type, onClick, }: AuthSubmitButtonProps): react_jsx_runtime.JSX.Element;
144
+
145
+ interface AuthLinkProps {
146
+ text: string;
147
+ linkText: string;
148
+ href: string;
149
+ }
150
+ /**
151
+ * Call-to-action link component for navigation between auth pages.
152
+ *
153
+ * @component
154
+ * @example
155
+ * ```tsx
156
+ * <AuthLink
157
+ * text="Don't have an account?"
158
+ * linkText="Sign up"
159
+ * href="/sign-up"
160
+ * />
161
+ * ```
162
+ *
163
+ * @param {string} text - Regular text before the link
164
+ * @param {string} linkText - Clickable link text
165
+ * @param {string} href - Link URL
166
+ */
167
+ declare function AuthLink({ text, linkText, href }: AuthLinkProps): react_jsx_runtime.JSX.Element;
168
+
169
+ interface AuthDividerProps {
170
+ text?: string;
171
+ }
172
+ /**
173
+ * Visual divider with optional centered text for auth forms.
174
+ */
175
+ declare function AuthDivider({ text }: AuthDividerProps): react_jsx_runtime.JSX.Element;
176
+
177
+ interface AuthOAuthButtonProps {
178
+ provider: OAuthProvidersSchema;
179
+ onClick: (provider: OAuthProvidersSchema) => void;
180
+ disabled?: boolean;
181
+ loading?: boolean;
182
+ displayMode?: 'full' | 'short' | 'icon';
183
+ style?: CSSProperties;
184
+ }
185
+ /**
186
+ * OAuth provider button with adaptive display modes.
187
+ */
188
+ declare function AuthOAuthButton({ provider, onClick, disabled, loading, displayMode, style, }: AuthOAuthButtonProps): react_jsx_runtime.JSX.Element | null;
189
+
190
+ interface AuthOAuthProvidersProps {
191
+ providers: OAuthProvidersSchema[];
192
+ onClick: (provider: OAuthProvidersSchema) => void;
193
+ disabled?: boolean;
194
+ loading?: OAuthProvidersSchema | null;
195
+ }
196
+ /**
197
+ * Smart OAuth provider grid with adaptive layout.
198
+ *
199
+ * Automatically adjusts layout based on provider count:
200
+ * - 1 provider: Full-width
201
+ * - 2 or 4 providers: Two columns
202
+ * - 3+ providers: Three columns
203
+ */
204
+ declare function AuthOAuthProviders({ providers, onClick, disabled, loading, }: AuthOAuthProvidersProps): react_jsx_runtime.JSX.Element | null;
205
+
206
+ interface AuthVerificationCodeInputProps {
207
+ length?: number;
208
+ value: string;
209
+ onChange: (value: string) => void;
210
+ disabled?: boolean;
211
+ onComplete?: (code: string) => void;
212
+ }
213
+ /**
214
+ * 6-digit verification code input component with auto-focus and paste support.
215
+ */
216
+ declare function AuthVerificationCodeInput({ length, value, onChange, disabled, onComplete, }: AuthVerificationCodeInputProps): react_jsx_runtime.JSX.Element;
217
+
218
+ interface AuthEmailVerificationStepProps {
219
+ email: string;
220
+ method: EmailVerificationMethod;
221
+ onVerifyCode?: (code: string) => Promise<void>;
222
+ emailSent?: boolean;
223
+ }
224
+ /**
225
+ * Email verification step component (pure UI, no container)
226
+ *
227
+ * Designed to be embedded within a form container.
228
+ * Handles the email verification flow:
229
+ * - Automatically sends verification email on mount
230
+ * - Shows countdown timer for resend functionality
231
+ * - Manages rate limiting for resend attempts
232
+ * - Supports both code and link verification methods
233
+ *
234
+ * @param method - 'code' for OTP input, 'link' for magic link (default: 'code')
235
+ */
236
+ declare function AuthEmailVerificationStep({ email, method, onVerifyCode, emailSent, }: AuthEmailVerificationStepProps): react_jsx_runtime.JSX.Element;
237
+
238
+ interface AuthResetPasswordVerificationStepProps {
239
+ email: string;
240
+ method: EmailVerificationMethod;
241
+ onVerifyCode?: (code: string) => Promise<void>;
242
+ onResendEmail: () => Promise<void>;
243
+ }
244
+ /**
245
+ * Reset password verification step component
246
+ *
247
+ * Handles the verification flow for password reset:
248
+ * - Shows appropriate UI based on method (code input or link message)
249
+ * - Manages countdown timer for resend functionality
250
+ * - Handles code verification for code method
251
+ */
252
+ declare function AuthResetPasswordVerificationStep({ email, method, onVerifyCode, onResendEmail, }: AuthResetPasswordVerificationStepProps): react_jsx_runtime.JSX.Element;
253
+
254
+ export { AuthBranding, AuthContainer, type AuthContainerProps, AuthDivider, type AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, type AuthErrorBannerProps, AuthFormField, type AuthFormFieldProps, AuthHeader, type AuthHeaderProps, AuthLink, type AuthLinkProps, AuthOAuthButton, type AuthOAuthButtonProps, AuthOAuthProviders, type AuthOAuthProvidersProps, AuthPasswordField, type AuthPasswordFieldProps, AuthPasswordStrengthIndicator, type AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, type AuthSubmitButtonProps, AuthVerificationCodeInput, type AuthVerificationCodeInputProps };
255
+
@@ -0,0 +1,255 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode, InputHTMLAttributes, CSSProperties } from 'react';
3
+ import { AuthConfig, EmailVerificationMethod } from './types.js';
4
+ import { OAuthProvidersSchema } from '@aaspai/shared-schemas';
5
+ import '@aaspai/shared';
6
+
7
+ /**
8
+ * Aaspai branding component for authentication pages.
9
+ *
10
+ * @component
11
+ * @example
12
+ * ```tsx
13
+ * <AuthBranding />
14
+ * ```
15
+ */
16
+ declare function AuthBranding(): react_jsx_runtime.JSX.Element;
17
+
18
+ interface AuthContainerProps {
19
+ children: ReactNode;
20
+ }
21
+ /**
22
+ * Main container component for authentication forms.
23
+ *
24
+ * @component
25
+ * @example
26
+ * ```tsx
27
+ * <AuthContainer>
28
+ * <AuthHeader title="Sign In" />
29
+ * <form>...</form>
30
+ * </AuthContainer>
31
+ * ```
32
+ *
33
+ * @param {ReactNode} children - Form content
34
+ */
35
+ declare function AuthContainer({ children }: AuthContainerProps): react_jsx_runtime.JSX.Element;
36
+
37
+ interface AuthHeaderProps {
38
+ title: string;
39
+ subtitle?: string;
40
+ }
41
+ /**
42
+ * Header component for authentication forms displaying title and optional subtitle.
43
+ *
44
+ * @component
45
+ * @example
46
+ * ```tsx
47
+ * <AuthHeader
48
+ * title="Welcome Back"
49
+ * subtitle="Sign in to continue"
50
+ * />
51
+ * ```
52
+ *
53
+ * @param {string} title - Main heading text
54
+ * @param {string} [subtitle] - Optional subheading text
55
+ */
56
+ declare function AuthHeader({ title, subtitle }: AuthHeaderProps): react_jsx_runtime.JSX.Element;
57
+
58
+ interface AuthErrorBannerProps {
59
+ error: string;
60
+ }
61
+ /**
62
+ * Error message banner for authentication forms.
63
+ */
64
+ declare function AuthErrorBanner({ error }: {
65
+ error?: string;
66
+ }): react_jsx_runtime.JSX.Element | null;
67
+
68
+ interface AuthFormFieldProps extends InputHTMLAttributes<HTMLInputElement> {
69
+ label: string;
70
+ id: string;
71
+ }
72
+ /**
73
+ * Standard form input field with label for authentication forms.
74
+ *
75
+ * @component
76
+ * @example
77
+ * ```tsx
78
+ * <AuthFormField
79
+ * id="email"
80
+ * type="email"
81
+ * label="Email Address"
82
+ * />
83
+ * ```
84
+ *
85
+ * @param {string} label - Label text
86
+ * @param {string} id - Input element ID
87
+ */
88
+ declare function AuthFormField({ label, id, ...props }: AuthFormFieldProps): react_jsx_runtime.JSX.Element;
89
+
90
+ interface AuthPasswordFieldProps extends InputHTMLAttributes<HTMLInputElement> {
91
+ label?: string;
92
+ id: string;
93
+ showStrengthIndicator?: boolean;
94
+ authConfig: AuthConfig;
95
+ forgotPasswordLink?: {
96
+ href: string;
97
+ text?: string;
98
+ };
99
+ }
100
+ /**
101
+ * Password input field with visibility toggle and optional strength indicator.
102
+ */
103
+ declare function AuthPasswordField({ label, id, showStrengthIndicator, authConfig, forgotPasswordLink, value, onFocus, ...props }: AuthPasswordFieldProps): react_jsx_runtime.JSX.Element;
104
+
105
+ interface AuthPasswordStrengthIndicatorProps {
106
+ password: string;
107
+ config: AuthConfig;
108
+ }
109
+ /**
110
+ * Password strength indicator showing requirement checklist.
111
+ */
112
+ declare function AuthPasswordStrengthIndicator({ password, config, }: AuthPasswordStrengthIndicatorProps): react_jsx_runtime.JSX.Element;
113
+
114
+ interface AuthSubmitButtonProps {
115
+ children: ReactNode;
116
+ isLoading?: boolean;
117
+ confirmed?: boolean;
118
+ disabled?: boolean;
119
+ type?: 'button' | 'submit';
120
+ onClick?: () => void;
121
+ }
122
+ /**
123
+ * Primary button for authentication forms with loading and confirmed states.
124
+ *
125
+ * Supports two modes:
126
+ * - **Form submit** (default): type="submit" - triggers form's onSubmit handler
127
+ * - **Action button**: type="button" + onClick - executes custom logic without form submission
128
+ *
129
+ * @component
130
+ * @example
131
+ * ```tsx
132
+ * // Form submit button (default)
133
+ * <AuthSubmitButton isLoading={loading}>
134
+ * Sign In
135
+ * </AuthSubmitButton>
136
+ *
137
+ * // Action button with click handler
138
+ * <AuthSubmitButton type="button" onClick={handleClick} isLoading={loading}>
139
+ * Verify Code
140
+ * </AuthSubmitButton>
141
+ * ```
142
+ */
143
+ declare function AuthSubmitButton({ children, isLoading, confirmed, disabled, type, onClick, }: AuthSubmitButtonProps): react_jsx_runtime.JSX.Element;
144
+
145
+ interface AuthLinkProps {
146
+ text: string;
147
+ linkText: string;
148
+ href: string;
149
+ }
150
+ /**
151
+ * Call-to-action link component for navigation between auth pages.
152
+ *
153
+ * @component
154
+ * @example
155
+ * ```tsx
156
+ * <AuthLink
157
+ * text="Don't have an account?"
158
+ * linkText="Sign up"
159
+ * href="/sign-up"
160
+ * />
161
+ * ```
162
+ *
163
+ * @param {string} text - Regular text before the link
164
+ * @param {string} linkText - Clickable link text
165
+ * @param {string} href - Link URL
166
+ */
167
+ declare function AuthLink({ text, linkText, href }: AuthLinkProps): react_jsx_runtime.JSX.Element;
168
+
169
+ interface AuthDividerProps {
170
+ text?: string;
171
+ }
172
+ /**
173
+ * Visual divider with optional centered text for auth forms.
174
+ */
175
+ declare function AuthDivider({ text }: AuthDividerProps): react_jsx_runtime.JSX.Element;
176
+
177
+ interface AuthOAuthButtonProps {
178
+ provider: OAuthProvidersSchema;
179
+ onClick: (provider: OAuthProvidersSchema) => void;
180
+ disabled?: boolean;
181
+ loading?: boolean;
182
+ displayMode?: 'full' | 'short' | 'icon';
183
+ style?: CSSProperties;
184
+ }
185
+ /**
186
+ * OAuth provider button with adaptive display modes.
187
+ */
188
+ declare function AuthOAuthButton({ provider, onClick, disabled, loading, displayMode, style, }: AuthOAuthButtonProps): react_jsx_runtime.JSX.Element | null;
189
+
190
+ interface AuthOAuthProvidersProps {
191
+ providers: OAuthProvidersSchema[];
192
+ onClick: (provider: OAuthProvidersSchema) => void;
193
+ disabled?: boolean;
194
+ loading?: OAuthProvidersSchema | null;
195
+ }
196
+ /**
197
+ * Smart OAuth provider grid with adaptive layout.
198
+ *
199
+ * Automatically adjusts layout based on provider count:
200
+ * - 1 provider: Full-width
201
+ * - 2 or 4 providers: Two columns
202
+ * - 3+ providers: Three columns
203
+ */
204
+ declare function AuthOAuthProviders({ providers, onClick, disabled, loading, }: AuthOAuthProvidersProps): react_jsx_runtime.JSX.Element | null;
205
+
206
+ interface AuthVerificationCodeInputProps {
207
+ length?: number;
208
+ value: string;
209
+ onChange: (value: string) => void;
210
+ disabled?: boolean;
211
+ onComplete?: (code: string) => void;
212
+ }
213
+ /**
214
+ * 6-digit verification code input component with auto-focus and paste support.
215
+ */
216
+ declare function AuthVerificationCodeInput({ length, value, onChange, disabled, onComplete, }: AuthVerificationCodeInputProps): react_jsx_runtime.JSX.Element;
217
+
218
+ interface AuthEmailVerificationStepProps {
219
+ email: string;
220
+ method: EmailVerificationMethod;
221
+ onVerifyCode?: (code: string) => Promise<void>;
222
+ emailSent?: boolean;
223
+ }
224
+ /**
225
+ * Email verification step component (pure UI, no container)
226
+ *
227
+ * Designed to be embedded within a form container.
228
+ * Handles the email verification flow:
229
+ * - Automatically sends verification email on mount
230
+ * - Shows countdown timer for resend functionality
231
+ * - Manages rate limiting for resend attempts
232
+ * - Supports both code and link verification methods
233
+ *
234
+ * @param method - 'code' for OTP input, 'link' for magic link (default: 'code')
235
+ */
236
+ declare function AuthEmailVerificationStep({ email, method, onVerifyCode, emailSent, }: AuthEmailVerificationStepProps): react_jsx_runtime.JSX.Element;
237
+
238
+ interface AuthResetPasswordVerificationStepProps {
239
+ email: string;
240
+ method: EmailVerificationMethod;
241
+ onVerifyCode?: (code: string) => Promise<void>;
242
+ onResendEmail: () => Promise<void>;
243
+ }
244
+ /**
245
+ * Reset password verification step component
246
+ *
247
+ * Handles the verification flow for password reset:
248
+ * - Shows appropriate UI based on method (code input or link message)
249
+ * - Manages countdown timer for resend functionality
250
+ * - Handles code verification for code method
251
+ */
252
+ declare function AuthResetPasswordVerificationStep({ email, method, onVerifyCode, onResendEmail, }: AuthResetPasswordVerificationStepProps): react_jsx_runtime.JSX.Element;
253
+
254
+ export { AuthBranding, AuthContainer, type AuthContainerProps, AuthDivider, type AuthDividerProps, AuthEmailVerificationStep, AuthErrorBanner, type AuthErrorBannerProps, AuthFormField, type AuthFormFieldProps, AuthHeader, type AuthHeaderProps, AuthLink, type AuthLinkProps, AuthOAuthButton, type AuthOAuthButtonProps, AuthOAuthProviders, type AuthOAuthProvidersProps, AuthPasswordField, type AuthPasswordFieldProps, AuthPasswordStrengthIndicator, type AuthPasswordStrengthIndicatorProps, AuthResetPasswordVerificationStep, AuthSubmitButton, type AuthSubmitButtonProps, AuthVerificationCodeInput, type AuthVerificationCodeInputProps };
255
+