@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,35 @@
1
+ 'use client';
2
+
3
+
4
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
5
+ let react = require("react");
6
+ react = require_rolldown_runtime.__toESM(react);
7
+
8
+ //#region src/hooks/use-reset-on-page-restore.ts
9
+ /**
10
+ * Runs `onRestore` when the browser shows this page again from its
11
+ * back/forward cache.
12
+ *
13
+ * OAuth leaves the page mid-flight: the provider URL is cross-origin, so the
14
+ * button is still spinning when the browser navigates away. Coming back with
15
+ * the Back button restores the document — React state included — exactly as it
16
+ * was left, and the spinner keeps running over a page that is no longer doing
17
+ * anything. A page that reloads instead starts from fresh state and needs
18
+ * nothing; only the restored one does.
19
+ */
20
+ function useResetOnPageRestore(onRestore) {
21
+ const onRestoreRef = (0, react.useRef)(onRestore);
22
+ (0, react.useEffect)(() => {
23
+ onRestoreRef.current = onRestore;
24
+ }, [onRestore]);
25
+ (0, react.useEffect)(() => {
26
+ const handlePageShow = (event) => {
27
+ if (event.persisted) onRestoreRef.current();
28
+ };
29
+ window.addEventListener("pageshow", handlePageShow);
30
+ return () => window.removeEventListener("pageshow", handlePageShow);
31
+ }, []);
32
+ }
33
+
34
+ //#endregion
35
+ exports.useResetOnPageRestore = useResetOnPageRestore;
@@ -0,0 +1,15 @@
1
+ //#region src/hooks/use-reset-on-page-restore.d.ts
2
+ /**
3
+ * Runs `onRestore` when the browser shows this page again from its
4
+ * back/forward cache.
5
+ *
6
+ * OAuth leaves the page mid-flight: the provider URL is cross-origin, so the
7
+ * button is still spinning when the browser navigates away. Coming back with
8
+ * the Back button restores the document — React state included — exactly as it
9
+ * was left, and the spinner keeps running over a page that is no longer doing
10
+ * anything. A page that reloads instead starts from fresh state and needs
11
+ * nothing; only the restored one does.
12
+ */
13
+ declare function useResetOnPageRestore(onRestore: () => void): void;
14
+ //#endregion
15
+ export { useResetOnPageRestore };
@@ -0,0 +1,15 @@
1
+ //#region src/hooks/use-reset-on-page-restore.d.ts
2
+ /**
3
+ * Runs `onRestore` when the browser shows this page again from its
4
+ * back/forward cache.
5
+ *
6
+ * OAuth leaves the page mid-flight: the provider URL is cross-origin, so the
7
+ * button is still spinning when the browser navigates away. Coming back with
8
+ * the Back button restores the document — React state included — exactly as it
9
+ * was left, and the spinner keeps running over a page that is no longer doing
10
+ * anything. A page that reloads instead starts from fresh state and needs
11
+ * nothing; only the restored one does.
12
+ */
13
+ declare function useResetOnPageRestore(onRestore: () => void): void;
14
+ //#endregion
15
+ export { useResetOnPageRestore };
@@ -0,0 +1,33 @@
1
+ 'use client';
2
+
3
+
4
+ import { useEffect, useRef } from "react";
5
+
6
+ //#region src/hooks/use-reset-on-page-restore.ts
7
+ /**
8
+ * Runs `onRestore` when the browser shows this page again from its
9
+ * back/forward cache.
10
+ *
11
+ * OAuth leaves the page mid-flight: the provider URL is cross-origin, so the
12
+ * button is still spinning when the browser navigates away. Coming back with
13
+ * the Back button restores the document — React state included — exactly as it
14
+ * was left, and the spinner keeps running over a page that is no longer doing
15
+ * anything. A page that reloads instead starts from fresh state and needs
16
+ * nothing; only the restored one does.
17
+ */
18
+ function useResetOnPageRestore(onRestore) {
19
+ const onRestoreRef = useRef(onRestore);
20
+ useEffect(() => {
21
+ onRestoreRef.current = onRestore;
22
+ }, [onRestore]);
23
+ useEffect(() => {
24
+ const handlePageShow = (event) => {
25
+ if (event.persisted) onRestoreRef.current();
26
+ };
27
+ window.addEventListener("pageshow", handlePageShow);
28
+ return () => window.removeEventListener("pageshow", handlePageShow);
29
+ }, []);
30
+ }
31
+
32
+ //#endregion
33
+ export { useResetOnPageRestore };
package/dist/index.cjs CHANGED
@@ -1,11 +1,71 @@
1
- const require_ResetPasswordForm = require('./ResetPasswordForm.cjs');
2
- const require_GoogleSignIn = require('./GoogleSignIn.cjs');
3
- const require_SignInForm = require('./SignInForm.cjs');
4
- const require_SignUpForm = require('./SignUpForm.cjs');
5
- const require_AuthForms = require('./AuthForms.cjs');
1
+ const require_use_pending_action = require('./hooks/use-pending-action.cjs');
2
+ const require_use_reset_on_page_restore = require('./hooks/use-reset-on-page-restore.cjs');
3
+ const require_auth_pending_context = require('./components/auth-pending/auth-pending-context.cjs');
4
+ const require_AuthButton = require('./components/auth-pending/AuthButton.cjs');
5
+ const require_AuthPendingProvider = require('./components/auth-pending/AuthPendingProvider.cjs');
6
+ const require_AuthCard = require('./components/AuthCard.cjs');
7
+ const require_validation = require('./constants/validation.cjs');
8
+ const require_AuthField = require('./components/forms/AuthField.cjs');
9
+ const require_EmailOtpCodeForm = require('./components/forms/EmailOtpCodeForm.cjs');
10
+ const require_validate_email = require('./utils/validate-email.cjs');
11
+ const require_LegalNotice = require('./components/LegalNotice.cjs');
12
+ const require_EmailRequestForm = require('./components/forms/EmailRequestForm.cjs');
13
+ const require_auth_providers = require('./constants/auth-providers.cjs');
14
+ const require_ProviderIcon = require('./components/provider-icon/ProviderIcon.cjs');
15
+ const require_ProviderSignInButtons = require('./components/ProviderSignInButtons.cjs');
16
+ const require_EmailOtpForm = require('./components/EmailOtpForm.cjs');
17
+ const require_MagicLinkForm = require('./components/MagicLinkForm.cjs');
18
+ const require_ResetPasswordForm = require('./components/ResetPasswordForm.cjs');
19
+ const require_validate_password = require('./utils/validate-password.cjs');
20
+ const require_SignInCredentialsForm = require('./components/forms/SignInCredentialsForm.cjs');
21
+ const require_SignInForm = require('./components/SignInForm.cjs');
22
+ const require_SignUpCredentialsForm = require('./components/forms/SignUpCredentialsForm.cjs');
23
+ const require_SignUpForm = require('./components/SignUpForm.cjs');
24
+ const require_AuthForms = require('./components/AuthForms.cjs');
25
+ const require_CompleteProfileFields = require('./components/forms/CompleteProfileFields.cjs');
26
+ const require_CompleteProfileForm = require('./components/CompleteProfileForm.cjs');
27
+ const require_sign_in_methods_copy = require('./components/sign-in-methods/sign-in-methods-copy.cjs');
28
+ const require_SignInMethodRow = require('./components/sign-in-methods/SignInMethodRow.cjs');
29
+ const require_build_sign_in_method_rows = require('./utils/build-sign-in-method-rows.cjs');
30
+ const require_SignInMethodsList = require('./components/sign-in-methods/SignInMethodsList.cjs');
31
+ const require_SignInMethods = require('./components/sign-in-methods/SignInMethods.cjs');
32
+ const require_until_navigation = require('./utils/until-navigation.cjs');
6
33
 
34
+ exports.AUTH_PROVIDER_LABELS = require_auth_providers.AUTH_PROVIDER_LABELS;
35
+ exports.AUTH_SUBMIT_ACTION = require_auth_pending_context.AUTH_SUBMIT_ACTION;
36
+ exports.AuthButton = require_AuthButton.AuthButton;
37
+ exports.AuthCard = require_AuthCard.AuthCard;
38
+ exports.AuthField = require_AuthField.AuthField;
7
39
  exports.AuthForms = require_AuthForms.AuthForms;
8
- exports.GoogleSignIn = require_GoogleSignIn.GoogleSignIn;
40
+ exports.AuthPendingContext = require_auth_pending_context.AuthPendingContext;
41
+ exports.AuthPendingProvider = require_AuthPendingProvider.AuthPendingProvider;
42
+ exports.CompleteProfileFields = require_CompleteProfileFields.CompleteProfileFields;
43
+ exports.CompleteProfileForm = require_CompleteProfileForm.CompleteProfileForm;
44
+ exports.DEFAULT_MINIMUM_AGE = require_validation.DEFAULT_MINIMUM_AGE;
45
+ exports.EmailOtpCodeForm = require_EmailOtpCodeForm.EmailOtpCodeForm;
46
+ exports.EmailOtpForm = require_EmailOtpForm.EmailOtpForm;
47
+ exports.EmailRequestForm = require_EmailRequestForm.EmailRequestForm;
48
+ exports.LegalNotice = require_LegalNotice.LegalNotice;
49
+ exports.MIN_PASSWORD_LENGTH = require_validation.MIN_PASSWORD_LENGTH;
50
+ exports.MagicLinkForm = require_MagicLinkForm.MagicLinkForm;
51
+ exports.OTP_LENGTH = require_validation.OTP_LENGTH;
52
+ exports.ProviderIcon = require_ProviderIcon.ProviderIcon;
53
+ exports.ProviderSignInButtons = require_ProviderSignInButtons.ProviderSignInButtons;
9
54
  exports.ResetPasswordForm = require_ResetPasswordForm.ResetPasswordForm;
55
+ exports.SIGN_IN_METHODS_COPY = require_sign_in_methods_copy.SIGN_IN_METHODS_COPY;
56
+ exports.SignInCredentialsForm = require_SignInCredentialsForm.SignInCredentialsForm;
10
57
  exports.SignInForm = require_SignInForm.SignInForm;
11
- exports.SignUpForm = require_SignUpForm.SignUpForm;
58
+ exports.SignInMethodRow = require_SignInMethodRow.SignInMethodRow;
59
+ exports.SignInMethods = require_SignInMethods.SignInMethods;
60
+ exports.SignInMethodsList = require_SignInMethodsList.SignInMethodsList;
61
+ exports.SignUpCredentialsForm = require_SignUpCredentialsForm.SignUpCredentialsForm;
62
+ exports.SignUpForm = require_SignUpForm.SignUpForm;
63
+ exports.buildSignInMethodRows = require_build_sign_in_method_rows.buildSignInMethodRows;
64
+ exports.describeAuthProvider = require_auth_providers.describeAuthProvider;
65
+ exports.untilNavigation = require_until_navigation.untilNavigation;
66
+ exports.useAuthPending = require_auth_pending_context.useAuthPending;
67
+ exports.useAuthPendingState = require_auth_pending_context.useAuthPendingState;
68
+ exports.usePendingAction = require_use_pending_action.usePendingAction;
69
+ exports.useResetOnPageRestore = require_use_reset_on_page_restore.useResetOnPageRestore;
70
+ exports.validateEmailValue = require_validate_email.validateEmailValue;
71
+ exports.validatePasswordValue = require_validate_password.validatePasswordValue;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,34 @@
1
- import { AuthForms } from "./AuthForms.cjs";
2
- import { GoogleSignIn, GoogleSignInProps } from "./GoogleSignIn.cjs";
3
- import { ResetPasswordForm } from "./ResetPasswordForm.cjs";
4
- import { SignInForm } from "./SignInForm.cjs";
5
- import { SignUpForm } from "./SignUpForm.cjs";
6
- export { AuthForms, GoogleSignIn, GoogleSignInProps, ResetPasswordForm, SignInForm, SignUpForm };
1
+ import { AUTH_SUBMIT_ACTION, AuthPendingContext, AuthPendingValue, useAuthPending, useAuthPendingState } from "./components/auth-pending/auth-pending-context.cjs";
2
+ import { AuthButton, AuthButtonProps } from "./components/auth-pending/AuthButton.cjs";
3
+ import { AuthPendingProvider, AuthPendingProviderProps } from "./components/auth-pending/AuthPendingProvider.cjs";
4
+ import { AuthCard, AuthCardProps } from "./components/AuthCard.cjs";
5
+ import { ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers } from "./components/ProviderSignInButtons.cjs";
6
+ import { AuthForms, AuthFormsProps, AuthMode } from "./components/AuthForms.cjs";
7
+ import { CompleteProfileForm, CompleteProfileFormProps } from "./components/CompleteProfileForm.cjs";
8
+ import { EmailOtpForm, EmailOtpFormProps } from "./components/EmailOtpForm.cjs";
9
+ import { AuthField, AuthFieldProps } from "./components/forms/AuthField.cjs";
10
+ import { CompleteProfileFields, CompleteProfileFieldsProps } from "./components/forms/CompleteProfileFields.cjs";
11
+ import { EmailOtpCodeForm, EmailOtpCodeFormProps } from "./components/forms/EmailOtpCodeForm.cjs";
12
+ import { EmailRequestForm, EmailRequestFormProps } from "./components/forms/EmailRequestForm.cjs";
13
+ import { SignInCredentialsForm, SignInCredentialsFormProps } from "./components/forms/SignInCredentialsForm.cjs";
14
+ import { SignUpCredentialsForm, SignUpCredentialsFormProps } from "./components/forms/SignUpCredentialsForm.cjs";
15
+ import { LegalNotice, LegalNoticeProps } from "./components/LegalNotice.cjs";
16
+ import { MagicLinkForm, MagicLinkFormProps } from "./components/MagicLinkForm.cjs";
17
+ import { ProviderIcon, ProviderIconProps } from "./components/provider-icon/ProviderIcon.cjs";
18
+ import { ResetPasswordForm, ResetPasswordFormProps } from "./components/ResetPasswordForm.cjs";
19
+ import { SIGN_IN_METHODS_COPY } from "./components/sign-in-methods/sign-in-methods-copy.cjs";
20
+ import { SignInMethodRow, SignInMethodRowProps } from "./components/sign-in-methods/SignInMethodRow.cjs";
21
+ import { SignInMethodIdentity, SignInMethodRowModel, buildSignInMethodRows } from "./utils/build-sign-in-method-rows.cjs";
22
+ import { SignInMethodsList, SignInMethodsListProps } from "./components/sign-in-methods/SignInMethodsList.cjs";
23
+ import { SignInMethods, SignInMethodsProps } from "./components/sign-in-methods/SignInMethods.cjs";
24
+ import { SignInForm, SignInFormProps } from "./components/SignInForm.cjs";
25
+ import { SignUpForm, SignUpFormProps } from "./components/SignUpForm.cjs";
26
+ import "./components/index.cjs";
27
+ import { AUTH_PROVIDER_LABELS, describeAuthProvider } from "./constants/auth-providers.cjs";
28
+ import { DEFAULT_MINIMUM_AGE, MIN_PASSWORD_LENGTH, OTP_LENGTH } from "./constants/validation.cjs";
29
+ import { PendingAction, usePendingAction } from "./hooks/use-pending-action.cjs";
30
+ import { useResetOnPageRestore } from "./hooks/use-reset-on-page-restore.cjs";
31
+ import { untilNavigation } from "./utils/until-navigation.cjs";
32
+ import { validateEmailValue } from "./utils/validate-email.cjs";
33
+ import { validatePasswordValue } from "./utils/validate-password.cjs";
34
+ export { AUTH_PROVIDER_LABELS, AUTH_SUBMIT_ACTION, AuthButton, AuthButtonProps, AuthCard, AuthCardProps, AuthField, AuthFieldProps, AuthForms, AuthFormsProps, AuthMode, AuthPendingContext, AuthPendingProvider, AuthPendingProviderProps, AuthPendingValue, CompleteProfileFields, CompleteProfileFieldsProps, CompleteProfileForm, CompleteProfileFormProps, DEFAULT_MINIMUM_AGE, EmailOtpCodeForm, EmailOtpCodeFormProps, EmailOtpForm, EmailOtpFormProps, EmailRequestForm, EmailRequestFormProps, LegalNotice, LegalNoticeProps, MIN_PASSWORD_LENGTH, MagicLinkForm, MagicLinkFormProps, OTP_LENGTH, PendingAction, ProviderIcon, ProviderIconProps, ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers, ResetPasswordForm, ResetPasswordFormProps, SIGN_IN_METHODS_COPY, SignInCredentialsForm, SignInCredentialsFormProps, SignInForm, SignInFormProps, SignInMethodIdentity, SignInMethodRow, SignInMethodRowModel, SignInMethodRowProps, SignInMethods, SignInMethodsList, SignInMethodsListProps, SignInMethodsProps, SignUpCredentialsForm, SignUpCredentialsFormProps, SignUpForm, SignUpFormProps, buildSignInMethodRows, describeAuthProvider, untilNavigation, useAuthPending, useAuthPendingState, usePendingAction, useResetOnPageRestore, validateEmailValue, validatePasswordValue };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,34 @@
1
- import { AuthForms } from "./AuthForms.js";
2
- import { GoogleSignIn, GoogleSignInProps } from "./GoogleSignIn.js";
3
- import { ResetPasswordForm } from "./ResetPasswordForm.js";
4
- import { SignInForm } from "./SignInForm.js";
5
- import { SignUpForm } from "./SignUpForm.js";
6
- export { AuthForms, GoogleSignIn, GoogleSignInProps, ResetPasswordForm, SignInForm, SignUpForm };
1
+ import { AUTH_SUBMIT_ACTION, AuthPendingContext, AuthPendingValue, useAuthPending, useAuthPendingState } from "./components/auth-pending/auth-pending-context.js";
2
+ import { AuthButton, AuthButtonProps } from "./components/auth-pending/AuthButton.js";
3
+ import { AuthPendingProvider, AuthPendingProviderProps } from "./components/auth-pending/AuthPendingProvider.js";
4
+ import { AuthCard, AuthCardProps } from "./components/AuthCard.js";
5
+ import { ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers } from "./components/ProviderSignInButtons.js";
6
+ import { AuthForms, AuthFormsProps, AuthMode } from "./components/AuthForms.js";
7
+ import { CompleteProfileForm, CompleteProfileFormProps } from "./components/CompleteProfileForm.js";
8
+ import { EmailOtpForm, EmailOtpFormProps } from "./components/EmailOtpForm.js";
9
+ import { AuthField, AuthFieldProps } from "./components/forms/AuthField.js";
10
+ import { CompleteProfileFields, CompleteProfileFieldsProps } from "./components/forms/CompleteProfileFields.js";
11
+ import { EmailOtpCodeForm, EmailOtpCodeFormProps } from "./components/forms/EmailOtpCodeForm.js";
12
+ import { EmailRequestForm, EmailRequestFormProps } from "./components/forms/EmailRequestForm.js";
13
+ import { SignInCredentialsForm, SignInCredentialsFormProps } from "./components/forms/SignInCredentialsForm.js";
14
+ import { SignUpCredentialsForm, SignUpCredentialsFormProps } from "./components/forms/SignUpCredentialsForm.js";
15
+ import { LegalNotice, LegalNoticeProps } from "./components/LegalNotice.js";
16
+ import { MagicLinkForm, MagicLinkFormProps } from "./components/MagicLinkForm.js";
17
+ import { ProviderIcon, ProviderIconProps } from "./components/provider-icon/ProviderIcon.js";
18
+ import { ResetPasswordForm, ResetPasswordFormProps } from "./components/ResetPasswordForm.js";
19
+ import { SIGN_IN_METHODS_COPY } from "./components/sign-in-methods/sign-in-methods-copy.js";
20
+ import { SignInMethodRow, SignInMethodRowProps } from "./components/sign-in-methods/SignInMethodRow.js";
21
+ import { SignInMethodIdentity, SignInMethodRowModel, buildSignInMethodRows } from "./utils/build-sign-in-method-rows.js";
22
+ import { SignInMethodsList, SignInMethodsListProps } from "./components/sign-in-methods/SignInMethodsList.js";
23
+ import { SignInMethods, SignInMethodsProps } from "./components/sign-in-methods/SignInMethods.js";
24
+ import { SignInForm, SignInFormProps } from "./components/SignInForm.js";
25
+ import { SignUpForm, SignUpFormProps } from "./components/SignUpForm.js";
26
+ import "./components/index.js";
27
+ import { AUTH_PROVIDER_LABELS, describeAuthProvider } from "./constants/auth-providers.js";
28
+ import { DEFAULT_MINIMUM_AGE, MIN_PASSWORD_LENGTH, OTP_LENGTH } from "./constants/validation.js";
29
+ import { PendingAction, usePendingAction } from "./hooks/use-pending-action.js";
30
+ import { useResetOnPageRestore } from "./hooks/use-reset-on-page-restore.js";
31
+ import { untilNavigation } from "./utils/until-navigation.js";
32
+ import { validateEmailValue } from "./utils/validate-email.js";
33
+ import { validatePasswordValue } from "./utils/validate-password.js";
34
+ export { AUTH_PROVIDER_LABELS, AUTH_SUBMIT_ACTION, AuthButton, AuthButtonProps, AuthCard, AuthCardProps, AuthField, AuthFieldProps, AuthForms, AuthFormsProps, AuthMode, AuthPendingContext, AuthPendingProvider, AuthPendingProviderProps, AuthPendingValue, CompleteProfileFields, CompleteProfileFieldsProps, CompleteProfileForm, CompleteProfileFormProps, DEFAULT_MINIMUM_AGE, EmailOtpCodeForm, EmailOtpCodeFormProps, EmailOtpForm, EmailOtpFormProps, EmailRequestForm, EmailRequestFormProps, LegalNotice, LegalNoticeProps, MIN_PASSWORD_LENGTH, MagicLinkForm, MagicLinkFormProps, OTP_LENGTH, PendingAction, ProviderIcon, ProviderIconProps, ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers, ResetPasswordForm, ResetPasswordFormProps, SIGN_IN_METHODS_COPY, SignInCredentialsForm, SignInCredentialsFormProps, SignInForm, SignInFormProps, SignInMethodIdentity, SignInMethodRow, SignInMethodRowModel, SignInMethodRowProps, SignInMethods, SignInMethodsList, SignInMethodsListProps, SignInMethodsProps, SignUpCredentialsForm, SignUpCredentialsFormProps, SignUpForm, SignUpFormProps, buildSignInMethodRows, describeAuthProvider, untilNavigation, useAuthPending, useAuthPendingState, usePendingAction, useResetOnPageRestore, validateEmailValue, validatePasswordValue };
package/dist/index.js CHANGED
@@ -1,7 +1,34 @@
1
- import { ResetPasswordForm } from "./ResetPasswordForm.js";
2
- import { GoogleSignIn } from "./GoogleSignIn.js";
3
- import { SignInForm } from "./SignInForm.js";
4
- import { SignUpForm } from "./SignUpForm.js";
5
- import { AuthForms } from "./AuthForms.js";
1
+ import { usePendingAction } from "./hooks/use-pending-action.js";
2
+ import { useResetOnPageRestore } from "./hooks/use-reset-on-page-restore.js";
3
+ import { AUTH_SUBMIT_ACTION, AuthPendingContext, useAuthPending, useAuthPendingState } from "./components/auth-pending/auth-pending-context.js";
4
+ import { AuthButton } from "./components/auth-pending/AuthButton.js";
5
+ import { AuthPendingProvider } from "./components/auth-pending/AuthPendingProvider.js";
6
+ import { AuthCard } from "./components/AuthCard.js";
7
+ import { DEFAULT_MINIMUM_AGE, MIN_PASSWORD_LENGTH, OTP_LENGTH } from "./constants/validation.js";
8
+ import { AuthField } from "./components/forms/AuthField.js";
9
+ import { EmailOtpCodeForm } from "./components/forms/EmailOtpCodeForm.js";
10
+ import { validateEmailValue } from "./utils/validate-email.js";
11
+ import { LegalNotice } from "./components/LegalNotice.js";
12
+ import { EmailRequestForm } from "./components/forms/EmailRequestForm.js";
13
+ import { AUTH_PROVIDER_LABELS, describeAuthProvider } from "./constants/auth-providers.js";
14
+ import { ProviderIcon } from "./components/provider-icon/ProviderIcon.js";
15
+ import { ProviderSignInButtons } from "./components/ProviderSignInButtons.js";
16
+ import { EmailOtpForm } from "./components/EmailOtpForm.js";
17
+ import { MagicLinkForm } from "./components/MagicLinkForm.js";
18
+ import { ResetPasswordForm } from "./components/ResetPasswordForm.js";
19
+ import { validatePasswordValue } from "./utils/validate-password.js";
20
+ import { SignInCredentialsForm } from "./components/forms/SignInCredentialsForm.js";
21
+ import { SignInForm } from "./components/SignInForm.js";
22
+ import { SignUpCredentialsForm } from "./components/forms/SignUpCredentialsForm.js";
23
+ import { SignUpForm } from "./components/SignUpForm.js";
24
+ import { AuthForms } from "./components/AuthForms.js";
25
+ import { CompleteProfileFields } from "./components/forms/CompleteProfileFields.js";
26
+ import { CompleteProfileForm } from "./components/CompleteProfileForm.js";
27
+ import { SIGN_IN_METHODS_COPY } from "./components/sign-in-methods/sign-in-methods-copy.js";
28
+ import { SignInMethodRow } from "./components/sign-in-methods/SignInMethodRow.js";
29
+ import { buildSignInMethodRows } from "./utils/build-sign-in-method-rows.js";
30
+ import { SignInMethodsList } from "./components/sign-in-methods/SignInMethodsList.js";
31
+ import { SignInMethods } from "./components/sign-in-methods/SignInMethods.js";
32
+ import { untilNavigation } from "./utils/until-navigation.js";
6
33
 
7
- export { AuthForms, GoogleSignIn, ResetPasswordForm, SignInForm, SignUpForm };
34
+ export { AUTH_PROVIDER_LABELS, AUTH_SUBMIT_ACTION, AuthButton, AuthCard, AuthField, AuthForms, AuthPendingContext, AuthPendingProvider, CompleteProfileFields, CompleteProfileForm, DEFAULT_MINIMUM_AGE, EmailOtpCodeForm, EmailOtpForm, EmailRequestForm, LegalNotice, MIN_PASSWORD_LENGTH, MagicLinkForm, OTP_LENGTH, ProviderIcon, ProviderSignInButtons, ResetPasswordForm, SIGN_IN_METHODS_COPY, SignInCredentialsForm, SignInForm, SignInMethodRow, SignInMethods, SignInMethodsList, SignUpCredentialsForm, SignUpForm, buildSignInMethodRows, describeAuthProvider, untilNavigation, useAuthPending, useAuthPendingState, usePendingAction, useResetOnPageRestore, validateEmailValue, validatePasswordValue };
@@ -0,0 +1,25 @@
1
+
2
+ //#region src/utils/build-sign-in-method-rows.ts
3
+ /**
4
+ * Merges what the account already has with what it could add.
5
+ *
6
+ * Connected methods come first, in the order Supabase returned them, so the
7
+ * list reads as "here is what you have" before "here is what you could add".
8
+ * Offering a provider that is already linked is the one thing this must not do
9
+ * — a second link attempt only ever ends in `identity_already_exists`.
10
+ */
11
+ function buildSignInMethodRows(identities, linkableProviders) {
12
+ const linked = new Set(identities.map((identity) => identity.provider));
13
+ return [...identities.map((identity) => ({
14
+ provider: identity.provider,
15
+ email: identity.email,
16
+ isConnected: true
17
+ })), ...linkableProviders.filter((provider) => !linked.has(provider)).map((provider) => ({
18
+ provider,
19
+ email: null,
20
+ isConnected: false
21
+ }))];
22
+ }
23
+
24
+ //#endregion
25
+ exports.buildSignInMethodRows = buildSignInMethodRows;
@@ -0,0 +1,26 @@
1
+ //#region src/utils/build-sign-in-method-rows.d.ts
2
+ /** Identity fields the sign-in methods UI needs from any auth provider. */
3
+ interface SignInMethodIdentity {
4
+ provider: string;
5
+ email: string | null;
6
+ }
7
+ /** One row of the sign-in-methods list, already resolved for rendering. */
8
+ interface SignInMethodRowModel {
9
+ /** Supabase provider key, e.g. `'google'`. */
10
+ provider: string;
11
+ /** Address the provider supplied, when it supplied one. */
12
+ email: string | null;
13
+ /** Whether the provider is attached to the account today. */
14
+ isConnected: boolean;
15
+ }
16
+ /**
17
+ * Merges what the account already has with what it could add.
18
+ *
19
+ * Connected methods come first, in the order Supabase returned them, so the
20
+ * list reads as "here is what you have" before "here is what you could add".
21
+ * Offering a provider that is already linked is the one thing this must not do
22
+ * — a second link attempt only ever ends in `identity_already_exists`.
23
+ */
24
+ declare function buildSignInMethodRows(identities: readonly SignInMethodIdentity[], linkableProviders: readonly string[]): SignInMethodRowModel[];
25
+ //#endregion
26
+ export { SignInMethodIdentity, SignInMethodRowModel, buildSignInMethodRows };
@@ -0,0 +1,26 @@
1
+ //#region src/utils/build-sign-in-method-rows.d.ts
2
+ /** Identity fields the sign-in methods UI needs from any auth provider. */
3
+ interface SignInMethodIdentity {
4
+ provider: string;
5
+ email: string | null;
6
+ }
7
+ /** One row of the sign-in-methods list, already resolved for rendering. */
8
+ interface SignInMethodRowModel {
9
+ /** Supabase provider key, e.g. `'google'`. */
10
+ provider: string;
11
+ /** Address the provider supplied, when it supplied one. */
12
+ email: string | null;
13
+ /** Whether the provider is attached to the account today. */
14
+ isConnected: boolean;
15
+ }
16
+ /**
17
+ * Merges what the account already has with what it could add.
18
+ *
19
+ * Connected methods come first, in the order Supabase returned them, so the
20
+ * list reads as "here is what you have" before "here is what you could add".
21
+ * Offering a provider that is already linked is the one thing this must not do
22
+ * — a second link attempt only ever ends in `identity_already_exists`.
23
+ */
24
+ declare function buildSignInMethodRows(identities: readonly SignInMethodIdentity[], linkableProviders: readonly string[]): SignInMethodRowModel[];
25
+ //#endregion
26
+ export { SignInMethodIdentity, SignInMethodRowModel, buildSignInMethodRows };
@@ -0,0 +1,24 @@
1
+ //#region src/utils/build-sign-in-method-rows.ts
2
+ /**
3
+ * Merges what the account already has with what it could add.
4
+ *
5
+ * Connected methods come first, in the order Supabase returned them, so the
6
+ * list reads as "here is what you have" before "here is what you could add".
7
+ * Offering a provider that is already linked is the one thing this must not do
8
+ * — a second link attempt only ever ends in `identity_already_exists`.
9
+ */
10
+ function buildSignInMethodRows(identities, linkableProviders) {
11
+ const linked = new Set(identities.map((identity) => identity.provider));
12
+ return [...identities.map((identity) => ({
13
+ provider: identity.provider,
14
+ email: identity.email,
15
+ isConnected: true
16
+ })), ...linkableProviders.filter((provider) => !linked.has(provider)).map((provider) => ({
17
+ provider,
18
+ email: null,
19
+ isConnected: false
20
+ }))];
21
+ }
22
+
23
+ //#endregion
24
+ export { buildSignInMethodRows };
@@ -0,0 +1,22 @@
1
+
2
+ //#region src/utils/until-navigation.ts
3
+ /**
4
+ * A promise that never settles, for the moment after a redirect has been handed
5
+ * to the router.
6
+ *
7
+ * The work succeeded, but this page is on its way out — and a handler that
8
+ * resolves here tells the form the opposite: its submit button stops spinning
9
+ * and its fields unlock for the frame or two before the new page paints, which
10
+ * reads as the click having done nothing. Leaving the promise open holds the
11
+ * form in its submitting state until the navigation takes the page with it.
12
+ *
13
+ * Nothing is leaked: the pending promise dies with the document, and a user who
14
+ * comes back with the Back button gets a restored page whose forms reset
15
+ * themselves on `pageshow`.
16
+ */
17
+ async function untilNavigation() {
18
+ return new Promise(() => {});
19
+ }
20
+
21
+ //#endregion
22
+ exports.untilNavigation = untilNavigation;
@@ -0,0 +1,18 @@
1
+ //#region src/utils/until-navigation.d.ts
2
+ /**
3
+ * A promise that never settles, for the moment after a redirect has been handed
4
+ * to the router.
5
+ *
6
+ * The work succeeded, but this page is on its way out — and a handler that
7
+ * resolves here tells the form the opposite: its submit button stops spinning
8
+ * and its fields unlock for the frame or two before the new page paints, which
9
+ * reads as the click having done nothing. Leaving the promise open holds the
10
+ * form in its submitting state until the navigation takes the page with it.
11
+ *
12
+ * Nothing is leaked: the pending promise dies with the document, and a user who
13
+ * comes back with the Back button gets a restored page whose forms reset
14
+ * themselves on `pageshow`.
15
+ */
16
+ declare function untilNavigation(): Promise<never>;
17
+ //#endregion
18
+ export { untilNavigation };
@@ -0,0 +1,18 @@
1
+ //#region src/utils/until-navigation.d.ts
2
+ /**
3
+ * A promise that never settles, for the moment after a redirect has been handed
4
+ * to the router.
5
+ *
6
+ * The work succeeded, but this page is on its way out — and a handler that
7
+ * resolves here tells the form the opposite: its submit button stops spinning
8
+ * and its fields unlock for the frame or two before the new page paints, which
9
+ * reads as the click having done nothing. Leaving the promise open holds the
10
+ * form in its submitting state until the navigation takes the page with it.
11
+ *
12
+ * Nothing is leaked: the pending promise dies with the document, and a user who
13
+ * comes back with the Back button gets a restored page whose forms reset
14
+ * themselves on `pageshow`.
15
+ */
16
+ declare function untilNavigation(): Promise<never>;
17
+ //#endregion
18
+ export { untilNavigation };
@@ -0,0 +1,21 @@
1
+ //#region src/utils/until-navigation.ts
2
+ /**
3
+ * A promise that never settles, for the moment after a redirect has been handed
4
+ * to the router.
5
+ *
6
+ * The work succeeded, but this page is on its way out — and a handler that
7
+ * resolves here tells the form the opposite: its submit button stops spinning
8
+ * and its fields unlock for the frame or two before the new page paints, which
9
+ * reads as the click having done nothing. Leaving the promise open holds the
10
+ * form in its submitting state until the navigation takes the page with it.
11
+ *
12
+ * Nothing is leaked: the pending promise dies with the document, and a user who
13
+ * comes back with the Back button gets a restored page whose forms reset
14
+ * themselves on `pageshow`.
15
+ */
16
+ async function untilNavigation() {
17
+ return new Promise(() => {});
18
+ }
19
+
20
+ //#endregion
21
+ export { untilNavigation };
@@ -0,0 +1,22 @@
1
+
2
+ //#region src/utils/validate-email.ts
3
+ /**
4
+ * Validates an email the way the browser already does.
5
+ *
6
+ * Deliberately not a regex: every hand-rolled email pattern is wrong at the
7
+ * edges, and the platform ships the exact validator the `type="email"` input
8
+ * will apply anyway. This just borrows it so the form can show a message
9
+ * before submit instead of relying on the native bubble.
10
+ *
11
+ * @returns An error message, or `null` when the value is acceptable.
12
+ */
13
+ function validateEmailValue(value) {
14
+ if (value.trim().length === 0) return "Email is required";
15
+ const input = document.createElement("input");
16
+ input.type = "email";
17
+ input.value = value;
18
+ return input.validity.valid ? null : "Please enter a valid email address";
19
+ }
20
+
21
+ //#endregion
22
+ exports.validateEmailValue = validateEmailValue;
@@ -0,0 +1,14 @@
1
+ //#region src/utils/validate-email.d.ts
2
+ /**
3
+ * Validates an email the way the browser already does.
4
+ *
5
+ * Deliberately not a regex: every hand-rolled email pattern is wrong at the
6
+ * edges, and the platform ships the exact validator the `type="email"` input
7
+ * will apply anyway. This just borrows it so the form can show a message
8
+ * before submit instead of relying on the native bubble.
9
+ *
10
+ * @returns An error message, or `null` when the value is acceptable.
11
+ */
12
+ declare function validateEmailValue(value: string): string | null;
13
+ //#endregion
14
+ export { validateEmailValue };
@@ -0,0 +1,14 @@
1
+ //#region src/utils/validate-email.d.ts
2
+ /**
3
+ * Validates an email the way the browser already does.
4
+ *
5
+ * Deliberately not a regex: every hand-rolled email pattern is wrong at the
6
+ * edges, and the platform ships the exact validator the `type="email"` input
7
+ * will apply anyway. This just borrows it so the form can show a message
8
+ * before submit instead of relying on the native bubble.
9
+ *
10
+ * @returns An error message, or `null` when the value is acceptable.
11
+ */
12
+ declare function validateEmailValue(value: string): string | null;
13
+ //#endregion
14
+ export { validateEmailValue };
@@ -0,0 +1,21 @@
1
+ //#region src/utils/validate-email.ts
2
+ /**
3
+ * Validates an email the way the browser already does.
4
+ *
5
+ * Deliberately not a regex: every hand-rolled email pattern is wrong at the
6
+ * edges, and the platform ships the exact validator the `type="email"` input
7
+ * will apply anyway. This just borrows it so the form can show a message
8
+ * before submit instead of relying on the native bubble.
9
+ *
10
+ * @returns An error message, or `null` when the value is acceptable.
11
+ */
12
+ function validateEmailValue(value) {
13
+ if (value.trim().length === 0) return "Email is required";
14
+ const input = document.createElement("input");
15
+ input.type = "email";
16
+ input.value = value;
17
+ return input.validity.valid ? null : "Please enter a valid email address";
18
+ }
19
+
20
+ //#endregion
21
+ export { validateEmailValue };
@@ -0,0 +1,16 @@
1
+ const require_validation = require('../constants/validation.cjs');
2
+
3
+ //#region src/utils/validate-password.ts
4
+ /**
5
+ * Validates a password field against the rules both credential forms share.
6
+ *
7
+ * @returns An error message, or `null` when the value is acceptable.
8
+ */
9
+ function validatePasswordValue(value) {
10
+ if (!value.trim()) return "Password is required";
11
+ if (value.length < require_validation.MIN_PASSWORD_LENGTH) return `Password must be at least ${require_validation.MIN_PASSWORD_LENGTH} characters long`;
12
+ return null;
13
+ }
14
+
15
+ //#endregion
16
+ exports.validatePasswordValue = validatePasswordValue;
@@ -0,0 +1,9 @@
1
+ //#region src/utils/validate-password.d.ts
2
+ /**
3
+ * Validates a password field against the rules both credential forms share.
4
+ *
5
+ * @returns An error message, or `null` when the value is acceptable.
6
+ */
7
+ declare function validatePasswordValue(value: string): string | null;
8
+ //#endregion
9
+ export { validatePasswordValue };
@@ -0,0 +1,9 @@
1
+ //#region src/utils/validate-password.d.ts
2
+ /**
3
+ * Validates a password field against the rules both credential forms share.
4
+ *
5
+ * @returns An error message, or `null` when the value is acceptable.
6
+ */
7
+ declare function validatePasswordValue(value: string): string | null;
8
+ //#endregion
9
+ export { validatePasswordValue };