@wordrhyme/shadcn-auth 1.0.61 → 2.0.3

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 (158) hide show
  1. package/README.md +154 -1
  2. package/dist/components/AuthCard.cjs +45 -0
  3. package/dist/components/AuthCard.d.cts +30 -0
  4. package/dist/components/AuthCard.d.ts +30 -0
  5. package/dist/components/AuthCard.js +42 -0
  6. package/dist/components/AuthForms.cjs +115 -0
  7. package/dist/components/AuthForms.d.cts +95 -0
  8. package/dist/components/AuthForms.d.ts +95 -0
  9. package/dist/components/AuthForms.js +112 -0
  10. package/dist/components/CompleteProfileForm.cjs +38 -0
  11. package/dist/components/CompleteProfileForm.d.cts +32 -0
  12. package/dist/components/CompleteProfileForm.d.ts +32 -0
  13. package/dist/components/CompleteProfileForm.js +36 -0
  14. package/dist/components/EmailOtpForm.cjs +181 -0
  15. package/dist/components/EmailOtpForm.d.cts +56 -0
  16. package/dist/components/EmailOtpForm.d.ts +56 -0
  17. package/dist/components/EmailOtpForm.js +176 -0
  18. package/dist/components/LegalNotice.cjs +37 -0
  19. package/dist/components/LegalNotice.d.cts +26 -0
  20. package/dist/components/LegalNotice.d.ts +26 -0
  21. package/dist/components/LegalNotice.js +35 -0
  22. package/dist/components/MagicLinkForm.cjs +119 -0
  23. package/dist/components/MagicLinkForm.d.cts +46 -0
  24. package/dist/components/MagicLinkForm.d.ts +46 -0
  25. package/dist/components/MagicLinkForm.js +115 -0
  26. package/dist/components/ProviderSignInButtons.cjs +65 -0
  27. package/dist/components/ProviderSignInButtons.d.cts +41 -0
  28. package/dist/components/ProviderSignInButtons.d.ts +41 -0
  29. package/dist/components/ProviderSignInButtons.js +62 -0
  30. package/dist/components/ResetPasswordForm.cjs +89 -0
  31. package/dist/components/ResetPasswordForm.d.cts +20 -0
  32. package/dist/components/ResetPasswordForm.d.ts +20 -0
  33. package/dist/components/ResetPasswordForm.js +85 -0
  34. package/dist/components/SignInForm.cjs +97 -0
  35. package/dist/components/SignInForm.d.cts +41 -0
  36. package/dist/components/SignInForm.d.ts +41 -0
  37. package/dist/components/SignInForm.js +93 -0
  38. package/dist/components/SignUpForm.cjs +123 -0
  39. package/dist/components/SignUpForm.d.cts +40 -0
  40. package/dist/components/SignUpForm.d.ts +40 -0
  41. package/dist/components/SignUpForm.js +119 -0
  42. package/dist/components/auth-pending/AuthButton.cjs +37 -0
  43. package/dist/components/auth-pending/AuthButton.d.cts +36 -0
  44. package/dist/components/auth-pending/AuthButton.d.ts +36 -0
  45. package/dist/components/auth-pending/AuthButton.js +34 -0
  46. package/dist/components/auth-pending/AuthPendingProvider.cjs +19 -0
  47. package/dist/components/auth-pending/AuthPendingProvider.d.cts +17 -0
  48. package/dist/components/auth-pending/AuthPendingProvider.d.ts +17 -0
  49. package/dist/components/auth-pending/AuthPendingProvider.js +17 -0
  50. package/dist/components/auth-pending/auth-pending-context.cjs +57 -0
  51. package/dist/components/auth-pending/auth-pending-context.d.cts +39 -0
  52. package/dist/components/auth-pending/auth-pending-context.d.ts +39 -0
  53. package/dist/components/auth-pending/auth-pending-context.js +52 -0
  54. package/dist/components/auth-pending/index.d.cts +3 -0
  55. package/dist/components/auth-pending/index.d.ts +3 -0
  56. package/dist/components/forms/AuthField.cjs +43 -0
  57. package/dist/components/forms/AuthField.d.cts +26 -0
  58. package/dist/components/forms/AuthField.d.ts +26 -0
  59. package/dist/components/forms/AuthField.js +40 -0
  60. package/dist/components/forms/CompleteProfileFields.cjs +63 -0
  61. package/dist/components/forms/CompleteProfileFields.d.cts +18 -0
  62. package/dist/components/forms/CompleteProfileFields.d.ts +18 -0
  63. package/dist/components/forms/CompleteProfileFields.js +60 -0
  64. package/dist/components/forms/EmailOtpCodeForm.cjs +78 -0
  65. package/dist/components/forms/EmailOtpCodeForm.d.cts +18 -0
  66. package/dist/components/forms/EmailOtpCodeForm.d.ts +18 -0
  67. package/dist/components/forms/EmailOtpCodeForm.js +75 -0
  68. package/dist/components/forms/EmailRequestForm.cjs +82 -0
  69. package/dist/components/forms/EmailRequestForm.d.cts +38 -0
  70. package/dist/components/forms/EmailRequestForm.d.ts +38 -0
  71. package/dist/components/forms/EmailRequestForm.js +79 -0
  72. package/dist/components/forms/SignInCredentialsForm.cjs +79 -0
  73. package/dist/components/forms/SignInCredentialsForm.d.cts +18 -0
  74. package/dist/components/forms/SignInCredentialsForm.d.ts +18 -0
  75. package/dist/components/forms/SignInCredentialsForm.js +76 -0
  76. package/dist/components/forms/SignUpCredentialsForm.cjs +130 -0
  77. package/dist/components/forms/SignUpCredentialsForm.d.cts +24 -0
  78. package/dist/components/forms/SignUpCredentialsForm.d.ts +24 -0
  79. package/dist/components/forms/SignUpCredentialsForm.js +126 -0
  80. package/dist/components/index.d.cts +25 -0
  81. package/dist/components/index.d.ts +25 -0
  82. package/dist/components/provider-icon/ProviderIcon.cjs +82 -0
  83. package/dist/components/provider-icon/ProviderIcon.d.cts +21 -0
  84. package/dist/components/provider-icon/ProviderIcon.d.ts +21 -0
  85. package/dist/components/provider-icon/ProviderIcon.js +79 -0
  86. package/dist/components/sign-in-methods/SignInMethodRow.cjs +55 -0
  87. package/dist/components/sign-in-methods/SignInMethodRow.d.cts +31 -0
  88. package/dist/components/sign-in-methods/SignInMethodRow.d.ts +31 -0
  89. package/dist/components/sign-in-methods/SignInMethodRow.js +50 -0
  90. package/dist/components/sign-in-methods/SignInMethods.cjs +45 -0
  91. package/dist/components/sign-in-methods/SignInMethods.d.cts +26 -0
  92. package/dist/components/sign-in-methods/SignInMethods.d.ts +26 -0
  93. package/dist/components/sign-in-methods/SignInMethods.js +43 -0
  94. package/dist/components/sign-in-methods/SignInMethodsList.cjs +69 -0
  95. package/dist/components/sign-in-methods/SignInMethodsList.d.cts +47 -0
  96. package/dist/components/sign-in-methods/SignInMethodsList.d.ts +47 -0
  97. package/dist/components/sign-in-methods/SignInMethodsList.js +65 -0
  98. package/dist/components/sign-in-methods/sign-in-methods-copy.cjs +13 -0
  99. package/dist/components/sign-in-methods/sign-in-methods-copy.d.cts +11 -0
  100. package/dist/components/sign-in-methods/sign-in-methods-copy.d.ts +11 -0
  101. package/dist/components/sign-in-methods/sign-in-methods-copy.js +12 -0
  102. package/dist/constants/auth-providers.cjs +33 -0
  103. package/dist/constants/auth-providers.d.cts +14 -0
  104. package/dist/constants/auth-providers.d.ts +14 -0
  105. package/dist/constants/auth-providers.js +31 -0
  106. package/dist/constants/validation.cjs +21 -0
  107. package/dist/constants/validation.d.cts +17 -0
  108. package/dist/constants/validation.d.ts +17 -0
  109. package/dist/constants/validation.js +18 -0
  110. package/dist/hooks/use-pending-action.cjs +37 -0
  111. package/dist/hooks/use-pending-action.d.cts +26 -0
  112. package/dist/hooks/use-pending-action.d.ts +26 -0
  113. package/dist/hooks/use-pending-action.js +35 -0
  114. package/dist/hooks/use-reset-on-page-restore.cjs +35 -0
  115. package/dist/hooks/use-reset-on-page-restore.d.cts +15 -0
  116. package/dist/hooks/use-reset-on-page-restore.d.ts +15 -0
  117. package/dist/hooks/use-reset-on-page-restore.js +33 -0
  118. package/dist/index.cjs +67 -7
  119. package/dist/index.d.cts +34 -6
  120. package/dist/index.d.ts +34 -6
  121. package/dist/index.js +33 -6
  122. package/dist/utils/build-sign-in-method-rows.cjs +25 -0
  123. package/dist/utils/build-sign-in-method-rows.d.cts +26 -0
  124. package/dist/utils/build-sign-in-method-rows.d.ts +26 -0
  125. package/dist/utils/build-sign-in-method-rows.js +24 -0
  126. package/dist/utils/until-navigation.cjs +22 -0
  127. package/dist/utils/until-navigation.d.cts +18 -0
  128. package/dist/utils/until-navigation.d.ts +18 -0
  129. package/dist/utils/until-navigation.js +21 -0
  130. package/dist/utils/validate-email.cjs +22 -0
  131. package/dist/utils/validate-email.d.cts +14 -0
  132. package/dist/utils/validate-email.d.ts +14 -0
  133. package/dist/utils/validate-email.js +21 -0
  134. package/dist/utils/validate-password.cjs +16 -0
  135. package/dist/utils/validate-password.d.cts +9 -0
  136. package/dist/utils/validate-password.d.ts +9 -0
  137. package/dist/utils/validate-password.js +16 -0
  138. package/package.json +15 -8
  139. package/dist/AuthForms.cjs +0 -47
  140. package/dist/AuthForms.d.cts +0 -23
  141. package/dist/AuthForms.d.ts +0 -23
  142. package/dist/AuthForms.js +0 -44
  143. package/dist/GoogleSignIn.cjs +0 -46
  144. package/dist/GoogleSignIn.d.cts +0 -10
  145. package/dist/GoogleSignIn.d.ts +0 -10
  146. package/dist/GoogleSignIn.js +0 -42
  147. package/dist/ResetPasswordForm.cjs +0 -106
  148. package/dist/ResetPasswordForm.d.cts +0 -17
  149. package/dist/ResetPasswordForm.d.ts +0 -17
  150. package/dist/ResetPasswordForm.js +0 -100
  151. package/dist/SignInForm.cjs +0 -164
  152. package/dist/SignInForm.d.cts +0 -21
  153. package/dist/SignInForm.d.ts +0 -21
  154. package/dist/SignInForm.js +0 -159
  155. package/dist/SignUpForm.cjs +0 -154
  156. package/dist/SignUpForm.d.cts +0 -19
  157. package/dist/SignUpForm.d.ts +0 -19
  158. package/dist/SignUpForm.js +0 -149
@@ -0,0 +1,93 @@
1
+ 'use client';
2
+
3
+
4
+ import { useAuthPendingState } from "./auth-pending/auth-pending-context.js";
5
+ import { AuthButton } from "./auth-pending/AuthButton.js";
6
+ import { AuthPendingProvider } from "./auth-pending/AuthPendingProvider.js";
7
+ import { AuthCard } from "./AuthCard.js";
8
+ import { ProviderSignInButtons } from "./ProviderSignInButtons.js";
9
+ import { SignInCredentialsForm } from "./forms/SignInCredentialsForm.js";
10
+ import { useState } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ import { Mail } from "lucide-react";
13
+
14
+ //#region src/components/SignInForm.tsx
15
+ function SignInForm({ onSignIn, credentialsDisclosureLabel, onGoogleSignIn, onLinkedInSignIn, isLoading, error, onSwitchToSignUp, onSwitchToReset, onSwitchToMagicLink, onSwitchToEmailOtp }) {
16
+ const pending = useAuthPendingState(isLoading);
17
+ const [isDisclosed, setIsDisclosed] = useState(false);
18
+ const isDisclosure = onSignIn != null && credentialsDisclosureLabel != null;
19
+ const showCredentials = onSignIn != null && (!isDisclosure || isDisclosed);
20
+ return /* @__PURE__ */ jsx(AuthPendingProvider, {
21
+ value: pending,
22
+ children: /* @__PURE__ */ jsxs(AuthCard, {
23
+ title: "Sign In",
24
+ error,
25
+ children: [
26
+ showCredentials && onSignIn != null && /* @__PURE__ */ jsx(SignInCredentialsForm, { onSignIn }),
27
+ /* @__PURE__ */ jsx(ProviderSignInButtons, {
28
+ onGoogleSignIn,
29
+ onLinkedInSignIn,
30
+ action: "Sign in",
31
+ showSeparator: showCredentials
32
+ }),
33
+ /* @__PURE__ */ jsx("div", { className: "my-4" }),
34
+ /* @__PURE__ */ jsxs("div", {
35
+ className: "space-y-2 text-center text-sm",
36
+ children: [
37
+ onSwitchToMagicLink && /* @__PURE__ */ jsxs(AuthButton, {
38
+ type: "button",
39
+ variant: "outline",
40
+ onClick: onSwitchToMagicLink,
41
+ className: "w-full",
42
+ children: [/* @__PURE__ */ jsx(Mail, {
43
+ className: "mr-2 h-4 w-4",
44
+ "aria-hidden": "true"
45
+ }), "Email me a sign-in link instead"]
46
+ }),
47
+ onSwitchToEmailOtp && /* @__PURE__ */ jsxs(AuthButton, {
48
+ type: "button",
49
+ variant: "outline",
50
+ onClick: onSwitchToEmailOtp,
51
+ className: "w-full",
52
+ children: [/* @__PURE__ */ jsx(Mail, {
53
+ className: "mr-2 h-4 w-4",
54
+ "aria-hidden": "true"
55
+ }), "Email me a sign-in code instead"]
56
+ }),
57
+ onSwitchToSignUp && /* @__PURE__ */ jsxs("p", { children: [
58
+ "Don't have an account?",
59
+ " ",
60
+ /* @__PURE__ */ jsx(AuthButton, {
61
+ variant: "link",
62
+ size: "sm",
63
+ onClick: onSwitchToSignUp,
64
+ className: "h-auto p-0",
65
+ children: "Sign up"
66
+ })
67
+ ] }),
68
+ onSwitchToReset && /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(AuthButton, {
69
+ variant: "link",
70
+ size: "sm",
71
+ onClick: onSwitchToReset,
72
+ className: "h-auto p-0",
73
+ children: "Forgot your password?"
74
+ }) })
75
+ ]
76
+ }),
77
+ isDisclosure && !isDisclosed && /* @__PURE__ */ jsx("div", {
78
+ className: "mt-8 text-center",
79
+ children: /* @__PURE__ */ jsx(AuthButton, {
80
+ variant: "link",
81
+ size: "sm",
82
+ onClick: () => setIsDisclosed(true),
83
+ className: "text-muted-foreground h-auto p-0 text-xs font-normal",
84
+ children: credentialsDisclosureLabel
85
+ })
86
+ })
87
+ ]
88
+ })
89
+ });
90
+ }
91
+
92
+ //#endregion
93
+ export { SignInForm };
@@ -0,0 +1,123 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_auth_pending_context = require('./auth-pending/auth-pending-context.cjs');
6
+ const require_AuthButton = require('./auth-pending/AuthButton.cjs');
7
+ const require_AuthPendingProvider = require('./auth-pending/AuthPendingProvider.cjs');
8
+ const require_AuthCard = require('./AuthCard.cjs');
9
+ const require_ProviderSignInButtons = require('./ProviderSignInButtons.cjs');
10
+ const require_SignUpCredentialsForm = require('./forms/SignUpCredentialsForm.cjs');
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
13
+ let __wordrhyme_shadcn = require("@wordrhyme/shadcn");
14
+ __wordrhyme_shadcn = require_rolldown_runtime.__toESM(__wordrhyme_shadcn);
15
+ let lucide_react = require("lucide-react");
16
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
17
+
18
+ //#region src/components/SignUpForm.tsx
19
+ function SignUpForm({ onSignUp, onGoogleSignIn, onLinkedInSignIn, isLoading, error, sentTo, onSwitchToSignIn, onSwitchToMagicLink, onSwitchToEmailOtp, privacyPolicyUrl = "/privacy", privacyNotice, termsUrl = "/terms", minimumAge, onConsentGiven }) {
20
+ const pending = require_auth_pending_context.useAuthPendingState(isLoading);
21
+ if (sentTo != null && sentTo.length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthPendingProvider.AuthPendingProvider, {
22
+ value: pending,
23
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthCard.AuthCard, {
24
+ title: "Check your email",
25
+ error,
26
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
27
+ className: "flex flex-col items-center gap-4 text-center",
28
+ children: [
29
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MailCheck, {
30
+ className: "text-primary h-12 w-12",
31
+ "aria-hidden": "true"
32
+ }),
33
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
34
+ className: "text-sm",
35
+ children: [
36
+ "We sent a confirmation link to ",
37
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
38
+ className: "font-medium",
39
+ children: sentTo
40
+ }),
41
+ "."
42
+ ]
43
+ }),
44
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
45
+ className: "text-muted-foreground text-xs",
46
+ children: "Open it to finish creating your account. Check your spam folder if it does not arrive."
47
+ })
48
+ ]
49
+ }), onSwitchToSignIn && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Separator, { className: "my-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
50
+ className: "text-center",
51
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthButton.AuthButton, {
52
+ variant: "link",
53
+ size: "sm",
54
+ onClick: onSwitchToSignIn,
55
+ className: "h-auto p-0",
56
+ children: "Back to sign in"
57
+ })
58
+ })] })]
59
+ })
60
+ });
61
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthPendingProvider.AuthPendingProvider, {
62
+ value: pending,
63
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthCard.AuthCard, {
64
+ title: "Sign Up",
65
+ error,
66
+ children: [
67
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SignUpCredentialsForm.SignUpCredentialsForm, {
68
+ onSignUp,
69
+ privacyPolicyUrl,
70
+ privacyNotice,
71
+ termsUrl,
72
+ minimumAge,
73
+ onConsentGiven
74
+ }),
75
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProviderSignInButtons.ProviderSignInButtons, {
76
+ onGoogleSignIn,
77
+ onLinkedInSignIn,
78
+ action: "Sign up"
79
+ }),
80
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Separator, { className: "my-4" }),
81
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
82
+ className: "space-y-2 text-center text-sm",
83
+ children: [
84
+ onSwitchToMagicLink && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthButton.AuthButton, {
85
+ type: "button",
86
+ variant: "outline",
87
+ onClick: onSwitchToMagicLink,
88
+ className: "w-full",
89
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Mail, {
90
+ className: "mr-2 h-4 w-4",
91
+ "aria-hidden": "true"
92
+ }), "Email me a sign-in link instead"]
93
+ }),
94
+ onSwitchToEmailOtp && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthButton.AuthButton, {
95
+ type: "button",
96
+ variant: "outline",
97
+ onClick: onSwitchToEmailOtp,
98
+ className: "w-full",
99
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Mail, {
100
+ className: "mr-2 h-4 w-4",
101
+ "aria-hidden": "true"
102
+ }), "Email me a sign-in code instead"]
103
+ }),
104
+ onSwitchToSignIn && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
105
+ "Already have an account?",
106
+ " ",
107
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthButton.AuthButton, {
108
+ variant: "link",
109
+ size: "sm",
110
+ onClick: onSwitchToSignIn,
111
+ className: "h-auto p-0",
112
+ children: "Sign in"
113
+ })
114
+ ] })
115
+ ]
116
+ })
117
+ ]
118
+ })
119
+ });
120
+ }
121
+
122
+ //#endregion
123
+ exports.SignUpForm = SignUpForm;
@@ -0,0 +1,40 @@
1
+ import { ProviderSignInHandlers } from "./ProviderSignInButtons.cjs";
2
+ import React from "react";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+
5
+ //#region src/components/SignUpForm.d.ts
6
+ interface SignUpFormProps extends ProviderSignInHandlers {
7
+ onSignUp: (email: string, password: string) => Promise<void>;
8
+ isLoading: boolean;
9
+ error: string | null;
10
+ /** Address that has been sent a confirmation email, controlled by the host. */
11
+ sentTo?: string | null;
12
+ onSwitchToSignIn?: () => void;
13
+ onSwitchToMagicLink?: () => void;
14
+ /** Offers the emailed-code route. Hidden when the host has not wired one. */
15
+ onSwitchToEmailOtp?: () => void;
16
+ privacyPolicyUrl?: string;
17
+ privacyNotice?: React.ReactNode;
18
+ termsUrl?: string;
19
+ /** Minimum age stated by the Terms; shown in the acceptance line. */
20
+ minimumAge?: number;
21
+ onConsentGiven?: () => void;
22
+ }
23
+ declare function SignUpForm({
24
+ onSignUp,
25
+ onGoogleSignIn,
26
+ onLinkedInSignIn,
27
+ isLoading,
28
+ error,
29
+ sentTo,
30
+ onSwitchToSignIn,
31
+ onSwitchToMagicLink,
32
+ onSwitchToEmailOtp,
33
+ privacyPolicyUrl,
34
+ privacyNotice,
35
+ termsUrl,
36
+ minimumAge,
37
+ onConsentGiven
38
+ }: SignUpFormProps): react_jsx_runtime0.JSX.Element;
39
+ //#endregion
40
+ export { SignUpForm, SignUpFormProps };
@@ -0,0 +1,40 @@
1
+ import { ProviderSignInHandlers } from "./ProviderSignInButtons.js";
2
+ import React from "react";
3
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
4
+
5
+ //#region src/components/SignUpForm.d.ts
6
+ interface SignUpFormProps extends ProviderSignInHandlers {
7
+ onSignUp: (email: string, password: string) => Promise<void>;
8
+ isLoading: boolean;
9
+ error: string | null;
10
+ /** Address that has been sent a confirmation email, controlled by the host. */
11
+ sentTo?: string | null;
12
+ onSwitchToSignIn?: () => void;
13
+ onSwitchToMagicLink?: () => void;
14
+ /** Offers the emailed-code route. Hidden when the host has not wired one. */
15
+ onSwitchToEmailOtp?: () => void;
16
+ privacyPolicyUrl?: string;
17
+ privacyNotice?: React.ReactNode;
18
+ termsUrl?: string;
19
+ /** Minimum age stated by the Terms; shown in the acceptance line. */
20
+ minimumAge?: number;
21
+ onConsentGiven?: () => void;
22
+ }
23
+ declare function SignUpForm({
24
+ onSignUp,
25
+ onGoogleSignIn,
26
+ onLinkedInSignIn,
27
+ isLoading,
28
+ error,
29
+ sentTo,
30
+ onSwitchToSignIn,
31
+ onSwitchToMagicLink,
32
+ onSwitchToEmailOtp,
33
+ privacyPolicyUrl,
34
+ privacyNotice,
35
+ termsUrl,
36
+ minimumAge,
37
+ onConsentGiven
38
+ }: SignUpFormProps): react_jsx_runtime18.JSX.Element;
39
+ //#endregion
40
+ export { SignUpForm, SignUpFormProps };
@@ -0,0 +1,119 @@
1
+ 'use client';
2
+
3
+
4
+ import { useAuthPendingState } from "./auth-pending/auth-pending-context.js";
5
+ import { AuthButton } from "./auth-pending/AuthButton.js";
6
+ import { AuthPendingProvider } from "./auth-pending/AuthPendingProvider.js";
7
+ import { AuthCard } from "./AuthCard.js";
8
+ import { ProviderSignInButtons } from "./ProviderSignInButtons.js";
9
+ import { SignUpCredentialsForm } from "./forms/SignUpCredentialsForm.js";
10
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
+ import { Separator } from "@wordrhyme/shadcn";
12
+ import { Mail, MailCheck } from "lucide-react";
13
+
14
+ //#region src/components/SignUpForm.tsx
15
+ function SignUpForm({ onSignUp, onGoogleSignIn, onLinkedInSignIn, isLoading, error, sentTo, onSwitchToSignIn, onSwitchToMagicLink, onSwitchToEmailOtp, privacyPolicyUrl = "/privacy", privacyNotice, termsUrl = "/terms", minimumAge, onConsentGiven }) {
16
+ const pending = useAuthPendingState(isLoading);
17
+ if (sentTo != null && sentTo.length > 0) return /* @__PURE__ */ jsx(AuthPendingProvider, {
18
+ value: pending,
19
+ children: /* @__PURE__ */ jsxs(AuthCard, {
20
+ title: "Check your email",
21
+ error,
22
+ children: [/* @__PURE__ */ jsxs("div", {
23
+ className: "flex flex-col items-center gap-4 text-center",
24
+ children: [
25
+ /* @__PURE__ */ jsx(MailCheck, {
26
+ className: "text-primary h-12 w-12",
27
+ "aria-hidden": "true"
28
+ }),
29
+ /* @__PURE__ */ jsxs("p", {
30
+ className: "text-sm",
31
+ children: [
32
+ "We sent a confirmation link to ",
33
+ /* @__PURE__ */ jsx("span", {
34
+ className: "font-medium",
35
+ children: sentTo
36
+ }),
37
+ "."
38
+ ]
39
+ }),
40
+ /* @__PURE__ */ jsx("p", {
41
+ className: "text-muted-foreground text-xs",
42
+ children: "Open it to finish creating your account. Check your spam folder if it does not arrive."
43
+ })
44
+ ]
45
+ }), onSwitchToSignIn && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Separator, { className: "my-4" }), /* @__PURE__ */ jsx("div", {
46
+ className: "text-center",
47
+ children: /* @__PURE__ */ jsx(AuthButton, {
48
+ variant: "link",
49
+ size: "sm",
50
+ onClick: onSwitchToSignIn,
51
+ className: "h-auto p-0",
52
+ children: "Back to sign in"
53
+ })
54
+ })] })]
55
+ })
56
+ });
57
+ return /* @__PURE__ */ jsx(AuthPendingProvider, {
58
+ value: pending,
59
+ children: /* @__PURE__ */ jsxs(AuthCard, {
60
+ title: "Sign Up",
61
+ error,
62
+ children: [
63
+ /* @__PURE__ */ jsx(SignUpCredentialsForm, {
64
+ onSignUp,
65
+ privacyPolicyUrl,
66
+ privacyNotice,
67
+ termsUrl,
68
+ minimumAge,
69
+ onConsentGiven
70
+ }),
71
+ /* @__PURE__ */ jsx(ProviderSignInButtons, {
72
+ onGoogleSignIn,
73
+ onLinkedInSignIn,
74
+ action: "Sign up"
75
+ }),
76
+ /* @__PURE__ */ jsx(Separator, { className: "my-4" }),
77
+ /* @__PURE__ */ jsxs("div", {
78
+ className: "space-y-2 text-center text-sm",
79
+ children: [
80
+ onSwitchToMagicLink && /* @__PURE__ */ jsxs(AuthButton, {
81
+ type: "button",
82
+ variant: "outline",
83
+ onClick: onSwitchToMagicLink,
84
+ className: "w-full",
85
+ children: [/* @__PURE__ */ jsx(Mail, {
86
+ className: "mr-2 h-4 w-4",
87
+ "aria-hidden": "true"
88
+ }), "Email me a sign-in link instead"]
89
+ }),
90
+ onSwitchToEmailOtp && /* @__PURE__ */ jsxs(AuthButton, {
91
+ type: "button",
92
+ variant: "outline",
93
+ onClick: onSwitchToEmailOtp,
94
+ className: "w-full",
95
+ children: [/* @__PURE__ */ jsx(Mail, {
96
+ className: "mr-2 h-4 w-4",
97
+ "aria-hidden": "true"
98
+ }), "Email me a sign-in code instead"]
99
+ }),
100
+ onSwitchToSignIn && /* @__PURE__ */ jsxs("p", { children: [
101
+ "Already have an account?",
102
+ " ",
103
+ /* @__PURE__ */ jsx(AuthButton, {
104
+ variant: "link",
105
+ size: "sm",
106
+ onClick: onSwitchToSignIn,
107
+ className: "h-auto p-0",
108
+ children: "Sign in"
109
+ })
110
+ ] })
111
+ ]
112
+ })
113
+ ]
114
+ })
115
+ });
116
+ }
117
+
118
+ //#endregion
119
+ export { SignUpForm };
@@ -0,0 +1,37 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
5
+ const require_auth_pending_context = require('./auth-pending-context.cjs');
6
+ let __wordrhyme_shadcn_ui = require("@wordrhyme/shadcn-ui");
7
+ __wordrhyme_shadcn_ui = require_rolldown_runtime.__toESM(__wordrhyme_shadcn_ui);
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
10
+
11
+ //#region src/components/auth-pending/AuthButton.tsx
12
+ /**
13
+ * A button on an auth card, wired to the card's pending scope.
14
+ *
15
+ * It takes its `loading` and `disabled` from that scope rather than from a flag
16
+ * passed down: the button whose action is running is the only one that spins,
17
+ * and every other control on the card goes disabled until it settles. Passing
18
+ * `disabled` still forces the button off for reasons of its own — an unticked
19
+ * consent box, a resend still in its cooldown.
20
+ */
21
+ function AuthButton({ actionKey, onAction, onClick, disabled,...rest }) {
22
+ const pending = require_auth_pending_context.useAuthPending();
23
+ const loading = actionKey != null && pending.pendingKey === actionKey;
24
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn_ui.ButtonExtended, {
25
+ ...rest,
26
+ loading,
27
+ loaderProps: { placement: "start" },
28
+ disabled: disabled === true || pending.isBusy,
29
+ onClick: (event) => {
30
+ onClick?.(event);
31
+ if (onAction != null && actionKey != null) pending.run(actionKey, onAction);
32
+ }
33
+ });
34
+ }
35
+
36
+ //#endregion
37
+ exports.AuthButton = AuthButton;
@@ -0,0 +1,36 @@
1
+ import * as react_jsx_runtime20 from "react/jsx-runtime";
2
+ import { ButtonExtendedProps } from "@wordrhyme/shadcn-ui";
3
+
4
+ //#region src/components/auth-pending/AuthButton.d.ts
5
+ interface AuthButtonProps extends Omit<ButtonExtendedProps, 'loading' | 'loaderProps'> {
6
+ /**
7
+ * Identifies this button's action within the card. The button spins only
8
+ * while the action under this key is the one running; omit it for a button
9
+ * that starts no async work of its own, such as a step switch.
10
+ */
11
+ actionKey?: string;
12
+ /**
13
+ * Async work this button starts, tracked under `actionKey`. A submit button
14
+ * leaves this out — its form's `onSubmit` runs the action, because only the
15
+ * form knows whether validation passed.
16
+ */
17
+ onAction?: () => Promise<void>;
18
+ }
19
+ /**
20
+ * A button on an auth card, wired to the card's pending scope.
21
+ *
22
+ * It takes its `loading` and `disabled` from that scope rather than from a flag
23
+ * passed down: the button whose action is running is the only one that spins,
24
+ * and every other control on the card goes disabled until it settles. Passing
25
+ * `disabled` still forces the button off for reasons of its own — an unticked
26
+ * consent box, a resend still in its cooldown.
27
+ */
28
+ declare function AuthButton({
29
+ actionKey,
30
+ onAction,
31
+ onClick,
32
+ disabled,
33
+ ...rest
34
+ }: AuthButtonProps): react_jsx_runtime20.JSX.Element;
35
+ //#endregion
36
+ export { AuthButton, AuthButtonProps };
@@ -0,0 +1,36 @@
1
+ import { ButtonExtendedProps } from "@wordrhyme/shadcn-ui";
2
+ import * as react_jsx_runtime20 from "react/jsx-runtime";
3
+
4
+ //#region src/components/auth-pending/AuthButton.d.ts
5
+ interface AuthButtonProps extends Omit<ButtonExtendedProps, 'loading' | 'loaderProps'> {
6
+ /**
7
+ * Identifies this button's action within the card. The button spins only
8
+ * while the action under this key is the one running; omit it for a button
9
+ * that starts no async work of its own, such as a step switch.
10
+ */
11
+ actionKey?: string;
12
+ /**
13
+ * Async work this button starts, tracked under `actionKey`. A submit button
14
+ * leaves this out — its form's `onSubmit` runs the action, because only the
15
+ * form knows whether validation passed.
16
+ */
17
+ onAction?: () => Promise<void>;
18
+ }
19
+ /**
20
+ * A button on an auth card, wired to the card's pending scope.
21
+ *
22
+ * It takes its `loading` and `disabled` from that scope rather than from a flag
23
+ * passed down: the button whose action is running is the only one that spins,
24
+ * and every other control on the card goes disabled until it settles. Passing
25
+ * `disabled` still forces the button off for reasons of its own — an unticked
26
+ * consent box, a resend still in its cooldown.
27
+ */
28
+ declare function AuthButton({
29
+ actionKey,
30
+ onAction,
31
+ onClick,
32
+ disabled,
33
+ ...rest
34
+ }: AuthButtonProps): react_jsx_runtime20.JSX.Element;
35
+ //#endregion
36
+ export { AuthButton, AuthButtonProps };
@@ -0,0 +1,34 @@
1
+ 'use client';
2
+
3
+
4
+ import { useAuthPending } from "./auth-pending-context.js";
5
+ import { ButtonExtended } from "@wordrhyme/shadcn-ui";
6
+ import { jsx } from "react/jsx-runtime";
7
+
8
+ //#region src/components/auth-pending/AuthButton.tsx
9
+ /**
10
+ * A button on an auth card, wired to the card's pending scope.
11
+ *
12
+ * It takes its `loading` and `disabled` from that scope rather than from a flag
13
+ * passed down: the button whose action is running is the only one that spins,
14
+ * and every other control on the card goes disabled until it settles. Passing
15
+ * `disabled` still forces the button off for reasons of its own — an unticked
16
+ * consent box, a resend still in its cooldown.
17
+ */
18
+ function AuthButton({ actionKey, onAction, onClick, disabled,...rest }) {
19
+ const pending = useAuthPending();
20
+ const loading = actionKey != null && pending.pendingKey === actionKey;
21
+ return /* @__PURE__ */ jsx(ButtonExtended, {
22
+ ...rest,
23
+ loading,
24
+ loaderProps: { placement: "start" },
25
+ disabled: disabled === true || pending.isBusy,
26
+ onClick: (event) => {
27
+ onClick?.(event);
28
+ if (onAction != null && actionKey != null) pending.run(actionKey, onAction);
29
+ }
30
+ });
31
+ }
32
+
33
+ //#endregion
34
+ export { AuthButton };
@@ -0,0 +1,19 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
5
+ const require_auth_pending_context = require('./auth-pending-context.cjs');
6
+ let react_jsx_runtime = require("react/jsx-runtime");
7
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
+
9
+ //#region src/components/auth-pending/AuthPendingProvider.tsx
10
+ /** Shares one auth card's pending scope with every control on it. */
11
+ function AuthPendingProvider({ value, children }) {
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_auth_pending_context.AuthPendingContext, {
13
+ value,
14
+ children
15
+ });
16
+ }
17
+
18
+ //#endregion
19
+ exports.AuthPendingProvider = AuthPendingProvider;
@@ -0,0 +1,17 @@
1
+ import { AuthPendingValue } from "./auth-pending-context.cjs";
2
+ import React from "react";
3
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
4
+
5
+ //#region src/components/auth-pending/AuthPendingProvider.d.ts
6
+ interface AuthPendingProviderProps {
7
+ /** The scope, from `useAuthPendingState`. One per auth card. */
8
+ value: AuthPendingValue;
9
+ children: React.ReactNode;
10
+ }
11
+ /** Shares one auth card's pending scope with every control on it. */
12
+ declare function AuthPendingProvider({
13
+ value,
14
+ children
15
+ }: AuthPendingProviderProps): react_jsx_runtime19.JSX.Element;
16
+ //#endregion
17
+ export { AuthPendingProvider, AuthPendingProviderProps };
@@ -0,0 +1,17 @@
1
+ import { AuthPendingValue } from "./auth-pending-context.js";
2
+ import React from "react";
3
+ import * as react_jsx_runtime19 from "react/jsx-runtime";
4
+
5
+ //#region src/components/auth-pending/AuthPendingProvider.d.ts
6
+ interface AuthPendingProviderProps {
7
+ /** The scope, from `useAuthPendingState`. One per auth card. */
8
+ value: AuthPendingValue;
9
+ children: React.ReactNode;
10
+ }
11
+ /** Shares one auth card's pending scope with every control on it. */
12
+ declare function AuthPendingProvider({
13
+ value,
14
+ children
15
+ }: AuthPendingProviderProps): react_jsx_runtime19.JSX.Element;
16
+ //#endregion
17
+ export { AuthPendingProvider, AuthPendingProviderProps };
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+
4
+ import { AuthPendingContext } from "./auth-pending-context.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/auth-pending/AuthPendingProvider.tsx
8
+ /** Shares one auth card's pending scope with every control on it. */
9
+ function AuthPendingProvider({ value, children }) {
10
+ return /* @__PURE__ */ jsx(AuthPendingContext, {
11
+ value,
12
+ children
13
+ });
14
+ }
15
+
16
+ //#endregion
17
+ export { AuthPendingProvider };