@douyinfe/semi-ui 2.13.0-beta.0 → 2.14.0-beta.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 (207) hide show
  1. package/autoComplete/_story/CustomTrigger/index.jsx +1 -1
  2. package/avatar/_story/avatar.stories.js +62 -5
  3. package/avatar/avatarGroup.tsx +16 -4
  4. package/avatar/index.tsx +88 -17
  5. package/backtop/index.tsx +11 -7
  6. package/badge/index.tsx +1 -1
  7. package/banner/index.tsx +5 -5
  8. package/breadcrumb/index.tsx +5 -3
  9. package/button/Button.tsx +10 -8
  10. package/calendar/_story/calendar.stories.js +125 -1
  11. package/card/index.tsx +43 -41
  12. package/carousel/CarouselArrow.tsx +2 -0
  13. package/carousel/index.tsx +1 -0
  14. package/cascader/_story/cascader.stories.js +21 -0
  15. package/cascader/index.tsx +103 -122
  16. package/cascader/item.tsx +1 -1
  17. package/checkbox/checkbox.tsx +13 -2
  18. package/collapsible/index.tsx +8 -1
  19. package/datePicker/dateInput.tsx +1 -0
  20. package/datePicker/datePicker.tsx +13 -5
  21. package/dist/css/semi.css +73 -35
  22. package/dist/css/semi.min.css +1 -1
  23. package/dist/umd/semi-ui.js +719 -368
  24. package/dist/umd/semi-ui.js.map +1 -1
  25. package/dist/umd/semi-ui.min.js +1 -1
  26. package/dist/umd/semi-ui.min.js.map +1 -1
  27. package/divider/index.tsx +8 -4
  28. package/dropdown/index.tsx +1 -1
  29. package/empty/index.tsx +13 -5
  30. package/form/hoc/withField.tsx +1 -1
  31. package/form/label.tsx +1 -1
  32. package/grid/col.tsx +1 -1
  33. package/grid/row.tsx +1 -1
  34. package/gulpfile.js +5 -5
  35. package/iconButton/index.tsx +2 -1
  36. package/input/_story/input.stories.js +32 -3
  37. package/input/index.tsx +45 -23
  38. package/input/inputGroup.tsx +3 -1
  39. package/input/textarea.tsx +2 -14
  40. package/lib/cjs/_base/base.css +36 -14
  41. package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
  42. package/lib/cjs/avatar/avatarGroup.js +36 -9
  43. package/lib/cjs/avatar/index.d.ts +5 -0
  44. package/lib/cjs/avatar/index.js +121 -41
  45. package/lib/cjs/backtop/index.js +2 -1
  46. package/lib/cjs/badge/index.js +2 -1
  47. package/lib/cjs/banner/index.js +9 -4
  48. package/lib/cjs/breadcrumb/index.js +4 -3
  49. package/lib/cjs/button/Button.js +13 -3
  50. package/lib/cjs/card/index.js +10 -5
  51. package/lib/cjs/carousel/CarouselArrow.js +6 -2
  52. package/lib/cjs/carousel/index.js +2 -1
  53. package/lib/cjs/cascader/index.js +15 -8
  54. package/lib/cjs/cascader/item.js +2 -1
  55. package/lib/cjs/checkbox/checkbox.js +6 -2
  56. package/lib/cjs/collapsible/index.js +2 -1
  57. package/lib/cjs/datePicker/dateInput.js +2 -1
  58. package/lib/cjs/datePicker/datePicker.js +4 -2
  59. package/lib/cjs/divider/index.js +2 -1
  60. package/lib/cjs/dropdown/index.js +2 -1
  61. package/lib/cjs/empty/index.js +8 -4
  62. package/lib/cjs/form/hoc/withField.js +2 -1
  63. package/lib/cjs/form/label.js +2 -1
  64. package/lib/cjs/grid/col.js +2 -1
  65. package/lib/cjs/grid/row.js +2 -1
  66. package/lib/cjs/iconButton/index.js +3 -1
  67. package/lib/cjs/input/index.d.ts +0 -1
  68. package/lib/cjs/input/index.js +41 -36
  69. package/lib/cjs/input/inputGroup.js +2 -3
  70. package/lib/cjs/input/textarea.js +8 -15
  71. package/lib/cjs/list/index.js +6 -3
  72. package/lib/cjs/modal/ConfirmModal.js +2 -1
  73. package/lib/cjs/modal/Modal.js +6 -2
  74. package/lib/cjs/modal/ModalContent.js +13 -6
  75. package/lib/cjs/notification/notice.js +6 -3
  76. package/lib/cjs/pagination/index.js +4 -2
  77. package/lib/cjs/popconfirm/index.js +6 -3
  78. package/lib/cjs/radio/radio.d.ts +4 -0
  79. package/lib/cjs/radio/radio.js +32 -9
  80. package/lib/cjs/radio/radioInner.d.ts +6 -0
  81. package/lib/cjs/radio/radioInner.js +13 -4
  82. package/lib/cjs/rating/item.js +2 -1
  83. package/lib/cjs/scrollList/index.js +6 -3
  84. package/lib/cjs/select/index.js +10 -4
  85. package/lib/cjs/select/option.js +2 -1
  86. package/lib/cjs/sideSheet/SideSheetContent.js +6 -3
  87. package/lib/cjs/skeleton/index.js +3 -1
  88. package/lib/cjs/space/index.js +2 -1
  89. package/lib/cjs/spin/index.js +7 -3
  90. package/lib/cjs/switch/index.js +6 -4
  91. package/lib/cjs/table/Table.js +6 -3
  92. package/lib/cjs/tabs/TabBar.js +2 -1
  93. package/lib/cjs/tabs/TabPane.js +5 -2
  94. package/lib/cjs/tagInput/index.js +33 -22
  95. package/lib/cjs/timePicker/Combobox.js +3 -1
  96. package/lib/cjs/timePicker/TimePicker.js +2 -0
  97. package/lib/cjs/toast/toast.js +6 -3
  98. package/lib/cjs/tooltip/index.js +6 -1
  99. package/lib/cjs/transfer/index.js +2 -1
  100. package/lib/cjs/tree/treeNode.js +2 -1
  101. package/lib/cjs/treeSelect/index.js +10 -3
  102. package/lib/cjs/typography/base.js +2 -1
  103. package/lib/cjs/upload/index.d.ts +1 -1
  104. package/lib/cjs/upload/index.js +13 -6
  105. package/lib/es/_base/base.css +36 -14
  106. package/lib/es/avatar/avatarGroup.d.ts +1 -1
  107. package/lib/es/avatar/avatarGroup.js +37 -9
  108. package/lib/es/avatar/index.d.ts +5 -0
  109. package/lib/es/avatar/index.js +119 -38
  110. package/lib/es/backtop/index.js +2 -1
  111. package/lib/es/badge/index.js +2 -1
  112. package/lib/es/banner/index.js +9 -4
  113. package/lib/es/breadcrumb/index.js +4 -3
  114. package/lib/es/button/Button.js +11 -3
  115. package/lib/es/card/index.js +10 -5
  116. package/lib/es/carousel/CarouselArrow.js +6 -2
  117. package/lib/es/carousel/index.js +2 -1
  118. package/lib/es/cascader/index.js +15 -8
  119. package/lib/es/cascader/item.js +2 -1
  120. package/lib/es/checkbox/checkbox.js +6 -2
  121. package/lib/es/collapsible/index.js +2 -1
  122. package/lib/es/datePicker/dateInput.js +2 -1
  123. package/lib/es/datePicker/datePicker.js +4 -2
  124. package/lib/es/divider/index.js +2 -1
  125. package/lib/es/dropdown/index.js +2 -1
  126. package/lib/es/empty/index.js +8 -4
  127. package/lib/es/form/hoc/withField.js +2 -1
  128. package/lib/es/form/label.js +2 -1
  129. package/lib/es/grid/col.js +2 -1
  130. package/lib/es/grid/row.js +2 -1
  131. package/lib/es/iconButton/index.js +3 -1
  132. package/lib/es/input/index.d.ts +0 -1
  133. package/lib/es/input/index.js +41 -36
  134. package/lib/es/input/inputGroup.js +2 -3
  135. package/lib/es/input/textarea.js +8 -15
  136. package/lib/es/list/index.js +6 -3
  137. package/lib/es/modal/ConfirmModal.js +2 -1
  138. package/lib/es/modal/Modal.js +6 -2
  139. package/lib/es/modal/ModalContent.js +13 -6
  140. package/lib/es/notification/notice.js +6 -3
  141. package/lib/es/pagination/index.js +4 -2
  142. package/lib/es/popconfirm/index.js +6 -3
  143. package/lib/es/radio/radio.d.ts +4 -0
  144. package/lib/es/radio/radio.js +32 -9
  145. package/lib/es/radio/radioInner.d.ts +6 -0
  146. package/lib/es/radio/radioInner.js +13 -4
  147. package/lib/es/rating/item.js +2 -1
  148. package/lib/es/scrollList/index.js +6 -3
  149. package/lib/es/select/index.js +10 -4
  150. package/lib/es/select/option.js +2 -1
  151. package/lib/es/sideSheet/SideSheetContent.js +6 -3
  152. package/lib/es/skeleton/index.js +3 -1
  153. package/lib/es/space/index.js +2 -1
  154. package/lib/es/spin/index.js +7 -3
  155. package/lib/es/switch/index.js +6 -4
  156. package/lib/es/table/Table.js +6 -3
  157. package/lib/es/tabs/TabBar.js +2 -1
  158. package/lib/es/tabs/TabPane.js +5 -2
  159. package/lib/es/tagInput/index.js +31 -22
  160. package/lib/es/timePicker/Combobox.js +3 -1
  161. package/lib/es/timePicker/TimePicker.js +2 -0
  162. package/lib/es/toast/toast.js +6 -3
  163. package/lib/es/tooltip/index.js +6 -1
  164. package/lib/es/transfer/index.js +2 -1
  165. package/lib/es/tree/treeNode.js +2 -1
  166. package/lib/es/treeSelect/index.js +10 -3
  167. package/lib/es/typography/base.js +2 -1
  168. package/lib/es/upload/index.d.ts +1 -1
  169. package/lib/es/upload/index.js +13 -6
  170. package/list/index.tsx +16 -4
  171. package/modal/ConfirmModal.tsx +1 -1
  172. package/modal/Modal.tsx +2 -0
  173. package/modal/ModalContent.tsx +27 -14
  174. package/notification/notice.tsx +16 -4
  175. package/package.json +8 -8
  176. package/pagination/index.tsx +16 -2
  177. package/popconfirm/index.tsx +11 -3
  178. package/radio/_story/radio.stories.js +9 -6
  179. package/radio/radio.tsx +37 -7
  180. package/radio/radioInner.tsx +11 -2
  181. package/rating/item.tsx +1 -1
  182. package/scrollList/index.tsx +19 -3
  183. package/select/index.tsx +13 -4
  184. package/select/option.tsx +5 -1
  185. package/sideSheet/SideSheetContent.tsx +3 -3
  186. package/skeleton/index.tsx +1 -1
  187. package/space/index.tsx +1 -1
  188. package/spin/index.tsx +15 -9
  189. package/switch/index.tsx +9 -14
  190. package/table/Table.tsx +5 -3
  191. package/table/_story/v2/FixedOnHeaderRow/index.jsx +3 -0
  192. package/tabs/TabBar.tsx +1 -1
  193. package/tabs/TabPane.tsx +9 -4
  194. package/tabs/_story/tabs.stories.js +36 -0
  195. package/tag/_story/tag.stories.js +1 -1
  196. package/tagInput/index.tsx +32 -15
  197. package/timePicker/Combobox.tsx +6 -1
  198. package/timePicker/TimePicker.tsx +1 -0
  199. package/toast/toast.tsx +3 -3
  200. package/tooltip/index.tsx +4 -1
  201. package/transfer/index.tsx +1 -0
  202. package/tree/treeNode.tsx +1 -1
  203. package/treeSelect/_story/treeSelect.stories.js +161 -2
  204. package/treeSelect/index.tsx +17 -3
  205. package/typography/base.tsx +1 -1
  206. package/upload/_story/upload.stories.js +152 -0
  207. package/upload/index.tsx +107 -38
@@ -5,8 +5,9 @@ import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
5
5
  import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
6
6
  import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
7
7
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
8
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
8
+ import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
9
9
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
10
+ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
10
11
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
11
12
 
12
13
  var __rest = this && this.__rest || function (s, e) {
@@ -34,7 +35,12 @@ export default class AvatarGroup extends PureComponent {
34
35
  const {
35
36
  children
36
37
  } = this.props;
37
- return _Array$isArray(children) ? children : [children];
38
+
39
+ if (children) {
40
+ return _Array$isArray(children) ? React.Children.toArray(children) : [children];
41
+ }
42
+
43
+ return [];
38
44
  }
39
45
 
40
46
  getMergeAvatars(avatars) {
@@ -58,13 +64,34 @@ export default class AvatarGroup extends PureComponent {
58
64
  }
59
65
 
60
66
  renderMoreAvatar(restNumber, restAvatars) {
67
+ var _context2;
68
+
61
69
  const {
62
70
  renderMore
63
71
  } = this.props;
64
72
  const moreCls = cls("".concat(prefixCls, "-item-more"));
73
+ const restAvatarAlt = restAvatars === null || restAvatars === void 0 ? void 0 : _reduceInstanceProperty(restAvatars).call(restAvatars, (pre, cur) => {
74
+ var _context;
75
+
76
+ const {
77
+ children,
78
+ alt
79
+ } = cur.props;
80
+ const avatarInfo = alt !== null && alt !== void 0 ? alt : typeof children === 'string' ? children : '';
81
+
82
+ if (avatarInfo.length === 0) {
83
+ return pre;
84
+ }
85
+
86
+ return pre.length > 0 ? _concatInstanceProperty(_context = "".concat(pre, ",")).call(_context, avatarInfo) : avatarInfo;
87
+ }, '');
88
+
89
+ const finalAlt = _concatInstanceProperty(_context2 = " Number of remaining Avatars\uFF1A".concat(restNumber, ",")).call(_context2, restAvatarAlt);
90
+
65
91
  let moreAvatar = /*#__PURE__*/React.createElement(Avatar, {
66
92
  className: moreCls,
67
- key: "_+n"
93
+ key: "_+n",
94
+ alt: finalAlt
68
95
  }, "+".concat(restNumber));
69
96
 
70
97
  if (_isFunction(renderMore)) {
@@ -95,15 +122,15 @@ export default class AvatarGroup extends PureComponent {
95
122
  });
96
123
 
97
124
  if (children) {
98
- var _context;
125
+ var _context3;
99
126
 
100
127
  const avatars = this.getAllAvatars();
101
- inner = _mapInstanceProperty(_context = _isNumber(maxCount) ? this.getMergeAvatars(avatars) : avatars).call(_context, (itm, index) => {
102
- var _context2, _context3;
128
+ inner = _mapInstanceProperty(_context3 = _isNumber(maxCount) ? this.getMergeAvatars(avatars) : avatars).call(_context3, (itm, index) => {
129
+ var _context4, _context5;
103
130
 
104
131
  const className = cls(_get(itm.props, 'className'), {
105
- [_concatInstanceProperty(_context2 = "".concat(prefixCls, "-item-start-")).call(_context2, index)]: overlapFrom === 'start',
106
- [_concatInstanceProperty(_context3 = "".concat(prefixCls, "-item-end-")).call(_context3, index)]: overlapFrom === 'end'
132
+ [_concatInstanceProperty(_context4 = "".concat(prefixCls, "-item-start-")).call(_context4, index)]: overlapFrom === 'start',
133
+ [_concatInstanceProperty(_context5 = "".concat(prefixCls, "-item-end-")).call(_context5, index)]: overlapFrom === 'end'
107
134
  });
108
135
  return /*#__PURE__*/React.cloneElement(itm, _Object$assign(_Object$assign({}, rest), {
109
136
  className,
@@ -115,7 +142,8 @@ export default class AvatarGroup extends PureComponent {
115
142
  }
116
143
 
117
144
  return /*#__PURE__*/React.createElement("div", {
118
- className: groupCls
145
+ className: groupCls,
146
+ role: 'list'
119
147
  }, inner);
120
148
  }
121
149
 
@@ -9,6 +9,7 @@ export * from './interface';
9
9
  export interface AvatarState {
10
10
  isImgExist: boolean;
11
11
  hoverContent: React.ReactNode;
12
+ focusVisible: boolean;
12
13
  }
13
14
  export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
14
15
  static defaultProps: {
@@ -45,5 +46,9 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
45
46
  onEnter(e: React.MouseEvent): void;
46
47
  onLeave(e: React.MouseEvent): void;
47
48
  handleError(): void;
49
+ handleKeyDown(event: any): void;
50
+ handleFocusVisible: (event: React.FocusEvent) => void;
51
+ handleBlur: (event: React.FocusEvent) => void;
52
+ getContent: () => React.ReactNode;
48
53
  render(): JSX.Element;
49
54
  }
@@ -1,7 +1,7 @@
1
1
  import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
2
2
  import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
- import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
4
3
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
+ import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
5
5
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
6
6
 
7
7
  var __rest = this && this.__rest || function (s, e) {
@@ -23,6 +23,7 @@ import AvatarFoundation from '@douyinfe/semi-foundation/lib/es/avatar/foundation
23
23
  import '@douyinfe/semi-foundation/lib/es/avatar/avatar.css';
24
24
  import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
25
25
  import BaseComponent from '../_base/baseComponent';
26
+ import { handlePrevent } from '@douyinfe/semi-foundation/lib/es/utils/a11y';
26
27
  const sizeSet = strings.SIZE;
27
28
  const shapeSet = strings.SHAPE;
28
29
  const colorSet = strings.COLOR;
@@ -30,16 +31,88 @@ const prefixCls = cssClasses.PREFIX;
30
31
  export * from './interface';
31
32
  export default class Avatar extends BaseComponent {
32
33
  constructor(props) {
33
- var _context, _context2, _context3;
34
+ var _context, _context2, _context3, _context4, _context5;
34
35
 
35
36
  super(props);
37
+
38
+ this.handleFocusVisible = event => {
39
+ this.foundation.handleFocusVisible(event);
40
+ };
41
+
42
+ this.handleBlur = event => {
43
+ this.foundation.handleBlur();
44
+ };
45
+
46
+ this.getContent = () => {
47
+ const {
48
+ children,
49
+ onClick,
50
+ imgAttr,
51
+ src,
52
+ srcSet,
53
+ alt
54
+ } = this.props;
55
+ const {
56
+ isImgExist
57
+ } = this.state;
58
+ let content = children;
59
+ const clickable = onClick !== noop;
60
+ const isImg = src && isImgExist;
61
+ const a11yFocusProps = {
62
+ tabIndex: 0,
63
+ onKeyDown: this.handleKeyDown,
64
+ onFocus: this.handleFocusVisible,
65
+ onBlur: this.handleBlur
66
+ };
67
+
68
+ if (isImg) {
69
+ const finalAlt = clickable ? "clickable Avatar: ".concat(alt) : alt;
70
+
71
+ const imgBasicProps = _Object$assign(_Object$assign({
72
+ src,
73
+ srcSet,
74
+ onError: this.handleError
75
+ }, imgAttr), {
76
+ className: cls({
77
+ ["".concat(prefixCls, "-no-focus-visible")]: clickable
78
+ })
79
+ });
80
+
81
+ const imgProps = clickable ? _Object$assign(_Object$assign({}, imgBasicProps), a11yFocusProps) : imgBasicProps;
82
+ content = /*#__PURE__*/React.createElement("img", _Object$assign({
83
+ alt: finalAlt
84
+ }, imgProps));
85
+ } else if (typeof children === 'string') {
86
+ const tempAlt = alt !== null && alt !== void 0 ? alt : children;
87
+ const finalAlt = clickable ? "clickable Avatar: ".concat(tempAlt) : tempAlt;
88
+ const props = {
89
+ role: 'img',
90
+ 'aria-label': finalAlt,
91
+ className: cls("".concat(prefixCls, "-label"), {
92
+ ["".concat(prefixCls, "-no-focus-visible")]: clickable
93
+ })
94
+ };
95
+ const finalProps = clickable ? _Object$assign(_Object$assign({}, props), a11yFocusProps) : props;
96
+ content = /*#__PURE__*/React.createElement("span", {
97
+ className: "".concat(prefixCls, "-content")
98
+ }, /*#__PURE__*/React.createElement("span", _Object$assign({}, finalProps, {
99
+ "x-semi-prop": "children"
100
+ }), children));
101
+ }
102
+
103
+ return content;
104
+ };
105
+
36
106
  this.state = {
37
107
  isImgExist: true,
38
- hoverContent: ''
108
+ hoverContent: '',
109
+ focusVisible: false
39
110
  };
40
111
  this.onEnter = _bindInstanceProperty(_context = this.onEnter).call(_context, this);
41
112
  this.onLeave = _bindInstanceProperty(_context2 = this.onLeave).call(_context2, this);
42
113
  this.handleError = _bindInstanceProperty(_context3 = this.handleError).call(_context3, this);
114
+ this.handleKeyDown = _bindInstanceProperty(_context4 = this.handleKeyDown).call(_context4, this);
115
+ this.getContent = _bindInstanceProperty(_context5 = this.getContent).call(_context5, this);
43
116
  }
44
117
 
45
118
  get adapter() {
@@ -72,6 +145,11 @@ export default class Avatar extends BaseComponent {
72
145
  } = this.props;
73
146
  onMouseLeave && onMouseLeave(e);
74
147
  });
148
+ },
149
+ setFocusVisible: focusVisible => {
150
+ this.setState({
151
+ focusVisible
152
+ });
75
153
  }
76
154
  });
77
155
  }
@@ -122,8 +200,28 @@ export default class Avatar extends BaseComponent {
122
200
  this.foundation.handleImgLoadError();
123
201
  }
124
202
 
203
+ handleKeyDown(event) {
204
+ const {
205
+ onClick
206
+ } = this.props;
207
+
208
+ switch (event.key) {
209
+ case "Enter":
210
+ onClick(event);
211
+ handlePrevent(event);
212
+ break;
213
+
214
+ case 'Escape':
215
+ event.target.blur();
216
+ break;
217
+
218
+ default:
219
+ break;
220
+ }
221
+ }
222
+
125
223
  render() {
126
- var _context4, _context5, _context6;
224
+ var _context6, _context7, _context8;
127
225
 
128
226
  // eslint-disable-next-line max-len, no-unused-vars
129
227
  const _a = this.props,
@@ -145,46 +243,29 @@ export default class Avatar extends BaseComponent {
145
243
 
146
244
  const {
147
245
  isImgExist,
148
- hoverContent
246
+ hoverContent,
247
+ focusVisible
149
248
  } = this.state;
150
249
  const isImg = src && isImgExist;
151
250
  const avatarCls = cls(prefixCls, {
152
- [_concatInstanceProperty(_context4 = "".concat(prefixCls, "-")).call(_context4, shape)]: shape,
153
- [_concatInstanceProperty(_context5 = "".concat(prefixCls, "-")).call(_context5, size)]: size,
154
- [_concatInstanceProperty(_context6 = "".concat(prefixCls, "-")).call(_context6, color)]: color && !isImg,
155
- ["".concat(prefixCls, "-img")]: isImg
251
+ [_concatInstanceProperty(_context6 = "".concat(prefixCls, "-")).call(_context6, shape)]: shape,
252
+ [_concatInstanceProperty(_context7 = "".concat(prefixCls, "-")).call(_context7, size)]: size,
253
+ [_concatInstanceProperty(_context8 = "".concat(prefixCls, "-")).call(_context8, color)]: color && !isImg,
254
+ ["".concat(prefixCls, "-img")]: isImg,
255
+ ["".concat(prefixCls, "-focus")]: focusVisible
156
256
  }, className);
157
- let content = children;
158
257
  const hoverRender = hoverContent ? /*#__PURE__*/React.createElement("div", {
159
- className: "".concat(prefixCls, "-hover")
258
+ className: "".concat(prefixCls, "-hover"),
259
+ "x-semi-prop": "hoverContent"
160
260
  }, hoverContent) : null;
161
-
162
- if (isImg) {
163
- content = /*#__PURE__*/React.createElement("img", _Object$assign({
164
- src: src,
165
- srcSet: srcSet,
166
- onError: this.handleError,
167
- alt: alt
168
- }, imgAttr));
169
- } else if (typeof children === 'string') {
170
- content = /*#__PURE__*/React.createElement("span", {
171
- className: "".concat(prefixCls, "-content")
172
- }, /*#__PURE__*/React.createElement("span", {
173
- className: "".concat(prefixCls, "-label")
174
- }, children));
175
- }
176
-
177
- return (
178
- /*#__PURE__*/
179
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
180
- React.createElement("span", _Object$assign({}, others, {
181
- style: style,
182
- className: avatarCls,
183
- onClick: onClick,
184
- onMouseEnter: this.onEnter,
185
- onMouseLeave: this.onLeave
186
- }), content, hoverRender)
187
- );
261
+ return /*#__PURE__*/React.createElement("span", _Object$assign({}, others, {
262
+ style: style,
263
+ className: avatarCls,
264
+ onClick: onClick,
265
+ onMouseEnter: this.onEnter,
266
+ onMouseLeave: this.onLeave,
267
+ role: 'listitem'
268
+ }), this.getContent(), hoverRender);
188
269
  }
189
270
 
190
271
  }
@@ -98,7 +98,8 @@ export default class BackTop extends BaseComponent {
98
98
  const content = visible ? /*#__PURE__*/React.createElement("div", _Object$assign({}, others, {
99
99
  className: preCls,
100
100
  style: style,
101
- onClick: e => this.handleClick(e)
101
+ onClick: e => this.handleClick(e),
102
+ "x-semi-prop": "children"
102
103
  }), backtopBtn) : null;
103
104
  return content;
104
105
  }
@@ -71,7 +71,8 @@ export default class Badge extends PureComponent {
71
71
  className: prefixCls
72
72
  }, rest), children, /*#__PURE__*/React.createElement("span", {
73
73
  className: wrapper,
74
- style: style
74
+ style: style,
75
+ "x-semi-prop": "count"
75
76
  }, dot ? null : content));
76
77
  }
77
78
 
@@ -68,6 +68,7 @@ export default class Banner extends BaseComponent {
68
68
  className: "".concat(prefixCls, "-close"),
69
69
  onClick: this.remove,
70
70
  icon: closeIcon || /*#__PURE__*/React.createElement(IconClose, {
71
+ "x-semi-prop": "closeIcon",
71
72
  "aria-hidden": true
72
73
  }),
73
74
  theme: "borderless",
@@ -113,7 +114,8 @@ export default class Banner extends BaseComponent {
113
114
 
114
115
  if (iconType) {
115
116
  return /*#__PURE__*/React.createElement("div", {
116
- className: iconCls
117
+ className: iconCls,
118
+ "x-semi-prop": "icon"
117
119
  }, iconType);
118
120
  }
119
121
 
@@ -155,12 +157,15 @@ export default class Banner extends BaseComponent {
155
157
  }, title ? /*#__PURE__*/React.createElement(Typography.Title, {
156
158
  heading: 5,
157
159
  className: "".concat(prefixCls, "-title"),
158
- component: "div"
160
+ component: "div",
161
+ "x-semi-prop": "title"
159
162
  }, title) : null, description ? /*#__PURE__*/React.createElement(Typography.Paragraph, {
160
163
  className: "".concat(prefixCls, "-description"),
161
- component: "div"
164
+ component: "div",
165
+ "x-semi-prop": "description"
162
166
  }, description) : null)), this.renderCloser()), children ? /*#__PURE__*/React.createElement("div", {
163
- className: "".concat(prefixCls, "-extra")
167
+ className: "".concat(prefixCls, "-extra"),
168
+ "x-semi-prop": "children"
164
169
  }, children) : null) : null;
165
170
  return banner;
166
171
  }
@@ -47,14 +47,15 @@ class Breadcrumb extends BaseComponent {
47
47
  }, /*#__PURE__*/React.createElement("span", {
48
48
  className: "".concat(clsPrefix, "-item-wrap")
49
49
  }, /*#__PURE__*/React.createElement("span", {
50
- role: 'button',
50
+ role: "button",
51
51
  tabIndex: 0,
52
- "aria-label": 'Expand breadcrumb items',
52
+ "aria-label": "Expand breadcrumb items",
53
53
  className: _concatInstanceProperty(_context = "".concat(clsPrefix, "-item ")).call(_context, clsPrefix, "-item-more"),
54
54
  onClick: item => this.foundation.handleExpand(item),
55
55
  onKeyPress: e => this.foundation.handleExpandEnterPress(e)
56
56
  }, hasRenderMore && renderMore(restItem), !hasRenderMore && moreType === 'default' && /*#__PURE__*/React.createElement(IconMore, null), !hasRenderMore && moreType === 'popover' && this.renderPopoverMore(restItem)), /*#__PURE__*/React.createElement("span", {
57
- className: "".concat(clsPrefix, "-separator")
57
+ className: "".concat(clsPrefix, "-separator"),
58
+ "x-semi-prop": "separator"
58
59
  }, this.props.separator)));
59
60
 
60
61
  _spliceInstanceProperty(template).call(template, 1, itemsLen - maxItemCount, spread);
@@ -1,7 +1,9 @@
1
+ import _omit from "lodash/omit";
1
2
  import _indexOfInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/index-of";
2
3
  import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
3
4
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
4
5
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
6
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
5
7
 
6
8
  var __rest = this && this.__rest || function (s, e) {
7
9
  var t = {};
@@ -52,7 +54,7 @@ export default class Button extends PureComponent {
52
54
 
53
55
  const baseProps = _Object$assign(_Object$assign({
54
56
  disabled
55
- }, attr), {
57
+ }, _omit(attr, ['x-semi-children-alias'])), {
56
58
  className: classNames(prefixCls, {
57
59
  [_concatInstanceProperty(_context = "".concat(prefixCls, "-")).call(_context, type)]: !disabled && type,
58
60
  ["".concat(prefixCls, "-disabled")]: disabled,
@@ -68,6 +70,12 @@ export default class Button extends PureComponent {
68
70
  'aria-disabled': disabled
69
71
  });
70
72
 
73
+ const xSemiProps = {};
74
+
75
+ if (!(className && _includesInstanceProperty(className).call(className, '-with-icon'))) {
76
+ xSemiProps['x-semi-prop'] = this.props['x-semi-children-alias'] || 'children';
77
+ }
78
+
71
79
  return (
72
80
  /*#__PURE__*/
73
81
  // eslint-disable-next-line react/button-has-type
@@ -75,10 +83,10 @@ export default class Button extends PureComponent {
75
83
  onClick: this.props.onClick,
76
84
  onMouseDown: this.props.onMouseDown,
77
85
  style: style
78
- }), /*#__PURE__*/React.createElement("span", {
86
+ }), /*#__PURE__*/React.createElement("span", _Object$assign({
79
87
  className: "".concat(prefixCls, "-content"),
80
88
  onClick: e => disabled && e.stopPropagation()
81
- }, children))
89
+ }, xSemiProps), children))
82
90
  );
83
91
  }
84
92
 
@@ -59,7 +59,8 @@ class Card extends PureComponent {
59
59
  React.createElement("div", {
60
60
  className: headerWrapperCls
61
61
  }, headerExtraContent && /*#__PURE__*/React.createElement("div", {
62
- className: "".concat(prefixcls, "-header-wrapper-extra")
62
+ className: "".concat(prefixcls, "-header-wrapper-extra"),
63
+ "x-semi-prop": "headerExtraContent"
63
64
  }, headerExtraContent), title && /*#__PURE__*/React.createElement("div", {
64
65
  className: titleCls
65
66
  }, _isString(title) ? /*#__PURE__*/React.createElement(Typography.Title, {
@@ -67,7 +68,8 @@ class Card extends PureComponent {
67
68
  ellipsis: {
68
69
  showTooltip: true,
69
70
  rows: 1
70
- }
71
+ },
72
+ "x-semi-prop": "title"
71
73
  }, title) : title)));
72
74
  }
73
75
 
@@ -80,7 +82,8 @@ class Card extends PureComponent {
80
82
  } = this.props;
81
83
  const coverCls = cls("".concat(prefixcls, "-cover"));
82
84
  return cover && /*#__PURE__*/React.createElement("div", {
83
- className: coverCls
85
+ className: coverCls,
86
+ "x-semi-prop": "cover"
84
87
  }, cover);
85
88
  };
86
89
 
@@ -110,7 +113,8 @@ class Card extends PureComponent {
110
113
  spacing: 12
111
114
  }, _mapInstanceProperty(actions).call(actions, (item, idx) => /*#__PURE__*/React.createElement("div", {
112
115
  key: idx,
113
- className: actionsItemCls
116
+ className: actionsItemCls,
117
+ "x-semi-prop": "actions.".concat(idx)
114
118
  }, item)))));
115
119
  };
116
120
 
@@ -125,7 +129,8 @@ class Card extends PureComponent {
125
129
  });
126
130
  return footer && /*#__PURE__*/React.createElement("div", {
127
131
  style: footerStyle,
128
- className: footerCls
132
+ className: footerCls,
133
+ "x-semi-prop": "footer"
129
134
  }, footer);
130
135
  };
131
136
  }
@@ -57,12 +57,16 @@ class CarouselArrow extends React.PureComponent {
57
57
  // role='button'
58
58
  className: leftClassNames,
59
59
  onClick: prev
60
- }, _get(this.props, 'arrowProps.leftArrow.props')), this.renderLeftIcon()), /*#__PURE__*/React.createElement("div", _Object$assign({
60
+ }, _get(this.props, 'arrowProps.leftArrow.props'), {
61
+ "x-semi-prop": "arrowProps.leftArrow.children"
62
+ }), this.renderLeftIcon()), /*#__PURE__*/React.createElement("div", _Object$assign({
61
63
  // role='button'
62
64
  // tabIndex={0}
63
65
  className: rightClassNames,
64
66
  onClick: next
65
- }, _get(this.props, 'arrowProps.rightArrow.props')), this.renderRightIcon()));
67
+ }, _get(this.props, 'arrowProps.rightArrow.props'), {
68
+ "x-semi-prop": "arrowProps.rightArrow.children"
69
+ }), this.renderRightIcon()));
66
70
  }
67
71
 
68
72
  }
@@ -263,7 +263,8 @@ class Carousel extends BaseComponent {
263
263
  className: cls([_concatInstanceProperty(_context2 = "".concat(cssClasses.CAROUSEL_CONTENT, "-")).call(_context2, animation)], {
264
264
  ["".concat(cssClasses.CAROUSEL_CONTENT)]: true,
265
265
  ["".concat(cssClasses.CAROUSEL_CONTENT, "-reverse")]: slideDirection === 'left' ? isReverse : !isReverse
266
- })
266
+ }),
267
+ "x-semi-prop": "children"
267
268
  }, this.renderChildren()), this.renderIndicator(), this.renderArrow());
268
269
  }
269
270
 
@@ -285,7 +285,8 @@ class Cascader extends BaseComponent {
285
285
  ["".concat(prefixcls, "-suffix-icon")]: isSemiIcon(suffix)
286
286
  });
287
287
  return /*#__PURE__*/React.createElement("div", {
288
- className: suffixWrapperCls
288
+ className: suffixWrapperCls,
289
+ "x-semi-prop": "suffix"
289
290
  }, suffix);
290
291
  };
291
292
 
@@ -305,7 +306,8 @@ class Cascader extends BaseComponent {
305
306
  });
306
307
  return /*#__PURE__*/React.createElement("div", {
307
308
  className: prefixWrapperCls,
308
- id: insetLabelId
309
+ id: insetLabelId,
310
+ "x-semi-prop": "prefix,insetLabel"
309
311
  }, labelNode);
310
312
  };
311
313
 
@@ -363,6 +365,8 @@ class Cascader extends BaseComponent {
363
365
  * A11y: simulate clear button click
364
366
  */
365
367
 
368
+ /* istanbul ignore next */
369
+
366
370
 
367
371
  this.handleClearEnterPress = e => {
368
372
  e && e.stopPropagation();
@@ -395,7 +399,7 @@ class Cascader extends BaseComponent {
395
399
  className: clearCls,
396
400
  onClick: this.handleClear,
397
401
  onKeyPress: this.handleClearEnterPress,
398
- role: 'button',
402
+ role: "button",
399
403
  tabIndex: 0
400
404
  }, /*#__PURE__*/React.createElement(IconClear, null));
401
405
  }
@@ -414,7 +418,8 @@ class Cascader extends BaseComponent {
414
418
  }
415
419
 
416
420
  return arrowIcon ? /*#__PURE__*/React.createElement("div", {
417
- className: cls("".concat(prefixcls, "-arrow"))
421
+ className: cls("".concat(prefixcls, "-arrow")),
422
+ "x-semi-prop": "arrowIcon"
418
423
  }, arrowIcon) : null;
419
424
  };
420
425
 
@@ -489,12 +494,12 @@ class Cascader extends BaseComponent {
489
494
  "aria-errormessage": this.props['aria-errormessage'],
490
495
  "aria-label": this.props['aria-label'],
491
496
  "aria-labelledby": this.props['aria-labelledby'],
492
- "aria-describedby": this.props["aria-describedby"],
497
+ "aria-describedby": this.props['aria-describedby'],
493
498
  "aria-required": this.props['aria-required'],
494
499
  id: id
495
500
  }, mouseEvent, {
496
501
  // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
497
- role: 'combobox',
502
+ role: "combobox",
498
503
  tabIndex: 0
499
504
  }), inner);
500
505
  };
@@ -741,14 +746,16 @@ class Cascader extends BaseComponent {
741
746
  if (_Array$isArray(realValue)) {
742
747
  normallizedValue = _Array$isArray(realValue[0]) ? realValue : [realValue];
743
748
  } else {
744
- normallizedValue = [[realValue]];
749
+ if (realValue !== undefined) {
750
+ normallizedValue = [[realValue]];
751
+ }
745
752
  } // formatValuePath is used to save value of valuePath
746
753
 
747
754
 
748
755
  const formatValuePath = [];
749
756
 
750
757
  _forEachInstanceProperty(normallizedValue).call(normallizedValue, valueItem => {
751
- const formatItem = onChangeWithObject ? _mapInstanceProperty(valueItem).call(valueItem, i => i.value) : valueItem;
758
+ const formatItem = onChangeWithObject ? _mapInstanceProperty(valueItem).call(valueItem, i => i === null || i === void 0 ? void 0 : i.value) : valueItem;
752
759
  formatValuePath.push(formatItem);
753
760
  }); // formatKeys is used to save key of value
754
761
 
@@ -296,7 +296,8 @@ export default class Item extends PureComponent {
296
296
  className: _concatInstanceProperty(_context6 = "".concat(prefixcls, " ")).call(_context6, prefixcls, "-empty"),
297
297
  key: 'empty-list'
298
298
  }, /*#__PURE__*/React.createElement("span", {
299
- className: "".concat(prefixcls, "-label")
299
+ className: "".concat(prefixcls, "-label"),
300
+ "x-semi-prop": "emptyContent"
300
301
  }, emptyContent || locale.emptyText));
301
302
  });
302
303
  }
@@ -177,13 +177,17 @@ class Checkbox extends BaseComponent {
177
177
  const extraCls = classnames("".concat(prefix, "-extra"), {
178
178
  ["".concat(prefix, "-cardType_extra_noChildren")]: props.isCardType && !children
179
179
  });
180
+ const name = inGroup && this.context.checkboxGroup.name;
181
+ const xSemiPropChildren = this.props['x-semi-children-alias'] || 'children';
180
182
 
181
183
  const renderContent = () => /*#__PURE__*/React.createElement(React.Fragment, null, children ? /*#__PURE__*/React.createElement("span", {
182
184
  id: addonId,
183
- className: "".concat(prefix, "-addon")
185
+ className: "".concat(prefix, "-addon"),
186
+ "x-semi-prop": xSemiPropChildren
184
187
  }, children) : null, extra ? /*#__PURE__*/React.createElement("div", {
185
188
  id: extraId,
186
- className: extraCls
189
+ className: extraCls,
190
+ "x-semi-prop": "extra"
187
191
  }, extra) : null);
188
192
 
189
193
  return (
@@ -89,7 +89,8 @@ const Collapsible = props => {
89
89
  style: {
90
90
  overflow: 'hidden'
91
91
  },
92
- id: id
92
+ id: id,
93
+ "x-semi-prop": "children"
93
94
  }, children));
94
95
  };
95
96
 
@@ -153,7 +153,8 @@ export default class DateInput extends BaseComponent {
153
153
  const labelNode = prefix || insetLabel;
154
154
  return labelNode ? /*#__PURE__*/React.createElement("div", {
155
155
  className: "".concat(prefixCls, "-range-input-prefix"),
156
- onClick: e => !disabled && !rangeInputFocus && this.handleRangeStartFocus(e)
156
+ onClick: e => !disabled && !rangeInputFocus && this.handleRangeStartFocus(e),
157
+ "x-semi-prop": "prefix,insetLabel"
157
158
  }, labelNode) : null;
158
159
  }
159
160