@ploykit/ui 0.4.0 → 0.4.1
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 +1 -1
- package/dist/pages/LoginPage.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -189,7 +189,7 @@ import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '@
|
|
|
189
189
|
### 其他常用导出
|
|
190
190
|
|
|
191
191
|
- **布局**:`AppShell` / `SettingsShell` / `AuthShell` / `AdminShell` + 全套 Sidebar。
|
|
192
|
-
- **页面**:`LoginPage`(props:`resetPath` / `registerPath` / `oauthProviders` / `enableFedLogin` / `onSuccess` / `title` / `description
|
|
192
|
+
- **页面**:`LoginPage`(props:`resetPath` / `registerPath` / `oauthProviders` / `enableFedLogin` / `onSuccess` / `title` / `description`;`resetPath` / `registerPath` **传空串即隐藏对应链接**——产品未挂载 /forgot-password、/register 路由时防止死链 404)、`RegisterPage`、`ForgotPasswordPage`、`ResetPasswordPage`、`VerifyEmailPage`、`InviteAcceptPage`,以及 workspace/account/admin 各默认页面。
|
|
193
193
|
- **反馈与状态**:`StatusBadge`、`PageHeader` / `PageLoading` / `PageEmpty` / `PageError`、`ErrorBoundary`、`ReauthDialog`(step-up sudo 模式弹窗)。
|
|
194
194
|
- **工具**:`cn`、`formatDate` / `formatDateTime` / `shortID`、`statusTone` / `statusLabel`、`apiErrorMessage`、`FormField`、`CronInput`。
|
|
195
195
|
- 基础 UI 件(Button / Input / Card / Tabs / AlertDialog / DropdownMenu / Popover / Switch / Checkbox / Progress / Avatar / Breadcrumb / Empty / Field / Label / Tooltip / Skeleton / Separator…)全部从 barrel 导出;也可走子路径 `import { Button } from '@ploykit/ui/components/ui/button'`(推荐统一走 barrel)。
|
package/dist/pages/LoginPage.js
CHANGED
|
@@ -83,5 +83,5 @@ export function LoginPage({ resetPath = '/forgot-password', registerPath = '/reg
|
|
|
83
83
|
? '重新发送'
|
|
84
84
|
: sending
|
|
85
85
|
? '发送中…'
|
|
86
|
-
: '发送' })] })] }), sendError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: sendError }), codeError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: codeError }), _jsx("button", { type: "submit", disabled: loading || !email || !code, className: "w-full py-2 px-4 bg-primary text-primary-foreground rounded-md hover:bg-primary/80 disabled:opacity-50", children: loading ? '登录中…' : '登录' })] }) }), _jsx(TabsContent, { value: "password", children: _jsxs("form", { onSubmit: handlePasswordSubmit, className: "space-y-4 pt-2", children: [_jsx(FormField, { label: "\u90AE\u7BB1", htmlFor: "login-pw-email", children: _jsx(Input, { id: "login-pw-email", type: "email", value: email, required: true, onChange: (e) => setEmail(e.target.value), placeholder: "you@example.com", autoComplete: "email" }) }), _jsx(FormField, { label: "\u5BC6\u7801", htmlFor: "login-pw-password", children: _jsx(Input, { id: "login-pw-password", type: "password", value: password, required: true, onChange: (e) => setPassword(e.target.value), placeholder: "\u8F93\u5165\u5BC6\u7801", autoComplete: "current-password" }) }), pwError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: pwError }), _jsx(Button, { type: "submit", className: "w-full", disabled: pwLoading || !email || !password, children: pwLoading ? '登录中…' : '登录' })] }) })] }), oauthProviders.length > 0 && (_jsxs("div", { className: "space-y-2 pt-1", "data-testid": "oauth-providers", children: [_jsxs("div", { className: "relative py-2 text-center", children: [_jsx("span", { className: "absolute inset-x-0 top-1/2 border-t border-border" }), _jsx("span", { className: "relative z-10 bg-card px-2 text-xs text-muted-foreground", children: "\u6216\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u767B\u5F55" })] }), oauthProviders.map((p) => (_jsxs("a", { href: '/auth/oauth/' + p.id + '/start', className: "block w-full py-2 px-4 text-center text-sm border border-input rounded-md hover:bg-background", children: ["\u4F7F\u7528 ", p.label, " \u767B\u5F55"] }, p.id)))] })), enableFedLogin && (_jsxs("details", { className: "pt-1", "data-testid": "fed-login", children: [_jsx("summary", { className: "text-sm text-muted-foreground cursor-pointer select-none", children: "\u4F01\u4E1A\u767B\u5F55" }), _jsxs("form", { method: "get", action: "/auth/fed/start", className: "mt-2 space-y-2", children: [_jsx("input", { type: "text", name: "workspace", placeholder: "\u5DE5\u4F5C\u533A\u6807\u8BC6\uFF08slug\uFF09", required: true, className: "w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-ring" }), _jsx("button", { type: "submit", className: "w-full py-2 px-4 bg-primary text-primary-foreground text-sm rounded-md hover:bg-primary/80", children: "\u901A\u8FC7\u4F01\u4E1A IdP \u767B\u5F55" })] })] })), _jsxs("div", { className: "flex items-center justify-between text-sm", children: [_jsx("a", { href: resetPath, className: "text-primary hover:underline", children: "\u5FD8\u8BB0\u5BC6\u7801\uFF1F" }), registerPath && (_jsx("a", { href: registerPath, "data-testid": "register-link", className: "text-primary hover:underline", children: "\u521B\u5EFA\u8D26\u53F7" }))] })] }) }));
|
|
86
|
+
: '发送' })] })] }), sendError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: sendError }), codeError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: codeError }), _jsx("button", { type: "submit", disabled: loading || !email || !code, className: "w-full py-2 px-4 bg-primary text-primary-foreground rounded-md hover:bg-primary/80 disabled:opacity-50", children: loading ? '登录中…' : '登录' })] }) }), _jsx(TabsContent, { value: "password", children: _jsxs("form", { onSubmit: handlePasswordSubmit, className: "space-y-4 pt-2", children: [_jsx(FormField, { label: "\u90AE\u7BB1", htmlFor: "login-pw-email", children: _jsx(Input, { id: "login-pw-email", type: "email", value: email, required: true, onChange: (e) => setEmail(e.target.value), placeholder: "you@example.com", autoComplete: "email" }) }), _jsx(FormField, { label: "\u5BC6\u7801", htmlFor: "login-pw-password", children: _jsx(Input, { id: "login-pw-password", type: "password", value: password, required: true, onChange: (e) => setPassword(e.target.value), placeholder: "\u8F93\u5165\u5BC6\u7801", autoComplete: "current-password" }) }), pwError && _jsx("p", { role: "alert", className: "text-destructive text-sm", children: pwError }), _jsx(Button, { type: "submit", className: "w-full", disabled: pwLoading || !email || !password, children: pwLoading ? '登录中…' : '登录' })] }) })] }), oauthProviders.length > 0 && (_jsxs("div", { className: "space-y-2 pt-1", "data-testid": "oauth-providers", children: [_jsxs("div", { className: "relative py-2 text-center", children: [_jsx("span", { className: "absolute inset-x-0 top-1/2 border-t border-border" }), _jsx("span", { className: "relative z-10 bg-card px-2 text-xs text-muted-foreground", children: "\u6216\u4F7F\u7528\u4EE5\u4E0B\u65B9\u5F0F\u767B\u5F55" })] }), oauthProviders.map((p) => (_jsxs("a", { href: '/auth/oauth/' + p.id + '/start', className: "block w-full py-2 px-4 text-center text-sm border border-input rounded-md hover:bg-background", children: ["\u4F7F\u7528 ", p.label, " \u767B\u5F55"] }, p.id)))] })), enableFedLogin && (_jsxs("details", { className: "pt-1", "data-testid": "fed-login", children: [_jsx("summary", { className: "text-sm text-muted-foreground cursor-pointer select-none", children: "\u4F01\u4E1A\u767B\u5F55" }), _jsxs("form", { method: "get", action: "/auth/fed/start", className: "mt-2 space-y-2", children: [_jsx("input", { type: "text", name: "workspace", placeholder: "\u5DE5\u4F5C\u533A\u6807\u8BC6\uFF08slug\uFF09", required: true, className: "w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-ring" }), _jsx("button", { type: "submit", className: "w-full py-2 px-4 bg-primary text-primary-foreground text-sm rounded-md hover:bg-primary/80", children: "\u901A\u8FC7\u4F01\u4E1A IdP \u767B\u5F55" })] })] })), (resetPath || registerPath) && (_jsxs("div", { className: "flex items-center justify-between text-sm", children: [resetPath && (_jsx("a", { href: resetPath, className: "text-primary hover:underline", children: "\u5FD8\u8BB0\u5BC6\u7801\uFF1F" })), registerPath && (_jsx("a", { href: registerPath, "data-testid": "register-link", className: "text-primary hover:underline", children: "\u521B\u5EFA\u8D26\u53F7" }))] }))] }) }));
|
|
87
87
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ploykit/ui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@base-ui/react": "^1.8.0",
|
|
32
|
-
"@ploykit/client": "^0.4.
|
|
33
|
-
"@ploykit/hooks": "^0.4.
|
|
32
|
+
"@ploykit/client": "^0.4.1",
|
|
33
|
+
"@ploykit/hooks": "^0.4.1",
|
|
34
34
|
"class-variance-authority": "^0.7.1",
|
|
35
35
|
"clsx": "^2.1.1",
|
|
36
36
|
"cn": "^0.4.0",
|