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
@@ -0,0 +1,229 @@
1
+ /**
2
+ * Icon Manager
3
+ * Unified management of icon sets and utility functions for the Icon component
4
+ */
5
+
6
+ import type { IconSet, IconSource, IconType, IconTheme } from './Icon.types';
7
+ import {
8
+ basicOutlinedIcons,
9
+ basicFilledIcons,
10
+ navigationOutlinedIcons,
11
+ actionOutlinedIcons,
12
+ statusColoredIcons,
13
+ socialColoredIcons,
14
+ } from './Icon.data';
15
+
16
+ /**
17
+ * Icon Manager class
18
+ * Provides methods for managing and accessing icon sets
19
+ */
20
+ export class IconManager {
21
+ private allIcons: IconSet[] = [];
22
+ private iconMap: Map<string, IconSet> = new Map();
23
+ private iconLibrary: Map<string, Map<string, IconSet>> = new Map();
24
+
25
+ constructor() {
26
+ // Register all icon sets
27
+ this.registerIcons(basicOutlinedIcons, 'basic', 'outlined');
28
+ this.registerIcons(basicFilledIcons, 'basic', 'filled');
29
+ this.registerIcons(navigationOutlinedIcons, 'navigation', 'outlined');
30
+ this.registerIcons(actionOutlinedIcons, 'action', 'outlined');
31
+ this.registerIcons(statusColoredIcons, 'status', 'colored');
32
+ this.registerIcons(socialColoredIcons, 'social', 'colored');
33
+ }
34
+
35
+ /**
36
+ * Register icon set with category and theme
37
+ */
38
+ registerIcons(icons: IconSet[], category: string, theme: IconTheme) {
39
+ icons.forEach((icon) => {
40
+ // Add category and theme if not already present
41
+ const iconWithMeta = {
42
+ ...icon,
43
+ category: icon.category || category,
44
+ theme: icon.theme || theme,
45
+ };
46
+
47
+ // Store in all icons array
48
+ this.allIcons.push(iconWithMeta);
49
+
50
+ // Create unique key for icon map
51
+ const key = `${iconWithMeta.name}:${iconWithMeta.theme}:${iconWithMeta.category}`;
52
+ this.iconMap.set(key, iconWithMeta);
53
+
54
+ // Store in category map
55
+ if (!this.iconLibrary.has(category)) {
56
+ this.iconLibrary.set(category, new Map());
57
+ }
58
+ const categoryMap = this.iconLibrary.get(category)!;
59
+ categoryMap.set(iconWithMeta.name, iconWithMeta);
60
+ });
61
+ }
62
+
63
+ /**
64
+ * Get icon by name, theme, and category
65
+ */
66
+ getIcon(name: string, theme: IconTheme = 'outlined', category: string = 'basic'): IconSet | undefined {
67
+ const key = `${name}:${theme}:${category}`;
68
+ return this.iconMap.get(key);
69
+ }
70
+
71
+ /**
72
+ * Get all icons
73
+ */
74
+ getAllIcons(): IconSet[] {
75
+ return this.allIcons;
76
+ }
77
+
78
+ /**
79
+ * Get icons by category
80
+ */
81
+ getIconsByCategory(category: string): IconSet[] {
82
+ const categoryMap = this.iconLibrary.get(category);
83
+ if (!categoryMap) return [];
84
+ return Array.from(categoryMap.values());
85
+ }
86
+
87
+ /**
88
+ * Get icons by theme
89
+ */
90
+ getIconsByTheme(theme: IconTheme): IconSet[] {
91
+ return this.allIcons.filter((icon) => icon.theme === theme);
92
+ }
93
+
94
+ /**
95
+ * Get icons by type
96
+ */
97
+ getIconsByType(type: IconType): IconSet[] {
98
+ return this.allIcons.filter((icon) => icon.type === type);
99
+ }
100
+
101
+ /**
102
+ * Search icons by name or tags
103
+ */
104
+ searchIcons(query: string): IconSet[] {
105
+ const lowerQuery = query.toLowerCase();
106
+ return this.allIcons.filter((icon) => {
107
+ return (
108
+ icon.name.toLowerCase().includes(lowerQuery) ||
109
+ icon.tags?.some((tag) => tag.toLowerCase().includes(lowerQuery)) ||
110
+ icon.category?.toLowerCase().includes(lowerQuery)
111
+ );
112
+ });
113
+ }
114
+
115
+ /**
116
+ * Get icon source by name
117
+ */
118
+ getIconSource(name: string, theme: IconTheme = 'outlined', category: string = 'basic'): IconSource | undefined {
119
+ const icon = this.getIcon(name, theme, category);
120
+ return icon?.data;
121
+ }
122
+
123
+ /**
124
+ * Get all categories
125
+ */
126
+ getCategories(): string[] {
127
+ return Array.from(this.iconLibrary.keys());
128
+ }
129
+
130
+ /**
131
+ * Get all themes
132
+ */
133
+ getThemes(): IconTheme[] {
134
+ const themes = new Set<IconTheme>();
135
+ this.allIcons.forEach((icon) => {
136
+ if (icon.theme) {
137
+ themes.add(icon.theme);
138
+ }
139
+ });
140
+ return Array.from(themes);
141
+ }
142
+
143
+ /**
144
+ * Check if icon exists
145
+ */
146
+ hasIcon(name: string, theme: IconTheme = 'outlined', category: string = 'basic'): boolean {
147
+ return this.getIcon(name, theme, category) !== undefined;
148
+ }
149
+
150
+ /**
151
+ * Get icon by name with automatic theme and category detection
152
+ */
153
+ findIcon(name: string): IconSet | undefined {
154
+ // Try to find icon in any theme and category
155
+ for (const [_, icon] of this.iconMap.entries()) {
156
+ if (icon.name === name) {
157
+ return icon;
158
+ }
159
+ }
160
+ return undefined;
161
+ }
162
+
163
+ /**
164
+ * Get icon statistics
165
+ */
166
+ getStats() {
167
+ return {
168
+ totalIcons: this.allIcons.length,
169
+ categories: this.getCategories().length,
170
+ themes: this.getThemes().length,
171
+ byCategory: Object.fromEntries(
172
+ this.getCategories().map((category) => [category, this.getIconsByCategory(category).length]),
173
+ ),
174
+ byTheme: Object.fromEntries(this.getThemes().map((theme) => [theme, this.getIconsByTheme(theme).length])),
175
+ };
176
+ }
177
+ }
178
+
179
+ /**
180
+ * Create and export default IconManager instance
181
+ */
182
+ export const iconManager = new IconManager();
183
+
184
+ /**
185
+ * Icon utility functions
186
+ */
187
+ export const IconUtils = {
188
+ /**
189
+ * Get icon source by name
190
+ */
191
+ getIcon(name: string, theme: IconTheme = 'outlined', category: string = 'basic'): IconSource | undefined {
192
+ return iconManager.getIconSource(name, theme, category);
193
+ },
194
+
195
+ /**
196
+ * Check if icon exists
197
+ */
198
+ hasIcon(name: string, theme: IconTheme = 'outlined', category: string = 'basic'): boolean {
199
+ return iconManager.hasIcon(name, theme, category);
200
+ },
201
+
202
+ /**
203
+ * Get all icons
204
+ */
205
+ getAllIcons(): IconSet[] {
206
+ return iconManager.getAllIcons();
207
+ },
208
+
209
+ /**
210
+ * Search icons
211
+ */
212
+ searchIcons(query: string): IconSet[] {
213
+ return iconManager.searchIcons(query);
214
+ },
215
+
216
+ /**
217
+ * Get icon by name with automatic detection
218
+ */
219
+ findIcon(name: string): IconSet | undefined {
220
+ return iconManager.findIcon(name);
221
+ },
222
+
223
+ /**
224
+ * Get icon statistics
225
+ */
226
+ getStats() {
227
+ return iconManager.getStats();
228
+ },
229
+ };
@@ -269,9 +269,9 @@ export class TextStyles {
269
269
  fontVariant: variant,
270
270
  letterSpacing: _letterSpacingValue,
271
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,
272
+ opacity: loading || disabled ? statusStyles['opacity'] : 1,
273
+ cursor: loading || disabled ? statusStyles['cursor'] : 'default',
274
+ pointerEvents: (loading || disabled ? statusStyles['pointerEvents'] : 'auto') as any,
275
275
  transition: animated ? `all ${animationDuration}ms ease-in-out` : 'none',
276
276
  backgroundColor: highlight ? highlightColor : 'transparent',
277
277
  textShadow,
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode, HTMLAttributes } from 'react';
2
- import React from "react"
2
+ import React from 'react';
3
3
  /** 文本尺寸 */
4
4
  export type TextSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | '8xl' | '9xl';
5
5
 
@@ -42,9 +42,19 @@ export type TextVariant =
42
42
  | 'all-petite-caps'
43
43
  | 'unicase'
44
44
  | 'titling-caps'
45
- | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
46
- | 'body1' | 'body2' | 'body'
47
- | 'caption' | 'overline' | 'subtitle1' | 'subtitle2';
45
+ | 'h1'
46
+ | 'h2'
47
+ | 'h3'
48
+ | 'h4'
49
+ | 'h5'
50
+ | 'h6'
51
+ | 'body1'
52
+ | 'body2'
53
+ | 'body'
54
+ | 'caption'
55
+ | 'overline'
56
+ | 'subtitle1'
57
+ | 'subtitle2';
48
58
 
49
59
  /** 文本间距 */
50
60
  export type LetterSpacing = 'tighter' | 'tight' | 'normal' | 'wide' | 'wider' | 'widest' | number;
@@ -217,13 +217,14 @@ export const typographyStyles = {
217
217
  /**
218
218
  * 多行省略号样式
219
219
  */
220
- multiLineEllipsis: (maxRows: number) => ({
221
- display: '-webkit-box',
222
- WebkitBoxOrient: 'vertical',
223
- WebkitLineClamp: maxRows,
224
- overflow: 'hidden',
225
- textOverflow: 'ellipsis',
226
- } as CSSProperties),
220
+ multiLineEllipsis: (maxRows: number) =>
221
+ ({
222
+ display: '-webkit-box',
223
+ WebkitBoxOrient: 'vertical',
224
+ WebkitLineClamp: maxRows,
225
+ overflow: 'hidden',
226
+ textOverflow: 'ellipsis',
227
+ }) as CSSProperties,
227
228
  };
228
229
 
229
230
  /**
@@ -256,7 +257,7 @@ export const calculateTypographyStyles = (props: TypographyProps): CSSProperties
256
257
 
257
258
  // 根据变体设置样式
258
259
  if (variant && variant in typographyStyles['headings']) {
259
- Object.assign(styles, typographyStyles['headings'][variant as keyof typeof typographyStyles['headings']]);
260
+ Object.assign(styles, typographyStyles['headings'][variant as keyof (typeof typographyStyles)['headings']]);
260
261
  } else if (variant === 'p') {
261
262
  Object.assign(styles, typographyStyles['paragraph']);
262
263
  } else if (variant === 'span') {
@@ -343,4 +344,4 @@ export const calculateTypographyStyles = (props: TypographyProps): CSSProperties
343
344
  }
344
345
 
345
346
  return styles;
346
- };
347
+ };
@@ -79,17 +79,20 @@ export const Typography = forwardRef<TypographyRef, TypographyProps>((props, ref
79
79
  const styles = calculateTypographyStyles(props);
80
80
 
81
81
  // 处理点击事件
82
- const handleClick = useCallback((e: React.MouseEvent) => {
83
- if (copyable) {
84
- e.preventDefault();
85
- handleCopy();
86
- } else if (editable) {
87
- e.preventDefault();
88
- handleEdit();
89
- } else {
90
- onClick?.(e);
91
- }
92
- }, [copyable, editable, handleCopy, handleEdit, onClick]);
82
+ const handleClick = useCallback(
83
+ (e: React.MouseEvent) => {
84
+ if (copyable) {
85
+ e.preventDefault();
86
+ handleCopy();
87
+ } else if (editable) {
88
+ e.preventDefault();
89
+ handleEdit();
90
+ } else {
91
+ onClick?.(e);
92
+ }
93
+ },
94
+ [copyable, editable, handleCopy, handleEdit, onClick],
95
+ );
93
96
 
94
97
  // 渲染编辑状态
95
98
  if (isEditing) {
@@ -201,5 +204,4 @@ export const Typography = forwardRef<TypographyRef, TypographyProps>((props, ref
201
204
 
202
205
  Typography.displayName = 'Typography';
203
206
 
204
-
205
- export default Typography;
207
+ export default Typography;
@@ -8,117 +8,117 @@ export interface TypographyProps {
8
8
  * 文本内容
9
9
  */
10
10
  children: ReactNode;
11
-
11
+
12
12
  /**
13
13
  * 文本类型
14
14
  */
15
15
  type?: 'primary' | 'secondary' | 'success' | 'warning' | 'danger';
16
-
16
+
17
17
  /**
18
18
  * 文本变体
19
19
  */
20
20
  variant?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span';
21
-
21
+
22
22
  /**
23
23
  * 文本对齐
24
24
  */
25
25
  align?: 'left' | 'center' | 'right' | 'justify';
26
-
26
+
27
27
  /**
28
28
  * 是否禁用
29
29
  */
30
30
  disabled?: boolean;
31
-
31
+
32
32
  /**
33
33
  * 是否可复制
34
34
  */
35
35
  copyable?: boolean;
36
-
36
+
37
37
  /**
38
38
  * 是否可编辑
39
39
  */
40
40
  editable?: boolean;
41
-
41
+
42
42
  /**
43
43
  * 删除线
44
44
  */
45
45
  delete?: boolean;
46
-
46
+
47
47
  /**
48
48
  * 下划线
49
49
  */
50
50
  underline?: boolean;
51
-
51
+
52
52
  /**
53
53
  * 代码样式
54
54
  */
55
55
  code?: boolean;
56
-
56
+
57
57
  /**
58
58
  * 键盘样式
59
59
  */
60
60
  keyboard?: boolean;
61
-
61
+
62
62
  /**
63
63
  * 粗体
64
64
  */
65
65
  strong?: boolean;
66
-
66
+
67
67
  /**
68
68
  * 斜体
69
69
  */
70
70
  italic?: boolean;
71
-
71
+
72
72
  /**
73
73
  * 自定义类名
74
74
  */
75
75
  className?: string;
76
-
76
+
77
77
  /**
78
78
  * 自定义样式
79
79
  */
80
80
  style?: React.CSSProperties;
81
-
81
+
82
82
  /**
83
83
  * 点击事件
84
84
  */
85
85
  onClick?: (_e: React.MouseEvent) => void;
86
-
86
+
87
87
  /**
88
88
  * 文本大小
89
89
  */
90
90
  size?: TypographySize;
91
-
91
+
92
92
  /**
93
93
  * 文本颜色
94
94
  */
95
95
  color?: TypographyColor;
96
-
96
+
97
97
  /**
98
98
  * 文本权重
99
99
  */
100
100
  weight?: TypographyWeight;
101
-
101
+
102
102
  /**
103
103
  * 省略号
104
104
  */
105
105
  ellipsis?: boolean;
106
-
106
+
107
107
  /**
108
108
  * 最大行数
109
109
  */
110
110
  maxRows?: number;
111
-
111
+
112
112
  /**
113
113
  * 换行
114
114
  */
115
115
  wrap?: boolean;
116
-
116
+
117
117
  /**
118
118
  * 复制回调
119
119
  */
120
120
  onCopy?: () => void;
121
-
121
+
122
122
  /**
123
123
  * 编辑回调
124
124
  */
@@ -133,12 +133,12 @@ export interface TypographyRef {
133
133
  * 获取文本内容
134
134
  */
135
135
  getText: () => string;
136
-
136
+
137
137
  /**
138
138
  * 复制文本
139
139
  */
140
140
  copy: () => void;
141
-
141
+
142
142
  /**
143
143
  * 编辑文本
144
144
  */
@@ -168,12 +168,12 @@ export interface TypographyUtils {
168
168
  * 计算文本样式
169
169
  */
170
170
  calculateStyles: (_props: TypographyProps) => React.CSSProperties;
171
-
171
+
172
172
  /**
173
173
  * 格式化文本
174
174
  */
175
175
  formatText: (_text: string, variant: TypographyProps['variant']) => string;
176
-
176
+
177
177
  /**
178
178
  * 复制到剪贴板
179
179
  */
@@ -198,12 +198,12 @@ export interface TitleProps extends TypographyProps {
198
198
  * 标题级别
199
199
  */
200
200
  level?: 1 | 2 | 3 | 4 | 5 | 6;
201
-
201
+
202
202
  /**
203
203
  * 副标题
204
204
  */
205
205
  subtitle?: ReactNode;
206
-
206
+
207
207
  /**
208
208
  * 标题分隔线
209
209
  */
@@ -218,12 +218,12 @@ export interface ParagraphProps extends TypographyProps {
218
218
  * 段落间距
219
219
  */
220
220
  spacing?: number;
221
-
221
+
222
222
  /**
223
223
  * 首行缩进
224
224
  */
225
225
  indent?: boolean;
226
-
226
+
227
227
  /**
228
228
  * 行高
229
229
  */
@@ -238,27 +238,27 @@ export interface TypographyTextProps extends TypographyProps {
238
238
  * 文本大小
239
239
  */
240
240
  size?: TypographySize;
241
-
241
+
242
242
  /**
243
243
  * 文本颜色
244
244
  */
245
245
  color?: TypographyColor;
246
-
246
+
247
247
  /**
248
248
  * 文本权重
249
249
  */
250
250
  weight?: TypographyWeight;
251
-
251
+
252
252
  /**
253
253
  * 省略号
254
254
  */
255
255
  ellipsis?: boolean;
256
-
256
+
257
257
  /**
258
258
  * 最大行数
259
259
  */
260
260
  maxRows?: number;
261
-
261
+
262
262
  /**
263
263
  * 换行
264
264
  */
@@ -273,24 +273,24 @@ export interface LinkProps extends TypographyProps {
273
273
  * 链接地址
274
274
  */
275
275
  href?: string;
276
-
276
+
277
277
  /**
278
278
  * 目标
279
279
  */
280
280
  target?: '_blank' | '_self' | '_parent' | '_top';
281
-
281
+
282
282
  /**
283
283
  * 是否在新窗口打开
284
284
  */
285
285
  external?: boolean;
286
-
286
+
287
287
  /**
288
288
  * 下划线
289
289
  */
290
290
  underline?: boolean;
291
-
291
+
292
292
  /**
293
293
  * 点击事件
294
294
  */
295
295
  onClick?: (_e: React.MouseEvent) => void;
296
- }
296
+ }
@@ -11,4 +11,4 @@ export type {
11
11
  TypographyTextProps,
12
12
  LinkProps,
13
13
  } from './Typography.types';
14
- export { calculateTypographyStyles, typographyStyles } from './Typography.styles';
14
+ export { calculateTypographyStyles, typographyStyles } from './Typography.styles';