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,500 @@
1
+ import { PlatformDetector } from '../../../utils';
2
+ import type { TextProps, TextSize, TextWeight, TextColor, TextStatus } from './Text.types';
3
+
4
+ /** 样式工具类 */
5
+ export class TextStyles {
6
+ /** 获取平台前缀 */
7
+ private static getPlatformPrefix(): string {
8
+ const platformValue = PlatformDetector.getPlatform();
9
+ // For test environment, default to h5
10
+ if (process.env['NODE_ENV'] === 'test' || platformValue === 'unknown') {
11
+ return 'taro-uno-h5-text';
12
+ }
13
+ return `taro-uno-${platformValue}-text`;
14
+ }
15
+
16
+ /** 尺寸映射 */
17
+ static readonly SIZE_MAP: Record<TextSize, { fontSize: number; _lineHeight: number }> = {
18
+ xs: { fontSize: 20, _lineHeight: 1.25 },
19
+ sm: { fontSize: 24, _lineHeight: 1.375 },
20
+ md: { fontSize: 28, _lineHeight: 1.5 },
21
+ lg: { fontSize: 32, _lineHeight: 1.625 },
22
+ xl: { fontSize: 36, _lineHeight: 1.75 },
23
+ '2xl': { fontSize: 40, _lineHeight: 1.875 },
24
+ '3xl': { fontSize: 48, _lineHeight: 2 },
25
+ '4xl': { fontSize: 56, _lineHeight: 2.125 },
26
+ '5xl': { fontSize: 64, _lineHeight: 2.25 },
27
+ '6xl': { fontSize: 72, _lineHeight: 2.375 },
28
+ '7xl': { fontSize: 80, _lineHeight: 2.5 },
29
+ '8xl': { fontSize: 96, _lineHeight: 2.625 },
30
+ '9xl': { fontSize: 112, _lineHeight: 2.75 },
31
+ };
32
+
33
+ /** 权重映射 */
34
+ static readonly WEIGHT_MAP: Record<TextWeight, number> = {
35
+ thin: 100,
36
+ extralight: 200,
37
+ light: 300,
38
+ normal: 400,
39
+ medium: 500,
40
+ semibold: 600,
41
+ bold: 700,
42
+ extrabold: 800,
43
+ black: 900,
44
+ };
45
+
46
+ /** 颜色映射 */
47
+ static readonly COLOR_MAP: Record<TextColor, string> = {
48
+ primary: '#0ea5e9',
49
+ secondary: '#6b7280',
50
+ success: '#22c55e',
51
+ warning: '#f59e0b',
52
+ error: '#ef4444',
53
+ info: '#3b82f6',
54
+ _disabled: '#9ca3af',
55
+ inherit: 'inherit',
56
+ current: 'currentColor',
57
+ };
58
+
59
+ /** 状态映射 */
60
+ static readonly STATUS_MAP: Record<TextStatus, { opacity: number; cursor: string; pointerEvents: string }> = {
61
+ normal: { opacity: 1, cursor: 'default', pointerEvents: 'auto' },
62
+ active: { opacity: 0.8, cursor: 'pointer', pointerEvents: 'auto' },
63
+ disabled: { opacity: 0.5, cursor: 'not-allowed', pointerEvents: 'none' },
64
+ loading: { opacity: 0.7, cursor: 'not-allowed', pointerEvents: 'none' },
65
+ };
66
+
67
+ /** 行高映射 */
68
+ static readonly LINE_HEIGHT_MAP: Record<string, number> = {
69
+ none: 1,
70
+ tight: 1.25,
71
+ snug: 1.375,
72
+ normal: 1.5,
73
+ relaxed: 1.625,
74
+ loose: 1.75,
75
+ };
76
+
77
+ /** 字母间距映射 */
78
+ static readonly LETTER_SPACING_MAP: Record<string, string> = {
79
+ tighter: '-0.05em',
80
+ tight: '-0.025em',
81
+ normal: '0',
82
+ wide: '0.025em',
83
+ wider: '0.05em',
84
+ widest: '0.1em',
85
+ };
86
+
87
+ /** 生成文本类名 */
88
+ static getClassName(props: Partial<TextProps>): string {
89
+ const prefix = this.getPlatformPrefix();
90
+ const {
91
+ size = 'md',
92
+ weight = 'normal',
93
+ color = 'inherit',
94
+ align = 'left',
95
+ decoration = 'none',
96
+ transform = 'none',
97
+ overflow = 'clip',
98
+ direction = 'ltr',
99
+ fontStyle = 'normal',
100
+ variant = 'normal',
101
+ status = 'normal',
102
+ type = 'body',
103
+ clickable = false,
104
+ loading = false,
105
+ disabled = false,
106
+ block = false,
107
+ inlineBlock = false,
108
+ selectable = false,
109
+ copyable = false,
110
+ animated = false,
111
+ underline = false,
112
+ strikethrough = false,
113
+ highlight = false,
114
+ ellipsis = false,
115
+ wrap = true,
116
+ breakWord = false,
117
+ className = '',
118
+ } = props;
119
+
120
+ const classes = [
121
+ prefix,
122
+ `${prefix}--${size}`,
123
+ `${prefix}--${weight}`,
124
+ `${prefix}--${color}`,
125
+ `${prefix}--${align}`,
126
+ `${prefix}--${decoration}`,
127
+ `${prefix}--${transform}`,
128
+ `${prefix}--${overflow}`,
129
+ `${prefix}--${direction}`,
130
+ `${prefix}--${fontStyle}`,
131
+ `${prefix}--${variant}`,
132
+ `${prefix}--${status}`,
133
+ `${prefix}--${type}`,
134
+ clickable && `${prefix}--clickable`,
135
+ loading && `${prefix}--loading`,
136
+ disabled && `${prefix}--disabled`,
137
+ block && `${prefix}--block`,
138
+ inlineBlock && `${prefix}--inline-block`,
139
+ selectable && `${prefix}--selectable`,
140
+ copyable && `${prefix}--copyable`,
141
+ animated && `${prefix}--animated`,
142
+ underline && `${prefix}--underline`,
143
+ strikethrough && `${prefix}--strikethrough`,
144
+ highlight && `${prefix}--highlight`,
145
+ ellipsis && `${prefix}--ellipsis`,
146
+ wrap && `${prefix}--wrap`,
147
+ breakWord && `${prefix}--break-word`,
148
+ className,
149
+ ].filter(Boolean);
150
+
151
+ return classes.join(' ');
152
+ }
153
+
154
+ /** 生成文本样式 */
155
+ static getStyle(props: Partial<TextProps>): React.CSSProperties {
156
+ const {
157
+ size = 'md',
158
+ weight = 'normal',
159
+ color = 'inherit',
160
+ align = 'left',
161
+ decoration = 'none',
162
+ transform = 'none',
163
+ overflow = 'clip',
164
+ direction = 'ltr',
165
+ fontStyle = 'normal',
166
+ variant = 'normal',
167
+ letterSpacing,
168
+ lineHeight,
169
+ status = 'normal',
170
+ loading = false,
171
+ disabled = false,
172
+ maxLines,
173
+ animated = false,
174
+ animationDuration = 300,
175
+ underline = false,
176
+ strikethrough = false,
177
+ highlight = false,
178
+ highlightColor = '#fef3c7',
179
+ ellipsis = false,
180
+ wrap = true,
181
+ breakWord = false,
182
+ textShadow,
183
+ textOutline,
184
+ gradient,
185
+ fontFamily,
186
+ wordSpacing,
187
+ textIndent,
188
+ whiteSpace,
189
+ verticalAlign,
190
+ writingMode,
191
+ textRendering,
192
+ style = {},
193
+ } = props;
194
+
195
+ const sizeStyles = this.SIZE_MAP[size];
196
+ const weightStyles = this.WEIGHT_MAP[weight];
197
+ const colorStyles = this.COLOR_MAP[color];
198
+ const statusStyles = this.STATUS_MAP[status];
199
+
200
+ // 处理字母间距
201
+ const _letterSpacingValue =
202
+ typeof letterSpacing === 'string' ? this.LETTER_SPACING_MAP[letterSpacing] : `${letterSpacing}px`;
203
+
204
+ // 处理行高
205
+ const _lineHeightValue = typeof lineHeight === 'string' ? this.LINE_HEIGHT_MAP[lineHeight] : lineHeight;
206
+
207
+ // 处理文本装饰
208
+ const textDecorationValue = [];
209
+ if (underline) textDecorationValue.push('underline');
210
+ if (strikethrough) textDecorationValue.push('line-through');
211
+ const finalDecoration = textDecorationValue.length > 0 ? textDecorationValue.join(' ') : decoration;
212
+
213
+ // 处理渐变背景
214
+ const backgroundStyle = gradient
215
+ ? {
216
+ backgroundImage: `linear-gradient(${gradient.direction || 'to right'}, ${gradient.start}, ${gradient.end})`,
217
+ WebkitBackgroundClip: 'text',
218
+ WebkitTextFillColor: 'transparent',
219
+ backgroundClip: 'text',
220
+ textFillColor: 'transparent',
221
+ }
222
+ : {};
223
+
224
+ // 处理最大行数
225
+ const overflowStyle = maxLines
226
+ ? {
227
+ display: '-webkit-box',
228
+ WebkitBoxOrient: 'vertical' as any,
229
+ WebkitLineClamp: maxLines,
230
+ overflow: 'hidden',
231
+ textOverflow: 'ellipsis',
232
+ }
233
+ : {};
234
+
235
+ // 处理省略号
236
+ const ellipsisStyle = ellipsis
237
+ ? {
238
+ whiteSpace: 'nowrap',
239
+ overflow: 'hidden',
240
+ textOverflow: 'ellipsis',
241
+ }
242
+ : {};
243
+
244
+ // 处理换行
245
+ const wrapStyle = !wrap
246
+ ? {
247
+ whiteSpace: 'nowrap',
248
+ }
249
+ : {};
250
+
251
+ // 处理断词
252
+ const breakWordStyle = breakWord
253
+ ? {
254
+ wordBreak: 'break-word' as any,
255
+ overflowWrap: 'break-word' as any,
256
+ }
257
+ : {};
258
+
259
+ return {
260
+ ...sizeStyles,
261
+ fontWeight: weightStyles,
262
+ color: colorStyles,
263
+ textAlign: align,
264
+ textDecoration: finalDecoration,
265
+ textTransform: transform,
266
+ textOverflow: overflow,
267
+ direction,
268
+ fontStyle,
269
+ fontVariant: variant,
270
+ letterSpacing: _letterSpacingValue,
271
+ lineHeight: _lineHeightValue,
272
+ opacity: (loading || disabled) ? statusStyles['opacity'] : 1,
273
+ cursor: (loading || disabled) ? statusStyles['cursor'] : 'default',
274
+ pointerEvents: ((loading || disabled) ? statusStyles['pointerEvents'] : 'auto') as any,
275
+ transition: animated ? `all ${animationDuration}ms ease-in-out` : 'none',
276
+ backgroundColor: highlight ? highlightColor : 'transparent',
277
+ textShadow,
278
+ WebkitTextStroke: textOutline ? `${textOutline}px currentColor` : undefined,
279
+ fontFamily: Array.isArray(fontFamily) ? fontFamily.join(', ') : fontFamily,
280
+ wordSpacing: typeof wordSpacing === 'number' ? `${wordSpacing}px` : wordSpacing,
281
+ textIndent: typeof textIndent === 'number' ? `${textIndent}px` : textIndent,
282
+ whiteSpace,
283
+ verticalAlign,
284
+ writingMode,
285
+ textRendering,
286
+ ...backgroundStyle,
287
+ ...overflowStyle,
288
+ ...ellipsisStyle,
289
+ ...wrapStyle,
290
+ ...breakWordStyle,
291
+ ...style,
292
+ };
293
+ }
294
+
295
+ /** 生成链接样式 */
296
+ static getLinkStyle(props: {
297
+ color?: string;
298
+ underline?: boolean;
299
+ visited?: boolean;
300
+ active?: boolean;
301
+ hover?: boolean;
302
+ }): React.CSSProperties {
303
+ const { color = '#0ea5e9', underline = true, visited, active, hover } = props;
304
+
305
+ return {
306
+ color: visited ? '#7c3aed' : active ? '#0369a1' : hover ? '#0284c7' : color,
307
+ textDecoration: underline ? 'underline' : 'none',
308
+ cursor: 'pointer',
309
+ transition: 'color 0.2s ease-in-out',
310
+ };
311
+ }
312
+
313
+ /** 生成代码样式 */
314
+ static getCodeStyle(props: { variant?: 'inline' | 'block'; language?: string }): React.CSSProperties {
315
+ const { variant = 'inline' } = props;
316
+
317
+ const baseStyle: React.CSSProperties = {
318
+ fontFamily: 'Monaco, Menlo, "Ubuntu Mono", monospace',
319
+ fontSize: '0.875em',
320
+ backgroundColor: '#f3f4f6',
321
+ padding: variant === 'inline' ? '0.125em 0.25em' : '0.5em',
322
+ borderRadius: '0.25em',
323
+ border: '1px solid #e5e7eb',
324
+ };
325
+
326
+ if (variant === 'block') {
327
+ return {
328
+ ...baseStyle,
329
+ display: 'block',
330
+ padding: '1em',
331
+ overflowX: 'auto',
332
+ whiteSpace: 'pre',
333
+ };
334
+ }
335
+
336
+ return baseStyle;
337
+ }
338
+
339
+ /** 生成引用样式 */
340
+ static getQuoteStyle(props: {
341
+ variant?: 'solid' | 'dashed' | 'dotted';
342
+ position?: 'left' | 'right';
343
+ }): React.CSSProperties {
344
+ const { variant = 'solid', position = 'left' } = props;
345
+
346
+ return {
347
+ fontStyle: 'italic',
348
+ borderLeft: position === 'left' ? `4px ${variant} #e5e7eb` : 'none',
349
+ borderRight: position === 'right' ? `4px ${variant} #e5e7eb` : 'none',
350
+ paddingLeft: position === 'left' ? '1em' : '0',
351
+ paddingRight: position === 'right' ? '1em' : '0',
352
+ margin: '1em 0',
353
+ color: '#6b7280',
354
+ };
355
+ }
356
+
357
+ /** 生成标题样式 */
358
+ static getHeadingStyle(level: 1 | 2 | 3 | 4 | 5 | 6): React.CSSProperties {
359
+ const styles = {
360
+ 1: { fontSize: '2.5em', fontWeight: 800, _lineHeight: 1.2, marginBottom: '0.5em' },
361
+ 2: { fontSize: '2em', fontWeight: 700, _lineHeight: 1.3, marginBottom: '0.5em' },
362
+ 3: { fontSize: '1.75em', fontWeight: 600, _lineHeight: 1.4, marginBottom: '0.5em' },
363
+ 4: { fontSize: '1.5em', fontWeight: 600, _lineHeight: 1.5, marginBottom: '0.5em' },
364
+ 5: { fontSize: '1.25em', fontWeight: 500, _lineHeight: 1.6, marginBottom: '0.5em' },
365
+ 6: { fontSize: '1em', fontWeight: 500, _lineHeight: 1.7, marginBottom: '0.5em' },
366
+ };
367
+
368
+ return styles[level];
369
+ }
370
+
371
+ /** 生成加载动画样式 */
372
+ static getLoadingStyle(): React.CSSProperties {
373
+ return {
374
+ display: 'inline-block',
375
+ width: '1em',
376
+ height: '1em',
377
+ border: '2px solid transparent',
378
+ borderTopColor: 'currentColor',
379
+ borderRadius: '50%',
380
+ animation: 'spin 1s linear infinite',
381
+ verticalAlign: 'middle',
382
+ marginRight: '0.5em',
383
+ };
384
+ }
385
+
386
+ /** 生成CSS变量 */
387
+ static generateCSSVariables(): string {
388
+ return `
389
+ :root {
390
+ --text-primary-color: #0ea5e9;
391
+ --text-secondary-color: #6b7280;
392
+ --text-success-color: #22c55e;
393
+ --text-warning-color: #f59e0b;
394
+ --text-error-color: #ef4444;
395
+ --text-info-color: #3b82f6;
396
+ --text-_disabled-color: #9ca3af;
397
+ --text-_disabled-opacity: 0.5;
398
+ --text-_loading-opacity: 0.7;
399
+ --text-animation-duration: 300ms;
400
+ --text-highlight-color: #fef3c7;
401
+ --text-link-color: #0ea5e9;
402
+ --text-link-hover-color: #0284c7;
403
+ --text-link-visited-color: #7c3aed;
404
+ --text-code-background: #f3f4f6;
405
+ --text-code-border: #e5e7eb;
406
+ --text-quote-border: #e5e7eb;
407
+ --text-quote-color: #6b7280;
408
+ }
409
+ `;
410
+ }
411
+
412
+ /** 生成关键帧动画 */
413
+ static generateKeyframes(): string {
414
+ return `
415
+ @keyframes spin {
416
+ from {
417
+ transform: rotate(0deg);
418
+ }
419
+ to {
420
+ transform: rotate(360deg);
421
+ }
422
+ }
423
+
424
+ @keyframes pulse {
425
+ 0%, 100% {
426
+ opacity: 1;
427
+ }
428
+ 50% {
429
+ opacity: 0.5;
430
+ }
431
+ }
432
+
433
+ @keyframes fadeIn {
434
+ from {
435
+ opacity: 0;
436
+ transform: translateY(10px);
437
+ }
438
+ to {
439
+ opacity: 1;
440
+ transform: translateY(0);
441
+ }
442
+ }
443
+
444
+ @keyframes slideIn {
445
+ from {
446
+ transform: translateX(-100%);
447
+ }
448
+ to {
449
+ transform: translateX(0);
450
+ }
451
+ }
452
+
453
+ @keyframes typewriter {
454
+ from {
455
+ width: 0;
456
+ }
457
+ to {
458
+ width: 100%;
459
+ }
460
+ }
461
+
462
+ @keyframes blink {
463
+ 0%, 50% {
464
+ opacity: 1;
465
+ }
466
+ 51%, 100% {
467
+ opacity: 0;
468
+ }
469
+ }
470
+ `;
471
+ }
472
+
473
+ /** 获取尺寸类名 */
474
+ static getSizeClassName(size: TextSize): string {
475
+ return `taro-uno-text--${size}`;
476
+ }
477
+
478
+ /** 获取权重类名 */
479
+ static getWeightClassName(weight: TextWeight): string {
480
+ return `taro-uno-text--${weight}`;
481
+ }
482
+
483
+ /** 获取颜色类名 */
484
+ static getColorClassName(color: TextColor): string {
485
+ return `taro-uno-text--${color}`;
486
+ }
487
+
488
+ /** 获取状态类名 */
489
+ static getStatusClassName(status: TextStatus): string {
490
+ return `taro-uno-text--${status}`;
491
+ }
492
+
493
+ /** 获取类型类名 */
494
+ static getTypeClassName(type: string): string {
495
+ return `taro-uno-text--${type}`;
496
+ }
497
+ }
498
+
499
+ /** 导出样式工具 */
500
+ export const textStyles = TextStyles;