@better-auth-ui/heroui 1.6.8 → 1.6.9

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 (270) hide show
  1. package/dist/components/auth/additional-field.d.ts +2 -2
  2. package/dist/components/auth/additional-field.js +133 -266
  3. package/dist/components/auth/api-key/api-key-skeleton.js +4 -20
  4. package/dist/components/auth/api-key/api-key.d.ts +6 -2
  5. package/dist/components/auth/api-key/api-key.js +16 -54
  6. package/dist/components/auth/api-key/api-keys-empty.d.ts +3 -1
  7. package/dist/components/auth/api-key/api-keys-empty.js +8 -34
  8. package/dist/components/auth/api-key/api-keys.d.ts +10 -2
  9. package/dist/components/auth/api-key/api-keys.js +21 -40
  10. package/dist/components/auth/api-key/create-api-key-dialog.d.ts +3 -1
  11. package/dist/components/auth/api-key/create-api-key-dialog.js +43 -73
  12. package/dist/components/auth/api-key/delete-api-key-dialog.d.ts +4 -2
  13. package/dist/components/auth/api-key/delete-api-key-dialog.js +16 -50
  14. package/dist/components/auth/api-key/new-api-key-dialog.js +23 -59
  15. package/dist/components/auth/api-key/organization-api-keys.d.ts +14 -0
  16. package/dist/components/auth/api-key/organization-api-keys.js +22 -0
  17. package/dist/components/auth/auth-provider.d.ts +1 -1
  18. package/dist/components/auth/auth-provider.js +10 -16
  19. package/dist/components/auth/auth.d.ts +3 -3
  20. package/dist/components/auth/auth.js +86 -61
  21. package/dist/components/auth/delete-user/danger-zone.d.ts +3 -3
  22. package/dist/components/auth/delete-user/danger-zone.js +11 -17
  23. package/dist/components/auth/delete-user/delete-account.d.ts +9 -0
  24. package/dist/components/auth/delete-user/delete-account.js +50 -0
  25. package/dist/components/auth/email/email-changed-email.d.ts +2 -2
  26. package/dist/components/auth/email/email-changed-email.js +22 -29
  27. package/dist/components/auth/email/email-verification-email.d.ts +2 -2
  28. package/dist/components/auth/email/email-verification-email.js +22 -29
  29. package/dist/components/auth/email/magic-link-email.d.ts +2 -2
  30. package/dist/components/auth/email/magic-link-email.js +22 -29
  31. package/dist/components/auth/email/new-device-email.d.ts +2 -2
  32. package/dist/components/auth/email/new-device-email.js +22 -29
  33. package/dist/components/auth/email/organization-invitation-email.d.ts +3 -0
  34. package/dist/components/auth/email/organization-invitation-email.js +23 -0
  35. package/dist/components/auth/email/otp-email.d.ts +2 -2
  36. package/dist/components/auth/email/otp-email.js +21 -28
  37. package/dist/components/auth/email/password-changed-email.d.ts +2 -2
  38. package/dist/components/auth/email/password-changed-email.js +22 -29
  39. package/dist/components/auth/email/reset-password-email.d.ts +2 -2
  40. package/dist/components/auth/email/reset-password-email.js +22 -29
  41. package/dist/components/auth/error-toaster.js +32 -16
  42. package/dist/components/auth/field-separator.d.ts +1 -1
  43. package/dist/components/auth/field-separator.js +4 -17
  44. package/dist/components/auth/forgot-password.d.ts +1 -1
  45. package/dist/components/auth/forgot-password.js +36 -88
  46. package/dist/components/auth/magic-link/magic-link-button.d.ts +1 -1
  47. package/dist/components/auth/magic-link/magic-link-button.js +33 -19
  48. package/dist/components/auth/magic-link/magic-link.d.ts +2 -2
  49. package/dist/components/auth/magic-link/magic-link.js +39 -86
  50. package/dist/components/auth/multi-session/manage-account.d.ts +1 -1
  51. package/dist/components/auth/multi-session/manage-account.js +32 -48
  52. package/dist/components/auth/multi-session/manage-accounts.d.ts +1 -1
  53. package/dist/components/auth/multi-session/manage-accounts.js +32 -33
  54. package/dist/components/auth/multi-session/switch-account-submenu-content.d.ts +3 -1
  55. package/dist/components/auth/multi-session/switch-account-submenu-content.js +24 -27
  56. package/dist/components/auth/multi-session/switch-account-submenu-item.d.ts +3 -2
  57. package/dist/components/auth/multi-session/switch-account-submenu-item.js +16 -19
  58. package/dist/components/auth/multi-session/switch-account-submenu.d.ts +2 -1
  59. package/dist/components/auth/multi-session/switch-account-submenu.js +23 -23
  60. package/dist/components/auth/organization/change-organization-logo.d.ts +4 -0
  61. package/dist/components/auth/organization/change-organization-logo.js +69 -0
  62. package/dist/components/auth/organization/create-organization-dialog.d.ts +13 -0
  63. package/dist/components/auth/organization/create-organization-dialog.js +37 -0
  64. package/dist/components/auth/organization/delete-organization-dialog.d.ts +7 -0
  65. package/dist/components/auth/organization/delete-organization-dialog.js +25 -0
  66. package/dist/components/auth/organization/delete-organization-skeleton.d.ts +4 -0
  67. package/dist/components/auth/organization/delete-organization-skeleton.js +8 -0
  68. package/dist/components/auth/organization/delete-organization.d.ts +5 -0
  69. package/dist/components/auth/organization/delete-organization.js +27 -0
  70. package/dist/components/auth/organization/invite-member-dialog.d.ts +13 -0
  71. package/dist/components/auth/organization/invite-member-dialog.js +47 -0
  72. package/dist/components/auth/organization/leave-organization-dialog.d.ts +7 -0
  73. package/dist/components/auth/organization/leave-organization-dialog.js +21 -0
  74. package/dist/components/auth/organization/leave-organization.d.ts +4 -0
  75. package/dist/components/auth/organization/leave-organization.js +16 -0
  76. package/dist/components/auth/organization/organization-danger-zone.d.ts +16 -0
  77. package/dist/components/auth/organization/organization-danger-zone.js +23 -0
  78. package/dist/components/auth/organization/organization-invitation-row-skeleton.d.ts +5 -0
  79. package/dist/components/auth/organization/organization-invitation-row-skeleton.js +9 -0
  80. package/dist/components/auth/organization/organization-invitation-row.d.ts +5 -0
  81. package/dist/components/auth/organization/organization-invitation-row.js +31 -0
  82. package/dist/components/auth/organization/organization-invitations-empty.d.ts +8 -0
  83. package/dist/components/auth/organization/organization-invitations-empty.js +13 -0
  84. package/dist/components/auth/organization/organization-invitations.d.ts +9 -0
  85. package/dist/components/auth/organization/organization-invitations.js +66 -0
  86. package/dist/components/auth/organization/organization-logo.d.ts +15 -0
  87. package/dist/components/auth/organization/organization-logo.js +14 -0
  88. package/dist/components/auth/organization/organization-member-row-skeleton.d.ts +4 -0
  89. package/dist/components/auth/organization/organization-member-row-skeleton.js +9 -0
  90. package/dist/components/auth/organization/organization-member-row.d.ts +9 -0
  91. package/dist/components/auth/organization/organization-member-row.js +34 -0
  92. package/dist/components/auth/organization/organization-members.d.ts +9 -0
  93. package/dist/components/auth/organization/organization-members.js +67 -0
  94. package/dist/components/auth/organization/organization-people.d.ts +10 -0
  95. package/dist/components/auth/organization/organization-people.js +11 -0
  96. package/dist/components/auth/organization/organization-profile.d.ts +9 -0
  97. package/dist/components/auth/organization/organization-profile.js +34 -0
  98. package/dist/components/auth/organization/organization-row.d.ts +8 -0
  99. package/dist/components/auth/organization/organization-row.js +31 -0
  100. package/dist/components/auth/organization/organization-settings.d.ts +12 -0
  101. package/dist/components/auth/organization/organization-settings.js +13 -0
  102. package/dist/components/auth/organization/organization-switcher.d.ts +20 -0
  103. package/dist/components/auth/organization/organization-switcher.js +48 -0
  104. package/dist/components/auth/organization/organization-view-skeleton.d.ts +6 -0
  105. package/dist/components/auth/organization/organization-view-skeleton.js +9 -0
  106. package/dist/components/auth/organization/organization-view.d.ts +15 -0
  107. package/dist/components/auth/organization/organization-view.js +31 -0
  108. package/dist/components/auth/organization/organization.d.ts +17 -0
  109. package/dist/components/auth/organization/organization.js +60 -0
  110. package/dist/components/auth/organization/organizations-empty.d.ts +4 -0
  111. package/dist/components/auth/organization/organizations-empty.js +9 -0
  112. package/dist/components/auth/organization/organizations-settings.d.ts +17 -0
  113. package/dist/components/auth/organization/organizations-settings.js +17 -0
  114. package/dist/components/auth/organization/organizations.d.ts +10 -0
  115. package/dist/components/auth/organization/organizations.js +21 -0
  116. package/dist/components/auth/organization/remove-member-dialog.d.ts +9 -0
  117. package/dist/components/auth/organization/remove-member-dialog.js +20 -0
  118. package/dist/components/auth/organization/slug-field.d.ts +19 -0
  119. package/dist/components/auth/organization/slug-field.js +38 -0
  120. package/dist/components/auth/organization/user-invitation-row-skeleton.d.ts +4 -0
  121. package/dist/components/auth/organization/user-invitation-row-skeleton.js +8 -0
  122. package/dist/components/auth/organization/user-invitation-row.d.ts +10 -0
  123. package/dist/components/auth/organization/user-invitation-row.js +22 -0
  124. package/dist/components/auth/organization/user-invitations-empty.d.ts +4 -0
  125. package/dist/components/auth/organization/user-invitations-empty.js +12 -0
  126. package/dist/components/auth/organization/user-invitations.d.ts +10 -0
  127. package/dist/components/auth/organization/user-invitations.js +18 -0
  128. package/dist/components/auth/passkey/add-passkey-dialog.js +21 -64
  129. package/dist/components/auth/passkey/delete-passkey-dialog.js +13 -46
  130. package/dist/components/auth/passkey/passkey-button.d.ts +1 -1
  131. package/dist/components/auth/passkey/passkey-button.js +24 -23
  132. package/dist/components/auth/passkey/passkey-skeleton.js +4 -16
  133. package/dist/components/auth/passkey/passkey.d.ts +1 -1
  134. package/dist/components/auth/passkey/passkey.js +16 -47
  135. package/dist/components/auth/passkey/passkeys-empty.js +8 -34
  136. package/dist/components/auth/passkey/passkeys.d.ts +1 -1
  137. package/dist/components/auth/passkey/passkeys.js +15 -41
  138. package/dist/components/auth/provider-button.d.ts +2 -2
  139. package/dist/components/auth/provider-button.js +28 -24
  140. package/dist/components/auth/provider-buttons.js +28 -18
  141. package/dist/components/auth/reset-password.d.ts +1 -1
  142. package/dist/components/auth/reset-password.js +56 -146
  143. package/dist/components/auth/settings/account/account-settings.d.ts +2 -2
  144. package/dist/components/auth/settings/account/account-settings.js +21 -19
  145. package/dist/components/auth/settings/account/change-avatar.js +53 -88
  146. package/dist/components/auth/settings/account/change-email.d.ts +1 -1
  147. package/dist/components/auth/settings/account/change-email.js +27 -53
  148. package/dist/components/auth/settings/account/user-profile.d.ts +1 -1
  149. package/dist/components/auth/settings/account/user-profile.js +64 -85
  150. package/dist/components/auth/settings/security/active-session.d.ts +1 -1
  151. package/dist/components/auth/settings/security/active-session.js +50 -57
  152. package/dist/components/auth/settings/security/active-sessions.d.ts +1 -1
  153. package/dist/components/auth/settings/security/active-sessions.js +21 -32
  154. package/dist/components/auth/settings/security/change-password.d.ts +1 -1
  155. package/dist/components/auth/settings/security/change-password.js +76 -186
  156. package/dist/components/auth/settings/security/linked-account.d.ts +1 -1
  157. package/dist/components/auth/settings/security/linked-account.js +37 -55
  158. package/dist/components/auth/settings/security/linked-accounts.d.ts +1 -1
  159. package/dist/components/auth/settings/security/linked-accounts.js +34 -43
  160. package/dist/components/auth/settings/security/security-settings.d.ts +2 -2
  161. package/dist/components/auth/settings/security/security-settings.js +19 -21
  162. package/dist/components/auth/settings/settings.d.ts +4 -4
  163. package/dist/components/auth/settings/settings.js +52 -44
  164. package/dist/components/auth/sign-in.d.ts +2 -2
  165. package/dist/components/auth/sign-in.js +63 -132
  166. package/dist/components/auth/sign-out.js +32 -26
  167. package/dist/components/auth/sign-up.d.ts +2 -2
  168. package/dist/components/auth/sign-up.js +97 -211
  169. package/dist/components/auth/theme/appearance.d.ts +1 -1
  170. package/dist/components/auth/theme/appearance.js +23 -71
  171. package/dist/components/auth/theme/theme-toggle-item.js +56 -61
  172. package/dist/components/auth/user/user-avatar.d.ts +4 -4
  173. package/dist/components/auth/user/user-avatar.js +31 -28
  174. package/dist/components/auth/user/user-button.d.ts +6 -7
  175. package/dist/components/auth/user/user-button.js +38 -72
  176. package/dist/components/auth/user/user-view.d.ts +13 -7
  177. package/dist/components/auth/user/user-view.js +26 -36
  178. package/dist/components/auth/username/sign-in-username.d.ts +2 -2
  179. package/dist/components/auth/username/sign-in-username.js +87 -147
  180. package/dist/components/auth/username/username-field.d.ts +1 -1
  181. package/dist/components/auth/username/username-field.js +44 -52
  182. package/dist/email.d.ts +8 -7
  183. package/dist/email.js +8 -8
  184. package/dist/index.d.ts +21 -21
  185. package/dist/index.js +21 -22
  186. package/dist/lib/auth/api-key-plugin.d.ts +7 -4
  187. package/dist/lib/auth/api-key-plugin.js +12 -10
  188. package/dist/lib/auth/auth-plugin.d.ts +10 -6
  189. package/dist/lib/auth/auth-plugin.js +1 -0
  190. package/dist/lib/auth/delete-user-plugin.d.ts +6 -6
  191. package/dist/lib/auth/delete-user-plugin.js +6 -9
  192. package/dist/lib/auth/magic-link-plugin.d.ts +5 -5
  193. package/dist/lib/auth/magic-link-plugin.js +17 -12
  194. package/dist/lib/auth/multi-session-plugin.d.ts +5 -5
  195. package/dist/lib/auth/multi-session-plugin.js +8 -11
  196. package/dist/lib/auth/organization-plugin.d.ts +37 -0
  197. package/dist/lib/auth/organization-plugin.js +19 -0
  198. package/dist/lib/auth/passkey-plugin.d.ts +5 -5
  199. package/dist/lib/auth/passkey-plugin.js +8 -11
  200. package/dist/lib/auth/theme-plugin.d.ts +6 -6
  201. package/dist/lib/auth/theme-plugin.js +25 -22
  202. package/dist/lib/auth/username-plugin.d.ts +11 -11
  203. package/dist/lib/auth/username-plugin.js +18 -17
  204. package/dist/plugins.d.ts +46 -22
  205. package/dist/plugins.js +47 -22
  206. package/package.json +25 -19
  207. package/src/components/auth/api-key/api-key.tsx +25 -16
  208. package/src/components/auth/api-key/api-keys-empty.tsx +8 -4
  209. package/src/components/auth/api-key/api-keys.tsx +52 -14
  210. package/src/components/auth/api-key/create-api-key-dialog.tsx +15 -2
  211. package/src/components/auth/api-key/delete-api-key-dialog.tsx +10 -2
  212. package/src/components/auth/api-key/organization-api-keys.tsx +55 -0
  213. package/src/components/auth/delete-user/danger-zone.tsx +3 -3
  214. package/src/components/auth/delete-user/{delete-user.tsx → delete-account.tsx} +9 -9
  215. package/src/components/auth/email/organization-invitation-email.tsx +38 -0
  216. package/src/components/auth/error-toaster.tsx +28 -10
  217. package/src/components/auth/forgot-password.tsx +10 -2
  218. package/src/components/auth/multi-session/manage-accounts.tsx +1 -1
  219. package/src/components/auth/multi-session/switch-account-submenu-content.tsx +7 -2
  220. package/src/components/auth/multi-session/switch-account-submenu-item.tsx +4 -2
  221. package/src/components/auth/multi-session/switch-account-submenu.tsx +8 -4
  222. package/src/components/auth/organization/change-organization-logo.tsx +171 -0
  223. package/src/components/auth/organization/create-organization-dialog.tsx +133 -0
  224. package/src/components/auth/organization/delete-organization-dialog.tsx +97 -0
  225. package/src/components/auth/organization/delete-organization-skeleton.tsx +17 -0
  226. package/src/components/auth/organization/delete-organization.tsx +77 -0
  227. package/src/components/auth/organization/invite-member-dialog.tsx +177 -0
  228. package/src/components/auth/organization/leave-organization-dialog.tsx +95 -0
  229. package/src/components/auth/organization/leave-organization.tsx +59 -0
  230. package/src/components/auth/organization/organization-danger-zone.tsx +68 -0
  231. package/src/components/auth/organization/organization-invitation-row-skeleton.tsx +29 -0
  232. package/src/components/auth/organization/organization-invitation-row.tsx +97 -0
  233. package/src/components/auth/organization/organization-invitations-empty.tsx +39 -0
  234. package/src/components/auth/organization/organization-invitations.tsx +351 -0
  235. package/src/components/auth/organization/organization-logo.tsx +64 -0
  236. package/src/components/auth/organization/organization-member-row-skeleton.tsx +24 -0
  237. package/src/components/auth/organization/organization-member-row.tsx +157 -0
  238. package/src/components/auth/organization/organization-members.tsx +284 -0
  239. package/src/components/auth/organization/organization-people.tsx +26 -0
  240. package/src/components/auth/organization/organization-profile.tsx +141 -0
  241. package/src/components/auth/organization/organization-row.tsx +66 -0
  242. package/src/components/auth/organization/organization-settings.tsx +38 -0
  243. package/src/components/auth/organization/organization-switcher.tsx +233 -0
  244. package/src/components/auth/organization/organization-view-skeleton.tsx +36 -0
  245. package/src/components/auth/organization/organization-view.tsx +109 -0
  246. package/src/components/auth/organization/organization.tsx +162 -0
  247. package/src/components/auth/organization/organizations-empty.tsx +35 -0
  248. package/src/components/auth/organization/organizations-settings.tsx +36 -0
  249. package/src/components/auth/organization/organizations.tsx +80 -0
  250. package/src/components/auth/organization/remove-member-dialog.tsx +95 -0
  251. package/src/components/auth/organization/slug-field.tsx +111 -0
  252. package/src/components/auth/organization/user-invitation-row-skeleton.tsx +17 -0
  253. package/src/components/auth/organization/user-invitation-row.tsx +90 -0
  254. package/src/components/auth/organization/user-invitations-empty.tsx +30 -0
  255. package/src/components/auth/organization/user-invitations.tsx +59 -0
  256. package/src/components/auth/settings/account/change-email.tsx +1 -1
  257. package/src/components/auth/settings/account/user-profile.tsx +5 -5
  258. package/src/components/auth/settings/security/active-sessions.tsx +6 -4
  259. package/src/components/auth/settings/security/linked-accounts.tsx +2 -2
  260. package/src/components/auth/settings/settings.tsx +77 -14
  261. package/src/components/auth/user/user-avatar.tsx +4 -1
  262. package/src/components/auth/user/user-button.tsx +14 -11
  263. package/src/components/auth/user/user-view.tsx +32 -12
  264. package/src/email.ts +1 -0
  265. package/src/lib/auth/api-key-plugin.ts +10 -4
  266. package/src/lib/auth/auth-plugin.ts +6 -1
  267. package/src/lib/auth/organization-plugin.tsx +32 -0
  268. package/src/plugins.ts +25 -1
  269. package/dist/components/auth/delete-user/delete-user.d.ts +0 -9
  270. package/dist/components/auth/delete-user/delete-user.js +0 -95
@@ -1,48 +1,17 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { DeletePasskeyDialog as t } from "./delete-passkey-dialog.js";
3
- import { useAuth as n, useAuthPlugin as r } from "@better-auth-ui/react";
4
- import { Fingerprint as i, Xmark as a } from "@gravity-ui/icons";
5
- import { Button as o } from "@heroui/react";
6
- import { useState as s } from "react";
7
- import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
- //#region src/components/auth/passkey/passkey.tsx
9
- function u({ passkey: u }) {
10
- let { localization: d } = n(), { localization: f } = r(e), [p, m] = s(!1), h = u.name || f.passkey;
11
- return /* @__PURE__ */ l("div", {
12
- className: "flex items-center gap-3",
13
- children: [
14
- /* @__PURE__ */ c("div", {
15
- className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary",
16
- children: /* @__PURE__ */ c(i, { className: "size-4.5" })
17
- }),
18
- /* @__PURE__ */ l("div", {
19
- className: "flex min-w-0 flex-col",
20
- children: [/* @__PURE__ */ c("span", {
21
- className: "truncate text-sm font-medium leading-tight",
22
- children: h
23
- }), /* @__PURE__ */ c("span", {
24
- className: "text-xs text-muted",
25
- children: new Date(u.createdAt).toLocaleString(void 0, {
26
- dateStyle: "medium",
27
- timeStyle: "short"
28
- })
29
- })]
30
- }),
31
- /* @__PURE__ */ l(o, {
32
- className: "ml-auto shrink-0",
33
- variant: "outline",
34
- size: "sm",
35
- onPress: () => m(!0),
36
- "aria-label": f.deletePasskey.replace("{{name}}", h),
37
- children: [/* @__PURE__ */ c(a, {}), d.settings.delete]
38
- }),
39
- /* @__PURE__ */ c(t, {
40
- isOpen: p,
41
- onOpenChange: m,
42
- passkey: u
43
- })
44
- ]
45
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAuth, useAuthPlugin } from "@better-auth-ui/react";
3
+ import { Fingerprint, Xmark } from "@gravity-ui/icons";
4
+ import { Button } from "@heroui/react";
5
+ import { useState } from "react";
6
+ import { passkeyPlugin } from "../../../lib/auth/passkey-plugin";
7
+ import { DeletePasskeyDialog } from "./delete-passkey-dialog";
8
+ export function Passkey({ passkey }) {
9
+ const { localization } = useAuth();
10
+ const { localization: passkeyLocalization } = useAuthPlugin(passkeyPlugin);
11
+ const [deleteOpen, setDeleteOpen] = useState(false);
12
+ const passkeyName = passkey.name || passkeyLocalization.passkey;
13
+ return (_jsxs("div", { className: "flex items-center gap-3", children: [_jsx("div", { className: "flex size-10 shrink-0 items-center justify-center rounded-xl bg-surface-secondary", children: _jsx(Fingerprint, { className: "size-4.5" }) }), _jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "truncate text-sm font-medium leading-tight", children: passkeyName }), _jsx("span", { className: "text-xs text-muted", children: new Date(passkey.createdAt).toLocaleString(undefined, {
14
+ dateStyle: "medium",
15
+ timeStyle: "short"
16
+ }) })] }), _jsxs(Button, { className: "ml-auto shrink-0", variant: "outline", size: "sm", onPress: () => setDeleteOpen(true), "aria-label": passkeyLocalization.deletePasskey.replace("{{name}}", passkeyName), children: [_jsx(Xmark, {}), localization.settings.delete] }), _jsx(DeletePasskeyDialog, { isOpen: deleteOpen, onOpenChange: setDeleteOpen, passkey: passkey })] }));
46
17
  }
47
- //#endregion
48
- export { u as Passkey };
@@ -1,35 +1,9 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { useAuthPlugin as t } from "@better-auth-ui/react";
3
- import { Fingerprint as n } from "@gravity-ui/icons";
4
- import { Button as r } from "@heroui/react";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
- //#region src/components/auth/passkey/passkeys-empty.tsx
7
- function o({ onAddPress: o }) {
8
- let { localization: s } = t(e);
9
- return /* @__PURE__ */ a("div", {
10
- className: "flex flex-col items-center justify-center gap-4",
11
- children: [
12
- /* @__PURE__ */ i("div", {
13
- className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary",
14
- children: /* @__PURE__ */ i(n, { className: "size-4.5" })
15
- }),
16
- /* @__PURE__ */ a("div", {
17
- className: "flex flex-col items-center justify-center gap-1 text-center",
18
- children: [/* @__PURE__ */ i("p", {
19
- className: "text-sm font-semibold",
20
- children: s.noPasskeys
21
- }), /* @__PURE__ */ i("p", {
22
- className: "text-muted text-xs",
23
- children: s.passkeysDescription
24
- })]
25
- }),
26
- /* @__PURE__ */ i(r, {
27
- size: "sm",
28
- onPress: o,
29
- children: s.addPasskey
30
- })
31
- ]
32
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAuthPlugin } from "@better-auth-ui/react";
3
+ import { Fingerprint } from "@gravity-ui/icons";
4
+ import { Button } from "@heroui/react";
5
+ import { passkeyPlugin } from "../../../lib/auth/passkey-plugin";
6
+ export function PasskeysEmpty({ onAddPress }) {
7
+ const { localization: passkeyLocalization } = useAuthPlugin(passkeyPlugin);
8
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-4", children: [_jsx("div", { className: "flex size-10 items-center justify-center rounded-xl bg-surface-secondary", children: _jsx(Fingerprint, { className: "size-4.5" }) }), _jsxs("div", { className: "flex flex-col items-center justify-center gap-1 text-center", children: [_jsx("p", { className: "text-sm font-semibold", children: passkeyLocalization.noPasskeys }), _jsx("p", { className: "text-muted text-xs", children: passkeyLocalization.passkeysDescription })] }), _jsx(Button, { size: "sm", onPress: onAddPress, children: passkeyLocalization.addPasskey })] }));
33
9
  }
34
- //#endregion
35
- export { o as PasskeysEmpty };
@@ -1,4 +1,4 @@
1
- import { CardProps } from '@heroui/react';
1
+ import { type CardProps } from "@heroui/react";
2
2
  export type PasskeysProps = {
3
3
  className?: string;
4
4
  variant?: CardProps["variant"];
@@ -1,42 +1,16 @@
1
- import { passkeyPlugin as e } from "../../../lib/auth/passkey-plugin.js";
2
- import { AddPasskeyDialog as t } from "./add-passkey-dialog.js";
3
- import { Passkey as n } from "./passkey.js";
4
- import { PasskeySkeleton as r } from "./passkey-skeleton.js";
5
- import { PasskeysEmpty as i } from "./passkeys-empty.js";
6
- import { useAuth as a, useAuthPlugin as o, useListPasskeys as s } from "@better-auth-ui/react";
7
- import { Button as c, Card as l, cn as u } from "@heroui/react";
8
- import { useState as d } from "react";
9
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
- //#region src/components/auth/passkey/passkeys.tsx
11
- function m({ className: m, variant: h, ...g }) {
12
- let { authClient: _ } = a(), { localization: v } = o(e), { data: y, isPending: b } = s(_), [x, S] = d(!1);
13
- return /* @__PURE__ */ p("div", {
14
- className: u("flex flex-col gap-3", m),
15
- children: [
16
- /* @__PURE__ */ p("div", {
17
- className: "flex items-end justify-between gap-3",
18
- children: [/* @__PURE__ */ f("h2", {
19
- className: "text-sm font-semibold truncate",
20
- children: v.passkeys
21
- }), /* @__PURE__ */ f(c, {
22
- className: "shrink-0",
23
- size: "sm",
24
- isDisabled: b,
25
- onPress: () => S(!0),
26
- children: v.addPasskey
27
- })]
28
- }),
29
- /* @__PURE__ */ f(l, {
30
- variant: h,
31
- ...g,
32
- children: /* @__PURE__ */ f(l.Content, { children: b ? /* @__PURE__ */ f(r, {}) : y?.length ? y.map((e, t) => /* @__PURE__ */ p("div", { children: [t > 0 && /* @__PURE__ */ f("div", { className: "border-b border-dashed -mx-4 my-4" }), /* @__PURE__ */ f(n, { passkey: e })] }, e.id)) : /* @__PURE__ */ f(i, { onAddPress: () => S(!0) }) })
33
- }),
34
- /* @__PURE__ */ f(t, {
35
- isOpen: x,
36
- onOpenChange: S
37
- })
38
- ]
39
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAuth, useAuthPlugin, useListPasskeys } from "@better-auth-ui/react";
3
+ import { Button, Card, cn } from "@heroui/react";
4
+ import { useState } from "react";
5
+ import { passkeyPlugin } from "../../../lib/auth/passkey-plugin";
6
+ import { AddPasskeyDialog } from "./add-passkey-dialog";
7
+ import { Passkey } from "./passkey";
8
+ import { PasskeySkeleton } from "./passkey-skeleton";
9
+ import { PasskeysEmpty } from "./passkeys-empty";
10
+ export function Passkeys({ className, variant, ...props }) {
11
+ const { authClient } = useAuth();
12
+ const { localization: passkeyLocalization } = useAuthPlugin(passkeyPlugin);
13
+ const { data: passkeys, isPending } = useListPasskeys(authClient);
14
+ const [addOpen, setAddOpen] = useState(false);
15
+ return (_jsxs("div", { className: cn("flex flex-col gap-3", className), children: [_jsxs("div", { className: "flex items-end justify-between gap-3", children: [_jsx("h2", { className: "text-sm font-semibold truncate", children: passkeyLocalization.passkeys }), _jsx(Button, { className: "shrink-0", size: "sm", isDisabled: isPending, onPress: () => setAddOpen(true), children: passkeyLocalization.addPasskey })] }), _jsx(Card, { variant: variant, ...props, children: _jsx(Card.Content, { children: isPending ? (_jsx(PasskeySkeleton, {})) : !passkeys?.length ? (_jsx(PasskeysEmpty, { onAddPress: () => setAddOpen(true) })) : (passkeys.map((passkey, index) => (_jsxs("div", { children: [index > 0 && (_jsx("div", { className: "border-b border-dashed -mx-4 my-4" })), _jsx(Passkey, { passkey: passkey })] }, passkey.id)))) }) }), _jsx(AddPasskeyDialog, { isOpen: addOpen, onOpenChange: setAddOpen })] }));
40
16
  }
41
- //#endregion
42
- export { m as Passkeys };
@@ -1,5 +1,5 @@
1
- import { ButtonProps } from '@heroui/react';
2
- import { SocialProvider } from 'better-auth/social-providers';
1
+ import { type ButtonProps } from "@heroui/react";
2
+ import type { SocialProvider } from "better-auth/social-providers";
3
3
  export type ProviderButtonProps = {
4
4
  provider: SocialProvider;
5
5
  display?: "full" | "name" | "icon";
@@ -1,25 +1,29 @@
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
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { authMutationKeys, getProviderName } from "@better-auth-ui/core";
3
+ import { providerIcons, useAuth, useSignInSocial } from "@better-auth-ui/react";
4
+ import { Button, Spinner } from "@heroui/react";
5
+ import { useIsMutating } from "@tanstack/react-query";
6
+ /**
7
+ * Social provider sign-in button.
8
+ *
9
+ * @param provider - Provider to sign in with.
10
+ * @param display - `"full"` (e.g. "Continue with Google"), `"name"` (just the provider name), or `"icon"` (icon only).
11
+ */
12
+ export function ProviderButton({ provider, display = "full", variant = "tertiary", ...props }) {
13
+ const { authClient, baseURL, localization, redirectTo } = useAuth();
14
+ const callbackURL = `${baseURL}${redirectTo}`;
15
+ const { mutate: signInSocial, isPending: signInSocialPending } = useSignInSocial(authClient);
16
+ const ProviderIcon = providerIcons[provider];
17
+ const signInMutating = useIsMutating({
18
+ mutationKey: authMutationKeys.signIn.all
19
+ });
20
+ const signUpMutating = useIsMutating({
21
+ mutationKey: authMutationKeys.signUp.all
22
+ });
23
+ const isPending = signInMutating + signUpMutating > 0;
24
+ return (_jsxs(Button, { variant: variant, isPending: isPending, onPress: () => signInSocial({ provider, callbackURL }), ...props, "aria-label": getProviderName(provider), children: [signInSocialPending ? (_jsx(Spinner, { color: "current", size: "sm" })) : (_jsx(ProviderIcon, {})), display === "full"
25
+ ? localization.auth.continueWith.replace("{{provider}}", getProviderName(provider))
26
+ : display === "name"
27
+ ? getProviderName(provider)
28
+ : null] }));
23
29
  }
24
- //#endregion
25
- export { u as ProviderButton };
@@ -1,19 +1,29 @@
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
- //#region src/components/auth/provider-buttons.tsx
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
- provider: t,
13
- display: s === "vertical" ? "full" : s === "grid" ? "name" : "icon",
14
- className: n("w-full", s === "horizontal" && "flex-1")
15
- }, t))
16
- });
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useAuth } from "@better-auth-ui/react";
3
+ import { cn } from "@heroui/react";
4
+ import { useMemo } from "react";
5
+ import { ProviderButton } from "./provider-button";
6
+ /**
7
+ * Render social provider sign-in buttons. Each button owns its own sign-in
8
+ * mutation and reads shared auth pending state from React Query.
9
+ *
10
+ * @param socialLayout - Preferred layout for the buttons; `"auto"` picks `"horizontal"` when there are four or more providers, otherwise `"vertical"`.
11
+ * @returns The JSX element that renders the configured social provider buttons.
12
+ */
13
+ export function ProviderButtons({ socialLayout = "auto" }) {
14
+ const { socialProviders } = useAuth();
15
+ const resolvedSocialLayout = useMemo(() => {
16
+ if (socialLayout === "auto") {
17
+ if (socialProviders?.length && socialProviders.length >= 4) {
18
+ return "horizontal";
19
+ }
20
+ return "vertical";
21
+ }
22
+ return socialLayout;
23
+ }, [socialLayout, socialProviders?.length]);
24
+ return (_jsx("div", { className: cn("gap-3", resolvedSocialLayout === "grid" && "grid grid-cols-2", resolvedSocialLayout === "vertical" && "flex flex-col", resolvedSocialLayout === "horizontal" && "flex flex-wrap"), children: socialProviders?.map((provider) => (_jsx(ProviderButton, { provider: provider, display: resolvedSocialLayout === "vertical"
25
+ ? "full"
26
+ : resolvedSocialLayout === "grid"
27
+ ? "name"
28
+ : "icon", className: cn("w-full", resolvedSocialLayout === "horizontal" && "flex-1") }, provider))) }));
17
29
  }
18
- //#endregion
19
- export { a as ProviderButtons };
@@ -1,4 +1,4 @@
1
- import { CardProps } from '@heroui/react';
1
+ import { type CardProps } from "@heroui/react";
2
2
  export type ResetPasswordProps = {
3
3
  className?: string;
4
4
  variant?: CardProps["variant"];
@@ -1,147 +1,57 @@
1
- import { useAuth as e, useResetPassword as t } from "@better-auth-ui/react";
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
- import { useEffect as g, useState as _ } from "react";
5
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
6
- //#region src/components/auth/reset-password.tsx
7
- function b({ className: b, variant: x, ...S }) {
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
- g(() => {
12
- new URLSearchParams(window.location.search).get("token") || (h.danger(E.auth.invalidResetPasswordToken), O({ to: `${w.auth}/${D.auth.signIn}` }));
13
- }, [
14
- w.auth,
15
- E.auth.invalidResetPasswordToken,
16
- D.auth.signIn,
17
- O
18
- ]);
19
- function F(e) {
20
- e.preventDefault();
21
- let t = new URLSearchParams(window.location.search).get("token");
22
- if (!t) {
23
- h.danger(E.auth.invalidResetPasswordToken), O({ to: `${w.auth}/${D.auth.signIn}` });
24
- return;
25
- }
26
- let n = new FormData(e.currentTarget), r = n.get("password"), i = n.get("confirmPassword");
27
- if (T?.confirmPassword && r !== i) {
28
- h.danger(E.auth.passwordsDoNotMatch);
29
- return;
30
- }
31
- k({
32
- token: t,
33
- newPassword: r
34
- });
35
- }
36
- return /* @__PURE__ */ y(a, {
37
- className: m("w-full max-w-sm gap-4 md:p-6", b),
38
- variant: x,
39
- ...S,
40
- children: [
41
- /* @__PURE__ */ v(a.Header, { children: /* @__PURE__ */ v(a.Title, {
42
- className: "text-xl font-semibold mb-1",
43
- children: E.auth.resetPassword
44
- }) }),
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
- })
125
- ]
126
- })
127
- }),
128
- /* @__PURE__ */ v(a.Footer, {
129
- className: "flex-col gap-3",
130
- children: /* @__PURE__ */ y(o, {
131
- className: "text-sm",
132
- children: [
133
- E.auth.rememberYourPassword,
134
- " ",
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
- })
140
- ]
141
- })
142
- })
143
- ]
144
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAuth, useResetPassword } from "@better-auth-ui/react";
3
+ import { Eye, EyeSlash } from "@gravity-ui/icons";
4
+ import { Button, Card, cn, Description, FieldError, Form, InputGroup, Label, Link, Spinner, TextField, toast } from "@heroui/react";
5
+ import { useEffect, useState } from "react";
6
+ /**
7
+ * Renders a reset password form that verifies a "token" URL parameter on mount and redirects to sign-in if absent.
8
+ *
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
+ */
11
+ export function ResetPassword({ className, variant, ...props }) {
12
+ const { authClient, basePaths, emailAndPassword, localization, viewPaths, navigate } = useAuth();
13
+ const { mutate: resetPassword, isPending } = useResetPassword(authClient, {
14
+ onSuccess: () => {
15
+ toast.success(localization.auth.passwordResetSuccess);
16
+ navigate({ to: `${basePaths.auth}/${viewPaths.auth.signIn}` });
17
+ }
18
+ });
19
+ const [isPasswordVisible, setIsPasswordVisible] = useState(false);
20
+ const [isConfirmPasswordVisible, setIsConfirmPasswordVisible] = useState(false);
21
+ useEffect(() => {
22
+ const searchParams = new URLSearchParams(window.location.search);
23
+ const token = searchParams.get("token");
24
+ if (!token) {
25
+ toast.danger(localization.auth.invalidResetPasswordToken);
26
+ navigate({ to: `${basePaths.auth}/${viewPaths.auth.signIn}` });
27
+ }
28
+ }, [
29
+ basePaths.auth,
30
+ localization.auth.invalidResetPasswordToken,
31
+ viewPaths.auth.signIn,
32
+ navigate
33
+ ]);
34
+ function handleSubmit(e) {
35
+ e.preventDefault();
36
+ const searchParams = new URLSearchParams(window.location.search);
37
+ const token = searchParams.get("token");
38
+ if (!token) {
39
+ toast.danger(localization.auth.invalidResetPasswordToken);
40
+ navigate({ to: `${basePaths.auth}/${viewPaths.auth.signIn}` });
41
+ return;
42
+ }
43
+ const formData = new FormData(e.currentTarget);
44
+ const password = formData.get("password");
45
+ const confirmPassword = formData.get("confirmPassword");
46
+ if (emailAndPassword?.confirmPassword && password !== confirmPassword) {
47
+ toast.danger(localization.auth.passwordsDoNotMatch);
48
+ return;
49
+ }
50
+ resetPassword({ token, newPassword: password });
51
+ }
52
+ return (_jsxs(Card, { className: cn("w-full max-w-sm gap-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.resetPassword }) }), _jsx(Card.Content, { className: "gap-4", children: _jsxs(Form, { onSubmit: handleSubmit, className: "flex flex-col gap-4", children: [_jsxs(TextField, { minLength: emailAndPassword?.minPasswordLength, maxLength: emailAndPassword?.maxPasswordLength, name: "password", autoComplete: "new-password", isDisabled: isPending, children: [_jsx(Label, { children: localization.auth.password }), _jsxs(InputGroup, { variant: variant === "transparent" ? "primary" : "secondary", children: [_jsx(InputGroup.Input, { name: "password", placeholder: localization.auth.newPasswordPlaceholder, type: isPasswordVisible ? "text" : "password", required: true }), _jsx(InputGroup.Suffix, { className: "px-0", children: _jsx(Button, { isIconOnly: true, "aria-label": isPasswordVisible
53
+ ? localization.auth.hidePassword
54
+ : 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, children: [_jsx(Label, { children: localization.auth.confirmPassword }), _jsxs(InputGroup, { variant: variant === "transparent" ? "primary" : "secondary", children: [_jsx(InputGroup.Input, { placeholder: localization.auth.confirmPasswordPlaceholder, type: isConfirmPasswordVisible ? "text" : "password", required: true, name: "confirmPassword" }), _jsx(InputGroup.Suffix, { className: "px-0", children: _jsx(Button, { isIconOnly: true, "aria-label": isConfirmPasswordVisible
55
+ ? localization.auth.hidePassword
56
+ : localization.auth.showPassword, size: "sm", variant: "ghost", onPress: () => setIsConfirmPasswordVisible(!isConfirmPasswordVisible), isDisabled: isPending, children: isConfirmPasswordVisible ? _jsx(EyeSlash, {}) : _jsx(Eye, {}) }) })] }), _jsx(FieldError, {})] })), _jsx("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.resetPassword] }) })] }) }), _jsx(Card.Footer, { className: "flex-col gap-3", children: _jsxs(Description, { className: "text-sm", children: [localization.auth.rememberYourPassword, " ", _jsx(Link, { href: `${basePaths.auth}/${viewPaths.auth.signIn}`, className: "text-accent no-underline hover:underline decoration-accent-hover", children: localization.auth.signIn })] }) })] }));
145
57
  }
146
- //#endregion
147
- export { b as ResetPassword };
@@ -1,5 +1,5 @@
1
- import { CardProps } from '@heroui/react';
2
- import { ComponentProps } from 'react';
1
+ import { type CardProps } from "@heroui/react";
2
+ import type { ComponentProps } from "react";
3
3
  export type AccountSettingsProps = {
4
4
  className?: string;
5
5
  variant?: CardProps["variant"];
@@ -1,20 +1,22 @@
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
- });
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useAuth } from "@better-auth-ui/react";
3
+ import { cn } from "@heroui/react";
4
+ import { ChangeEmail } from "./change-email";
5
+ import { UserProfile } from "./user-profile";
6
+ /**
7
+ * Renders the account settings layout.
8
+ *
9
+ * `UserProfile` always renders. `ChangeEmail` renders when password auth is
10
+ * enabled or the `magicLink` plugin is registered. Plugin-contributed account
11
+ * cards (e.g. `Appearance` from the theme plugin, multi-session accounts) are
12
+ * rendered via the plugins array.
13
+ *
14
+ * @param className - Optional additional CSS class names for the outer container.
15
+ * @param variant - Card variant forwarded to each account settings card.
16
+ * @returns The account settings container as a JSX element.
17
+ */
18
+ export function AccountSettings({ className, variant, ...props }) {
19
+ const { emailAndPassword, plugins } = useAuth();
20
+ const hasMagicLink = plugins.some((plugin) => plugin.id === "magicLink");
21
+ return (_jsxs("div", { className: cn("flex w-full flex-col gap-4 md:gap-6", className), ...props, children: [_jsx(UserProfile, { variant: variant }), (emailAndPassword?.enabled || hasMagicLink) && (_jsx(ChangeEmail, { variant: variant })), plugins.flatMap((plugin) => plugin.accountCards?.map((Card, index) => (_jsx(Card, { variant: variant }, `${plugin.id}-${index.toString()}`))))] }));
18
22
  }
19
- //#endregion
20
- export { o as AccountSettings };