Compare commits
3 Commits
d50ab5f7bf
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 08b9bb8095 | |||
| 5ada30858a | |||
| a1e9519eee |
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
node_modules/
|
||||||
|
.DS_Store
|
||||||
218
dist/react/index.js
vendored
218
dist/react/index.js
vendored
@@ -1,8 +1,85 @@
|
|||||||
// react/AuthGuard.tsx
|
// react/AuthGuard.tsx
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Center, Spinner } from "@chakra-ui/react";
|
|
||||||
import { Navigate } from "react-router-dom";
|
// react/chakra-compat.tsx
|
||||||
import { Fragment, jsx } from "react/jsx-runtime";
|
import {
|
||||||
|
Alert as ChakraAlert,
|
||||||
|
Box as ChakraBox,
|
||||||
|
Button as ChakraButton,
|
||||||
|
Center as ChakraCenter,
|
||||||
|
HStack as ChakraHStack,
|
||||||
|
Icon as ChakraIcon,
|
||||||
|
Input as ChakraInput,
|
||||||
|
Spinner as ChakraSpinner,
|
||||||
|
Stack as ChakraStack,
|
||||||
|
Text as ChakraText
|
||||||
|
} from "@chakra-ui/react";
|
||||||
|
import { jsx, jsxs } from "react/jsx-runtime";
|
||||||
|
function normalizeSpacingProps(props) {
|
||||||
|
const next = { ...props };
|
||||||
|
if (next.spacing !== void 0 && next.gap === void 0) {
|
||||||
|
next.gap = next.spacing;
|
||||||
|
}
|
||||||
|
delete next.spacing;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
function normalizeInteractiveProps(props) {
|
||||||
|
const next = normalizeSpacingProps(props);
|
||||||
|
if (next.isDisabled !== void 0 && next.disabled === void 0) {
|
||||||
|
next.disabled = next.isDisabled;
|
||||||
|
}
|
||||||
|
if (next.isLoading !== void 0 && next.loading === void 0) {
|
||||||
|
next.loading = next.isLoading;
|
||||||
|
}
|
||||||
|
delete next.isDisabled;
|
||||||
|
delete next.isLoading;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
var Center = ChakraCenter;
|
||||||
|
var Icon = ChakraIcon;
|
||||||
|
var Input = ChakraInput;
|
||||||
|
var Spinner = ChakraSpinner;
|
||||||
|
function Stack(props) {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraStack, { ...normalizeSpacingProps(props) });
|
||||||
|
}
|
||||||
|
function HStack(props) {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraHStack, { ...normalizeSpacingProps(props) });
|
||||||
|
}
|
||||||
|
function Text(props) {
|
||||||
|
const next = { ...props };
|
||||||
|
if (next.noOfLines !== void 0 && next.lineClamp === void 0) {
|
||||||
|
next.lineClamp = next.noOfLines;
|
||||||
|
}
|
||||||
|
delete next.noOfLines;
|
||||||
|
return /* @__PURE__ */ jsx(ChakraText, { ...next });
|
||||||
|
}
|
||||||
|
function Button(props) {
|
||||||
|
const { leftIcon, rightIcon, children, ...rest } = normalizeInteractiveProps(props);
|
||||||
|
return /* @__PURE__ */ jsx(ChakraButton, { ...rest, children: /* @__PURE__ */ jsxs(ChakraHStack, { gap: 2, children: [
|
||||||
|
leftIcon ?? null,
|
||||||
|
/* @__PURE__ */ jsx("span", { children }),
|
||||||
|
rightIcon ?? null
|
||||||
|
] }) });
|
||||||
|
}
|
||||||
|
function Alert({ children, status = "info", ...props }) {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraAlert.Root, { status, ...props, children });
|
||||||
|
}
|
||||||
|
function AlertIcon() {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraAlert.Indicator, {});
|
||||||
|
}
|
||||||
|
function AlertDescription({ children, ...props }) {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraAlert.Description, { ...props, children });
|
||||||
|
}
|
||||||
|
function FormControl({ children, ...props }) {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraStack, { gap: 2, ...normalizeSpacingProps(props), children });
|
||||||
|
}
|
||||||
|
function FormLabel(props) {
|
||||||
|
return /* @__PURE__ */ jsx(ChakraBox, { as: "label", fontWeight: "medium", ...props });
|
||||||
|
}
|
||||||
|
|
||||||
|
// react/AuthGuard.tsx
|
||||||
|
import { Navigate } from "react-router";
|
||||||
|
import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
|
||||||
function AuthGuard({
|
function AuthGuard({
|
||||||
children,
|
children,
|
||||||
fetchCurrentUser,
|
fetchCurrentUser,
|
||||||
@@ -30,12 +107,12 @@ function AuthGuard({
|
|||||||
};
|
};
|
||||||
}, [fetchCurrentUser]);
|
}, [fetchCurrentUser]);
|
||||||
if (state.loading) {
|
if (state.loading) {
|
||||||
return /* @__PURE__ */ jsx(Fragment, { children: loadingFallback ?? /* @__PURE__ */ jsx(Center, { h: "var(--app-height)", children: /* @__PURE__ */ jsx(Spinner, { size: "xl" }) }) });
|
return /* @__PURE__ */ jsx2(Fragment, { children: loadingFallback ?? /* @__PURE__ */ jsx2(Center, { h: "var(--app-height)", children: /* @__PURE__ */ jsx2(Spinner, { size: "xl" }) }) });
|
||||||
}
|
}
|
||||||
if (!state.authenticated) {
|
if (!state.authenticated) {
|
||||||
return /* @__PURE__ */ jsx(Navigate, { to: redirectTo, replace: true });
|
return /* @__PURE__ */ jsx2(Navigate, { to: redirectTo, replace: true });
|
||||||
}
|
}
|
||||||
return /* @__PURE__ */ jsx(Fragment, { children: authenticatedWrapper ? authenticatedWrapper(children) : children });
|
return /* @__PURE__ */ jsx2(Fragment, { children: authenticatedWrapper ? authenticatedWrapper(children) : children });
|
||||||
}
|
}
|
||||||
|
|
||||||
// react/client.ts
|
// react/client.ts
|
||||||
@@ -172,9 +249,8 @@ function createAuthClient(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// react/LoginForm.tsx
|
// react/LoginForm.tsx
|
||||||
import { Alert, AlertDescription, AlertIcon, Button, Center as Center2, FormControl, FormLabel, HStack, Icon, Input, Stack } from "@chakra-ui/react";
|
|
||||||
import { FcGoogle } from "react-icons/fc";
|
import { FcGoogle } from "react-icons/fc";
|
||||||
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
||||||
function LoginForm({
|
function LoginForm({
|
||||||
mode,
|
mode,
|
||||||
texts,
|
texts,
|
||||||
@@ -202,37 +278,37 @@ function LoginForm({
|
|||||||
passwordConfirm: String(form.get("passwordConfirm") ?? "")
|
passwordConfirm: String(form.get("passwordConfirm") ?? "")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return /* @__PURE__ */ jsxs(Stack, { spacing: 5, children: [
|
return /* @__PURE__ */ jsxs2(Stack, { spacing: 5, children: [
|
||||||
errorMessage ? /* @__PURE__ */ jsxs(Alert, { status: "error", borderRadius: "md", children: [
|
errorMessage ? /* @__PURE__ */ jsxs2(Alert, { status: "error", borderRadius: "md", children: [
|
||||||
/* @__PURE__ */ jsx2(AlertIcon, {}),
|
/* @__PURE__ */ jsx3(AlertIcon, {}),
|
||||||
/* @__PURE__ */ jsx2(AlertDescription, { children: errorMessage })
|
/* @__PURE__ */ jsx3(AlertDescription, { children: errorMessage })
|
||||||
] }) : null,
|
] }) : null,
|
||||||
successMessage ? /* @__PURE__ */ jsxs(Alert, { status: "success", borderRadius: "md", children: [
|
successMessage ? /* @__PURE__ */ jsxs2(Alert, { status: "success", borderRadius: "md", children: [
|
||||||
/* @__PURE__ */ jsx2(AlertIcon, {}),
|
/* @__PURE__ */ jsx3(AlertIcon, {}),
|
||||||
/* @__PURE__ */ jsx2(AlertDescription, { children: successMessage })
|
/* @__PURE__ */ jsx3(AlertDescription, { children: successMessage })
|
||||||
] }) : null,
|
] }) : null,
|
||||||
/* @__PURE__ */ jsx2("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs(Stack, { spacing: 4, children: [
|
/* @__PURE__ */ jsx3("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs2(Stack, { spacing: 4, children: [
|
||||||
registerMode ? /* @__PURE__ */ jsxs(FormControl, { isRequired: true, children: [
|
registerMode ? /* @__PURE__ */ jsxs2(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx2(FormLabel, { children: texts.nameLabel }),
|
/* @__PURE__ */ jsx3(FormLabel, { children: texts.nameLabel }),
|
||||||
/* @__PURE__ */ jsx2(Input, { name: "name", placeholder: namePlaceholder })
|
/* @__PURE__ */ jsx3(Input, { name: "name", placeholder: namePlaceholder })
|
||||||
] }) : null,
|
] }) : null,
|
||||||
/* @__PURE__ */ jsxs(FormControl, { isRequired: true, children: [
|
/* @__PURE__ */ jsxs2(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx2(FormLabel, { children: texts.emailLabel }),
|
/* @__PURE__ */ jsx3(FormLabel, { children: texts.emailLabel }),
|
||||||
/* @__PURE__ */ jsx2(Input, { name: "email", type: "email", placeholder: emailPlaceholder })
|
/* @__PURE__ */ jsx3(Input, { name: "email", type: "email", placeholder: emailPlaceholder })
|
||||||
] }),
|
] }),
|
||||||
/* @__PURE__ */ jsxs(FormControl, { isRequired: true, children: [
|
/* @__PURE__ */ jsxs2(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx2(FormLabel, { children: texts.passwordLabel }),
|
/* @__PURE__ */ jsx3(FormLabel, { children: texts.passwordLabel }),
|
||||||
/* @__PURE__ */ jsx2(Input, { name: "password", type: "password", minLength: 8 })
|
/* @__PURE__ */ jsx3(Input, { name: "password", type: "password", minLength: 8 })
|
||||||
] }),
|
] }),
|
||||||
!registerMode && forgotPasswordLink ? /* @__PURE__ */ jsx2(Stack, { align: "flex-end", children: forgotPasswordLink }) : null,
|
!registerMode && forgotPasswordLink ? /* @__PURE__ */ jsx3(Stack, { align: "flex-end", children: forgotPasswordLink }) : null,
|
||||||
registerMode ? /* @__PURE__ */ jsxs(FormControl, { isRequired: true, children: [
|
registerMode ? /* @__PURE__ */ jsxs2(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx2(FormLabel, { children: texts.passwordConfirmLabel }),
|
/* @__PURE__ */ jsx3(FormLabel, { children: texts.passwordConfirmLabel }),
|
||||||
/* @__PURE__ */ jsx2(Input, { name: "passwordConfirm", type: "password", minLength: 8 })
|
/* @__PURE__ */ jsx3(Input, { name: "passwordConfirm", type: "password", minLength: 8 })
|
||||||
] }) : null,
|
] }) : null,
|
||||||
/* @__PURE__ */ jsx2(Button, { type: "submit", isLoading: loading, children: registerMode ? texts.submitRegisterLabel : texts.submitSignInLabel })
|
/* @__PURE__ */ jsx3(Button, { type: "submit", isLoading: loading, children: registerMode ? texts.submitRegisterLabel : texts.submitSignInLabel })
|
||||||
] }) }),
|
] }) }),
|
||||||
registerMode || !onOAuthSignIn || !providers?.google && !providers?.slack ? null : /* @__PURE__ */ jsxs(HStack, { children: [
|
registerMode || !onOAuthSignIn || !providers?.google && !providers?.slack ? null : /* @__PURE__ */ jsxs2(HStack, { children: [
|
||||||
providers.google ? /* @__PURE__ */ jsx2(
|
providers.google ? /* @__PURE__ */ jsx3(
|
||||||
Button,
|
Button,
|
||||||
{
|
{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@@ -245,7 +321,7 @@ function LoginForm({
|
|||||||
fontSize: { base: "md", md: "lg" },
|
fontSize: { base: "md", md: "lg" },
|
||||||
fontWeight: "semibold",
|
fontWeight: "semibold",
|
||||||
iconSpacing: 4,
|
iconSpacing: 4,
|
||||||
leftIcon: /* @__PURE__ */ jsx2(Center2, { boxSize: "40px", bg: "white", borderRadius: "full", boxShadow: "sm", children: /* @__PURE__ */ jsx2(Icon, { as: FcGoogle, boxSize: 6 }) }),
|
leftIcon: /* @__PURE__ */ jsx3(Center, { boxSize: "40px", bg: "white", borderRadius: "full", boxShadow: "sm", children: /* @__PURE__ */ jsx3(Icon, { as: FcGoogle, boxSize: 6 }) }),
|
||||||
_hover: { bg: "gray.300" },
|
_hover: { bg: "gray.300" },
|
||||||
_active: { bg: "gray.300" },
|
_active: { bg: "gray.300" },
|
||||||
isLoading: oauthLoadingProvider === "google",
|
isLoading: oauthLoadingProvider === "google",
|
||||||
@@ -253,7 +329,7 @@ function LoginForm({
|
|||||||
children: texts.googleLabel
|
children: texts.googleLabel
|
||||||
}
|
}
|
||||||
) : null,
|
) : null,
|
||||||
providers.slack ? /* @__PURE__ */ jsx2(
|
providers.slack ? /* @__PURE__ */ jsx3(
|
||||||
Button,
|
Button,
|
||||||
{
|
{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
@@ -264,25 +340,13 @@ function LoginForm({
|
|||||||
}
|
}
|
||||||
) : null
|
) : null
|
||||||
] }),
|
] }),
|
||||||
/* @__PURE__ */ jsx2(Button, { variant: "ghost", onClick: onModeToggle, children: registerMode ? texts.toggleToSignInLabel : texts.toggleToRegisterLabel }),
|
/* @__PURE__ */ jsx3(Button, { variant: "ghost", onClick: onModeToggle, children: registerMode ? texts.toggleToSignInLabel : texts.toggleToRegisterLabel }),
|
||||||
footer ?? null
|
footer ?? null
|
||||||
] });
|
] });
|
||||||
}
|
}
|
||||||
|
|
||||||
// react/PasswordResetForms.tsx
|
// react/PasswordResetForms.tsx
|
||||||
import {
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
||||||
Alert as Alert2,
|
|
||||||
AlertDescription as AlertDescription2,
|
|
||||||
AlertIcon as AlertIcon2,
|
|
||||||
Button as Button2,
|
|
||||||
FormControl as FormControl2,
|
|
||||||
FormLabel as FormLabel2,
|
|
||||||
Input as Input2,
|
|
||||||
Spinner as Spinner2,
|
|
||||||
Stack as Stack2,
|
|
||||||
Text
|
|
||||||
} from "@chakra-ui/react";
|
|
||||||
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
||||||
function PasswordResetRequestForm({
|
function PasswordResetRequestForm({
|
||||||
texts,
|
texts,
|
||||||
helperText,
|
helperText,
|
||||||
@@ -298,18 +362,18 @@ function PasswordResetRequestForm({
|
|||||||
email: String(form.get("email") ?? "")
|
email: String(form.get("email") ?? "")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return /* @__PURE__ */ jsxs2(Stack2, { spacing: 5, children: [
|
return /* @__PURE__ */ jsxs3(Stack, { spacing: 5, children: [
|
||||||
requestSent ? /* @__PURE__ */ jsxs2(Alert2, { status: "success", borderRadius: "md", children: [
|
requestSent ? /* @__PURE__ */ jsxs3(Alert, { status: "success", borderRadius: "md", children: [
|
||||||
/* @__PURE__ */ jsx3(AlertIcon2, {}),
|
/* @__PURE__ */ jsx4(AlertIcon, {}),
|
||||||
/* @__PURE__ */ jsx3(AlertDescription2, { children: texts.requestSentMessage })
|
/* @__PURE__ */ jsx4(AlertDescription, { children: texts.requestSentMessage })
|
||||||
] }) : null,
|
] }) : null,
|
||||||
/* @__PURE__ */ jsx3("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs2(Stack2, { spacing: 4, children: [
|
/* @__PURE__ */ jsx4("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs3(Stack, { spacing: 4, children: [
|
||||||
/* @__PURE__ */ jsxs2(FormControl2, { isRequired: true, children: [
|
/* @__PURE__ */ jsxs3(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx3(FormLabel2, { children: texts.emailLabel }),
|
/* @__PURE__ */ jsx4(FormLabel, { children: texts.emailLabel }),
|
||||||
/* @__PURE__ */ jsx3(Input2, { name: "email", type: "email", placeholder: emailPlaceholder })
|
/* @__PURE__ */ jsx4(Input, { name: "email", type: "email", placeholder: emailPlaceholder })
|
||||||
] }),
|
] }),
|
||||||
/* @__PURE__ */ jsx3(Text, { fontSize: "sm", color: "gray.600", children: helperText }),
|
/* @__PURE__ */ jsx4(Text, { fontSize: "sm", color: "gray.600", children: helperText }),
|
||||||
/* @__PURE__ */ jsx3(Button2, { type: "submit", isLoading: loading, children: texts.submitLabel })
|
/* @__PURE__ */ jsx4(Button, { type: "submit", isLoading: loading, children: texts.submitLabel })
|
||||||
] }) })
|
] }) })
|
||||||
] });
|
] });
|
||||||
}
|
}
|
||||||
@@ -329,35 +393,35 @@ function PasswordResetConfirmForm({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (tokenState.status === "loading") {
|
if (tokenState.status === "loading") {
|
||||||
return /* @__PURE__ */ jsxs2(Stack2, { align: "center", py: 6, spacing: 3, children: [
|
return /* @__PURE__ */ jsxs3(Stack, { align: "center", py: 6, spacing: 3, children: [
|
||||||
/* @__PURE__ */ jsx3(Spinner2, {}),
|
/* @__PURE__ */ jsx4(Spinner, {}),
|
||||||
/* @__PURE__ */ jsx3(Text, { color: "gray.600", children: texts.loadingLabel })
|
/* @__PURE__ */ jsx4(Text, { color: "gray.600", children: texts.loadingLabel })
|
||||||
] });
|
] });
|
||||||
}
|
}
|
||||||
if (tokenState.status === "invalid") {
|
if (tokenState.status === "invalid") {
|
||||||
return /* @__PURE__ */ jsxs2(Alert2, { status: "error", borderRadius: "md", children: [
|
return /* @__PURE__ */ jsxs3(Alert, { status: "error", borderRadius: "md", children: [
|
||||||
/* @__PURE__ */ jsx3(AlertIcon2, {}),
|
/* @__PURE__ */ jsx4(AlertIcon, {}),
|
||||||
/* @__PURE__ */ jsx3(AlertDescription2, { children: tokenState.error || texts.invalidLinkLabel })
|
/* @__PURE__ */ jsx4(AlertDescription, { children: tokenState.error || texts.invalidLinkLabel })
|
||||||
] });
|
] });
|
||||||
}
|
}
|
||||||
if (completedMode !== null) {
|
if (completedMode !== null) {
|
||||||
return /* @__PURE__ */ jsxs2(Alert2, { status: "success", borderRadius: "md", children: [
|
return /* @__PURE__ */ jsxs3(Alert, { status: "success", borderRadius: "md", children: [
|
||||||
/* @__PURE__ */ jsx3(AlertIcon2, {}),
|
/* @__PURE__ */ jsx4(AlertIcon, {}),
|
||||||
/* @__PURE__ */ jsx3(AlertDescription2, { children: completedMode === "create" ? texts.createSuccessLabel : texts.resetSuccessLabel })
|
/* @__PURE__ */ jsx4(AlertDescription, { children: completedMode === "create" ? texts.createSuccessLabel : texts.resetSuccessLabel })
|
||||||
] });
|
] });
|
||||||
}
|
}
|
||||||
return /* @__PURE__ */ jsxs2(Stack2, { spacing: 4, children: [
|
return /* @__PURE__ */ jsxs3(Stack, { spacing: 4, children: [
|
||||||
/* @__PURE__ */ jsx3(Text, { fontSize: "sm", color: "gray.600", children: tokenState.email }),
|
/* @__PURE__ */ jsx4(Text, { fontSize: "sm", color: "gray.600", children: tokenState.email }),
|
||||||
/* @__PURE__ */ jsx3("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs2(Stack2, { spacing: 4, children: [
|
/* @__PURE__ */ jsx4("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs3(Stack, { spacing: 4, children: [
|
||||||
/* @__PURE__ */ jsxs2(FormControl2, { isRequired: true, children: [
|
/* @__PURE__ */ jsxs3(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx3(FormLabel2, { children: texts.passwordLabel }),
|
/* @__PURE__ */ jsx4(FormLabel, { children: texts.passwordLabel }),
|
||||||
/* @__PURE__ */ jsx3(Input2, { name: "password", type: "password", minLength: 8 })
|
/* @__PURE__ */ jsx4(Input, { name: "password", type: "password", minLength: 8 })
|
||||||
] }),
|
] }),
|
||||||
/* @__PURE__ */ jsxs2(FormControl2, { isRequired: true, children: [
|
/* @__PURE__ */ jsxs3(FormControl, { isRequired: true, children: [
|
||||||
/* @__PURE__ */ jsx3(FormLabel2, { children: texts.passwordConfirmLabel }),
|
/* @__PURE__ */ jsx4(FormLabel, { children: texts.passwordConfirmLabel }),
|
||||||
/* @__PURE__ */ jsx3(Input2, { name: "passwordConfirm", type: "password", minLength: 8 })
|
/* @__PURE__ */ jsx4(Input, { name: "passwordConfirm", type: "password", minLength: 8 })
|
||||||
] }),
|
] }),
|
||||||
/* @__PURE__ */ jsx3(Button2, { type: "submit", isLoading: loading, children: tokenState.mode === "create" ? texts.createSubmitLabel : texts.resetSubmitLabel })
|
/* @__PURE__ */ jsx4(Button, { type: "submit", isLoading: loading, children: tokenState.mode === "create" ? texts.createSubmitLabel : texts.resetSubmitLabel })
|
||||||
] }) })
|
] }) })
|
||||||
] });
|
] });
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/react/index.js.map
vendored
2
dist/react/index.js.map
vendored
File diff suppressed because one or more lines are too long
5
dist/server/index.js
vendored
5
dist/server/index.js
vendored
@@ -60,6 +60,11 @@ function createAuthModule(options) {
|
|||||||
Google({
|
Google({
|
||||||
clientId: options.googleClientId,
|
clientId: options.googleClientId,
|
||||||
clientSecret: options.googleClientSecret,
|
clientSecret: options.googleClientSecret,
|
||||||
|
authorization: {
|
||||||
|
params: {
|
||||||
|
prompt: "select_account"
|
||||||
|
}
|
||||||
|
},
|
||||||
allowDangerousEmailAccountLinking: true
|
allowDangerousEmailAccountLinking: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
2
dist/server/index.js.map
vendored
2
dist/server/index.js.map
vendored
File diff suppressed because one or more lines are too long
4548
package-lock.json
generated
Normal file
4548
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@packages/auth",
|
"name": "@packages/auth",
|
||||||
"version": "0.0.0",
|
"version": "0.0.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"files": [
|
"files": [
|
||||||
@@ -23,13 +23,24 @@
|
|||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@auth/express": "^0.12.1",
|
"@auth/express": "^0.12.1",
|
||||||
"@auth/prisma-adapter": "^2.9.1",
|
"@auth/prisma-adapter": "^2.9.1",
|
||||||
"@chakra-ui/react": "^2.10.7",
|
"@chakra-ui/react": "^3.33.0",
|
||||||
"@prisma/client": "^6.5.0",
|
"@prisma/client": "^6.5.0",
|
||||||
"express": "^4.21.2",
|
"express": "^4.21.2",
|
||||||
"react": "^18.3.1",
|
"react": "^19.2.4",
|
||||||
"react-dom": "^18.3.1",
|
"react-dom": "^19.2.4",
|
||||||
"react-icons": "^5.6.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^6.30.0",
|
"react-router": "^7.13.2",
|
||||||
"zod": "^3.24.2"
|
"zod": "^3.24.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@emotion/react": "^11.14.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/express": "^5.0.3",
|
||||||
|
"@types/node": "^24.7.2",
|
||||||
|
"@types/react": "^19.2.2",
|
||||||
|
"@types/react-dom": "^19.2.2",
|
||||||
|
"tsup": "^8.5.0",
|
||||||
|
"typescript": "^5.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { Center, Spinner } from "@chakra-ui/react";
|
import { Center, Spinner } from "./chakra-compat";
|
||||||
import { Navigate } from "react-router-dom";
|
import { Navigate } from "react-router";
|
||||||
|
|
||||||
type AuthGuardProps = {
|
type AuthGuardProps = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { FormEvent, ReactNode } from "react";
|
import type { FormEvent, ReactNode } from "react";
|
||||||
import { Alert, AlertDescription, AlertIcon, Button, Center, FormControl, FormLabel, HStack, Icon, Input, Stack } from "@chakra-ui/react";
|
import { Alert, AlertDescription, AlertIcon, Button, Center, FormControl, FormLabel, HStack, Icon, Input, Stack } from "./chakra-compat";
|
||||||
import { FcGoogle } from "react-icons/fc";
|
import { FcGoogle } from "react-icons/fc";
|
||||||
import type { AuthProviderAvailability, AuthProviderKey, AuthSubmitValues, LoginMode } from "./types";
|
import type { AuthProviderAvailability, AuthProviderKey, AuthSubmitValues, LoginMode } from "./types";
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
Spinner,
|
Spinner,
|
||||||
Stack,
|
Stack,
|
||||||
Text
|
Text
|
||||||
} from "@chakra-ui/react";
|
} from "./chakra-compat";
|
||||||
import type { PasswordResetMode, PasswordResetTokenState } from "./types";
|
import type { PasswordResetMode, PasswordResetTokenState } from "./types";
|
||||||
|
|
||||||
type PasswordResetRequestTexts = {
|
type PasswordResetRequestTexts = {
|
||||||
|
|||||||
96
react/chakra-compat.tsx
Normal file
96
react/chakra-compat.tsx
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import {
|
||||||
|
Alert as ChakraAlert,
|
||||||
|
Box as ChakraBox,
|
||||||
|
Button as ChakraButton,
|
||||||
|
Center as ChakraCenter,
|
||||||
|
HStack as ChakraHStack,
|
||||||
|
Icon as ChakraIcon,
|
||||||
|
Input as ChakraInput,
|
||||||
|
Spinner as ChakraSpinner,
|
||||||
|
Stack as ChakraStack,
|
||||||
|
Text as ChakraText
|
||||||
|
} from "@chakra-ui/react";
|
||||||
|
import type { ReactNode } from "react";
|
||||||
|
|
||||||
|
type AnyProps = Record<string, any>;
|
||||||
|
|
||||||
|
function normalizeSpacingProps(props: AnyProps) {
|
||||||
|
const next = { ...props };
|
||||||
|
if (next.spacing !== undefined && next.gap === undefined) {
|
||||||
|
next.gap = next.spacing;
|
||||||
|
}
|
||||||
|
delete next.spacing;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeInteractiveProps(props: AnyProps) {
|
||||||
|
const next = normalizeSpacingProps(props);
|
||||||
|
if (next.isDisabled !== undefined && next.disabled === undefined) {
|
||||||
|
next.disabled = next.isDisabled;
|
||||||
|
}
|
||||||
|
if (next.isLoading !== undefined && next.loading === undefined) {
|
||||||
|
next.loading = next.isLoading;
|
||||||
|
}
|
||||||
|
delete next.isDisabled;
|
||||||
|
delete next.isLoading;
|
||||||
|
return next;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Center = ChakraCenter as any;
|
||||||
|
export const Icon = ChakraIcon as any;
|
||||||
|
export const Input = ChakraInput as any;
|
||||||
|
export const Spinner = ChakraSpinner as any;
|
||||||
|
|
||||||
|
export function Stack(props: AnyProps) {
|
||||||
|
return <ChakraStack {...normalizeSpacingProps(props)} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function HStack(props: AnyProps) {
|
||||||
|
return <ChakraHStack {...normalizeSpacingProps(props)} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Text(props: AnyProps) {
|
||||||
|
const next = { ...props };
|
||||||
|
if (next.noOfLines !== undefined && next.lineClamp === undefined) {
|
||||||
|
next.lineClamp = next.noOfLines;
|
||||||
|
}
|
||||||
|
delete next.noOfLines;
|
||||||
|
return <ChakraText {...next} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Button(props: AnyProps) {
|
||||||
|
const { leftIcon, rightIcon, children, ...rest } = normalizeInteractiveProps(props);
|
||||||
|
return (
|
||||||
|
<ChakraButton {...rest}>
|
||||||
|
<ChakraHStack gap={2}>
|
||||||
|
{leftIcon ?? null}
|
||||||
|
<span>{children}</span>
|
||||||
|
{rightIcon ?? null}
|
||||||
|
</ChakraHStack>
|
||||||
|
</ChakraButton>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Alert({ children, status = "info", ...props }: AnyProps) {
|
||||||
|
return (
|
||||||
|
<ChakraAlert.Root status={status} {...props}>
|
||||||
|
{children}
|
||||||
|
</ChakraAlert.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AlertIcon() {
|
||||||
|
return <ChakraAlert.Indicator />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function AlertDescription({ children, ...props }: { children: ReactNode } & AnyProps) {
|
||||||
|
return <ChakraAlert.Description {...props}>{children}</ChakraAlert.Description>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FormControl({ children, ...props }: AnyProps) {
|
||||||
|
return <ChakraStack gap={2} {...normalizeSpacingProps(props)}>{children}</ChakraStack>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function FormLabel(props: AnyProps) {
|
||||||
|
return <ChakraBox as="label" fontWeight="medium" {...props} />;
|
||||||
|
}
|
||||||
@@ -101,6 +101,11 @@ export function createAuthModule<TAuthUser>(options: CreateAuthModuleOptions<TAu
|
|||||||
Google({
|
Google({
|
||||||
clientId: options.googleClientId!,
|
clientId: options.googleClientId!,
|
||||||
clientSecret: options.googleClientSecret!,
|
clientSecret: options.googleClientSecret!,
|
||||||
|
authorization: {
|
||||||
|
params: {
|
||||||
|
prompt: "select_account"
|
||||||
|
}
|
||||||
|
},
|
||||||
allowDangerousEmailAccountLinking: true
|
allowDangerousEmailAccountLinking: true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default defineConfig({
|
|||||||
"react",
|
"react",
|
||||||
"react-dom",
|
"react-dom",
|
||||||
"react-icons",
|
"react-icons",
|
||||||
"react-router-dom",
|
"react-router",
|
||||||
"zod"
|
"zod"
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user