@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.
Files changed (74) hide show
  1. package/dist/components/auth/auth-provider.js +12 -11
  2. package/dist/components/auth/auth.d.ts +1 -1
  3. package/dist/components/auth/error-toaster.d.ts +1 -0
  4. package/dist/components/auth/error-toaster.js +17 -0
  5. package/dist/components/auth/forgot-password.d.ts +1 -1
  6. package/dist/components/auth/forgot-password.js +3 -6
  7. package/dist/components/auth/magic-link.d.ts +1 -1
  8. package/dist/components/auth/magic-link.js +52 -64
  9. package/dist/components/auth/passkey-button.js +12 -15
  10. package/dist/components/auth/provider-button.d.ts +15 -0
  11. package/dist/components/auth/provider-button.js +29 -0
  12. package/dist/components/auth/provider-buttons.d.ts +4 -10
  13. package/dist/components/auth/provider-buttons.js +16 -23
  14. package/dist/components/auth/reset-password.d.ts +1 -1
  15. package/dist/components/auth/reset-password.js +3 -6
  16. package/dist/components/auth/sign-in.d.ts +1 -1
  17. package/dist/components/auth/sign-in.js +81 -93
  18. package/dist/components/auth/sign-up.d.ts +1 -1
  19. package/dist/components/auth/sign-up.js +99 -108
  20. package/dist/components/settings/account/appearance.d.ts +1 -1
  21. package/dist/components/settings/account/change-avatar.js +1 -1
  22. package/dist/components/settings/account/change-email.d.ts +1 -1
  23. package/dist/components/settings/account/change-email.js +1 -4
  24. package/dist/components/settings/account/manage-account.js +1 -4
  25. package/dist/components/settings/account/manage-accounts.d.ts +1 -1
  26. package/dist/components/settings/account/manage-accounts.js +16 -16
  27. package/dist/components/settings/account/user-profile.d.ts +1 -1
  28. package/dist/components/settings/account/user-profile.js +1 -4
  29. package/dist/components/settings/security/active-session.js +1 -4
  30. package/dist/components/settings/security/active-sessions.d.ts +1 -1
  31. package/dist/components/settings/security/active-sessions.js +17 -17
  32. package/dist/components/settings/security/change-password.d.ts +1 -1
  33. package/dist/components/settings/security/change-password.js +1 -4
  34. package/dist/components/settings/security/delete-user.d.ts +1 -1
  35. package/dist/components/settings/security/delete-user.js +6 -11
  36. package/dist/components/settings/security/linked-account.js +1 -7
  37. package/dist/components/settings/security/linked-accounts.d.ts +1 -1
  38. package/dist/components/settings/security/linked-accounts.js +18 -18
  39. package/dist/components/settings/security/passkey.js +19 -19
  40. package/dist/components/settings/security/passkeys.d.ts +1 -1
  41. package/dist/components/settings/security/passkeys.js +28 -28
  42. package/dist/components/user/switch-account-item.js +9 -9
  43. package/dist/components/user/switch-account-menu.js +16 -16
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.js +34 -33
  46. package/package.json +6 -4
  47. package/src/components/auth/auth-provider.tsx +4 -0
  48. package/src/components/auth/auth.tsx +1 -1
  49. package/src/components/auth/error-toaster.tsx +25 -0
  50. package/src/components/auth/forgot-password.tsx +1 -2
  51. package/src/components/auth/magic-link.tsx +3 -23
  52. package/src/components/auth/passkey-button.tsx +1 -2
  53. package/src/components/auth/provider-button.tsx +67 -0
  54. package/src/components/auth/provider-buttons.tsx +26 -43
  55. package/src/components/auth/reset-password.tsx +1 -2
  56. package/src/components/auth/sign-in.tsx +2 -20
  57. package/src/components/auth/sign-up.tsx +5 -20
  58. package/src/components/settings/account/appearance.tsx +1 -1
  59. package/src/components/settings/account/change-avatar.tsx +1 -3
  60. package/src/components/settings/account/change-email.tsx +2 -3
  61. package/src/components/settings/account/manage-account.tsx +1 -4
  62. package/src/components/settings/account/manage-accounts.tsx +3 -8
  63. package/src/components/settings/account/user-profile.tsx +1 -2
  64. package/src/components/settings/security/active-session.tsx +0 -1
  65. package/src/components/settings/security/active-sessions.tsx +3 -8
  66. package/src/components/settings/security/change-password.tsx +7 -4
  67. package/src/components/settings/security/delete-user.tsx +1 -4
  68. package/src/components/settings/security/linked-account.tsx +4 -14
  69. package/src/components/settings/security/linked-accounts.tsx +3 -8
  70. package/src/components/settings/security/passkey.tsx +2 -4
  71. package/src/components/settings/security/passkeys.tsx +4 -12
  72. package/src/components/user/switch-account-item.tsx +2 -4
  73. package/src/components/user/switch-account-menu.tsx +2 -7
  74. package/src/index.tsx +1 -0
@@ -1,16 +1,17 @@
1
- import { AuthProvider as e } from "@better-auth-ui/react";
2
- import { RouterProvider as t } from "@heroui/react";
3
- import { jsx as n } from "react/jsx-runtime";
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 r({ children: r, navigate: i, ...a }) {
6
- return /* @__PURE__ */ n(e, {
7
- navigate: i,
8
- ...a,
9
- children: /* @__PURE__ */ n(t, {
10
- navigate: (e) => i({ to: 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 { r as AuthProvider };
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
- onError: (e) => p.danger(e.error?.message || e.message),
8
- onSuccess: () => {
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, useSignInSocial as o } from "@better-auth-ui/react";
6
- import { Button as s, Card as c, Description as l, FieldError as u, Form as d, Input as f, Label as p, Link as m, Spinner as h, TextField as g, cn as _, toast as v } from "@heroui/react";
7
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
8
- import { useState as S } from "react";
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 C({ className: C, socialLayout: w, socialPosition: T = "bottom", variant: E, ...D }) {
11
- let { basePaths: O, baseURL: k, localization: A, passkey: j, redirectTo: M, socialProviders: N, viewPaths: P } = i(), [F, I] = S(""), { mutate: L, isPending: R } = a({
12
- onError: (e) => v.danger(e.error?.message || e.message),
13
- onSuccess: () => {
14
- I(""), v.success(A.auth.magicLinkSent);
15
- }
16
- }), [z, B] = S(!1), { mutate: V, isPending: H } = o({
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
- }, G = !!N?.length;
29
- return /* @__PURE__ */ x(c, {
30
- className: _("w-full max-w-sm p-4 md:p-6", C),
31
- variant: E,
32
- ...D,
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__ */ b(c.Header, { children: /* @__PURE__ */ b(c.Title, {
24
+ /* @__PURE__ */ y(s.Header, { children: /* @__PURE__ */ y(s.Title, {
35
25
  className: "text-xl font-semibold mb-1",
36
- children: A.auth.signIn
26
+ children: k.auth.signIn
37
27
  }) }),
38
- /* @__PURE__ */ x(c.Content, {
28
+ /* @__PURE__ */ b(s.Content, {
39
29
  className: "gap-4",
40
30
  children: [
41
- T === "top" && /* @__PURE__ */ x(y, { children: [!!N?.length && /* @__PURE__ */ b(r, {
42
- socialLayout: w,
43
- signInSocial: V,
44
- isPending: U
45
- }), G && /* @__PURE__ */ b(e, { children: A.auth.or })] }),
46
- /* @__PURE__ */ x(d, {
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__ */ x(g, {
38
+ children: [/* @__PURE__ */ b(h, {
50
39
  name: "email",
51
40
  type: "email",
52
41
  autoComplete: "email",
53
- isDisabled: U,
54
- value: F,
55
- onChange: I,
42
+ isDisabled: R,
43
+ value: P,
44
+ onChange: F,
56
45
  children: [
57
- /* @__PURE__ */ b(p, { children: A.auth.email }),
58
- /* @__PURE__ */ b(f, {
59
- placeholder: A.auth.emailPlaceholder,
46
+ /* @__PURE__ */ y(f, { children: k.auth.email }),
47
+ /* @__PURE__ */ y(d, {
48
+ placeholder: k.auth.emailPlaceholder,
60
49
  required: !0,
61
- variant: E === "transparent" ? "primary" : "secondary"
50
+ variant: T === "transparent" ? "primary" : "secondary"
62
51
  }),
63
- /* @__PURE__ */ b(u, {})
52
+ /* @__PURE__ */ y(l, {})
64
53
  ]
65
- }), /* @__PURE__ */ x("div", {
54
+ }), /* @__PURE__ */ b("div", {
66
55
  className: "flex flex-col gap-3",
67
56
  children: [
68
- /* @__PURE__ */ x(s, {
57
+ /* @__PURE__ */ b(o, {
69
58
  type: "submit",
70
59
  className: "w-full",
71
- isPending: U,
72
- children: [U && /* @__PURE__ */ b(h, {
60
+ isPending: R,
61
+ children: [R && /* @__PURE__ */ y(m, {
73
62
  color: "current",
74
63
  size: "sm"
75
- }), A.auth.sendMagicLink]
64
+ }), k.auth.sendMagicLink]
76
65
  }),
77
- /* @__PURE__ */ b(t, {
66
+ /* @__PURE__ */ y(t, {
78
67
  view: "magicLink",
79
- isPending: U
68
+ isPending: R
80
69
  }),
81
- j && /* @__PURE__ */ b(n, { isPending: U })
70
+ A && /* @__PURE__ */ y(n, { isPending: R })
82
71
  ]
83
72
  })]
84
73
  }),
85
- T === "bottom" && /* @__PURE__ */ x(y, { children: [G && /* @__PURE__ */ b(e, { children: A.auth.or }), !!N?.length && /* @__PURE__ */ b(r, {
86
- socialLayout: w,
87
- signInSocial: V,
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__ */ b(c.Footer, {
80
+ /* @__PURE__ */ y(s.Footer, {
93
81
  className: "flex-col",
94
- children: /* @__PURE__ */ x(l, {
82
+ children: /* @__PURE__ */ b(c, {
95
83
  className: "text-sm",
96
84
  children: [
97
- A.auth.needToCreateAnAccount,
85
+ k.auth.needToCreateAnAccount,
98
86
  " ",
99
- /* @__PURE__ */ b(m, {
100
- href: `${O.auth}/${P.auth.signUp}`,
87
+ /* @__PURE__ */ y(p, {
88
+ href: `${D.auth}/${N.auth.signUp}`,
101
89
  className: "text-accent decoration-accent no-underline hover:underline",
102
- children: A.auth.signUp
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 { C as MagicLink };
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, toast as i } from "@heroui/react";
3
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
- import { Fingerprint as s } from "@gravity-ui/icons";
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 c({ isPending: c }) {
7
- let { localization: l, redirectTo: u, navigate: d } = e(), { mutate: f, isPending: p } = t({
8
- onError: (e) => i.danger(e.error?.message || e.message),
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: c || p,
15
- isPending: p,
16
- onPress: () => f(),
17
- children: [p ? /* @__PURE__ */ a(r, {
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__ */ a(s, {}), l.auth.continueWith.replace("{{provider}}", l.auth.passkey)]
17
+ }) : /* @__PURE__ */ i(o, {}), c.auth.continueWith.replace("{{provider}}", c.auth.passkey)]
21
18
  });
22
19
  }
23
20
  //#endregion
24
- export { c as PasskeyButton };
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: boolean;
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 and handle initiation and pending state.
7
+ * Render social provider sign-in buttons. Each button owns its own sign-in mutation.
13
8
  *
14
- * @param isPending - Disables all provider buttons when true.
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, signInSocial }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ProviderButtons({ isPending, socialLayout }: ProviderButtonsProps): import("react/jsx-runtime").JSX.Element;
@@ -1,27 +1,20 @@
1
- import { providerIcons as e, useAuth as t } from "@better-auth-ui/react";
2
- import { Button as n, cn as r } from "@heroui/react";
3
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
4
- import { useMemo as o } from "react";
5
- import { getProviderName as s } from "@better-auth-ui/core";
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 c({ isPending: c, socialLayout: l = "auto", signInSocial: u }) {
8
- let { baseURL: d, localization: f, redirectTo: p, socialProviders: m } = t(), h = `${d}${p}`, g = o(() => l === "auto" ? m?.length && m.length >= 4 ? "horizontal" : "vertical" : l, [l, m?.length]);
9
- return /* @__PURE__ */ i("div", {
10
- className: r("gap-3", g === "grid" && "grid grid-cols-2", g === "vertical" && "flex flex-col", g === "horizontal" && "flex flex-wrap"),
11
- children: m?.map((t) => {
12
- let o = e[t];
13
- return /* @__PURE__ */ a(n, {
14
- className: r("w-full", g === "horizontal" && "flex-1"),
15
- variant: "tertiary",
16
- isPending: c,
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 { c as ProviderButtons };
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
- onError: (e) => p.danger(e.error?.message || e.message),
10
- onSuccess: () => {
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;