lingui-ui 1.0.0
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/LICENSE +21 -0
- package/README.md +284 -0
- package/dist/index.d.ts +1309 -0
- package/dist/index.esm.js +82961 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +83083 -0
- package/dist/index.js.map +1 -0
- package/package.json +82 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 code 100 precent
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# LingUI
|
|
2
|
+
|
|
3
|
+
一个现代化、功能丰富的 React UI 组件库,具有精美的动画和主题系统。
|
|
4
|
+
|
|
5
|
+
## ✨ 特性
|
|
6
|
+
|
|
7
|
+
- 🎨 **丰富的组件** - 包含 100+ 个精心设计的 React 组件
|
|
8
|
+
- 🎭 **精美动画** - 基于 Framer Motion 的流畅动画效果
|
|
9
|
+
- 🎨 **主题系统** - 内置多种主题,支持自定义主题
|
|
10
|
+
- 📱 **响应式设计** - 所有组件都支持移动端和桌面端
|
|
11
|
+
- ♿ **无障碍支持** - 遵循 WAI-ARIA 标准
|
|
12
|
+
- 🎯 **TypeScript** - 完整的 TypeScript 类型支持
|
|
13
|
+
- 🚀 **性能优化** - 内置性能监控和优化组件
|
|
14
|
+
- 🎵 **音频反馈** - 可选的音频交互反馈
|
|
15
|
+
|
|
16
|
+
## 📦 安装
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @lingui/ui
|
|
20
|
+
# 或
|
|
21
|
+
yarn add @lingui/ui
|
|
22
|
+
# 或
|
|
23
|
+
pnpm add @lingui/ui
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 🔧 依赖要求
|
|
27
|
+
|
|
28
|
+
LingUI 需要以下 peer dependencies:
|
|
29
|
+
|
|
30
|
+
- React >= 16.8.0
|
|
31
|
+
- React DOM >= 16.8.0
|
|
32
|
+
|
|
33
|
+
## 🚀 快速开始
|
|
34
|
+
|
|
35
|
+
### 基础使用
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Button, Card, Input } from '@lingui/ui';
|
|
39
|
+
|
|
40
|
+
function App() {
|
|
41
|
+
return (
|
|
42
|
+
<div>
|
|
43
|
+
<Button variant="primary" size="md">
|
|
44
|
+
点击我
|
|
45
|
+
</Button>
|
|
46
|
+
|
|
47
|
+
<Card title="示例卡片" padding="md">
|
|
48
|
+
<Input placeholder="输入内容" />
|
|
49
|
+
</Card>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 样式配置
|
|
56
|
+
|
|
57
|
+
LingUI 使用 Tailwind CSS。你需要在项目中配置 Tailwind CSS:
|
|
58
|
+
|
|
59
|
+
1. 安装 Tailwind CSS:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -D tailwindcss postcss autoprefixer
|
|
63
|
+
npx tailwindcss init -p
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
2. 在 `tailwind.config.js` 中添加内容路径:
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
module.exports = {
|
|
70
|
+
content: [
|
|
71
|
+
"./src/**/*.{js,jsx,ts,tsx}",
|
|
72
|
+
"./node_modules/@lingui/ui/dist/**/*.{js,jsx,ts,tsx}"
|
|
73
|
+
],
|
|
74
|
+
// ... 其他配置
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. 在 CSS 文件中导入 Tailwind:
|
|
79
|
+
|
|
80
|
+
```css
|
|
81
|
+
@tailwind base;
|
|
82
|
+
@tailwind components;
|
|
83
|
+
@tailwind utilities;
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 📚 组件文档
|
|
87
|
+
|
|
88
|
+
### UI 组件
|
|
89
|
+
|
|
90
|
+
#### Button
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { Button } from '@lingui/ui';
|
|
94
|
+
|
|
95
|
+
<Button
|
|
96
|
+
variant="primary"
|
|
97
|
+
size="md"
|
|
98
|
+
loading={false}
|
|
99
|
+
onClick={() => console.log('clicked')}
|
|
100
|
+
>
|
|
101
|
+
按钮文本
|
|
102
|
+
</Button>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Props:**
|
|
106
|
+
- `variant`: 'default' | 'primary' | 'secondary' | 'outline' | 'ghost' | 'destructive' | 'success' | 'warning'
|
|
107
|
+
- `size`: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'icon'
|
|
108
|
+
- `loading`: boolean
|
|
109
|
+
- `leftIcon`: ReactNode
|
|
110
|
+
- `rightIcon`: ReactNode
|
|
111
|
+
- `fullWidth`: boolean
|
|
112
|
+
- `animation`: 'none' | 'scale' | 'bounce' | 'pulse' | 'slide'
|
|
113
|
+
- `enableAudio`: boolean
|
|
114
|
+
|
|
115
|
+
#### Card
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import { Card, CardHeader, CardTitle, CardContent, CardFooter } from '@lingui/ui';
|
|
119
|
+
|
|
120
|
+
<Card variant="elevated" padding="md">
|
|
121
|
+
<CardHeader>
|
|
122
|
+
<CardTitle>卡片标题</CardTitle>
|
|
123
|
+
</CardHeader>
|
|
124
|
+
<CardContent>
|
|
125
|
+
卡片内容
|
|
126
|
+
</CardContent>
|
|
127
|
+
<CardFooter>
|
|
128
|
+
卡片底部
|
|
129
|
+
</CardFooter>
|
|
130
|
+
</Card>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Input
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { Input } from '@lingui/ui';
|
|
137
|
+
|
|
138
|
+
<Input
|
|
139
|
+
label="用户名"
|
|
140
|
+
placeholder="请输入用户名"
|
|
141
|
+
error="错误信息"
|
|
142
|
+
helperText="帮助文本"
|
|
143
|
+
size="md"
|
|
144
|
+
/>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### 动画组件
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
import { FadeIn, LoadingAnimation, ParticleEffect } from '@lingui/ui';
|
|
151
|
+
|
|
152
|
+
<FadeIn delay={0.2}>
|
|
153
|
+
<div>淡入动画</div>
|
|
154
|
+
</FadeIn>
|
|
155
|
+
|
|
156
|
+
<LoadingAnimation />
|
|
157
|
+
<ParticleEffect />
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 布局组件
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { Layout, Sidebar, PageContainer } from '@lingui/ui';
|
|
164
|
+
|
|
165
|
+
<Layout>
|
|
166
|
+
<Sidebar />
|
|
167
|
+
<PageContainer>
|
|
168
|
+
页面内容
|
|
169
|
+
</PageContainer>
|
|
170
|
+
</Layout>
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### 表单组件
|
|
174
|
+
|
|
175
|
+
```tsx
|
|
176
|
+
import { AdvancedForm, FormField } from '@lingui/ui';
|
|
177
|
+
|
|
178
|
+
<AdvancedForm onSubmit={handleSubmit}>
|
|
179
|
+
<FormField name="username" label="用户名" required />
|
|
180
|
+
<FormField name="email" label="邮箱" type="email" />
|
|
181
|
+
</AdvancedForm>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## 🎨 主题系统
|
|
185
|
+
|
|
186
|
+
LingUI 内置了多种主题:
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
import { setTheme, getCurrentTheme } from '@lingui/ui';
|
|
190
|
+
|
|
191
|
+
// 设置主题
|
|
192
|
+
setTheme('dark'); // 'default' | 'dark' | 'nature' | 'ocean' | 'sunset' | 'purple' | 'rose' | 'fresh'
|
|
193
|
+
|
|
194
|
+
// 获取当前主题
|
|
195
|
+
const currentTheme = getCurrentTheme();
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## 🎵 音频反馈
|
|
199
|
+
|
|
200
|
+
```tsx
|
|
201
|
+
import { setAudioEnabled, playClickSound } from '@lingui/ui';
|
|
202
|
+
|
|
203
|
+
// 启用/禁用音频
|
|
204
|
+
setAudioEnabled(true);
|
|
205
|
+
|
|
206
|
+
// 播放音效
|
|
207
|
+
playClickSound();
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 📦 导出组件列表
|
|
211
|
+
|
|
212
|
+
### UI 组件
|
|
213
|
+
- Button, Card, Input, Select, Modal, Badge, Avatar, Tabs, Tooltip, Popover, Switch, Slider, Stepper, DatePicker, FileUpload, DragDrop, DragSort, EmptyState, Chart, MarkdownRenderer, InfiniteScroll, VirtualList, NotificationContainer, 等
|
|
214
|
+
|
|
215
|
+
### 布局组件
|
|
216
|
+
- Layout, Sidebar, Footer, Grid, PageContainer, PageHeader
|
|
217
|
+
|
|
218
|
+
### 表单组件
|
|
219
|
+
- AdvancedForm, FormField, FormSection
|
|
220
|
+
|
|
221
|
+
### 数据展示组件
|
|
222
|
+
- DataTable, ProgressBar, StatCard, Timeline, AdvancedChart
|
|
223
|
+
|
|
224
|
+
### 动画组件
|
|
225
|
+
- FadeIn, LoadingAnimation, ParticleEffect, PageTransition, ParallaxScroll, Typewriter, WaterRipple, 等
|
|
226
|
+
|
|
227
|
+
### 其他组件
|
|
228
|
+
- AuthModal, ErrorBoundary, PerformanceMonitor, PWAInstaller, 等
|
|
229
|
+
|
|
230
|
+
## 🛠️ 开发
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
# 克隆仓库
|
|
234
|
+
git clone https://github.com/yourusername/lingui.git
|
|
235
|
+
|
|
236
|
+
# 安装依赖
|
|
237
|
+
npm install
|
|
238
|
+
|
|
239
|
+
# 开发模式
|
|
240
|
+
npm run dev
|
|
241
|
+
|
|
242
|
+
# 构建
|
|
243
|
+
npm run build
|
|
244
|
+
|
|
245
|
+
# 类型检查
|
|
246
|
+
npm run type-check
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## ⚠️ 注意事项
|
|
250
|
+
|
|
251
|
+
### 依赖问题
|
|
252
|
+
|
|
253
|
+
某些工具函数(如 `axios.ts`, `notification.ts`)可能依赖应用特定的 stores 或 config 文件。如果遇到相关错误,你需要:
|
|
254
|
+
|
|
255
|
+
1. **实现缺失的依赖**:根据你的项目需求实现相应的 stores 或 config
|
|
256
|
+
2. **移除相关依赖**:如果不需要这些功能,可以移除相关导入
|
|
257
|
+
|
|
258
|
+
### Tailwind CSS 配置
|
|
259
|
+
|
|
260
|
+
LingUI 使用 Tailwind CSS,你需要在项目中配置 Tailwind。确保在 `tailwind.config.js` 中包含 LingUI 的路径:
|
|
261
|
+
|
|
262
|
+
```js
|
|
263
|
+
content: [
|
|
264
|
+
"./src/**/*.{js,jsx,ts,tsx}",
|
|
265
|
+
"./node_modules/@lingui/ui/dist/**/*.{js,jsx,ts,tsx}"
|
|
266
|
+
]
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## 📝 License
|
|
270
|
+
|
|
271
|
+
MIT License - 详见 [LICENSE](LICENSE) 文件
|
|
272
|
+
|
|
273
|
+
## 🤝 贡献
|
|
274
|
+
|
|
275
|
+
欢迎提交 Issue 和 Pull Request!
|
|
276
|
+
|
|
277
|
+
## 📧 联系方式
|
|
278
|
+
|
|
279
|
+
如有问题或建议,请通过 GitHub Issues 联系我们。
|
|
280
|
+
|
|
281
|
+
## 📚 相关文档
|
|
282
|
+
|
|
283
|
+
- [发布指南](./PUBLISHING.md) - 如何发布新版本到 npm
|
|
284
|
+
|