@wordrhyme/shadcn-auth 1.0.61 → 2.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 (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,65 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ const require_AuthButton = require('./auth-pending/AuthButton.cjs');
6
+ const require_auth_providers = require('../constants/auth-providers.cjs');
7
+ const require_ProviderIcon = require('./provider-icon/ProviderIcon.cjs');
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
10
+ let __wordrhyme_shadcn = require("@wordrhyme/shadcn");
11
+ __wordrhyme_shadcn = require_rolldown_runtime.__toESM(__wordrhyme_shadcn);
12
+
13
+ //#region src/components/ProviderSignInButtons.tsx
14
+ /** The providers the host wired, in the order they should appear. */
15
+ function collectProviders({ onGoogleSignIn, onLinkedInSignIn }) {
16
+ const entries = [];
17
+ if (onGoogleSignIn != null) entries.push({
18
+ provider: "google",
19
+ onSignIn: onGoogleSignIn
20
+ });
21
+ if (onLinkedInSignIn != null) entries.push({
22
+ provider: "linkedin_oidc",
23
+ onSignIn: onLinkedInSignIn
24
+ });
25
+ return entries;
26
+ }
27
+ /**
28
+ * The identity-provider buttons, with the "or continue with" rule above them.
29
+ *
30
+ * The rule lives here rather than at each call site so every auth card spaces
31
+ * its provider buttons the same way; a card whose buttons are the only thing on
32
+ * it opts out with `showSeparator={false}`.
33
+ *
34
+ * A provider only appears when the host passed a handler for it, so an app that
35
+ * has not configured LinkedIn simply does not show a LinkedIn button — no flag
36
+ * to keep in sync with the Supabase dashboard.
37
+ *
38
+ * Loading state comes from the card's pending scope, so clicking Google spins
39
+ * the Google button alone and leaves LinkedIn and the credential form disabled
40
+ * rather than spinning too.
41
+ */
42
+ function ProviderSignInButtons({ onGoogleSignIn, onLinkedInSignIn, action = "Sign in", showSeparator = true }) {
43
+ const providers = collectProviders({
44
+ onGoogleSignIn,
45
+ onLinkedInSignIn
46
+ });
47
+ if (providers.length === 0) return null;
48
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [showSeparator && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.OrContinueWithSeparator, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
49
+ className: "relative space-y-2",
50
+ children: providers.map(({ provider, onSignIn }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthButton.AuthButton, {
51
+ type: "button",
52
+ variant: "outline",
53
+ className: "w-full",
54
+ actionKey: provider,
55
+ onAction: onSignIn,
56
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProviderIcon.ProviderIcon, {
57
+ provider,
58
+ className: "mr-2 h-4 w-4"
59
+ }), `${action} with ${require_auth_providers.describeAuthProvider(provider)}`]
60
+ }, provider))
61
+ })] });
62
+ }
63
+
64
+ //#endregion
65
+ exports.ProviderSignInButtons = ProviderSignInButtons;
@@ -0,0 +1,41 @@
1
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+
3
+ //#region src/components/ProviderSignInButtons.d.ts
4
+ /** Handlers for the identity providers a host has actually configured. */
5
+ interface ProviderSignInHandlers {
6
+ onGoogleSignIn?: () => Promise<void>;
7
+ onLinkedInSignIn?: () => Promise<void>;
8
+ }
9
+ interface ProviderSignInButtonsProps extends ProviderSignInHandlers {
10
+ /** Verb shown on the buttons — "Sign in" on the sign-in step, "Sign up" on sign-up. */
11
+ action?: string;
12
+ /**
13
+ * Whether to draw the "or continue with" rule above the buttons. Pass `false`
14
+ * only when nothing precedes them on the card — a rule directly under the
15
+ * heading separates the buttons from nothing.
16
+ */
17
+ showSeparator?: boolean;
18
+ }
19
+ /**
20
+ * The identity-provider buttons, with the "or continue with" rule above them.
21
+ *
22
+ * The rule lives here rather than at each call site so every auth card spaces
23
+ * its provider buttons the same way; a card whose buttons are the only thing on
24
+ * it opts out with `showSeparator={false}`.
25
+ *
26
+ * A provider only appears when the host passed a handler for it, so an app that
27
+ * has not configured LinkedIn simply does not show a LinkedIn button — no flag
28
+ * to keep in sync with the Supabase dashboard.
29
+ *
30
+ * Loading state comes from the card's pending scope, so clicking Google spins
31
+ * the Google button alone and leaves LinkedIn and the credential form disabled
32
+ * rather than spinning too.
33
+ */
34
+ declare function ProviderSignInButtons({
35
+ onGoogleSignIn,
36
+ onLinkedInSignIn,
37
+ action,
38
+ showSeparator
39
+ }: ProviderSignInButtonsProps): react_jsx_runtime13.JSX.Element | null;
40
+ //#endregion
41
+ export { ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers };
@@ -0,0 +1,41 @@
1
+ import * as react_jsx_runtime13 from "react/jsx-runtime";
2
+
3
+ //#region src/components/ProviderSignInButtons.d.ts
4
+ /** Handlers for the identity providers a host has actually configured. */
5
+ interface ProviderSignInHandlers {
6
+ onGoogleSignIn?: () => Promise<void>;
7
+ onLinkedInSignIn?: () => Promise<void>;
8
+ }
9
+ interface ProviderSignInButtonsProps extends ProviderSignInHandlers {
10
+ /** Verb shown on the buttons — "Sign in" on the sign-in step, "Sign up" on sign-up. */
11
+ action?: string;
12
+ /**
13
+ * Whether to draw the "or continue with" rule above the buttons. Pass `false`
14
+ * only when nothing precedes them on the card — a rule directly under the
15
+ * heading separates the buttons from nothing.
16
+ */
17
+ showSeparator?: boolean;
18
+ }
19
+ /**
20
+ * The identity-provider buttons, with the "or continue with" rule above them.
21
+ *
22
+ * The rule lives here rather than at each call site so every auth card spaces
23
+ * its provider buttons the same way; a card whose buttons are the only thing on
24
+ * it opts out with `showSeparator={false}`.
25
+ *
26
+ * A provider only appears when the host passed a handler for it, so an app that
27
+ * has not configured LinkedIn simply does not show a LinkedIn button — no flag
28
+ * to keep in sync with the Supabase dashboard.
29
+ *
30
+ * Loading state comes from the card's pending scope, so clicking Google spins
31
+ * the Google button alone and leaves LinkedIn and the credential form disabled
32
+ * rather than spinning too.
33
+ */
34
+ declare function ProviderSignInButtons({
35
+ onGoogleSignIn,
36
+ onLinkedInSignIn,
37
+ action,
38
+ showSeparator
39
+ }: ProviderSignInButtonsProps): react_jsx_runtime13.JSX.Element | null;
40
+ //#endregion
41
+ export { ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers };
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+
3
+
4
+ import { AuthButton } from "./auth-pending/AuthButton.js";
5
+ import { describeAuthProvider } from "../constants/auth-providers.js";
6
+ import { ProviderIcon } from "./provider-icon/ProviderIcon.js";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { OrContinueWithSeparator } from "@wordrhyme/shadcn";
9
+
10
+ //#region src/components/ProviderSignInButtons.tsx
11
+ /** The providers the host wired, in the order they should appear. */
12
+ function collectProviders({ onGoogleSignIn, onLinkedInSignIn }) {
13
+ const entries = [];
14
+ if (onGoogleSignIn != null) entries.push({
15
+ provider: "google",
16
+ onSignIn: onGoogleSignIn
17
+ });
18
+ if (onLinkedInSignIn != null) entries.push({
19
+ provider: "linkedin_oidc",
20
+ onSignIn: onLinkedInSignIn
21
+ });
22
+ return entries;
23
+ }
24
+ /**
25
+ * The identity-provider buttons, with the "or continue with" rule above them.
26
+ *
27
+ * The rule lives here rather than at each call site so every auth card spaces
28
+ * its provider buttons the same way; a card whose buttons are the only thing on
29
+ * it opts out with `showSeparator={false}`.
30
+ *
31
+ * A provider only appears when the host passed a handler for it, so an app that
32
+ * has not configured LinkedIn simply does not show a LinkedIn button — no flag
33
+ * to keep in sync with the Supabase dashboard.
34
+ *
35
+ * Loading state comes from the card's pending scope, so clicking Google spins
36
+ * the Google button alone and leaves LinkedIn and the credential form disabled
37
+ * rather than spinning too.
38
+ */
39
+ function ProviderSignInButtons({ onGoogleSignIn, onLinkedInSignIn, action = "Sign in", showSeparator = true }) {
40
+ const providers = collectProviders({
41
+ onGoogleSignIn,
42
+ onLinkedInSignIn
43
+ });
44
+ if (providers.length === 0) return null;
45
+ return /* @__PURE__ */ jsxs(Fragment, { children: [showSeparator && /* @__PURE__ */ jsx(OrContinueWithSeparator, {}), /* @__PURE__ */ jsx("div", {
46
+ className: "relative space-y-2",
47
+ children: providers.map(({ provider, onSignIn }) => /* @__PURE__ */ jsxs(AuthButton, {
48
+ type: "button",
49
+ variant: "outline",
50
+ className: "w-full",
51
+ actionKey: provider,
52
+ onAction: onSignIn,
53
+ children: [/* @__PURE__ */ jsx(ProviderIcon, {
54
+ provider,
55
+ className: "mr-2 h-4 w-4"
56
+ }), `${action} with ${describeAuthProvider(provider)}`]
57
+ }, provider))
58
+ })] });
59
+ }
60
+
61
+ //#endregion
62
+ export { ProviderSignInButtons };
@@ -0,0 +1,89 @@
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_EmailRequestForm = require('./forms/EmailRequestForm.cjs');
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
12
+ let __wordrhyme_shadcn = require("@wordrhyme/shadcn");
13
+ __wordrhyme_shadcn = require_rolldown_runtime.__toESM(__wordrhyme_shadcn);
14
+ let lucide_react = require("lucide-react");
15
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
16
+
17
+ //#region src/components/ResetPasswordForm.tsx
18
+ function ResetPasswordForm({ onResetPassword, isLoading, error, sentTo, onSwitchToSignIn }) {
19
+ const pending = require_auth_pending_context.useAuthPendingState(isLoading);
20
+ if (sentTo != null && sentTo.length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthPendingProvider.AuthPendingProvider, {
21
+ value: pending,
22
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthCard.AuthCard, {
23
+ title: "Check your email",
24
+ error,
25
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
26
+ className: "flex flex-col items-center gap-4 text-center",
27
+ children: [
28
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.MailCheck, {
29
+ className: "text-primary h-12 w-12",
30
+ "aria-hidden": "true"
31
+ }),
32
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
33
+ className: "text-sm",
34
+ children: [
35
+ "We sent a password-reset link to",
36
+ " ",
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: "The link works once and expires shortly. 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: "Reset Password",
65
+ error,
66
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_EmailRequestForm.EmailRequestForm, {
67
+ fieldId: "reset-email",
68
+ onSubmitEmail: onResetPassword,
69
+ submitLabel: "Send Reset Email",
70
+ submittingLabel: "Sending Reset Email..."
71
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
72
+ className: "mt-4 text-center",
73
+ children: onSwitchToSignIn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
74
+ className: "text-sm",
75
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthButton.AuthButton, {
76
+ variant: "link",
77
+ size: "sm",
78
+ onClick: onSwitchToSignIn,
79
+ className: "min-w-0 p-0 font-medium",
80
+ children: "Back to sign in"
81
+ })
82
+ })
83
+ })]
84
+ })
85
+ });
86
+ }
87
+
88
+ //#endregion
89
+ exports.ResetPasswordForm = ResetPasswordForm;
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+
3
+ //#region src/components/ResetPasswordForm.d.ts
4
+ interface ResetPasswordFormProps {
5
+ onResetPassword: (email: string) => Promise<void>;
6
+ isLoading: boolean;
7
+ error: string | null;
8
+ /** Address that has been sent a recovery link, controlled by the host. */
9
+ sentTo?: string | null;
10
+ onSwitchToSignIn?: () => void;
11
+ }
12
+ declare function ResetPasswordForm({
13
+ onResetPassword,
14
+ isLoading,
15
+ error,
16
+ sentTo,
17
+ onSwitchToSignIn
18
+ }: ResetPasswordFormProps): react_jsx_runtime14.JSX.Element;
19
+ //#endregion
20
+ export { ResetPasswordForm, ResetPasswordFormProps };
@@ -0,0 +1,20 @@
1
+ import * as react_jsx_runtime14 from "react/jsx-runtime";
2
+
3
+ //#region src/components/ResetPasswordForm.d.ts
4
+ interface ResetPasswordFormProps {
5
+ onResetPassword: (email: string) => Promise<void>;
6
+ isLoading: boolean;
7
+ error: string | null;
8
+ /** Address that has been sent a recovery link, controlled by the host. */
9
+ sentTo?: string | null;
10
+ onSwitchToSignIn?: () => void;
11
+ }
12
+ declare function ResetPasswordForm({
13
+ onResetPassword,
14
+ isLoading,
15
+ error,
16
+ sentTo,
17
+ onSwitchToSignIn
18
+ }: ResetPasswordFormProps): react_jsx_runtime14.JSX.Element;
19
+ //#endregion
20
+ export { ResetPasswordForm, ResetPasswordFormProps };
@@ -0,0 +1,85 @@
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 { EmailRequestForm } from "./forms/EmailRequestForm.js";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { Separator } from "@wordrhyme/shadcn";
11
+ import { MailCheck } from "lucide-react";
12
+
13
+ //#region src/components/ResetPasswordForm.tsx
14
+ function ResetPasswordForm({ onResetPassword, isLoading, error, sentTo, onSwitchToSignIn }) {
15
+ const pending = useAuthPendingState(isLoading);
16
+ if (sentTo != null && sentTo.length > 0) return /* @__PURE__ */ jsx(AuthPendingProvider, {
17
+ value: pending,
18
+ children: /* @__PURE__ */ jsxs(AuthCard, {
19
+ title: "Check your email",
20
+ error,
21
+ children: [/* @__PURE__ */ jsxs("div", {
22
+ className: "flex flex-col items-center gap-4 text-center",
23
+ children: [
24
+ /* @__PURE__ */ jsx(MailCheck, {
25
+ className: "text-primary h-12 w-12",
26
+ "aria-hidden": "true"
27
+ }),
28
+ /* @__PURE__ */ jsxs("p", {
29
+ className: "text-sm",
30
+ children: [
31
+ "We sent a password-reset link to",
32
+ " ",
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: "The link works once and expires shortly. 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: "Reset Password",
61
+ error,
62
+ children: [/* @__PURE__ */ jsx(EmailRequestForm, {
63
+ fieldId: "reset-email",
64
+ onSubmitEmail: onResetPassword,
65
+ submitLabel: "Send Reset Email",
66
+ submittingLabel: "Sending Reset Email..."
67
+ }), /* @__PURE__ */ jsx("div", {
68
+ className: "mt-4 text-center",
69
+ children: onSwitchToSignIn && /* @__PURE__ */ jsx("p", {
70
+ className: "text-sm",
71
+ children: /* @__PURE__ */ jsx(AuthButton, {
72
+ variant: "link",
73
+ size: "sm",
74
+ onClick: onSwitchToSignIn,
75
+ className: "min-w-0 p-0 font-medium",
76
+ children: "Back to sign in"
77
+ })
78
+ })
79
+ })]
80
+ })
81
+ });
82
+ }
83
+
84
+ //#endregion
85
+ export { ResetPasswordForm };
@@ -0,0 +1,97 @@
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_SignInCredentialsForm = require('./forms/SignInCredentialsForm.cjs');
11
+ let react = require("react");
12
+ react = require_rolldown_runtime.__toESM(react);
13
+ let react_jsx_runtime = require("react/jsx-runtime");
14
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
15
+ let lucide_react = require("lucide-react");
16
+ lucide_react = require_rolldown_runtime.__toESM(lucide_react);
17
+
18
+ //#region src/components/SignInForm.tsx
19
+ function SignInForm({ onSignIn, credentialsDisclosureLabel, onGoogleSignIn, onLinkedInSignIn, isLoading, error, onSwitchToSignUp, onSwitchToReset, onSwitchToMagicLink, onSwitchToEmailOtp }) {
20
+ const pending = require_auth_pending_context.useAuthPendingState(isLoading);
21
+ const [isDisclosed, setIsDisclosed] = (0, react.useState)(false);
22
+ const isDisclosure = onSignIn != null && credentialsDisclosureLabel != null;
23
+ const showCredentials = onSignIn != null && (!isDisclosure || isDisclosed);
24
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthPendingProvider.AuthPendingProvider, {
25
+ value: pending,
26
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthCard.AuthCard, {
27
+ title: "Sign In",
28
+ error,
29
+ children: [
30
+ showCredentials && onSignIn != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SignInCredentialsForm.SignInCredentialsForm, { onSignIn }),
31
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProviderSignInButtons.ProviderSignInButtons, {
32
+ onGoogleSignIn,
33
+ onLinkedInSignIn,
34
+ action: "Sign in",
35
+ showSeparator: showCredentials
36
+ }),
37
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "my-4" }),
38
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
39
+ className: "space-y-2 text-center text-sm",
40
+ children: [
41
+ onSwitchToMagicLink && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthButton.AuthButton, {
42
+ type: "button",
43
+ variant: "outline",
44
+ onClick: onSwitchToMagicLink,
45
+ className: "w-full",
46
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Mail, {
47
+ className: "mr-2 h-4 w-4",
48
+ "aria-hidden": "true"
49
+ }), "Email me a sign-in link instead"]
50
+ }),
51
+ onSwitchToEmailOtp && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_AuthButton.AuthButton, {
52
+ type: "button",
53
+ variant: "outline",
54
+ onClick: onSwitchToEmailOtp,
55
+ className: "w-full",
56
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Mail, {
57
+ className: "mr-2 h-4 w-4",
58
+ "aria-hidden": "true"
59
+ }), "Email me a sign-in code instead"]
60
+ }),
61
+ onSwitchToSignUp && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [
62
+ "Don't have an account?",
63
+ " ",
64
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthButton.AuthButton, {
65
+ variant: "link",
66
+ size: "sm",
67
+ onClick: onSwitchToSignUp,
68
+ className: "h-auto p-0",
69
+ children: "Sign up"
70
+ })
71
+ ] }),
72
+ onSwitchToReset && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthButton.AuthButton, {
73
+ variant: "link",
74
+ size: "sm",
75
+ onClick: onSwitchToReset,
76
+ className: "h-auto p-0",
77
+ children: "Forgot your password?"
78
+ }) })
79
+ ]
80
+ }),
81
+ isDisclosure && !isDisclosed && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
82
+ className: "mt-8 text-center",
83
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_AuthButton.AuthButton, {
84
+ variant: "link",
85
+ size: "sm",
86
+ onClick: () => setIsDisclosed(true),
87
+ className: "text-muted-foreground h-auto p-0 text-xs font-normal",
88
+ children: credentialsDisclosureLabel
89
+ })
90
+ })
91
+ ]
92
+ })
93
+ });
94
+ }
95
+
96
+ //#endregion
97
+ exports.SignInForm = SignInForm;
@@ -0,0 +1,41 @@
1
+ import { ProviderSignInHandlers } from "./ProviderSignInButtons.cjs";
2
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
3
+
4
+ //#region src/components/SignInForm.d.ts
5
+ interface SignInFormProps extends ProviderSignInHandlers {
6
+ /** Enables the email/password form. Omit to show passwordless/OAuth choices only. */
7
+ onSignIn?: (email: string, password: string) => Promise<void>;
8
+ /**
9
+ * Puts the credential fields behind a link carrying this label, instead of
10
+ * showing them straight away.
11
+ *
12
+ * For a product whose sign-in is passwordless but which still has to let one
13
+ * known account in — a store reviewer, a support login — password fields on
14
+ * the front of the card advertise a route almost no visitor can take. Behind
15
+ * a line of text they stay reachable by anyone told to look for them, and
16
+ * invisible to everyone else. Omit it and the fields render as usual.
17
+ */
18
+ credentialsDisclosureLabel?: string;
19
+ isLoading: boolean;
20
+ error: string | null;
21
+ onSwitchToSignUp?: () => void;
22
+ onSwitchToReset?: () => void;
23
+ /** Offers the passwordless route. Hidden when the host has not wired one. */
24
+ onSwitchToMagicLink?: () => void;
25
+ /** Offers the emailed-code route. Hidden when the host has not wired one. */
26
+ onSwitchToEmailOtp?: () => void;
27
+ }
28
+ declare function SignInForm({
29
+ onSignIn,
30
+ credentialsDisclosureLabel,
31
+ onGoogleSignIn,
32
+ onLinkedInSignIn,
33
+ isLoading,
34
+ error,
35
+ onSwitchToSignUp,
36
+ onSwitchToReset,
37
+ onSwitchToMagicLink,
38
+ onSwitchToEmailOtp
39
+ }: SignInFormProps): react_jsx_runtime18.JSX.Element;
40
+ //#endregion
41
+ export { SignInForm, SignInFormProps };
@@ -0,0 +1,41 @@
1
+ import { ProviderSignInHandlers } from "./ProviderSignInButtons.js";
2
+ import * as react_jsx_runtime18 from "react/jsx-runtime";
3
+
4
+ //#region src/components/SignInForm.d.ts
5
+ interface SignInFormProps extends ProviderSignInHandlers {
6
+ /** Enables the email/password form. Omit to show passwordless/OAuth choices only. */
7
+ onSignIn?: (email: string, password: string) => Promise<void>;
8
+ /**
9
+ * Puts the credential fields behind a link carrying this label, instead of
10
+ * showing them straight away.
11
+ *
12
+ * For a product whose sign-in is passwordless but which still has to let one
13
+ * known account in — a store reviewer, a support login — password fields on
14
+ * the front of the card advertise a route almost no visitor can take. Behind
15
+ * a line of text they stay reachable by anyone told to look for them, and
16
+ * invisible to everyone else. Omit it and the fields render as usual.
17
+ */
18
+ credentialsDisclosureLabel?: string;
19
+ isLoading: boolean;
20
+ error: string | null;
21
+ onSwitchToSignUp?: () => void;
22
+ onSwitchToReset?: () => void;
23
+ /** Offers the passwordless route. Hidden when the host has not wired one. */
24
+ onSwitchToMagicLink?: () => void;
25
+ /** Offers the emailed-code route. Hidden when the host has not wired one. */
26
+ onSwitchToEmailOtp?: () => void;
27
+ }
28
+ declare function SignInForm({
29
+ onSignIn,
30
+ credentialsDisclosureLabel,
31
+ onGoogleSignIn,
32
+ onLinkedInSignIn,
33
+ isLoading,
34
+ error,
35
+ onSwitchToSignUp,
36
+ onSwitchToReset,
37
+ onSwitchToMagicLink,
38
+ onSwitchToEmailOtp
39
+ }: SignInFormProps): react_jsx_runtime18.JSX.Element;
40
+ //#endregion
41
+ export { SignInForm, SignInFormProps };