@douyinfe/semi-ui 2.14.0-alpha.0 → 2.14.0-beta.2

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 (223) 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 +957 -545
  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/_story/form.stories.tsx +9 -2
  31. package/form/field.tsx +1 -1
  32. package/form/hoc/withField.tsx +1 -1
  33. package/form/label.tsx +1 -1
  34. package/grid/col.tsx +1 -1
  35. package/grid/row.tsx +1 -1
  36. package/gulpfile.js +5 -5
  37. package/iconButton/index.tsx +2 -1
  38. package/input/_story/input.stories.js +32 -3
  39. package/input/index.tsx +45 -23
  40. package/input/inputGroup.tsx +3 -1
  41. package/input/textarea.tsx +2 -14
  42. package/lib/cjs/_base/base.css +36 -14
  43. package/lib/cjs/avatar/avatarGroup.d.ts +1 -1
  44. package/lib/cjs/avatar/avatarGroup.js +36 -9
  45. package/lib/cjs/avatar/index.d.ts +5 -0
  46. package/lib/cjs/avatar/index.js +121 -41
  47. package/lib/cjs/backtop/index.js +2 -1
  48. package/lib/cjs/badge/index.js +2 -1
  49. package/lib/cjs/banner/index.js +9 -4
  50. package/lib/cjs/breadcrumb/index.js +4 -3
  51. package/lib/cjs/button/Button.js +13 -3
  52. package/lib/cjs/card/index.js +10 -5
  53. package/lib/cjs/carousel/CarouselArrow.js +6 -2
  54. package/lib/cjs/carousel/index.js +2 -1
  55. package/lib/cjs/cascader/index.js +15 -8
  56. package/lib/cjs/cascader/item.js +2 -1
  57. package/lib/cjs/checkbox/checkbox.js +6 -2
  58. package/lib/cjs/collapsible/index.js +2 -1
  59. package/lib/cjs/datePicker/dateInput.js +2 -1
  60. package/lib/cjs/datePicker/datePicker.js +4 -2
  61. package/lib/cjs/divider/index.js +2 -1
  62. package/lib/cjs/dropdown/index.js +2 -1
  63. package/lib/cjs/empty/index.js +8 -4
  64. package/lib/cjs/form/baseForm.d.ts +1 -1
  65. package/lib/cjs/form/field.d.ts +1 -1
  66. package/lib/cjs/form/field.js +2 -2
  67. package/lib/cjs/form/hoc/withField.js +2 -1
  68. package/lib/cjs/form/label.js +2 -1
  69. package/lib/cjs/grid/col.js +2 -1
  70. package/lib/cjs/grid/row.js +2 -1
  71. package/lib/cjs/iconButton/index.js +3 -1
  72. package/lib/cjs/input/index.d.ts +0 -1
  73. package/lib/cjs/input/index.js +41 -36
  74. package/lib/cjs/input/inputGroup.js +2 -3
  75. package/lib/cjs/input/textarea.js +8 -15
  76. package/lib/cjs/list/index.js +6 -3
  77. package/lib/cjs/modal/ConfirmModal.js +2 -1
  78. package/lib/cjs/modal/Modal.js +6 -2
  79. package/lib/cjs/modal/ModalContent.js +13 -6
  80. package/lib/cjs/notification/notice.js +6 -3
  81. package/lib/cjs/pagination/index.js +4 -2
  82. package/lib/cjs/popconfirm/index.js +6 -3
  83. package/lib/cjs/radio/radio.d.ts +4 -0
  84. package/lib/cjs/radio/radio.js +32 -9
  85. package/lib/cjs/radio/radioInner.d.ts +6 -0
  86. package/lib/cjs/radio/radioInner.js +13 -4
  87. package/lib/cjs/rating/item.js +2 -1
  88. package/lib/cjs/scrollList/index.js +6 -3
  89. package/lib/cjs/select/index.js +10 -4
  90. package/lib/cjs/select/option.js +2 -1
  91. package/lib/cjs/sideSheet/SideSheetContent.js +6 -3
  92. package/lib/cjs/skeleton/index.js +3 -1
  93. package/lib/cjs/space/index.js +2 -1
  94. package/lib/cjs/spin/index.js +7 -3
  95. package/lib/cjs/switch/index.js +6 -4
  96. package/lib/cjs/table/ColumnFilter.js +2 -2
  97. package/lib/cjs/table/ColumnSelection.js +2 -2
  98. package/lib/cjs/table/Table.js +6 -3
  99. package/lib/cjs/tabs/TabBar.js +2 -1
  100. package/lib/cjs/tabs/TabPane.js +5 -2
  101. package/lib/cjs/tagInput/index.js +33 -22
  102. package/lib/cjs/timePicker/Combobox.js +3 -1
  103. package/lib/cjs/timePicker/TimePicker.js +2 -0
  104. package/lib/cjs/toast/toast.js +6 -3
  105. package/lib/cjs/tooltip/index.js +6 -1
  106. package/lib/cjs/transfer/index.js +6 -5
  107. package/lib/cjs/tree/treeNode.js +4 -3
  108. package/lib/cjs/treeSelect/index.js +10 -3
  109. package/lib/cjs/typography/base.js +2 -1
  110. package/lib/cjs/typography/title.d.ts +1 -1
  111. package/lib/cjs/upload/index.d.ts +1 -1
  112. package/lib/cjs/upload/index.js +13 -6
  113. package/lib/es/_base/base.css +36 -14
  114. package/lib/es/avatar/avatarGroup.d.ts +1 -1
  115. package/lib/es/avatar/avatarGroup.js +37 -9
  116. package/lib/es/avatar/index.d.ts +5 -0
  117. package/lib/es/avatar/index.js +119 -38
  118. package/lib/es/backtop/index.js +2 -1
  119. package/lib/es/badge/index.js +2 -1
  120. package/lib/es/banner/index.js +9 -4
  121. package/lib/es/breadcrumb/index.js +4 -3
  122. package/lib/es/button/Button.js +11 -3
  123. package/lib/es/card/index.js +10 -5
  124. package/lib/es/carousel/CarouselArrow.js +6 -2
  125. package/lib/es/carousel/index.js +2 -1
  126. package/lib/es/cascader/index.js +15 -8
  127. package/lib/es/cascader/item.js +2 -1
  128. package/lib/es/checkbox/checkbox.js +6 -2
  129. package/lib/es/collapsible/index.js +2 -1
  130. package/lib/es/datePicker/dateInput.js +2 -1
  131. package/lib/es/datePicker/datePicker.js +4 -2
  132. package/lib/es/divider/index.js +2 -1
  133. package/lib/es/dropdown/index.js +2 -1
  134. package/lib/es/empty/index.js +8 -4
  135. package/lib/es/form/baseForm.d.ts +1 -1
  136. package/lib/es/form/field.d.ts +1 -1
  137. package/lib/es/form/field.js +1 -1
  138. package/lib/es/form/hoc/withField.js +2 -1
  139. package/lib/es/form/label.js +2 -1
  140. package/lib/es/grid/col.js +2 -1
  141. package/lib/es/grid/row.js +2 -1
  142. package/lib/es/iconButton/index.js +3 -1
  143. package/lib/es/input/index.d.ts +0 -1
  144. package/lib/es/input/index.js +41 -36
  145. package/lib/es/input/inputGroup.js +2 -3
  146. package/lib/es/input/textarea.js +8 -15
  147. package/lib/es/list/index.js +6 -3
  148. package/lib/es/modal/ConfirmModal.js +2 -1
  149. package/lib/es/modal/Modal.js +6 -2
  150. package/lib/es/modal/ModalContent.js +13 -6
  151. package/lib/es/notification/notice.js +6 -3
  152. package/lib/es/pagination/index.js +4 -2
  153. package/lib/es/popconfirm/index.js +6 -3
  154. package/lib/es/radio/radio.d.ts +4 -0
  155. package/lib/es/radio/radio.js +32 -9
  156. package/lib/es/radio/radioInner.d.ts +6 -0
  157. package/lib/es/radio/radioInner.js +13 -4
  158. package/lib/es/rating/item.js +2 -1
  159. package/lib/es/scrollList/index.js +6 -3
  160. package/lib/es/select/index.js +10 -4
  161. package/lib/es/select/option.js +2 -1
  162. package/lib/es/sideSheet/SideSheetContent.js +6 -3
  163. package/lib/es/skeleton/index.js +3 -1
  164. package/lib/es/space/index.js +2 -1
  165. package/lib/es/spin/index.js +7 -3
  166. package/lib/es/switch/index.js +6 -4
  167. package/lib/es/table/ColumnFilter.js +1 -1
  168. package/lib/es/table/ColumnSelection.js +1 -1
  169. package/lib/es/table/Table.js +6 -3
  170. package/lib/es/tabs/TabBar.js +2 -1
  171. package/lib/es/tabs/TabPane.js +5 -2
  172. package/lib/es/tagInput/index.js +31 -22
  173. package/lib/es/timePicker/Combobox.js +3 -1
  174. package/lib/es/timePicker/TimePicker.js +2 -0
  175. package/lib/es/toast/toast.js +6 -3
  176. package/lib/es/tooltip/index.js +6 -1
  177. package/lib/es/transfer/index.js +3 -2
  178. package/lib/es/tree/treeNode.js +3 -2
  179. package/lib/es/treeSelect/index.js +10 -3
  180. package/lib/es/typography/base.js +2 -1
  181. package/lib/es/typography/title.d.ts +1 -1
  182. package/lib/es/upload/index.d.ts +1 -1
  183. package/lib/es/upload/index.js +13 -6
  184. package/list/index.tsx +16 -4
  185. package/modal/ConfirmModal.tsx +1 -1
  186. package/modal/Modal.tsx +2 -0
  187. package/modal/ModalContent.tsx +27 -14
  188. package/notification/notice.tsx +16 -4
  189. package/package.json +8 -8
  190. package/pagination/index.tsx +16 -2
  191. package/popconfirm/index.tsx +11 -3
  192. package/radio/_story/radio.stories.js +9 -6
  193. package/radio/radio.tsx +37 -7
  194. package/radio/radioInner.tsx +11 -2
  195. package/rating/item.tsx +1 -1
  196. package/scrollList/index.tsx +19 -3
  197. package/select/index.tsx +13 -4
  198. package/select/option.tsx +5 -1
  199. package/sideSheet/SideSheetContent.tsx +3 -3
  200. package/skeleton/index.tsx +1 -1
  201. package/space/index.tsx +1 -1
  202. package/spin/index.tsx +15 -9
  203. package/switch/index.tsx +9 -14
  204. package/table/ColumnFilter.tsx +1 -1
  205. package/table/ColumnSelection.tsx +1 -1
  206. package/table/Table.tsx +5 -3
  207. package/table/_story/v2/FixedOnHeaderRow/index.jsx +3 -0
  208. package/tabs/TabBar.tsx +1 -1
  209. package/tabs/TabPane.tsx +9 -4
  210. package/tabs/_story/tabs.stories.js +36 -0
  211. package/tag/_story/tag.stories.js +1 -1
  212. package/tagInput/index.tsx +32 -15
  213. package/timePicker/Combobox.tsx +6 -1
  214. package/timePicker/TimePicker.tsx +1 -0
  215. package/toast/toast.tsx +3 -3
  216. package/tooltip/index.tsx +4 -1
  217. package/transfer/index.tsx +2 -1
  218. package/tree/treeNode.tsx +2 -2
  219. package/treeSelect/_story/treeSelect.stories.js +161 -2
  220. package/treeSelect/index.tsx +17 -3
  221. package/typography/base.tsx +1 -1
  222. package/upload/_story/upload.stories.js +152 -0
  223. package/upload/index.tsx +107 -38
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
  );
@@ -49,14 +49,30 @@ class ScrollList extends BaseComponent<ScrollListProps, {}> {
49
49
  <div className={clsWrapper} style={style}>
50
50
  {header ? (
51
51
  <div className={clsHeader}>
52
- <div className={`${clsHeader}-title`}>{header}</div>
52
+ <div
53
+ className={`${clsHeader}-title`}
54
+ x-semi-prop={this.props['x-semi-header-alias'] || "header"}
55
+ >
56
+ {header}
57
+ </div>
53
58
  <div className={`${clsWrapper}-line`} />
54
59
  </div>
55
60
  ) : null}
56
- <div className={`${clsWrapper}-body`} style={{ height: bodyHeight ? bodyHeight : '' }}>
61
+ <div
62
+ className={`${clsWrapper}-body`}
63
+ style={{ height: bodyHeight ? bodyHeight : '' }}
64
+ x-semi-prop="children"
65
+ >
57
66
  {children}
58
67
  </div>
59
- {footer ? <div className={`${clsWrapper}-footer`}>{footer}</div> : null}
68
+ {footer ? (
69
+ <div
70
+ className={`${clsWrapper}-footer`}
71
+ x-semi-prop={this.props['x-semi-footer-alias'] || "footer"}
72
+ >
73
+ {footer}
74
+ </div>
75
+ ) : null}
60
76
  </div>
61
77
  );
62
78
  }
package/select/index.tsx CHANGED
@@ -662,6 +662,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
662
662
  this.foundation.handleClearClick(e as any);
663
663
  }
664
664
 
665
+ /* istanbul ignore next */
665
666
  onClearBtnEnterPress(e: React.KeyboardEvent) {
666
667
  this.foundation.handleClearBtnEnterPress(e as any);
667
668
  }
@@ -878,7 +879,11 @@ class Select extends BaseComponent<SelectProps, SelectState> {
878
879
  return (
879
880
  <>
880
881
  <div className={contentWrapperCls}>
881
- {<span className={spanCls}>{renderText || renderText === 0 ? renderText : placeholder}</span>}
882
+ {
883
+ <span className={spanCls} x-semi-prop="placeholder">
884
+ {renderText || renderText === 0 ? renderText : placeholder}
885
+ </span>
886
+ }
882
887
  {filterable && showInput ? this.renderInput() : null}
883
888
  </div>
884
889
  </>
@@ -1006,7 +1011,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
1006
1011
  [`${prefixcls}-suffix-text`]: suffix && isString(suffix),
1007
1012
  [`${prefixcls}-suffix-icon`]: isSemiIcon(suffix),
1008
1013
  });
1009
- return <div className={suffixWrapperCls}>{suffix}</div>;
1014
+ return <div className={suffixWrapperCls} x-semi-prop="suffix">{suffix}</div>;
1010
1015
  }
1011
1016
 
1012
1017
  renderPrefix() {
@@ -1020,7 +1025,11 @@ class Select extends BaseComponent<SelectProps, SelectState> {
1020
1025
  [`${prefixcls}-prefix-icon`]: isSemiIcon(labelNode),
1021
1026
  });
1022
1027
 
1023
- return <div className={prefixWrapperCls} id={insetLabelId}>{labelNode}</div>;
1028
+ return (
1029
+ <div className={prefixWrapperCls} id={insetLabelId} x-semi-prop="prefix,insetLabel">
1030
+ {labelNode}
1031
+ </div>
1032
+ );
1024
1033
  }
1025
1034
 
1026
1035
  renderSelection() {
@@ -1067,7 +1076,7 @@ class Select extends BaseComponent<SelectProps, SelectState> {
1067
1076
  (selections.size || inputValue) && !disabled && (isHovering || isOpen);
1068
1077
 
1069
1078
  const arrowContent = showArrow ? (
1070
- <div className={`${prefixcls}-arrow`}>
1079
+ <div className={`${prefixcls}-arrow`} x-semi-prop="arrowIcon">
1071
1080
  {arrowIcon}
1072
1081
  </div>
1073
1082
  ) : (
package/select/option.tsx CHANGED
@@ -105,7 +105,11 @@ class Option extends PureComponent<OptionProps> {
105
105
  }
106
106
  return (
107
107
  <LocaleConsumer<Locale['Select']> componentName="Select">
108
- {(locale: Locale['Select']) => <div className={optionClassName}>{emptyContent || locale.emptyText}</div>}
108
+ {(locale: Locale['Select']) => (
109
+ <div className={optionClassName} x-semi-prop="emptyContent">
110
+ {emptyContent || locale.emptyText}
111
+ </div>
112
+ )}
109
113
  </LocaleConsumer>
110
114
  );
111
115
  }
@@ -88,7 +88,7 @@ export default class SideSheetContent extends React.PureComponent<SideSheetConte
88
88
  let header, closer;
89
89
  if (title) {
90
90
  header = (
91
- <div className={`${prefixCls}-title`}>
91
+ <div className={`${prefixCls}-title`} x-semi-prop="title">
92
92
  {this.props.title}
93
93
  </div>
94
94
  );
@@ -140,11 +140,11 @@ export default class SideSheetContent extends React.PureComponent<SideSheetConte
140
140
  >
141
141
  <div className={`${prefixCls}-content`}>
142
142
  {header}
143
- <div className={`${prefixCls}-body`} style={props.bodyStyle}>
143
+ <div className={`${prefixCls}-body`} style={props.bodyStyle} x-semi-prop="children">
144
144
  {props.children}
145
145
  </div>
146
146
  {props.footer ? (
147
- <div className={`${prefixCls}-footer`}>
147
+ <div className={`${prefixCls}-footer`} x-semi-prop="footer">
148
148
  {props.footer}
149
149
  </div>
150
150
  ) : null}
@@ -48,7 +48,7 @@ class Skeleton extends PureComponent<SkeletonProps> {
48
48
  let content;
49
49
  if (loading) {
50
50
  content = (
51
- <div className={skCls} style={style} {...others}>
51
+ <div className={skCls} style={style} {...others} x-semi-prop="placeholder">
52
52
  {placeholder}
53
53
  </div>
54
54
  );
package/space/index.tsx CHANGED
@@ -85,7 +85,7 @@ class Space extends PureComponent<SpaceProps> {
85
85
  });
86
86
  const childrenNodes = flatten(children);
87
87
  return (
88
- <div className={classNames} style={realStyle}>
88
+ <div className={classNames} style={realStyle} x-semi-prop="children">
89
89
  {childrenNodes}
90
90
  </div>
91
91
  );
package/spin/index.tsx CHANGED
@@ -95,14 +95,18 @@ class Spin extends BaseComponent<SpinProps, SpinState> {
95
95
  [`${prefixCls}-animate`]: loading,
96
96
  });
97
97
 
98
- return (
99
- loading ? (
100
- <div className={`${prefixCls}-wrapper`}>
101
- {indicator ? <div className={spinIconCls}>{indicator}</div> : <SpinIcon />}
102
- {tip ? <div>{tip}</div> : null}
103
- </div>
104
- ) : null
105
- );
98
+ return loading ? (
99
+ <div className={`${prefixCls}-wrapper`}>
100
+ {indicator ? (
101
+ <div className={spinIconCls} x-semi-prop="indicator">
102
+ {indicator}
103
+ </div>
104
+ ) : (
105
+ <SpinIcon />
106
+ )}
107
+ {tip ? <div x-semi-prop="tip">{tip}</div> : null}
108
+ </div>
109
+ ) : null;
106
110
  }
107
111
 
108
112
  render() {
@@ -122,7 +126,9 @@ class Spin extends BaseComponent<SpinProps, SpinState> {
122
126
  return (
123
127
  <div className={spinCls} style={style}>
124
128
  {this.renderSpin()}
125
- <div className={`${prefixCls}-children`} style={childStyle}>{children}</div>
129
+ <div className={`${prefixCls}-children`} style={childStyle} x-semi-prop="children">
130
+ {children}
131
+ </div>
126
132
  </div>
127
133
  );
128
134
  }
package/switch/index.tsx CHANGED
@@ -146,23 +146,18 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
146
146
  const showUncheckedText = uncheckedText && !nativeControlChecked && size !== 'small';
147
147
  return (
148
148
  <div className={wrapperCls} style={style} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
149
- {
150
- loading
151
- ? (
152
- <Spin
153
- wrapperClassName={cssClasses.LOADING_SPIN}
154
- size={size === 'default' ? 'middle' : size}
155
- />
156
- )
157
- : <div className={cssClasses.KNOB} aria-hidden={true} />
158
- }
149
+ {loading ? (
150
+ <Spin wrapperClassName={cssClasses.LOADING_SPIN} size={size === 'default' ? 'middle' : size} />
151
+ ) : (
152
+ <div className={cssClasses.KNOB} aria-hidden={true} />
153
+ )}
159
154
  {showCheckedText ? (
160
- <div className={cssClasses.CHECKED_TEXT}>
155
+ <div className={cssClasses.CHECKED_TEXT} x-semi-prop="checkedText">
161
156
  {checkedText}
162
157
  </div>
163
158
  ) : null}
164
159
  {showUncheckedText ? (
165
- <div className={cssClasses.UNCHECKED_TEXT}>
160
+ <div className={cssClasses.UNCHECKED_TEXT} x-semi-prop="uncheckedText">
166
161
  {uncheckedText}
167
162
  </div>
168
163
  ) : null}
@@ -170,13 +165,13 @@ class Switch extends BaseComponent<SwitchProps, SwitchState> {
170
165
  {...switchProps}
171
166
  ref={this.switchRef}
172
167
  id={id}
173
- role='switch'
168
+ role="switch"
174
169
  aria-checked={nativeControlChecked}
175
170
  aria-invalid={this.props['aria-invalid']}
176
171
  aria-errormessage={this.props['aria-errormessage']}
177
172
  aria-label={this.props['aria-label']}
178
173
  aria-labelledby={this.props['aria-labelledby']}
179
- aria-describedby={this.props["aria-describedby"]}
174
+ aria-describedby={this.props['aria-describedby']}
180
175
  aria-disabled={this.props['disabled']}
181
176
  onChange={e => this.foundation.handleChange(e.target.checked, e)}
182
177
  onFocus={e => this.handleFocusVisible(e)}
@@ -10,7 +10,7 @@ import { cssClasses } from '@douyinfe/semi-foundation/table/constants';
10
10
  import Dropdown, { DropdownProps } from '../dropdown';
11
11
  import { Trigger, Position } from '../tooltip';
12
12
  import { Radio } from '../radio';
13
- import Checkbox from '../checkbox';
13
+ import { Checkbox } from '../checkbox';
14
14
  import {
15
15
  FilterIcon,
16
16
  Filter,
@@ -8,7 +8,7 @@ import { noop } from 'lodash';
8
8
  import { cssClasses } from '@douyinfe/semi-foundation/table/constants';
9
9
  import TableSelectionCellFoundation, { TableSelectionCellAdapter, TableSelectionCellEvent } from '@douyinfe/semi-foundation/table/tableSelectionCellFoundation';
10
10
 
11
- import Checkbox, { CheckboxEvent, CheckboxProps } from '../checkbox';
11
+ import { Checkbox, CheckboxEvent, CheckboxProps } from '../checkbox';
12
12
 
13
13
  export interface TableSelectionCellProps {
14
14
  columnTitle?: string; // TODO: future api
package/table/Table.tsx CHANGED
@@ -1015,7 +1015,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
1015
1015
  }
1016
1016
 
1017
1017
  return isValidElement(title) || typeof title === 'string' ? (
1018
- <div className={`${prefixCls}-title`}>{title}</div>
1018
+ <div className={`${prefixCls}-title`} x-semi-prop="title">{title}</div>
1019
1019
  ) : null;
1020
1020
  };
1021
1021
 
@@ -1032,7 +1032,9 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
1032
1032
  <LocaleConsumer componentName="Table" key={'emptyText'}>
1033
1033
  {(locale: TableLocale, localeCode: string) => (
1034
1034
  <div className={wrapCls}>
1035
- <div className={`${prefixCls}-empty`}>{empty || locale.emptyText}</div>
1035
+ <div className={`${prefixCls}-empty`} x-semi-prop="empty">
1036
+ {empty || locale.emptyText}
1037
+ </div>
1036
1038
  </div>
1037
1039
  )}
1038
1040
  </LocaleConsumer>
@@ -1048,7 +1050,7 @@ class Table<RecordType extends Record<string, any>> extends BaseComponent<Normal
1048
1050
  }
1049
1051
 
1050
1052
  return isValidElement(footer) || typeof footer === 'string' ? (
1051
- <div className={`${prefixCls}-footer`} key="footer">
1053
+ <div className={`${prefixCls}-footer`} key="footer" x-semi-prop="footer">
1052
1054
  {footer}
1053
1055
  </div>
1054
1056
  ) : null;
@@ -3,6 +3,9 @@ import { Table, Avatar, Toast } from '@douyinfe/semi-ui';
3
3
  import * as dateFns from 'date-fns';
4
4
 
5
5
  App.storyName = 'fix onHeaderRow';
6
+ App.parameters = {
7
+ chromatic: { disableSnapshot: true },
8
+ };
6
9
 
7
10
  /**
8
11
  * test with cypress
package/tabs/TabBar.tsx CHANGED
@@ -70,7 +70,7 @@ class TabBar extends React.Component<TabBarProps, TabBarState> {
70
70
  if (tabBarExtraContent) {
71
71
  const tabBarStyle = { ...tabBarExtraContentDefaultStyle, ...tabBarExtraContentStyle };
72
72
  return (
73
- <div className={extraCls} style={tabBarStyle}>
73
+ <div className={extraCls} style={tabBarStyle} x-semi-prop="tabBarExtraContent">
74
74
  {tabBarExtraContent}
75
75
  </div>
76
76
  );
package/tabs/TabPane.tsx CHANGED
@@ -98,6 +98,7 @@ class TabPane extends PureComponent<TabPaneProps> {
98
98
  aria-hidden={active ? 'false' : 'true'}
99
99
  tabIndex={0}
100
100
  {...getDataAttr(restProps)}
101
+ x-semi-prop="children"
101
102
  >
102
103
  {motion ? (
103
104
  <TabPaneTransition
@@ -107,14 +108,18 @@ class TabPane extends PureComponent<TabPaneProps> {
107
108
  state={active ? 'enter' : 'leave'}
108
109
  >
109
110
  {(transitionStyle): ReactNode => (
110
- <div className={`${cssClasses.TABS_PANE_MOTION_OVERLAY}`} style={{ ...transitionStyle }}>
111
+ <div
112
+ className={`${cssClasses.TABS_PANE_MOTION_OVERLAY}`}
113
+ style={{ ...transitionStyle }}
114
+ x-semi-prop="children"
115
+ >
111
116
  {shouldRender ? children : null}
112
117
  </div>
113
118
  )}
114
119
  </TabPaneTransition>
115
- ) : (
116
- shouldRender ? children : null
117
- )}
120
+ ) : shouldRender ? (
121
+ children
122
+ ) : null}
118
123
  </div>
119
124
  );
120
125
  }
@@ -867,3 +867,39 @@ export const TabListChange = () => <TabListChangeDemo />;
867
867
  TabListChange.story = {
868
868
  name: 'tablist change',
869
869
  };
870
+
871
+
872
+ class TabClosableDemo extends React.Component {
873
+ constructor(props){
874
+ super(props);
875
+ this.state = {
876
+ tabList: [
877
+ {tab: '文档', itemKey:'1', text:'文档', closable:true},
878
+ {tab: '快速起步', itemKey:'2', text:'快速起步', closable:true},
879
+ {tab: '帮助', itemKey:'3', text:'帮助'},
880
+ ]
881
+ }
882
+ }
883
+ close(key){
884
+ const newTabList = [...this.state.tabList];
885
+ const closeIndex = newTabList.findIndex(t=>t.itemKey===key);
886
+ newTabList.splice(closeIndex, 1);
887
+ this.setState({tabList:newTabList});
888
+ }
889
+
890
+ render() {
891
+ return (
892
+ <Tabs type="card" defaultActiveKey="1" onTabClose={this.close.bind(this)}>
893
+ {
894
+ this.state.tabList.map(t=><TabPane closable={t.closable} tab={t.tab} itemKey={t.itemKey} key={t.itemKey}>{t.text}</TabPane>)
895
+ }
896
+ </Tabs>
897
+ );
898
+ }
899
+ }
900
+
901
+ export const TabClosable = () => <TabClosableDemo />;
902
+
903
+ TabClosable.story = {
904
+ name: 'tab closable',
905
+ };
@@ -155,7 +155,7 @@ export const TagAvatar = () => {
155
155
  'https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/avatarDemo.jpeg';
156
156
  return (
157
157
  <div style={{ margin: 10 }}>
158
- <Tag avatarSrc={avatarSrc} avatarShape={'square'}>
158
+ <Tag avatarSrc={avatarSrc} avatarShape={'square'} onClick={()=>{console.log('如果能重来,我要做李白')}}>
159
159
  李白
160
160
  </Tag>
161
161
  <br />