@stackframe/stack 2.3.5 → 2.3.7
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/card-frame.d.mts +9 -0
- package/dist/components/card-frame.d.ts +8 -5
- package/dist/components/card-frame.js +58 -23
- package/dist/components/credential-sign-in.d.mts +5 -0
- package/dist/components/credential-sign-in.d.ts +5 -1
- package/dist/components/credential-sign-in.js +109 -41
- package/dist/components/credential-sign-up.d.mts +5 -0
- package/dist/components/credential-sign-up.d.ts +5 -1
- package/dist/components/credential-sign-up.js +140 -62
- package/dist/components/forgot-password.d.mts +7 -0
- package/dist/components/forgot-password.d.ts +6 -2
- package/dist/components/forgot-password.js +83 -26
- package/dist/components/form-warning.d.mts +7 -0
- package/dist/components/form-warning.d.ts +6 -2
- package/dist/components/form-warning.js +34 -8
- package/dist/components/magic-link-sign-in.d.mts +5 -0
- package/dist/components/magic-link-sign-in.d.ts +5 -1
- package/dist/components/magic-link-sign-in.js +89 -31
- package/dist/components/message-card.d.mts +10 -0
- package/dist/components/message-card.d.ts +8 -4
- package/dist/components/message-card.js +45 -6
- package/dist/components/oauth-button.d.mts +8 -0
- package/dist/components/oauth-button.d.ts +6 -2
- package/dist/components/oauth-button.js +142 -63
- package/dist/components/oauth-group.d.mts +7 -0
- package/dist/components/oauth-group.d.ts +6 -2
- package/dist/components/oauth-group.js +46 -8
- package/dist/components/password-field.d.mts +5 -0
- package/dist/components/password-field.d.ts +5 -3
- package/dist/components/password-field.js +111 -41
- package/dist/components/password-reset-inner.d.mts +8 -0
- package/dist/components/password-reset-inner.d.ts +6 -2
- package/dist/components/password-reset-inner.js +120 -58
- package/dist/components/redirect-message-card.d.mts +8 -0
- package/dist/components/redirect-message-card.d.ts +6 -2
- package/dist/components/redirect-message-card.js +110 -58
- package/dist/components/separator-with-text.d.mts +7 -0
- package/dist/components/separator-with-text.d.ts +6 -2
- package/dist/components/separator-with-text.js +35 -5
- package/dist/components/user-avatar.d.mts +13 -0
- package/dist/components/user-avatar.d.ts +11 -3
- package/dist/components/user-avatar.js +34 -6
- package/dist/components/user-button.d.mts +15 -0
- package/dist/components/user-button.d.ts +12 -3
- package/dist/components/user-button.js +156 -26
- package/dist/components-core/avatar.d.mts +8 -0
- package/dist/components-core/avatar.d.ts +7 -5
- package/dist/components-core/avatar.js +73 -18
- package/dist/components-core/button.d.mts +12 -0
- package/dist/components-core/button.d.ts +8 -6
- package/dist/components-core/button.js +177 -113
- package/dist/components-core/card.d.mts +8 -0
- package/dist/components-core/card.d.ts +4 -2
- package/dist/components-core/card.js +73 -22
- package/dist/components-core/collapsible.d.mts +8 -0
- package/dist/components-core/collapsible.d.ts +8 -6
- package/dist/components-core/collapsible.js +48 -5
- package/dist/components-core/container.d.mts +8 -0
- package/dist/components-core/container.d.ts +5 -3
- package/dist/components-core/container.js +61 -11
- package/dist/components-core/dropdown.d.mts +15 -0
- package/dist/components-core/dropdown.d.ts +10 -8
- package/dist/components-core/dropdown.js +108 -36
- package/dist/components-core/index.d.mts +59 -0
- package/dist/components-core/index.d.ts +51 -40
- package/dist/components-core/index.js +144 -46
- package/dist/components-core/input.d.mts +6 -0
- package/dist/components-core/input.d.ts +5 -3
- package/dist/components-core/input.js +97 -28
- package/dist/components-core/label.d.mts +6 -0
- package/dist/components-core/label.d.ts +5 -3
- package/dist/components-core/label.js +65 -15
- package/dist/components-core/link.d.mts +10 -0
- package/dist/components-core/link.d.ts +7 -6
- package/dist/components-core/link.js +72 -18
- package/dist/components-core/loading-indicator.d.mts +13 -0
- package/dist/components-core/loading-indicator.d.ts +11 -4
- package/dist/components-core/loading-indicator.js +46 -6
- package/dist/components-core/popover.d.mts +8 -0
- package/dist/components-core/popover.d.ts +8 -6
- package/dist/components-core/popover.js +72 -16
- package/dist/components-core/separator.d.mts +6 -0
- package/dist/components-core/separator.d.ts +5 -3
- package/dist/components-core/separator.js +66 -16
- package/dist/components-core/skeleton.d.mts +7 -0
- package/dist/components-core/skeleton.d.ts +5 -3
- package/dist/components-core/skeleton.js +75 -21
- package/dist/components-core/tabs.d.mts +9 -0
- package/dist/components-core/tabs.d.ts +8 -6
- package/dist/components-core/tabs.js +87 -20
- package/dist/components-core/text.d.mts +10 -0
- package/dist/components-core/text.d.ts +5 -3
- package/dist/components-core/text.js +95 -40
- package/dist/components-core-joy/button.d.mts +6 -0
- package/dist/components-core-joy/button.d.ts +6 -2
- package/dist/components-core-joy/button.js +86 -28
- package/dist/components-core-joy/input.d.mts +5 -0
- package/dist/components-core-joy/input.d.ts +5 -2
- package/dist/components-core-joy/input.js +51 -6
- package/dist/components-core-joy/separator.d.mts +6 -0
- package/dist/components-core-joy/separator.d.ts +6 -2
- package/dist/components-core-joy/separator.js +50 -6
- package/dist/components-core-joy/tabs.d.mts +9 -0
- package/dist/components-core-joy/tabs.d.ts +9 -5
- package/dist/components-core-joy/tabs.js +62 -16
- package/dist/components-core-joy/text.d.mts +9 -0
- package/dist/components-core-joy/text.d.ts +6 -3
- package/dist/components-core-joy/text.js +68 -28
- package/dist/components-page/account-settings.d.mts +7 -0
- package/dist/components-page/account-settings.d.ts +6 -2
- package/dist/components-page/account-settings.js +213 -81
- package/dist/components-page/auth-page.d.mts +8 -0
- package/dist/components-page/auth-page.d.ts +6 -2
- package/dist/components-page/auth-page.js +79 -19
- package/dist/components-page/email-verification.d.mts +8 -0
- package/dist/components-page/email-verification.d.ts +6 -2
- package/dist/components-page/email-verification.js +65 -28
- package/dist/components-page/forgot-password.d.mts +7 -0
- package/dist/components-page/forgot-password.d.ts +6 -2
- package/dist/components-page/forgot-password.js +64 -20
- package/dist/components-page/magic-link-callback.d.mts +8 -0
- package/dist/components-page/magic-link-callback.d.ts +6 -2
- package/dist/components-page/magic-link-callback.js +72 -34
- package/dist/components-page/oauth-callback.d.mts +5 -0
- package/dist/components-page/oauth-callback.d.ts +5 -1
- package/dist/components-page/oauth-callback.js +52 -16
- package/dist/components-page/password-reset.d.mts +8 -0
- package/dist/components-page/password-reset.d.ts +6 -2
- package/dist/components-page/password-reset.js +70 -34
- package/dist/components-page/sign-in.d.mts +7 -0
- package/dist/components-page/sign-in.d.ts +6 -2
- package/dist/components-page/sign-in.js +41 -5
- package/dist/components-page/sign-out.d.mts +5 -0
- package/dist/components-page/sign-out.d.ts +5 -1
- package/dist/components-page/sign-out.js +47 -11
- package/dist/components-page/sign-up.d.mts +7 -0
- package/dist/components-page/sign-up.d.ts +6 -2
- package/dist/components-page/sign-up.js +41 -5
- package/dist/components-page/stack-handler.d.mts +16 -0
- package/dist/components-page/stack-handler.d.ts +11 -3
- package/dist/components-page/stack-handler.js +102 -64
- package/dist/esm/components/card-frame.js +39 -0
- package/dist/esm/components/credential-sign-in.js +82 -0
- package/dist/esm/components/credential-sign-up.js +114 -0
- package/dist/esm/components/forgot-password.js +55 -0
- package/dist/esm/components/form-warning.js +15 -0
- package/dist/esm/components/magic-link-sign-in.js +61 -0
- package/dist/esm/components/message-card.js +16 -0
- package/dist/esm/components/oauth-button.js +124 -0
- package/dist/esm/components/oauth-group.js +17 -0
- package/dist/esm/components/password-field.js +82 -0
- package/dist/esm/components/password-reset-inner.js +93 -0
- package/dist/esm/components/redirect-message-card.js +83 -0
- package/dist/esm/components/separator-with-text.js +16 -0
- package/dist/esm/components/user-avatar.js +14 -0
- package/dist/esm/components/user-button.js +133 -0
- package/dist/esm/components-core/avatar.js +56 -0
- package/dist/esm/components-core/button.js +165 -0
- package/dist/esm/components-core/card.js +51 -0
- package/dist/esm/components-core/collapsible.js +13 -0
- package/dist/esm/components-core/container.js +35 -0
- package/dist/esm/components-core/dropdown.js +106 -0
- package/dist/esm/components-core/index.js +93 -0
- package/dist/esm/components-core/input.js +80 -0
- package/dist/esm/components-core/label.js +38 -0
- package/dist/esm/components-core/link.js +38 -0
- package/dist/esm/components-core/loading-indicator.js +27 -0
- package/dist/esm/components-core/popover.js +43 -0
- package/dist/esm/components-core/separator.js +36 -0
- package/dist/esm/components-core/skeleton.js +52 -0
- package/dist/esm/components-core/tabs.js +79 -0
- package/dist/esm/components-core/text.js +63 -0
- package/dist/esm/components-core-joy/button.js +53 -0
- package/dist/esm/components-core-joy/input.js +18 -0
- package/dist/esm/components-core-joy/separator.js +17 -0
- package/dist/esm/components-core-joy/tabs.js +29 -0
- package/dist/esm/components-core-joy/text.js +35 -0
- package/dist/esm/components-page/account-settings.js +197 -0
- package/dist/esm/components-page/auth-page.js +50 -0
- package/dist/esm/components-page/email-verification.js +36 -0
- package/dist/esm/components-page/forgot-password.js +35 -0
- package/dist/esm/components-page/magic-link-callback.js +43 -0
- package/dist/esm/components-page/oauth-callback.js +23 -0
- package/dist/esm/components-page/password-reset.js +42 -0
- package/dist/esm/components-page/sign-in.js +12 -0
- package/dist/esm/components-page/sign-out.js +18 -0
- package/dist/esm/components-page/sign-up.js +12 -0
- package/dist/esm/components-page/stack-handler.js +75 -0
- package/dist/esm/index.js +47 -0
- package/dist/esm/joy.js +5 -0
- package/dist/esm/lib/auth.js +62 -0
- package/dist/esm/lib/cookie.js +185 -0
- package/dist/esm/lib/hooks.js +29 -0
- package/dist/esm/lib/stack-app.js +940 -0
- package/dist/esm/providers/component-provider.js +76 -0
- package/dist/esm/providers/design-provider.js +36 -0
- package/dist/esm/providers/joy-provider.js +35 -0
- package/dist/esm/providers/stack-provider-client.js +31 -0
- package/dist/esm/providers/stack-provider.js +21 -0
- package/dist/esm/providers/styled-components-registry.js +24 -0
- package/dist/esm/providers/theme-provider.js +22 -0
- package/dist/esm/utils/browser-script.js +25 -0
- package/dist/esm/utils/constants.js +34 -0
- package/dist/esm/utils/email.js +10 -0
- package/dist/esm/utils/next.js +7 -0
- package/dist/esm/utils/url.js +21 -0
- package/dist/index.d.mts +37 -0
- package/dist/index.d.ts +37 -22
- package/dist/index.js +106 -21
- package/dist/joy.d.mts +16 -0
- package/dist/joy.d.ts +16 -1
- package/dist/joy.js +30 -1
- package/dist/lib/auth.d.mts +11 -0
- package/dist/lib/auth.d.ts +8 -4
- package/dist/lib/auth.js +83 -57
- package/dist/lib/cookie.d.mts +14 -0
- package/dist/lib/cookie.d.ts +8 -6
- package/dist/lib/cookie.js +217 -45
- package/dist/lib/hooks.d.mts +35 -0
- package/dist/lib/hooks.d.ts +14 -8
- package/dist/lib/hooks.js +53 -28
- package/dist/lib/stack-app.d.mts +227 -0
- package/dist/lib/stack-app.d.ts +43 -41
- package/dist/lib/stack-app.js +937 -849
- package/dist/providers/component-provider.d.mts +113 -0
- package/dist/providers/component-provider.d.ts +95 -77
- package/dist/providers/component-provider.js +92 -58
- package/dist/providers/design-provider.d.mts +34 -0
- package/dist/providers/design-provider.d.ts +16 -21
- package/dist/providers/design-provider.js +57 -58
- package/dist/providers/joy-provider.d.mts +36 -0
- package/dist/providers/joy-provider.d.ts +30 -14
- package/dist/providers/joy-provider.js +58 -30
- package/dist/providers/stack-provider-client.d.mts +20 -0
- package/dist/providers/stack-provider-client.d.ts +15 -8
- package/dist/providers/stack-provider-client.js +64 -20
- package/dist/providers/stack-provider.d.mts +14 -0
- package/dist/providers/stack-provider.d.ts +13 -5
- package/dist/providers/stack-provider.js +39 -8
- package/dist/providers/styled-components-registry.d.mts +8 -0
- package/dist/providers/styled-components-registry.d.ts +8 -4
- package/dist/providers/styled-components-registry.js +43 -17
- package/dist/providers/theme-provider.d.mts +22 -0
- package/dist/providers/theme-provider.d.ts +21 -9
- package/dist/providers/theme-provider.js +55 -19
- package/dist/utils/browser-script.d.mts +5 -0
- package/dist/utils/browser-script.d.ts +5 -0
- package/dist/utils/browser-script.js +50 -0
- package/dist/utils/constants.d.mts +48 -0
- package/dist/utils/constants.d.ts +11 -9
- package/dist/utils/constants.js +66 -21
- package/dist/utils/email.d.mts +3 -0
- package/dist/utils/email.d.ts +3 -1
- package/dist/utils/email.js +44 -6
- package/dist/utils/next.d.mts +3 -0
- package/dist/utils/next.d.ts +3 -1
- package/dist/utils/next.js +31 -3
- package/dist/utils/url.d.mts +4 -0
- package/dist/utils/url.d.ts +4 -2
- package/dist/utils/url.js +44 -13
- package/package.json +19 -10
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/oauth-button.tsx
|
|
5
|
+
import { FaGithub, FaFacebook, FaApple } from "react-icons/fa";
|
|
6
|
+
import { useStackApp } from "..";
|
|
7
|
+
import { Button } from "../components-core";
|
|
8
|
+
import { useDesign } from "../providers/design-provider";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
var iconSize = 22;
|
|
11
|
+
function OAuthButton({
|
|
12
|
+
provider,
|
|
13
|
+
type
|
|
14
|
+
}) {
|
|
15
|
+
const { colors } = useDesign();
|
|
16
|
+
const stackApp = useStackApp();
|
|
17
|
+
let style;
|
|
18
|
+
switch (provider) {
|
|
19
|
+
case "google": {
|
|
20
|
+
style = {
|
|
21
|
+
backgroundColor: "#fff",
|
|
22
|
+
name: "Google",
|
|
23
|
+
border: "1px solid #ccc",
|
|
24
|
+
icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 24 24", children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
"path",
|
|
27
|
+
{
|
|
28
|
+
fill: "#4285F4",
|
|
29
|
+
d: "M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"path",
|
|
34
|
+
{
|
|
35
|
+
fill: "#34A853",
|
|
36
|
+
d: "M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ jsx(
|
|
40
|
+
"path",
|
|
41
|
+
{
|
|
42
|
+
fill: "#FBBC05",
|
|
43
|
+
d: "M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
"path",
|
|
48
|
+
{
|
|
49
|
+
fill: "#EA4335",
|
|
50
|
+
d: "M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ jsx("path", { fill: "none", d: "M1 1h22v22H1z" })
|
|
54
|
+
] })
|
|
55
|
+
};
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
case "github": {
|
|
59
|
+
style = {
|
|
60
|
+
backgroundColor: "#111",
|
|
61
|
+
border: "1px solid #444",
|
|
62
|
+
name: "GitHub",
|
|
63
|
+
icon: /* @__PURE__ */ jsx(FaGithub, { color: "#fff", size: iconSize })
|
|
64
|
+
};
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
case "facebook": {
|
|
68
|
+
style = {
|
|
69
|
+
backgroundColor: "#1877F2",
|
|
70
|
+
name: "Facebook",
|
|
71
|
+
icon: /* @__PURE__ */ jsx(FaFacebook, { color: "#fff", size: iconSize })
|
|
72
|
+
};
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
case "apple": {
|
|
76
|
+
style = {
|
|
77
|
+
backgroundColor: "#000",
|
|
78
|
+
name: "Apple",
|
|
79
|
+
icon: /* @__PURE__ */ jsx(FaApple, { color: "#fff", size: iconSize })
|
|
80
|
+
};
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case "microsoft": {
|
|
84
|
+
style = {
|
|
85
|
+
backgroundColor: "#2f2f2f",
|
|
86
|
+
name: "Microsoft",
|
|
87
|
+
icon: /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 21 21", children: [
|
|
88
|
+
/* @__PURE__ */ jsx("title", { children: "MS-SymbolLockup" }),
|
|
89
|
+
/* @__PURE__ */ jsx("path", { fill: "#f25022", d: "M1 1h9v9H1z" }),
|
|
90
|
+
/* @__PURE__ */ jsx("path", { fill: "#00a4ef", d: "M1 11h9v9H1z" }),
|
|
91
|
+
/* @__PURE__ */ jsx("path", { fill: "#7fba00", d: "M11 1h9v9h-9z" }),
|
|
92
|
+
/* @__PURE__ */ jsx("path", { fill: "#ffb900", d: "M11 11h9v9h-9z" })
|
|
93
|
+
] })
|
|
94
|
+
};
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
default: {
|
|
98
|
+
style = {
|
|
99
|
+
backgroundColor: "#000",
|
|
100
|
+
name: provider,
|
|
101
|
+
icon: null
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
Button,
|
|
107
|
+
{
|
|
108
|
+
color: style.backgroundColor,
|
|
109
|
+
style: { border: style.border },
|
|
110
|
+
onClick: () => stackApp.signInWithOAuth(provider),
|
|
111
|
+
children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", width: "100%" }, children: [
|
|
112
|
+
style.icon,
|
|
113
|
+
/* @__PURE__ */ jsxs("span", { style: { flexGrow: 1 }, children: [
|
|
114
|
+
type === "signup" ? "Sign up with " : "Sign in with ",
|
|
115
|
+
style.name
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsx("div", { style: { visibility: "hidden" }, children: style.icon })
|
|
118
|
+
] })
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
OAuthButton as default
|
|
124
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/oauth-group.tsx
|
|
5
|
+
import { useStackApp } from "../lib/hooks";
|
|
6
|
+
import OAuthButton from "./oauth-button";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
function OAuthGroup({
|
|
9
|
+
type
|
|
10
|
+
}) {
|
|
11
|
+
const stackApp = useStackApp();
|
|
12
|
+
const project = stackApp.useProject();
|
|
13
|
+
return /* @__PURE__ */ jsx("div", { style: { gap: "16px", display: "flex", flexDirection: "column", alignItems: "stretch" }, children: project.oauthProviders.filter((p) => p.enabled).map((p) => /* @__PURE__ */ jsx(OAuthButton, { provider: p.id, type }, p.id)) });
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
OAuthGroup as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/password-field.tsx
|
|
5
|
+
import { Input } from "../components-core";
|
|
6
|
+
import { forwardRef, useRef, useState } from "react";
|
|
7
|
+
import { HiEye, HiEyeOff } from "react-icons/hi";
|
|
8
|
+
import { useDesign } from "..";
|
|
9
|
+
import styled from "styled-components";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var getIconStyle = (colors) => `
|
|
12
|
+
color: ${colors.light.secondaryColor};
|
|
13
|
+
|
|
14
|
+
html[data-theme='dark'] & {
|
|
15
|
+
color: ${colors.dark.secondaryColor};
|
|
16
|
+
}
|
|
17
|
+
`;
|
|
18
|
+
var StyledEyeOff = styled(HiEyeOff)`${(props) => getIconStyle(props.colors)}`;
|
|
19
|
+
var StyledEye = styled(HiEye)`${(props) => getIconStyle(props.colors)}`;
|
|
20
|
+
var PasswordField = forwardRef(({ id, name, ...props }, ref) => {
|
|
21
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
22
|
+
const { colors } = useDesign();
|
|
23
|
+
const inputRef = useRef(null);
|
|
24
|
+
const mergeRef = (node) => {
|
|
25
|
+
if (ref) {
|
|
26
|
+
if (typeof ref === "function") {
|
|
27
|
+
ref(node);
|
|
28
|
+
} else {
|
|
29
|
+
ref.current = node;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
inputRef.current = node;
|
|
33
|
+
};
|
|
34
|
+
const onClickReveal = () => {
|
|
35
|
+
setIsOpen(!isOpen);
|
|
36
|
+
const currentInput = inputRef.current;
|
|
37
|
+
if (currentInput) {
|
|
38
|
+
currentInput.focus({ preventScroll: true });
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs("div", { style: { position: "relative", display: "flex" }, children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Input,
|
|
44
|
+
{
|
|
45
|
+
id,
|
|
46
|
+
ref: mergeRef,
|
|
47
|
+
name,
|
|
48
|
+
type: isOpen ? "text" : "password",
|
|
49
|
+
autoComplete: "current-password",
|
|
50
|
+
required: true,
|
|
51
|
+
style: { flex: 1 },
|
|
52
|
+
...props
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
"button",
|
|
57
|
+
{
|
|
58
|
+
tabIndex: -1,
|
|
59
|
+
type: "button",
|
|
60
|
+
style: {
|
|
61
|
+
position: "absolute",
|
|
62
|
+
backgroundColor: "transparent",
|
|
63
|
+
border: "none",
|
|
64
|
+
top: 0,
|
|
65
|
+
right: 0,
|
|
66
|
+
bottom: 0,
|
|
67
|
+
display: "flex",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
paddingRight: "12px"
|
|
70
|
+
},
|
|
71
|
+
onClick: onClickReveal,
|
|
72
|
+
"aria-label": isOpen ? "Mask password" : "Reveal password",
|
|
73
|
+
children: isOpen ? /* @__PURE__ */ jsx(StyledEyeOff, { colors }) : /* @__PURE__ */ jsx(StyledEye, { colors })
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] });
|
|
77
|
+
});
|
|
78
|
+
PasswordField.displayName = "PasswordField";
|
|
79
|
+
var password_field_default = PasswordField;
|
|
80
|
+
export {
|
|
81
|
+
password_field_default as default
|
|
82
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/password-reset-inner.tsx
|
|
5
|
+
import { useState } from "react";
|
|
6
|
+
import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
|
|
7
|
+
import { useStackApp } from "..";
|
|
8
|
+
import PasswordField from "./password-field";
|
|
9
|
+
import FormWarningText from "./form-warning";
|
|
10
|
+
import RedirectMessageCard from "./redirect-message-card";
|
|
11
|
+
import MessageCard from "./message-card";
|
|
12
|
+
import CardFrame from "./card-frame";
|
|
13
|
+
import { Button, Label, Text } from "../components-core";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
function PasswordResetInner({ code, fullPage = false }) {
|
|
16
|
+
const [password, setPassword] = useState("");
|
|
17
|
+
const [passwordError, setPasswordError] = useState("");
|
|
18
|
+
const [passwordRepeat, setPasswordRepeat] = useState("");
|
|
19
|
+
const [passwordRepeatError, setPasswordRepeatError] = useState("");
|
|
20
|
+
const [finished, setFinished] = useState(false);
|
|
21
|
+
const [resetError, setResetError] = useState(false);
|
|
22
|
+
const stackApp = useStackApp();
|
|
23
|
+
const onSubmit = async () => {
|
|
24
|
+
if (!password) {
|
|
25
|
+
setPasswordError("Please enter your password");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (!passwordRepeat) {
|
|
29
|
+
setPasswordRepeatError("Please repeat your password");
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (password !== passwordRepeat) {
|
|
33
|
+
setPasswordRepeatError("Passwords do not match");
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const passwordError2 = getPasswordError(password);
|
|
37
|
+
if (passwordError2) {
|
|
38
|
+
setPasswordError(passwordError2.message);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const errorCode = await stackApp.resetPassword({ password, code });
|
|
42
|
+
if (errorCode) {
|
|
43
|
+
setResetError(true);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setFinished(true);
|
|
47
|
+
};
|
|
48
|
+
if (finished) {
|
|
49
|
+
return /* @__PURE__ */ jsx(RedirectMessageCard, { type: "passwordReset", fullPage });
|
|
50
|
+
}
|
|
51
|
+
if (resetError) {
|
|
52
|
+
return /* @__PURE__ */ jsx(MessageCard, { title: "Failed to reset password", fullPage, children: /* @__PURE__ */ jsx(Text, { children: "Failed to reset password. Please request a new password reset link" }) });
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ jsxs(CardFrame, { fullPage, children: [
|
|
55
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "center", marginBottom: "1.5rem" }, children: /* @__PURE__ */ jsx(Text, { size: "xl", as: "h2", children: "Reset Your Password" }) }),
|
|
56
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "stretch" }, children: [
|
|
57
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "password", children: "New Password" }),
|
|
58
|
+
/* @__PURE__ */ jsx(
|
|
59
|
+
PasswordField,
|
|
60
|
+
{
|
|
61
|
+
id: "password",
|
|
62
|
+
name: "password",
|
|
63
|
+
value: password,
|
|
64
|
+
onChange: (e) => {
|
|
65
|
+
setPassword(e.target.value);
|
|
66
|
+
setPasswordError("");
|
|
67
|
+
setPasswordRepeatError("");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(FormWarningText, { text: passwordError }),
|
|
72
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "repeat-password", style: { marginTop: "1rem" }, children: "Repeat New Password" }),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
PasswordField,
|
|
75
|
+
{
|
|
76
|
+
id: "repeat-password",
|
|
77
|
+
name: "repeat-password",
|
|
78
|
+
value: passwordRepeat,
|
|
79
|
+
onChange: (e) => {
|
|
80
|
+
setPasswordRepeat(e.target.value);
|
|
81
|
+
setPasswordError("");
|
|
82
|
+
setPasswordRepeatError("");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsx(FormWarningText, { text: passwordRepeatError }),
|
|
87
|
+
/* @__PURE__ */ jsx(Button, { style: { marginTop: "1.5rem" }, onClick: () => onSubmit(), children: "Reset Password" })
|
|
88
|
+
] })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
PasswordResetInner as default
|
|
93
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/redirect-message-card.tsx
|
|
5
|
+
import { useRouter } from "next/navigation";
|
|
6
|
+
import { useStackApp } from "..";
|
|
7
|
+
import MessageCard from "./message-card";
|
|
8
|
+
import { Text, Button } from "../components-core";
|
|
9
|
+
import { neverResolve } from "@stackframe/stack-shared/dist/utils/promises";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
function RedirectMessageCard({
|
|
12
|
+
type,
|
|
13
|
+
fullPage = false
|
|
14
|
+
}) {
|
|
15
|
+
const stackApp = useStackApp();
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
let title;
|
|
18
|
+
let primaryUrl;
|
|
19
|
+
let secondaryUrl = null;
|
|
20
|
+
let message = null;
|
|
21
|
+
let primaryButton;
|
|
22
|
+
let secondaryButton = null;
|
|
23
|
+
switch (type) {
|
|
24
|
+
case "signedIn": {
|
|
25
|
+
title = "You are already signed in";
|
|
26
|
+
primaryUrl = stackApp.urls.home;
|
|
27
|
+
secondaryUrl = stackApp.urls.signOut;
|
|
28
|
+
primaryButton = "Go to Home";
|
|
29
|
+
secondaryButton = "Sign Out";
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "signedOut": {
|
|
33
|
+
title = "You are not currently signed in.";
|
|
34
|
+
primaryUrl = stackApp.urls.home;
|
|
35
|
+
primaryButton = "Go to Home";
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case "emailSent": {
|
|
39
|
+
title = "Email sent!";
|
|
40
|
+
message = "Please check your inbox. Make sure to check your spam folder.";
|
|
41
|
+
primaryUrl = stackApp.urls.home;
|
|
42
|
+
primaryButton = "Go to Home";
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "passwordReset": {
|
|
46
|
+
title = "Password reset successfully!";
|
|
47
|
+
message = "Your password has been reset. You can now sign in with your new password.";
|
|
48
|
+
primaryUrl = stackApp.urls.signIn;
|
|
49
|
+
primaryButton = "Go to Sign In";
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "emailVerified": {
|
|
53
|
+
title = "Email verified!";
|
|
54
|
+
message = "Your have successfully verified your email.";
|
|
55
|
+
primaryUrl = stackApp.urls.home;
|
|
56
|
+
primaryButton = "Go to Home";
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return /* @__PURE__ */ jsxs(MessageCard, { title, fullPage, children: [
|
|
61
|
+
message && /* @__PURE__ */ jsx(Text, { children: message }),
|
|
62
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "16px", marginTop: 20 }, children: [
|
|
63
|
+
secondaryButton && /* @__PURE__ */ jsx(
|
|
64
|
+
Button,
|
|
65
|
+
{
|
|
66
|
+
variant: "secondary",
|
|
67
|
+
onClick: async () => {
|
|
68
|
+
router.push(stackApp.urls.signOut.toString());
|
|
69
|
+
await neverResolve();
|
|
70
|
+
},
|
|
71
|
+
children: secondaryButton
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx(Button, { onClick: async () => {
|
|
75
|
+
router.push(primaryUrl.toString());
|
|
76
|
+
await neverResolve();
|
|
77
|
+
}, children: primaryButton })
|
|
78
|
+
] })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
RedirectMessageCard as default
|
|
83
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/separator-with-text.tsx
|
|
5
|
+
import { Separator, Text } from "../components-core";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
function SeparatorWithText({ text }) {
|
|
8
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", marginTop: "1.5rem", marginBottom: "1.5rem" }, children: [
|
|
9
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(Separator, {}) }),
|
|
10
|
+
/* @__PURE__ */ jsx(Text, { style: { padding: "0 16px" }, variant: "secondary", size: "sm", children: text }),
|
|
11
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsx(Separator, {}) })
|
|
12
|
+
] });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
SeparatorWithText as default
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/components/user-avatar.tsx
|
|
2
|
+
import { RxPerson } from "react-icons/rx";
|
|
3
|
+
import { Avatar, AvatarFallback, AvatarImage, Text } from "..";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
function UserAvatar(props) {
|
|
6
|
+
const user = props.user;
|
|
7
|
+
return /* @__PURE__ */ jsxs(Avatar, { style: { height: props.size, width: props.size }, children: [
|
|
8
|
+
/* @__PURE__ */ jsx(AvatarImage, { src: user?.profileImageUrl || "" }),
|
|
9
|
+
/* @__PURE__ */ jsx(AvatarFallback, { children: user ? /* @__PURE__ */ jsx(Text, { style: { fontWeight: 500 }, children: (user?.displayName || user?.primaryEmail)?.slice(0, 2).toUpperCase() }) : /* @__PURE__ */ jsx(RxPerson, { size: props.size }) })
|
|
10
|
+
] });
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
UserAvatar as default
|
|
14
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
// src/components/user-button.tsx
|
|
5
|
+
import React, { Suspense } from "react";
|
|
6
|
+
import { useUser, Text, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, DropdownMenuLabel, DropdownMenuSeparator, useStackApp, Skeleton } from "..";
|
|
7
|
+
import { RxPerson, RxEnter, RxHalf2, RxFilePlus, RxPencil2 } from "react-icons/rx";
|
|
8
|
+
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
|
9
|
+
import { SECONDARY_FONT_COLORS } from "../utils/constants";
|
|
10
|
+
import UserAvatar from "./user-avatar";
|
|
11
|
+
import { useRouter } from "next/navigation";
|
|
12
|
+
import { typedEntries, typedFromEntries } from "@stackframe/stack-shared/dist/utils/objects";
|
|
13
|
+
import styled from "styled-components";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var icons = typedFromEntries(typedEntries({
|
|
16
|
+
RxPencil2,
|
|
17
|
+
RxPerson,
|
|
18
|
+
RxEnter,
|
|
19
|
+
RxHalf2,
|
|
20
|
+
RxFilePlus
|
|
21
|
+
}).map(([key, value]) => {
|
|
22
|
+
const styledComponent = styled(value)`
|
|
23
|
+
color: ${SECONDARY_FONT_COLORS.light};
|
|
24
|
+
|
|
25
|
+
html[data-theme='dark'] & {
|
|
26
|
+
color: ${SECONDARY_FONT_COLORS.dark};
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
return [
|
|
30
|
+
key,
|
|
31
|
+
React.createElement(styledComponent, { size: 20 })
|
|
32
|
+
];
|
|
33
|
+
}));
|
|
34
|
+
function Item(props) {
|
|
35
|
+
return /* @__PURE__ */ jsxs(
|
|
36
|
+
DropdownMenuItem,
|
|
37
|
+
{
|
|
38
|
+
onClick: () => runAsynchronously(props.onClick),
|
|
39
|
+
style: { display: "flex", gap: "0.5rem", alignItems: "center" },
|
|
40
|
+
children: [
|
|
41
|
+
props.icon,
|
|
42
|
+
/* @__PURE__ */ jsx(Text, { children: props.text })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function UserButton(props) {
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Suspense,
|
|
50
|
+
{
|
|
51
|
+
fallback: /* @__PURE__ */ jsx(Skeleton, { children: /* @__PURE__ */ jsx(UserButtonInnerInner, { ...props, user: null }) }),
|
|
52
|
+
children: /* @__PURE__ */ jsx(UserButtonInner, { ...props })
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function UserButtonInner(props) {
|
|
57
|
+
const user = useUser();
|
|
58
|
+
return /* @__PURE__ */ jsx(UserButtonInnerInner, { ...props, user });
|
|
59
|
+
}
|
|
60
|
+
function UserButtonInnerInner(props) {
|
|
61
|
+
const user = props.user;
|
|
62
|
+
const app = useStackApp();
|
|
63
|
+
const router = useRouter();
|
|
64
|
+
const textStyles = {
|
|
65
|
+
textOverflow: "ellipsis",
|
|
66
|
+
whiteSpace: "nowrap",
|
|
67
|
+
overflow: "hidden"
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(DropdownMenuTrigger, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
71
|
+
/* @__PURE__ */ jsx(UserAvatar, { user }),
|
|
72
|
+
user && props.showUserInfo && /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", justifyContent: "center" }, children: [
|
|
73
|
+
/* @__PURE__ */ jsx(Text, { style: textStyles, children: user.displayName }),
|
|
74
|
+
/* @__PURE__ */ jsx(Text, { style: { ...textStyles, fontWeight: 400 }, variant: "secondary", size: "sm", children: user.primaryEmail })
|
|
75
|
+
] })
|
|
76
|
+
] }) }),
|
|
77
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { style: { zIndex: 1500 }, children: [
|
|
78
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center" }, children: [
|
|
79
|
+
/* @__PURE__ */ jsx(UserAvatar, { user }),
|
|
80
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
81
|
+
user && /* @__PURE__ */ jsx(Text, { children: user.displayName }),
|
|
82
|
+
user && /* @__PURE__ */ jsx(Text, { variant: "secondary", size: "sm", style: { fontWeight: 400 }, children: user.primaryEmail }),
|
|
83
|
+
!user && /* @__PURE__ */ jsx(Text, { variant: "secondary", children: "Not signed in" })
|
|
84
|
+
] })
|
|
85
|
+
] }) }),
|
|
86
|
+
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
87
|
+
user && /* @__PURE__ */ jsx(
|
|
88
|
+
Item,
|
|
89
|
+
{
|
|
90
|
+
text: "Account settings",
|
|
91
|
+
onClick: () => runAsynchronously(router.push(app.urls.accountSettings)),
|
|
92
|
+
icon: icons.RxPerson
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
!user && /* @__PURE__ */ jsx(
|
|
96
|
+
Item,
|
|
97
|
+
{
|
|
98
|
+
text: "Sign in",
|
|
99
|
+
onClick: () => runAsynchronously(router.push(app.urls.signIn)),
|
|
100
|
+
icon: icons.RxPerson
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
!user && /* @__PURE__ */ jsx(
|
|
104
|
+
Item,
|
|
105
|
+
{
|
|
106
|
+
text: "Sign up",
|
|
107
|
+
onClick: () => runAsynchronously(router.push(app.urls.signUp)),
|
|
108
|
+
icon: icons.RxPencil2
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
user && props.extraItems && props.extraItems.map((item, index) => /* @__PURE__ */ jsx(Item, { ...item }, index)),
|
|
112
|
+
props.colorModeToggle && /* @__PURE__ */ jsx(
|
|
113
|
+
Item,
|
|
114
|
+
{
|
|
115
|
+
text: "Toggle theme",
|
|
116
|
+
onClick: props.colorModeToggle,
|
|
117
|
+
icon: icons.RxHalf2
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
user && /* @__PURE__ */ jsx(
|
|
121
|
+
Item,
|
|
122
|
+
{
|
|
123
|
+
text: "Sign out",
|
|
124
|
+
onClick: () => user.signOut(),
|
|
125
|
+
icon: icons.RxEnter
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
] })
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
export {
|
|
132
|
+
UserButton as default
|
|
133
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/components-core/avatar.tsx
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
4
|
+
import styled from "styled-components";
|
|
5
|
+
import { useDesign } from "..";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var StyledAvatar = styled(AvatarPrimitive.Root)`
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
height: 2rem;
|
|
11
|
+
width: 2rem;
|
|
12
|
+
flex-shrink: 0;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
border-radius: 9999px;
|
|
15
|
+
`;
|
|
16
|
+
var Avatar = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(StyledAvatar, { ref, className, ...props }));
|
|
17
|
+
Avatar.displayName = "Avatar";
|
|
18
|
+
var StyledAvatarImage = styled(AvatarPrimitive.Image)`
|
|
19
|
+
aspect-ratio: 1 / 1;
|
|
20
|
+
height: 100%;
|
|
21
|
+
width: 100%;
|
|
22
|
+
`;
|
|
23
|
+
var AvatarImage = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(StyledAvatarImage, { ref, className, ...props }));
|
|
24
|
+
AvatarImage.displayName = "AvatarImage";
|
|
25
|
+
var StyledAvatarFallback = styled(AvatarPrimitive.Fallback)`
|
|
26
|
+
display: flex;
|
|
27
|
+
height: 100%;
|
|
28
|
+
width: 100%;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
border-radius: 9999px;
|
|
32
|
+
|
|
33
|
+
background-color: ${({ $colors }) => $colors.light.secondaryColor};
|
|
34
|
+
|
|
35
|
+
html[data-theme='dark'] & {
|
|
36
|
+
background-color: ${({ $colors }) => $colors.dark.secondaryColor};
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
var AvatarFallback = React.forwardRef(({ className, ...props }, ref) => {
|
|
40
|
+
const { colors } = useDesign();
|
|
41
|
+
return /* @__PURE__ */ jsx(
|
|
42
|
+
StyledAvatarFallback,
|
|
43
|
+
{
|
|
44
|
+
ref,
|
|
45
|
+
className,
|
|
46
|
+
$colors: colors,
|
|
47
|
+
...props
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
AvatarFallback.displayName = "AvatarFallback";
|
|
52
|
+
export {
|
|
53
|
+
Avatar,
|
|
54
|
+
AvatarFallback,
|
|
55
|
+
AvatarImage
|
|
56
|
+
};
|