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.
- package/README.md +21 -0
- package/dist/js/{index-DffLRSro.js → index-CDFsvu80.js} +15369 -10741
- package/dist/js/index-CDFsvu80.js.map +1 -0
- package/dist/js/index-DFdcksbe.js.map +1 -1
- package/dist/js/index-DXRIkWX1.js.map +1 -1
- package/dist/js/{index-6NJ3A1Dn.js → index-JffnTUrv.js} +15430 -10801
- package/dist/js/index-JffnTUrv.js.map +1 -0
- package/dist/utils/http/request.d.ts +280 -0
- package/package.json +14 -10
- package/src/components/basic/Button/Button.tsx +53 -13
- package/src/components/basic/Button/Button.types.ts +45 -9
- package/src/components/basic/Divider/Divider.tsx +60 -29
- package/src/components/basic/Icon/Icon.data.ts +474 -0
- package/src/components/basic/Icon/Icon.test.tsx +2 -2
- package/src/components/basic/Icon/Icon.tsx +48 -35
- package/src/components/basic/Icon/IconManager.ts +229 -0
- package/src/components/basic/Text/Text.styles.ts +3 -3
- package/src/components/basic/Text/Text.types.ts +14 -4
- package/src/components/basic/Typography/Typography.styles.ts +10 -9
- package/src/components/basic/Typography/Typography.tsx +15 -13
- package/src/components/basic/Typography/Typography.types.ts +41 -41
- package/src/components/basic/Typography/index.tsx +1 -1
- package/src/components/basic/Video/Video.styles.ts +777 -0
- package/src/components/basic/Video/Video.test.tsx +490 -0
- package/src/components/basic/Video/Video.tsx +1468 -0
- package/src/components/basic/Video/Video.types.ts +500 -0
- package/src/components/basic/Video/index.tsx +26 -0
- package/src/components/basic/index.tsx +13 -15
- package/src/components/common/ErrorBoundary.tsx +1 -1
- package/src/components/common/LazyComponent.tsx +9 -8
- package/src/components/common/SecurityProvider.tsx +2 -14
- package/src/components/common/ThemeProvider.tsx +43 -56
- package/src/components/common/VirtualList.tsx +187 -205
- package/src/components/common/index.tsx +25 -0
- package/src/components/display/Avatar/Avatar.styles.ts +1 -1
- package/src/components/display/Avatar/Avatar.tsx +6 -19
- package/src/components/display/Avatar/Avatar.types.ts +1 -1
- package/src/components/display/Avatar/index.ts +1 -1
- package/src/components/display/Badge/Badge.tsx +3 -16
- package/src/components/display/Badge/Badge.types.ts +1 -1
- package/src/components/display/Badge/index.ts +1 -1
- package/src/components/display/Calendar/Calendar.styles.ts +36 -36
- package/src/components/display/Calendar/Calendar.test.tsx +27 -15
- package/src/components/display/Calendar/Calendar.tsx +56 -35
- package/src/components/display/Calendar/Calendar.types.ts +1 -1
- package/src/components/display/Calendar/index.ts +1 -1
- package/src/components/display/Card/Card.styles.ts +2 -2
- package/src/components/display/Card/Card.test.tsx +6 -4
- package/src/components/display/Card/Card.tsx +1 -1
- package/src/components/display/Card/Card.types.ts +4 -4
- package/src/components/display/Card/index.ts +1 -1
- package/src/components/display/Carousel/Carousel.styles.ts +31 -31
- package/src/components/display/Carousel/Carousel.tsx +34 -39
- package/src/components/display/Carousel/Carousel.types.ts +1 -1
- package/src/components/display/Carousel/index.ts +1 -1
- package/src/components/display/List/List.styles.ts +3 -3
- package/src/components/display/List/List.tsx +0 -1
- package/src/components/display/List/index.ts +1 -1
- package/src/components/display/Rate/Rate.styles.ts +5 -17
- package/src/components/display/Rate/Rate.tsx +6 -14
- package/src/components/display/Rate/Rate.types.ts +4 -3
- package/src/components/display/Rate/index.ts +3 -11
- package/src/components/display/Table/Table.test.tsx +2 -0
- package/src/components/display/Table/Table.tsx +3 -7
- package/src/components/display/Table/Table.types.ts +3 -2
- package/src/components/display/Tag/Tag.styles.ts +31 -31
- package/src/components/display/Tag/Tag.tsx +9 -26
- package/src/components/display/Tag/Tag.types.ts +1 -1
- package/src/components/display/Tag/index.ts +1 -1
- package/src/components/display/Timeline/Timeline.styles.ts +32 -32
- package/src/components/display/Timeline/Timeline.tsx +23 -42
- package/src/components/display/Timeline/Timeline.types.ts +1 -1
- package/src/components/display/Timeline/index.ts +1 -1
- package/src/components/display/index.tsx +33 -29
- package/src/components/feedback/Loading/Loading.tsx +6 -1
- package/src/components/feedback/Loading/index.ts +2 -5
- package/src/components/feedback/Message/Message.styles.ts +3 -3
- package/src/components/feedback/Message/index.ts +2 -5
- package/src/components/feedback/Modal/Modal.styles.ts +1 -1
- package/src/components/feedback/Modal/Modal.tsx +9 -31
- package/src/components/feedback/Modal/Modal.types.ts +12 -2
- package/src/components/feedback/Notification/Notification.styles.ts +49 -39
- package/src/components/feedback/Notification/Notification.test.tsx +1 -1
- package/src/components/feedback/Notification/Notification.tsx +97 -120
- package/src/components/feedback/Notification/Notification.types.ts +11 -8
- package/src/components/feedback/Notification/NotificationManager.tsx +135 -106
- package/src/components/feedback/Notification/index.ts +10 -3
- package/src/components/feedback/Notification/index.tsx +16 -26
- package/src/components/feedback/Progress/Progress.styles.ts +23 -14
- package/src/components/feedback/Progress/Progress.tsx +93 -113
- package/src/components/feedback/Progress/Progress.types.ts +1 -1
- package/src/components/feedback/Progress/index.ts +1 -1
- package/src/components/feedback/Progress/utils/animation.ts +12 -23
- package/src/components/feedback/Progress/utils/index.ts +2 -2
- package/src/components/feedback/Progress/utils/progress-calculator.ts +14 -32
- package/src/components/feedback/Result/Result.styles.ts +29 -29
- package/src/components/feedback/Result/Result.tsx +8 -20
- package/src/components/feedback/Result/Result.types.ts +7 -7
- package/src/components/feedback/Result/index.tsx +1 -1
- package/src/components/feedback/Toast/Toast.styles.ts +1 -1
- package/src/components/feedback/Toast/Toast.tsx +25 -13
- package/src/components/feedback/Tooltip/Tooltip.examples.tsx +21 -44
- package/src/components/feedback/Tooltip/Tooltip.styles.ts +16 -22
- package/src/components/feedback/Tooltip/Tooltip.test.tsx +1 -1
- package/src/components/feedback/Tooltip/Tooltip.tsx +65 -46
- package/src/components/feedback/Tooltip/Tooltip.types.ts +14 -20
- package/src/components/feedback/Tooltip/index.ts +1 -1
- package/src/components/feedback/Tooltip/index.tsx +12 -24
- package/src/components/feedback/index.tsx +54 -42
- package/src/components/form/Cascader/Cascader.styles.ts +2 -2
- package/src/components/form/Cascader/Cascader.tsx +84 -88
- package/src/components/form/Cascader/Cascader.types.ts +49 -50
- package/src/components/form/Cascader/hooks/useCascaderFieldNames.ts +11 -8
- package/src/components/form/Cascader/hooks/useCascaderOptions.ts +73 -55
- package/src/components/form/Cascader/hooks/useCascaderState.ts +31 -25
- package/src/components/form/Cascader/index.ts +1 -1
- package/src/components/form/Cascader/utils/formatDisplayValue.ts +4 -4
- package/src/components/form/Checkbox/Checkbox.styles.ts +83 -84
- package/src/components/form/Checkbox/Checkbox.tsx +2 -9
- package/src/components/form/Checkbox/CheckboxGroup.tsx +7 -7
- package/src/components/form/DatePicker/DatePicker.test.tsx +1 -1
- package/src/components/form/DatePicker/DatePicker.tsx +91 -75
- package/src/components/form/DatePicker/DatePicker.types.ts +4 -1
- package/src/components/form/Form/Form.tsx +66 -504
- package/src/components/form/Form/Form.types.ts +16 -1
- package/src/components/form/Form/useFormLogic.ts +497 -0
- package/src/components/form/Input/Input.styles.ts +8 -1
- package/src/components/form/Input/Input.tsx +55 -291
- package/src/components/form/Input/Input.types.ts +13 -1
- package/src/components/form/Input/useInputLogic.test.ts +82 -0
- package/src/components/form/Input/useInputLogic.ts +260 -0
- package/src/components/form/InputNumber/InputNumber.styles.ts +76 -25
- package/src/components/form/InputNumber/InputNumber.tsx +53 -21
- package/src/components/form/InputNumber/InputNumber.types.ts +21 -3
- package/src/components/form/InputNumber/components/InputNumberClearButton.tsx +3 -11
- package/src/components/form/InputNumber/components/InputNumberControls.tsx +3 -12
- package/src/components/form/InputNumber/hooks/index.ts +1 -1
- package/src/components/form/InputNumber/hooks/useInputNumberState.ts +7 -9
- package/src/components/form/InputNumber/hooks/useInputNumberValidation.ts +18 -17
- package/src/components/form/InputNumber/index.ts +7 -7
- package/src/components/form/Radio/Radio.styles.ts +1 -8
- package/src/components/form/Radio/Radio.tsx +3 -9
- package/src/components/form/Radio/Radio.types.ts +5 -1
- package/src/components/form/Select/Select.styles.ts +5 -1
- package/src/components/form/Select/Select.tsx +15 -15
- package/src/components/form/Select/Select.types.ts +2 -1
- package/src/components/form/Slider/Slider.styles.ts +13 -13
- package/src/components/form/Slider/Slider.tsx +19 -33
- package/src/components/form/Slider/Slider.types.ts +14 -12
- package/src/components/form/Slider/index.tsx +2 -9
- package/src/components/form/Switch/Switch.styles.ts +1 -7
- package/src/components/form/Switch/Switch.tsx +7 -13
- package/src/components/form/Textarea/Textarea.styles.ts +4 -4
- package/src/components/form/Textarea/Textarea.tsx +7 -1
- package/src/components/form/Textarea/Textarea.types.ts +4 -1
- package/src/components/form/TimePicker/TimePicker.styles.ts +8 -12
- package/src/components/form/TimePicker/TimePicker.tsx +122 -100
- package/src/components/form/TimePicker/TimePicker.types.ts +2 -2
- package/src/components/form/TimePicker/index.ts +1 -1
- package/src/components/form/Transfer/Transfer.styles.ts +3 -15
- package/src/components/form/Transfer/Transfer.tsx +146 -134
- package/src/components/form/Transfer/Transfer.types.ts +34 -26
- package/src/components/form/Transfer/components/TransferItem.tsx +55 -62
- package/src/components/form/Transfer/components/TransferList.tsx +212 -199
- package/src/components/form/Transfer/components/TransferOperations.tsx +52 -55
- package/src/components/form/Transfer/components/TransferPagination.tsx +115 -111
- package/src/components/form/Transfer/components/TransferSearch.tsx +52 -55
- package/src/components/form/Transfer/hooks/useTransferData.ts +91 -81
- package/src/components/form/Transfer/hooks/useTransferState.ts +22 -16
- package/src/components/form/Transfer/index.ts +2 -8
- package/src/components/form/Upload/Upload.styles.ts +21 -21
- package/src/components/form/Upload/Upload.tsx +189 -142
- package/src/components/form/Upload/Upload.types.ts +31 -31
- package/src/components/form/Upload/index.tsx +1 -1
- package/src/components/form/index.tsx +60 -29
- package/src/components/index.tsx +0 -1
- package/src/components/layout/Affix/Affix.styles.ts +16 -11
- package/src/components/layout/Affix/Affix.tsx +67 -75
- package/src/components/layout/Affix/Affix.types.ts +18 -18
- package/src/components/layout/Affix/index.tsx +1 -1
- package/src/components/layout/Col/Col.styles.ts +17 -17
- package/src/components/layout/Col/Col.test.tsx +7 -5
- package/src/components/layout/Col/Col.tsx +3 -21
- package/src/components/layout/Col/Col.types.ts +1 -1
- package/src/components/layout/Container/Container.styles.ts +3 -1
- package/src/components/layout/Container/Container.tsx +2 -11
- package/src/components/layout/Grid/Grid.tsx +3 -53
- package/src/components/layout/Layout/Content.tsx +24 -32
- package/src/components/layout/Layout/Footer.tsx +24 -32
- package/src/components/layout/Layout/Header.tsx +24 -32
- package/src/components/layout/Layout/Layout.styles.ts +17 -17
- package/src/components/layout/Layout/Layout.tsx +14 -25
- package/src/components/layout/Layout/Layout.types.ts +29 -29
- package/src/components/layout/Layout/Sider.tsx +44 -56
- package/src/components/layout/Layout/index.tsx +16 -2
- package/src/components/layout/Row/Row.tsx +15 -43
- package/src/components/layout/Space/Space.tsx +3 -11
- package/src/components/layout/Space/Space.types.ts +1 -1
- package/src/components/layout/index.tsx +29 -19
- package/src/components/navigation/Menu/Menu.constants.ts +69 -0
- package/src/components/navigation/Menu/Menu.stories.tsx +107 -0
- package/src/components/navigation/Menu/Menu.styles.ts +25 -37
- package/src/components/navigation/Menu/Menu.tsx +8 -11
- package/src/components/navigation/Menu/Menu.types.ts +2 -2
- package/src/components/navigation/Menu/Menu.utils.ts +17 -17
- package/src/components/navigation/Menu/MenuItem.tsx +9 -11
- package/src/components/navigation/Menu/SubMenu.tsx +8 -6
- package/src/components/navigation/Menu/index.tsx +4 -69
- package/src/components/navigation/NavBar/NavBar.styles.ts +1 -1
- package/src/components/navigation/NavBar/NavBar.tsx +7 -10
- package/src/components/navigation/NavBar/NavBar.types.ts +3 -3
- package/src/components/navigation/NavBar/index.tsx +1 -1
- package/src/components/navigation/Pagination/Pagination.test.tsx +2 -3
- package/src/components/navigation/Pagination/Pagination.tsx +3 -3
- package/src/components/navigation/Pagination/Pagination.types.ts +3 -2
- package/src/components/navigation/Pagination/index.ts +9 -3
- package/src/components/navigation/Steps/Step.tsx +24 -44
- package/src/components/navigation/Steps/Steps.styles.ts +28 -13
- package/src/components/navigation/Steps/Steps.test.tsx +2 -0
- package/src/components/navigation/Steps/Steps.tsx +88 -89
- package/src/components/navigation/Steps/Steps.types.ts +30 -30
- package/src/components/navigation/Steps/index.tsx +1 -1
- package/src/components/navigation/Tabs/Tabs.test.tsx +3 -2
- package/src/components/navigation/Tabs/Tabs.types.ts +4 -3
- package/src/components/navigation/index.tsx +21 -16
- package/src/constants/index.ts +1 -1
- package/src/hooks/index.ts +52 -102
- package/src/hooks/types.ts +4 -5
- package/src/hooks/useAsync.ts +46 -47
- package/src/hooks/useClickOutside.ts +52 -0
- package/src/hooks/useCounter.ts +87 -0
- package/src/hooks/useDebounce.ts +150 -0
- package/src/hooks/useDeepCompareEffect.ts +88 -0
- package/src/hooks/useEventListener.ts +77 -0
- package/src/hooks/useMediaQuery.ts +75 -0
- package/src/hooks/useMutation.ts +233 -0
- package/src/hooks/usePerformance.ts +1 -64
- package/src/hooks/usePlatform.ts +3 -1
- package/src/hooks/usePrevious.ts +25 -0
- package/src/hooks/useRequest.ts +12 -7
- package/src/hooks/useStateManagement.ts +1 -1
- package/src/hooks/useStorage.ts +169 -0
- package/src/hooks/useStyle.ts +8 -2
- package/src/hooks/useToggle.ts +54 -0
- package/src/index.ts +34 -9
- package/src/theme/ThemeProvider.tsx +3 -7
- package/src/theme/ThemeProvider.types.ts +1 -1
- package/src/theme/defaults.ts +1 -1
- package/src/theme/design-system.ts +2 -2
- package/src/theme/design-tokens.ts +85 -99
- package/src/theme/generated/dark-theme.scss +1 -1
- package/src/theme/generated/tokens.scss +82 -18
- package/src/theme/index.ts +8 -29
- package/src/theme/responsive.tsx +36 -34
- package/src/theme/styles.ts +1 -1
- package/src/theme/useThemeUtils.ts +43 -43
- package/src/theme/utils.ts +32 -32
- package/src/theme/variables.ts +70 -51
- package/src/types/accessibility.ts +36 -37
- package/src/types/button.ts +25 -27
- package/src/types/component-props.ts +6 -1
- package/src/types/glob.d.ts +4 -0
- package/src/types/index.ts +2 -2
- package/src/types/standardized-components.ts +9 -3
- package/src/types/utils.ts +13 -23
- package/src/utils/__tests__/responsiveUtils.test.ts +5 -4
- package/src/utils/abort-controller.ts +48 -0
- package/src/utils/cache.ts +2 -6
- package/src/utils/createNamespace.ts +4 -4
- package/src/utils/environment.ts +26 -6
- package/src/utils/error-handler.ts +2 -2
- package/src/utils/errorLogger.ts +16 -20
- package/src/utils/formatUtils.ts +38 -70
- package/src/utils/http/error-codes.ts +314 -0
- package/src/utils/http/http-client.test.ts +63 -0
- package/src/utils/{network → http}/http-client.ts +45 -35
- package/src/utils/http/request-cache.ts +127 -0
- package/src/utils/http/request.ts +954 -0
- package/src/utils/http/taro-adapter.test.ts +74 -0
- package/src/utils/http/taro-adapter.ts +24 -0
- package/src/utils/http/types.ts +414 -0
- package/src/utils/http/web-adapter.ts +33 -0
- package/src/utils/index.ts +5 -8
- package/src/utils/inputValidator.ts +17 -14
- package/src/utils/performance/performance.ts +60 -71
- package/src/utils/responsiveUtils.ts +7 -16
- package/src/utils/rtl-support.ts +29 -19
- package/src/utils/security/api-security.ts +47 -39
- package/src/utils/securityHeaders.ts +61 -67
- package/src/utils/typeHelpers.ts +10 -10
- package/src/utils/types/dataProcessing.ts +93 -92
- package/src/utils/types/typeHelpers.ts +31 -21
- package/src/utils/xssProtection.ts +96 -48
- package/dist/js/index-6NJ3A1Dn.js.map +0 -1
- package/dist/js/index-DffLRSro.js.map +0 -1
- package/src/components/form/Input/Input.enhanced.tsx +0 -732
- package/src/components/navigation/Menu/__tests__/Menu.test.tsx +0 -687
- package/src/components/navigation/Tree/Tree.styles.ts +0 -553
- package/src/components/navigation/Tree/Tree.test.basic.tsx +0 -7
- package/src/components/navigation/Tree/Tree.test.functional.tsx +0 -496
- package/src/components/navigation/Tree/Tree.test.import.check.tsx +0 -6
- package/src/components/navigation/Tree/Tree.test.import.tsx +0 -6
- package/src/components/navigation/Tree/Tree.test.minimal.tsx +0 -5
- package/src/components/navigation/Tree/Tree.test.simple.tsx +0 -30
- package/src/components/navigation/Tree/Tree.test.tsx +0 -908
- package/src/components/navigation/Tree/Tree.test.working.tsx +0 -673
- package/src/components/navigation/Tree/Tree.tsx +0 -600
- package/src/components/navigation/Tree/Tree.types.ts +0 -909
- package/src/components/navigation/Tree/Tree.utils.ts +0 -452
- package/src/components/navigation/Tree/index.ts +0 -33
- package/src/components/navigation/Tree/index.tsx +0 -23
- package/src/utils/network/http-client.test.ts +0 -18
|
@@ -9,63 +9,63 @@ export const resultStyles: Record<string, CSSProperties> = {
|
|
|
9
9
|
padding: '48px 32px',
|
|
10
10
|
textAlign: 'center',
|
|
11
11
|
},
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
iconContainer: {
|
|
14
14
|
marginBottom: '24px',
|
|
15
15
|
},
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
icon: {
|
|
18
18
|
fontSize: '72px',
|
|
19
19
|
fontWeight: 'bold',
|
|
20
20
|
lineHeight: 1,
|
|
21
21
|
},
|
|
22
|
-
|
|
22
|
+
|
|
23
23
|
iconSuccess: {
|
|
24
24
|
color: '#22c55e',
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
iconError: {
|
|
28
28
|
color: '#ef4444',
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
|
|
31
31
|
iconInfo: {
|
|
32
32
|
color: '#0ea5e9',
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
|
|
35
35
|
iconWarning: {
|
|
36
36
|
color: '#f59e0b',
|
|
37
37
|
},
|
|
38
|
-
|
|
38
|
+
|
|
39
39
|
iconLoading: {
|
|
40
40
|
color: '#6b7280',
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
icon404: {
|
|
44
44
|
color: '#6b7280',
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
icon403: {
|
|
48
48
|
color: '#6b7280',
|
|
49
49
|
},
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
icon500: {
|
|
52
52
|
color: '#6b7280',
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
content: {
|
|
56
56
|
display: 'flex',
|
|
57
57
|
flexDirection: 'column',
|
|
58
58
|
alignItems: 'center',
|
|
59
59
|
gap: '16px',
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
|
|
62
62
|
title: {
|
|
63
63
|
fontSize: '24px',
|
|
64
64
|
fontWeight: '600',
|
|
65
65
|
color: '#1f2937',
|
|
66
66
|
margin: 0,
|
|
67
67
|
},
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
subTitle: {
|
|
70
70
|
fontSize: '16px',
|
|
71
71
|
color: '#6b7280',
|
|
@@ -73,67 +73,67 @@ export const resultStyles: Record<string, CSSProperties> = {
|
|
|
73
73
|
lineHeight: 1.5,
|
|
74
74
|
maxWidth: '400px',
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
|
|
77
77
|
children: {
|
|
78
78
|
marginTop: '24px',
|
|
79
79
|
width: '100%',
|
|
80
80
|
},
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
extra: {
|
|
83
83
|
marginTop: '24px',
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
// Status variations
|
|
87
87
|
success: {
|
|
88
88
|
color: '#22c55e',
|
|
89
89
|
},
|
|
90
|
-
|
|
90
|
+
|
|
91
91
|
error: {
|
|
92
92
|
color: '#ef4444',
|
|
93
93
|
},
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
info: {
|
|
96
96
|
color: '#0ea5e9',
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
|
|
99
99
|
warning: {
|
|
100
100
|
color: '#f59e0b',
|
|
101
101
|
},
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
loading: {
|
|
104
104
|
color: '#6b7280',
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
|
|
107
107
|
// Size variations
|
|
108
108
|
small: {
|
|
109
109
|
padding: '24px 16px',
|
|
110
110
|
},
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
smallIcon: {
|
|
113
113
|
fontSize: '48px',
|
|
114
114
|
},
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
smallTitle: {
|
|
117
117
|
fontSize: '18px',
|
|
118
118
|
},
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
smallSubTitle: {
|
|
121
121
|
fontSize: '14px',
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
large: {
|
|
125
125
|
padding: '64px 48px',
|
|
126
126
|
},
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
largeIcon: {
|
|
129
129
|
fontSize: '96px',
|
|
130
130
|
},
|
|
131
|
-
|
|
131
|
+
|
|
132
132
|
largeTitle: {
|
|
133
133
|
fontSize: '32px',
|
|
134
134
|
},
|
|
135
|
-
|
|
135
|
+
|
|
136
136
|
largeSubTitle: {
|
|
137
137
|
fontSize: '18px',
|
|
138
138
|
},
|
|
139
|
-
};
|
|
139
|
+
};
|
|
@@ -187,39 +187,27 @@ export const ResultComponent = forwardRef<ResultRef, ResultProps>((props, ref) =
|
|
|
187
187
|
};
|
|
188
188
|
|
|
189
189
|
return (
|
|
190
|
-
<View
|
|
191
|
-
ref={containerRef}
|
|
192
|
-
style={containerStyle}
|
|
193
|
-
{...restProps}
|
|
194
|
-
>
|
|
190
|
+
<View ref={containerRef} style={containerStyle} {...restProps}>
|
|
195
191
|
<View style={iconContainerStyle}>
|
|
196
192
|
<View style={iconStyle}>
|
|
197
193
|
<Text>{getStatusIcon()}</Text>
|
|
198
194
|
</View>
|
|
199
195
|
</View>
|
|
200
|
-
|
|
196
|
+
|
|
201
197
|
<View style={contentStyle}>
|
|
202
198
|
<View style={titleStyle}>
|
|
203
199
|
<Text>{internalTitle || getStatusText()}</Text>
|
|
204
200
|
</View>
|
|
205
|
-
|
|
201
|
+
|
|
206
202
|
{internalSubTitle && (
|
|
207
203
|
<View style={subTitleStyle}>
|
|
208
204
|
<Text>{internalSubTitle}</Text>
|
|
209
205
|
</View>
|
|
210
206
|
)}
|
|
211
|
-
|
|
212
|
-
{children &&
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
</View>
|
|
216
|
-
)}
|
|
217
|
-
|
|
218
|
-
{extra && (
|
|
219
|
-
<View style={extraStyle}>
|
|
220
|
-
{extra}
|
|
221
|
-
</View>
|
|
222
|
-
)}
|
|
207
|
+
|
|
208
|
+
{children && <View style={childrenStyle}>{children}</View>}
|
|
209
|
+
|
|
210
|
+
{extra && <View style={extraStyle}>{extra}</View>}
|
|
223
211
|
</View>
|
|
224
212
|
</View>
|
|
225
213
|
);
|
|
@@ -230,4 +218,4 @@ ResultComponent.displayName = 'Result';
|
|
|
230
218
|
|
|
231
219
|
/** 导出结果组件 */
|
|
232
220
|
export const Result = ResultComponent;
|
|
233
|
-
export default Result;
|
|
221
|
+
export default Result;
|
|
@@ -57,7 +57,7 @@ export interface ResultConfig {
|
|
|
57
57
|
extraStyle?: React.CSSProperties;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export interface
|
|
60
|
+
export interface ResultUtilsType {
|
|
61
61
|
/** 获取状态对应的颜色 */
|
|
62
62
|
getStatusColor: (_status: ResultStatus) => string;
|
|
63
63
|
/** 获取状态对应的图标 */
|
|
@@ -70,7 +70,7 @@ export interface ResultUtils {
|
|
|
70
70
|
validateStatus: (_status: string) => boolean;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
export const ResultUtils:
|
|
73
|
+
export const ResultUtils: ResultUtilsType = {
|
|
74
74
|
getStatusColor: (status: ResultStatus) => {
|
|
75
75
|
const colorMap = {
|
|
76
76
|
success: '#22c55e',
|
|
@@ -84,7 +84,7 @@ export const ResultUtils: ResultUtils = {
|
|
|
84
84
|
};
|
|
85
85
|
return colorMap[status] || '#6b7280';
|
|
86
86
|
},
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
getStatusIcon: (status: ResultStatus) => {
|
|
89
89
|
const iconMap = {
|
|
90
90
|
success: '✓',
|
|
@@ -98,7 +98,7 @@ export const ResultUtils: ResultUtils = {
|
|
|
98
98
|
};
|
|
99
99
|
return iconMap[status] || '';
|
|
100
100
|
},
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
getStatusTitle: (status: ResultStatus) => {
|
|
103
103
|
const titleMap = {
|
|
104
104
|
success: '成功',
|
|
@@ -112,7 +112,7 @@ export const ResultUtils: ResultUtils = {
|
|
|
112
112
|
};
|
|
113
113
|
return titleMap[status] || status;
|
|
114
114
|
},
|
|
115
|
-
|
|
115
|
+
|
|
116
116
|
formatResultData: (data: any) => {
|
|
117
117
|
return {
|
|
118
118
|
...data,
|
|
@@ -120,9 +120,9 @@ export const ResultUtils: ResultUtils = {
|
|
|
120
120
|
formattedTime: new Date().toLocaleString(),
|
|
121
121
|
};
|
|
122
122
|
},
|
|
123
|
-
|
|
123
|
+
|
|
124
124
|
validateStatus: (status: string) => {
|
|
125
125
|
const validStatuses = ['success', 'error', 'info', 'warning', 'loading', '404', '403', '500'];
|
|
126
126
|
return validStatuses.includes(status);
|
|
127
127
|
},
|
|
128
|
-
};
|
|
128
|
+
};
|
|
@@ -15,7 +15,6 @@ export const ToastComponent = forwardRef<ToastRef, ToastProps>((props, ref) => {
|
|
|
15
15
|
closable = false,
|
|
16
16
|
showIcon = true,
|
|
17
17
|
icon,
|
|
18
|
-
animated = true,
|
|
19
18
|
animationDuration = 300,
|
|
20
19
|
closeable = false,
|
|
21
20
|
onShow,
|
|
@@ -24,7 +23,6 @@ export const ToastComponent = forwardRef<ToastRef, ToastProps>((props, ref) => {
|
|
|
24
23
|
onClick,
|
|
25
24
|
className,
|
|
26
25
|
style,
|
|
27
|
-
...restProps
|
|
28
26
|
} = props;
|
|
29
27
|
|
|
30
28
|
const toastRef = useRef<any>(null);
|
|
@@ -100,7 +98,7 @@ export const ToastComponent = forwardRef<ToastRef, ToastProps>((props, ref) => {
|
|
|
100
98
|
|
|
101
99
|
// 处理点击
|
|
102
100
|
const handleClick = useCallback(
|
|
103
|
-
(event:
|
|
101
|
+
(event: any) => {
|
|
104
102
|
onClick?.(event);
|
|
105
103
|
},
|
|
106
104
|
[onClick],
|
|
@@ -193,7 +191,7 @@ export const ToastComponent = forwardRef<ToastRef, ToastProps>((props, ref) => {
|
|
|
193
191
|
}
|
|
194
192
|
|
|
195
193
|
return (
|
|
196
|
-
<View ref={toastRef} className={toastClassName} style={toastStyle} onClick={handleClick}
|
|
194
|
+
<View ref={toastRef} className={toastClassName} style={toastStyle} onClick={handleClick}>
|
|
197
195
|
{getIcon() && (
|
|
198
196
|
<View className="taro-uno-toast__icon" style={{ marginRight: '8px', fontSize: '16px' }}>
|
|
199
197
|
{getIcon()}
|
|
@@ -203,7 +201,11 @@ export const ToastComponent = forwardRef<ToastRef, ToastProps>((props, ref) => {
|
|
|
203
201
|
<Text>{internalMessage}</Text>
|
|
204
202
|
</View>
|
|
205
203
|
{(closable || closeable) && (
|
|
206
|
-
<View
|
|
204
|
+
<View
|
|
205
|
+
className="taro-uno-toast__close"
|
|
206
|
+
style={{ marginLeft: '8px', fontSize: '16px', color: 'white' }}
|
|
207
|
+
onClick={handleClose}
|
|
208
|
+
>
|
|
207
209
|
×
|
|
208
210
|
</View>
|
|
209
211
|
)}
|
|
@@ -279,8 +281,6 @@ const createGlobalToastContainer = () => {
|
|
|
279
281
|
opacity: 0;
|
|
280
282
|
`;
|
|
281
283
|
|
|
282
|
-
|
|
283
|
-
|
|
284
284
|
// 添加图标
|
|
285
285
|
if (props.showIcon !== false) {
|
|
286
286
|
const iconElement = document.createElement('span');
|
|
@@ -324,30 +324,42 @@ const createGlobalToastContainer = () => {
|
|
|
324
324
|
toastElement.parentNode.removeChild(toastElement);
|
|
325
325
|
}
|
|
326
326
|
}, 300);
|
|
327
|
-
}
|
|
327
|
+
},
|
|
328
328
|
};
|
|
329
329
|
|
|
330
330
|
return globalToastInstance;
|
|
331
331
|
};
|
|
332
332
|
|
|
333
333
|
(Toast as any).info = (config: ToastMethodConfig | string) => {
|
|
334
|
-
return (Toast as any).show(
|
|
334
|
+
return (Toast as any).show(
|
|
335
|
+
typeof config === 'string' ? { message: config, type: 'info' } : { ...config, type: 'info' },
|
|
336
|
+
);
|
|
335
337
|
};
|
|
336
338
|
|
|
337
339
|
(Toast as any).success = (config: ToastMethodConfig | string) => {
|
|
338
|
-
return (Toast as any).show(
|
|
340
|
+
return (Toast as any).show(
|
|
341
|
+
typeof config === 'string' ? { message: config, type: 'success' } : { ...config, type: 'success' },
|
|
342
|
+
);
|
|
339
343
|
};
|
|
340
344
|
|
|
341
345
|
(Toast as any).warning = (config: ToastMethodConfig | string) => {
|
|
342
|
-
return (Toast as any).show(
|
|
346
|
+
return (Toast as any).show(
|
|
347
|
+
typeof config === 'string' ? { message: config, type: 'warning' } : { ...config, type: 'warning' },
|
|
348
|
+
);
|
|
343
349
|
};
|
|
344
350
|
|
|
345
351
|
(Toast as any).error = (config: ToastMethodConfig | string) => {
|
|
346
|
-
return (Toast as any).show(
|
|
352
|
+
return (Toast as any).show(
|
|
353
|
+
typeof config === 'string' ? { message: config, type: 'error' } : { ...config, type: 'error' },
|
|
354
|
+
);
|
|
347
355
|
};
|
|
348
356
|
|
|
349
357
|
(Toast as any).loading = (config: ToastMethodConfig | string) => {
|
|
350
|
-
return (Toast as any).show(
|
|
358
|
+
return (Toast as any).show(
|
|
359
|
+
typeof config === 'string'
|
|
360
|
+
? { message: config, type: 'loading', duration: 0 }
|
|
361
|
+
: { ...config, type: 'loading', duration: 0 },
|
|
362
|
+
);
|
|
351
363
|
};
|
|
352
364
|
|
|
353
365
|
(Toast as any).hide = () => {
|
|
@@ -8,7 +8,7 @@ import { Tooltip } from './Tooltip';
|
|
|
8
8
|
|
|
9
9
|
export const TooltipExamples = () => {
|
|
10
10
|
const [visible, setVisible] = useState(false);
|
|
11
|
-
const tooltipRef = useRef
|
|
11
|
+
const tooltipRef = useRef<any>(null);
|
|
12
12
|
|
|
13
13
|
return (
|
|
14
14
|
<div className="p-8 space-y-8">
|
|
@@ -180,10 +180,7 @@ export const TooltipExamples = () => {
|
|
|
180
180
|
<Tooltip title="受控 Tooltip" visible={visible}>
|
|
181
181
|
<button className="px-4 py-2 bg-purple-500 text-white rounded">受控模式</button>
|
|
182
182
|
</Tooltip>
|
|
183
|
-
<button
|
|
184
|
-
onClick={() => setVisible(!visible)}
|
|
185
|
-
className="px-4 py-2 bg-gray-500 text-white rounded"
|
|
186
|
-
>
|
|
183
|
+
<button onClick={() => setVisible(!visible)} className="px-4 py-2 bg-gray-500 text-white rounded">
|
|
187
184
|
{visible ? '隐藏' : '显示'}
|
|
188
185
|
</button>
|
|
189
186
|
</div>
|
|
@@ -200,7 +197,7 @@ export const TooltipExamples = () => {
|
|
|
200
197
|
color: 'white',
|
|
201
198
|
borderRadius: '8px',
|
|
202
199
|
padding: '16px',
|
|
203
|
-
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)'
|
|
200
|
+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
|
|
204
201
|
}}
|
|
205
202
|
>
|
|
206
203
|
<button className="px-4 py-2 bg-blue-500 text-white rounded">自定义样式</button>
|
|
@@ -211,7 +208,7 @@ export const TooltipExamples = () => {
|
|
|
211
208
|
arrow
|
|
212
209
|
popupStyle={{
|
|
213
210
|
backgroundColor: '#ff6b6b',
|
|
214
|
-
color: 'white'
|
|
211
|
+
color: 'white',
|
|
215
212
|
}}
|
|
216
213
|
>
|
|
217
214
|
<button className="px-4 py-2 bg-green-500 text-white rounded">自定义箭头</button>
|
|
@@ -298,17 +295,11 @@ export const TooltipExamples = () => {
|
|
|
298
295
|
<div className="space-y-2">
|
|
299
296
|
<h3 className="text-lg font-medium">偏移量</h3>
|
|
300
297
|
<div className="flex space-x-4">
|
|
301
|
-
<Tooltip
|
|
302
|
-
title="偏移量 [10, 10]"
|
|
303
|
-
offset={[10, 10]}
|
|
304
|
-
>
|
|
298
|
+
<Tooltip title="偏移量 [10, 10]" offset={[10, 10]}>
|
|
305
299
|
<button className="px-4 py-2 bg-blue-500 text-white rounded">偏移 10px</button>
|
|
306
300
|
</Tooltip>
|
|
307
301
|
|
|
308
|
-
<Tooltip
|
|
309
|
-
title="偏移量 [20, -10]"
|
|
310
|
-
offset={[20, -10]}
|
|
311
|
-
>
|
|
302
|
+
<Tooltip title="偏移量 [20, -10]" offset={[20, -10]}>
|
|
312
303
|
<button className="px-4 py-2 bg-green-500 text-white rounded">偏移 20px</button>
|
|
313
304
|
</Tooltip>
|
|
314
305
|
</div>
|
|
@@ -328,31 +319,19 @@ export const TooltipExamples = () => {
|
|
|
328
319
|
<div className="space-y-2">
|
|
329
320
|
<h3 className="text-lg font-medium">API 调用</h3>
|
|
330
321
|
<div className="flex space-x-4">
|
|
331
|
-
<Tooltip
|
|
332
|
-
title="可通过 ref 调用"
|
|
333
|
-
ref={tooltipRef}
|
|
334
|
-
>
|
|
322
|
+
<Tooltip title="可通过 ref 调用" ref={tooltipRef}>
|
|
335
323
|
<button className="px-4 py-2 bg-purple-500 text-white rounded">API 控制</button>
|
|
336
324
|
</Tooltip>
|
|
337
325
|
|
|
338
|
-
<button
|
|
339
|
-
onClick={() => tooltipRef.current?.show()}
|
|
340
|
-
className="px-4 py-2 bg-green-500 text-white rounded"
|
|
341
|
-
>
|
|
326
|
+
<button onClick={() => tooltipRef.current?.show()} className="px-4 py-2 bg-green-500 text-white rounded">
|
|
342
327
|
显示
|
|
343
328
|
</button>
|
|
344
329
|
|
|
345
|
-
<button
|
|
346
|
-
onClick={() => tooltipRef.current?.hide()}
|
|
347
|
-
className="px-4 py-2 bg-red-500 text-white rounded"
|
|
348
|
-
>
|
|
330
|
+
<button onClick={() => tooltipRef.current?.hide()} className="px-4 py-2 bg-red-500 text-white rounded">
|
|
349
331
|
隐藏
|
|
350
332
|
</button>
|
|
351
333
|
|
|
352
|
-
<button
|
|
353
|
-
onClick={() => tooltipRef.current?.toggle()}
|
|
354
|
-
className="px-4 py-2 bg-gray-500 text-white rounded"
|
|
355
|
-
>
|
|
334
|
+
<button onClick={() => tooltipRef.current?.toggle()} className="px-4 py-2 bg-gray-500 text-white rounded">
|
|
356
335
|
切换
|
|
357
336
|
</button>
|
|
358
337
|
</div>
|
|
@@ -369,11 +348,7 @@ export const TooltipExamples = () => {
|
|
|
369
348
|
<div className="space-y-4">
|
|
370
349
|
<div className="flex items-center space-x-4">
|
|
371
350
|
<label className="w-24">用户名:</label>
|
|
372
|
-
<input
|
|
373
|
-
type="text"
|
|
374
|
-
className="px-3 py-2 border rounded"
|
|
375
|
-
placeholder="请输入用户名"
|
|
376
|
-
/>
|
|
351
|
+
<input type="text" className="px-3 py-2 border rounded" placeholder="请输入用户名" />
|
|
377
352
|
<Tooltip title="用户名长度应为 3-20 个字符">
|
|
378
353
|
<span className="text-gray-400 cursor-help">?</span>
|
|
379
354
|
</Tooltip>
|
|
@@ -381,11 +356,7 @@ export const TooltipExamples = () => {
|
|
|
381
356
|
|
|
382
357
|
<div className="flex items-center space-x-4">
|
|
383
358
|
<label className="w-24">密码:</label>
|
|
384
|
-
<input
|
|
385
|
-
type="password"
|
|
386
|
-
className="px-3 py-2 border rounded"
|
|
387
|
-
placeholder="请输入密码"
|
|
388
|
-
/>
|
|
359
|
+
<input type="password" className="px-3 py-2 border rounded" placeholder="请输入密码" />
|
|
389
360
|
<Tooltip title="密码应包含字母、数字和特殊字符">
|
|
390
361
|
<span className="text-gray-400 cursor-help">?</span>
|
|
391
362
|
</Tooltip>
|
|
@@ -438,15 +409,21 @@ export const TooltipExamples = () => {
|
|
|
438
409
|
<h3 className="text-lg font-medium">链接提示</h3>
|
|
439
410
|
<div className="flex space-x-4">
|
|
440
411
|
<Tooltip title="访问官方网站">
|
|
441
|
-
<a href="#" className="text-blue-500 underline"
|
|
412
|
+
<a href="#" className="text-blue-500 underline">
|
|
413
|
+
官方网站
|
|
414
|
+
</a>
|
|
442
415
|
</Tooltip>
|
|
443
416
|
|
|
444
417
|
<Tooltip title="查看文档">
|
|
445
|
-
<a href="#" className="text-blue-500 underline"
|
|
418
|
+
<a href="#" className="text-blue-500 underline">
|
|
419
|
+
文档
|
|
420
|
+
</a>
|
|
446
421
|
</Tooltip>
|
|
447
422
|
|
|
448
423
|
<Tooltip title="提交问题">
|
|
449
|
-
<a href="#" className="text-blue-500 underline"
|
|
424
|
+
<a href="#" className="text-blue-500 underline">
|
|
425
|
+
问题反馈
|
|
426
|
+
</a>
|
|
450
427
|
</Tooltip>
|
|
451
428
|
</div>
|
|
452
429
|
</div>
|
|
@@ -187,10 +187,11 @@ export const tooltipStyles = {
|
|
|
187
187
|
|
|
188
188
|
// 获取提示框样式
|
|
189
189
|
getTooltipStyle: (placement?: TooltipPlacement, color?: string, overlayStyle?: CSSProperties): CSSProperties => {
|
|
190
|
-
const placementStyle =
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
190
|
+
const placementStyle =
|
|
191
|
+
placement && tooltipStyles['placements'][placement]
|
|
192
|
+
? tooltipStyles['placements'][placement]
|
|
193
|
+
: tooltipStyles['placements'].top;
|
|
194
|
+
|
|
194
195
|
return {
|
|
195
196
|
...tooltipStyles['tooltip'],
|
|
196
197
|
...placementStyle,
|
|
@@ -202,12 +203,12 @@ export const tooltipStyles = {
|
|
|
202
203
|
// 获取箭头样式
|
|
203
204
|
getArrowStyle: (placement?: TooltipPlacement, color?: string, arrow?: boolean): CSSProperties => {
|
|
204
205
|
if (!arrow) return {};
|
|
205
|
-
|
|
206
|
-
const arrowKey = `${placement}Arrow` as keyof typeof tooltipStyles['placements'];
|
|
206
|
+
|
|
207
|
+
const arrowKey = `${placement}Arrow` as keyof (typeof tooltipStyles)['placements'];
|
|
207
208
|
const arrowStyle = tooltipStyles['placements'][arrowKey];
|
|
208
|
-
|
|
209
|
+
|
|
209
210
|
if (!arrowStyle) return {};
|
|
210
|
-
|
|
211
|
+
|
|
211
212
|
return {
|
|
212
213
|
...tooltipStyles['arrow'],
|
|
213
214
|
...arrowStyle,
|
|
@@ -286,30 +287,23 @@ export const tooltipStyles = {
|
|
|
286
287
|
|
|
287
288
|
// 获取主题样式
|
|
288
289
|
getThemeStyle: (theme?: string): CSSProperties => {
|
|
289
|
-
const themeKey = theme as keyof typeof tooltipStyles['themes'];
|
|
290
|
+
const themeKey = theme as keyof (typeof tooltipStyles)['themes'];
|
|
290
291
|
return tooltipStyles['themes'][themeKey] || tooltipStyles['themes'].dark;
|
|
291
292
|
},
|
|
292
293
|
};
|
|
293
294
|
|
|
294
295
|
// CSS 类名工具函数
|
|
295
296
|
export const getTooltipClasses = (placement: TooltipPlacement, visible: boolean): string => {
|
|
296
|
-
const baseClasses = [
|
|
297
|
-
|
|
298
|
-
`tooltip-${placement}`,
|
|
299
|
-
visible ? 'tooltip-visible' : 'tooltip-hidden',
|
|
300
|
-
];
|
|
301
|
-
|
|
297
|
+
const baseClasses = ['tooltip', `tooltip-${placement}`, visible ? 'tooltip-visible' : 'tooltip-hidden'];
|
|
298
|
+
|
|
302
299
|
return baseClasses.join(' ');
|
|
303
300
|
};
|
|
304
301
|
|
|
305
302
|
export const getArrowClasses = (placement: TooltipPlacement, arrow: boolean): string => {
|
|
306
303
|
if (!arrow) return '';
|
|
307
|
-
|
|
308
|
-
const baseClasses = [
|
|
309
|
-
|
|
310
|
-
`tooltip-arrow-${placement}`,
|
|
311
|
-
];
|
|
312
|
-
|
|
304
|
+
|
|
305
|
+
const baseClasses = ['tooltip-arrow', `tooltip-arrow-${placement}`];
|
|
306
|
+
|
|
313
307
|
return baseClasses.join(' ');
|
|
314
308
|
};
|
|
315
309
|
|
|
@@ -343,4 +337,4 @@ export const tooltipCssClasses = {
|
|
|
343
337
|
info: 'tooltip-info',
|
|
344
338
|
};
|
|
345
339
|
|
|
346
|
-
export default tooltipStyles;
|
|
340
|
+
export default tooltipStyles;
|