@arco-design/mobile-react 2.19.1-941e02b.7 → 2.20.0

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 (130) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.en-US.md +6 -6
  3. package/README.md +6 -6
  4. package/cjs/_helpers/type.d.ts +1 -1
  5. package/cjs/avatar/group.js +1 -1
  6. package/cjs/avatar/index.js +10 -13
  7. package/cjs/avatar/style/css/index.css +96 -126
  8. package/cjs/avatar/style/index.less +54 -72
  9. package/cjs/badge/index.js +6 -8
  10. package/cjs/badge/style/css/index.css +5 -5
  11. package/cjs/badge/style/index.less +5 -5
  12. package/cjs/button/hooks.d.ts +1 -2
  13. package/cjs/button/hooks.js +5 -3
  14. package/cjs/button/index.d.ts +12 -0
  15. package/cjs/button/index.js +40 -33
  16. package/cjs/button/style/css/index.css +75 -310
  17. package/cjs/button/style/index.less +32 -38
  18. package/cjs/count-down/demo/style/mobile.less +1 -1
  19. package/cjs/dropdown/dropdown.d.ts +3 -0
  20. package/cjs/dropdown/dropdown.js +306 -0
  21. package/cjs/dropdown/index.d.ts +3 -4
  22. package/cjs/dropdown/index.js +3 -303
  23. package/cjs/dropdown/options.js +2 -1
  24. package/cjs/dropdown/type.d.ts +20 -9
  25. package/cjs/dropdown-menu/dropdown-menu.d.ts +4 -0
  26. package/cjs/dropdown-menu/dropdown-menu.js +273 -0
  27. package/cjs/dropdown-menu/helper.d.ts +1 -1
  28. package/cjs/dropdown-menu/index.d.ts +2 -3
  29. package/cjs/dropdown-menu/index.js +2 -245
  30. package/cjs/dropdown-menu/type.d.ts +21 -20
  31. package/cjs/image/index.js +4 -1
  32. package/cjs/image/style/css/index.css +2 -1
  33. package/cjs/image/style/index.less +2 -1
  34. package/cjs/image-picker/index.d.ts +11 -8
  35. package/cjs/image-picker/index.js +19 -12
  36. package/cjs/image-picker/style/index.less +1 -1
  37. package/cjs/nav-bar/index.js +7 -2
  38. package/cjs/notify/index.d.ts +1 -0
  39. package/cjs/notify/index.js +12 -0
  40. package/cjs/notify/type.d.ts +1 -0
  41. package/cjs/show-monitor/index.js +31 -3
  42. package/cjs/transition/index.js +4 -2
  43. package/dist/index.js +677 -617
  44. package/dist/index.min.js +4 -4
  45. package/dist/style.css +174 -438
  46. package/dist/style.min.css +1 -1
  47. package/esm/_helpers/type.d.ts +1 -1
  48. package/esm/avatar/group.js +1 -1
  49. package/esm/avatar/index.js +10 -13
  50. package/esm/avatar/style/css/index.css +96 -126
  51. package/esm/avatar/style/index.less +54 -72
  52. package/esm/badge/index.js +6 -8
  53. package/esm/badge/style/css/index.css +5 -5
  54. package/esm/badge/style/index.less +5 -5
  55. package/esm/button/hooks.d.ts +1 -2
  56. package/esm/button/hooks.js +5 -3
  57. package/esm/button/index.d.ts +12 -0
  58. package/esm/button/index.js +42 -35
  59. package/esm/button/style/css/index.css +75 -310
  60. package/esm/button/style/index.less +32 -38
  61. package/esm/count-down/demo/style/mobile.less +1 -1
  62. package/esm/dropdown/dropdown.d.ts +3 -0
  63. package/esm/dropdown/dropdown.js +288 -0
  64. package/esm/dropdown/index.d.ts +3 -4
  65. package/esm/dropdown/index.js +3 -293
  66. package/esm/dropdown/options.js +2 -1
  67. package/esm/dropdown/type.d.ts +20 -9
  68. package/esm/dropdown-menu/dropdown-menu.d.ts +4 -0
  69. package/esm/dropdown-menu/dropdown-menu.js +256 -0
  70. package/esm/dropdown-menu/helper.d.ts +1 -1
  71. package/esm/dropdown-menu/index.d.ts +2 -3
  72. package/esm/dropdown-menu/index.js +2 -237
  73. package/esm/dropdown-menu/type.d.ts +21 -20
  74. package/esm/image/index.js +4 -1
  75. package/esm/image/style/css/index.css +2 -1
  76. package/esm/image/style/index.less +2 -1
  77. package/esm/image-picker/index.d.ts +11 -8
  78. package/esm/image-picker/index.js +19 -12
  79. package/esm/image-picker/style/index.less +1 -1
  80. package/esm/nav-bar/index.js +6 -2
  81. package/esm/notify/index.d.ts +1 -0
  82. package/esm/notify/index.js +1 -0
  83. package/esm/notify/type.d.ts +1 -0
  84. package/esm/show-monitor/index.js +31 -3
  85. package/esm/transition/index.js +4 -2
  86. package/package.json +3 -3
  87. package/tokens/app/arcodesign/default/css-variables.less +2 -1
  88. package/tokens/app/arcodesign/default/index.d.ts +2 -1
  89. package/tokens/app/arcodesign/default/index.js +2 -1
  90. package/tokens/app/arcodesign/default/index.json +123 -47
  91. package/tokens/app/arcodesign/default/index.less +2 -1
  92. package/umd/_helpers/type.d.ts +1 -1
  93. package/umd/avatar/group.js +1 -1
  94. package/umd/avatar/index.js +10 -13
  95. package/umd/avatar/style/css/index.css +96 -126
  96. package/umd/avatar/style/index.less +54 -72
  97. package/umd/badge/index.js +6 -8
  98. package/umd/badge/style/css/index.css +5 -5
  99. package/umd/badge/style/index.less +5 -5
  100. package/umd/button/hooks.d.ts +1 -2
  101. package/umd/button/hooks.js +5 -3
  102. package/umd/button/index.d.ts +12 -0
  103. package/umd/button/index.js +40 -33
  104. package/umd/button/style/css/index.css +75 -310
  105. package/umd/button/style/index.less +32 -38
  106. package/umd/count-down/demo/style/mobile.less +1 -1
  107. package/umd/dropdown/dropdown.d.ts +3 -0
  108. package/umd/dropdown/dropdown.js +309 -0
  109. package/umd/dropdown/index.d.ts +3 -4
  110. package/umd/dropdown/index.js +5 -298
  111. package/umd/dropdown/options.js +2 -1
  112. package/umd/dropdown/type.d.ts +20 -9
  113. package/umd/dropdown-menu/dropdown-menu.d.ts +4 -0
  114. package/umd/dropdown-menu/dropdown-menu.js +278 -0
  115. package/umd/dropdown-menu/helper.d.ts +1 -1
  116. package/umd/dropdown-menu/index.d.ts +2 -3
  117. package/umd/dropdown-menu/index.js +5 -241
  118. package/umd/dropdown-menu/type.d.ts +21 -20
  119. package/umd/image/index.js +4 -1
  120. package/umd/image/style/css/index.css +2 -1
  121. package/umd/image/style/index.less +2 -1
  122. package/umd/image-picker/index.d.ts +11 -8
  123. package/umd/image-picker/index.js +19 -12
  124. package/umd/image-picker/style/index.less +1 -1
  125. package/umd/nav-bar/index.js +9 -6
  126. package/umd/notify/index.d.ts +1 -0
  127. package/umd/notify/index.js +13 -4
  128. package/umd/notify/type.d.ts +1 -0
  129. package/umd/show-monitor/index.js +31 -3
  130. package/umd/transition/index.js +4 -2
@@ -2,16 +2,6 @@
2
2
 
3
3
  @size-map: @avatar-size-map;
4
4
 
5
- .@{prefix}-avatar-wrapper {
6
- display: inline-block;
7
- .set-with-info-avatar-size(length(@size-map));
8
-
9
- &.with-info {
10
- display: flex;
11
- align-items: center;
12
- }
13
- }
14
-
15
5
  .@{prefix}-avatar {
16
6
  position: relative;
17
7
  font-size: 0;
@@ -20,21 +10,23 @@
20
10
  justify-content: center;
21
11
  .use-var(color, avatar-text-font-color);
22
12
  .use-var(background-color, avatar-background);
23
- &.@{prefix}-image-avatar {
13
+
14
+ &-mode-image {
24
15
  background-color: transparent;
25
16
  }
26
17
 
27
- &.default-overlap {
18
+ &-default-overlap {
28
19
  .use-var(background-color, avatar-default-overlap-background);
29
20
  }
30
21
 
31
- &.circle {
22
+ &-shape-circle {
32
23
  .set-avatar-radius(50%);
33
24
  }
34
25
 
35
- &.square {
26
+ &-shape-square {
36
27
  .set-avatar-radius(.08rem);
37
28
  }
29
+
38
30
  .set-avatar-size(length(@size-map));
39
31
 
40
32
  &-img {
@@ -50,26 +42,34 @@
50
42
  flex: 0 0 auto;
51
43
  font-weight: bold;
52
44
  }
53
- }
54
45
 
55
- .@{prefix}-avatar-info {
56
- display: flex;
57
- justify-content: center;
58
- flex-direction: column;
59
- .rem(margin-left, 16);
60
- }
46
+ &-wrapper {
47
+ display: inline-block;
61
48
 
62
- .@{prefix}-avatar-name {
63
- .use-var(color, avatar-name-color);
64
- }
49
+ &-with-info {
50
+ display: flex;
51
+ align-items: center;
52
+ }
53
+ }
65
54
 
66
- .@{prefix}-avatar-desc {
67
- .use-var(color, avatar-desc-color);
68
- }
55
+ &-info {
56
+ display: flex;
57
+ justify-content: center;
58
+ flex-direction: column;
59
+ .rem(margin-left, 16);
60
+ }
69
61
 
62
+ &-name {
63
+ .use-var(color, avatar-name-color);
64
+ }
65
+
66
+ &-desc {
67
+ .use-var(color, avatar-desc-color);
68
+ }
69
+ }
70
70
 
71
71
  .@{prefix}-avatar-group {
72
- .@{prefix}-avatar-wrapper.circle {
72
+ .@{prefix}-avatar-wrapper-shape-circle {
73
73
  position: relative; // 为了让z-index属性生效
74
74
 
75
75
  &:first-child {
@@ -92,39 +92,12 @@
92
92
  }
93
93
  }
94
94
 
95
- // 循环设置各头像大小的属性
96
-
97
- .set-with-info-avatar-size(@index) when (@index > 0) {
98
-
99
- @size: extract(@size-map, @index);
100
-
101
- // 有辅助信息的样式
102
- &.with-info.@{size} {
103
- .use-var(height, "avatar-info-box-@{size}-size");
104
- }
105
-
106
- // 用户名样式
107
- &.@{size} .@{prefix}-avatar-name {
108
- .use-var(font-size, "avatar-name-@{size}-font-size");
109
- .use-var(line-height, "avatar-name-@{size}-line-height");
110
- }
111
-
112
- // 用户描述样式
113
- &.@{size} .@{prefix}-avatar-desc {
114
- .use-var(margin-top, "avatar-desc-@{size}-margin-top");
115
- .use-var(font-size, "avatar-desc-@{size}-font-size");
116
- .use-var(line-height, "avatar-desc-@{size}-line-height");
117
- }
118
-
119
- .set-with-info-avatar-size(@index - 1);
120
- }
121
-
122
95
  // 循环设置头像叠层的样式
123
96
  .set-avatar-group-size(@index) when (@index > 0) {
124
97
 
125
98
  @size: extract(@size-map, @index);
126
99
 
127
- &.group-@{size} {
100
+ &-size-@{size} {
128
101
  .@{prefix}-avatar-wrapper {
129
102
  .use-var(margin-left, "avatar-group-@{size}-size-offset");
130
103
  }
@@ -141,24 +114,33 @@
141
114
 
142
115
  @size: extract(@size-map, @index);
143
116
 
144
- &.group-@{size} {
145
- .@{prefix}-avatar-wrapper {
146
- .use-var(margin-left, "avatar-group-@{size}-size-offset");
147
- }
148
- .@{prefix}-avatar {
149
- .use-var(border-width, "avatar-group-@{size}-size-border");
150
- }
151
- }
152
-
153
- &.@{size} {
117
+ &-size-@{size} {
154
118
  .use-var(width, "avatar-@{size}-size");
155
119
  .use-var(height, "avatar-@{size}-size");
156
- .@{prefix}-avatar-default {
157
- .use-var(font-size, "avatar-default-overlap-@{size}-size");
158
- }
159
- .@{prefix}-avatar-text {
160
- .use-var(font-size, "avatar-@{size}-text-font-size");
161
- }
120
+ }
121
+ &-default-icon-size-@{size} {
122
+ .use-var(font-size, "avatar-default-overlap-@{size}-size");
123
+ }
124
+ &-text-size-@{size} {
125
+ .use-var(font-size, "avatar-@{size}-text-font-size");
126
+ }
127
+
128
+ // 有辅助信息的样式
129
+ &-wrapper-with-info-size-@{size} {
130
+ .use-var(height, "avatar-info-box-@{size}-size");
131
+ }
132
+
133
+ // 用户名样式
134
+ &-name-size-@{size} {
135
+ .use-var(font-size, "avatar-name-@{size}-font-size");
136
+ .use-var(line-height, "avatar-name-@{size}-line-height");
137
+ }
138
+
139
+ // 用户描述样式
140
+ &-desc-size-@{size} {
141
+ .use-var(margin-top, "avatar-desc-@{size}-margin-top");
142
+ .use-var(font-size, "avatar-desc-@{size}-font-size");
143
+ .use-var(line-height, "avatar-desc-@{size}-line-height");
162
144
  }
163
145
 
164
146
  .set-avatar-size(@index - 1);
@@ -52,27 +52,25 @@ var Badge = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
52
52
  };
53
53
  });
54
54
 
55
- function renderInnerBadge() {
55
+ function renderInnerBadge(prefix) {
56
56
  return dot ? null : /*#__PURE__*/_react.default.createElement("span", {
57
- className: "badge-text"
57
+ className: prefix + "-text badge-text"
58
58
  }, Number(text) && Number(text) > maxCount ? maxCount + "+" : text);
59
59
  }
60
60
 
61
61
  return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
62
+ var _cls;
63
+
62
64
  var prefixCls = _ref.prefixCls;
63
65
  return /*#__PURE__*/_react.default.createElement(_transition.default, {
64
66
  in: visible,
65
67
  timeout: timeout,
66
68
  type: "scale"
67
69
  }, /*#__PURE__*/_react.default.createElement("div", {
68
- className: (0, _mobileUtils.cls)(prefixCls + "-badge", className, {
69
- dot: dot,
70
- bordered: bordered,
71
- absolute: absolute
72
- }),
70
+ className: (0, _mobileUtils.cls)(prefixCls + "-badge", className, (_cls = {}, _cls[prefixCls + "-badge-dot dot"] = dot, _cls[prefixCls + "-badge-bordered bordered"] = bordered, _cls[prefixCls + "-badge-absolute absolute"] = absolute, _cls)),
73
71
  style: style,
74
72
  ref: domRef
75
- }, children || renderInnerBadge()));
73
+ }, children || renderInnerBadge(prefixCls + "-badge")));
76
74
  });
77
75
  });
78
76
  var _default = Badge;
@@ -68,28 +68,28 @@
68
68
  min-width: 8PX;
69
69
  padding: 0 4PX ;
70
70
  }
71
- .arco-badge .badge-text {
71
+ .arco-badge-text {
72
72
  display: block;
73
73
  font-weight: 500;
74
74
  font-size: 12PX;
75
75
  }
76
- .arco-badge.dot {
76
+ .arco-badge-dot {
77
77
  width: 8PX ;
78
78
  height: 8PX ;
79
79
  padding: 0;
80
80
  min-width: auto;
81
81
  }
82
- .arco-badge.bordered {
82
+ .arco-badge-bordered {
83
83
  border: 1PX solid #FFFFFF ;
84
84
  }
85
- .arco-badge.absolute {
85
+ .arco-badge-absolute {
86
86
  position: absolute;
87
87
  top: 0;
88
88
  left: 100%;
89
89
  margin-left: -8PX ;
90
90
  margin-top: -8PX ;
91
91
  }
92
- .arco-badge.absolute.dot {
92
+ .arco-badge-absolute.arco-badge-dot {
93
93
  margin-left: -4PX ;
94
94
  margin-top: -4PX ;
95
95
  }
@@ -40,24 +40,24 @@
40
40
  .set-content-box-width-var(min-width, badge-text-width, badge-text-padding, badge-text-padding);
41
41
  .use-var(padding, badge-text-padding, 0);
42
42
 
43
- .badge-text {
43
+ &-text {
44
44
  display: block;
45
45
  font-weight: 500;
46
46
  .set-font-size-var(badge-font-size);
47
47
  }
48
48
 
49
- &.dot {
49
+ &-dot {
50
50
  .use-var(width, badge-dot-width);
51
51
  .use-var(height, badge-dot-width);
52
52
  padding: 0;
53
53
  min-width: auto;
54
54
  }
55
55
 
56
- &.bordered {
56
+ &-bordered {
57
57
  .use-var(border, badge-border-color, 1PX solid);
58
58
  }
59
59
 
60
- &.absolute {
60
+ &-absolute {
61
61
  position: absolute;
62
62
  top: 0;
63
63
  left: 100%;
@@ -65,7 +65,7 @@
65
65
  .use-var(margin-top, badge-text-deviation);
66
66
  }
67
67
 
68
- &.absolute.dot {
68
+ &-absolute&-dot {
69
69
  .use-var(margin-left, badge-dot-deviation);
70
70
  .use-var(margin-top, badge-dot-deviation);
71
71
  }
@@ -1,8 +1,7 @@
1
1
  import { CSSProperties } from 'react';
2
2
  import { ButtonProps } from '.';
3
- export declare const useCustomColor: ({ color, bgColor, borderColor, isActive: active, disabled, }: Pick<ButtonProps, "color" | "borderColor" | "type" | "bgColor"> & {
3
+ export declare const useCustomColor: ({ color, bgColor, borderColor, isActive: active, disabled, halfBorder, }: Pick<ButtonProps, 'color' | 'bgColor' | 'borderColor' | 'type' | 'disabled' | 'halfBorder'> & {
4
4
  isActive: boolean;
5
- disabled: boolean;
6
5
  }) => {
7
6
  customColorStyle: CSSProperties;
8
7
  customColorClass: string[];
@@ -27,7 +27,8 @@ var useCustomColor = function useCustomColor(_ref) {
27
27
  bgColor = _ref.bgColor,
28
28
  borderColor = _ref.borderColor,
29
29
  active = _ref.isActive,
30
- disabled = _ref.disabled;
30
+ disabled = _ref.disabled,
31
+ halfBorder = _ref.halfBorder;
31
32
  var state = {
32
33
  active: active,
33
34
  disabled: disabled
@@ -64,8 +65,9 @@ var useCustomColor = function useCustomColor(_ref) {
64
65
  return res;
65
66
  }, [styleConfig, active, disabled]);
66
67
  var customColorClass = (0, _react.useMemo)(function () {
67
- return styleConfig.borderColor ? ['has-custom-border'] : [];
68
- }, [diffColor(borderColor)]);
68
+ var borderCls = halfBorder ? 'half-border' : '';
69
+ return styleConfig.borderColor ? ['has-custom-border'] : [borderCls];
70
+ }, [styleConfig.borderColor, halfBorder]);
69
71
  return {
70
72
  customColorStyle: customColorStyle,
71
73
  customColorClass: customColorClass
@@ -109,6 +109,18 @@ export interface ButtonProps {
109
109
  * @en Callback function when disabling button
110
110
  */
111
111
  onClickDisabled?: (e: React.MouseEvent) => void;
112
+ /**
113
+ * 加载中是否禁用按钮操作
114
+ * @en Disable button when loading
115
+ * @default true
116
+ */
117
+ disableWhenLoading?: boolean;
118
+ /**
119
+ * 加载中是否覆盖Icon
120
+ * @en Whether to override Icon during loading
121
+ * @default true
122
+ */
123
+ coverIconWhenLoading?: boolean;
112
124
  }
113
125
  export interface ButtonRef {
114
126
  /**
@@ -32,6 +32,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
32
32
  * @name_en Button
33
33
  */
34
34
  var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
35
+ var _ref, _cls;
36
+
35
37
  var _useState = (0, _react.useState)(false),
36
38
  isActive = _useState[0],
37
39
  setActive = _useState[1];
@@ -47,6 +49,8 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
47
49
  loading = _props$loading === void 0 ? false : _props$loading,
48
50
  _props$disabled = props.disabled,
49
51
  disabled = _props$disabled === void 0 ? false : _props$disabled,
52
+ _props$disableWhenLoa = props.disableWhenLoading,
53
+ disableWhenLoading = _props$disableWhenLoa === void 0 ? true : _props$disableWhenLoa,
50
54
  _props$shape = props.shape,
51
55
  shape = _props$shape === void 0 ? 'semi' : _props$shape,
52
56
  _props$halfBorder = props.halfBorder,
@@ -67,8 +71,15 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
67
71
  children = _props$children === void 0 ? null : _props$children,
68
72
  loadingIcon = props.loadingIcon,
69
73
  onClick = props.onClick,
70
- onClickDisabled = props.onClickDisabled;
74
+ onClickDisabled = props.onClickDisabled,
75
+ _props$coverIconWhenL = props.coverIconWhenLoading,
76
+ coverIconWhenLoading = _props$coverIconWhenL === void 0 ? true : _props$coverIconWhenL;
71
77
  var domRef = (0, _react.useRef)(null);
78
+
79
+ var _useContext = (0, _react.useContext)(_contextProvider.GlobalContext),
80
+ prefixCls = _useContext.prefixCls;
81
+
82
+ var prefix = prefixCls + "-button";
72
83
  (0, _react.useImperativeHandle)(ref, function () {
73
84
  return {
74
85
  dom: domRef.current
@@ -80,7 +91,8 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
80
91
  bgColor: bgColor,
81
92
  borderColor: borderColor,
82
93
  isActive: isActive,
83
- disabled: disabled
94
+ disabled: disabled,
95
+ halfBorder: halfBorder
84
96
  }),
85
97
  customColorClass = _useCustomColor.customColorClass,
86
98
  customColorStyle = _useCustomColor.customColorStyle;
@@ -95,37 +107,32 @@ var Button = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
95
107
  setActive(false);
96
108
  };
97
109
 
98
- return /*#__PURE__*/_react.default.createElement(_contextProvider.ContextLayout, null, function (_ref) {
99
- var prefixCls = _ref.prefixCls;
100
- return /*#__PURE__*/_react.default.createElement("button", {
101
- type: "button",
102
- ref: domRef,
103
- style: (0, _extends2.default)({}, customColorStyle, style),
104
- className: _mobileUtils.cls.apply(void 0, [prefixCls + "-button", className, "type-" + type, "size-" + size, "is-" + shape, system, {
105
- inline: inline,
106
- disabled: disabled,
107
- loading: loading,
108
- active: isActive,
109
- 'half-border': halfBorder
110
- }].concat(customColorClass)),
111
- onTouchStart: handleTouchStart,
112
- onTouchEnd: handleTouchEnd,
113
- onTouchCancel: handleTouchEnd,
114
- onMouseDown: handleTouchStart,
115
- onMouseUp: handleTouchEnd,
116
- onClick: disabled ? onClickDisabled : onClick
117
- }, /*#__PURE__*/_react.default.createElement("div", {
118
- className: "btn-icon"
119
- }, icon, loading && (loadingIcon === void 0 ? /*#__PURE__*/_react.default.createElement(_loading.default, {
120
- className: "loading-icon",
121
- radius: 6,
122
- type: "circle"
123
- }) : loadingIcon)), (!loading || loading && showTextWhenLoading) && children ? /*#__PURE__*/_react.default.createElement("div", {
124
- className: (0, _mobileUtils.cls)('btn-text', {
125
- 'has-icon': loading || icon
126
- })
127
- }, children) : null);
128
- });
110
+ var renderIcon = function renderIcon() {
111
+ if (coverIconWhenLoading) {
112
+ return loading ? null : icon;
113
+ }
114
+
115
+ return icon;
116
+ };
117
+
118
+ return /*#__PURE__*/_react.default.createElement("button", {
119
+ type: "button",
120
+ ref: domRef,
121
+ style: (0, _extends2.default)({}, customColorStyle, style),
122
+ className: _mobileUtils.cls.apply(void 0, [prefix, prefix + "-type-" + type + " type-" + type, prefix + "-size-" + size + " " + prefix + "-size-" + size + "-is-" + shape + " size-" + size, className, "is-" + shape, system, (_ref = {}, _ref[prefix + "-inline inline"] = inline, _ref[prefix + "-type-" + type + "-disabled disabled"] = disabled, _ref.loading = loading, _ref[prefix + "-type-" + type + "-active active"] = isActive, _ref)].concat(customColorClass)),
123
+ onTouchStart: handleTouchStart,
124
+ onTouchEnd: handleTouchEnd,
125
+ onTouchCancel: handleTouchEnd,
126
+ onClick: disabled || loading && disableWhenLoading ? onClickDisabled : onClick
127
+ }, icon || loading ? /*#__PURE__*/_react.default.createElement("div", {
128
+ className: prefix + "-icon btn-icon"
129
+ }, renderIcon(), loading && (loadingIcon === void 0 ? /*#__PURE__*/_react.default.createElement(_loading.default, {
130
+ className: prefix + "-loading-icon loading-icon",
131
+ radius: 6,
132
+ type: "circle"
133
+ }) : loadingIcon)) : null, (!loading || loading && showTextWhenLoading) && children ? /*#__PURE__*/_react.default.createElement("div", {
134
+ className: (0, _mobileUtils.cls)(prefix + "-text", prefix + "-text-" + system, 'btn-text', (_cls = {}, _cls[prefix + "-text-has-icon has-icon"] = loading || icon, _cls))
135
+ }, children) : null);
129
136
  });
130
137
  var _default = Button;
131
138
  exports.default = _default;