@digitalc/dxp-ui 0.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +38 -0
  3. package/es/assets/iconFont/iconfont.css +734 -0
  4. package/es/assets/iconFont/iconfont.eot +0 -0
  5. package/es/assets/iconFont/iconfont.js +43 -0
  6. package/es/assets/iconFont/iconfont.json +1262 -0
  7. package/es/assets/iconFont/iconfont.svg +377 -0
  8. package/es/assets/iconFont/iconfont.ttf +0 -0
  9. package/es/assets/iconFont/iconfont.woff +0 -0
  10. package/es/assets/iconFont/iconfont.woff2 +0 -0
  11. package/es/assets/token.json +239 -0
  12. package/es/components/Button/designTokens.d.ts +66 -0
  13. package/es/components/Button/designTokens.js +131 -0
  14. package/es/components/Button/index.d.ts +44 -0
  15. package/es/components/Button/index.js +92 -0
  16. package/es/components/Button/index_backup.d.ts +72 -0
  17. package/es/components/Button/index_backup.js +110 -0
  18. package/es/components/Button/style/button.less +34 -0
  19. package/es/components/Button/style/variables.less +5 -0
  20. package/es/components/Text/index.d.ts +32 -0
  21. package/es/components/Text/index.js +59 -0
  22. package/es/components/Text/style/text.less +116 -0
  23. package/es/components/Text/style/variables.less +4 -0
  24. package/es/components/index.d.ts +4 -0
  25. package/es/components/index.js +4 -0
  26. package/es/constants/index.d.ts +15 -0
  27. package/es/constants/index.js +16 -0
  28. package/es/fonts/Poppins/Poppins-Bold.ttf +0 -0
  29. package/es/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
  30. package/es/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
  31. package/es/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
  32. package/es/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
  33. package/es/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
  34. package/es/fonts/Poppins/Poppins-Italic.ttf +0 -0
  35. package/es/fonts/Poppins/Poppins-Light.ttf +0 -0
  36. package/es/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
  37. package/es/fonts/Poppins/Poppins-Medium.ttf +0 -0
  38. package/es/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
  39. package/es/fonts/Poppins/Poppins-Regular.ttf +0 -0
  40. package/es/fonts/Poppins/Poppins-SemiBold.ttf +0 -0
  41. package/es/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
  42. package/es/fonts/Poppins/Poppins-Thin.ttf +0 -0
  43. package/es/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
  44. package/es/fonts/Roboto/Roboto-Black.ttf +0 -0
  45. package/es/fonts/Roboto/Roboto-BlackItalic.ttf +0 -0
  46. package/es/fonts/Roboto/Roboto-Bold.ttf +0 -0
  47. package/es/fonts/Roboto/Roboto-BoldItalic.ttf +0 -0
  48. package/es/fonts/Roboto/Roboto-ExtraBold.ttf +0 -0
  49. package/es/fonts/Roboto/Roboto-ExtraBoldItalic.ttf +0 -0
  50. package/es/fonts/Roboto/Roboto-ExtraLight.ttf +0 -0
  51. package/es/fonts/Roboto/Roboto-ExtraLightItalic.ttf +0 -0
  52. package/es/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
  53. package/es/fonts/Roboto/Roboto-Italic.ttf +0 -0
  54. package/es/fonts/Roboto/Roboto-Light.ttf +0 -0
  55. package/es/fonts/Roboto/Roboto-LightItalic.ttf +0 -0
  56. package/es/fonts/Roboto/Roboto-Medium.ttf +0 -0
  57. package/es/fonts/Roboto/Roboto-MediumItalic.ttf +0 -0
  58. package/es/fonts/Roboto/Roboto-Regular.ttf +0 -0
  59. package/es/fonts/Roboto/Roboto-SemiBold.ttf +0 -0
  60. package/es/fonts/Roboto/Roboto-SemiBoldItalic.ttf +0 -0
  61. package/es/fonts/Roboto/Roboto-Thin.ttf +0 -0
  62. package/es/fonts/Roboto/Roboto-ThinItalic.ttf +0 -0
  63. package/es/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
  64. package/es/index.d.ts +3 -0
  65. package/es/index.js +3 -0
  66. package/es/style/antdDesignToken.json +503 -0
  67. package/es/style/themes/base-vars.css +6 -0
  68. package/es/style/themes/colorful.css +5 -0
  69. package/es/style/themes/index.css +4 -0
  70. package/es/style/variables.less +34 -0
  71. package/es/tokens/DXPGlobal.d.ts +240 -0
  72. package/es/tokens/DXPGlobal.js +5 -0
  73. package/es/utils/noop.d.ts +1 -0
  74. package/es/utils/noop.js +1 -0
  75. package/es/utils/themeContext.d.ts +11 -0
  76. package/es/utils/themeContext.js +39 -0
  77. package/es/utils/tokenHelper.d.ts +1 -0
  78. package/es/utils/tokenHelper.js +4 -0
  79. package/es/utils/tokenManager.d.ts +1464 -0
  80. package/es/utils/tokenManager.js +750 -0
  81. package/package.json +112 -0
  82. package/umd/dxp-ui.min.css +1 -0
  83. package/umd/dxp-ui.min.js +1 -0
  84. package/umd/static/Poppins-Bold.8001a01b.ttf +0 -0
  85. package/umd/static/Roboto-Bold.ff276312.ttf +0 -0
  86. package/umd/static/Roboto-Regular.a5023d7b.ttf +0 -0
  87. package/umd/static/Roboto-SemiBold.3452daa4.ttf +0 -0
Binary file
Binary file
@@ -0,0 +1,239 @@
1
+ {
2
+ "borderRadiusLg": 32,
3
+ "borderRadiusMd": 16,
4
+ "borderRadiusSm": 8,
5
+ "borderRadiusXl": 40,
6
+ "borderUpload": "[object Object]",
7
+ "borderWidthCta": 2,
8
+ "borderWidthHover": 1,
9
+ "borderWidthSelected": 2,
10
+ "borderWidthStandard": 1,
11
+ "borderWidthStrikeout": 2,
12
+ "colorBackgroundActive": "#4D28E8",
13
+ "colorBackgroundActiveInverse": "#E5FF17",
14
+ "colorBackgroundActiveWeak": "#EDE9FD",
15
+ "colorBackgroundActiveWeakInverse": "#F5FFC0",
16
+ "colorBackgroundCoachmark": "#4D28E8",
17
+ "colorBackgroundCta": "#4D28E8",
18
+ "colorBackgroundCtaInverse": "#E5FF17",
19
+ "colorBackgroundCtaInversePressed": "rgba(229,255,23,0.5)",
20
+ "colorBackgroundCtaPressed": "rgba(77,40,232,0.5)",
21
+ "colorBackgroundCtaSuccess": "#00B379",
22
+ "colorBackgroundDark": "#242328",
23
+ "colorBackgroundDark2": "#151518",
24
+ "colorBackgroundDisabled": "#DFDFE4",
25
+ "colorBackgroundFooter": "#F5F5F8",
26
+ "colorBackgroundHeader": "#3E20BA",
27
+ "colorBackgroundHover": "#EDE9FD",
28
+ "colorBackgroundHoverNeutral": "rgba(245,245,248,0.8)",
29
+ "colorBackgroundOverlay": "rgba(21,21,24,0.8)",
30
+ "colorBackgroundOverlayLight": "rgba(223,223,228,0.8)",
31
+ "colorBackgroundSelected": "#EDE9FD",
32
+ "colorBackgroundStandard": "#ffffff",
33
+ "colorBackgroundSubtle": "#F5F5F8",
34
+ "colorBackgroundSubtle2": "#EDE9FD",
35
+ "colorBackgroundWeak": "#BFBFC7",
36
+ "colorBorderActive": "#4D28E8",
37
+ "colorBorderActiveInverse": "#E5FF17",
38
+ "colorBorderBenchmark": "#3E20BA",
39
+ "colorBorderBenchmarkInverse": "#D5E516",
40
+ "colorBorderCta": "#4D28E8",
41
+ "colorBorderCtaInverse": "#E5FF17",
42
+ "colorBorderDisabled": "rgba(140,140,152,0.5)",
43
+ "colorBorderError": "#BD341C",
44
+ "colorBorderSelected": "#4D28E8",
45
+ "colorBorderStandard": "#BFBFC7",
46
+ "colorBorderStrikeout": "#DFDFE4",
47
+ "colorBorderStrikeoutInverse": "#ffffff",
48
+ "colorBorderStrong": "#8C8C98",
49
+ "colorBorderWeak": "#DFDFE4",
50
+ "colorBorderWeakInverse": "#ffffff",
51
+ "colorDivider": "#DFDFE4",
52
+ "colorGradientNeutral": "linear-gradient(180deg, rgba(0, 0, 0, 0.80) 0%, rgba(0, 0, 0, 0.00) 100%)",
53
+ "colorGraph1": "#0062F5",
54
+ "colorGraph2": "#FFB824",
55
+ "colorGraph3": "#FF5D76",
56
+ "colorGraph4": "#0CAA8F",
57
+ "colorGraph5": "#6699FF",
58
+ "colorGraph6": "#FFD47C",
59
+ "colorGraph7": "#FFD2D9",
60
+ "colorGraph8": "#6DCCBC",
61
+ "colorGraph9": "#151560",
62
+ "colorGraph10": "#FFEABD",
63
+ "colorGraph11": "#FCEAED",
64
+ "colorGraph12": "#B6E6DD",
65
+ "colorIconActive": "#8C8C98",
66
+ "colorIconAlert": "#BD341C",
67
+ "colorIconAlertInverse": "#ff5d76",
68
+ "colorIconBottomNavigationActive": "#4D28E8",
69
+ "colorIconBottomNavigationInactive": "#8C8C98",
70
+ "colorIconCta": "#4D28E8",
71
+ "colorIconCtaInverse": "#E5FF17",
72
+ "colorIconDisabled": "#DFDFE4",
73
+ "colorIconInactive": "#DFDFE4",
74
+ "colorIconInverse": "#ffffff",
75
+ "colorIconLink": "#4D28E8",
76
+ "colorIconLinkInverse": "#E5FF17",
77
+ "colorIconLoader": "#8C8C98",
78
+ "colorIconLocationPin": "#D01660",
79
+ "colorIconLocationPinActive": "#4D28E8",
80
+ "colorIconNeutral": "#242328",
81
+ "colorIconNotice": "#e71336",
82
+ "colorIconPending": "#FFB524",
83
+ "colorIconRating": "#FFB524",
84
+ "colorIconSubtle": "#8C8C98",
85
+ "colorIconSubtleInverse": "#DFDFE4",
86
+ "colorIconSuccess": "#00B379",
87
+ "colorIconWeak": "#BFBFC7",
88
+ "colorNotificationAlert": "#FDEAE7",
89
+ "colorNotificationDefault": "#EDE9FD",
90
+ "colorNotificationPromo": "#F5FFC0",
91
+ "colorRewards1": "#FFC9AA",
92
+ "colorRewards2": "#D4E6EC",
93
+ "colorRewards3": "#FEE8B6",
94
+ "colorRibbonPrimary": "#D01660",
95
+ "colorRibbonPrimary2": "#FFEAF2",
96
+ "colorRibbonPrimary3": "#D01660",
97
+ "colorRibbonPrimaryDark": "#D01660",
98
+ "colorRibbonSecondary": "#1482CC",
99
+ "colorRibbonSecondary2": "#E8F6FF",
100
+ "colorRibbonSecondaryDark": "#1482CC",
101
+ "colorTagPrimary": "#D01660",
102
+ "colorTagSecondary": "#1482CC",
103
+ "colorTextAlert": "#bc1430",
104
+ "colorTextCoachmark": "#ffffff",
105
+ "colorTextCta": "#4D28E8",
106
+ "colorTextCtaInverse": "#E5FF17",
107
+ "colorTextDisabled": "#8C8C98",
108
+ "colorTextHeaderActive": "#E5FF17",
109
+ "colorTextHeaderActiveInverse": "#ffffff",
110
+ "colorTextHeaderHighlight": "#151518",
111
+ "colorTextHeaderHighlightInverse": "#F5FFC0",
112
+ "colorTextInverse": "#ffffff",
113
+ "colorTextLabel": "#70707A",
114
+ "colorTextLink": "#4D28E8",
115
+ "colorTextLinkInverse": "#E5FF17",
116
+ "colorTextNavigationActive": "#4D28E8",
117
+ "colorTextNeutral": "#242328",
118
+ "colorTextStrikethrough": "#8C8C98",
119
+ "colorTextSubtle": "#70707A",
120
+ "colorTextSubtleInverse": "#DFDFE4",
121
+ "colorTextSuccess": "#00B379",
122
+ "colorToggleActiveStrong": "#4D28E8",
123
+ "colorToggleActiveWeak": "#ffffff",
124
+ "colorToggleInactiveStrong": "#DFDFE4",
125
+ "colorToggleInactiveWeak": "#ffffff",
126
+ "colorToggleIndicator": "rgba(34,34,34,0.05)",
127
+ "opacityDisabled": 0.5,
128
+ "opacityHover": 0.8,
129
+ "opacityOverlay": 0.8,
130
+ "opacityPressed": 0.5,
131
+ "opacitySubtle": 0.3,
132
+ "shadowHigh": {
133
+ "elevation": 0,
134
+ "shadowColor": "rgba(0, 0, 0, 0.10)",
135
+ "shadowOffset": {
136
+ "width": 0,
137
+ "height": 6
138
+ },
139
+ "shadowOpacity": 0.1,
140
+ "shadowRadius": 6
141
+ },
142
+ "shadowHighInverse": {
143
+ "elevation": 4,
144
+ "shadowColor": "rgba(0, 0, 0, 0.10)",
145
+ "shadowOffset": {
146
+ "width": 0,
147
+ "height": -6
148
+ },
149
+ "shadowOpacity": 0.1,
150
+ "shadowRadius": 8
151
+ },
152
+ "shadowLow": {
153
+ "elevation": 5,
154
+ "shadowColor": "#000000",
155
+ "shadowOffset": {
156
+ "width": 0,
157
+ "height": 4
158
+ },
159
+ "shadowOpacity": 0.1,
160
+ "shadowRadius": 5
161
+ },
162
+ "sizingBullet": 6,
163
+ "sizingBulletSm": 4,
164
+ "sizingCirclePatternLg": 242,
165
+ "sizingCirclePatternMd": 215,
166
+ "sizingCirclePatternSm": 188,
167
+ "sizingCirclePatternXs": 88,
168
+ "sizingColorList": 12,
169
+ "sizingFileInput": 218,
170
+ "sizingFileInputLg": 227,
171
+ "sizingIconGeneralLg": 40,
172
+ "sizingIconGeneralMd": 32,
173
+ "sizingIconGeneralSm": 24,
174
+ "sizingIconGeneralXl": 48,
175
+ "sizingIconGeneralXs": 16,
176
+ "sizingIconGeneralXs2": 20,
177
+ "sizingIconSpotLg": 72,
178
+ "sizingIconSpotMd": 64,
179
+ "sizingIconSpotSm": 56,
180
+ "sizingIconSpotXl": 80,
181
+ "sizingIconSpotXs": 48,
182
+ "sizingIconSpotXxl": 88,
183
+ "sizingIconUtilityLg": 40,
184
+ "sizingIconUtilityMd": 32,
185
+ "sizingIconUtilitySm": 24,
186
+ "sizingIconUtilityXs": 16,
187
+ "sizingIconUtilityXs2": 20,
188
+ "sizingIconUtilityXxs": 12,
189
+ "sizingImageLg": 56,
190
+ "sizingImageMd": 48,
191
+ "sizingImageSm": 40,
192
+ "sizingImageXl": 72,
193
+ "sizingImageXs": 32,
194
+ "sizingImageXxl": 104,
195
+ "sizingImageXxs": 24,
196
+ "sizingTagLg": 32,
197
+ "sizingTagMd": 24,
198
+ "sizingTagSm": 20,
199
+ "sizingTextBoxLg": 64,
200
+ "sizingTextBoxMd": 56,
201
+ "sizingTextBoxSm": 48,
202
+ "sizingTextBoxXs": 40,
203
+ "sizingTextBoxXxs": 24,
204
+ "sizingVoucherMd": 142,
205
+ "sizingVoucherSm": 104,
206
+ "spacingBulletMd": 10,
207
+ "spacingBulletSm": 9,
208
+ "spacingBulletXs": 7,
209
+ "spacingGapLg": 24,
210
+ "spacingGapMd": 16,
211
+ "spacingGapSm": 8,
212
+ "spacingGapSm2": 12,
213
+ "spacingGapXl": 32,
214
+ "spacingGapXs": 4,
215
+ "spacingGapXxl": 40,
216
+ "spacingGapXxxl": 64,
217
+ "spacingIconLg": 24,
218
+ "spacingIconMd": 16,
219
+ "spacingIconSm": 8,
220
+ "spacingIconXs": 4,
221
+ "spacingIconXxs": 1.50,
222
+ "spacingImageLg": 24,
223
+ "spacingImageMd": 16,
224
+ "spacingImageSm": 8,
225
+ "spacingImageXs": 4,
226
+ "spacingInputMd": 16,
227
+ "spacingInputMd2": 20,
228
+ "spacingInputMd3": 22.5,
229
+ "spacingInputSm": 8,
230
+ "spacingInputSm2": 11,
231
+ "spacingInputSm3": 12,
232
+ "spacingInputXs": 4,
233
+ "spacingTextLg": 24,
234
+ "spacingTextMd": 16,
235
+ "spacingTextSm": 8,
236
+ "spacingTextXl": 32,
237
+ "spacingTextXs": 4,
238
+ "spacingTextXxl": 40
239
+ }
@@ -0,0 +1,66 @@
1
+ declare const designTokens: {
2
+ colorPrimary: any;
3
+ colorPrimaryHover: any;
4
+ colorPrimaryActive: any;
5
+ primaryColor: any;
6
+ defaultColor: any;
7
+ defaultBorderColor: any;
8
+ colorBgContainerDisabled: any;
9
+ borderColorDisabled: any;
10
+ colorTextDisabled: any;
11
+ green1: any;
12
+ green2: any;
13
+ green3: any;
14
+ green4: any;
15
+ green5: any;
16
+ green6: any;
17
+ green7: any;
18
+ borderRadius: any;
19
+ borderRadiusSM: any;
20
+ borderRadiusLG: any;
21
+ defaultShadow: string;
22
+ primaryShadow: string;
23
+ lineWidth: any;
24
+ textTextColor: any;
25
+ paddingInline: any;
26
+ paddingInlineSM: any;
27
+ paddingInlineLG: any;
28
+ paddingBlock: any;
29
+ paddingBlockSM: any;
30
+ paddingBlockLG: any;
31
+ };
32
+ declare const inverseDesignTokens: {
33
+ colorPrimary: any;
34
+ colorPrimaryHover: any;
35
+ colorPrimaryActive: any;
36
+ primaryColor: any;
37
+ defaultBg: string;
38
+ defaultHoverBg: string;
39
+ defaultActiveBg: string;
40
+ defaultColor: any;
41
+ defaultBorderColor: any;
42
+ colorBgContainerDisabled: any;
43
+ borderColorDisabled: any;
44
+ colorTextDisabled: any;
45
+ green1: any;
46
+ green2: any;
47
+ green3: any;
48
+ green4: any;
49
+ green5: any;
50
+ green6: any;
51
+ green7: any;
52
+ borderRadius: any;
53
+ borderRadiusSM: any;
54
+ borderRadiusLG: any;
55
+ defaultShadow: string;
56
+ primaryShadow: string;
57
+ lineWidth: any;
58
+ textTextColor: any;
59
+ paddingInline: any;
60
+ paddingInlineSM: any;
61
+ paddingInlineLG: any;
62
+ paddingBlock: any;
63
+ paddingBlockSM: any;
64
+ paddingBlockLG: any;
65
+ };
66
+ export { designTokens, inverseDesignTokens };
@@ -0,0 +1,131 @@
1
+ import { getToken } from "../../utils/tokenHelper";
2
+ /*
3
+ 这里是 dxp 的 UI token,缓存在本地的内置变量;
4
+ 通过antd 提供的 ConfigProvider 注入了组件级 token 变量来实现 gomo 风格的UI组件;
5
+
6
+ 理论上可以通过2种方式来实现 antd 的样式定制:
7
+ 1. 直接写 /components/Button/style/button.less 文件通过 less 覆盖antd的样式,可控细节更多(相当于把 dxp 的 UI token 通过 less 的方式覆盖antd的样式);
8
+ 2. 通过 ConfigProvider 注入组件级别的 token 变量,这种不用写 less 文件,但是可控细节更少,只能antd 提供了哪些 token,才能覆盖对应的值;
9
+ 目前优先选择第二种,因为第一种需要写 less 文件,要知道对应组件的dom结构,才能覆盖;而第二种只需要对齐 变量值,就能覆盖;
10
+ */
11
+ var designTokens = {
12
+ // 算法配置
13
+ // algorithm: true,
14
+
15
+ // 主要按钮背景色
16
+ colorPrimary: getToken('colorButtonBackgroundPrimary'),
17
+ // 主要按钮 Hover todo
18
+ colorPrimaryHover: getToken('colorButtonBackgroundPrimary'),
19
+ colorPrimaryActive: getToken('colorButtonBackgroundPrimary'),
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
47
+
48
+ // 全局公用的:
49
+ // 按钮圆角
50
+ borderRadius: getToken('borderRadiusButton'),
51
+ borderRadiusSM: getToken('borderRadiusButton'),
52
+ borderRadiusLG: getToken('borderRadiusButton'),
53
+ defaultShadow: '0 0px 0 rgba(0,0,0,0.02)',
54
+ primaryShadow: '0 0 0 rgba(5,145,255,0.1)',
55
+ // todo gFontFamilySecondaryBold: String = "Roboto"
56
+ // todo fontWeight700: Font.Weight = .bold 改用 text 组件实现
57
+ // fontWeight: getToken(''),
58
+ // fontfamily: getToken(''),
59
+
60
+ // 边框宽度
61
+ lineWidth: getToken('borderWidthButtonSecondary'),
62
+ // 默认文本按钮的文本色
63
+ textTextColor: getToken('colorButtonTextSecondary'),
64
+ // 按钮内间距
65
+ paddingInline: getToken('spacingButtonPaddingHorizontal'),
66
+ paddingInlineSM: getToken('spacingButtonPaddingHorizontal'),
67
+ paddingInlineLG: getToken('spacingButtonPaddingHorizontal'),
68
+ paddingBlock: getToken('spacingButtonPaddingVertical'),
69
+ paddingBlockSM: getToken('spacingButtonPaddingVertical'),
70
+ paddingBlockLG: getToken('spacingButtonPaddingVertical')
71
+ };
72
+ var inverseDesignTokens = {
73
+ // 算法配置
74
+ // algorithm: true,
75
+
76
+ // 主要按钮背景色
77
+ colorPrimary: getToken('colorButtonBackgroundPrimaryInverse'),
78
+ // 主要按钮 Hover
79
+ colorPrimaryHover: getToken('colorButtonBackgroundPrimaryInverse'),
80
+ colorPrimaryActive: getToken('colorButtonBackgroundPrimaryInverse'),
81
+ // 主要按钮 Active
82
+ // colorPrimaryBg: getToken('colorButtonBackgroundPrimaryInverse'),
83
+ // 主要按钮文本颜色
84
+ primaryColor: getToken('colorButtonTextPrimaryInverse'),
85
+ // 次要按钮背景色 默认是白色
86
+ defaultBg: "rgba(255,255,255,0)",
87
+ defaultHoverBg: "rgba(255,255,255,0)",
88
+ defaultActiveBg: "rgba(255,255,255,0)",
89
+ // 次要按钮文本颜色
90
+ defaultColor: getToken('colorButtonTextSecondaryInverse'),
91
+ // 次要按钮边框颜色
92
+ defaultBorderColor: getToken('colorButtonSecondaryBorderInverse'),
93
+ // 禁用按钮背景色 Hover
94
+ colorBgContainerDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
95
+ borderColorDisabled: getToken('colorButtonBackgroundPrimaryDisable'),
96
+ colorTextDisabled: getToken('colorButtonTextDisabled'),
97
+ // Success 按钮背景色
98
+ green1: getToken('colorButtonBackgroundSuccess'),
99
+ green2: getToken('colorButtonBackgroundSuccess'),
100
+ green3: getToken('colorButtonBackgroundSuccess'),
101
+ green4: getToken('colorButtonBackgroundSuccess'),
102
+ green5: getToken('colorButtonBackgroundSuccess'),
103
+ green6: getToken('colorButtonBackgroundSuccess'),
104
+ green7: getToken('colorButtonBackgroundSuccess'),
105
+ // 全局公用的:
106
+ // 按钮圆角
107
+ borderRadius: getToken('borderRadiusButton'),
108
+ borderRadiusSM: getToken('borderRadiusButton'),
109
+ borderRadiusLG: getToken('borderRadiusButton'),
110
+ defaultShadow: '0 0px 0 rgba(0,0,0,0.02)',
111
+ primaryShadow: '0 0 0 rgba(5,145,255,0.1)',
112
+ // todo gFontFamilySecondaryBold: String = "Roboto"
113
+ // todo fontWeight700: Font.Weight = .bold 改用 text 组件实现
114
+ // fontWeight: getToken(''),
115
+ // fontfamily: getToken(''),
116
+
117
+ // 边框宽度
118
+ lineWidth: getToken('borderWidthButtonSecondary'),
119
+ // 默认文本按钮的文本色
120
+ textTextColor: getToken('colorButtonTextSecondary'),
121
+ // 按钮内间距
122
+ paddingInline: getToken('spacingButtonPaddingHorizontal'),
123
+ paddingInlineSM: getToken('spacingButtonPaddingHorizontal'),
124
+ paddingInlineLG: getToken('spacingButtonPaddingHorizontal'),
125
+ paddingBlock: getToken('spacingButtonPaddingVertical'),
126
+ paddingBlockSM: getToken('spacingButtonPaddingVertical'),
127
+ paddingBlockLG: getToken('spacingButtonPaddingVertical')
128
+ };
129
+
130
+ // export default designTokens;
131
+ export { designTokens, inverseDesignTokens };
@@ -0,0 +1,44 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { noop } from '../../utils/noop';
3
+ import './style/button.less';
4
+ export type HtmlType = 'button' | 'reset' | 'submit';
5
+ export type Size = 'middle' | 'small' | 'large';
6
+ export type ButtonType = 'primary' | 'default' | 'dashed' | 'link' | 'text';
7
+ export type ButtonColorType = 'default' | 'primary' | 'danger' | 'blue' | 'purple' | 'cyan' | 'green' | 'magenta' | 'pink' | 'red' | 'orange' | 'yellow' | 'volcano' | 'geekblue' | 'lime' | 'gold';
8
+ export type fontSize = 'bannerTitle' | 'pageTitle' | 'sectionTitle' | 'header' | 'bodyBold' | 'bodyRegular' | 'bodyStrikethrough' | 'smallbodyRegular' | 'smallBodyStrikethrough' | 'smallBodySemiBold' | 'smallBodyBold' | 'smallBodyLink' | 'textLink' | 'mediumBody' | 'mediumBodyBold';
9
+ export interface xDXpProps {
10
+ 'x-dxp-prop'?: string;
11
+ }
12
+ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'color'> {
13
+ type?: ButtonType;
14
+ color?: ButtonColorType;
15
+ inverse?: boolean;
16
+ loading?: boolean;
17
+ htmlType?: HtmlType;
18
+ size?: Size;
19
+ fontSize?: fontSize;
20
+ disabled?: boolean;
21
+ block?: boolean;
22
+ style?: React.CSSProperties;
23
+ theme?: string;
24
+ prefixCls?: string;
25
+ 'aria-label'?: React.AriaAttributes['aria-label'];
26
+ contentClassName?: string;
27
+ [key: string]: any;
28
+ }
29
+ export default class Button extends PureComponent<ButtonProps> {
30
+ static defaultProps: {
31
+ disabled: boolean;
32
+ size: string;
33
+ fontSize: string;
34
+ type: string;
35
+ theme: string;
36
+ htmlType: string;
37
+ onMouseDown: typeof noop;
38
+ onClick: typeof noop;
39
+ onMouseEnter: typeof noop;
40
+ onMouseLeave: typeof noop;
41
+ prefixCls: string;
42
+ };
43
+ render(): React.JSX.Element;
44
+ }
@@ -0,0 +1,92 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
5
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
6
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
7
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
8
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
+ var _excluded = ["fontSize", "theme", "inverse"];
10
+ import { Button as AntdBtn, ConfigProvider } from 'antd';
11
+ import React, { PureComponent } from 'react';
12
+ import { cssClasses } from "../../constants";
13
+ import { noop } from "../../utils/noop";
14
+ import Text from "../Text";
15
+ import { designTokens, inverseDesignTokens } from "./designTokens";
16
+
17
+ // 这种是另一方 定制 antd 的 style 的方式; 现在使用了上面的 designTokens.ts 的方式。
18
+ import "./style/button.less";
19
+
20
+ // const { htmlTypes, btnTypes, sizes } = strings;
21
+
22
+ // export type Theme = 'solid' | 'borderless' | 'light' | 'outline';
23
+ var Button = /*#__PURE__*/function (_PureComponent) {
24
+ _inherits(Button, _PureComponent);
25
+ var _super = _createSuper(Button);
26
+ function Button() {
27
+ _classCallCheck(this, Button);
28
+ return _super.apply(this, arguments);
29
+ }
30
+ _createClass(Button, [{
31
+ key: "render",
32
+ value: function render() {
33
+ var _this$props = this.props,
34
+ children = _this$props.children,
35
+ style = _this$props.style,
36
+ inverse = _this$props.inverse,
37
+ fontSize = _this$props.fontSize;
38
+
39
+ // Filter out fontSize from props to avoid passing it to AntdBtn
40
+ // const { fontSize: _, ...filteredProps } = this.props;
41
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
42
+ var _this$props2 = this.props,
43
+ _ = _this$props2.fontSize,
44
+ __ = _this$props2.theme,
45
+ ___ = _this$props2.inverse,
46
+ filteredProps = _objectWithoutProperties(_this$props2, _excluded);
47
+
48
+ // todo : 临时处理,后续需要调整取值
49
+ var baseStyle = {
50
+ minWidth: '128px',
51
+ paddingTop: '8px',
52
+ paddingBottom: '8px'
53
+ };
54
+ var btnStyle = _objectSpread(_objectSpread({}, baseStyle), style);
55
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ConfigProvider, {
56
+ wave: {
57
+ disabled: true
58
+ }
59
+ // prefixCls={cssClasses.PREFIX}
60
+ ,
61
+ theme: {
62
+ // 这个外层的 Seed Token,影响范围大。
63
+ // token: designTokens,
64
+ components: {
65
+ Button: _objectSpread({}, inverse ? inverseDesignTokens : designTokens)
66
+ },
67
+ cssVar: true,
68
+ hashed: false
69
+ }
70
+ }, /*#__PURE__*/React.createElement(AntdBtn, _extends({}, filteredProps, {
71
+ style: btnStyle
72
+ }), /*#__PURE__*/React.createElement(Text, {
73
+ size: fontSize
74
+ }, children))));
75
+ }
76
+ }]);
77
+ return Button;
78
+ }(PureComponent);
79
+ _defineProperty(Button, "defaultProps", {
80
+ disabled: false,
81
+ size: 'large',
82
+ fontSize: 'bodyBold',
83
+ type: 'default',
84
+ theme: 'light',
85
+ htmlType: 'button',
86
+ onMouseDown: noop,
87
+ onClick: noop,
88
+ onMouseEnter: noop,
89
+ onMouseLeave: noop,
90
+ prefixCls: cssClasses.PREFIX + '-button'
91
+ });
92
+ export { Button as default };
@@ -0,0 +1,72 @@
1
+ import React, { PureComponent } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { noop } from '../../utils/noop';
4
+ import './style/button.less';
5
+ export type HtmlType = 'button' | 'reset' | 'submit';
6
+ export type Size = 'default' | 'small' | 'large';
7
+ export type Theme = 'solid' | 'borderless' | 'light' | 'outline';
8
+ export type Type = 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger';
9
+ export interface xDXpProps {
10
+ 'x-dxp-prop'?: string;
11
+ }
12
+ export interface ButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
13
+ id?: string;
14
+ type?: Type;
15
+ icon?: React.ReactNode;
16
+ block?: boolean;
17
+ circle?: boolean;
18
+ children?: React.ReactNode;
19
+ disabled?: boolean;
20
+ className?: string;
21
+ iconPosition?: 'left' | 'right';
22
+ loading?: boolean;
23
+ htmlType?: HtmlType;
24
+ size?: Size;
25
+ style?: React.CSSProperties;
26
+ theme?: Theme;
27
+ prefixCls?: string;
28
+ onClick?: React.MouseEventHandler<HTMLButtonElement>;
29
+ onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
30
+ onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
31
+ onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
32
+ 'aria-label'?: React.AriaAttributes['aria-label'];
33
+ 'x-dxp-children-alias'?: string;
34
+ contentClassName?: string;
35
+ [key: string]: any;
36
+ }
37
+ export default class Button extends PureComponent<ButtonProps> {
38
+ static defaultProps: {
39
+ disabled: boolean;
40
+ size: string;
41
+ type: string;
42
+ theme: string;
43
+ block: boolean;
44
+ htmlType: string;
45
+ onMouseDown: typeof noop;
46
+ onClick: typeof noop;
47
+ onMouseEnter: typeof noop;
48
+ onMouseLeave: typeof noop;
49
+ prefixCls: string;
50
+ };
51
+ static propTypes: {
52
+ children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
53
+ disabled: PropTypes.Requireable<boolean>;
54
+ prefixCls: PropTypes.Requireable<string>;
55
+ style: PropTypes.Requireable<object>;
56
+ size: PropTypes.Requireable<"default" | "small" | "large">;
57
+ type: PropTypes.Requireable<"primary" | "secondary" | "tertiary" | "warning" | "danger">;
58
+ block: PropTypes.Requireable<boolean>;
59
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
60
+ onMouseDown: PropTypes.Requireable<(...args: any[]) => any>;
61
+ circle: PropTypes.Requireable<boolean>;
62
+ loading: PropTypes.Requireable<boolean>;
63
+ htmlType: PropTypes.Requireable<"button" | "reset" | "submit">;
64
+ theme: PropTypes.Requireable<"solid" | "borderless" | "light" | "outline">;
65
+ className: PropTypes.Requireable<string>;
66
+ onMouseEnter: PropTypes.Requireable<(...args: any[]) => any>;
67
+ onMouseLeave: PropTypes.Requireable<(...args: any[]) => any>;
68
+ 'aria-label': PropTypes.Requireable<string>;
69
+ contentClassName: PropTypes.Requireable<string>;
70
+ };
71
+ render(): React.JSX.Element;
72
+ }