@mxmweb/zui 1.3.3 → 1.3.5

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.
Files changed (3) hide show
  1. package/README.md +413 -0
  2. package/package.json +1 -1
  3. package/stats.html +4949 -0
package/README.md CHANGED
@@ -0,0 +1,413 @@
1
+ # @mxmweb/zui
2
+
3
+ 一个现代化的 React UI 组件库,提供完整的主题系统和丰富的组件集合。
4
+
5
+ ## 📦 包结构
6
+
7
+ ZUI 采用模块化设计,包含以下子包:
8
+ - **@mxmweb/zui-theme** (v2.1.x) - 主题系统包
9
+ - **@mxmweb/zui-elements** (v1.1.x) - 基础元素组件
10
+ - **@mxmweb/zui-components** (v1.1.x) - 复杂业务组件
11
+ - **@mxmweb/zui-layouts** (v1.1.x) - 布局容器组件
12
+ - **@mxmweb/zui-icons** (v1.x) - 图标组件包
13
+
14
+ ## 🚀 快速开始
15
+
16
+ ### 安装
17
+
18
+ ```bash
19
+ # 安装主包(推荐)
20
+ npm install @mxmweb/zui
21
+
22
+ # 或者安装子包(按需安装)
23
+ npm install @mxmweb/zui-theme @mxmweb/zui-elements @mxmweb/zui-components @mxmweb/zui-layouts @mxmweb/zui-icons
24
+ ```
25
+
26
+ ### 依赖要求
27
+
28
+ 确保你的项目已安装以下依赖:
29
+
30
+ ```json
31
+ {
32
+ "dependencies": {
33
+ "react": ">=18.0.0 <20.0.0",
34
+ "react-dom": ">=18.0.0 <20.0.0",
35
+ "styled-components": "^6.0.0"
36
+ }
37
+ }
38
+ ```
39
+
40
+ **可选依赖**(根据使用的组件):
41
+ ```json
42
+ {
43
+ "dependencies": {
44
+ "animejs": "^3.0.0", // 动画组件需要
45
+ "antd": "^5.0.0", // 表单组件需要
46
+ "lucide-react": "^0.456.0" // 图标组件需要
47
+ }
48
+ }
49
+ ```
50
+
51
+ ### 基础使用
52
+
53
+ ```tsx
54
+ import React from 'react';
55
+ import { ThemeProvider, Button, GoogleNavbar } from '@mxmweb/zui';
56
+ import '@mxmweb/zui/style.css';
57
+
58
+ // 自定义主题
59
+ const customTheme = {
60
+ colors: {
61
+ primary: '#007bff',
62
+ background: '#ffffff',
63
+ text: '#333333'
64
+ },
65
+ space: {
66
+ radius: '8px',
67
+ padding: '16px'
68
+ }
69
+ };
70
+
71
+ function App() {
72
+ return (
73
+ <ThemeProvider theme={customTheme}>
74
+ <div>
75
+ <GoogleNavbar
76
+ items={[
77
+ { key: 'home', name: '首页', icon: '🏠' },
78
+ { key: 'about', name: '关于', icon: 'ℹ️' }
79
+ ]}
80
+ />
81
+ <Button mode="primary" label="点击我" />
82
+ </div>
83
+ </ThemeProvider>
84
+ );
85
+ }
86
+
87
+ export default App;
88
+ ```
89
+
90
+ ## 🎨 主题系统
91
+
92
+ ZUI 提供强大的主题系统,支持 3 级优先级:
93
+
94
+ 1. **用户 styles** - 最高优先级
95
+ 2. **useTheme 上下文** - 中等优先级
96
+ 3. **默认主题** - 基础优先级
97
+
98
+ ### 主题配置
99
+
100
+ ```tsx
101
+ import { ThemeProvider, useTheme } from '@mxmweb/zui';
102
+
103
+ // 全局主题配置
104
+ const globalTheme = {
105
+ theme: {
106
+ colors: {
107
+ primary: '#007bff',
108
+ secondary: '#6c757d',
109
+ success: '#28a745',
110
+ error: '#dc3545',
111
+ background: '#ffffff',
112
+ text: '#333333',
113
+ border: '#dee2e6'
114
+ },
115
+ space: {
116
+ radius: '8px',
117
+ padding: '16px'
118
+ },
119
+ fonts: {
120
+ heading: {
121
+ family: 'PingFang SC, Microsoft YaHei, Arial, sans-serif',
122
+ size: '16px',
123
+ weight: '600'
124
+ },
125
+ body: {
126
+ family: 'PingFang SC, Microsoft YaHei, Arial, sans-serif',
127
+ size: '14px',
128
+ weight: '400'
129
+ }
130
+ }
131
+ },
132
+ mode: 'light' // 或 'dark'
133
+ };
134
+
135
+ // 组件级主题覆盖
136
+ function MyComponent() {
137
+ const globalTheme = useTheme();
138
+
139
+ const customStyles = {
140
+ theme: {
141
+ colors: {
142
+ primary: '#ff6b6b' // 覆盖全局主题
143
+ }
144
+ }
145
+ };
146
+
147
+ return (
148
+ <Button
149
+ mode="primary"
150
+ label="自定义按钮"
151
+ styles={customStyles} // 最高优先级
152
+ />
153
+ );
154
+ }
155
+ ```
156
+
157
+ ## 📚 组件文档
158
+
159
+ ### 基础元素 (@mxmweb/zui-elements)
160
+
161
+ #### Button 按钮
162
+ ```tsx
163
+ import { Button } from '@mxmweb/zui';
164
+
165
+ <Button
166
+ mode="primary" // 'primary' | 'default' | 'error' | 'text'
167
+ label="按钮文字"
168
+ icon={<Icon />} // 可选图标
169
+ disabled={false} // 禁用状态
170
+ loading={false} // 加载状态
171
+ onClick={() => {}} // 点击事件
172
+ styles={customStyles} // 自定义样式
173
+ />
174
+ ```
175
+
176
+ #### DropdownMenu 下拉菜单
177
+ ```tsx
178
+ import { DropdownMenu } from '@mxmweb/zui';
179
+
180
+ <DropdownMenu
181
+ actions={[
182
+ { key: 'edit', label: '编辑', icon: <EditIcon /> },
183
+ { key: 'delete', label: '删除', icon: <DeleteIcon />, type: 'divider' },
184
+ { key: 'more', label: '更多' }
185
+ ]}
186
+ onAction={(key) => console.log(key)}
187
+ direction="bottom" // 'top' | 'bottom'
188
+ styles={customStyles}
189
+ />
190
+ ```
191
+
192
+ ### 复杂组件 (@mxmweb/zui-components)
193
+
194
+ #### GoogleNavbar 导航栏
195
+ ```tsx
196
+ import { GoogleNavbar } from '@mxmweb/zui';
197
+
198
+ <GoogleNavbar
199
+ items={[
200
+ {
201
+ key: 'home',
202
+ name: '首页',
203
+ icon: '🏠',
204
+ activeIcon: '🏡',
205
+ path: '/home',
206
+ badge: 5
207
+ }
208
+ ]}
209
+ activePath="/home"
210
+ open={true}
211
+ onOpenChange={(open) => {}}
212
+ onItemClick={(item) => {}}
213
+ logo={<Logo />}
214
+ styles={customStyles}
215
+ />
216
+ ```
217
+
218
+ #### DynamicTable 动态表格
219
+ ```tsx
220
+ import { DynamicTable } from '@mxmweb/zui';
221
+
222
+ <DynamicTable
223
+ columns={[
224
+ { id: 'name', title: '姓名', type: 'text' },
225
+ { id: 'age', title: '年龄', type: 'number' },
226
+ { id: 'status', title: '状态', type: 'status' }
227
+ ]}
228
+ dataSource={[
229
+ { id: '1', data: [
230
+ { columnId: 'name', value: '张三' },
231
+ { columnId: 'age', value: 25 }
232
+ ]}
233
+ ]}
234
+ allowMultiSelect={true}
235
+ viewBehavior="pagination"
236
+ styles={customStyles}
237
+ />
238
+ ```
239
+
240
+ #### Uploader 文件上传
241
+ ```tsx
242
+ import { Uploader } from '@mxmweb/zui';
243
+
244
+ <Uploader
245
+ multiple={true}
246
+ accept="image/*"
247
+ maxSize={10} // MB
248
+ url="/api/upload"
249
+ autoUpload={true}
250
+ itemForm={[
251
+ { name: 'title', label: '标题', type: 'text' },
252
+ { name: 'description', label: '描述', type: 'textarea' }
253
+ ]}
254
+ eventsEmit={(event, data) => {
255
+ console.log(event, data);
256
+ }}
257
+ styles={customStyles}
258
+ />
259
+ ```
260
+
261
+ ### 布局容器 (@mxmweb/zui-layouts)
262
+
263
+ #### DashboardContainer 仪表板容器
264
+ ```tsx
265
+ import { DashboardContainer } from '@mxmweb/zui';
266
+
267
+ <DashboardContainer
268
+ title="仪表板"
269
+ description="系统概览"
270
+ breadcrumbs={[
271
+ { id: 'home', label: '首页', path: '/' },
272
+ { id: 'dashboard', label: '仪表板' }
273
+ ]}
274
+ dockItems={navItems}
275
+ goBack={() => history.back()}
276
+ eventsEmit={{
277
+ onBreadcrumbClick: (item, index) => {},
278
+ onGoBack: () => {},
279
+ onTitleClick: () => {}
280
+ }}
281
+ styles={customStyles}
282
+ >
283
+ <YourContent />
284
+ </DashboardContainer>
285
+ ```
286
+
287
+ #### DockContainer 全屏容器
288
+ ```tsx
289
+ import { DockContainer } from '@mxmweb/zui';
290
+
291
+ <DockContainer
292
+ backgroundImage="/bg.jpg"
293
+ backgroundColor="#1a1a1a"
294
+ header={<Header />}
295
+ dockItems={dockItems}
296
+ dockActiveMode="single"
297
+ eventsEmit={{
298
+ onDockItemClick: (item, index) => {},
299
+ onDockActiveChange: (activeId, item) => {}
300
+ }}
301
+ styles={customStyles}
302
+ >
303
+ <YourContent />
304
+ </DockContainer>
305
+ ```
306
+
307
+ ## 🔧 高级配置
308
+
309
+ ### 按需导入
310
+
311
+ ```tsx
312
+ // 只导入需要的组件
313
+ import { Button, DropdownMenu } from '@mxmweb/zui-elements';
314
+ import { GoogleNavbar, DynamicTable } from '@mxmweb/zui-components';
315
+ import { DashboardContainer } from '@mxmweb/zui-layouts';
316
+ import { ThemeProvider } from '@mxmweb/zui-theme';
317
+ ```
318
+
319
+ ### TypeScript 支持
320
+
321
+ 所有组件都提供完整的 TypeScript 类型定义:
322
+
323
+ ```tsx
324
+ import type {
325
+ ButtonProps,
326
+ DropdownMenuAction,
327
+ GoggleNavItem,
328
+ DynamicTableColumn,
329
+ Styles,
330
+ AppTheme
331
+ } from '@mxmweb/zui';
332
+ ```
333
+
334
+ ### 样式覆盖
335
+
336
+ ```tsx
337
+ // 全局样式覆盖
338
+ const globalStyles = {
339
+ theme: {
340
+ colors: {
341
+ primary: '#your-color'
342
+ }
343
+ }
344
+ };
345
+
346
+ <ThemeProvider theme={globalStyles}>
347
+ <App />
348
+ </ThemeProvider>
349
+
350
+ // 组件级样式覆盖
351
+ <Button
352
+ styles={{
353
+ theme: {
354
+ colors: {
355
+ primary: '#component-specific-color'
356
+ }
357
+ }
358
+ }}
359
+ />
360
+ ```
361
+
362
+ ## 📋 版本兼容性
363
+
364
+ | 包名 | 当前版本 | React | Node | 主要特性 |
365
+ |------|----------|-------|------|----------|
366
+ | @mxmweb/zui | 1.3.4 | >=18 <20 | >=22 | 聚合包 |
367
+ | @mxmweb/zui-theme | 2.1.3 | >=18 <20 | >=22 | 主题系统 |
368
+ | @mxmweb/zui-elements | 1.1.4 | >=18 <20 | >=22 | 基础组件 |
369
+ | @mxmweb/zui-components | 1.1.2 | >=18 <20 | >=22 | 业务组件 |
370
+ | @mxmweb/zui-layouts | 1.1.2 | >=18 <20 | >=22 | 布局容器 |
371
+
372
+ ## 🛠️ 开发指南
373
+
374
+ ### 本地开发
375
+
376
+ ```bash
377
+ # 克隆仓库
378
+ git clone https://github.com/mxmweb/zui.git
379
+ cd zui
380
+
381
+ # 安装依赖
382
+ pnpm install
383
+
384
+ # 启动开发服务器
385
+ pnpm dev
386
+
387
+ # 构建所有包
388
+ pnpm build:all
389
+
390
+ # 发布包
391
+ pnpm publish
392
+ ```
393
+
394
+ ### 贡献指南
395
+
396
+ 1. Fork 仓库
397
+ 2. 创建功能分支
398
+ 3. 提交更改
399
+ 4. 推送到分支
400
+ 5. 创建 Pull Request
401
+
402
+ ## 📄 许可证
403
+
404
+ MIT License - 详见 [LICENSE](LICENSE) 文件
405
+
406
+ ## 🤝 支持
407
+
408
+ - 📧 邮箱:mxm.web.develop@gmail.com
409
+ - 🐛 问题反馈:[GitHub Issues](https://github.com/mxmweb/zui/issues)
410
+
411
+ ---
412
+
413
+ **ZUI** - 让 React 开发更简单、更高效!
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "style": "assets/style.css",
6
6
  "types": "cluster_enter.d.ts",
7
7
  "private": false,
8
- "version": "1.3.3",
8
+ "version": "1.3.5",
9
9
  "author": "hanfeng_Zhang",
10
10
  "type": "module",
11
11
  "scripts": {