@main12/auth-login 0.4.2 → 1.0.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.
Files changed (66) hide show
  1. package/README.md +54 -7
  2. package/dist/components/AuthCard.d.ts +41 -0
  3. package/dist/components/AuthCard.js +28 -0
  4. package/dist/components/AuthCardServer.d.ts +29 -0
  5. package/dist/components/AuthCardServer.js +57 -0
  6. package/dist/components/AuthLayout.d.ts +23 -13
  7. package/dist/components/AuthLayout.js +26 -87
  8. package/dist/components/AuthPages.d.ts +4 -29
  9. package/dist/components/AuthPages.js +23 -105
  10. package/dist/components/AuthPagesServer.d.ts +3 -4
  11. package/dist/components/AuthPagesServer.js +15 -8
  12. package/dist/components/auth-card/AuthCardShell.d.ts +21 -0
  13. package/dist/components/auth-card/AuthCardShell.js +104 -0
  14. package/dist/components/auth-card/FormRenderer.d.ts +32 -0
  15. package/dist/components/auth-card/FormRenderer.js +88 -0
  16. package/dist/components/auth-card/formConfigs.d.ts +25 -0
  17. package/dist/components/auth-card/formConfigs.js +56 -0
  18. package/dist/components/auth-card/index.d.ts +3 -0
  19. package/dist/components/auth-card/index.js +3 -0
  20. package/dist/components/forms/ForgotPasswordForm.d.ts +7 -0
  21. package/dist/components/forms/ForgotPasswordForm.js +56 -0
  22. package/dist/components/forms/LoginForm.d.ts +15 -0
  23. package/dist/components/forms/LoginForm.js +247 -0
  24. package/dist/components/forms/SetPasswordForm.d.ts +7 -0
  25. package/dist/components/forms/SetPasswordForm.js +75 -0
  26. package/dist/components/forms/SignupForm.d.ts +13 -0
  27. package/dist/components/forms/SignupForm.js +152 -0
  28. package/dist/components/forms/VerifyOtpForm.d.ts +9 -0
  29. package/dist/components/forms/VerifyOtpForm.js +107 -0
  30. package/dist/components/forms/index.d.ts +19 -0
  31. package/dist/components/forms/index.js +21 -0
  32. package/dist/components/pages/ForgotPasswordPage.d.ts +2 -1
  33. package/dist/components/pages/ForgotPasswordPageHero.d.ts +3 -2
  34. package/dist/components/pages/ForgotPasswordPageHero.js +70 -64
  35. package/dist/components/pages/ForgotPasswordPageTailwind.d.ts +3 -2
  36. package/dist/components/pages/ForgotPasswordPageTailwind.js +42 -36
  37. package/dist/components/pages/LoginPage.d.ts +2 -1
  38. package/dist/components/pages/LoginPageHero.d.ts +2 -1
  39. package/dist/components/pages/LoginPageHero.js +297 -291
  40. package/dist/components/pages/LoginPageTailwind.d.ts +2 -1
  41. package/dist/components/pages/LoginPageTailwind.js +197 -191
  42. package/dist/components/pages/SetPasswordPage.d.ts +2 -1
  43. package/dist/components/pages/SetPasswordPageHero.d.ts +3 -2
  44. package/dist/components/pages/SetPasswordPageHero.js +98 -92
  45. package/dist/components/pages/SetPasswordPageTailwind.d.ts +3 -2
  46. package/dist/components/pages/SetPasswordPageTailwind.js +63 -57
  47. package/dist/components/pages/SignupPage.d.ts +2 -1
  48. package/dist/components/pages/SignupPageHero.d.ts +3 -2
  49. package/dist/components/pages/SignupPageHero.js +139 -133
  50. package/dist/components/pages/SignupPageTailwind.d.ts +3 -2
  51. package/dist/components/pages/SignupPageTailwind.js +123 -117
  52. package/dist/components/pages/VerifyOtpPage.d.ts +2 -1
  53. package/dist/components/pages/VerifyOtpPageHero.d.ts +2 -1
  54. package/dist/components/pages/VerifyOtpPageHero.js +110 -104
  55. package/dist/components/pages/VerifyOtpPageTailwind.d.ts +2 -1
  56. package/dist/components/pages/VerifyOtpPageTailwind.js +60 -54
  57. package/dist/components/ui/translations.d.ts +9 -0
  58. package/dist/components/ui/translations.js +18 -0
  59. package/dist/config.d.ts +12 -0
  60. package/dist/config.js +11 -0
  61. package/dist/exports/client.d.ts +5 -0
  62. package/dist/exports/client.js +5 -0
  63. package/dist/exports/rsc.d.ts +7 -0
  64. package/dist/exports/rsc.js +8 -0
  65. package/dist/index.js +12 -2
  66. package/package.json +3 -2
@@ -6,8 +6,9 @@ import { Icon } from '@iconify/react';
6
6
  import { motion } from 'framer-motion';
7
7
  import { useSetPasswordFlow } from '../../auth/application/hooks/useSetPasswordFlow.js';
8
8
  import { AuthLayout } from '../AuthLayout.js';
9
+ import { AuthCard } from '../AuthCard.js';
9
10
  import { getUiTranslations } from '../ui/translations.js';
10
- export default function SetPasswordPageHero({ redirectTo = '/', logo, poweredBy, cardClassName, backgroundClass, locale, messages }) {
11
+ export default function SetPasswordPageHero({ redirectTo = '/', logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages }) {
11
12
  const { password, confirmPassword, error, isLoading, showPassword, strength, setPassword, setConfirmPassword, setShowPassword, handleSubmit } = useSetPasswordFlow({
12
13
  redirectTo
13
14
  });
@@ -16,99 +17,104 @@ export default function SetPasswordPageHero({ redirectTo = '/', logo, poweredBy,
16
17
  }, (_, i)=>i < strength.score);
17
18
  const t = getUiTranslations(locale, messages).setPassword;
18
19
  return /*#__PURE__*/ _jsx(AuthLayout, {
19
- logo: logo,
20
- title: t.title,
21
- subtitle: t.subtitle,
22
- poweredBy: poweredBy,
23
- cardClassName: cardClassName,
24
20
  backgroundClass: backgroundClass,
25
- children: /*#__PURE__*/ _jsxs("form", {
26
- onSubmit: handleSubmit,
27
- className: "space-y-4",
28
- children: [
29
- error && /*#__PURE__*/ _jsx(motion.div, {
30
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
31
- initial: {
32
- opacity: 0
33
- },
34
- animate: {
35
- opacity: 1
36
- },
37
- children: error
38
- }),
39
- /*#__PURE__*/ _jsxs(TextField, {
40
- type: showPassword ? 'text' : 'password',
41
- value: password,
42
- onChange: setPassword,
43
- isRequired: true,
44
- autoFocus: true,
45
- fullWidth: true,
46
- children: [
47
- /*#__PURE__*/ _jsx(Label, {
48
- className: "text-gray-600",
49
- children: t.newPasswordLabel
50
- }),
51
- /*#__PURE__*/ _jsxs("div", {
52
- className: "relative",
53
- children: [
54
- /*#__PURE__*/ _jsx(Input, {
55
- variant: "secondary",
56
- className: "w-full pr-10"
57
- }),
58
- /*#__PURE__*/ _jsx("button", {
59
- type: "button",
60
- className: "absolute right-3 top-1/2 -translate-y-1/2",
61
- onClick: ()=>setShowPassword(!showPassword),
62
- children: /*#__PURE__*/ _jsx(Icon, {
63
- icon: showPassword ? 'lucide:eye-off' : 'lucide:eye',
64
- className: "text-gray-400",
65
- width: 20
21
+ children: /*#__PURE__*/ _jsx(AuthCard, {
22
+ logo: logo,
23
+ title: t.title,
24
+ subtitle: t.subtitle,
25
+ poweredBy: poweredBy,
26
+ cardClassName: cardClassName,
27
+ removeBorder: removeBorder,
28
+ removeShadow: removeShadow,
29
+ mobileVariant: mobileVariant,
30
+ children: /*#__PURE__*/ _jsxs("form", {
31
+ onSubmit: handleSubmit,
32
+ className: "space-y-4",
33
+ children: [
34
+ error && /*#__PURE__*/ _jsx(motion.div, {
35
+ className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
36
+ initial: {
37
+ opacity: 0
38
+ },
39
+ animate: {
40
+ opacity: 1
41
+ },
42
+ children: error
43
+ }),
44
+ /*#__PURE__*/ _jsxs(TextField, {
45
+ type: showPassword ? 'text' : 'password',
46
+ value: password,
47
+ onChange: setPassword,
48
+ isRequired: true,
49
+ autoFocus: true,
50
+ fullWidth: true,
51
+ children: [
52
+ /*#__PURE__*/ _jsx(Label, {
53
+ className: "text-gray-600",
54
+ children: t.newPasswordLabel
55
+ }),
56
+ /*#__PURE__*/ _jsxs("div", {
57
+ className: "relative",
58
+ children: [
59
+ /*#__PURE__*/ _jsx(Input, {
60
+ variant: "secondary",
61
+ className: "w-full pr-10"
62
+ }),
63
+ /*#__PURE__*/ _jsx("button", {
64
+ type: "button",
65
+ className: "absolute right-3 top-1/2 -translate-y-1/2",
66
+ onClick: ()=>setShowPassword(!showPassword),
67
+ children: /*#__PURE__*/ _jsx(Icon, {
68
+ icon: showPassword ? 'lucide:eye-off' : 'lucide:eye',
69
+ className: "text-gray-400",
70
+ width: 20
71
+ })
66
72
  })
67
- })
68
- ]
69
- })
70
- ]
71
- }),
72
- password.length > 0 && /*#__PURE__*/ _jsx("div", {
73
- className: "flex gap-1",
74
- children: bars.map((a, i)=>/*#__PURE__*/ _jsx("div", {
75
- className: `h-1 flex-1 rounded-full ${a ? 'bg-[#D5E855]' : 'bg-gray-200'}`
76
- }, i))
77
- }),
78
- /*#__PURE__*/ _jsxs(TextField, {
79
- type: showPassword ? 'text' : 'password',
80
- value: confirmPassword,
81
- onChange: setConfirmPassword,
82
- isRequired: true,
83
- fullWidth: true,
84
- children: [
85
- /*#__PURE__*/ _jsx(Label, {
86
- className: "text-gray-600",
87
- children: t.confirmPasswordLabel
88
- }),
89
- /*#__PURE__*/ _jsx(Input, {
90
- variant: "secondary",
91
- className: "w-full"
92
- })
93
- ]
94
- }),
95
- /*#__PURE__*/ _jsx(Button, {
96
- type: "submit",
97
- fullWidth: true,
98
- size: "lg",
99
- isPending: isLoading,
100
- className: "h-12 font-semibold",
101
- children: ({ isPending })=>/*#__PURE__*/ _jsxs(_Fragment, {
102
- children: [
103
- isPending && /*#__PURE__*/ _jsx(Spinner, {
104
- color: "current",
105
- size: "sm"
106
- }),
107
- t.setPassword
108
- ]
109
- })
110
- })
111
- ]
73
+ ]
74
+ })
75
+ ]
76
+ }),
77
+ password.length > 0 && /*#__PURE__*/ _jsx("div", {
78
+ className: "flex gap-1",
79
+ children: bars.map((a, i)=>/*#__PURE__*/ _jsx("div", {
80
+ className: `h-1 flex-1 rounded-full ${a ? 'bg-[#D5E855]' : 'bg-gray-200'}`
81
+ }, i))
82
+ }),
83
+ /*#__PURE__*/ _jsxs(TextField, {
84
+ type: showPassword ? 'text' : 'password',
85
+ value: confirmPassword,
86
+ onChange: setConfirmPassword,
87
+ isRequired: true,
88
+ fullWidth: true,
89
+ children: [
90
+ /*#__PURE__*/ _jsx(Label, {
91
+ className: "text-gray-600",
92
+ children: t.confirmPasswordLabel
93
+ }),
94
+ /*#__PURE__*/ _jsx(Input, {
95
+ variant: "secondary",
96
+ className: "w-full"
97
+ })
98
+ ]
99
+ }),
100
+ /*#__PURE__*/ _jsx(Button, {
101
+ type: "submit",
102
+ fullWidth: true,
103
+ size: "lg",
104
+ isPending: isLoading,
105
+ className: "h-12 font-semibold",
106
+ children: ({ isPending })=>/*#__PURE__*/ _jsxs(_Fragment, {
107
+ children: [
108
+ isPending && /*#__PURE__*/ _jsx(Spinner, {
109
+ color: "current",
110
+ size: "sm"
111
+ }),
112
+ t.setPassword
113
+ ]
114
+ })
115
+ })
116
+ ]
117
+ })
112
118
  })
113
119
  });
114
120
  }
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface SetPasswordPageProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface SetPasswordPageProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  redirectTo?: string;
4
5
  }
5
- export default function SetPasswordPage({ redirectTo, logo, poweredBy, cardClassName, backgroundClass, locale, messages, }: SetPasswordPageProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function SetPasswordPage({ redirectTo, logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages, }: SetPasswordPageProps): import("react/jsx-runtime").JSX.Element;
@@ -4,8 +4,9 @@ import React from 'react';
4
4
  import { Button, Input } from '../ui/index.js';
5
5
  import { useSetPasswordFlow } from '../../auth/application/hooks/useSetPasswordFlow.js';
6
6
  import { AuthLayout } from '../AuthLayout.js';
7
+ import { AuthCard } from '../AuthCard.js';
7
8
  import { getUiTranslations } from '../ui/translations.js';
8
- export default function SetPasswordPage({ redirectTo = '/', logo, poweredBy, cardClassName, backgroundClass, locale, messages }) {
9
+ export default function SetPasswordPage({ redirectTo = '/', logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages }) {
9
10
  const { password, confirmPassword, error, isLoading, showPassword, strength, setPassword, setConfirmPassword, setShowPassword, handleSubmit } = useSetPasswordFlow({
10
11
  redirectTo
11
12
  });
@@ -14,63 +15,68 @@ export default function SetPasswordPage({ redirectTo = '/', logo, poweredBy, car
14
15
  }, (_, i)=>i < strength.score);
15
16
  const t = getUiTranslations(locale, messages).setPassword;
16
17
  return /*#__PURE__*/ _jsx(AuthLayout, {
17
- logo: logo,
18
- title: t.title,
19
- subtitle: t.subtitle,
20
- poweredBy: poweredBy,
21
- cardClassName: cardClassName,
22
18
  backgroundClass: backgroundClass,
23
- children: /*#__PURE__*/ _jsxs("form", {
24
- onSubmit: handleSubmit,
25
- className: "space-y-4",
26
- children: [
27
- error && /*#__PURE__*/ _jsx("div", {
28
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
29
- children: error
30
- }),
31
- /*#__PURE__*/ _jsxs("div", {
32
- className: "relative",
33
- children: [
34
- /*#__PURE__*/ _jsx(Input, {
35
- type: showPassword ? 'text' : 'password',
36
- label: t.newPasswordLabel,
37
- value: password,
38
- onValueChange: setPassword,
39
- isRequired: true,
40
- autoFocus: true
41
- }),
42
- /*#__PURE__*/ _jsx("button", {
43
- type: "button",
44
- onClick: ()=>setShowPassword(!showPassword),
45
- className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
46
- children: showPassword ? '🙈' : '👁'
47
- })
48
- ]
49
- }),
50
- password.length > 0 && /*#__PURE__*/ _jsx("div", {
51
- className: "flex gap-1",
52
- children: strengthBars.map((active, i)=>/*#__PURE__*/ _jsx("div", {
53
- className: `h-1 flex-1 rounded-full ${active ? 'bg-[#D5E855]' : 'bg-gray-200'}`
54
- }, i))
55
- }),
56
- password.length > 0 && !strength.isValid && /*#__PURE__*/ _jsx("p", {
57
- className: "text-xs text-gray-500",
58
- children: t.passwordRequirements
59
- }),
60
- /*#__PURE__*/ _jsx(Input, {
61
- type: showPassword ? 'text' : 'password',
62
- label: t.confirmPasswordLabel,
63
- value: confirmPassword,
64
- onValueChange: setConfirmPassword,
65
- isRequired: true
66
- }),
67
- /*#__PURE__*/ _jsx(Button, {
68
- type: "submit",
69
- variant: "primary",
70
- isLoading: isLoading,
71
- children: t.setPassword
72
- })
73
- ]
19
+ children: /*#__PURE__*/ _jsx(AuthCard, {
20
+ logo: logo,
21
+ title: t.title,
22
+ subtitle: t.subtitle,
23
+ poweredBy: poweredBy,
24
+ cardClassName: cardClassName,
25
+ removeBorder: removeBorder,
26
+ removeShadow: removeShadow,
27
+ mobileVariant: mobileVariant,
28
+ children: /*#__PURE__*/ _jsxs("form", {
29
+ onSubmit: handleSubmit,
30
+ className: "space-y-4",
31
+ children: [
32
+ error && /*#__PURE__*/ _jsx("div", {
33
+ className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
34
+ children: error
35
+ }),
36
+ /*#__PURE__*/ _jsxs("div", {
37
+ className: "relative",
38
+ children: [
39
+ /*#__PURE__*/ _jsx(Input, {
40
+ type: showPassword ? 'text' : 'password',
41
+ label: t.newPasswordLabel,
42
+ value: password,
43
+ onValueChange: setPassword,
44
+ isRequired: true,
45
+ autoFocus: true
46
+ }),
47
+ /*#__PURE__*/ _jsx("button", {
48
+ type: "button",
49
+ onClick: ()=>setShowPassword(!showPassword),
50
+ className: "absolute right-4 top-9 text-gray-400 hover:text-gray-600",
51
+ children: showPassword ? '🙈' : '👁'
52
+ })
53
+ ]
54
+ }),
55
+ password.length > 0 && /*#__PURE__*/ _jsx("div", {
56
+ className: "flex gap-1",
57
+ children: strengthBars.map((active, i)=>/*#__PURE__*/ _jsx("div", {
58
+ className: `h-1 flex-1 rounded-full ${active ? 'bg-[#D5E855]' : 'bg-gray-200'}`
59
+ }, i))
60
+ }),
61
+ password.length > 0 && !strength.isValid && /*#__PURE__*/ _jsx("p", {
62
+ className: "text-xs text-gray-500",
63
+ children: t.passwordRequirements
64
+ }),
65
+ /*#__PURE__*/ _jsx(Input, {
66
+ type: showPassword ? 'text' : 'password',
67
+ label: t.confirmPasswordLabel,
68
+ value: confirmPassword,
69
+ onValueChange: setConfirmPassword,
70
+ isRequired: true
71
+ }),
72
+ /*#__PURE__*/ _jsx(Button, {
73
+ type: "submit",
74
+ variant: "primary",
75
+ isLoading: isLoading,
76
+ children: t.setPassword
77
+ })
78
+ ]
79
+ })
74
80
  })
75
81
  });
76
82
  }
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface SignupPageProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface SignupPageProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  onSignup: (data: {
4
5
  name: string;
5
6
  email: string;
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface SignupPageHeroProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface SignupPageHeroProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  onSignup: (data: {
4
5
  name: string;
5
6
  email: string;
@@ -7,4 +8,4 @@ export interface SignupPageHeroProps extends AuthLayoutConfig {
7
8
  showGoogleOAuth?: boolean;
8
9
  loginUrl?: string;
9
10
  }
10
- export default function SignupPageHero({ onSignup, showGoogleOAuth, loginUrl, logo, poweredBy, cardClassName, backgroundClass, locale, messages }: SignupPageHeroProps): import("react/jsx-runtime").JSX.Element;
11
+ export default function SignupPageHero({ onSignup, showGoogleOAuth, loginUrl, logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages }: SignupPageHeroProps): import("react/jsx-runtime").JSX.Element;