@better-auth-ui/heroui 1.6.0 → 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 -42
- package/dist/components/auth/passkey-button.d.ts +4 -0
- package/dist/components/auth/passkey-button.js +24 -0
- 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 -63
- 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.d.ts +8 -0
- package/dist/components/settings/security/passkey.js +43 -0
- package/dist/components/settings/security/passkeys.d.ts +6 -0
- package/dist/components/settings/security/passkeys.js +53 -0
- package/dist/components/settings/security/security-settings.d.ts +2 -2
- package/dist/components/settings/security/security-settings.js +24 -20
- 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 -33
- package/dist/index.js +36 -33
- package/dist/react-exports.d.ts +1 -1
- package/package.json +17 -10
- package/src/components/auth/auth.tsx +1 -1
- package/src/components/auth/magic-link.tsx +4 -0
- package/src/components/auth/passkey-button.tsx +36 -0
- package/src/components/auth/sign-in.tsx +67 -30
- package/src/components/auth/sign-up.tsx +97 -3
- package/src/components/settings/account/user-profile.tsx +121 -6
- package/src/components/settings/security/passkey.tsx +51 -0
- package/src/components/settings/security/passkeys.tsx +104 -0
- package/src/components/settings/security/security-settings.tsx +3 -1
- package/src/components/settings/settings.tsx +1 -1
- package/src/index.tsx +2 -0
- package/dist/components/account/account.d.ts +0 -18
- package/dist/components/account/account.js +0 -24
- package/dist/components/account/settings/account-settings.d.ts +0 -5
- package/dist/components/account/settings/account-settings.js +0 -6
- package/dist/components/account/settings/settings.d.ts +0 -5
- package/dist/components/account/settings/settings.js +0 -5
- package/dist/components/account/settings/user-profile.d.ts +0 -5
- package/dist/components/account/settings/user-profile.js +0 -20
- package/dist/components/settings/account/accounts.d.ts +0 -14
- package/dist/components/settings/account/accounts.js +0 -26
- package/dist/components/settings/account/theme-selector.d.ts +0 -16
- package/dist/components/settings/account/theme-selector.js +0 -33
- package/dist/components/settings/account/theme-settings.d.ts +0 -16
- package/dist/components/settings/account/theme-settings.js +0 -31
- package/dist/components/settings/account-settings.d.ts +0 -5
- package/dist/components/settings/account-settings.js +0 -6
- package/dist/components/settings/account.d.ts +0 -18
- package/dist/components/settings/account.js +0 -24
- package/dist/components/settings/security/connected-account.d.ts +0 -16
- package/dist/components/settings/security/connected-account.js +0 -46
- package/dist/components/settings/security/connected-accounts.d.ts +0 -15
- package/dist/components/settings/security/connected-accounts.js +0 -31
- package/dist/components/settings/security/sessions.d.ts +0 -14
- package/dist/components/settings/security/sessions.js +0 -40
- package/dist/components/settings/settings/account-settings.d.ts +0 -5
- package/dist/components/settings/settings/account-settings.js +0 -6
- package/dist/components/settings/settings/user-profile.d.ts +0 -5
- package/dist/components/settings/settings/user-profile.js +0 -20
- package/dist/components/settings/user-profile.d.ts +0 -5
- package/dist/components/settings/user-profile.js +0 -20
- package/dist/components/user/switch-account-popover.d.ts +0 -10
- package/dist/components/user/switch-account-popover.js +0 -25
- package/dist/components/user/switch-account-submenu.d.ts +0 -10
- package/dist/components/user/switch-account-submenu.js +0 -25
- package/dist/hooks/use-auth.d.ts +0 -2
- package/dist/hooks/use-auth.js +0 -8
- package/dist/hooks/use-redirect-to.d.ts +0 -8
- package/dist/hooks/use-redirect-to.js +0 -19
- package/dist/hooks/use-sign-in.d.ts +0 -8
- package/dist/hooks/use-sign-in.js +0 -53
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +0 -5
- package/dist/server.d.ts +0 -1
- package/dist/server.js +0 -1
- package/dist/src/components/auth/auth-provider.d.ts +0 -8
- package/dist/src/components/auth/auth-provider.js +0 -13
- package/dist/src/components/auth/auth.d.ts +0 -22
- package/dist/src/components/auth/auth.js +0 -42
- package/dist/src/components/auth/field-separator.d.ts +0 -4
- package/dist/src/components/auth/field-separator.js +0 -5
- package/dist/src/components/auth/forgot-password.d.ts +0 -15
- package/dist/src/components/auth/forgot-password.js +0 -29
- package/dist/src/components/auth/magic-link-button.d.ts +0 -13
- package/dist/src/components/auth/magic-link-button.js +0 -20
- package/dist/src/components/auth/magic-link.d.ts +0 -17
- package/dist/src/components/auth/magic-link.js +0 -37
- package/dist/src/components/auth/provider-buttons.d.ts +0 -19
- package/dist/src/components/auth/provider-buttons.js +0 -35
- package/dist/src/components/auth/reset-password.d.ts +0 -11
- package/dist/src/components/auth/reset-password.js +0 -59
- package/dist/src/components/auth/sign-in.d.ts +0 -14
- package/dist/src/components/auth/sign-in.js +0 -58
- package/dist/src/components/auth/sign-out.d.ts +0 -11
- package/dist/src/components/auth/sign-out.js +0 -34
- package/dist/src/components/auth/sign-up.d.ts +0 -19
- package/dist/src/components/auth/sign-up.js +0 -65
- package/dist/src/components/email/email-changed-email.d.ts +0 -3
- package/dist/src/components/email/email-changed-email.js +0 -23
- package/dist/src/components/email/email-verification-email.d.ts +0 -3
- package/dist/src/components/email/email-verification-email.js +0 -23
- package/dist/src/components/email/magic-link-email.d.ts +0 -3
- package/dist/src/components/email/magic-link-email.js +0 -23
- package/dist/src/components/email/new-device-email.d.ts +0 -3
- package/dist/src/components/email/new-device-email.js +0 -23
- package/dist/src/components/email/otp-email.d.ts +0 -3
- package/dist/src/components/email/otp-email.js +0 -22
- package/dist/src/components/email/password-changed-email.d.ts +0 -3
- package/dist/src/components/email/password-changed-email.js +0 -23
- package/dist/src/components/email/reset-password-email.d.ts +0 -3
- package/dist/src/components/email/reset-password-email.js +0 -23
- package/dist/src/components/settings/account/account-settings.d.ts +0 -13
- package/dist/src/components/settings/account/account-settings.js +0 -19
- package/dist/src/components/settings/account/appearance.d.ts +0 -16
- package/dist/src/components/settings/account/appearance.js +0 -28
- package/dist/src/components/settings/account/change-email.d.ts +0 -15
- package/dist/src/components/settings/account/change-email.js +0 -35
- package/dist/src/components/settings/account/manage-account.d.ts +0 -19
- package/dist/src/components/settings/account/manage-account.js +0 -27
- package/dist/src/components/settings/account/manage-accounts.d.ts +0 -14
- package/dist/src/components/settings/account/manage-accounts.js +0 -27
- package/dist/src/components/settings/account/user-profile.d.ts +0 -13
- package/dist/src/components/settings/account/user-profile.js +0 -29
- package/dist/src/components/settings/security/active-session.d.ts +0 -14
- package/dist/src/components/settings/security/active-session.js +0 -35
- package/dist/src/components/settings/security/active-sessions.d.ts +0 -14
- package/dist/src/components/settings/security/active-sessions.js +0 -29
- package/dist/src/components/settings/security/change-password.d.ts +0 -15
- package/dist/src/components/settings/security/change-password.js +0 -57
- package/dist/src/components/settings/security/linked-account.d.ts +0 -16
- package/dist/src/components/settings/security/linked-account.js +0 -46
- package/dist/src/components/settings/security/linked-accounts.d.ts +0 -15
- package/dist/src/components/settings/security/linked-accounts.js +0 -31
- package/dist/src/components/settings/security/security-settings.d.ts +0 -15
- package/dist/src/components/settings/security/security-settings.js +0 -18
- package/dist/src/components/settings/settings.d.ts +0 -29
- package/dist/src/components/settings/settings.js +0 -39
- package/dist/src/components/user/switch-account-item.d.ts +0 -16
- package/dist/src/components/user/switch-account-item.js +0 -14
- package/dist/src/components/user/switch-account-menu.d.ts +0 -10
- package/dist/src/components/user/switch-account-menu.js +0 -23
- package/dist/src/components/user/user-avatar.d.ts +0 -24
- package/dist/src/components/user/user-avatar.js +0 -31
- package/dist/src/components/user/user-button.d.ts +0 -21
- package/dist/src/components/user/user-button.js +0 -24
- package/dist/src/components/user/user-view.d.ts +0 -21
- package/dist/src/components/user/user-view.js +0 -24
- package/dist/src/core.d.ts +0 -1
- package/dist/src/core.js +0 -1
- package/dist/src/index.d.ts +0 -31
- package/dist/src/index.js +0 -32
- package/dist/src/lib/utils.d.ts +0 -2
- package/dist/src/lib/utils.js +0 -5
- package/dist/src/react-exports.d.ts +0 -1
- package/dist/src/react-exports.js +0 -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,33 +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
|
|
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,34 +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
|
-
|
|
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,11 +53,17 @@
|
|
|
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"
|
|
59
61
|
},
|
|
62
|
+
"repository": {
|
|
63
|
+
"type": "git",
|
|
64
|
+
"url": "https://github.com/better-auth-ui/better-auth-ui",
|
|
65
|
+
"directory": "packages/heroui"
|
|
66
|
+
},
|
|
60
67
|
"publishConfig": {
|
|
61
68
|
"access": "public"
|
|
62
69
|
}
|
|
@@ -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"
|
|
@@ -22,6 +22,7 @@ import { type SyntheticEvent, useState } from "react"
|
|
|
22
22
|
|
|
23
23
|
import { FieldSeparator } from "./field-separator"
|
|
24
24
|
import { MagicLinkButton } from "./magic-link-button"
|
|
25
|
+
import { PasskeyButton } from "./passkey-button"
|
|
25
26
|
import { ProviderButtons, type SocialLayout } from "./provider-buttons"
|
|
26
27
|
|
|
27
28
|
export type MagicLinkProps = {
|
|
@@ -50,6 +51,7 @@ export function MagicLink({
|
|
|
50
51
|
basePaths,
|
|
51
52
|
baseURL,
|
|
52
53
|
localization,
|
|
54
|
+
passkey,
|
|
53
55
|
redirectTo,
|
|
54
56
|
socialProviders,
|
|
55
57
|
viewPaths
|
|
@@ -145,6 +147,8 @@ export function MagicLink({
|
|
|
145
147
|
</Button>
|
|
146
148
|
|
|
147
149
|
<MagicLinkButton view="magicLink" isPending={isPending} />
|
|
150
|
+
|
|
151
|
+
{passkey && <PasskeyButton isPending={isPending} />}
|
|
148
152
|
</div>
|
|
149
153
|
</Form>
|
|
150
154
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useAuth, useSignInPasskey } from "@better-auth-ui/react"
|
|
2
|
+
import { Fingerprint } from "@gravity-ui/icons"
|
|
3
|
+
import { Button, Spinner, toast } from "@heroui/react"
|
|
4
|
+
|
|
5
|
+
export type PasskeyButtonProps = {
|
|
6
|
+
isPending: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function PasskeyButton({ isPending }: PasskeyButtonProps) {
|
|
10
|
+
const { localization, redirectTo, navigate } = useAuth()
|
|
11
|
+
|
|
12
|
+
const { mutate: signInPasskey, isPending: passkeyPending } = useSignInPasskey(
|
|
13
|
+
{
|
|
14
|
+
onError: (error) => toast.danger(error.error?.message || error.message),
|
|
15
|
+
onSuccess: () => navigate({ to: redirectTo })
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
const isDisabled = isPending || passkeyPending
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Button
|
|
23
|
+
className="w-full"
|
|
24
|
+
variant="tertiary"
|
|
25
|
+
isDisabled={isDisabled}
|
|
26
|
+
isPending={passkeyPending}
|
|
27
|
+
onPress={() => signInPasskey()}
|
|
28
|
+
>
|
|
29
|
+
{passkeyPending ? <Spinner color="current" size="sm" /> : <Fingerprint />}
|
|
30
|
+
{localization.auth.continueWith.replace(
|
|
31
|
+
"{{provider}}",
|
|
32
|
+
localization.auth.passkey
|
|
33
|
+
)}
|
|
34
|
+
</Button>
|
|
35
|
+
)
|
|
36
|
+
}
|