@wordrhyme/shadcn-auth 1.0.60 → 2.0.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.
- package/README.md +154 -1
- package/dist/components/AuthCard.cjs +45 -0
- package/dist/components/AuthCard.d.cts +30 -0
- package/dist/components/AuthCard.d.ts +30 -0
- package/dist/components/AuthCard.js +42 -0
- package/dist/components/AuthForms.cjs +115 -0
- package/dist/components/AuthForms.d.cts +95 -0
- package/dist/components/AuthForms.d.ts +95 -0
- package/dist/components/AuthForms.js +112 -0
- package/dist/components/CompleteProfileForm.cjs +38 -0
- package/dist/components/CompleteProfileForm.d.cts +32 -0
- package/dist/components/CompleteProfileForm.d.ts +32 -0
- package/dist/components/CompleteProfileForm.js +36 -0
- package/dist/components/EmailOtpForm.cjs +181 -0
- package/dist/components/EmailOtpForm.d.cts +56 -0
- package/dist/components/EmailOtpForm.d.ts +56 -0
- package/dist/components/EmailOtpForm.js +176 -0
- package/dist/components/LegalNotice.cjs +37 -0
- package/dist/components/LegalNotice.d.cts +26 -0
- package/dist/components/LegalNotice.d.ts +26 -0
- package/dist/components/LegalNotice.js +35 -0
- package/dist/components/MagicLinkForm.cjs +119 -0
- package/dist/components/MagicLinkForm.d.cts +46 -0
- package/dist/components/MagicLinkForm.d.ts +46 -0
- package/dist/components/MagicLinkForm.js +115 -0
- package/dist/components/ProviderSignInButtons.cjs +65 -0
- package/dist/components/ProviderSignInButtons.d.cts +41 -0
- package/dist/components/ProviderSignInButtons.d.ts +41 -0
- package/dist/components/ProviderSignInButtons.js +62 -0
- package/dist/components/ResetPasswordForm.cjs +89 -0
- package/dist/components/ResetPasswordForm.d.cts +20 -0
- package/dist/components/ResetPasswordForm.d.ts +20 -0
- package/dist/components/ResetPasswordForm.js +85 -0
- package/dist/components/SignInForm.cjs +97 -0
- package/dist/components/SignInForm.d.cts +41 -0
- package/dist/components/SignInForm.d.ts +41 -0
- package/dist/components/SignInForm.js +93 -0
- package/dist/components/SignUpForm.cjs +123 -0
- package/dist/components/SignUpForm.d.cts +40 -0
- package/dist/components/SignUpForm.d.ts +40 -0
- package/dist/components/SignUpForm.js +119 -0
- package/dist/components/auth-pending/AuthButton.cjs +37 -0
- package/dist/components/auth-pending/AuthButton.d.cts +36 -0
- package/dist/components/auth-pending/AuthButton.d.ts +36 -0
- package/dist/components/auth-pending/AuthButton.js +34 -0
- package/dist/components/auth-pending/AuthPendingProvider.cjs +19 -0
- package/dist/components/auth-pending/AuthPendingProvider.d.cts +17 -0
- package/dist/components/auth-pending/AuthPendingProvider.d.ts +17 -0
- package/dist/components/auth-pending/AuthPendingProvider.js +17 -0
- package/dist/components/auth-pending/auth-pending-context.cjs +57 -0
- package/dist/components/auth-pending/auth-pending-context.d.cts +39 -0
- package/dist/components/auth-pending/auth-pending-context.d.ts +39 -0
- package/dist/components/auth-pending/auth-pending-context.js +52 -0
- package/dist/components/auth-pending/index.d.cts +3 -0
- package/dist/components/auth-pending/index.d.ts +3 -0
- package/dist/components/forms/AuthField.cjs +43 -0
- package/dist/components/forms/AuthField.d.cts +26 -0
- package/dist/components/forms/AuthField.d.ts +26 -0
- package/dist/components/forms/AuthField.js +40 -0
- package/dist/components/forms/CompleteProfileFields.cjs +63 -0
- package/dist/components/forms/CompleteProfileFields.d.cts +18 -0
- package/dist/components/forms/CompleteProfileFields.d.ts +18 -0
- package/dist/components/forms/CompleteProfileFields.js +60 -0
- package/dist/components/forms/EmailOtpCodeForm.cjs +78 -0
- package/dist/components/forms/EmailOtpCodeForm.d.cts +18 -0
- package/dist/components/forms/EmailOtpCodeForm.d.ts +18 -0
- package/dist/components/forms/EmailOtpCodeForm.js +75 -0
- package/dist/components/forms/EmailRequestForm.cjs +82 -0
- package/dist/components/forms/EmailRequestForm.d.cts +38 -0
- package/dist/components/forms/EmailRequestForm.d.ts +38 -0
- package/dist/components/forms/EmailRequestForm.js +79 -0
- package/dist/components/forms/SignInCredentialsForm.cjs +79 -0
- package/dist/components/forms/SignInCredentialsForm.d.cts +18 -0
- package/dist/components/forms/SignInCredentialsForm.d.ts +18 -0
- package/dist/components/forms/SignInCredentialsForm.js +76 -0
- package/dist/components/forms/SignUpCredentialsForm.cjs +130 -0
- package/dist/components/forms/SignUpCredentialsForm.d.cts +24 -0
- package/dist/components/forms/SignUpCredentialsForm.d.ts +24 -0
- package/dist/components/forms/SignUpCredentialsForm.js +126 -0
- package/dist/components/index.d.cts +25 -0
- package/dist/components/index.d.ts +25 -0
- package/dist/components/provider-icon/ProviderIcon.cjs +82 -0
- package/dist/components/provider-icon/ProviderIcon.d.cts +21 -0
- package/dist/components/provider-icon/ProviderIcon.d.ts +21 -0
- package/dist/components/provider-icon/ProviderIcon.js +79 -0
- package/dist/components/sign-in-methods/SignInMethodRow.cjs +55 -0
- package/dist/components/sign-in-methods/SignInMethodRow.d.cts +31 -0
- package/dist/components/sign-in-methods/SignInMethodRow.d.ts +31 -0
- package/dist/components/sign-in-methods/SignInMethodRow.js +50 -0
- package/dist/components/sign-in-methods/SignInMethods.cjs +45 -0
- package/dist/components/sign-in-methods/SignInMethods.d.cts +26 -0
- package/dist/components/sign-in-methods/SignInMethods.d.ts +26 -0
- package/dist/components/sign-in-methods/SignInMethods.js +43 -0
- package/dist/components/sign-in-methods/SignInMethodsList.cjs +69 -0
- package/dist/components/sign-in-methods/SignInMethodsList.d.cts +47 -0
- package/dist/components/sign-in-methods/SignInMethodsList.d.ts +47 -0
- package/dist/components/sign-in-methods/SignInMethodsList.js +65 -0
- package/dist/components/sign-in-methods/sign-in-methods-copy.cjs +13 -0
- package/dist/components/sign-in-methods/sign-in-methods-copy.d.cts +11 -0
- package/dist/components/sign-in-methods/sign-in-methods-copy.d.ts +11 -0
- package/dist/components/sign-in-methods/sign-in-methods-copy.js +12 -0
- package/dist/constants/auth-providers.cjs +33 -0
- package/dist/constants/auth-providers.d.cts +14 -0
- package/dist/constants/auth-providers.d.ts +14 -0
- package/dist/constants/auth-providers.js +31 -0
- package/dist/constants/validation.cjs +21 -0
- package/dist/constants/validation.d.cts +17 -0
- package/dist/constants/validation.d.ts +17 -0
- package/dist/constants/validation.js +18 -0
- package/dist/hooks/use-pending-action.cjs +37 -0
- package/dist/hooks/use-pending-action.d.cts +26 -0
- package/dist/hooks/use-pending-action.d.ts +26 -0
- package/dist/hooks/use-pending-action.js +35 -0
- package/dist/hooks/use-reset-on-page-restore.cjs +35 -0
- package/dist/hooks/use-reset-on-page-restore.d.cts +15 -0
- package/dist/hooks/use-reset-on-page-restore.d.ts +15 -0
- package/dist/hooks/use-reset-on-page-restore.js +33 -0
- package/dist/index.cjs +67 -7
- package/dist/index.d.cts +34 -6
- package/dist/index.d.ts +34 -6
- package/dist/index.js +33 -6
- package/dist/utils/build-sign-in-method-rows.cjs +25 -0
- package/dist/utils/build-sign-in-method-rows.d.cts +26 -0
- package/dist/utils/build-sign-in-method-rows.d.ts +26 -0
- package/dist/utils/build-sign-in-method-rows.js +24 -0
- package/dist/utils/until-navigation.cjs +22 -0
- package/dist/utils/until-navigation.d.cts +18 -0
- package/dist/utils/until-navigation.d.ts +18 -0
- package/dist/utils/until-navigation.js +21 -0
- package/dist/utils/validate-email.cjs +22 -0
- package/dist/utils/validate-email.d.cts +14 -0
- package/dist/utils/validate-email.d.ts +14 -0
- package/dist/utils/validate-email.js +21 -0
- package/dist/utils/validate-password.cjs +16 -0
- package/dist/utils/validate-password.d.cts +9 -0
- package/dist/utils/validate-password.d.ts +9 -0
- package/dist/utils/validate-password.js +16 -0
- package/package.json +16 -9
- package/dist/AuthForms.cjs +0 -47
- package/dist/AuthForms.d.cts +0 -23
- package/dist/AuthForms.d.ts +0 -23
- package/dist/AuthForms.js +0 -44
- package/dist/GoogleSignIn.cjs +0 -46
- package/dist/GoogleSignIn.d.cts +0 -10
- package/dist/GoogleSignIn.d.ts +0 -10
- package/dist/GoogleSignIn.js +0 -42
- package/dist/ResetPasswordForm.cjs +0 -106
- package/dist/ResetPasswordForm.d.cts +0 -17
- package/dist/ResetPasswordForm.d.ts +0 -17
- package/dist/ResetPasswordForm.js +0 -100
- package/dist/SignInForm.cjs +0 -164
- package/dist/SignInForm.d.cts +0 -21
- package/dist/SignInForm.d.ts +0 -21
- package/dist/SignInForm.js +0 -159
- package/dist/SignUpForm.cjs +0 -154
- package/dist/SignUpForm.d.cts +0 -19
- package/dist/SignUpForm.d.ts +0 -19
- package/dist/SignUpForm.js +0 -149
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import * as react_jsx_runtime9 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/forms/SignUpCredentialsForm.d.ts
|
|
5
|
+
interface SignUpCredentialsFormProps {
|
|
6
|
+
onSignUp: (email: string, password: string) => Promise<void>;
|
|
7
|
+
privacyPolicyUrl: string;
|
|
8
|
+
privacyNotice?: React.ReactNode;
|
|
9
|
+
termsUrl: string;
|
|
10
|
+
/** Minimum age stated by the Terms; shown in the acceptance line. */
|
|
11
|
+
minimumAge?: number;
|
|
12
|
+
onConsentGiven?: () => void;
|
|
13
|
+
}
|
|
14
|
+
/** The account-details half of the sign-up card: credentials and the consent it needs. */
|
|
15
|
+
declare function SignUpCredentialsForm({
|
|
16
|
+
onSignUp,
|
|
17
|
+
privacyPolicyUrl,
|
|
18
|
+
privacyNotice,
|
|
19
|
+
termsUrl,
|
|
20
|
+
minimumAge,
|
|
21
|
+
onConsentGiven
|
|
22
|
+
}: SignUpCredentialsFormProps): react_jsx_runtime9.JSX.Element;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { SignUpCredentialsForm, SignUpCredentialsFormProps };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { AUTH_SUBMIT_ACTION, useAuthPending } from "../auth-pending/auth-pending-context.js";
|
|
5
|
+
import { AuthButton } from "../auth-pending/AuthButton.js";
|
|
6
|
+
import { DEFAULT_MINIMUM_AGE } from "../../constants/validation.js";
|
|
7
|
+
import { AuthField } from "./AuthField.js";
|
|
8
|
+
import { validateEmailValue } from "../../utils/validate-email.js";
|
|
9
|
+
import { LegalNotice } from "../LegalNotice.js";
|
|
10
|
+
import { validatePasswordValue } from "../../utils/validate-password.js";
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Label } from "@wordrhyme/shadcn";
|
|
14
|
+
|
|
15
|
+
//#region src/components/forms/SignUpCredentialsForm.tsx
|
|
16
|
+
/** The account-details half of the sign-up card: credentials and the consent it needs. */
|
|
17
|
+
function SignUpCredentialsForm({ onSignUp, privacyPolicyUrl, privacyNotice, termsUrl, minimumAge = DEFAULT_MINIMUM_AGE, onConsentGiven }) {
|
|
18
|
+
const [email, setEmail] = useState("");
|
|
19
|
+
const [password, setPassword] = useState("");
|
|
20
|
+
const [emailError, setEmailError] = useState("");
|
|
21
|
+
const [passwordError, setPasswordError] = useState("");
|
|
22
|
+
const [consentChecked, setConsentChecked] = useState(false);
|
|
23
|
+
const [consentError, setConsentError] = useState("");
|
|
24
|
+
const pending = useAuthPending();
|
|
25
|
+
const isSubmitting = pending.pendingKey === AUTH_SUBMIT_ACTION;
|
|
26
|
+
const handleSubmit = (e) => {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
const emailMessage = validateEmailValue(email);
|
|
29
|
+
setEmailError(emailMessage ?? "");
|
|
30
|
+
const passwordMessage = validatePasswordValue(password);
|
|
31
|
+
setPasswordError(passwordMessage ?? "");
|
|
32
|
+
if (emailMessage != null || passwordMessage != null) return;
|
|
33
|
+
if (!consentChecked) {
|
|
34
|
+
setConsentError("You must accept the Terms of Service to create an account.");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setConsentError("");
|
|
38
|
+
onConsentGiven?.();
|
|
39
|
+
pending.run(AUTH_SUBMIT_ACTION, async () => onSignUp(email, password));
|
|
40
|
+
};
|
|
41
|
+
return /* @__PURE__ */ jsxs("form", {
|
|
42
|
+
onSubmit: handleSubmit,
|
|
43
|
+
className: "space-y-4",
|
|
44
|
+
noValidate: true,
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(AuthField, {
|
|
47
|
+
id: "email",
|
|
48
|
+
label: "Email",
|
|
49
|
+
type: "email",
|
|
50
|
+
value: email,
|
|
51
|
+
onChange: (e) => {
|
|
52
|
+
setEmail(e.target.value);
|
|
53
|
+
if (emailError) setEmailError("");
|
|
54
|
+
},
|
|
55
|
+
error: emailError,
|
|
56
|
+
required: true
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx(AuthField, {
|
|
59
|
+
id: "password",
|
|
60
|
+
label: "Password",
|
|
61
|
+
type: "password",
|
|
62
|
+
value: password,
|
|
63
|
+
onChange: (e) => {
|
|
64
|
+
setPassword(e.target.value);
|
|
65
|
+
if (passwordError) setPasswordError("");
|
|
66
|
+
},
|
|
67
|
+
error: passwordError,
|
|
68
|
+
required: true
|
|
69
|
+
}),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: "mt-4 flex items-start gap-2",
|
|
72
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
73
|
+
type: "checkbox",
|
|
74
|
+
id: "consent",
|
|
75
|
+
checked: consentChecked,
|
|
76
|
+
onChange: (e) => {
|
|
77
|
+
setConsentChecked(e.target.checked);
|
|
78
|
+
if (e.target.checked) setConsentError("");
|
|
79
|
+
},
|
|
80
|
+
disabled: pending.isBusy,
|
|
81
|
+
"aria-describedby": "consent-privacy-note",
|
|
82
|
+
"aria-invalid": consentError !== "",
|
|
83
|
+
className: "border-input text-primary focus-visible:ring-ring mt-1 h-4 w-4 shrink-0 rounded focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none"
|
|
84
|
+
}), /* @__PURE__ */ jsxs(Label, {
|
|
85
|
+
htmlFor: "consent",
|
|
86
|
+
className: "block min-w-0 flex-1 text-sm leading-relaxed",
|
|
87
|
+
children: [
|
|
88
|
+
"I accept the",
|
|
89
|
+
" ",
|
|
90
|
+
/* @__PURE__ */ jsx("a", {
|
|
91
|
+
href: termsUrl,
|
|
92
|
+
target: "_blank",
|
|
93
|
+
rel: "noopener noreferrer",
|
|
94
|
+
className: "text-primary underline",
|
|
95
|
+
children: "Terms of Service"
|
|
96
|
+
}),
|
|
97
|
+
" ",
|
|
98
|
+
"and confirm I am at least ",
|
|
99
|
+
minimumAge,
|
|
100
|
+
" years old."
|
|
101
|
+
]
|
|
102
|
+
})]
|
|
103
|
+
}),
|
|
104
|
+
consentError && /* @__PURE__ */ jsx("p", {
|
|
105
|
+
className: "text-destructive text-sm",
|
|
106
|
+
role: "alert",
|
|
107
|
+
children: consentError
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ jsx(LegalNotice, {
|
|
110
|
+
id: "consent-privacy-note",
|
|
111
|
+
privacyPolicyUrl,
|
|
112
|
+
notice: privacyNotice
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx(AuthButton, {
|
|
115
|
+
type: "submit",
|
|
116
|
+
className: "mt-6 w-full",
|
|
117
|
+
actionKey: AUTH_SUBMIT_ACTION,
|
|
118
|
+
disabled: !consentChecked,
|
|
119
|
+
children: isSubmitting ? "Signing Up..." : "Sign Up"
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
//#endregion
|
|
126
|
+
export { SignUpCredentialsForm };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AUTH_SUBMIT_ACTION, AuthPendingContext, AuthPendingValue, useAuthPending, useAuthPendingState } from "./auth-pending/auth-pending-context.cjs";
|
|
2
|
+
import { AuthButton, AuthButtonProps } from "./auth-pending/AuthButton.cjs";
|
|
3
|
+
import { AuthPendingProvider, AuthPendingProviderProps } from "./auth-pending/AuthPendingProvider.cjs";
|
|
4
|
+
import "./auth-pending/index.cjs";
|
|
5
|
+
import { AuthCard, AuthCardProps } from "./AuthCard.cjs";
|
|
6
|
+
import { ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers } from "./ProviderSignInButtons.cjs";
|
|
7
|
+
import { AuthForms, AuthFormsProps, AuthMode } from "./AuthForms.cjs";
|
|
8
|
+
import { CompleteProfileForm, CompleteProfileFormProps } from "./CompleteProfileForm.cjs";
|
|
9
|
+
import { EmailOtpForm, EmailOtpFormProps } from "./EmailOtpForm.cjs";
|
|
10
|
+
import { AuthField, AuthFieldProps } from "./forms/AuthField.cjs";
|
|
11
|
+
import { CompleteProfileFields, CompleteProfileFieldsProps } from "./forms/CompleteProfileFields.cjs";
|
|
12
|
+
import { EmailOtpCodeForm, EmailOtpCodeFormProps } from "./forms/EmailOtpCodeForm.cjs";
|
|
13
|
+
import { EmailRequestForm, EmailRequestFormProps } from "./forms/EmailRequestForm.cjs";
|
|
14
|
+
import { SignInCredentialsForm, SignInCredentialsFormProps } from "./forms/SignInCredentialsForm.cjs";
|
|
15
|
+
import { SignUpCredentialsForm, SignUpCredentialsFormProps } from "./forms/SignUpCredentialsForm.cjs";
|
|
16
|
+
import { LegalNotice, LegalNoticeProps } from "./LegalNotice.cjs";
|
|
17
|
+
import { MagicLinkForm, MagicLinkFormProps } from "./MagicLinkForm.cjs";
|
|
18
|
+
import { ProviderIcon, ProviderIconProps } from "./provider-icon/ProviderIcon.cjs";
|
|
19
|
+
import { ResetPasswordForm, ResetPasswordFormProps } from "./ResetPasswordForm.cjs";
|
|
20
|
+
import { SIGN_IN_METHODS_COPY } from "./sign-in-methods/sign-in-methods-copy.cjs";
|
|
21
|
+
import { SignInMethodRow, SignInMethodRowProps } from "./sign-in-methods/SignInMethodRow.cjs";
|
|
22
|
+
import { SignInMethodsList, SignInMethodsListProps } from "./sign-in-methods/SignInMethodsList.cjs";
|
|
23
|
+
import { SignInMethods, SignInMethodsProps } from "./sign-in-methods/SignInMethods.cjs";
|
|
24
|
+
import { SignInForm, SignInFormProps } from "./SignInForm.cjs";
|
|
25
|
+
import { SignUpForm, SignUpFormProps } from "./SignUpForm.cjs";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AUTH_SUBMIT_ACTION, AuthPendingContext, AuthPendingValue, useAuthPending, useAuthPendingState } from "./auth-pending/auth-pending-context.js";
|
|
2
|
+
import { AuthButton, AuthButtonProps } from "./auth-pending/AuthButton.js";
|
|
3
|
+
import { AuthPendingProvider, AuthPendingProviderProps } from "./auth-pending/AuthPendingProvider.js";
|
|
4
|
+
import "./auth-pending/index.js";
|
|
5
|
+
import { AuthCard, AuthCardProps } from "./AuthCard.js";
|
|
6
|
+
import { ProviderSignInButtons, ProviderSignInButtonsProps, ProviderSignInHandlers } from "./ProviderSignInButtons.js";
|
|
7
|
+
import { AuthForms, AuthFormsProps, AuthMode } from "./AuthForms.js";
|
|
8
|
+
import { CompleteProfileForm, CompleteProfileFormProps } from "./CompleteProfileForm.js";
|
|
9
|
+
import { EmailOtpForm, EmailOtpFormProps } from "./EmailOtpForm.js";
|
|
10
|
+
import { AuthField, AuthFieldProps } from "./forms/AuthField.js";
|
|
11
|
+
import { CompleteProfileFields, CompleteProfileFieldsProps } from "./forms/CompleteProfileFields.js";
|
|
12
|
+
import { EmailOtpCodeForm, EmailOtpCodeFormProps } from "./forms/EmailOtpCodeForm.js";
|
|
13
|
+
import { EmailRequestForm, EmailRequestFormProps } from "./forms/EmailRequestForm.js";
|
|
14
|
+
import { SignInCredentialsForm, SignInCredentialsFormProps } from "./forms/SignInCredentialsForm.js";
|
|
15
|
+
import { SignUpCredentialsForm, SignUpCredentialsFormProps } from "./forms/SignUpCredentialsForm.js";
|
|
16
|
+
import { LegalNotice, LegalNoticeProps } from "./LegalNotice.js";
|
|
17
|
+
import { MagicLinkForm, MagicLinkFormProps } from "./MagicLinkForm.js";
|
|
18
|
+
import { ProviderIcon, ProviderIconProps } from "./provider-icon/ProviderIcon.js";
|
|
19
|
+
import { ResetPasswordForm, ResetPasswordFormProps } from "./ResetPasswordForm.js";
|
|
20
|
+
import { SIGN_IN_METHODS_COPY } from "./sign-in-methods/sign-in-methods-copy.js";
|
|
21
|
+
import { SignInMethodRow, SignInMethodRowProps } from "./sign-in-methods/SignInMethodRow.js";
|
|
22
|
+
import { SignInMethodsList, SignInMethodsListProps } from "./sign-in-methods/SignInMethodsList.js";
|
|
23
|
+
import { SignInMethods, SignInMethodsProps } from "./sign-in-methods/SignInMethods.js";
|
|
24
|
+
import { SignInForm, SignInFormProps } from "./SignInForm.js";
|
|
25
|
+
import { SignUpForm, SignUpFormProps } from "./SignUpForm.js";
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
3
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
4
|
+
let lucide_react = require("lucide-react");
|
|
5
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
6
|
+
|
|
7
|
+
//#region src/components/provider-icon/ProviderIcon.tsx
|
|
8
|
+
function GoogleIcon({ className }) {
|
|
9
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
10
|
+
className,
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
15
|
+
fill: "#4285F4",
|
|
16
|
+
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"
|
|
17
|
+
}),
|
|
18
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
19
|
+
fill: "#34A853",
|
|
20
|
+
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"
|
|
21
|
+
}),
|
|
22
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
23
|
+
fill: "#FBBC05",
|
|
24
|
+
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"
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
27
|
+
fill: "#EA4335",
|
|
28
|
+
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"
|
|
29
|
+
})
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function LinkedInIcon({ className }) {
|
|
34
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
|
|
35
|
+
className,
|
|
36
|
+
viewBox: "0 0 24 24",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
40
|
+
fill: "currentColor",
|
|
41
|
+
d: "M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.35V9h3.41v1.56h.05c.48-.9 1.63-1.85 3.36-1.85 3.6 0 4.27 2.37 4.27 5.45v6.29z"
|
|
42
|
+
}),
|
|
43
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
44
|
+
fill: "currentColor",
|
|
45
|
+
d: "M5.34 7.43a2.06 2.06 0 1 1 0-4.13 2.06 2.06 0 0 1 0 4.13z"
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
48
|
+
fill: "currentColor",
|
|
49
|
+
d: "M7.12 20.45H3.55V9h3.57v11.45z"
|
|
50
|
+
})
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function GitHubIcon({ className }) {
|
|
55
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
56
|
+
className,
|
|
57
|
+
viewBox: "0 0 24 24",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
|
|
60
|
+
fill: "currentColor",
|
|
61
|
+
d: "M12 .5A11.5 11.5 0 0 0 .5 12a11.5 11.5 0 0 0 7.86 10.92c.58.1.79-.25.79-.56v-2c-3.2.7-3.88-1.37-3.88-1.37-.53-1.34-1.29-1.7-1.29-1.7-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.2 1.77 1.2 1.03 1.77 2.7 1.26 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.23-1.28-5.23-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11 11 0 0 1 5.8 0c2.2-1.5 3.17-1.18 3.17-1.18.63 1.59.23 2.76.12 3.05.74.81 1.18 1.84 1.18 3.1 0 4.43-2.69 5.4-5.25 5.69.41.36.78 1.06.78 2.14v3.17c0 .31.21.67.8.56A11.5 11.5 0 0 0 23.5 12 11.5 11.5 0 0 0 12 .5z"
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const PROVIDER_ICONS = {
|
|
66
|
+
google: GoogleIcon,
|
|
67
|
+
linkedin_oidc: LinkedInIcon,
|
|
68
|
+
github: GitHubIcon
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The mark for a sign-in provider.
|
|
72
|
+
*
|
|
73
|
+
* One registry keeps the sign-in buttons and the account's sign-in-methods list
|
|
74
|
+
* showing the same thing, and a provider with no mark of its own falls back to
|
|
75
|
+
* a generic credential icon rather than rendering nothing.
|
|
76
|
+
*/
|
|
77
|
+
function ProviderIcon({ provider, className }) {
|
|
78
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PROVIDER_ICONS[provider] ?? lucide_react.KeyRound, { className });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
exports.ProviderIcon = ProviderIcon;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/components/provider-icon/ProviderIcon.d.ts
|
|
4
|
+
interface ProviderIconProps {
|
|
5
|
+
/** Supabase provider key, e.g. `'google'`. */
|
|
6
|
+
provider: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The mark for a sign-in provider.
|
|
11
|
+
*
|
|
12
|
+
* One registry keeps the sign-in buttons and the account's sign-in-methods list
|
|
13
|
+
* showing the same thing, and a provider with no mark of its own falls back to
|
|
14
|
+
* a generic credential icon rather than rendering nothing.
|
|
15
|
+
*/
|
|
16
|
+
declare function ProviderIcon({
|
|
17
|
+
provider,
|
|
18
|
+
className
|
|
19
|
+
}: ProviderIconProps): react_jsx_runtime12.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ProviderIcon, ProviderIconProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as react_jsx_runtime12 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/components/provider-icon/ProviderIcon.d.ts
|
|
4
|
+
interface ProviderIconProps {
|
|
5
|
+
/** Supabase provider key, e.g. `'google'`. */
|
|
6
|
+
provider: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The mark for a sign-in provider.
|
|
11
|
+
*
|
|
12
|
+
* One registry keeps the sign-in buttons and the account's sign-in-methods list
|
|
13
|
+
* showing the same thing, and a provider with no mark of its own falls back to
|
|
14
|
+
* a generic credential icon rather than rendering nothing.
|
|
15
|
+
*/
|
|
16
|
+
declare function ProviderIcon({
|
|
17
|
+
provider,
|
|
18
|
+
className
|
|
19
|
+
}: ProviderIconProps): react_jsx_runtime12.JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ProviderIcon, ProviderIconProps };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { KeyRound } from "lucide-react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/provider-icon/ProviderIcon.tsx
|
|
5
|
+
function GoogleIcon({ className }) {
|
|
6
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
7
|
+
className,
|
|
8
|
+
viewBox: "0 0 24 24",
|
|
9
|
+
"aria-hidden": "true",
|
|
10
|
+
children: [
|
|
11
|
+
/* @__PURE__ */ jsx("path", {
|
|
12
|
+
fill: "#4285F4",
|
|
13
|
+
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"
|
|
14
|
+
}),
|
|
15
|
+
/* @__PURE__ */ jsx("path", {
|
|
16
|
+
fill: "#34A853",
|
|
17
|
+
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"
|
|
18
|
+
}),
|
|
19
|
+
/* @__PURE__ */ jsx("path", {
|
|
20
|
+
fill: "#FBBC05",
|
|
21
|
+
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"
|
|
22
|
+
}),
|
|
23
|
+
/* @__PURE__ */ jsx("path", {
|
|
24
|
+
fill: "#EA4335",
|
|
25
|
+
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"
|
|
26
|
+
})
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function LinkedInIcon({ className }) {
|
|
31
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
32
|
+
className,
|
|
33
|
+
viewBox: "0 0 24 24",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsx("path", {
|
|
37
|
+
fill: "currentColor",
|
|
38
|
+
d: "M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.35V9h3.41v1.56h.05c.48-.9 1.63-1.85 3.36-1.85 3.6 0 4.27 2.37 4.27 5.45v6.29z"
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsx("path", {
|
|
41
|
+
fill: "currentColor",
|
|
42
|
+
d: "M5.34 7.43a2.06 2.06 0 1 1 0-4.13 2.06 2.06 0 0 1 0 4.13z"
|
|
43
|
+
}),
|
|
44
|
+
/* @__PURE__ */ jsx("path", {
|
|
45
|
+
fill: "currentColor",
|
|
46
|
+
d: "M7.12 20.45H3.55V9h3.57v11.45z"
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function GitHubIcon({ className }) {
|
|
52
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
53
|
+
className,
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
57
|
+
fill: "currentColor",
|
|
58
|
+
d: "M12 .5A11.5 11.5 0 0 0 .5 12a11.5 11.5 0 0 0 7.86 10.92c.58.1.79-.25.79-.56v-2c-3.2.7-3.88-1.37-3.88-1.37-.53-1.34-1.29-1.7-1.29-1.7-1.05-.72.08-.7.08-.7 1.16.08 1.77 1.2 1.77 1.2 1.03 1.77 2.7 1.26 3.36.96.1-.75.4-1.26.73-1.55-2.55-.29-5.23-1.28-5.23-5.7 0-1.26.45-2.29 1.19-3.1-.12-.29-.52-1.46.11-3.05 0 0 .97-.31 3.18 1.18a11 11 0 0 1 5.8 0c2.2-1.5 3.17-1.18 3.17-1.18.63 1.59.23 2.76.12 3.05.74.81 1.18 1.84 1.18 3.1 0 4.43-2.69 5.4-5.25 5.69.41.36.78 1.06.78 2.14v3.17c0 .31.21.67.8.56A11.5 11.5 0 0 0 23.5 12 11.5 11.5 0 0 0 12 .5z"
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const PROVIDER_ICONS = {
|
|
63
|
+
google: GoogleIcon,
|
|
64
|
+
linkedin_oidc: LinkedInIcon,
|
|
65
|
+
github: GitHubIcon
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The mark for a sign-in provider.
|
|
69
|
+
*
|
|
70
|
+
* One registry keeps the sign-in buttons and the account's sign-in-methods list
|
|
71
|
+
* showing the same thing, and a provider with no mark of its own falls back to
|
|
72
|
+
* a generic credential icon rather than rendering nothing.
|
|
73
|
+
*/
|
|
74
|
+
function ProviderIcon({ provider, className }) {
|
|
75
|
+
return /* @__PURE__ */ jsx(PROVIDER_ICONS[provider] ?? KeyRound, { className });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
export { ProviderIcon };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_auth_providers = require('../../constants/auth-providers.cjs');
|
|
6
|
+
const require_ProviderIcon = require('../provider-icon/ProviderIcon.cjs');
|
|
7
|
+
let __wordrhyme_shadcn_ui = require("@wordrhyme/shadcn-ui");
|
|
8
|
+
__wordrhyme_shadcn_ui = require_rolldown_runtime.__toESM(__wordrhyme_shadcn_ui);
|
|
9
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
11
|
+
let __wordrhyme_shadcn = require("@wordrhyme/shadcn");
|
|
12
|
+
__wordrhyme_shadcn = require_rolldown_runtime.__toESM(__wordrhyme_shadcn);
|
|
13
|
+
let lucide_react = require("lucide-react");
|
|
14
|
+
lucide_react = require_rolldown_runtime.__toESM(lucide_react);
|
|
15
|
+
|
|
16
|
+
//#region src/components/sign-in-methods/SignInMethodRow.tsx
|
|
17
|
+
/**
|
|
18
|
+
* One sign-in method: what it is, which account it points at, and — when it is
|
|
19
|
+
* not attached yet — the button that attaches it.
|
|
20
|
+
*/
|
|
21
|
+
function SignInMethodRow({ provider, email, isConnected, isPending = false, isDisabled = false, onConnect }) {
|
|
22
|
+
const label = require_auth_providers.describeAuthProvider(provider);
|
|
23
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
24
|
+
className: "flex items-center justify-between gap-4 py-3",
|
|
25
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
26
|
+
className: "flex min-w-0 items-center gap-3",
|
|
27
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ProviderIcon.ProviderIcon, {
|
|
28
|
+
provider,
|
|
29
|
+
className: "text-muted-foreground h-5 w-5"
|
|
30
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
31
|
+
className: "min-w-0",
|
|
32
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
33
|
+
className: "text-sm font-medium",
|
|
34
|
+
children: label
|
|
35
|
+
}), email != null && email.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
36
|
+
className: "text-muted-foreground truncate text-xs",
|
|
37
|
+
children: email
|
|
38
|
+
})]
|
|
39
|
+
})]
|
|
40
|
+
}), isConnected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(__wordrhyme_shadcn.Badge, {
|
|
41
|
+
variant: "secondary",
|
|
42
|
+
children: "Connected"
|
|
43
|
+
}) : onConnect != null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(__wordrhyme_shadcn_ui.Button, {
|
|
44
|
+
type: "button",
|
|
45
|
+
variant: "outline",
|
|
46
|
+
size: "sm",
|
|
47
|
+
disabled: isPending || isDisabled,
|
|
48
|
+
onClick: () => onConnect(provider),
|
|
49
|
+
children: [isPending && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isPending ? "Connecting..." : `Connect ${label}`]
|
|
50
|
+
})]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
exports.SignInMethodRow = SignInMethodRow;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/components/sign-in-methods/SignInMethodRow.d.ts
|
|
4
|
+
interface SignInMethodRowProps {
|
|
5
|
+
/** Supabase provider key, e.g. `'google'`. */
|
|
6
|
+
provider: string;
|
|
7
|
+
/** Address this provider supplied, shown under the label when known. */
|
|
8
|
+
email?: string | null;
|
|
9
|
+
/** Whether the provider is already attached to the account. */
|
|
10
|
+
isConnected: boolean;
|
|
11
|
+
/** Whether this row's connect flow is in flight. */
|
|
12
|
+
isPending?: boolean;
|
|
13
|
+
/** Disables the connect button while some other row is mid-flow. */
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
/** Starts connecting this provider. Absent on rows that cannot be connected. */
|
|
16
|
+
onConnect?: (provider: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One sign-in method: what it is, which account it points at, and — when it is
|
|
20
|
+
* not attached yet — the button that attaches it.
|
|
21
|
+
*/
|
|
22
|
+
declare function SignInMethodRow({
|
|
23
|
+
provider,
|
|
24
|
+
email,
|
|
25
|
+
isConnected,
|
|
26
|
+
isPending,
|
|
27
|
+
isDisabled,
|
|
28
|
+
onConnect
|
|
29
|
+
}: SignInMethodRowProps): react_jsx_runtime15.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SignInMethodRow, SignInMethodRowProps };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as react_jsx_runtime15 from "react/jsx-runtime";
|
|
2
|
+
|
|
3
|
+
//#region src/components/sign-in-methods/SignInMethodRow.d.ts
|
|
4
|
+
interface SignInMethodRowProps {
|
|
5
|
+
/** Supabase provider key, e.g. `'google'`. */
|
|
6
|
+
provider: string;
|
|
7
|
+
/** Address this provider supplied, shown under the label when known. */
|
|
8
|
+
email?: string | null;
|
|
9
|
+
/** Whether the provider is already attached to the account. */
|
|
10
|
+
isConnected: boolean;
|
|
11
|
+
/** Whether this row's connect flow is in flight. */
|
|
12
|
+
isPending?: boolean;
|
|
13
|
+
/** Disables the connect button while some other row is mid-flow. */
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
/** Starts connecting this provider. Absent on rows that cannot be connected. */
|
|
16
|
+
onConnect?: (provider: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One sign-in method: what it is, which account it points at, and — when it is
|
|
20
|
+
* not attached yet — the button that attaches it.
|
|
21
|
+
*/
|
|
22
|
+
declare function SignInMethodRow({
|
|
23
|
+
provider,
|
|
24
|
+
email,
|
|
25
|
+
isConnected,
|
|
26
|
+
isPending,
|
|
27
|
+
isDisabled,
|
|
28
|
+
onConnect
|
|
29
|
+
}: SignInMethodRowProps): react_jsx_runtime15.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { SignInMethodRow, SignInMethodRowProps };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import { describeAuthProvider } from "../../constants/auth-providers.js";
|
|
5
|
+
import { ProviderIcon } from "../provider-icon/ProviderIcon.js";
|
|
6
|
+
import { Button } from "@wordrhyme/shadcn-ui";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Badge } from "@wordrhyme/shadcn";
|
|
9
|
+
import { Loader2 } from "lucide-react";
|
|
10
|
+
|
|
11
|
+
//#region src/components/sign-in-methods/SignInMethodRow.tsx
|
|
12
|
+
/**
|
|
13
|
+
* One sign-in method: what it is, which account it points at, and — when it is
|
|
14
|
+
* not attached yet — the button that attaches it.
|
|
15
|
+
*/
|
|
16
|
+
function SignInMethodRow({ provider, email, isConnected, isPending = false, isDisabled = false, onConnect }) {
|
|
17
|
+
const label = describeAuthProvider(provider);
|
|
18
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
19
|
+
className: "flex items-center justify-between gap-4 py-3",
|
|
20
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
21
|
+
className: "flex min-w-0 items-center gap-3",
|
|
22
|
+
children: [/* @__PURE__ */ jsx(ProviderIcon, {
|
|
23
|
+
provider,
|
|
24
|
+
className: "text-muted-foreground h-5 w-5"
|
|
25
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: "min-w-0",
|
|
27
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
28
|
+
className: "text-sm font-medium",
|
|
29
|
+
children: label
|
|
30
|
+
}), email != null && email.length > 0 && /* @__PURE__ */ jsx("p", {
|
|
31
|
+
className: "text-muted-foreground truncate text-xs",
|
|
32
|
+
children: email
|
|
33
|
+
})]
|
|
34
|
+
})]
|
|
35
|
+
}), isConnected ? /* @__PURE__ */ jsx(Badge, {
|
|
36
|
+
variant: "secondary",
|
|
37
|
+
children: "Connected"
|
|
38
|
+
}) : onConnect != null && /* @__PURE__ */ jsxs(Button, {
|
|
39
|
+
type: "button",
|
|
40
|
+
variant: "outline",
|
|
41
|
+
size: "sm",
|
|
42
|
+
disabled: isPending || isDisabled,
|
|
43
|
+
onClick: () => onConnect(provider),
|
|
44
|
+
children: [isPending && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }), isPending ? "Connecting..." : `Connect ${label}`]
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//#endregion
|
|
50
|
+
export { SignInMethodRow };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
5
|
+
const require_sign_in_methods_copy = require('./sign-in-methods-copy.cjs');
|
|
6
|
+
const require_SignInMethodsList = require('./SignInMethodsList.cjs');
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
9
|
+
|
|
10
|
+
//#region src/components/sign-in-methods/SignInMethods.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The account's sign-in methods: what is connected, and what can be added.
|
|
13
|
+
*
|
|
14
|
+
* Presentational by design — the host owns fetching, the connect action, and
|
|
15
|
+
* the error/success copy, exactly as the login screen owns them for
|
|
16
|
+
* `AuthForms`. Adding GitHub or LinkedIn later is one more entry in
|
|
17
|
+
* `linkableProviders`; nothing in here is provider-specific.
|
|
18
|
+
*
|
|
19
|
+
* This is the composed default, heading included, for a host with no section
|
|
20
|
+
* card of its own. A host that has one renders {@link SignInMethodsList} under
|
|
21
|
+
* its own heading and takes the wording from {@link SIGN_IN_METHODS_COPY}.
|
|
22
|
+
*/
|
|
23
|
+
function SignInMethods({ className,...props }) {
|
|
24
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
25
|
+
className,
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
28
|
+
className: "font-medium",
|
|
29
|
+
children: require_sign_in_methods_copy.SIGN_IN_METHODS_COPY.title
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
32
|
+
className: "text-muted-foreground mt-1 text-sm",
|
|
33
|
+
children: require_sign_in_methods_copy.SIGN_IN_METHODS_COPY.description
|
|
34
|
+
}),
|
|
35
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_SignInMethodsList.SignInMethodsList, {
|
|
36
|
+
...props,
|
|
37
|
+
className: "mt-4"
|
|
38
|
+
})
|
|
39
|
+
]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
SignInMethods.displayName = "SignInMethods";
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.SignInMethods = SignInMethods;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SignInMethodsListProps } from "./SignInMethodsList.cjs";
|
|
2
|
+
import * as react_jsx_runtime16 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/components/sign-in-methods/SignInMethods.d.ts
|
|
5
|
+
interface SignInMethodsProps extends SignInMethodsListProps {}
|
|
6
|
+
/**
|
|
7
|
+
* The account's sign-in methods: what is connected, and what can be added.
|
|
8
|
+
*
|
|
9
|
+
* Presentational by design — the host owns fetching, the connect action, and
|
|
10
|
+
* the error/success copy, exactly as the login screen owns them for
|
|
11
|
+
* `AuthForms`. Adding GitHub or LinkedIn later is one more entry in
|
|
12
|
+
* `linkableProviders`; nothing in here is provider-specific.
|
|
13
|
+
*
|
|
14
|
+
* This is the composed default, heading included, for a host with no section
|
|
15
|
+
* card of its own. A host that has one renders {@link SignInMethodsList} under
|
|
16
|
+
* its own heading and takes the wording from {@link SIGN_IN_METHODS_COPY}.
|
|
17
|
+
*/
|
|
18
|
+
declare function SignInMethods({
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}: SignInMethodsProps): react_jsx_runtime16.JSX.Element;
|
|
22
|
+
declare namespace SignInMethods {
|
|
23
|
+
var displayName: string;
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { SignInMethods, SignInMethodsProps };
|