@better-auth-ui/heroui 1.6.3 → 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 (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 +3 -4
  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 +41 -38
  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 +75 -99
  62. package/dist/components/auth/sign-out.js +11 -11
  63. package/dist/components/auth/sign-up.js +123 -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 +142 -0
  74. package/dist/components/auth/username/username-field.d.ts +8 -0
  75. package/dist/components/auth/username/username-field.js +51 -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 +3 -10
  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 +14 -11
  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 +38 -61
  134. package/src/components/auth/sign-out.tsx +2 -2
  135. package/src/components/auth/sign-up.tsx +109 -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 +283 -0
  142. package/src/components/auth/username/username-field.tsx +122 -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,44 @@
1
+ import { AdditionalField as AdditionalFieldConfig } from '@better-auth-ui/core';
2
+ import { AccountCardProps, AuthPlugin as AuthPluginPrimitive, AuthPluginComponents as BaseAuthPluginComponents, SecurityCardProps, UserMenuItemProps } from '@better-auth-ui/react';
3
+ import { CardProps } from '@heroui/react';
4
+ import { ComponentType, ReactNode } from 'react';
5
+ import { SocialLayout } from '../../components/auth/provider-buttons';
6
+ /** Props for the heroui `<AdditionalField>` component and `field.render` callbacks. */
7
+ export type AdditionalFieldProps = {
8
+ name: string;
9
+ field: AdditionalFieldConfig;
10
+ isPending?: boolean;
11
+ variant?: CardProps["variant"];
12
+ };
13
+ declare module "@better-auth-ui/core" {
14
+ interface AuthPluginRegister {
15
+ heroui: AuthPlugin;
16
+ }
17
+ interface AdditionalFieldRegister {
18
+ label: ReactNode;
19
+ renderProps: AdditionalFieldProps;
20
+ renderResult: ReactNode;
21
+ }
22
+ }
23
+ /** Heroui slot component shapes — inherits from the framework-agnostic defaults and narrows slots that receive a heroui variant from the host. */
24
+ export type AuthPluginComponents = Omit<BaseAuthPluginComponents, "securityCards" | "accountCards"> & {
25
+ /** Rendered as cards inside security settings */
26
+ securityCards?: ComponentType<SecurityCardProps & {
27
+ variant?: CardProps["variant"];
28
+ }>[];
29
+ /** Rendered as cards inside account settings */
30
+ accountCards?: ComponentType<AccountCardProps & {
31
+ variant?: CardProps["variant"];
32
+ }>[];
33
+ /** Rendered as items inside the `UserButton` dropdown (e.g. account switcher). */
34
+ userMenuItems?: ComponentType<UserMenuItemProps>[];
35
+ };
36
+ /** Props the heroui `<Auth>` router spreads onto plugin-contributed auth views. */
37
+ export type AuthViewProps = Omit<CardProps, "children"> & {
38
+ socialLayout?: SocialLayout;
39
+ socialPosition?: "top" | "bottom";
40
+ };
41
+ /** Props the heroui `<Settings>` router spreads onto plugin-contributed settings views. */
42
+ export type SettingsViewProps = Omit<CardProps, "children">;
43
+ /** Heroui plugin type. Plugin authors import this from `@better-auth-ui/heroui`. */
44
+ export type AuthPlugin = AuthPluginPrimitive<AuthPluginComponents, AuthViewProps, SettingsViewProps>;
@@ -0,0 +1,17 @@
1
+ import { DeleteUserPluginOptions } from '@better-auth-ui/core/plugins';
2
+ import { DangerZone } from '../../components/auth/delete-user/danger-zone';
3
+ export declare const deleteUserPlugin: ((options?: DeleteUserPluginOptions | undefined) => Omit<{
4
+ securityCards: (typeof DangerZone)[];
5
+ localization: {
6
+ deleteUser: string;
7
+ deleteUserDescription: string;
8
+ deleteUserVerificationSent: string;
9
+ deleteUserSuccess: string;
10
+ };
11
+ sendDeleteAccountVerification: boolean;
12
+ id: "deleteUser";
13
+ }, "id"> & {
14
+ id: "deleteUser";
15
+ }) & {
16
+ id: "deleteUser";
17
+ };
@@ -0,0 +1,10 @@
1
+ import { DangerZone as e } from "../../components/auth/delete-user/danger-zone.js";
2
+ import { createAuthPlugin as t } from "@better-auth-ui/core";
3
+ import { deleteUserPlugin as n } from "@better-auth-ui/core/plugins";
4
+ //#region src/lib/auth/delete-user-plugin.ts
5
+ var r = t(n.id, (t = {}) => ({
6
+ ...n(t),
7
+ securityCards: [e]
8
+ }));
9
+ //#endregion
10
+ export { r as deleteUserPlugin };
@@ -0,0 +1,31 @@
1
+ import { MagicLinkPluginOptions } from '@better-auth-ui/core/plugins';
2
+ import { MagicLink } from '../../components/auth/magic-link/magic-link';
3
+ import { MagicLinkButton } from '../../components/auth/magic-link/magic-link-button';
4
+ export declare const magicLinkPlugin: ((options?: MagicLinkPluginOptions | undefined) => Omit<{
5
+ authButtons: (typeof MagicLinkButton)[];
6
+ views: {
7
+ auth: {
8
+ magicLink: typeof MagicLink;
9
+ };
10
+ };
11
+ fallbackViews: {
12
+ auth: {
13
+ signIn: typeof MagicLink;
14
+ };
15
+ };
16
+ localization: {
17
+ magicLink: string;
18
+ sendMagicLink: string;
19
+ magicLinkSent: string;
20
+ };
21
+ viewPaths: {
22
+ auth: {
23
+ magicLink: string;
24
+ };
25
+ };
26
+ id: "magicLink";
27
+ }, "id"> & {
28
+ id: "magicLink";
29
+ }) & {
30
+ id: "magicLink";
31
+ };
@@ -0,0 +1,13 @@
1
+ import { MagicLinkButton as e } from "../../components/auth/magic-link/magic-link-button.js";
2
+ import { MagicLink as t } from "../../components/auth/magic-link/magic-link.js";
3
+ import { createAuthPlugin as n } from "@better-auth-ui/core";
4
+ import { magicLinkPlugin as r } from "@better-auth-ui/core/plugins";
5
+ //#region src/lib/auth/magic-link-plugin.ts
6
+ var i = n(r.id, (n = {}) => ({
7
+ ...r(n),
8
+ authButtons: [e],
9
+ views: { auth: { magicLink: t } },
10
+ fallbackViews: { auth: { signIn: t } }
11
+ }));
12
+ //#endregion
13
+ export { i as magicLinkPlugin };
@@ -0,0 +1,18 @@
1
+ import { MultiSessionPluginOptions } from '@better-auth-ui/core/plugins';
2
+ import { ManageAccounts } from '../../components/auth/multi-session/manage-accounts';
3
+ import { SwitchAccountSubmenu } from '../../components/auth/multi-session/switch-account-submenu';
4
+ export declare const multiSessionPlugin: ((options?: MultiSessionPluginOptions | undefined) => Omit<{
5
+ accountCards: (typeof ManageAccounts)[];
6
+ userMenuItems: (typeof SwitchAccountSubmenu)[];
7
+ localization: {
8
+ switchAccount: string;
9
+ addAccount: string;
10
+ manageAccounts: string;
11
+ manageAccountsDescription: string;
12
+ };
13
+ id: "multiSession";
14
+ }, "id"> & {
15
+ id: "multiSession";
16
+ }) & {
17
+ id: "multiSession";
18
+ };
@@ -0,0 +1,12 @@
1
+ import { ManageAccounts as e } from "../../components/auth/multi-session/manage-accounts.js";
2
+ import { SwitchAccountSubmenu as t } from "../../components/auth/multi-session/switch-account-submenu.js";
3
+ import { createAuthPlugin as n } from "@better-auth-ui/core";
4
+ import { multiSessionPlugin as r } from "@better-auth-ui/core/plugins";
5
+ //#region src/lib/auth/multi-session-plugin.ts
6
+ var i = n(r.id, (n = {}) => ({
7
+ ...r(n),
8
+ accountCards: [e],
9
+ userMenuItems: [t]
10
+ }));
11
+ //#endregion
12
+ export { i as multiSessionPlugin };
@@ -0,0 +1,20 @@
1
+ import { PasskeyPluginOptions } from '@better-auth-ui/core/plugins';
2
+ import { PasskeyButton } from '../../components/auth/passkey/passkey-button';
3
+ import { Passkeys } from '../../components/auth/passkey/passkeys';
4
+ export declare const passkeyPlugin: ((options?: PasskeyPluginOptions | undefined) => Omit<{
5
+ authButtons: (typeof PasskeyButton)[];
6
+ securityCards: (typeof Passkeys)[];
7
+ localization: {
8
+ passkey: string;
9
+ addPasskey: string;
10
+ deletePasskey: string;
11
+ passkeys: string;
12
+ passkeysDescription: string;
13
+ passkeysInstructions: string;
14
+ };
15
+ id: "passkey";
16
+ }, "id"> & {
17
+ id: "passkey";
18
+ }) & {
19
+ id: "passkey";
20
+ };
@@ -0,0 +1,12 @@
1
+ import { PasskeyButton as e } from "../../components/auth/passkey/passkey-button.js";
2
+ import { Passkeys as t } from "../../components/auth/passkey/passkeys.js";
3
+ import { createAuthPlugin as n } from "@better-auth-ui/core";
4
+ import { passkeyPlugin as r } from "@better-auth-ui/core/plugins";
5
+ //#region src/lib/auth/passkey-plugin.ts
6
+ var i = n(r.id, (n = {}) => ({
7
+ ...r(n),
8
+ authButtons: [e],
9
+ securityCards: [t]
10
+ }));
11
+ //#endregion
12
+ export { i as passkeyPlugin };
@@ -0,0 +1,68 @@
1
+ import { ThemeLocalization } from '@better-auth-ui/core/plugins';
2
+ import { Appearance } from '../../components/auth/theme/appearance';
3
+ import { ThemeToggleItem } from '../../components/auth/theme/theme-toggle-item';
4
+ /**
5
+ * Hook shape compatible with `next-themes`' `useTheme` and similar APIs. The
6
+ * hook is invoked inside the plugin factory so consumers can register the
7
+ * plugin in the same component as their `<ThemeProvider>` without an extra
8
+ * inner component.
9
+ */
10
+ export type UseThemeHook = () => {
11
+ theme?: string;
12
+ setTheme: (theme: string) => void;
13
+ themes?: string[];
14
+ };
15
+ type CommonThemeOptions = {
16
+ /**
17
+ * Override the plugin's default localization strings.
18
+ * @remarks `ThemeLocalization`
19
+ */
20
+ localization?: Partial<ThemeLocalization>;
21
+ /**
22
+ * Available theme options.
23
+ * @default ["system", "light", "dark"]
24
+ */
25
+ themes?: string[];
26
+ };
27
+ export type ThemePluginOptions = CommonThemeOptions & ({
28
+ /**
29
+ * A theme hook (e.g. next-themes' `useTheme`) called inside the
30
+ * plugin's slot components on every render. The hook owns the live
31
+ * theme value, so `theme`/`setTheme` are not accepted in this form.
32
+ */
33
+ useTheme: UseThemeHook;
34
+ theme?: never;
35
+ setTheme?: never;
36
+ } | {
37
+ /**
38
+ * Current theme value. Required when not using a hook so slot
39
+ * components can highlight the active option. Pass it from a
40
+ * stateful source (e.g. `useState`, Context) so updates flow
41
+ * through `<AuthProvider>` and re-render slot components.
42
+ */
43
+ theme: string;
44
+ /** Setter that updates the value `theme` is read from. */
45
+ setTheme: (theme: string) => void;
46
+ useTheme?: never;
47
+ });
48
+ export declare const themePlugin: ((args_0: ThemePluginOptions) => Omit<{
49
+ useTheme: UseThemeHook;
50
+ userMenuItems: (typeof ThemeToggleItem)[];
51
+ accountCards: (typeof Appearance)[];
52
+ localization: {
53
+ appearance: string;
54
+ theme: string;
55
+ system: string;
56
+ light: string;
57
+ dark: string;
58
+ };
59
+ theme: string;
60
+ themes: string[];
61
+ setTheme: (theme: string) => void;
62
+ id: "theme";
63
+ }, "id"> & {
64
+ id: "theme";
65
+ }) & {
66
+ id: "theme";
67
+ };
68
+ export {};
@@ -0,0 +1,23 @@
1
+ import { ThemeToggleItem as e } from "../../components/auth/theme/theme-toggle-item.js";
2
+ import { Appearance as t } from "../../components/auth/theme/appearance.js";
3
+ import { createAuthPlugin as n } from "@better-auth-ui/core";
4
+ import { themePlugin as r } from "@better-auth-ui/core/plugins";
5
+ //#region src/lib/auth/theme-plugin.ts
6
+ var i = n(r.id, ({ useTheme: n, ...i }) => {
7
+ let a = r({
8
+ setTheme: () => {},
9
+ ...i
10
+ });
11
+ return {
12
+ ...a,
13
+ useTheme: n ?? (() => ({
14
+ theme: a.theme,
15
+ setTheme: a.setTheme,
16
+ themes: a.themes
17
+ })),
18
+ userMenuItems: [e],
19
+ accountCards: [t]
20
+ };
21
+ });
22
+ //#endregion
23
+ export { i as themePlugin };
@@ -0,0 +1,63 @@
1
+ import { UsernamePluginOptions } from '@better-auth-ui/core/plugins';
2
+ import { SignInUsername } from '../../components/auth/username/sign-in-username';
3
+ import { UsernameField } from '../../components/auth/username/username-field';
4
+ export declare const usernamePlugin: ((options?: UsernamePluginOptions | undefined) => Omit<{
5
+ additionalFields: ({
6
+ name: string;
7
+ type: "string";
8
+ label: string;
9
+ placeholder: string;
10
+ inputType: "input";
11
+ signUp: "above";
12
+ required: boolean;
13
+ } | {
14
+ name: string;
15
+ type: "string";
16
+ label: string;
17
+ placeholder: string;
18
+ inputType: "input";
19
+ signUp: "above";
20
+ required?: undefined;
21
+ } | {
22
+ render: typeof UsernameField;
23
+ name: string;
24
+ type: "string";
25
+ label: string;
26
+ placeholder: string;
27
+ inputType: "input";
28
+ signUp: "above";
29
+ required: boolean;
30
+ } | {
31
+ render: typeof UsernameField;
32
+ name: string;
33
+ type: "string";
34
+ label: string;
35
+ placeholder: string;
36
+ inputType: "input";
37
+ signUp: "above";
38
+ required?: undefined;
39
+ })[];
40
+ views: {
41
+ auth: {
42
+ signIn: typeof SignInUsername;
43
+ };
44
+ };
45
+ localization: {
46
+ username: string;
47
+ usernamePlaceholder: string;
48
+ usernameOrEmailPlaceholder: string;
49
+ usernameAvailable: string;
50
+ usernameTaken: string;
51
+ displayUsername: string;
52
+ displayUsernamePlaceholder: string;
53
+ };
54
+ isUsernameAvailable?: boolean | undefined;
55
+ displayUsername?: boolean | undefined;
56
+ minUsernameLength: number;
57
+ maxUsernameLength: number;
58
+ id: "username";
59
+ }, "id"> & {
60
+ id: "username";
61
+ }) & {
62
+ id: "username";
63
+ };
@@ -0,0 +1,18 @@
1
+ import { UsernameField as e } from "../../components/auth/username/username-field.js";
2
+ import { SignInUsername as t } from "../../components/auth/username/sign-in-username.js";
3
+ import { createAuthPlugin as n } from "@better-auth-ui/core";
4
+ import { usernamePlugin as r } from "@better-auth-ui/core/plugins";
5
+ //#region src/lib/auth/username-plugin.tsx
6
+ var i = n(r.id, (n = {}) => {
7
+ let i = r(n);
8
+ return {
9
+ ...i,
10
+ additionalFields: i.additionalFields?.map((t) => t.name === "username" ? {
11
+ ...t,
12
+ render: e
13
+ } : t),
14
+ views: { auth: { signIn: t } }
15
+ };
16
+ });
17
+ //#endregion
18
+ export { i as usernamePlugin };
@@ -0,0 +1,20 @@
1
+ export * from './components/auth/delete-user/danger-zone';
2
+ export * from './components/auth/delete-user/delete-user';
3
+ export * from './components/auth/magic-link/magic-link';
4
+ export * from './components/auth/multi-session/manage-account';
5
+ export * from './components/auth/multi-session/manage-accounts';
6
+ export * from './components/auth/multi-session/switch-account-submenu';
7
+ export * from './components/auth/multi-session/switch-account-submenu-content';
8
+ export * from './components/auth/multi-session/switch-account-submenu-item';
9
+ export * from './components/auth/passkey/passkeys';
10
+ export * from './components/auth/theme/appearance';
11
+ export * from './components/auth/theme/theme-toggle-item';
12
+ export * from './components/auth/username/sign-in-username';
13
+ export * from './components/auth/username/username-field';
14
+ export * from './lib/auth/auth-plugin';
15
+ export * from './lib/auth/delete-user-plugin';
16
+ export * from './lib/auth/magic-link-plugin';
17
+ export * from './lib/auth/multi-session-plugin';
18
+ export * from './lib/auth/passkey-plugin';
19
+ export * from './lib/auth/theme-plugin';
20
+ export * from './lib/auth/username-plugin';
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { deleteUserPlugin as e } from "./lib/auth/delete-user-plugin.js";
3
+ import { DeleteUser as t } from "./components/auth/delete-user/delete-user.js";
4
+ import { DangerZone as n } from "./components/auth/delete-user/danger-zone.js";
5
+ import { magicLinkPlugin as r } from "./lib/auth/magic-link-plugin.js";
6
+ import { MagicLink as i } from "./components/auth/magic-link/magic-link.js";
7
+ import { ManageAccounts as a } from "./components/auth/multi-session/manage-accounts.js";
8
+ import { SwitchAccountSubmenuItem as o } from "./components/auth/multi-session/switch-account-submenu-item.js";
9
+ import { SwitchAccountSubmenuContent as s } from "./components/auth/multi-session/switch-account-submenu-content.js";
10
+ import { SwitchAccountSubmenu as c } from "./components/auth/multi-session/switch-account-submenu.js";
11
+ import { multiSessionPlugin as l } from "./lib/auth/multi-session-plugin.js";
12
+ import { ManageAccount as u } from "./components/auth/multi-session/manage-account.js";
13
+ import { passkeyPlugin as d } from "./lib/auth/passkey-plugin.js";
14
+ import { Passkeys as f } from "./components/auth/passkey/passkeys.js";
15
+ import { ThemeToggleItem as p } from "./components/auth/theme/theme-toggle-item.js";
16
+ import { themePlugin as m } from "./lib/auth/theme-plugin.js";
17
+ import { Appearance as h } from "./components/auth/theme/appearance.js";
18
+ import { UsernameField as g } from "./components/auth/username/username-field.js";
19
+ import { usernamePlugin as _ } from "./lib/auth/username-plugin.js";
20
+ import { SignInUsername as v } from "./components/auth/username/sign-in-username.js";
21
+ export { h as Appearance, n as DangerZone, t as DeleteUser, i as MagicLink, u as ManageAccount, a as ManageAccounts, f as Passkeys, v as SignInUsername, c as SwitchAccountSubmenu, s as SwitchAccountSubmenuContent, o as SwitchAccountSubmenuItem, p as ThemeToggleItem, g as UsernameField, e as deleteUserPlugin, r as magicLinkPlugin, l as multiSessionPlugin, d as passkeyPlugin, m as themePlugin, _ as usernamePlugin };
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@better-auth-ui/heroui",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "build": "vite build && bun styles",
7
- "dev": "bun styles && tsc --watch",
8
- "styles": "cpy src/styles.css dist/ --flat",
6
+ "build": "vite build",
7
+ "dev": "vite build --watch",
9
8
  "test": "vitest"
10
9
  },
11
10
  "files": [
@@ -17,13 +16,13 @@
17
16
  "types": "./dist/index.d.ts",
18
17
  "import": "./dist/index.js"
19
18
  },
20
- "./core": {
21
- "types": "./dist/core.d.ts",
22
- "import": "./dist/core.js"
19
+ "./email": {
20
+ "types": "./dist/email.d.ts",
21
+ "import": "./dist/email.js"
23
22
  },
24
- "./react": {
25
- "types": "./dist/react-exports.d.ts",
26
- "import": "./dist/react-exports.js"
23
+ "./plugins": {
24
+ "types": "./dist/plugins.d.ts",
25
+ "import": "./dist/plugins.js"
27
26
  },
28
27
  "./styles": "./dist/styles.css"
29
28
  },
@@ -31,32 +30,31 @@
31
30
  "@gravity-ui/icons": "^2.18.0",
32
31
  "@heroui/react": "^3.0.2",
33
32
  "@heroui/styles": "^3.0.2",
33
+ "@internationalized/date": "^3.12.1",
34
34
  "@tanstack/react-pacer": "^0.22.0",
35
- "@tanstack/react-query": "^5.99.0",
35
+ "@tanstack/react-query": "^5.100.8",
36
36
  "@testing-library/react": "^16.3.2",
37
37
  "@testing-library/user-event": "^14.5.2",
38
38
  "@types/react": "^19.2.14",
39
39
  "@vitejs/plugin-react": "^6.0.1",
40
- "@vitest/browser-playwright": "^4.1.4",
41
- "better-auth": "^1.6.5",
40
+ "@vitest/browser-playwright": "^4.1.5",
41
+ "better-auth": "^1.6.9",
42
42
  "bowser": "^2.11.0",
43
- "cpy-cli": "^7.0.0",
44
43
  "playwright": "^1.59.1",
45
44
  "react": "^19.2.5",
46
45
  "react-dom": "^19.2.5",
47
- "vitest": "^4.1.4"
48
- },
49
- "dependencies": {
50
- "@better-auth-ui/core": "*",
51
- "@better-auth-ui/react": "*"
46
+ "vitest": "^4.1.5"
52
47
  },
53
48
  "peerDependencies": {
49
+ "@better-auth-ui/core": "*",
50
+ "@better-auth-ui/react": "*",
54
51
  "@gravity-ui/icons": ">=2.18.0",
55
52
  "@heroui/react": ">=3.0.2",
56
53
  "@heroui/styles": ">=3.0.2",
54
+ "@internationalized/date": ">=3.12.1",
57
55
  "@tanstack/react-pacer": ">=0.22.0",
58
- "@tanstack/react-query": ">=5.99.0",
59
- "better-auth": ">=1.6.5",
56
+ "@tanstack/react-query": ">=5.100.8",
57
+ "better-auth": ">=1.6.9",
60
58
  "react": ">=19.2.5",
61
59
  "react-dom": ">=19.2.5",
62
60
  "bowser": ">=2.11.0"