@better-auth-ui/heroui 1.6.0 → 1.6.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 (221) hide show
  1. package/dist/components/auth/auth-provider.d.ts +1 -1
  2. package/dist/components/auth/auth-provider.js +15 -11
  3. package/dist/components/auth/auth.d.ts +3 -3
  4. package/dist/components/auth/auth.js +36 -41
  5. package/dist/components/auth/field-separator.d.ts +1 -1
  6. package/dist/components/auth/field-separator.js +17 -4
  7. package/dist/components/auth/forgot-password.d.ts +1 -1
  8. package/dist/components/auth/forgot-password.js +69 -27
  9. package/dist/components/auth/magic-link-button.d.ts +1 -1
  10. package/dist/components/auth/magic-link-button.js +15 -18
  11. package/dist/components/auth/magic-link.d.ts +2 -2
  12. package/dist/components/auth/magic-link.js +110 -42
  13. package/dist/components/auth/passkey-button.d.ts +4 -0
  14. package/dist/components/auth/passkey-button.js +24 -0
  15. package/dist/components/auth/provider-buttons.d.ts +1 -1
  16. package/dist/components/auth/provider-buttons.js +26 -33
  17. package/dist/components/auth/reset-password.d.ts +1 -1
  18. package/dist/components/auth/reset-password.js +146 -57
  19. package/dist/components/auth/sign-in.d.ts +2 -2
  20. package/dist/components/auth/sign-in.js +163 -63
  21. package/dist/components/auth/sign-out.js +26 -32
  22. package/dist/components/auth/sign-up.d.ts +2 -2
  23. package/dist/components/auth/sign-up.js +240 -70
  24. package/dist/components/email/email-changed-email.d.ts +2 -2
  25. package/dist/components/email/email-changed-email.js +29 -22
  26. package/dist/components/email/email-verification-email.d.ts +2 -2
  27. package/dist/components/email/email-verification-email.js +29 -22
  28. package/dist/components/email/magic-link-email.d.ts +2 -2
  29. package/dist/components/email/magic-link-email.js +29 -22
  30. package/dist/components/email/new-device-email.d.ts +2 -2
  31. package/dist/components/email/new-device-email.js +29 -22
  32. package/dist/components/email/otp-email.d.ts +2 -2
  33. package/dist/components/email/otp-email.js +28 -21
  34. package/dist/components/email/password-changed-email.d.ts +2 -2
  35. package/dist/components/email/password-changed-email.js +29 -22
  36. package/dist/components/email/reset-password-email.d.ts +2 -2
  37. package/dist/components/email/reset-password-email.js +29 -22
  38. package/dist/components/settings/account/account-settings.d.ts +2 -2
  39. package/dist/components/settings/account/account-settings.js +22 -19
  40. package/dist/components/settings/account/appearance.d.ts +1 -1
  41. package/dist/components/settings/account/appearance.js +70 -27
  42. package/dist/components/settings/account/change-avatar.js +88 -55
  43. package/dist/components/settings/account/change-email.d.ts +1 -1
  44. package/dist/components/settings/account/change-email.js +56 -28
  45. package/dist/components/settings/account/manage-account.d.ts +1 -1
  46. package/dist/components/settings/account/manage-account.js +50 -31
  47. package/dist/components/settings/account/manage-accounts.d.ts +1 -1
  48. package/dist/components/settings/account/manage-accounts.js +32 -36
  49. package/dist/components/settings/account/user-profile.d.ts +3 -3
  50. package/dist/components/settings/account/user-profile.js +105 -22
  51. package/dist/components/settings/security/active-session.d.ts +1 -1
  52. package/dist/components/settings/security/active-session.js +60 -51
  53. package/dist/components/settings/security/active-sessions.d.ts +1 -1
  54. package/dist/components/settings/security/active-sessions.js +32 -26
  55. package/dist/components/settings/security/change-password.d.ts +1 -1
  56. package/dist/components/settings/security/change-password.js +189 -76
  57. package/dist/components/settings/security/danger-zone.d.ts +2 -2
  58. package/dist/components/settings/security/danger-zone.js +17 -11
  59. package/dist/components/settings/security/delete-user.d.ts +1 -1
  60. package/dist/components/settings/security/delete-user.js +96 -46
  61. package/dist/components/settings/security/linked-account.d.ts +1 -1
  62. package/dist/components/settings/security/linked-account.js +61 -47
  63. package/dist/components/settings/security/linked-accounts.d.ts +1 -1
  64. package/dist/components/settings/security/linked-accounts.js +43 -40
  65. package/dist/components/settings/security/passkey.d.ts +8 -0
  66. package/dist/components/settings/security/passkey.js +43 -0
  67. package/dist/components/settings/security/passkeys.d.ts +6 -0
  68. package/dist/components/settings/security/passkeys.js +53 -0
  69. package/dist/components/settings/security/security-settings.d.ts +2 -2
  70. package/dist/components/settings/security/security-settings.js +24 -20
  71. package/dist/components/settings/settings.d.ts +3 -3
  72. package/dist/components/settings/settings.js +44 -27
  73. package/dist/components/user/switch-account-item.d.ts +1 -1
  74. package/dist/components/user/switch-account-item.js +19 -15
  75. package/dist/components/user/switch-account-menu.js +27 -28
  76. package/dist/components/user/user-avatar.d.ts +3 -3
  77. package/dist/components/user/user-avatar.js +28 -30
  78. package/dist/components/user/user-button.d.ts +1 -1
  79. package/dist/components/user/user-button.js +90 -23
  80. package/dist/components/user/user-view.d.ts +3 -3
  81. package/dist/components/user/user-view.js +36 -23
  82. package/dist/core.d.ts +1 -1
  83. package/dist/index.d.ts +35 -33
  84. package/dist/index.js +36 -33
  85. package/dist/react-exports.d.ts +1 -1
  86. package/package.json +17 -10
  87. package/src/components/auth/auth.tsx +1 -1
  88. package/src/components/auth/magic-link.tsx +4 -0
  89. package/src/components/auth/passkey-button.tsx +36 -0
  90. package/src/components/auth/sign-in.tsx +67 -30
  91. package/src/components/auth/sign-up.tsx +97 -3
  92. package/src/components/settings/account/user-profile.tsx +121 -6
  93. package/src/components/settings/security/passkey.tsx +51 -0
  94. package/src/components/settings/security/passkeys.tsx +104 -0
  95. package/src/components/settings/security/security-settings.tsx +3 -1
  96. package/src/components/settings/settings.tsx +1 -1
  97. package/src/index.tsx +2 -0
  98. package/dist/components/account/account.d.ts +0 -18
  99. package/dist/components/account/account.js +0 -24
  100. package/dist/components/account/settings/account-settings.d.ts +0 -5
  101. package/dist/components/account/settings/account-settings.js +0 -6
  102. package/dist/components/account/settings/settings.d.ts +0 -5
  103. package/dist/components/account/settings/settings.js +0 -5
  104. package/dist/components/account/settings/user-profile.d.ts +0 -5
  105. package/dist/components/account/settings/user-profile.js +0 -20
  106. package/dist/components/settings/account/accounts.d.ts +0 -14
  107. package/dist/components/settings/account/accounts.js +0 -26
  108. package/dist/components/settings/account/theme-selector.d.ts +0 -16
  109. package/dist/components/settings/account/theme-selector.js +0 -33
  110. package/dist/components/settings/account/theme-settings.d.ts +0 -16
  111. package/dist/components/settings/account/theme-settings.js +0 -31
  112. package/dist/components/settings/account-settings.d.ts +0 -5
  113. package/dist/components/settings/account-settings.js +0 -6
  114. package/dist/components/settings/account.d.ts +0 -18
  115. package/dist/components/settings/account.js +0 -24
  116. package/dist/components/settings/security/connected-account.d.ts +0 -16
  117. package/dist/components/settings/security/connected-account.js +0 -46
  118. package/dist/components/settings/security/connected-accounts.d.ts +0 -15
  119. package/dist/components/settings/security/connected-accounts.js +0 -31
  120. package/dist/components/settings/security/sessions.d.ts +0 -14
  121. package/dist/components/settings/security/sessions.js +0 -40
  122. package/dist/components/settings/settings/account-settings.d.ts +0 -5
  123. package/dist/components/settings/settings/account-settings.js +0 -6
  124. package/dist/components/settings/settings/user-profile.d.ts +0 -5
  125. package/dist/components/settings/settings/user-profile.js +0 -20
  126. package/dist/components/settings/user-profile.d.ts +0 -5
  127. package/dist/components/settings/user-profile.js +0 -20
  128. package/dist/components/user/switch-account-popover.d.ts +0 -10
  129. package/dist/components/user/switch-account-popover.js +0 -25
  130. package/dist/components/user/switch-account-submenu.d.ts +0 -10
  131. package/dist/components/user/switch-account-submenu.js +0 -25
  132. package/dist/hooks/use-auth.d.ts +0 -2
  133. package/dist/hooks/use-auth.js +0 -8
  134. package/dist/hooks/use-redirect-to.d.ts +0 -8
  135. package/dist/hooks/use-redirect-to.js +0 -19
  136. package/dist/hooks/use-sign-in.d.ts +0 -8
  137. package/dist/hooks/use-sign-in.js +0 -53
  138. package/dist/lib/utils.d.ts +0 -2
  139. package/dist/lib/utils.js +0 -5
  140. package/dist/server.d.ts +0 -1
  141. package/dist/server.js +0 -1
  142. package/dist/src/components/auth/auth-provider.d.ts +0 -8
  143. package/dist/src/components/auth/auth-provider.js +0 -13
  144. package/dist/src/components/auth/auth.d.ts +0 -22
  145. package/dist/src/components/auth/auth.js +0 -42
  146. package/dist/src/components/auth/field-separator.d.ts +0 -4
  147. package/dist/src/components/auth/field-separator.js +0 -5
  148. package/dist/src/components/auth/forgot-password.d.ts +0 -15
  149. package/dist/src/components/auth/forgot-password.js +0 -29
  150. package/dist/src/components/auth/magic-link-button.d.ts +0 -13
  151. package/dist/src/components/auth/magic-link-button.js +0 -20
  152. package/dist/src/components/auth/magic-link.d.ts +0 -17
  153. package/dist/src/components/auth/magic-link.js +0 -37
  154. package/dist/src/components/auth/provider-buttons.d.ts +0 -19
  155. package/dist/src/components/auth/provider-buttons.js +0 -35
  156. package/dist/src/components/auth/reset-password.d.ts +0 -11
  157. package/dist/src/components/auth/reset-password.js +0 -59
  158. package/dist/src/components/auth/sign-in.d.ts +0 -14
  159. package/dist/src/components/auth/sign-in.js +0 -58
  160. package/dist/src/components/auth/sign-out.d.ts +0 -11
  161. package/dist/src/components/auth/sign-out.js +0 -34
  162. package/dist/src/components/auth/sign-up.d.ts +0 -19
  163. package/dist/src/components/auth/sign-up.js +0 -65
  164. package/dist/src/components/email/email-changed-email.d.ts +0 -3
  165. package/dist/src/components/email/email-changed-email.js +0 -23
  166. package/dist/src/components/email/email-verification-email.d.ts +0 -3
  167. package/dist/src/components/email/email-verification-email.js +0 -23
  168. package/dist/src/components/email/magic-link-email.d.ts +0 -3
  169. package/dist/src/components/email/magic-link-email.js +0 -23
  170. package/dist/src/components/email/new-device-email.d.ts +0 -3
  171. package/dist/src/components/email/new-device-email.js +0 -23
  172. package/dist/src/components/email/otp-email.d.ts +0 -3
  173. package/dist/src/components/email/otp-email.js +0 -22
  174. package/dist/src/components/email/password-changed-email.d.ts +0 -3
  175. package/dist/src/components/email/password-changed-email.js +0 -23
  176. package/dist/src/components/email/reset-password-email.d.ts +0 -3
  177. package/dist/src/components/email/reset-password-email.js +0 -23
  178. package/dist/src/components/settings/account/account-settings.d.ts +0 -13
  179. package/dist/src/components/settings/account/account-settings.js +0 -19
  180. package/dist/src/components/settings/account/appearance.d.ts +0 -16
  181. package/dist/src/components/settings/account/appearance.js +0 -28
  182. package/dist/src/components/settings/account/change-email.d.ts +0 -15
  183. package/dist/src/components/settings/account/change-email.js +0 -35
  184. package/dist/src/components/settings/account/manage-account.d.ts +0 -19
  185. package/dist/src/components/settings/account/manage-account.js +0 -27
  186. package/dist/src/components/settings/account/manage-accounts.d.ts +0 -14
  187. package/dist/src/components/settings/account/manage-accounts.js +0 -27
  188. package/dist/src/components/settings/account/user-profile.d.ts +0 -13
  189. package/dist/src/components/settings/account/user-profile.js +0 -29
  190. package/dist/src/components/settings/security/active-session.d.ts +0 -14
  191. package/dist/src/components/settings/security/active-session.js +0 -35
  192. package/dist/src/components/settings/security/active-sessions.d.ts +0 -14
  193. package/dist/src/components/settings/security/active-sessions.js +0 -29
  194. package/dist/src/components/settings/security/change-password.d.ts +0 -15
  195. package/dist/src/components/settings/security/change-password.js +0 -57
  196. package/dist/src/components/settings/security/linked-account.d.ts +0 -16
  197. package/dist/src/components/settings/security/linked-account.js +0 -46
  198. package/dist/src/components/settings/security/linked-accounts.d.ts +0 -15
  199. package/dist/src/components/settings/security/linked-accounts.js +0 -31
  200. package/dist/src/components/settings/security/security-settings.d.ts +0 -15
  201. package/dist/src/components/settings/security/security-settings.js +0 -18
  202. package/dist/src/components/settings/settings.d.ts +0 -29
  203. package/dist/src/components/settings/settings.js +0 -39
  204. package/dist/src/components/user/switch-account-item.d.ts +0 -16
  205. package/dist/src/components/user/switch-account-item.js +0 -14
  206. package/dist/src/components/user/switch-account-menu.d.ts +0 -10
  207. package/dist/src/components/user/switch-account-menu.js +0 -23
  208. package/dist/src/components/user/user-avatar.d.ts +0 -24
  209. package/dist/src/components/user/user-avatar.js +0 -31
  210. package/dist/src/components/user/user-button.d.ts +0 -21
  211. package/dist/src/components/user/user-button.js +0 -24
  212. package/dist/src/components/user/user-view.d.ts +0 -21
  213. package/dist/src/components/user/user-view.js +0 -24
  214. package/dist/src/core.d.ts +0 -1
  215. package/dist/src/core.js +0 -1
  216. package/dist/src/index.d.ts +0 -31
  217. package/dist/src/index.js +0 -32
  218. package/dist/src/lib/utils.d.ts +0 -2
  219. package/dist/src/lib/utils.js +0 -5
  220. package/dist/src/react-exports.d.ts +0 -1
  221. package/dist/src/react-exports.js +0 -1
@@ -1,71 +1,241 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useAuth, useSignInSocial, useSignUpEmail } from "@better-auth-ui/react";
3
- import { Eye, EyeSlash } from "@gravity-ui/icons";
4
- import { Button, Card, cn, Description, FieldError, Form, Input, InputGroup, Label, Link, Spinner, TextField, toast } from "@heroui/react";
5
- import { useState } from "react";
6
- import { FieldSeparator } from "./field-separator";
7
- import { MagicLinkButton } from "./magic-link-button";
8
- import { ProviderButtons } from "./provider-buttons";
9
- /**
10
- * Render a sign-up form with name, email, password (and optional confirm password) fields, optional social provider buttons, and password visibility controls.
11
- *
12
- * The component reflects request state by disabling inputs and showing a pending indicator during sign-up or social sign-in.
13
- *
14
- * @param className - Additional CSS classes applied to the outer card container
15
- * @param socialLayout - Social layout to apply to the provider buttons component
16
- * @param socialPosition - Position of social provider buttons relative to the form; `"top"` or `"bottom"` (default `"bottom"`)
17
- * @returns The sign-up form React element
18
- */
19
- export function SignUp({ className, socialLayout, socialPosition = "bottom", variant, ...props }) {
20
- const { basePaths, emailAndPassword, localization, magicLink, redirectTo, socialProviders, viewPaths, navigate } = useAuth();
21
- const [password, setPassword] = useState("");
22
- const [confirmPassword, setConfirmPassword] = useState("");
23
- const { mutate: signUpEmail, isPending: signUpPending } = useSignUpEmail({
24
- onError: (error) => {
25
- setPassword("");
26
- setConfirmPassword("");
27
- toast.danger(error.error?.message || error.message);
28
- },
29
- onSuccess: () => {
30
- if (emailAndPassword?.requireEmailVerification) {
31
- toast.success(localization.auth.verifyYourEmail);
32
- navigate({ to: `${basePaths.auth}/${viewPaths.auth.signIn}` });
33
- }
34
- else {
35
- navigate({ to: redirectTo });
36
- }
37
- }
38
- });
39
- const [socialRedirecting, setSocialRedirecting] = useState(false);
40
- const { mutate: signInSocial, isPending: socialPending } = useSignInSocial({
41
- onError: (error) => toast.danger(error.error?.message || error.message),
42
- onSuccess: () => {
43
- setSocialRedirecting(true);
44
- setTimeout(() => {
45
- setSocialRedirecting(false);
46
- }, 5000);
47
- }
48
- });
49
- const [isPasswordVisible, setIsPasswordVisible] = useState(false);
50
- const [isConfirmPasswordVisible, setIsConfirmPasswordVisible] = useState(false);
51
- const isPending = signUpPending || socialPending || socialRedirecting;
52
- const handleSubmit = (e) => {
53
- e.preventDefault();
54
- const formData = new FormData(e.currentTarget);
55
- const name = formData.get("name");
56
- const email = formData.get("email");
57
- if (emailAndPassword?.confirmPassword && password !== confirmPassword) {
58
- toast.danger(localization.auth.passwordsDoNotMatch);
59
- setPassword("");
60
- setConfirmPassword("");
61
- return;
62
- }
63
- signUpEmail({ name, email, password });
64
- };
65
- const showSeparator = emailAndPassword?.enabled && !!socialProviders?.length;
66
- return (_jsxs(Card, { className: cn("w-full max-w-sm p-4 md:p-6", className), variant: variant, ...props, children: [_jsx(Card.Header, { children: _jsx(Card.Title, { className: "text-xl font-semibold mb-1", children: localization.auth.signUp }) }), _jsxs(Card.Content, { className: "gap-4", children: [socialPosition === "top" && (_jsxs(_Fragment, { children: [!!socialProviders?.length && (_jsx(ProviderButtons, { isPending: isPending, socialLayout: socialLayout, signInSocial: signInSocial })), showSeparator && (_jsx(FieldSeparator, { children: localization.auth.or }))] })), emailAndPassword?.enabled && (_jsxs(Form, { onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [_jsxs(TextField, { name: "name", type: "text", autoComplete: "name", isDisabled: isPending, children: [_jsx(Label, { children: localization.auth.name }), _jsx(Input, { placeholder: localization.auth.namePlaceholder, required: true, variant: variant === "transparent" ? "primary" : "secondary" }), _jsx(FieldError, {})] }), _jsxs(TextField, { name: "email", type: "email", autoComplete: "email", isDisabled: isPending, children: [_jsx(Label, { children: localization.auth.email }), _jsx(Input, { placeholder: localization.auth.emailPlaceholder, required: true, variant: variant === "transparent" ? "primary" : "secondary" }), _jsx(FieldError, {})] }), _jsxs(TextField, { minLength: emailAndPassword?.minPasswordLength, maxLength: emailAndPassword?.maxPasswordLength, name: "password", autoComplete: "new-password", isDisabled: isPending, value: password, onChange: setPassword, children: [_jsx(Label, { children: localization.auth.password }), _jsxs(InputGroup, { variant: variant === "transparent" ? "primary" : "secondary", children: [_jsx(InputGroup.Input, { placeholder: localization.auth.passwordPlaceholder, type: isPasswordVisible ? "text" : "password", name: "password", required: true }), _jsx(InputGroup.Suffix, { className: "px-0", children: _jsx(Button, { isIconOnly: true, "aria-label": isPasswordVisible
67
- ? localization.auth.hidePassword
68
- : localization.auth.showPassword, size: "sm", variant: "ghost", onPress: () => setIsPasswordVisible(!isPasswordVisible), isDisabled: isPending, children: isPasswordVisible ? _jsx(EyeSlash, {}) : _jsx(Eye, {}) }) })] }), _jsx(FieldError, {})] }), emailAndPassword?.confirmPassword && (_jsxs(TextField, { minLength: emailAndPassword?.minPasswordLength, maxLength: emailAndPassword?.maxPasswordLength, name: "confirmPassword", autoComplete: "new-password", isDisabled: isPending, value: confirmPassword, onChange: setConfirmPassword, children: [_jsx(Label, { children: localization.auth.confirmPassword }), _jsxs(InputGroup, { variant: variant === "transparent" ? "primary" : "secondary", children: [_jsx(InputGroup.Input, { name: "confirmPassword", placeholder: localization.auth.confirmPasswordPlaceholder, type: isConfirmPasswordVisible ? "text" : "password", required: true }), _jsx(InputGroup.Suffix, { className: "px-0", children: _jsx(Button, { isIconOnly: true, "aria-label": isConfirmPasswordVisible
69
- ? localization.auth.hidePassword
70
- : localization.auth.showPassword, size: "sm", variant: "ghost", onPress: () => setIsConfirmPasswordVisible(!isConfirmPasswordVisible), isDisabled: isPending, children: isConfirmPasswordVisible ? _jsx(EyeSlash, {}) : _jsx(Eye, {}) }) })] }), _jsx(FieldError, {})] })), _jsxs("div", { className: "flex flex-col gap-3", children: [_jsxs(Button, { type: "submit", className: "w-full", isPending: isPending, children: [isPending && _jsx(Spinner, { color: "current", size: "sm" }), localization.auth.signUp] }), magicLink && (_jsx(MagicLinkButton, { view: "signUp", isPending: isPending }))] })] })), socialPosition === "bottom" && (_jsxs(_Fragment, { children: [showSeparator && (_jsx(FieldSeparator, { children: localization.auth.or })), !!socialProviders?.length && (_jsx(ProviderButtons, { socialLayout: socialLayout, signInSocial: signInSocial, isPending: isPending }))] }))] }), _jsx(Card.Footer, { className: "flex-col", children: _jsxs(Description, { className: "text-sm", children: [localization.auth.alreadyHaveAnAccount, " ", _jsx(Link, { href: `${basePaths.auth}/${viewPaths.auth.signIn}`, className: "text-accent decoration-accent no-underline hover:underline", children: localization.auth.signIn })] }) })] }));
1
+ import { FieldSeparator as e } from "./field-separator.js";
2
+ import { MagicLinkButton as t } from "./magic-link-button.js";
3
+ import { ProviderButtons as n } from "./provider-buttons.js";
4
+ import { useAuth as r, useIsUsernameAvailable as i, useSignInSocial as ee, useSignUpEmail as te } from "@better-auth-ui/react";
5
+ import { Button as a, Card as o, Description as ne, FieldError as s, Form as c, Input as l, InputGroup as u, Label as d, Link as re, Spinner as f, TextField as p, cn as m, toast as h } from "@heroui/react";
6
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
7
+ import { useState as y } from "react";
8
+ import { Check as ie, Eye as b, EyeSlash as x, Xmark as S } from "@gravity-ui/icons";
9
+ import { useDebouncer as C } from "@tanstack/react-pacer";
10
+ //#region src/components/auth/sign-up.tsx
11
+ function w({ className: w, socialLayout: T, socialPosition: E = "bottom", variant: D, ...ae }) {
12
+ let { basePaths: O, emailAndPassword: k, localization: A, magicLink: j, redirectTo: M, socialProviders: N, username: P, viewPaths: F, navigate: I } = r(), [L, R] = y(""), [z, B] = y(""), [V, H] = y(""), { mutate: U, data: W, error: G, reset: K } = i(), q = C((e) => {
13
+ if (!e.trim()) {
14
+ K();
15
+ return;
16
+ }
17
+ U({ username: e.trim() });
18
+ }, { wait: 500 });
19
+ function oe(e) {
20
+ H(e), K(), P?.isUsernameAvailable && q.maybeExecute(e);
21
+ }
22
+ let { mutate: se, isPending: ce } = te({
23
+ onError: (e) => {
24
+ R(""), B(""), h.danger(e.error?.message || e.message);
25
+ },
26
+ onSuccess: () => {
27
+ k?.requireEmailVerification ? (h.success(A.auth.verifyYourEmail), I({ to: `${O.auth}/${F.auth.signIn}` })) : I({ to: M });
28
+ }
29
+ }), [le, J] = y(!1), { mutate: Y, isPending: ue } = ee({
30
+ onError: (e) => h.danger(e.error?.message || e.message),
31
+ onSuccess: () => {
32
+ J(!0), setTimeout(() => {
33
+ J(!1);
34
+ }, 5e3);
35
+ }
36
+ }), [X, de] = y(!1), [Z, fe] = y(!1), Q = ce || ue || le, pe = (e) => {
37
+ e.preventDefault();
38
+ let t = new FormData(e.currentTarget), n = t.get("name"), r = t.get("email");
39
+ if (k?.confirmPassword && L !== z) {
40
+ h.danger(A.auth.passwordsDoNotMatch), R(""), B("");
41
+ return;
42
+ }
43
+ se({
44
+ name: n,
45
+ email: r,
46
+ password: L,
47
+ ...P?.enabled ? {
48
+ username: V.trim(),
49
+ ...P.displayUsername ? { displayUsername: V.trim() } : {}
50
+ } : {}
51
+ });
52
+ }, $ = k?.enabled && !!N?.length;
53
+ return /* @__PURE__ */ v(o, {
54
+ className: m("w-full max-w-sm p-4 md:p-6", w),
55
+ variant: D,
56
+ ...ae,
57
+ children: [
58
+ /* @__PURE__ */ _(o.Header, { children: /* @__PURE__ */ _(o.Title, {
59
+ className: "text-xl font-semibold mb-1",
60
+ children: A.auth.signUp
61
+ }) }),
62
+ /* @__PURE__ */ v(o.Content, {
63
+ className: "gap-4",
64
+ children: [
65
+ E === "top" && /* @__PURE__ */ v(g, { children: [!!N?.length && /* @__PURE__ */ _(n, {
66
+ isPending: Q,
67
+ socialLayout: T,
68
+ signInSocial: Y
69
+ }), $ && /* @__PURE__ */ _(e, { children: A.auth.or })] }),
70
+ k?.enabled && /* @__PURE__ */ v(c, {
71
+ onSubmit: pe,
72
+ className: "flex flex-col gap-4",
73
+ children: [
74
+ /* @__PURE__ */ v(p, {
75
+ name: "name",
76
+ type: "text",
77
+ autoComplete: "name",
78
+ isDisabled: Q,
79
+ children: [
80
+ /* @__PURE__ */ _(d, { children: A.auth.name }),
81
+ /* @__PURE__ */ _(l, {
82
+ placeholder: A.auth.namePlaceholder,
83
+ required: !0,
84
+ variant: D === "transparent" ? "primary" : "secondary"
85
+ }),
86
+ /* @__PURE__ */ _(s, {})
87
+ ]
88
+ }),
89
+ P?.enabled && /* @__PURE__ */ v(p, {
90
+ name: "username",
91
+ type: "text",
92
+ autoComplete: "username",
93
+ minLength: P.minUsernameLength,
94
+ maxLength: P.maxUsernameLength,
95
+ isDisabled: Q,
96
+ value: V,
97
+ onChange: oe,
98
+ isInvalid: !!G || W && !W.available,
99
+ children: [
100
+ /* @__PURE__ */ _(d, { children: A.auth.username }),
101
+ /* @__PURE__ */ v(u, {
102
+ variant: D === "transparent" ? "primary" : "secondary",
103
+ children: [/* @__PURE__ */ _(u.Input, {
104
+ placeholder: A.auth.usernamePlaceholder,
105
+ required: !0
106
+ }), P.isUsernameAvailable && V.trim() && /* @__PURE__ */ _(u.Suffix, {
107
+ className: "px-2",
108
+ children: W?.available ? /* @__PURE__ */ _(ie, { className: "text-success" }) : G || W?.available === !1 ? /* @__PURE__ */ _(S, { className: "text-danger" }) : /* @__PURE__ */ _(f, {
109
+ size: "sm",
110
+ color: "current"
111
+ })
112
+ })]
113
+ }),
114
+ /* @__PURE__ */ _(s, { children: G?.error?.message || G?.message || W?.available === !1 && A.auth.usernameTaken })
115
+ ]
116
+ }),
117
+ /* @__PURE__ */ v(p, {
118
+ name: "email",
119
+ type: "email",
120
+ autoComplete: "email",
121
+ isDisabled: Q,
122
+ children: [
123
+ /* @__PURE__ */ _(d, { children: A.auth.email }),
124
+ /* @__PURE__ */ _(l, {
125
+ placeholder: A.auth.emailPlaceholder,
126
+ required: !0,
127
+ variant: D === "transparent" ? "primary" : "secondary"
128
+ }),
129
+ /* @__PURE__ */ _(s, {})
130
+ ]
131
+ }),
132
+ /* @__PURE__ */ v(p, {
133
+ minLength: k?.minPasswordLength,
134
+ maxLength: k?.maxPasswordLength,
135
+ name: "password",
136
+ autoComplete: "new-password",
137
+ isDisabled: Q,
138
+ value: L,
139
+ onChange: R,
140
+ children: [
141
+ /* @__PURE__ */ _(d, { children: A.auth.password }),
142
+ /* @__PURE__ */ v(u, {
143
+ variant: D === "transparent" ? "primary" : "secondary",
144
+ children: [/* @__PURE__ */ _(u.Input, {
145
+ placeholder: A.auth.passwordPlaceholder,
146
+ type: X ? "text" : "password",
147
+ name: "password",
148
+ required: !0
149
+ }), /* @__PURE__ */ _(u.Suffix, {
150
+ className: "px-0",
151
+ children: /* @__PURE__ */ _(a, {
152
+ isIconOnly: !0,
153
+ "aria-label": X ? A.auth.hidePassword : A.auth.showPassword,
154
+ size: "sm",
155
+ variant: "ghost",
156
+ onPress: () => de(!X),
157
+ isDisabled: Q,
158
+ children: _(X ? x : b, {})
159
+ })
160
+ })]
161
+ }),
162
+ /* @__PURE__ */ _(s, {})
163
+ ]
164
+ }),
165
+ k?.confirmPassword && /* @__PURE__ */ v(p, {
166
+ minLength: k?.minPasswordLength,
167
+ maxLength: k?.maxPasswordLength,
168
+ name: "confirmPassword",
169
+ autoComplete: "new-password",
170
+ isDisabled: Q,
171
+ value: z,
172
+ onChange: B,
173
+ children: [
174
+ /* @__PURE__ */ _(d, { children: A.auth.confirmPassword }),
175
+ /* @__PURE__ */ v(u, {
176
+ variant: D === "transparent" ? "primary" : "secondary",
177
+ children: [/* @__PURE__ */ _(u.Input, {
178
+ name: "confirmPassword",
179
+ placeholder: A.auth.confirmPasswordPlaceholder,
180
+ type: Z ? "text" : "password",
181
+ required: !0
182
+ }), /* @__PURE__ */ _(u.Suffix, {
183
+ className: "px-0",
184
+ children: /* @__PURE__ */ _(a, {
185
+ isIconOnly: !0,
186
+ "aria-label": Z ? A.auth.hidePassword : A.auth.showPassword,
187
+ size: "sm",
188
+ variant: "ghost",
189
+ onPress: () => fe(!Z),
190
+ isDisabled: Q,
191
+ children: _(Z ? x : b, {})
192
+ })
193
+ })]
194
+ }),
195
+ /* @__PURE__ */ _(s, {})
196
+ ]
197
+ }),
198
+ /* @__PURE__ */ v("div", {
199
+ className: "flex flex-col gap-3",
200
+ children: [/* @__PURE__ */ v(a, {
201
+ type: "submit",
202
+ className: "w-full",
203
+ isPending: Q,
204
+ children: [Q && /* @__PURE__ */ _(f, {
205
+ color: "current",
206
+ size: "sm"
207
+ }), A.auth.signUp]
208
+ }), j && /* @__PURE__ */ _(t, {
209
+ view: "signUp",
210
+ isPending: Q
211
+ })]
212
+ })
213
+ ]
214
+ }),
215
+ E === "bottom" && /* @__PURE__ */ v(g, { children: [$ && /* @__PURE__ */ _(e, { children: A.auth.or }), !!N?.length && /* @__PURE__ */ _(n, {
216
+ socialLayout: T,
217
+ signInSocial: Y,
218
+ isPending: Q
219
+ })] })
220
+ ]
221
+ }),
222
+ /* @__PURE__ */ _(o.Footer, {
223
+ className: "flex-col",
224
+ children: /* @__PURE__ */ v(ne, {
225
+ className: "text-sm",
226
+ children: [
227
+ A.auth.alreadyHaveAnAccount,
228
+ " ",
229
+ /* @__PURE__ */ _(re, {
230
+ href: `${O.auth}/${F.auth.signIn}`,
231
+ className: "text-accent decoration-accent no-underline hover:underline",
232
+ children: A.auth.signIn
233
+ })
234
+ ]
235
+ })
236
+ })
237
+ ]
238
+ });
71
239
  }
240
+ //#endregion
241
+ export { w as SignUp };
@@ -1,3 +1,3 @@
1
- import { type EmailChangedEmailProps } from "@better-auth-ui/react";
2
- export type { EmailChangedEmailProps } from "@better-auth-ui/react";
1
+ import { EmailChangedEmailProps } from '@better-auth-ui/react';
2
+ export type { EmailChangedEmailProps } from '@better-auth-ui/react';
3
3
  export declare function EmailChangedEmail({ colors, classNames, ...props }: EmailChangedEmailProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { EmailChangedEmail as EmailChangedEmailPrimitive } from "@better-auth-ui/react";
3
- import { cn } from "@heroui/react";
4
- export function EmailChangedEmail({ colors, classNames, ...props }) {
5
- return (_jsx(EmailChangedEmailPrimitive, { colors: {
6
- light: {
7
- background: "#F5F5F5",
8
- primary: "#0285F7",
9
- primaryForeground: "#FCFCFC",
10
- ...colors?.light
11
- },
12
- dark: {
13
- background: "#060607",
14
- primary: "#0584F6",
15
- primaryForeground: "#FCFCFC",
16
- ...colors?.dark
17
- }
18
- }, classNames: {
19
- ...classNames,
20
- card: cn("border-none rounded-3xl", classNames?.card),
21
- button: cn("rounded-full", classNames?.button)
22
- }, ...props }));
1
+ import { EmailChangedEmail as e } from "@better-auth-ui/react";
2
+ import { cn as t } from "@heroui/react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/email/email-changed-email.tsx
5
+ function r({ colors: r, classNames: i, ...a }) {
6
+ return /* @__PURE__ */ n(e, {
7
+ colors: {
8
+ light: {
9
+ background: "#F5F5F5",
10
+ primary: "#0285F7",
11
+ primaryForeground: "#FCFCFC",
12
+ ...r?.light
13
+ },
14
+ dark: {
15
+ background: "#060607",
16
+ primary: "#0584F6",
17
+ primaryForeground: "#FCFCFC",
18
+ ...r?.dark
19
+ }
20
+ },
21
+ classNames: {
22
+ ...i,
23
+ card: t("border-none rounded-3xl", i?.card),
24
+ button: t("rounded-full", i?.button)
25
+ },
26
+ ...a
27
+ });
23
28
  }
29
+ //#endregion
30
+ export { r as EmailChangedEmail };
@@ -1,3 +1,3 @@
1
- import { type EmailVerificationEmailProps } from "@better-auth-ui/react";
2
- export type { EmailVerificationEmailProps } from "@better-auth-ui/react";
1
+ import { EmailVerificationEmailProps } from '@better-auth-ui/react';
2
+ export type { EmailVerificationEmailProps } from '@better-auth-ui/react';
3
3
  export declare function EmailVerificationEmail({ colors, classNames, ...props }: EmailVerificationEmailProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { EmailVerificationEmail as EmailVerificationEmailPrimitive } from "@better-auth-ui/react";
3
- import { cn } from "@heroui/react";
4
- export function EmailVerificationEmail({ colors, classNames, ...props }) {
5
- return (_jsx(EmailVerificationEmailPrimitive, { colors: {
6
- light: {
7
- background: "#F5F5F5",
8
- primary: "#0285F7",
9
- primaryForeground: "#FCFCFC",
10
- ...colors?.light
11
- },
12
- dark: {
13
- background: "#060607",
14
- primary: "#0584F6",
15
- primaryForeground: "#FCFCFC",
16
- ...colors?.dark
17
- }
18
- }, classNames: {
19
- ...classNames,
20
- card: cn("border-none rounded-3xl", classNames?.card),
21
- button: cn("rounded-full", classNames?.button)
22
- }, ...props }));
1
+ import { EmailVerificationEmail as e } from "@better-auth-ui/react";
2
+ import { cn as t } from "@heroui/react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/email/email-verification-email.tsx
5
+ function r({ colors: r, classNames: i, ...a }) {
6
+ return /* @__PURE__ */ n(e, {
7
+ colors: {
8
+ light: {
9
+ background: "#F5F5F5",
10
+ primary: "#0285F7",
11
+ primaryForeground: "#FCFCFC",
12
+ ...r?.light
13
+ },
14
+ dark: {
15
+ background: "#060607",
16
+ primary: "#0584F6",
17
+ primaryForeground: "#FCFCFC",
18
+ ...r?.dark
19
+ }
20
+ },
21
+ classNames: {
22
+ ...i,
23
+ card: t("border-none rounded-3xl", i?.card),
24
+ button: t("rounded-full", i?.button)
25
+ },
26
+ ...a
27
+ });
23
28
  }
29
+ //#endregion
30
+ export { r as EmailVerificationEmail };
@@ -1,3 +1,3 @@
1
- import { type MagicLinkEmailProps } from "@better-auth-ui/react";
2
- export type { MagicLinkEmailProps } from "@better-auth-ui/react";
1
+ import { MagicLinkEmailProps } from '@better-auth-ui/react';
2
+ export type { MagicLinkEmailProps } from '@better-auth-ui/react';
3
3
  export declare function MagicLinkEmail({ colors, classNames, ...props }: MagicLinkEmailProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { MagicLinkEmail as MagicLinkEmailPrimitive } from "@better-auth-ui/react";
3
- import { cn } from "@heroui/react";
4
- export function MagicLinkEmail({ colors, classNames, ...props }) {
5
- return (_jsx(MagicLinkEmailPrimitive, { colors: {
6
- light: {
7
- background: "#F5F5F5",
8
- primary: "#0285F7",
9
- primaryForeground: "#FCFCFC",
10
- ...colors?.light
11
- },
12
- dark: {
13
- background: "#060607",
14
- primary: "#0584F6",
15
- primaryForeground: "#FCFCFC",
16
- ...colors?.dark
17
- }
18
- }, classNames: {
19
- ...classNames,
20
- card: cn("border-none rounded-3xl", classNames?.card),
21
- button: cn("rounded-full", classNames?.button)
22
- }, ...props }));
1
+ import { MagicLinkEmail as e } from "@better-auth-ui/react";
2
+ import { cn as t } from "@heroui/react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/email/magic-link-email.tsx
5
+ function r({ colors: r, classNames: i, ...a }) {
6
+ return /* @__PURE__ */ n(e, {
7
+ colors: {
8
+ light: {
9
+ background: "#F5F5F5",
10
+ primary: "#0285F7",
11
+ primaryForeground: "#FCFCFC",
12
+ ...r?.light
13
+ },
14
+ dark: {
15
+ background: "#060607",
16
+ primary: "#0584F6",
17
+ primaryForeground: "#FCFCFC",
18
+ ...r?.dark
19
+ }
20
+ },
21
+ classNames: {
22
+ ...i,
23
+ card: t("border-none rounded-3xl", i?.card),
24
+ button: t("rounded-full", i?.button)
25
+ },
26
+ ...a
27
+ });
23
28
  }
29
+ //#endregion
30
+ export { r as MagicLinkEmail };
@@ -1,3 +1,3 @@
1
- import { type NewDeviceEmailProps } from "@better-auth-ui/react";
2
- export type { NewDeviceEmailProps } from "@better-auth-ui/react";
1
+ import { NewDeviceEmailProps } from '@better-auth-ui/react';
2
+ export type { NewDeviceEmailProps } from '@better-auth-ui/react';
3
3
  export declare function NewDeviceEmail({ colors, classNames, ...props }: NewDeviceEmailProps): import("react/jsx-runtime").JSX.Element;
@@ -1,23 +1,30 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { NewDeviceEmail as NewDeviceEmailPrimitive } from "@better-auth-ui/react";
3
- import { cn } from "@heroui/react";
4
- export function NewDeviceEmail({ colors, classNames, ...props }) {
5
- return (_jsx(NewDeviceEmailPrimitive, { colors: {
6
- light: {
7
- background: "#F5F5F5",
8
- primary: "#0285F7",
9
- primaryForeground: "#FCFCFC",
10
- ...colors?.light
11
- },
12
- dark: {
13
- background: "#060607",
14
- primary: "#0584F6",
15
- primaryForeground: "#FCFCFC",
16
- ...colors?.dark
17
- }
18
- }, classNames: {
19
- ...classNames,
20
- card: cn("border-none rounded-3xl", classNames?.card),
21
- button: cn("rounded-full", classNames?.button)
22
- }, ...props }));
1
+ import { NewDeviceEmail as e } from "@better-auth-ui/react";
2
+ import { cn as t } from "@heroui/react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/email/new-device-email.tsx
5
+ function r({ colors: r, classNames: i, ...a }) {
6
+ return /* @__PURE__ */ n(e, {
7
+ colors: {
8
+ light: {
9
+ background: "#F5F5F5",
10
+ primary: "#0285F7",
11
+ primaryForeground: "#FCFCFC",
12
+ ...r?.light
13
+ },
14
+ dark: {
15
+ background: "#060607",
16
+ primary: "#0584F6",
17
+ primaryForeground: "#FCFCFC",
18
+ ...r?.dark
19
+ }
20
+ },
21
+ classNames: {
22
+ ...i,
23
+ card: t("border-none rounded-3xl", i?.card),
24
+ button: t("rounded-full", i?.button)
25
+ },
26
+ ...a
27
+ });
23
28
  }
29
+ //#endregion
30
+ export { r as NewDeviceEmail };
@@ -1,3 +1,3 @@
1
- import { type OtpEmailProps } from "@better-auth-ui/react";
2
- export type { OtpEmailProps } from "@better-auth-ui/react";
1
+ import { OtpEmailProps } from '@better-auth-ui/react';
2
+ export type { OtpEmailProps } from '@better-auth-ui/react';
3
3
  export declare function OtpEmail({ colors, classNames, ...props }: OtpEmailProps): import("react/jsx-runtime").JSX.Element;
@@ -1,22 +1,29 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { OtpEmail as OtpEmailPrimitive } from "@better-auth-ui/react";
3
- import { cn } from "@heroui/react";
4
- export function OtpEmail({ colors, classNames, ...props }) {
5
- return (_jsx(OtpEmailPrimitive, { colors: {
6
- light: {
7
- background: "#F5F5F5",
8
- primary: "#0285F7",
9
- primaryForeground: "#FCFCFC",
10
- ...colors?.light
11
- },
12
- dark: {
13
- background: "#060607",
14
- primary: "#0584F6",
15
- primaryForeground: "#FCFCFC",
16
- ...colors?.dark
17
- }
18
- }, classNames: {
19
- ...classNames,
20
- card: cn("border-none rounded-3xl", classNames?.card)
21
- }, ...props }));
1
+ import { OtpEmail as e } from "@better-auth-ui/react";
2
+ import { cn as t } from "@heroui/react";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ //#region src/components/email/otp-email.tsx
5
+ function r({ colors: r, classNames: i, ...a }) {
6
+ return /* @__PURE__ */ n(e, {
7
+ colors: {
8
+ light: {
9
+ background: "#F5F5F5",
10
+ primary: "#0285F7",
11
+ primaryForeground: "#FCFCFC",
12
+ ...r?.light
13
+ },
14
+ dark: {
15
+ background: "#060607",
16
+ primary: "#0584F6",
17
+ primaryForeground: "#FCFCFC",
18
+ ...r?.dark
19
+ }
20
+ },
21
+ classNames: {
22
+ ...i,
23
+ card: t("border-none rounded-3xl", i?.card)
24
+ },
25
+ ...a
26
+ });
22
27
  }
28
+ //#endregion
29
+ export { r as OtpEmail };
@@ -1,3 +1,3 @@
1
- import { type PasswordChangedEmailProps } from "@better-auth-ui/react";
2
- export type { PasswordChangedEmailProps } from "@better-auth-ui/react";
1
+ import { PasswordChangedEmailProps } from '@better-auth-ui/react';
2
+ export type { PasswordChangedEmailProps } from '@better-auth-ui/react';
3
3
  export declare function PasswordChangedEmail({ colors, classNames, ...props }: PasswordChangedEmailProps): import("react/jsx-runtime").JSX.Element;