@better-auth-ui/heroui 1.6.1 → 1.6.3
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.
- package/dist/components/auth/auth-provider.d.ts +1 -1
- package/dist/components/auth/auth-provider.js +16 -11
- package/dist/components/auth/auth.d.ts +4 -4
- package/dist/components/auth/auth.js +36 -41
- package/dist/components/auth/error-toaster.d.ts +1 -0
- package/dist/components/auth/error-toaster.js +17 -0
- package/dist/components/auth/field-separator.d.ts +1 -1
- package/dist/components/auth/field-separator.js +17 -4
- package/dist/components/auth/forgot-password.d.ts +2 -2
- package/dist/components/auth/forgot-password.js +66 -27
- package/dist/components/auth/magic-link-button.d.ts +1 -1
- package/dist/components/auth/magic-link-button.js +15 -18
- package/dist/components/auth/magic-link.d.ts +3 -3
- package/dist/components/auth/magic-link.js +98 -43
- package/dist/components/auth/passkey-button.js +20 -12
- package/dist/components/auth/provider-button.d.ts +15 -0
- package/dist/components/auth/provider-button.js +29 -0
- package/dist/components/auth/provider-buttons.d.ts +4 -10
- package/dist/components/auth/provider-buttons.js +19 -33
- package/dist/components/auth/reset-password.d.ts +2 -2
- package/dist/components/auth/reset-password.js +143 -57
- package/dist/components/auth/sign-in.d.ts +3 -3
- package/dist/components/auth/sign-in.js +151 -64
- package/dist/components/auth/sign-out.js +26 -32
- package/dist/components/auth/sign-up.d.ts +3 -3
- package/dist/components/auth/sign-up.js +231 -70
- package/dist/components/email/email-changed-email.d.ts +2 -2
- package/dist/components/email/email-changed-email.js +29 -22
- package/dist/components/email/email-verification-email.d.ts +2 -2
- package/dist/components/email/email-verification-email.js +29 -22
- package/dist/components/email/magic-link-email.d.ts +2 -2
- package/dist/components/email/magic-link-email.js +29 -22
- package/dist/components/email/new-device-email.d.ts +2 -2
- package/dist/components/email/new-device-email.js +29 -22
- package/dist/components/email/otp-email.d.ts +2 -2
- package/dist/components/email/otp-email.js +28 -21
- package/dist/components/email/password-changed-email.d.ts +2 -2
- package/dist/components/email/password-changed-email.js +29 -22
- package/dist/components/email/reset-password-email.d.ts +2 -2
- package/dist/components/email/reset-password-email.js +29 -22
- package/dist/components/settings/account/account-settings.d.ts +2 -2
- package/dist/components/settings/account/account-settings.js +22 -19
- package/dist/components/settings/account/appearance.d.ts +2 -2
- package/dist/components/settings/account/appearance.js +70 -27
- package/dist/components/settings/account/change-avatar.js +88 -55
- package/dist/components/settings/account/change-email.d.ts +2 -2
- package/dist/components/settings/account/change-email.js +53 -28
- package/dist/components/settings/account/manage-account.d.ts +1 -1
- package/dist/components/settings/account/manage-account.js +47 -31
- package/dist/components/settings/account/manage-accounts.d.ts +2 -2
- package/dist/components/settings/account/manage-accounts.js +32 -36
- package/dist/components/settings/account/user-profile.d.ts +4 -4
- package/dist/components/settings/account/user-profile.js +102 -22
- package/dist/components/settings/security/active-session.d.ts +1 -1
- package/dist/components/settings/security/active-session.js +57 -51
- package/dist/components/settings/security/active-sessions.d.ts +2 -2
- package/dist/components/settings/security/active-sessions.js +32 -26
- package/dist/components/settings/security/change-password.d.ts +2 -2
- package/dist/components/settings/security/change-password.js +186 -76
- package/dist/components/settings/security/danger-zone.d.ts +2 -2
- package/dist/components/settings/security/danger-zone.js +17 -11
- package/dist/components/settings/security/delete-user.d.ts +2 -2
- package/dist/components/settings/security/delete-user.js +91 -46
- package/dist/components/settings/security/linked-account.d.ts +1 -1
- package/dist/components/settings/security/linked-account.js +55 -47
- package/dist/components/settings/security/linked-accounts.d.ts +2 -2
- package/dist/components/settings/security/linked-accounts.js +43 -40
- package/dist/components/settings/security/passkey.js +42 -13
- package/dist/components/settings/security/passkeys.d.ts +2 -2
- package/dist/components/settings/security/passkeys.js +51 -19
- package/dist/components/settings/security/security-settings.d.ts +2 -2
- package/dist/components/settings/security/security-settings.js +24 -21
- package/dist/components/settings/settings.d.ts +3 -3
- package/dist/components/settings/settings.js +44 -27
- package/dist/components/user/switch-account-item.d.ts +1 -1
- package/dist/components/user/switch-account-item.js +19 -15
- package/dist/components/user/switch-account-menu.js +27 -28
- package/dist/components/user/user-avatar.d.ts +3 -3
- package/dist/components/user/user-avatar.js +28 -30
- package/dist/components/user/user-button.d.ts +1 -1
- package/dist/components/user/user-button.js +90 -23
- package/dist/components/user/user-view.d.ts +3 -3
- package/dist/components/user/user-view.js +36 -23
- package/dist/core.d.ts +1 -1
- package/dist/index.d.ts +36 -35
- package/dist/index.js +37 -35
- package/dist/react-exports.d.ts +1 -1
- package/package.json +15 -11
- package/src/components/auth/auth-provider.tsx +4 -0
- package/src/components/auth/auth.tsx +2 -2
- package/src/components/auth/error-toaster.tsx +25 -0
- package/src/components/auth/forgot-password.tsx +1 -2
- package/src/components/auth/magic-link.tsx +3 -23
- package/src/components/auth/passkey-button.tsx +1 -2
- package/src/components/auth/provider-button.tsx +67 -0
- package/src/components/auth/provider-buttons.tsx +26 -43
- package/src/components/auth/reset-password.tsx +1 -2
- package/src/components/auth/sign-in.tsx +63 -48
- package/src/components/auth/sign-up.tsx +99 -20
- package/src/components/settings/account/appearance.tsx +1 -1
- package/src/components/settings/account/change-avatar.tsx +1 -3
- package/src/components/settings/account/change-email.tsx +2 -3
- package/src/components/settings/account/manage-account.tsx +1 -4
- package/src/components/settings/account/manage-accounts.tsx +3 -8
- package/src/components/settings/account/user-profile.tsx +122 -8
- package/src/components/settings/security/active-session.tsx +0 -1
- package/src/components/settings/security/active-sessions.tsx +3 -8
- package/src/components/settings/security/change-password.tsx +7 -4
- package/src/components/settings/security/delete-user.tsx +1 -4
- package/src/components/settings/security/linked-account.tsx +4 -14
- package/src/components/settings/security/linked-accounts.tsx +3 -8
- package/src/components/settings/security/passkey.tsx +2 -4
- package/src/components/settings/security/passkeys.tsx +4 -12
- package/src/components/settings/settings.tsx +1 -1
- package/src/components/user/switch-account-item.tsx +2 -4
- package/src/components/user/switch-account-menu.tsx +2 -7
- package/src/index.tsx +1 -0
|
@@ -1,24 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { UserAvatar as e } from "./user-avatar.js";
|
|
2
|
+
import { UserView as t } from "./user-view.js";
|
|
3
|
+
import { SwitchAccountMenu as n } from "./switch-account-menu.js";
|
|
4
|
+
import { useAuth as r, useSession as i } from "@better-auth-ui/react";
|
|
5
|
+
import { Button as a, Dropdown as o, Label as s, Separator as c, Tabs as l, cn as u } from "@heroui/react";
|
|
6
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
7
|
+
import { ArrowRightFromSquare as m, ArrowRightToSquare as h, ChevronsExpandVertical as g, Display as _, Gear as v, Moon as y, PersonPlus as b, Persons as x, Sun as S } from "@gravity-ui/icons";
|
|
8
|
+
//#region src/components/user/user-button.tsx
|
|
9
|
+
function C({ className: C, placement: w = "bottom", size: T = "default", variant: E = "ghost", themeToggle: D = !0 }) {
|
|
10
|
+
let { basePaths: O, viewPaths: k, localization: A, multiSession: j, appearance: { theme: M, setTheme: N, themes: P } } = r(), { data: F, isPending: I } = i();
|
|
11
|
+
return /* @__PURE__ */ p(o, { children: [T === "icon" ? /* @__PURE__ */ f(o.Trigger, {
|
|
12
|
+
className: u("rounded-full", C),
|
|
13
|
+
children: /* @__PURE__ */ f(e, {})
|
|
14
|
+
}) : /* @__PURE__ */ p(a, {
|
|
15
|
+
variant: E,
|
|
16
|
+
className: u("h-auto font-normal justify-start px-3 py-2 text-left", C),
|
|
17
|
+
children: [F || I ? /* @__PURE__ */ f(t, { isPending: I }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(e, {}), /* @__PURE__ */ f("p", {
|
|
18
|
+
className: "text-sm font-medium",
|
|
19
|
+
children: A.auth.account
|
|
20
|
+
})] }), /* @__PURE__ */ f(g, { className: "ml-auto size-3.5" })]
|
|
21
|
+
}), /* @__PURE__ */ p(o.Popover, {
|
|
22
|
+
placement: w,
|
|
23
|
+
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
24
|
+
children: [F && /* @__PURE__ */ f("div", {
|
|
25
|
+
className: "px-3 pt-3 pb-1",
|
|
26
|
+
children: /* @__PURE__ */ f(t, {})
|
|
27
|
+
}), /* @__PURE__ */ f(o.Menu, { children: F ? /* @__PURE__ */ p(d, { children: [
|
|
28
|
+
/* @__PURE__ */ p(o.Item, {
|
|
29
|
+
textValue: A.settings.settings,
|
|
30
|
+
href: `${O.settings}/${k.settings.account}`,
|
|
31
|
+
children: [/* @__PURE__ */ f(v, { className: "text-muted" }), /* @__PURE__ */ f(s, { children: A.settings.settings })]
|
|
32
|
+
}),
|
|
33
|
+
j && /* @__PURE__ */ p(o.SubmenuTrigger, { children: [/* @__PURE__ */ p(o.Item, {
|
|
34
|
+
textValue: A.auth.switchAccount,
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ f(x, { className: "text-muted" }),
|
|
37
|
+
/* @__PURE__ */ f(s, { children: A.auth.switchAccount }),
|
|
38
|
+
/* @__PURE__ */ f(o.SubmenuIndicator, {})
|
|
39
|
+
]
|
|
40
|
+
}), /* @__PURE__ */ f(o.Popover, {
|
|
41
|
+
className: "min-w-40 md:min-w-56 max-w-[48svw]",
|
|
42
|
+
children: /* @__PURE__ */ f(n, {})
|
|
43
|
+
})] }),
|
|
44
|
+
D && M && N && !!P?.length && /* @__PURE__ */ p(o.Item, {
|
|
45
|
+
className: "py-1 pe-2",
|
|
46
|
+
children: [/* @__PURE__ */ f(s, { children: A.settings.theme }), /* @__PURE__ */ f(l, {
|
|
47
|
+
className: "ml-auto",
|
|
48
|
+
selectedKey: M,
|
|
49
|
+
onSelectionChange: (e) => N(e),
|
|
50
|
+
children: /* @__PURE__ */ f(l.ListContainer, { children: /* @__PURE__ */ p(l.List, {
|
|
51
|
+
"aria-label": A.settings.theme,
|
|
52
|
+
className: "*:h-5 *:w-5 *:p-0",
|
|
53
|
+
children: [
|
|
54
|
+
P.includes("system") && /* @__PURE__ */ p(l.Tab, {
|
|
55
|
+
id: "system",
|
|
56
|
+
"aria-label": A.settings.system,
|
|
57
|
+
children: [/* @__PURE__ */ f(_, { className: "size-3" }), /* @__PURE__ */ f(l.Indicator, {})]
|
|
58
|
+
}),
|
|
59
|
+
P.includes("light") && /* @__PURE__ */ p(l.Tab, {
|
|
60
|
+
id: "light",
|
|
61
|
+
"aria-label": A.settings.light,
|
|
62
|
+
children: [/* @__PURE__ */ f(S, { className: "size-3" }), /* @__PURE__ */ f(l.Indicator, {})]
|
|
63
|
+
}),
|
|
64
|
+
P.includes("dark") && /* @__PURE__ */ p(l.Tab, {
|
|
65
|
+
id: "dark",
|
|
66
|
+
"aria-label": A.settings.dark,
|
|
67
|
+
children: [/* @__PURE__ */ f(y, { className: "size-3" }), /* @__PURE__ */ f(l.Indicator, {})]
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}) })
|
|
71
|
+
})]
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ f(c, {}),
|
|
74
|
+
/* @__PURE__ */ p(o.Item, {
|
|
75
|
+
textValue: A.auth.signOut,
|
|
76
|
+
href: `${O.auth}/${k.auth.signOut}`,
|
|
77
|
+
children: [/* @__PURE__ */ f(m, { className: "text-muted" }), /* @__PURE__ */ f(s, { children: A.auth.signOut })]
|
|
78
|
+
})
|
|
79
|
+
] }) : /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p(o.Item, {
|
|
80
|
+
textValue: A.auth.signIn,
|
|
81
|
+
href: `${O.auth}/${k.auth.signIn}`,
|
|
82
|
+
children: [/* @__PURE__ */ f(h, { className: "text-muted" }), /* @__PURE__ */ f(s, { children: A.auth.signIn })]
|
|
83
|
+
}), /* @__PURE__ */ p(o.Item, {
|
|
84
|
+
textValue: A.auth.signUp,
|
|
85
|
+
href: `${O.auth}/${k.auth.signUp}`,
|
|
86
|
+
children: [/* @__PURE__ */ f(b, { className: "text-muted" }), /* @__PURE__ */ f(s, { children: A.auth.signUp })]
|
|
87
|
+
})] }) })]
|
|
88
|
+
})] });
|
|
24
89
|
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { C as UserButton };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { AvatarProps } from '@heroui/react';
|
|
2
|
+
import { User } from 'better-auth';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
4
|
export type UserViewProps = {
|
|
5
5
|
className?: string;
|
|
6
6
|
isPending?: boolean;
|
|
@@ -1,24 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useSession } from "@better-auth-ui/react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import { UserAvatar as e } from "./user-avatar.js";
|
|
2
|
+
import { useSession as t } from "@better-auth-ui/react";
|
|
3
|
+
import { Skeleton as n, cn as r } from "@heroui/react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/user/user-view.tsx
|
|
6
|
+
function o({ className: o, isPending: s, size: c = "sm", user: l, ...u }) {
|
|
7
|
+
let { data: d, isPending: f } = t({ enabled: !l && !s }), p = l ?? d?.user;
|
|
8
|
+
return (s || f) && !l ? /* @__PURE__ */ a("div", {
|
|
9
|
+
className: r("flex items-center gap-2 min-w-0", o),
|
|
10
|
+
...u,
|
|
11
|
+
children: [/* @__PURE__ */ i(e, {
|
|
12
|
+
isPending: !0,
|
|
13
|
+
size: c
|
|
14
|
+
}), /* @__PURE__ */ a("div", {
|
|
15
|
+
className: "flex flex-col gap-1 min-w-0",
|
|
16
|
+
children: [/* @__PURE__ */ i(n, { className: "h-3.5 w-24 rounded-lg" }), /* @__PURE__ */ i(n, { className: "h-3 w-32 rounded-lg" })]
|
|
17
|
+
})]
|
|
18
|
+
}) : /* @__PURE__ */ a("div", {
|
|
19
|
+
className: r("flex items-center gap-2 min-w-0", o),
|
|
20
|
+
...u,
|
|
21
|
+
children: [/* @__PURE__ */ i(e, {
|
|
22
|
+
user: p,
|
|
23
|
+
size: c
|
|
24
|
+
}), /* @__PURE__ */ a("div", {
|
|
25
|
+
className: "min-w-0",
|
|
26
|
+
children: [/* @__PURE__ */ i("p", {
|
|
27
|
+
className: "text-sm font-medium truncate leading-tight",
|
|
28
|
+
children: p?.displayUsername || p?.name || p?.email
|
|
29
|
+
}), (p?.displayUsername || p?.name) && /* @__PURE__ */ i("p", {
|
|
30
|
+
className: "text-muted text-xs mb-0.5 truncate overflow-x-hidden",
|
|
31
|
+
children: p?.email
|
|
32
|
+
})]
|
|
33
|
+
})]
|
|
34
|
+
});
|
|
24
35
|
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { o as UserView };
|
package/dist/core.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from '@better-auth-ui/react/core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
export * from
|
|
24
|
-
export * from
|
|
25
|
-
export * from
|
|
26
|
-
export * from
|
|
27
|
-
export * from
|
|
28
|
-
export * from
|
|
29
|
-
export * from
|
|
30
|
-
export * from
|
|
31
|
-
export * from
|
|
32
|
-
export * from
|
|
33
|
-
export * from
|
|
34
|
-
export * from
|
|
35
|
-
export * from
|
|
1
|
+
export * from './components/auth/auth';
|
|
2
|
+
export * from './components/auth/auth-provider';
|
|
3
|
+
export * from './components/auth/forgot-password';
|
|
4
|
+
export * from './components/auth/magic-link';
|
|
5
|
+
export * from './components/auth/magic-link-button';
|
|
6
|
+
export * from './components/auth/passkey-button';
|
|
7
|
+
export * from './components/auth/provider-button';
|
|
8
|
+
export * from './components/auth/provider-buttons';
|
|
9
|
+
export * from './components/auth/reset-password';
|
|
10
|
+
export * from './components/auth/sign-in';
|
|
11
|
+
export * from './components/auth/sign-out';
|
|
12
|
+
export * from './components/auth/sign-up';
|
|
13
|
+
export * from './components/email/email-changed-email';
|
|
14
|
+
export * from './components/email/email-verification-email';
|
|
15
|
+
export * from './components/email/magic-link-email';
|
|
16
|
+
export * from './components/email/new-device-email';
|
|
17
|
+
export * from './components/email/otp-email';
|
|
18
|
+
export * from './components/email/password-changed-email';
|
|
19
|
+
export * from './components/email/reset-password-email';
|
|
20
|
+
export * from './components/settings/account/account-settings';
|
|
21
|
+
export * from './components/settings/account/appearance';
|
|
22
|
+
export * from './components/settings/account/change-email';
|
|
23
|
+
export * from './components/settings/account/manage-account';
|
|
24
|
+
export * from './components/settings/account/manage-accounts';
|
|
25
|
+
export * from './components/settings/account/user-profile';
|
|
26
|
+
export * from './components/settings/security/active-sessions';
|
|
27
|
+
export * from './components/settings/security/change-password';
|
|
28
|
+
export * from './components/settings/security/danger-zone';
|
|
29
|
+
export * from './components/settings/security/delete-user';
|
|
30
|
+
export * from './components/settings/security/linked-accounts';
|
|
31
|
+
export * from './components/settings/security/passkeys';
|
|
32
|
+
export * from './components/settings/security/security-settings';
|
|
33
|
+
export * from './components/settings/settings';
|
|
34
|
+
export * from './components/user/user-avatar';
|
|
35
|
+
export * from './components/user/user-button';
|
|
36
|
+
export * from './components/user/user-view';
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
import { ForgotPassword as e } from "./components/auth/forgot-password.js";
|
|
3
|
+
import { MagicLinkButton as t } from "./components/auth/magic-link-button.js";
|
|
4
|
+
import { PasskeyButton as n } from "./components/auth/passkey-button.js";
|
|
5
|
+
import { ProviderButton as r } from "./components/auth/provider-button.js";
|
|
6
|
+
import { ProviderButtons as i } from "./components/auth/provider-buttons.js";
|
|
7
|
+
import { MagicLink as a } from "./components/auth/magic-link.js";
|
|
8
|
+
import { ResetPassword as o } from "./components/auth/reset-password.js";
|
|
9
|
+
import { SignIn as s } from "./components/auth/sign-in.js";
|
|
10
|
+
import { SignOut as c } from "./components/auth/sign-out.js";
|
|
11
|
+
import { SignUp as l } from "./components/auth/sign-up.js";
|
|
12
|
+
import { Auth as u } from "./components/auth/auth.js";
|
|
13
|
+
import { AuthProvider as d } from "./components/auth/auth-provider.js";
|
|
14
|
+
import { EmailChangedEmail as f } from "./components/email/email-changed-email.js";
|
|
15
|
+
import { EmailVerificationEmail as p } from "./components/email/email-verification-email.js";
|
|
16
|
+
import { MagicLinkEmail as m } from "./components/email/magic-link-email.js";
|
|
17
|
+
import { NewDeviceEmail as h } from "./components/email/new-device-email.js";
|
|
18
|
+
import { OtpEmail as g } from "./components/email/otp-email.js";
|
|
19
|
+
import { PasswordChangedEmail as _ } from "./components/email/password-changed-email.js";
|
|
20
|
+
import { ResetPasswordEmail as v } from "./components/email/reset-password-email.js";
|
|
21
|
+
import { Appearance as y } from "./components/settings/account/appearance.js";
|
|
22
|
+
import { ChangeEmail as b } from "./components/settings/account/change-email.js";
|
|
23
|
+
import { UserAvatar as x } from "./components/user/user-avatar.js";
|
|
24
|
+
import { UserView as S } from "./components/user/user-view.js";
|
|
25
|
+
import { ManageAccount as C } from "./components/settings/account/manage-account.js";
|
|
26
|
+
import { ManageAccounts as w } from "./components/settings/account/manage-accounts.js";
|
|
27
|
+
import { UserProfile as T } from "./components/settings/account/user-profile.js";
|
|
28
|
+
import { AccountSettings as E } from "./components/settings/account/account-settings.js";
|
|
29
|
+
import { ActiveSessions as D } from "./components/settings/security/active-sessions.js";
|
|
30
|
+
import { ChangePassword as O } from "./components/settings/security/change-password.js";
|
|
31
|
+
import { DeleteUser as k } from "./components/settings/security/delete-user.js";
|
|
32
|
+
import { DangerZone as A } from "./components/settings/security/danger-zone.js";
|
|
33
|
+
import { LinkedAccounts as j } from "./components/settings/security/linked-accounts.js";
|
|
34
|
+
import { Passkeys as M } from "./components/settings/security/passkeys.js";
|
|
35
|
+
import { SecuritySettings as N } from "./components/settings/security/security-settings.js";
|
|
36
|
+
import { Settings as P } from "./components/settings/settings.js";
|
|
37
|
+
import { UserButton as F } from "./components/user/user-button.js";
|
|
38
|
+
export { E as AccountSettings, D as ActiveSessions, y as Appearance, u as Auth, d as AuthProvider, b as ChangeEmail, O as ChangePassword, A as DangerZone, k as DeleteUser, f as EmailChangedEmail, p as EmailVerificationEmail, e as ForgotPassword, j as LinkedAccounts, a as MagicLink, t as MagicLinkButton, m as MagicLinkEmail, C as ManageAccount, w as ManageAccounts, h as NewDeviceEmail, g as OtpEmail, n as PasskeyButton, M as Passkeys, _ as PasswordChangedEmail, r as ProviderButton, i as ProviderButtons, o as ResetPassword, v as ResetPasswordEmail, N as SecuritySettings, P as Settings, s as SignIn, c as SignOut, l as SignUp, x as UserAvatar, F as UserButton, T as UserProfile, S as UserView };
|
package/dist/react-exports.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from
|
|
1
|
+
export * from '@better-auth-ui/react';
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@better-auth-ui/heroui",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "
|
|
6
|
+
"build": "vite build && bun styles",
|
|
7
7
|
"dev": "bun styles && tsc --watch",
|
|
8
8
|
"styles": "cpy src/styles.css dist/ --flat",
|
|
9
9
|
"test": "vitest"
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
],
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
19
|
},
|
|
20
20
|
"./core": {
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"types": "./dist/core.d.ts",
|
|
22
|
+
"import": "./dist/core.js"
|
|
23
23
|
},
|
|
24
24
|
"./react": {
|
|
25
|
-
"
|
|
26
|
-
"
|
|
25
|
+
"types": "./dist/react-exports.d.ts",
|
|
26
|
+
"import": "./dist/react-exports.js"
|
|
27
27
|
},
|
|
28
28
|
"./styles": "./dist/styles.css"
|
|
29
29
|
},
|
|
@@ -31,17 +31,19 @@
|
|
|
31
31
|
"@gravity-ui/icons": "^2.18.0",
|
|
32
32
|
"@heroui/react": "^3.0.2",
|
|
33
33
|
"@heroui/styles": "^3.0.2",
|
|
34
|
+
"@tanstack/react-pacer": "^0.22.0",
|
|
35
|
+
"@tanstack/react-query": "^5.99.0",
|
|
34
36
|
"@testing-library/react": "^16.3.2",
|
|
35
37
|
"@testing-library/user-event": "^14.5.2",
|
|
36
38
|
"@types/react": "^19.2.14",
|
|
37
39
|
"@vitejs/plugin-react": "^6.0.1",
|
|
38
40
|
"@vitest/browser-playwright": "^4.1.4",
|
|
39
|
-
"better-auth": "^1.6.
|
|
41
|
+
"better-auth": "^1.6.5",
|
|
42
|
+
"bowser": "^2.11.0",
|
|
40
43
|
"cpy-cli": "^7.0.0",
|
|
41
44
|
"playwright": "^1.59.1",
|
|
42
45
|
"react": "^19.2.5",
|
|
43
46
|
"react-dom": "^19.2.5",
|
|
44
|
-
"bowser": "^2.11.0",
|
|
45
47
|
"vitest": "^4.1.4"
|
|
46
48
|
},
|
|
47
49
|
"dependencies": {
|
|
@@ -52,7 +54,9 @@
|
|
|
52
54
|
"@gravity-ui/icons": ">=2.18.0",
|
|
53
55
|
"@heroui/react": ">=3.0.2",
|
|
54
56
|
"@heroui/styles": ">=3.0.2",
|
|
55
|
-
"
|
|
57
|
+
"@tanstack/react-pacer": ">=0.22.0",
|
|
58
|
+
"@tanstack/react-query": ">=5.99.0",
|
|
59
|
+
"better-auth": ">=1.6.5",
|
|
56
60
|
"react": ">=19.2.5",
|
|
57
61
|
"react-dom": ">=19.2.5",
|
|
58
62
|
"bowser": ">=2.11.0"
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
} from "@better-auth-ui/react"
|
|
5
5
|
import { RouterProvider } from "@heroui/react"
|
|
6
6
|
|
|
7
|
+
import { ErrorToaster } from "./error-toaster"
|
|
8
|
+
|
|
7
9
|
export type AuthProviderProps = Omit<AuthProviderPropsPrimitive, "Link">
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -21,6 +23,8 @@ export function AuthProvider({
|
|
|
21
23
|
<AuthProviderPrimitive navigate={navigate} {...config}>
|
|
22
24
|
<RouterProvider navigate={(path) => navigate({ to: path })}>
|
|
23
25
|
{children}
|
|
26
|
+
|
|
27
|
+
<ErrorToaster />
|
|
24
28
|
</RouterProvider>
|
|
25
29
|
</AuthProviderPrimitive>
|
|
26
30
|
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { AuthView } from "@better-auth-ui/core"
|
|
1
2
|
import { useAuth } from "@better-auth-ui/react"
|
|
2
|
-
import type { AuthView } from "@better-auth-ui/react/core"
|
|
3
3
|
import type { CardProps } from "@heroui/react"
|
|
4
4
|
import { ForgotPassword } from "./forgot-password"
|
|
5
5
|
import { MagicLink } from "./magic-link"
|
|
@@ -35,7 +35,7 @@ export function Auth({
|
|
|
35
35
|
socialPosition,
|
|
36
36
|
view,
|
|
37
37
|
...props
|
|
38
|
-
}: AuthProps & CardProps) {
|
|
38
|
+
}: AuthProps & Omit<CardProps, "children">) {
|
|
39
39
|
const { viewPaths } = useAuth()
|
|
40
40
|
|
|
41
41
|
if (!view && !path) {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { toast } from "@heroui/react"
|
|
2
|
+
import { useQueryClient } from "@tanstack/react-query"
|
|
3
|
+
import type { BetterFetchError } from "better-auth/react"
|
|
4
|
+
import { useEffect } from "react"
|
|
5
|
+
|
|
6
|
+
export function ErrorToaster() {
|
|
7
|
+
const queryClient = useQueryClient()
|
|
8
|
+
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
queryClient.getQueryCache().config.onError = (error) => {
|
|
11
|
+
const err = error as BetterFetchError
|
|
12
|
+
if (err?.error) toast.danger(err.error.message)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
queryClient.setMutationDefaults([], {
|
|
16
|
+
onError: (error) => {
|
|
17
|
+
toast.danger(
|
|
18
|
+
(error as BetterFetchError)?.error?.message || error.message
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
}, [queryClient])
|
|
23
|
+
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
@@ -34,11 +34,10 @@ export function ForgotPassword({
|
|
|
34
34
|
className,
|
|
35
35
|
variant,
|
|
36
36
|
...props
|
|
37
|
-
}: ForgotPasswordProps & CardProps) {
|
|
37
|
+
}: ForgotPasswordProps & Omit<CardProps, "children">) {
|
|
38
38
|
const { basePaths, localization, viewPaths, navigate } = useAuth()
|
|
39
39
|
|
|
40
40
|
const { mutate: requestPasswordReset, isPending } = useRequestPasswordReset({
|
|
41
|
-
onError: (error) => toast.danger(error.error?.message || error.message),
|
|
42
41
|
onSuccess: () => {
|
|
43
42
|
toast.success(localization.auth.passwordResetEmailSent)
|
|
44
43
|
navigate({ to: `${basePaths.auth}/${viewPaths.auth.signIn}` })
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useAuth,
|
|
3
|
-
useSignInMagicLink,
|
|
4
|
-
useSignInSocial
|
|
5
|
-
} from "@better-auth-ui/react"
|
|
1
|
+
import { useAuth, useSignInMagicLink } from "@better-auth-ui/react"
|
|
6
2
|
import {
|
|
7
3
|
Button,
|
|
8
4
|
Card,
|
|
@@ -46,7 +42,7 @@ export function MagicLink({
|
|
|
46
42
|
socialPosition = "bottom",
|
|
47
43
|
variant,
|
|
48
44
|
...props
|
|
49
|
-
}: MagicLinkProps & CardProps) {
|
|
45
|
+
}: MagicLinkProps & Omit<CardProps, "children">) {
|
|
50
46
|
const {
|
|
51
47
|
basePaths,
|
|
52
48
|
baseURL,
|
|
@@ -61,27 +57,13 @@ export function MagicLink({
|
|
|
61
57
|
|
|
62
58
|
const { mutate: signInMagicLink, isPending: magicLinkPending } =
|
|
63
59
|
useSignInMagicLink({
|
|
64
|
-
onError: (error) => toast.danger(error.error?.message || error.message),
|
|
65
60
|
onSuccess: () => {
|
|
66
61
|
setEmail("")
|
|
67
62
|
toast.success(localization.auth.magicLinkSent)
|
|
68
63
|
}
|
|
69
64
|
})
|
|
70
65
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const { mutate: signInSocial, isPending: socialPending } = useSignInSocial({
|
|
74
|
-
onError: (error) => toast.danger(error.error?.message || error.message),
|
|
75
|
-
onSuccess: () => {
|
|
76
|
-
setSocialRedirecting(true)
|
|
77
|
-
|
|
78
|
-
setTimeout(() => {
|
|
79
|
-
setSocialRedirecting(false)
|
|
80
|
-
}, 5000)
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
const isPending = magicLinkPending || socialPending || socialRedirecting
|
|
66
|
+
const isPending = magicLinkPending
|
|
85
67
|
|
|
86
68
|
const handleSubmit = (e: SyntheticEvent<HTMLFormElement>) => {
|
|
87
69
|
e.preventDefault()
|
|
@@ -108,7 +90,6 @@ export function MagicLink({
|
|
|
108
90
|
{!!socialProviders?.length && (
|
|
109
91
|
<ProviderButtons
|
|
110
92
|
socialLayout={socialLayout}
|
|
111
|
-
signInSocial={signInSocial}
|
|
112
93
|
isPending={isPending}
|
|
113
94
|
/>
|
|
114
95
|
)}
|
|
@@ -161,7 +142,6 @@ export function MagicLink({
|
|
|
161
142
|
{!!socialProviders?.length && (
|
|
162
143
|
<ProviderButtons
|
|
163
144
|
socialLayout={socialLayout}
|
|
164
|
-
signInSocial={signInSocial}
|
|
165
145
|
isPending={isPending}
|
|
166
146
|
/>
|
|
167
147
|
)}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useAuth, useSignInPasskey } from "@better-auth-ui/react"
|
|
2
2
|
import { Fingerprint } from "@gravity-ui/icons"
|
|
3
|
-
import { Button, Spinner
|
|
3
|
+
import { Button, Spinner } from "@heroui/react"
|
|
4
4
|
|
|
5
5
|
export type PasskeyButtonProps = {
|
|
6
6
|
isPending: boolean
|
|
@@ -11,7 +11,6 @@ export function PasskeyButton({ isPending }: PasskeyButtonProps) {
|
|
|
11
11
|
|
|
12
12
|
const { mutate: signInPasskey, isPending: passkeyPending } = useSignInPasskey(
|
|
13
13
|
{
|
|
14
|
-
onError: (error) => toast.danger(error.error?.message || error.message),
|
|
15
14
|
onSuccess: () => navigate({ to: redirectTo })
|
|
16
15
|
}
|
|
17
16
|
)
|