@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
@@ -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
 
@@ -110,6 +112,8 @@ class TreeSelect extends BaseComponent {
110
112
  this.handleClick = e => {
111
113
  this.foundation.handleClick(e);
112
114
  };
115
+ /* istanbul ignore next */
116
+
113
117
 
114
118
  this.handleSelectionEnterPress = e => {
115
119
  this.foundation.handleSelectionEnterPress(e);
@@ -303,6 +307,8 @@ class TreeSelect extends BaseComponent {
303
307
  e && e.stopPropagation();
304
308
  this.foundation.handleClear(e);
305
309
  };
310
+ /* istanbul ignore next */
311
+
306
312
 
307
313
  this.handleClearEnterPress = e => {
308
314
  e && e.stopPropagation();
@@ -336,7 +342,8 @@ class TreeSelect extends BaseComponent {
336
342
  }
337
343
 
338
344
  return arrowIcon ? /*#__PURE__*/React.createElement("div", {
339
- className: cls("".concat(prefixcls, "-arrow"))
345
+ className: cls("".concat(prefixcls, "-arrow")),
346
+ "x-semi-prop": "arrowIcon"
340
347
  }, arrowIcon) : null;
341
348
  };
342
349
 
@@ -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);
@@ -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
@@ -292,6 +292,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
292
292
  type="tertiary"
293
293
  autoFocus={true}
294
294
  {...this.props.cancelButtonProps}
295
+ x-semi-children-alias="cancelText"
295
296
  >
296
297
  {cancelText || locale.cancel}
297
298
  </Button>
@@ -311,6 +312,7 @@ class Modal extends BaseComponent<ModalReactProps, ModalState> {
311
312
  loading={confirmLoading}
312
313
  onClick={this.handleOk}
313
314
  {...this.props.okButtonProps}
315
+ x-semi-children-alias="okText"
314
316
  >
315
317
  {okText || locale.confirm}
316
318
  </Button>
@@ -163,7 +163,7 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
163
163
  } = this.props;
164
164
  let closer;
165
165
  if (closable) {
166
- const iconType = closeIcon || <IconClose/>;
166
+ const iconType = closeIcon || <IconClose x-semi-prop="closeIcon" />;
167
167
  closer = (
168
168
  <Button
169
169
  aria-label="close"
@@ -182,7 +182,7 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
182
182
 
183
183
  renderIcon = () => {
184
184
  const { icon } = this.props;
185
- return icon ? <span className={`${cssClasses.DIALOG}-icon-wrapper`}>{icon}</span> : null;
185
+ return icon ? <span className={`${cssClasses.DIALOG}-icon-wrapper`} x-semi-prop="icon">{icon}</span> : null;
186
186
  };
187
187
 
188
188
  renderHeader = () => {
@@ -197,8 +197,14 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
197
197
  (
198
198
  <div className={`${cssClasses.DIALOG}-header`}>
199
199
  {icon}
200
- <Typography.Title heading={5} className={`${cssClasses.DIALOG}-title`}
201
- id={`${cssClasses.DIALOG}-title`}>{title}</Typography.Title>
200
+ <Typography.Title
201
+ heading={5}
202
+ className={`${cssClasses.DIALOG}-title`}
203
+ id={`${cssClasses.DIALOG}-title`}
204
+ x-semi-prop="title"
205
+ >
206
+ {title}
207
+ </Typography.Title>
202
208
  {closer}
203
209
  </div>
204
210
  );
@@ -216,16 +222,19 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
216
222
  const closer = this.renderCloseBtn();
217
223
  const icon = this.renderIcon();
218
224
  const hasHeader = title !== null && title !== undefined || 'header' in this.props;
219
- return hasHeader ?
220
- <div className={bodyCls} id={`${cssClasses.DIALOG}-body`} style={bodyStyle}>{children}</div> :
221
- (
222
- <div className={`${cssClasses.DIALOG}-body-wrapper`}>
223
- {icon}
224
- <div className={bodyCls} style={bodyStyle}>{children}</div>
225
- {closer}
225
+ return hasHeader ? (
226
+ <div className={bodyCls} id={`${cssClasses.DIALOG}-body`} style={bodyStyle} x-semi-prop="children">
227
+ {children}
228
+ </div>
229
+ ) : (
230
+ <div className={`${cssClasses.DIALOG}-body-wrapper`}>
231
+ {icon}
232
+ <div className={bodyCls} style={bodyStyle} x-semi-prop="children">
233
+ {children}
226
234
  </div>
227
- );
228
-
235
+ {closer}
236
+ </div>
237
+ );
229
238
  };
230
239
 
231
240
  getDialogElement = () => {
@@ -248,7 +257,11 @@ export default class ModalContent extends BaseComponent<ModalContentReactProps,
248
257
  }
249
258
  const body = this.renderBody();
250
259
  const header = this.renderHeader();
251
- const footer = props.footer ? <div className={`${cssClasses.DIALOG}-footer`}>{props.footer}</div> : null;
260
+ const footer = props.footer ? (
261
+ <div className={`${cssClasses.DIALOG}-footer`} x-semi-prop="footer">
262
+ {props.footer}
263
+ </div>
264
+ ) : null;
252
265
  const dialogElement = (
253
266
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
254
267
  <div
@@ -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.13.0-beta.0",
3
+ "version": "2.14.0-beta.0",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -15,11 +15,11 @@
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
17
  "@douyinfe/semi-animation": "2.12.0",
18
- "@douyinfe/semi-animation-react": "2.13.0-beta.0",
19
- "@douyinfe/semi-foundation": "2.13.0-beta.0",
20
- "@douyinfe/semi-icons": "2.13.0-beta.0",
21
- "@douyinfe/semi-illustrations": "2.13.0-beta.0",
22
- "@douyinfe/semi-theme-default": "2.13.0-beta.0",
18
+ "@douyinfe/semi-animation-react": "2.14.0-beta.0",
19
+ "@douyinfe/semi-foundation": "2.14.0-beta.0",
20
+ "@douyinfe/semi-icons": "2.14.0-beta.0",
21
+ "@douyinfe/semi-illustrations": "2.14.0-beta.0",
22
+ "@douyinfe/semi-theme-default": "2.14.0-beta.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": "3b7c0e399103443a467eca0ff77f233a11346c99",
72
+ "gitHead": "a2044cdc5d6e5ca58c6eefe87b75a7c13002f381",
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.13.0-beta.0",
78
+ "@douyinfe/semi-scss-compile": "2.14.0-beta.0",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "babel-loader": "^8.2.2",
@@ -216,7 +216,14 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
216
216
  [`${prefixCls}-item-disabled`]: prevDisabled,
217
217
  });
218
218
  return (
219
- <li role="button" aria-disabled={prevDisabled ? true : false} aria-label="Previous" onClick={e => !prevDisabled && this.foundation.goPrev(e)} className={preClassName}>
219
+ <li
220
+ role="button"
221
+ aria-disabled={prevDisabled ? true : false}
222
+ aria-label="Previous"
223
+ onClick={e => !prevDisabled && this.foundation.goPrev(e)}
224
+ className={preClassName}
225
+ x-semi-prop="prevText"
226
+ >
220
227
  {prevText || <IconChevronLeft size="large" />}
221
228
  </li>
222
229
  );
@@ -231,7 +238,14 @@ export default class Pagination extends BaseComponent<PaginationProps, Paginatio
231
238
  [`${prefixCls}-next`]: true,
232
239
  });
233
240
  return (
234
- <li role="button" aria-disabled={nextDisabled ? true : false} aria-label="Next" onClick={e => !nextDisabled && this.foundation.goNext(e)} className={nextClassName}>
241
+ <li
242
+ role="button"
243
+ aria-disabled={nextDisabled ? true : false}
244
+ aria-label="Next"
245
+ onClick={e => !nextDisabled && this.foundation.goNext(e)}
246
+ className={nextClassName}
247
+ x-semi-prop="prevText"
248
+ >
235
249
  {nextText || <IconChevronRight size="large" />}
236
250
  </li>
237
251
  );
@@ -174,12 +174,20 @@ export default class Popconfirm extends BaseComponent<PopconfirmProps, Popconfir
174
174
  <div className={popCardCls} onClick={this.stopImmediatePropagation} style={style}>
175
175
  <div className={`${prefixCls}-inner`}>
176
176
  <div className={`${prefixCls}-header`}>
177
- <i className={`${prefixCls}-header-icon`}>
177
+ <i className={`${prefixCls}-header-icon`} x-semi-prop="icon">
178
178
  {React.isValidElement(icon) ? icon : null}
179
179
  </i>
180
180
  <div className={`${prefixCls}-header-body`}>
181
- {showTitle ? <div className={`${prefixCls}-header-title`}>{title}</div> : null}
182
- {showContent ? <div className={`${prefixCls}-header-content`}>{content}</div> : null}
181
+ {showTitle ? (
182
+ <div className={`${prefixCls}-header-title`} x-semi-prop="title">
183
+ {title}
184
+ </div>
185
+ ) : null}
186
+ {showContent ? (
187
+ <div className={`${prefixCls}-header-content`} x-semi-prop="content">
188
+ {content}
189
+ </div>
190
+ ) : null}
183
191
  </div>
184
192
  <Button
185
193
  className={`${prefixCls}-btn-close`}
@@ -34,13 +34,14 @@ _Radio.story = {
34
34
  export const RadioWithExtra = () => {
35
35
  return (
36
36
  <>
37
- <Radio value="1" extra="这是辅助的文本,同厂辅助文本会更长一些,甚至还可能换行">
37
+ <Radio value="1" extra="这是辅助的文本,同厂辅助文本会更长一些,甚至还可能换行" name="demo-radio-1">
38
38
  示例文本
39
39
  </Radio>
40
40
  <Radio
41
41
  style={{ width: 200 }}
42
42
  value="1"
43
43
  extra="这是辅助的文本,同厂辅助文本会更长一些,甚至还可能换行"
44
+ name="demo-radio-2"
44
45
  >
45
46
  示例文本
46
47
  </Radio>
@@ -227,13 +228,13 @@ export const _RadioGroup = () => {
227
228
  return (
228
229
  <div>
229
230
  value=1
230
- <RadioGroup name="pie" value="1" onChange={onChange}>
231
+ <RadioGroup name="pie1" value="1" onChange={onChange}>
231
232
  <Radio value="1">111</Radio>
232
233
  <Radio value="2">222</Radio>
233
234
  </RadioGroup>
234
235
  <br />
235
236
  defaultValue=1
236
- <RadioGroup name="pie" defaultValue="1" onChange={onChange}>
237
+ <RadioGroup name="pie2" defaultValue="1" onChange={onChange}>
237
238
  <Radio value="1">111</Radio>
238
239
  <Radio value="2">222</Radio>
239
240
  </RadioGroup>
@@ -316,6 +317,8 @@ const RadioWithAdvancedMode = () => {
316
317
  onChange={e => {
317
318
  console.log(e);
318
319
  setChecked(e.target.checked);
320
+ e.stopPropagation();
321
+ e.preventDefault();
319
322
  }}
320
323
  >
321
324
  111
@@ -434,19 +437,19 @@ export const RadioGroupButtonStyle = () => {
434
437
  };
435
438
  return (
436
439
  <Space vertical spacing="loose" align="start">
437
- <RadioGroup type="button" buttonSize="small" onChange={onChange1} value={value1}>
440
+ <RadioGroup type="button" buttonSize="small" onChange={onChange1} value={value1} name="demo-radio-button-1">
438
441
  <Radio value={1}>semi</Radio>
439
442
  <Radio value={2}>pipixia</Radio>
440
443
  <Radio value={3}>hotsoon</Radio>
441
444
  <Radio value={4}>toutiao</Radio>
442
445
  </RadioGroup>
443
- <RadioGroup type="button" buttonSize="middle" onChange={onChange2} value={value2}>
446
+ <RadioGroup type="button" buttonSize="middle" onChange={onChange2} value={value2} name="demo-radio-button-2">
444
447
  <Radio value={1}>semi</Radio>
445
448
  <Radio value={2}>pipixia</Radio>
446
449
  <Radio value={3}>hotsoon</Radio>
447
450
  <Radio value={4}>toutiao</Radio>
448
451
  </RadioGroup>
449
- <RadioGroup type="button" buttonSize="large" onChange={onChange3} value={value3}>
452
+ <RadioGroup type="button" buttonSize="large" onChange={onChange3} value={value3} name="demo-radio-button-3">
450
453
  <Radio value={1}>semi</Radio>
451
454
  <Radio value={2}>pipixia</Radio>
452
455
  <Radio value={3}>hotsoon</Radio>
package/radio/radio.tsx CHANGED
@@ -43,12 +43,14 @@ export type RadioProps = {
43
43
  'aria-label'?: React.AriaAttributes['aria-label'];
44
44
  addonId?: string;
45
45
  extraId?: string;
46
+ name?: string;
46
47
  };
47
48
 
48
49
  export interface RadioState {
49
50
  hover?: boolean;
50
51
  addonId?: string;
51
52
  extraId?: string;
53
+ focusVisible?: boolean;
52
54
  }
53
55
 
54
56
  export { RadioChangeEvent };
@@ -116,7 +118,10 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
116
118
  },
117
119
  setExtraId: () => {
118
120
  this.setState({ extraId: getUuidShort({ prefix: 'extra' }) });
119
- }
121
+ },
122
+ setFocusVisible: (focusVisible: boolean): void => {
123
+ this.setState({ focusVisible });
124
+ },
120
125
  };
121
126
  }
122
127
 
@@ -152,6 +157,14 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
152
157
  this.foundation.setHover(false);
153
158
  };
154
159
 
160
+ handleFocusVisible = (event: React.FocusEvent) => {
161
+ this.foundation.handleFocusVisible(event);
162
+ }
163
+
164
+ handleBlur = (event: React.FocusEvent) => {
165
+ this.foundation.handleBlur();
166
+ }
167
+
155
168
  render() {
156
169
  const {
157
170
  addonClassName,
@@ -166,7 +179,8 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
166
179
  extra,
167
180
  mode,
168
181
  type,
169
- value: propValue
182
+ value: propValue,
183
+ name
170
184
  } = this.props;
171
185
 
172
186
  let realChecked,
@@ -178,7 +192,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
178
192
  isButtonRadioComponent,
179
193
  buttonSize,
180
194
  realPrefixCls;
181
- const { hover: isHover, addonId, extraId } = this.state;
195
+ const { hover: isHover, addonId, extraId, focusVisible } = this.state;
182
196
  let props = {};
183
197
 
184
198
  if (this.isInGroup()) {
@@ -202,6 +216,8 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
202
216
 
203
217
  const prefix = realPrefixCls || css.PREFIX;
204
218
 
219
+ const focusOuter = isCardRadioGroup || isPureCardRadioGroup || isButtonRadio;
220
+
205
221
  const wrapper = cls(prefix, {
206
222
  [`${prefix}-disabled`]: isDisabled,
207
223
  [`${prefix}-checked`]: realChecked,
@@ -215,9 +231,10 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
215
231
  [`${prefix}-cardRadioGroup_checked_disabled`]: isCardRadioGroup && realChecked && isDisabled,
216
232
  [`${prefix}-cardRadioGroup_hover`]: isCardRadioGroup && !realChecked && isHover && !isDisabled,
217
233
  [className]: Boolean(className),
234
+ [`${prefix}-focus`]: focusVisible && (isCardRadioGroup || isPureCardRadioGroup),
218
235
  });
219
236
 
220
- const name = this.isInGroup() && this.context.radioGroup.name;
237
+ const groupName = this.isInGroup() && this.context.radioGroup.name;
221
238
  const addonCls = cls({
222
239
  [`${prefix}-addon`]: !isButtonRadio,
223
240
  [`${prefix}-addon-buttonRadio`]: isButtonRadio,
@@ -225,13 +242,23 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
225
242
  [`${prefix}-addon-buttonRadio-disabled`]: isButtonRadio && isDisabled,
226
243
  [`${prefix}-addon-buttonRadio-hover`]: isButtonRadio && !realChecked && !isDisabled && isHover,
227
244
  [`${prefix}-addon-buttonRadio-${buttonSize}`]: isButtonRadio && buttonSize,
245
+ [`${prefix}-focus`]: focusVisible && isButtonRadio,
228
246
  }, addonClassName);
229
247
  const renderContent = () => (
230
248
  <>
231
- {children ? <span className={addonCls} style={addonStyle} id={addonId}>{children}</span> : null}
232
- {extra && !isButtonRadio ? <div className={`${prefix}-extra`} id={extraId}>{extra}</div> : null}
249
+ {children ? (
250
+ <span className={addonCls} style={addonStyle} id={addonId} x-semi-prop="children">
251
+ {children}
252
+ </span>
253
+ ) : null}
254
+ {extra && !isButtonRadio ? (
255
+ <div className={`${prefix}-extra`} id={extraId} x-semi-prop="extra">
256
+ {extra}
257
+ </div>
258
+ ) : null}
233
259
  </>
234
260
  );
261
+
235
262
  return (
236
263
  <label
237
264
  style={style}
@@ -243,7 +270,7 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
243
270
  {...this.props}
244
271
  {...props}
245
272
  mode={realMode}
246
- name={name}
273
+ name={name ?? groupName}
247
274
  isButtonRadio={isButtonRadio}
248
275
  isPureCardRadioGroup={isPureCardRadioGroup}
249
276
  onChange={this.onChange}
@@ -252,6 +279,9 @@ class Radio extends BaseComponent<RadioProps, RadioState> {
252
279
  }}
253
280
  addonId={children && addonId}
254
281
  extraId={extra && extraId}
282
+ focusInner={focusVisible && !focusOuter}
283
+ onInputFocus={this.handleFocusVisible}
284
+ onInputBlur={this.handleBlur}
255
285
  />
256
286
  {
257
287
  isCardRadioGroup ?
@@ -23,6 +23,9 @@ export interface RadioInnerProps extends BaseProps {
23
23
  addonId?: string;
24
24
  extraId?: string;
25
25
  'aria-label'?: React.AriaAttributes['aria-label'];
26
+ focusInner?: boolean;
27
+ onInputFocus?: (e: any) => void;
28
+ onInputBlur?: (e: any) => void;
26
29
  }
27
30
 
28
31
  interface RadioInnerState {
@@ -39,6 +42,9 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
39
42
  onChange: PropTypes.func,
40
43
  mode: PropTypes.oneOf(['advanced', '']),
41
44
  'aria-label': PropTypes.string,
45
+ focusInner: PropTypes.bool,
46
+ onInputFocus: PropTypes.func,
47
+ onInputBlur: PropTypes.func,
42
48
  };
43
49
 
44
50
  static defaultProps = {
@@ -97,7 +103,7 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
97
103
  }
98
104
 
99
105
  render() {
100
- const { disabled, mode, autoFocus, name, isButtonRadio, isPureCardRadioGroup, addonId, extraId, 'aria-label': ariaLabel } = this.props;
106
+ const { disabled, mode, autoFocus, name, isButtonRadio, isPureCardRadioGroup, addonId, extraId, 'aria-label': ariaLabel, focusInner, onInputFocus, onInputBlur } = this.props;
101
107
  const { checked } = this.state;
102
108
 
103
109
  const prefix = this.props.prefixCls || css.PREFIX;
@@ -110,6 +116,8 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
110
116
  });
111
117
 
112
118
  const inner = classnames({
119
+ [`${prefix}-focus`]: focusInner,
120
+ [`${prefix}-focus-border`]: focusInner && !checked,
113
121
  [`${prefix}-inner-display`]: !isButtonRadio,
114
122
  });
115
123
 
@@ -119,7 +127,6 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
119
127
  ref={ref => {
120
128
  this.inputEntity = ref;
121
129
  }}
122
- // eslint-disable-next-line jsx-a11y/no-autofocus
123
130
  autoFocus={autoFocus}
124
131
  type={mode === 'advanced' ? 'checkbox' : 'radio'}
125
132
  checked={Boolean(checked)}
@@ -129,6 +136,8 @@ class RadioInner extends BaseComponent<RadioInnerProps, RadioInnerState> {
129
136
  aria-label={ariaLabel}
130
137
  aria-labelledby={addonId}
131
138
  aria-describedby={extraId}
139
+ onFocus={onInputFocus}
140
+ onBlur={onInputBlur}
132
141
  />
133
142
  <span className={inner}>{checked ? <IconRadio /> : null}</span>
134
143
  </span>
package/rating/item.tsx CHANGED
@@ -110,7 +110,7 @@ export default class Item extends PureComponent<RatingItemProps> {
110
110
  className={`${prefixCls}-wrapper`}
111
111
  >
112
112
  <div className={`${prefixCls}-first`} style={{ width: `${firstWidth * 100}%` }}>{content}</div>
113
- <div className={`${prefixCls}-second`}>{content}</div>
113
+ <div className={`${prefixCls}-second`} x-semi-prop="character">{content}</div>
114
114
  </div>
115
115
  </li>
116
116
  );