@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.
- package/README.md +54 -7
- package/dist/components/AuthCard.d.ts +41 -0
- package/dist/components/AuthCard.js +28 -0
- package/dist/components/AuthCardServer.d.ts +29 -0
- package/dist/components/AuthCardServer.js +57 -0
- package/dist/components/AuthLayout.d.ts +23 -13
- package/dist/components/AuthLayout.js +26 -87
- package/dist/components/AuthPages.d.ts +4 -29
- package/dist/components/AuthPages.js +23 -105
- package/dist/components/AuthPagesServer.d.ts +3 -4
- package/dist/components/AuthPagesServer.js +15 -8
- package/dist/components/auth-card/AuthCardShell.d.ts +21 -0
- package/dist/components/auth-card/AuthCardShell.js +104 -0
- package/dist/components/auth-card/FormRenderer.d.ts +32 -0
- package/dist/components/auth-card/FormRenderer.js +88 -0
- package/dist/components/auth-card/formConfigs.d.ts +25 -0
- package/dist/components/auth-card/formConfigs.js +56 -0
- package/dist/components/auth-card/index.d.ts +3 -0
- package/dist/components/auth-card/index.js +3 -0
- package/dist/components/forms/ForgotPasswordForm.d.ts +7 -0
- package/dist/components/forms/ForgotPasswordForm.js +56 -0
- package/dist/components/forms/LoginForm.d.ts +15 -0
- package/dist/components/forms/LoginForm.js +247 -0
- package/dist/components/forms/SetPasswordForm.d.ts +7 -0
- package/dist/components/forms/SetPasswordForm.js +75 -0
- package/dist/components/forms/SignupForm.d.ts +13 -0
- package/dist/components/forms/SignupForm.js +152 -0
- package/dist/components/forms/VerifyOtpForm.d.ts +9 -0
- package/dist/components/forms/VerifyOtpForm.js +107 -0
- package/dist/components/forms/index.d.ts +19 -0
- package/dist/components/forms/index.js +21 -0
- package/dist/components/pages/ForgotPasswordPage.d.ts +2 -1
- package/dist/components/pages/ForgotPasswordPageHero.d.ts +3 -2
- package/dist/components/pages/ForgotPasswordPageHero.js +70 -64
- package/dist/components/pages/ForgotPasswordPageTailwind.d.ts +3 -2
- package/dist/components/pages/ForgotPasswordPageTailwind.js +42 -36
- package/dist/components/pages/LoginPage.d.ts +2 -1
- package/dist/components/pages/LoginPageHero.d.ts +2 -1
- package/dist/components/pages/LoginPageHero.js +297 -291
- package/dist/components/pages/LoginPageTailwind.d.ts +2 -1
- package/dist/components/pages/LoginPageTailwind.js +197 -191
- package/dist/components/pages/SetPasswordPage.d.ts +2 -1
- package/dist/components/pages/SetPasswordPageHero.d.ts +3 -2
- package/dist/components/pages/SetPasswordPageHero.js +98 -92
- package/dist/components/pages/SetPasswordPageTailwind.d.ts +3 -2
- package/dist/components/pages/SetPasswordPageTailwind.js +63 -57
- package/dist/components/pages/SignupPage.d.ts +2 -1
- package/dist/components/pages/SignupPageHero.d.ts +3 -2
- package/dist/components/pages/SignupPageHero.js +139 -133
- package/dist/components/pages/SignupPageTailwind.d.ts +3 -2
- package/dist/components/pages/SignupPageTailwind.js +123 -117
- package/dist/components/pages/VerifyOtpPage.d.ts +2 -1
- package/dist/components/pages/VerifyOtpPageHero.d.ts +2 -1
- package/dist/components/pages/VerifyOtpPageHero.js +110 -104
- package/dist/components/pages/VerifyOtpPageTailwind.d.ts +2 -1
- package/dist/components/pages/VerifyOtpPageTailwind.js +60 -54
- package/dist/components/ui/translations.d.ts +9 -0
- package/dist/components/ui/translations.js +18 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.js +11 -0
- package/dist/exports/client.d.ts +5 -0
- package/dist/exports/client.js +5 -0
- package/dist/exports/rsc.d.ts +7 -0
- package/dist/exports/rsc.js +8 -0
- package/dist/index.js +12 -2
- 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__*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
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__*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|