@better-auth-ui/heroui 1.6.26 → 1.6.28

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.
@@ -1,113 +0,0 @@
1
- import { authMutationKeys as e, getProviderName as t } from "@better-auth-ui/core";
2
- import { providerIcons as n, useAuth as r, useSession as i, useSignInSocial as a } from "@better-auth-ui/react";
3
- import { Person as o } from "@gravity-ui/icons";
4
- import { Avatar as s, Button as c, Separator as l, Skeleton as u, Spinner as d, cn as f } from "@heroui/react";
5
- import { useMemo as p } from "react";
6
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
7
- import { useIsMutating as g } from "@tanstack/react-query";
8
- //#region src/components/auth/field-separator.tsx
9
- function _({ children: e }) {
10
- return /* @__PURE__ */ h("div", {
11
- className: "flex items-center gap-4",
12
- children: [
13
- /* @__PURE__ */ m(l, { className: "flex-1" }),
14
- /* @__PURE__ */ m("p", {
15
- className: "text-xs text-muted shrink-0",
16
- children: e
17
- }),
18
- /* @__PURE__ */ m(l, { className: "flex-1" })
19
- ]
20
- });
21
- }
22
- //#endregion
23
- //#region src/components/auth/provider-button.tsx
24
- function v({ provider: i, display: o = "full", variant: s = "tertiary", ...l }) {
25
- let { authClient: u, baseURL: f, localization: p, redirectTo: _ } = r(), v = `${f}${_}`, { mutate: y, isPending: b } = a(u), x = n[i];
26
- return /* @__PURE__ */ h(c, {
27
- variant: s,
28
- isPending: g({ mutationKey: e.signIn.all }) + g({ mutationKey: e.signUp.all }) > 0,
29
- onPress: () => y({
30
- provider: i,
31
- callbackURL: v
32
- }),
33
- ...l,
34
- "aria-label": t(i),
35
- children: [b ? /* @__PURE__ */ m(d, {
36
- color: "current",
37
- size: "sm"
38
- }) : /* @__PURE__ */ m(x, {}), o === "full" ? p.auth.continueWith.replace("{{provider}}", t(i)) : o === "name" ? t(i) : null]
39
- });
40
- }
41
- //#endregion
42
- //#region src/components/auth/provider-buttons.tsx
43
- function y({ socialLayout: e = "auto" }) {
44
- let { socialProviders: t } = r(), n = p(() => e === "auto" ? t?.length && t.length >= 4 ? "horizontal" : "vertical" : e, [e, t?.length]);
45
- return /* @__PURE__ */ m("div", {
46
- className: f("gap-3", n === "grid" && "grid grid-cols-2", n === "vertical" && "flex flex-col", n === "horizontal" && "flex flex-wrap"),
47
- children: t?.map((e) => /* @__PURE__ */ m(v, {
48
- provider: e,
49
- display: n === "vertical" ? "full" : n === "grid" ? "name" : "icon",
50
- className: f("w-full", n === "horizontal" && "flex-1")
51
- }, e))
52
- });
53
- }
54
- //#endregion
55
- //#region src/components/auth/user/user-avatar.tsx
56
- function b({ className: e, fallback: t, isPending: n, user: a, size: c = "sm", style: l, ...d }) {
57
- let { authClient: p } = r(), { data: g, isPending: _ } = i(p, { enabled: !a && !n });
58
- if ((n || _) && !a) return /* @__PURE__ */ m(u, {
59
- className: f("rounded-full", c === "sm" ? "size-8" : c === "md" ? "size-10" : "size-12", e),
60
- style: l
61
- });
62
- let v = a ?? g?.user, y = (v?.username || v?.name || v?.email)?.slice(0, 2).toUpperCase();
63
- return /* @__PURE__ */ h(s, {
64
- size: c,
65
- className: f("rounded-full", e),
66
- style: l,
67
- ...d,
68
- children: [/* @__PURE__ */ m(s.Image, {
69
- alt: v?.displayUsername || v?.name || v?.email,
70
- src: v?.image ?? void 0
71
- }), /* @__PURE__ */ m(s.Fallback, {
72
- className: f(c === "lg" ? "text-xl" : c === "md" ? "text-base" : "text-sm"),
73
- delayMs: v?.image ? 600 : void 0,
74
- children: t || y || /* @__PURE__ */ m(o, { className: "size-4" })
75
- })]
76
- });
77
- }
78
- //#endregion
79
- //#region src/components/auth/user/user-view.tsx
80
- function x({ className: e, isPending: t, size: n = "md", hideSubtitle: a = !1, user: o, ...s }) {
81
- let { authClient: c } = r(), { data: l, isPending: d } = i(c, { enabled: !o && !t }), p = o ?? l?.user;
82
- return (t || d) && !o ? /* @__PURE__ */ h("div", {
83
- className: f("flex items-center gap-2 min-w-0", e),
84
- ...s,
85
- children: [/* @__PURE__ */ m(b, {
86
- isPending: !0,
87
- className: n === "sm" ? "size-5 [&>span]:text-xs" : void 0,
88
- size: n === "lg" ? "md" : "sm"
89
- }), /* @__PURE__ */ h("div", {
90
- className: "flex flex-col gap-1 min-w-0",
91
- children: [/* @__PURE__ */ m(u, { className: "h-3.5 w-24 rounded-lg" }), a ? null : /* @__PURE__ */ m(u, { className: "h-3 w-32 rounded-lg" })]
92
- })]
93
- }) : /* @__PURE__ */ h("div", {
94
- className: f("flex items-center gap-2 min-w-0", e),
95
- ...s,
96
- children: [/* @__PURE__ */ m(b, {
97
- className: n === "sm" ? "size-5 [&>span]:text-xs" : void 0,
98
- user: p,
99
- size: n === "lg" ? "md" : "sm"
100
- }), /* @__PURE__ */ h("div", {
101
- className: "flex flex-col min-w-0",
102
- children: [/* @__PURE__ */ m("p", {
103
- className: "text-foreground text-sm font-medium leading-tight truncate",
104
- children: p?.displayUsername || p?.name || p?.email
105
- }), !a && (p?.displayUsername || p?.name) ? /* @__PURE__ */ m("p", {
106
- className: "text-muted text-xs leading-tight truncate overflow-x-hidden",
107
- children: p?.email
108
- }) : null]
109
- })]
110
- });
111
- }
112
- //#endregion
113
- export { _ as a, v as i, b as n, y as r, x as t };