@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
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface ForgotPasswordPageHeroProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface ForgotPasswordPageHeroProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  loginUrl?: string;
4
5
  }
5
- export default function ForgotPasswordPageHero({ loginUrl, logo, poweredBy, cardClassName, backgroundClass, locale, messages }: ForgotPasswordPageHeroProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function ForgotPasswordPageHero({ loginUrl, logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages }: ForgotPasswordPageHeroProps): import("react/jsx-runtime").JSX.Element;
@@ -6,75 +6,81 @@ import { Icon } from '@iconify/react';
6
6
  import { motion } from 'framer-motion';
7
7
  import { useForgotPasswordFlow } from '../../auth/application/hooks/useForgotPasswordFlow.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 ForgotPasswordPageHero({ loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass, locale, messages }) {
11
+ export default function ForgotPasswordPageHero({ loginUrl = '/login', logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages }) {
11
12
  const { email, error, isLoading, setEmail, handleSubmit } = useForgotPasswordFlow();
12
13
  const t = getUiTranslations(locale, messages).forgotPassword;
13
14
  return /*#__PURE__*/ _jsx(AuthLayout, {
14
- logo: logo,
15
- title: t.title,
16
- subtitle: t.subtitle,
17
- poweredBy: poweredBy,
18
- cardClassName: cardClassName,
19
15
  backgroundClass: backgroundClass,
20
- footer: /*#__PURE__*/ _jsxs("a", {
21
- href: loginUrl,
22
- className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
23
- children: [
24
- /*#__PURE__*/ _jsx(Icon, {
25
- icon: "lucide:arrow-left",
26
- width: 16
27
- }),
28
- t.backToLogin
29
- ]
30
- }),
31
- children: /*#__PURE__*/ _jsxs("form", {
32
- onSubmit: handleSubmit,
33
- className: "space-y-4",
34
- children: [
35
- error && /*#__PURE__*/ _jsx(motion.div, {
36
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
37
- initial: {
38
- opacity: 0
39
- },
40
- animate: {
41
- opacity: 1
42
- },
43
- children: error
44
- }),
45
- /*#__PURE__*/ _jsxs(TextField, {
46
- type: "email",
47
- value: email,
48
- onChange: setEmail,
49
- isRequired: true,
50
- fullWidth: true,
51
- children: [
52
- /*#__PURE__*/ _jsx(Label, {
53
- className: "text-gray-600",
54
- children: t.emailLabel
55
- }),
56
- /*#__PURE__*/ _jsx(Input, {
57
- variant: "secondary"
58
- })
59
- ]
60
- }),
61
- /*#__PURE__*/ _jsx(Button, {
62
- type: "submit",
63
- fullWidth: true,
64
- size: "lg",
65
- isPending: isLoading,
66
- className: "h-12 font-semibold",
67
- children: ({ isPending })=>/*#__PURE__*/ _jsxs(_Fragment, {
68
- children: [
69
- isPending && /*#__PURE__*/ _jsx(Spinner, {
70
- color: "current",
71
- size: "sm"
72
- }),
73
- t.sendResetCode
74
- ]
75
- })
76
- })
77
- ]
16
+ children: /*#__PURE__*/ _jsx(AuthCard, {
17
+ logo: logo,
18
+ title: t.title,
19
+ subtitle: t.subtitle,
20
+ poweredBy: poweredBy,
21
+ cardClassName: cardClassName,
22
+ removeBorder: removeBorder,
23
+ removeShadow: removeShadow,
24
+ mobileVariant: mobileVariant,
25
+ footer: /*#__PURE__*/ _jsxs("a", {
26
+ href: loginUrl,
27
+ className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
28
+ children: [
29
+ /*#__PURE__*/ _jsx(Icon, {
30
+ icon: "lucide:arrow-left",
31
+ width: 16
32
+ }),
33
+ t.backToLogin
34
+ ]
35
+ }),
36
+ children: /*#__PURE__*/ _jsxs("form", {
37
+ onSubmit: handleSubmit,
38
+ className: "space-y-4",
39
+ children: [
40
+ error && /*#__PURE__*/ _jsx(motion.div, {
41
+ className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm",
42
+ initial: {
43
+ opacity: 0
44
+ },
45
+ animate: {
46
+ opacity: 1
47
+ },
48
+ children: error
49
+ }),
50
+ /*#__PURE__*/ _jsxs(TextField, {
51
+ type: "email",
52
+ value: email,
53
+ onChange: setEmail,
54
+ isRequired: true,
55
+ fullWidth: true,
56
+ children: [
57
+ /*#__PURE__*/ _jsx(Label, {
58
+ className: "text-gray-600",
59
+ children: t.emailLabel
60
+ }),
61
+ /*#__PURE__*/ _jsx(Input, {
62
+ variant: "secondary"
63
+ })
64
+ ]
65
+ }),
66
+ /*#__PURE__*/ _jsx(Button, {
67
+ type: "submit",
68
+ fullWidth: true,
69
+ size: "lg",
70
+ isPending: isLoading,
71
+ className: "h-12 font-semibold",
72
+ children: ({ isPending })=>/*#__PURE__*/ _jsxs(_Fragment, {
73
+ children: [
74
+ isPending && /*#__PURE__*/ _jsx(Spinner, {
75
+ color: "current",
76
+ size: "sm"
77
+ }),
78
+ t.sendResetCode
79
+ ]
80
+ })
81
+ })
82
+ ]
83
+ })
78
84
  })
79
85
  });
80
86
  }
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface ForgotPasswordPageProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface ForgotPasswordPageProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  loginUrl?: string;
4
5
  }
5
- export default function ForgotPasswordPage({ loginUrl, logo, poweredBy, cardClassName, backgroundClass, locale, messages, }: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function ForgotPasswordPage({ loginUrl, logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages, }: ForgotPasswordPageProps): import("react/jsx-runtime").JSX.Element;
@@ -4,47 +4,53 @@ import React from 'react';
4
4
  import { Button, Input } from '../ui/index.js';
5
5
  import { useForgotPasswordFlow } from '../../auth/application/hooks/useForgotPasswordFlow.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 ForgotPasswordPage({ loginUrl = '/login', logo, poweredBy, cardClassName, backgroundClass, locale, messages }) {
9
+ export default function ForgotPasswordPage({ loginUrl = '/login', logo, poweredBy, cardClassName, removeBorder, removeShadow, mobileVariant, backgroundClass, locale, messages }) {
9
10
  const { email, error, isLoading, setEmail, handleSubmit } = useForgotPasswordFlow();
10
11
  const t = getUiTranslations(locale, messages).forgotPassword;
11
12
  return /*#__PURE__*/ _jsx(AuthLayout, {
12
- logo: logo,
13
- title: t.title,
14
- subtitle: t.subtitle,
15
- poweredBy: poweredBy,
16
- cardClassName: cardClassName,
17
13
  backgroundClass: backgroundClass,
18
- footer: /*#__PURE__*/ _jsxs("a", {
19
- href: loginUrl,
20
- className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
21
- children: [
22
- "← ",
23
- t.backToLogin
24
- ]
25
- }),
26
- children: /*#__PURE__*/ _jsxs("form", {
27
- onSubmit: handleSubmit,
28
- className: "space-y-4",
29
- children: [
30
- error && /*#__PURE__*/ _jsx("div", {
31
- className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
32
- children: error
33
- }),
34
- /*#__PURE__*/ _jsx(Input, {
35
- type: "email",
36
- label: t.emailLabel,
37
- value: email,
38
- onChange: (e)=>setEmail(e.target.value),
39
- isRequired: true
40
- }),
41
- /*#__PURE__*/ _jsx(Button, {
42
- type: "submit",
43
- variant: "primary",
44
- isLoading: isLoading,
45
- children: t.sendResetCode
46
- })
47
- ]
14
+ children: /*#__PURE__*/ _jsx(AuthCard, {
15
+ logo: logo,
16
+ title: t.title,
17
+ subtitle: t.subtitle,
18
+ poweredBy: poweredBy,
19
+ cardClassName: cardClassName,
20
+ removeBorder: removeBorder,
21
+ removeShadow: removeShadow,
22
+ mobileVariant: mobileVariant,
23
+ footer: /*#__PURE__*/ _jsxs("a", {
24
+ href: loginUrl,
25
+ className: "text-sm text-gray-600 hover:text-gray-900 inline-flex items-center gap-1",
26
+ children: [
27
+ "← ",
28
+ t.backToLogin
29
+ ]
30
+ }),
31
+ children: /*#__PURE__*/ _jsxs("form", {
32
+ onSubmit: handleSubmit,
33
+ className: "space-y-4",
34
+ children: [
35
+ error && /*#__PURE__*/ _jsx("div", {
36
+ className: "bg-red-50 text-red-600 border border-red-200 rounded-lg p-3 text-sm animate-[fadeIn_0.2s_ease-out]",
37
+ children: error
38
+ }),
39
+ /*#__PURE__*/ _jsx(Input, {
40
+ type: "email",
41
+ label: t.emailLabel,
42
+ value: email,
43
+ onChange: (e)=>setEmail(e.target.value),
44
+ isRequired: true
45
+ }),
46
+ /*#__PURE__*/ _jsx(Button, {
47
+ type: "submit",
48
+ variant: "primary",
49
+ isLoading: isLoading,
50
+ children: t.sendResetCode
51
+ })
52
+ ]
53
+ })
48
54
  })
49
55
  });
50
56
  }
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface LoginPageProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface LoginPageProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  onPasswordLogin: (credentials: {
4
5
  email: string;
5
6
  password: string;
@@ -1,5 +1,6 @@
1
1
  import type { AuthLayoutConfig } from '../AuthLayout';
2
- export interface LoginPageHeroProps extends AuthLayoutConfig {
2
+ import type { AuthCardConfig } from '../AuthCard';
3
+ export interface LoginPageHeroProps extends AuthLayoutConfig, AuthCardConfig {
3
4
  onPasswordLogin: (credentials: {
4
5
  email: string;
5
6
  password: string;