seven-design-ui 0.0.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/.eslintrc.json +35 -0
- package/.prettierrc.json +10 -0
- package/CONTRIBUTING.md +350 -0
- package/PROJECT_STRUCTURE.md +343 -0
- package/README.md +83 -0
- package/app/globals.css +125 -0
- package/app/layout.tsx +45 -0
- package/app/page.tsx +202 -0
- package/components/theme-provider.tsx +11 -0
- package/components/ui/accordion.tsx +66 -0
- package/components/ui/alert-dialog.tsx +157 -0
- package/components/ui/alert.tsx +66 -0
- package/components/ui/aspect-ratio.tsx +11 -0
- package/components/ui/avatar.tsx +53 -0
- package/components/ui/badge.tsx +46 -0
- package/components/ui/breadcrumb.tsx +109 -0
- package/components/ui/button-group.tsx +83 -0
- package/components/ui/button.tsx +60 -0
- package/components/ui/calendar.tsx +213 -0
- package/components/ui/card.tsx +92 -0
- package/components/ui/carousel.tsx +241 -0
- package/components/ui/chart.tsx +353 -0
- package/components/ui/checkbox.tsx +32 -0
- package/components/ui/collapsible.tsx +33 -0
- package/components/ui/command.tsx +184 -0
- package/components/ui/context-menu.tsx +252 -0
- package/components/ui/dialog.tsx +143 -0
- package/components/ui/drawer.tsx +135 -0
- package/components/ui/dropdown-menu.tsx +257 -0
- package/components/ui/empty.tsx +104 -0
- package/components/ui/field.tsx +244 -0
- package/components/ui/form.tsx +167 -0
- package/components/ui/hover-card.tsx +44 -0
- package/components/ui/input-group.tsx +169 -0
- package/components/ui/input-otp.tsx +77 -0
- package/components/ui/input.tsx +21 -0
- package/components/ui/item.tsx +193 -0
- package/components/ui/kbd.tsx +28 -0
- package/components/ui/label.tsx +24 -0
- package/components/ui/menubar.tsx +276 -0
- package/components/ui/navigation-menu.tsx +166 -0
- package/components/ui/pagination.tsx +127 -0
- package/components/ui/popover.tsx +48 -0
- package/components/ui/progress.tsx +31 -0
- package/components/ui/radio-group.tsx +45 -0
- package/components/ui/resizable.tsx +56 -0
- package/components/ui/scroll-area.tsx +58 -0
- package/components/ui/select.tsx +185 -0
- package/components/ui/separator.tsx +28 -0
- package/components/ui/sheet.tsx +139 -0
- package/components/ui/sidebar.tsx +726 -0
- package/components/ui/skeleton.tsx +13 -0
- package/components/ui/slider.tsx +63 -0
- package/components/ui/sonner.tsx +25 -0
- package/components/ui/spinner.tsx +16 -0
- package/components/ui/switch.tsx +31 -0
- package/components/ui/table.tsx +116 -0
- package/components/ui/tabs.tsx +66 -0
- package/components/ui/textarea.tsx +18 -0
- package/components/ui/toast.tsx +129 -0
- package/components/ui/toaster.tsx +35 -0
- package/components/ui/toggle-group.tsx +73 -0
- package/components/ui/toggle.tsx +47 -0
- package/components/ui/tooltip.tsx +61 -0
- package/components/ui/use-mobile.tsx +19 -0
- package/components/ui/use-toast.ts +191 -0
- package/components.json +21 -0
- package/docs/components/button.mdx +155 -0
- package/docs/components/input.mdx +157 -0
- package/docs/components/pagination.mdx +186 -0
- package/docs/components/switch.mdx +134 -0
- package/docs/doc_build/.nojekyll +0 -0
- package/docs/doc_build/404.html +15 -0
- package/docs/doc_build/components/button.html +39 -0
- package/docs/doc_build/components/input.html +39 -0
- package/docs/doc_build/components/pagination.html +39 -0
- package/docs/doc_build/components/switch.html +38 -0
- package/docs/doc_build/guide/introduction.html +58 -0
- package/docs/doc_build/guide/quick-start.html +98 -0
- package/docs/doc_build/guide/theme.html +139 -0
- package/docs/doc_build/index.html +15 -0
- package/docs/doc_build/logo.svg +1 -0
- package/docs/doc_build/static/css/styles.5a3e7113.css +1 -0
- package/docs/doc_build/static/js/414.04bb58dd.js +6 -0
- package/docs/doc_build/static/js/414.04bb58dd.js.LICENSE.txt +21 -0
- package/docs/doc_build/static/js/async/166.f43be01a.js +2 -0
- package/docs/doc_build/static/js/async/166.f43be01a.js.LICENSE.txt +19 -0
- package/docs/doc_build/static/js/async/218.cd780e24.js +1 -0
- package/docs/doc_build/static/js/async/232.11414fd7.js +1 -0
- package/docs/doc_build/static/js/async/416.b217df75.js +1 -0
- package/docs/doc_build/static/js/async/509.97958e51.js +1 -0
- package/docs/doc_build/static/js/async/512.9047d21e.js +1 -0
- package/docs/doc_build/static/js/async/531.131f5963.js +1 -0
- package/docs/doc_build/static/js/async/562.b402b94f.js +2 -0
- package/docs/doc_build/static/js/async/562.b402b94f.js.LICENSE.txt +11 -0
- package/docs/doc_build/static/js/async/637.cb5d76c9.js +1 -0
- package/docs/doc_build/static/js/async/712.558b85be.js +1 -0
- package/docs/doc_build/static/js/index.0991c749.js +1 -0
- package/docs/doc_build/static/js/lib-react.ce4199ca.js +2 -0
- package/docs/doc_build/static/js/lib-react.ce4199ca.js.LICENSE.txt +49 -0
- package/docs/doc_build/static/js/lib-router.4000fe55.js +2 -0
- package/docs/doc_build/static/js/lib-router.4000fe55.js.LICENSE.txt +32 -0
- package/docs/doc_build/static/js/styles.f2af9a40.js +1 -0
- package/docs/doc_build/static/search_index.72c9c372.json +1 -0
- package/docs/docs/public/logo.svg +1 -0
- package/docs/guide/introduction.md +50 -0
- package/docs/guide/quick-start.md +132 -0
- package/docs/guide/theme.md +230 -0
- package/docs/index.md +85 -0
- package/docs/package.json +22 -0
- package/docs/public/logo.svg +1 -0
- package/docs/rspress.config.ts +116 -0
- package/hooks/use-mobile.ts +19 -0
- package/hooks/use-toast.ts +191 -0
- package/next.config.mjs +11 -0
- package/package.json +75 -0
- package/packages/components/package.json +34 -0
- package/packages/components/src/button/Button.tsx +83 -0
- package/packages/components/src/button/button.css +256 -0
- package/packages/components/src/button/index.ts +2 -0
- package/packages/components/src/index.ts +8 -0
- package/packages/components/src/input/Input.tsx +230 -0
- package/packages/components/src/input/index.ts +2 -0
- package/packages/components/src/input/input.css +99 -0
- package/packages/components/src/pagination/Pagination.tsx +271 -0
- package/packages/components/src/pagination/index.ts +1 -0
- package/packages/components/src/pagination/pagination.css +225 -0
- package/packages/components/src/switch/Switch.tsx +145 -0
- package/packages/components/src/switch/index.ts +2 -0
- package/packages/components/src/switch/switch.css +119 -0
- package/packages/components/tsconfig.json +12 -0
- package/packages/components/vite.config.ts +31 -0
- package/packages/core/package.json +23 -0
- package/packages/core/src/hooks/useControllableState.ts +31 -0
- package/packages/core/src/hooks/useEventListener.ts +37 -0
- package/packages/core/src/index.ts +7 -0
- package/packages/core/src/utils/classnames.ts +48 -0
- package/packages/core/tsconfig.json +12 -0
- package/packages/core/vite.config.ts +24 -0
- package/packages/theme/package.json +20 -0
- package/packages/theme/src/index.css +138 -0
- package/packages/theme/src/index.ts +1 -0
- package/packages/theme/vite.config.ts +21 -0
- package/play/index.html +13 -0
- package/play/package.json +25 -0
- package/play/src/App.tsx +237 -0
- package/play/src/index.css +93 -0
- package/play/src/main.tsx +14 -0
- package/play/tsconfig.json +8 -0
- package/play/vite.config.ts +10 -0
- package/pnpm-workspace.yaml +4 -0
- package/postcss.config.mjs +8 -0
- package/public/logo.svg +1 -0
- package/scripts/build.sh +19 -0
- package/scripts/deploy-docs.js +38 -0
- package/styles/globals.css +125 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
# SevenDesign 项目结构
|
|
2
|
+
|
|
3
|
+
## 📁 完整目录结构
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
seven-design-ui/
|
|
7
|
+
├── packages/ # Monorepo 子包目录
|
|
8
|
+
│ ├── components/ # 组件库包
|
|
9
|
+
│ │ ├── src/
|
|
10
|
+
│ │ │ ├── button/ # Button 组件
|
|
11
|
+
│ │ │ │ ├── Button.tsx
|
|
12
|
+
│ │ │ │ ├── button.css
|
|
13
|
+
│ │ │ │ └── index.ts
|
|
14
|
+
│ │ │ ├── input/ # Input 组件
|
|
15
|
+
│ │ │ │ ├── Input.tsx
|
|
16
|
+
│ │ │ │ ├── input.css
|
|
17
|
+
│ │ │ │ └── index.ts
|
|
18
|
+
│ │ │ ├── switch/ # Switch 组件
|
|
19
|
+
│ │ │ │ ├── Switch.tsx
|
|
20
|
+
│ │ │ │ ├── switch.css
|
|
21
|
+
│ │ │ │ └── index.ts
|
|
22
|
+
│ │ │ └── index.ts # 统一导出
|
|
23
|
+
│ │ ├── package.json
|
|
24
|
+
│ │ ├── tsconfig.json
|
|
25
|
+
│ │ └── vite.config.ts
|
|
26
|
+
│ │
|
|
27
|
+
│ ├── core/ # 核心工具包
|
|
28
|
+
│ │ ├── src/
|
|
29
|
+
│ │ │ ├── hooks/ # React Hooks
|
|
30
|
+
│ │ │ │ ├── useControllableState.ts
|
|
31
|
+
│ │ │ │ └── useEventListener.ts
|
|
32
|
+
│ │ │ ├── utils/ # 工具函数
|
|
33
|
+
│ │ │ │ └── classnames.ts
|
|
34
|
+
│ │ │ └── index.ts
|
|
35
|
+
│ │ ├── package.json
|
|
36
|
+
│ │ ├── tsconfig.json
|
|
37
|
+
│ │ └── vite.config.ts
|
|
38
|
+
│ │
|
|
39
|
+
│ └── theme/ # 主题样式包
|
|
40
|
+
│ ├── src/
|
|
41
|
+
│ │ └── index.css # 主题 CSS Variables
|
|
42
|
+
│ ├── package.json
|
|
43
|
+
│ └── vite.config.ts
|
|
44
|
+
│
|
|
45
|
+
├── docs/ # 文档站点(Rspress)
|
|
46
|
+
│ ├── guide/ # 指南文档
|
|
47
|
+
│ │ ├── introduction.md # 介绍
|
|
48
|
+
│ │ ├── quick-start.md # 快速开始
|
|
49
|
+
│ │ └── theme.md # 主题定制
|
|
50
|
+
│ ├── components/ # 组件文档
|
|
51
|
+
│ │ ├── button.mdx # Button 文档
|
|
52
|
+
│ │ ├── input.mdx # Input 文档
|
|
53
|
+
│ │ └── switch.mdx # Switch 文档
|
|
54
|
+
│ ├── index.md # 首页
|
|
55
|
+
│ ├── package.json
|
|
56
|
+
│ └── rspress.config.ts # Rspress 配置
|
|
57
|
+
│
|
|
58
|
+
├── play/ # 本地开发调试环境
|
|
59
|
+
│ ├── src/
|
|
60
|
+
│ │ ├── App.tsx # 测试组件的应用
|
|
61
|
+
│ │ ├── main.tsx # 入口文件
|
|
62
|
+
│ │ └── index.css # 样式
|
|
63
|
+
│ ├── index.html
|
|
64
|
+
│ ├── package.json
|
|
65
|
+
│ ├── tsconfig.json
|
|
66
|
+
│ └── vite.config.ts
|
|
67
|
+
│
|
|
68
|
+
├── scripts/ # 构建和发布脚本
|
|
69
|
+
│ └── build.sh # 构建脚本
|
|
70
|
+
│
|
|
71
|
+
├── .changeset/ # Changesets 配置(版本管理)
|
|
72
|
+
│
|
|
73
|
+
├── .github/ # GitHub 配置
|
|
74
|
+
│ └── workflows/ # GitHub Actions
|
|
75
|
+
│
|
|
76
|
+
├── .eslintrc.json # ESLint 配置
|
|
77
|
+
├── .gitignore # Git 忽略文件
|
|
78
|
+
├── .prettierrc.json # Prettier 配置
|
|
79
|
+
├── CONTRIBUTING.md # 贡献指南
|
|
80
|
+
├── LICENSE # 开源协议
|
|
81
|
+
├── package.json # 根 package.json
|
|
82
|
+
├── pnpm-workspace.yaml # pnpm workspace 配置
|
|
83
|
+
├── PROJECT_STRUCTURE.md # 本文件
|
|
84
|
+
├── README.md # 项目说明
|
|
85
|
+
├── RELEASE.md # 发布指南
|
|
86
|
+
└── tsconfig.json # TypeScript 配置
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 📦 包说明
|
|
90
|
+
|
|
91
|
+
### 1. @seven-design-ui/components
|
|
92
|
+
|
|
93
|
+
**职责**:UI 组件库主包
|
|
94
|
+
|
|
95
|
+
**包含内容**:
|
|
96
|
+
- Button、Input、Switch 等 UI 组件
|
|
97
|
+
- 组件样式(CSS)
|
|
98
|
+
- 组件类型定义(TypeScript)
|
|
99
|
+
|
|
100
|
+
**构建产物**:
|
|
101
|
+
- `dist/index.esm.js` - ES Module 格式
|
|
102
|
+
- `dist/index.cjs.js` - CommonJS 格式
|
|
103
|
+
- `dist/index.d.ts` - TypeScript 类型声明
|
|
104
|
+
- `dist/style.css` - 组件样式
|
|
105
|
+
|
|
106
|
+
**使用方式**:
|
|
107
|
+
```tsx
|
|
108
|
+
import { Button } from '@seven-design-ui/components'
|
|
109
|
+
import '@seven-design-ui/components/dist/style.css'
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. @seven-design-ui/core
|
|
113
|
+
|
|
114
|
+
**职责**:核心工具和 Hooks
|
|
115
|
+
|
|
116
|
+
**包含内容**:
|
|
117
|
+
- React Hooks(useControllableState、useEventListener 等)
|
|
118
|
+
- 工具函数(classnames、createBEM 等)
|
|
119
|
+
- 类型定义
|
|
120
|
+
|
|
121
|
+
**构建产物**:
|
|
122
|
+
- `dist/index.esm.js` - ES Module 格式
|
|
123
|
+
- `dist/index.cjs.js` - CommonJS 格式
|
|
124
|
+
- `dist/index.d.ts` - TypeScript 类型声明
|
|
125
|
+
|
|
126
|
+
**使用方式**:
|
|
127
|
+
```tsx
|
|
128
|
+
import { classnames, useControllableState } from '@seven-design-ui/core'
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 3. @seven-design-ui/theme
|
|
132
|
+
|
|
133
|
+
**职责**:主题样式系统
|
|
134
|
+
|
|
135
|
+
**包含内容**:
|
|
136
|
+
- CSS Variables 定义
|
|
137
|
+
- 基础样式
|
|
138
|
+
- 暗色主题
|
|
139
|
+
|
|
140
|
+
**构建产物**:
|
|
141
|
+
- `dist/index.css` - 主题样式文件
|
|
142
|
+
|
|
143
|
+
**使用方式**:
|
|
144
|
+
```tsx
|
|
145
|
+
import '@seven-design-ui/theme/dist/index.css'
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## 🎮 开发环境
|
|
149
|
+
|
|
150
|
+
### play/
|
|
151
|
+
|
|
152
|
+
**职责**:本地开发和调试环境
|
|
153
|
+
|
|
154
|
+
**特点**:
|
|
155
|
+
- 实时预览组件效果
|
|
156
|
+
- 快速迭代开发
|
|
157
|
+
- 测试组件交互
|
|
158
|
+
|
|
159
|
+
**启动方式**:
|
|
160
|
+
```bash
|
|
161
|
+
pnpm dev
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## 📚 文档站点
|
|
165
|
+
|
|
166
|
+
### docs/
|
|
167
|
+
|
|
168
|
+
**职责**:组件库文档网站
|
|
169
|
+
|
|
170
|
+
**技术栈**:Rspress
|
|
171
|
+
|
|
172
|
+
**包含内容**:
|
|
173
|
+
- 使用指南
|
|
174
|
+
- 组件文档
|
|
175
|
+
- API 说明
|
|
176
|
+
- 示例代码
|
|
177
|
+
|
|
178
|
+
**启动方式**:
|
|
179
|
+
```bash
|
|
180
|
+
pnpm docs:dev
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## 🔧 工作流程
|
|
184
|
+
|
|
185
|
+
### 开发新组件
|
|
186
|
+
|
|
187
|
+
1. 在 `packages/components/src/` 创建组件目录
|
|
188
|
+
2. 实现组件逻辑和样式
|
|
189
|
+
3. 在 `packages/components/src/index.ts` 导出
|
|
190
|
+
4. 在 `play/src/App.tsx` 中测试
|
|
191
|
+
5. 在 `docs/components/` 编写文档
|
|
192
|
+
6. 构建并发布
|
|
193
|
+
|
|
194
|
+
### 构建流程
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# 清理构建产物
|
|
198
|
+
pnpm clean
|
|
199
|
+
|
|
200
|
+
# 构建所有包(按依赖顺序)
|
|
201
|
+
pnpm build:theme # 1. 先构建 theme
|
|
202
|
+
pnpm build:core # 2. 再构建 core
|
|
203
|
+
pnpm build:components # 3. 最后构建 components
|
|
204
|
+
|
|
205
|
+
# 或一次性构建所有
|
|
206
|
+
pnpm build
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 发布流程
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# 1. 添加变更记录
|
|
213
|
+
pnpm changeset
|
|
214
|
+
|
|
215
|
+
# 2. 生成版本号
|
|
216
|
+
pnpm version-packages
|
|
217
|
+
|
|
218
|
+
# 3. 发布到 npm
|
|
219
|
+
pnpm release
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## 🎯 设计原则
|
|
223
|
+
|
|
224
|
+
### 1. 单一职责
|
|
225
|
+
|
|
226
|
+
每个包都有明确的职责:
|
|
227
|
+
- `theme`:只负责样式
|
|
228
|
+
- `core`:只负责工具和 Hooks
|
|
229
|
+
- `components`:只负责 UI 组件
|
|
230
|
+
|
|
231
|
+
### 2. 依赖方向
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
components → core → theme
|
|
235
|
+
↓
|
|
236
|
+
用户项目
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
组件库依赖核心工具,核心工具不依赖组件。
|
|
240
|
+
|
|
241
|
+
### 3. BEM 命名
|
|
242
|
+
|
|
243
|
+
CSS 类名使用 BEM 规范:
|
|
244
|
+
```css
|
|
245
|
+
.sd-button /* Block */
|
|
246
|
+
.sd-button__icon /* Element */
|
|
247
|
+
.sd-button--primary /* Modifier */
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### 4. CSS Variables
|
|
251
|
+
|
|
252
|
+
所有样式使用 CSS Variables:
|
|
253
|
+
```css
|
|
254
|
+
:root {
|
|
255
|
+
--sd-color-primary: #409eff;
|
|
256
|
+
--sd-font-size-base: 14px;
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 5. TypeScript
|
|
261
|
+
|
|
262
|
+
所有代码使用 TypeScript,提供完整类型支持。
|
|
263
|
+
|
|
264
|
+
## 📊 包依赖关系
|
|
265
|
+
|
|
266
|
+
```
|
|
267
|
+
@seven-design-ui/components
|
|
268
|
+
└── @seven-design-ui/core
|
|
269
|
+
└── react
|
|
270
|
+
└── react-dom
|
|
271
|
+
└── @seven-design-ui/theme
|
|
272
|
+
|
|
273
|
+
@seven-design-ui/core
|
|
274
|
+
└── react
|
|
275
|
+
└── react-dom
|
|
276
|
+
|
|
277
|
+
@seven-design-ui/theme
|
|
278
|
+
└── (无依赖)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## 🚀 性能优化
|
|
282
|
+
|
|
283
|
+
1. **按需加载**:支持 Tree-shaking
|
|
284
|
+
2. **样式隔离**:每个组件独立 CSS 文件
|
|
285
|
+
3. **类型优化**:使用 TypeScript 严格模式
|
|
286
|
+
4. **构建优化**:使用 Vite 构建
|
|
287
|
+
|
|
288
|
+
## 📝 文件命名规范
|
|
289
|
+
|
|
290
|
+
- 组件文件:`PascalCase.tsx`(如 `Button.tsx`)
|
|
291
|
+
- 样式文件:`kebab-case.css`(如 `button.css`)
|
|
292
|
+
- 工具文件:`camelCase.ts`(如 `classnames.ts`)
|
|
293
|
+
- 类型文件:`PascalCase.ts`(如 `ButtonProps.ts`)
|
|
294
|
+
- 测试文件:`*.test.tsx` 或 `*.spec.tsx`
|
|
295
|
+
|
|
296
|
+
## 🎨 样式组织
|
|
297
|
+
|
|
298
|
+
```
|
|
299
|
+
packages/theme/src/
|
|
300
|
+
└── index.css # 主题入口
|
|
301
|
+
|
|
302
|
+
packages/components/src/
|
|
303
|
+
├── button/
|
|
304
|
+
│ └── button.css # Button 样式
|
|
305
|
+
├── input/
|
|
306
|
+
│ └── input.css # Input 样式
|
|
307
|
+
└── ...
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
每个组件的样式独立管理,主题样式统一在 theme 包中。
|
|
311
|
+
|
|
312
|
+
## 🧪 测试组织
|
|
313
|
+
|
|
314
|
+
```
|
|
315
|
+
packages/components/src/
|
|
316
|
+
├── button/
|
|
317
|
+
│ ├── Button.tsx
|
|
318
|
+
│ ├── Button.test.tsx # 单元测试
|
|
319
|
+
│ └── button.css
|
|
320
|
+
└── ...
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## 📦 发布包结构
|
|
324
|
+
|
|
325
|
+
发布到 npm 后的包结构:
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
@seven-design-ui/components/
|
|
329
|
+
├── dist/
|
|
330
|
+
│ ├── index.esm.js # ES Module
|
|
331
|
+
│ ├── index.cjs.js # CommonJS
|
|
332
|
+
│ ├── index.d.ts # 类型声明
|
|
333
|
+
│ └── style.css # 样式
|
|
334
|
+
├── src/ # 源码(可选)
|
|
335
|
+
├── package.json
|
|
336
|
+
└── README.md
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
## 🔗 相关链接
|
|
340
|
+
|
|
341
|
+
- [贡献指南](./CONTRIBUTING.md)
|
|
342
|
+
- [发布指南](./RELEASE.md)
|
|
343
|
+
- [开发文档](./docs/)
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# SevenDesign
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>企业级 React UI 组件库</strong>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
一个现代化的、可定制的、TypeScript 驱动的 React 组件库
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
## ✨ 特性
|
|
12
|
+
|
|
13
|
+
- 🎨 **精美设计**:现代化的设计风格,参考 Element Plus
|
|
14
|
+
- 📦 **开箱即用**:丰富的组件库,满足企业级应用需求
|
|
15
|
+
- 🔧 **TypeScript**:完整的类型定义,提供更好的开发体验
|
|
16
|
+
- 🎭 **主题定制**:基于 CSS Variables 的主题系统
|
|
17
|
+
- ⚡ **按需加载**:支持 Tree-shaking,减小打包体积
|
|
18
|
+
- 📚 **完善文档**:详细的组件文档和示例
|
|
19
|
+
|
|
20
|
+
## 📦 安装
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# npm
|
|
24
|
+
npm install seven-design-ui
|
|
25
|
+
|
|
26
|
+
# pnpm
|
|
27
|
+
pnpm add seven-design-ui
|
|
28
|
+
|
|
29
|
+
# yarn
|
|
30
|
+
yarn add seven-design-ui
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 🚀 快速开始
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Button } from 'seven-design-ui'
|
|
37
|
+
import 'seven-design-ui/dist/style.css'
|
|
38
|
+
|
|
39
|
+
function App() {
|
|
40
|
+
return <Button type="primary">点击我</Button>
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 📖 文档
|
|
45
|
+
|
|
46
|
+
访问 [组件文档](https://sevendesign.dev) 查看完整的组件列表和使用指南。
|
|
47
|
+
|
|
48
|
+
## 🔨 本地开发
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# 安装依赖
|
|
52
|
+
pnpm install
|
|
53
|
+
|
|
54
|
+
# 启动开发环境
|
|
55
|
+
pnpm dev
|
|
56
|
+
|
|
57
|
+
# 启动文档站点
|
|
58
|
+
pnpm docs:dev
|
|
59
|
+
|
|
60
|
+
# 构建所有包
|
|
61
|
+
pnpm build
|
|
62
|
+
|
|
63
|
+
# 运行测试
|
|
64
|
+
pnpm test
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 📁 项目结构
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
seven-design-ui/
|
|
71
|
+
├── packages/
|
|
72
|
+
│ ├── components/ # UI 组件库
|
|
73
|
+
│ ├── core/ # 核心工具和 hooks
|
|
74
|
+
│ └── theme/ # 主题样式
|
|
75
|
+
├── docs/ # 文档站点(Rspress)
|
|
76
|
+
├── play/ # 本地开发调试
|
|
77
|
+
└── scripts/ # 构建脚本
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## 🤝 贡献
|
|
81
|
+
|
|
82
|
+
欢迎提交 Issue 和 Pull Request!
|
|
83
|
+
|
package/app/globals.css
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
@import 'tailwindcss';
|
|
2
|
+
@import 'tw-animate-css';
|
|
3
|
+
|
|
4
|
+
@custom-variant dark (&:is(.dark *));
|
|
5
|
+
|
|
6
|
+
:root {
|
|
7
|
+
--background: oklch(1 0 0);
|
|
8
|
+
--foreground: oklch(0.145 0 0);
|
|
9
|
+
--card: oklch(1 0 0);
|
|
10
|
+
--card-foreground: oklch(0.145 0 0);
|
|
11
|
+
--popover: oklch(1 0 0);
|
|
12
|
+
--popover-foreground: oklch(0.145 0 0);
|
|
13
|
+
--primary: oklch(0.205 0 0);
|
|
14
|
+
--primary-foreground: oklch(0.985 0 0);
|
|
15
|
+
--secondary: oklch(0.97 0 0);
|
|
16
|
+
--secondary-foreground: oklch(0.205 0 0);
|
|
17
|
+
--muted: oklch(0.97 0 0);
|
|
18
|
+
--muted-foreground: oklch(0.556 0 0);
|
|
19
|
+
--accent: oklch(0.97 0 0);
|
|
20
|
+
--accent-foreground: oklch(0.205 0 0);
|
|
21
|
+
--destructive: oklch(0.577 0.245 27.325);
|
|
22
|
+
--destructive-foreground: oklch(0.577 0.245 27.325);
|
|
23
|
+
--border: oklch(0.922 0 0);
|
|
24
|
+
--input: oklch(0.922 0 0);
|
|
25
|
+
--ring: oklch(0.708 0 0);
|
|
26
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
27
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
28
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
29
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
30
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
31
|
+
--radius: 0.625rem;
|
|
32
|
+
--sidebar: oklch(0.985 0 0);
|
|
33
|
+
--sidebar-foreground: oklch(0.145 0 0);
|
|
34
|
+
--sidebar-primary: oklch(0.205 0 0);
|
|
35
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
36
|
+
--sidebar-accent: oklch(0.97 0 0);
|
|
37
|
+
--sidebar-accent-foreground: oklch(0.205 0 0);
|
|
38
|
+
--sidebar-border: oklch(0.922 0 0);
|
|
39
|
+
--sidebar-ring: oklch(0.708 0 0);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.dark {
|
|
43
|
+
--background: oklch(0.145 0 0);
|
|
44
|
+
--foreground: oklch(0.985 0 0);
|
|
45
|
+
--card: oklch(0.145 0 0);
|
|
46
|
+
--card-foreground: oklch(0.985 0 0);
|
|
47
|
+
--popover: oklch(0.145 0 0);
|
|
48
|
+
--popover-foreground: oklch(0.985 0 0);
|
|
49
|
+
--primary: oklch(0.985 0 0);
|
|
50
|
+
--primary-foreground: oklch(0.205 0 0);
|
|
51
|
+
--secondary: oklch(0.269 0 0);
|
|
52
|
+
--secondary-foreground: oklch(0.985 0 0);
|
|
53
|
+
--muted: oklch(0.269 0 0);
|
|
54
|
+
--muted-foreground: oklch(0.708 0 0);
|
|
55
|
+
--accent: oklch(0.269 0 0);
|
|
56
|
+
--accent-foreground: oklch(0.985 0 0);
|
|
57
|
+
--destructive: oklch(0.396 0.141 25.723);
|
|
58
|
+
--destructive-foreground: oklch(0.637 0.237 25.331);
|
|
59
|
+
--border: oklch(0.269 0 0);
|
|
60
|
+
--input: oklch(0.269 0 0);
|
|
61
|
+
--ring: oklch(0.439 0 0);
|
|
62
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
63
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
64
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
65
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
66
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
67
|
+
--sidebar: oklch(0.205 0 0);
|
|
68
|
+
--sidebar-foreground: oklch(0.985 0 0);
|
|
69
|
+
--sidebar-primary: oklch(0.488 0.243 264.376);
|
|
70
|
+
--sidebar-primary-foreground: oklch(0.985 0 0);
|
|
71
|
+
--sidebar-accent: oklch(0.269 0 0);
|
|
72
|
+
--sidebar-accent-foreground: oklch(0.985 0 0);
|
|
73
|
+
--sidebar-border: oklch(0.269 0 0);
|
|
74
|
+
--sidebar-ring: oklch(0.439 0 0);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@theme inline {
|
|
78
|
+
--font-sans: 'Geist', 'Geist Fallback';
|
|
79
|
+
--font-mono: 'Geist Mono', 'Geist Mono Fallback';
|
|
80
|
+
--color-background: var(--background);
|
|
81
|
+
--color-foreground: var(--foreground);
|
|
82
|
+
--color-card: var(--card);
|
|
83
|
+
--color-card-foreground: var(--card-foreground);
|
|
84
|
+
--color-popover: var(--popover);
|
|
85
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
86
|
+
--color-primary: var(--primary);
|
|
87
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
88
|
+
--color-secondary: var(--secondary);
|
|
89
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
90
|
+
--color-muted: var(--muted);
|
|
91
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
92
|
+
--color-accent: var(--accent);
|
|
93
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
94
|
+
--color-destructive: var(--destructive);
|
|
95
|
+
--color-destructive-foreground: var(--destructive-foreground);
|
|
96
|
+
--color-border: var(--border);
|
|
97
|
+
--color-input: var(--input);
|
|
98
|
+
--color-ring: var(--ring);
|
|
99
|
+
--color-chart-1: var(--chart-1);
|
|
100
|
+
--color-chart-2: var(--chart-2);
|
|
101
|
+
--color-chart-3: var(--chart-3);
|
|
102
|
+
--color-chart-4: var(--chart-4);
|
|
103
|
+
--color-chart-5: var(--chart-5);
|
|
104
|
+
--radius-sm: calc(var(--radius) - 4px);
|
|
105
|
+
--radius-md: calc(var(--radius) - 2px);
|
|
106
|
+
--radius-lg: var(--radius);
|
|
107
|
+
--radius-xl: calc(var(--radius) + 4px);
|
|
108
|
+
--color-sidebar: var(--sidebar);
|
|
109
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
110
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
111
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
112
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
113
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
114
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
115
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@layer base {
|
|
119
|
+
* {
|
|
120
|
+
@apply border-border outline-ring/50;
|
|
121
|
+
}
|
|
122
|
+
body {
|
|
123
|
+
@apply bg-background text-foreground;
|
|
124
|
+
}
|
|
125
|
+
}
|
package/app/layout.tsx
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Metadata } from 'next'
|
|
2
|
+
import { Geist, Geist_Mono } from 'next/font/google'
|
|
3
|
+
import { Analytics } from '@vercel/analytics/next'
|
|
4
|
+
import './globals.css'
|
|
5
|
+
|
|
6
|
+
const geist = Geist({ subsets: ["latin"] });
|
|
7
|
+
const geistMono = Geist_Mono({ subsets: ["latin"] });
|
|
8
|
+
|
|
9
|
+
export const metadata: Metadata = {
|
|
10
|
+
title: 'sevenDesign',
|
|
11
|
+
description: 'sevenDesign UI',
|
|
12
|
+
generator: 'sevenDesign',
|
|
13
|
+
icons: {
|
|
14
|
+
icon: [
|
|
15
|
+
{
|
|
16
|
+
url: '/icon-light-32x32.png',
|
|
17
|
+
media: '(prefers-color-scheme: light)',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
url: '/icon-dark-32x32.png',
|
|
21
|
+
media: '(prefers-color-scheme: dark)',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
url: '/icon.svg',
|
|
25
|
+
type: 'image/svg+xml',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
apple: '/apple-icon.png',
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default function RootLayout({
|
|
33
|
+
children,
|
|
34
|
+
}: Readonly<{
|
|
35
|
+
children: React.ReactNode
|
|
36
|
+
}>) {
|
|
37
|
+
return (
|
|
38
|
+
<html lang="en">
|
|
39
|
+
<body className={`${geist.className} ${geistMono.className} antialiased`}>
|
|
40
|
+
{children}
|
|
41
|
+
<Analytics />
|
|
42
|
+
</body>
|
|
43
|
+
</html>
|
|
44
|
+
)
|
|
45
|
+
}
|