@better-auth-ui/heroui 1.6.1 → 1.6.2
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 +15 -11
- package/dist/components/auth/auth.d.ts +3 -3
- package/dist/components/auth/auth.js +36 -41
- 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 +1 -1
- package/dist/components/auth/forgot-password.js +69 -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 +2 -2
- package/dist/components/auth/magic-link.js +110 -43
- package/dist/components/auth/passkey-button.js +23 -12
- package/dist/components/auth/provider-buttons.d.ts +1 -1
- package/dist/components/auth/provider-buttons.js +26 -33
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/reset-password.js +146 -57
- package/dist/components/auth/sign-in.d.ts +2 -2
- package/dist/components/auth/sign-in.js +163 -64
- package/dist/components/auth/sign-out.js +26 -32
- package/dist/components/auth/sign-up.d.ts +2 -2
- package/dist/components/auth/sign-up.js +240 -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 +1 -1
- 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 +1 -1
- package/dist/components/settings/account/change-email.js +56 -28
- package/dist/components/settings/account/manage-account.d.ts +1 -1
- package/dist/components/settings/account/manage-account.js +50 -31
- package/dist/components/settings/account/manage-accounts.d.ts +1 -1
- package/dist/components/settings/account/manage-accounts.js +32 -36
- package/dist/components/settings/account/user-profile.d.ts +3 -3
- package/dist/components/settings/account/user-profile.js +105 -22
- package/dist/components/settings/security/active-session.d.ts +1 -1
- package/dist/components/settings/security/active-session.js +60 -51
- package/dist/components/settings/security/active-sessions.d.ts +1 -1
- package/dist/components/settings/security/active-sessions.js +32 -26
- package/dist/components/settings/security/change-password.d.ts +1 -1
- package/dist/components/settings/security/change-password.js +189 -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 +1 -1
- package/dist/components/settings/security/delete-user.js +96 -46
- package/dist/components/settings/security/linked-account.d.ts +1 -1
- package/dist/components/settings/security/linked-account.js +61 -47
- package/dist/components/settings/security/linked-accounts.d.ts +1 -1
- 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 +1 -1
- 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 +35 -35
- package/dist/index.js +36 -35
- package/dist/react-exports.d.ts +1 -1
- package/package.json +12 -10
- package/src/components/auth/auth.tsx +1 -1
- package/src/components/auth/sign-in.tsx +63 -30
- package/src/components/auth/sign-up.tsx +97 -3
- package/src/components/settings/account/user-profile.tsx +121 -6
- package/src/components/settings/settings.tsx +1 -1
|
@@ -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,35 @@
|
|
|
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-buttons';
|
|
8
|
+
export * from './components/auth/reset-password';
|
|
9
|
+
export * from './components/auth/sign-in';
|
|
10
|
+
export * from './components/auth/sign-out';
|
|
11
|
+
export * from './components/auth/sign-up';
|
|
12
|
+
export * from './components/email/email-changed-email';
|
|
13
|
+
export * from './components/email/email-verification-email';
|
|
14
|
+
export * from './components/email/magic-link-email';
|
|
15
|
+
export * from './components/email/new-device-email';
|
|
16
|
+
export * from './components/email/otp-email';
|
|
17
|
+
export * from './components/email/password-changed-email';
|
|
18
|
+
export * from './components/email/reset-password-email';
|
|
19
|
+
export * from './components/settings/account/account-settings';
|
|
20
|
+
export * from './components/settings/account/appearance';
|
|
21
|
+
export * from './components/settings/account/change-email';
|
|
22
|
+
export * from './components/settings/account/manage-account';
|
|
23
|
+
export * from './components/settings/account/manage-accounts';
|
|
24
|
+
export * from './components/settings/account/user-profile';
|
|
25
|
+
export * from './components/settings/security/active-sessions';
|
|
26
|
+
export * from './components/settings/security/change-password';
|
|
27
|
+
export * from './components/settings/security/danger-zone';
|
|
28
|
+
export * from './components/settings/security/delete-user';
|
|
29
|
+
export * from './components/settings/security/linked-accounts';
|
|
30
|
+
export * from './components/settings/security/passkeys';
|
|
31
|
+
export * from './components/settings/security/security-settings';
|
|
32
|
+
export * from './components/settings/settings';
|
|
33
|
+
export * from './components/user/user-avatar';
|
|
34
|
+
export * from './components/user/user-button';
|
|
35
|
+
export * from './components/user/user-view';
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
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 { ProviderButtons as r } from "./components/auth/provider-buttons.js";
|
|
6
|
+
import { MagicLink as i } from "./components/auth/magic-link.js";
|
|
7
|
+
import { ResetPassword as a } from "./components/auth/reset-password.js";
|
|
8
|
+
import { SignIn as o } from "./components/auth/sign-in.js";
|
|
9
|
+
import { SignOut as s } from "./components/auth/sign-out.js";
|
|
10
|
+
import { SignUp as c } from "./components/auth/sign-up.js";
|
|
11
|
+
import { Auth as l } from "./components/auth/auth.js";
|
|
12
|
+
import { AuthProvider as u } from "./components/auth/auth-provider.js";
|
|
13
|
+
import { EmailChangedEmail as d } from "./components/email/email-changed-email.js";
|
|
14
|
+
import { EmailVerificationEmail as f } from "./components/email/email-verification-email.js";
|
|
15
|
+
import { MagicLinkEmail as p } from "./components/email/magic-link-email.js";
|
|
16
|
+
import { NewDeviceEmail as m } from "./components/email/new-device-email.js";
|
|
17
|
+
import { OtpEmail as h } from "./components/email/otp-email.js";
|
|
18
|
+
import { PasswordChangedEmail as g } from "./components/email/password-changed-email.js";
|
|
19
|
+
import { ResetPasswordEmail as _ } from "./components/email/reset-password-email.js";
|
|
20
|
+
import { Appearance as v } from "./components/settings/account/appearance.js";
|
|
21
|
+
import { ChangeEmail as y } from "./components/settings/account/change-email.js";
|
|
22
|
+
import { UserAvatar as b } from "./components/user/user-avatar.js";
|
|
23
|
+
import { UserView as x } from "./components/user/user-view.js";
|
|
24
|
+
import { ManageAccount as S } from "./components/settings/account/manage-account.js";
|
|
25
|
+
import { ManageAccounts as C } from "./components/settings/account/manage-accounts.js";
|
|
26
|
+
import { UserProfile as w } from "./components/settings/account/user-profile.js";
|
|
27
|
+
import { AccountSettings as T } from "./components/settings/account/account-settings.js";
|
|
28
|
+
import { ActiveSessions as E } from "./components/settings/security/active-sessions.js";
|
|
29
|
+
import { ChangePassword as D } from "./components/settings/security/change-password.js";
|
|
30
|
+
import { DeleteUser as O } from "./components/settings/security/delete-user.js";
|
|
31
|
+
import { DangerZone as k } from "./components/settings/security/danger-zone.js";
|
|
32
|
+
import { LinkedAccounts as A } from "./components/settings/security/linked-accounts.js";
|
|
33
|
+
import { Passkeys as j } from "./components/settings/security/passkeys.js";
|
|
34
|
+
import { SecuritySettings as M } from "./components/settings/security/security-settings.js";
|
|
35
|
+
import { Settings as N } from "./components/settings/settings.js";
|
|
36
|
+
import { UserButton as P } from "./components/user/user-button.js";
|
|
37
|
+
export { T as AccountSettings, E as ActiveSessions, v as Appearance, l as Auth, u as AuthProvider, y as ChangeEmail, D as ChangePassword, k as DangerZone, O as DeleteUser, d as EmailChangedEmail, f as EmailVerificationEmail, e as ForgotPassword, A as LinkedAccounts, i as MagicLink, t as MagicLinkButton, p as MagicLinkEmail, S as ManageAccount, C as ManageAccounts, m as NewDeviceEmail, h as OtpEmail, n as PasskeyButton, j as Passkeys, g as PasswordChangedEmail, r as ProviderButtons, a as ResetPassword, _ as ResetPasswordEmail, M as SecuritySettings, N as Settings, o as SignIn, s as SignOut, c as SignUp, b as UserAvatar, P as UserButton, w as UserProfile, x 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.2",
|
|
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,12 +31,13 @@
|
|
|
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.21.1",
|
|
34
35
|
"@testing-library/react": "^16.3.2",
|
|
35
36
|
"@testing-library/user-event": "^14.5.2",
|
|
36
37
|
"@types/react": "^19.2.14",
|
|
37
38
|
"@vitejs/plugin-react": "^6.0.1",
|
|
38
39
|
"@vitest/browser-playwright": "^4.1.4",
|
|
39
|
-
"better-auth": "^1.6.
|
|
40
|
+
"better-auth": "^1.6.5",
|
|
40
41
|
"cpy-cli": "^7.0.0",
|
|
41
42
|
"playwright": "^1.59.1",
|
|
42
43
|
"react": "^19.2.5",
|
|
@@ -52,7 +53,8 @@
|
|
|
52
53
|
"@gravity-ui/icons": ">=2.18.0",
|
|
53
54
|
"@heroui/react": ">=3.0.2",
|
|
54
55
|
"@heroui/styles": ">=3.0.2",
|
|
55
|
-
"
|
|
56
|
+
"@tanstack/react-pacer": ">=0.21.0",
|
|
57
|
+
"better-auth": ">=1.6.5",
|
|
56
58
|
"react": ">=19.2.5",
|
|
57
59
|
"react-dom": ">=19.2.5",
|
|
58
60
|
"bowser": ">=2.11.0"
|
|
@@ -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"
|
|
@@ -2,7 +2,8 @@ import {
|
|
|
2
2
|
useAuth,
|
|
3
3
|
useSendVerificationEmail,
|
|
4
4
|
useSignInEmail,
|
|
5
|
-
useSignInSocial
|
|
5
|
+
useSignInSocial,
|
|
6
|
+
useSignInUsername
|
|
6
7
|
} from "@better-auth-ui/react"
|
|
7
8
|
import {
|
|
8
9
|
Button,
|
|
@@ -34,6 +35,10 @@ export interface SignInProps {
|
|
|
34
35
|
variant?: CardProps["variant"]
|
|
35
36
|
}
|
|
36
37
|
|
|
38
|
+
function isEmail(value: string): boolean {
|
|
39
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value)
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
/**
|
|
38
43
|
* Render the sign-in UI using auth context for configuration and localization.
|
|
39
44
|
*
|
|
@@ -55,6 +60,7 @@ export function SignIn({
|
|
|
55
60
|
passkey,
|
|
56
61
|
redirectTo,
|
|
57
62
|
socialProviders,
|
|
63
|
+
username: usernameConfig,
|
|
58
64
|
viewPaths,
|
|
59
65
|
navigate
|
|
60
66
|
} = useAuth()
|
|
@@ -66,27 +72,38 @@ export function SignIn({
|
|
|
66
72
|
onSuccess: () => toast.success(localization.auth.verificationEmailSent)
|
|
67
73
|
})
|
|
68
74
|
|
|
69
|
-
const { mutate: signInEmail, isPending:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
const { mutate: signInEmail, isPending: signInEmailPending } = useSignInEmail(
|
|
76
|
+
{
|
|
77
|
+
onError: (error, { email }) => {
|
|
78
|
+
setPassword("")
|
|
79
|
+
|
|
80
|
+
if (error.error?.code === "EMAIL_NOT_VERIFIED") {
|
|
81
|
+
toast.danger(error.error?.message || error.message, {
|
|
82
|
+
actionProps: {
|
|
83
|
+
children: localization.auth.resend,
|
|
84
|
+
onClick: () =>
|
|
85
|
+
sendVerificationEmail({
|
|
86
|
+
email,
|
|
87
|
+
callbackURL: `${baseURL}${redirectTo}`
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
} else {
|
|
92
|
+
toast.danger(error.error?.message || error.message)
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
onSuccess: () => navigate({ to: redirectTo })
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
const { mutate: signInUsername, isPending: signInUsernamePending } =
|
|
100
|
+
useSignInUsername({
|
|
101
|
+
onError: (error) => {
|
|
102
|
+
setPassword("")
|
|
85
103
|
toast.danger(error.error?.message || error.message)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})
|
|
104
|
+
},
|
|
105
|
+
onSuccess: () => navigate({ to: redirectTo })
|
|
106
|
+
})
|
|
90
107
|
|
|
91
108
|
const [socialRedirecting, setSocialRedirecting] = useState(false)
|
|
92
109
|
|
|
@@ -108,13 +125,21 @@ export function SignIn({
|
|
|
108
125
|
const email = formData.get("email") as string
|
|
109
126
|
const rememberMe = formData.get("rememberMe") === "on"
|
|
110
127
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
if (usernameConfig?.enabled && !isEmail(email)) {
|
|
129
|
+
signInUsername({
|
|
130
|
+
username: email,
|
|
131
|
+
password
|
|
132
|
+
})
|
|
133
|
+
} else {
|
|
134
|
+
signInEmail({
|
|
135
|
+
email,
|
|
136
|
+
password,
|
|
137
|
+
...(emailAndPassword?.rememberMe ? { rememberMe } : {})
|
|
138
|
+
})
|
|
139
|
+
}
|
|
116
140
|
}
|
|
117
141
|
|
|
142
|
+
const signInPending = signInEmailPending || signInUsernamePending
|
|
118
143
|
const isPending = signInPending || socialPending || socialRedirecting
|
|
119
144
|
|
|
120
145
|
const showSeparator = emailAndPassword?.enabled && !!socialProviders?.length
|
|
@@ -152,14 +177,22 @@ export function SignIn({
|
|
|
152
177
|
<Form onSubmit={handleSubmit} className="flex flex-col gap-4">
|
|
153
178
|
<TextField
|
|
154
179
|
name="email"
|
|
155
|
-
type="email"
|
|
156
|
-
autoComplete="email"
|
|
180
|
+
type={usernameConfig?.enabled ? "text" : "email"}
|
|
181
|
+
autoComplete={usernameConfig?.enabled ? "username" : "email"}
|
|
157
182
|
isDisabled={isPending}
|
|
158
183
|
>
|
|
159
|
-
<Label>
|
|
184
|
+
<Label>
|
|
185
|
+
{usernameConfig?.enabled
|
|
186
|
+
? localization.auth.username
|
|
187
|
+
: localization.auth.email}
|
|
188
|
+
</Label>
|
|
160
189
|
|
|
161
190
|
<Input
|
|
162
|
-
placeholder={
|
|
191
|
+
placeholder={
|
|
192
|
+
usernameConfig?.enabled
|
|
193
|
+
? localization.auth.usernameOrEmailPlaceholder
|
|
194
|
+
: localization.auth.emailPlaceholder
|
|
195
|
+
}
|
|
163
196
|
variant={variant === "transparent" ? "primary" : "secondary"}
|
|
164
197
|
required
|
|
165
198
|
/>
|