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.
Files changed (157) hide show
  1. package/.eslintrc.json +35 -0
  2. package/.prettierrc.json +10 -0
  3. package/CONTRIBUTING.md +350 -0
  4. package/PROJECT_STRUCTURE.md +343 -0
  5. package/README.md +83 -0
  6. package/app/globals.css +125 -0
  7. package/app/layout.tsx +45 -0
  8. package/app/page.tsx +202 -0
  9. package/components/theme-provider.tsx +11 -0
  10. package/components/ui/accordion.tsx +66 -0
  11. package/components/ui/alert-dialog.tsx +157 -0
  12. package/components/ui/alert.tsx +66 -0
  13. package/components/ui/aspect-ratio.tsx +11 -0
  14. package/components/ui/avatar.tsx +53 -0
  15. package/components/ui/badge.tsx +46 -0
  16. package/components/ui/breadcrumb.tsx +109 -0
  17. package/components/ui/button-group.tsx +83 -0
  18. package/components/ui/button.tsx +60 -0
  19. package/components/ui/calendar.tsx +213 -0
  20. package/components/ui/card.tsx +92 -0
  21. package/components/ui/carousel.tsx +241 -0
  22. package/components/ui/chart.tsx +353 -0
  23. package/components/ui/checkbox.tsx +32 -0
  24. package/components/ui/collapsible.tsx +33 -0
  25. package/components/ui/command.tsx +184 -0
  26. package/components/ui/context-menu.tsx +252 -0
  27. package/components/ui/dialog.tsx +143 -0
  28. package/components/ui/drawer.tsx +135 -0
  29. package/components/ui/dropdown-menu.tsx +257 -0
  30. package/components/ui/empty.tsx +104 -0
  31. package/components/ui/field.tsx +244 -0
  32. package/components/ui/form.tsx +167 -0
  33. package/components/ui/hover-card.tsx +44 -0
  34. package/components/ui/input-group.tsx +169 -0
  35. package/components/ui/input-otp.tsx +77 -0
  36. package/components/ui/input.tsx +21 -0
  37. package/components/ui/item.tsx +193 -0
  38. package/components/ui/kbd.tsx +28 -0
  39. package/components/ui/label.tsx +24 -0
  40. package/components/ui/menubar.tsx +276 -0
  41. package/components/ui/navigation-menu.tsx +166 -0
  42. package/components/ui/pagination.tsx +127 -0
  43. package/components/ui/popover.tsx +48 -0
  44. package/components/ui/progress.tsx +31 -0
  45. package/components/ui/radio-group.tsx +45 -0
  46. package/components/ui/resizable.tsx +56 -0
  47. package/components/ui/scroll-area.tsx +58 -0
  48. package/components/ui/select.tsx +185 -0
  49. package/components/ui/separator.tsx +28 -0
  50. package/components/ui/sheet.tsx +139 -0
  51. package/components/ui/sidebar.tsx +726 -0
  52. package/components/ui/skeleton.tsx +13 -0
  53. package/components/ui/slider.tsx +63 -0
  54. package/components/ui/sonner.tsx +25 -0
  55. package/components/ui/spinner.tsx +16 -0
  56. package/components/ui/switch.tsx +31 -0
  57. package/components/ui/table.tsx +116 -0
  58. package/components/ui/tabs.tsx +66 -0
  59. package/components/ui/textarea.tsx +18 -0
  60. package/components/ui/toast.tsx +129 -0
  61. package/components/ui/toaster.tsx +35 -0
  62. package/components/ui/toggle-group.tsx +73 -0
  63. package/components/ui/toggle.tsx +47 -0
  64. package/components/ui/tooltip.tsx +61 -0
  65. package/components/ui/use-mobile.tsx +19 -0
  66. package/components/ui/use-toast.ts +191 -0
  67. package/components.json +21 -0
  68. package/docs/components/button.mdx +155 -0
  69. package/docs/components/input.mdx +157 -0
  70. package/docs/components/pagination.mdx +186 -0
  71. package/docs/components/switch.mdx +134 -0
  72. package/docs/doc_build/.nojekyll +0 -0
  73. package/docs/doc_build/404.html +15 -0
  74. package/docs/doc_build/components/button.html +39 -0
  75. package/docs/doc_build/components/input.html +39 -0
  76. package/docs/doc_build/components/pagination.html +39 -0
  77. package/docs/doc_build/components/switch.html +38 -0
  78. package/docs/doc_build/guide/introduction.html +58 -0
  79. package/docs/doc_build/guide/quick-start.html +98 -0
  80. package/docs/doc_build/guide/theme.html +139 -0
  81. package/docs/doc_build/index.html +15 -0
  82. package/docs/doc_build/logo.svg +1 -0
  83. package/docs/doc_build/static/css/styles.5a3e7113.css +1 -0
  84. package/docs/doc_build/static/js/414.04bb58dd.js +6 -0
  85. package/docs/doc_build/static/js/414.04bb58dd.js.LICENSE.txt +21 -0
  86. package/docs/doc_build/static/js/async/166.f43be01a.js +2 -0
  87. package/docs/doc_build/static/js/async/166.f43be01a.js.LICENSE.txt +19 -0
  88. package/docs/doc_build/static/js/async/218.cd780e24.js +1 -0
  89. package/docs/doc_build/static/js/async/232.11414fd7.js +1 -0
  90. package/docs/doc_build/static/js/async/416.b217df75.js +1 -0
  91. package/docs/doc_build/static/js/async/509.97958e51.js +1 -0
  92. package/docs/doc_build/static/js/async/512.9047d21e.js +1 -0
  93. package/docs/doc_build/static/js/async/531.131f5963.js +1 -0
  94. package/docs/doc_build/static/js/async/562.b402b94f.js +2 -0
  95. package/docs/doc_build/static/js/async/562.b402b94f.js.LICENSE.txt +11 -0
  96. package/docs/doc_build/static/js/async/637.cb5d76c9.js +1 -0
  97. package/docs/doc_build/static/js/async/712.558b85be.js +1 -0
  98. package/docs/doc_build/static/js/index.0991c749.js +1 -0
  99. package/docs/doc_build/static/js/lib-react.ce4199ca.js +2 -0
  100. package/docs/doc_build/static/js/lib-react.ce4199ca.js.LICENSE.txt +49 -0
  101. package/docs/doc_build/static/js/lib-router.4000fe55.js +2 -0
  102. package/docs/doc_build/static/js/lib-router.4000fe55.js.LICENSE.txt +32 -0
  103. package/docs/doc_build/static/js/styles.f2af9a40.js +1 -0
  104. package/docs/doc_build/static/search_index.72c9c372.json +1 -0
  105. package/docs/docs/public/logo.svg +1 -0
  106. package/docs/guide/introduction.md +50 -0
  107. package/docs/guide/quick-start.md +132 -0
  108. package/docs/guide/theme.md +230 -0
  109. package/docs/index.md +85 -0
  110. package/docs/package.json +22 -0
  111. package/docs/public/logo.svg +1 -0
  112. package/docs/rspress.config.ts +116 -0
  113. package/hooks/use-mobile.ts +19 -0
  114. package/hooks/use-toast.ts +191 -0
  115. package/next.config.mjs +11 -0
  116. package/package.json +75 -0
  117. package/packages/components/package.json +34 -0
  118. package/packages/components/src/button/Button.tsx +83 -0
  119. package/packages/components/src/button/button.css +256 -0
  120. package/packages/components/src/button/index.ts +2 -0
  121. package/packages/components/src/index.ts +8 -0
  122. package/packages/components/src/input/Input.tsx +230 -0
  123. package/packages/components/src/input/index.ts +2 -0
  124. package/packages/components/src/input/input.css +99 -0
  125. package/packages/components/src/pagination/Pagination.tsx +271 -0
  126. package/packages/components/src/pagination/index.ts +1 -0
  127. package/packages/components/src/pagination/pagination.css +225 -0
  128. package/packages/components/src/switch/Switch.tsx +145 -0
  129. package/packages/components/src/switch/index.ts +2 -0
  130. package/packages/components/src/switch/switch.css +119 -0
  131. package/packages/components/tsconfig.json +12 -0
  132. package/packages/components/vite.config.ts +31 -0
  133. package/packages/core/package.json +23 -0
  134. package/packages/core/src/hooks/useControllableState.ts +31 -0
  135. package/packages/core/src/hooks/useEventListener.ts +37 -0
  136. package/packages/core/src/index.ts +7 -0
  137. package/packages/core/src/utils/classnames.ts +48 -0
  138. package/packages/core/tsconfig.json +12 -0
  139. package/packages/core/vite.config.ts +24 -0
  140. package/packages/theme/package.json +20 -0
  141. package/packages/theme/src/index.css +138 -0
  142. package/packages/theme/src/index.ts +1 -0
  143. package/packages/theme/vite.config.ts +21 -0
  144. package/play/index.html +13 -0
  145. package/play/package.json +25 -0
  146. package/play/src/App.tsx +237 -0
  147. package/play/src/index.css +93 -0
  148. package/play/src/main.tsx +14 -0
  149. package/play/tsconfig.json +8 -0
  150. package/play/vite.config.ts +10 -0
  151. package/pnpm-workspace.yaml +4 -0
  152. package/postcss.config.mjs +8 -0
  153. package/public/logo.svg +1 -0
  154. package/scripts/build.sh +19 -0
  155. package/scripts/deploy-docs.js +38 -0
  156. package/styles/globals.css +125 -0
  157. package/tsconfig.json +30 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "root": true,
3
+ "parser": "@typescript-eslint/parser",
4
+ "parserOptions": {
5
+ "ecmaVersion": 2020,
6
+ "sourceType": "module",
7
+ "ecmaFeatures": {
8
+ "jsx": true
9
+ }
10
+ },
11
+ "plugins": ["@typescript-eslint", "react", "react-hooks"],
12
+ "extends": [
13
+ "eslint:recommended",
14
+ "plugin:@typescript-eslint/recommended",
15
+ "plugin:react/recommended",
16
+ "plugin:react-hooks/recommended",
17
+ "prettier"
18
+ ],
19
+ "rules": {
20
+ "react/react-in-jsx-scope": "off",
21
+ "react/prop-types": "off",
22
+ "@typescript-eslint/no-explicit-any": "warn",
23
+ "@typescript-eslint/explicit-module-boundary-types": "off"
24
+ },
25
+ "settings": {
26
+ "react": {
27
+ "version": "detect"
28
+ }
29
+ },
30
+ "env": {
31
+ "browser": true,
32
+ "es2020": true,
33
+ "node": true
34
+ }
35
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "semi": false,
3
+ "singleQuote": true,
4
+ "tabWidth": 2,
5
+ "useTabs": false,
6
+ "printWidth": 100,
7
+ "trailingComma": "es5",
8
+ "arrowParens": "avoid",
9
+ "endOfLine": "lf"
10
+ }
@@ -0,0 +1,350 @@
1
+ # 贡献指南
2
+
3
+ 感谢你考虑为 SevenDesign 做出贡献!
4
+
5
+ ## 开发设置
6
+
7
+ ### 环境要求
8
+
9
+ - Node.js >= 18.0.0
10
+ - pnpm >= 8.0.0
11
+
12
+ ### 安装依赖
13
+
14
+ ```bash
15
+ # 安装 pnpm(如果还没有安装)
16
+ npm install -g pnpm
17
+
18
+ # 克隆仓库
19
+ git clone https://github.com/7777even/sevenDesign.git
20
+ cd sevenDesign
21
+
22
+ # 安装依赖
23
+ pnpm install
24
+ ```
25
+
26
+ ### 项目结构
27
+
28
+ ```
29
+ seven-design-ui/
30
+ ├── packages/
31
+ │ ├── components/ # UI 组件库
32
+ │ │ ├── src/
33
+ │ │ │ ├── button/
34
+ │ │ │ ├── input/
35
+ │ │ │ └── index.ts
36
+ │ │ ├── package.json
37
+ │ │ └── vite.config.ts
38
+ │ ├── core/ # 核心工具和 hooks
39
+ │ │ ├── src/
40
+ │ │ │ ├── hooks/
41
+ │ │ │ ├── utils/
42
+ │ │ │ └── index.ts
43
+ │ │ └── package.json
44
+ │ └── theme/ # 主题样式
45
+ │ ├── src/
46
+ │ │ └── index.css
47
+ │ └── package.json
48
+ ├── docs/ # 文档站点(Rspress)
49
+ │ ├── guide/
50
+ │ ├── components/
51
+ │ └── rspress.config.ts
52
+ ├── play/ # 本地开发调试
53
+ │ ├── src/
54
+ │ └── package.json
55
+ └── scripts/ # 构建脚本
56
+ ```
57
+
58
+ ## 开发流程
59
+
60
+ ### 启动开发环境
61
+
62
+ ```bash
63
+ # 启动 playground(推荐)
64
+ pnpm dev
65
+
66
+ # 启动文档站点
67
+ pnpm docs:dev
68
+ ```
69
+
70
+ ### 构建项目
71
+
72
+ ```bash
73
+ # 构建所有包
74
+ pnpm build
75
+
76
+ # 构建特定包
77
+ pnpm build:components
78
+ pnpm build:core
79
+ pnpm build:theme
80
+ ```
81
+
82
+ ### 代码规范
83
+
84
+ ```bash
85
+ # 运行 lint
86
+ pnpm lint
87
+
88
+ # 格式化代码
89
+ pnpm format
90
+ ```
91
+
92
+ ### 运行测试
93
+
94
+ ```bash
95
+ # 运行所有测试
96
+ pnpm test
97
+
98
+ # 监听模式
99
+ pnpm test -- --watch
100
+ ```
101
+
102
+ ## 添加新组件
103
+
104
+ ### 1. 创建组件文件
105
+
106
+ 在 `packages/components/src/` 下创建新组件目录:
107
+
108
+ ```
109
+ packages/components/src/
110
+ └── your-component/
111
+ ├── YourComponent.tsx
112
+ ├── your-component.css
113
+ └── index.ts
114
+ ```
115
+
116
+ ### 2. 实现组件
117
+
118
+ ```tsx
119
+ // YourComponent.tsx
120
+ import { forwardRef } from 'react'
121
+ import { classnames } from '@seven-design-ui/core'
122
+ import './your-component.css'
123
+
124
+ export interface YourComponentProps {
125
+ // 定义 props
126
+ }
127
+
128
+ export const YourComponent = forwardRef<HTMLDivElement, YourComponentProps>((props, ref) => {
129
+ // 实现组件逻辑
130
+ return <div ref={ref} className="sd-your-component"></div>
131
+ })
132
+
133
+ YourComponent.displayName = 'YourComponent'
134
+ ```
135
+
136
+ ### 3. 添加样式
137
+
138
+ ```css
139
+ /* your-component.css */
140
+ .sd-your-component {
141
+ /* 样式实现 */
142
+ }
143
+ ```
144
+
145
+ ### 4. 导出组件
146
+
147
+ ```ts
148
+ // index.ts
149
+ export { YourComponent } from './YourComponent'
150
+ export type { YourComponentProps } from './YourComponent'
151
+ ```
152
+
153
+ 在 `packages/components/src/index.ts` 中添加导出:
154
+
155
+ ```ts
156
+ export * from './your-component'
157
+ ```
158
+
159
+ ### 5. 添加文档
160
+
161
+ 在 `docs/components/` 下创建文档文件:
162
+
163
+ ```mdx
164
+ # YourComponent 组件名称
165
+
166
+ 组件描述
167
+
168
+ ## 基础用法
169
+
170
+ \`\`\`tsx live
171
+ <YourComponent />
172
+ \`\`\`
173
+
174
+ ## API
175
+
176
+ ### Props
177
+
178
+ | 属性 | 说明 | 类型 | 默认值 |
179
+ | ---- | ---- | ---- | ------ |
180
+ | ... | ... | ... | ... |
181
+ ```
182
+
183
+ ### 6. 在 Playground 中测试
184
+
185
+ 在 `play/src/App.tsx` 中添加测试代码。
186
+
187
+ ## 版本发布
188
+
189
+ ### 使用 Changesets
190
+
191
+ 1. 创建 changeset:
192
+
193
+ ```bash
194
+ pnpm changeset
195
+ ```
196
+
197
+ 2. 选择要发布的包和版本类型(patch/minor/major)
198
+
199
+ 3. 生成版本号:
200
+
201
+ ```bash
202
+ pnpm version-packages
203
+ ```
204
+
205
+ 4. 发布到 npm:
206
+
207
+ ```bash
208
+ pnpm release
209
+ ```
210
+
211
+ ### 手动发布流程
212
+
213
+ 1. **更新版本号**
214
+
215
+ ```bash
216
+ # 在各个 package.json 中更新版本号
217
+ # packages/components/package.json
218
+ # packages/core/package.json
219
+ # packages/theme/package.json
220
+ ```
221
+
222
+ 2. **构建所有包**
223
+
224
+ ```bash
225
+ pnpm build
226
+ ```
227
+
228
+ 3. **发布到 npm**
229
+
230
+ ```bash
231
+ # 发布 theme 包
232
+ cd packages/theme
233
+ npm publish --access public
234
+
235
+ # 发布 core 包
236
+ cd ../core
237
+ npm publish --access public
238
+
239
+ # 发布 components 包
240
+ cd ../components
241
+ npm publish --access public
242
+ ```
243
+
244
+ 4. **创建 Git 标签**
245
+
246
+ ```bash
247
+ git tag v0.0.1
248
+ git push origin v0.0.1
249
+ ```
250
+
251
+ ## Pull Request 指南
252
+
253
+ ### 提交 PR 前
254
+
255
+ 1. 确保代码通过 lint 检查
256
+ 2. 确保所有测试通过
257
+ 3. 更新相关文档
258
+ 4. 添加 changeset(如果需要)
259
+
260
+ ### PR 标题格式
261
+
262
+ ```
263
+ feat: 添加 XXX 组件
264
+ fix: 修复 XXX 问题
265
+ docs: 更新 XXX 文档
266
+ style: 优化 XXX 样式
267
+ refactor: 重构 XXX
268
+ test: 添加 XXX 测试
269
+ chore: 更新构建配置
270
+ ```
271
+
272
+ ### PR 描述模板
273
+
274
+ ```markdown
275
+ ## 改动说明
276
+
277
+ 简要描述你的改动
278
+
279
+ ## 改动类型
280
+
281
+ - [ ] 新功能
282
+ - [ ] Bug 修复
283
+ - [ ] 文档更新
284
+ - [ ] 样式优化
285
+ - [ ] 代码重构
286
+ - [ ] 测试补充
287
+
288
+ ## 相关 Issue
289
+
290
+ Closes #issue_number
291
+
292
+ ## 测试说明
293
+
294
+ 描述如何测试这个改动
295
+
296
+ ## 截图(如果适用)
297
+ ```
298
+
299
+ ## 代码风格
300
+
301
+ - 使用 TypeScript
302
+ - 遵循 ESLint 规则
303
+ - 使用 Prettier 格式化代码
304
+ - 组件名使用 PascalCase
305
+ - 函数名使用 camelCase
306
+ - CSS 类名使用 BEM 命名规范(`sd-component__element--modifier`)
307
+
308
+ ## 提交规范
309
+
310
+ 使用语义化的提交信息:
311
+
312
+ ```
313
+ <type>(<scope>): <subject>
314
+
315
+ <body>
316
+
317
+ <footer>
318
+ ```
319
+
320
+ 类型(type):
321
+
322
+ - `feat`: 新功能
323
+ - `fix`: Bug 修复
324
+ - `docs`: 文档更新
325
+ - `style`: 代码格式(不影响代码运行的变动)
326
+ - `refactor`: 重构
327
+ - `test`: 测试相关
328
+ - `chore`: 构建过程或辅助工具的变动
329
+
330
+ 示例:
331
+
332
+ ```
333
+ feat(button): 添加 loading 状态
334
+
335
+ - 添加 loading 属性
336
+ - 添加加载动画
337
+ - 更新文档
338
+
339
+ Closes #123
340
+ ```
341
+
342
+ ## 寻求帮助
343
+
344
+ 如果你在贡献过程中遇到任何问题:
345
+
346
+ 1. 查看 [文档](https://sevendesign.dev)
347
+ 2. 搜索 [Issues](https://github.com/7777even/sevenDesign.git/issues)
348
+ 3. 创建新的 Issue 提问
349
+
350
+ 感谢你的贡献! 🎉