@contentgrowth/content-auth 0.2.1 → 0.2.2
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.
|
@@ -16,10 +16,12 @@ var AuthForm = ({
|
|
|
16
16
|
layout = "default",
|
|
17
17
|
socialPosition = "top",
|
|
18
18
|
view,
|
|
19
|
-
onSwitchMode
|
|
19
|
+
onSwitchMode,
|
|
20
|
+
defaultEmail = "",
|
|
21
|
+
lockEmail = false
|
|
20
22
|
}) => {
|
|
21
23
|
const [isLogin, setIsLogin] = useState(view !== "signup");
|
|
22
|
-
const [email, setEmail] = useState(
|
|
24
|
+
const [email, setEmail] = useState(defaultEmail);
|
|
23
25
|
const [password, setPassword] = useState("");
|
|
24
26
|
const [name, setName] = useState("");
|
|
25
27
|
const [loading, setLoading] = useState(false);
|
|
@@ -73,26 +75,29 @@ var AuthForm = ({
|
|
|
73
75
|
else if (width === "wide") widthClass = "ca-width-wide";
|
|
74
76
|
else widthClass = "ca-width-default";
|
|
75
77
|
const containerClass = `ca-container ${layout === "split" ? "ca-layout-split" : ""} ${widthClass} ${className || ""}`;
|
|
76
|
-
const renderSocials = () =>
|
|
77
|
-
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
/* @__PURE__ */ jsx("
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
const renderSocials = () => (
|
|
79
|
+
// Hide social logins when email is locked (e.g., invitation flow)
|
|
80
|
+
!lockEmail && socialProviders.length > 0 && /* @__PURE__ */ jsx("div", { className: socialClass, children: socialProviders.map((provider) => /* @__PURE__ */ jsxs(
|
|
81
|
+
"button",
|
|
82
|
+
{
|
|
83
|
+
type: "button",
|
|
84
|
+
className: `ca-button ca-button-social ca-button-${provider}`,
|
|
85
|
+
onClick: () => handleSocialLogin(provider),
|
|
86
|
+
disabled: loading,
|
|
87
|
+
children: [
|
|
88
|
+
provider === "google" && /* @__PURE__ */ jsx("svg", { className: "ca-icon", viewBox: "0 0 24 24", width: "20", height: "20", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxs("g", { transform: "matrix(1, 0, 0, 1, 27.009001, -39.238998)", children: [
|
|
89
|
+
/* @__PURE__ */ jsx("path", { fill: "#4285F4", d: "M -3.264 51.509 C -3.264 50.719 -3.334 49.969 -3.454 49.239 L -14.754 49.239 L -14.754 53.749 L -8.284 53.749 C -8.574 55.229 -9.424 56.479 -10.684 57.329 L -10.684 60.329 L -6.824 60.329 C -4.564 58.239 -3.264 55.159 -3.264 51.509 Z" }),
|
|
90
|
+
/* @__PURE__ */ jsx("path", { fill: "#34A853", d: "M -14.754 63.239 C -11.514 63.239 -8.804 62.159 -6.824 60.329 L -10.684 57.329 C -11.764 58.049 -13.134 58.489 -14.754 58.489 C -17.884 58.489 -20.534 56.379 -21.484 53.529 L -25.464 53.529 L -25.464 56.619 C -23.494 60.539 -19.444 63.239 -14.754 63.239 Z" }),
|
|
91
|
+
/* @__PURE__ */ jsx("path", { fill: "#FBBC05", d: "M -21.484 53.529 C -21.734 52.809 -21.864 52.039 -21.864 51.239 C -21.864 50.439 -21.734 49.669 -21.484 48.949 L -21.484 45.859 L -25.464 45.859 C -26.284 47.479 -26.754 49.299 -26.754 51.239 C -26.754 53.179 -26.284 54.999 -25.464 56.619 L -21.484 53.529 Z" }),
|
|
92
|
+
/* @__PURE__ */ jsx("path", { fill: "#EA4335", d: "M -14.754 43.989 C -12.984 43.989 -11.424 44.599 -10.174 45.789 L -6.744 42.359 C -8.804 40.429 -11.514 39.239 -14.754 39.239 C -19.444 39.239 -23.494 41.939 -25.464 45.859 L -21.484 48.949 C -20.534 46.099 -17.884 43.989 -14.754 43.989 Z" })
|
|
93
|
+
] }) }),
|
|
94
|
+
provider === "github" && /* @__PURE__ */ jsx("svg", { className: "ca-icon", viewBox: "0 0 24 24", width: "20", height: "20", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.604-3.369-1.34-3.369-1.34-.454-1.156-1.11-1.464-1.11-1.464-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.087 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.026A9.564 9.564 0 0 1 12 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0 0 22 12c0-5.523-4.477-10-10-10z", fill: "currentColor" }) }),
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "ca-btn-text", children: provider === "github" ? "GitHub" : "Google" })
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
provider
|
|
99
|
+
)) })
|
|
100
|
+
);
|
|
96
101
|
const renderForm = () => {
|
|
97
102
|
if (!mounted) {
|
|
98
103
|
return /* @__PURE__ */ jsx("div", { className: "ca-form", children: /* @__PURE__ */ jsxs("div", { className: "ca-input-group", style: { opacity: 0 }, children: [
|
|
@@ -122,9 +127,10 @@ var AuthForm = ({
|
|
|
122
127
|
{
|
|
123
128
|
id: "email",
|
|
124
129
|
type: "email",
|
|
125
|
-
className: "ca-input"
|
|
130
|
+
className: `ca-input ${lockEmail ? "ca-input-locked" : ""}`,
|
|
126
131
|
value: email,
|
|
127
|
-
onChange: (e) => setEmail(e.target.value),
|
|
132
|
+
onChange: (e) => !lockEmail && setEmail(e.target.value),
|
|
133
|
+
readOnly: lockEmail,
|
|
128
134
|
required: true
|
|
129
135
|
}
|
|
130
136
|
)
|
package/dist/frontend/index.d.ts
CHANGED
|
@@ -18,6 +18,10 @@ interface AuthFormProps {
|
|
|
18
18
|
layout?: 'default' | 'split';
|
|
19
19
|
socialPosition?: 'top' | 'bottom';
|
|
20
20
|
onSwitchMode?: () => void;
|
|
21
|
+
/** Pre-populate the email field (useful for invitation flows) */
|
|
22
|
+
defaultEmail?: string;
|
|
23
|
+
/** Lock the email field (readonly) and hide social logins */
|
|
24
|
+
lockEmail?: boolean;
|
|
21
25
|
}
|
|
22
26
|
declare const AuthForm: React.FC<AuthFormProps>;
|
|
23
27
|
|
package/dist/frontend/index.js
CHANGED
package/dist/index.js
CHANGED