@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
|
@@ -2,157 +2,145 @@ 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, useSendVerificationEmail as a, useSignInEmail as o,
|
|
6
|
-
import { Button as
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { useState as
|
|
5
|
+
import { useAuth as i, useSendVerificationEmail as a, useSignInEmail as o, useSignInUsername as s } from "@better-auth-ui/react";
|
|
6
|
+
import { Button as c, Card as l, Checkbox as u, Description as d, FieldError as f, Form as p, Input as m, Label as h, Link as g, Spinner as _, TextField as v, cn as y, toast as b } from "@heroui/react";
|
|
7
|
+
import { Fragment as x, jsx as S, jsxs as C } from "react/jsx-runtime";
|
|
8
|
+
import { useState as w } from "react";
|
|
9
9
|
//#region src/components/auth/sign-in.tsx
|
|
10
|
-
function
|
|
10
|
+
function T(e) {
|
|
11
11
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
let { basePaths:
|
|
15
|
-
onError: (e) => y.danger(e.error?.message || e.message),
|
|
16
|
-
onSuccess: () => y.success(N.auth.verificationEmailSent)
|
|
17
|
-
}), { mutate: W, isPending: G } = o({
|
|
13
|
+
function E({ className: E, socialLayout: D, socialPosition: O = "bottom", variant: k, ...A }) {
|
|
14
|
+
let { basePaths: j, baseURL: M, emailAndPassword: N, localization: P, magicLink: F, passkey: I, redirectTo: L, socialProviders: R, username: z, viewPaths: B, navigate: V } = i(), [H, U] = w(""), { mutate: W } = a({ onSuccess: () => b.success(P.auth.verificationEmailSent) }), { mutate: G, isPending: K } = o({
|
|
18
15
|
onError: (e, { email: t }) => {
|
|
19
|
-
|
|
20
|
-
children:
|
|
21
|
-
onClick: () =>
|
|
16
|
+
U(""), e.error?.code === "EMAIL_NOT_VERIFIED" ? b.danger(e.error?.message || e.message, { actionProps: {
|
|
17
|
+
children: P.auth.resend,
|
|
18
|
+
onClick: () => W({
|
|
22
19
|
email: t,
|
|
23
|
-
callbackURL: `${
|
|
20
|
+
callbackURL: `${M}${L}`
|
|
24
21
|
})
|
|
25
|
-
} }) :
|
|
22
|
+
} }) : b.danger(e.error?.message || e.message);
|
|
26
23
|
},
|
|
27
|
-
onSuccess: () =>
|
|
28
|
-
}), { mutate:
|
|
24
|
+
onSuccess: () => V({ to: L })
|
|
25
|
+
}), { mutate: q, isPending: J } = s({
|
|
29
26
|
onError: (e) => {
|
|
30
|
-
|
|
27
|
+
U(""), b.danger(e.error?.message || e.message);
|
|
31
28
|
},
|
|
32
|
-
onSuccess: () =>
|
|
33
|
-
}),
|
|
34
|
-
onError: (e) => y.danger(e.error?.message || e.message),
|
|
35
|
-
onSuccess: () => {
|
|
36
|
-
Y(!0), setTimeout(() => {
|
|
37
|
-
Y(!1);
|
|
38
|
-
}, 5e3);
|
|
39
|
-
}
|
|
40
|
-
}), ne = (e) => {
|
|
29
|
+
onSuccess: () => V({ to: L })
|
|
30
|
+
}), Y = (e) => {
|
|
41
31
|
e.preventDefault();
|
|
42
32
|
let t = new FormData(e.currentTarget), n = t.get("email"), r = t.get("rememberMe") === "on";
|
|
43
|
-
|
|
33
|
+
z?.enabled && !T(n) ? q({
|
|
44
34
|
username: n,
|
|
45
|
-
password:
|
|
46
|
-
}) :
|
|
35
|
+
password: H
|
|
36
|
+
}) : G({
|
|
47
37
|
email: n,
|
|
48
|
-
password:
|
|
49
|
-
...
|
|
38
|
+
password: H,
|
|
39
|
+
...N?.rememberMe ? { rememberMe: r } : {}
|
|
50
40
|
});
|
|
51
|
-
},
|
|
52
|
-
return /* @__PURE__ */
|
|
53
|
-
className:
|
|
54
|
-
variant:
|
|
55
|
-
...
|
|
41
|
+
}, X = K || J, Z = N?.enabled && !!R?.length;
|
|
42
|
+
return /* @__PURE__ */ C(l, {
|
|
43
|
+
className: y("w-full max-w-sm gap-4 md:p-6", E),
|
|
44
|
+
variant: k,
|
|
45
|
+
...A,
|
|
56
46
|
children: [
|
|
57
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ S(l.Header, { children: /* @__PURE__ */ S(l.Title, {
|
|
58
48
|
className: "text-xl font-semibold mb-1",
|
|
59
|
-
children:
|
|
49
|
+
children: P.auth.signIn
|
|
60
50
|
}) }),
|
|
61
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ C(l.Content, {
|
|
62
52
|
className: "gap-4",
|
|
63
53
|
children: [
|
|
64
|
-
|
|
65
|
-
socialLayout:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
onSubmit: ne,
|
|
54
|
+
O === "top" && /* @__PURE__ */ C(x, { children: [!!R?.length && /* @__PURE__ */ S(r, {
|
|
55
|
+
socialLayout: D,
|
|
56
|
+
isPending: X
|
|
57
|
+
}), Z && /* @__PURE__ */ S(e, { children: P.auth.or })] }),
|
|
58
|
+
N?.enabled && /* @__PURE__ */ C(p, {
|
|
59
|
+
onSubmit: Y,
|
|
71
60
|
className: "flex flex-col gap-4",
|
|
72
61
|
children: [
|
|
73
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ C(v, {
|
|
74
63
|
name: "email",
|
|
75
|
-
type:
|
|
76
|
-
autoComplete:
|
|
77
|
-
isDisabled:
|
|
64
|
+
type: z?.enabled ? "text" : "email",
|
|
65
|
+
autoComplete: z?.enabled ? "username" : "email",
|
|
66
|
+
isDisabled: X,
|
|
78
67
|
children: [
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
placeholder:
|
|
82
|
-
variant:
|
|
68
|
+
/* @__PURE__ */ S(h, { children: z?.enabled ? P.auth.username : P.auth.email }),
|
|
69
|
+
/* @__PURE__ */ S(m, {
|
|
70
|
+
placeholder: z?.enabled ? P.auth.usernameOrEmailPlaceholder : P.auth.emailPlaceholder,
|
|
71
|
+
variant: k === "transparent" ? "primary" : "secondary",
|
|
83
72
|
required: !0
|
|
84
73
|
}),
|
|
85
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ S(f, {})
|
|
86
75
|
]
|
|
87
76
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
minLength:
|
|
90
|
-
maxLength:
|
|
77
|
+
/* @__PURE__ */ C(v, {
|
|
78
|
+
minLength: N?.minPasswordLength,
|
|
79
|
+
maxLength: N?.maxPasswordLength,
|
|
91
80
|
name: "password",
|
|
92
81
|
type: "password",
|
|
93
82
|
autoComplete: "current-password",
|
|
94
|
-
isDisabled:
|
|
95
|
-
value:
|
|
96
|
-
onChange:
|
|
83
|
+
isDisabled: X,
|
|
84
|
+
value: H,
|
|
85
|
+
onChange: U,
|
|
97
86
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
placeholder:
|
|
101
|
-
variant:
|
|
87
|
+
/* @__PURE__ */ S(h, { children: P.auth.password }),
|
|
88
|
+
/* @__PURE__ */ S(m, {
|
|
89
|
+
placeholder: P.auth.passwordPlaceholder,
|
|
90
|
+
variant: k === "transparent" ? "primary" : "secondary",
|
|
102
91
|
required: !0
|
|
103
92
|
}),
|
|
104
|
-
/* @__PURE__ */
|
|
93
|
+
/* @__PURE__ */ S(f, {})
|
|
105
94
|
]
|
|
106
95
|
}),
|
|
107
|
-
|
|
96
|
+
N?.rememberMe && /* @__PURE__ */ C(u, {
|
|
108
97
|
name: "rememberMe",
|
|
109
|
-
isDisabled:
|
|
110
|
-
variant:
|
|
111
|
-
children: [/* @__PURE__ */
|
|
98
|
+
isDisabled: X,
|
|
99
|
+
variant: k === "transparent" ? "primary" : "secondary",
|
|
100
|
+
children: [/* @__PURE__ */ S(u.Control, { children: /* @__PURE__ */ S(u.Indicator, {}) }), /* @__PURE__ */ S(u.Content, { children: /* @__PURE__ */ S(h, { children: P.auth.rememberMe }) })]
|
|
112
101
|
}),
|
|
113
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ C("div", {
|
|
114
103
|
className: "flex flex-col gap-3",
|
|
115
104
|
children: [
|
|
116
|
-
/* @__PURE__ */
|
|
105
|
+
/* @__PURE__ */ C(c, {
|
|
117
106
|
type: "submit",
|
|
118
107
|
className: "w-full",
|
|
119
|
-
isPending:
|
|
120
|
-
children: [
|
|
108
|
+
isPending: X,
|
|
109
|
+
children: [X && /* @__PURE__ */ S(_, {
|
|
121
110
|
color: "current",
|
|
122
111
|
size: "sm"
|
|
123
|
-
}),
|
|
112
|
+
}), P.auth.signIn]
|
|
124
113
|
}),
|
|
125
|
-
|
|
114
|
+
F && /* @__PURE__ */ S(t, {
|
|
126
115
|
view: "signIn",
|
|
127
|
-
isPending:
|
|
116
|
+
isPending: X
|
|
128
117
|
}),
|
|
129
|
-
|
|
118
|
+
I && /* @__PURE__ */ S(n, { isPending: X })
|
|
130
119
|
]
|
|
131
120
|
})
|
|
132
121
|
]
|
|
133
122
|
}),
|
|
134
|
-
|
|
135
|
-
socialLayout:
|
|
136
|
-
|
|
137
|
-
isPending: Q
|
|
123
|
+
O === "bottom" && /* @__PURE__ */ C(x, { children: [Z && /* @__PURE__ */ S(e, { children: P.auth.or }), !!R?.length && /* @__PURE__ */ S(r, {
|
|
124
|
+
socialLayout: D,
|
|
125
|
+
isPending: X
|
|
138
126
|
})] })
|
|
139
127
|
]
|
|
140
128
|
}),
|
|
141
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ C(l.Footer, {
|
|
142
130
|
className: "flex-col gap-3",
|
|
143
|
-
children: [
|
|
144
|
-
href: `${
|
|
131
|
+
children: [N?.forgotPassword && /* @__PURE__ */ S(g, {
|
|
132
|
+
href: `${j.auth}/${B.auth.forgotPassword}`,
|
|
145
133
|
className: "no-underline hover:underline",
|
|
146
|
-
children:
|
|
147
|
-
}),
|
|
134
|
+
children: P.auth.forgotPasswordLink
|
|
135
|
+
}), N?.enabled && /* @__PURE__ */ C(d, {
|
|
148
136
|
className: "text-sm",
|
|
149
137
|
children: [
|
|
150
|
-
|
|
138
|
+
P.auth.needToCreateAnAccount,
|
|
151
139
|
" ",
|
|
152
|
-
/* @__PURE__ */
|
|
153
|
-
href: `${
|
|
140
|
+
/* @__PURE__ */ S(g, {
|
|
141
|
+
href: `${j.auth}/${B.auth.signUp}`,
|
|
154
142
|
className: "text-accent no-underline hover:underline decoration-accent-hover",
|
|
155
|
-
children:
|
|
143
|
+
children: P.auth.signUp
|
|
156
144
|
})
|
|
157
145
|
]
|
|
158
146
|
})]
|
|
@@ -161,4 +149,4 @@ function T({ className: T, socialLayout: E, socialPosition: D = "bottom", varian
|
|
|
161
149
|
});
|
|
162
150
|
}
|
|
163
151
|
//#endregion
|
|
164
|
-
export {
|
|
152
|
+
export { E as SignIn };
|
|
@@ -16,4 +16,4 @@ export type SignUpProps = {
|
|
|
16
16
|
* @param socialPosition - Position of social provider buttons relative to the form; `"top"` or `"bottom"` (default `"bottom"`)
|
|
17
17
|
* @returns The sign-up form React element
|
|
18
18
|
*/
|
|
19
|
-
export declare function SignUp({ className, socialLayout, socialPosition, variant, ...props }: SignUpProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function SignUp({ className, socialLayout, socialPosition, variant, ...props }: SignUpProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,235 +1,226 @@
|
|
|
1
1
|
import { FieldSeparator as e } from "./field-separator.js";
|
|
2
2
|
import { MagicLinkButton as t } from "./magic-link-button.js";
|
|
3
3
|
import { ProviderButtons as n } from "./provider-buttons.js";
|
|
4
|
-
import { useAuth as r, useIsUsernameAvailable as i,
|
|
5
|
-
import { Button as a, Card as o, Description as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { useState as
|
|
8
|
-
import { Check as
|
|
4
|
+
import { useAuth as r, useIsUsernameAvailable as i, useSignUpEmail as ee } from "@better-auth-ui/react";
|
|
5
|
+
import { Button as a, Card as o, Description as te, FieldError as s, Form as ne, Input as c, InputGroup as l, Label as u, Link as re, Spinner as d, TextField as f, cn as p, toast as m } from "@heroui/react";
|
|
6
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
7
|
+
import { useState as v } from "react";
|
|
8
|
+
import { Check as y, Eye as b, EyeSlash as x, Xmark as S } from "@gravity-ui/icons";
|
|
9
9
|
import { useDebouncer as C } from "@tanstack/react-pacer";
|
|
10
10
|
//#region src/components/auth/sign-up.tsx
|
|
11
|
-
function w({ className: w, socialLayout: T, socialPosition: E = "bottom", variant: D, ...
|
|
12
|
-
let { basePaths:
|
|
11
|
+
function w({ className: w, socialLayout: T, socialPosition: E = "bottom", variant: D, ...O }) {
|
|
12
|
+
let { basePaths: k, emailAndPassword: A, localization: j, magicLink: M, redirectTo: N, socialProviders: P, username: F, viewPaths: I, navigate: L } = r(), [R, z] = v(""), [B, V] = v(""), [H, U] = v(""), { mutate: W, data: G, error: K, reset: q } = i(), J = C((e) => {
|
|
13
13
|
if (!e.trim()) {
|
|
14
|
-
|
|
14
|
+
q();
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
W({ username: e.trim() });
|
|
18
18
|
}, { wait: 500 });
|
|
19
|
-
function
|
|
20
|
-
|
|
19
|
+
function Y(e) {
|
|
20
|
+
U(e), q(), F?.isUsernameAvailable && J.maybeExecute(e);
|
|
21
21
|
}
|
|
22
|
-
let { mutate:
|
|
22
|
+
let { mutate: ie, isPending: ae } = ee({
|
|
23
23
|
onError: (e) => {
|
|
24
|
-
|
|
24
|
+
z(""), V(""), m.danger(e.error?.message || e.message);
|
|
25
25
|
},
|
|
26
26
|
onSuccess: () => {
|
|
27
|
-
|
|
27
|
+
A?.requireEmailVerification ? (m.success(j.auth.verifyYourEmail), L({ to: `${k.auth}/${I.auth.signIn}` })) : L({ to: N });
|
|
28
28
|
}
|
|
29
|
-
}), [
|
|
30
|
-
onError: (e) => h.danger(e.error?.message || e.message),
|
|
31
|
-
onSuccess: () => {
|
|
32
|
-
J(!0), setTimeout(() => {
|
|
33
|
-
J(!1);
|
|
34
|
-
}, 5e3);
|
|
35
|
-
}
|
|
36
|
-
}), [X, de] = y(!1), [Z, fe] = y(!1), Q = ce || ue || le, pe = (e) => {
|
|
29
|
+
}), [X, oe] = v(!1), [Z, se] = v(!1), Q = ae, ce = (e) => {
|
|
37
30
|
e.preventDefault();
|
|
38
31
|
let t = new FormData(e.currentTarget), n = t.get("name"), r = t.get("email");
|
|
39
|
-
if (
|
|
40
|
-
|
|
32
|
+
if (A?.confirmPassword && R !== B) {
|
|
33
|
+
m.danger(j.auth.passwordsDoNotMatch), z(""), V("");
|
|
41
34
|
return;
|
|
42
35
|
}
|
|
43
|
-
|
|
36
|
+
ie({
|
|
44
37
|
name: n,
|
|
45
38
|
email: r,
|
|
46
|
-
password:
|
|
47
|
-
...
|
|
48
|
-
username:
|
|
49
|
-
...
|
|
39
|
+
password: R,
|
|
40
|
+
...F?.enabled ? {
|
|
41
|
+
username: H.trim(),
|
|
42
|
+
...F.displayUsername ? { displayUsername: H.trim() } : {}
|
|
50
43
|
} : {}
|
|
51
44
|
});
|
|
52
|
-
}, $ =
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
className:
|
|
45
|
+
}, $ = A?.enabled && !!P?.length;
|
|
46
|
+
return /* @__PURE__ */ _(o, {
|
|
47
|
+
className: p("w-full max-w-sm p-4 md:p-6", w),
|
|
55
48
|
variant: D,
|
|
56
|
-
...
|
|
49
|
+
...O,
|
|
57
50
|
children: [
|
|
58
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ g(o.Header, { children: /* @__PURE__ */ g(o.Title, {
|
|
59
52
|
className: "text-xl font-semibold mb-1",
|
|
60
|
-
children:
|
|
53
|
+
children: j.auth.signUp
|
|
61
54
|
}) }),
|
|
62
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ _(o.Content, {
|
|
63
56
|
className: "gap-4",
|
|
64
57
|
children: [
|
|
65
|
-
E === "top" && /* @__PURE__ */
|
|
58
|
+
E === "top" && /* @__PURE__ */ _(h, { children: [!!P?.length && /* @__PURE__ */ g(n, {
|
|
66
59
|
isPending: Q,
|
|
67
|
-
socialLayout: T
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
onSubmit: pe,
|
|
60
|
+
socialLayout: T
|
|
61
|
+
}), $ && /* @__PURE__ */ g(e, { children: j.auth.or })] }),
|
|
62
|
+
A?.enabled && /* @__PURE__ */ _(ne, {
|
|
63
|
+
onSubmit: ce,
|
|
72
64
|
className: "flex flex-col gap-4",
|
|
73
65
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ _(f, {
|
|
75
67
|
name: "name",
|
|
76
68
|
type: "text",
|
|
77
69
|
autoComplete: "name",
|
|
78
70
|
isDisabled: Q,
|
|
79
71
|
children: [
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
82
|
-
placeholder:
|
|
72
|
+
/* @__PURE__ */ g(u, { children: j.auth.name }),
|
|
73
|
+
/* @__PURE__ */ g(c, {
|
|
74
|
+
placeholder: j.auth.namePlaceholder,
|
|
83
75
|
required: !0,
|
|
84
76
|
variant: D === "transparent" ? "primary" : "secondary"
|
|
85
77
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ g(s, {})
|
|
87
79
|
]
|
|
88
80
|
}),
|
|
89
|
-
|
|
81
|
+
F?.enabled && /* @__PURE__ */ _(f, {
|
|
90
82
|
name: "username",
|
|
91
83
|
type: "text",
|
|
92
84
|
autoComplete: "username",
|
|
93
|
-
minLength:
|
|
94
|
-
maxLength:
|
|
85
|
+
minLength: F.minUsernameLength,
|
|
86
|
+
maxLength: F.maxUsernameLength,
|
|
95
87
|
isDisabled: Q,
|
|
96
|
-
value:
|
|
97
|
-
onChange:
|
|
98
|
-
isInvalid: !!
|
|
88
|
+
value: H,
|
|
89
|
+
onChange: Y,
|
|
90
|
+
isInvalid: !!K || G && !G.available,
|
|
99
91
|
children: [
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ g(u, { children: j.auth.username }),
|
|
93
|
+
/* @__PURE__ */ _(l, {
|
|
102
94
|
variant: D === "transparent" ? "primary" : "secondary",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
104
|
-
placeholder:
|
|
95
|
+
children: [/* @__PURE__ */ g(l.Input, {
|
|
96
|
+
placeholder: j.auth.usernamePlaceholder,
|
|
105
97
|
required: !0
|
|
106
|
-
}),
|
|
98
|
+
}), F.isUsernameAvailable && H.trim() && /* @__PURE__ */ g(l.Suffix, {
|
|
107
99
|
className: "px-2",
|
|
108
|
-
children:
|
|
100
|
+
children: G?.available ? /* @__PURE__ */ g(y, { className: "text-success" }) : K || G?.available === !1 ? /* @__PURE__ */ g(S, { className: "text-danger" }) : /* @__PURE__ */ g(d, {
|
|
109
101
|
size: "sm",
|
|
110
102
|
color: "current"
|
|
111
103
|
})
|
|
112
104
|
})]
|
|
113
105
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ g(s, { children: K?.error?.message || K?.message || (G?.available === !1 ? j.auth.usernameTaken : null) })
|
|
115
107
|
]
|
|
116
108
|
}),
|
|
117
|
-
/* @__PURE__ */
|
|
109
|
+
/* @__PURE__ */ _(f, {
|
|
118
110
|
name: "email",
|
|
119
111
|
type: "email",
|
|
120
112
|
autoComplete: "email",
|
|
121
113
|
isDisabled: Q,
|
|
122
114
|
children: [
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
-
/* @__PURE__ */
|
|
125
|
-
placeholder:
|
|
115
|
+
/* @__PURE__ */ g(u, { children: j.auth.email }),
|
|
116
|
+
/* @__PURE__ */ g(c, {
|
|
117
|
+
placeholder: j.auth.emailPlaceholder,
|
|
126
118
|
required: !0,
|
|
127
119
|
variant: D === "transparent" ? "primary" : "secondary"
|
|
128
120
|
}),
|
|
129
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ g(s, {})
|
|
130
122
|
]
|
|
131
123
|
}),
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
minLength:
|
|
134
|
-
maxLength:
|
|
124
|
+
/* @__PURE__ */ _(f, {
|
|
125
|
+
minLength: A?.minPasswordLength,
|
|
126
|
+
maxLength: A?.maxPasswordLength,
|
|
135
127
|
name: "password",
|
|
136
128
|
autoComplete: "new-password",
|
|
137
129
|
isDisabled: Q,
|
|
138
|
-
value:
|
|
139
|
-
onChange:
|
|
130
|
+
value: R,
|
|
131
|
+
onChange: z,
|
|
140
132
|
children: [
|
|
141
|
-
/* @__PURE__ */
|
|
142
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ g(u, { children: j.auth.password }),
|
|
134
|
+
/* @__PURE__ */ _(l, {
|
|
143
135
|
variant: D === "transparent" ? "primary" : "secondary",
|
|
144
|
-
children: [/* @__PURE__ */
|
|
145
|
-
placeholder:
|
|
136
|
+
children: [/* @__PURE__ */ g(l.Input, {
|
|
137
|
+
placeholder: j.auth.passwordPlaceholder,
|
|
146
138
|
type: X ? "text" : "password",
|
|
147
139
|
name: "password",
|
|
148
140
|
required: !0
|
|
149
|
-
}), /* @__PURE__ */
|
|
141
|
+
}), /* @__PURE__ */ g(l.Suffix, {
|
|
150
142
|
className: "px-0",
|
|
151
|
-
children: /* @__PURE__ */
|
|
143
|
+
children: /* @__PURE__ */ g(a, {
|
|
152
144
|
isIconOnly: !0,
|
|
153
|
-
"aria-label": X ?
|
|
145
|
+
"aria-label": X ? j.auth.hidePassword : j.auth.showPassword,
|
|
154
146
|
size: "sm",
|
|
155
147
|
variant: "ghost",
|
|
156
|
-
onPress: () =>
|
|
148
|
+
onPress: () => oe(!X),
|
|
157
149
|
isDisabled: Q,
|
|
158
|
-
children:
|
|
150
|
+
children: g(X ? x : b, {})
|
|
159
151
|
})
|
|
160
152
|
})]
|
|
161
153
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ g(s, {})
|
|
163
155
|
]
|
|
164
156
|
}),
|
|
165
|
-
|
|
166
|
-
minLength:
|
|
167
|
-
maxLength:
|
|
157
|
+
A?.confirmPassword && /* @__PURE__ */ _(f, {
|
|
158
|
+
minLength: A?.minPasswordLength,
|
|
159
|
+
maxLength: A?.maxPasswordLength,
|
|
168
160
|
name: "confirmPassword",
|
|
169
161
|
autoComplete: "new-password",
|
|
170
162
|
isDisabled: Q,
|
|
171
|
-
value:
|
|
172
|
-
onChange:
|
|
163
|
+
value: B,
|
|
164
|
+
onChange: V,
|
|
173
165
|
children: [
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ g(u, { children: j.auth.confirmPassword }),
|
|
167
|
+
/* @__PURE__ */ _(l, {
|
|
176
168
|
variant: D === "transparent" ? "primary" : "secondary",
|
|
177
|
-
children: [/* @__PURE__ */
|
|
169
|
+
children: [/* @__PURE__ */ g(l.Input, {
|
|
178
170
|
name: "confirmPassword",
|
|
179
|
-
placeholder:
|
|
171
|
+
placeholder: j.auth.confirmPasswordPlaceholder,
|
|
180
172
|
type: Z ? "text" : "password",
|
|
181
173
|
required: !0
|
|
182
|
-
}), /* @__PURE__ */
|
|
174
|
+
}), /* @__PURE__ */ g(l.Suffix, {
|
|
183
175
|
className: "px-0",
|
|
184
|
-
children: /* @__PURE__ */
|
|
176
|
+
children: /* @__PURE__ */ g(a, {
|
|
185
177
|
isIconOnly: !0,
|
|
186
|
-
"aria-label": Z ?
|
|
178
|
+
"aria-label": Z ? j.auth.hidePassword : j.auth.showPassword,
|
|
187
179
|
size: "sm",
|
|
188
180
|
variant: "ghost",
|
|
189
|
-
onPress: () =>
|
|
181
|
+
onPress: () => se(!Z),
|
|
190
182
|
isDisabled: Q,
|
|
191
|
-
children:
|
|
183
|
+
children: g(Z ? x : b, {})
|
|
192
184
|
})
|
|
193
185
|
})]
|
|
194
186
|
}),
|
|
195
|
-
/* @__PURE__ */
|
|
187
|
+
/* @__PURE__ */ g(s, {})
|
|
196
188
|
]
|
|
197
189
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ _("div", {
|
|
199
191
|
className: "flex flex-col gap-3",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
192
|
+
children: [/* @__PURE__ */ _(a, {
|
|
201
193
|
type: "submit",
|
|
202
194
|
className: "w-full",
|
|
203
195
|
isPending: Q,
|
|
204
|
-
children: [Q && /* @__PURE__ */
|
|
196
|
+
children: [Q && /* @__PURE__ */ g(d, {
|
|
205
197
|
color: "current",
|
|
206
198
|
size: "sm"
|
|
207
|
-
}),
|
|
208
|
-
}),
|
|
199
|
+
}), j.auth.signUp]
|
|
200
|
+
}), M && /* @__PURE__ */ g(t, {
|
|
209
201
|
view: "signUp",
|
|
210
202
|
isPending: Q
|
|
211
203
|
})]
|
|
212
204
|
})
|
|
213
205
|
]
|
|
214
206
|
}),
|
|
215
|
-
E === "bottom" && /* @__PURE__ */
|
|
207
|
+
E === "bottom" && /* @__PURE__ */ _(h, { children: [$ && /* @__PURE__ */ g(e, { children: j.auth.or }), !!P?.length && /* @__PURE__ */ g(n, {
|
|
216
208
|
socialLayout: T,
|
|
217
|
-
signInSocial: Y,
|
|
218
209
|
isPending: Q
|
|
219
210
|
})] })
|
|
220
211
|
]
|
|
221
212
|
}),
|
|
222
|
-
/* @__PURE__ */
|
|
213
|
+
/* @__PURE__ */ g(o.Footer, {
|
|
223
214
|
className: "flex-col",
|
|
224
|
-
children: /* @__PURE__ */
|
|
215
|
+
children: /* @__PURE__ */ _(te, {
|
|
225
216
|
className: "text-sm",
|
|
226
217
|
children: [
|
|
227
|
-
|
|
218
|
+
j.auth.alreadyHaveAnAccount,
|
|
228
219
|
" ",
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
href: `${
|
|
220
|
+
/* @__PURE__ */ g(re, {
|
|
221
|
+
href: `${k.auth}/${I.auth.signIn}`,
|
|
231
222
|
className: "text-accent decoration-accent no-underline hover:underline",
|
|
232
|
-
children:
|
|
223
|
+
children: j.auth.signIn
|
|
233
224
|
})
|
|
234
225
|
]
|
|
235
226
|
})
|
|
@@ -13,4 +13,4 @@ export type AppearanceProps = {
|
|
|
13
13
|
* @param className - Optional additional CSS class names for the card container.
|
|
14
14
|
* @returns A JSX element containing the theme selector card, or null if theme settings are not configured.
|
|
15
15
|
*/
|
|
16
|
-
export declare function Appearance({ className, variant, ...props }: AppearanceProps & CardProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export declare function Appearance({ className, variant, ...props }: AppearanceProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -7,7 +7,7 @@ import { CloudArrowUpIn as m, TrashBin as h } from "@gravity-ui/icons";
|
|
|
7
7
|
import { fileToBase64 as g } from "@better-auth-ui/core";
|
|
8
8
|
//#region src/components/settings/account/change-avatar.tsx
|
|
9
9
|
function _({ className: _ }) {
|
|
10
|
-
let { localization: v, avatar: y } = t(), { data: b } = n(), { mutate: x, isPending: S } = r(
|
|
10
|
+
let { localization: v, avatar: y } = t(), { data: b } = n(), { mutate: x, isPending: S } = r(), C = f(null), [w, T] = p(!1), [E, D] = p(!1), O = S || w || E;
|
|
11
11
|
async function k(e) {
|
|
12
12
|
let t = e.target.files?.[0];
|
|
13
13
|
if (t) {
|
|
@@ -12,4 +12,4 @@ export type ChangeEmailProps = {
|
|
|
12
12
|
*
|
|
13
13
|
* @returns A JSX element rendering the change-email card and form
|
|
14
14
|
*/
|
|
15
|
-
export declare function ChangeEmail({ className, variant, ...props }: ChangeEmailProps & CardProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function ChangeEmail({ className, variant, ...props }: ChangeEmailProps & Omit<CardProps, "children">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,10 +3,7 @@ import { Button as r, Card as i, FieldError as a, Fieldset as o, Form as s, Inpu
|
|
|
3
3
|
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/settings/account/change-email.tsx
|
|
5
5
|
function _({ className: _, variant: v, ...y }) {
|
|
6
|
-
let { localization: b, baseURL: x, viewPaths: S } = e(), { data: C } = n(), { mutate: w, isPending: T } = t({
|
|
7
|
-
onSuccess: () => m.success(b.settings.changeEmailSuccess),
|
|
8
|
-
onError: (e) => m.danger(e.error?.message || e.message)
|
|
9
|
-
});
|
|
6
|
+
let { localization: b, baseURL: x, viewPaths: S } = e(), { data: C } = n(), { mutate: w, isPending: T } = t({ onSuccess: () => m.success(b.settings.changeEmailSuccess) });
|
|
10
7
|
function E(e) {
|
|
11
8
|
e.preventDefault(), w({
|
|
12
9
|
newEmail: new FormData(e.currentTarget).get("email"),
|