@chaos_team/chaos-ui 1.0.5 → 1.1.0
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/CHANGELOG.md +72 -0
- package/README.md +11 -15
- package/dist/auth-layout-AqhdIh5N.d.cts +172 -0
- package/dist/auth-layout-AqhdIh5N.d.ts +172 -0
- package/dist/business.cjs +11 -9
- package/dist/business.d.cts +1015 -939
- package/dist/business.d.ts +1015 -939
- package/dist/business.js +11 -9
- package/dist/card-DY3pk0zA.d.cts +150 -0
- package/dist/card-DY3pk0zA.d.ts +150 -0
- package/dist/hooks.cjs +2 -2
- package/dist/hooks.d.cts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/hooks.js +2 -2
- package/dist/index.cjs +8 -1
- package/dist/index.d.cts +2089 -9
- package/dist/index.d.ts +2089 -9
- package/dist/index.js +8 -1
- package/dist/input-B39p_6ia.d.cts +40 -0
- package/dist/input-B39p_6ia.d.ts +40 -0
- package/dist/layout.cjs +12 -0
- package/dist/layout.d.cts +642 -0
- package/dist/layout.d.ts +642 -0
- package/dist/layout.js +12 -0
- package/dist/lib.d.cts +1 -1
- package/dist/lib.d.ts +1 -1
- package/dist/{message-KJli9tvf.d.cts → message-BoUedza5.d.cts} +1 -1
- package/dist/{message-KJli9tvf.d.ts → message-BoUedza5.d.ts} +1 -1
- package/dist/message-provider-Dt4mVwWP.d.cts +23 -0
- package/dist/message-provider-Dt4mVwWP.d.ts +23 -0
- package/dist/mobile-bottom-nav-Bi6_V5Bu.d.cts +18 -0
- package/dist/mobile-bottom-nav-Bi6_V5Bu.d.ts +18 -0
- package/dist/mobile-qrcode-scanner-BHDncd40.d.cts +327 -0
- package/dist/mobile-qrcode-scanner-a_Cz8tF5.d.ts +327 -0
- package/dist/mobile.cjs +6 -0
- package/dist/mobile.d.cts +101 -0
- package/dist/mobile.d.ts +101 -0
- package/dist/mobile.js +6 -0
- package/dist/next.cjs +1 -1
- package/dist/next.d.cts +5 -102
- package/dist/next.d.ts +5 -102
- package/dist/next.js +1 -1
- package/dist/top-bar-BYXz4LtM.d.cts +74 -0
- package/dist/top-bar-BYXz4LtM.d.ts +74 -0
- package/dist/ui/icons.cjs +1 -1
- package/dist/ui/icons.d.cts +1 -1
- package/dist/ui/icons.d.ts +1 -1
- package/dist/ui/icons.js +1 -1
- package/dist/ui-icons.cjs +1 -1
- package/dist/ui-icons.d.cts +24 -1
- package/dist/ui-icons.d.ts +24 -1
- package/dist/ui-icons.js +1 -1
- package/dist/ui.cjs +8 -1
- package/dist/ui.d.cts +7 -5
- package/dist/ui.d.ts +7 -5
- package/dist/ui.js +8 -1
- package/package.json +15 -5
- package/styles.css +11 -11
- package/dist/message-provider-BI-P3CNq.d.cts +0 -11
- package/dist/message-provider-BI-P3CNq.d.ts +0 -11
- package/dist/time-picker-H1AaecnE.d.cts +0 -452
- package/dist/time-picker-H1AaecnE.d.ts +0 -452
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,78 @@ All notable changes to **@chaos_team/chaos-ui** will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.0] — 2026-07-09
|
|
9
|
+
|
|
10
|
+
### 组件深度检测与修正
|
|
11
|
+
|
|
12
|
+
对全部 546 个注册组件进行系统性深度检测,覆盖功能、样式、交互、文档、示例代码五大维度。基于检测结果执行批量修正,显著提升组件质量评分。
|
|
13
|
+
|
|
14
|
+
#### P0 修正(阻塞性)
|
|
15
|
+
|
|
16
|
+
- **sourcePath 元数据修复**:修正 256 个组件的 `sourcePath` 指向(从 `packages/chaos-design-ui/` 修正为 `components/`),消除源码路径缺失问题。
|
|
17
|
+
- **错误代码示例修复**:修正 Select 组件 `<Select>Normal</Select>` 不合规用法,改为正确的复合组件用法;修正 Breadcrumb 代码示例缺失子组件问题。
|
|
18
|
+
|
|
19
|
+
#### P1 修正(质量提升)
|
|
20
|
+
|
|
21
|
+
- **模板描述替换**:将 139 个使用 `"面向 ERP/企业场景的业务组件"` 模板文案的 Business 分类组件替换为基于源码分析生成的真实功能描述。
|
|
22
|
+
- **裸代码示例补写**:将 272 个 `<Component />` 裸实例化代码示例替换为包含核心 props 和 import 语句的可运行示例。
|
|
23
|
+
- **API/Props 表格完善**:自动从源码提取 Props 接口定义,丰富组件 API 文档。
|
|
24
|
+
|
|
25
|
+
#### Lint 修复
|
|
26
|
+
|
|
27
|
+
- **mdx-components.tsx**:移除 `@ts-nocheck`,将 20 处 `any` 类型替换为精确的 `React.HTMLAttributes<T>` 类型。
|
|
28
|
+
- **map-marker.tsx / map-track.tsx**:移除不必要的 `@ts-ignore` 注释(实际无类型错误)。
|
|
29
|
+
- **use-modal.tsx**:添加 `react-hooks/immutability` 规则豁免。
|
|
30
|
+
|
|
31
|
+
#### 质量指标提升
|
|
32
|
+
|
|
33
|
+
| 指标 | 修正前 | 修正后 | 变化 |
|
|
34
|
+
| --- | --- | --- | --- |
|
|
35
|
+
| Grade A 组件 | 60 (11.0%) | 104 (19.0%) | +44 (+73%) |
|
|
36
|
+
| Grade B 组件 | 191 (35.0%) | 227 (41.6%) | +36 (+19%) |
|
|
37
|
+
| Grade C 组件 | 295 (54.0%) | 215 (39.4%) | -80 (-27%) |
|
|
38
|
+
| 模板描述 | 267 | 128 | -139 (-52%) |
|
|
39
|
+
| sourcePath 错误 | 256 | 0 | -256 (-100%) |
|
|
40
|
+
| 裸代码示例 | 426 | ~154 | -272 (-64%) |
|
|
41
|
+
|
|
42
|
+
**验证**:
|
|
43
|
+
|
|
44
|
+
| 闸门 | 结果 |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `pnpm run typecheck` | ✅ exit 0 |
|
|
47
|
+
| `pnpm run lint` | ✅ 0 errors (2355 warnings) |
|
|
48
|
+
| `pnpm run build-storybook` | ✅ Storybook build completed successfully |
|
|
49
|
+
|
|
50
|
+
**审计工具**:
|
|
51
|
+
|
|
52
|
+
- `scripts/component-audit.mjs` — 自动化组件质量扫描(5 维度评分)
|
|
53
|
+
- `scripts/fix-source-paths.mjs` — sourcePath 元数据修复
|
|
54
|
+
- `scripts/fix-desc-safe.mjs` — 模板描述安全替换
|
|
55
|
+
- `scripts/fix-component-docs.mjs` — 裸代码示例批量修正
|
|
56
|
+
- `scripts/visual-audit-full.cjs` — 全量视觉检测(546 组件 × 2 主题)
|
|
57
|
+
|
|
58
|
+
## [1.0.7] — 2026-07-09
|
|
59
|
+
|
|
60
|
+
### 组件文档质量修复
|
|
61
|
+
|
|
62
|
+
- **i18n 双语覆盖**:对全部 932 个 bootstrap MDX 文件执行 `split-mdx-locales.mjs` 拆分,生成 `.en.mdx` / `.zh.mdx` 双语文件,i18n 覆盖率从 ~26% 提升至 ~100%。
|
|
63
|
+
- **模板描述修复**:22 个使用统一模板描述的组件(AudioPlayer, Collapsible, Direction, Icon 等)替换为真实功能描述(中英文)。
|
|
64
|
+
- **代码示例补写**:所有组件 MDX 补写可运行的代码示例,覆盖基础用法和关键 props。
|
|
65
|
+
- **残留文件清理**:删除 466 个 `ui-*` / `layout-*` / `business-*` 前缀的重复 MDX 文件,重新生成 `mdx-loaders.ts`。
|
|
66
|
+
- **P0 页面修复**:修复 Icon 和 Direction 页面因缺少必填 props 导致的渲染崩溃。
|
|
67
|
+
- **Windows 兼容性**:修复 `split-mdx-locales.mjs` 多行 import 处理和 `generate-mdx-map.mjs` 路径分隔符问题。
|
|
68
|
+
- **构建配置修复**:修复 `tsup.config.ts` 中 `tsconfig` 属性位置(从 `dts` 内移至顶层),修复 `.dockerignore` 嵌套目录排除规则。
|
|
69
|
+
- **ESLint 修复**:扩展 `.cjs` 文件的 `require()` 豁免范围至 `scripts/` 目录。
|
|
70
|
+
|
|
71
|
+
**验证**:
|
|
72
|
+
|
|
73
|
+
| 闸门 | 结果 |
|
|
74
|
+
| --- | --- |
|
|
75
|
+
| `pnpm run typecheck` | ✅ exit 0 |
|
|
76
|
+
| `pnpm run lint` | ✅ 0 errors (2139 warnings) |
|
|
77
|
+
| `pnpm run build-storybook` | ✅ Storybook build completed successfully |
|
|
78
|
+
| `docker build -t chaos-ui:test .` | ✅ 镜像构建成功 (2.27GB) |
|
|
79
|
+
|
|
8
80
|
## 批次1 — Docs 组件官网改造 (2026-07-05)
|
|
9
81
|
|
|
10
82
|
### 总览
|
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ export default function RootLayout({ children }) {
|
|
|
134
134
|
- **入口**: `/components` — 8 分区搜索总览,卡片式跳转
|
|
135
135
|
- **详情页**: `/components/[category]/[slug]` — 基于 MDX 的组件文档 + 实时预览(Storybook 驱动)
|
|
136
136
|
- **预览覆盖**: 331/331 组件,**100%** 有实时预览(Story 或手写 Demo)
|
|
137
|
-
- **启动**: `npm run dev`,访问 `http://localhost:
|
|
137
|
+
- **启动**: `npm run dev`,访问 `http://localhost:3001`
|
|
138
138
|
- **Storybook**: 独立运行于 `http://localhost:3002`,使用 `npm run storybook` 启动
|
|
139
139
|
|
|
140
140
|
## 组件清单
|
|
@@ -156,7 +156,7 @@ export default function RootLayout({ children }) {
|
|
|
156
156
|
## 开发
|
|
157
157
|
|
|
158
158
|
```bash
|
|
159
|
-
# 启动组件官网 (Next.js
|
|
159
|
+
# 启动组件官网 (Next.js, 端口 3001)
|
|
160
160
|
npm run dev
|
|
161
161
|
|
|
162
162
|
# 独立启动 Storybook (端口 3002)
|
|
@@ -187,21 +187,17 @@ pnpm run format
|
|
|
187
187
|
|
|
188
188
|
Docker 镜像托管在 **GitHub Container Registry**:`ghcr.io/chao2hang/chaos-ui`。推 `main` 分支时自动构建。
|
|
189
189
|
|
|
190
|
-
|
|
190
|
+
容器内运行 Next.js 展示站,同时通过 `serve` 提供 Storybook 静态文件:
|
|
191
191
|
|
|
192
192
|
```
|
|
193
193
|
容器内部
|
|
194
194
|
┌──────────────────┐
|
|
195
195
|
│ │
|
|
196
|
-
:
|
|
197
|
-
│
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
│ :3001 │
|
|
202
|
-
└──────────────────┘
|
|
203
|
-
|
|
204
|
-
:3002 ────►│ serve │
|
|
196
|
+
:3001 ────►│ Next.js │
|
|
197
|
+
│ :3001 │
|
|
198
|
+
└──────────────────┘
|
|
199
|
+
|
|
200
|
+
:3002 ────►│ serve │
|
|
205
201
|
│ storybook-static│
|
|
206
202
|
└──────────────────┘
|
|
207
203
|
```
|
|
@@ -217,12 +213,12 @@ docker build -t ghcr.io/chao2hang/chaos-ui:latest .
|
|
|
217
213
|
```bash
|
|
218
214
|
docker run -d \
|
|
219
215
|
--name chaos-ui \
|
|
220
|
-
-p
|
|
216
|
+
-p 3001:3001 \
|
|
221
217
|
-p 3002:3002 \
|
|
222
218
|
chaos-ui:latest
|
|
223
219
|
|
|
224
220
|
# 访问
|
|
225
|
-
# http://localhost:
|
|
221
|
+
# http://localhost:3001 → Next.js 展示站
|
|
226
222
|
# http://localhost:3002 → Storybook 组件库
|
|
227
223
|
```
|
|
228
224
|
|
|
@@ -239,7 +235,7 @@ docker compose up -d --build
|
|
|
239
235
|
DOCS_PORT=3000 STORYBOOK_PORT=9000 docker compose up -d
|
|
240
236
|
```
|
|
241
237
|
|
|
242
|
-
端口可通过环境变量 `DOCS_PORT`(默认 `
|
|
238
|
+
端口可通过环境变量 `DOCS_PORT`(默认 `3001`)和 `STORYBOOK_PORT`(默认 `3002`)配置。
|
|
243
239
|
|
|
244
240
|
### GitHub Actions Release
|
|
245
241
|
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface NotificationItem {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
timestamp: number | Date | string;
|
|
8
|
+
read?: boolean;
|
|
9
|
+
type?: "info" | "success" | "warning" | "error";
|
|
10
|
+
action?: {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
interface NotificationCenterProps {
|
|
16
|
+
notifications: NotificationItem[];
|
|
17
|
+
onMarkRead?: (id: string) => void;
|
|
18
|
+
onMarkAllRead?: () => void;
|
|
19
|
+
onClear?: () => void;
|
|
20
|
+
onItemClick?: (item: NotificationItem) => void;
|
|
21
|
+
align?: "start" | "center" | "end";
|
|
22
|
+
className?: string;
|
|
23
|
+
emptyText?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @component NotificationCenter
|
|
27
|
+
* @category business/ux
|
|
28
|
+
* @since 0.2.0
|
|
29
|
+
* @description Notification bell with popover panel, unread badge, mark-read/clear-all actions, and type-styled indicators / 通知铃铛组件,含弹出面板、未读标记、已读/清空操作和类型样式指示器
|
|
30
|
+
* @keywords notification, bell, popover, unread, badge, alert
|
|
31
|
+
* @example
|
|
32
|
+
* <NotificationCenter notifications={[{ id: "1", title: "Hello", timestamp: Date.now() }]} />
|
|
33
|
+
*/
|
|
34
|
+
declare function NotificationCenter({ notifications, onMarkRead, onMarkAllRead, onClear, onItemClick, align, className, emptyText, }: NotificationCenterProps): React.JSX.Element;
|
|
35
|
+
|
|
36
|
+
interface UserMenuUser {
|
|
37
|
+
name: string;
|
|
38
|
+
email?: string;
|
|
39
|
+
avatar?: string;
|
|
40
|
+
role?: string;
|
|
41
|
+
}
|
|
42
|
+
interface UserMenuAction {
|
|
43
|
+
label: string;
|
|
44
|
+
icon?: React.ReactNode;
|
|
45
|
+
onClick?: () => void;
|
|
46
|
+
href?: string;
|
|
47
|
+
destructive?: boolean;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface UserMenuProps {
|
|
51
|
+
user: UserMenuUser;
|
|
52
|
+
actions?: UserMenuAction[];
|
|
53
|
+
showProfile?: boolean;
|
|
54
|
+
showSettings?: boolean;
|
|
55
|
+
onProfile?: () => void;
|
|
56
|
+
onSettings?: () => void;
|
|
57
|
+
onSignOut?: () => void;
|
|
58
|
+
align?: "start" | "center" | "end";
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @component UserMenu
|
|
63
|
+
* @category business/ux
|
|
64
|
+
* @since 0.2.0
|
|
65
|
+
* @description Avatar dropdown menu with user info, profile/settings links, custom actions, and sign-out / 头像下拉菜单,包含用户信息、个人资料/设置链接、自定义操作和退出登录
|
|
66
|
+
* @keywords user, menu, avatar, dropdown, profile, settings, signout
|
|
67
|
+
* @example
|
|
68
|
+
* <UserMenu user={currentUser} onProfile={goToProfile} onSignOut={handleSignOut} />
|
|
69
|
+
*/
|
|
70
|
+
declare function UserMenu({ user, actions, showProfile, showSettings, onProfile, onSettings, onSignOut, align, className, }: UserMenuProps): React.JSX.Element;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @component DialogFormBody
|
|
74
|
+
* @category layout
|
|
75
|
+
* @since 0.5.0
|
|
76
|
+
* @description Drop-in body for Dialog forms - stacks FormFields / LabeledFields
|
|
77
|
+
* vertically with appropriate gap and padding.
|
|
78
|
+
* / Dialog form layout, vertical FormField stacking, default gap + padding
|
|
79
|
+
* @example
|
|
80
|
+
* <DialogContent>
|
|
81
|
+
* <DialogHeader>...</DialogHeader>
|
|
82
|
+
* <DialogFormBody>
|
|
83
|
+
* <LabeledField label="Name">...</LabeledField>
|
|
84
|
+
* </DialogFormBody>
|
|
85
|
+
* <DialogFooter>...</DialogFooter>
|
|
86
|
+
* </DialogContent>
|
|
87
|
+
*/
|
|
88
|
+
interface DialogFormBodyProps extends React.ComponentProps<"div"> {
|
|
89
|
+
/** Gap between fields / field spacing, default 4 (1rem) */
|
|
90
|
+
gap?: number | string;
|
|
91
|
+
}
|
|
92
|
+
declare function DialogFormBody({ className, gap, ...props }: DialogFormBodyProps): React.JSX.Element;
|
|
93
|
+
interface FormStackProps extends React.ComponentProps<"div"> {
|
|
94
|
+
/** Gap between items / spacing */
|
|
95
|
+
gap?: number | string;
|
|
96
|
+
/** Direction / layout direction */
|
|
97
|
+
direction?: "vertical" | "horizontal";
|
|
98
|
+
}
|
|
99
|
+
declare function FormStack({ className, gap, direction, ...props }: FormStackProps): React.JSX.Element;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @component MasterDetailLayout
|
|
103
|
+
* @category layout
|
|
104
|
+
* @since 0.5.0
|
|
105
|
+
* @description 主从两栏布局 (master-detail),左侧固定宽度侧边栏 + 右侧自适应主区域。
|
|
106
|
+
*
|
|
107
|
+
* 宽屏并排;窄屏默认堆叠为上下,开启 `collapsible` 后窄屏把 master 折叠成
|
|
108
|
+
* 左侧抽屉(overlay + 遮罩),对齐 Sidebar 的 collapsible 行为。
|
|
109
|
+
* / Master-detail two-column layout; mobile master collapses to a drawer.
|
|
110
|
+
* @keywords layout, master-detail, sidebar, two-column, responsive, drawer
|
|
111
|
+
* @example
|
|
112
|
+
* <MasterDetailLayout
|
|
113
|
+
* sidebar={<TreeView />}
|
|
114
|
+
* main={<SearchTable />}
|
|
115
|
+
* sidebarWidth={320}
|
|
116
|
+
* collapsible
|
|
117
|
+
* />
|
|
118
|
+
*/
|
|
119
|
+
interface MasterDetailLayoutProps extends React.ComponentProps<"div"> {
|
|
120
|
+
/** Sidebar content / 侧边栏内容 */
|
|
121
|
+
sidebar: React.ReactNode;
|
|
122
|
+
/** Main area content / 主区域内容 */
|
|
123
|
+
main: React.ReactNode;
|
|
124
|
+
/** Sidebar width in px / 侧边栏宽度 */
|
|
125
|
+
sidebarWidth?: number;
|
|
126
|
+
/** Gap between sidebar and main / 间距 */
|
|
127
|
+
gap?: "sm" | "md" | "lg";
|
|
128
|
+
/**
|
|
129
|
+
* Collapse master into a drawer on narrow screens.
|
|
130
|
+
* / 窄屏将 master 折叠为抽屉
|
|
131
|
+
*/
|
|
132
|
+
collapsible?: boolean;
|
|
133
|
+
/** Controlled master drawer open state (mobile) / 受控抽屉展开 */
|
|
134
|
+
masterOpen?: boolean;
|
|
135
|
+
/** Uncontrolled default open / 非受控默认展开 */
|
|
136
|
+
defaultMasterOpen?: boolean;
|
|
137
|
+
/** Master open change callback / 展开状态变更回调 */
|
|
138
|
+
onMasterOpenChange?: (open: boolean) => void;
|
|
139
|
+
/** Custom toggle button (defaults to a hamburger Menu button) / 自定义切换按钮 */
|
|
140
|
+
masterToggle?: React.ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* Also collapse master on desktop (not just mobile). / 桌面端也支持折叠 master
|
|
143
|
+
*/
|
|
144
|
+
collapsibleDesktop?: boolean;
|
|
145
|
+
}
|
|
146
|
+
declare function MasterDetailLayout({ className, sidebar, main, sidebarWidth, gap, collapsible, masterOpen, defaultMasterOpen, onMasterOpenChange, masterToggle, collapsibleDesktop, ...props }: MasterDetailLayoutProps): React.JSX.Element;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @component AuthLayout
|
|
150
|
+
* @category layout
|
|
151
|
+
* @since 0.3.0
|
|
152
|
+
* @description Authentication page layout. Supports single-column (centered card)
|
|
153
|
+
* and split-screen (brand left + form right) variants. Collapses to single
|
|
154
|
+
* column on mobile. / 认证页布局,支持单栏居中和双栏(品牌+表单)模式
|
|
155
|
+
* @example
|
|
156
|
+
* <AuthLayout variant="split" brand={<BrandPanel />}>
|
|
157
|
+
* <LoginForm />
|
|
158
|
+
* </AuthLayout>
|
|
159
|
+
*/
|
|
160
|
+
interface AuthLayoutProps extends React.ComponentProps<"div"> {
|
|
161
|
+
/** Layout variant / 布局模式 */
|
|
162
|
+
variant?: "centered" | "split";
|
|
163
|
+
/** Brand panel content (left side in split mode) / 品牌展示区 */
|
|
164
|
+
brand?: React.ReactNode;
|
|
165
|
+
/** Brand panel background class (used when brand is a string or empty) / 品牌区背景样式 */
|
|
166
|
+
brandClassName?: string;
|
|
167
|
+
/** Maximum width of the form panel / 表单区最大宽度 */
|
|
168
|
+
formMaxWidth?: string;
|
|
169
|
+
}
|
|
170
|
+
declare function AuthLayout({ variant, brand, brandClassName, formMaxWidth, className, children, ...props }: AuthLayoutProps): React.JSX.Element;
|
|
171
|
+
|
|
172
|
+
export { AuthLayout as A, DialogFormBody as D, FormStack as F, MasterDetailLayout as M, type NotificationItem as N, type UserMenuUser as U, type UserMenuAction as a, type AuthLayoutProps as b, type DialogFormBodyProps as c, type FormStackProps as d, type MasterDetailLayoutProps as e, NotificationCenter as f, UserMenu as g };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface NotificationItem {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
timestamp: number | Date | string;
|
|
8
|
+
read?: boolean;
|
|
9
|
+
type?: "info" | "success" | "warning" | "error";
|
|
10
|
+
action?: {
|
|
11
|
+
label: string;
|
|
12
|
+
onClick: () => void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
interface NotificationCenterProps {
|
|
16
|
+
notifications: NotificationItem[];
|
|
17
|
+
onMarkRead?: (id: string) => void;
|
|
18
|
+
onMarkAllRead?: () => void;
|
|
19
|
+
onClear?: () => void;
|
|
20
|
+
onItemClick?: (item: NotificationItem) => void;
|
|
21
|
+
align?: "start" | "center" | "end";
|
|
22
|
+
className?: string;
|
|
23
|
+
emptyText?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @component NotificationCenter
|
|
27
|
+
* @category business/ux
|
|
28
|
+
* @since 0.2.0
|
|
29
|
+
* @description Notification bell with popover panel, unread badge, mark-read/clear-all actions, and type-styled indicators / 通知铃铛组件,含弹出面板、未读标记、已读/清空操作和类型样式指示器
|
|
30
|
+
* @keywords notification, bell, popover, unread, badge, alert
|
|
31
|
+
* @example
|
|
32
|
+
* <NotificationCenter notifications={[{ id: "1", title: "Hello", timestamp: Date.now() }]} />
|
|
33
|
+
*/
|
|
34
|
+
declare function NotificationCenter({ notifications, onMarkRead, onMarkAllRead, onClear, onItemClick, align, className, emptyText, }: NotificationCenterProps): React.JSX.Element;
|
|
35
|
+
|
|
36
|
+
interface UserMenuUser {
|
|
37
|
+
name: string;
|
|
38
|
+
email?: string;
|
|
39
|
+
avatar?: string;
|
|
40
|
+
role?: string;
|
|
41
|
+
}
|
|
42
|
+
interface UserMenuAction {
|
|
43
|
+
label: string;
|
|
44
|
+
icon?: React.ReactNode;
|
|
45
|
+
onClick?: () => void;
|
|
46
|
+
href?: string;
|
|
47
|
+
destructive?: boolean;
|
|
48
|
+
disabled?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface UserMenuProps {
|
|
51
|
+
user: UserMenuUser;
|
|
52
|
+
actions?: UserMenuAction[];
|
|
53
|
+
showProfile?: boolean;
|
|
54
|
+
showSettings?: boolean;
|
|
55
|
+
onProfile?: () => void;
|
|
56
|
+
onSettings?: () => void;
|
|
57
|
+
onSignOut?: () => void;
|
|
58
|
+
align?: "start" | "center" | "end";
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @component UserMenu
|
|
63
|
+
* @category business/ux
|
|
64
|
+
* @since 0.2.0
|
|
65
|
+
* @description Avatar dropdown menu with user info, profile/settings links, custom actions, and sign-out / 头像下拉菜单,包含用户信息、个人资料/设置链接、自定义操作和退出登录
|
|
66
|
+
* @keywords user, menu, avatar, dropdown, profile, settings, signout
|
|
67
|
+
* @example
|
|
68
|
+
* <UserMenu user={currentUser} onProfile={goToProfile} onSignOut={handleSignOut} />
|
|
69
|
+
*/
|
|
70
|
+
declare function UserMenu({ user, actions, showProfile, showSettings, onProfile, onSettings, onSignOut, align, className, }: UserMenuProps): React.JSX.Element;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @component DialogFormBody
|
|
74
|
+
* @category layout
|
|
75
|
+
* @since 0.5.0
|
|
76
|
+
* @description Drop-in body for Dialog forms - stacks FormFields / LabeledFields
|
|
77
|
+
* vertically with appropriate gap and padding.
|
|
78
|
+
* / Dialog form layout, vertical FormField stacking, default gap + padding
|
|
79
|
+
* @example
|
|
80
|
+
* <DialogContent>
|
|
81
|
+
* <DialogHeader>...</DialogHeader>
|
|
82
|
+
* <DialogFormBody>
|
|
83
|
+
* <LabeledField label="Name">...</LabeledField>
|
|
84
|
+
* </DialogFormBody>
|
|
85
|
+
* <DialogFooter>...</DialogFooter>
|
|
86
|
+
* </DialogContent>
|
|
87
|
+
*/
|
|
88
|
+
interface DialogFormBodyProps extends React.ComponentProps<"div"> {
|
|
89
|
+
/** Gap between fields / field spacing, default 4 (1rem) */
|
|
90
|
+
gap?: number | string;
|
|
91
|
+
}
|
|
92
|
+
declare function DialogFormBody({ className, gap, ...props }: DialogFormBodyProps): React.JSX.Element;
|
|
93
|
+
interface FormStackProps extends React.ComponentProps<"div"> {
|
|
94
|
+
/** Gap between items / spacing */
|
|
95
|
+
gap?: number | string;
|
|
96
|
+
/** Direction / layout direction */
|
|
97
|
+
direction?: "vertical" | "horizontal";
|
|
98
|
+
}
|
|
99
|
+
declare function FormStack({ className, gap, direction, ...props }: FormStackProps): React.JSX.Element;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @component MasterDetailLayout
|
|
103
|
+
* @category layout
|
|
104
|
+
* @since 0.5.0
|
|
105
|
+
* @description 主从两栏布局 (master-detail),左侧固定宽度侧边栏 + 右侧自适应主区域。
|
|
106
|
+
*
|
|
107
|
+
* 宽屏并排;窄屏默认堆叠为上下,开启 `collapsible` 后窄屏把 master 折叠成
|
|
108
|
+
* 左侧抽屉(overlay + 遮罩),对齐 Sidebar 的 collapsible 行为。
|
|
109
|
+
* / Master-detail two-column layout; mobile master collapses to a drawer.
|
|
110
|
+
* @keywords layout, master-detail, sidebar, two-column, responsive, drawer
|
|
111
|
+
* @example
|
|
112
|
+
* <MasterDetailLayout
|
|
113
|
+
* sidebar={<TreeView />}
|
|
114
|
+
* main={<SearchTable />}
|
|
115
|
+
* sidebarWidth={320}
|
|
116
|
+
* collapsible
|
|
117
|
+
* />
|
|
118
|
+
*/
|
|
119
|
+
interface MasterDetailLayoutProps extends React.ComponentProps<"div"> {
|
|
120
|
+
/** Sidebar content / 侧边栏内容 */
|
|
121
|
+
sidebar: React.ReactNode;
|
|
122
|
+
/** Main area content / 主区域内容 */
|
|
123
|
+
main: React.ReactNode;
|
|
124
|
+
/** Sidebar width in px / 侧边栏宽度 */
|
|
125
|
+
sidebarWidth?: number;
|
|
126
|
+
/** Gap between sidebar and main / 间距 */
|
|
127
|
+
gap?: "sm" | "md" | "lg";
|
|
128
|
+
/**
|
|
129
|
+
* Collapse master into a drawer on narrow screens.
|
|
130
|
+
* / 窄屏将 master 折叠为抽屉
|
|
131
|
+
*/
|
|
132
|
+
collapsible?: boolean;
|
|
133
|
+
/** Controlled master drawer open state (mobile) / 受控抽屉展开 */
|
|
134
|
+
masterOpen?: boolean;
|
|
135
|
+
/** Uncontrolled default open / 非受控默认展开 */
|
|
136
|
+
defaultMasterOpen?: boolean;
|
|
137
|
+
/** Master open change callback / 展开状态变更回调 */
|
|
138
|
+
onMasterOpenChange?: (open: boolean) => void;
|
|
139
|
+
/** Custom toggle button (defaults to a hamburger Menu button) / 自定义切换按钮 */
|
|
140
|
+
masterToggle?: React.ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* Also collapse master on desktop (not just mobile). / 桌面端也支持折叠 master
|
|
143
|
+
*/
|
|
144
|
+
collapsibleDesktop?: boolean;
|
|
145
|
+
}
|
|
146
|
+
declare function MasterDetailLayout({ className, sidebar, main, sidebarWidth, gap, collapsible, masterOpen, defaultMasterOpen, onMasterOpenChange, masterToggle, collapsibleDesktop, ...props }: MasterDetailLayoutProps): React.JSX.Element;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @component AuthLayout
|
|
150
|
+
* @category layout
|
|
151
|
+
* @since 0.3.0
|
|
152
|
+
* @description Authentication page layout. Supports single-column (centered card)
|
|
153
|
+
* and split-screen (brand left + form right) variants. Collapses to single
|
|
154
|
+
* column on mobile. / 认证页布局,支持单栏居中和双栏(品牌+表单)模式
|
|
155
|
+
* @example
|
|
156
|
+
* <AuthLayout variant="split" brand={<BrandPanel />}>
|
|
157
|
+
* <LoginForm />
|
|
158
|
+
* </AuthLayout>
|
|
159
|
+
*/
|
|
160
|
+
interface AuthLayoutProps extends React.ComponentProps<"div"> {
|
|
161
|
+
/** Layout variant / 布局模式 */
|
|
162
|
+
variant?: "centered" | "split";
|
|
163
|
+
/** Brand panel content (left side in split mode) / 品牌展示区 */
|
|
164
|
+
brand?: React.ReactNode;
|
|
165
|
+
/** Brand panel background class (used when brand is a string or empty) / 品牌区背景样式 */
|
|
166
|
+
brandClassName?: string;
|
|
167
|
+
/** Maximum width of the form panel / 表单区最大宽度 */
|
|
168
|
+
formMaxWidth?: string;
|
|
169
|
+
}
|
|
170
|
+
declare function AuthLayout({ variant, brand, brandClassName, formMaxWidth, className, children, ...props }: AuthLayoutProps): React.JSX.Element;
|
|
171
|
+
|
|
172
|
+
export { AuthLayout as A, DialogFormBody as D, FormStack as F, MasterDetailLayout as M, type NotificationItem as N, type UserMenuUser as U, type UserMenuAction as a, type AuthLayoutProps as b, type DialogFormBodyProps as c, type FormStackProps as d, type MasterDetailLayoutProps as e, NotificationCenter as f, UserMenu as g };
|