@digitalc/dxp-ui 0.0.5-alpha.15 → 0.0.5-alpha.17
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 +81 -47
- package/es/assets/token.json +128 -102
- package/es/components/Accordion/designTokens.d.ts +3 -3
- package/es/components/Accordion/designTokens.js +22 -14
- package/es/components/Accordion/index.js +8 -4
- package/es/components/Amount/designTokens.d.ts +2 -2
- package/es/components/Amount/designTokens.js +12 -8
- package/es/components/Amount/index.d.ts +3 -10
- package/es/components/Amount/index.js +122 -136
- package/es/components/Button/designTokens.d.ts +18 -3
- package/es/components/Button/designTokens.js +136 -122
- package/es/components/Button/index.d.ts +16 -5
- package/es/components/Button/index.js +89 -94
- package/es/components/Button/style/index.less +1 -1
- package/es/components/Card/designTokens.d.ts +9 -0
- package/es/components/Card/designTokens.js +14 -0
- package/es/components/Card/index.d.ts +15 -0
- package/es/components/Card/index.js +66 -0
- package/es/components/Card/style/index.less +45 -0
- package/es/components/Card/style/variables.less +4 -0
- package/es/components/Chip/designTokens.d.ts +2 -2
- package/es/components/Chip/designTokens.js +25 -21
- package/es/components/Chip/index.js +9 -8
- package/es/components/Divider/designTokens.d.ts +4 -0
- package/es/components/Divider/designTokens.js +9 -0
- package/es/components/Divider/index.d.ts +3 -8
- package/es/components/Divider/index.js +31 -49
- package/es/components/Drawer/designTokens.d.ts +2 -2
- package/es/components/Drawer/designTokens.js +30 -26
- package/es/components/Drawer/index.d.ts +6 -2
- package/es/components/Drawer/index.js +71 -68
- package/es/components/Drawer/style/index.less +13 -7
- package/es/components/GlobalTokenProvider/index.d.ts +11 -0
- package/es/components/GlobalTokenProvider/index.js +16 -0
- package/es/components/Icon/designTokens.d.ts +3 -3
- package/es/components/Icon/designTokens.js +11 -6
- package/es/components/Icon/index.js +6 -2
- package/es/components/IconButton/designTokens.d.ts +3 -4
- package/es/components/IconButton/designTokens.js +38 -32
- package/es/components/IconButton/index.d.ts +1 -1
- package/es/components/IconButton/index.js +7 -7
- package/es/components/Image/index.d.ts +1 -1
- package/es/components/Image/index.js +4 -3
- package/es/components/ListItem/designTokens.d.ts +4 -2
- package/es/components/ListItem/designTokens.js +36 -30
- package/es/components/ListItem/index.d.ts +12 -2
- package/es/components/ListItem/index.js +95 -30
- package/es/components/ListItem/style/index.less +42 -9
- package/es/components/Modal/designTokens.d.ts +11 -20
- package/es/components/Modal/designTokens.js +39 -30
- package/es/components/Modal/index.js +24 -11
- package/es/components/Navigation/designTokens.d.ts +9 -8
- package/es/components/Navigation/designTokens.js +24 -18
- package/es/components/Navigation/index.d.ts +1 -0
- package/es/components/Navigation/index.js +14 -10
- package/es/components/Notification/designTokens.d.ts +9 -0
- package/es/components/Notification/designTokens.js +14 -0
- package/es/components/Notification/index.d.ts +12 -0
- package/es/components/Notification/index.js +54 -0
- package/es/components/Notification/style/index.less +45 -0
- package/es/components/Notification/style/variables.less +4 -0
- package/es/components/Search/designTokens.d.ts +4 -4
- package/es/components/Search/designTokens.js +57 -46
- package/es/components/Search/index.js +15 -9
- package/es/components/Stepper/designTokens.d.ts +4 -5
- package/es/components/Stepper/designTokens.js +48 -40
- package/es/components/Stepper/index.d.ts +9 -10
- package/es/components/Stepper/index.js +139 -135
- package/es/components/Stepper/style/index.less +27 -12
- package/es/components/StickyFooter/designTokens.d.ts +2 -2
- package/es/components/StickyFooter/designTokens.js +20 -16
- package/es/components/StickyFooter/index.d.ts +2 -2
- package/es/components/StickyFooter/index.js +68 -39
- package/es/components/StickyFooter/style/index.less +5 -3
- package/es/components/Tabs/designTokens.d.ts +6 -6
- package/es/components/Tabs/designTokens.js +77 -60
- package/es/components/Tabs/index.js +11 -6
- package/es/components/Tag/designTokens.d.ts +42 -42
- package/es/components/Tag/designTokens.js +139 -95
- package/es/components/Tag/index.d.ts +1 -1
- package/es/components/Tag/index.js +16 -3
- package/es/components/Text/designTokens.d.ts +19 -10
- package/es/components/Text/designTokens.js +65 -51
- package/es/components/Text/index.d.ts +2 -1
- package/es/components/Text/index.js +42 -12
- package/es/components/TextInputInside/designTokens.d.ts +3 -12
- package/es/components/TextInputInside/designTokens.js +59 -57
- package/es/components/TextInputInside/index.js +10 -7
- package/es/components/TextInputOutside/designTokens.d.ts +5 -5
- package/es/components/TextInputOutside/designTokens.js +77 -61
- package/es/components/TextInputOutside/index.js +12 -7
- package/es/components/TextLink/designTokens.d.ts +2 -2
- package/es/components/TextLink/designTokens.js +14 -10
- package/es/components/TextLink/index.js +2 -1
- package/es/components/Toast/designTokens.d.ts +2 -2
- package/es/components/Toast/designTokens.js +20 -19
- package/es/components/Toast/index.js +2 -1
- package/es/components/Toggle/designTokens.d.ts +2 -2
- package/es/components/Toggle/designTokens.js +16 -12
- package/es/components/Toggle/index.js +2 -1
- package/es/components/index.d.ts +7 -1
- package/es/components/index.js +6 -2
- package/es/constants/index.d.ts +4 -1
- package/es/constants/index.js +5 -1
- package/es/index.d.ts +2 -0
- package/es/index.js +4 -0
- package/es/tokens/DXPGlobal.d.ts +27 -19
- package/es/tokens/DXPGlobal.js +3 -2
- package/es/utils/TokenContext.d.ts +14 -0
- package/es/utils/TokenContext.js +91 -0
- package/es/utils/deviceType.d.ts +14 -0
- package/es/utils/deviceType.js +65 -0
- package/es/utils/index.d.ts +9 -0
- package/es/utils/index.js +9 -0
- package/es/utils/tokenHelper.js +2 -5
- package/es/utils/tokenManager.d.ts +82 -20
- package/es/utils/tokenManager.js +857 -779
- package/lib/assets/token.json +128 -102
- package/lib/components/Accordion/designTokens.d.ts +3 -3
- package/lib/components/Accordion/designTokens.js +25 -17
- package/lib/components/Accordion/index.js +8 -4
- package/lib/components/Amount/designTokens.d.ts +2 -2
- package/lib/components/Amount/designTokens.js +13 -9
- package/lib/components/Amount/index.d.ts +3 -10
- package/lib/components/Amount/index.js +84 -90
- package/lib/components/Button/designTokens.d.ts +18 -3
- package/lib/components/Button/designTokens.js +120 -114
- package/lib/components/Button/index.d.ts +16 -5
- package/lib/components/Button/index.js +59 -51
- package/lib/components/Button/style/index.less +1 -1
- package/lib/components/Card/designTokens.d.ts +9 -0
- package/lib/components/Card/designTokens.js +37 -0
- package/lib/components/Card/index.d.ts +15 -0
- package/lib/components/Card/index.js +156 -0
- package/lib/components/Card/style/index.less +45 -0
- package/lib/components/Card/style/variables.less +4 -0
- package/lib/components/Chip/designTokens.d.ts +2 -2
- package/lib/components/Chip/designTokens.js +25 -21
- package/lib/components/Chip/index.js +8 -5
- package/lib/components/Divider/designTokens.d.ts +4 -0
- package/lib/components/Divider/designTokens.js +32 -0
- package/lib/components/Divider/index.d.ts +3 -8
- package/lib/components/Divider/index.js +41 -43
- package/lib/components/Drawer/designTokens.d.ts +2 -2
- package/lib/components/Drawer/designTokens.js +31 -38
- package/lib/components/Drawer/index.d.ts +6 -2
- package/lib/components/Drawer/index.js +80 -53
- package/lib/components/Drawer/style/index.less +13 -7
- package/lib/components/GlobalTokenProvider/index.d.ts +11 -0
- package/lib/components/GlobalTokenProvider/index.js +40 -0
- package/lib/components/Icon/designTokens.d.ts +3 -3
- package/lib/components/Icon/designTokens.js +11 -17
- package/lib/components/Icon/index.js +5 -4
- package/lib/components/IconButton/designTokens.d.ts +3 -4
- package/lib/components/IconButton/designTokens.js +41 -34
- package/lib/components/IconButton/index.d.ts +1 -1
- package/lib/components/IconButton/index.js +25 -23
- package/lib/components/Image/index.d.ts +1 -1
- package/lib/components/Image/index.js +4 -4
- package/lib/components/ListItem/designTokens.d.ts +4 -2
- package/lib/components/ListItem/designTokens.js +36 -41
- package/lib/components/ListItem/index.d.ts +12 -2
- package/lib/components/ListItem/index.js +115 -46
- package/lib/components/ListItem/style/index.less +42 -9
- package/lib/components/Modal/designTokens.d.ts +11 -20
- package/lib/components/Modal/designTokens.js +44 -60
- package/lib/components/Modal/index.js +63 -16
- package/lib/components/Navigation/designTokens.d.ts +9 -8
- package/lib/components/Navigation/designTokens.js +24 -29
- package/lib/components/Navigation/index.d.ts +1 -0
- package/lib/components/Navigation/index.js +13 -12
- package/lib/components/Notification/designTokens.d.ts +9 -0
- package/lib/components/Notification/designTokens.js +37 -0
- package/lib/components/Notification/index.d.ts +12 -0
- package/lib/components/Notification/index.js +110 -0
- package/lib/components/Notification/style/index.less +45 -0
- package/lib/components/Notification/style/variables.less +4 -0
- package/lib/components/Search/designTokens.d.ts +4 -4
- package/lib/components/Search/designTokens.js +61 -49
- package/lib/components/Search/index.js +31 -9
- package/lib/components/Stepper/designTokens.d.ts +4 -5
- package/lib/components/Stepper/designTokens.js +70 -62
- package/lib/components/Stepper/index.d.ts +9 -10
- package/lib/components/Stepper/index.js +104 -53
- package/lib/components/Stepper/style/index.less +27 -12
- package/lib/components/StickyFooter/designTokens.d.ts +2 -2
- package/lib/components/StickyFooter/designTokens.js +21 -17
- package/lib/components/StickyFooter/index.d.ts +2 -2
- package/lib/components/StickyFooter/index.js +50 -18
- package/lib/components/StickyFooter/style/index.less +5 -3
- package/lib/components/Tabs/designTokens.d.ts +6 -6
- package/lib/components/Tabs/designTokens.js +80 -63
- package/lib/components/Tabs/index.js +19 -12
- package/lib/components/Tag/designTokens.d.ts +42 -42
- package/lib/components/Tag/designTokens.js +159 -115
- package/lib/components/Tag/index.d.ts +1 -1
- package/lib/components/Tag/index.js +27 -14
- package/lib/components/Text/designTokens.d.ts +19 -10
- package/lib/components/Text/designTokens.js +65 -51
- package/lib/components/Text/index.d.ts +2 -1
- package/lib/components/Text/index.js +407 -297
- package/lib/components/TextInputInside/designTokens.d.ts +3 -12
- package/lib/components/TextInputInside/designTokens.js +62 -75
- package/lib/components/TextInputInside/index.js +10 -7
- package/lib/components/TextInputOutside/designTokens.d.ts +5 -5
- package/lib/components/TextInputOutside/designTokens.js +82 -66
- package/lib/components/TextInputOutside/index.js +12 -8
- package/lib/components/TextLink/designTokens.d.ts +2 -2
- package/lib/components/TextLink/designTokens.js +14 -21
- package/lib/components/TextLink/index.js +3 -2
- package/lib/components/Toast/designTokens.d.ts +2 -2
- package/lib/components/Toast/designTokens.js +20 -16
- package/lib/components/Toast/index.js +7 -6
- package/lib/components/Toggle/designTokens.d.ts +2 -2
- package/lib/components/Toggle/designTokens.js +16 -23
- package/lib/components/Toggle/index.js +3 -2
- package/lib/components/index.d.ts +7 -1
- package/lib/components/index.js +10 -2
- package/lib/constants/index.d.ts +4 -1
- package/lib/constants/index.js +5 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +22 -0
- package/lib/tokens/DXPGlobal.d.ts +27 -19
- package/lib/tokens/DXPGlobal.js +1 -1
- package/lib/utils/TokenContext.d.ts +14 -0
- package/lib/utils/TokenContext.js +85 -0
- package/lib/utils/deviceType.d.ts +14 -0
- package/lib/utils/deviceType.js +56 -0
- package/lib/utils/index.d.ts +9 -0
- package/lib/utils/index.js +44 -0
- package/lib/utils/tokenHelper.js +2 -12
- package/lib/utils/tokenManager.d.ts +82 -20
- package/lib/utils/tokenManager.js +840 -777
- package/package.json +14 -11
- package/umd/dxp-ui.min.css +1 -1
- package/umd/dxp-ui.min.js +1 -1
- package/lib/components/Button/demo/index.d.ts +0 -3
- package/lib/components/Button/demo/index.js +0 -138
|
@@ -1,131 +1,145 @@
|
|
|
1
|
-
import {
|
|
2
|
-
/*
|
|
3
|
-
这里是 dxp 的 UI token,缓存在本地的内置变量;
|
|
4
|
-
通过antd 提供的 ConfigProvider 注入了组件级 token 变量来实现 gomo 风格的UI组件;
|
|
1
|
+
import { useDynamicTokens } from "../../utils";
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Button组件的设计Token系统
|
|
5
|
+
*
|
|
6
|
+
* 这里是dxp的UI token,缓存在本地的内置变量;
|
|
7
|
+
* 通过antd提供的ConfigProvider注入组件级token变量来实现gomo风格的UI组件。
|
|
8
|
+
*
|
|
9
|
+
* 样式定制实现方式(理论上可以通过2种方式来实现):
|
|
10
|
+
* 1. 通过ConfigProvider注入组件级别的token变量(当前采用)
|
|
11
|
+
* - 优点:不需要编写less文件,只需对齐变量值
|
|
12
|
+
* - 缺点:可控细节较少,受限于antd提供的token
|
|
13
|
+
*
|
|
14
|
+
* 2. 直接编写less文件覆盖antd样式
|
|
15
|
+
* - 优点:可控细节更多(相当于把 dxp 的 UI token 通过 less 的方式覆盖antd的样式)
|
|
16
|
+
* - 缺点:需要了解组件DOM结构,维护成本高,优先选择第1种
|
|
17
|
+
*/
|
|
14
18
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// colorPrimaryBg: getToken('colorButtonBackgroundPrimary'),
|
|
21
|
-
// 主要按钮文本颜色
|
|
22
|
-
primaryColor: getToken('colorButtonTextPrimary'),
|
|
23
|
-
// 次要按钮背景色 默认是白色
|
|
24
|
-
// 次要按钮文本颜色
|
|
25
|
-
defaultColor: getToken('colorButtonTextSecondary'),
|
|
26
|
-
// 次要按钮边框颜色
|
|
27
|
-
defaultBorderColor: getToken('colorButtonTextSecondary'),
|
|
28
|
-
// 禁用按钮背景色 Hover
|
|
29
|
-
colorBgContainerDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
|
|
30
|
-
borderColorDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
|
|
31
|
-
colorTextDisabled: getToken('colorButtonTextDisabled'),
|
|
32
|
-
// Success 按钮背景色
|
|
33
|
-
green1: getToken('colorButtonBackgroundSuccess'),
|
|
34
|
-
green2: getToken('colorButtonBackgroundSuccess'),
|
|
35
|
-
green3: getToken('colorButtonBackgroundSuccess'),
|
|
36
|
-
green4: getToken('colorButtonBackgroundSuccess'),
|
|
37
|
-
green5: getToken('colorButtonBackgroundSuccess'),
|
|
38
|
-
green6: getToken('colorButtonBackgroundSuccess'),
|
|
39
|
-
green7: getToken('colorButtonBackgroundSuccess'),
|
|
40
|
-
// Inverse 反色配置 token配置不出来,用 inverse 判断处理。
|
|
41
|
-
// ghostBg: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
42
|
-
// defaultGhostBorderColor: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
43
|
-
// groupBorderColor: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
44
|
-
// // 文本按钮的
|
|
45
|
-
// defaultGhostColor: getToken('colorButtonTextPrimaryInverse'),
|
|
46
|
-
// Inverse 反色配置 end
|
|
19
|
+
var useDesignTokens = function useDesignTokens() {
|
|
20
|
+
var getToken = useDynamicTokens();
|
|
21
|
+
return {
|
|
22
|
+
// 算法配置
|
|
23
|
+
// algorithm: true,
|
|
47
24
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
25
|
+
// 主要按钮背景色
|
|
26
|
+
colorPrimary: getToken('colorButtonBackgroundPrimary'),
|
|
27
|
+
// 主要按钮 Hover
|
|
28
|
+
colorPrimaryHover: getToken('colorButtonBackgroundPrimary'),
|
|
29
|
+
colorPrimaryActive: getToken('colorButtonBackgroundPrimary'),
|
|
30
|
+
// colorPrimaryBg: getToken('colorButtonBackgroundPrimary'),
|
|
31
|
+
// 主要按钮文本颜色
|
|
32
|
+
primaryColor: getToken('colorButtonTextPrimary'),
|
|
33
|
+
// 次要按钮背景色 默认是白色
|
|
34
|
+
// 次要按钮文本颜色
|
|
35
|
+
defaultColor: getToken('colorButtonTextSecondary'),
|
|
36
|
+
// 次要按钮边框颜色
|
|
37
|
+
defaultBorderColor: getToken('colorButtonTextSecondary'),
|
|
38
|
+
// 禁用按钮背景色 Hover
|
|
39
|
+
colorBgContainerDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
|
|
40
|
+
borderColorDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
|
|
41
|
+
colorTextDisabled: getToken('colorButtonTextDisabled'),
|
|
42
|
+
// Success 按钮背景色
|
|
43
|
+
green1: getToken('colorButtonBackgroundSuccess'),
|
|
44
|
+
green2: getToken('colorButtonBackgroundSuccess'),
|
|
45
|
+
green3: getToken('colorButtonBackgroundSuccess'),
|
|
46
|
+
green4: getToken('colorButtonBackgroundSuccess'),
|
|
47
|
+
green5: getToken('colorButtonBackgroundSuccess'),
|
|
48
|
+
green6: getToken('colorButtonBackgroundSuccess'),
|
|
49
|
+
green7: getToken('colorButtonBackgroundSuccess'),
|
|
50
|
+
// Inverse 反色配置 token配置不出来,用 inverse 判断处理。
|
|
51
|
+
// ghostBg: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
52
|
+
// defaultGhostBorderColor: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
53
|
+
// groupBorderColor: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
54
|
+
// // 文本按钮的
|
|
55
|
+
// defaultGhostColor: getToken('colorButtonTextPrimaryInverse'),
|
|
56
|
+
// Inverse 反色配置 end
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
// 全局公用的:
|
|
59
|
+
// 按钮圆角
|
|
60
|
+
borderRadius: getToken('borderRadiusButton'),
|
|
61
|
+
borderRadiusSM: getToken('borderRadiusButton'),
|
|
62
|
+
borderRadiusLG: getToken('borderRadiusButton'),
|
|
63
|
+
defaultShadow: '0 0px 0 rgba(0,0,0,0.02)',
|
|
64
|
+
primaryShadow: '0 0 0 rgba(5,145,255,0.1)',
|
|
65
|
+
// gFontFamilySecondaryBold: String = "Roboto"
|
|
66
|
+
// fontWeight700: Font.Weight = .bold 改用 text 组件实现
|
|
67
|
+
// fontWeight: getToken(''),
|
|
68
|
+
// fontfamily: getToken(''),
|
|
69
|
+
|
|
70
|
+
// 边框宽度
|
|
71
|
+
lineWidth: getToken('borderWidthButtonSecondary'),
|
|
72
|
+
// 默认文本按钮的文本色
|
|
73
|
+
textTextColor: getToken('colorButtonTextSecondary'),
|
|
74
|
+
// 按钮内间距
|
|
75
|
+
paddingInline: getToken('spacingButtonPaddingHorizontal'),
|
|
76
|
+
paddingInlineSM: getToken('spacingButtonPaddingHorizontal'),
|
|
77
|
+
paddingInlineLG: getToken('spacingButtonPaddingHorizontal'),
|
|
78
|
+
paddingBlock: getToken('spacingButtonPaddingVertical'),
|
|
79
|
+
paddingBlockSM: getToken('spacingButtonPaddingVertical'),
|
|
80
|
+
paddingBlockLG: getToken('spacingButtonPaddingVertical')
|
|
81
|
+
};
|
|
71
82
|
};
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
var useInverseDesignTokens = function useInverseDesignTokens() {
|
|
84
|
+
var getToken = useDynamicTokens();
|
|
85
|
+
return {
|
|
86
|
+
// 算法配置
|
|
87
|
+
// algorithm: true,
|
|
75
88
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
89
|
+
// 主要按钮背景色
|
|
90
|
+
colorPrimary: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
91
|
+
// 主要按钮 Hover
|
|
92
|
+
colorPrimaryHover: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
93
|
+
colorPrimaryActive: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
94
|
+
// 主要按钮 Active
|
|
95
|
+
// colorPrimaryBg: getToken('colorButtonBackgroundPrimaryInverse'),
|
|
96
|
+
// 主要按钮文本颜色
|
|
97
|
+
primaryColor: getToken('colorButtonTextPrimaryInverse'),
|
|
98
|
+
// 次要按钮背景色 默认是白色
|
|
99
|
+
defaultBg: "rgba(255,255,255,0)",
|
|
100
|
+
defaultHoverBg: "rgba(255,255,255,0)",
|
|
101
|
+
defaultActiveBg: "rgba(255,255,255,0)",
|
|
102
|
+
// 次要按钮文本颜色
|
|
103
|
+
defaultColor: getToken('colorButtonTextSecondaryInverse'),
|
|
104
|
+
// 次要按钮边框颜色
|
|
105
|
+
defaultBorderColor: getToken('colorButtonSecondaryBorderInverse'),
|
|
106
|
+
// 禁用按钮背景色 Hover
|
|
107
|
+
colorBgContainerDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
|
|
108
|
+
borderColorDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
|
|
109
|
+
colorTextDisabled: getToken('colorButtonTextDisabled'),
|
|
110
|
+
// Success 按钮背景色
|
|
111
|
+
green1: getToken('colorButtonBackgroundSuccess'),
|
|
112
|
+
green2: getToken('colorButtonBackgroundSuccess'),
|
|
113
|
+
green3: getToken('colorButtonBackgroundSuccess'),
|
|
114
|
+
green4: getToken('colorButtonBackgroundSuccess'),
|
|
115
|
+
green5: getToken('colorButtonBackgroundSuccess'),
|
|
116
|
+
green6: getToken('colorButtonBackgroundSuccess'),
|
|
117
|
+
green7: getToken('colorButtonBackgroundSuccess'),
|
|
118
|
+
// 全局公用的:
|
|
119
|
+
// 按钮圆角
|
|
120
|
+
borderRadius: getToken('borderRadiusButton'),
|
|
121
|
+
borderRadiusSM: getToken('borderRadiusButton'),
|
|
122
|
+
borderRadiusLG: getToken('borderRadiusButton'),
|
|
123
|
+
defaultShadow: '0 0px 0 rgba(0,0,0,0.02)',
|
|
124
|
+
primaryShadow: '0 0 0 rgba(5,145,255,0.1)',
|
|
125
|
+
// gFontFamilySecondaryBold: String = "Roboto"
|
|
126
|
+
// fontWeight700: Font.Weight = .bold 改用 text 组件实现
|
|
127
|
+
// fontWeight: getToken(''),
|
|
128
|
+
// fontfamily: getToken(''),
|
|
116
129
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
130
|
+
// 边框宽度
|
|
131
|
+
lineWidth: getToken('borderWidthButtonSecondary'),
|
|
132
|
+
// 默认文本按钮的文本色
|
|
133
|
+
textTextColor: getToken('colorButtonTextSecondary'),
|
|
134
|
+
// 按钮内间距
|
|
135
|
+
paddingInline: getToken('spacingButtonPaddingHorizontal'),
|
|
136
|
+
paddingInlineSM: getToken('spacingButtonPaddingHorizontal'),
|
|
137
|
+
paddingInlineLG: getToken('spacingButtonPaddingHorizontal'),
|
|
138
|
+
paddingBlock: getToken('spacingButtonPaddingVertical'),
|
|
139
|
+
paddingBlockSM: getToken('spacingButtonPaddingVertical'),
|
|
140
|
+
paddingBlockLG: getToken('spacingButtonPaddingVertical')
|
|
141
|
+
};
|
|
128
142
|
};
|
|
129
143
|
|
|
130
|
-
//
|
|
131
|
-
export {
|
|
144
|
+
// 导出钩子函数
|
|
145
|
+
export { useDesignTokens, useInverseDesignTokens };
|
|
@@ -11,13 +11,22 @@ export interface ButtonThemeConfig {
|
|
|
11
11
|
Button?: Record<string, any>;
|
|
12
12
|
[key: string]: any;
|
|
13
13
|
};
|
|
14
|
-
cssVar?:
|
|
14
|
+
cssVar?: {
|
|
15
|
+
/**
|
|
16
|
+
* @descCN css 变量的前缀
|
|
17
|
+
* @descEN Prefix for css variable.
|
|
18
|
+
* @default ant
|
|
19
|
+
*/
|
|
20
|
+
prefix?: string;
|
|
21
|
+
/**
|
|
22
|
+
* @descCN 主题的唯一 key,版本低于 react@18 时需要手动设置。
|
|
23
|
+
* @descEN Unique key for theme, should be set manually < react@18.
|
|
24
|
+
*/
|
|
25
|
+
key?: string;
|
|
26
|
+
} | boolean;
|
|
15
27
|
hashed?: boolean;
|
|
16
28
|
[key: string]: any;
|
|
17
29
|
}
|
|
18
|
-
export interface xDXpProps {
|
|
19
|
-
'x-dxp-prop'?: string;
|
|
20
|
-
}
|
|
21
30
|
export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'color'> {
|
|
22
31
|
type?: ButtonType;
|
|
23
32
|
color?: ButtonColorType;
|
|
@@ -35,5 +44,7 @@ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonE
|
|
|
35
44
|
contentClassName?: string;
|
|
36
45
|
[key: string]: any;
|
|
37
46
|
}
|
|
38
|
-
declare const ButtonWithContext: React.FC<ButtonProps
|
|
47
|
+
declare const ButtonWithContext: React.FC<ButtonProps & {
|
|
48
|
+
getToken?: (tokenName: string) => string | number | boolean | undefined;
|
|
49
|
+
}>;
|
|
39
50
|
export default ButtonWithContext;
|
|
@@ -2,20 +2,15 @@ import "antd/es/config-provider/style";
|
|
|
2
2
|
import _ConfigProvider from "antd/es/config-provider";
|
|
3
3
|
import "antd/es/button/style";
|
|
4
4
|
import _Button from "antd/es/button";
|
|
5
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
6
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
6
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
10
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
11
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
12
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
13
|
-
var _excluded = ["fontSize", "theme", "inverse", "parentTheme"];
|
|
14
|
-
import React, { PureComponent } from 'react';
|
|
8
|
+
var _excluded = ["children", "inverse", "fontSize", "theme", "parentTheme"];
|
|
9
|
+
import React from 'react';
|
|
15
10
|
import Text from "../Text";
|
|
16
11
|
import { cssClasses } from "../../constants";
|
|
17
|
-
import { noop } from "../../utils
|
|
18
|
-
import {
|
|
12
|
+
import { noop } from "../../utils";
|
|
13
|
+
import { useDesignTokens, useInverseDesignTokens } from "./designTokens";
|
|
19
14
|
|
|
20
15
|
// 这种是另一方 定制 antd 的 style 的方式; 现在使用了上面的 designTokens.ts 的方式。
|
|
21
16
|
import "./style/index.less";
|
|
@@ -26,88 +21,8 @@ import "./style/index.less";
|
|
|
26
21
|
|
|
27
22
|
// 复用antd的Theme配置接口
|
|
28
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
|
-
//
|
|
30
|
-
var
|
|
31
|
-
_inherits(ButtonComponent, _PureComponent);
|
|
32
|
-
var _super = _createSuper(ButtonComponent);
|
|
33
|
-
function ButtonComponent() {
|
|
34
|
-
_classCallCheck(this, ButtonComponent);
|
|
35
|
-
return _super.apply(this, arguments);
|
|
36
|
-
}
|
|
37
|
-
_createClass(ButtonComponent, [{
|
|
38
|
-
key: "render",
|
|
39
|
-
value: function render() {
|
|
40
|
-
var _this$props = this.props,
|
|
41
|
-
children = _this$props.children,
|
|
42
|
-
inverse = _this$props.inverse,
|
|
43
|
-
fontSize = _this$props.fontSize,
|
|
44
|
-
theme = _this$props.theme,
|
|
45
|
-
parentTheme = _this$props.parentTheme;
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
47
|
-
var _this$props2 = this.props,
|
|
48
|
-
_ = _this$props2.fontSize,
|
|
49
|
-
__ = _this$props2.theme,
|
|
50
|
-
___ = _this$props2.inverse,
|
|
51
|
-
____ = _this$props2.parentTheme,
|
|
52
|
-
filteredProps = _objectWithoutProperties(_this$props2, _excluded);
|
|
53
|
-
|
|
54
|
-
// 获取基础token
|
|
55
|
-
var baseTokens = inverse ? inverseDesignTokens : designTokens;
|
|
56
|
-
|
|
57
|
-
// 处理theme属性 - 如果是对象格式,则按antd的Theme配置处理
|
|
58
|
-
var themeConfig = {
|
|
59
|
-
components: {
|
|
60
|
-
Button: baseTokens
|
|
61
|
-
},
|
|
62
|
-
token: {},
|
|
63
|
-
cssVar: true,
|
|
64
|
-
hashed: false
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// 如果有父级配置,则与基础token合并
|
|
68
|
-
if (parentTheme) {
|
|
69
|
-
var _parentTheme$componen;
|
|
70
|
-
var parentButtonTokens = ((_parentTheme$componen = parentTheme.components) === null || _parentTheme$componen === void 0 ? void 0 : _parentTheme$componen.Button) || {};
|
|
71
|
-
var parentGlobalTokens = parentTheme.token || {};
|
|
72
|
-
themeConfig = _objectSpread(_objectSpread(_objectSpread({}, themeConfig), parentTheme), {}, {
|
|
73
|
-
token: _objectSpread(_objectSpread({}, themeConfig.token || {}), parentGlobalTokens),
|
|
74
|
-
components: _objectSpread(_objectSpread({}, parentTheme.components), {}, {
|
|
75
|
-
Button: _objectSpread(_objectSpread({}, baseTokens), parentButtonTokens)
|
|
76
|
-
})
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// 如果用户传入了自定义theme配置(对象),则合并处理
|
|
81
|
-
if (theme && _typeof(theme) === 'object') {
|
|
82
|
-
var _theme$components, _parentTheme$componen2;
|
|
83
|
-
// 获取用户自定义的Button token
|
|
84
|
-
var userButtonTokens = ((_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : _theme$components.Button) || {};
|
|
85
|
-
var userGlobalTokens = theme.token || {};
|
|
86
|
-
themeConfig = _objectSpread(_objectSpread(_objectSpread({}, themeConfig), theme), {}, {
|
|
87
|
-
token: _objectSpread(_objectSpread({}, themeConfig.token || {}), userGlobalTokens),
|
|
88
|
-
components: _objectSpread(_objectSpread(_objectSpread({}, themeConfig.components), theme.components), {}, {
|
|
89
|
-
Button: _objectSpread(_objectSpread(_objectSpread({}, baseTokens), (parentTheme === null || parentTheme === void 0 || (_parentTheme$componen2 = parentTheme.components) === null || _parentTheme$componen2 === void 0 ? void 0 : _parentTheme$componen2.Button) || {}), userButtonTokens)
|
|
90
|
-
})
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
return /*#__PURE__*/_jsx(_ConfigProvider, {
|
|
94
|
-
wave: {
|
|
95
|
-
disabled: true
|
|
96
|
-
},
|
|
97
|
-
prefixCls: cssClasses.PREFIX,
|
|
98
|
-
theme: themeConfig,
|
|
99
|
-
children: /*#__PURE__*/_jsx(_Button, _objectSpread(_objectSpread({}, filteredProps), {}, {
|
|
100
|
-
children: /*#__PURE__*/_jsx(Text, {
|
|
101
|
-
size: fontSize,
|
|
102
|
-
children: children
|
|
103
|
-
})
|
|
104
|
-
}))
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}]);
|
|
108
|
-
return ButtonComponent;
|
|
109
|
-
}(PureComponent); // 包装器函数组件,用于获取 ConfigProvider 上下文
|
|
110
|
-
_defineProperty(ButtonComponent, "defaultProps", {
|
|
24
|
+
// 默认属性
|
|
25
|
+
var defaultProps = {
|
|
111
26
|
disabled: false,
|
|
112
27
|
size: 'large',
|
|
113
28
|
type: 'default',
|
|
@@ -118,9 +33,89 @@ _defineProperty(ButtonComponent, "defaultProps", {
|
|
|
118
33
|
onMouseEnter: noop,
|
|
119
34
|
onMouseLeave: noop,
|
|
120
35
|
prefixCls: cssClasses.PREFIX + '-button'
|
|
121
|
-
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// 提取主题合并逻辑为独立函数
|
|
39
|
+
var mergeThemeConfig = function mergeThemeConfig(baseTokens, parentTheme, theme) {
|
|
40
|
+
var inverse = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
41
|
+
// 处理 dxp 定制 theme - 如果是对象格式,则按antd的Theme配置处理
|
|
42
|
+
var themeConfig = {
|
|
43
|
+
components: {
|
|
44
|
+
Button: baseTokens
|
|
45
|
+
},
|
|
46
|
+
token: {},
|
|
47
|
+
cssVar: {
|
|
48
|
+
prefix: cssClasses.PREFIX,
|
|
49
|
+
// 保持与 ConfigProvider 的 prefixCls 一致或你期望的 CSS 变量前缀
|
|
50
|
+
key: inverse ? 'inverse' : 'default' // 为 inverse 状态提供一个不同的 key
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// 如果有父级配置,则与 dxp 定制 theme 合并
|
|
55
|
+
if (parentTheme) {
|
|
56
|
+
var _parentTheme$componen;
|
|
57
|
+
var parentButtonTokens = ((_parentTheme$componen = parentTheme.components) === null || _parentTheme$componen === void 0 ? void 0 : _parentTheme$componen.Button) || {};
|
|
58
|
+
var parentGlobalTokens = parentTheme.token || {};
|
|
59
|
+
themeConfig = _objectSpread(_objectSpread(_objectSpread({}, themeConfig), parentTheme), {}, {
|
|
60
|
+
token: _objectSpread(_objectSpread({}, themeConfig.token || {}), parentGlobalTokens),
|
|
61
|
+
components: _objectSpread(_objectSpread({}, parentTheme.components), {}, {
|
|
62
|
+
Button: _objectSpread(_objectSpread({}, baseTokens), parentButtonTokens)
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 如果还用户传入了自定义theme配置(对象),也合并处理
|
|
68
|
+
if (theme && _typeof(theme) === 'object') {
|
|
69
|
+
var _theme$components, _parentTheme$componen2;
|
|
70
|
+
// 获取用户自定义的Button token
|
|
71
|
+
var userButtonTokens = ((_theme$components = theme.components) === null || _theme$components === void 0 ? void 0 : _theme$components.Button) || {};
|
|
72
|
+
var userGlobalTokens = theme.token || {};
|
|
73
|
+
themeConfig = _objectSpread(_objectSpread(_objectSpread({}, themeConfig), theme), {}, {
|
|
74
|
+
token: _objectSpread(_objectSpread({}, themeConfig.token || {}), userGlobalTokens),
|
|
75
|
+
components: _objectSpread(_objectSpread(_objectSpread({}, themeConfig.components), theme.components), {}, {
|
|
76
|
+
Button: _objectSpread(_objectSpread(_objectSpread({}, baseTokens), (parentTheme === null || parentTheme === void 0 || (_parentTheme$componen2 = parentTheme.components) === null || _parentTheme$componen2 === void 0 ? void 0 : _parentTheme$componen2.Button) || {}), userButtonTokens)
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return themeConfig;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// 实际的 Button 组件实现 - 转为函数组件以使用hooks
|
|
84
|
+
var ButtonComponent = function ButtonComponent(props) {
|
|
85
|
+
var children = props.children,
|
|
86
|
+
inverse = props.inverse,
|
|
87
|
+
fontSize = props.fontSize,
|
|
88
|
+
theme = props.theme,
|
|
89
|
+
parentTheme = props.parentTheme,
|
|
90
|
+
restProps = _objectWithoutProperties(props, _excluded);
|
|
91
|
+
|
|
92
|
+
// 1、使用hooks获取动态tokens
|
|
93
|
+
var designTokens = useDesignTokens();
|
|
94
|
+
var inverseDesignTokens = useInverseDesignTokens();
|
|
95
|
+
// 2、获取基础token
|
|
96
|
+
var baseTokens = inverse ? inverseDesignTokens : designTokens;
|
|
97
|
+
// 3、合并 外部传入的主题配置
|
|
98
|
+
var themeConfig = mergeThemeConfig(baseTokens, parentTheme, theme, inverse);
|
|
99
|
+
// 应用默认属性
|
|
100
|
+
var mergedProps = _objectSpread(_objectSpread({}, defaultProps), restProps);
|
|
101
|
+
return /*#__PURE__*/_jsx(_ConfigProvider, {
|
|
102
|
+
wave: {
|
|
103
|
+
disabled: true
|
|
104
|
+
},
|
|
105
|
+
prefixCls: cssClasses.PREFIX,
|
|
106
|
+
theme: themeConfig,
|
|
107
|
+
children: /*#__PURE__*/_jsx(_Button, _objectSpread(_objectSpread({}, mergedProps), {}, {
|
|
108
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
109
|
+
size: fontSize,
|
|
110
|
+
children: children
|
|
111
|
+
})
|
|
112
|
+
}))
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// 包装器函数组件,用于获取 ConfigProvider
|
|
122
117
|
var ButtonWithContext = function ButtonWithContext(props) {
|
|
123
|
-
//
|
|
118
|
+
// 获取 useContext 上下文
|
|
124
119
|
var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
|
|
125
120
|
parentTheme = _React$useContext.theme;
|
|
126
121
|
return /*#__PURE__*/_jsx(ButtonComponent, _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useDynamicTokens } from "../../utils";
|
|
2
|
+
var useDesignTokens = function useDesignTokens() {
|
|
3
|
+
var getToken = useDynamicTokens();
|
|
4
|
+
var designTokens = {
|
|
5
|
+
borderColor: getToken('colorDividerHorizontal'),
|
|
6
|
+
spacingCardPaddingVertical: getToken('spacingCardPaddingVertical'),
|
|
7
|
+
spacingCardPaddingHorizontal: getToken('spacingCardPaddingHorizontal'),
|
|
8
|
+
borderRadius: "".concat(getToken('borderRadiusCardMd'), "px"),
|
|
9
|
+
colorBackgroundSubtle2: getToken('colorBackgroundSubtle2'),
|
|
10
|
+
colorTextAmount: getToken('colorTextAmount')
|
|
11
|
+
};
|
|
12
|
+
return designTokens;
|
|
13
|
+
};
|
|
14
|
+
export { useDesignTokens };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import './style/index.less';
|
|
3
|
+
export interface CardProps {
|
|
4
|
+
type?: 'default' | 'whiteDivider' | 'grayDivider';
|
|
5
|
+
className?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
list?: {
|
|
8
|
+
key: number;
|
|
9
|
+
content: ReactNode;
|
|
10
|
+
}[];
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
declare const Card: (props: CardProps) => React.JSX.Element;
|
|
15
|
+
export default Card;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "prefixCls", "type", "children", "extraTop", "extraBottom", "amountLabel", "amountValue"];
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { useStyleRegister } from '@ant-design/cssinjs';
|
|
6
|
+
import { theme } from "../../utils/theme";
|
|
7
|
+
import { useDesignTokens } from "./designTokens";
|
|
8
|
+
import { cssClasses } from "../../constants";
|
|
9
|
+
import { Text, Amount } from "../";
|
|
10
|
+
import "./style/index.less";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
var Card = function Card(props) {
|
|
13
|
+
var _props$className = props.className,
|
|
14
|
+
className = _props$className === void 0 ? '' : _props$className,
|
|
15
|
+
_props$prefixCls = props.prefixCls,
|
|
16
|
+
prefixCls = _props$prefixCls === void 0 ? cssClasses.PREFIX + '-card' : _props$prefixCls,
|
|
17
|
+
_props$type = props.type,
|
|
18
|
+
type = _props$type === void 0 ? 'default' : _props$type,
|
|
19
|
+
children = props.children,
|
|
20
|
+
extraTop = props.extraTop,
|
|
21
|
+
extraBottom = props.extraBottom,
|
|
22
|
+
amountLabel = props.amountLabel,
|
|
23
|
+
amountValue = props.amountValue,
|
|
24
|
+
attr = _objectWithoutProperties(props, _excluded);
|
|
25
|
+
var designTokens = useDesignTokens();
|
|
26
|
+
var borderColor = designTokens.borderColor,
|
|
27
|
+
spacingCardPaddingVertical = designTokens.spacingCardPaddingVertical,
|
|
28
|
+
spacingCardPaddingHorizontal = designTokens.spacingCardPaddingHorizontal,
|
|
29
|
+
borderRadius = designTokens.borderRadius,
|
|
30
|
+
colorBackgroundSubtle2 = designTokens.colorBackgroundSubtle2,
|
|
31
|
+
colorTextAmount = designTokens.colorTextAmount;
|
|
32
|
+
var useCustomButtonStyle = function useCustomButtonStyle() {
|
|
33
|
+
var hashId = useStyleRegister({
|
|
34
|
+
theme: theme,
|
|
35
|
+
token: {},
|
|
36
|
+
path: [prefixCls]
|
|
37
|
+
}, function () {
|
|
38
|
+
return "\n .".concat(prefixCls, " {\n padding: ").concat(spacingCardPaddingVertical, "px ").concat(spacingCardPaddingHorizontal, "px;\n border: 1px solid ").concat(borderColor, ";\n border-radius: ").concat(borderRadius, ";\n .").concat(prefixCls, "-amount {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ").concat(spacingCardPaddingVertical, "px ").concat(spacingCardPaddingHorizontal, "px;\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n border-bottom-left-radius: ").concat(borderRadius, ";\n border-bottom-right-radius: ").concat(borderRadius, ";\n background: ").concat(colorBackgroundSubtle2, ";\n }\n }\n .").concat(prefixCls, "-whiteDivider,\n .").concat(prefixCls, "-grayDivider {\n .").concat(prefixCls, "-list {\n border-radius: ").concat(borderRadius, ";\n > div {\n padding: ").concat(spacingCardPaddingVertical / 2, "px ").concat(spacingCardPaddingHorizontal, "px;\n &.").concat(prefixCls, "-hideTopPadding:first-child {\n padding-top: 0;\n }\n &.").concat(prefixCls, "-hideBottomPadding:last-child {\n padding-bottom: 0;\n }\n }\n }}\n .").concat(prefixCls, "-whiteDivider .").concat(prefixCls, "-list {\n >div + div {\n &::before,\n &::after {\n background: #fff;\n }\n }\n }\n .").concat(prefixCls, "-grayDivider .").concat(prefixCls, "-list {\n >div + div {\n &::before,\n &::after {\n background: ").concat(borderColor, ";\n }\n }\n }\n ");
|
|
39
|
+
});
|
|
40
|
+
return hashId;
|
|
41
|
+
};
|
|
42
|
+
useCustomButtonStyle();
|
|
43
|
+
var getAmount = function getAmount() {
|
|
44
|
+
return amountValue ? /*#__PURE__*/_jsxs("div", {
|
|
45
|
+
className: "".concat(prefixCls, "-amount"),
|
|
46
|
+
children: [/*#__PURE__*/_jsx(Text, {
|
|
47
|
+
size: "ContentC15Bold",
|
|
48
|
+
children: amountLabel
|
|
49
|
+
}), /*#__PURE__*/_jsx(Amount, {
|
|
50
|
+
showIcon: false,
|
|
51
|
+
title: "",
|
|
52
|
+
priceColor: colorTextAmount,
|
|
53
|
+
children: amountValue
|
|
54
|
+
})]
|
|
55
|
+
}) : extraBottom;
|
|
56
|
+
};
|
|
57
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
58
|
+
className: "".concat(prefixCls, " ").concat(prefixCls, "-").concat(type, " ").concat(className)
|
|
59
|
+
}, attr), {}, {
|
|
60
|
+
children: [extraTop, /*#__PURE__*/_jsx("div", {
|
|
61
|
+
className: "".concat(prefixCls, "-list"),
|
|
62
|
+
children: children
|
|
63
|
+
}), getAmount()]
|
|
64
|
+
}));
|
|
65
|
+
};
|
|
66
|
+
export default Card;
|