@better-auth-ui/heroui 1.6.2 → 1.6.4

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 (213) hide show
  1. package/dist/components/auth/additional-field.d.ts +4 -0
  2. package/dist/components/auth/additional-field.js +270 -0
  3. package/dist/components/auth/auth-provider.d.ts +4 -6
  4. package/dist/components/auth/auth-provider.js +12 -11
  5. package/dist/components/auth/auth.d.ts +1 -1
  6. package/dist/components/auth/auth.js +54 -28
  7. package/dist/components/{settings/security → auth/delete-user}/danger-zone.d.ts +3 -4
  8. package/dist/components/{settings/security → auth/delete-user}/danger-zone.js +1 -1
  9. package/dist/components/{settings/security → auth/delete-user}/delete-user.d.ts +1 -1
  10. package/dist/components/auth/delete-user/delete-user.js +95 -0
  11. package/dist/components/{email → auth/email}/email-changed-email.d.ts +2 -2
  12. package/dist/components/{email → auth/email}/email-changed-email.js +7 -7
  13. package/dist/components/{email → auth/email}/email-verification-email.d.ts +2 -2
  14. package/dist/components/{email → auth/email}/email-verification-email.js +7 -7
  15. package/dist/components/auth/email/magic-link-email.d.ts +3 -0
  16. package/dist/components/{email → auth/email}/magic-link-email.js +7 -7
  17. package/dist/components/auth/email/new-device-email.d.ts +3 -0
  18. package/dist/components/{email → auth/email}/new-device-email.js +7 -7
  19. package/dist/components/auth/email/otp-email.d.ts +3 -0
  20. package/dist/components/{email → auth/email}/otp-email.js +6 -6
  21. package/dist/components/{email → auth/email}/password-changed-email.d.ts +2 -2
  22. package/dist/components/{email → auth/email}/password-changed-email.js +7 -7
  23. package/dist/components/{email → auth/email}/reset-password-email.d.ts +2 -2
  24. package/dist/components/{email → auth/email}/reset-password-email.js +7 -7
  25. package/dist/components/auth/error-toaster.d.ts +1 -0
  26. package/dist/components/auth/error-toaster.js +17 -0
  27. package/dist/components/auth/forgot-password.d.ts +2 -2
  28. package/dist/components/auth/forgot-password.js +42 -42
  29. package/dist/components/auth/magic-link/magic-link-button.d.ts +11 -0
  30. package/dist/components/auth/magic-link/magic-link-button.js +20 -0
  31. package/dist/components/auth/magic-link/magic-link.d.ts +16 -0
  32. package/dist/components/auth/magic-link/magic-link.js +87 -0
  33. package/dist/components/{settings/account → auth/multi-session}/manage-account.d.ts +2 -6
  34. package/dist/components/auth/multi-session/manage-account.js +49 -0
  35. package/dist/components/{settings/account → auth/multi-session}/manage-accounts.d.ts +1 -1
  36. package/dist/components/auth/multi-session/manage-accounts.js +34 -0
  37. package/dist/components/{user/switch-account-menu.d.ts → auth/multi-session/switch-account-submenu-content.d.ts} +3 -3
  38. package/dist/components/auth/multi-session/switch-account-submenu-content.js +29 -0
  39. package/dist/components/{user/switch-account-item.d.ts → auth/multi-session/switch-account-submenu-item.d.ts} +2 -2
  40. package/dist/components/auth/multi-session/switch-account-submenu-item.js +20 -0
  41. package/dist/components/auth/multi-session/switch-account-submenu.d.ts +13 -0
  42. package/dist/components/auth/multi-session/switch-account-submenu.js +24 -0
  43. package/dist/components/auth/passkey/passkey-button.d.ts +6 -0
  44. package/dist/components/auth/passkey/passkey-button.js +24 -0
  45. package/dist/components/auth/passkey/passkey.js +45 -0
  46. package/dist/components/{settings/security → auth/passkey}/passkeys.d.ts +1 -1
  47. package/dist/components/auth/passkey/passkeys.js +106 -0
  48. package/dist/components/auth/provider-button.d.ts +13 -0
  49. package/dist/components/auth/provider-button.js +25 -0
  50. package/dist/components/auth/provider-buttons.d.ts +3 -10
  51. package/dist/components/auth/provider-buttons.js +14 -22
  52. package/dist/components/auth/reset-password.d.ts +1 -1
  53. package/dist/components/auth/reset-password.js +110 -110
  54. package/dist/components/{settings → auth/settings}/account/account-settings.d.ts +5 -2
  55. package/dist/components/auth/settings/account/account-settings.js +20 -0
  56. package/dist/components/auth/settings/account/change-avatar.js +89 -0
  57. package/dist/components/{settings → auth/settings}/account/change-email.d.ts +1 -1
  58. package/dist/components/{settings → auth/settings}/account/change-email.js +17 -20
  59. package/dist/components/{settings → auth/settings}/account/user-profile.d.ts +3 -4
  60. package/dist/components/auth/settings/account/user-profile.js +86 -0
  61. package/dist/components/auth/settings/security/active-session.js +59 -0
  62. package/dist/components/{settings → auth/settings}/security/active-sessions.d.ts +1 -1
  63. package/dist/components/auth/settings/security/active-sessions.js +34 -0
  64. package/dist/components/{settings → auth/settings}/security/change-password.d.ts +1 -1
  65. package/dist/components/auth/settings/security/change-password.js +189 -0
  66. package/dist/components/auth/settings/security/linked-account.js +56 -0
  67. package/dist/components/{settings → auth/settings}/security/linked-accounts.d.ts +1 -1
  68. package/dist/components/auth/settings/security/linked-accounts.js +45 -0
  69. package/dist/components/{settings → auth/settings}/security/security-settings.d.ts +1 -1
  70. package/dist/components/auth/settings/security/security-settings.js +22 -0
  71. package/dist/components/auth/settings/settings.js +45 -0
  72. package/dist/components/auth/sign-in.d.ts +1 -1
  73. package/dist/components/auth/sign-in.js +64 -100
  74. package/dist/components/auth/sign-out.js +11 -11
  75. package/dist/components/auth/sign-up.d.ts +1 -1
  76. package/dist/components/auth/sign-up.js +123 -157
  77. package/dist/components/{settings/account → auth/theme}/appearance.d.ts +3 -6
  78. package/dist/components/auth/theme/appearance.js +72 -0
  79. package/dist/components/auth/theme/theme-toggle-item.d.ts +5 -0
  80. package/dist/components/auth/theme/theme-toggle-item.js +58 -0
  81. package/dist/components/auth/user/user-avatar.js +29 -0
  82. package/dist/components/{user → auth/user}/user-button.d.ts +2 -6
  83. package/dist/components/auth/user/user-button.js +55 -0
  84. package/dist/components/auth/user/user-view.js +37 -0
  85. package/dist/components/auth/username/sign-in-username.d.ts +14 -0
  86. package/dist/components/auth/username/sign-in-username.js +142 -0
  87. package/dist/components/auth/username/username-field.d.ts +8 -0
  88. package/dist/components/auth/username/username-field.js +51 -0
  89. package/dist/email.d.ts +7 -0
  90. package/dist/email.js +9 -0
  91. package/dist/index.d.ts +13 -27
  92. package/dist/index.js +22 -36
  93. package/dist/lib/auth/auth-plugin.d.ts +44 -0
  94. package/dist/lib/auth/delete-user-plugin.d.ts +17 -0
  95. package/dist/lib/auth/delete-user-plugin.js +10 -0
  96. package/dist/lib/auth/magic-link-plugin.d.ts +31 -0
  97. package/dist/lib/auth/magic-link-plugin.js +13 -0
  98. package/dist/lib/auth/multi-session-plugin.d.ts +18 -0
  99. package/dist/lib/auth/multi-session-plugin.js +12 -0
  100. package/dist/lib/auth/passkey-plugin.d.ts +20 -0
  101. package/dist/lib/auth/passkey-plugin.js +12 -0
  102. package/dist/lib/auth/theme-plugin.d.ts +68 -0
  103. package/dist/lib/auth/theme-plugin.js +23 -0
  104. package/dist/lib/auth/username-plugin.d.ts +63 -0
  105. package/dist/lib/auth/username-plugin.js +18 -0
  106. package/dist/plugins.d.ts +20 -0
  107. package/dist/plugins.js +21 -0
  108. package/package.json +22 -22
  109. package/src/components/auth/additional-field.tsx +554 -0
  110. package/src/components/auth/auth-provider.tsx +8 -5
  111. package/src/components/auth/auth.tsx +100 -36
  112. package/src/components/{settings/security → auth/delete-user}/danger-zone.tsx +3 -10
  113. package/src/components/{settings/security → auth/delete-user}/delete-user.tsx +31 -24
  114. package/src/components/{email → auth/email}/email-changed-email.tsx +2 -2
  115. package/src/components/{email → auth/email}/email-verification-email.tsx +2 -2
  116. package/src/components/{email → auth/email}/magic-link-email.tsx +2 -2
  117. package/src/components/{email → auth/email}/new-device-email.tsx +2 -2
  118. package/src/components/{email → auth/email}/otp-email.tsx +2 -2
  119. package/src/components/{email → auth/email}/password-changed-email.tsx +2 -2
  120. package/src/components/{email → auth/email}/reset-password-email.tsx +2 -2
  121. package/src/components/auth/error-toaster.tsx +25 -0
  122. package/src/components/auth/forgot-password.tsx +15 -13
  123. package/src/components/auth/magic-link/magic-link-button.tsx +61 -0
  124. package/src/components/auth/{magic-link.tsx → magic-link/magic-link.tsx} +52 -57
  125. package/src/components/{settings/account → auth/multi-session}/manage-account.tsx +15 -15
  126. package/src/components/{settings/account → auth/multi-session}/manage-accounts.tsx +16 -12
  127. package/src/components/{user/switch-account-menu.tsx → auth/multi-session/switch-account-submenu-content.tsx} +19 -17
  128. package/src/components/{user/switch-account-item.tsx → auth/multi-session/switch-account-submenu-item.tsx} +18 -8
  129. package/src/components/auth/multi-session/switch-account-submenu.tsx +50 -0
  130. package/src/components/auth/passkey/passkey-button.tsx +56 -0
  131. package/src/components/{settings/security → auth/passkey}/passkey.tsx +21 -9
  132. package/src/components/auth/passkey/passkeys.tsx +196 -0
  133. package/src/components/auth/provider-button.tsx +65 -0
  134. package/src/components/auth/provider-buttons.tsx +23 -45
  135. package/src/components/auth/reset-password.tsx +14 -9
  136. package/src/components/{settings → auth/settings}/account/account-settings.tsx +15 -13
  137. package/src/components/{settings → auth/settings}/account/change-avatar.tsx +4 -5
  138. package/src/components/{settings → auth/settings}/account/change-email.tsx +5 -6
  139. package/src/components/auth/settings/account/user-profile.tsx +171 -0
  140. package/src/components/{settings → auth/settings}/security/active-session.tsx +8 -6
  141. package/src/components/{settings → auth/settings}/security/active-sessions.tsx +5 -10
  142. package/src/components/{settings → auth/settings}/security/change-password.tsx +22 -14
  143. package/src/components/{settings → auth/settings}/security/linked-account.tsx +10 -16
  144. package/src/components/{settings → auth/settings}/security/linked-accounts.tsx +4 -9
  145. package/src/components/{settings → auth/settings}/security/security-settings.tsx +7 -6
  146. package/src/components/{settings → auth/settings}/settings.tsx +2 -2
  147. package/src/components/auth/sign-in.tsx +39 -80
  148. package/src/components/auth/sign-out.tsx +2 -2
  149. package/src/components/auth/sign-up.tsx +110 -147
  150. package/src/components/{settings/account → auth/theme}/appearance.tsx +18 -25
  151. package/src/components/auth/theme/theme-toggle-item.tsx +110 -0
  152. package/src/components/{user → auth/user}/user-avatar.tsx +12 -4
  153. package/src/components/{user → auth/user}/user-button.tsx +15 -88
  154. package/src/components/{user → auth/user}/user-view.tsx +12 -4
  155. package/src/components/auth/username/sign-in-username.tsx +283 -0
  156. package/src/components/auth/username/username-field.tsx +122 -0
  157. package/src/email.ts +9 -0
  158. package/src/index.tsx +13 -27
  159. package/src/lib/auth/auth-plugin.ts +67 -0
  160. package/src/lib/auth/delete-user-plugin.ts +15 -0
  161. package/src/lib/auth/magic-link-plugin.ts +26 -0
  162. package/src/lib/auth/multi-session-plugin.ts +17 -0
  163. package/src/lib/auth/passkey-plugin.ts +17 -0
  164. package/src/lib/auth/theme-plugin.ts +86 -0
  165. package/src/lib/auth/username-plugin.tsx +30 -0
  166. package/src/plugins.ts +23 -0
  167. package/dist/components/auth/magic-link-button.d.ts +0 -13
  168. package/dist/components/auth/magic-link-button.js +0 -16
  169. package/dist/components/auth/magic-link.d.ts +0 -17
  170. package/dist/components/auth/magic-link.js +0 -111
  171. package/dist/components/auth/passkey-button.d.ts +0 -4
  172. package/dist/components/auth/passkey-button.js +0 -24
  173. package/dist/components/email/magic-link-email.d.ts +0 -3
  174. package/dist/components/email/new-device-email.d.ts +0 -3
  175. package/dist/components/email/otp-email.d.ts +0 -3
  176. package/dist/components/settings/account/account-settings.js +0 -23
  177. package/dist/components/settings/account/appearance.js +0 -71
  178. package/dist/components/settings/account/change-avatar.js +0 -89
  179. package/dist/components/settings/account/manage-account.js +0 -51
  180. package/dist/components/settings/account/manage-accounts.js +0 -33
  181. package/dist/components/settings/account/user-profile.js +0 -106
  182. package/dist/components/settings/security/active-session.js +0 -62
  183. package/dist/components/settings/security/active-sessions.js +0 -34
  184. package/dist/components/settings/security/change-password.js +0 -192
  185. package/dist/components/settings/security/delete-user.js +0 -97
  186. package/dist/components/settings/security/linked-account.js +0 -62
  187. package/dist/components/settings/security/linked-accounts.js +0 -45
  188. package/dist/components/settings/security/passkey.js +0 -43
  189. package/dist/components/settings/security/passkeys.js +0 -53
  190. package/dist/components/settings/security/security-settings.js +0 -25
  191. package/dist/components/settings/settings.js +0 -45
  192. package/dist/components/user/switch-account-item.js +0 -20
  193. package/dist/components/user/switch-account-menu.js +0 -28
  194. package/dist/components/user/user-avatar.js +0 -29
  195. package/dist/components/user/user-button.js +0 -91
  196. package/dist/components/user/user-view.js +0 -37
  197. package/dist/core.d.ts +0 -1
  198. package/dist/core.js +0 -1
  199. package/dist/react-exports.d.ts +0 -1
  200. package/dist/react-exports.js +0 -1
  201. package/src/components/auth/magic-link-button.tsx +0 -43
  202. package/src/components/auth/passkey-button.tsx +0 -36
  203. package/src/components/settings/account/user-profile.tsx +0 -218
  204. package/src/components/settings/security/passkeys.tsx +0 -104
  205. package/src/core.ts +0 -1
  206. package/src/react-exports.ts +0 -1
  207. /package/dist/components/{settings/security → auth/passkey}/passkey.d.ts +0 -0
  208. /package/dist/components/{settings → auth/settings}/account/change-avatar.d.ts +0 -0
  209. /package/dist/components/{settings → auth/settings}/security/active-session.d.ts +0 -0
  210. /package/dist/components/{settings → auth/settings}/security/linked-account.d.ts +0 -0
  211. /package/dist/components/{settings → auth/settings}/settings.d.ts +0 -0
  212. /package/dist/components/{user → auth/user}/user-avatar.d.ts +0 -0
  213. /package/dist/components/{user → auth/user}/user-view.d.ts +0 -0
@@ -0,0 +1,24 @@
1
+ import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
+ import { authMutationKeys as t } from "@better-auth-ui/core";
3
+ import { useAuth as n, useAuthPlugin as r, useSignInPasskey as i } from "@better-auth-ui/react";
4
+ import { Fingerprint as a } from "@gravity-ui/icons";
5
+ import { Button as o, Spinner as s } from "@heroui/react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ import { useIsMutating as u } from "@tanstack/react-query";
8
+ //#region src/components/auth/passkey/passkey-button.tsx
9
+ function d({ view: d }) {
10
+ let { authClient: f, localization: p, redirectTo: m, navigate: h } = n(), { localization: g } = r(e), { mutate: _, isPending: v } = i(f, { onSuccess: () => h({ to: m }) }), y = u({ mutationKey: t.signIn.all }) + u({ mutationKey: t.signUp.all }) > 0;
11
+ return d === "signUp" ? null : /* @__PURE__ */ l(o, {
12
+ className: "w-full",
13
+ variant: "tertiary",
14
+ isDisabled: y,
15
+ isPending: v,
16
+ onPress: () => _(),
17
+ children: [v ? /* @__PURE__ */ c(s, {
18
+ color: "current",
19
+ size: "sm"
20
+ }) : /* @__PURE__ */ c(a, {}), p.auth.continueWith.replace("{{provider}}", g.passkey)]
21
+ });
22
+ }
23
+ //#endregion
24
+ export { d as PasskeyButton };
@@ -0,0 +1,45 @@
1
+ import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
+ import { useAuth as t, useAuthPlugin as n, useDeletePasskey as r } from "@better-auth-ui/react";
3
+ import { Fingerprint as i, Xmark as a } from "@gravity-ui/icons";
4
+ import { Button as o, Spinner as s } from "@heroui/react";
5
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
+ //#region src/components/auth/passkey/passkey.tsx
7
+ function u({ passkey: u }) {
8
+ let { authClient: d, localization: f } = t(), { localization: p } = n(e), { mutate: m, isPending: h } = r(d), g = u.name || p.passkey;
9
+ return /* @__PURE__ */ l("div", {
10
+ className: "flex items-center gap-3",
11
+ children: [
12
+ /* @__PURE__ */ c("div", {
13
+ className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
14
+ children: /* @__PURE__ */ c(i, { className: "size-4.5" })
15
+ }),
16
+ /* @__PURE__ */ l("div", {
17
+ className: "flex flex-col min-w-0",
18
+ children: [/* @__PURE__ */ c("span", {
19
+ className: "text-sm font-medium leading-tight",
20
+ children: g
21
+ }), /* @__PURE__ */ c("span", {
22
+ className: "text-xs text-muted",
23
+ children: new Date(u.createdAt).toLocaleString(void 0, {
24
+ dateStyle: "medium",
25
+ timeStyle: "short"
26
+ })
27
+ })]
28
+ }),
29
+ /* @__PURE__ */ l(o, {
30
+ className: "ml-auto shrink-0",
31
+ variant: "outline",
32
+ size: "sm",
33
+ isPending: h,
34
+ onPress: () => m({ id: u.id }),
35
+ "aria-label": p.deletePasskey.replace("{{name}}", g),
36
+ children: [h ? /* @__PURE__ */ c(s, {
37
+ color: "current",
38
+ size: "sm"
39
+ }) : /* @__PURE__ */ c(a, {}), f.settings.delete]
40
+ })
41
+ ]
42
+ });
43
+ }
44
+ //#endregion
45
+ export { u as Passkey };
@@ -3,4 +3,4 @@ export type PasskeysProps = {
3
3
  className?: string;
4
4
  variant?: CardProps["variant"];
5
5
  };
6
- export declare function Passkeys({ className, variant, ...props }: PasskeysProps & CardProps): import("react/jsx-runtime").JSX.Element;
6
+ export declare function Passkeys({ className, variant, ...props }: PasskeysProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,106 @@
1
+ import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
+ import { Passkey as t } from "./passkey.js";
3
+ import { useAddPasskey as n, useAuth as r, useAuthPlugin as i, useListPasskeys as a } from "@better-auth-ui/react";
4
+ import { Fingerprint as o } from "@gravity-ui/icons";
5
+ import { AlertDialog as s, Button as c, Card as l, FieldError as u, Form as d, Input as f, Label as p, Skeleton as m, Spinner as h, TextField as g, cn as _ } from "@heroui/react";
6
+ import { useState as v } from "react";
7
+ import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
8
+ //#region src/components/auth/passkey/passkeys.tsx
9
+ function S({ className: m, variant: S, ...w }) {
10
+ let { authClient: T, localization: E } = r(), { localization: D } = i(e), { data: O, isPending: k } = a(T), { mutate: A, isPending: j } = n(T), [M, N] = v(!1), [P, F] = v(""), I = (e) => {
11
+ N(e), F("");
12
+ }, L = async (e) => {
13
+ e.preventDefault(), A({ name: P.trim() || void 0 }, { onSuccess: () => {
14
+ N(!1), F("");
15
+ } });
16
+ };
17
+ return /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("h2", {
18
+ className: _("text-sm font-semibold mb-3"),
19
+ children: D.passkeys
20
+ }), /* @__PURE__ */ b(l, {
21
+ className: _(m),
22
+ variant: S,
23
+ ...w,
24
+ children: /* @__PURE__ */ x(l.Content, {
25
+ className: "gap-0",
26
+ children: [/* @__PURE__ */ x("div", {
27
+ className: "flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",
28
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("p", {
29
+ className: "text-sm font-medium leading-tight",
30
+ children: D.passkeysDescription
31
+ }), /* @__PURE__ */ b("p", {
32
+ className: "text-muted text-xs mt-0.5",
33
+ children: D.passkeysInstructions
34
+ })] }), /* @__PURE__ */ x(s, { children: [/* @__PURE__ */ b(c, {
35
+ className: "shrink-0",
36
+ size: "sm",
37
+ isDisabled: k,
38
+ onPress: () => N(!0),
39
+ children: D.addPasskey
40
+ }), /* @__PURE__ */ b(s.Backdrop, {
41
+ isOpen: M,
42
+ onOpenChange: I,
43
+ children: /* @__PURE__ */ b(s.Container, { children: /* @__PURE__ */ b(s.Dialog, { children: /* @__PURE__ */ x(d, {
44
+ onSubmit: L,
45
+ children: [
46
+ /* @__PURE__ */ b(s.CloseTrigger, {}),
47
+ /* @__PURE__ */ x(s.Header, { children: [/* @__PURE__ */ b(s.Icon, {
48
+ status: "default",
49
+ children: /* @__PURE__ */ b(o, {})
50
+ }), /* @__PURE__ */ b(s.Heading, { children: D.addPasskey })] }),
51
+ /* @__PURE__ */ x(s.Body, {
52
+ className: "overflow-visible",
53
+ children: [/* @__PURE__ */ b("p", {
54
+ className: "text-muted text-sm",
55
+ children: D.passkeysInstructions
56
+ }), /* @__PURE__ */ x(g, {
57
+ className: "mt-4",
58
+ name: "passkey-name",
59
+ isDisabled: j,
60
+ value: P,
61
+ onChange: F,
62
+ children: [
63
+ /* @__PURE__ */ b(p, { children: D.passkey }),
64
+ /* @__PURE__ */ b(f, {
65
+ autoFocus: !0,
66
+ placeholder: E.settings.optional,
67
+ variant: "secondary"
68
+ }),
69
+ /* @__PURE__ */ b(u, {})
70
+ ]
71
+ })]
72
+ }),
73
+ /* @__PURE__ */ x(s.Footer, { children: [/* @__PURE__ */ b(c, {
74
+ slot: "close",
75
+ variant: "tertiary",
76
+ isDisabled: j,
77
+ children: E.settings.cancel
78
+ }), /* @__PURE__ */ x(c, {
79
+ type: "submit",
80
+ isPending: j,
81
+ children: [j && /* @__PURE__ */ b(h, {
82
+ color: "current",
83
+ size: "sm"
84
+ }), D.addPasskey]
85
+ })] })
86
+ ]
87
+ }) }) })
88
+ })] })]
89
+ }), k ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ b(C, {})] }) : O?.map((e) => /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("div", { className: "border-b border-dashed -mx-4 md:-mx-6 my-4" }), /* @__PURE__ */ b(t, { passkey: e })] }, e.id))]
90
+ })
91
+ })] });
92
+ }
93
+ function C() {
94
+ return /* @__PURE__ */ b("div", {
95
+ className: "flex items-center justify-between",
96
+ children: /* @__PURE__ */ x("div", {
97
+ className: "flex items-center gap-3",
98
+ children: [/* @__PURE__ */ b(m, { className: "size-10 rounded-xl" }), /* @__PURE__ */ x("div", {
99
+ className: "flex flex-col gap-1",
100
+ children: [/* @__PURE__ */ b(m, { className: "h-4 w-24 rounded-lg" }), /* @__PURE__ */ b(m, { className: "h-3 w-20 rounded-lg" })]
101
+ })]
102
+ })
103
+ });
104
+ }
105
+ //#endregion
106
+ export { S as Passkeys };
@@ -0,0 +1,13 @@
1
+ import { ButtonProps } from '@heroui/react';
2
+ import { SocialProvider } from 'better-auth/social-providers';
3
+ export type ProviderButtonProps = {
4
+ provider: SocialProvider;
5
+ display?: "full" | "name" | "icon";
6
+ } & Omit<ButtonProps, "children" | "onPress" | "isPending" | "isDisabled">;
7
+ /**
8
+ * Social provider sign-in button.
9
+ *
10
+ * @param provider - Provider to sign in with.
11
+ * @param display - `"full"` (e.g. "Continue with Google"), `"name"` (just the provider name), or `"icon"` (icon only).
12
+ */
13
+ export declare function ProviderButton({ provider, display, variant, ...props }: ProviderButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { authMutationKeys as e, getProviderName as t } from "@better-auth-ui/core";
2
+ import { providerIcons as n, useAuth as r, useSignInSocial as i } from "@better-auth-ui/react";
3
+ import { Button as a, Spinner as o } from "@heroui/react";
4
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ import { useIsMutating as l } from "@tanstack/react-query";
6
+ //#region src/components/auth/provider-button.tsx
7
+ function u({ provider: u, display: d = "full", variant: f = "tertiary", ...p }) {
8
+ let { authClient: m, baseURL: h, localization: g, redirectTo: _ } = r(), v = `${h}${_}`, { mutate: y, isPending: b } = i(m), x = n[u];
9
+ return /* @__PURE__ */ c(a, {
10
+ variant: f,
11
+ isPending: l({ mutationKey: e.signIn.all }) + l({ mutationKey: e.signUp.all }) > 0,
12
+ onPress: () => y({
13
+ provider: u,
14
+ callbackURL: v
15
+ }),
16
+ ...p,
17
+ "aria-label": t(u),
18
+ children: [b ? /* @__PURE__ */ s(o, {
19
+ color: "current",
20
+ size: "sm"
21
+ }) : /* @__PURE__ */ s(x, {}), d === "full" ? g.auth.continueWith.replace("{{provider}}", t(u)) : d === "name" ? t(u) : null]
22
+ });
23
+ }
24
+ //#endregion
25
+ export { u as ProviderButton };
@@ -1,19 +1,12 @@
1
- import { SocialProvider } from 'better-auth/social-providers';
2
1
  export type ProviderButtonsProps = {
3
- isPending: boolean;
4
2
  socialLayout?: SocialLayout;
5
- signInSocial: (params: {
6
- provider: SocialProvider;
7
- callbackURL: string;
8
- }) => void;
9
3
  };
10
4
  export type SocialLayout = "auto" | "horizontal" | "vertical" | "grid";
11
5
  /**
12
- * Render social provider sign-in buttons and handle initiation and pending state.
6
+ * Render social provider sign-in buttons. Each button owns its own sign-in
7
+ * mutation and reads shared auth pending state from React Query.
13
8
  *
14
- * @param isPending - Disables all provider buttons when true.
15
9
  * @param socialLayout - Preferred layout for the buttons; `"auto"` picks `"horizontal"` when there are four or more providers, otherwise `"vertical"`.
16
- * @param signInSocial - Callback invoked with the provider and callbackURL when a button is clicked.
17
10
  * @returns The JSX element that renders the configured social provider buttons.
18
11
  */
19
- export declare function ProviderButtons({ isPending, socialLayout, signInSocial }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ProviderButtons({ socialLayout }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,19 @@
1
- import { providerIcons as e, useAuth as t } from "@better-auth-ui/react";
2
- import { Button as n, cn as r } from "@heroui/react";
3
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
- import { useMemo as o } from "react";
5
- import { getProviderName as s } from "@better-auth-ui/core";
1
+ import { ProviderButton as e } from "./provider-button.js";
2
+ import { useAuth as t } from "@better-auth-ui/react";
3
+ import { cn as n } from "@heroui/react";
4
+ import { useMemo as r } from "react";
5
+ import { jsx as i } from "react/jsx-runtime";
6
6
  //#region src/components/auth/provider-buttons.tsx
7
- function c({ isPending: c, socialLayout: l = "auto", signInSocial: u }) {
8
- let { baseURL: d, localization: f, redirectTo: p, socialProviders: m } = t(), h = `${d}${p}`, g = o(() => l === "auto" ? m?.length && m.length >= 4 ? "horizontal" : "vertical" : l, [l, m?.length]);
7
+ function a({ socialLayout: a = "auto" }) {
8
+ let { socialProviders: o } = t(), s = r(() => a === "auto" ? o?.length && o.length >= 4 ? "horizontal" : "vertical" : a, [a, o?.length]);
9
9
  return /* @__PURE__ */ i("div", {
10
- className: r("gap-3", g === "grid" && "grid grid-cols-2", g === "vertical" && "flex flex-col", g === "horizontal" && "flex flex-wrap"),
11
- children: m?.map((t) => {
12
- let o = e[t];
13
- return /* @__PURE__ */ a(n, {
14
- className: r("w-full", g === "horizontal" && "flex-1"),
15
- variant: "tertiary",
16
- isPending: c,
17
- onPress: () => u({
18
- provider: t,
19
- callbackURL: h
20
- }),
21
- children: [/* @__PURE__ */ i(o, {}), g === "vertical" ? f.auth.continueWith.replace("{{provider}}", s(t)) : g === "grid" ? s(t) : null]
22
- }, t);
23
- })
10
+ className: n("gap-3", s === "grid" && "grid grid-cols-2", s === "vertical" && "flex flex-col", s === "horizontal" && "flex flex-wrap"),
11
+ children: o?.map((t) => /* @__PURE__ */ i(e, {
12
+ provider: t,
13
+ display: s === "vertical" ? "full" : s === "grid" ? "name" : "icon",
14
+ className: n("w-full", s === "horizontal" && "flex-1")
15
+ }, t))
24
16
  });
25
17
  }
26
18
  //#endregion
27
- export { c as ProviderButtons };
19
+ export { a as ProviderButtons };
@@ -8,4 +8,4 @@ export type ResetPasswordProps = {
8
8
  *
9
9
  * Renders password (and optional confirm-password) inputs with visibility toggles, applies min/max length constraints from the auth configuration, shows field errors, and submits the new password to the auth client.
10
10
  */
11
- export declare function ResetPassword({ className, variant, ...props }: ResetPasswordProps & CardProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ResetPassword({ className, variant, ...props }: ResetPasswordProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
@@ -1,141 +1,141 @@
1
1
  import { useAuth as e, useResetPassword as t } from "@better-auth-ui/react";
2
- import { Button as n, Card as r, Description as i, FieldError as a, Form as o, InputGroup as s, Label as c, Link as l, Spinner as u, TextField as d, cn as f, toast as p } from "@heroui/react";
3
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
2
+ import { Eye as n, EyeSlash as r } from "@gravity-ui/icons";
3
+ import { Button as i, Card as a, Description as o, FieldError as s, Form as c, InputGroup as l, Label as u, Link as d, Spinner as f, TextField as p, cn as m, toast as h } from "@heroui/react";
4
4
  import { useEffect as g, useState as _ } from "react";
5
- import { Eye as v, EyeSlash as y } from "@gravity-ui/icons";
5
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
6
6
  //#region src/components/auth/reset-password.tsx
7
7
  function b({ className: b, variant: x, ...S }) {
8
- let { basePaths: C, emailAndPassword: w, localization: T, viewPaths: E, navigate: D } = e(), { mutate: O, isPending: k } = t({
9
- onError: (e) => p.danger(e.error?.message || e.message),
10
- onSuccess: () => {
11
- p.success(T.auth.passwordResetSuccess), D({ to: `${C.auth}/${E.auth.signIn}` });
12
- }
13
- }), [A, j] = _(!1), [M, N] = _(!1);
8
+ let { authClient: C, basePaths: w, emailAndPassword: T, localization: E, viewPaths: D, navigate: O } = e(), { mutate: k, isPending: A } = t(C, { onSuccess: () => {
9
+ h.success(E.auth.passwordResetSuccess), O({ to: `${w.auth}/${D.auth.signIn}` });
10
+ } }), [j, M] = _(!1), [N, P] = _(!1);
14
11
  g(() => {
15
- new URLSearchParams(window.location.search).get("token") || (p.danger(T.auth.invalidResetPasswordToken), D({ to: `${C.auth}/${E.auth.signIn}` }));
12
+ new URLSearchParams(window.location.search).get("token") || (h.danger(E.auth.invalidResetPasswordToken), O({ to: `${w.auth}/${D.auth.signIn}` }));
16
13
  }, [
17
- C.auth,
18
- T.auth.invalidResetPasswordToken,
19
- E.auth.signIn,
20
- D
14
+ w.auth,
15
+ E.auth.invalidResetPasswordToken,
16
+ D.auth.signIn,
17
+ O
21
18
  ]);
22
- function P(e) {
19
+ function F(e) {
23
20
  e.preventDefault();
24
21
  let t = new URLSearchParams(window.location.search).get("token");
25
22
  if (!t) {
26
- p.danger(T.auth.invalidResetPasswordToken), D({ to: `${C.auth}/${E.auth.signIn}` });
23
+ h.danger(E.auth.invalidResetPasswordToken), O({ to: `${w.auth}/${D.auth.signIn}` });
27
24
  return;
28
25
  }
29
26
  let n = new FormData(e.currentTarget), r = n.get("password"), i = n.get("confirmPassword");
30
- if (w?.confirmPassword && r !== i) {
31
- p.danger(T.auth.passwordsDoNotMatch);
27
+ if (T?.confirmPassword && r !== i) {
28
+ h.danger(E.auth.passwordsDoNotMatch);
32
29
  return;
33
30
  }
34
- O({
31
+ k({
35
32
  token: t,
36
33
  newPassword: r
37
34
  });
38
35
  }
39
- return /* @__PURE__ */ h(r, {
40
- className: f("w-full max-w-sm p-4 md:p-6", b),
36
+ return /* @__PURE__ */ y(a, {
37
+ className: m("w-full max-w-sm gap-4 md:p-6", b),
41
38
  variant: x,
42
39
  ...S,
43
40
  children: [
44
- /* @__PURE__ */ m(r.Header, { children: /* @__PURE__ */ m(r.Title, {
41
+ /* @__PURE__ */ v(a.Header, { children: /* @__PURE__ */ v(a.Title, {
45
42
  className: "text-xl font-semibold mb-1",
46
- children: T.auth.resetPassword
43
+ children: E.auth.resetPassword
47
44
  }) }),
48
- /* @__PURE__ */ m(r.Content, { children: /* @__PURE__ */ h(o, {
49
- onSubmit: P,
50
- className: "flex flex-col gap-4",
51
- children: [
52
- /* @__PURE__ */ h(d, {
53
- minLength: w?.minPasswordLength,
54
- maxLength: w?.maxPasswordLength,
55
- name: "password",
56
- autoComplete: "new-password",
57
- isDisabled: k,
58
- children: [
59
- /* @__PURE__ */ m(c, { children: T.auth.password }),
60
- /* @__PURE__ */ h(s, {
61
- variant: x === "transparent" ? "primary" : "secondary",
62
- children: [/* @__PURE__ */ m(s.Input, {
63
- name: "password",
64
- placeholder: T.auth.newPasswordPlaceholder,
65
- type: A ? "text" : "password",
66
- required: !0
67
- }), /* @__PURE__ */ m(s.Suffix, {
68
- className: "px-0",
69
- children: /* @__PURE__ */ m(n, {
70
- isIconOnly: !0,
71
- "aria-label": A ? T.auth.hidePassword : T.auth.showPassword,
72
- size: "sm",
73
- variant: "ghost",
74
- onPress: () => j(!A),
75
- isDisabled: k,
76
- children: m(A ? y : v, {})
77
- })
78
- })]
79
- }),
80
- /* @__PURE__ */ m(a, {})
81
- ]
82
- }),
83
- w?.confirmPassword && /* @__PURE__ */ h(d, {
84
- minLength: w?.minPasswordLength,
85
- maxLength: w?.maxPasswordLength,
86
- name: "confirmPassword",
87
- autoComplete: "new-password",
88
- isDisabled: k,
89
- children: [
90
- /* @__PURE__ */ m(c, { children: T.auth.confirmPassword }),
91
- /* @__PURE__ */ h(s, {
92
- variant: x === "transparent" ? "primary" : "secondary",
93
- children: [/* @__PURE__ */ m(s.Input, {
94
- placeholder: T.auth.confirmPasswordPlaceholder,
95
- type: M ? "text" : "password",
96
- required: !0,
97
- name: "confirmPassword"
98
- }), /* @__PURE__ */ m(s.Suffix, {
99
- className: "px-0",
100
- children: /* @__PURE__ */ m(n, {
101
- isIconOnly: !0,
102
- "aria-label": M ? T.auth.hidePassword : T.auth.showPassword,
103
- size: "sm",
104
- variant: "ghost",
105
- onPress: () => N(!M),
106
- isDisabled: k,
107
- children: m(M ? y : v, {})
108
- })
109
- })]
110
- }),
111
- /* @__PURE__ */ m(a, {})
112
- ]
113
- }),
114
- /* @__PURE__ */ m("div", {
115
- className: "flex flex-col gap-3",
116
- children: /* @__PURE__ */ h(n, {
117
- type: "submit",
118
- className: "w-full",
119
- isPending: k,
120
- children: [k && /* @__PURE__ */ m(u, {
121
- color: "current",
122
- size: "sm"
123
- }), T.auth.resetPassword]
45
+ /* @__PURE__ */ v(a.Content, {
46
+ className: "gap-4",
47
+ children: /* @__PURE__ */ y(c, {
48
+ onSubmit: F,
49
+ className: "flex flex-col gap-4",
50
+ children: [
51
+ /* @__PURE__ */ y(p, {
52
+ minLength: T?.minPasswordLength,
53
+ maxLength: T?.maxPasswordLength,
54
+ name: "password",
55
+ autoComplete: "new-password",
56
+ isDisabled: A,
57
+ children: [
58
+ /* @__PURE__ */ v(u, { children: E.auth.password }),
59
+ /* @__PURE__ */ y(l, {
60
+ variant: x === "transparent" ? "primary" : "secondary",
61
+ children: [/* @__PURE__ */ v(l.Input, {
62
+ name: "password",
63
+ placeholder: E.auth.newPasswordPlaceholder,
64
+ type: j ? "text" : "password",
65
+ required: !0
66
+ }), /* @__PURE__ */ v(l.Suffix, {
67
+ className: "px-0",
68
+ children: /* @__PURE__ */ v(i, {
69
+ isIconOnly: !0,
70
+ "aria-label": j ? E.auth.hidePassword : E.auth.showPassword,
71
+ size: "sm",
72
+ variant: "ghost",
73
+ onPress: () => M(!j),
74
+ isDisabled: A,
75
+ children: v(j ? r : n, {})
76
+ })
77
+ })]
78
+ }),
79
+ /* @__PURE__ */ v(s, {})
80
+ ]
81
+ }),
82
+ T?.confirmPassword && /* @__PURE__ */ y(p, {
83
+ minLength: T?.minPasswordLength,
84
+ maxLength: T?.maxPasswordLength,
85
+ name: "confirmPassword",
86
+ autoComplete: "new-password",
87
+ isDisabled: A,
88
+ children: [
89
+ /* @__PURE__ */ v(u, { children: E.auth.confirmPassword }),
90
+ /* @__PURE__ */ y(l, {
91
+ variant: x === "transparent" ? "primary" : "secondary",
92
+ children: [/* @__PURE__ */ v(l.Input, {
93
+ placeholder: E.auth.confirmPasswordPlaceholder,
94
+ type: N ? "text" : "password",
95
+ required: !0,
96
+ name: "confirmPassword"
97
+ }), /* @__PURE__ */ v(l.Suffix, {
98
+ className: "px-0",
99
+ children: /* @__PURE__ */ v(i, {
100
+ isIconOnly: !0,
101
+ "aria-label": N ? E.auth.hidePassword : E.auth.showPassword,
102
+ size: "sm",
103
+ variant: "ghost",
104
+ onPress: () => P(!N),
105
+ isDisabled: A,
106
+ children: v(N ? r : n, {})
107
+ })
108
+ })]
109
+ }),
110
+ /* @__PURE__ */ v(s, {})
111
+ ]
112
+ }),
113
+ /* @__PURE__ */ v("div", {
114
+ className: "flex flex-col gap-3",
115
+ children: /* @__PURE__ */ y(i, {
116
+ type: "submit",
117
+ className: "w-full",
118
+ isPending: A,
119
+ children: [A && /* @__PURE__ */ v(f, {
120
+ color: "current",
121
+ size: "sm"
122
+ }), E.auth.resetPassword]
123
+ })
124
124
  })
125
- })
126
- ]
127
- }) }),
128
- /* @__PURE__ */ m(r.Footer, {
129
- className: "flex-col",
130
- children: /* @__PURE__ */ h(i, {
125
+ ]
126
+ })
127
+ }),
128
+ /* @__PURE__ */ v(a.Footer, {
129
+ className: "flex-col gap-3",
130
+ children: /* @__PURE__ */ y(o, {
131
131
  className: "text-sm",
132
132
  children: [
133
- T.auth.rememberYourPassword,
133
+ E.auth.rememberYourPassword,
134
134
  " ",
135
- /* @__PURE__ */ m(l, {
136
- href: `${C.auth}/${E.auth.signIn}`,
137
- className: "text-accent decoration-accent no-underline hover:underline",
138
- children: T.auth.signIn
135
+ /* @__PURE__ */ v(d, {
136
+ href: `${w.auth}/${D.auth.signIn}`,
137
+ className: "text-accent no-underline hover:underline decoration-accent-hover",
138
+ children: E.auth.signIn
139
139
  })
140
140
  ]
141
141
  })
@@ -5,9 +5,12 @@ export type AccountSettingsProps = {
5
5
  variant?: CardProps["variant"];
6
6
  };
7
7
  /**
8
- * Renders the account settings layout including user profile, change email, appearance, and accounts management.
8
+ * Renders the account settings layout.
9
9
  *
10
- * UserProfile, ChangeEmail, and Appearance are always rendered; Accounts is rendered when `multiSession` is enabled.
10
+ * `UserProfile` always renders. `ChangeEmail` renders when password auth is
11
+ * enabled or the `magicLink` plugin is registered. Plugin-contributed account
12
+ * cards (e.g. `Appearance` from the theme plugin, multi-session accounts) are
13
+ * rendered via the plugins array.
11
14
  *
12
15
  * @param className - Optional additional CSS class names for the outer container.
13
16
  * @param variant - Card variant forwarded to each account settings card.
@@ -0,0 +1,20 @@
1
+ import { ChangeEmail as e } from "./change-email.js";
2
+ import { UserProfile as t } from "./user-profile.js";
3
+ import { useAuth as n } from "@better-auth-ui/react";
4
+ import { cn as r } from "@heroui/react";
5
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
+ //#region src/components/auth/settings/account/account-settings.tsx
7
+ function o({ className: o, variant: s, ...c }) {
8
+ let { emailAndPassword: l, plugins: u } = n(), d = u.some((e) => e.id === "magicLink");
9
+ return /* @__PURE__ */ a("div", {
10
+ className: r("flex w-full flex-col gap-4 md:gap-6", o),
11
+ ...c,
12
+ children: [
13
+ /* @__PURE__ */ i(t, { variant: s }),
14
+ (l?.enabled || d) && /* @__PURE__ */ i(e, { variant: s }),
15
+ u.flatMap((e) => e.accountCards?.map((t, n) => /* @__PURE__ */ i(t, { variant: s }, `${e.id}-${n.toString()}`)))
16
+ ]
17
+ });
18
+ }
19
+ //#endregion
20
+ export { o as AccountSettings };