@better-auth-ui/heroui 1.6.2 → 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.js +12 -11
- package/dist/components/auth/auth.d.ts +1 -1
- package/dist/components/auth/error-toaster.d.ts +1 -0
- package/dist/components/auth/error-toaster.js +17 -0
- package/dist/components/auth/forgot-password.d.ts +1 -1
- package/dist/components/auth/forgot-password.js +3 -6
- package/dist/components/auth/magic-link.d.ts +1 -1
- package/dist/components/auth/magic-link.js +52 -64
- package/dist/components/auth/passkey-button.js +12 -15
- 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 +16 -23
- package/dist/components/auth/reset-password.d.ts +1 -1
- package/dist/components/auth/reset-password.js +3 -6
- package/dist/components/auth/sign-in.d.ts +1 -1
- package/dist/components/auth/sign-in.js +81 -93
- package/dist/components/auth/sign-up.d.ts +1 -1
- package/dist/components/auth/sign-up.js +99 -108
- package/dist/components/settings/account/appearance.d.ts +1 -1
- package/dist/components/settings/account/change-avatar.js +1 -1
- package/dist/components/settings/account/change-email.d.ts +1 -1
- package/dist/components/settings/account/change-email.js +1 -4
- package/dist/components/settings/account/manage-account.js +1 -4
- package/dist/components/settings/account/manage-accounts.d.ts +1 -1
- package/dist/components/settings/account/manage-accounts.js +16 -16
- package/dist/components/settings/account/user-profile.d.ts +1 -1
- package/dist/components/settings/account/user-profile.js +1 -4
- package/dist/components/settings/security/active-session.js +1 -4
- package/dist/components/settings/security/active-sessions.d.ts +1 -1
- package/dist/components/settings/security/active-sessions.js +17 -17
- package/dist/components/settings/security/change-password.d.ts +1 -1
- package/dist/components/settings/security/change-password.js +1 -4
- package/dist/components/settings/security/delete-user.d.ts +1 -1
- package/dist/components/settings/security/delete-user.js +6 -11
- package/dist/components/settings/security/linked-account.js +1 -7
- package/dist/components/settings/security/linked-accounts.d.ts +1 -1
- package/dist/components/settings/security/linked-accounts.js +18 -18
- package/dist/components/settings/security/passkey.js +19 -19
- package/dist/components/settings/security/passkeys.d.ts +1 -1
- package/dist/components/settings/security/passkeys.js +28 -28
- package/dist/components/user/switch-account-item.js +9 -9
- package/dist/components/user/switch-account-menu.js +16 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -33
- package/package.json +6 -4
- package/src/components/auth/auth-provider.tsx +4 -0
- package/src/components/auth/auth.tsx +1 -1
- 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 +2 -20
- package/src/components/auth/sign-up.tsx +5 -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 +1 -2
- 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/user/switch-account-item.tsx +2 -4
- package/src/components/user/switch-account-menu.tsx +2 -7
- package/src/index.tsx +1 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { ErrorToaster as e } from "./error-toaster.js";
|
|
2
|
+
import { AuthProvider as t } from "@better-auth-ui/react";
|
|
3
|
+
import { RouterProvider as n } from "@heroui/react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
5
|
//#region src/components/auth/auth-provider.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
navigate:
|
|
8
|
-
...
|
|
9
|
-
children: /* @__PURE__ */ n
|
|
10
|
-
navigate: (e) =>
|
|
11
|
-
children: r
|
|
6
|
+
function a({ children: a, navigate: o, ...s }) {
|
|
7
|
+
return /* @__PURE__ */ r(t, {
|
|
8
|
+
navigate: o,
|
|
9
|
+
...s,
|
|
10
|
+
children: /* @__PURE__ */ i(n, {
|
|
11
|
+
navigate: (e) => o({ to: e }),
|
|
12
|
+
children: [a, /* @__PURE__ */ r(e, {})]
|
|
12
13
|
})
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
16
|
//#endregion
|
|
16
|
-
export {
|
|
17
|
+
export { a as AuthProvider };
|
|
@@ -20,4 +20,4 @@ export type AuthProps = {
|
|
|
20
20
|
* @param view - Explicit auth view to render (e.g., "signIn", "signUp")
|
|
21
21
|
* @returns The React element for the resolved authentication view
|
|
22
22
|
*/
|
|
23
|
-
export declare function Auth({ path, socialLayout, socialPosition, view, ...props }: AuthProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare function Auth({ path, socialLayout, socialPosition, view, ...props }: AuthProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ErrorToaster(): null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { toast as e } from "@heroui/react";
|
|
2
|
+
import { useEffect as t } from "react";
|
|
3
|
+
import { useQueryClient as n } from "@tanstack/react-query";
|
|
4
|
+
//#region src/components/auth/error-toaster.tsx
|
|
5
|
+
function r() {
|
|
6
|
+
let r = n();
|
|
7
|
+
return t(() => {
|
|
8
|
+
r.getQueryCache().config.onError = (t) => {
|
|
9
|
+
let n = t;
|
|
10
|
+
n?.error && e.danger(n.error.message);
|
|
11
|
+
}, r.setMutationDefaults([], { onError: (t) => {
|
|
12
|
+
e.danger(t?.error?.message || t.message);
|
|
13
|
+
} });
|
|
14
|
+
}, [r]), null;
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as ErrorToaster };
|
|
@@ -12,4 +12,4 @@ export type ForgotPasswordProps = {
|
|
|
12
12
|
* @param className - Optional additional CSS class names applied to the card
|
|
13
13
|
* @returns The forgot-password form UI as a JSX element
|
|
14
14
|
*/
|
|
15
|
-
export declare function ForgotPassword({ className, variant, ...props }: ForgotPasswordProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ForgotPassword({ className, variant, ...props }: ForgotPasswordProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,12 +3,9 @@ import { Button as n, Card as r, Description as i, FieldError as a, Form as o, I
|
|
|
3
3
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/auth/forgot-password.tsx
|
|
5
5
|
function g({ className: g, variant: _, ...v }) {
|
|
6
|
-
let { basePaths: y, localization: b, viewPaths: x, navigate: S } = e(), { mutate: C, isPending: w } = t({
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
p.success(b.auth.passwordResetEmailSent), S({ to: `${y.auth}/${x.auth.signIn}` });
|
|
10
|
-
}
|
|
11
|
-
});
|
|
6
|
+
let { basePaths: y, localization: b, viewPaths: x, navigate: S } = e(), { mutate: C, isPending: w } = t({ onSuccess: () => {
|
|
7
|
+
p.success(b.auth.passwordResetEmailSent), S({ to: `${y.auth}/${x.auth.signIn}` });
|
|
8
|
+
} });
|
|
12
9
|
function T(e) {
|
|
13
10
|
e.preventDefault(), C({ email: new FormData(e.currentTarget).get("email") });
|
|
14
11
|
}
|
|
@@ -14,4 +14,4 @@ export type MagicLinkProps = {
|
|
|
14
14
|
* @param socialPosition - Position of social provider buttons; `"top"` or `"bottom"`. Defaults to `"bottom"`.
|
|
15
15
|
* @returns The magic-link sign-in UI as a JSX element
|
|
16
16
|
*/
|
|
17
|
-
export declare function MagicLink({ className, socialLayout, socialPosition, variant, ...props }: MagicLinkProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function MagicLink({ className, socialLayout, socialPosition, variant, ...props }: MagicLinkProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,104 +2,92 @@ import { FieldSeparator as e } from "./field-separator.js";
|
|
|
2
2
|
import { MagicLinkButton as t } from "./magic-link-button.js";
|
|
3
3
|
import { PasskeyButton as n } from "./passkey-button.js";
|
|
4
4
|
import { ProviderButtons as r } from "./provider-buttons.js";
|
|
5
|
-
import { useAuth as i, useSignInMagicLink as a
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useState as
|
|
5
|
+
import { useAuth as i, useSignInMagicLink as a } from "@better-auth-ui/react";
|
|
6
|
+
import { Button as o, Card as s, Description as c, FieldError as l, Form as u, Input as d, Label as f, Link as p, Spinner as m, TextField as h, cn as g, toast as _ } from "@heroui/react";
|
|
7
|
+
import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
8
|
+
import { useState as x } from "react";
|
|
9
9
|
//#region src/components/auth/magic-link.tsx
|
|
10
|
-
function
|
|
11
|
-
let { basePaths:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onError: (e) => v.danger(e.error?.message || e.message),
|
|
18
|
-
onSuccess: () => {
|
|
19
|
-
B(!0), setTimeout(() => {
|
|
20
|
-
B(!1);
|
|
21
|
-
}, 5e3);
|
|
22
|
-
}
|
|
23
|
-
}), U = R || H || z, W = (e) => {
|
|
24
|
-
e.preventDefault(), L({
|
|
25
|
-
email: F,
|
|
26
|
-
callbackURL: `${k}${M}`
|
|
10
|
+
function S({ className: S, socialLayout: C, socialPosition: w = "bottom", variant: T, ...E }) {
|
|
11
|
+
let { basePaths: D, baseURL: O, localization: k, passkey: A, redirectTo: j, socialProviders: M, viewPaths: N } = i(), [P, F] = x(""), { mutate: I, isPending: L } = a({ onSuccess: () => {
|
|
12
|
+
F(""), _.success(k.auth.magicLinkSent);
|
|
13
|
+
} }), R = L, z = (e) => {
|
|
14
|
+
e.preventDefault(), I({
|
|
15
|
+
email: P,
|
|
16
|
+
callbackURL: `${O}${j}`
|
|
27
17
|
});
|
|
28
|
-
},
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
className:
|
|
31
|
-
variant:
|
|
32
|
-
...
|
|
18
|
+
}, B = !!M?.length;
|
|
19
|
+
return /* @__PURE__ */ b(s, {
|
|
20
|
+
className: g("w-full max-w-sm p-4 md:p-6", S),
|
|
21
|
+
variant: T,
|
|
22
|
+
...E,
|
|
33
23
|
children: [
|
|
34
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ y(s.Header, { children: /* @__PURE__ */ y(s.Title, {
|
|
35
25
|
className: "text-xl font-semibold mb-1",
|
|
36
|
-
children:
|
|
26
|
+
children: k.auth.signIn
|
|
37
27
|
}) }),
|
|
38
|
-
/* @__PURE__ */
|
|
28
|
+
/* @__PURE__ */ b(s.Content, {
|
|
39
29
|
className: "gap-4",
|
|
40
30
|
children: [
|
|
41
|
-
|
|
42
|
-
socialLayout:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onSubmit: W,
|
|
31
|
+
w === "top" && /* @__PURE__ */ b(v, { children: [!!M?.length && /* @__PURE__ */ y(r, {
|
|
32
|
+
socialLayout: C,
|
|
33
|
+
isPending: R
|
|
34
|
+
}), B && /* @__PURE__ */ y(e, { children: k.auth.or })] }),
|
|
35
|
+
/* @__PURE__ */ b(u, {
|
|
36
|
+
onSubmit: z,
|
|
48
37
|
className: "flex flex-col gap-4",
|
|
49
|
-
children: [/* @__PURE__ */
|
|
38
|
+
children: [/* @__PURE__ */ b(h, {
|
|
50
39
|
name: "email",
|
|
51
40
|
type: "email",
|
|
52
41
|
autoComplete: "email",
|
|
53
|
-
isDisabled:
|
|
54
|
-
value:
|
|
55
|
-
onChange:
|
|
42
|
+
isDisabled: R,
|
|
43
|
+
value: P,
|
|
44
|
+
onChange: F,
|
|
56
45
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
placeholder:
|
|
46
|
+
/* @__PURE__ */ y(f, { children: k.auth.email }),
|
|
47
|
+
/* @__PURE__ */ y(d, {
|
|
48
|
+
placeholder: k.auth.emailPlaceholder,
|
|
60
49
|
required: !0,
|
|
61
|
-
variant:
|
|
50
|
+
variant: T === "transparent" ? "primary" : "secondary"
|
|
62
51
|
}),
|
|
63
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ y(l, {})
|
|
64
53
|
]
|
|
65
|
-
}), /* @__PURE__ */
|
|
54
|
+
}), /* @__PURE__ */ b("div", {
|
|
66
55
|
className: "flex flex-col gap-3",
|
|
67
56
|
children: [
|
|
68
|
-
/* @__PURE__ */
|
|
57
|
+
/* @__PURE__ */ b(o, {
|
|
69
58
|
type: "submit",
|
|
70
59
|
className: "w-full",
|
|
71
|
-
isPending:
|
|
72
|
-
children: [
|
|
60
|
+
isPending: R,
|
|
61
|
+
children: [R && /* @__PURE__ */ y(m, {
|
|
73
62
|
color: "current",
|
|
74
63
|
size: "sm"
|
|
75
|
-
}),
|
|
64
|
+
}), k.auth.sendMagicLink]
|
|
76
65
|
}),
|
|
77
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ y(t, {
|
|
78
67
|
view: "magicLink",
|
|
79
|
-
isPending:
|
|
68
|
+
isPending: R
|
|
80
69
|
}),
|
|
81
|
-
|
|
70
|
+
A && /* @__PURE__ */ y(n, { isPending: R })
|
|
82
71
|
]
|
|
83
72
|
})]
|
|
84
73
|
}),
|
|
85
|
-
|
|
86
|
-
socialLayout:
|
|
87
|
-
|
|
88
|
-
isPending: U
|
|
74
|
+
w === "bottom" && /* @__PURE__ */ b(v, { children: [B && /* @__PURE__ */ y(e, { children: k.auth.or }), !!M?.length && /* @__PURE__ */ y(r, {
|
|
75
|
+
socialLayout: C,
|
|
76
|
+
isPending: R
|
|
89
77
|
})] })
|
|
90
78
|
]
|
|
91
79
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ y(s.Footer, {
|
|
93
81
|
className: "flex-col",
|
|
94
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ b(c, {
|
|
95
83
|
className: "text-sm",
|
|
96
84
|
children: [
|
|
97
|
-
|
|
85
|
+
k.auth.needToCreateAnAccount,
|
|
98
86
|
" ",
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
href: `${
|
|
87
|
+
/* @__PURE__ */ y(p, {
|
|
88
|
+
href: `${D.auth}/${N.auth.signUp}`,
|
|
101
89
|
className: "text-accent decoration-accent no-underline hover:underline",
|
|
102
|
-
children:
|
|
90
|
+
children: k.auth.signUp
|
|
103
91
|
})
|
|
104
92
|
]
|
|
105
93
|
})
|
|
@@ -108,4 +96,4 @@ function C({ className: C, socialLayout: w, socialPosition: T = "bottom", varian
|
|
|
108
96
|
});
|
|
109
97
|
}
|
|
110
98
|
//#endregion
|
|
111
|
-
export {
|
|
99
|
+
export { S as MagicLink };
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
import { useAuth as e, useSignInPasskey as t } from "@better-auth-ui/react";
|
|
2
|
-
import { Button as n, Spinner as r
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { Fingerprint as
|
|
2
|
+
import { Button as n, Spinner as r } from "@heroui/react";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import { Fingerprint as o } from "@gravity-ui/icons";
|
|
5
5
|
//#region src/components/auth/passkey-button.tsx
|
|
6
|
-
function
|
|
7
|
-
let { localization:
|
|
8
|
-
|
|
9
|
-
onSuccess: () => d({ to: u })
|
|
10
|
-
});
|
|
11
|
-
return /* @__PURE__ */ o(n, {
|
|
6
|
+
function s({ isPending: s }) {
|
|
7
|
+
let { localization: c, redirectTo: l, navigate: u } = e(), { mutate: d, isPending: f } = t({ onSuccess: () => u({ to: l }) });
|
|
8
|
+
return /* @__PURE__ */ a(n, {
|
|
12
9
|
className: "w-full",
|
|
13
10
|
variant: "tertiary",
|
|
14
|
-
isDisabled:
|
|
15
|
-
isPending:
|
|
16
|
-
onPress: () =>
|
|
17
|
-
children: [
|
|
11
|
+
isDisabled: s || f,
|
|
12
|
+
isPending: f,
|
|
13
|
+
onPress: () => d(),
|
|
14
|
+
children: [f ? /* @__PURE__ */ i(r, {
|
|
18
15
|
color: "current",
|
|
19
16
|
size: "sm"
|
|
20
|
-
}) : /* @__PURE__ */
|
|
17
|
+
}) : /* @__PURE__ */ i(o, {}), c.auth.continueWith.replace("{{provider}}", c.auth.passkey)]
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
20
|
//#endregion
|
|
24
|
-
export {
|
|
21
|
+
export { s as PasskeyButton };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ButtonProps } from '@heroui/react';
|
|
2
|
+
import { SocialProvider } from 'better-auth/social-providers';
|
|
3
|
+
export type ProviderButtonProps = {
|
|
4
|
+
provider: SocialProvider;
|
|
5
|
+
label?: "continueWith" | "providerName" | "none";
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
} & Omit<ButtonProps, "children" | "onPress" | "isPending">;
|
|
8
|
+
/**
|
|
9
|
+
* Render a single social provider sign-in button with its own mutation and pending state.
|
|
10
|
+
*
|
|
11
|
+
* @param provider - The social provider this button signs in with.
|
|
12
|
+
* @param label - Label style: `"continueWith"` (e.g. "Continue with Google"), `"providerName"` (e.g. "Google"), or `"none"` (icon only).
|
|
13
|
+
* @param isDisabled - External disabled state (e.g. a sibling provider is mid-redirect).
|
|
14
|
+
*/
|
|
15
|
+
export declare function ProviderButton({ provider, label, isDisabled, variant, ...props }: ProviderButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { providerIcons as e, useAuth as t, useSignInSocial as n } from "@better-auth-ui/react";
|
|
2
|
+
import { Button as r, Spinner as i } from "@heroui/react";
|
|
3
|
+
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
|
+
import { useState as s } from "react";
|
|
5
|
+
import { getProviderName as c } from "@better-auth-ui/core";
|
|
6
|
+
//#region src/components/auth/provider-button.tsx
|
|
7
|
+
function l({ provider: l, label: u = "continueWith", isDisabled: d, variant: f = "tertiary", ...p }) {
|
|
8
|
+
let { baseURL: m, localization: h, redirectTo: g } = t(), _ = `${m}${g}`, [v, y] = s(!1), { mutate: b, isPending: x } = n({ onSuccess: () => {
|
|
9
|
+
y(!0), setTimeout(() => {
|
|
10
|
+
y(!1);
|
|
11
|
+
}, 5e3);
|
|
12
|
+
} }), S = e[l], C = x || v;
|
|
13
|
+
return /* @__PURE__ */ o(r, {
|
|
14
|
+
variant: f,
|
|
15
|
+
isDisabled: d,
|
|
16
|
+
isPending: C,
|
|
17
|
+
onPress: () => b({
|
|
18
|
+
provider: l,
|
|
19
|
+
callbackURL: _
|
|
20
|
+
}),
|
|
21
|
+
...p,
|
|
22
|
+
children: [C ? /* @__PURE__ */ a(i, {
|
|
23
|
+
color: "current",
|
|
24
|
+
size: "sm"
|
|
25
|
+
}) : /* @__PURE__ */ a(S, {}), u === "continueWith" ? h.auth.continueWith.replace("{{provider}}", c(l)) : u === "providerName" ? c(l) : null]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { l as ProviderButton };
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import { SocialProvider } from 'better-auth/social-providers';
|
|
2
1
|
export type ProviderButtonsProps = {
|
|
3
|
-
isPending
|
|
2
|
+
isPending?: boolean;
|
|
4
3
|
socialLayout?: SocialLayout;
|
|
5
|
-
signInSocial: (params: {
|
|
6
|
-
provider: SocialProvider;
|
|
7
|
-
callbackURL: string;
|
|
8
|
-
}) => void;
|
|
9
4
|
};
|
|
10
5
|
export type SocialLayout = "auto" | "horizontal" | "vertical" | "grid";
|
|
11
6
|
/**
|
|
12
|
-
* Render social provider sign-in buttons
|
|
7
|
+
* Render social provider sign-in buttons. Each button owns its own sign-in mutation.
|
|
13
8
|
*
|
|
14
|
-
* @param isPending -
|
|
9
|
+
* @param isPending - External pending state (e.g. parent form submitting) that disables all buttons.
|
|
15
10
|
* @param socialLayout - Preferred layout for the buttons; `"auto"` picks `"horizontal"` when there are four or more providers, otherwise `"vertical"`.
|
|
16
|
-
* @param signInSocial - Callback invoked with the provider and callbackURL when a button is clicked.
|
|
17
11
|
* @returns The JSX element that renders the configured social provider buttons.
|
|
18
12
|
*/
|
|
19
|
-
export declare function ProviderButtons({ isPending, socialLayout
|
|
13
|
+
export declare function ProviderButtons({ isPending, socialLayout }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ProviderButton as e } from "./provider-button.js";
|
|
2
|
+
import { useAuth as t } from "@better-auth-ui/react";
|
|
3
|
+
import { cn as n } from "@heroui/react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
import { useMemo as i } from "react";
|
|
6
6
|
//#region src/components/auth/provider-buttons.tsx
|
|
7
|
-
function
|
|
8
|
-
let {
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
className:
|
|
11
|
-
children:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
onPress: () => u({
|
|
18
|
-
provider: t,
|
|
19
|
-
callbackURL: h
|
|
20
|
-
}),
|
|
21
|
-
children: [/* @__PURE__ */ i(o, {}), g === "vertical" ? f.auth.continueWith.replace("{{provider}}", s(t)) : g === "grid" ? s(t) : null]
|
|
22
|
-
}, t);
|
|
23
|
-
})
|
|
7
|
+
function a({ isPending: a, socialLayout: o = "auto" }) {
|
|
8
|
+
let { socialProviders: s } = t(), c = i(() => o === "auto" ? s?.length && s.length >= 4 ? "horizontal" : "vertical" : o, [o, s?.length]);
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
className: n("gap-3", c === "grid" && "grid grid-cols-2", c === "vertical" && "flex flex-col", c === "horizontal" && "flex flex-wrap"),
|
|
11
|
+
children: s?.map((t) => /* @__PURE__ */ r(e, {
|
|
12
|
+
provider: t,
|
|
13
|
+
isDisabled: a,
|
|
14
|
+
label: c === "vertical" ? "continueWith" : c === "grid" ? "providerName" : "none",
|
|
15
|
+
className: n("w-full", c === "horizontal" && "flex-1")
|
|
16
|
+
}, t))
|
|
24
17
|
});
|
|
25
18
|
}
|
|
26
19
|
//#endregion
|
|
27
|
-
export {
|
|
20
|
+
export { a as ProviderButtons };
|
|
@@ -8,4 +8,4 @@ export type ResetPasswordProps = {
|
|
|
8
8
|
*
|
|
9
9
|
* Renders password (and optional confirm-password) inputs with visibility toggles, applies min/max length constraints from the auth configuration, shows field errors, and submits the new password to the auth client.
|
|
10
10
|
*/
|
|
11
|
-
export declare function ResetPassword({ className, variant, ...props }: ResetPasswordProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function ResetPassword({ className, variant, ...props }: ResetPasswordProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,12 +5,9 @@ import { useEffect as g, useState as _ } from "react";
|
|
|
5
5
|
import { Eye as v, EyeSlash as y } from "@gravity-ui/icons";
|
|
6
6
|
//#region src/components/auth/reset-password.tsx
|
|
7
7
|
function b({ className: b, variant: x, ...S }) {
|
|
8
|
-
let { basePaths: C, emailAndPassword: w, localization: T, viewPaths: E, navigate: D } = e(), { mutate: O, isPending: k } = t({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
p.success(T.auth.passwordResetSuccess), D({ to: `${C.auth}/${E.auth.signIn}` });
|
|
12
|
-
}
|
|
13
|
-
}), [A, j] = _(!1), [M, N] = _(!1);
|
|
8
|
+
let { basePaths: C, emailAndPassword: w, localization: T, viewPaths: E, navigate: D } = e(), { mutate: O, isPending: k } = t({ onSuccess: () => {
|
|
9
|
+
p.success(T.auth.passwordResetSuccess), D({ to: `${C.auth}/${E.auth.signIn}` });
|
|
10
|
+
} }), [A, j] = _(!1), [M, N] = _(!1);
|
|
14
11
|
g(() => {
|
|
15
12
|
new URLSearchParams(window.location.search).get("token") || (p.danger(T.auth.invalidResetPasswordToken), D({ to: `${C.auth}/${E.auth.signIn}` }));
|
|
16
13
|
}, [
|
|
@@ -11,4 +11,4 @@ export interface SignInProps {
|
|
|
11
11
|
*
|
|
12
12
|
* @returns The sign-in JSX element containing email/password fields, optional magic-link button, and social provider buttons.
|
|
13
13
|
*/
|
|
14
|
-
export declare function SignIn({ className, socialLayout, socialPosition, variant, ...props }: SignInProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function SignIn({ className, socialLayout, socialPosition, variant, ...props }: SignInProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|