@douyinfe/semi-ui 2.11.0 → 2.12.0-alpha.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 (210) hide show
  1. package/README.md +1 -1
  2. package/avatar/index.tsx +2 -2
  3. package/backtop/index.tsx +11 -7
  4. package/badge/index.tsx +1 -1
  5. package/banner/index.tsx +5 -5
  6. package/breadcrumb/index.tsx +5 -3
  7. package/button/Button.tsx +10 -8
  8. package/card/index.tsx +43 -41
  9. package/carousel/CarouselArrow.tsx +2 -0
  10. package/carousel/index.tsx +1 -0
  11. package/cascader/index.tsx +101 -123
  12. package/cascader/item.tsx +1 -1
  13. package/checkbox/checkbox.tsx +13 -2
  14. package/collapsible/index.tsx +8 -1
  15. package/datePicker/dateInput.tsx +1 -0
  16. package/datePicker/datePicker.tsx +13 -5
  17. package/dist/css/semi.css +33 -0
  18. package/dist/css/semi.min.css +1 -1
  19. package/dist/umd/semi-ui.js +694 -384
  20. package/dist/umd/semi-ui.js.map +1 -1
  21. package/dist/umd/semi-ui.min.js +1 -1
  22. package/dist/umd/semi-ui.min.js.map +1 -1
  23. package/divider/index.tsx +8 -4
  24. package/dropdown/index.tsx +1 -1
  25. package/empty/index.tsx +13 -5
  26. package/form/_story/FormSubmit/index.tsx +45 -0
  27. package/form/_story/form.stories.js +2 -1
  28. package/form/hoc/withField.tsx +1 -1
  29. package/form/label.tsx +1 -1
  30. package/grid/col.tsx +1 -1
  31. package/grid/row.tsx +1 -1
  32. package/iconButton/index.tsx +2 -1
  33. package/input/index.tsx +38 -11
  34. package/lib/cjs/avatar/index.js +4 -2
  35. package/lib/cjs/backtop/index.js +2 -1
  36. package/lib/cjs/badge/index.js +2 -1
  37. package/lib/cjs/banner/index.js +9 -4
  38. package/lib/cjs/breadcrumb/index.js +4 -3
  39. package/lib/cjs/button/Button.js +13 -3
  40. package/lib/cjs/card/index.js +10 -5
  41. package/lib/cjs/carousel/CarouselArrow.js +6 -2
  42. package/lib/cjs/carousel/index.js +2 -1
  43. package/lib/cjs/cascader/index.js +9 -6
  44. package/lib/cjs/cascader/item.js +2 -1
  45. package/lib/cjs/checkbox/checkbox.js +8 -4
  46. package/lib/cjs/collapsible/index.js +2 -1
  47. package/lib/cjs/datePicker/dateInput.d.ts +1 -1
  48. package/lib/cjs/datePicker/dateInput.js +2 -1
  49. package/lib/cjs/datePicker/datePicker.d.ts +1 -1
  50. package/lib/cjs/datePicker/datePicker.js +4 -2
  51. package/lib/cjs/datePicker/monthsGrid.d.ts +2 -2
  52. package/lib/cjs/divider/index.js +2 -1
  53. package/lib/cjs/dropdown/index.js +2 -1
  54. package/lib/cjs/empty/index.js +8 -4
  55. package/lib/cjs/form/baseForm.d.ts +1 -1
  56. package/lib/cjs/form/field.d.ts +1 -1
  57. package/lib/cjs/form/hoc/withField.js +2 -1
  58. package/lib/cjs/form/label.js +2 -1
  59. package/lib/cjs/grid/col.js +2 -1
  60. package/lib/cjs/grid/row.js +2 -1
  61. package/lib/cjs/iconButton/index.js +3 -1
  62. package/lib/cjs/input/index.js +9 -5
  63. package/lib/cjs/list/index.js +6 -3
  64. package/lib/cjs/modal/ConfirmModal.js +2 -1
  65. package/lib/cjs/modal/Modal.js +6 -2
  66. package/lib/cjs/modal/ModalContent.js +13 -6
  67. package/lib/cjs/navigation/Item.d.ts +1 -1
  68. package/lib/cjs/notification/notice.js +6 -3
  69. package/lib/cjs/pagination/index.js +4 -2
  70. package/lib/cjs/popconfirm/index.js +6 -3
  71. package/lib/cjs/radio/radio.d.ts +1 -1
  72. package/lib/cjs/radio/radio.js +4 -2
  73. package/lib/cjs/radio/radioGroup.d.ts +1 -1
  74. package/lib/cjs/rating/item.js +2 -1
  75. package/lib/cjs/scrollList/index.js +6 -3
  76. package/lib/cjs/select/index.js +9 -5
  77. package/lib/cjs/select/option.js +2 -1
  78. package/lib/cjs/sideSheet/SideSheetContent.js +6 -3
  79. package/lib/cjs/skeleton/index.js +3 -1
  80. package/lib/cjs/slider/index.js +9 -5
  81. package/lib/cjs/space/index.js +2 -1
  82. package/lib/cjs/spin/index.js +7 -3
  83. package/lib/cjs/switch/index.js +6 -4
  84. package/lib/cjs/table/Table.d.ts +1 -1
  85. package/lib/cjs/table/Table.js +6 -3
  86. package/lib/cjs/tabs/TabBar.d.ts +1 -0
  87. package/lib/cjs/tabs/TabBar.js +10 -2
  88. package/lib/cjs/tabs/TabPane.js +7 -3
  89. package/lib/cjs/tabs/index.js +2 -1
  90. package/lib/cjs/tabs/interface.d.ts +1 -0
  91. package/lib/cjs/tag/index.d.ts +2 -0
  92. package/lib/cjs/tag/index.js +60 -11
  93. package/lib/cjs/tag/interface.d.ts +1 -0
  94. package/lib/cjs/tagInput/index.js +7 -4
  95. package/lib/cjs/timePicker/Combobox.js +3 -1
  96. package/lib/cjs/toast/toast.js +6 -3
  97. package/lib/cjs/transfer/index.js +2 -1
  98. package/lib/cjs/tree/treeNode.js +2 -1
  99. package/lib/cjs/treeSelect/index.js +9 -6
  100. package/lib/cjs/typography/base.js +2 -1
  101. package/lib/cjs/typography/title.d.ts +1 -1
  102. package/lib/cjs/upload/index.d.ts +1 -1
  103. package/lib/cjs/upload/index.js +13 -6
  104. package/lib/es/avatar/index.js +4 -2
  105. package/lib/es/backtop/index.js +2 -1
  106. package/lib/es/badge/index.js +2 -1
  107. package/lib/es/banner/index.js +9 -4
  108. package/lib/es/breadcrumb/index.js +4 -3
  109. package/lib/es/button/Button.js +11 -3
  110. package/lib/es/card/index.js +10 -5
  111. package/lib/es/carousel/CarouselArrow.js +6 -2
  112. package/lib/es/carousel/index.js +2 -1
  113. package/lib/es/cascader/index.js +9 -6
  114. package/lib/es/cascader/item.js +2 -1
  115. package/lib/es/checkbox/checkbox.js +8 -4
  116. package/lib/es/collapsible/index.js +2 -1
  117. package/lib/es/datePicker/dateInput.d.ts +1 -1
  118. package/lib/es/datePicker/dateInput.js +2 -1
  119. package/lib/es/datePicker/datePicker.d.ts +1 -1
  120. package/lib/es/datePicker/datePicker.js +4 -2
  121. package/lib/es/datePicker/monthsGrid.d.ts +2 -2
  122. package/lib/es/divider/index.js +2 -1
  123. package/lib/es/dropdown/index.js +2 -1
  124. package/lib/es/empty/index.js +8 -4
  125. package/lib/es/form/baseForm.d.ts +1 -1
  126. package/lib/es/form/field.d.ts +1 -1
  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.js +9 -5
  133. package/lib/es/list/index.js +6 -3
  134. package/lib/es/modal/ConfirmModal.js +2 -1
  135. package/lib/es/modal/Modal.js +6 -2
  136. package/lib/es/modal/ModalContent.js +13 -6
  137. package/lib/es/navigation/Item.d.ts +1 -1
  138. package/lib/es/notification/notice.js +6 -3
  139. package/lib/es/pagination/index.js +4 -2
  140. package/lib/es/popconfirm/index.js +6 -3
  141. package/lib/es/radio/radio.d.ts +1 -1
  142. package/lib/es/radio/radio.js +4 -2
  143. package/lib/es/radio/radioGroup.d.ts +1 -1
  144. package/lib/es/rating/item.js +2 -1
  145. package/lib/es/scrollList/index.js +6 -3
  146. package/lib/es/select/index.js +9 -5
  147. package/lib/es/select/option.js +2 -1
  148. package/lib/es/sideSheet/SideSheetContent.js +6 -3
  149. package/lib/es/skeleton/index.js +3 -1
  150. package/lib/es/slider/index.js +9 -5
  151. package/lib/es/space/index.js +2 -1
  152. package/lib/es/spin/index.js +7 -3
  153. package/lib/es/switch/index.js +6 -4
  154. package/lib/es/table/Table.d.ts +1 -1
  155. package/lib/es/table/Table.js +6 -3
  156. package/lib/es/tabs/TabBar.d.ts +1 -0
  157. package/lib/es/tabs/TabBar.js +10 -2
  158. package/lib/es/tabs/TabPane.js +7 -3
  159. package/lib/es/tabs/index.js +2 -1
  160. package/lib/es/tabs/interface.d.ts +1 -0
  161. package/lib/es/tag/index.d.ts +2 -0
  162. package/lib/es/tag/index.js +56 -9
  163. package/lib/es/tag/interface.d.ts +1 -0
  164. package/lib/es/tagInput/index.js +7 -4
  165. package/lib/es/timePicker/Combobox.js +3 -1
  166. package/lib/es/toast/toast.js +6 -3
  167. package/lib/es/transfer/index.js +2 -1
  168. package/lib/es/tree/treeNode.js +2 -1
  169. package/lib/es/treeSelect/index.js +8 -5
  170. package/lib/es/typography/base.js +2 -1
  171. package/lib/es/typography/title.d.ts +1 -1
  172. package/lib/es/upload/index.d.ts +1 -1
  173. package/lib/es/upload/index.js +13 -6
  174. package/list/index.tsx +16 -4
  175. package/modal/ConfirmModal.tsx +1 -1
  176. package/modal/Modal.tsx +2 -0
  177. package/modal/ModalContent.tsx +33 -21
  178. package/navigation/Item.tsx +1 -1
  179. package/notification/notice.tsx +16 -4
  180. package/package.json +9 -9
  181. package/pagination/index.tsx +16 -2
  182. package/popconfirm/index.tsx +11 -3
  183. package/radio/radio.tsx +10 -2
  184. package/rating/item.tsx +1 -1
  185. package/scrollList/index.tsx +19 -3
  186. package/select/index.tsx +13 -6
  187. package/select/option.tsx +5 -1
  188. package/sideSheet/SideSheetContent.tsx +3 -3
  189. package/skeleton/index.tsx +1 -1
  190. package/slider/index.tsx +5 -3
  191. package/space/index.tsx +1 -1
  192. package/spin/index.tsx +15 -9
  193. package/switch/index.tsx +9 -14
  194. package/table/Table.tsx +5 -3
  195. package/table/_story/v2/index.js +2 -1
  196. package/table/_story/v2/radioRowSelection.tsx +107 -0
  197. package/tabs/TabBar.tsx +8 -1
  198. package/tabs/TabPane.tsx +10 -4
  199. package/tabs/index.tsx +2 -1
  200. package/tabs/interface.ts +1 -0
  201. package/tag/index.tsx +32 -2
  202. package/tag/interface.ts +1 -0
  203. package/tagInput/index.tsx +3 -2
  204. package/timePicker/Combobox.tsx +6 -1
  205. package/toast/toast.tsx +3 -3
  206. package/transfer/index.tsx +1 -0
  207. package/tree/treeNode.tsx +1 -1
  208. package/treeSelect/index.tsx +16 -4
  209. package/typography/base.tsx +1 -1
  210. package/upload/index.tsx +107 -38
@@ -1,3 +1,4 @@
1
+ import _isString from "lodash/isString";
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 _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
@@ -14,6 +15,8 @@ var __rest = this && this.__rest || function (s, e) {
14
15
  }
15
16
  return t;
16
17
  };
18
+ /* eslint-disable jsx-a11y/no-static-element-interactions */
19
+
17
20
  /* eslint-disable no-unused-vars */
18
21
 
19
22
  /* eslint-disable max-len */
@@ -25,6 +28,7 @@ import PropTypes from 'prop-types';
25
28
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/tag/constants';
26
29
  import Avatar from '../avatar/index';
27
30
  import { IconClose } from '@douyinfe/semi-icons';
31
+ import { handlePrevent } from '@douyinfe/semi-foundation/lib/es/utils/a11y';
28
32
  import '@douyinfe/semi-foundation/lib/es/tag/tag.css';
29
33
  export * from './interface';
30
34
  const prefixCls = cssClasses.PREFIX;
@@ -34,13 +38,14 @@ const tagType = strings.TAG_TYPE;
34
38
  const avatarShapeSet = strings.AVATAR_SHAPE;
35
39
  export default class Tag extends Component {
36
40
  constructor(props) {
37
- var _context;
41
+ var _context, _context2;
38
42
 
39
43
  super(props);
40
44
  this.state = {
41
45
  visible: true
42
46
  };
43
47
  this.close = _bindInstanceProperty(_context = this.close).call(_context, this);
48
+ this.handleKeyDown = _bindInstanceProperty(_context2 = this.handleKeyDown).call(_context2, this);
44
49
  } // any other way to achieve this?
45
50
 
46
51
 
@@ -77,6 +82,33 @@ export default class Tag extends Component {
77
82
  this.setVisible(false);
78
83
  }
79
84
 
85
+ handleKeyDown(event) {
86
+ const {
87
+ closable,
88
+ onClick
89
+ } = this.props;
90
+
91
+ switch (event.key) {
92
+ case "Backspace":
93
+ case "Delete":
94
+ closable && this.close(event, this.props.children);
95
+ handlePrevent(event);
96
+ break;
97
+
98
+ case "Enter":
99
+ onClick(event);
100
+ handlePrevent(event);
101
+ break;
102
+
103
+ case 'Escape':
104
+ event.target.blur();
105
+ break;
106
+
107
+ default:
108
+ break;
109
+ }
110
+ }
111
+
80
112
  renderAvatar() {
81
113
  const {
82
114
  avatarShape,
@@ -90,7 +122,7 @@ export default class Tag extends Component {
90
122
  }
91
123
 
92
124
  render() {
93
- var _context2, _context3, _context4, _context5;
125
+ var _context3, _context4, _context5, _context6, _context7;
94
126
 
95
127
  const _a = this.props,
96
128
  {
@@ -100,37 +132,51 @@ export default class Tag extends Component {
100
132
  closable,
101
133
  visible,
102
134
  onClose,
135
+ onClick,
103
136
  className,
104
137
  type,
105
138
  avatarSrc,
106
139
  avatarShape
107
140
  } = _a,
108
- attr = __rest(_a, ["children", "size", "color", "closable", "visible", "onClose", "className", "type", "avatarSrc", "avatarShape"]);
141
+ attr = __rest(_a, ["children", "size", "color", "closable", "visible", "onClose", "onClick", "className", "type", "avatarSrc", "avatarShape"]);
109
142
 
110
143
  const {
111
144
  visible: isVisible
112
145
  } = this.state;
146
+ const clickable = onClick !== Tag.defaultProps.onClick || closable;
147
+ const a11yProps = {
148
+ role: 'button',
149
+ tabIndex: 0,
150
+ onKeyDown: this.handleKeyDown
151
+ };
113
152
 
114
153
  const baseProps = _Object$assign(_Object$assign({}, attr), {
154
+ onClick,
115
155
  className: classNames(prefixCls, {
116
156
  ["".concat(prefixCls, "-default")]: size === 'default',
117
157
  ["".concat(prefixCls, "-small")]: size === 'small',
118
158
  ["".concat(prefixCls, "-large")]: size === 'large',
119
- [_concatInstanceProperty(_context2 = "".concat(prefixCls, "-")).call(_context2, type)]: type,
120
- [_concatInstanceProperty(_context3 = _concatInstanceProperty(_context4 = "".concat(prefixCls, "-")).call(_context4, color, "-")).call(_context3, type)]: color && type,
159
+ [_concatInstanceProperty(_context3 = "".concat(prefixCls, "-")).call(_context3, type)]: type,
160
+ [_concatInstanceProperty(_context4 = _concatInstanceProperty(_context5 = "".concat(prefixCls, "-")).call(_context5, color, "-")).call(_context4, type)]: color && type,
121
161
  ["".concat(prefixCls, "-closable")]: closable,
122
162
  ["".concat(prefixCls, "-invisible")]: !isVisible,
123
- [_concatInstanceProperty(_context5 = "".concat(prefixCls, "-avatar-")).call(_context5, avatarShape)]: avatarSrc
163
+ [_concatInstanceProperty(_context6 = "".concat(prefixCls, "-avatar-")).call(_context6, avatarShape)]: avatarSrc
124
164
  }, className)
125
165
  });
126
166
 
127
- const closeIcon = closable ? /*#__PURE__*/React.createElement("div", {
167
+ const wrapProps = clickable ? _Object$assign(_Object$assign({}, baseProps), a11yProps) : baseProps;
168
+ const closeIcon = closable ?
169
+ /*#__PURE__*/
170
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events
171
+ React.createElement("div", {
128
172
  className: "".concat(prefixCls, "-close"),
129
173
  onClick: e => this.close(e, children)
130
174
  }, /*#__PURE__*/React.createElement(IconClose, {
131
175
  size: "small"
132
176
  })) : null;
133
- return /*#__PURE__*/React.createElement("div", _Object$assign({}, baseProps), /*#__PURE__*/React.createElement("div", {
177
+ return /*#__PURE__*/React.createElement("div", _Object$assign({
178
+ "aria-label": this.props['aria-label'] || _isString(children) ? _concatInstanceProperty(_context7 = "".concat(closable ? 'Closable ' : '', "Tag: ")).call(_context7, children) : ''
179
+ }, wrapProps), /*#__PURE__*/React.createElement("div", {
134
180
  className: "".concat(prefixCls, "-content")
135
181
  }, avatarSrc ? this.renderAvatar() : null, children, closeIcon));
136
182
  }
@@ -160,5 +206,6 @@ Tag.propTypes = {
160
206
  style: PropTypes.object,
161
207
  className: PropTypes.string,
162
208
  avatarSrc: PropTypes.string,
163
- avatarShape: PropTypes.oneOf(avatarShapeSet)
209
+ avatarShape: PropTypes.oneOf(avatarShapeSet),
210
+ 'aria-label': PropTypes.string
164
211
  };
@@ -16,6 +16,7 @@ export interface TagProps {
16
16
  className?: string;
17
17
  avatarSrc?: string;
18
18
  avatarShape?: AvatarShape;
19
+ 'aria-label'?: React.AriaAttributes['aria-label'];
19
20
  }
20
21
  export interface TagGroupProps {
21
22
  style?: React.CSSProperties;
@@ -195,7 +195,8 @@ class TagInput extends BaseComponent {
195
195
  ["".concat(prefixCls, "-prefix-icon")]: /*#__PURE__*/React.isValidElement(prefix) && !(prefix && _isString(prefix))
196
196
  });
197
197
  return /*#__PURE__*/React.createElement("div", {
198
- className: prefixWrapperCls
198
+ className: prefixWrapperCls,
199
+ "x-semi-prop": "prefix"
199
200
  }, prefix);
200
201
  }
201
202
 
@@ -214,7 +215,8 @@ class TagInput extends BaseComponent {
214
215
  ["".concat(prefixCls, "-suffix-icon")]: /*#__PURE__*/React.isValidElement(suffix) && !(suffix && _isString(suffix))
215
216
  });
216
217
  return /*#__PURE__*/React.createElement("div", {
217
- className: suffixWrapperCls
218
+ className: suffixWrapperCls,
219
+ "x-semi-prop": "suffix"
218
220
  }, suffix);
219
221
  }
220
222
 
@@ -251,7 +253,7 @@ class TagInput extends BaseComponent {
251
253
  if (_isFunction(renderTagItem)) {
252
254
  item = renderTagItem(value, index);
253
255
  } else {
254
- var _context2;
256
+ var _context2, _context3;
255
257
 
256
258
  item = /*#__PURE__*/React.createElement(Tag, {
257
259
  className: tagCls,
@@ -263,7 +265,8 @@ class TagInput extends BaseComponent {
263
265
  },
264
266
  closable: !disabled,
265
267
  key: _concatInstanceProperty(_context2 = "".concat(index)).call(_context2, value),
266
- visible: true
268
+ visible: true,
269
+ "aria-label": _concatInstanceProperty(_context3 = "".concat(!disabled ? 'Closable ' : '', "Tag: ")).call(_context3, value)
267
270
  }, /*#__PURE__*/React.createElement(Paragraph, {
268
271
  className: typoCls,
269
272
  ellipsis: {
@@ -278,7 +278,9 @@ class Combobox extends BaseComponent {
278
278
  componentName: "TimePicker"
279
279
  }, (locale, localeCode) => /*#__PURE__*/React.createElement(ScrollList, {
280
280
  header: panelHeader,
281
- footer: panelFooter
281
+ footer: panelFooter,
282
+ "x-semi-header-alias": "panelHeader",
283
+ "x-semi-footer-alias": "panelFooter"
282
284
  }, this.renderAMPMSelect(locale, localeCode), this.renderHourSelect(value.getHours(), locale), this.renderMinuteSelect(value.getMinutes(), locale), this.renderSecondSelect(value.getSeconds(), locale)));
283
285
  }
284
286
 
@@ -111,7 +111,7 @@ class Toast extends BaseComponent {
111
111
  const btnTheme = 'borderless';
112
112
  const btnSize = 'small';
113
113
  return /*#__PURE__*/React.createElement("div", {
114
- role: 'alert',
114
+ role: "alert",
115
115
  "aria-label": "".concat(type ? type : 'default', " type"),
116
116
  className: toastCls,
117
117
  style: style,
@@ -121,13 +121,16 @@ class Toast extends BaseComponent {
121
121
  className: "".concat(prefixCls, "-content")
122
122
  }, this.renderIcon(), /*#__PURE__*/React.createElement("span", {
123
123
  className: "".concat(prefixCls, "-content-text"),
124
- style: textStyle
124
+ style: textStyle,
125
+ "x-semi-prop": "content"
125
126
  }, content), showClose && /*#__PURE__*/React.createElement("div", {
126
127
  className: "".concat(prefixCls, "-close-button")
127
128
  }, /*#__PURE__*/React.createElement(Button, {
128
129
  onClick: e => this.close(e),
129
130
  type: "tertiary",
130
- icon: /*#__PURE__*/React.createElement(IconClose, null),
131
+ icon: /*#__PURE__*/React.createElement(IconClose, {
132
+ "x-semi-prop": "icon"
133
+ }),
131
134
  theme: btnTheme,
132
135
  size: btnSize
133
136
  }))));
@@ -237,7 +237,8 @@ class Transfer extends BaseComponent {
237
237
  className: leftItemCls,
238
238
  checked: checked,
239
239
  role: "listitem",
240
- onChange: () => this.onSelectOrRemove(item)
240
+ onChange: () => this.onSelectOrRemove(item),
241
+ "x-semi-children-alias": "dataSource[".concat(index, "].label")
241
242
  }, item.label);
242
243
  }
243
244
 
@@ -373,7 +373,8 @@ export default class TreeNode extends PureComponent {
373
373
  return /*#__PURE__*/React.createElement("ul", {
374
374
  className: wrapperCls
375
375
  }, /*#__PURE__*/React.createElement("li", {
376
- className: _concatInstanceProperty(_context2 = "".concat(prefixcls, "-label ")).call(_context2, prefixcls, "-label-empty")
376
+ className: _concatInstanceProperty(_context2 = "".concat(prefixcls, "-label ")).call(_context2, prefixcls, "-label-empty"),
377
+ "x-semi-prop": "emptyContent"
377
378
  }, emptyContent));
378
379
  } // eslint-disable-next-line max-lines-per-function
379
380
 
@@ -5,13 +5,13 @@ import _isEmpty from "lodash/isEmpty";
5
5
  import _isString from "lodash/isString";
6
6
  import _isEqual from "lodash/isEqual";
7
7
  import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
8
+ import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
8
9
  import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
9
10
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
10
11
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
11
12
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
12
13
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
13
14
  import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
14
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
15
15
  import React, { Fragment } from 'react';
16
16
  import ReactDOM from 'react-dom';
17
17
  import cls from 'classnames';
@@ -59,7 +59,8 @@ class TreeSelect extends BaseComponent {
59
59
  ["".concat(prefixcls, "-suffix-icon")]: isSemiIcon(suffix)
60
60
  });
61
61
  return /*#__PURE__*/React.createElement("div", {
62
- className: suffixWrapperCls
62
+ className: suffixWrapperCls,
63
+ "x-semi-prop": "suffix"
63
64
  }, suffix);
64
65
  };
65
66
 
@@ -79,7 +80,8 @@ class TreeSelect extends BaseComponent {
79
80
  });
80
81
  return /*#__PURE__*/React.createElement("div", {
81
82
  className: prefixWrapperCls,
82
- id: insetLabelId
83
+ id: insetLabelId,
84
+ "x-semi-prop": "prefix,insetLabel"
83
85
  }, labelNode);
84
86
  };
85
87
 
@@ -179,7 +181,7 @@ class TreeSelect extends BaseComponent {
179
181
 
180
182
  if (checkRelation === 'related') {
181
183
  renderKeys = normalizeKeyList([...checkedKeys], keyEntities, leafOnly);
182
- } else if (checkRelation === 'unRelated') {
184
+ } else if (checkRelation === 'unRelated' && _Object$keys(keyEntities).length > 0) {
183
185
  renderKeys = [...realCheckedKeys];
184
186
  }
185
187
 
@@ -336,7 +338,8 @@ class TreeSelect extends BaseComponent {
336
338
  }
337
339
 
338
340
  return arrowIcon ? /*#__PURE__*/React.createElement("div", {
339
- className: cls("".concat(prefixcls, "-arrow"))
341
+ className: cls("".concat(prefixcls, "-arrow")),
342
+ "x-semi-prop": "arrowIcon"
340
343
  }, arrowIcon) : null;
341
344
  };
342
345
 
@@ -536,7 +536,8 @@ export default class Base extends Component {
536
536
 
537
537
  const iconSize = size === 'small' ? 'small' : 'default';
538
538
  return /*#__PURE__*/React.createElement("span", {
539
- className: "".concat(prefixCls, "-icon")
539
+ className: "".concat(prefixCls, "-icon"),
540
+ "x-semi-prop": "icon"
540
541
  }, isSemiIcon(icon) ? /*#__PURE__*/React.cloneElement(icon, {
541
542
  size: iconSize
542
543
  }) : icon);
@@ -37,7 +37,7 @@ export default class Title extends PureComponent<TitleProps> {
37
37
  underline: PropTypes.Requireable<boolean>;
38
38
  strong: PropTypes.Requireable<boolean>;
39
39
  type: PropTypes.Requireable<"warning" | "success" | "primary" | "tertiary" | "secondary" | "danger" | "quaternary">;
40
- heading: PropTypes.Requireable<1 | 2 | 3 | 4 | 5 | 6>;
40
+ heading: PropTypes.Requireable<4 | 1 | 2 | 3 | 5 | 6>;
41
41
  style: PropTypes.Requireable<object>;
42
42
  className: PropTypes.Requireable<string>;
43
43
  component: PropTypes.Requireable<string>;
@@ -6,7 +6,7 @@ import BaseComponent, { ValidateStatus } from '../_base/baseComponent';
6
6
  import { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError } from './interface';
7
7
  import { Locale } from '../locale/interface';
8
8
  import '@douyinfe/semi-foundation/lib/es/upload/upload.css';
9
- export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult };
9
+ export { FileItem, RenderFileItemProps, UploadListType, PromptPositionType, BeforeUploadProps, AfterUploadProps, OnChangeProps, customRequestArgs, CustomError, BeforeUploadObjectResult, AfterUploadResult, };
10
10
  export interface UploadProps {
11
11
  accept?: string;
12
12
  action: string;
@@ -230,7 +230,9 @@ class Upload extends BaseComponent {
230
230
  });
231
231
  }
232
232
 
233
- const addContent = /*#__PURE__*/React.createElement("div", _Object$assign({}, addContentProps), children);
233
+ const addContent = /*#__PURE__*/React.createElement("div", _Object$assign({}, addContentProps, {
234
+ "x-semi-prop": "children"
235
+ }), children);
234
236
 
235
237
  if (!showUploadList || !fileList.length) {
236
238
  if (showAddTriggerInList) {
@@ -363,15 +365,18 @@ class Upload extends BaseComponent {
363
365
  onDragEnter: this.onDragEnter,
364
366
  onClick: this.onClick
365
367
  }, children ? children : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
366
- className: "".concat(dragAreaBaseCls, "-icon")
368
+ className: "".concat(dragAreaBaseCls, "-icon"),
369
+ "x-semi-prop": "dragIcon"
367
370
  }, dragIcon || /*#__PURE__*/React.createElement(IconUpload, {
368
371
  size: "extra-large"
369
372
  })), /*#__PURE__*/React.createElement("div", {
370
373
  className: "".concat(dragAreaBaseCls, "-text")
371
374
  }, /*#__PURE__*/React.createElement("div", {
372
- className: "".concat(dragAreaBaseCls, "-main-text")
375
+ className: "".concat(dragAreaBaseCls, "-main-text"),
376
+ "x-semi-prop": "dragMainText"
373
377
  }, dragMainText || locale.mainText), /*#__PURE__*/React.createElement("div", {
374
- className: "".concat(dragAreaBaseCls, "-sub-text")
378
+ className: "".concat(dragAreaBaseCls, "-sub-text"),
379
+ "x-semi-prop": "dragSubText"
375
380
  }, dragSubText), /*#__PURE__*/React.createElement("div", {
376
381
  className: "".concat(dragAreaBaseCls, "-tips")
377
382
  }, dragAreaStatus === strings.DRAG_AREA_LEGAL && /*#__PURE__*/React.createElement("span", {
@@ -557,9 +562,11 @@ class Upload extends BaseComponent {
557
562
  className: inputReplaceCls,
558
563
  ref: this.replaceInputRef
559
564
  }), this.renderAddContent(), prompt ? /*#__PURE__*/React.createElement("div", {
560
- className: promptCls
565
+ className: promptCls,
566
+ "x-semi-prop": "prompt"
561
567
  }, prompt) : null, validateMessage ? /*#__PURE__*/React.createElement("div", {
562
- className: validateMsgCls
568
+ className: validateMsgCls,
569
+ "x-semi-prop": "validateMessage"
563
570
  }, validateMessage) : null, this.renderFileList());
564
571
  }
565
572
 
package/list/index.tsx CHANGED
@@ -71,7 +71,11 @@ class List<T = any> extends BaseComponent<ListProps<T>> {
71
71
  renderEmpty = () => {
72
72
  const { emptyContent } = this.props;
73
73
  if (emptyContent) {
74
- return (<div className={`${cssClasses.PREFIX}-empty`}>{emptyContent}</div>);
74
+ return (
75
+ <div className={`${cssClasses.PREFIX}-empty`} x-semi-prop="emptyContent">
76
+ {emptyContent}
77
+ </div>
78
+ );
75
79
  } else {
76
80
  return (
77
81
  <LocaleConsumer componentName="List">
@@ -152,19 +156,27 @@ class List<T = any> extends BaseComponent<ListProps<T>> {
152
156
  }
153
157
  return (
154
158
  <div className={wrapperCls} style={style}>
155
- {header ? <div className={`${cssClasses.PREFIX}-header`}>{header}</div> : null}
159
+ {header ? (
160
+ <div className={`${cssClasses.PREFIX}-header`} x-semi-prop="header">
161
+ {header}
162
+ </div>
163
+ ) : null}
156
164
  <ListContext.Provider
157
165
  value={{
158
166
  grid,
159
167
  onRightClick,
160
- onClick
168
+ onClick,
161
169
  }}
162
170
  >
163
171
  <Spin spinning={loading} size="large">
164
172
  {this.wrapChildren(childrenList, children)}
165
173
  </Spin>
166
174
  </ListContext.Provider>
167
- {footer ? <div className={`${cssClasses.PREFIX}-footer`}>{footer}</div> : null}
175
+ {footer ? (
176
+ <div className={`${cssClasses.PREFIX}-footer`} x-semi-prop="footer">
177
+ {footer}
178
+ </div>
179
+ ) : null}
168
180
  {loadMore ? loadMore : null}
169
181
  </div>
170
182
  );
@@ -81,7 +81,7 @@ const ConfirmModal = (props: ConfirmProps) => {
81
81
  visible={visible}
82
82
  {...rest}
83
83
  >
84
- <div className={contentCls}>{content}</div>
84
+ <div className={contentCls} x-semi-prop="content">{content}</div>
85
85
  </Modal>
86
86
  );
87
87
  };
package/modal/Modal.tsx CHANGED
@@ -291,6 +291,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
291
291
  loading={cancelLoading}
292
292
  type="tertiary"
293
293
  {...this.props.cancelButtonProps}
294
+ x-semi-children-alias="cancelText"
294
295
  >
295
296
  {cancelText || locale.cancel}
296
297
  </Button>
@@ -310,6 +311,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
310
311
  loading={confirmLoading}
311
312
  onClick={this.handleOk}
312
313
  {...this.props.okButtonProps}
314
+ x-semi-children-alias="okText"
313
315
  >
314
316
  {okText || locale.confirm}
315
317
  </Button>
@@ -158,7 +158,7 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
158
158
  } = this.props;
159
159
  let closer;
160
160
  if (closable) {
161
- const iconType = closeIcon || <IconClose/>;
161
+ const iconType = closeIcon || <IconClose x-semi-prop="closeIcon" />;
162
162
  closer = (
163
163
  <Button
164
164
  aria-label="close"
@@ -177,7 +177,7 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
177
177
 
178
178
  renderIcon = () => {
179
179
  const { icon } = this.props;
180
- return icon ? <span className={`${cssClasses.DIALOG}-icon-wrapper`}>{icon}</span> : null;
180
+ return icon ? <span className={`${cssClasses.DIALOG}-icon-wrapper`} x-semi-prop="icon">{icon}</span> : null;
181
181
  };
182
182
 
183
183
  renderHeader = () => {
@@ -187,15 +187,20 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
187
187
  const { title } = this.props;
188
188
  const closer = this.renderCloseBtn();
189
189
  const icon = this.renderIcon();
190
- return (title === null || title === undefined) ?
191
- null :
192
- (
193
- <div className={`${cssClasses.DIALOG}-header`}>
194
- {icon}
195
- <Typography.Title heading={5} className={`${cssClasses.DIALOG}-title`} id={`${cssClasses.DIALOG}-title`}>{title}</Typography.Title>
196
- {closer}
197
- </div>
198
- );
190
+ return title === null || title === undefined ? null : (
191
+ <div className={`${cssClasses.DIALOG}-header`}>
192
+ {icon}
193
+ <Typography.Title
194
+ heading={5}
195
+ className={`${cssClasses.DIALOG}-title`}
196
+ id={`${cssClasses.DIALOG}-title`}
197
+ x-semi-prop="title"
198
+ >
199
+ {title}
200
+ </Typography.Title>
201
+ {closer}
202
+ </div>
203
+ );
199
204
  };
200
205
 
201
206
  renderBody = () => {
@@ -210,16 +215,19 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
210
215
  const closer = this.renderCloseBtn();
211
216
  const icon = this.renderIcon();
212
217
  const hasHeader = title !== null && title !== undefined || 'header' in this.props;
213
- return hasHeader ?
214
- <div className={bodyCls} id={`${cssClasses.DIALOG}-body`} style={bodyStyle}>{children}</div> :
215
- (
216
- <div className={`${cssClasses.DIALOG}-body-wrapper`}>
217
- {icon}
218
- <div className={bodyCls} style={bodyStyle}>{children}</div>
219
- {closer}
218
+ return hasHeader ? (
219
+ <div className={bodyCls} id={`${cssClasses.DIALOG}-body`} style={bodyStyle} x-semi-prop="children">
220
+ {children}
221
+ </div>
222
+ ) : (
223
+ <div className={`${cssClasses.DIALOG}-body-wrapper`}>
224
+ {icon}
225
+ <div className={bodyCls} style={bodyStyle} x-semi-prop="children">
226
+ {children}
220
227
  </div>
221
- );
222
-
228
+ {closer}
229
+ </div>
230
+ );
223
231
  };
224
232
 
225
233
  getDialogElement = () => {
@@ -242,7 +250,11 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
242
250
  }
243
251
  const body = this.renderBody();
244
252
  const header = this.renderHeader();
245
- const footer = props.footer ? <div className={`${cssClasses.DIALOG}-footer`}>{props.footer}</div> : null;
253
+ const footer = props.footer ? (
254
+ <div className={`${cssClasses.DIALOG}-footer`} x-semi-prop="footer">
255
+ {props.footer}
256
+ </div>
257
+ ) : null;
246
258
  const dialogElement = (
247
259
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
248
260
  <div
@@ -29,7 +29,7 @@ export interface NavItemProps extends ItemProps, BaseProps {
29
29
  itemKey?: React.ReactText;
30
30
  level?: number;
31
31
  link?: string;
32
- linkOptions?: React.HTMLAttributes<HTMLLinkElement>;
32
+ linkOptions?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
33
33
  text?: React.ReactNode;
34
34
  tooltipHideDelay?: number;
35
35
  tooltipShowDelay?: number;
@@ -106,7 +106,7 @@ class Notice extends BaseComponent<NoticeReactProps, NoticeState> {
106
106
  }
107
107
  if (iconType) {
108
108
  return (
109
- <div className={iconCls}>
109
+ <div className={iconCls} x-semi-prop="icon">
110
110
  {isSemiIcon(iconType) ? React.cloneElement(iconType, { size: iconType.props.size || 'large' }) : iconType}
111
111
  </div>
112
112
  );
@@ -170,14 +170,26 @@ class Notice extends BaseComponent<NoticeReactProps, NoticeState> {
170
170
  <div>{this.renderTypeIcon()}</div>
171
171
  <div className={`${prefixCls}-inner`}>
172
172
  <div className={`${prefixCls}-content-wrapper`}>
173
- {title ? <div id={titleID} className={`${prefixCls}-title`}>{title}</div> : ''}
174
- {content ? <div className={`${prefixCls}-content`}>{content}</div> : ''}
173
+ {title ? (
174
+ <div id={titleID} className={`${prefixCls}-title`} x-semi-prop="title">
175
+ {title}
176
+ </div>
177
+ ) : (
178
+ ''
179
+ )}
180
+ {content ? (
181
+ <div className={`${prefixCls}-content`} x-semi-prop="content">
182
+ {content}
183
+ </div>
184
+ ) : (
185
+ ''
186
+ )}
175
187
  </div>
176
188
  {showClose && (
177
189
  <Button
178
190
  className={`${prefixCls}-icon-close`}
179
191
  type="tertiary"
180
- icon={<IconClose/>}
192
+ icon={<IconClose />}
181
193
  theme="borderless"
182
194
  size="small"
183
195
  onClick={this.close}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.11.0",
3
+ "version": "2.12.0-alpha.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
- "@douyinfe/semi-animation": "2.11.0",
18
- "@douyinfe/semi-animation-react": "2.11.0",
19
- "@douyinfe/semi-foundation": "2.11.0",
20
- "@douyinfe/semi-icons": "2.11.0",
21
- "@douyinfe/semi-illustrations": "2.11.0",
22
- "@douyinfe/semi-theme-default": "2.11.0",
17
+ "@douyinfe/semi-animation": "^2.12.0-alpha.0",
18
+ "@douyinfe/semi-animation-react": "^2.12.0-alpha.0",
19
+ "@douyinfe/semi-foundation": "^2.12.0-alpha.0",
20
+ "@douyinfe/semi-icons": "^2.12.0-alpha.0",
21
+ "@douyinfe/semi-illustrations": "^2.12.0-alpha.0",
22
+ "@douyinfe/semi-theme-default": "^2.12.0-alpha.0",
23
23
  "@types/react-window": "^1.8.2",
24
24
  "async-validator": "^3.5.0",
25
25
  "classnames": "^2.2.6",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "f7a5cae3d9190faff4a08c5a4da23927a1ab86e5",
72
+ "gitHead": "2a4f34115b9dd03fc3c40b1edcc421bf64a3024b",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.11.0",
78
+ "@douyinfe/semi-scss-compile": "^2.12.0-alpha.0",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "babel-loader": "^8.2.2",