taro-uno-ui 0.9.0 → 1.0.1

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 (312) hide show
  1. package/README.md +21 -0
  2. package/dist/js/{index-DffLRSro.js → index-CDFsvu80.js} +15369 -10741
  3. package/dist/js/index-CDFsvu80.js.map +1 -0
  4. package/dist/js/index-DFdcksbe.js.map +1 -1
  5. package/dist/js/index-DXRIkWX1.js.map +1 -1
  6. package/dist/js/{index-6NJ3A1Dn.js → index-JffnTUrv.js} +15430 -10801
  7. package/dist/js/index-JffnTUrv.js.map +1 -0
  8. package/dist/utils/http/request.d.ts +280 -0
  9. package/package.json +14 -10
  10. package/src/components/basic/Button/Button.tsx +53 -13
  11. package/src/components/basic/Button/Button.types.ts +45 -9
  12. package/src/components/basic/Divider/Divider.tsx +60 -29
  13. package/src/components/basic/Icon/Icon.data.ts +474 -0
  14. package/src/components/basic/Icon/Icon.test.tsx +2 -2
  15. package/src/components/basic/Icon/Icon.tsx +48 -35
  16. package/src/components/basic/Icon/IconManager.ts +229 -0
  17. package/src/components/basic/Text/Text.styles.ts +3 -3
  18. package/src/components/basic/Text/Text.types.ts +14 -4
  19. package/src/components/basic/Typography/Typography.styles.ts +10 -9
  20. package/src/components/basic/Typography/Typography.tsx +15 -13
  21. package/src/components/basic/Typography/Typography.types.ts +41 -41
  22. package/src/components/basic/Typography/index.tsx +1 -1
  23. package/src/components/basic/Video/Video.styles.ts +777 -0
  24. package/src/components/basic/Video/Video.test.tsx +490 -0
  25. package/src/components/basic/Video/Video.tsx +1468 -0
  26. package/src/components/basic/Video/Video.types.ts +500 -0
  27. package/src/components/basic/Video/index.tsx +26 -0
  28. package/src/components/basic/index.tsx +13 -15
  29. package/src/components/common/ErrorBoundary.tsx +1 -1
  30. package/src/components/common/LazyComponent.tsx +9 -8
  31. package/src/components/common/SecurityProvider.tsx +2 -14
  32. package/src/components/common/ThemeProvider.tsx +43 -56
  33. package/src/components/common/VirtualList.tsx +187 -205
  34. package/src/components/common/index.tsx +25 -0
  35. package/src/components/display/Avatar/Avatar.styles.ts +1 -1
  36. package/src/components/display/Avatar/Avatar.tsx +6 -19
  37. package/src/components/display/Avatar/Avatar.types.ts +1 -1
  38. package/src/components/display/Avatar/index.ts +1 -1
  39. package/src/components/display/Badge/Badge.tsx +3 -16
  40. package/src/components/display/Badge/Badge.types.ts +1 -1
  41. package/src/components/display/Badge/index.ts +1 -1
  42. package/src/components/display/Calendar/Calendar.styles.ts +36 -36
  43. package/src/components/display/Calendar/Calendar.test.tsx +27 -15
  44. package/src/components/display/Calendar/Calendar.tsx +56 -35
  45. package/src/components/display/Calendar/Calendar.types.ts +1 -1
  46. package/src/components/display/Calendar/index.ts +1 -1
  47. package/src/components/display/Card/Card.styles.ts +2 -2
  48. package/src/components/display/Card/Card.test.tsx +6 -4
  49. package/src/components/display/Card/Card.tsx +1 -1
  50. package/src/components/display/Card/Card.types.ts +4 -4
  51. package/src/components/display/Card/index.ts +1 -1
  52. package/src/components/display/Carousel/Carousel.styles.ts +31 -31
  53. package/src/components/display/Carousel/Carousel.tsx +34 -39
  54. package/src/components/display/Carousel/Carousel.types.ts +1 -1
  55. package/src/components/display/Carousel/index.ts +1 -1
  56. package/src/components/display/List/List.styles.ts +3 -3
  57. package/src/components/display/List/List.tsx +0 -1
  58. package/src/components/display/List/index.ts +1 -1
  59. package/src/components/display/Rate/Rate.styles.ts +5 -17
  60. package/src/components/display/Rate/Rate.tsx +6 -14
  61. package/src/components/display/Rate/Rate.types.ts +4 -3
  62. package/src/components/display/Rate/index.ts +3 -11
  63. package/src/components/display/Table/Table.test.tsx +2 -0
  64. package/src/components/display/Table/Table.tsx +3 -7
  65. package/src/components/display/Table/Table.types.ts +3 -2
  66. package/src/components/display/Tag/Tag.styles.ts +31 -31
  67. package/src/components/display/Tag/Tag.tsx +9 -26
  68. package/src/components/display/Tag/Tag.types.ts +1 -1
  69. package/src/components/display/Tag/index.ts +1 -1
  70. package/src/components/display/Timeline/Timeline.styles.ts +32 -32
  71. package/src/components/display/Timeline/Timeline.tsx +23 -42
  72. package/src/components/display/Timeline/Timeline.types.ts +1 -1
  73. package/src/components/display/Timeline/index.ts +1 -1
  74. package/src/components/display/index.tsx +33 -29
  75. package/src/components/feedback/Loading/Loading.tsx +6 -1
  76. package/src/components/feedback/Loading/index.ts +2 -5
  77. package/src/components/feedback/Message/Message.styles.ts +3 -3
  78. package/src/components/feedback/Message/index.ts +2 -5
  79. package/src/components/feedback/Modal/Modal.styles.ts +1 -1
  80. package/src/components/feedback/Modal/Modal.tsx +9 -31
  81. package/src/components/feedback/Modal/Modal.types.ts +12 -2
  82. package/src/components/feedback/Notification/Notification.styles.ts +49 -39
  83. package/src/components/feedback/Notification/Notification.test.tsx +1 -1
  84. package/src/components/feedback/Notification/Notification.tsx +97 -120
  85. package/src/components/feedback/Notification/Notification.types.ts +11 -8
  86. package/src/components/feedback/Notification/NotificationManager.tsx +135 -106
  87. package/src/components/feedback/Notification/index.ts +10 -3
  88. package/src/components/feedback/Notification/index.tsx +16 -26
  89. package/src/components/feedback/Progress/Progress.styles.ts +23 -14
  90. package/src/components/feedback/Progress/Progress.tsx +93 -113
  91. package/src/components/feedback/Progress/Progress.types.ts +1 -1
  92. package/src/components/feedback/Progress/index.ts +1 -1
  93. package/src/components/feedback/Progress/utils/animation.ts +12 -23
  94. package/src/components/feedback/Progress/utils/index.ts +2 -2
  95. package/src/components/feedback/Progress/utils/progress-calculator.ts +14 -32
  96. package/src/components/feedback/Result/Result.styles.ts +29 -29
  97. package/src/components/feedback/Result/Result.tsx +8 -20
  98. package/src/components/feedback/Result/Result.types.ts +7 -7
  99. package/src/components/feedback/Result/index.tsx +1 -1
  100. package/src/components/feedback/Toast/Toast.styles.ts +1 -1
  101. package/src/components/feedback/Toast/Toast.tsx +25 -13
  102. package/src/components/feedback/Tooltip/Tooltip.examples.tsx +21 -44
  103. package/src/components/feedback/Tooltip/Tooltip.styles.ts +16 -22
  104. package/src/components/feedback/Tooltip/Tooltip.test.tsx +1 -1
  105. package/src/components/feedback/Tooltip/Tooltip.tsx +65 -46
  106. package/src/components/feedback/Tooltip/Tooltip.types.ts +14 -20
  107. package/src/components/feedback/Tooltip/index.ts +1 -1
  108. package/src/components/feedback/Tooltip/index.tsx +12 -24
  109. package/src/components/feedback/index.tsx +54 -42
  110. package/src/components/form/Cascader/Cascader.styles.ts +2 -2
  111. package/src/components/form/Cascader/Cascader.tsx +84 -88
  112. package/src/components/form/Cascader/Cascader.types.ts +49 -50
  113. package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +11 -8
  114. package/src/components/form/Cascader/hooks/useCascaderOptions.ts +73 -55
  115. package/src/components/form/Cascader/hooks/useCascaderState.ts +31 -25
  116. package/src/components/form/Cascader/index.ts +1 -1
  117. package/src/components/form/Cascader/utils/formatDisplayValue.ts +4 -4
  118. package/src/components/form/Checkbox/Checkbox.styles.ts +83 -84
  119. package/src/components/form/Checkbox/Checkbox.tsx +2 -9
  120. package/src/components/form/Checkbox/CheckboxGroup.tsx +7 -7
  121. package/src/components/form/DatePicker/DatePicker.test.tsx +1 -1
  122. package/src/components/form/DatePicker/DatePicker.tsx +91 -75
  123. package/src/components/form/DatePicker/DatePicker.types.ts +4 -1
  124. package/src/components/form/Form/Form.tsx +66 -504
  125. package/src/components/form/Form/Form.types.ts +16 -1
  126. package/src/components/form/Form/useFormLogic.ts +497 -0
  127. package/src/components/form/Input/Input.styles.ts +8 -1
  128. package/src/components/form/Input/Input.tsx +55 -291
  129. package/src/components/form/Input/Input.types.ts +13 -1
  130. package/src/components/form/Input/useInputLogic.test.ts +82 -0
  131. package/src/components/form/Input/useInputLogic.ts +260 -0
  132. package/src/components/form/InputNumber/InputNumber.styles.ts +76 -25
  133. package/src/components/form/InputNumber/InputNumber.tsx +53 -21
  134. package/src/components/form/InputNumber/InputNumber.types.ts +21 -3
  135. package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +3 -11
  136. package/src/components/form/InputNumber/components/InputNumberControls.tsx +3 -12
  137. package/src/components/form/InputNumber/hooks/index.ts +1 -1
  138. package/src/components/form/InputNumber/hooks/useInputNumberState.ts +7 -9
  139. package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +18 -17
  140. package/src/components/form/InputNumber/index.ts +7 -7
  141. package/src/components/form/Radio/Radio.styles.ts +1 -8
  142. package/src/components/form/Radio/Radio.tsx +3 -9
  143. package/src/components/form/Radio/Radio.types.ts +5 -1
  144. package/src/components/form/Select/Select.styles.ts +5 -1
  145. package/src/components/form/Select/Select.tsx +15 -15
  146. package/src/components/form/Select/Select.types.ts +2 -1
  147. package/src/components/form/Slider/Slider.styles.ts +13 -13
  148. package/src/components/form/Slider/Slider.tsx +19 -33
  149. package/src/components/form/Slider/Slider.types.ts +14 -12
  150. package/src/components/form/Slider/index.tsx +2 -9
  151. package/src/components/form/Switch/Switch.styles.ts +1 -7
  152. package/src/components/form/Switch/Switch.tsx +7 -13
  153. package/src/components/form/Textarea/Textarea.styles.ts +4 -4
  154. package/src/components/form/Textarea/Textarea.tsx +7 -1
  155. package/src/components/form/Textarea/Textarea.types.ts +4 -1
  156. package/src/components/form/TimePicker/TimePicker.styles.ts +8 -12
  157. package/src/components/form/TimePicker/TimePicker.tsx +122 -100
  158. package/src/components/form/TimePicker/TimePicker.types.ts +2 -2
  159. package/src/components/form/TimePicker/index.ts +1 -1
  160. package/src/components/form/Transfer/Transfer.styles.ts +3 -15
  161. package/src/components/form/Transfer/Transfer.tsx +146 -134
  162. package/src/components/form/Transfer/Transfer.types.ts +34 -26
  163. package/src/components/form/Transfer/components/TransferItem.tsx +55 -62
  164. package/src/components/form/Transfer/components/TransferList.tsx +212 -199
  165. package/src/components/form/Transfer/components/TransferOperations.tsx +52 -55
  166. package/src/components/form/Transfer/components/TransferPagination.tsx +115 -111
  167. package/src/components/form/Transfer/components/TransferSearch.tsx +52 -55
  168. package/src/components/form/Transfer/hooks/useTransferData.ts +91 -81
  169. package/src/components/form/Transfer/hooks/useTransferState.ts +22 -16
  170. package/src/components/form/Transfer/index.ts +2 -8
  171. package/src/components/form/Upload/Upload.styles.ts +21 -21
  172. package/src/components/form/Upload/Upload.tsx +189 -142
  173. package/src/components/form/Upload/Upload.types.ts +31 -31
  174. package/src/components/form/Upload/index.tsx +1 -1
  175. package/src/components/form/index.tsx +60 -29
  176. package/src/components/index.tsx +0 -1
  177. package/src/components/layout/Affix/Affix.styles.ts +16 -11
  178. package/src/components/layout/Affix/Affix.tsx +67 -75
  179. package/src/components/layout/Affix/Affix.types.ts +18 -18
  180. package/src/components/layout/Affix/index.tsx +1 -1
  181. package/src/components/layout/Col/Col.styles.ts +17 -17
  182. package/src/components/layout/Col/Col.test.tsx +7 -5
  183. package/src/components/layout/Col/Col.tsx +3 -21
  184. package/src/components/layout/Col/Col.types.ts +1 -1
  185. package/src/components/layout/Container/Container.styles.ts +3 -1
  186. package/src/components/layout/Container/Container.tsx +2 -11
  187. package/src/components/layout/Grid/Grid.tsx +3 -53
  188. package/src/components/layout/Layout/Content.tsx +24 -32
  189. package/src/components/layout/Layout/Footer.tsx +24 -32
  190. package/src/components/layout/Layout/Header.tsx +24 -32
  191. package/src/components/layout/Layout/Layout.styles.ts +17 -17
  192. package/src/components/layout/Layout/Layout.tsx +14 -25
  193. package/src/components/layout/Layout/Layout.types.ts +29 -29
  194. package/src/components/layout/Layout/Sider.tsx +44 -56
  195. package/src/components/layout/Layout/index.tsx +16 -2
  196. package/src/components/layout/Row/Row.tsx +15 -43
  197. package/src/components/layout/Space/Space.tsx +3 -11
  198. package/src/components/layout/Space/Space.types.ts +1 -1
  199. package/src/components/layout/index.tsx +29 -19
  200. package/src/components/navigation/Menu/Menu.constants.ts +69 -0
  201. package/src/components/navigation/Menu/Menu.stories.tsx +107 -0
  202. package/src/components/navigation/Menu/Menu.styles.ts +25 -37
  203. package/src/components/navigation/Menu/Menu.tsx +8 -11
  204. package/src/components/navigation/Menu/Menu.types.ts +2 -2
  205. package/src/components/navigation/Menu/Menu.utils.ts +17 -17
  206. package/src/components/navigation/Menu/MenuItem.tsx +9 -11
  207. package/src/components/navigation/Menu/SubMenu.tsx +8 -6
  208. package/src/components/navigation/Menu/index.tsx +4 -69
  209. package/src/components/navigation/NavBar/NavBar.styles.ts +1 -1
  210. package/src/components/navigation/NavBar/NavBar.tsx +7 -10
  211. package/src/components/navigation/NavBar/NavBar.types.ts +3 -3
  212. package/src/components/navigation/NavBar/index.tsx +1 -1
  213. package/src/components/navigation/Pagination/Pagination.test.tsx +2 -3
  214. package/src/components/navigation/Pagination/Pagination.tsx +3 -3
  215. package/src/components/navigation/Pagination/Pagination.types.ts +3 -2
  216. package/src/components/navigation/Pagination/index.ts +9 -3
  217. package/src/components/navigation/Steps/Step.tsx +24 -44
  218. package/src/components/navigation/Steps/Steps.styles.ts +28 -13
  219. package/src/components/navigation/Steps/Steps.test.tsx +2 -0
  220. package/src/components/navigation/Steps/Steps.tsx +88 -89
  221. package/src/components/navigation/Steps/Steps.types.ts +30 -30
  222. package/src/components/navigation/Steps/index.tsx +1 -1
  223. package/src/components/navigation/Tabs/Tabs.test.tsx +3 -2
  224. package/src/components/navigation/Tabs/Tabs.types.ts +4 -3
  225. package/src/components/navigation/index.tsx +21 -16
  226. package/src/constants/index.ts +1 -1
  227. package/src/hooks/index.ts +52 -102
  228. package/src/hooks/types.ts +4 -5
  229. package/src/hooks/useAsync.ts +46 -47
  230. package/src/hooks/useClickOutside.ts +52 -0
  231. package/src/hooks/useCounter.ts +87 -0
  232. package/src/hooks/useDebounce.ts +150 -0
  233. package/src/hooks/useDeepCompareEffect.ts +88 -0
  234. package/src/hooks/useEventListener.ts +77 -0
  235. package/src/hooks/useMediaQuery.ts +75 -0
  236. package/src/hooks/useMutation.ts +233 -0
  237. package/src/hooks/usePerformance.ts +1 -64
  238. package/src/hooks/usePlatform.ts +3 -1
  239. package/src/hooks/usePrevious.ts +25 -0
  240. package/src/hooks/useRequest.ts +12 -7
  241. package/src/hooks/useStateManagement.ts +1 -1
  242. package/src/hooks/useStorage.ts +169 -0
  243. package/src/hooks/useStyle.ts +8 -2
  244. package/src/hooks/useToggle.ts +54 -0
  245. package/src/index.ts +34 -9
  246. package/src/theme/ThemeProvider.tsx +3 -7
  247. package/src/theme/ThemeProvider.types.ts +1 -1
  248. package/src/theme/defaults.ts +1 -1
  249. package/src/theme/design-system.ts +2 -2
  250. package/src/theme/design-tokens.ts +85 -99
  251. package/src/theme/generated/dark-theme.scss +1 -1
  252. package/src/theme/generated/tokens.scss +82 -18
  253. package/src/theme/index.ts +8 -29
  254. package/src/theme/responsive.tsx +36 -34
  255. package/src/theme/styles.ts +1 -1
  256. package/src/theme/useThemeUtils.ts +43 -43
  257. package/src/theme/utils.ts +32 -32
  258. package/src/theme/variables.ts +70 -51
  259. package/src/types/accessibility.ts +36 -37
  260. package/src/types/button.ts +25 -27
  261. package/src/types/component-props.ts +6 -1
  262. package/src/types/glob.d.ts +4 -0
  263. package/src/types/index.ts +2 -2
  264. package/src/types/standardized-components.ts +9 -3
  265. package/src/types/utils.ts +13 -23
  266. package/src/utils/__tests__/responsiveUtils.test.ts +5 -4
  267. package/src/utils/abort-controller.ts +48 -0
  268. package/src/utils/cache.ts +2 -6
  269. package/src/utils/createNamespace.ts +4 -4
  270. package/src/utils/environment.ts +26 -6
  271. package/src/utils/error-handler.ts +2 -2
  272. package/src/utils/errorLogger.ts +16 -20
  273. package/src/utils/formatUtils.ts +38 -70
  274. package/src/utils/http/error-codes.ts +314 -0
  275. package/src/utils/http/http-client.test.ts +63 -0
  276. package/src/utils/{network → http}/http-client.ts +45 -35
  277. package/src/utils/http/request-cache.ts +127 -0
  278. package/src/utils/http/request.ts +954 -0
  279. package/src/utils/http/taro-adapter.test.ts +74 -0
  280. package/src/utils/http/taro-adapter.ts +24 -0
  281. package/src/utils/http/types.ts +414 -0
  282. package/src/utils/http/web-adapter.ts +33 -0
  283. package/src/utils/index.ts +5 -8
  284. package/src/utils/inputValidator.ts +17 -14
  285. package/src/utils/performance/performance.ts +60 -71
  286. package/src/utils/responsiveUtils.ts +7 -16
  287. package/src/utils/rtl-support.ts +29 -19
  288. package/src/utils/security/api-security.ts +47 -39
  289. package/src/utils/securityHeaders.ts +61 -67
  290. package/src/utils/typeHelpers.ts +10 -10
  291. package/src/utils/types/dataProcessing.ts +93 -92
  292. package/src/utils/types/typeHelpers.ts +31 -21
  293. package/src/utils/xssProtection.ts +96 -48
  294. package/dist/js/index-6NJ3A1Dn.js.map +0 -1
  295. package/dist/js/index-DffLRSro.js.map +0 -1
  296. package/src/components/form/Input/Input.enhanced.tsx +0 -732
  297. package/src/components/navigation/Menu/__tests__/Menu.test.tsx +0 -687
  298. package/src/components/navigation/Tree/Tree.styles.ts +0 -553
  299. package/src/components/navigation/Tree/Tree.test.basic.tsx +0 -7
  300. package/src/components/navigation/Tree/Tree.test.functional.tsx +0 -496
  301. package/src/components/navigation/Tree/Tree.test.import.check.tsx +0 -6
  302. package/src/components/navigation/Tree/Tree.test.import.tsx +0 -6
  303. package/src/components/navigation/Tree/Tree.test.minimal.tsx +0 -5
  304. package/src/components/navigation/Tree/Tree.test.simple.tsx +0 -30
  305. package/src/components/navigation/Tree/Tree.test.tsx +0 -908
  306. package/src/components/navigation/Tree/Tree.test.working.tsx +0 -673
  307. package/src/components/navigation/Tree/Tree.tsx +0 -600
  308. package/src/components/navigation/Tree/Tree.types.ts +0 -909
  309. package/src/components/navigation/Tree/Tree.utils.ts +0 -452
  310. package/src/components/navigation/Tree/index.ts +0 -33
  311. package/src/components/navigation/Tree/index.tsx +0 -23
  312. package/src/utils/network/http-client.test.ts +0 -18
@@ -7,18 +7,18 @@ export const carouselStyles: Record<string, CSSProperties> = {
7
7
  width: '100%',
8
8
  height: '200px',
9
9
  },
10
-
10
+
11
11
  vertical: {
12
12
  height: '300px',
13
13
  },
14
-
14
+
15
15
  // 容器
16
16
  container: {
17
17
  position: 'relative',
18
18
  width: '100%',
19
19
  height: '100%',
20
20
  },
21
-
21
+
22
22
  // 轮播项包装器
23
23
  wrapper: {
24
24
  position: 'relative',
@@ -27,15 +27,15 @@ export const carouselStyles: Record<string, CSSProperties> = {
27
27
  display: 'flex',
28
28
  transition: 'transform 0.3s ease-in-out',
29
29
  },
30
-
30
+
31
31
  wrapperVertical: {
32
32
  flexDirection: 'column',
33
33
  },
34
-
34
+
35
35
  wrapperNoTransition: {
36
36
  transition: 'none',
37
37
  },
38
-
38
+
39
39
  // 轮播项
40
40
  slide: {
41
41
  position: 'relative',
@@ -44,16 +44,16 @@ export const carouselStyles: Record<string, CSSProperties> = {
44
44
  height: '100%',
45
45
  overflow: 'hidden',
46
46
  },
47
-
47
+
48
48
  slideMultiple: {
49
49
  width: 'calc(100% / var(--slides-to-show))',
50
50
  },
51
-
51
+
52
52
  slideVertical: {
53
53
  width: '100%',
54
54
  height: 'calc(100% / var(--slides-to-show))',
55
55
  },
56
-
56
+
57
57
  // 淡入淡出效果
58
58
  slideFade: {
59
59
  position: 'absolute',
@@ -64,11 +64,11 @@ export const carouselStyles: Record<string, CSSProperties> = {
64
64
  opacity: 0,
65
65
  transition: 'opacity 0.3s ease-in-out',
66
66
  },
67
-
67
+
68
68
  slideFadeActive: {
69
69
  opacity: 1,
70
70
  },
71
-
71
+
72
72
  // 指示器
73
73
  dots: {
74
74
  position: 'absolute',
@@ -77,33 +77,33 @@ export const carouselStyles: Record<string, CSSProperties> = {
77
77
  padding: '8px',
78
78
  zIndex: 1,
79
79
  },
80
-
80
+
81
81
  dotsBottom: {
82
82
  bottom: '12px',
83
83
  left: '50%',
84
84
  transform: 'translateX(-50%)',
85
85
  },
86
-
86
+
87
87
  dotsTop: {
88
88
  top: '12px',
89
89
  left: '50%',
90
90
  transform: 'translateX(-50%)',
91
91
  },
92
-
92
+
93
93
  dotsLeft: {
94
94
  left: '12px',
95
95
  top: '50%',
96
96
  transform: 'translateY(-50%)',
97
97
  flexDirection: 'column',
98
98
  },
99
-
99
+
100
100
  dotsRight: {
101
101
  right: '12px',
102
102
  top: '50%',
103
103
  transform: 'translateY(-50%)',
104
104
  flexDirection: 'column',
105
105
  },
106
-
106
+
107
107
  dot: {
108
108
  width: '8px',
109
109
  height: '8px',
@@ -113,16 +113,16 @@ export const carouselStyles: Record<string, CSSProperties> = {
113
113
  transition: 'all 0.3s ease',
114
114
  border: '1px solid rgba(255, 255, 255, 0.3)',
115
115
  },
116
-
116
+
117
117
  dotActive: {
118
118
  backgroundColor: '#ffffff',
119
119
  transform: 'scale(1.2)',
120
120
  },
121
-
121
+
122
122
  dotHover: {
123
123
  backgroundColor: 'rgba(255, 255, 255, 0.8)',
124
124
  },
125
-
125
+
126
126
  // 箭头
127
127
  arrows: {
128
128
  position: 'absolute',
@@ -130,15 +130,15 @@ export const carouselStyles: Record<string, CSSProperties> = {
130
130
  transform: 'translateY(-50%)',
131
131
  zIndex: 1,
132
132
  },
133
-
133
+
134
134
  arrowPrev: {
135
135
  left: '12px',
136
136
  },
137
-
137
+
138
138
  arrowNext: {
139
139
  right: '12px',
140
140
  },
141
-
141
+
142
142
  arrowButton: {
143
143
  display: 'flex',
144
144
  alignItems: 'center',
@@ -154,35 +154,35 @@ export const carouselStyles: Record<string, CSSProperties> = {
154
154
  transition: 'all 0.3s ease',
155
155
  userSelect: 'none',
156
156
  },
157
-
157
+
158
158
  arrowButtonHover: {
159
159
  backgroundColor: 'rgba(0, 0, 0, 0.7)',
160
160
  transform: 'translateY(-50%) scale(1.1)',
161
161
  },
162
-
162
+
163
163
  arrowButtonDisabled: {
164
164
  opacity: 0.3,
165
165
  cursor: 'not-allowed',
166
166
  },
167
-
167
+
168
168
  // 垂直模式箭头
169
169
  arrowVertical: {
170
170
  left: '50%',
171
171
  transform: 'translateX(-50%)',
172
172
  },
173
-
173
+
174
174
  arrowVerticalPrev: {
175
175
  top: '12px',
176
176
  },
177
-
177
+
178
178
  arrowVerticalNext: {
179
179
  bottom: '12px',
180
180
  },
181
-
181
+
182
182
  arrowVerticalButtonHover: {
183
183
  transform: 'translateX(-50%) scale(1.1)',
184
184
  },
185
-
185
+
186
186
  // 加载状态
187
187
  loading: {
188
188
  display: 'flex',
@@ -193,7 +193,7 @@ export const carouselStyles: Record<string, CSSProperties> = {
193
193
  backgroundColor: '#f5f5f5',
194
194
  color: '#8c8c8c',
195
195
  },
196
-
196
+
197
197
  loadingIcon: {
198
198
  width: '20px',
199
199
  height: '20px',
@@ -203,4 +203,4 @@ export const carouselStyles: Record<string, CSSProperties> = {
203
203
  animation: 'spin 1s linear infinite',
204
204
  marginRight: '8px',
205
205
  },
206
- };
206
+ };
@@ -72,47 +72,50 @@ export const CarouselComponent = forwardRef<CarouselRef, CarouselProps>((props,
72
72
  return () => stopAutoplay();
73
73
  }, [startAutoplay, stopAutoplay]);
74
74
 
75
- const goToSlide = useCallback((index: number) => {
76
- if (isTransitioning || totalSlides <= 1) return;
77
-
78
- const validIndex = Math.max(0, Math.min(index, totalSlides - 1));
79
-
80
- if (validIndex === currentIndex) return;
81
-
82
- beforeChange?.(currentIndex, validIndex);
83
-
84
- setIsTransitioning(true);
85
- setCurrentIndex(validIndex);
86
-
87
- setTimeout(() => {
88
- setIsTransitioning(false);
89
- afterChange?.(validIndex);
90
- }, 300);
91
- }, [currentIndex, totalSlides, isTransitioning, beforeChange, afterChange]);
75
+ const goToSlide = useCallback(
76
+ (index: number) => {
77
+ if (isTransitioning || totalSlides <= 1) return;
78
+
79
+ const validIndex = Math.max(0, Math.min(index, totalSlides - 1));
80
+
81
+ if (validIndex === currentIndex) return;
82
+
83
+ beforeChange?.(currentIndex, validIndex);
84
+
85
+ setIsTransitioning(true);
86
+ setCurrentIndex(validIndex);
87
+
88
+ setTimeout(() => {
89
+ setIsTransitioning(false);
90
+ afterChange?.(validIndex);
91
+ }, 300);
92
+ },
93
+ [currentIndex, totalSlides, isTransitioning, beforeChange, afterChange],
94
+ );
92
95
 
93
96
  const goPrev = useCallback(() => {
94
97
  if (totalSlides <= 1) return;
95
-
98
+
96
99
  let newIndex;
97
100
  if (infinite) {
98
101
  newIndex = currentIndex <= 0 ? totalSlides - 1 : currentIndex - slidesToScroll;
99
102
  } else {
100
103
  newIndex = Math.max(0, currentIndex - slidesToScroll);
101
104
  }
102
-
105
+
103
106
  goToSlide(newIndex);
104
107
  }, [currentIndex, totalSlides, infinite, slidesToScroll, goToSlide]);
105
108
 
106
109
  const goNext = useCallback(() => {
107
110
  if (totalSlides <= 1) return;
108
-
111
+
109
112
  let newIndex;
110
113
  if (infinite) {
111
114
  newIndex = currentIndex >= totalSlides - 1 ? 0 : currentIndex + slidesToScroll;
112
115
  } else {
113
116
  newIndex = Math.min(totalSlides - 1, currentIndex + slidesToScroll);
114
117
  }
115
-
118
+
116
119
  goToSlide(newIndex);
117
120
  }, [currentIndex, totalSlides, infinite, slidesToScroll, goToSlide]);
118
121
 
@@ -120,11 +123,9 @@ export const CarouselComponent = forwardRef<CarouselRef, CarouselProps>((props,
120
123
 
121
124
  const getTransform = () => {
122
125
  if (effect === 'fade') return 'none';
123
-
126
+
124
127
  const translateValue = -(currentIndex * (100 / slidesToShow));
125
- return vertical
126
- ? `translateY(${translateValue}%)`
127
- : `translateX(${translateValue}%)`;
128
+ return vertical ? `translateY(${translateValue}%)` : `translateX(${translateValue}%)`;
128
129
  };
129
130
 
130
131
  const getWrapperStyle = () => {
@@ -173,7 +174,9 @@ export const CarouselComponent = forwardRef<CarouselRef, CarouselProps>((props,
173
174
 
174
175
  const dotsStyle = {
175
176
  ...carouselStyles['dots'],
176
- ...carouselStyles[`dots${dotsPosition.charAt(0).toUpperCase() + dotsPosition.slice(1)}` as keyof typeof carouselStyles],
177
+ ...carouselStyles[
178
+ `dots${dotsPosition.charAt(0).toUpperCase() + dotsPosition.slice(1)}` as keyof typeof carouselStyles
179
+ ],
177
180
  };
178
181
 
179
182
  return (
@@ -217,7 +220,7 @@ export const CarouselComponent = forwardRef<CarouselRef, CarouselProps>((props,
217
220
  <Text>{vertical ? '↑' : '‹'}</Text>
218
221
  </View>
219
222
  </View>
220
-
223
+
221
224
  <View
222
225
  style={{
223
226
  ...carouselStyles['arrows'],
@@ -264,24 +267,16 @@ export const CarouselComponent = forwardRef<CarouselRef, CarouselProps>((props,
264
267
  }
265
268
 
266
269
  return (
267
- <View
268
- ref={elementRef}
269
- style={getCarouselStyle()}
270
- className={className}
271
- {...rest}
272
- >
270
+ <View ref={elementRef} style={getCarouselStyle()} className={className} {...rest}>
273
271
  <View style={carouselStyles['container']}>
274
272
  <View style={getWrapperStyle()}>
275
273
  {childrenArray.map((child, index) => (
276
- <View
277
- key={index}
278
- style={getSlideStyle(index)}
279
- >
274
+ <View key={index} style={getSlideStyle(index)}>
280
275
  {child}
281
276
  </View>
282
277
  ))}
283
278
  </View>
284
-
279
+
285
280
  {renderDots()}
286
281
  {renderArrows()}
287
282
  </View>
@@ -292,4 +287,4 @@ export const CarouselComponent = forwardRef<CarouselRef, CarouselProps>((props,
292
287
  CarouselComponent.displayName = 'Carousel';
293
288
 
294
289
  export const Carousel = CarouselComponent;
295
- export default Carousel;
290
+ export default Carousel;
@@ -54,4 +54,4 @@ export interface CarouselRef {
54
54
  pause: () => void;
55
55
  /** 获取总数 */
56
56
  getTotal: () => number;
57
- }
57
+ }
@@ -1,3 +1,3 @@
1
1
  export { Carousel } from './Carousel';
2
2
  export { carouselStyles } from './Carousel.styles';
3
- export type { CarouselProps, CarouselRef } from './Carousel.types';
3
+ export type { CarouselProps, CarouselRef } from './Carousel.types';
@@ -10,7 +10,7 @@ export const ListStyles = createStyles({
10
10
  size: {
11
11
  small: 'text-sm',
12
12
  default: 'text-base',
13
- large: 'text-lg'
13
+ large: 'text-lg',
14
14
  },
15
15
 
16
16
  bordered: `
@@ -59,7 +59,7 @@ export const ListStyles = createStyles({
59
59
  itemSize: {
60
60
  small: 'py-2',
61
61
  default: 'py-3',
62
- large: 'py-4'
62
+ large: 'py-4',
63
63
  },
64
64
 
65
65
  itemSplit: `
@@ -75,5 +75,5 @@ export const ListStyles = createStyles({
75
75
  cursor-pointer
76
76
  hover:bg-gray-50 dark:hover:bg-gray-700
77
77
  active:bg-gray-100 dark:active:bg-gray-600
78
- `
78
+ `,
79
79
  });
@@ -20,7 +20,6 @@ export const List = forwardRef<ListRef, ListProps>((props, ref) => {
20
20
  ...rest
21
21
  } = props;
22
22
 
23
-
24
23
  const renderItems = () => {
25
24
  if (dataSource && renderItem) {
26
25
  return dataSource.map((item, index) => (
@@ -1,3 +1,3 @@
1
1
  export { List, ListItem } from './List';
2
2
  export { ListStyles as listStyles } from './List.styles';
3
- export type { ListProps, ListRef, ListItemProps } from './List.types';
3
+ export type { ListProps, ListRef, ListItemProps } from './List.types';
@@ -95,10 +95,7 @@ export const rateStyles = {
95
95
  /**
96
96
  * 获取半星遮罩样式
97
97
  */
98
- getHalfStarMaskStyle: (props: {
99
- color?: string;
100
- unselectedColor?: string;
101
- }): React.CSSProperties => {
98
+ getHalfStarMaskStyle: (props: { color?: string; unselectedColor?: string }): React.CSSProperties => {
102
99
  const { color = rateStyles['COLORS'].default } = props;
103
100
 
104
101
  return {
@@ -138,12 +135,7 @@ export const rateStyles = {
138
135
  /**
139
136
  * 获取容器类名
140
137
  */
141
- getClassName: (props: {
142
- size?: RateSize;
143
- disabled?: boolean;
144
- readonly?: boolean;
145
- className?: string;
146
- }): string => {
138
+ getClassName: (props: { size?: RateSize; disabled?: boolean; readonly?: boolean; className?: string }): string => {
147
139
  const { size = 'default', disabled = false, readonly = false, className = '' } = props;
148
140
 
149
141
  const baseClass = 'taro-uno-rate';
@@ -157,11 +149,7 @@ export const rateStyles = {
157
149
  /**
158
150
  * 获取星星类名
159
151
  */
160
- getStarClassName: (props: {
161
- state: StarState;
162
- isActive?: boolean;
163
- isHovering?: boolean;
164
- }): string => {
152
+ getStarClassName: (props: { state: StarState; isActive?: boolean; isHovering?: boolean }): string => {
165
153
  const { state, isActive = false, isHovering = false } = props;
166
154
 
167
155
  const baseClass = 'taro-uno-rate__star';
@@ -253,7 +241,7 @@ export const rateStyles = {
253
241
  size: RateSize;
254
242
  }): React.CSSProperties => {
255
243
  const { breakpoint = 'md', size } = props;
256
-
244
+
257
245
  // 在小屏幕上调整尺寸
258
246
  const responsiveSize = breakpoint === 'xs' || breakpoint === 'sm' ? 'small' : size;
259
247
  const sizeConfig = rateStyles.SIZE_MAP[responsiveSize as keyof typeof rateStyles.SIZE_MAP];
@@ -263,4 +251,4 @@ export const rateStyles = {
263
251
  gap: `${sizeConfig.gap}px`,
264
252
  };
265
253
  },
266
- };
254
+ };
@@ -24,10 +24,10 @@ const Star: React.FC<StarProps> = ({
24
24
  const handleClick = useCallback(
25
25
  (e: any) => {
26
26
  if (disabled || readonly) return;
27
-
27
+
28
28
  const rect = e.currentTarget.getBoundingClientRect?.();
29
29
  if (rect) {
30
- const clickX = e.clientX || (e.touches?.[0]?.clientX);
30
+ const clickX = e.clientX || e.touches?.[0]?.clientX;
31
31
  const position = clickX - rect.left < rect.width / 2 ? 0.5 : 1;
32
32
  onClick?.(index, position);
33
33
  } else {
@@ -77,22 +77,14 @@ const Star: React.FC<StarProps> = ({
77
77
  if (state !== 'half') return null;
78
78
 
79
79
  return (
80
- <View
81
- style={rateStyles['getHalfStarMaskStyle']({ color, unselectedColor })}
82
- className="taro-uno-rate__star-half"
83
- >
80
+ <View style={rateStyles['getHalfStarMaskStyle']({ color, unselectedColor })} className="taro-uno-rate__star-half">
84
81
  {renderCharacter()}
85
82
  </View>
86
83
  );
87
84
  };
88
85
 
89
86
  return (
90
- <View
91
- className={starClassName}
92
- style={starStyle}
93
- onClick={handleClick}
94
- onTouchStart={handleClick}
95
- >
87
+ <View className={starClassName} style={starStyle} onClick={handleClick} onTouchStart={handleClick}>
96
88
  {renderCharacter()}
97
89
  {renderHalfStar()}
98
90
  </View>
@@ -232,7 +224,7 @@ export const RateComponent = forwardRef<RateRef, RateProps>((props, ref) => {
232
224
  }, [disabled, onFocus]);
233
225
 
234
226
  // 处理失焦
235
-
227
+
236
228
  // 渲染工具提示
237
229
  const renderTooltip = (index: number) => {
238
230
  if (!showTooltips || !tooltips[index] || showTooltip !== index) return null;
@@ -329,4 +321,4 @@ export const RateComponent = forwardRef<RateRef, RateProps>((props, ref) => {
329
321
  RateComponent.displayName = 'Rate';
330
322
 
331
323
  /** 导出Rate组件 */
332
- export const Rate = RateComponent;
324
+ export const Rate = RateComponent;
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { BaseComponentProps, Size } from '../../../types';
2
+ import { Size } from '../../../types';
3
+ import { BaseComponentProps as StandardBaseComponentProps } from '../../../types/component-props';
3
4
 
4
5
  /** 评分尺寸 */
5
6
  export type RateSize = Size | 'small' | 'medium' | 'large';
@@ -24,7 +25,7 @@ export interface RateRef {
24
25
  }
25
26
 
26
27
  /** 评分组件属性 */
27
- export interface RateProps extends BaseComponentProps {
28
+ export interface RateProps extends StandardBaseComponentProps {
28
29
  /** 当前评分值 */
29
30
  value?: number;
30
31
  /** 默认评分值 */
@@ -108,4 +109,4 @@ export interface StarProps {
108
109
  onHover?: (_index: number, position: number) => void;
109
110
  /** 离开回调 - not supported in Taro.js */
110
111
  onLeave?: () => void;
111
- }
112
+ }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Rate 评分组件
3
- *
3
+ *
4
4
  * 企业级评分组件,支持:
5
5
  * - 完整和半星评分
6
6
  * - 自定义字符和颜色
@@ -13,16 +13,8 @@
13
13
  */
14
14
 
15
15
  export { Rate, RateComponent } from './Rate';
16
- export type {
17
- RateProps,
18
- RateRef,
19
- RateSize,
20
- RateCharacter,
21
- RateUtils,
22
- StarState,
23
- StarProps,
24
- } from './Rate.types';
16
+ export type { RateProps, RateRef, RateSize, RateCharacter, RateUtils, StarState, StarProps } from './Rate.types';
25
17
  export { rateStyles } from './Rate.styles';
26
18
 
27
19
  // 默认导出
28
- export { Rate as default } from './Rate';
20
+ export { Rate as default } from './Rate';
@@ -1,4 +1,6 @@
1
+
1
2
  import React from 'react'
3
+ import { vi, describe, test, expect, beforeEach } from 'vitest'
2
4
  import { render, fireEvent, screen } from '@testing-library/react'
3
5
  import { Table } from './index'
4
6
 
@@ -1,11 +1,7 @@
1
1
  import React, { forwardRef, useRef, useState, useEffect, useCallback, useMemo } from 'react';
2
2
  import { View, Text, ScrollView } from '@tarojs/components';
3
3
  import { TableStyles } from './Table.styles';
4
- import type {
5
- TableProps,
6
- TableRef,
7
- TableSortOrder,
8
- } from './Table.types';
4
+ import type { TableProps, TableRef, TableSortOrder } from './Table.types';
9
5
 
10
6
  /** 表格组件 */
11
7
  export const TableComponent = forwardRef<TableRef, TableProps>((props, ref) => {
@@ -92,7 +88,7 @@ export const TableComponent = forwardRef<TableRef, TableProps>((props, ref) => {
92
88
  setExpandedRowKeys(newExpandedKeys);
93
89
 
94
90
  // 调用外部展开回调
95
- const record = data.find(item => String(item[rowKey as keyof typeof item]) === key);
91
+ const record = data.find((item) => String(item[rowKey as keyof typeof item]) === key);
96
92
  if (record && typeof expandable === 'object' && expandable.onExpand) {
97
93
  expandable.onExpand(expanded, record);
98
94
  }
@@ -337,7 +333,7 @@ export const TableComponent = forwardRef<TableRef, TableProps>((props, ref) => {
337
333
  () => ({
338
334
  element: tableRef.current,
339
335
  getData: () => data,
340
- getSelectedRows: () => data.filter(item => selectedRowKeys.includes(item.id as string)),
336
+ getSelectedRows: () => data.filter((item) => selectedRowKeys.includes(item.id as string)),
341
337
  getSelectedRowKeys: () => selectedRowKeys,
342
338
  getSortField: () => sortField,
343
339
  getSortOrder: () => sortOrder,
@@ -1,5 +1,6 @@
1
1
  import { ReactNode } from 'react';
2
- import { BaseComponentProps, Size } from '../../../types';
2
+ import { Size } from '../../../types';
3
+ import { BaseComponentProps as StandardBaseComponentProps } from '../../../types/component-props';
3
4
 
4
5
  /** 表格尺寸 */
5
6
  export type TableSize = Size | 'small' | 'medium' | 'large';
@@ -176,7 +177,7 @@ export interface TableRef<T = any> {
176
177
  }
177
178
 
178
179
  /** 表格组件属性 */
179
- export interface TableProps<T = any> extends BaseComponentProps {
180
+ export interface TableProps<T = any> extends StandardBaseComponentProps {
180
181
  /** 表格数据 */
181
182
  data?: T[];
182
183
  /** 数据源(兼容属性) */