@unif/react-native-ui 0.1.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 +20 -0
- package/README.md +103 -0
- package/lib/module/README.md +99 -0
- package/lib/module/action-sheet/index.js +63 -0
- package/lib/module/action-sheet/index.js.map +1 -0
- package/lib/module/action-sheet/index.md +69 -0
- package/lib/module/action-sheet/style/index.js +38 -0
- package/lib/module/action-sheet/style/index.js.map +1 -0
- package/lib/module/avatar/index.js +42 -0
- package/lib/module/avatar/index.js.map +1 -0
- package/lib/module/avatar/index.md +51 -0
- package/lib/module/avatar/style/index.js +17 -0
- package/lib/module/avatar/style/index.js.map +1 -0
- package/lib/module/button/index.js +52 -0
- package/lib/module/button/index.js.map +1 -0
- package/lib/module/button/index.md +90 -0
- package/lib/module/button/style/index.js +94 -0
- package/lib/module/button/style/index.js.map +1 -0
- package/lib/module/center/index.js +21 -0
- package/lib/module/center/index.js.map +1 -0
- package/lib/module/center/index.md +28 -0
- package/lib/module/center/style/index.js +10 -0
- package/lib/module/center/style/index.js.map +1 -0
- package/lib/module/chip/index.js +59 -0
- package/lib/module/chip/index.js.map +1 -0
- package/lib/module/chip/index.md +60 -0
- package/lib/module/chip/style/index.js +40 -0
- package/lib/module/chip/style/index.js.map +1 -0
- package/lib/module/column/index.js +30 -0
- package/lib/module/column/index.js.map +1 -0
- package/lib/module/column/index.md +34 -0
- package/lib/module/column/style/index.js +9 -0
- package/lib/module/column/style/index.js.map +1 -0
- package/lib/module/divider/index.js +21 -0
- package/lib/module/divider/index.js.map +1 -0
- package/lib/module/divider/index.md +44 -0
- package/lib/module/divider/style/index.js +17 -0
- package/lib/module/divider/style/index.js.map +1 -0
- package/lib/module/hooks/index.js +4 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/index.md +71 -0
- package/lib/module/hooks/useMergeStyles.js +27 -0
- package/lib/module/hooks/useMergeStyles.js.map +1 -0
- package/lib/module/index.js +29 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/input/index.js +69 -0
- package/lib/module/input/index.js.map +1 -0
- package/lib/module/input/index.md +73 -0
- package/lib/module/input/style/index.js +27 -0
- package/lib/module/input/style/index.js.map +1 -0
- package/lib/module/list-item/index.js +69 -0
- package/lib/module/list-item/index.js.map +1 -0
- package/lib/module/list-item/index.md +101 -0
- package/lib/module/list-item/style/index.js +39 -0
- package/lib/module/list-item/style/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/popover/index.js +60 -0
- package/lib/module/popover/index.js.map +1 -0
- package/lib/module/popover/index.md +57 -0
- package/lib/module/popover/style/index.js +22 -0
- package/lib/module/popover/style/index.js.map +1 -0
- package/lib/module/row/index.js +31 -0
- package/lib/module/row/index.js.map +1 -0
- package/lib/module/row/index.md +46 -0
- package/lib/module/row/style/index.js +15 -0
- package/lib/module/row/style/index.js.map +1 -0
- package/lib/module/space/index.js +20 -0
- package/lib/module/space/index.js.map +1 -0
- package/lib/module/space/index.md +31 -0
- package/lib/module/space/style/index.js +9 -0
- package/lib/module/space/style/index.js.map +1 -0
- package/lib/module/text/index.js +30 -0
- package/lib/module/text/index.js.map +1 -0
- package/lib/module/text/index.md +63 -0
- package/lib/module/text/style/index.js +51 -0
- package/lib/module/text/style/index.js.map +1 -0
- package/lib/module/theme/config.js +27 -0
- package/lib/module/theme/config.js.map +1 -0
- package/lib/module/theme/tokens.js +67 -0
- package/lib/module/theme/tokens.js.map +1 -0
- package/lib/module/touchable/index.js +35 -0
- package/lib/module/touchable/index.js.map +1 -0
- package/lib/module/touchable/index.md +42 -0
- package/lib/module/touchable/style/index.js +9 -0
- package/lib/module/touchable/style/index.js.map +1 -0
- package/lib/module/wave-animation/index.js +67 -0
- package/lib/module/wave-animation/index.js.map +1 -0
- package/lib/module/wave-animation/index.md +50 -0
- package/lib/typescript/jest.setup.d.ts +1 -0
- package/lib/typescript/jest.setup.d.ts.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/action-sheet/index.d.ts +22 -0
- package/lib/typescript/src/action-sheet/index.d.ts.map +1 -0
- package/lib/typescript/src/action-sheet/style/index.d.ts +16 -0
- package/lib/typescript/src/action-sheet/style/index.d.ts.map +1 -0
- package/lib/typescript/src/avatar/index.d.ts +19 -0
- package/lib/typescript/src/avatar/index.d.ts.map +1 -0
- package/lib/typescript/src/avatar/style/index.d.ts +7 -0
- package/lib/typescript/src/avatar/style/index.d.ts.map +1 -0
- package/lib/typescript/src/button/index.d.ts +24 -0
- package/lib/typescript/src/button/index.d.ts.map +1 -0
- package/lib/typescript/src/button/style/index.d.ts +16 -0
- package/lib/typescript/src/button/style/index.d.ts.map +1 -0
- package/lib/typescript/src/center/index.d.ts +11 -0
- package/lib/typescript/src/center/index.d.ts.map +1 -0
- package/lib/typescript/src/center/style/index.d.ts +5 -0
- package/lib/typescript/src/center/style/index.d.ts.map +1 -0
- package/lib/typescript/src/chip/index.d.ts +22 -0
- package/lib/typescript/src/chip/index.d.ts.map +1 -0
- package/lib/typescript/src/chip/style/index.d.ts +10 -0
- package/lib/typescript/src/chip/style/index.d.ts.map +1 -0
- package/lib/typescript/src/column/index.d.ts +20 -0
- package/lib/typescript/src/column/index.d.ts.map +1 -0
- package/lib/typescript/src/column/style/index.d.ts +4 -0
- package/lib/typescript/src/column/style/index.d.ts.map +1 -0
- package/lib/typescript/src/divider/index.d.ts +13 -0
- package/lib/typescript/src/divider/index.d.ts.map +1 -0
- package/lib/typescript/src/divider/style/index.d.ts +9 -0
- package/lib/typescript/src/divider/style/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +2 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useMergeStyles.d.ts +13 -0
- package/lib/typescript/src/hooks/useMergeStyles.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +39 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/input/index.d.ts +29 -0
- package/lib/typescript/src/input/index.d.ts.map +1 -0
- package/lib/typescript/src/input/style/index.d.ts +8 -0
- package/lib/typescript/src/input/style/index.d.ts.map +1 -0
- package/lib/typescript/src/list-item/index.d.ts +25 -0
- package/lib/typescript/src/list-item/index.d.ts.map +1 -0
- package/lib/typescript/src/list-item/style/index.d.ts +17 -0
- package/lib/typescript/src/list-item/style/index.d.ts.map +1 -0
- package/lib/typescript/src/popover/index.d.ts +27 -0
- package/lib/typescript/src/popover/index.d.ts.map +1 -0
- package/lib/typescript/src/popover/style/index.d.ts +7 -0
- package/lib/typescript/src/popover/style/index.d.ts.map +1 -0
- package/lib/typescript/src/row/index.d.ts +22 -0
- package/lib/typescript/src/row/index.d.ts.map +1 -0
- package/lib/typescript/src/row/style/index.d.ts +8 -0
- package/lib/typescript/src/row/style/index.d.ts.map +1 -0
- package/lib/typescript/src/space/index.d.ts +15 -0
- package/lib/typescript/src/space/index.d.ts.map +1 -0
- package/lib/typescript/src/space/style/index.d.ts +7 -0
- package/lib/typescript/src/space/style/index.d.ts.map +1 -0
- package/lib/typescript/src/text/index.d.ts +18 -0
- package/lib/typescript/src/text/index.d.ts.map +1 -0
- package/lib/typescript/src/text/style/index.d.ts +35 -0
- package/lib/typescript/src/text/style/index.d.ts.map +1 -0
- package/lib/typescript/src/theme/config.d.ts +18 -0
- package/lib/typescript/src/theme/config.d.ts.map +1 -0
- package/lib/typescript/src/theme/tokens.d.ts +61 -0
- package/lib/typescript/src/theme/tokens.d.ts.map +1 -0
- package/lib/typescript/src/touchable/index.d.ts +19 -0
- package/lib/typescript/src/touchable/index.d.ts.map +1 -0
- package/lib/typescript/src/touchable/style/index.d.ts +4 -0
- package/lib/typescript/src/touchable/style/index.d.ts.map +1 -0
- package/lib/typescript/src/wave-animation/index.d.ts +20 -0
- package/lib/typescript/src/wave-animation/index.d.ts.map +1 -0
- package/lib/typescript/tests/component/component.coverage.test.d.ts +2 -0
- package/lib/typescript/tests/component/component.coverage.test.d.ts.map +1 -0
- package/lib/typescript/tests/component/component.interaction.test.d.ts +2 -0
- package/lib/typescript/tests/component/component.interaction.test.d.ts.map +1 -0
- package/lib/typescript/tests/component/component.snapshot.test.d.ts +2 -0
- package/lib/typescript/tests/component/component.snapshot.test.d.ts.map +1 -0
- package/lib/typescript/tests/e2e/app.e2e.test.d.ts +2 -0
- package/lib/typescript/tests/e2e/app.e2e.test.d.ts.map +1 -0
- package/lib/typescript/tests/integration/ui.integration.test.d.ts +2 -0
- package/lib/typescript/tests/integration/ui.integration.test.d.ts.map +1 -0
- package/lib/typescript/tests/unit/mergeStyles.unit.test.d.ts +2 -0
- package/lib/typescript/tests/unit/mergeStyles.unit.test.d.ts.map +1 -0
- package/lib/typescript/tests/unit/public-api.unit.test.d.ts +2 -0
- package/lib/typescript/tests/unit/public-api.unit.test.d.ts.map +1 -0
- package/lib/typescript/tests/unit/theme-config.unit.test.d.ts +2 -0
- package/lib/typescript/tests/unit/theme-config.unit.test.d.ts.map +1 -0
- package/package.json +134 -0
- package/src/README.md +99 -0
- package/src/action-sheet/index.md +69 -0
- package/src/action-sheet/index.tsx +85 -0
- package/src/action-sheet/style/index.tsx +52 -0
- package/src/avatar/index.md +51 -0
- package/src/avatar/index.tsx +56 -0
- package/src/avatar/style/index.tsx +21 -0
- package/src/button/index.md +90 -0
- package/src/button/index.tsx +86 -0
- package/src/button/style/index.tsx +67 -0
- package/src/center/index.md +28 -0
- package/src/center/index.tsx +18 -0
- package/src/center/style/index.tsx +8 -0
- package/src/chip/index.md +60 -0
- package/src/chip/index.tsx +80 -0
- package/src/chip/style/index.tsx +47 -0
- package/src/column/index.md +34 -0
- package/src/column/index.tsx +43 -0
- package/src/column/style/index.tsx +7 -0
- package/src/divider/index.md +44 -0
- package/src/divider/index.tsx +30 -0
- package/src/divider/style/index.tsx +13 -0
- package/src/hooks/index.md +71 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useMergeStyles.ts +27 -0
- package/src/index.tsx +49 -0
- package/src/input/index.md +73 -0
- package/src/input/index.tsx +95 -0
- package/src/input/style/index.tsx +32 -0
- package/src/list-item/index.md +101 -0
- package/src/list-item/index.tsx +91 -0
- package/src/list-item/style/index.tsx +41 -0
- package/src/popover/index.md +57 -0
- package/src/popover/index.tsx +80 -0
- package/src/popover/style/index.tsx +23 -0
- package/src/row/index.md +46 -0
- package/src/row/index.tsx +47 -0
- package/src/row/style/index.tsx +14 -0
- package/src/space/index.md +31 -0
- package/src/space/index.tsx +28 -0
- package/src/space/style/index.tsx +3 -0
- package/src/text/index.md +63 -0
- package/src/text/index.tsx +45 -0
- package/src/text/style/index.tsx +32 -0
- package/src/theme/config.ts +26 -0
- package/src/theme/tokens.ts +66 -0
- package/src/touchable/index.md +42 -0
- package/src/touchable/index.tsx +45 -0
- package/src/touchable/style/index.tsx +5 -0
- package/src/wave-animation/index.md +50 -0
- package/src/wave-animation/index.tsx +93 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 间距占位组件
|
|
5
|
+
*
|
|
6
|
+
* 在两个元素之间插入固定间距。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { View } from 'react-native';
|
|
11
|
+
import { verticalStyle, horizontalStyle } from "./style/index.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const Space = ({
|
|
14
|
+
size = 12,
|
|
15
|
+
direction = 'vertical'
|
|
16
|
+
}) => /*#__PURE__*/_jsx(View, {
|
|
17
|
+
style: direction === 'vertical' ? verticalStyle(size) : horizontalStyle(size)
|
|
18
|
+
});
|
|
19
|
+
export default Space;
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","View","verticalStyle","horizontalStyle","jsx","_jsx","Space","size","direction","style"],"sourceRoot":"../../../src","sources":["space/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,aAAa,EAAEC,eAAe,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AASzD,MAAMC,KAA2B,GAAGA,CAAC;EAAEC,IAAI,GAAG,EAAE;EAAEC,SAAS,GAAG;AAAW,CAAC,kBACxEH,IAAA,CAACJ,IAAI;EACHQ,KAAK,EACHD,SAAS,KAAK,UAAU,GACpBN,aAAa,CAACK,IAAI,CAAC,GACnBJ,eAAe,CAACI,IAAI;AACzB,CACF,CACF;AAED,eAAeD,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Space 间距占位
|
|
2
|
+
|
|
3
|
+
在两个元素之间插入固定间距。替代 `<View style={{height: 12}} />` 或 `marginTop` 手写。
|
|
4
|
+
|
|
5
|
+
## 何时使用
|
|
6
|
+
|
|
7
|
+
- 两个块级元素之间需要固定间距
|
|
8
|
+
- 不想在元素上写 margin 时
|
|
9
|
+
|
|
10
|
+
## 代码演示
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
// 垂直间距(默认)
|
|
14
|
+
<Text variant="title">标题</Text>
|
|
15
|
+
<Space size={16} />
|
|
16
|
+
<Text variant="body">正文内容</Text>
|
|
17
|
+
|
|
18
|
+
// 水平间距
|
|
19
|
+
<Row>
|
|
20
|
+
<Icon name="star" />
|
|
21
|
+
<Space size={8} direction="horizontal" />
|
|
22
|
+
<Text>收藏</Text>
|
|
23
|
+
</Row>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
29
|
+
|------|------|------|--------|
|
|
30
|
+
| size | 间距大小(px) | `number` | `12` |
|
|
31
|
+
| direction | 方向 | `'vertical'` \| `'horizontal'` | `'vertical'` |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["verticalStyle","size","height","horizontalStyle","width"],"sourceRoot":"../../../../src","sources":["space/style/index.tsx"],"mappings":";;AAAA,OAAO,MAAMA,aAAa,GAAIC,IAAY,KAAM;EAAEC,MAAM,EAAED;AAAK,CAAC,CAAC;AAEjE,OAAO,MAAME,eAAe,GAAIF,IAAY,KAAM;EAAEG,KAAK,EAAEH;AAAK,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 语义化文字组件
|
|
5
|
+
*
|
|
6
|
+
* variant 驱动样式,支持嵌套 Text。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Text as RNText } from 'react-native';
|
|
11
|
+
import { VARIANT_MAP, WEIGHT_MAP, secondaryStyle, primaryStyle } from "./style/index.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const Text = ({
|
|
14
|
+
variant = 'body',
|
|
15
|
+
secondary,
|
|
16
|
+
primary,
|
|
17
|
+
color,
|
|
18
|
+
weight,
|
|
19
|
+
style,
|
|
20
|
+
...rest
|
|
21
|
+
}) => {
|
|
22
|
+
return /*#__PURE__*/_jsx(RNText, {
|
|
23
|
+
style: [VARIANT_MAP[variant], secondary && secondaryStyle, primary && primaryStyle, color != null && {
|
|
24
|
+
color
|
|
25
|
+
}, weight != null && WEIGHT_MAP[weight], style],
|
|
26
|
+
...rest
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
export default Text;
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Text","RNText","VARIANT_MAP","WEIGHT_MAP","secondaryStyle","primaryStyle","jsx","_jsx","variant","secondary","primary","color","weight","style","rest"],"sourceRoot":"../../../src","sources":["text/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,IAAIC,MAAM,QAAQ,cAAc;AAG7C,SAASC,WAAW,EAAEC,UAAU,EAAEC,cAAc,EAAEC,YAAY,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAUhF,MAAMP,IAAyB,GAAGA,CAAC;EACjCQ,OAAO,GAAG,MAAM;EAChBC,SAAS;EACTC,OAAO;EACPC,KAAK;EACLC,MAAM;EACNC,KAAK;EACL,GAAGC;AACM,CAAC,KAAK;EACf,oBACEP,IAAA,CAACN,MAAM;IACLY,KAAK,EAAE,CACLX,WAAW,CAACM,OAAO,CAAC,EACpBC,SAAS,IAAIL,cAAc,EAC3BM,OAAO,IAAIL,YAAY,EACvBM,KAAK,IAAI,IAAI,IAAI;MAAEA;IAAM,CAAC,EAC1BC,MAAM,IAAI,IAAI,IAAIT,UAAU,CAACS,MAAM,CAAC,EACpCC,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN,CAAC;AAED,eAAed,IAAI","ignoreList":[]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Text 语义化文字
|
|
2
|
+
|
|
3
|
+
通过 `variant` 驱动排版样式。继承 RN `Text`,支持嵌套。
|
|
4
|
+
|
|
5
|
+
## 何时使用
|
|
6
|
+
|
|
7
|
+
- 替代直接写 `fontSize` + `fontWeight` + `color` 的 `<Text>` 组合
|
|
8
|
+
- 需要统一排版规范时
|
|
9
|
+
|
|
10
|
+
## 代码演示
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
// 基础用法
|
|
14
|
+
<Text variant="title">标题文字</Text>
|
|
15
|
+
<Text variant="caption" secondary>辅助说明</Text>
|
|
16
|
+
|
|
17
|
+
// 颜色与字重
|
|
18
|
+
<Text variant="caption" primary weight="bold">¥88.00</Text>
|
|
19
|
+
|
|
20
|
+
// 嵌套 Text
|
|
21
|
+
<Text variant="body" numberOfLines={1}>
|
|
22
|
+
<Text primary weight="semibold">新 </Text>
|
|
23
|
+
{productName}
|
|
24
|
+
</Text>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
30
|
+
|------|------|------|--------|
|
|
31
|
+
| variant | 排版变体 | `'title'` \| `'heading'` \| `'body'` \| `'caption'` \| `'micro'` | `'body'` |
|
|
32
|
+
| secondary | 次要色(colorTextSecondary) | `boolean` | `false` |
|
|
33
|
+
| primary | 主题色(colorPrimary) | `boolean` | `false` |
|
|
34
|
+
| color | 自定义颜色 | `string` | - |
|
|
35
|
+
| weight | 字重 | `'medium'` \| `'semibold'` \| `'bold'` | - |
|
|
36
|
+
|
|
37
|
+
> 继承所有 RN `TextProps`(`numberOfLines`、`ellipsizeMode`、`onPress`、`style` 等)
|
|
38
|
+
|
|
39
|
+
## Variant 规格
|
|
40
|
+
|
|
41
|
+
| variant | fontSize | lineHeight | fontWeight | 场景 |
|
|
42
|
+
|---------|----------|------------|------------|------|
|
|
43
|
+
| title | 20 | 26 | 600 | 页面标题、问候语 |
|
|
44
|
+
| heading | 16 | 22 | 600 | 弹窗标题、区块标题 |
|
|
45
|
+
| body | 15 | 22 | 正常 | 默认正文 |
|
|
46
|
+
| caption | 13 | 18 | 正常 | 信息行、标签 |
|
|
47
|
+
| micro | 12 | 18 | 正常 | 地址、规格、描述 |
|
|
48
|
+
|
|
49
|
+
## Weight 映射
|
|
50
|
+
|
|
51
|
+
| weight | fontWeight | 场景 |
|
|
52
|
+
|--------|----------|------|
|
|
53
|
+
| medium | 500 | 产品名、模型名 |
|
|
54
|
+
| semibold | 600 | 标题、按钮文字、客户名 |
|
|
55
|
+
| bold | 700 | 价格金额 |
|
|
56
|
+
|
|
57
|
+
## 样式优先级
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
VARIANT_MAP → secondary/primary → color → weight → style
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
后传入的属性覆盖先传入的,`style` prop 拥有最高优先级。
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
import { tokens } from "../../theme/tokens.js";
|
|
5
|
+
export const VARIANT_MAP = StyleSheet.create({
|
|
6
|
+
title: {
|
|
7
|
+
fontSize: 20,
|
|
8
|
+
lineHeight: 26,
|
|
9
|
+
fontWeight: '600',
|
|
10
|
+
color: tokens.colorText
|
|
11
|
+
},
|
|
12
|
+
heading: {
|
|
13
|
+
fontSize: 16,
|
|
14
|
+
lineHeight: 22,
|
|
15
|
+
fontWeight: '600',
|
|
16
|
+
color: tokens.colorText
|
|
17
|
+
},
|
|
18
|
+
body: {
|
|
19
|
+
fontSize: 15,
|
|
20
|
+
lineHeight: 22,
|
|
21
|
+
color: tokens.colorText
|
|
22
|
+
},
|
|
23
|
+
caption: {
|
|
24
|
+
fontSize: 13,
|
|
25
|
+
lineHeight: 18,
|
|
26
|
+
color: tokens.colorText
|
|
27
|
+
},
|
|
28
|
+
micro: {
|
|
29
|
+
fontSize: 12,
|
|
30
|
+
lineHeight: 18,
|
|
31
|
+
color: tokens.colorText
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export const WEIGHT_MAP = {
|
|
35
|
+
medium: {
|
|
36
|
+
fontWeight: '500'
|
|
37
|
+
},
|
|
38
|
+
semibold: {
|
|
39
|
+
fontWeight: '600'
|
|
40
|
+
},
|
|
41
|
+
bold: {
|
|
42
|
+
fontWeight: '700'
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const secondaryStyle = {
|
|
46
|
+
color: tokens.colorTextSecondary
|
|
47
|
+
};
|
|
48
|
+
export const primaryStyle = {
|
|
49
|
+
color: tokens.colorPrimary
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","tokens","VARIANT_MAP","create","title","fontSize","lineHeight","fontWeight","color","colorText","heading","body","caption","micro","WEIGHT_MAP","medium","semibold","bold","secondaryStyle","colorTextSecondary","primaryStyle","colorPrimary"],"sourceRoot":"../../../../src","sources":["text/style/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,SAASC,MAAM,QAAQ,uBAAoB;AAI3C,OAAO,MAAMC,WAAW,GAAGF,UAAU,CAACG,MAAM,CAAC;EAC3CC,KAAK,EAAE;IACLC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdC,UAAU,EAAE,KAAK;IACjBC,KAAK,EAAEP,MAAM,CAACQ;EAChB,CAAC;EACDC,OAAO,EAAE;IACPL,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,EAAE;IACdC,UAAU,EAAE,KAAK;IACjBC,KAAK,EAAEP,MAAM,CAACQ;EAChB,CAAC;EACDE,IAAI,EAAE;IAAEN,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE,EAAE;IAAEE,KAAK,EAAEP,MAAM,CAACQ;EAAU,CAAC;EAC/DG,OAAO,EAAE;IAAEP,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE,EAAE;IAAEE,KAAK,EAAEP,MAAM,CAACQ;EAAU,CAAC;EAClEI,KAAK,EAAE;IAAER,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE,EAAE;IAAEE,KAAK,EAAEP,MAAM,CAACQ;EAAU;AACjE,CAAC,CAAC;AAEF,OAAO,MAAMK,UAAyC,GAAG;EACvDC,MAAM,EAAE;IAAER,UAAU,EAAE;EAAM,CAAC;EAC7BS,QAAQ,EAAE;IAAET,UAAU,EAAE;EAAM,CAAC;EAC/BU,IAAI,EAAE;IAAEV,UAAU,EAAE;EAAM;AAC5B,CAAC;AAED,OAAO,MAAMW,cAAyB,GAAG;EAAEV,KAAK,EAAEP,MAAM,CAACkB;AAAmB,CAAC;AAC7E,OAAO,MAAMC,YAAuB,GAAG;EAAEZ,KAAK,EAAEP,MAAM,CAACoB;AAAa,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 主题配置
|
|
5
|
+
*
|
|
6
|
+
* 消费方通过 configure() 注入主题色,实现包与业务解耦。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
let _config = {};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 配置主题
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* import { configure } from '@unif/react-native-ui';
|
|
16
|
+
* configure({ primaryColor: getAppThemeColor() });
|
|
17
|
+
*/
|
|
18
|
+
export function configure(options) {
|
|
19
|
+
_config = {
|
|
20
|
+
..._config,
|
|
21
|
+
...options
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function getPrimaryColor() {
|
|
25
|
+
return _config.primaryColor || '#EB6E00';
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_config","configure","options","getPrimaryColor","primaryColor"],"sourceRoot":"../../../src","sources":["theme/config.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAMA,IAAIA,OAAoB,GAAG,CAAC,CAAC;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,OAAoB,EAAQ;EACpDF,OAAO,GAAG;IAAE,GAAGA,OAAO;IAAE,GAAGE;EAAQ,CAAC;AACtC;AAEA,OAAO,SAASC,eAAeA,CAAA,EAAW;EACxC,OAAOH,OAAO,CAACI,YAAY,IAAI,SAAS;AAC1C","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Design Tokens
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { getPrimaryColor } from "./config.js";
|
|
8
|
+
export const tokens = {
|
|
9
|
+
get colorPrimary() {
|
|
10
|
+
return getPrimaryColor();
|
|
11
|
+
},
|
|
12
|
+
colorSuccess: '#34C759',
|
|
13
|
+
colorWarning: '#FF9500',
|
|
14
|
+
colorError: '#FF3B30',
|
|
15
|
+
colorBgPage: '#F7F7F8',
|
|
16
|
+
colorBgElevated: '#FFFFFF',
|
|
17
|
+
colorBgUserMsg: '#F0F0F0',
|
|
18
|
+
colorText: '#1D1D1F',
|
|
19
|
+
colorTextSecondary: '#8E8E93',
|
|
20
|
+
colorTextPlaceholder: '#C7C7CC',
|
|
21
|
+
colorBorder: '#E5E5EA',
|
|
22
|
+
colorLink: '#007AFF',
|
|
23
|
+
colorBgHeader: '#FFFFFF',
|
|
24
|
+
colorHeaderText: '#1D1D1F',
|
|
25
|
+
colorHeaderIcon: '#8E8E93',
|
|
26
|
+
fontSizeXs: 11,
|
|
27
|
+
fontSizeSm: 13,
|
|
28
|
+
fontSize: 15,
|
|
29
|
+
fontSizeMd: 16,
|
|
30
|
+
fontSizeLg: 17,
|
|
31
|
+
fontSizeXl: 20,
|
|
32
|
+
lineHeight: 22,
|
|
33
|
+
lineHeightLg: 26,
|
|
34
|
+
spaceXs: 4,
|
|
35
|
+
spaceSm: 8,
|
|
36
|
+
space: 12,
|
|
37
|
+
spaceMd: 16,
|
|
38
|
+
spaceLg: 20,
|
|
39
|
+
spaceXl: 24,
|
|
40
|
+
spaceXxl: 32,
|
|
41
|
+
radiusSm: 6,
|
|
42
|
+
radius: 10,
|
|
43
|
+
radiusLg: 16,
|
|
44
|
+
radiusXl: 20,
|
|
45
|
+
radiusFull: 999,
|
|
46
|
+
shadowSm: {
|
|
47
|
+
shadowColor: '#000',
|
|
48
|
+
shadowOffset: {
|
|
49
|
+
width: 0,
|
|
50
|
+
height: 1
|
|
51
|
+
},
|
|
52
|
+
shadowOpacity: 0.04,
|
|
53
|
+
shadowRadius: 2,
|
|
54
|
+
elevation: 1
|
|
55
|
+
},
|
|
56
|
+
shadow: {
|
|
57
|
+
shadowColor: '#000',
|
|
58
|
+
shadowOffset: {
|
|
59
|
+
width: 0,
|
|
60
|
+
height: 2
|
|
61
|
+
},
|
|
62
|
+
shadowOpacity: 0.06,
|
|
63
|
+
shadowRadius: 4,
|
|
64
|
+
elevation: 2
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getPrimaryColor","tokens","colorPrimary","colorSuccess","colorWarning","colorError","colorBgPage","colorBgElevated","colorBgUserMsg","colorText","colorTextSecondary","colorTextPlaceholder","colorBorder","colorLink","colorBgHeader","colorHeaderText","colorHeaderIcon","fontSizeXs","fontSizeSm","fontSize","fontSizeMd","fontSizeLg","fontSizeXl","lineHeight","lineHeightLg","spaceXs","spaceSm","space","spaceMd","spaceLg","spaceXl","spaceXxl","radiusSm","radius","radiusLg","radiusXl","radiusFull","shadowSm","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","shadow"],"sourceRoot":"../../../src","sources":["theme/tokens.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,eAAe,QAAQ,aAAU;AAE1C,OAAO,MAAMC,MAAM,GAAG;EACpB,IAAIC,YAAYA,CAAA,EAAG;IACjB,OAAOF,eAAe,CAAC,CAAC;EAC1B,CAAC;EACDG,YAAY,EAAE,SAAS;EACvBC,YAAY,EAAE,SAAS;EACvBC,UAAU,EAAE,SAAS;EAErBC,WAAW,EAAE,SAAS;EACtBC,eAAe,EAAE,SAAS;EAC1BC,cAAc,EAAE,SAAS;EAEzBC,SAAS,EAAE,SAAS;EACpBC,kBAAkB,EAAE,SAAS;EAC7BC,oBAAoB,EAAE,SAAS;EAC/BC,WAAW,EAAE,SAAS;EACtBC,SAAS,EAAE,SAAS;EAEpBC,aAAa,EAAE,SAAS;EACxBC,eAAe,EAAE,SAAS;EAC1BC,eAAe,EAAE,SAAS;EAE1BC,UAAU,EAAE,EAAE;EACdC,UAAU,EAAE,EAAE;EACdC,QAAQ,EAAE,EAAE;EACZC,UAAU,EAAE,EAAE;EACdC,UAAU,EAAE,EAAE;EACdC,UAAU,EAAE,EAAE;EACdC,UAAU,EAAE,EAAE;EACdC,YAAY,EAAE,EAAE;EAEhBC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,KAAK,EAAE,EAAE;EACTC,OAAO,EAAE,EAAE;EACXC,OAAO,EAAE,EAAE;EACXC,OAAO,EAAE,EAAE;EACXC,QAAQ,EAAE,EAAE;EAEZC,QAAQ,EAAE,CAAC;EACXC,MAAM,EAAE,EAAE;EACVC,QAAQ,EAAE,EAAE;EACZC,QAAQ,EAAE,EAAE;EACZC,UAAU,EAAE,GAAG;EAEfC,QAAQ,EAAE;IACRC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDC,MAAM,EAAE;IACNP,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE,CAAC;MAAEC,MAAM,EAAE;IAAE,CAAC;IACrCC,aAAa,EAAE,IAAI;IACnBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb;AACF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 统一触摸反馈组件
|
|
5
|
+
*
|
|
6
|
+
* 基于 Pressable,替代 TouchableOpacity。
|
|
7
|
+
* 按下时透明度降低,支持 activeOpacity 自定义。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { Pressable } from 'react-native';
|
|
12
|
+
import { disabledStyle } from "./style/index.js";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
const Touchable = ({
|
|
15
|
+
onPress,
|
|
16
|
+
onLongPress,
|
|
17
|
+
disabled,
|
|
18
|
+
activeOpacity = 0.7,
|
|
19
|
+
style,
|
|
20
|
+
testID,
|
|
21
|
+
...rest
|
|
22
|
+
}) => /*#__PURE__*/_jsx(Pressable, {
|
|
23
|
+
onPress: onPress,
|
|
24
|
+
onLongPress: onLongPress,
|
|
25
|
+
disabled: disabled,
|
|
26
|
+
testID: testID,
|
|
27
|
+
style: ({
|
|
28
|
+
pressed
|
|
29
|
+
}) => [style, pressed && {
|
|
30
|
+
opacity: activeOpacity
|
|
31
|
+
}, disabled && disabledStyle],
|
|
32
|
+
...rest
|
|
33
|
+
});
|
|
34
|
+
export default Touchable;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Pressable","disabledStyle","jsx","_jsx","Touchable","onPress","onLongPress","disabled","activeOpacity","style","testID","rest","pressed","opacity"],"sourceRoot":"../../../src","sources":["touchable/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAAQ,cAAc;AAExC,SAASC,aAAa,QAAQ,kBAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAWxC,MAAMC,SAAmC,GAAGA,CAAC;EAC3CC,OAAO;EACPC,WAAW;EACXC,QAAQ;EACRC,aAAa,GAAG,GAAG;EACnBC,KAAK;EACLC,MAAM;EACN,GAAGC;AACW,CAAC,kBACfR,IAAA,CAACH,SAAS;EACRK,OAAO,EAAEA,OAAQ;EACjBC,WAAW,EAAEA,WAAY;EACzBC,QAAQ,EAAEA,QAAS;EACnBG,MAAM,EAAEA,MAAO;EACfD,KAAK,EAAEA,CAAC;IAAEG;EAAQ,CAAC,KAAK,CACtBH,KAAK,EACLG,OAAO,IAAI;IAAEC,OAAO,EAAEL;EAAc,CAAC,EACrCD,QAAQ,IAAIN,aAAa,CACzB;EAAA,GACEU;AAAI,CACT,CACF;AAED,eAAeP,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Touchable 统一触摸反馈
|
|
2
|
+
|
|
3
|
+
基于 `Pressable`,统一替代 `TouchableOpacity`。按下时降低透明度,支持自定义 `activeOpacity`。
|
|
4
|
+
|
|
5
|
+
## 何时使用
|
|
6
|
+
|
|
7
|
+
- 替代所有 `TouchableOpacity` 的场景
|
|
8
|
+
- 需要可点击区域(非按钮语义)时
|
|
9
|
+
|
|
10
|
+
## 代码演示
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
// 基础用法
|
|
14
|
+
<Touchable onPress={handlePress}>
|
|
15
|
+
<Row gap={10}>
|
|
16
|
+
<Icon name="settings" />
|
|
17
|
+
<Text>设置</Text>
|
|
18
|
+
</Row>
|
|
19
|
+
</Touchable>
|
|
20
|
+
|
|
21
|
+
// 自定义按下透明度
|
|
22
|
+
<Touchable onPress={handlePress} activeOpacity={0.5}>
|
|
23
|
+
<Text>更明显的按下效果</Text>
|
|
24
|
+
</Touchable>
|
|
25
|
+
|
|
26
|
+
// 长按
|
|
27
|
+
<Touchable onPress={handlePress} onLongPress={handleLongPress}>
|
|
28
|
+
<Text>支持长按</Text>
|
|
29
|
+
</Touchable>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
35
|
+
|------|------|------|--------|
|
|
36
|
+
| onPress | 点击回调 | `() => void` | - |
|
|
37
|
+
| onLongPress | 长按回调 | `() => void` | - |
|
|
38
|
+
| disabled | 禁用状态 | `boolean` | `false` |
|
|
39
|
+
| activeOpacity | 按下态透明度 | `number` | `0.7` |
|
|
40
|
+
| testID | 测试标识 | `string` | - |
|
|
41
|
+
|
|
42
|
+
> 继承所有 RN `ViewProps`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","disabledStyle","create","s","opacity"],"sourceRoot":"../../../../src","sources":["touchable/style/index.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,aAAa,GAAGD,UAAU,CAACE,MAAM,CAAC;EAC7CC,CAAC,EAAE;IAAEC,OAAO,EAAE;EAAI;AACpB,CAAC,CAAC,CAACD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WaveAnimation 原子组件
|
|
5
|
+
*
|
|
6
|
+
* 柱状声波动画,可配置柱数、尺寸和颜色。
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { useEffect, useRef } from 'react';
|
|
10
|
+
import { View, Animated, StyleSheet } from 'react-native';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const WaveAnimation = ({
|
|
13
|
+
active,
|
|
14
|
+
color = '#FFFFFF',
|
|
15
|
+
barCount = 4,
|
|
16
|
+
barWidth = 3,
|
|
17
|
+
minHeight = 6,
|
|
18
|
+
maxHeight = 20,
|
|
19
|
+
style,
|
|
20
|
+
testID
|
|
21
|
+
}) => {
|
|
22
|
+
const animations = useRef(Array.from({
|
|
23
|
+
length: barCount
|
|
24
|
+
}, () => new Animated.Value(minHeight))).current;
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!active) {
|
|
27
|
+
animations.forEach(anim => anim.setValue(minHeight));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const loops = animations.map((anim, index) => Animated.loop(Animated.sequence([Animated.timing(anim, {
|
|
31
|
+
toValue: maxHeight - index * 3,
|
|
32
|
+
duration: 300 + index * 100,
|
|
33
|
+
useNativeDriver: false
|
|
34
|
+
}), Animated.timing(anim, {
|
|
35
|
+
toValue: minHeight,
|
|
36
|
+
duration: 300 + index * 100,
|
|
37
|
+
useNativeDriver: false
|
|
38
|
+
})])));
|
|
39
|
+
loops.forEach(loop => loop.start());
|
|
40
|
+
return () => {
|
|
41
|
+
loops.forEach(loop => loop.stop());
|
|
42
|
+
};
|
|
43
|
+
}, [active, animations, minHeight, maxHeight]);
|
|
44
|
+
return /*#__PURE__*/_jsx(View, {
|
|
45
|
+
style: [styles.container, {
|
|
46
|
+
height: maxHeight
|
|
47
|
+
}, style],
|
|
48
|
+
testID: testID,
|
|
49
|
+
children: animations.map((anim, index) => /*#__PURE__*/_jsx(Animated.View, {
|
|
50
|
+
style: [{
|
|
51
|
+
width: barWidth,
|
|
52
|
+
borderRadius: barWidth / 2,
|
|
53
|
+
height: anim,
|
|
54
|
+
backgroundColor: color
|
|
55
|
+
}]
|
|
56
|
+
}, index))
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const styles = StyleSheet.create({
|
|
60
|
+
container: {
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
alignItems: 'center',
|
|
63
|
+
gap: 3
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export default /*#__PURE__*/React.memo(WaveAnimation);
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","useRef","View","Animated","StyleSheet","jsx","_jsx","WaveAnimation","active","color","barCount","barWidth","minHeight","maxHeight","style","testID","animations","Array","from","length","Value","current","forEach","anim","setValue","loops","map","index","loop","sequence","timing","toValue","duration","useNativeDriver","start","stop","styles","container","height","children","width","borderRadius","backgroundColor","create","flexDirection","alignItems","gap","memo"],"sourceRoot":"../../../src","sources":["wave-animation/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,IAAI,EAAEC,QAAQ,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAc1D,MAAMC,aAA2C,GAAGA,CAAC;EACnDC,MAAM;EACNC,KAAK,GAAG,SAAS;EACjBC,QAAQ,GAAG,CAAC;EACZC,QAAQ,GAAG,CAAC;EACZC,SAAS,GAAG,CAAC;EACbC,SAAS,GAAG,EAAE;EACdC,KAAK;EACLC;AACF,CAAC,KAAK;EACJ,MAAMC,UAAU,GAAGf,MAAM,CACvBgB,KAAK,CAACC,IAAI,CAAC;IAAEC,MAAM,EAAET;EAAS,CAAC,EAAE,MAAM,IAAIP,QAAQ,CAACiB,KAAK,CAACR,SAAS,CAAC,CACtE,CAAC,CAACS,OAAO;EAETrB,SAAS,CAAC,MAAM;IACd,IAAI,CAACQ,MAAM,EAAE;MACXQ,UAAU,CAACM,OAAO,CAAEC,IAAI,IAAKA,IAAI,CAACC,QAAQ,CAACZ,SAAS,CAAC,CAAC;MACtD;IACF;IAEA,MAAMa,KAAK,GAAGT,UAAU,CAACU,GAAG,CAAC,CAACH,IAAI,EAAEI,KAAK,KACvCxB,QAAQ,CAACyB,IAAI,CACXzB,QAAQ,CAAC0B,QAAQ,CAAC,CAChB1B,QAAQ,CAAC2B,MAAM,CAACP,IAAI,EAAE;MACpBQ,OAAO,EAAElB,SAAS,GAAGc,KAAK,GAAG,CAAC;MAC9BK,QAAQ,EAAE,GAAG,GAAGL,KAAK,GAAG,GAAG;MAC3BM,eAAe,EAAE;IACnB,CAAC,CAAC,EACF9B,QAAQ,CAAC2B,MAAM,CAACP,IAAI,EAAE;MACpBQ,OAAO,EAAEnB,SAAS;MAClBoB,QAAQ,EAAE,GAAG,GAAGL,KAAK,GAAG,GAAG;MAC3BM,eAAe,EAAE;IACnB,CAAC,CAAC,CACH,CACH,CACF,CAAC;IAEDR,KAAK,CAACH,OAAO,CAAEM,IAAI,IAAKA,IAAI,CAACM,KAAK,CAAC,CAAC,CAAC;IAErC,OAAO,MAAM;MACXT,KAAK,CAACH,OAAO,CAAEM,IAAI,IAAKA,IAAI,CAACO,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;EACH,CAAC,EAAE,CAAC3B,MAAM,EAAEQ,UAAU,EAAEJ,SAAS,EAAEC,SAAS,CAAC,CAAC;EAE9C,oBACEP,IAAA,CAACJ,IAAI;IAACY,KAAK,EAAE,CAACsB,MAAM,CAACC,SAAS,EAAE;MAAEC,MAAM,EAAEzB;IAAU,CAAC,EAAEC,KAAK,CAAE;IAACC,MAAM,EAAEA,MAAO;IAAAwB,QAAA,EAC3EvB,UAAU,CAACU,GAAG,CAAC,CAACH,IAAI,EAAEI,KAAK,kBAC1BrB,IAAA,CAACH,QAAQ,CAACD,IAAI;MAEZY,KAAK,EAAE,CACL;QACE0B,KAAK,EAAE7B,QAAQ;QACf8B,YAAY,EAAE9B,QAAQ,GAAG,CAAC;QAC1B2B,MAAM,EAAEf,IAAI;QACZmB,eAAe,EAAEjC;MACnB,CAAC;IACD,GARGkB,KASN,CACF;EAAC,CACE,CAAC;AAEX,CAAC;AAED,MAAMS,MAAM,GAAGhC,UAAU,CAACuC,MAAM,CAAC;EAC/BN,SAAS,EAAE;IACTO,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE;EACP;AACF,CAAC,CAAC;AAEF,4BAAe/C,KAAK,CAACgD,IAAI,CAACxC,aAAa,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: WaveAnimation
|
|
3
|
+
nav:
|
|
4
|
+
title: 组件
|
|
5
|
+
order: 1
|
|
6
|
+
group:
|
|
7
|
+
title: 原子
|
|
8
|
+
order: 1
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# WaveAnimation 声波动画
|
|
12
|
+
|
|
13
|
+
柱状声波动画,适用于语音录制等场景的视觉反馈。
|
|
14
|
+
|
|
15
|
+
## 何时使用
|
|
16
|
+
|
|
17
|
+
- 语音录制时展示声波效果
|
|
18
|
+
- 需要节奏性动画反馈时
|
|
19
|
+
|
|
20
|
+
## 代码演示
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { WaveAnimation } from '@unif/react-native-ui';
|
|
24
|
+
|
|
25
|
+
// 基本用法
|
|
26
|
+
<WaveAnimation active={isRecording} />
|
|
27
|
+
|
|
28
|
+
// 自定义参数
|
|
29
|
+
<WaveAnimation
|
|
30
|
+
active={true}
|
|
31
|
+
color="#EB6E00"
|
|
32
|
+
barCount={5}
|
|
33
|
+
barWidth={4}
|
|
34
|
+
minHeight={4}
|
|
35
|
+
maxHeight={24}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
42
|
+
| --------- | ------------ | ---------- | ----------- |
|
|
43
|
+
| active | 控制动画启停 | `boolean` | - |
|
|
44
|
+
| color | 柱体颜色 | `string` | `'#FFFFFF'` |
|
|
45
|
+
| barCount | 柱数 | `number` | `4` |
|
|
46
|
+
| barWidth | 柱宽 | `number` | `3` |
|
|
47
|
+
| minHeight | 最小高度 | `number` | `6` |
|
|
48
|
+
| maxHeight | 最大高度 | `number` | `20` |
|
|
49
|
+
| style | 容器样式 | `ViewStyle`| - |
|
|
50
|
+
| testID | 测试标识 | `string` | - |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=jest.setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../../jest.setup.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ActionSheet 基础组件
|
|
3
|
+
*
|
|
4
|
+
* 轻量底部选项面板,Modal + 网格布局。
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ViewStyle } from 'react-native';
|
|
8
|
+
import type { ActionSheetSemanticStyles, ActionSheetOption } from './style';
|
|
9
|
+
export interface ActionSheetProps {
|
|
10
|
+
visible: boolean;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
title?: string;
|
|
13
|
+
options: ActionSheetOption[];
|
|
14
|
+
onSelect: (key: string) => void;
|
|
15
|
+
columns?: number;
|
|
16
|
+
style?: ViewStyle;
|
|
17
|
+
styles?: Partial<ActionSheetSemanticStyles>;
|
|
18
|
+
testID?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const ActionSheet: React.FC<ActionSheetProps>;
|
|
21
|
+
export default ActionSheet;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/action-sheet/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAQvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5E,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAmD3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ViewStyle, TextStyle } from 'react-native';
|
|
2
|
+
export type ActionSheetSemanticStyles = {
|
|
3
|
+
overlay?: ViewStyle;
|
|
4
|
+
panel?: ViewStyle;
|
|
5
|
+
grid?: ViewStyle;
|
|
6
|
+
option?: ViewStyle;
|
|
7
|
+
optionIcon?: ViewStyle;
|
|
8
|
+
optionLabel?: TextStyle;
|
|
9
|
+
};
|
|
10
|
+
export interface ActionSheetOption {
|
|
11
|
+
key: string;
|
|
12
|
+
label: string;
|
|
13
|
+
icon?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const DEFAULT_STYLES: ActionSheetSemanticStyles;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/action-sheet/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzD,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,EAAE,yBAiC5B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar 原子组件
|
|
3
|
+
*
|
|
4
|
+
* 圆形图像/图标容器,支持图片、图标、占位三种模式。
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import type { ViewStyle, ImageSourcePropType } from 'react-native';
|
|
8
|
+
import type { AvatarSemanticStyles } from './style';
|
|
9
|
+
export interface AvatarProps {
|
|
10
|
+
size?: number;
|
|
11
|
+
source?: ImageSourcePropType;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
style?: ViewStyle;
|
|
14
|
+
styles?: Partial<AvatarSemanticStyles>;
|
|
15
|
+
testID?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Avatar: React.FC<AvatarProps>;
|
|
18
|
+
export default Avatar;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/avatar/index.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGpD,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA+BjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/avatar/style/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1D,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,oBAY5B,CAAC"}
|