@wordrhyme/shadcn-auth 1.0.60 → 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 +16 -9
  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,16 @@
1
+ import { MIN_PASSWORD_LENGTH } from "../constants/validation.js";
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 < MIN_PASSWORD_LENGTH) return `Password must be at least ${MIN_PASSWORD_LENGTH} characters long`;
12
+ return null;
13
+ }
14
+
15
+ //#endregion
16
+ export { validatePasswordValue };
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@wordrhyme/shadcn-auth",
3
3
  "type": "module",
4
- "version": "1.0.60",
4
+ "version": "2.0.2",
5
5
  "description": "Authentication forms and components built with shadcn/ui.",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/pixpilot/shadcn-components.git",
10
+ "url": "https://github.com/denvey/wordrhyme-components",
11
11
  "directory": "packages/shadcn-auth"
12
12
  },
13
+ "bugs": {
14
+ "url": "https://github.com/denvey/wordrhyme-components/issues"
15
+ },
16
+ "sideEffects": false,
13
17
  "exports": {
14
18
  ".": {
15
19
  "types": "./dist/index.d.ts",
@@ -29,14 +33,17 @@
29
33
  },
30
34
  "dependencies": {
31
35
  "lucide-react": "0.553.0",
32
- "@wordrhyme/shadcn": "1.3.2",
33
- "@wordrhyme/shadcn-ui": "1.32.2"
36
+ "@wordrhyme/shadcn": "2.0.0",
37
+ "@wordrhyme/shadcn-ui": "2.1.0"
34
38
  },
35
39
  "devDependencies": {
36
40
  "@storybook/react": "^8.6.18",
41
+ "@testing-library/jest-dom": "^6.9.1",
42
+ "@testing-library/react": "^16.3.2",
37
43
  "@types/node": "^22.19.17",
38
44
  "@types/react": "^19.2.14",
39
45
  "eslint": "^9.39.4",
46
+ "jsdom": "^27.4.0",
40
47
  "react": "19.2.4",
41
48
  "react-dom": "19.2.4",
42
49
  "tailwindcss": "^4.2.2",
@@ -44,12 +51,15 @@
44
51
  "typescript": "^5.9.3",
45
52
  "typescript-eslint": "^8.58.1",
46
53
  "@internal/eslint-config": "0.3.0",
47
- "@internal/tsconfig": "0.1.0",
48
54
  "@internal/prettier-config": "0.0.1",
55
+ "@internal/tsconfig": "0.1.0",
49
56
  "@internal/tsdown-config": "0.1.0",
50
57
  "@internal/vitest-config": "0.1.0"
51
58
  },
52
59
  "prettier": "@internal/prettier-config",
60
+ "main": "./dist/index.cjs",
61
+ "module": "./dist/index.js",
62
+ "types": "./dist/index.d.ts",
53
63
  "scripts": {
54
64
  "clean": "git clean -xdf .cache .turbo dist",
55
65
  "clean:all": "git clean -xdf .cache .turbo dist node_modules",
@@ -62,8 +72,5 @@
62
72
  "typecheck": "tsc --noEmit",
63
73
  "lint": "eslint",
64
74
  "format": "prettier --check . --ignore-path ../../.gitignore --ignore-path ../../.prettierignore"
65
- },
66
- "main": "./dist/index.cjs",
67
- "module": "./dist/index.js",
68
- "types": "./dist/index.d.ts"
75
+ }
69
76
  }
@@ -1,47 +0,0 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- const require_ResetPasswordForm = require('./ResetPasswordForm.cjs');
3
- const require_SignInForm = require('./SignInForm.cjs');
4
- const require_SignUpForm = require('./SignUpForm.cjs');
5
- let react = require("react");
6
- react = require_rolldown_runtime.__toESM(react);
7
- let react_jsx_runtime = require("react/jsx-runtime");
8
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
9
-
10
- //#region src/AuthForms.tsx
11
- function AuthForms({ handleSignIn, handleSignUp, handleResetPassword, authLoadingState, authErrorData }) {
12
- const [authMode, setAuthMode] = (0, react.useState)("signin");
13
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
14
- className: "flex min-h-screen items-center justify-center p-4",
15
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
16
- className: "w-full max-w-md",
17
- children: [
18
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
19
- className: "mb-6 text-center text-3xl font-bold",
20
- children: "Job Hunter"
21
- }),
22
- authMode === "signin" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SignInForm.SignInForm, {
23
- onSignIn: handleSignIn,
24
- isLoading: authLoadingState.isLoading,
25
- error: authErrorData?.error ?? null,
26
- onSwitchToSignUp: () => setAuthMode("signup"),
27
- onSwitchToReset: () => setAuthMode("reset")
28
- }),
29
- authMode === "signup" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SignUpForm.SignUpForm, {
30
- onSignUp: handleSignUp,
31
- isLoading: authLoadingState.isLoading,
32
- error: authErrorData?.error ?? null,
33
- onSwitchToSignIn: () => setAuthMode("signin")
34
- }),
35
- authMode === "reset" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ResetPasswordForm.ResetPasswordForm, {
36
- onResetPassword: handleResetPassword,
37
- isLoading: authLoadingState.isLoading,
38
- error: authErrorData?.error ?? null,
39
- onSwitchToSignIn: () => setAuthMode("signin")
40
- })
41
- ]
42
- })
43
- });
44
- }
45
-
46
- //#endregion
47
- exports.AuthForms = AuthForms;
@@ -1,23 +0,0 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
-
3
- //#region src/AuthForms.d.ts
4
- interface AuthFormsProps {
5
- handleSignIn: (email: string, password: string) => Promise<void>;
6
- handleSignUp: (email: string, password: string) => Promise<void>;
7
- handleResetPassword: (email: string) => Promise<void>;
8
- authLoadingState: {
9
- isLoading: boolean;
10
- };
11
- authErrorData?: {
12
- error: string;
13
- } | null;
14
- }
15
- declare function AuthForms({
16
- handleSignIn,
17
- handleSignUp,
18
- handleResetPassword,
19
- authLoadingState,
20
- authErrorData
21
- }: AuthFormsProps): react_jsx_runtime2.JSX.Element;
22
- //#endregion
23
- export { AuthForms };
@@ -1,23 +0,0 @@
1
- import * as react_jsx_runtime1 from "react/jsx-runtime";
2
-
3
- //#region src/AuthForms.d.ts
4
- interface AuthFormsProps {
5
- handleSignIn: (email: string, password: string) => Promise<void>;
6
- handleSignUp: (email: string, password: string) => Promise<void>;
7
- handleResetPassword: (email: string) => Promise<void>;
8
- authLoadingState: {
9
- isLoading: boolean;
10
- };
11
- authErrorData?: {
12
- error: string;
13
- } | null;
14
- }
15
- declare function AuthForms({
16
- handleSignIn,
17
- handleSignUp,
18
- handleResetPassword,
19
- authLoadingState,
20
- authErrorData
21
- }: AuthFormsProps): react_jsx_runtime1.JSX.Element;
22
- //#endregion
23
- export { AuthForms };
package/dist/AuthForms.js DELETED
@@ -1,44 +0,0 @@
1
- import { ResetPasswordForm } from "./ResetPasswordForm.js";
2
- import { SignInForm } from "./SignInForm.js";
3
- import { SignUpForm } from "./SignUpForm.js";
4
- import React, { useState } from "react";
5
- import { jsx, jsxs } from "react/jsx-runtime";
6
-
7
- //#region src/AuthForms.tsx
8
- function AuthForms({ handleSignIn, handleSignUp, handleResetPassword, authLoadingState, authErrorData }) {
9
- const [authMode, setAuthMode] = useState("signin");
10
- return /* @__PURE__ */ jsx("div", {
11
- className: "flex min-h-screen items-center justify-center p-4",
12
- children: /* @__PURE__ */ jsxs("div", {
13
- className: "w-full max-w-md",
14
- children: [
15
- /* @__PURE__ */ jsx("h1", {
16
- className: "mb-6 text-center text-3xl font-bold",
17
- children: "Job Hunter"
18
- }),
19
- authMode === "signin" && /* @__PURE__ */ jsx(SignInForm, {
20
- onSignIn: handleSignIn,
21
- isLoading: authLoadingState.isLoading,
22
- error: authErrorData?.error ?? null,
23
- onSwitchToSignUp: () => setAuthMode("signup"),
24
- onSwitchToReset: () => setAuthMode("reset")
25
- }),
26
- authMode === "signup" && /* @__PURE__ */ jsx(SignUpForm, {
27
- onSignUp: handleSignUp,
28
- isLoading: authLoadingState.isLoading,
29
- error: authErrorData?.error ?? null,
30
- onSwitchToSignIn: () => setAuthMode("signin")
31
- }),
32
- authMode === "reset" && /* @__PURE__ */ jsx(ResetPasswordForm, {
33
- onResetPassword: handleResetPassword,
34
- isLoading: authLoadingState.isLoading,
35
- error: authErrorData?.error ?? null,
36
- onSwitchToSignIn: () => setAuthMode("signin")
37
- })
38
- ]
39
- })
40
- });
41
- }
42
-
43
- //#endregion
44
- export { AuthForms };
@@ -1,46 +0,0 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
2
- let react = require("react");
3
- react = require_rolldown_runtime.__toESM(react);
4
- let __wordrhyme_shadcn_ui = require("@wordrhyme/shadcn-ui");
5
- __wordrhyme_shadcn_ui = require_rolldown_runtime.__toESM(__wordrhyme_shadcn_ui);
6
- let react_jsx_runtime = require("react/jsx-runtime");
7
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
8
-
9
- //#region src/GoogleSignIn.tsx
10
- const GoogleSignIn = ({ onGoogleSignIn, isLoading }) => {
11
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn_ui.Button, {
12
- type: "button",
13
- variant: "outline",
14
- className: "w-full",
15
- disabled: isLoading,
16
- onClick: () => {
17
- onGoogleSignIn().catch(console.error);
18
- },
19
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
20
- className: "mr-2 h-4 w-4",
21
- viewBox: "0 0 24 24",
22
- children: [
23
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
24
- fill: "currentColor",
25
- d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
26
- }),
27
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
28
- fill: "currentColor",
29
- d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
30
- }),
31
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
32
- fill: "currentColor",
33
- d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
34
- }),
35
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
36
- fill: "currentColor",
37
- d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
38
- })
39
- ]
40
- }), "Sign in with Google"]
41
- });
42
- };
43
- GoogleSignIn.displayName = "GoogleSignIn";
44
-
45
- //#endregion
46
- exports.GoogleSignIn = GoogleSignIn;
@@ -1,10 +0,0 @@
1
- import React from "react";
2
-
3
- //#region src/GoogleSignIn.d.ts
4
- interface GoogleSignInProps {
5
- onGoogleSignIn: () => Promise<void>;
6
- isLoading?: boolean;
7
- }
8
- declare const GoogleSignIn: React.FC<GoogleSignInProps>;
9
- //#endregion
10
- export { GoogleSignIn, GoogleSignInProps };
@@ -1,10 +0,0 @@
1
- import React from "react";
2
-
3
- //#region src/GoogleSignIn.d.ts
4
- interface GoogleSignInProps {
5
- onGoogleSignIn: () => Promise<void>;
6
- isLoading?: boolean;
7
- }
8
- declare const GoogleSignIn: React.FC<GoogleSignInProps>;
9
- //#endregion
10
- export { GoogleSignIn, GoogleSignInProps };
@@ -1,42 +0,0 @@
1
- import React from "react";
2
- import { Button } from "@wordrhyme/shadcn-ui";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
-
5
- //#region src/GoogleSignIn.tsx
6
- const GoogleSignIn = ({ onGoogleSignIn, isLoading }) => {
7
- return /* @__PURE__ */ jsxs(Button, {
8
- type: "button",
9
- variant: "outline",
10
- className: "w-full",
11
- disabled: isLoading,
12
- onClick: () => {
13
- onGoogleSignIn().catch(console.error);
14
- },
15
- children: [/* @__PURE__ */ jsxs("svg", {
16
- className: "mr-2 h-4 w-4",
17
- viewBox: "0 0 24 24",
18
- children: [
19
- /* @__PURE__ */ jsx("path", {
20
- fill: "currentColor",
21
- d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
22
- }),
23
- /* @__PURE__ */ jsx("path", {
24
- fill: "currentColor",
25
- d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
26
- }),
27
- /* @__PURE__ */ jsx("path", {
28
- fill: "currentColor",
29
- d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
30
- }),
31
- /* @__PURE__ */ jsx("path", {
32
- fill: "currentColor",
33
- d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
34
- })
35
- ]
36
- }), "Sign in with Google"]
37
- });
38
- };
39
- GoogleSignIn.displayName = "GoogleSignIn";
40
-
41
- //#endregion
42
- export { GoogleSignIn };
@@ -1,106 +0,0 @@
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
- let __wordrhyme_shadcn = require("@wordrhyme/shadcn");
8
- __wordrhyme_shadcn = require_rolldown_runtime.__toESM(__wordrhyme_shadcn);
9
- let __wordrhyme_shadcn_ui = require("@wordrhyme/shadcn-ui");
10
- __wordrhyme_shadcn_ui = require_rolldown_runtime.__toESM(__wordrhyme_shadcn_ui);
11
- let lucide_react = require("lucide-react");
12
- lucide_react = require_rolldown_runtime.__toESM(lucide_react);
13
- let react_jsx_runtime = require("react/jsx-runtime");
14
- react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
15
-
16
- //#region src/ResetPasswordForm.tsx
17
- function ResetPasswordForm({ onResetPassword, isLoading, error, onSwitchToSignIn }) {
18
- const [email, setEmail] = (0, react.useState)("");
19
- const [emailError, setEmailError] = (0, react.useState)("");
20
- const validateEmail = (emailValue) => {
21
- if (!emailValue.trim()) {
22
- setEmailError("Email is required");
23
- return false;
24
- }
25
- const input = document.createElement("input");
26
- input.type = "email";
27
- input.value = emailValue;
28
- if (!input.validity.valid) {
29
- setEmailError("Please enter a valid email address");
30
- return false;
31
- }
32
- setEmailError("");
33
- return true;
34
- };
35
- const handleSubmit = (e) => {
36
- e.preventDefault();
37
- if (!validateEmail(email)) return;
38
- onResetPassword(email).catch(console.error);
39
- };
40
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Card, {
41
- className: "mx-auto w-full max-w-md",
42
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.CardContent, {
43
- className: "p-6",
44
- children: [
45
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h2", {
46
- className: "mb-4 text-center text-2xl font-bold",
47
- children: "Reset Password"
48
- }),
49
- error != null && error.trim() !== "" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn_ui.Alert, {
50
- variant: "error",
51
- description: error
52
- }),
53
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("form", {
54
- onSubmit: handleSubmit,
55
- className: "space-y-4",
56
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
57
- className: "space-y-2",
58
- children: [
59
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Label, {
60
- htmlFor: "email",
61
- children: "Email"
62
- }),
63
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Input, {
64
- id: "email",
65
- type: "email",
66
- value: email,
67
- onChange: (e) => {
68
- setEmail(e.target.value);
69
- if (emailError) setEmailError("");
70
- },
71
- disabled: isLoading,
72
- required: true
73
- }),
74
- emailError && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
75
- className: "text-destructive text-sm",
76
- children: emailError
77
- })
78
- ]
79
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn.Button, {
80
- type: "submit",
81
- className: "mt-6 w-full",
82
- disabled: isLoading,
83
- children: [isLoading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isLoading ? "Sending Reset Email..." : "Send Reset Email"]
84
- })]
85
- }),
86
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
87
- className: "mt-4 text-center",
88
- children: onSwitchToSignIn && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
89
- className: "text-sm",
90
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Button, {
91
- variant: "link",
92
- size: "sm",
93
- onClick: onSwitchToSignIn,
94
- disabled: isLoading,
95
- className: "min-w-0 p-0 font-medium",
96
- children: "Back to sign in"
97
- })
98
- })
99
- })
100
- ]
101
- })
102
- });
103
- }
104
-
105
- //#endregion
106
- exports.ResetPasswordForm = ResetPasswordForm;
@@ -1,17 +0,0 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
-
3
- //#region src/ResetPasswordForm.d.ts
4
- interface ResetPasswordFormProps {
5
- onResetPassword: (email: string) => Promise<void>;
6
- isLoading: boolean;
7
- error: string | null;
8
- onSwitchToSignIn?: () => void;
9
- }
10
- declare function ResetPasswordForm({
11
- onResetPassword,
12
- isLoading,
13
- error,
14
- onSwitchToSignIn
15
- }: ResetPasswordFormProps): react_jsx_runtime0.JSX.Element;
16
- //#endregion
17
- export { ResetPasswordForm };
@@ -1,17 +0,0 @@
1
- import * as react_jsx_runtime2 from "react/jsx-runtime";
2
-
3
- //#region src/ResetPasswordForm.d.ts
4
- interface ResetPasswordFormProps {
5
- onResetPassword: (email: string) => Promise<void>;
6
- isLoading: boolean;
7
- error: string | null;
8
- onSwitchToSignIn?: () => void;
9
- }
10
- declare function ResetPasswordForm({
11
- onResetPassword,
12
- isLoading,
13
- error,
14
- onSwitchToSignIn
15
- }: ResetPasswordFormProps): react_jsx_runtime2.JSX.Element;
16
- //#endregion
17
- export { ResetPasswordForm };
@@ -1,100 +0,0 @@
1
- 'use client';
2
-
3
-
4
- import React, { useState } from "react";
5
- import { Button, Card, CardContent, Input, Label } from "@wordrhyme/shadcn";
6
- import { Alert as Alert$1 } from "@wordrhyme/shadcn-ui";
7
- import { Loader2 } from "lucide-react";
8
- import { jsx, jsxs } from "react/jsx-runtime";
9
-
10
- //#region src/ResetPasswordForm.tsx
11
- function ResetPasswordForm({ onResetPassword, isLoading, error, onSwitchToSignIn }) {
12
- const [email, setEmail] = useState("");
13
- const [emailError, setEmailError] = useState("");
14
- const validateEmail = (emailValue) => {
15
- if (!emailValue.trim()) {
16
- setEmailError("Email is required");
17
- return false;
18
- }
19
- const input = document.createElement("input");
20
- input.type = "email";
21
- input.value = emailValue;
22
- if (!input.validity.valid) {
23
- setEmailError("Please enter a valid email address");
24
- return false;
25
- }
26
- setEmailError("");
27
- return true;
28
- };
29
- const handleSubmit = (e) => {
30
- e.preventDefault();
31
- if (!validateEmail(email)) return;
32
- onResetPassword(email).catch(console.error);
33
- };
34
- return /* @__PURE__ */ jsx(Card, {
35
- className: "mx-auto w-full max-w-md",
36
- children: /* @__PURE__ */ jsxs(CardContent, {
37
- className: "p-6",
38
- children: [
39
- /* @__PURE__ */ jsx("h2", {
40
- className: "mb-4 text-center text-2xl font-bold",
41
- children: "Reset Password"
42
- }),
43
- error != null && error.trim() !== "" && /* @__PURE__ */ jsx(Alert$1, {
44
- variant: "error",
45
- description: error
46
- }),
47
- /* @__PURE__ */ jsxs("form", {
48
- onSubmit: handleSubmit,
49
- className: "space-y-4",
50
- children: [/* @__PURE__ */ jsxs("div", {
51
- className: "space-y-2",
52
- children: [
53
- /* @__PURE__ */ jsx(Label, {
54
- htmlFor: "email",
55
- children: "Email"
56
- }),
57
- /* @__PURE__ */ jsx(Input, {
58
- id: "email",
59
- type: "email",
60
- value: email,
61
- onChange: (e) => {
62
- setEmail(e.target.value);
63
- if (emailError) setEmailError("");
64
- },
65
- disabled: isLoading,
66
- required: true
67
- }),
68
- emailError && /* @__PURE__ */ jsx("p", {
69
- className: "text-destructive text-sm",
70
- children: emailError
71
- })
72
- ]
73
- }), /* @__PURE__ */ jsxs(Button, {
74
- type: "submit",
75
- className: "mt-6 w-full",
76
- disabled: isLoading,
77
- children: [isLoading && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isLoading ? "Sending Reset Email..." : "Send Reset Email"]
78
- })]
79
- }),
80
- /* @__PURE__ */ jsx("div", {
81
- className: "mt-4 text-center",
82
- children: onSwitchToSignIn && /* @__PURE__ */ jsx("p", {
83
- className: "text-sm",
84
- children: /* @__PURE__ */ jsx(Button, {
85
- variant: "link",
86
- size: "sm",
87
- onClick: onSwitchToSignIn,
88
- disabled: isLoading,
89
- className: "min-w-0 p-0 font-medium",
90
- children: "Back to sign in"
91
- })
92
- })
93
- })
94
- ]
95
- })
96
- });
97
- }
98
-
99
- //#endregion
100
- export { ResetPasswordForm };