@better-auth-ui/heroui 1.6.3 → 1.6.5

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 (204) 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.d.ts +1 -1
  5. package/dist/components/auth/auth.js +54 -28
  6. package/dist/components/{settings/security → auth/delete-user}/danger-zone.d.ts +1 -1
  7. package/dist/components/{settings/security → auth/delete-user}/danger-zone.js +1 -1
  8. package/dist/components/auth/delete-user/delete-user.js +95 -0
  9. package/dist/components/{email → auth/email}/email-changed-email.d.ts +2 -2
  10. package/dist/components/{email → auth/email}/email-changed-email.js +7 -7
  11. package/dist/components/{email → auth/email}/email-verification-email.d.ts +2 -2
  12. package/dist/components/{email → auth/email}/email-verification-email.js +7 -7
  13. package/dist/components/auth/email/magic-link-email.d.ts +3 -0
  14. package/dist/components/{email → auth/email}/magic-link-email.js +7 -7
  15. package/dist/components/auth/email/new-device-email.d.ts +3 -0
  16. package/dist/components/{email → auth/email}/new-device-email.js +7 -7
  17. package/dist/components/auth/email/otp-email.d.ts +3 -0
  18. package/dist/components/{email → auth/email}/otp-email.js +6 -6
  19. package/dist/components/{email → auth/email}/password-changed-email.d.ts +2 -2
  20. package/dist/components/{email → auth/email}/password-changed-email.js +7 -7
  21. package/dist/components/{email → auth/email}/reset-password-email.d.ts +2 -2
  22. package/dist/components/{email → auth/email}/reset-password-email.js +7 -7
  23. package/dist/components/auth/forgot-password.d.ts +1 -1
  24. package/dist/components/auth/forgot-password.js +70 -48
  25. package/dist/components/auth/magic-link/magic-link-button.d.ts +11 -0
  26. package/dist/components/auth/magic-link/magic-link-button.js +20 -0
  27. package/dist/components/auth/magic-link/magic-link.d.ts +16 -0
  28. package/dist/components/auth/magic-link/magic-link.js +87 -0
  29. package/dist/components/{settings/account → auth/multi-session}/manage-account.d.ts +2 -6
  30. package/dist/components/auth/multi-session/manage-account.js +49 -0
  31. package/dist/components/auth/multi-session/manage-accounts.js +34 -0
  32. package/dist/components/{user/switch-account-menu.d.ts → auth/multi-session/switch-account-submenu-content.d.ts} +3 -3
  33. package/dist/components/auth/multi-session/switch-account-submenu-content.js +29 -0
  34. package/dist/components/{user/switch-account-item.d.ts → auth/multi-session/switch-account-submenu-item.d.ts} +2 -2
  35. package/dist/components/auth/multi-session/switch-account-submenu-item.js +20 -0
  36. package/dist/components/auth/multi-session/switch-account-submenu.d.ts +13 -0
  37. package/dist/components/auth/multi-session/switch-account-submenu.js +24 -0
  38. package/dist/components/auth/passkey/passkey-button.d.ts +6 -0
  39. package/dist/components/auth/passkey/passkey-button.js +24 -0
  40. package/dist/components/auth/passkey/passkey.js +45 -0
  41. package/dist/components/auth/passkey/passkeys.js +106 -0
  42. package/dist/components/auth/provider-button.d.ts +6 -8
  43. package/dist/components/auth/provider-button.js +16 -20
  44. package/dist/components/auth/provider-buttons.d.ts +3 -4
  45. package/dist/components/auth/provider-buttons.js +9 -10
  46. package/dist/components/auth/reset-password.js +110 -107
  47. package/dist/components/{settings → auth/settings}/account/account-settings.d.ts +5 -2
  48. package/dist/components/auth/settings/account/account-settings.js +20 -0
  49. package/dist/components/auth/settings/account/change-avatar.js +89 -0
  50. package/dist/components/{settings → auth/settings}/account/change-email.js +17 -17
  51. package/dist/components/{settings → auth/settings}/account/user-profile.d.ts +2 -3
  52. package/dist/components/auth/settings/account/user-profile.js +86 -0
  53. package/dist/components/auth/settings/security/active-session.js +59 -0
  54. package/dist/components/{settings → auth/settings}/security/active-sessions.js +4 -4
  55. package/dist/components/auth/settings/security/change-password.js +189 -0
  56. package/dist/components/auth/settings/security/linked-account.js +56 -0
  57. package/dist/components/{settings → auth/settings}/security/linked-accounts.js +5 -5
  58. package/dist/components/{settings → auth/settings}/security/security-settings.d.ts +1 -1
  59. package/dist/components/auth/settings/security/security-settings.js +22 -0
  60. package/dist/components/auth/settings/settings.js +45 -0
  61. package/dist/components/auth/sign-in.js +66 -85
  62. package/dist/components/auth/sign-out.js +11 -11
  63. package/dist/components/auth/sign-up.js +128 -148
  64. package/dist/components/{settings/account → auth/theme}/appearance.d.ts +3 -6
  65. package/dist/components/auth/theme/appearance.js +72 -0
  66. package/dist/components/auth/theme/theme-toggle-item.d.ts +5 -0
  67. package/dist/components/auth/theme/theme-toggle-item.js +58 -0
  68. package/dist/components/auth/user/user-avatar.js +29 -0
  69. package/dist/components/{user → auth/user}/user-button.d.ts +2 -6
  70. package/dist/components/auth/user/user-button.js +55 -0
  71. package/dist/components/auth/user/user-view.js +37 -0
  72. package/dist/components/auth/username/sign-in-username.d.ts +14 -0
  73. package/dist/components/auth/username/sign-in-username.js +148 -0
  74. package/dist/components/auth/username/username-field.d.ts +8 -0
  75. package/dist/components/auth/username/username-field.js +53 -0
  76. package/dist/email.d.ts +7 -0
  77. package/dist/email.js +9 -0
  78. package/dist/index.d.ts +12 -27
  79. package/dist/index.js +20 -35
  80. package/dist/lib/auth/auth-plugin.d.ts +44 -0
  81. package/dist/lib/auth/delete-user-plugin.d.ts +17 -0
  82. package/dist/lib/auth/delete-user-plugin.js +10 -0
  83. package/dist/lib/auth/magic-link-plugin.d.ts +31 -0
  84. package/dist/lib/auth/magic-link-plugin.js +13 -0
  85. package/dist/lib/auth/multi-session-plugin.d.ts +18 -0
  86. package/dist/lib/auth/multi-session-plugin.js +12 -0
  87. package/dist/lib/auth/passkey-plugin.d.ts +20 -0
  88. package/dist/lib/auth/passkey-plugin.js +12 -0
  89. package/dist/lib/auth/theme-plugin.d.ts +68 -0
  90. package/dist/lib/auth/theme-plugin.js +23 -0
  91. package/dist/lib/auth/username-plugin.d.ts +63 -0
  92. package/dist/lib/auth/username-plugin.js +18 -0
  93. package/dist/plugins.d.ts +20 -0
  94. package/dist/plugins.js +21 -0
  95. package/package.json +19 -21
  96. package/src/components/auth/additional-field.tsx +554 -0
  97. package/src/components/auth/auth-provider.tsx +5 -6
  98. package/src/components/auth/auth.tsx +99 -35
  99. package/src/components/{settings/security → auth/delete-user}/danger-zone.tsx +1 -1
  100. package/src/components/{settings/security → auth/delete-user}/delete-user.tsx +30 -20
  101. package/src/components/{email → auth/email}/email-changed-email.tsx +2 -2
  102. package/src/components/{email → auth/email}/email-verification-email.tsx +2 -2
  103. package/src/components/{email → auth/email}/magic-link-email.tsx +2 -2
  104. package/src/components/{email → auth/email}/new-device-email.tsx +2 -2
  105. package/src/components/{email → auth/email}/otp-email.tsx +2 -2
  106. package/src/components/{email → auth/email}/password-changed-email.tsx +2 -2
  107. package/src/components/{email → auth/email}/reset-password-email.tsx +2 -2
  108. package/src/components/auth/forgot-password.tsx +42 -17
  109. package/src/components/auth/magic-link/magic-link-button.tsx +61 -0
  110. package/src/components/auth/{magic-link.tsx → magic-link/magic-link.tsx} +55 -40
  111. package/src/components/{settings/account → auth/multi-session}/manage-account.tsx +16 -13
  112. package/src/components/{settings/account → auth/multi-session}/manage-accounts.tsx +14 -5
  113. package/src/components/{user/switch-account-menu.tsx → auth/multi-session/switch-account-submenu-content.tsx} +18 -11
  114. package/src/components/{user/switch-account-item.tsx → auth/multi-session/switch-account-submenu-item.tsx} +17 -5
  115. package/src/components/auth/multi-session/switch-account-submenu.tsx +50 -0
  116. package/src/components/auth/passkey/passkey-button.tsx +56 -0
  117. package/src/components/{settings/security → auth/passkey}/passkey.tsx +20 -6
  118. package/src/components/auth/passkey/passkeys.tsx +196 -0
  119. package/src/components/auth/provider-button.tsx +27 -29
  120. package/src/components/auth/provider-buttons.tsx +6 -11
  121. package/src/components/auth/reset-password.tsx +13 -7
  122. package/src/components/{settings → auth/settings}/account/account-settings.tsx +15 -13
  123. package/src/components/{settings → auth/settings}/account/change-avatar.tsx +4 -3
  124. package/src/components/{settings → auth/settings}/account/change-email.tsx +3 -3
  125. package/src/components/auth/settings/account/user-profile.tsx +171 -0
  126. package/src/components/{settings → auth/settings}/security/active-session.tsx +8 -5
  127. package/src/components/{settings → auth/settings}/security/active-sessions.tsx +3 -3
  128. package/src/components/{settings → auth/settings}/security/change-password.tsx +14 -9
  129. package/src/components/{settings → auth/settings}/security/linked-account.tsx +12 -8
  130. package/src/components/{settings → auth/settings}/security/linked-accounts.tsx +2 -2
  131. package/src/components/{settings → auth/settings}/security/security-settings.tsx +7 -6
  132. package/src/components/{settings → auth/settings}/settings.tsx +2 -2
  133. package/src/components/auth/sign-in.tsx +50 -61
  134. package/src/components/auth/sign-out.tsx +2 -2
  135. package/src/components/auth/sign-up.tsx +119 -131
  136. package/src/components/{settings/account → auth/theme}/appearance.tsx +17 -24
  137. package/src/components/auth/theme/theme-toggle-item.tsx +110 -0
  138. package/src/components/{user → auth/user}/user-avatar.tsx +12 -4
  139. package/src/components/{user → auth/user}/user-button.tsx +15 -88
  140. package/src/components/{user → auth/user}/user-view.tsx +12 -4
  141. package/src/components/auth/username/sign-in-username.tsx +299 -0
  142. package/src/components/auth/username/username-field.tsx +124 -0
  143. package/src/email.ts +9 -0
  144. package/src/index.tsx +12 -27
  145. package/src/lib/auth/auth-plugin.ts +67 -0
  146. package/src/lib/auth/delete-user-plugin.ts +15 -0
  147. package/src/lib/auth/magic-link-plugin.ts +26 -0
  148. package/src/lib/auth/multi-session-plugin.ts +17 -0
  149. package/src/lib/auth/passkey-plugin.ts +17 -0
  150. package/src/lib/auth/theme-plugin.ts +86 -0
  151. package/src/lib/auth/username-plugin.tsx +30 -0
  152. package/src/plugins.ts +23 -0
  153. package/dist/components/auth/magic-link-button.d.ts +0 -13
  154. package/dist/components/auth/magic-link-button.js +0 -16
  155. package/dist/components/auth/magic-link.d.ts +0 -17
  156. package/dist/components/auth/magic-link.js +0 -99
  157. package/dist/components/auth/passkey-button.d.ts +0 -4
  158. package/dist/components/auth/passkey-button.js +0 -21
  159. package/dist/components/email/magic-link-email.d.ts +0 -3
  160. package/dist/components/email/new-device-email.d.ts +0 -3
  161. package/dist/components/email/otp-email.d.ts +0 -3
  162. package/dist/components/settings/account/account-settings.js +0 -23
  163. package/dist/components/settings/account/appearance.js +0 -71
  164. package/dist/components/settings/account/change-avatar.js +0 -89
  165. package/dist/components/settings/account/manage-account.js +0 -48
  166. package/dist/components/settings/account/manage-accounts.js +0 -33
  167. package/dist/components/settings/account/user-profile.js +0 -103
  168. package/dist/components/settings/security/active-session.js +0 -59
  169. package/dist/components/settings/security/change-password.js +0 -189
  170. package/dist/components/settings/security/delete-user.js +0 -92
  171. package/dist/components/settings/security/linked-account.js +0 -56
  172. package/dist/components/settings/security/passkey.js +0 -43
  173. package/dist/components/settings/security/passkeys.js +0 -53
  174. package/dist/components/settings/security/security-settings.js +0 -25
  175. package/dist/components/settings/settings.js +0 -45
  176. package/dist/components/user/switch-account-item.js +0 -20
  177. package/dist/components/user/switch-account-menu.js +0 -28
  178. package/dist/components/user/user-avatar.js +0 -29
  179. package/dist/components/user/user-button.js +0 -91
  180. package/dist/components/user/user-view.js +0 -37
  181. package/dist/core.d.ts +0 -1
  182. package/dist/core.js +0 -1
  183. package/dist/react-exports.d.ts +0 -1
  184. package/dist/react-exports.js +0 -1
  185. package/src/components/auth/magic-link-button.tsx +0 -43
  186. package/src/components/auth/passkey-button.tsx +0 -35
  187. package/src/components/settings/account/user-profile.tsx +0 -217
  188. package/src/components/settings/security/passkeys.tsx +0 -96
  189. package/src/core.ts +0 -1
  190. package/src/react-exports.ts +0 -1
  191. /package/dist/components/{settings/security → auth/delete-user}/delete-user.d.ts +0 -0
  192. /package/dist/components/{settings/account → auth/multi-session}/manage-accounts.d.ts +0 -0
  193. /package/dist/components/{settings/security → auth/passkey}/passkey.d.ts +0 -0
  194. /package/dist/components/{settings/security → auth/passkey}/passkeys.d.ts +0 -0
  195. /package/dist/components/{settings → auth/settings}/account/change-avatar.d.ts +0 -0
  196. /package/dist/components/{settings → auth/settings}/account/change-email.d.ts +0 -0
  197. /package/dist/components/{settings → auth/settings}/security/active-session.d.ts +0 -0
  198. /package/dist/components/{settings → auth/settings}/security/active-sessions.d.ts +0 -0
  199. /package/dist/components/{settings → auth/settings}/security/change-password.d.ts +0 -0
  200. /package/dist/components/{settings → auth/settings}/security/linked-account.d.ts +0 -0
  201. /package/dist/components/{settings → auth/settings}/security/linked-accounts.d.ts +0 -0
  202. /package/dist/components/{settings → auth/settings}/settings.d.ts +0 -0
  203. /package/dist/components/{user → auth/user}/user-avatar.d.ts +0 -0
  204. /package/dist/components/{user → auth/user}/user-view.d.ts +0 -0
@@ -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 };
@@ -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 };
@@ -2,14 +2,12 @@ import { ButtonProps } from '@heroui/react';
2
2
  import { SocialProvider } from 'better-auth/social-providers';
3
3
  export type ProviderButtonProps = {
4
4
  provider: SocialProvider;
5
- label?: "continueWith" | "providerName" | "none";
6
- isDisabled?: boolean;
7
- } & Omit<ButtonProps, "children" | "onPress" | "isPending">;
5
+ display?: "full" | "name" | "icon";
6
+ } & Omit<ButtonProps, "children" | "onPress" | "isPending" | "isDisabled">;
8
7
  /**
9
- * Render a single social provider sign-in button with its own mutation and pending state.
8
+ * Social provider sign-in button.
10
9
  *
11
- * @param provider - The social provider this button signs in with.
12
- * @param label - Label style: `"continueWith"` (e.g. "Continue with Google"), `"providerName"` (e.g. "Google"), or `"none"` (icon only).
13
- * @param isDisabled - External disabled state (e.g. a sibling provider is mid-redirect).
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).
14
12
  */
15
- export declare function ProviderButton({ provider, label, isDisabled, variant, ...props }: ProviderButtonProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ProviderButton({ provider, display, variant, ...props }: ProviderButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -1,29 +1,25 @@
1
- import { providerIcons as e, useAuth as t, useSignInSocial as n } from "@better-auth-ui/react";
2
- import { Button as r, Spinner as i } from "@heroui/react";
3
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
- import { useState as s } from "react";
5
- import { getProviderName as c } from "@better-auth-ui/core";
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
6
  //#region src/components/auth/provider-button.tsx
7
- function l({ provider: l, label: u = "continueWith", isDisabled: d, variant: f = "tertiary", ...p }) {
8
- let { baseURL: m, localization: h, redirectTo: g } = t(), _ = `${m}${g}`, [v, y] = s(!1), { mutate: b, isPending: x } = n({ onSuccess: () => {
9
- y(!0), setTimeout(() => {
10
- y(!1);
11
- }, 5e3);
12
- } }), S = e[l], C = x || v;
13
- return /* @__PURE__ */ o(r, {
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, {
14
10
  variant: f,
15
- isDisabled: d,
16
- isPending: C,
17
- onPress: () => b({
18
- provider: l,
19
- callbackURL: _
11
+ isPending: l({ mutationKey: e.signIn.all }) + l({ mutationKey: e.signUp.all }) > 0,
12
+ onPress: () => y({
13
+ provider: u,
14
+ callbackURL: v
20
15
  }),
21
16
  ...p,
22
- children: [C ? /* @__PURE__ */ a(i, {
17
+ "aria-label": t(u),
18
+ children: [b ? /* @__PURE__ */ s(o, {
23
19
  color: "current",
24
20
  size: "sm"
25
- }) : /* @__PURE__ */ a(S, {}), u === "continueWith" ? h.auth.continueWith.replace("{{provider}}", c(l)) : u === "providerName" ? c(l) : null]
21
+ }) : /* @__PURE__ */ s(x, {}), d === "full" ? g.auth.continueWith.replace("{{provider}}", t(u)) : d === "name" ? t(u) : null]
26
22
  });
27
23
  }
28
24
  //#endregion
29
- export { l as ProviderButton };
25
+ export { u as ProviderButton };
@@ -1,13 +1,12 @@
1
1
  export type ProviderButtonsProps = {
2
- isPending?: boolean;
3
2
  socialLayout?: SocialLayout;
4
3
  };
5
4
  export type SocialLayout = "auto" | "horizontal" | "vertical" | "grid";
6
5
  /**
7
- * Render social provider sign-in buttons. Each button owns its own sign-in mutation.
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.
8
8
  *
9
- * @param isPending - External pending state (e.g. parent form submitting) that disables all buttons.
10
9
  * @param socialLayout - Preferred layout for the buttons; `"auto"` picks `"horizontal"` when there are four or more providers, otherwise `"vertical"`.
11
10
  * @returns The JSX element that renders the configured social provider buttons.
12
11
  */
13
- export declare function ProviderButtons({ isPending, socialLayout }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ProviderButtons({ socialLayout }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
@@ -1,18 +1,17 @@
1
1
  import { ProviderButton as e } from "./provider-button.js";
2
2
  import { useAuth as t } from "@better-auth-ui/react";
3
3
  import { cn as n } from "@heroui/react";
4
- import { jsx as r } from "react/jsx-runtime";
5
- import { useMemo as i } from "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 a({ isPending: a, socialLayout: o = "auto" }) {
8
- let { socialProviders: s } = t(), c = i(() => o === "auto" ? s?.length && s.length >= 4 ? "horizontal" : "vertical" : o, [o, s?.length]);
9
- return /* @__PURE__ */ r("div", {
10
- className: n("gap-3", c === "grid" && "grid grid-cols-2", c === "vertical" && "flex flex-col", c === "horizontal" && "flex flex-wrap"),
11
- children: s?.map((t) => /* @__PURE__ */ r(e, {
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
+ return /* @__PURE__ */ i("div", {
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
12
  provider: t,
13
- isDisabled: a,
14
- label: c === "vertical" ? "continueWith" : c === "grid" ? "providerName" : "none",
15
- className: n("w-full", c === "horizontal" && "flex-1")
13
+ display: s === "vertical" ? "full" : s === "grid" ? "name" : "icon",
14
+ className: n("w-full", s === "horizontal" && "flex-1")
16
15
  }, t))
17
16
  });
18
17
  }
@@ -1,138 +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({ onSuccess: () => {
9
- p.success(T.auth.passwordResetSuccess), D({ to: `${C.auth}/${E.auth.signIn}` });
10
- } }), [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);
11
11
  g(() => {
12
- 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}` }));
13
13
  }, [
14
- C.auth,
15
- T.auth.invalidResetPasswordToken,
16
- E.auth.signIn,
17
- D
14
+ w.auth,
15
+ E.auth.invalidResetPasswordToken,
16
+ D.auth.signIn,
17
+ O
18
18
  ]);
19
- function P(e) {
19
+ function F(e) {
20
20
  e.preventDefault();
21
21
  let t = new URLSearchParams(window.location.search).get("token");
22
22
  if (!t) {
23
- 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}` });
24
24
  return;
25
25
  }
26
26
  let n = new FormData(e.currentTarget), r = n.get("password"), i = n.get("confirmPassword");
27
- if (w?.confirmPassword && r !== i) {
28
- p.danger(T.auth.passwordsDoNotMatch);
27
+ if (T?.confirmPassword && r !== i) {
28
+ h.danger(E.auth.passwordsDoNotMatch);
29
29
  return;
30
30
  }
31
- O({
31
+ k({
32
32
  token: t,
33
33
  newPassword: r
34
34
  });
35
35
  }
36
- return /* @__PURE__ */ h(r, {
37
- 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),
38
38
  variant: x,
39
39
  ...S,
40
40
  children: [
41
- /* @__PURE__ */ m(r.Header, { children: /* @__PURE__ */ m(r.Title, {
41
+ /* @__PURE__ */ v(a.Header, { children: /* @__PURE__ */ v(a.Title, {
42
42
  className: "text-xl font-semibold mb-1",
43
- children: T.auth.resetPassword
43
+ children: E.auth.resetPassword
44
44
  }) }),
45
- /* @__PURE__ */ m(r.Content, { children: /* @__PURE__ */ h(o, {
46
- onSubmit: P,
47
- className: "flex flex-col gap-4",
48
- children: [
49
- /* @__PURE__ */ h(d, {
50
- minLength: w?.minPasswordLength,
51
- maxLength: w?.maxPasswordLength,
52
- name: "password",
53
- autoComplete: "new-password",
54
- isDisabled: k,
55
- children: [
56
- /* @__PURE__ */ m(c, { children: T.auth.password }),
57
- /* @__PURE__ */ h(s, {
58
- variant: x === "transparent" ? "primary" : "secondary",
59
- children: [/* @__PURE__ */ m(s.Input, {
60
- name: "password",
61
- placeholder: T.auth.newPasswordPlaceholder,
62
- type: A ? "text" : "password",
63
- required: !0
64
- }), /* @__PURE__ */ m(s.Suffix, {
65
- className: "px-0",
66
- children: /* @__PURE__ */ m(n, {
67
- isIconOnly: !0,
68
- "aria-label": A ? T.auth.hidePassword : T.auth.showPassword,
69
- size: "sm",
70
- variant: "ghost",
71
- onPress: () => j(!A),
72
- isDisabled: k,
73
- children: m(A ? y : v, {})
74
- })
75
- })]
76
- }),
77
- /* @__PURE__ */ m(a, {})
78
- ]
79
- }),
80
- w?.confirmPassword && /* @__PURE__ */ h(d, {
81
- minLength: w?.minPasswordLength,
82
- maxLength: w?.maxPasswordLength,
83
- name: "confirmPassword",
84
- autoComplete: "new-password",
85
- isDisabled: k,
86
- children: [
87
- /* @__PURE__ */ m(c, { children: T.auth.confirmPassword }),
88
- /* @__PURE__ */ h(s, {
89
- variant: x === "transparent" ? "primary" : "secondary",
90
- children: [/* @__PURE__ */ m(s.Input, {
91
- placeholder: T.auth.confirmPasswordPlaceholder,
92
- type: M ? "text" : "password",
93
- required: !0,
94
- name: "confirmPassword"
95
- }), /* @__PURE__ */ m(s.Suffix, {
96
- className: "px-0",
97
- children: /* @__PURE__ */ m(n, {
98
- isIconOnly: !0,
99
- "aria-label": M ? T.auth.hidePassword : T.auth.showPassword,
100
- size: "sm",
101
- variant: "ghost",
102
- onPress: () => N(!M),
103
- isDisabled: k,
104
- children: m(M ? y : v, {})
105
- })
106
- })]
107
- }),
108
- /* @__PURE__ */ m(a, {})
109
- ]
110
- }),
111
- /* @__PURE__ */ m("div", {
112
- className: "flex flex-col gap-3",
113
- children: /* @__PURE__ */ h(n, {
114
- type: "submit",
115
- className: "w-full",
116
- isPending: k,
117
- children: [k && /* @__PURE__ */ m(u, {
118
- color: "current",
119
- size: "sm"
120
- }), 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
+ })
121
124
  })
122
- })
123
- ]
124
- }) }),
125
- /* @__PURE__ */ m(r.Footer, {
126
- className: "flex-col",
127
- children: /* @__PURE__ */ h(i, {
125
+ ]
126
+ })
127
+ }),
128
+ /* @__PURE__ */ v(a.Footer, {
129
+ className: "flex-col gap-3",
130
+ children: /* @__PURE__ */ y(o, {
128
131
  className: "text-sm",
129
132
  children: [
130
- T.auth.rememberYourPassword,
133
+ E.auth.rememberYourPassword,
131
134
  " ",
132
- /* @__PURE__ */ m(l, {
133
- href: `${C.auth}/${E.auth.signIn}`,
134
- className: "text-accent decoration-accent no-underline hover:underline",
135
- 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
136
139
  })
137
140
  ]
138
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 };