dishui 0.0.11 → 0.0.12
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 +185 -34
- package/dist/dishui.css +1 -1
- package/dist/dishui.es.js +23536 -23258
- package/dist/dishui.es.js.map +1 -0
- package/dist/dishui.umd.js +24 -104
- package/dist/dishui.umd.js.map +1 -0
- package/dist/types/src/components/Demo/index.d.ts +5 -1
- package/dist/types/src/components/Select/index.d.ts +2 -2
- package/dist/types/src/contexts/AppContext.d.ts +0 -2
- package/dist/types/src/index.d.ts +2 -0
- package/dist/types/src/index.routes.d.ts +1 -1
- package/package.json +26 -20
package/README.md
CHANGED
|
@@ -1,42 +1,108 @@
|
|
|
1
|
-
# DiShUI
|
|
1
|
+
# DiShUI - 基于 daisyUI 和 Tailwind CSS 的 React 组件库
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
一个优雅、现代的 React UI 组件库,基于 daisyUI 和 Tailwind CSS 构建。
|
|
11
|
+
|
|
12
|
+
[English](./docs/README.en.md) | 简体中文
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
## ✨ 特性
|
|
17
|
+
|
|
18
|
+
- 🎨 **优雅设计** - 基于 daisyUI,提供多种精美主题
|
|
19
|
+
- 📦 **开箱即用** - 完整的 TypeScript 类型支持
|
|
20
|
+
- 🔧 **灵活可定制** - 基于 Tailwind CSS,轻松定制样式
|
|
21
|
+
- 🚀 **现代化** - 使用最新的 React 19 和 Vite 7
|
|
22
|
+
- 📱 **响应式** - 完美支持移动端和桌面端
|
|
23
|
+
- 🎯 **Tree Shaking** - 自动优化打包大小
|
|
24
|
+
- 📖 **丰富文档** - 详细的 API 文档和使用示例
|
|
25
|
+
|
|
26
|
+
## 📦 安装
|
|
6
27
|
|
|
7
28
|
```bash
|
|
8
|
-
pnpm
|
|
9
|
-
|
|
29
|
+
# 使用 pnpm (推荐)
|
|
30
|
+
pnpm add dishui
|
|
31
|
+
|
|
32
|
+
# 使用 npm
|
|
33
|
+
npm install dishui
|
|
34
|
+
|
|
35
|
+
# 使用 yarn
|
|
10
36
|
yarn add dishui
|
|
11
37
|
```
|
|
12
38
|
|
|
13
|
-
##
|
|
39
|
+
## 🚀 快速开始
|
|
40
|
+
|
|
41
|
+
### 1. 配置 Tailwind CSS
|
|
42
|
+
|
|
43
|
+
在你的项目中配置 Tailwind CSS 和 daisyUI:
|
|
14
44
|
|
|
15
|
-
|
|
45
|
+
```bash
|
|
46
|
+
# 安装依赖
|
|
47
|
+
pnpm add -D tailwindcss daisyui
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
在 `tailwind.config.js` 中配置:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
/** @type {import('tailwindcss').Config} */
|
|
54
|
+
export default {
|
|
55
|
+
content: [
|
|
56
|
+
"./index.html",
|
|
57
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
58
|
+
"./node_modules/dishui/dist/**/*.js",
|
|
59
|
+
],
|
|
60
|
+
theme: {
|
|
61
|
+
extend: {},
|
|
62
|
+
},
|
|
63
|
+
plugins: [require("daisyui")],
|
|
64
|
+
daisyui: {
|
|
65
|
+
themes: ["light", "dark", "retro", "cyberpunk"],
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. 导入样式和组件
|
|
16
71
|
|
|
17
72
|
```tsx
|
|
18
|
-
import React from
|
|
19
|
-
import { Button, Badge } from
|
|
20
|
-
import
|
|
73
|
+
import React from 'react';
|
|
74
|
+
import { Button, Badge, Card } from 'dishui';
|
|
75
|
+
import 'dishui/dist/dishui.css';
|
|
21
76
|
|
|
22
77
|
function App() {
|
|
23
78
|
return (
|
|
24
79
|
<div className="p-4">
|
|
25
|
-
<h1 className="text-2xl font-bold mb-4">
|
|
80
|
+
<h1 className="text-2xl font-bold mb-4">DiShUI UI 示例</h1>
|
|
26
81
|
|
|
82
|
+
{/* 按钮示例 */}
|
|
27
83
|
<div className="flex gap-2 mb-4">
|
|
28
|
-
<Button
|
|
29
|
-
<Button variant="
|
|
30
|
-
<Button variant="
|
|
31
|
-
<Button variant="accent">Accent Button</Button>
|
|
84
|
+
<Button variant="primary">主要按钮</Button>
|
|
85
|
+
<Button variant="secondary">次要按钮</Button>
|
|
86
|
+
<Button variant="accent">强调按钮</Button>
|
|
32
87
|
</div>
|
|
33
88
|
|
|
34
|
-
|
|
35
|
-
|
|
89
|
+
{/* 徽章示例 */}
|
|
90
|
+
<div className="flex gap-2 mb-4">
|
|
36
91
|
<Badge variant="primary">Primary</Badge>
|
|
37
|
-
<Badge variant="
|
|
38
|
-
<Badge variant="
|
|
92
|
+
<Badge variant="success">Success</Badge>
|
|
93
|
+
<Badge variant="warning">Warning</Badge>
|
|
39
94
|
</div>
|
|
95
|
+
|
|
96
|
+
{/* 卡片示例 */}
|
|
97
|
+
<Card bordered>
|
|
98
|
+
<Card.Body>
|
|
99
|
+
<Card.Title>卡片标题</Card.Title>
|
|
100
|
+
<p>这是一个卡片组件的示例内容。</p>
|
|
101
|
+
<Card.Actions>
|
|
102
|
+
<Button variant="primary">操作</Button>
|
|
103
|
+
</Card.Actions>
|
|
104
|
+
</Card.Body>
|
|
105
|
+
</Card>
|
|
40
106
|
</div>
|
|
41
107
|
);
|
|
42
108
|
}
|
|
@@ -44,30 +110,115 @@ function App() {
|
|
|
44
110
|
export default App;
|
|
45
111
|
```
|
|
46
112
|
|
|
47
|
-
|
|
113
|
+
## 📚 组件列表
|
|
114
|
+
|
|
115
|
+
### 基础组件
|
|
116
|
+
|
|
117
|
+
- **[Button](./docs/components/Button.md)** - 按钮组件,支持多种样式和尺寸
|
|
118
|
+
- **[Badge](./docs/components/Badge.md)** - 徽章组件,用于标记和分类
|
|
119
|
+
- **[Input](./docs/components/Input.md)** - 输入框组件,支持多种类型
|
|
120
|
+
- **[Label](./docs/components/Label.md)** - 标签组件,用于表单标签
|
|
121
|
+
- **[Select](./docs/components/Select.md)** - 下拉选择组件,支持单选和多选
|
|
122
|
+
|
|
123
|
+
### 数据展示
|
|
124
|
+
|
|
125
|
+
- **[Card](./docs/components/Card.md)** - 卡片容器组件
|
|
126
|
+
- **[Table](./docs/components/Table.md)** - 简单表格组件
|
|
127
|
+
- **[DataTable](./docs/components/DataTable.md)** - 高级数据表格,支持排序、筛选、分页
|
|
128
|
+
- **[List](./docs/components/List.md)** - 列表组件
|
|
129
|
+
|
|
130
|
+
### 工具组件
|
|
131
|
+
|
|
132
|
+
- **[Demo](./docs/components/Demo.md)** - 示例展示组件
|
|
133
|
+
|
|
134
|
+
### 布局组件
|
|
48
135
|
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
- Label - Label component
|
|
53
|
-
- More components coming soon...
|
|
136
|
+
- **MainLayout** - 主布局组件
|
|
137
|
+
- **Sidebar** - 侧边栏组件
|
|
138
|
+
- **Navbar** - 导航栏组件
|
|
54
139
|
|
|
55
|
-
##
|
|
140
|
+
## 🎨 主题
|
|
141
|
+
|
|
142
|
+
DiShUI 支持 daisyUI 的多种主题:
|
|
143
|
+
|
|
144
|
+
- `light` - 浅色主题
|
|
145
|
+
- `dark` - 深色主题
|
|
146
|
+
- `retro` - 复古主题
|
|
147
|
+
- `cyberpunk` - 赛博朋克主题
|
|
148
|
+
- `customblue` - 自定义蓝色主题
|
|
149
|
+
- `ghibli` - 吉卜力风格主题
|
|
150
|
+
|
|
151
|
+
你可以在运行时动态切换主题:
|
|
152
|
+
|
|
153
|
+
```tsx
|
|
154
|
+
import { AppProvider, useAppContext } from 'dishui';
|
|
155
|
+
|
|
156
|
+
function ThemeSwitcher() {
|
|
157
|
+
const { theme, setTheme } = useAppContext();
|
|
158
|
+
|
|
159
|
+
return (
|
|
160
|
+
<select value={theme} onChange={(e) => setTheme(e.target.value)}>
|
|
161
|
+
<option value="light">浅色</option>
|
|
162
|
+
<option value="dark">深色</option>
|
|
163
|
+
<option value="retro">复古</option>
|
|
164
|
+
<option value="cyberpunk">赛博朋克</option>
|
|
165
|
+
</select>
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function App() {
|
|
170
|
+
return (
|
|
171
|
+
<AppProvider>
|
|
172
|
+
<ThemeSwitcher />
|
|
173
|
+
{/* 你的应用内容 */}
|
|
174
|
+
</AppProvider>
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## 🔧 开发
|
|
56
180
|
|
|
57
181
|
```bash
|
|
58
|
-
#
|
|
182
|
+
# 克隆仓库
|
|
183
|
+
git clone https://github.com/yourusername/DishUI.git
|
|
184
|
+
cd DishUI
|
|
185
|
+
|
|
186
|
+
# 安装依赖
|
|
59
187
|
pnpm install
|
|
60
188
|
|
|
61
|
-
#
|
|
62
|
-
pnpm
|
|
189
|
+
# 启动开发服务器
|
|
190
|
+
pnpm dev
|
|
63
191
|
|
|
64
|
-
#
|
|
65
|
-
pnpm
|
|
192
|
+
# 构建库
|
|
193
|
+
pnpm build
|
|
66
194
|
|
|
67
|
-
#
|
|
195
|
+
# 发布到 npm
|
|
68
196
|
pnpm run publish:npm
|
|
69
197
|
```
|
|
70
198
|
|
|
71
|
-
##
|
|
199
|
+
## 📖 文档
|
|
200
|
+
|
|
201
|
+
- [组件文档](./docs/components/README.md)
|
|
202
|
+
- [API 参考](./docs/API.md)
|
|
203
|
+
- [开发指南](./docs/CONTRIBUTING.md)
|
|
204
|
+
- [更新日志](./CHANGELOG.md)
|
|
205
|
+
|
|
206
|
+
## 🤝 贡献
|
|
207
|
+
|
|
208
|
+
欢迎贡献代码!请查看 [贡献指南](./docs/CONTRIBUTING.md) 了解详情。
|
|
209
|
+
|
|
210
|
+
## 📄 许可证
|
|
211
|
+
|
|
212
|
+
ISC License
|
|
213
|
+
|
|
214
|
+
## 🙏 致谢
|
|
215
|
+
|
|
216
|
+
- [React](https://react.dev/) - UI 框架
|
|
217
|
+
- [Tailwind CSS](https://tailwindcss.com/) - CSS 框架
|
|
218
|
+
- [daisyUI](https://daisyui.com/) - Tailwind CSS 组件库
|
|
219
|
+
- [Vite](https://vitejs.dev/) - 构建工具
|
|
220
|
+
- [TanStack Table](https://tanstack.com/table) - 表格解决方案
|
|
221
|
+
|
|
222
|
+
## 📮 联系
|
|
72
223
|
|
|
73
|
-
|
|
224
|
+
如果有任何问题或建议,欢迎提交 Issue 或 Pull Request。
|