@beppla/tapas-ui 1.5.2 → 1.5.6

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 (167) hide show
  1. package/commonjs/Alert/README.md +75 -0
  2. package/commonjs/BarChart/README.md +172 -0
  3. package/commonjs/Button/README.md +108 -0
  4. package/commonjs/Calendar/Calendar.base.js +1 -1
  5. package/commonjs/Calendar/Calendar.base.js.map +1 -1
  6. package/commonjs/Calendar/README.md +410 -0
  7. package/commonjs/Card/README.md +126 -0
  8. package/commonjs/CheckBox/README.md +147 -0
  9. package/commonjs/CircularProgress/README.md +70 -0
  10. package/commonjs/Collapsible/README.md +140 -0
  11. package/commonjs/ComboChart/README.md +124 -0
  12. package/commonjs/DashboardCard/README.md +120 -0
  13. package/commonjs/DataTable/README.md +159 -0
  14. package/commonjs/DeviceSelectionModal/README.md +124 -0
  15. package/commonjs/DraggableFlatList/README.md +35 -0
  16. package/commonjs/Drawer/README.md +175 -0
  17. package/commonjs/Dropdown/README.md +230 -0
  18. package/commonjs/ExternalLink/README.md +81 -0
  19. package/commonjs/Gantt/README.md +155 -0
  20. package/commonjs/Grid/README.md +197 -0
  21. package/commonjs/Header/README.md +109 -0
  22. package/commonjs/HelloWave/README.md +28 -0
  23. package/commonjs/Hoverable/Hoverable.js.map +1 -1
  24. package/commonjs/IconText/README.md +99 -0
  25. package/commonjs/Image/PreviewImg/README.md +100 -0
  26. package/commonjs/Image/README.md +88 -0
  27. package/commonjs/Input/Input.js +60 -4
  28. package/commonjs/Input/Input.js.map +1 -1
  29. package/commonjs/Layout/README.md +174 -0
  30. package/commonjs/LineChart/README.md +181 -0
  31. package/commonjs/ListItem/README.md +122 -0
  32. package/commonjs/MessageBox/MessageBox.js +7 -1
  33. package/commonjs/MessageBox/MessageBox.js.map +1 -1
  34. package/commonjs/MessageBox/README.md +120 -0
  35. package/commonjs/Navigation/README.md +197 -0
  36. package/commonjs/NumericInput/README.md +95 -0
  37. package/commonjs/Overlay/README.md +84 -0
  38. package/commonjs/Pagination/README.md +106 -0
  39. package/commonjs/PieChart/README.md +212 -0
  40. package/commonjs/Popover/README.md +82 -0
  41. package/commonjs/Progress/README.md +106 -0
  42. package/commonjs/RadioButton/README.md +85 -0
  43. package/commonjs/ScanButton/README.md +72 -0
  44. package/commonjs/SearchInput/SearchInput.js.map +1 -1
  45. package/commonjs/SheetTitle/README.md +89 -0
  46. package/commonjs/Shell/README.md +152 -0
  47. package/commonjs/Shell/Shell.js.map +1 -1
  48. package/commonjs/StatisticCard/README.md +129 -0
  49. package/commonjs/Status/README.md +75 -0
  50. package/commonjs/Steps/README.md +76 -0
  51. package/commonjs/Switch/Switch.js +101 -0
  52. package/commonjs/Switch/Switch.js.map +1 -0
  53. package/commonjs/Tab/README.md +161 -0
  54. package/commonjs/Tag/README.md +93 -0
  55. package/commonjs/Task/README.md +110 -0
  56. package/commonjs/Text/README.md +97 -0
  57. package/commonjs/TextArea/README.md +127 -0
  58. package/commonjs/TextArea/TextArea.js +4 -2
  59. package/commonjs/TextArea/TextArea.js.map +1 -1
  60. package/commonjs/Theme/README.md +161 -0
  61. package/commonjs/Theme/makeStyles.js +30 -0
  62. package/commonjs/Theme/makeStyles.js.map +1 -0
  63. package/commonjs/Theme/withTheme.js +91 -0
  64. package/commonjs/Theme/withTheme.js.map +1 -0
  65. package/commonjs/Timeline/README.md +111 -0
  66. package/commonjs/Toast/README.md +96 -0
  67. package/commonjs/Upload/Upload.js +126 -0
  68. package/commonjs/Upload/Upload.js.map +1 -0
  69. package/commonjs/index.js +24 -4
  70. package/commonjs/index.js.map +1 -1
  71. package/module/Alert/README.md +75 -0
  72. package/module/BarChart/README.md +172 -0
  73. package/module/Button/README.md +108 -0
  74. package/module/Calendar/Calendar.base.js +1 -1
  75. package/module/Calendar/Calendar.base.js.map +1 -1
  76. package/module/Calendar/README.md +410 -0
  77. package/module/Card/README.md +126 -0
  78. package/module/CheckBox/README.md +147 -0
  79. package/module/CircularProgress/README.md +70 -0
  80. package/module/Collapsible/README.md +140 -0
  81. package/module/ComboChart/README.md +124 -0
  82. package/module/DashboardCard/README.md +120 -0
  83. package/module/DataTable/README.md +159 -0
  84. package/module/DeviceSelectionModal/README.md +124 -0
  85. package/module/DraggableFlatList/README.md +35 -0
  86. package/module/Drawer/README.md +175 -0
  87. package/module/Dropdown/README.md +230 -0
  88. package/module/ExternalLink/README.md +81 -0
  89. package/module/Gantt/README.md +155 -0
  90. package/module/Grid/README.md +197 -0
  91. package/module/Header/README.md +109 -0
  92. package/module/HelloWave/README.md +28 -0
  93. package/module/Hoverable/Hoverable.js.map +1 -1
  94. package/module/IconText/README.md +99 -0
  95. package/module/Image/PreviewImg/README.md +100 -0
  96. package/module/Image/README.md +88 -0
  97. package/module/Input/Input.js +60 -4
  98. package/module/Input/Input.js.map +1 -1
  99. package/module/Layout/README.md +174 -0
  100. package/module/LineChart/README.md +181 -0
  101. package/module/ListItem/README.md +122 -0
  102. package/module/MessageBox/MessageBox.js +8 -2
  103. package/module/MessageBox/MessageBox.js.map +1 -1
  104. package/module/MessageBox/README.md +120 -0
  105. package/module/Navigation/README.md +197 -0
  106. package/module/NumericInput/README.md +95 -0
  107. package/module/Overlay/README.md +84 -0
  108. package/module/Pagination/README.md +106 -0
  109. package/module/PieChart/README.md +212 -0
  110. package/module/Popover/README.md +82 -0
  111. package/module/Progress/README.md +106 -0
  112. package/module/RadioButton/README.md +85 -0
  113. package/module/ScanButton/README.md +72 -0
  114. package/module/SearchInput/SearchInput.js.map +1 -1
  115. package/module/SheetTitle/README.md +89 -0
  116. package/module/Shell/README.md +152 -0
  117. package/module/Shell/Shell.js.map +1 -1
  118. package/module/StatisticCard/README.md +129 -0
  119. package/module/Status/README.md +75 -0
  120. package/module/Steps/README.md +76 -0
  121. package/module/Switch/Switch.js +96 -0
  122. package/module/Switch/Switch.js.map +1 -0
  123. package/module/Tab/README.md +161 -0
  124. package/module/Tag/README.md +93 -0
  125. package/module/Task/README.md +110 -0
  126. package/module/Text/README.md +97 -0
  127. package/module/TextArea/README.md +127 -0
  128. package/module/TextArea/TextArea.js +4 -2
  129. package/module/TextArea/TextArea.js.map +1 -1
  130. package/module/Theme/README.md +161 -0
  131. package/module/Theme/makeStyles.js +24 -0
  132. package/module/Theme/makeStyles.js.map +1 -0
  133. package/module/Theme/withTheme.js +82 -0
  134. package/module/Theme/withTheme.js.map +1 -0
  135. package/module/Timeline/README.md +111 -0
  136. package/module/Toast/README.md +96 -0
  137. package/module/Upload/Upload.js +121 -0
  138. package/module/Upload/Upload.js.map +1 -0
  139. package/module/index.js +11 -3
  140. package/module/index.js.map +1 -1
  141. package/package.json +1 -1
  142. package/typescript/Grid/FixedSizeGrid.d.ts +1 -3
  143. package/typescript/Grid/FixedSizeGrid.d.ts.map +1 -1
  144. package/typescript/Grid/Grid.base.d.ts +1 -3
  145. package/typescript/Grid/Grid.base.d.ts.map +1 -1
  146. package/typescript/Grid/VariableSizeGrid.d.ts +1 -3
  147. package/typescript/Grid/VariableSizeGrid.d.ts.map +1 -1
  148. package/typescript/Input/Input.d.ts +5 -0
  149. package/typescript/Input/Input.d.ts.map +1 -1
  150. package/typescript/MessageBox/MessageBox.d.ts.map +1 -1
  151. package/typescript/SearchInput/SearchInput.d.ts +4 -0
  152. package/typescript/SearchInput/SearchInput.d.ts.map +1 -1
  153. package/typescript/Switch/Switch.d.ts +15 -0
  154. package/typescript/Switch/Switch.d.ts.map +1 -0
  155. package/typescript/TextArea/TextArea.d.ts +2 -0
  156. package/typescript/TextArea/TextArea.d.ts.map +1 -1
  157. package/typescript/Theme/makeStyles.d.ts +11 -0
  158. package/typescript/Theme/makeStyles.d.ts.map +1 -0
  159. package/typescript/Theme/withTheme.d.ts +12 -0
  160. package/typescript/Theme/withTheme.d.ts.map +1 -0
  161. package/typescript/Upload/Upload.d.ts +25 -0
  162. package/typescript/Upload/Upload.d.ts.map +1 -0
  163. package/typescript/WebViewBridge/useWebViewBridge.d.ts +1 -1
  164. package/typescript/WebViewBridge/useWebViewBridge.d.ts.map +1 -1
  165. package/typescript/common/hooks/useBridgelessFix.d.ts +1 -1
  166. package/typescript/index.d.ts +7 -1
  167. package/typescript/index.d.ts.map +1 -1
@@ -0,0 +1,106 @@
1
+ # Pagination
2
+
3
+ 分页组件,用于大数据列表的分页导航。支持页码选择、每页条数切换、分组翻页和总数展示,适配桌面和移动端。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 页码分组展示(每组 5 页),前后翻组
8
+ - ✅ 当前页高亮(圆形选中样式)
9
+ - ✅ 每页条数下拉选择(Dropdown 集成)
10
+ - ✅ 总数显示(可选隐藏)
11
+ - ✅ 移动端自适应:默认隐藏总数和每页条数选择
12
+ - ✅ 自定义每页条数选项(pageSizeOptions)
13
+ - ✅ 自定义容器样式和背景色
14
+ - ✅ 下拉框位置和宽度可配置
15
+ - ✅ 无障碍支持(accessibilityRole / accessibilityLabel)
16
+
17
+ ## 安装使用
18
+
19
+ ```tsx
20
+ import { Pagination } from '@beppla/tapas-ui';
21
+ ```
22
+
23
+ ## Props
24
+
25
+ | 属性 | 类型 | 默认值 | 说明 |
26
+ |------|------|--------|------|
27
+ | totalCount | `string` | - | 总数显示文本(必填) |
28
+ | pageParams | `TPageParams` | `{ page: 1, pageSize: 10, totalItems: 0, totalPage: 1 }` | 分页参数 |
29
+ | pageSizeOptions | `ItemProps[]` | `[1, 5, 10, 20, 50, 100]/Page` | 每页条数选项 |
30
+ | visibleTotalCount | `boolean` | 桌面端 `true`,移动端 `false` | 是否显示总数 |
31
+ | visiblePageSizeOptions | `boolean` | 桌面端 `true`,移动端 `false` | 是否显示每页条数选择 |
32
+ | onPageChange | `(page: TPageParams) => void` | - | 页码变化回调 |
33
+ | onPageSizeChange | `(item: ItemProps) => void` | - | 每页条数变化回调 |
34
+ | paginationContainerStyle | `StyleProp<ViewStyle>` | - | 容器样式 |
35
+ | pageSizePosition | `TDropdownPosition` | `'auto'` | 下拉框弹出位置 |
36
+ | backgroundColor | `string` | - | 背景色 |
37
+ | pageSizeDropdownWidth | `number` | 自动计算 | 下拉框宽度 |
38
+
39
+ ### TPageParams
40
+
41
+ ```tsx
42
+ type TPageParams = {
43
+ page: number; // 当前页码
44
+ pageSize: number; // 每页条数
45
+ totalItems: number; // 总条数
46
+ totalPage: number; // 总页数
47
+ }
48
+ ```
49
+
50
+ ## 使用示例
51
+
52
+ ### 基础用法
53
+
54
+ ```tsx
55
+ <Pagination
56
+ totalCount="100 items"
57
+ pageParams={{
58
+ page: 1,
59
+ pageSize: 10,
60
+ totalItems: 100,
61
+ totalPage: 10,
62
+ }}
63
+ onPageChange={(params) => {
64
+ fetchData(params.page, params.pageSize);
65
+ }}
66
+ />
67
+ ```
68
+
69
+ ### 自定义每页条数
70
+
71
+ ```tsx
72
+ <Pagination
73
+ totalCount="500 records"
74
+ pageParams={pageParams}
75
+ pageSizeOptions={[
76
+ { name: '25/Page', value: 25 },
77
+ { name: '50/Page', value: 50 },
78
+ { name: '100/Page', value: 100 },
79
+ ]}
80
+ onPageChange={handlePageChange}
81
+ onPageSizeChange={(item) => {
82
+ setPageSize(item.value);
83
+ }}
84
+ />
85
+ ```
86
+
87
+ ### 隐藏总数和条数选择
88
+
89
+ ```tsx
90
+ <Pagination
91
+ totalCount=""
92
+ pageParams={pageParams}
93
+ visibleTotalCount={false}
94
+ visiblePageSizeOptions={false}
95
+ onPageChange={handlePageChange}
96
+ />
97
+ ```
98
+
99
+ ## 注意事项
100
+
101
+ - 页码分组为每组 5 页,通过左右箭头翻组
102
+ - `pageParams` 变化会自动同步内部状态
103
+ - 移动端自动隐藏总数和每页条数选择器
104
+ - 下拉框宽度默认根据最长选项文本自动计算(最小 140px,最大 200px)
105
+ - 组件使用 `React.memo` 优化渲染
106
+ - 下拉框基于 Dropdown 组件实现
@@ -0,0 +1,212 @@
1
+ # PieChart / NestedPieChart
2
+
3
+ 饼图组件,包含基础饼图(PieChart)和嵌套饼图(NestedPieChart)两个组件。支持饼图、环形图(Donut)、多层级嵌套等展示方式。采用**双平台渲染**策略:Web 端使用 recharts,Native 端使用 react-native-svg-charts。
4
+
5
+ ## 功能特性
6
+
7
+ ### PieChart
8
+ - ✅ **双平台渲染**:Web 使用 recharts,Native 使用 react-native-svg-charts
9
+ - ✅ 支持饼图和环形图(通过 innerRadius 控制)
10
+ - ✅ 图例支持 top / bottom / left / right 四个位置
11
+ - ✅ 图例可显示数值,支持 left / right 对齐
12
+ - ✅ 自定义图例间距:行间距(legendItemGap)、Label-Value 间距(legendLabelValueGap)
13
+ - ✅ Label 最小宽度控制(legendLabelMinWidth),确保数值列对齐
14
+ - ✅ 饼图与图例间距可调(legendChartGap,左右位置时生效)
15
+ - ✅ 自定义外圆/内圆半径,支持数字(像素)和字符串(百分比)
16
+ - ✅ 支持扇区标签显示和中心文字
17
+ - ✅ 长图例列表自动滚动(Native 端 ScrollView)
18
+
19
+ ### NestedPieChart
20
+ - ✅ 支持多层级嵌套饼图(仅 Web 平台)
21
+ - ✅ 树形数据结构和扁平数据结构,支持自动推断
22
+ - ✅ 分组图例(grouped legend),可折叠展开
23
+ - ✅ 自动配色策略(渐变色阶,baseColors 映射)
24
+ - ✅ 扇区点击/悬停、图例点击事件
25
+ - ✅ 图例过滤(enableLegendFilter)
26
+ - ✅ 自定义 Tooltip
27
+ - ✅ 格式化函数(数值 / 百分比)
28
+
29
+ ## 安装使用
30
+
31
+ ```tsx
32
+ import { PieChart } from '@beppla/tapas-ui/components/PieChart';
33
+ import { NestedPieChart } from '@beppla/tapas-ui/components/PieChart';
34
+ ```
35
+
36
+ ## PieChart Props
37
+
38
+ | 属性 | 类型 | 默认值 | 说明 |
39
+ |------|------|--------|------|
40
+ | data | `PieChartData[]` | (必填) | 饼图数据 |
41
+ | width | `number` | - | 图表宽度 |
42
+ | height | `number` | `300` | 图表高度 |
43
+ | colors | `string[]` | 默认 6 色 | 颜色方案 |
44
+ | outerRadius | `number \| string` | 自动计算 | 外圆半径,支持像素和百分比(如 `'80%'`) |
45
+ | innerRadius | `number \| string` | `0` | 内圆半径,设置后变为环形图 |
46
+ | padAngle | `number` | `0.02` | 扇区间隔角度 |
47
+ | showLabels | `boolean` | `false` | 是否在扇区上显示标签 |
48
+ | showLegend | `boolean` | `true` | 是否显示图例 |
49
+ | legendPosition | `'top' \| 'bottom' \| 'left' \| 'right'` | `'right'` | 图例位置 |
50
+ | showLegendValues | `boolean` | `true` | 图例是否显示数值 |
51
+ | legendValueAlign | `'left' \| 'right'` | `'right'` | 图例数值对齐方式 |
52
+ | legendItemGap | `number` | `8` | 图例行间距(px) |
53
+ | legendLabelValueGap | `number` | `12` | Label 与 Value 间距(px) |
54
+ | legendLabelMinWidth | `number` | - | Label 最小宽度,确保对齐 |
55
+ | legendChartGap | `number` | `30` | 饼图与图例间距(左右位置时生效) |
56
+ | centerText | `string` | - | 中心文字(环形图) |
57
+ | style | `any` | - | 容器样式 |
58
+ | testID | `string` | - | 测试标识 |
59
+
60
+ ### PieChartData
61
+
62
+ | 属性 | 类型 | 说明 |
63
+ |------|------|------|
64
+ | value | `number` | 数值(必填) |
65
+ | label | `string` | 标签 |
66
+ | color | `string` | 自定义颜色(优先级高于 colors 数组) |
67
+ | key | `string \| number` | 唯一标识 |
68
+
69
+ ## NestedPieChart Props
70
+
71
+ | 属性 | 类型 | 默认值 | 说明 |
72
+ |------|------|--------|------|
73
+ | data | `NestedPieChartNode[] \| NestedPieChartFlatData[]` | (必填) | 嵌套数据 |
74
+ | dataType | `'tree' \| 'flat'` | 自动推断 | 数据类型 |
75
+ | levels | `number` | 自动计算 | 显示层数 |
76
+ | width | `number` | - | 图表宽度 |
77
+ | height | `number` | - | 图表高度 |
78
+ | outerRadius | `number \| string` | - | 外圆半径 |
79
+ | innerRadius | `number \| string` | - | 最内层半径 |
80
+ | radiusGap | `number` | `10` | 层间间隔 |
81
+ | colorStrategy | `ColorStrategy` | - | 配色策略(baseColors、autoGenerate、colorSteps) |
82
+ | colors | `string[]` | - | 默认配色数组 |
83
+ | showLegend | `boolean` | - | 是否显示图例 |
84
+ | legendMode | `'flat' \| 'grouped'` | - | 图例模式 |
85
+ | legendPosition | `'top' \| 'bottom' \| 'left' \| 'right'` | - | 图例位置 |
86
+ | legendContent | `'all' \| 'parent-only' \| 'children-only'` | - | 图例显示内容 |
87
+ | legendCollapsible | `boolean` | - | 图例是否可折叠 |
88
+ | legendDefaultExpanded | `boolean` | - | 图例默认展开 |
89
+ | legendSortStrategy | `'none' \| 'value-desc' \| 'value-asc' \| 'label-asc' \| 'label-desc'` | - | 图例排序策略 |
90
+ | legendGroupSortStrategy | `LegendSortStrategy` | - | 分组排序策略 |
91
+ | legendShowValues | `boolean` | - | 是否显示数值 |
92
+ | legendShowPercent | `boolean` | - | 是否显示百分比 |
93
+ | legendItemGap | `number` | - | 图例项间距 |
94
+ | legendGroupGap | `number` | - | 分组间距 |
95
+ | legendLabelMinWidth | `number` | - | Label 最小宽度 |
96
+ | legendChartGap | `number` | - | 饼图与图例间距 |
97
+ | showLabels | `boolean` | - | 是否显示扇区标签 |
98
+ | labelLevel | `'all' \| number` | - | 显示标签的层级 |
99
+ | formatValue | `(value: number) => string` | - | 数值格式化 |
100
+ | formatPercent | `(percent: number) => string` | - | 百分比格式化 |
101
+ | onSliceClick | `(event: SliceClickEvent) => void` | - | 扇区点击 |
102
+ | onSliceHover | `(event: SliceClickEvent \| null) => void` | - | 扇区悬停 |
103
+ | onLegendClick | `(event: LegendClickEvent) => void` | - | 图例点击 |
104
+ | enableLegendFilter | `boolean` | - | 点击图例过滤扇区 |
105
+ | showTooltip | `boolean` | - | 是否显示 Tooltip |
106
+ | customTooltip | `(event: SliceClickEvent) => ReactNode` | - | 自定义 Tooltip |
107
+ | padAngle | `number` | - | 扇区间隔角度 |
108
+ | centerText | `string` | - | 中心文字 |
109
+ | centerTextStyle | `React.CSSProperties` | - | 中心文字样式 |
110
+ | emptyText | `string` | - | 空数据文本 |
111
+ | style | `any` | - | 容器样式 |
112
+ | testID | `string` | - | 测试标识 |
113
+
114
+ ## 使用示例
115
+
116
+ ### 基础饼图
117
+
118
+ ```tsx
119
+ <PieChart
120
+ data={[
121
+ { value: 40, label: 'Category A', color: '#FF6B00' },
122
+ { value: 30, label: 'Category B', color: '#0066CC' },
123
+ { value: 20, label: 'Category C', color: '#00B894' },
124
+ { value: 10, label: 'Category D', color: '#6C5CE7' },
125
+ ]}
126
+ height={300}
127
+ />
128
+ ```
129
+
130
+ ### 环形图(Donut Chart)
131
+
132
+ ```tsx
133
+ <PieChart
134
+ data={sampleData}
135
+ innerRadius="50%"
136
+ centerText="Total"
137
+ />
138
+ ```
139
+
140
+ ### 自定义饼图大小
141
+
142
+ ```tsx
143
+ <PieChart data={sampleData} outerRadius={100} height={300} />
144
+ <PieChart data={sampleData} outerRadius="80%" height={350} />
145
+ ```
146
+
147
+ ### 图例配置
148
+
149
+ ```tsx
150
+ <PieChart
151
+ data={sampleData}
152
+ legendPosition="right"
153
+ showLegendValues
154
+ legendValueAlign="right"
155
+ legendItemGap={12}
156
+ legendLabelValueGap={20}
157
+ legendLabelMinWidth={200}
158
+ legendChartGap={48}
159
+ />
160
+ ```
161
+
162
+ ### NestedPieChart 嵌套饼图
163
+
164
+ ```tsx
165
+ <NestedPieChart
166
+ data={[
167
+ {
168
+ key: 'food',
169
+ label: 'Food',
170
+ children: [
171
+ { key: 'rice', label: 'Rice', value: 30 },
172
+ { key: 'noodle', label: 'Noodle', value: 20 },
173
+ ],
174
+ },
175
+ {
176
+ key: 'drink',
177
+ label: 'Drink',
178
+ children: [
179
+ { key: 'coffee', label: 'Coffee', value: 25 },
180
+ { key: 'tea', label: 'Tea', value: 15 },
181
+ ],
182
+ },
183
+ ]}
184
+ showLegend
185
+ legendMode="grouped"
186
+ legendCollapsible
187
+ />
188
+ ```
189
+
190
+ ### 自定义配色
191
+
192
+ ```tsx
193
+ <NestedPieChart
194
+ data={nestedData}
195
+ colorStrategy={{
196
+ baseColors: { cash: '#00B894', card: '#FF6B00' },
197
+ autoGenerate: true,
198
+ }}
199
+ height={450}
200
+ />
201
+ ```
202
+
203
+ ## 注意事项
204
+
205
+ - **PieChart 双平台渲染**:Web 端使用 recharts(功能完整),Native 端使用 react-native-svg-charts(功能受限)
206
+ - **NestedPieChart 仅支持 Web 平台**,Native 端会显示降级提示
207
+ - `innerRadius` 设置为大于 0 的值即变为环形图
208
+ - `outerRadius` 支持数字(像素)和字符串(百分比如 `'80%'`)
209
+ - `legendChartGap` 仅在图例位于 left / right 时生效
210
+ - `legendLabelMinWidth` 可确保不同长度标签的数值列对齐
211
+ - Native 端图例使用 ScrollView 实现长列表滚动
212
+ - 需安装对应平台依赖:Web 需要 `recharts`,Native 需要 `react-native-svg-charts` + `react-native-svg`
@@ -0,0 +1,82 @@
1
+ # Popover
2
+
3
+ 气泡弹出层组件,用于显示与触发元素相对定位的内容面板。支持四个方向(top/bottom/left/right)和三种箭头位置(start/center/end),适合工具提示、操作菜单等场景。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 四个弹出方向:top、bottom、left、right
8
+ - ✅ 三种箭头位置:start、center、end
9
+ - ✅ 自定义宽高尺寸
10
+ - ✅ 带阴影的浮层效果(elevation: 8)
11
+ - ✅ 箭头自动跟随方向和位置调整
12
+ - ✅ 通过 isVisible 控制显隐
13
+ - ✅ 支持自定义容器和内容区样式
14
+ - ✅ 主题色适配(withTheme HOC)
15
+
16
+ ## 安装使用
17
+
18
+ ```tsx
19
+ import { Popover } from '@beppla/tapas-ui';
20
+ ```
21
+
22
+ ## Props
23
+
24
+ | 属性 | 类型 | 默认值 | 说明 |
25
+ |------|------|--------|------|
26
+ | isVisible | `boolean` | - | 是否显示(必填) |
27
+ | children | `React.ReactNode` | - | 弹出层内容 |
28
+ | position | `'top' \| 'bottom' \| 'left' \| 'right'` | `'bottom'` | 弹出方向 |
29
+ | arrowPosition | `'start' \| 'center' \| 'end'` | `'center'` | 箭头在边上的位置 |
30
+ | width | `number` | `392` | 弹出层宽度 |
31
+ | height | `number` | `696` | 弹出层高度 |
32
+ | containerStyle | `StyleProp<ViewStyle>` | - | 外层容器样式 |
33
+ | contentStyle | `StyleProp<ViewStyle>` | - | 内容区域样式 |
34
+
35
+ ## 使用示例
36
+
37
+ ### 基础用法
38
+
39
+ ```tsx
40
+ const [isVisible, setIsVisible] = useState(false);
41
+
42
+ <Button onPress={() => setIsVisible(true)}>Show Popover</Button>
43
+ <Popover isVisible={isVisible} position="bottom">
44
+ <Text>Popover content here</Text>
45
+ </Popover>
46
+ ```
47
+
48
+ ### 左侧弹出 + 箭头末端
49
+
50
+ ```tsx
51
+ <Popover
52
+ isVisible={isVisible}
53
+ position="left"
54
+ arrowPosition="end"
55
+ width={392}
56
+ height={396}
57
+ >
58
+ <Text>Left popover with end arrow</Text>
59
+ </Popover>
60
+ ```
61
+
62
+ ### 自定义尺寸
63
+
64
+ ```tsx
65
+ <Popover
66
+ isVisible={isVisible}
67
+ position="top"
68
+ arrowPosition="start"
69
+ width={280}
70
+ height={200}
71
+ >
72
+ <Text>Compact popover</Text>
73
+ </Popover>
74
+ ```
75
+
76
+ ## 注意事项
77
+
78
+ - 组件使用 `position: absolute` 定位,需要父容器提供合适的定位上下文
79
+ - `isVisible` 为 `false` 时组件返回 `null`,不占据布局空间
80
+ - 箭头使用 TapasIcon 的 `left_arrow` 图标,通过旋转适配不同方向
81
+ - `arrowPosition` 的 `center` 值根据 `width` 或 `height` 自动计算居中位置
82
+ - 需在 `ThemeProvider` 内使用
@@ -0,0 +1,106 @@
1
+ # Progress
2
+
3
+ 进度条组件,用于显示文件上传或图片处理等任务的进度状态。支持 image 和 file 两种布局类型,可展示进行中(progress)、完成(done)和失败(failed)三种状态。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 两种展示类型:image(图片进度条)和 file(文件进度条)
8
+ - ✅ 三种状态:progress(进行中)、done(完成)、failed(失败)
9
+ - ✅ 状态自动匹配图标和颜色(success / error)
10
+ - ✅ 自定义起始和结束内容区域(支持 ReactNode)
11
+ - ✅ 进度百分比展示
12
+ - ✅ file 类型支持文件名展示
13
+ - ✅ 主题色适配
14
+ - ✅ React.memo 优化渲染性能
15
+
16
+ ## 安装使用
17
+
18
+ ```tsx
19
+ import { Progress } from '@beppla/tapas-ui';
20
+ ```
21
+
22
+ ## Props
23
+
24
+ | 属性 | 类型 | 默认值 | 说明 |
25
+ |------|------|--------|------|
26
+ | type | `'image' \| 'file'` | - | 展示类型(必填) |
27
+ | data | `ProgressData` | - | 进度数据(必填) |
28
+ | testID | `string` | - | 测试标识 |
29
+
30
+ ### ProgressData
31
+
32
+ ```tsx
33
+ interface ProgressData {
34
+ start: React.ReactNode | string; // 左侧内容(如缩略图、图标)
35
+ end?: React.ReactNode | string; // 右侧内容(状态文本)
36
+ status: 'progress' | 'done' | 'failed'; // 当前状态
37
+ progress?: number; // 进度值(0-100)
38
+ file?: string; // 文件名(file 类型使用)
39
+ }
40
+ ```
41
+
42
+ ## 使用示例
43
+
44
+ ### 图片上传进度
45
+
46
+ ```tsx
47
+ <Progress
48
+ type="image"
49
+ data={{
50
+ start: <Image source={{ uri: thumbnail }} style={{ width: 40, height: 40 }} />,
51
+ status: 'progress',
52
+ progress: 65,
53
+ }}
54
+ />
55
+ ```
56
+
57
+ ### 上传完成
58
+
59
+ ```tsx
60
+ <Progress
61
+ type="image"
62
+ data={{
63
+ start: <Image source={{ uri: thumbnail }} style={{ width: 40, height: 40 }} />,
64
+ status: 'done',
65
+ end: 'Uploaded',
66
+ }}
67
+ />
68
+ ```
69
+
70
+ ### 文件上传
71
+
72
+ ```tsx
73
+ <Progress
74
+ type="file"
75
+ data={{
76
+ start: <TapasIcon name="file" size={20} />,
77
+ file: 'document.pdf',
78
+ status: 'progress',
79
+ progress: 42,
80
+ }}
81
+ />
82
+ ```
83
+
84
+ ### 上传失败
85
+
86
+ ```tsx
87
+ <Progress
88
+ type="file"
89
+ data={{
90
+ start: <TapasIcon name="file" size={20} />,
91
+ file: 'report.xlsx',
92
+ status: 'failed',
93
+ end: 'Upload failed',
94
+ }}
95
+ />
96
+ ```
97
+
98
+ ## 注意事项
99
+
100
+ - `data` 为 null 或 undefined 时组件返回 null
101
+ - `image` 类型为左右布局,进度条位于中间
102
+ - `file` 类型为上下布局,文件名在上方,进度条在下方
103
+ - `end` 属性不存在时,默认显示 `progress%` 文本
104
+ - 进度条宽度通过 CSS `width: ${progress}%` 实现
105
+ - 使用 `withTheme` + `React.memo` 双重优化
106
+ - 需在 `ThemeProvider` 内使用
@@ -0,0 +1,85 @@
1
+ # RadioButton
2
+
3
+ 单选按钮组件,用于在一组选项中选择一个值。采用圆形指示器和文字标签的经典单选样式。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 支持多个选项的单选功能
8
+ - ✅ 受控模式,通过 selected 属性指定默认选中项
9
+ - ✅ 自动跟踪外部 selected 属性变化
10
+ - ✅ 圆形选中指示器,使用主题色渲染
11
+ - ✅ 垂直排列布局,每个选项固定高度 40px
12
+ - ✅ 使用 React.memo 优化渲染性能
13
+ - ✅ 支持 testID 属性用于测试
14
+
15
+ ## 安装使用
16
+
17
+ ```tsx
18
+ import RadioButton from '@beppla/tapas-ui/components/RadioButton/RadioButton';
19
+ ```
20
+
21
+ ## Props
22
+
23
+ | 属性 | 类型 | 默认值 | 说明 |
24
+ |------|------|--------|------|
25
+ | options | `Option[]` | - | 选项列表 |
26
+ | onPress | `(option: Option) => void` | - | 选中回调,返回被选中的选项 |
27
+ | selected | `string` | `""` | 默认选中项的 key 值 |
28
+ | testID | `string` | - | 测试标识 |
29
+
30
+ ### Option 数据类型
31
+
32
+ | 属性 | 类型 | 说明 |
33
+ |------|------|------|
34
+ | key | `string` | 选项唯一标识 |
35
+ | text | `string` | 选项显示文字 |
36
+
37
+ ## 使用示例
38
+
39
+ ### 基础用法
40
+
41
+ ```tsx
42
+ <RadioButton
43
+ options={[
44
+ { key: 'a', text: '选项 A' },
45
+ { key: 'b', text: '选项 B' },
46
+ { key: 'c', text: '选项 C' },
47
+ ]}
48
+ onPress={(option) => console.log('选中:', option.key)}
49
+ />
50
+ ```
51
+
52
+ ### 指定默认选中
53
+
54
+ ```tsx
55
+ <RadioButton
56
+ options={[
57
+ { key: 'male', text: '男' },
58
+ { key: 'female', text: '女' },
59
+ ]}
60
+ selected="male"
61
+ onPress={(option) => setGender(option.key)}
62
+ />
63
+ ```
64
+
65
+ ### 受控模式
66
+
67
+ ```tsx
68
+ const [selected, setSelected] = useState('option1');
69
+
70
+ <RadioButton
71
+ options={[
72
+ { key: 'option1', text: '立即配送' },
73
+ { key: 'option2', text: '预约配送' },
74
+ ]}
75
+ selected={selected}
76
+ onPress={(option) => setSelected(option.key)}
77
+ />
78
+ ```
79
+
80
+ ## 注意事项
81
+
82
+ - 组件通过 `withTheme` HOC 注入主题,圆形指示器颜色使用 `theme.colors.primary`
83
+ - 选项文字颜色也使用主题主色,与指示器保持一致
84
+ - 组件不支持禁用单个选项,如需此功能需自行扩展
85
+ - `selected` 属性变化时会自动同步内部状态
@@ -0,0 +1,72 @@
1
+ # ScanButton
2
+
3
+ 浮动扫描按钮组件,用于快速启动二维码扫描等功能。支持五个定位位置,可自定义文本、图标和颜色,以悬浮按钮形式固定在页面指定位置。
4
+
5
+ ## 功能特性
6
+
7
+ - ✅ 五种定位位置:bottom-right / bottom-left / top-right / top-left / center
8
+ - ✅ 自定义按钮文本
9
+ - ✅ 自定义图标(TapasIcon 图标名)
10
+ - ✅ 自定义图标大小
11
+ - ✅ 自定义背景色、文字色、图标色
12
+ - ✅ 悬浮定位(position: absolute)
13
+ - ✅ 圆角胶囊按钮样式 + 阴影效果
14
+ - ✅ 主题色适配
15
+
16
+ ## 安装使用
17
+
18
+ ```tsx
19
+ import { ScanButton } from '@beppla/tapas-ui';
20
+ ```
21
+
22
+ ## Props
23
+
24
+ | 属性 | 类型 | 默认值 | 说明 |
25
+ |------|------|--------|------|
26
+ | onPress | `() => void` | - | 按钮点击回调 |
27
+ | text | `string` | `'Scan QR Code'` | 按钮文本 |
28
+ | icon | `string` | `'qr_code_scan'` | 图标名称 |
29
+ | size | `number` | `20` | 图标大小 |
30
+ | position | `'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' \| 'center'` | `'bottom-right'` | 按钮定位位置 |
31
+ | backgroundColor | `string` | 主题 primary | 背景色 |
32
+ | textColor | `string` | 主题 white | 文字颜色 |
33
+ | iconColor | `string` | 主题 white | 图标颜色 |
34
+ | testID | `string` | - | 测试标识 |
35
+
36
+ ## 使用示例
37
+
38
+ ### 基础用法
39
+
40
+ ```tsx
41
+ <ScanButton onPress={() => navigation.navigate('Scanner')} />
42
+ ```
43
+
44
+ ### 左下角定位
45
+
46
+ ```tsx
47
+ <ScanButton
48
+ position="bottom-left"
49
+ onPress={() => handleScan()}
50
+ />
51
+ ```
52
+
53
+ ### 自定义样式
54
+
55
+ ```tsx
56
+ <ScanButton
57
+ text="Scan Barcode"
58
+ icon="barcode_scanner"
59
+ position="top-right"
60
+ backgroundColor="#895F38"
61
+ textColor="#FFF"
62
+ onPress={() => handleBarcodeScan()}
63
+ />
64
+ ```
65
+
66
+ ## 注意事项
67
+
68
+ - 组件使用 `position: absolute` 定位,需要父容器具备定位上下文
69
+ - 按钮固定高度 40px,圆角 20px(胶囊形状)
70
+ - 文本超长会自动截断(numberOfLines=1, ellipsizeMode=tail)
71
+ - `center` 位置通过负 margin 实现居中,可能需要根据内容宽度调整
72
+ - 需在 `ThemeProvider` 内使用