@unif/react-native-design 0.4.36 → 0.5.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.
Files changed (32) hide show
  1. package/README.md +11 -80
  2. package/docs-home.css +980 -0
  3. package/lib/module/components/ui/Reveal/Reveal.js +28 -0
  4. package/lib/module/components/ui/Reveal/Reveal.js.map +1 -0
  5. package/lib/module/components/ui/Reveal/Reveal.web.js +48 -0
  6. package/lib/module/components/ui/Reveal/Reveal.web.js.map +1 -0
  7. package/lib/module/components/ui/Reveal/index.js +4 -0
  8. package/lib/module/components/ui/Reveal/index.js.map +1 -0
  9. package/lib/module/components/ui/Reveal/types.js +4 -0
  10. package/lib/module/components/ui/Reveal/types.js.map +1 -0
  11. package/lib/module/components/ui/index.js +1 -0
  12. package/lib/module/components/ui/index.js.map +1 -1
  13. package/lib/module/index.js +2 -0
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/typescript/src/components/ui/Reveal/Reveal.d.ts +11 -0
  16. package/lib/typescript/src/components/ui/Reveal/Reveal.d.ts.map +1 -0
  17. package/lib/typescript/src/components/ui/Reveal/Reveal.web.d.ts +10 -0
  18. package/lib/typescript/src/components/ui/Reveal/Reveal.web.d.ts.map +1 -0
  19. package/lib/typescript/src/components/ui/Reveal/index.d.ts +3 -0
  20. package/lib/typescript/src/components/ui/Reveal/index.d.ts.map +1 -0
  21. package/lib/typescript/src/components/ui/Reveal/types.d.ts +12 -0
  22. package/lib/typescript/src/components/ui/Reveal/types.d.ts.map +1 -0
  23. package/lib/typescript/src/components/ui/index.d.ts +2 -0
  24. package/lib/typescript/src/components/ui/index.d.ts.map +1 -1
  25. package/lib/typescript/src/index.d.ts.map +1 -1
  26. package/package.json +4 -2
  27. package/src/components/ui/Reveal/Reveal.tsx +29 -0
  28. package/src/components/ui/Reveal/Reveal.web.tsx +46 -0
  29. package/src/components/ui/Reveal/index.ts +2 -0
  30. package/src/components/ui/Reveal/types.ts +12 -0
  31. package/src/components/ui/index.ts +2 -0
  32. package/src/index.tsx +2 -0
package/README.md CHANGED
@@ -5,7 +5,10 @@
5
5
  [![License](https://img.shields.io/npm/l/@unif/react-native-design.svg?color=blue)](LICENSE)
6
6
  [![Docs](https://img.shields.io/badge/docs-unif--design.github.io-orange.svg)](https://unif-design.github.io/react-native-design/)
7
7
 
8
- Unif 设计系统 —— theme + icons + utils + components,面向 React Native 0.85 新架构(Fabric + concurrent React)
8
+ Unif 设计系统:theme(设计令牌)+ 组件 + 图标 + utils,面向 RN 0.85 新架构(Fabric + concurrent React)。所有 Unif 应用与端能力包的 UI 基座。
9
+
10
+ > 📖 **完整文档**(快速开始 · 组件 · 设计令牌 · 设计原则):
11
+ > **https://unif-design.github.io/react-native-design/**
9
12
 
10
13
  ## 安装
11
14
 
@@ -13,93 +16,21 @@ Unif 设计系统 —— theme + icons + utils + components,面向 React Native
13
16
  yarn add @unif/react-native-design
14
17
  ```
15
18
 
16
- 需要在宿主工程提前安装的 peer dependencies:
17
-
18
- ```sh
19
- yarn add react-native-svg react-native-gesture-handler react-native-reanimated \
20
- react-native-worklets react-native-safe-area-context \
21
- react-native-reanimated-carousel @gorhom/bottom-sheet @sbaiahmed1/react-native-blur
22
- ```
19
+ 需要一组 peer(`react-native-svg` / `react-native-gesture-handler` / `react-native-reanimated` / `react-native-worklets` / `react-native-safe-area-context` / `react-native-reanimated-carousel` / `@gorhom/bottom-sheet` / `@sbaiahmed1/react-native-blur`)+ 根挂 `ThemeProvider`,详见[文档站 · 快速开始](https://unif-design.github.io/react-native-design/docs/getting-started)。
23
20
 
24
21
  ## 用法
25
22
 
26
- 在 app 根附近挂一次 `ThemeProvider`,并按需挂载命令式 host:
27
-
28
- ```tsx
29
- import { ThemeProvider, ToastHost, ConfirmHost } from '@unif/react-native-design';
30
-
31
- export function App() {
32
- return (
33
- <ThemeProvider>
34
- {/* ...你的导航 / 屏幕... */}
35
- <ToastHost />
36
- <ConfirmHost />
37
- </ThemeProvider>
38
- );
39
- }
40
- ```
41
-
42
- 组件内通过 `useThemedStyles` 拿当前主题的 `StyleSheet`:
43
-
44
23
  ```tsx
45
- import { Button, useThemedStyles, type ColorTokens } from '@unif/react-native-design';
46
- import { View } from 'react-native';
24
+ import { Button, useColors, useThemedStyles } from '@unif/react-native-design';
47
25
 
48
- // makeStyles 必须定义在模块顶层,不要写在组件里 inline
49
- const makeStyles = (c: ColorTokens) => ({
50
- wrap: { padding: 16, backgroundColor: c.surface },
51
- });
52
-
53
- export function Demo() {
54
- const styles = useThemedStyles(makeStyles);
55
- return (
56
- <View style={styles.wrap}>
57
- <Button label="保存" onPress={() => {}} />
58
- </View>
59
- );
26
+ function MyScreen() {
27
+ const c = useColors();
28
+ return <Button label="提交" onPress={() => {}} />;
60
29
  }
61
30
  ```
62
31
 
63
- 命令式 API:
64
-
65
- ```tsx
66
- import { toast, confirm } from '@unif/react-native-design';
67
-
68
- toast.success('已保存');
69
-
70
- const ok = await confirm({
71
- title: '确认注销账号?',
72
- message: '注销后数据无法恢复',
73
- destructive: true,
74
- });
75
- ```
76
-
77
- ## 包结构
78
-
79
- - **theme** —— `ThemeProvider` / `useTheme` / `useColors` / `useShadow` / `useThemedStyles`,以及 color / shadow / type / space / radius / icon / control / motion 等 token,`r` / `rf` 尺寸 & 字号缩放
80
- - **icons** —— `IconName` 联合类型 + `ICONS` 数据(用 `<Icon name="..." />` 渲染)
81
- - **components/ui** —— 原子组件:Button、Card、Cell、NavBar、BottomSheet、Toast、Confirm、Input、Search、Tabs、Switch 等约 37 个
82
- - **components/business** —— 通用业务复合组件:AvatarWithRing、Decorations、GlassStats、VersionPill(耦合 navigation / store 的组件留在消费者仓库)
83
- - **utils** —— `createLogger(scope)` 日志器、`childTestID` 列表型组件 testID 拼接助手
84
-
85
- ## Example
86
-
87
- `example/` 是接通本库的 RN 宿主应用:
88
-
89
- ```sh
90
- yarn
91
- yarn example start # metro
92
- yarn example ios # 或 yarn example android
93
- ```
94
-
95
- 源码改动会通过 Metro monorepo 配置直接热更新,不需要重新构建原生。
96
-
97
- ## 贡献
98
-
99
- - [开发流程](CONTRIBUTING.md#development-workflow)
100
- - [提交 PR](CONTRIBUTING.md#sending-a-pull-request)
101
- - [行为准则](CODE_OF_CONDUCT.md)
32
+ 组件 API、token 调色板、暗色适配、设计原则 —— 见[文档站](https://unif-design.github.io/react-native-design/)。
102
33
 
103
- ## License
34
+ ## 许可
104
35
 
105
36
  MIT