@particle-network/ui-native 0.0.2 → 0.0.4

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 (2) hide show
  1. package/README.md +260 -28
  2. package/package.json +10 -3
package/README.md CHANGED
@@ -1,57 +1,289 @@
1
- ![picture of storybook](https://github.com/user-attachments/assets/cf98766d-8b90-44ab-b718-94ab16e63205)
1
+ # @particle-network/ui-native
2
2
 
3
- # getting started
3
+ <div align="center">
4
+ <p align="center">
5
+ <strong>UniversalX Design System - React Native 组件库</strong>
6
+ </p>
7
+
8
+ <p align="center">
9
+ 为 iOS 和 Android 提供一致、优雅的原生移动端 UI 组件
10
+ </p>
4
11
 
5
- ```sh
6
- npx create-expo-app --template expo-template-storybook AwesomeStorybook
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/@particle-network/ui-native">
14
+ <img src="https://img.shields.io/npm/v/@particle-network/ui-native.svg" alt="npm version" />
15
+ </a>
16
+ <img src="https://img.shields.io/npm/l/@particle-network/ui-native.svg" alt="license" />
17
+ <img src="https://img.shields.io/npm/dm/@particle-network/ui-native.svg" alt="downloads" />
18
+ </p>
19
+ </div>
20
+
21
+ ## ✨ 特性
22
+
23
+ - 📱 **原生体验** - 遵循 iOS 和 Android 平台设计规范
24
+ - 🎨 **统一设计** - 与 Web 端保持一致的设计语言
25
+ - 🚀 **高性能** - 基于 React Native 优化的组件实现
26
+ - 🛡 **TypeScript** - 完整的类型定义支持
27
+ - 📦 **丰富组件** - 覆盖常见移动端场景的组件库
28
+ - 🎯 **Expo 支持** - 完美支持 Expo 开发工作流
29
+
30
+ ## 📦 安装
31
+
32
+ ### 使用 Expo (推荐)
33
+
34
+ ```bash
35
+ expo install @particle-network/ui-native
7
36
  ```
8
37
 
9
- or
38
+ ### 使用 React Native CLI
10
39
 
11
- ```sh
12
- yarn create expo-app --template expo-template-storybook AwesomeStorybook
40
+ ```bash
41
+ # npm
42
+ npm install @particle-network/ui-native
43
+
44
+ # yarn
45
+ yarn add @particle-network/ui-native
13
46
  ```
14
47
 
15
- # app
48
+ ### 安装依赖
16
49
 
17
- ```sh
18
- yarn start
50
+ 某些组件需要额外的原生依赖:
51
+
52
+ ```bash
53
+ # 必需依赖
54
+ expo install react-native-gesture-handler react-native-reanimated react-native-safe-area-context
55
+
56
+ # 可选依赖(根据使用的组件)
57
+ expo install react-native-svg expo-haptics
19
58
  ```
20
59
 
21
- # RN Storybook (ondevice)
60
+ ## 🚀 快速开始
22
61
 
23
- In this template you can now run `yarn storybook` to start ondevice storybook or `yarn start` to start your expo app.
24
- This works via env variables and expo constants.
62
+ ### 基础设置
25
63
 
26
- ```sh
27
- # either
64
+ 在应用入口包裹 Provider:
65
+
66
+ ```tsx
67
+ import { UXProvider } from '@particle-network/ui-native';
68
+
69
+ export default function App() {
70
+ return (
71
+ <UXProvider>
72
+ <YourApp />
73
+ </UXProvider>
74
+ );
75
+ }
76
+ ```
77
+
78
+ ### 使用组件
79
+
80
+ ```tsx
81
+ import { VStack, UXButton, UXInput, UXSwitch } from '@particle-network/ui-native';
82
+ import { View } from 'react-native';
83
+
84
+ function LoginScreen() {
85
+ const [rememberMe, setRememberMe] = useState(false);
86
+
87
+ return (
88
+ <View style={{ flex: 1, padding: 20 }}>
89
+ <VStack spacing='md'>
90
+ <UXInput placeholder='用户名' autoCapitalize='none' />
91
+ <UXInput placeholder='密码' secureTextEntry />
92
+ <UXSwitch value={rememberMe} onValueChange={setRememberMe} label='记住我' />
93
+ <UXButton color='primary' onPress={() => console.log('登录')}>
94
+ 登录
95
+ </UXButton>
96
+ </VStack>
97
+ </View>
98
+ );
99
+ }
100
+ ```
101
+
102
+ ## 📚 组件列表
103
+
104
+ ### 布局组件
105
+
106
+ - `Box` - 基础容器
107
+ - `Center` - 居中布局
108
+ - `Circle` - 圆形容器
109
+ - `Square` - 正方形容器
110
+ - `Flex` - 弹性布局
111
+ - `HStack` - 水平堆叠
112
+ - `VStack` - 垂直堆叠
113
+
114
+ ### 表单组件
115
+
116
+ - `UXButton` - 按钮
117
+ - `UXInput` - 输入框
118
+ - `UXNumberInput` - 数字输入
119
+ - `UXCheckbox` - 复选框
120
+ - `UXRadio` - 单选框
121
+ - `UXSwitch` - 开关
122
+
123
+ ### 交互组件
124
+
125
+ - `UXPressable` - 可按压组件
126
+ - `UXTouchableOpacity` - 触摸反馈
127
+
128
+ ### 反馈组件
129
+
130
+ - `UXModal` - 模态框
131
+ - `UXTooltip` - 工具提示
132
+ - `UXHint` - 提示信息
133
+
134
+ ### 数据展示
135
+
136
+ - `UXTabs` - 标签页
137
+ - `UXChip` - 标签
138
+ - `UXDivider` - 分割线
139
+ - `ProgressWrapper` - 进度条
140
+ - `Text` - 文本组件
141
+
142
+ ## 🎨 主题定制
143
+
144
+ ### 使用主题
145
+
146
+ ```tsx
147
+ import { UXProvider } from '@particle-network/ui-native';
148
+ import { customTheme } from './theme';
149
+
150
+ export default function App() {
151
+ return (
152
+ <UXProvider theme={customTheme}>
153
+ <YourApp />
154
+ </UXProvider>
155
+ );
156
+ }
157
+ ```
158
+
159
+ ### 自定义主题
160
+
161
+ ```tsx
162
+ const customTheme = {
163
+ colors: {
164
+ primary: '#1890ff',
165
+ secondary: '#52c41a',
166
+ danger: '#ff4d4f',
167
+ warning: '#faad14',
168
+ success: '#52c41a',
169
+ },
170
+ spacing: {
171
+ xs: 4,
172
+ sm: 8,
173
+ md: 16,
174
+ lg: 24,
175
+ xl: 32,
176
+ },
177
+ borderRadius: {
178
+ sm: 4,
179
+ md: 8,
180
+ lg: 16,
181
+ },
182
+ };
183
+ ```
184
+
185
+ ## 🔧 开发工具
186
+
187
+ ### Storybook
188
+
189
+ 本项目集成了 Storybook,方便组件开发和测试:
190
+
191
+ ```bash
192
+ # Web 版 Storybook(推荐用于开发)
193
+ yarn storybook:web
194
+
195
+ # 设备上的 Storybook
28
196
  yarn storybook
29
197
 
30
- # ios
198
+ # iOS
31
199
  yarn storybook:ios
32
200
 
33
- # android
201
+ # Android
34
202
  yarn storybook:android
35
203
  ```
36
204
 
37
- If you add new stories on the native (ondevice version) you either need to have the watcher running or run the stories loader
205
+ ### 开发命令
38
206
 
39
- To update the stories one time
207
+ ```bash
208
+ # 安装依赖
209
+ yarn install
40
210
 
41
- ```sh
42
- yarn storybook-generate
43
- ```
211
+ # 启动开发
212
+ yarn start
213
+
214
+ # 构建库
215
+ yarn build
44
216
 
45
- # Web
217
+ # 运行测试
218
+ yarn test
46
219
 
47
- Start react native web storybook:
220
+ # 类型检查
221
+ yarn type-check
48
222
 
223
+ # 代码检查
224
+ yarn lint
49
225
  ```
50
- yarn storybook:web
226
+
227
+ ## 📱 平台支持
228
+
229
+ | 平台 | 版本要求 |
230
+ | ------------ | -------------- |
231
+ | iOS | 13.0+ |
232
+ | Android | 5.0+ (API 21+) |
233
+ | Expo SDK | 48+ |
234
+ | React Native | 0.71+ |
235
+
236
+ ## 🎯 最佳实践
237
+
238
+ ### 性能优化
239
+
240
+ ```tsx
241
+ import { memo } from 'react';
242
+ import { UXButton } from '@particle-network/ui-native';
243
+
244
+ // 使用 memo 优化组件
245
+ const OptimizedButton = memo(({ onPress, title }) => <UXButton onPress={onPress}>{title}</UXButton>);
51
246
  ```
52
247
 
53
- build react native web storybook:
248
+ ### 响应式设计
249
+
250
+ ```tsx
251
+ import { useResponsive } from '@particle-network/ui-native';
54
252
 
55
- ```sh
56
- yarn build-storybook
253
+ function ResponsiveComponent() {
254
+ const { isTablet } = useResponsive();
255
+
256
+ return <VStack spacing={isTablet ? 'lg' : 'md'}>{/* 根据设备类型调整布局 */}</VStack>;
257
+ }
57
258
  ```
259
+
260
+ ## 🤝 贡献
261
+
262
+ 欢迎贡献代码!请查看[贡献指南](../../CONTRIBUTING.md)了解更多信息。
263
+
264
+ ## 📄 许可证
265
+
266
+ MIT © [UniversalX Team](https://github.com/particle-network)
267
+
268
+ ## 🔗 相关链接
269
+
270
+ - [文档站点](https://ux-design.minijoy.work)
271
+ - [Storybook 演示](https://storybook.ux-design.minijoy.work)
272
+ - [GitHub 仓库](https://gitlab.minijoy.work/frontend/ux-design)
273
+ - [NPM 包](https://www.npmjs.com/package/@particle-network/ui-native)
274
+ - [更新日志](./CHANGELOG.md)
275
+
276
+ ## 🙏 致谢
277
+
278
+ 感谢以下开源项目:
279
+
280
+ - [React Native](https://reactnative.dev/)
281
+ - [Expo](https://expo.dev/)
282
+ - [React Native Reanimated](https://docs.swmansion.com/react-native-reanimated/)
283
+ - [React Native Gesture Handler](https://docs.swmansion.com/react-native-gesture-handler/)
284
+
285
+ ---
286
+
287
+ <div align="center">
288
+ Made with ❤️ by UniversalX Team
289
+ </div>
package/package.json CHANGED
@@ -1,10 +1,17 @@
1
1
  {
2
2
  "name": "@particle-network/ui-native",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "main": "./entry.js",
6
- "module": "dist/index.js",
7
- "types": "dist/index.d.ts",
6
+ "react-native": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
8
15
  "scripts": {
9
16
  "start": "expo start",
10
17
  "android": "expo start --android",