@unif/react-native-ui 0.2.0 → 0.2.11

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 (139) hide show
  1. package/lib/commonjs/action-sheet/style/index.js.map +1 -1
  2. package/lib/commonjs/avatar/index.js.map +1 -1
  3. package/lib/commonjs/chip/index.js +2 -7
  4. package/lib/commonjs/chip/index.js.map +1 -1
  5. package/lib/commonjs/chip/style/index.js +5 -0
  6. package/lib/commonjs/chip/style/index.js.map +1 -1
  7. package/lib/commonjs/index.js.map +1 -1
  8. package/lib/commonjs/input/index.js.map +1 -1
  9. package/lib/commonjs/list-item/index.js.map +1 -1
  10. package/lib/commonjs/menu/index.js +3 -5
  11. package/lib/commonjs/menu/index.js.map +1 -1
  12. package/lib/commonjs/popover/index.js.map +1 -1
  13. package/lib/commonjs/popover/style/index.js +3 -3
  14. package/lib/commonjs/popover/style/index.js.map +1 -1
  15. package/lib/commonjs/space/index.js.map +1 -1
  16. package/lib/commonjs/text/index.js.map +1 -1
  17. package/lib/commonjs/wave-animation/index.js.map +1 -1
  18. package/lib/module/action-sheet/style/index.js.map +1 -1
  19. package/lib/module/avatar/index.js.map +1 -1
  20. package/lib/module/chip/index.js +2 -7
  21. package/lib/module/chip/index.js.map +1 -1
  22. package/lib/module/chip/style/index.js +5 -0
  23. package/lib/module/chip/style/index.js.map +1 -1
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/input/index.js.map +1 -1
  26. package/lib/module/list-item/index.js.map +1 -1
  27. package/lib/module/menu/index.js +3 -5
  28. package/lib/module/menu/index.js.map +1 -1
  29. package/lib/module/popover/index.js.map +1 -1
  30. package/lib/module/popover/style/index.js +3 -3
  31. package/lib/module/popover/style/index.js.map +1 -1
  32. package/lib/module/space/index.js.map +1 -1
  33. package/lib/module/text/index.js.map +1 -1
  34. package/lib/module/wave-animation/index.js.map +1 -1
  35. package/lib/typescript/commonjs/docs-src/components/ExpoSnack.d.ts +11 -0
  36. package/lib/typescript/commonjs/docs-src/components/ExpoSnack.d.ts.map +1 -0
  37. package/lib/typescript/commonjs/docusaurus.config.d.ts +4 -0
  38. package/lib/typescript/commonjs/docusaurus.config.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/sidebars.d.ts +4 -0
  40. package/lib/typescript/commonjs/sidebars.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/src/action-sheet/style/index.d.ts.map +1 -1
  42. package/lib/typescript/commonjs/src/avatar/index.d.ts.map +1 -1
  43. package/lib/typescript/commonjs/src/chip/index.d.ts.map +1 -1
  44. package/lib/typescript/commonjs/src/chip/style/index.d.ts +1 -0
  45. package/lib/typescript/commonjs/src/chip/style/index.d.ts.map +1 -1
  46. package/lib/typescript/commonjs/src/index.d.ts +1 -1
  47. package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
  48. package/lib/typescript/commonjs/src/input/index.d.ts.map +1 -1
  49. package/lib/typescript/commonjs/src/list-item/index.d.ts.map +1 -1
  50. package/lib/typescript/commonjs/src/menu/index.d.ts.map +1 -1
  51. package/lib/typescript/commonjs/src/popover/index.d.ts.map +1 -1
  52. package/lib/typescript/commonjs/src/space/index.d.ts.map +1 -1
  53. package/lib/typescript/commonjs/src/text/index.d.ts.map +1 -1
  54. package/lib/typescript/commonjs/src/wave-animation/index.d.ts.map +1 -1
  55. package/lib/typescript/module/docs-src/components/ExpoSnack.d.ts +11 -0
  56. package/lib/typescript/module/docs-src/components/ExpoSnack.d.ts.map +1 -0
  57. package/lib/typescript/module/docusaurus.config.d.ts +4 -0
  58. package/lib/typescript/module/docusaurus.config.d.ts.map +1 -0
  59. package/lib/typescript/module/sidebars.d.ts +4 -0
  60. package/lib/typescript/module/sidebars.d.ts.map +1 -0
  61. package/lib/typescript/module/src/action-sheet/style/index.d.ts.map +1 -1
  62. package/lib/typescript/module/src/avatar/index.d.ts.map +1 -1
  63. package/lib/typescript/module/src/chip/index.d.ts.map +1 -1
  64. package/lib/typescript/module/src/chip/style/index.d.ts +1 -0
  65. package/lib/typescript/module/src/chip/style/index.d.ts.map +1 -1
  66. package/lib/typescript/module/src/index.d.ts +1 -1
  67. package/lib/typescript/module/src/index.d.ts.map +1 -1
  68. package/lib/typescript/module/src/input/index.d.ts.map +1 -1
  69. package/lib/typescript/module/src/list-item/index.d.ts.map +1 -1
  70. package/lib/typescript/module/src/menu/index.d.ts.map +1 -1
  71. package/lib/typescript/module/src/popover/index.d.ts.map +1 -1
  72. package/lib/typescript/module/src/space/index.d.ts.map +1 -1
  73. package/lib/typescript/module/src/text/index.d.ts.map +1 -1
  74. package/lib/typescript/module/src/wave-animation/index.d.ts.map +1 -1
  75. package/package.json +16 -2
  76. package/src/action-sheet/index.tsx +1 -1
  77. package/src/action-sheet/style/index.tsx +1 -3
  78. package/src/avatar/index.tsx +5 -2
  79. package/src/button/index.tsx +2 -2
  80. package/src/button/style/index.tsx +1 -1
  81. package/src/chip/index.tsx +12 -4
  82. package/src/chip/style/index.tsx +7 -1
  83. package/src/index.tsx +4 -1
  84. package/src/input/index.tsx +59 -54
  85. package/src/list-item/index.tsx +3 -4
  86. package/src/menu/index.tsx +1 -4
  87. package/src/popover/index.tsx +6 -7
  88. package/src/popover/style/index.tsx +3 -3
  89. package/src/space/index.tsx +1 -3
  90. package/src/text/index.tsx +6 -1
  91. package/src/wave-animation/index.tsx +7 -4
  92. package/lib/commonjs/action-sheet/index.md +0 -69
  93. package/lib/commonjs/avatar/index.md +0 -51
  94. package/lib/commonjs/button/index.md +0 -90
  95. package/lib/commonjs/center/index.md +0 -28
  96. package/lib/commonjs/chip/index.md +0 -60
  97. package/lib/commonjs/column/index.md +0 -34
  98. package/lib/commonjs/divider/index.md +0 -44
  99. package/lib/commonjs/hooks/index.md +0 -71
  100. package/lib/commonjs/input/index.md +0 -73
  101. package/lib/commonjs/list-item/index.md +0 -101
  102. package/lib/commonjs/popover/index.md +0 -57
  103. package/lib/commonjs/row/index.md +0 -46
  104. package/lib/commonjs/space/index.md +0 -31
  105. package/lib/commonjs/text/index.md +0 -63
  106. package/lib/commonjs/touchable/index.md +0 -42
  107. package/lib/commonjs/wave-animation/index.md +0 -50
  108. package/lib/module/action-sheet/index.md +0 -69
  109. package/lib/module/avatar/index.md +0 -51
  110. package/lib/module/button/index.md +0 -90
  111. package/lib/module/center/index.md +0 -28
  112. package/lib/module/chip/index.md +0 -60
  113. package/lib/module/column/index.md +0 -34
  114. package/lib/module/divider/index.md +0 -44
  115. package/lib/module/hooks/index.md +0 -71
  116. package/lib/module/input/index.md +0 -73
  117. package/lib/module/list-item/index.md +0 -101
  118. package/lib/module/popover/index.md +0 -57
  119. package/lib/module/row/index.md +0 -46
  120. package/lib/module/space/index.md +0 -31
  121. package/lib/module/text/index.md +0 -63
  122. package/lib/module/touchable/index.md +0 -42
  123. package/lib/module/wave-animation/index.md +0 -50
  124. package/src/action-sheet/index.md +0 -69
  125. package/src/avatar/index.md +0 -51
  126. package/src/button/index.md +0 -90
  127. package/src/center/index.md +0 -28
  128. package/src/chip/index.md +0 -60
  129. package/src/column/index.md +0 -34
  130. package/src/divider/index.md +0 -44
  131. package/src/hooks/index.md +0 -71
  132. package/src/input/index.md +0 -73
  133. package/src/list-item/index.md +0 -101
  134. package/src/popover/index.md +0 -57
  135. package/src/row/index.md +0 -46
  136. package/src/space/index.md +0 -31
  137. package/src/text/index.md +0 -63
  138. package/src/touchable/index.md +0 -42
  139. package/src/wave-animation/index.md +0 -50
@@ -1,101 +0,0 @@
1
- # ListItem 列表行
2
-
3
- 4 个语义 slot(root / content / description / extra),支持 `styles` 精确覆盖。
4
-
5
- ## 何时使用
6
-
7
- - 替代 `<TouchableOpacity>` + icon + text + arrow 的手写列表行
8
- - 统一列表行样式:设置菜单、选择列表、会话列表等
9
-
10
- ## 代码演示
11
-
12
- ```tsx
13
- // 基础 — 带箭头
14
- <ListItem title="关于" arrow onPress={handleAbout} />
15
-
16
- // 带右侧额外信息
17
- <ListItem title="关于" extra="v1.0.0" onPress={handleAbout} />
18
-
19
- // 带左侧图标
20
- <ListItem
21
- thumb={<Icon name="information-circle-outline" size={22} color={tokens.colorTextSecondary} />}
22
- title="关于"
23
- extra="v1.0.0"
24
- onPress={handleAbout}
25
- />
26
-
27
- // 带描述文字(双行)
28
- <ListItem
29
- thumb={<Icon name="chatbubble-outline" size={16} />}
30
- title="今天的会话"
31
- description="最后一条消息预览..."
32
- onPress={handleSelect}
33
- onLongPress={handleDelete}
34
- />
35
-
36
- // 语义插槽覆盖 — 选中态
37
- <ListItem
38
- title={model.name}
39
- description={model.desc}
40
- extra={isSelected ? <Icon name="checkmark-circle" size={22} color={tokens.colorPrimary} /> : undefined}
41
- onPress={() => handleSelect(model.id)}
42
- styles={isSelected ? {
43
- root: {backgroundColor: '#FFF7F0'},
44
- content: {color: tokens.colorPrimary},
45
- } : undefined}
46
- />
47
-
48
- // 语义插槽覆盖 — 危险操作
49
- <ListItem
50
- thumb={<Icon name="log-out-outline" size={22} color={tokens.colorError} />}
51
- title="退出登录"
52
- onPress={handleLogout}
53
- styles={{content: {color: tokens.colorError}}}
54
- />
55
- ```
56
-
57
- ## API
58
-
59
- | 属性 | 说明 | 类型 | 默认值 |
60
- |------|------|------|--------|
61
- | thumb | 左侧缩略(图标、头像等) | `ReactNode` | - |
62
- | title | 主标题 | `string` \| `ReactNode` | **必填** |
63
- | description | 描述文字(单行截断) | `string` | - |
64
- | extra | 右侧额外内容 | `ReactNode` \| `string` | - |
65
- | arrow | 显示右箭头 | `boolean` | `false` |
66
- | onPress | 点击回调(有值时渲染为 Pressable) | `() => void` | - |
67
- | onLongPress | 长按回调 | `() => void` | - |
68
- | disabled | 禁用状态 | `boolean` | `false` |
69
- | style | 外层容器样式 | `ViewStyle` | - |
70
- | styles | 语义插槽样式 | `Partial<ListItemSemanticStyles>` | - |
71
- | testID | 测试标识 | `string` | - |
72
-
73
- ## Semantic Styles
74
-
75
- 通过 `styles` prop 精确覆盖组件内部各 slot 的样式。
76
-
77
- | 插槽 | 类型 | 说明 |
78
- |------|------|------|
79
- | root | `ViewStyle` | 整行容器(padding、背景等) |
80
- | content | `TextStyle` | 主标题文字(字号、颜色、flex 等) |
81
- | description | `TextStyle` | 描述文字(字号、颜色等) |
82
- | extra | `ViewStyle & TextStyle` | 右侧额外内容区域 |
83
-
84
- ## 内部布局
85
-
86
- ```
87
- ┌─ root ──────────────────────────────────┐
88
- │ [thumb] ┌─ line ─────────────────────┐ │
89
- │ │ ┌─ contentWrap ──────────┐ │ │
90
- │ │ │ [content] │ │ │
91
- │ │ │ [description] │ │ │
92
- │ │ └────────────────────────┘ │ │
93
- │ │ [extra] [arrow] │ │
94
- │ └────────────────────────────┘ │
95
- └─────────────────────────────────────────┘
96
- ```
97
-
98
- ## 交互行为
99
-
100
- - 有 `onPress` 时自动包裹 `Pressable`,无 `onPress` 时渲染为纯 `View`
101
- - `onLongPress` 仅在有 `onPress` 时生效
@@ -1,57 +0,0 @@
1
- ---
2
- title: Popover
3
- nav:
4
- title: 组件
5
- order: 1
6
- group:
7
- title: 基础
8
- order: 2
9
- ---
10
-
11
- # Popover 弹出定位容器
12
-
13
- 锚定在指定元素下方的弹出容器,用于下拉菜单等场景。
14
-
15
- ## 何时使用
16
-
17
- - 下拉选择菜单
18
- - 模型选择器
19
- - 任何需要锚定定位的浮层
20
-
21
- ## 代码演示
22
-
23
- ```tsx
24
- import { Popover } from '@unif/react-native-ui';
25
-
26
- <Popover
27
- visible={visible}
28
- onClose={() => setVisible(false)}
29
- anchorLayout={{ x: 100, y: 50, width: 120, height: 40 }}
30
- width={180}
31
- >
32
- <View>
33
- <Text>下拉内容</Text>
34
- </View>
35
- </Popover>
36
- ```
37
-
38
- ## API
39
-
40
- | 属性 | 说明 | 类型 | 默认值 |
41
- | ------------ | -------------- | --------------------------------------------- | ---------- |
42
- | visible | 是否可见 | `boolean` | - |
43
- | onClose | 关闭回调 | `() => void` | - |
44
- | anchorLayout | 锚点布局 | `{ x, y, width, height }` | - |
45
- | width | 内容宽度 | `number` | `180` |
46
- | placement | 弹出方向 | `'bottom'` \| `'top'` | `'bottom'` |
47
- | children | 弹出内容 | `ReactNode` | - |
48
- | style | 内容容器样式 | `ViewStyle` | - |
49
- | styles | 语义样式 | `PopoverSemanticStyles` | - |
50
- | testID | 测试标识 | `string` | - |
51
-
52
- ## Semantic Styles
53
-
54
- | Slot | 说明 |
55
- | ------- | ------------ |
56
- | overlay | 遮罩层 |
57
- | content | 内容容器 |
@@ -1,46 +0,0 @@
1
- # Row 水平布局
2
-
3
- 水平排列子元素,默认垂直居中。替代 `flexDirection: 'row' + alignItems: 'center'` 的手写样式。
4
-
5
- ## 何时使用
6
-
7
- - 需要水平排列元素时
8
- - 替代 `<View style={{flexDirection: 'row', alignItems: 'center'}}>` 的场景
9
-
10
- ## 代码演示
11
-
12
- ```tsx
13
- // 基础用法 — 默认 alignItems: 'center'
14
- <Row>
15
- <Icon name="star" />
16
- <Text>标题</Text>
17
- </Row>
18
-
19
- // 两端对齐
20
- <Row justify="space-between">
21
- <Text>左侧</Text>
22
- <Text>右侧</Text>
23
- </Row>
24
-
25
- // 间距
26
- <Row gap={10}>
27
- <Button block onPress={...}>修改</Button>
28
- <Button block onPress={...}>确认</Button>
29
- </Row>
30
-
31
- // 换行
32
- <Row wrap gap={8}>
33
- {tags.map(tag => <Tag key={tag}>{tag}</Tag>)}
34
- </Row>
35
- ```
36
-
37
- ## API
38
-
39
- | 属性 | 说明 | 类型 | 默认值 |
40
- |------|------|------|--------|
41
- | align | alignItems | `ViewStyle['alignItems']` | `'center'` |
42
- | justify | justifyContent | `ViewStyle['justifyContent']` | - |
43
- | gap | 子元素间距 | `number` | - |
44
- | wrap | 是否换行 | `boolean` | `false` |
45
-
46
- > 继承所有 RN `ViewProps`(`style`、`testID` 等)
@@ -1,31 +0,0 @@
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'` |
@@ -1,63 +0,0 @@
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 拥有最高优先级。
@@ -1,42 +0,0 @@
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`
@@ -1,50 +0,0 @@
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` | - |
@@ -1,69 +0,0 @@
1
- ---
2
- title: ActionSheet
3
- nav:
4
- title: 组件
5
- order: 1
6
- group:
7
- title: 基础
8
- order: 2
9
- ---
10
-
11
- # ActionSheet 底部操作面板
12
-
13
- 从底部弹出的选项网格面板。
14
-
15
- ## 何时使用
16
-
17
- - 需要展示操作选项时(如拍照、选照片等)
18
- - 底部弹出式面板
19
-
20
- ## 代码演示
21
-
22
- ```tsx
23
- import { ActionSheet, Icon } from '@unif/react-native-ui';
24
-
25
- const options = [
26
- { key: 'camera', label: '拍照', icon: <Icon name="camera-outline" size={28} /> },
27
- { key: 'photo', label: '照片', icon: <Icon name="image-outline" size={28} /> },
28
- ];
29
-
30
- <ActionSheet
31
- visible={visible}
32
- onClose={() => setVisible(false)}
33
- options={options}
34
- onSelect={(key) => console.log(key)}
35
- />
36
- ```
37
-
38
- ## API
39
-
40
- | 属性 | 说明 | 类型 | 默认值 |
41
- | -------- | -------------- | ----------------------------------- | ------ |
42
- | visible | 是否可见 | `boolean` | - |
43
- | onClose | 关闭回调 | `() => void` | - |
44
- | title | 标题 | `string` | - |
45
- | options | 选项列表 | `ActionSheetOption[]` | - |
46
- | onSelect | 选择回调 | `(key: string) => void` | - |
47
- | columns | 每行列数 | `number` | `3` |
48
- | style | 面板样式 | `ViewStyle` | - |
49
- | styles | 语义样式 | `ActionSheetSemanticStyles` | - |
50
- | testID | 测试标识 | `string` | - |
51
-
52
- ## ActionSheetOption
53
-
54
- | 属性 | 说明 | 类型 |
55
- | ----- | ------ | ----------- |
56
- | key | 唯一标识 | `string` |
57
- | label | 显示文本 | `string` |
58
- | icon | 图标 | `ReactNode` |
59
-
60
- ## Semantic Styles
61
-
62
- | Slot | 说明 |
63
- | ----------- | -------------- |
64
- | overlay | 遮罩层 |
65
- | panel | 底部面板 |
66
- | grid | 网格容器 |
67
- | option | 单个选项 |
68
- | optionIcon | 选项图标容器 |
69
- | optionLabel | 选项标签文本 |
@@ -1,51 +0,0 @@
1
- ---
2
- title: Avatar
3
- nav:
4
- title: 组件
5
- order: 1
6
- group:
7
- title: 原子
8
- order: 1
9
- ---
10
-
11
- # Avatar 头像
12
-
13
- 圆形图像/图标容器,支持图片、图标、占位三种模式。
14
-
15
- ## 何时使用
16
-
17
- - 展示用户头像
18
- - 展示 AI 助手图标头像
19
-
20
- ## 代码演示
21
-
22
- ```tsx
23
- import { Avatar, Icon } from '@unif/react-native-ui';
24
-
25
- // 图片头像
26
- <Avatar size={40} source={{ uri: 'https://example.com/avatar.png' }} />
27
-
28
- // 图标头像
29
- <Avatar size={28} icon={<Icon name="sparkles" size={18} color="#EB6E00" />} />
30
-
31
- // 默认占位
32
- <Avatar size={40} />
33
- ```
34
-
35
- ## API
36
-
37
- | 属性 | 说明 | 类型 | 默认值 |
38
- | ------- | ---------------- | ---------------------- | ------ |
39
- | size | 头像尺寸 | `number` | `40` |
40
- | source | 图片来源 | `ImageSourcePropType` | - |
41
- | icon | 替代图片的图标 | `ReactNode` | - |
42
- | style | 容器样式 | `ViewStyle` | - |
43
- | styles | 语义样式 | `AvatarSemanticStyles` | - |
44
- | testID | 测试标识 | `string` | - |
45
-
46
- ## Semantic Styles
47
-
48
- | Slot | 说明 |
49
- | ----- | ---------- |
50
- | root | 外层容器 |
51
- | image | 图片元素 |
@@ -1,90 +0,0 @@
1
- # Button 语义化按钮
2
-
3
- 支持 `type` / `size` 变体和 `styles` 语义插槽覆盖。使用 `Pressable` 实现按下态反馈。
4
-
5
- ## 何时使用
6
-
7
- - 替代 `<TouchableOpacity>` + 手写按钮样式的组合
8
- - 需要统一按钮风格(主按钮、描边按钮、幽灵按钮)时
9
-
10
- ## 代码演示
11
-
12
- ```tsx
13
- // 主按钮
14
- <Button onPress={handleConfirm}>确认下单</Button>
15
-
16
- // 描边按钮
17
- <Button type="outline" onPress={handleModify}>修改</Button>
18
-
19
- // 幽灵按钮
20
- <Button type="ghost" onPress={handlePush}>推送经销商</Button>
21
-
22
- // 并排等宽
23
- <View style={{flexDirection: 'row', gap: 10}}>
24
- <Button type="outline" block onPress={handleModify}>修改</Button>
25
- <Button block onPress={handleConfirm}>确认</Button>
26
- </View>
27
-
28
- // 带图标
29
- <Button icon={<Icon name="add" size={16} color="#FFF" />} onPress={handleAdd}>
30
- 添加
31
- </Button>
32
-
33
- // 语义插槽覆盖
34
- <Button
35
- type="outline"
36
- onPress={handleAction}
37
- styles={{root: {borderColor: 'red'}, content: {color: 'red'}}}>
38
- 危险操作
39
- </Button>
40
- ```
41
-
42
- ## API
43
-
44
- | 属性 | 说明 | 类型 | 默认值 |
45
- |------|------|------|--------|
46
- | type | 按钮类型 | `'primary'` \| `'outline'` \| `'ghost'` \| `'danger'` | `'primary'` |
47
- | size | 按钮大小 | `'default'` \| `'small'` | `'default'` |
48
- | icon | 左侧图标 | `ReactNode` | - |
49
- | disabled | 禁用状态 | `boolean` | `false` |
50
- | block | 撑满父容器(flex: 1) | `boolean` | `false` |
51
- | loading | 加载状态 | `boolean` | `false` |
52
- | onPress | 点击回调 | `() => void` | **必填** |
53
- | style | 外层容器样式 | `ViewStyle` | - |
54
- | styles | 语义插槽样式 | `Partial<ButtonSemanticStyles>` | - |
55
- | testID | 测试标识 | `string` | - |
56
- | children | 按钮内容 | `ReactNode` | **必填** |
57
-
58
- ## Semantic Styles
59
-
60
- 通过 `styles` prop 精确覆盖组件内部各 slot 的样式,不侵入组件结构。
61
-
62
- | 插槽 | 类型 | 说明 |
63
- |------|------|------|
64
- | root | `ViewStyle` | 按钮容器(背景、边框、圆角等) |
65
- | icon | `ViewStyle` | 图标区域(间距等) |
66
- | content | `TextStyle` | 文字区域(字号、颜色、字重等) |
67
-
68
- ## Type 规格
69
-
70
- | type | 背景 | 文字色 | 边框 |
71
- |------|------|--------|------|
72
- | primary | colorPrimary | #FFF | 无 |
73
- | outline | 透明 | colorTextSecondary | colorBorder |
74
- | ghost | 透明 | colorPrimary | colorPrimary |
75
- | danger | colorError | #FFF | 无 |
76
-
77
- ## Size 规格
78
-
79
- | size | paddingVertical | borderRadius | fontSize |
80
- |------|----------------|--------------|----------|
81
- | default | 10 | 8 | 14 |
82
- | small | 6 | 6 | 12 |
83
-
84
- ## 样式合并顺序
85
-
86
- ```
87
- DEFAULT_STYLES → SIZE_STYLES → TYPE_STYLES → DISABLED_STYLES → BLOCK_STYLES → semanticStyles
88
- ```
89
-
90
- 内部使用 `mergeStyles` + `useMemo` 按 slot 维度合并,仅在 props 变化时重算。
@@ -1,28 +0,0 @@
1
- # Center 居中布局
2
-
3
- 内容水平 + 垂直居中。替代 `justifyContent: 'center' + alignItems: 'center'`。
4
-
5
- ## 何时使用
6
-
7
- - 圆形图标按钮、头像容器
8
- - 空状态页面居中
9
- - 任何需要内容完全居中的场景
10
-
11
- ## 代码演示
12
-
13
- ```tsx
14
- // 圆形按钮
15
- <Center style={{width: 32, height: 32, borderRadius: 16, backgroundColor: '#EB6E00'}}>
16
- <Icon name="add" size={18} color="#FFF" />
17
- </Center>
18
-
19
- // 空状态
20
- <Center style={{flex: 1}}>
21
- <Icon name="inbox" size={48} />
22
- <Text secondary>暂无数据</Text>
23
- </Center>
24
- ```
25
-
26
- ## API
27
-
28
- > 继承所有 RN `ViewProps`,无额外属性。
@@ -1,60 +0,0 @@
1
- ---
2
- title: Chip
3
- nav:
4
- title: 组件
5
- order: 1
6
- group:
7
- title: 基础
8
- order: 2
9
- ---
10
-
11
- # Chip 胶囊标签
12
-
13
- 用于展示标签或可选项的胶囊形组件。
14
-
15
- ## 何时使用
16
-
17
- - 展示快捷建议
18
- - 标签选择
19
- - 筛选项
20
-
21
- ## 代码演示
22
-
23
- ```tsx
24
- import { Chip, Icon } from '@unif/react-native-ui';
25
-
26
- // 基本用法
27
- <Chip onPress={() => {}}>标签文本</Chip>
28
-
29
- // 带图标
30
- <Chip icon={<Icon name="search-outline" size={14} />} onPress={() => {}}>
31
- 搜索
32
- </Chip>
33
-
34
- // 选中态
35
- <Chip selected onPress={() => {}}>已选中</Chip>
36
-
37
- // 小尺寸
38
- <Chip size="small">小标签</Chip>
39
- ```
40
-
41
- ## API
42
-
43
- | 属性 | 说明 | 类型 | 默认值 |
44
- | -------- | ------------ | ------------------------- | ----------- |
45
- | children | 内容 | `ReactNode` | - |
46
- | onPress | 点击回调 | `() => void` | - |
47
- | selected | 选中状态 | `boolean` | - |
48
- | disabled | 禁用状态 | `boolean` | - |
49
- | size | 尺寸 | `'default'` \| `'small'` | `'default'` |
50
- | icon | 左侧图标 | `ReactNode` | - |
51
- | style | 容器样式 | `ViewStyle` | - |
52
- | styles | 语义样式 | `ChipSemanticStyles` | - |
53
- | testID | 测试标识 | `string` | - |
54
-
55
- ## Semantic Styles
56
-
57
- | Slot | 说明 |
58
- | ------- | ---------- |
59
- | root | 外层容器 |
60
- | content | 文本样式 |