@choiceform/shared-auth 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,49 +1,20 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { AuthInstance } from "../core";
|
|
3
3
|
interface SignInPageProps {
|
|
4
|
+
afterElement?: React.ReactNode;
|
|
4
5
|
auth: AuthInstance;
|
|
5
|
-
|
|
6
|
-
* 自定义样式类名
|
|
7
|
-
*/
|
|
6
|
+
beforeElement?: React.ReactNode;
|
|
8
7
|
className?: string;
|
|
9
|
-
/**
|
|
10
|
-
* 描述
|
|
11
|
-
*/
|
|
12
8
|
description?: string;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
logo?: React.ReactNode;
|
|
17
|
-
/**
|
|
18
|
-
* OAuth 提供商
|
|
19
|
-
* @default 'github'
|
|
20
|
-
*/
|
|
9
|
+
footerText?: React.ReactNode;
|
|
10
|
+
githubButton?: (isSigningIn: boolean) => React.ReactNode;
|
|
21
11
|
provider?: string;
|
|
22
|
-
/**
|
|
23
|
-
* 登录成功后的重定向路径
|
|
24
|
-
* @default '/explore'
|
|
25
|
-
*/
|
|
26
12
|
redirectAfterLogin?: string;
|
|
27
|
-
/**
|
|
28
|
-
* 登录按钮图标
|
|
29
|
-
*/
|
|
30
|
-
signInButtonIcon?: React.ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* 登录按钮文本
|
|
33
|
-
*/
|
|
34
|
-
signInButtonText?: string;
|
|
35
|
-
/**
|
|
36
|
-
* 登录中按钮文本
|
|
37
|
-
*/
|
|
38
|
-
signingInButtonText?: string;
|
|
39
|
-
/**
|
|
40
|
-
* 标题
|
|
41
|
-
*/
|
|
42
13
|
title?: string;
|
|
43
14
|
}
|
|
44
15
|
/**
|
|
45
16
|
* 登录页面组件
|
|
46
17
|
*/
|
|
47
|
-
export declare function SignInPage({ auth, redirectAfterLogin, provider,
|
|
18
|
+
export declare function SignInPage({ afterElement, auth, beforeElement, redirectAfterLogin, provider, title, description, githubButton, className, footerText, }: SignInPageProps): import("react/jsx-runtime").JSX.Element;
|
|
48
19
|
export {};
|
|
49
20
|
//# sourceMappingURL=sign-in-page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-in-page.d.ts","sourceRoot":"","sources":["../../src/components/sign-in-page.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sign-in-page.d.ts","sourceRoot":"","sources":["../../src/components/sign-in-page.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAE3C,UAAU,eAAe;IACvB,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAC;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,kBAA+B,EAC/B,QAAmB,EACnB,KAAK,EACL,WAAW,EACX,YAAY,EACZ,SAAS,EACT,UAAU,GACX,EAAE,eAAe,2CAgDjB"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from "@choiceform/design-system";
|
|
3
|
+
import { use$ } from "@legendapp/state/react";
|
|
2
4
|
import { useEffect, useState } from "react";
|
|
3
5
|
import { useNavigate } from "react-router";
|
|
4
|
-
import { use$ } from "@legendapp/state/react";
|
|
5
|
-
import { Button } from "@choiceform/design-system";
|
|
6
6
|
/**
|
|
7
7
|
* 登录页面组件
|
|
8
8
|
*/
|
|
9
|
-
export function SignInPage({ auth, redirectAfterLogin = "/explore", provider = "github",
|
|
9
|
+
export function SignInPage({ afterElement, auth, beforeElement, redirectAfterLogin = "/explore", provider = "github", title, description, githubButton, className, footerText, }) {
|
|
10
10
|
const navigate = useNavigate();
|
|
11
11
|
const { authStore, authActions } = auth;
|
|
12
12
|
const { isAuthenticated, error } = use$(authStore);
|
|
@@ -29,5 +29,5 @@ export function SignInPage({ auth, redirectAfterLogin = "/explore", provider = "
|
|
|
29
29
|
setIsSigningIn(false);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
return (
|
|
32
|
+
return (_jsxs("div", { className: className, children: [beforeElement, title && (_jsxs("div", { className: "flex flex-col gap-2", children: [title && _jsx("p", { className: "text-heading-large", children: title }), description && (_jsx("p", { className: "text-secondary-foreground text-body-large", children: description }))] })), provider === "github" && (_jsx(Slot, { onClick: handleSignIn, children: githubButton?.(isSigningIn) })), error && _jsx("p", { className: "text-danger-foreground mt-2", children: error }), footerText, afterElement] }));
|
|
33
33
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@choiceform/shared-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Shared authentication package for Choiceform projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"build": "tsc",
|
|
21
21
|
"dev": "tsc --watch",
|
|
22
22
|
"clean": "rimraf dist",
|
|
23
|
-
"prepublishOnly": "pnpm run build"
|
|
23
|
+
"prepublishOnly": "pnpm run build",
|
|
24
|
+
"publish": "npm publish"
|
|
24
25
|
},
|
|
25
26
|
"repository": {
|
|
26
27
|
"type": "git",
|