taro-uno-ui 0.9.0-beta

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 (397) hide show
  1. package/LICENSE +100 -0
  2. package/README.md +273 -0
  3. package/dist/js/index-6NJ3A1Dn.js +26535 -0
  4. package/dist/js/index-6NJ3A1Dn.js.map +1 -0
  5. package/dist/js/index-DFdcksbe.js +1165 -0
  6. package/dist/js/index-DFdcksbe.js.map +1 -0
  7. package/dist/js/index-DXRIkWX1.js +1148 -0
  8. package/dist/js/index-DXRIkWX1.js.map +1 -0
  9. package/dist/js/index-DffLRSro.js +26519 -0
  10. package/dist/js/index-DffLRSro.js.map +1 -0
  11. package/package.json +119 -0
  12. package/src/app.config.ts +55 -0
  13. package/src/app.scss +508 -0
  14. package/src/app.tsx +44 -0
  15. package/src/components/basic/Button/Button.styles.ts +130 -0
  16. package/src/components/basic/Button/Button.test.tsx +154 -0
  17. package/src/components/basic/Button/Button.tsx +93 -0
  18. package/src/components/basic/Button/Button.types.ts +45 -0
  19. package/src/components/basic/Button/index.tsx +6 -0
  20. package/src/components/basic/Divider/Divider.styles.ts +488 -0
  21. package/src/components/basic/Divider/Divider.test.tsx +551 -0
  22. package/src/components/basic/Divider/Divider.tsx +361 -0
  23. package/src/components/basic/Divider/Divider.types.ts +261 -0
  24. package/src/components/basic/Divider/index.tsx +25 -0
  25. package/src/components/basic/Icon/Icon.styles.ts +359 -0
  26. package/src/components/basic/Icon/Icon.test.tsx +357 -0
  27. package/src/components/basic/Icon/Icon.tsx +154 -0
  28. package/src/components/basic/Icon/Icon.types.ts +210 -0
  29. package/src/components/basic/Icon/index.tsx +22 -0
  30. package/src/components/basic/Text/Text.styles.ts +500 -0
  31. package/src/components/basic/Text/Text.test.tsx +299 -0
  32. package/src/components/basic/Text/Text.tsx +340 -0
  33. package/src/components/basic/Text/Text.types.ts +319 -0
  34. package/src/components/basic/Text/index.tsx +27 -0
  35. package/src/components/basic/Typography/Typography.styles.ts +346 -0
  36. package/src/components/basic/Typography/Typography.tsx +205 -0
  37. package/src/components/basic/Typography/Typography.types.ts +296 -0
  38. package/src/components/basic/Typography/index.tsx +14 -0
  39. package/src/components/basic/index.tsx +302 -0
  40. package/src/components/common/ErrorBoundary.tsx +87 -0
  41. package/src/components/common/LazyComponent.tsx +246 -0
  42. package/src/components/common/ResponsiveContainer.tsx +93 -0
  43. package/src/components/common/ResponsiveGrid.tsx +183 -0
  44. package/src/components/common/SecurityProvider.tsx +110 -0
  45. package/src/components/common/ThemeProvider.tsx +128 -0
  46. package/src/components/common/VirtualList.tsx +368 -0
  47. package/src/components/common/__tests__/ErrorBoundary.test.tsx +249 -0
  48. package/src/components/common/index.tsx +7 -0
  49. package/src/components/display/Avatar/Avatar.styles.ts +62 -0
  50. package/src/components/display/Avatar/Avatar.test.tsx +390 -0
  51. package/src/components/display/Avatar/Avatar.tsx +79 -0
  52. package/src/components/display/Avatar/Avatar.types.ts +40 -0
  53. package/src/components/display/Avatar/index.ts +3 -0
  54. package/src/components/display/Badge/Badge.tsx +42 -0
  55. package/src/components/display/Badge/Badge.types.ts +29 -0
  56. package/src/components/display/Badge/index.ts +2 -0
  57. package/src/components/display/Calendar/Calendar.styles.ts +255 -0
  58. package/src/components/display/Calendar/Calendar.test.tsx +30 -0
  59. package/src/components/display/Calendar/Calendar.tsx +337 -0
  60. package/src/components/display/Calendar/Calendar.types.ts +91 -0
  61. package/src/components/display/Calendar/index.ts +3 -0
  62. package/src/components/display/Card/Card.styles.ts +89 -0
  63. package/src/components/display/Card/Card.test.tsx +180 -0
  64. package/src/components/display/Card/Card.tsx +135 -0
  65. package/src/components/display/Card/Card.types.ts +55 -0
  66. package/src/components/display/Card/index.ts +3 -0
  67. package/src/components/display/Carousel/Carousel.styles.ts +206 -0
  68. package/src/components/display/Carousel/Carousel.tsx +295 -0
  69. package/src/components/display/Carousel/Carousel.types.ts +57 -0
  70. package/src/components/display/Carousel/index.ts +3 -0
  71. package/src/components/display/List/List.styles.ts +79 -0
  72. package/src/components/display/List/List.tsx +115 -0
  73. package/src/components/display/List/List.types.ts +68 -0
  74. package/src/components/display/List/index.ts +3 -0
  75. package/src/components/display/Rate/Rate.styles.ts +266 -0
  76. package/src/components/display/Rate/Rate.tsx +332 -0
  77. package/src/components/display/Rate/Rate.types.ts +111 -0
  78. package/src/components/display/Rate/index.ts +28 -0
  79. package/src/components/display/Table/Table.styles.ts +269 -0
  80. package/src/components/display/Table/Table.test.tsx +343 -0
  81. package/src/components/display/Table/Table.tsx +430 -0
  82. package/src/components/display/Table/Table.types.ts +255 -0
  83. package/src/components/display/Table/index.tsx +16 -0
  84. package/src/components/display/Tag/Tag.styles.ts +197 -0
  85. package/src/components/display/Tag/Tag.test.tsx +541 -0
  86. package/src/components/display/Tag/Tag.tsx +156 -0
  87. package/src/components/display/Tag/Tag.types.ts +49 -0
  88. package/src/components/display/Tag/index.ts +3 -0
  89. package/src/components/display/Timeline/Timeline.styles.ts +211 -0
  90. package/src/components/display/Timeline/Timeline.tsx +239 -0
  91. package/src/components/display/Timeline/Timeline.types.ts +56 -0
  92. package/src/components/display/Timeline/index.ts +3 -0
  93. package/src/components/display/index.tsx +143 -0
  94. package/src/components/feedback/Loading/Loading.styles.ts +117 -0
  95. package/src/components/feedback/Loading/Loading.test.tsx +534 -0
  96. package/src/components/feedback/Loading/Loading.tsx +127 -0
  97. package/src/components/feedback/Loading/Loading.types.ts +33 -0
  98. package/src/components/feedback/Loading/index.ts +9 -0
  99. package/src/components/feedback/Message/Message.styles.ts +41 -0
  100. package/src/components/feedback/Message/Message.test.tsx +234 -0
  101. package/src/components/feedback/Message/Message.tsx +96 -0
  102. package/src/components/feedback/Message/Message.types.ts +37 -0
  103. package/src/components/feedback/Message/index.ts +9 -0
  104. package/src/components/feedback/Modal/Modal.styles.ts +21 -0
  105. package/src/components/feedback/Modal/Modal.test.tsx +11 -0
  106. package/src/components/feedback/Modal/Modal.tsx +291 -0
  107. package/src/components/feedback/Modal/Modal.types.ts +141 -0
  108. package/src/components/feedback/Modal/index.tsx +11 -0
  109. package/src/components/feedback/Notification/Notification.styles.ts +443 -0
  110. package/src/components/feedback/Notification/Notification.test.tsx +401 -0
  111. package/src/components/feedback/Notification/Notification.tsx +370 -0
  112. package/src/components/feedback/Notification/Notification.types.ts +336 -0
  113. package/src/components/feedback/Notification/NotificationManager.tsx +376 -0
  114. package/src/components/feedback/Notification/index.ts +33 -0
  115. package/src/components/feedback/Notification/index.tsx +164 -0
  116. package/src/components/feedback/Progress/Progress.styles.ts +460 -0
  117. package/src/components/feedback/Progress/Progress.test.simple.tsx +14 -0
  118. package/src/components/feedback/Progress/Progress.test.tsx +312 -0
  119. package/src/components/feedback/Progress/Progress.tsx +508 -0
  120. package/src/components/feedback/Progress/Progress.types.ts +163 -0
  121. package/src/components/feedback/Progress/index.ts +3 -0
  122. package/src/components/feedback/Progress/index.tsx +38 -0
  123. package/src/components/feedback/Progress/utils/animation.ts +204 -0
  124. package/src/components/feedback/Progress/utils/index.ts +26 -0
  125. package/src/components/feedback/Progress/utils/progress-calculator.ts +217 -0
  126. package/src/components/feedback/Result/Result.styles.ts +139 -0
  127. package/src/components/feedback/Result/Result.tsx +233 -0
  128. package/src/components/feedback/Result/Result.types.ts +128 -0
  129. package/src/components/feedback/Result/index.tsx +3 -0
  130. package/src/components/feedback/Toast/Toast.styles.ts +17 -0
  131. package/src/components/feedback/Toast/Toast.test.tsx +10 -0
  132. package/src/components/feedback/Toast/Toast.tsx +372 -0
  133. package/src/components/feedback/Toast/Toast.types.ts +86 -0
  134. package/src/components/feedback/Toast/index.tsx +3 -0
  135. package/src/components/feedback/Tooltip/Tooltip.examples.tsx +458 -0
  136. package/src/components/feedback/Tooltip/Tooltip.styles.ts +346 -0
  137. package/src/components/feedback/Tooltip/Tooltip.test.tsx +446 -0
  138. package/src/components/feedback/Tooltip/Tooltip.tsx +283 -0
  139. package/src/components/feedback/Tooltip/Tooltip.types.ts +172 -0
  140. package/src/components/feedback/Tooltip/index.ts +3 -0
  141. package/src/components/feedback/Tooltip/index.tsx +258 -0
  142. package/src/components/feedback/index.tsx +164 -0
  143. package/src/components/form/Cascader/Cascader.styles.ts +526 -0
  144. package/src/components/form/Cascader/Cascader.test.tsx +77 -0
  145. package/src/components/form/Cascader/Cascader.tsx +585 -0
  146. package/src/components/form/Cascader/Cascader.types.ts +582 -0
  147. package/src/components/form/Cascader/hooks/index.ts +3 -0
  148. package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +16 -0
  149. package/src/components/form/Cascader/hooks/useCascaderOptions.ts +109 -0
  150. package/src/components/form/Cascader/hooks/useCascaderState.ts +133 -0
  151. package/src/components/form/Cascader/index.ts +25 -0
  152. package/src/components/form/Cascader/utils/formatDisplayValue.ts +19 -0
  153. package/src/components/form/Cascader/utils/index.ts +1 -0
  154. package/src/components/form/Checkbox/Checkbox.styles.ts +608 -0
  155. package/src/components/form/Checkbox/Checkbox.test.tsx +1140 -0
  156. package/src/components/form/Checkbox/Checkbox.tsx +496 -0
  157. package/src/components/form/Checkbox/Checkbox.types.ts +472 -0
  158. package/src/components/form/Checkbox/CheckboxGroup.tsx +444 -0
  159. package/src/components/form/Checkbox/index.tsx +27 -0
  160. package/src/components/form/DatePicker/DatePicker.styles.ts +393 -0
  161. package/src/components/form/DatePicker/DatePicker.test.tsx +407 -0
  162. package/src/components/form/DatePicker/DatePicker.tsx +360 -0
  163. package/src/components/form/DatePicker/DatePicker.types.ts +247 -0
  164. package/src/components/form/DatePicker/index.tsx +15 -0
  165. package/src/components/form/Form/Form.styles.ts +357 -0
  166. package/src/components/form/Form/Form.test.tsx +122 -0
  167. package/src/components/form/Form/Form.tsx +695 -0
  168. package/src/components/form/Form/Form.types.ts +407 -0
  169. package/src/components/form/Form/index.tsx +31 -0
  170. package/src/components/form/Input/Input.enhanced.tsx +732 -0
  171. package/src/components/form/Input/Input.styles.ts +438 -0
  172. package/src/components/form/Input/Input.test.tsx +494 -0
  173. package/src/components/form/Input/Input.tsx +541 -0
  174. package/src/components/form/Input/Input.types.ts +285 -0
  175. package/src/components/form/Input/index.tsx +26 -0
  176. package/src/components/form/InputNumber/InputNumber.styles.ts +665 -0
  177. package/src/components/form/InputNumber/InputNumber.tsx +370 -0
  178. package/src/components/form/InputNumber/InputNumber.types.ts +318 -0
  179. package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +32 -0
  180. package/src/components/form/InputNumber/components/InputNumberControls.tsx +42 -0
  181. package/src/components/form/InputNumber/components/index.ts +2 -0
  182. package/src/components/form/InputNumber/hooks/index.ts +4 -0
  183. package/src/components/form/InputNumber/hooks/useInputNumberState.ts +315 -0
  184. package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +147 -0
  185. package/src/components/form/InputNumber/index.ts +25 -0
  186. package/src/components/form/Radio/Radio.styles.ts +458 -0
  187. package/src/components/form/Radio/Radio.test.tsx +547 -0
  188. package/src/components/form/Radio/Radio.tsx +283 -0
  189. package/src/components/form/Radio/Radio.types.ts +410 -0
  190. package/src/components/form/Radio/index.tsx +21 -0
  191. package/src/components/form/Select/Select.styles.ts +514 -0
  192. package/src/components/form/Select/Select.test.tsx +648 -0
  193. package/src/components/form/Select/Select.tsx +474 -0
  194. package/src/components/form/Select/Select.types.ts +428 -0
  195. package/src/components/form/Select/index.tsx +30 -0
  196. package/src/components/form/Slider/Slider.styles.ts +139 -0
  197. package/src/components/form/Slider/Slider.test.tsx +553 -0
  198. package/src/components/form/Slider/Slider.tsx +326 -0
  199. package/src/components/form/Slider/Slider.types.ts +108 -0
  200. package/src/components/form/Slider/index.tsx +10 -0
  201. package/src/components/form/Switch/Switch.styles.ts +540 -0
  202. package/src/components/form/Switch/Switch.test.tsx +345 -0
  203. package/src/components/form/Switch/Switch.tsx +464 -0
  204. package/src/components/form/Switch/Switch.types.ts +386 -0
  205. package/src/components/form/Switch/index.tsx +26 -0
  206. package/src/components/form/Textarea/Textarea.styles.ts +592 -0
  207. package/src/components/form/Textarea/Textarea.test.tsx +1075 -0
  208. package/src/components/form/Textarea/Textarea.tsx +602 -0
  209. package/src/components/form/Textarea/Textarea.types.ts +371 -0
  210. package/src/components/form/Textarea/index.tsx +26 -0
  211. package/src/components/form/TimePicker/TimePicker.styles.ts +438 -0
  212. package/src/components/form/TimePicker/TimePicker.test.tsx +306 -0
  213. package/src/components/form/TimePicker/TimePicker.tsx +228 -0
  214. package/src/components/form/TimePicker/TimePicker.types.ts +385 -0
  215. package/src/components/form/TimePicker/index.ts +21 -0
  216. package/src/components/form/Transfer/Transfer.styles.ts +502 -0
  217. package/src/components/form/Transfer/Transfer.test.tsx +316 -0
  218. package/src/components/form/Transfer/Transfer.tsx +402 -0
  219. package/src/components/form/Transfer/Transfer.types.ts +557 -0
  220. package/src/components/form/Transfer/components/TransferItem.tsx +101 -0
  221. package/src/components/form/Transfer/components/TransferList.tsx +285 -0
  222. package/src/components/form/Transfer/components/TransferOperations.tsx +84 -0
  223. package/src/components/form/Transfer/components/TransferPagination.tsx +135 -0
  224. package/src/components/form/Transfer/components/TransferSearch.tsx +88 -0
  225. package/src/components/form/Transfer/components/index.ts +6 -0
  226. package/src/components/form/Transfer/hooks/index.ts +3 -0
  227. package/src/components/form/Transfer/hooks/useTransferData.ts +192 -0
  228. package/src/components/form/Transfer/hooks/useTransferState.ts +114 -0
  229. package/src/components/form/Transfer/index.ts +33 -0
  230. package/src/components/form/Upload/Upload.styles.ts +145 -0
  231. package/src/components/form/Upload/Upload.test.tsx +10 -0
  232. package/src/components/form/Upload/Upload.tsx +451 -0
  233. package/src/components/form/Upload/Upload.types.ts +200 -0
  234. package/src/components/form/Upload/index.tsx +12 -0
  235. package/src/components/form/index.tsx +121 -0
  236. package/src/components/index.tsx +146 -0
  237. package/src/components/layout/Affix/Affix.styles.ts +37 -0
  238. package/src/components/layout/Affix/Affix.test.tsx +10 -0
  239. package/src/components/layout/Affix/Affix.tsx +91 -0
  240. package/src/components/layout/Affix/Affix.types.ts +29 -0
  241. package/src/components/layout/Affix/index.tsx +3 -0
  242. package/src/components/layout/Col/Col.styles.ts +185 -0
  243. package/src/components/layout/Col/Col.test.tsx +535 -0
  244. package/src/components/layout/Col/Col.tsx +115 -0
  245. package/src/components/layout/Col/Col.types.ts +59 -0
  246. package/src/components/layout/Col/index.tsx +3 -0
  247. package/src/components/layout/Container/Container.styles.ts +161 -0
  248. package/src/components/layout/Container/Container.test.tsx +380 -0
  249. package/src/components/layout/Container/Container.tsx +132 -0
  250. package/src/components/layout/Container/Container.types.ts +63 -0
  251. package/src/components/layout/Container/index.tsx +3 -0
  252. package/src/components/layout/Grid/Grid.styles.ts +183 -0
  253. package/src/components/layout/Grid/Grid.test.tsx +637 -0
  254. package/src/components/layout/Grid/Grid.tsx +173 -0
  255. package/src/components/layout/Grid/Grid.types.ts +78 -0
  256. package/src/components/layout/Grid/index.tsx +3 -0
  257. package/src/components/layout/Layout/Content.tsx +38 -0
  258. package/src/components/layout/Layout/Footer.tsx +38 -0
  259. package/src/components/layout/Layout/Header.tsx +38 -0
  260. package/src/components/layout/Layout/Layout.styles.ts +84 -0
  261. package/src/components/layout/Layout/Layout.test.tsx +10 -0
  262. package/src/components/layout/Layout/Layout.tsx +39 -0
  263. package/src/components/layout/Layout/Layout.types.ts +58 -0
  264. package/src/components/layout/Layout/Sider.tsx +56 -0
  265. package/src/components/layout/Layout/index.tsx +8 -0
  266. package/src/components/layout/Row/Row.styles.ts +159 -0
  267. package/src/components/layout/Row/Row.test.tsx +467 -0
  268. package/src/components/layout/Row/Row.tsx +139 -0
  269. package/src/components/layout/Row/Row.types.ts +60 -0
  270. package/src/components/layout/Row/index.tsx +3 -0
  271. package/src/components/layout/Space/Space.styles.ts +255 -0
  272. package/src/components/layout/Space/Space.test.tsx +682 -0
  273. package/src/components/layout/Space/Space.tsx +211 -0
  274. package/src/components/layout/Space/Space.types.ts +92 -0
  275. package/src/components/layout/Space/index.tsx +12 -0
  276. package/src/components/layout/index.tsx +68 -0
  277. package/src/components/navigation/Menu/Menu.styles.ts +779 -0
  278. package/src/components/navigation/Menu/Menu.tsx +355 -0
  279. package/src/components/navigation/Menu/Menu.types.ts +231 -0
  280. package/src/components/navigation/Menu/Menu.utils.ts +187 -0
  281. package/src/components/navigation/Menu/MenuItem.tsx +126 -0
  282. package/src/components/navigation/Menu/SubMenu.tsx +148 -0
  283. package/src/components/navigation/Menu/__tests__/Menu.test.tsx +687 -0
  284. package/src/components/navigation/Menu/index.tsx +124 -0
  285. package/src/components/navigation/NavBar/NavBar.styles.ts +129 -0
  286. package/src/components/navigation/NavBar/NavBar.test.tsx +287 -0
  287. package/src/components/navigation/NavBar/NavBar.tsx +231 -0
  288. package/src/components/navigation/NavBar/NavBar.types.ts +54 -0
  289. package/src/components/navigation/NavBar/index.tsx +3 -0
  290. package/src/components/navigation/Pagination/Pagination.styles.ts +187 -0
  291. package/src/components/navigation/Pagination/Pagination.test.tsx +673 -0
  292. package/src/components/navigation/Pagination/Pagination.tsx +395 -0
  293. package/src/components/navigation/Pagination/Pagination.types.ts +86 -0
  294. package/src/components/navigation/Pagination/index.ts +18 -0
  295. package/src/components/navigation/Pagination/index.tsx +9 -0
  296. package/src/components/navigation/Steps/Step.tsx +56 -0
  297. package/src/components/navigation/Steps/Steps.styles.ts +154 -0
  298. package/src/components/navigation/Steps/Steps.test.tsx +12 -0
  299. package/src/components/navigation/Steps/Steps.tsx +113 -0
  300. package/src/components/navigation/Steps/Steps.types.ts +47 -0
  301. package/src/components/navigation/Steps/index.tsx +3 -0
  302. package/src/components/navigation/Tabs/Tabs.styles.ts +199 -0
  303. package/src/components/navigation/Tabs/Tabs.test.tsx +661 -0
  304. package/src/components/navigation/Tabs/Tabs.tsx +253 -0
  305. package/src/components/navigation/Tabs/Tabs.types.ts +114 -0
  306. package/src/components/navigation/Tabs/index.tsx +3 -0
  307. package/src/components/navigation/Tree/Tree.styles.ts +553 -0
  308. package/src/components/navigation/Tree/Tree.test.basic.tsx +7 -0
  309. package/src/components/navigation/Tree/Tree.test.functional.tsx +496 -0
  310. package/src/components/navigation/Tree/Tree.test.import.check.tsx +6 -0
  311. package/src/components/navigation/Tree/Tree.test.import.tsx +6 -0
  312. package/src/components/navigation/Tree/Tree.test.minimal.tsx +5 -0
  313. package/src/components/navigation/Tree/Tree.test.simple.tsx +30 -0
  314. package/src/components/navigation/Tree/Tree.test.tsx +908 -0
  315. package/src/components/navigation/Tree/Tree.test.working.tsx +673 -0
  316. package/src/components/navigation/Tree/Tree.tsx +600 -0
  317. package/src/components/navigation/Tree/Tree.types.ts +909 -0
  318. package/src/components/navigation/Tree/Tree.utils.ts +452 -0
  319. package/src/components/navigation/Tree/index.ts +33 -0
  320. package/src/components/navigation/Tree/index.tsx +23 -0
  321. package/src/components/navigation/index.tsx +83 -0
  322. package/src/constants/index.ts +785 -0
  323. package/src/hooks/index.ts +110 -0
  324. package/src/hooks/types.ts +10 -0
  325. package/src/hooks/useAsync.ts +65 -0
  326. package/src/hooks/useEventHandling.ts +444 -0
  327. package/src/hooks/useLifecycle.ts +399 -0
  328. package/src/hooks/usePerformance.ts +441 -0
  329. package/src/hooks/usePerformanceMonitor.ts +348 -0
  330. package/src/hooks/usePlatform.ts +62 -0
  331. package/src/hooks/useRequest.test.ts +11 -0
  332. package/src/hooks/useRequest.ts +135 -0
  333. package/src/hooks/useStateManagement.ts +300 -0
  334. package/src/hooks/useStyle.ts +537 -0
  335. package/src/hooks/useTheme.ts +347 -0
  336. package/src/hooks/useVirtualScroll.ts +331 -0
  337. package/src/index.ts +298 -0
  338. package/src/platform/index.ts +1188 -0
  339. package/src/providers/AppProvider.test.tsx +63 -0
  340. package/src/providers/AppProvider.tsx +155 -0
  341. package/src/providers/index.ts +1 -0
  342. package/src/theme/ThemeProvider.tsx +283 -0
  343. package/src/theme/ThemeProvider.types.ts +26 -0
  344. package/src/theme/animations.tsx +660 -0
  345. package/src/theme/defaults.ts +188 -0
  346. package/src/theme/design-system.ts +562 -0
  347. package/src/theme/design-tokens.ts +1136 -0
  348. package/src/theme/generated/dark-theme.scss +120 -0
  349. package/src/theme/generated/tokens.css +441 -0
  350. package/src/theme/generated/tokens.scss +320 -0
  351. package/src/theme/index.ts +120 -0
  352. package/src/theme/responsive.tsx +193 -0
  353. package/src/theme/styles/mixins.scss +612 -0
  354. package/src/theme/styles/variables.scss +295 -0
  355. package/src/theme/styles.ts +403 -0
  356. package/src/theme/tokens/colors.ts +256 -0
  357. package/src/theme/tokens/effects.ts +260 -0
  358. package/src/theme/tokens/index.ts +217 -0
  359. package/src/theme/tokens/spacing.ts +137 -0
  360. package/src/theme/tokens/typography.ts +186 -0
  361. package/src/theme/types.ts +188 -0
  362. package/src/theme/useThemeUtils.ts +313 -0
  363. package/src/theme/utils.ts +501 -0
  364. package/src/theme/variables.ts +583 -0
  365. package/src/types/accessibility.ts +51 -0
  366. package/src/types/button.ts +562 -0
  367. package/src/types/component-props.ts +317 -0
  368. package/src/types/env.d.ts +20 -0
  369. package/src/types/index.ts +427 -0
  370. package/src/types/modules.d.ts +40 -0
  371. package/src/types/standardized-components.ts +544 -0
  372. package/src/types/taro-adapter.d.ts +174 -0
  373. package/src/types/taro-components.d.ts +73 -0
  374. package/src/types/utils.ts +410 -0
  375. package/src/utils/__tests__/inputValidator.test.ts +338 -0
  376. package/src/utils/__tests__/responsiveUtils.test.ts +310 -0
  377. package/src/utils/__tests__/xssProtection.test.ts +268 -0
  378. package/src/utils/cache.ts +83 -0
  379. package/src/utils/createNamespace.ts +24 -0
  380. package/src/utils/environment.ts +95 -0
  381. package/src/utils/error-handler.ts +88 -0
  382. package/src/utils/errorLogger.ts +197 -0
  383. package/src/utils/formatUtils.ts +444 -0
  384. package/src/utils/index.ts +115 -0
  385. package/src/utils/inputValidator.ts +261 -0
  386. package/src/utils/network/http-client.test.ts +18 -0
  387. package/src/utils/network/http-client.ts +151 -0
  388. package/src/utils/performance/performance.ts +850 -0
  389. package/src/utils/responsiveUtils.ts +357 -0
  390. package/src/utils/rtl-support.ts +344 -0
  391. package/src/utils/security/api-security.ts +386 -0
  392. package/src/utils/security/xss-protection.ts +69 -0
  393. package/src/utils/securityHeaders.ts +314 -0
  394. package/src/utils/typeHelpers.ts +16 -0
  395. package/src/utils/types/dataProcessing.ts +543 -0
  396. package/src/utils/types/typeHelpers.ts +187 -0
  397. package/src/utils/xssProtection.ts +420 -0
@@ -0,0 +1,376 @@
1
+ import React, { forwardRef, useRef, useState, useCallback } from 'react';
2
+ import { View } from '@tarojs/components';
3
+ import type {
4
+ NotificationManagerProps,
5
+ NotificationManagerRef,
6
+ NotificationItem,
7
+ NotificationPlacement
8
+ } from './Notification.types';
9
+ import { Notification } from './Notification';
10
+ import { notificationStyleHelpers } from './Notification.styles';
11
+ import { cn, platform } from '../../../utils';
12
+ import { useTheme } from '../../../theme/ThemeProvider';
13
+ import { DEFAULT_NOTIFICATION_CONFIG, NotificationUtils } from './Notification.types';
14
+
15
+ // 通知项内部接口
16
+ interface InternalNotificationItem extends NotificationItem {
17
+ /** 堆叠索引 */
18
+ stackIndex: number;
19
+ /** 是否正在关闭 */
20
+ isClosing: boolean;
21
+ }
22
+
23
+ export const NotificationManager = forwardRef<NotificationManagerRef, NotificationManagerProps>((props, ref) => {
24
+ const {
25
+ maxCount = DEFAULT_NOTIFICATION_CONFIG.defaultMaxCount,
26
+ defaultPlacement = DEFAULT_NOTIFICATION_CONFIG.defaultPlacement,
27
+ defaultDuration = DEFAULT_NOTIFICATION_CONFIG.defaultDuration,
28
+ defaultAnimation = DEFAULT_NOTIFICATION_CONFIG.defaultAnimation,
29
+ stack = DEFAULT_NOTIFICATION_CONFIG.defaultStack,
30
+ containerStyle,
31
+ containerClassName,
32
+ onEnter,
33
+ onLeave,
34
+ onAllClose,
35
+ } = props;
36
+
37
+ // Ignore unused props for future implementation
38
+ void props.stackMaxCount;
39
+ void props.allowDrag;
40
+ void props.dragThreshold;
41
+ void props.showGroup;
42
+ void props.groupInterval;
43
+ void props.style;
44
+ void props.className;
45
+
46
+ const theme = useTheme();
47
+ const [notifications, setNotifications] = useState<InternalNotificationItem[]>([]);
48
+ const [history, setHistory] = useState<NotificationItem[]>([]);
49
+ const [_isAllPaused, setIsAllPaused] = useState(false);
50
+ const notificationRefs = useRef<Map<string, { current: any }>>(new Map());
51
+
52
+ // 添加通知
53
+ const addNotification = useCallback((config: Omit<NotificationItem, 'key' | 'createdAt'>): string => {
54
+ const key = NotificationUtils.generateKey();
55
+ const newNotification: InternalNotificationItem = {
56
+ ...config,
57
+ key,
58
+ createdAt: Date.now(),
59
+ placement: config.placement || defaultPlacement,
60
+ duration: config.duration ?? defaultDuration,
61
+ animation: config.animation || defaultAnimation,
62
+ stackIndex: 0,
63
+ isClosing: false,
64
+ };
65
+
66
+ setNotifications(prev => {
67
+ // 检查是否超过最大数量
68
+ let updatedNotifications = [...prev, newNotification];
69
+
70
+ if (updatedNotifications.length > maxCount) {
71
+ // 移除最早的通知
72
+ const removed = updatedNotifications.shift();
73
+ if (removed) {
74
+ // 添加到历史记录
75
+ setHistory(prevHistory => [...prevHistory.slice(-DEFAULT_NOTIFICATION_CONFIG.maxHistoryCount!), removed]);
76
+ onLeave?.(removed.key);
77
+ }
78
+ }
79
+
80
+ // 更新堆叠索引
81
+ return updateStackIndices(updatedNotifications);
82
+ });
83
+
84
+ onEnter?.(key);
85
+ return key;
86
+ }, [maxCount, defaultPlacement, defaultDuration, defaultAnimation, onEnter, onLeave]);
87
+
88
+ // 更新堆叠索引
89
+ const updateStackIndices = useCallback((notificationsList: InternalNotificationItem[]): InternalNotificationItem[] => {
90
+ if (!stack) return notificationsList;
91
+
92
+ return notificationsList.map((notification, index) => ({
93
+ ...notification,
94
+ stackIndex: index,
95
+ }));
96
+ }, [stack]);
97
+
98
+ // 关闭通知
99
+ const closeNotification = useCallback((key: string) => {
100
+ setNotifications(prev => {
101
+ const notificationIndex = prev.findIndex(n => n.key === key);
102
+ if (notificationIndex === -1) return prev;
103
+
104
+ const notification = prev[notificationIndex];
105
+ const updatedNotifications = prev.filter((_, index) => index !== notificationIndex);
106
+
107
+ // 添加到历史记录
108
+ setHistory(prevHistory => [...prevHistory.slice(-DEFAULT_NOTIFICATION_CONFIG.maxHistoryCount!), notification as NotificationItem]);
109
+
110
+ // 更新堆叠索引
111
+ return updateStackIndices(updatedNotifications);
112
+ });
113
+
114
+ onLeave?.(key);
115
+ }, [onLeave, updateStackIndices]);
116
+
117
+ // 关闭所有通知
118
+ const closeAllNotifications = useCallback(() => {
119
+ setNotifications(prev => {
120
+ // 添加到历史记录
121
+ setHistory(prevHistory => [
122
+ ...prevHistory.slice(-DEFAULT_NOTIFICATION_CONFIG.maxHistoryCount!),
123
+ ...prev
124
+ ]);
125
+
126
+ const firstKey = prev[0]?.key;
127
+ if (firstKey) {
128
+ onLeave?.(firstKey);
129
+ }
130
+ onAllClose?.();
131
+
132
+ return [];
133
+ });
134
+ }, [onLeave, onAllClose]);
135
+
136
+ // 更新通知
137
+ const updateNotification = useCallback((key: string, config: Partial<NotificationItem>) => {
138
+ setNotifications(prev => {
139
+ return prev.map(notification => {
140
+ if (notification.key === key) {
141
+ return {
142
+ ...notification,
143
+ ...config,
144
+ // 保留原始创建时间和键
145
+ key: notification.key,
146
+ createdAt: notification.createdAt,
147
+ };
148
+ }
149
+ return notification;
150
+ });
151
+ });
152
+ }, []);
153
+
154
+ // 显示通知
155
+ const open = useCallback((config: Omit<NotificationItem, 'key' | 'createdAt'>) => {
156
+ return addNotification(config);
157
+ }, [addNotification]);
158
+
159
+ // 显示成功通知
160
+ const success = useCallback((config: Omit<NotificationItem, 'key' | 'createdAt' | 'type'>) => {
161
+ return open({ ...config, type: 'success' });
162
+ }, [open]);
163
+
164
+ // 显示信息通知
165
+ const info = useCallback((config: Omit<NotificationItem, 'key' | 'createdAt' | 'type'>) => {
166
+ return open({ ...config, type: 'info' });
167
+ }, [open]);
168
+
169
+ // 显示警告通知
170
+ const warning = useCallback((config: Omit<NotificationItem, 'key' | 'createdAt' | 'type'>) => {
171
+ return open({ ...config, type: 'warning' });
172
+ }, [open]);
173
+
174
+ // 显示错误通知
175
+ const error = useCallback((config: Omit<NotificationItem, 'key' | 'createdAt' | 'type'>) => {
176
+ return open({ ...config, type: 'error' });
177
+ }, [open]);
178
+
179
+ // 关闭指定通知
180
+ const close = useCallback((key: string) => {
181
+ closeNotification(key);
182
+ }, [closeNotification]);
183
+
184
+ // 关闭所有通知
185
+ const destroyAll = useCallback(() => {
186
+ closeAllNotifications();
187
+ }, [closeAllNotifications]);
188
+
189
+ // 获取所有通知
190
+ const getNotifications = useCallback(() => {
191
+ return notifications.map(({ isClosing, stackIndex, ...rest }) => rest);
192
+ }, [notifications]);
193
+
194
+ // 获取通知数量
195
+ const getCount = useCallback(() => {
196
+ return notifications.length;
197
+ }, [notifications]);
198
+
199
+ // 设置最大数量
200
+ const setMaxCount = useCallback((_count: number) => {
201
+ // 这里可以更新状态,但由于maxCount是prop,实际应该通过props更新
202
+ console.warn('setMaxCount should be controlled by props');
203
+ }, []);
204
+
205
+ // 设置默认位置
206
+ const setDefaultPlacement = useCallback((_placement: NotificationPlacement) => {
207
+ // 这里可以更新状态,但由于defaultPlacement是prop,实际应该通过props更新
208
+ console.warn('setDefaultPlacement should be controlled by props');
209
+ }, []);
210
+
211
+ // 设置默认时长
212
+ const setDefaultDuration = useCallback((_duration: number) => {
213
+ // 这里可以更新状态,但由于defaultDuration是prop,实际应该通过props更新
214
+ console.warn('setDefaultDuration should be controlled by props');
215
+ }, []);
216
+
217
+ // 暂停所有通知自动关闭
218
+ const pauseAll = useCallback(() => {
219
+ setIsAllPaused(true);
220
+ notificationRefs.current.forEach(refObject => {
221
+ if (refObject?.current?.pauseProgress) {
222
+ refObject.current.pauseProgress();
223
+ }
224
+ });
225
+ }, []);
226
+
227
+ // 恢复所有通知自动关闭
228
+ const resumeAll = useCallback(() => {
229
+ setIsAllPaused(false);
230
+ notificationRefs.current.forEach(ref => {
231
+ if (ref?.current?.resumeProgress) {
232
+ ref.current.resumeProgress();
233
+ }
234
+ });
235
+ }, []);
236
+
237
+ // 清空历史记录
238
+ const clearHistory = useCallback(() => {
239
+ setHistory([]);
240
+ }, []);
241
+
242
+ // 获取通知历史
243
+ const getHistory = useCallback(() => {
244
+ return [...history];
245
+ }, [history]);
246
+
247
+ // 暴露方法给ref
248
+ React.useImperativeHandle(ref, () => ({
249
+ open,
250
+ success,
251
+ info,
252
+ warning,
253
+ error,
254
+ close,
255
+ destroyAll,
256
+ update: updateNotification,
257
+ getNotifications,
258
+ getCount,
259
+ setMaxCount,
260
+ setDefaultPlacement,
261
+ setDefaultDuration,
262
+ pauseAll,
263
+ resumeAll,
264
+ clearHistory,
265
+ getHistory,
266
+ }));
267
+
268
+ // 处理通知关闭
269
+ const handleNotificationClose = useCallback((key: string) => {
270
+ closeNotification(key);
271
+ }, [closeNotification]);
272
+
273
+ // 处理通知点击
274
+ const handleNotificationClick = useCallback((key: string) => {
275
+ const notification = notifications.find(n => n.key === key);
276
+ if (notification?.onClick) {
277
+ notification.onClick();
278
+ }
279
+ }, [notifications]);
280
+
281
+ // 获取容器样式
282
+ const getContainerStyle = () => {
283
+ return {
284
+ ...notificationStyleHelpers.getContainerStyle({ theme, isMobile: platform.isMobile() }),
285
+ ...containerStyle,
286
+ };
287
+ };
288
+
289
+ // 获取容器类名
290
+ const getContainerClassName = () => {
291
+ return cn(
292
+ 'taro-uno-notification-container',
293
+ containerClassName
294
+ );
295
+ };
296
+
297
+
298
+ // 按位置分组通知
299
+ const renderNotificationsByPlacement = () => {
300
+ const notificationsByPlacement: Record<NotificationPlacement, InternalNotificationItem[]> = {
301
+ topRight: [],
302
+ topLeft: [],
303
+ bottomRight: [],
304
+ bottomLeft: [],
305
+ top: [],
306
+ bottom: [],
307
+ };
308
+
309
+ // 按位置分组
310
+ notifications.forEach(notification => {
311
+ const placement = notification.placement || defaultPlacement;
312
+ notificationsByPlacement[placement].push(notification);
313
+ });
314
+
315
+ // 渲染每个位置的通知
316
+ return Object.entries(notificationsByPlacement).map(([placement, placementNotifications]) => {
317
+ if (placementNotifications.length === 0) return null;
318
+
319
+ const sortedNotifications = NotificationUtils.sortNotifications(placementNotifications);
320
+
321
+ return (
322
+ <View
323
+ key={placement}
324
+ className={`taro-uno-notification-placement-${placement}`}
325
+ style={{
326
+ position: 'absolute',
327
+ pointerEvents: 'none',
328
+ ...getPlacementStyle(placement as NotificationPlacement),
329
+ }}
330
+ >
331
+ {sortedNotifications.map((notification) => {
332
+ const { key, ...notificationConfig } = notification;
333
+ // Future implementation might use these properties
334
+ void (notification as any).isClosing;
335
+ void (notification as any).stackIndex;
336
+
337
+ return (
338
+ <Notification
339
+ key={key}
340
+ ref={(ref) => {
341
+ if (ref) {
342
+ notificationRefs.current.set(key, { current: ref });
343
+ } else {
344
+ notificationRefs.current.delete(key);
345
+ }
346
+ }}
347
+ {...notificationConfig}
348
+ onClose={() => handleNotificationClose(key)}
349
+ onClick={() => handleNotificationClick(key)}
350
+ />
351
+ );
352
+ })}
353
+ </View>
354
+ );
355
+ });
356
+ };
357
+
358
+ // 获取位置样式
359
+ const getPlacementStyle = (placement: NotificationPlacement) => {
360
+ const placementStyleData = notificationStyleHelpers.getPlacementStyle(placement, { theme, isMobile: platform.isMobile() });
361
+ return placementStyleData.container;
362
+ };
363
+
364
+ return (
365
+ <View
366
+ className={getContainerClassName()}
367
+ style={getContainerStyle()}
368
+ >
369
+ {renderNotificationsByPlacement()}
370
+ </View>
371
+ );
372
+ });
373
+
374
+ NotificationManager.displayName = 'NotificationManager';
375
+
376
+ export default NotificationManager;
@@ -0,0 +1,33 @@
1
+ export { Notification } from './Notification';
2
+ export { default as NotificationManager } from './NotificationManager';
3
+
4
+ // Simple notification singleton for direct usage
5
+ class NotificationSingleton {
6
+ open = (_config: any) => {
7
+ console.warn('Notification singleton called. Please render <NotificationManager /> in your app for full functionality.');
8
+ return 'notification-key';
9
+ };
10
+
11
+ success = (config: any) => this.open({ ...config, type: 'success' });
12
+ info = (config: any) => this.open({ ...config, type: 'info' });
13
+ warning = (config: any) => this.open({ ...config, type: 'warning' });
14
+ error = (config: any) => this.open({ ...config, type: 'error' });
15
+ close = (_key: string) => {};
16
+ destroyAll = () => {};
17
+ update = (_key: string, _config: any) => {};
18
+ getNotifications = () => [];
19
+ getCount = () => 0;
20
+ setMaxCount = (_count: number) => {};
21
+ setDefaultPlacement = (_placement: any) => {};
22
+ setDefaultDuration = (_duration: number) => {};
23
+ pauseAll = () => {};
24
+ resumeAll = () => {};
25
+ clearHistory = () => {};
26
+ getHistory = () => [];
27
+ }
28
+
29
+ export const notification = new NotificationSingleton();
30
+ export type { NotificationProps, NotificationRef, NotificationManagerProps, NotificationPlacement } from './Notification.types';
31
+ export { notificationStyles } from './Notification.styles';
32
+
33
+ export default Notification;
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Notification 通知提醒组件
3
+ * 提供全局通知提醒功能,支持多种类型、位置、动画效果
4
+ */
5
+
6
+ // 导出主要组件
7
+ export { Notification } from './Notification';
8
+ export { default as NotificationManager } from './NotificationManager';
9
+
10
+ // 导出类型定义
11
+ export type {
12
+ NotificationType,
13
+ NotificationPlacement,
14
+ NotificationAnimation,
15
+ NotificationItem,
16
+ NotificationProps,
17
+ NotificationManagerProps,
18
+ NotificationRef,
19
+ NotificationUtils,
20
+ } from './Notification.types';
21
+
22
+ // 导出默认配置
23
+ export { DEFAULT_NOTIFICATION_CONFIG } from './Notification.types';
24
+
25
+ // 导出样式系统
26
+ export {
27
+ notificationStyles,
28
+ notificationStyleHelpers,
29
+ notificationStyleConfig,
30
+ notificationStylesCompat,
31
+ notificationStylesLegacy,
32
+ } from './Notification.styles';
33
+
34
+ // 导出工具函数
35
+ export { NotificationUtils } from './Notification.types';
36
+
37
+ // 创建全局通知管理器实例
38
+ import type { NotificationManagerRef } from './Notification.types';
39
+
40
+ // 全局通知管理器引用
41
+ let globalNotificationRef: NotificationManagerRef | null = null;
42
+
43
+ // 设置全局通知管理器
44
+ export const setGlobalNotificationRef = (ref: NotificationManagerRef | null) => {
45
+ globalNotificationRef = ref;
46
+ };
47
+
48
+ // 获取全局通知管理器
49
+ export const getGlobalNotificationRef = (): NotificationManagerRef | null => {
50
+ return globalNotificationRef;
51
+ };
52
+
53
+ // 全局通知方法
54
+ export const notification = {
55
+ // 显示通知
56
+ open: (config: Parameters<NotificationManagerRef['open']>[0]) => {
57
+ return globalNotificationRef?.open(config) || '';
58
+ },
59
+
60
+ // 显示成功通知
61
+ success: (config: Parameters<NotificationManagerRef['success']>[0]) => {
62
+ return globalNotificationRef?.success(config) || '';
63
+ },
64
+
65
+ // 显示信息通知
66
+ info: (config: Parameters<NotificationManagerRef['info']>[0]) => {
67
+ return globalNotificationRef?.info(config) || '';
68
+ },
69
+
70
+ // 显示警告通知
71
+ warning: (config: Parameters<NotificationManagerRef['warning']>[0]) => {
72
+ return globalNotificationRef?.warning(config) || '';
73
+ },
74
+
75
+ // 显示错误通知
76
+ error: (config: Parameters<NotificationManagerRef['error']>[0]) => {
77
+ return globalNotificationRef?.error(config) || '';
78
+ },
79
+
80
+ // 关闭通知
81
+ close: (key: string) => {
82
+ globalNotificationRef?.close(key);
83
+ },
84
+
85
+ // 关闭所有通知
86
+ destroyAll: () => {
87
+ globalNotificationRef?.destroyAll();
88
+ },
89
+
90
+ // 更新通知
91
+ update: (key: string, config: Parameters<NotificationManagerRef['update']>[1]) => {
92
+ globalNotificationRef?.update(key, config);
93
+ },
94
+
95
+ // 获取所有通知
96
+ getNotifications: () => {
97
+ return globalNotificationRef?.getNotifications() || [];
98
+ },
99
+
100
+ // 获取通知数量
101
+ getCount: () => {
102
+ return globalNotificationRef?.getCount() || 0;
103
+ },
104
+
105
+ // 暂停所有通知
106
+ pauseAll: () => {
107
+ globalNotificationRef?.pauseAll();
108
+ },
109
+
110
+ // 恢复所有通知
111
+ resumeAll: () => {
112
+ globalNotificationRef?.resumeAll();
113
+ },
114
+
115
+ // 清空历史记录
116
+ clearHistory: () => {
117
+ globalNotificationRef?.clearHistory();
118
+ },
119
+
120
+ // 获取通知历史
121
+ getHistory: () => {
122
+ return globalNotificationRef?.getHistory() || [];
123
+ },
124
+ };
125
+
126
+ // 便捷方法
127
+ export const {
128
+ success,
129
+ info,
130
+ warning,
131
+ error,
132
+ destroyAll,
133
+ pauseAll,
134
+ resumeAll,
135
+ } = notification;
136
+
137
+ // 默认导出
138
+ export default Notification;
139
+
140
+ // 导出类型工具
141
+ export type {
142
+ // 通知类型
143
+ NotificationType as Type,
144
+ NotificationPlacement as Placement,
145
+ NotificationAnimation as Animation,
146
+
147
+ // 通知接口
148
+ NotificationItem as Item,
149
+ NotificationProps as Props,
150
+ NotificationManagerProps as ManagerProps,
151
+ NotificationRef as Ref,
152
+ NotificationManagerRef as ManagerRef,
153
+ } from './Notification.types';
154
+
155
+ // 导出全局通知对象
156
+ export { notification };
157
+
158
+ // 组件 displayName
159
+ if (typeof Notification !== 'undefined') {
160
+ (Notification as any).displayName = 'Notification';
161
+ }
162
+ if (typeof NotificationManager !== 'undefined') {
163
+ (NotificationManager as any).displayName = 'NotificationManager';
164
+ }