@douyinfe/semi-ui 2.4.1 → 2.6.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 (138) hide show
  1. package/calendar/monthCalendar.tsx +14 -13
  2. package/cascader/__test__/cascader.test.js +24 -0
  3. package/cascader/_story/cascader.stories.js +73 -0
  4. package/cascader/index.tsx +26 -5
  5. package/cascader/item.tsx +25 -5
  6. package/datePicker/_story/v2/FixInputRangeFocus.jsx +25 -0
  7. package/datePicker/_story/v2/index.js +2 -1
  8. package/datePicker/dateInput.tsx +8 -5
  9. package/datePicker/datePicker.tsx +9 -1
  10. package/datePicker/month.tsx +14 -7
  11. package/datePicker/monthsGrid.tsx +17 -5
  12. package/datePicker/navigation.tsx +8 -4
  13. package/datePicker/quickControl.tsx +1 -0
  14. package/datePicker/yearAndMonth.tsx +1 -1
  15. package/dist/css/semi.css +71 -35
  16. package/dist/css/semi.min.css +1 -1
  17. package/dist/umd/semi-ui.js +696 -263
  18. package/dist/umd/semi-ui.js.map +1 -1
  19. package/dist/umd/semi-ui.min.js +1 -1
  20. package/dist/umd/semi-ui.min.js.map +1 -1
  21. package/form/__test__/formApi.test.js +182 -0
  22. package/form/_story/FormApi/arrayDemo.jsx +4 -7
  23. package/form/_story/Layout/slotDemo.jsx +2 -2
  24. package/form/_story/demo.jsx +18 -1
  25. package/form/_story/form.stories.js +6 -6
  26. package/form/baseForm.tsx +2 -2
  27. package/form/hoc/withField.tsx +1 -1
  28. package/lib/cjs/_base/base.css +5 -5
  29. package/lib/cjs/autoComplete/index.d.ts +1 -1
  30. package/lib/cjs/calendar/monthCalendar.js +21 -5
  31. package/lib/cjs/cascader/index.d.ts +9 -2
  32. package/lib/cjs/cascader/index.js +20 -1
  33. package/lib/cjs/cascader/item.d.ts +6 -2
  34. package/lib/cjs/cascader/item.js +33 -4
  35. package/lib/cjs/datePicker/dateInput.d.ts +0 -2
  36. package/lib/cjs/datePicker/dateInput.js +17 -6
  37. package/lib/cjs/datePicker/datePicker.js +19 -12
  38. package/lib/cjs/datePicker/month.d.ts +1 -0
  39. package/lib/cjs/datePicker/month.js +18 -2
  40. package/lib/cjs/datePicker/monthsGrid.js +16 -4
  41. package/lib/cjs/datePicker/navigation.js +8 -0
  42. package/lib/cjs/datePicker/quickControl.js +1 -0
  43. package/lib/cjs/datePicker/yearAndMonth.js +1 -0
  44. package/lib/cjs/dropdown/index.d.ts +1 -1
  45. package/lib/cjs/form/baseForm.d.ts +1 -1
  46. package/lib/cjs/form/baseForm.js +2 -2
  47. package/lib/cjs/form/field.d.ts +1 -1
  48. package/lib/cjs/form/hoc/withField.js +1 -1
  49. package/lib/cjs/scrollList/scrollItem.d.ts +2 -1
  50. package/lib/cjs/scrollList/scrollItem.js +13 -3
  51. package/lib/cjs/select/index.d.ts +3 -3
  52. package/lib/cjs/select/index.js +32 -28
  53. package/lib/cjs/select/option.js +2 -2
  54. package/lib/cjs/select/virtualRow.js +2 -2
  55. package/lib/cjs/table/Table.d.ts +1 -1
  56. package/lib/cjs/table/Table.js +8 -2
  57. package/lib/cjs/table/interface.d.ts +1 -0
  58. package/lib/cjs/tabs/interface.d.ts +1 -1
  59. package/lib/cjs/tooltip/index.d.ts +1 -1
  60. package/lib/cjs/tooltip/index.js +6 -2
  61. package/lib/cjs/tree/index.d.ts +2 -0
  62. package/lib/cjs/tree/index.js +15 -8
  63. package/lib/cjs/treeSelect/index.d.ts +2 -0
  64. package/lib/cjs/treeSelect/index.js +64 -27
  65. package/lib/cjs/upload/fileCard.js +31 -22
  66. package/lib/cjs/upload/index.d.ts +6 -0
  67. package/lib/cjs/upload/index.js +15 -8
  68. package/lib/cjs/upload/interface.d.ts +8 -6
  69. package/lib/es/_base/base.css +5 -5
  70. package/lib/es/autoComplete/index.d.ts +1 -1
  71. package/lib/es/calendar/monthCalendar.js +22 -5
  72. package/lib/es/cascader/index.d.ts +9 -2
  73. package/lib/es/cascader/index.js +19 -1
  74. package/lib/es/cascader/item.d.ts +6 -2
  75. package/lib/es/cascader/item.js +31 -4
  76. package/lib/es/datePicker/dateInput.d.ts +0 -2
  77. package/lib/es/datePicker/dateInput.js +17 -6
  78. package/lib/es/datePicker/datePicker.js +19 -12
  79. package/lib/es/datePicker/month.d.ts +1 -0
  80. package/lib/es/datePicker/month.js +18 -2
  81. package/lib/es/datePicker/monthsGrid.js +16 -4
  82. package/lib/es/datePicker/navigation.js +8 -0
  83. package/lib/es/datePicker/quickControl.js +2 -0
  84. package/lib/es/datePicker/yearAndMonth.js +1 -0
  85. package/lib/es/dropdown/index.d.ts +1 -1
  86. package/lib/es/form/baseForm.d.ts +1 -1
  87. package/lib/es/form/baseForm.js +2 -2
  88. package/lib/es/form/field.d.ts +1 -1
  89. package/lib/es/form/hoc/withField.js +1 -1
  90. package/lib/es/scrollList/scrollItem.d.ts +2 -1
  91. package/lib/es/scrollList/scrollItem.js +13 -3
  92. package/lib/es/select/index.d.ts +3 -3
  93. package/lib/es/select/index.js +30 -26
  94. package/lib/es/select/option.js +2 -2
  95. package/lib/es/select/virtualRow.js +2 -2
  96. package/lib/es/table/Table.d.ts +1 -1
  97. package/lib/es/table/Table.js +10 -2
  98. package/lib/es/table/interface.d.ts +1 -0
  99. package/lib/es/tabs/interface.d.ts +1 -1
  100. package/lib/es/tooltip/index.d.ts +1 -1
  101. package/lib/es/tooltip/index.js +6 -2
  102. package/lib/es/tree/index.d.ts +2 -0
  103. package/lib/es/tree/index.js +15 -8
  104. package/lib/es/treeSelect/index.d.ts +2 -0
  105. package/lib/es/treeSelect/index.js +64 -27
  106. package/lib/es/upload/fileCard.js +31 -24
  107. package/lib/es/upload/index.d.ts +6 -0
  108. package/lib/es/upload/index.js +14 -8
  109. package/lib/es/upload/interface.d.ts +8 -6
  110. package/package.json +9 -9
  111. package/scrollList/_story/ScrollList/index.js +3 -0
  112. package/scrollList/_story/WheelList/index.js +3 -0
  113. package/scrollList/scrollItem.tsx +30 -9
  114. package/select/index.tsx +18 -19
  115. package/select/option.tsx +2 -2
  116. package/select/virtualRow.tsx +2 -2
  117. package/table/Table.tsx +7 -2
  118. package/table/_story/Perf/Virtualized/index.jsx +6 -0
  119. package/table/_story/table.stories.js +1 -2
  120. package/table/_story/v2/FixedHeaderMerge/index.jsx +98 -0
  121. package/table/_story/v2/FixedResizable/index.jsx +114 -0
  122. package/table/_story/v2/defaultFilteredValue.tsx +114 -0
  123. package/table/_story/v2/index.js +5 -0
  124. package/table/interface.ts +1 -0
  125. package/tabs/interface.ts +1 -1
  126. package/tooltip/__test__/tooltip.test.js +48 -4
  127. package/tooltip/_story/tooltip.stories.js +83 -1
  128. package/tooltip/index.tsx +4 -4
  129. package/tree/__test__/treeMultiple.test.js +94 -0
  130. package/tree/_story/tree.stories.js +169 -0
  131. package/tree/index.tsx +12 -5
  132. package/treeSelect/__test__/treeMultiple.test.js +94 -0
  133. package/treeSelect/_story/treeSelect.stories.js +242 -0
  134. package/treeSelect/index.tsx +72 -40
  135. package/upload/_story/upload.stories.js +22 -6
  136. package/upload/fileCard.tsx +23 -23
  137. package/upload/index.tsx +15 -6
  138. package/upload/interface.ts +7 -5
@@ -25,7 +25,6 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
25
25
  value: PropTypes.Requireable<any[]>;
26
26
  disabled: PropTypes.Requireable<boolean>;
27
27
  type: PropTypes.Requireable<"dateTime" | "date" | "month" | "dateRange" | "year" | "dateTimeRange">;
28
- multiple: PropTypes.Requireable<boolean>;
29
28
  showClear: PropTypes.Requireable<boolean>;
30
29
  format: PropTypes.Requireable<string>;
31
30
  inputStyle: PropTypes.Requireable<object>;
@@ -49,7 +48,6 @@ export default class DateInput extends BaseComponent<DateInputProps, {}> {
49
48
  onBlur: typeof noop;
50
49
  onClear: typeof noop;
51
50
  onFocus: typeof noop;
52
- multiple: boolean;
53
51
  type: string;
54
52
  inputStyle: {};
55
53
  inputReadOnly: boolean;
@@ -15,6 +15,8 @@ var __rest = this && this.__rest || function (s, e) {
15
15
  }
16
16
  return t;
17
17
  };
18
+ /* eslint-disable jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions,jsx-a11y/interactive-supports-focus */
19
+
18
20
  /* eslint-disable max-lines-per-function */
19
21
 
20
22
  /* eslint-disable no-unused-vars */
@@ -170,9 +172,14 @@ export default class DateInput extends BaseComponent {
170
172
  } = this.props;
171
173
  const allowClear = (rangeStart || rangeEnd) && showClear;
172
174
  return allowClear && !disabled ? /*#__PURE__*/React.createElement("div", {
175
+ role: "button",
176
+ tabIndex: 0,
177
+ "aria-label": "Clear range input value",
173
178
  className: "".concat(prefixCls, "-range-input-clearbtn"),
174
179
  onMouseDown: e => !disabled && this.handleRangeInputClear(e)
175
- }, /*#__PURE__*/React.createElement(IconClear, null)) : null;
180
+ }, /*#__PURE__*/React.createElement(IconClear, {
181
+ "aria-hidden": true
182
+ })) : null;
176
183
  }
177
184
 
178
185
  renderRangeSuffix(suffix) {
@@ -273,6 +280,8 @@ export default class DateInput extends BaseComponent {
273
280
  validateStatus,
274
281
  block,
275
282
  prefixCls,
283
+ multiple,
284
+ // Whether to allow multiple values for email and file types
276
285
  dateFnsLocale,
277
286
  // No need to pass to input
278
287
  onBlur,
@@ -290,10 +299,14 @@ export default class DateInput extends BaseComponent {
290
299
  rangeInputFocus,
291
300
  rangeSeparator
292
301
  } = _a,
293
- rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator"]);
302
+ rest = __rest(_a, ["placeholder", "type", "value", "inputValue", "inputStyle", "disabled", "showClear", "inputReadOnly", "insetLabel", "validateStatus", "block", "prefixCls", "multiple", "dateFnsLocale", "onBlur", "onClear", "onFocus", "prefix", "autofocus", "size", "rangeInputStartRef", "rangeInputEndRef", "onRangeClear", "onRangeBlur", "onRangeEndTabPress", "rangeInputFocus", "rangeSeparator"]);
294
303
 
295
- const dateIcon = /*#__PURE__*/React.createElement(IconCalendar, null);
296
- const dateTimeIcon = /*#__PURE__*/React.createElement(IconCalendarClock, null);
304
+ const dateIcon = /*#__PURE__*/React.createElement(IconCalendar, {
305
+ "aria-hidden": true
306
+ });
307
+ const dateTimeIcon = /*#__PURE__*/React.createElement(IconCalendarClock, {
308
+ "aria-hidden": true
309
+ });
297
310
  const suffix = _includesInstanceProperty(type).call(type, 'Time') ? dateTimeIcon : dateIcon;
298
311
  let text = '';
299
312
 
@@ -348,7 +361,6 @@ DateInput.propTypes = {
348
361
  value: PropTypes.array,
349
362
  disabled: PropTypes.bool,
350
363
  type: PropTypes.oneOf(strings.TYPE_SET),
351
- multiple: PropTypes.bool,
352
364
  showClear: PropTypes.bool,
353
365
  format: PropTypes.string,
354
366
  inputStyle: PropTypes.object,
@@ -372,7 +384,6 @@ DateInput.defaultProps = {
372
384
  onBlur: noop,
373
385
  onClear: noop,
374
386
  onFocus: noop,
375
- multiple: false,
376
387
  type: 'date',
377
388
  inputStyle: {},
378
389
  inputReadOnly: false,
@@ -9,6 +9,8 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/ins
9
9
  import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
10
10
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
11
11
 
12
+ /* eslint-disable jsx-a11y/click-events-have-key-events,jsx-a11y/interactive-supports-focus */
13
+
12
14
  /* eslint-disable max-len */
13
15
  import React from 'react';
14
16
  import classnames from 'classnames';
@@ -401,6 +403,10 @@ export default class DatePicker extends BaseComponent {
401
403
 
402
404
  if (prevProps.open !== this.props.open) {
403
405
  this.foundation.initPanelOpenStatus();
406
+
407
+ if (!this.props.open) {
408
+ this.foundation.clearRangeInputFocus();
409
+ }
404
410
  }
405
411
  }
406
412
 
@@ -572,18 +578,19 @@ export default class DatePicker extends BaseComponent {
572
578
  onRangeEndTabPress: this.handleRangeEndTabPress
573
579
  });
574
580
 
575
- return (
576
- /*#__PURE__*/
577
- // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
578
- React.createElement("div", {
579
- onClick: this.handleTriggerWrapperClick,
580
- className: inputCls
581
- }, typeof triggerRender === 'function' ? /*#__PURE__*/React.createElement(Trigger, _Object$assign({}, props, {
582
- triggerRender: triggerRender,
583
- componentName: "DatePicker",
584
- componentProps: _Object$assign({}, this.props)
585
- })) : /*#__PURE__*/React.createElement(DateInput, _Object$assign({}, props)))
586
- );
581
+ return /*#__PURE__*/React.createElement("div", {
582
+ // tooltip will mount a11y props to children
583
+ // eslint-disable-next-line jsx-a11y/role-has-required-aria-props
584
+ role: "combobox",
585
+ "aria-label": _Array$isArray(value) && value.length ? "Change date" : "Choose date",
586
+ "aria-disabled": disabled,
587
+ onClick: this.handleTriggerWrapperClick,
588
+ className: inputCls
589
+ }, typeof triggerRender === 'function' ? /*#__PURE__*/React.createElement(Trigger, _Object$assign({}, props, {
590
+ triggerRender: triggerRender,
591
+ componentName: "DatePicker",
592
+ componentProps: _Object$assign({}, this.props)
593
+ })) : /*#__PURE__*/React.createElement(DateInput, _Object$assign({}, props)));
587
594
  }
588
595
 
589
596
  render() {
@@ -33,6 +33,7 @@ export default class Month extends BaseComponent<MonthProps, MonthState> {
33
33
  endDateOffset: PropTypes.Requireable<(...args: any[]) => any>;
34
34
  rangeInputFocus: PropTypes.Requireable<string | boolean>;
35
35
  focusRecordsRef: PropTypes.Requireable<object>;
36
+ multiple: PropTypes.Requireable<boolean>;
36
37
  };
37
38
  static defaultProps: {
38
39
  month: Date;
@@ -6,6 +6,8 @@ import _trimInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
6
6
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
7
7
  import _Set from "@babel/runtime-corejs3/core-js-stable/set";
8
8
 
9
+ /* eslint-disable jsx-a11y/click-events-have-key-events,jsx-a11y/no-noninteractive-element-interactions */
10
+
9
11
  /* eslint-disable max-len */
10
12
  import React from 'react';
11
13
  import classNames from 'classnames';
@@ -328,8 +330,10 @@ export default class Month extends BaseComponent {
328
330
  const weekdaysText = _mapInstanceProperty(weekdays).call(weekdays, key => locale.weeks[key]);
329
331
 
330
332
  return /*#__PURE__*/React.createElement("div", {
333
+ role: "row",
331
334
  className: weekdayCls
332
335
  }, _mapInstanceProperty(weekdaysText).call(weekdaysText, (E, i) => /*#__PURE__*/React.createElement("div", {
336
+ role: "columnheader",
333
337
  key: E + i,
334
338
  className: weekdayItemCls
335
339
  }, E)));
@@ -364,6 +368,7 @@ export default class Month extends BaseComponent {
364
368
  renderWeek(week, weekIndex) {
365
369
  const weekCls = cssClasses.WEEK;
366
370
  return /*#__PURE__*/React.createElement("div", {
371
+ role: "row",
367
372
  className: weekCls,
368
373
  key: weekIndex
369
374
  }, _mapInstanceProperty(week).call(week, (day, dayIndex) => this.renderDay(day, dayIndex)));
@@ -384,6 +389,8 @@ export default class Month extends BaseComponent {
384
389
 
385
390
  if (!fullDate) {
386
391
  return /*#__PURE__*/React.createElement("div", {
392
+ role: "gridcell",
393
+ tabIndex: -1,
387
394
  key: dayNumber + dayIndex,
388
395
  className: cssClasses.DAY
389
396
  }, /*#__PURE__*/React.createElement("span", null));
@@ -421,6 +428,11 @@ export default class Month extends BaseComponent {
421
428
  const customRender = _isFunction(renderFullDate);
422
429
 
423
430
  return /*#__PURE__*/React.createElement("div", {
431
+ role: "gridcell",
432
+ tabIndex: dayStatus.isDisabled ? -1 : 0,
433
+ "aria-disabled": dayStatus.isDisabled,
434
+ "aria-selected": dayStatus.isSelected,
435
+ "aria-label": fullDate,
424
436
  className: !customRender ? dayCls : cssClasses.DAY,
425
437
  title: fullDate,
426
438
  key: dayNumber + dayIndex,
@@ -434,13 +446,16 @@ export default class Month extends BaseComponent {
434
446
 
435
447
  render() {
436
448
  const {
437
- forwardRef
449
+ forwardRef,
450
+ multiple
438
451
  } = this.props;
439
452
  const weekday = this.renderDayOfWeek();
440
453
  const weeks = this.renderWeeks();
441
454
  const monthCls = classNames(cssClasses.MONTH);
442
455
  const ref = forwardRef || this.monthRef;
443
456
  return /*#__PURE__*/React.createElement("div", {
457
+ role: "grid",
458
+ "aria-multiselectable": multiple,
444
459
  ref: ref,
445
460
  className: monthCls
446
461
  }, weekday, weeks);
@@ -466,7 +481,8 @@ Month.propTypes = {
466
481
  startDateOffset: PropTypes.func,
467
482
  endDateOffset: PropTypes.func,
468
483
  rangeInputFocus: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
469
- focusRecordsRef: PropTypes.object
484
+ focusRecordsRef: PropTypes.object,
485
+ multiple: PropTypes.bool
470
486
  };
471
487
  Month.defaultProps = {
472
488
  month: new Date(),
@@ -7,6 +7,8 @@ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign"
7
7
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
8
8
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
9
9
 
10
+ /* eslint-disable jsx-a11y/interactive-supports-focus,jsx-a11y/click-events-have-key-events */
11
+
10
12
  /* eslint-disable react/no-did-update-set-state */
11
13
 
12
14
  /* eslint-disable max-len */
@@ -362,7 +364,8 @@ export default class MonthsGrid extends BaseComponent {
362
364
  endDateOffset,
363
365
  density,
364
366
  rangeInputFocus,
365
- syncSwitchMonth
367
+ syncSwitchMonth,
368
+ multiple
366
369
  } = this.props;
367
370
  let monthText = ''; // i18n monthText
368
371
 
@@ -428,7 +431,8 @@ export default class MonthsGrid extends BaseComponent {
428
431
  onWeeksRowNumChange: weeksRowNum => this.handleWeeksRowNumChange(weeksRowNum, panelType),
429
432
  startDateOffset: startDateOffset,
430
433
  endDateOffset: endDateOffset,
431
- focusRecordsRef: this.props.focusRecordsRef
434
+ focusRecordsRef: this.props.focusRecordsRef,
435
+ multiple: multiple
432
436
  }));
433
437
  }
434
438
 
@@ -584,14 +588,22 @@ export default class MonthsGrid extends BaseComponent {
584
588
  className: switchCls,
585
589
  ref: current => this.adapter.setCache("switch-".concat(panelType), current)
586
590
  }, /*#__PURE__*/React.createElement("div", {
591
+ role: "button",
592
+ "aria-label": "Switch to date panel",
587
593
  className: dateCls,
588
594
  onClick: e => this.foundation.showDatePanel(panelType)
589
- }, showSwithIcon && /*#__PURE__*/React.createElement(IconCalendar, null), /*#__PURE__*/React.createElement("span", {
595
+ }, showSwithIcon && /*#__PURE__*/React.createElement(IconCalendar, {
596
+ "aria-hidden": true
597
+ }), /*#__PURE__*/React.createElement("span", {
590
598
  className: textCls
591
599
  }, dateText || monthText)), /*#__PURE__*/React.createElement("div", {
600
+ role: "button",
601
+ "aria-label": "Switch to time panel",
592
602
  className: timeCls,
593
603
  onClick: e => this.foundation.showTimePicker(panelType, true)
594
- }, showSwithIcon && /*#__PURE__*/React.createElement(IconClock, null), /*#__PURE__*/React.createElement("span", {
604
+ }, showSwithIcon && /*#__PURE__*/React.createElement(IconClock, {
605
+ "aria-hidden": true
606
+ }), /*#__PURE__*/React.createElement("span", {
595
607
  className: textCls
596
608
  }, timeText)));
597
609
  }
@@ -54,7 +54,9 @@ export default class Navigation extends PureComponent {
54
54
  ref: ref
55
55
  }, /*#__PURE__*/React.createElement(IconButton, {
56
56
  key: "double-chevron-left",
57
+ "aria-label": "Previous year",
57
58
  icon: /*#__PURE__*/React.createElement(IconDoubleChevronLeft, {
59
+ "aria-hidden": true,
58
60
  size: iconBtnSize
59
61
  }),
60
62
  size: buttonSize,
@@ -64,7 +66,9 @@ export default class Navigation extends PureComponent {
64
66
  style: leftButtonStyle
65
67
  }), /*#__PURE__*/React.createElement(IconButton, {
66
68
  key: "chevron-left",
69
+ "aria-label": "Previous month",
67
70
  icon: /*#__PURE__*/React.createElement(IconChevronLeft, {
71
+ "aria-hidden": true,
68
72
  size: iconBtnSize
69
73
  }),
70
74
  size: buttonSize,
@@ -80,7 +84,9 @@ export default class Navigation extends PureComponent {
80
84
  size: buttonSize
81
85
  }, /*#__PURE__*/React.createElement("span", null, monthText))), /*#__PURE__*/React.createElement(IconButton, {
82
86
  key: "chevron-right",
87
+ "aria-label": "Next month",
83
88
  icon: /*#__PURE__*/React.createElement(IconChevronRight, {
89
+ "aria-hidden": true,
84
90
  size: iconBtnSize
85
91
  }),
86
92
  size: buttonSize,
@@ -90,7 +96,9 @@ export default class Navigation extends PureComponent {
90
96
  style: rightButtonStyle
91
97
  }), /*#__PURE__*/React.createElement(IconButton, {
92
98
  key: "double-chevron-right",
99
+ "aria-label": "Next year",
93
100
  icon: /*#__PURE__*/React.createElement(IconDoubleChevronRight, {
101
+ "aria-hidden": true,
94
102
  size: iconBtnSize
95
103
  }),
96
104
  size: buttonSize,
@@ -1,5 +1,7 @@
1
1
  import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
2
2
  import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
3
+
4
+ /* eslint-disable jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events */
3
5
  import React, { PureComponent } from 'react';
4
6
  import classNames from 'classnames';
5
7
  import PropTypes from 'prop-types';
@@ -222,6 +222,7 @@ class YearAndMonth extends BaseComponent {
222
222
  }, /*#__PURE__*/React.createElement(IconButton, {
223
223
  noHorizontalPadding: false,
224
224
  icon: /*#__PURE__*/React.createElement(IconChevronLeft, {
225
+ "aria-hidden": true,
225
226
  size: iconSize
226
227
  }),
227
228
  size: buttonSize,
@@ -58,7 +58,7 @@ declare class Dropdown extends BaseComponent<DropdownProps, DropdownState> {
58
58
  render: PropTypes.Requireable<PropTypes.ReactNodeLike>;
59
59
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
60
60
  visible: PropTypes.Requireable<boolean>;
61
- position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
61
+ position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
62
62
  getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
63
63
  mouseEnterDelay: PropTypes.Requireable<number>;
64
64
  mouseLeaveDelay: PropTypes.Requireable<number>;
@@ -80,7 +80,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
80
80
  emptyContent?: React.ReactNode;
81
81
  onDropdownVisibleChange?: (visible: boolean) => void;
82
82
  zIndex?: number;
83
- position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
83
+ position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
84
84
  onSearch?: (value: string) => void;
85
85
  dropdownClassName?: string;
86
86
  dropdownStyle?: React.CSSProperties;
@@ -77,8 +77,8 @@ class Form extends BaseComponent {
77
77
  notifySubmitFail: (errors, values) => {
78
78
  this.props.onSubmitFail(errors, values);
79
79
  },
80
- forceUpdate: () => {
81
- this.forceUpdate();
80
+ forceUpdate: callback => {
81
+ this.forceUpdate(callback);
82
82
  },
83
83
  notifyChange: formState => {
84
84
  this.props.onChange(formState);
@@ -28,7 +28,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
28
28
  emptyContent?: import("react").ReactNode;
29
29
  onDropdownVisibleChange?: (visible: boolean) => void;
30
30
  zIndex?: number;
31
- position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
31
+ position?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
32
32
  onSearch?: (value: string) => void;
33
33
  dropdownClassName?: string;
34
34
  dropdownStyle?: import("react").CSSProperties;
@@ -498,7 +498,7 @@ function withField(Component, opts) {
498
498
  text: label || field,
499
499
  id: labelId,
500
500
  required: required,
501
- name: name || field,
501
+ name: a11yId || name || field,
502
502
  width: mergeLabelWidth,
503
503
  align: mergeLabelAlign
504
504
  }, needSpread));
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { AriaAttributes } from 'react';
2
2
  import BaseComponent from '../_base/baseComponent';
3
3
  import PropTypes from 'prop-types';
4
4
  import { Item, ScrollItemAdapter } from '@douyinfe/semi-foundation/lib/es/scrollList/itemFoundation';
@@ -18,6 +18,7 @@ export interface ScrollItemProps<T extends Item> {
18
18
  motion?: Motion;
19
19
  style?: React.CSSProperties;
20
20
  type?: string | number;
21
+ 'aria-label'?: AriaAttributes['aria-label'];
21
22
  }
22
23
  export interface ScrollItemState {
23
24
  prependCount: number;
@@ -274,13 +274,14 @@ export default class ScrollItem extends BaseComponent {
274
274
  transform: itemTrans
275
275
  } = item;
276
276
  const transform = typeof itemTrans === 'function' ? itemTrans : commonTrans;
277
+ const selected = selectedIndex === index;
277
278
  const cls = classnames({
278
- ["".concat(cssClasses.PREFIX, "-item-sel")]: selectedIndex === index && mode !== wheelMode,
279
+ ["".concat(cssClasses.PREFIX, "-item-sel")]: selected && mode !== wheelMode,
279
280
  ["".concat(cssClasses.PREFIX, "-item-disabled")]: Boolean(item.disabled)
280
281
  });
281
282
  let text = '';
282
283
 
283
- if (selectedIndex === index) {
284
+ if (selected) {
284
285
  if (typeof transform === 'function') {
285
286
  text = transform(item.value, item.text);
286
287
  } else {
@@ -304,7 +305,10 @@ export default class ScrollItem extends BaseComponent {
304
305
  React.createElement("li", _Object$assign({
305
306
  key: prefixKey + index
306
307
  }, events, {
307
- className: cls
308
+ className: cls,
309
+ role: "option",
310
+ "aria-selected": selected,
311
+ "aria-disabled": item.disabled
308
312
  }), text)
309
313
  );
310
314
  });
@@ -323,6 +327,9 @@ export default class ScrollItem extends BaseComponent {
323
327
  className: wrapperCls,
324
328
  ref: this._cacheWrapperNode
325
329
  }, /*#__PURE__*/React.createElement("ul", {
330
+ role: "listbox",
331
+ "aria-multiselectable": false,
332
+ "aria-label": this.props['aria-label'],
326
333
  ref: this._cacheListNode
327
334
  }, inner));
328
335
  };
@@ -380,6 +387,9 @@ export default class ScrollItem extends BaseComponent {
380
387
  ref: this._cacheWrapperNode,
381
388
  onScroll: this.scrollToSelectItem
382
389
  }, /*#__PURE__*/React.createElement("ul", {
390
+ role: "listbox",
391
+ "aria-label": this.props['aria-label'],
392
+ "aria-multiselectable": false,
383
393
  ref: this._cacheListNode,
384
394
  onClick: this.clickToSelectItem
385
395
  }, prependList, inner, appendList)));
@@ -165,7 +165,7 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
165
165
  emptyContent: PropTypes.Requireable<PropTypes.ReactNodeLike>;
166
166
  onDropdownVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
167
167
  zIndex: PropTypes.Requireable<number>;
168
- position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
168
+ position: PropTypes.Requireable<"top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver">;
169
169
  onSearch: PropTypes.Requireable<(...args: any[]) => any>;
170
170
  getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
171
171
  dropdownClassName: PropTypes.Requireable<string>;
@@ -243,8 +243,8 @@ declare class Select extends BaseComponent<SelectProps, SelectState> {
243
243
  renderOption(option: OptionProps, optionIndex: number, style?: React.CSSProperties): any;
244
244
  renderCreateOption(option: OptionProps, isFocused: boolean, optionIndex: number, style: React.CSSProperties): JSX.Element;
245
245
  onOptionHover(optionIndex: number): void;
246
- renderWithGroup(visibileOptions: OptionProps[]): JSX.Element[];
247
- renderVirtualizeList(visibileOptions: OptionProps[]): JSX.Element;
246
+ renderWithGroup(visibleOptions: OptionProps[]): JSX.Element[];
247
+ renderVirtualizeList(visibleOptions: OptionProps[]): JSX.Element;
248
248
  renderOptions(children?: React.ReactNode): JSX.Element;
249
249
  renderSingleSelection(selections: Map<OptionProps['label'], any>, filterable: boolean): JSX.Element;
250
250
  renderMultipleSelection(selections: Map<OptionProps['label'], any>, filterable: boolean): JSX.Element;
@@ -285,11 +285,19 @@ class Select extends BaseComponent {
285
285
  el.focus();
286
286
  } catch (error) {}
287
287
  },
288
- updateScrollTop: () => {
289
- var _context9, _context10;
288
+ updateScrollTop: index => {
289
+ var _context10, _context11;
290
290
 
291
291
  // eslint-disable-next-line max-len
292
- let destNode = document.querySelector(_concatInstanceProperty(_context9 = _concatInstanceProperty(_context10 = "#".concat(prefixcls, "-")).call(_context10, this.selectOptionListID, " .")).call(_context9, prefixcls, "-option-selected"));
292
+ let optionClassName = ".".concat(prefixcls, "-option-selected");
293
+
294
+ if (index !== undefined) {
295
+ var _context9;
296
+
297
+ optionClassName = _concatInstanceProperty(_context9 = ".".concat(prefixcls, "-option:nth-child(")).call(_context9, index, ")");
298
+ }
299
+
300
+ let destNode = document.querySelector(_concatInstanceProperty(_context10 = _concatInstanceProperty(_context11 = "#".concat(prefixcls, "-")).call(_context11, this.selectOptionListID, " ")).call(_context10, optionClassName));
293
301
 
294
302
  if (_Array$isArray(destNode)) {
295
303
  // eslint-disable-next-line prefer-destructuring
@@ -317,11 +325,11 @@ class Select extends BaseComponent {
317
325
  }
318
326
 
319
327
  componentDidUpdate(prevProps, prevState) {
320
- var _context11, _context12;
328
+ var _context12, _context13;
321
329
 
322
- const prevChildrenKeys = _mapInstanceProperty(_context11 = React.Children.toArray(prevProps.children)).call(_context11, child => child.key);
330
+ const prevChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(prevProps.children)).call(_context12, child => child.key);
323
331
 
324
- const nowChildrenKeys = _mapInstanceProperty(_context12 = React.Children.toArray(this.props.children)).call(_context12, child => child.key);
332
+ const nowChildrenKeys = _mapInstanceProperty(_context13 = React.Children.toArray(this.props.children)).call(_context13, child => child.key);
325
333
 
326
334
  let isOptionsChanged = false;
327
335
 
@@ -515,34 +523,30 @@ class Select extends BaseComponent {
515
523
  this.foundation.handleOptionMouseEnter(optionIndex);
516
524
  }
517
525
 
518
- renderWithGroup(visibileOptions) {
526
+ renderWithGroup(visibleOptions) {
519
527
  const content = [];
520
528
  const groupStatus = new _Map();
521
529
 
522
- _forEachInstanceProperty(visibileOptions).call(visibileOptions, (option, optionIndex) => {
530
+ _forEachInstanceProperty(visibleOptions).call(visibleOptions, (option, optionIndex) => {
523
531
  const parentGroup = option._parentGroup;
524
532
  const optionContent = this.renderOption(option, optionIndex);
525
533
 
526
- if (parentGroup && groupStatus.has(parentGroup.label)) {
527
- // group content already insert
528
- content.push(optionContent);
529
- } else if (parentGroup) {
534
+ if (parentGroup && !groupStatus.has(parentGroup.label)) {
535
+ // when use with OptionGroup and group content not already insert
530
536
  const groupContent = /*#__PURE__*/React.createElement(OptionGroup, _Object$assign({}, parentGroup, {
531
537
  key: parentGroup.label
532
538
  }));
533
539
  groupStatus.set(parentGroup.label, true);
534
540
  content.push(groupContent);
535
- content.push(optionContent);
536
- } else {
537
- // when not use with OptionGroup
538
- content.push(optionContent);
539
541
  }
542
+
543
+ content.push(optionContent);
540
544
  });
541
545
 
542
546
  return content;
543
547
  }
544
548
 
545
- renderVirtualizeList(visibileOptions) {
549
+ renderVirtualizeList(visibleOptions) {
546
550
  const {
547
551
  virtualize
548
552
  } = this.props;
@@ -557,10 +561,10 @@ class Select extends BaseComponent {
557
561
  return /*#__PURE__*/React.createElement(List, {
558
562
  ref: this.virtualizeListRef,
559
563
  height: height || numbers.LIST_HEIGHT,
560
- itemCount: visibileOptions.length,
564
+ itemCount: visibleOptions.length,
561
565
  itemSize: itemSize,
562
566
  itemData: {
563
- visibileOptions,
567
+ visibleOptions,
564
568
  renderOption: this.renderOption
565
569
  },
566
570
  width: width || '100%',
@@ -571,7 +575,7 @@ class Select extends BaseComponent {
571
575
  }
572
576
 
573
577
  renderOptions(children) {
574
- var _context13;
578
+ var _context14;
575
579
 
576
580
  const {
577
581
  dropdownMinWidth,
@@ -591,12 +595,12 @@ class Select extends BaseComponent {
591
595
  multiple
592
596
  } = this.props; // Do a filter first, instead of directly judging in forEach, so that the focusIndex can correspond to
593
597
 
594
- const visibileOptions = _filterInstanceProperty(options).call(options, item => item._show);
598
+ const visibleOptions = _filterInstanceProperty(options).call(options, item => item._show);
595
599
 
596
- let listContent = this.renderWithGroup(visibileOptions);
600
+ let listContent = this.renderWithGroup(visibleOptions);
597
601
 
598
602
  if (virtualize) {
599
- listContent = this.renderVirtualizeList(visibileOptions);
603
+ listContent = this.renderVirtualizeList(visibleOptions);
600
604
  }
601
605
 
602
606
  const style = _Object$assign({
@@ -609,7 +613,7 @@ class Select extends BaseComponent {
609
613
  });
610
614
  const isEmpty = !options.length || !_someInstanceProperty(options).call(options, item => item._show);
611
615
  return /*#__PURE__*/React.createElement("div", {
612
- id: _concatInstanceProperty(_context13 = "".concat(prefixcls, "-")).call(_context13, this.selectOptionListID),
616
+ id: _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
613
617
  className: dropdownClassName,
614
618
  style: style
615
619
  }, outerTopSlot, /*#__PURE__*/React.createElement("div", {
@@ -840,7 +844,7 @@ class Select extends BaseComponent {
840
844
  }
841
845
 
842
846
  renderSelection() {
843
- var _context14;
847
+ var _context15;
844
848
 
845
849
  const {
846
850
  disabled,
@@ -924,7 +928,7 @@ class Select extends BaseComponent {
924
928
  role: "combobox",
925
929
  "aria-disabled": disabled,
926
930
  "aria-expanded": isOpen,
927
- "aria-controls": _concatInstanceProperty(_context14 = "".concat(prefixcls, "-")).call(_context14, this.selectOptionListID),
931
+ "aria-controls": _concatInstanceProperty(_context15 = "".concat(prefixcls, "-")).call(_context15, this.selectOptionListID),
928
932
  "aria-haspopup": "listbox",
929
933
  "aria-label": "select value",
930
934
  "aria-invalid": this.props['aria-invalid'],
@@ -36,9 +36,9 @@ class Option extends PureComponent {
36
36
  const {
37
37
  props
38
38
  } = this;
39
- const isDisbled = props.disabled;
39
+ const isDisabled = props.disabled;
40
40
 
41
- if (!isDisbled) {
41
+ if (!isDisabled) {
42
42
  props.onSelect(_Object$assign(_Object$assign({}, rest), {
43
43
  value,
44
44
  label: label || children
@@ -5,9 +5,9 @@ const VirtualRow = _ref => {
5
5
  style
6
6
  } = _ref;
7
7
  const {
8
- visibileOptions
8
+ visibleOptions
9
9
  } = data;
10
- const option = visibileOptions[index];
10
+ const option = visibleOptions[index];
11
11
  return data.renderOption(option, index, style);
12
12
  };
13
13
 
@@ -298,7 +298,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
298
298
  showSizeChanger?: boolean;
299
299
  showQuickJumper?: boolean;
300
300
  popoverZIndex?: number;
301
- popoverPosition?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver";
301
+ popoverPosition?: "top" | "topLeft" | "topRight" | "left" | "leftTop" | "leftBottom" | "right" | "rightTop" | "rightBottom" | "bottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver" | "leftBottomOver" | "rightBottomOver";
302
302
  hideOnSinglePage?: boolean;
303
303
  hoverShowPageSelect?: boolean;
304
304
  };