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,132 @@
|
|
|
1
|
+
# 快速开始
|
|
2
|
+
|
|
3
|
+
本节将介绍如何在项目中使用 SevenDesign。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
### 使用包管理器
|
|
8
|
+
|
|
9
|
+
::: code-group
|
|
10
|
+
|
|
11
|
+
```bash [npm]
|
|
12
|
+
npm install seven-design-ui
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash [pnpm]
|
|
16
|
+
pnpm add seven-design-ui
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```bash [yarn]
|
|
20
|
+
yarn add seven-design-ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
:::
|
|
24
|
+
|
|
25
|
+
## 完整引入
|
|
26
|
+
|
|
27
|
+
在 main.ts 中写入以下内容:
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { createRoot } from 'react-dom/client'
|
|
31
|
+
import App from './App'
|
|
32
|
+
// 引入样式
|
|
33
|
+
import 'seven-design-ui/dist/style.css'
|
|
34
|
+
|
|
35
|
+
const root = document.getElementById('root')
|
|
36
|
+
if (root) {
|
|
37
|
+
createRoot(root).render(<App />)
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
然后就可以在组件中使用了:
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { Button } from 'seven-design-ui'
|
|
45
|
+
|
|
46
|
+
function App() {
|
|
47
|
+
return <Button type="primary">Hello SevenDesign</Button>
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default App
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 按需引入
|
|
54
|
+
|
|
55
|
+
SevenDesign 支持基于 ES modules 的 tree shaking,直接引入即可按需加载:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { Button, Input, Switch } from 'seven-design-ui'
|
|
59
|
+
import 'seven-design-ui/dist/style.css'
|
|
60
|
+
|
|
61
|
+
function App() {
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<Button type="primary">按钮</Button>
|
|
65
|
+
<Input placeholder="请输入" />
|
|
66
|
+
<Switch />
|
|
67
|
+
</>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 全局配置
|
|
73
|
+
|
|
74
|
+
某些组件如 Button 等,可以通过全局配置来设置默认属性。
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import { ConfigProvider, Button } from 'seven-design-ui'
|
|
78
|
+
|
|
79
|
+
function App() {
|
|
80
|
+
return (
|
|
81
|
+
<ConfigProvider size="large">
|
|
82
|
+
<Button>大尺寸按钮</Button>
|
|
83
|
+
</ConfigProvider>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Vite 项目
|
|
89
|
+
|
|
90
|
+
如果你使用 Vite 创建项目,可以直接使用 SevenDesign:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
// vite.config.ts
|
|
94
|
+
import { defineConfig } from 'vite'
|
|
95
|
+
import react from '@vitejs/plugin-react'
|
|
96
|
+
|
|
97
|
+
export default defineConfig({
|
|
98
|
+
plugins: [react()],
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Next.js 项目
|
|
103
|
+
|
|
104
|
+
在 Next.js 项目中使用 SevenDesign:
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
// app/layout.tsx
|
|
108
|
+
import 'seven-design-ui/dist/style.css'
|
|
109
|
+
|
|
110
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
111
|
+
return (
|
|
112
|
+
<html lang="zh-CN">
|
|
113
|
+
<body>{children}</body>
|
|
114
|
+
</html>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
// app/page.tsx
|
|
121
|
+
'use client'
|
|
122
|
+
|
|
123
|
+
import { Button } from 'seven-design-ui'
|
|
124
|
+
|
|
125
|
+
export default function Home() {
|
|
126
|
+
return <Button type="primary">Hello</Button>
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 开始使用
|
|
131
|
+
|
|
132
|
+
现在你可以开始使用 SevenDesign 了!访问 [组件文档](/components/button) 查看所有可用组件。
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# 主题定制
|
|
2
|
+
|
|
3
|
+
SevenDesign 使用 CSS Variables 实现主题定制,你可以轻松地修改组件的样式。
|
|
4
|
+
|
|
5
|
+
## CSS Variables
|
|
6
|
+
|
|
7
|
+
所有的设计 token 都以 CSS Variables 的形式暴露出来,你可以通过覆盖这些变量来自定义主题。
|
|
8
|
+
|
|
9
|
+
### 品牌色
|
|
10
|
+
|
|
11
|
+
```css
|
|
12
|
+
:root {
|
|
13
|
+
--sd-color-primary: #409eff;
|
|
14
|
+
--sd-color-success: #67c23a;
|
|
15
|
+
--sd-color-warning: #e6a23c;
|
|
16
|
+
--sd-color-danger: #f56c6c;
|
|
17
|
+
--sd-color-info: #909399;
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 文本颜色
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
:root {
|
|
25
|
+
--sd-text-color-primary: #303133;
|
|
26
|
+
--sd-text-color-regular: #606266;
|
|
27
|
+
--sd-text-color-secondary: #909399;
|
|
28
|
+
--sd-text-color-placeholder: #a8abb2;
|
|
29
|
+
--sd-text-color-disabled: #c0c4cc;
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 边框颜色
|
|
34
|
+
|
|
35
|
+
```css
|
|
36
|
+
:root {
|
|
37
|
+
--sd-border-color: #dcdfe6;
|
|
38
|
+
--sd-border-color-light: #e4e7ed;
|
|
39
|
+
--sd-border-color-lighter: #ebeef5;
|
|
40
|
+
--sd-border-color-extra-light: #f2f6fc;
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 背景色
|
|
45
|
+
|
|
46
|
+
```css
|
|
47
|
+
:root {
|
|
48
|
+
--sd-bg-color: #ffffff;
|
|
49
|
+
--sd-bg-color-page: #f2f3f5;
|
|
50
|
+
--sd-bg-color-overlay: #ffffff;
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 自定义主题
|
|
55
|
+
|
|
56
|
+
### 方式一:覆盖 CSS Variables
|
|
57
|
+
|
|
58
|
+
在你的项目中创建一个样式文件,覆盖默认的 CSS Variables:
|
|
59
|
+
|
|
60
|
+
```css
|
|
61
|
+
/* custom-theme.css */
|
|
62
|
+
:root {
|
|
63
|
+
/* 修改主色调 */
|
|
64
|
+
--sd-color-primary: #1890ff;
|
|
65
|
+
|
|
66
|
+
/* 修改圆角 */
|
|
67
|
+
--sd-border-radius-base: 8px;
|
|
68
|
+
|
|
69
|
+
/* 修改字体大小 */
|
|
70
|
+
--sd-font-size-base: 16px;
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
然后在你的应用入口引入:
|
|
75
|
+
|
|
76
|
+
```tsx
|
|
77
|
+
import 'seven-design-ui/dist/style.css'
|
|
78
|
+
import './custom-theme.css'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 方式二:使用内联样式
|
|
82
|
+
|
|
83
|
+
你也可以直接在 HTML 中修改 CSS Variables:
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
function App() {
|
|
87
|
+
return (
|
|
88
|
+
<div
|
|
89
|
+
style={{
|
|
90
|
+
'--sd-color-primary': '#1890ff',
|
|
91
|
+
'--sd-border-radius-base': '8px',
|
|
92
|
+
} as React.CSSProperties}
|
|
93
|
+
>
|
|
94
|
+
<Button type="primary">自定义主题按钮</Button>
|
|
95
|
+
</div>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 暗色主题
|
|
101
|
+
|
|
102
|
+
SevenDesign 内置了暗色主题支持,只需在根元素添加 `.sd-dark` 类名:
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
function App() {
|
|
106
|
+
const [dark, setDark] = React.useState(false)
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div className={dark ? 'sd-dark' : ''}>
|
|
110
|
+
<button onClick={() => setDark(!dark)}>切换主题</button>
|
|
111
|
+
<Button type="primary">按钮</Button>
|
|
112
|
+
</div>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 自定义暗色主题
|
|
118
|
+
|
|
119
|
+
你也可以覆盖暗色主题的 CSS Variables:
|
|
120
|
+
|
|
121
|
+
```css
|
|
122
|
+
/* custom-dark-theme.css */
|
|
123
|
+
.sd-dark {
|
|
124
|
+
--sd-color-primary: #177ddc;
|
|
125
|
+
--sd-bg-color: #1f1f1f;
|
|
126
|
+
--sd-text-color-primary: #e5e5e5;
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 完整的 CSS Variables 列表
|
|
131
|
+
|
|
132
|
+
### 颜色
|
|
133
|
+
|
|
134
|
+
| 变量名 | 说明 | 默认值 |
|
|
135
|
+
| ------------------------- | -------------- | --------- |
|
|
136
|
+
| `--sd-color-primary` | 主色 | `#409eff` |
|
|
137
|
+
| `--sd-color-success` | 成功色 | `#67c23a` |
|
|
138
|
+
| `--sd-color-warning` | 警告色 | `#e6a23c` |
|
|
139
|
+
| `--sd-color-danger` | 危险色 | `#f56c6c` |
|
|
140
|
+
| `--sd-color-info` | 信息色 | `#909399` |
|
|
141
|
+
| `--sd-color-white` | 白色 | `#ffffff` |
|
|
142
|
+
| `--sd-color-black` | 黑色 | `#000000` |
|
|
143
|
+
|
|
144
|
+
### 文本颜色
|
|
145
|
+
|
|
146
|
+
| 变量名 | 说明 | 默认值 |
|
|
147
|
+
| ------------------------------- | ------------ | --------- |
|
|
148
|
+
| `--sd-text-color-primary` | 主要文本 | `#303133` |
|
|
149
|
+
| `--sd-text-color-regular` | 常规文本 | `#606266` |
|
|
150
|
+
| `--sd-text-color-secondary` | 次要文本 | `#909399` |
|
|
151
|
+
| `--sd-text-color-placeholder` | 占位文本 | `#a8abb2` |
|
|
152
|
+
| `--sd-text-color-disabled` | 禁用文本 | `#c0c4cc` |
|
|
153
|
+
|
|
154
|
+
### 边框
|
|
155
|
+
|
|
156
|
+
| 变量名 | 说明 | 默认值 |
|
|
157
|
+
| -------------------------------- | ------------ | --------- |
|
|
158
|
+
| `--sd-border-color` | 边框颜色 | `#dcdfe6` |
|
|
159
|
+
| `--sd-border-color-light` | 浅边框 | `#e4e7ed` |
|
|
160
|
+
| `--sd-border-color-lighter` | 更浅边框 | `#ebeef5` |
|
|
161
|
+
| `--sd-border-color-extra-light` | 极浅边框 | `#f2f6fc` |
|
|
162
|
+
| `--sd-border-radius-base` | 基础圆角 | `4px` |
|
|
163
|
+
| `--sd-border-radius-small` | 小圆角 | `2px` |
|
|
164
|
+
| `--sd-border-radius-round` | 圆形 | `20px` |
|
|
165
|
+
| `--sd-border-radius-circle` | 圆 | `100%` |
|
|
166
|
+
|
|
167
|
+
### 字体
|
|
168
|
+
|
|
169
|
+
| 变量名 | 说明 | 默认值 |
|
|
170
|
+
| --------------------------- | ------------ | ------- |
|
|
171
|
+
| `--sd-font-size-extra-large`| 超大字号 | `20px` |
|
|
172
|
+
| `--sd-font-size-large` | 大字号 | `18px` |
|
|
173
|
+
| `--sd-font-size-medium` | 中等字号 | `16px` |
|
|
174
|
+
| `--sd-font-size-base` | 基础字号 | `14px` |
|
|
175
|
+
| `--sd-font-size-small` | 小字号 | `13px` |
|
|
176
|
+
| `--sd-font-size-extra-small`| 超小字号 | `12px` |
|
|
177
|
+
|
|
178
|
+
### 组件尺寸
|
|
179
|
+
|
|
180
|
+
| 变量名 | 说明 | 默认值 |
|
|
181
|
+
| ------------------------------- | ------------ | ------- |
|
|
182
|
+
| `--sd-component-size-large` | 大尺寸 | `40px` |
|
|
183
|
+
| `--sd-component-size-default` | 默认尺寸 | `32px` |
|
|
184
|
+
| `--sd-component-size-small` | 小尺寸 | `24px` |
|
|
185
|
+
|
|
186
|
+
### 阴影
|
|
187
|
+
|
|
188
|
+
| 变量名 | 说明 |
|
|
189
|
+
| -------------------------- | ------------ |
|
|
190
|
+
| `--sd-box-shadow-base` | 基础阴影 |
|
|
191
|
+
| `--sd-box-shadow-light` | 浅阴影 |
|
|
192
|
+
| `--sd-box-shadow-lighter` | 更浅阴影 |
|
|
193
|
+
| `--sd-box-shadow-dark` | 深阴影 |
|
|
194
|
+
|
|
195
|
+
## 示例
|
|
196
|
+
|
|
197
|
+
### 创建绿色主题
|
|
198
|
+
|
|
199
|
+
```css
|
|
200
|
+
/* green-theme.css */
|
|
201
|
+
:root {
|
|
202
|
+
--sd-color-primary: #52c41a;
|
|
203
|
+
--sd-color-primary-light-3: #7ed321;
|
|
204
|
+
--sd-color-primary-light-5: #95de64;
|
|
205
|
+
--sd-color-primary-light-7: #b7eb8f;
|
|
206
|
+
--sd-color-primary-light-8: #d9f7be;
|
|
207
|
+
--sd-color-primary-light-9: #f6ffed;
|
|
208
|
+
--sd-color-primary-dark-2: #389e0d;
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### 创建紧凑主题
|
|
213
|
+
|
|
214
|
+
```css
|
|
215
|
+
/* compact-theme.css */
|
|
216
|
+
:root {
|
|
217
|
+
--sd-component-size-large: 36px;
|
|
218
|
+
--sd-component-size-default: 28px;
|
|
219
|
+
--sd-component-size-small: 20px;
|
|
220
|
+
--sd-font-size-base: 12px;
|
|
221
|
+
--sd-border-radius-base: 2px;
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## 最佳实践
|
|
226
|
+
|
|
227
|
+
1. **保持一致性**:确保主题颜色在整个应用中保持一致
|
|
228
|
+
2. **考虑可访问性**:确保文本和背景色有足够的对比度
|
|
229
|
+
3. **测试暗色模式**:如果支持暗色模式,确保在两种模式下都测试过
|
|
230
|
+
4. **使用设计系统**:建议基于设计系统来定制主题,而不是随意修改
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
pageType: home
|
|
3
|
+
|
|
4
|
+
hero:
|
|
5
|
+
name: SevenDesign
|
|
6
|
+
text: 企业级 React UI 组件库
|
|
7
|
+
tagline: 现代化、可定制、TypeScript 驱动的组件库
|
|
8
|
+
actions:
|
|
9
|
+
- theme: brand
|
|
10
|
+
text: 快速开始
|
|
11
|
+
link: /guide/quick-start
|
|
12
|
+
- theme: alt
|
|
13
|
+
text: 组件示例
|
|
14
|
+
link: /components/button
|
|
15
|
+
image:
|
|
16
|
+
src: /logo.svg
|
|
17
|
+
alt: SevenDesign Logo
|
|
18
|
+
|
|
19
|
+
features:
|
|
20
|
+
- title: 🎨 精美设计
|
|
21
|
+
details: 现代化的设计风格,参考 Element Plus,提供优雅的用户体验
|
|
22
|
+
- title: 📦 开箱即用
|
|
23
|
+
details: 丰富的组件库,满足企业级应用的各种需求
|
|
24
|
+
- title: 🔧 TypeScript
|
|
25
|
+
details: 完整的类型定义,提供更好的开发体验和代码提示
|
|
26
|
+
- title: 🎭 主题定制
|
|
27
|
+
details: 基于 CSS Variables 的主题系统,轻松定制你的品牌风格
|
|
28
|
+
- title: ⚡ 按需加载
|
|
29
|
+
details: 支持 Tree-shaking,只打包你使用的组件,减小打包体积
|
|
30
|
+
- title: 📚 完善文档
|
|
31
|
+
details: 详细的组件文档和示例代码,帮助你快速上手
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 安装
|
|
35
|
+
|
|
36
|
+
::: code-group
|
|
37
|
+
|
|
38
|
+
```bash [npm]
|
|
39
|
+
npm install seven-design-ui
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```bash [pnpm]
|
|
43
|
+
pnpm add seven-design-ui
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```bash [yarn]
|
|
47
|
+
yarn add seven-design-ui
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
:::
|
|
51
|
+
|
|
52
|
+
## 快速开始
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { Button } from 'seven-design-ui'
|
|
56
|
+
import 'seven-design-ui/dist/style.css'
|
|
57
|
+
|
|
58
|
+
function App() {
|
|
59
|
+
return <Button type="primary">点击我</Button>
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 特性
|
|
64
|
+
|
|
65
|
+
### 企业级设计
|
|
66
|
+
|
|
67
|
+
SevenDesign 采用现代化的设计语言,参考了 Element Plus 的设计理念,为企业级应用提供统一、专业的视觉体验。
|
|
68
|
+
|
|
69
|
+
### TypeScript 支持
|
|
70
|
+
|
|
71
|
+
所有组件都使用 TypeScript 编写,提供完整的类型定义,让你在开发时获得更好的代码提示和类型检查。
|
|
72
|
+
|
|
73
|
+
### 主题定制
|
|
74
|
+
|
|
75
|
+
基于 CSS Variables 的主题系统,你可以轻松定制组件的颜色、尺寸等样式,打造符合你品牌风格的 UI。
|
|
76
|
+
|
|
77
|
+
### 按需引入
|
|
78
|
+
|
|
79
|
+
支持 Tree-shaking,只打包你实际使用的组件,有效减小项目的打包体积。
|
|
80
|
+
|
|
81
|
+
## 社区
|
|
82
|
+
|
|
83
|
+
- [GitHub](https://github.com/7777even/sevenDesign.git)
|
|
84
|
+
- [NPM](https://www.npmjs.com/package/@seven-design-ui/theme)
|
|
85
|
+
- [问题反馈](https://github.com/7777even/sevenDesign.git/issues)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "SevenDesign 文档站点",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "rspress dev --port 3001",
|
|
8
|
+
"build": "rspress build && node -e \"const fs = require('fs'); const path = require('path'); const filePath = path.join('doc_build', '.nojekyll'); fs.mkdirSync(path.dirname(filePath), { recursive: true }); fs.writeFileSync(filePath, '');\"",
|
|
9
|
+
"preview": "rspress preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@seven-design-ui/components": "workspace:*",
|
|
13
|
+
"react": "19.2.3",
|
|
14
|
+
"react-dom": "19.2.3"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/react": "^19.2.0",
|
|
18
|
+
"@types/react-dom": "^19.2.0",
|
|
19
|
+
"rspress": "^1.11.0",
|
|
20
|
+
"typescript": "^5.3.3"
|
|
21
|
+
}
|
|
22
|
+
}
|