@douyinfe/semi-ui 2.2.0 → 2.3.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 (439) hide show
  1. package/_base/_story/a11y.jsx +6 -6
  2. package/_base/_story/a11y.scss +0 -1
  3. package/_base/_story/index.scss +2 -5
  4. package/_utils/hooks/usePrevFocus.ts +16 -0
  5. package/_utils/index.ts +4 -0
  6. package/anchor/_story/anchor.stories.js +1 -1
  7. package/anchor/index.tsx +5 -2
  8. package/anchor/link.tsx +29 -4
  9. package/autoComplete/index.tsx +28 -1
  10. package/avatar/_story/avatar.stories.js +4 -4
  11. package/avatar/index.tsx +6 -4
  12. package/banner/index.tsx +2 -1
  13. package/breadcrumb/_story/breadcrumb.stories.js +22 -8
  14. package/breadcrumb/index.tsx +8 -1
  15. package/breadcrumb/item.tsx +1 -1
  16. package/button/Button.tsx +4 -0
  17. package/button/__test__/button.test.js +1 -1
  18. package/button/_story/button.stories.js +10 -10
  19. package/button/buttonGroup.tsx +4 -2
  20. package/button/splitButtonGroup.tsx +5 -2
  21. package/card/_story/card.stories.js +8 -1
  22. package/card/_story/card.stories.tsx +3 -0
  23. package/card/index.tsx +5 -2
  24. package/cascader/index.tsx +33 -5
  25. package/checkbox/_story/checkbox.stories.js +19 -12
  26. package/checkbox/checkbox.tsx +40 -5
  27. package/checkbox/checkboxGroup.tsx +30 -5
  28. package/checkbox/checkboxInner.tsx +25 -2
  29. package/collapse/index.tsx +1 -1
  30. package/collapse/item.tsx +12 -7
  31. package/collapsible/index.tsx +4 -2
  32. package/configProvider/_story/configProvider.stories.tsx +27 -0
  33. package/datePicker/__test__/datePicker.test.js +108 -0
  34. package/datePicker/_story/datePicker.stories.js +146 -2
  35. package/datePicker/datePicker.tsx +24 -0
  36. package/datePicker/monthsGrid.tsx +2 -1
  37. package/dist/css/semi.css +34 -7
  38. package/dist/css/semi.min.css +1 -1
  39. package/dist/umd/semi-ui.js +2768 -1501
  40. package/dist/umd/semi-ui.js.map +1 -1
  41. package/dist/umd/semi-ui.min.js +1 -1
  42. package/dist/umd/semi-ui.min.js.map +1 -1
  43. package/dropdown/dropdownItem.tsx +1 -1
  44. package/dropdown/dropdownMenu.tsx +1 -1
  45. package/empty/index.tsx +4 -4
  46. package/form/_story/FormApi/formApiDemo.jsx +3 -2
  47. package/form/_story/Validate/validateDemo.jsx +1 -1
  48. package/form/_story/demo.jsx +12 -3
  49. package/form/_story/form.stories.js +0 -7
  50. package/form/baseForm.tsx +2 -0
  51. package/form/errorMessage.tsx +13 -2
  52. package/form/hoc/withField.tsx +37 -8
  53. package/form/index.tsx +0 -2
  54. package/form/interface.ts +2 -0
  55. package/form/label.tsx +4 -2
  56. package/input/index.tsx +49 -4
  57. package/input/inputGroup.tsx +9 -4
  58. package/input/textarea.tsx +25 -6
  59. package/inputNumber/_story/inputNumber.stories.js +12 -0
  60. package/inputNumber/index.tsx +33 -2
  61. package/layout/Sider.tsx +6 -2
  62. package/layout/index.tsx +4 -3
  63. package/lib/cjs/_utils/hooks/usePrevFocus.d.ts +2 -0
  64. package/lib/cjs/_utils/hooks/usePrevFocus.js +30 -0
  65. package/lib/cjs/_utils/index.d.ts +1 -0
  66. package/lib/cjs/_utils/index.js +6 -1
  67. package/lib/cjs/anchor/index.d.ts +2 -0
  68. package/lib/cjs/anchor/index.js +6 -1
  69. package/lib/cjs/anchor/link.d.ts +4 -1
  70. package/lib/cjs/anchor/link.js +39 -5
  71. package/lib/cjs/autoComplete/index.d.ts +17 -0
  72. package/lib/cjs/autoComplete/index.js +21 -2
  73. package/lib/cjs/avatar/index.d.ts +4 -3
  74. package/lib/cjs/avatar/index.js +15 -11
  75. package/lib/cjs/banner/index.js +4 -2
  76. package/lib/cjs/breadcrumb/index.d.ts +3 -0
  77. package/lib/cjs/breadcrumb/index.js +10 -4
  78. package/lib/cjs/breadcrumb/item.js +2 -2
  79. package/lib/cjs/button/Button.d.ts +2 -0
  80. package/lib/cjs/button/Button.js +4 -2
  81. package/lib/cjs/button/buttonGroup.d.ts +3 -0
  82. package/lib/cjs/button/buttonGroup.js +8 -4
  83. package/lib/cjs/button/index.d.ts +1 -0
  84. package/lib/cjs/button/splitButtonGroup.d.ts +3 -0
  85. package/lib/cjs/button/splitButtonGroup.js +5 -2
  86. package/lib/cjs/card/index.d.ts +3 -0
  87. package/lib/cjs/card/index.js +3 -1
  88. package/lib/cjs/cascader/index.d.ts +14 -0
  89. package/lib/cjs/cascader/index.js +35 -7
  90. package/lib/cjs/checkbox/checkbox.d.ts +21 -1
  91. package/lib/cjs/checkbox/checkbox.js +51 -17
  92. package/lib/cjs/checkbox/checkboxGroup.d.ts +13 -1
  93. package/lib/cjs/checkbox/checkboxGroup.js +16 -3
  94. package/lib/cjs/checkbox/checkboxInner.d.ts +15 -0
  95. package/lib/cjs/checkbox/checkboxInner.js +20 -3
  96. package/lib/cjs/collapse/item.d.ts +2 -1
  97. package/lib/cjs/collapse/item.js +12 -2
  98. package/lib/cjs/collapsible/index.d.ts +1 -0
  99. package/lib/cjs/collapsible/index.js +4 -2
  100. package/lib/cjs/datePicker/datePicker.d.ts +12 -0
  101. package/lib/cjs/datePicker/datePicker.js +22 -3
  102. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
  103. package/lib/cjs/datePicker/monthsGrid.js +2 -1
  104. package/lib/cjs/dropdown/dropdownItem.js +3 -1
  105. package/lib/cjs/dropdown/dropdownMenu.js +4 -1
  106. package/lib/cjs/form/baseForm.d.ts +9 -0
  107. package/lib/cjs/form/baseForm.js +3 -1
  108. package/lib/cjs/form/errorMessage.d.ts +4 -0
  109. package/lib/cjs/form/errorMessage.js +21 -3
  110. package/lib/cjs/form/field.d.ts +7 -0
  111. package/lib/cjs/form/hoc/withField.js +49 -16
  112. package/lib/cjs/form/index.d.ts +0 -1
  113. package/lib/cjs/form/interface.d.ts +2 -0
  114. package/lib/cjs/form/label.d.ts +2 -0
  115. package/lib/cjs/form/label.js +5 -2
  116. package/lib/cjs/input/index.d.ts +16 -0
  117. package/lib/cjs/input/index.js +51 -15
  118. package/lib/cjs/input/inputGroup.d.ts +2 -1
  119. package/lib/cjs/input/inputGroup.js +11 -1
  120. package/lib/cjs/input/textarea.js +12 -1
  121. package/lib/cjs/inputNumber/index.d.ts +21 -12
  122. package/lib/cjs/inputNumber/index.js +37 -3
  123. package/lib/cjs/layout/Sider.d.ts +4 -0
  124. package/lib/cjs/layout/Sider.js +4 -1
  125. package/lib/cjs/layout/index.js +2 -0
  126. package/lib/cjs/list/item.js +0 -1
  127. package/lib/cjs/modal/Modal.js +2 -0
  128. package/lib/cjs/modal/ModalContent.d.ts +3 -1
  129. package/lib/cjs/modal/ModalContent.js +47 -5
  130. package/lib/cjs/navigation/Item.d.ts +4 -2
  131. package/lib/cjs/navigation/Item.js +25 -5
  132. package/lib/cjs/navigation/SubNav.d.ts +4 -2
  133. package/lib/cjs/navigation/SubNav.js +8 -1
  134. package/lib/cjs/navigation/index.js +2 -0
  135. package/lib/cjs/notification/notice.d.ts +1 -1
  136. package/lib/cjs/notification/notice.js +32 -22
  137. package/lib/cjs/pagination/index.js +16 -6
  138. package/lib/cjs/popover/index.js +7 -3
  139. package/lib/cjs/progress/index.d.ts +8 -0
  140. package/lib/cjs/progress/index.js +42 -9
  141. package/lib/cjs/radio/radio.d.ts +6 -1
  142. package/lib/cjs/radio/radio.js +17 -5
  143. package/lib/cjs/radio/radioGroup.d.ts +16 -1
  144. package/lib/cjs/radio/radioGroup.js +18 -3
  145. package/lib/cjs/radio/radioInner.d.ts +6 -1
  146. package/lib/cjs/radio/radioInner.js +11 -3
  147. package/lib/cjs/rating/index.d.ts +14 -0
  148. package/lib/cjs/rating/index.js +14 -3
  149. package/lib/cjs/rating/item.d.ts +2 -0
  150. package/lib/cjs/rating/item.js +6 -1
  151. package/lib/cjs/select/index.d.ts +16 -0
  152. package/lib/cjs/select/index.js +65 -19
  153. package/lib/cjs/select/option.js +28 -22
  154. package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
  155. package/lib/cjs/sideSheet/SideSheetContent.js +4 -1
  156. package/lib/cjs/sideSheet/index.d.ts +1 -0
  157. package/lib/cjs/sideSheet/index.js +2 -1
  158. package/lib/cjs/slider/index.d.ts +2 -1
  159. package/lib/cjs/slider/index.js +64 -17
  160. package/lib/cjs/spin/icon.js +3 -4
  161. package/lib/cjs/steps/basicStep.d.ts +3 -0
  162. package/lib/cjs/steps/basicStep.js +23 -25
  163. package/lib/cjs/steps/basicSteps.d.ts +1 -0
  164. package/lib/cjs/steps/basicSteps.js +2 -1
  165. package/lib/cjs/steps/fillStep.d.ts +3 -0
  166. package/lib/cjs/steps/fillStep.js +19 -4
  167. package/lib/cjs/steps/fillSteps.d.ts +1 -0
  168. package/lib/cjs/steps/fillSteps.js +2 -1
  169. package/lib/cjs/steps/navStep.d.ts +3 -0
  170. package/lib/cjs/steps/navStep.js +22 -25
  171. package/lib/cjs/steps/navSteps.d.ts +1 -0
  172. package/lib/cjs/steps/navSteps.js +2 -1
  173. package/lib/cjs/switch/index.d.ts +12 -0
  174. package/lib/cjs/switch/index.js +19 -4
  175. package/lib/cjs/table/Body/BaseRow.js +35 -3
  176. package/lib/cjs/table/Body/index.js +9 -1
  177. package/lib/cjs/table/ColumnFilter.js +4 -0
  178. package/lib/cjs/table/ColumnSelection.d.ts +3 -0
  179. package/lib/cjs/table/ColumnSelection.js +6 -2
  180. package/lib/cjs/table/ColumnSorter.js +19 -3
  181. package/lib/cjs/table/CustomExpandIcon.js +7 -1
  182. package/lib/cjs/table/Table.d.ts +2 -0
  183. package/lib/cjs/table/Table.js +31 -15
  184. package/lib/cjs/table/TableCell.d.ts +2 -0
  185. package/lib/cjs/table/TableCell.js +6 -2
  186. package/lib/cjs/table/TableHeaderRow.js +8 -2
  187. package/lib/cjs/tabs/TabBar.js +11 -3
  188. package/lib/cjs/tabs/TabPane.js +3 -1
  189. package/lib/cjs/tabs/index.js +0 -1
  190. package/lib/cjs/tagInput/index.d.ts +4 -1
  191. package/lib/cjs/tagInput/index.js +29 -3
  192. package/lib/cjs/timePicker/TimePicker.d.ts +12 -0
  193. package/lib/cjs/timePicker/TimePicker.js +9 -1
  194. package/lib/cjs/timePicker/index.d.ts +6 -0
  195. package/lib/cjs/timeline/index.d.ts +1 -1
  196. package/lib/cjs/timeline/index.js +1 -0
  197. package/lib/cjs/timeline/item.js +4 -2
  198. package/lib/cjs/toast/toast.js +2 -0
  199. package/lib/cjs/tooltip/TriangleArrow.js +1 -0
  200. package/lib/cjs/tooltip/TriangleArrowVertical.js +1 -0
  201. package/lib/cjs/tooltip/index.d.ts +16 -12
  202. package/lib/cjs/tooltip/index.js +55 -39
  203. package/lib/cjs/transfer/index.d.ts +1 -1
  204. package/lib/cjs/transfer/index.js +35 -17
  205. package/lib/cjs/tree/index.d.ts +1 -0
  206. package/lib/cjs/tree/index.js +15 -6
  207. package/lib/cjs/tree/treeNode.d.ts +12 -4
  208. package/lib/cjs/tree/treeNode.js +44 -4
  209. package/lib/cjs/treeSelect/index.d.ts +16 -0
  210. package/lib/cjs/treeSelect/index.js +60 -12
  211. package/lib/cjs/typography/base.js +18 -7
  212. package/lib/cjs/typography/copyable.js +6 -1
  213. package/lib/cjs/upload/fileCard.js +26 -7
  214. package/lib/cjs/upload/index.js +19 -4
  215. package/lib/es/_utils/hooks/usePrevFocus.d.ts +2 -0
  216. package/lib/es/_utils/hooks/usePrevFocus.js +15 -0
  217. package/lib/es/_utils/index.d.ts +1 -0
  218. package/lib/es/_utils/index.js +4 -1
  219. package/lib/es/anchor/index.d.ts +2 -0
  220. package/lib/es/anchor/index.js +6 -1
  221. package/lib/es/anchor/link.d.ts +4 -1
  222. package/lib/es/anchor/link.js +38 -5
  223. package/lib/es/autoComplete/index.d.ts +17 -0
  224. package/lib/es/autoComplete/index.js +21 -2
  225. package/lib/es/avatar/index.d.ts +4 -3
  226. package/lib/es/avatar/index.js +15 -11
  227. package/lib/es/banner/index.js +4 -2
  228. package/lib/es/breadcrumb/index.d.ts +3 -0
  229. package/lib/es/breadcrumb/index.js +10 -4
  230. package/lib/es/breadcrumb/item.js +2 -2
  231. package/lib/es/button/Button.d.ts +2 -0
  232. package/lib/es/button/Button.js +4 -2
  233. package/lib/es/button/buttonGroup.d.ts +3 -0
  234. package/lib/es/button/buttonGroup.js +8 -4
  235. package/lib/es/button/index.d.ts +1 -0
  236. package/lib/es/button/splitButtonGroup.d.ts +3 -0
  237. package/lib/es/button/splitButtonGroup.js +5 -2
  238. package/lib/es/card/index.d.ts +3 -0
  239. package/lib/es/card/index.js +3 -1
  240. package/lib/es/cascader/index.d.ts +14 -0
  241. package/lib/es/cascader/index.js +35 -7
  242. package/lib/es/checkbox/checkbox.d.ts +21 -1
  243. package/lib/es/checkbox/checkbox.js +50 -17
  244. package/lib/es/checkbox/checkboxGroup.d.ts +13 -1
  245. package/lib/es/checkbox/checkboxGroup.js +18 -5
  246. package/lib/es/checkbox/checkboxInner.d.ts +15 -0
  247. package/lib/es/checkbox/checkboxInner.js +20 -3
  248. package/lib/es/collapse/item.d.ts +2 -1
  249. package/lib/es/collapse/item.js +11 -2
  250. package/lib/es/collapsible/index.d.ts +1 -0
  251. package/lib/es/collapsible/index.js +4 -2
  252. package/lib/es/datePicker/datePicker.d.ts +12 -0
  253. package/lib/es/datePicker/datePicker.js +22 -3
  254. package/lib/es/datePicker/monthsGrid.d.ts +1 -0
  255. package/lib/es/datePicker/monthsGrid.js +2 -1
  256. package/lib/es/dropdown/dropdownItem.js +3 -1
  257. package/lib/es/dropdown/dropdownMenu.js +4 -1
  258. package/lib/es/form/baseForm.d.ts +9 -0
  259. package/lib/es/form/baseForm.js +3 -1
  260. package/lib/es/form/errorMessage.d.ts +4 -0
  261. package/lib/es/form/errorMessage.js +21 -3
  262. package/lib/es/form/field.d.ts +7 -0
  263. package/lib/es/form/hoc/withField.js +48 -15
  264. package/lib/es/form/index.d.ts +0 -1
  265. package/lib/es/form/index.js +0 -1
  266. package/lib/es/form/interface.d.ts +2 -0
  267. package/lib/es/form/label.d.ts +2 -0
  268. package/lib/es/form/label.js +5 -2
  269. package/lib/es/input/index.d.ts +16 -0
  270. package/lib/es/input/index.js +51 -15
  271. package/lib/es/input/inputGroup.d.ts +2 -1
  272. package/lib/es/input/inputGroup.js +11 -1
  273. package/lib/es/input/textarea.js +12 -1
  274. package/lib/es/inputNumber/index.d.ts +21 -12
  275. package/lib/es/inputNumber/index.js +38 -3
  276. package/lib/es/layout/Sider.d.ts +4 -0
  277. package/lib/es/layout/Sider.js +4 -1
  278. package/lib/es/layout/index.js +2 -0
  279. package/lib/es/list/item.js +0 -1
  280. package/lib/es/modal/Modal.js +2 -0
  281. package/lib/es/modal/ModalContent.d.ts +3 -1
  282. package/lib/es/modal/ModalContent.js +46 -5
  283. package/lib/es/navigation/Item.d.ts +4 -2
  284. package/lib/es/navigation/Item.js +25 -5
  285. package/lib/es/navigation/SubNav.d.ts +4 -2
  286. package/lib/es/navigation/SubNav.js +8 -1
  287. package/lib/es/navigation/index.js +2 -0
  288. package/lib/es/notification/notice.d.ts +1 -1
  289. package/lib/es/notification/notice.js +33 -24
  290. package/lib/es/pagination/index.js +16 -6
  291. package/lib/es/popover/index.js +7 -3
  292. package/lib/es/progress/index.d.ts +8 -0
  293. package/lib/es/progress/index.js +42 -9
  294. package/lib/es/radio/radio.d.ts +6 -1
  295. package/lib/es/radio/radio.js +16 -5
  296. package/lib/es/radio/radioGroup.d.ts +16 -1
  297. package/lib/es/radio/radioGroup.js +18 -3
  298. package/lib/es/radio/radioInner.d.ts +6 -1
  299. package/lib/es/radio/radioInner.js +11 -3
  300. package/lib/es/rating/index.d.ts +14 -0
  301. package/lib/es/rating/index.js +14 -3
  302. package/lib/es/rating/item.d.ts +2 -0
  303. package/lib/es/rating/item.js +6 -1
  304. package/lib/es/select/index.d.ts +16 -0
  305. package/lib/es/select/index.js +63 -17
  306. package/lib/es/select/option.js +28 -22
  307. package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
  308. package/lib/es/sideSheet/SideSheetContent.js +4 -1
  309. package/lib/es/sideSheet/index.d.ts +1 -0
  310. package/lib/es/sideSheet/index.js +2 -1
  311. package/lib/es/slider/index.d.ts +2 -1
  312. package/lib/es/slider/index.js +63 -16
  313. package/lib/es/spin/icon.js +3 -4
  314. package/lib/es/steps/basicStep.d.ts +3 -0
  315. package/lib/es/steps/basicStep.js +23 -23
  316. package/lib/es/steps/basicSteps.d.ts +1 -0
  317. package/lib/es/steps/basicSteps.js +2 -1
  318. package/lib/es/steps/fillStep.d.ts +3 -0
  319. package/lib/es/steps/fillStep.js +19 -4
  320. package/lib/es/steps/fillSteps.d.ts +1 -0
  321. package/lib/es/steps/fillSteps.js +2 -1
  322. package/lib/es/steps/navStep.d.ts +3 -0
  323. package/lib/es/steps/navStep.js +22 -23
  324. package/lib/es/steps/navSteps.d.ts +1 -0
  325. package/lib/es/steps/navSteps.js +2 -1
  326. package/lib/es/switch/index.d.ts +12 -0
  327. package/lib/es/switch/index.js +19 -4
  328. package/lib/es/table/Body/BaseRow.js +35 -3
  329. package/lib/es/table/Body/index.js +9 -2
  330. package/lib/es/table/ColumnFilter.js +4 -0
  331. package/lib/es/table/ColumnSelection.d.ts +3 -0
  332. package/lib/es/table/ColumnSelection.js +6 -2
  333. package/lib/es/table/ColumnSorter.js +17 -3
  334. package/lib/es/table/CustomExpandIcon.js +6 -1
  335. package/lib/es/table/Table.d.ts +2 -0
  336. package/lib/es/table/Table.js +31 -15
  337. package/lib/es/table/TableCell.d.ts +2 -0
  338. package/lib/es/table/TableCell.js +6 -2
  339. package/lib/es/table/TableHeaderRow.js +8 -2
  340. package/lib/es/tabs/TabBar.js +11 -3
  341. package/lib/es/tabs/TabPane.js +3 -1
  342. package/lib/es/tabs/index.js +0 -1
  343. package/lib/es/tagInput/index.d.ts +4 -1
  344. package/lib/es/tagInput/index.js +29 -3
  345. package/lib/es/timePicker/TimePicker.d.ts +12 -0
  346. package/lib/es/timePicker/TimePicker.js +9 -1
  347. package/lib/es/timePicker/index.d.ts +6 -0
  348. package/lib/es/timeline/index.d.ts +1 -1
  349. package/lib/es/timeline/index.js +1 -0
  350. package/lib/es/timeline/item.js +4 -2
  351. package/lib/es/toast/toast.js +2 -0
  352. package/lib/es/tooltip/TriangleArrow.js +1 -0
  353. package/lib/es/tooltip/TriangleArrowVertical.js +1 -0
  354. package/lib/es/tooltip/index.d.ts +16 -12
  355. package/lib/es/tooltip/index.js +53 -39
  356. package/lib/es/transfer/index.d.ts +1 -1
  357. package/lib/es/transfer/index.js +35 -17
  358. package/lib/es/tree/index.d.ts +1 -0
  359. package/lib/es/tree/index.js +15 -6
  360. package/lib/es/tree/treeNode.d.ts +12 -4
  361. package/lib/es/tree/treeNode.js +44 -4
  362. package/lib/es/treeSelect/index.d.ts +16 -0
  363. package/lib/es/treeSelect/index.js +57 -10
  364. package/lib/es/typography/base.js +17 -7
  365. package/lib/es/typography/copyable.js +5 -1
  366. package/lib/es/upload/fileCard.js +26 -7
  367. package/lib/es/upload/index.js +19 -4
  368. package/list/item.tsx +0 -1
  369. package/modal/Modal.tsx +2 -0
  370. package/modal/ModalContent.tsx +35 -5
  371. package/navigation/Item.tsx +15 -0
  372. package/navigation/SubNav.tsx +13 -1
  373. package/navigation/index.tsx +1 -1
  374. package/notification/notice.tsx +19 -14
  375. package/package.json +8 -8
  376. package/pagination/index.tsx +9 -5
  377. package/popover/index.tsx +5 -0
  378. package/progress/_story/progress.stories.js +18 -18
  379. package/progress/index.tsx +58 -20
  380. package/radio/radio.tsx +12 -2
  381. package/radio/radioGroup.tsx +29 -3
  382. package/radio/radioInner.tsx +10 -1
  383. package/rating/index.tsx +19 -2
  384. package/rating/item.tsx +6 -0
  385. package/select/__test__/select.test.js +45 -0
  386. package/select/_story/select.stories.js +29 -0
  387. package/select/index.tsx +52 -4
  388. package/select/option.tsx +3 -0
  389. package/sideSheet/SideSheetContent.tsx +6 -4
  390. package/sideSheet/index.tsx +3 -2
  391. package/slider/__test__/slider.test.js +9 -0
  392. package/slider/_story/slider.stories.js +1 -1
  393. package/slider/index.tsx +44 -7
  394. package/spin/icon.tsx +4 -3
  395. package/steps/basicStep.tsx +15 -4
  396. package/steps/basicSteps.tsx +3 -2
  397. package/steps/fillStep.tsx +27 -12
  398. package/steps/fillSteps.tsx +2 -0
  399. package/steps/navStep.tsx +15 -4
  400. package/steps/navSteps.tsx +3 -2
  401. package/switch/_story/switch.stories.js +20 -19
  402. package/switch/_story/switch.stories.tsx +13 -13
  403. package/switch/index.tsx +23 -5
  404. package/table/Body/BaseRow.tsx +25 -1
  405. package/table/Body/index.tsx +7 -2
  406. package/table/ColumnFilter.tsx +7 -1
  407. package/table/ColumnSelection.tsx +4 -1
  408. package/table/ColumnSorter.tsx +18 -1
  409. package/table/CustomExpandIcon.tsx +5 -0
  410. package/table/Table.tsx +26 -13
  411. package/table/TableCell.tsx +11 -1
  412. package/table/TableHeaderRow.tsx +16 -2
  413. package/table/__test__/table.test.js +46 -0
  414. package/tabs/TabBar.tsx +8 -5
  415. package/tabs/TabPane.tsx +3 -1
  416. package/tabs/index.tsx +0 -1
  417. package/tagInput/__test__/tagInput.test.js +46 -0
  418. package/tagInput/_story/tagInput.stories.js +2 -2
  419. package/tagInput/index.tsx +31 -8
  420. package/timePicker/TimePicker.tsx +14 -1
  421. package/timeline/_story/timeline.stories.js +1 -1
  422. package/timeline/index.tsx +2 -2
  423. package/timeline/item.tsx +2 -1
  424. package/toast/toast.tsx +2 -0
  425. package/tooltip/TriangleArrow.tsx +1 -1
  426. package/tooltip/TriangleArrowVertical.tsx +1 -1
  427. package/tooltip/_story/tooltip.stories.js +562 -514
  428. package/tooltip/index.tsx +51 -33
  429. package/transfer/index.tsx +32 -28
  430. package/tree/_story/tree.stories.js +3 -3
  431. package/tree/index.tsx +10 -2
  432. package/tree/treeNode.tsx +46 -10
  433. package/treeSelect/__test__/treeMultiple.test.js +5 -0
  434. package/treeSelect/_story/treeSelect.stories.js +12 -0
  435. package/treeSelect/index.tsx +58 -7
  436. package/typography/base.tsx +7 -1
  437. package/typography/copyable.tsx +10 -1
  438. package/upload/fileCard.tsx +14 -16
  439. package/upload/index.tsx +10 -6
@@ -839,12 +839,12 @@ export default function SemiA11y() {
839
839
  </Timeline.Item>
840
840
  </Timeline>
841
841
  <div style={{ width: 200 }}>
842
- <Progress className="mb12" percent={10} stroke="#fc8800" />
843
- <Progress className="mb12" percent={25} stroke="#f93920" />
844
- <Progress className="mb12" percent={50} />
845
- <Progress className="mb12" percent={80} />
846
- <Progress className="mb12" percent={80} size="large" />
847
- <Progress className="mb12" percent={80} style={{ height: '8px' }} />
842
+ <Progress className="mb12" percent={10} stroke="#fc8800" aria-label='download progress'/>
843
+ <Progress className="mb12" percent={25} stroke="#f93920" aria-label='download progress'/>
844
+ <Progress className="mb12" percent={50} aria-label='download progress'/>
845
+ <Progress className="mb12" percent={80} aria-label='download progress'/>
846
+ <Progress className="mb12" percent={80} size="large" aria-label='download progress'/>
847
+ <Progress className="mb12" percent={80} style={{ height: '8px' }} aria-label='download progress'/>
848
848
  </div>
849
849
  <div className="mb12">
850
850
  <Skeleton placeholder={placeholder} loading={true} active>
@@ -22,7 +22,6 @@ body[data-page="a11y"] {
22
22
  }
23
23
 
24
24
  .grid {
25
-
26
25
  .semi-row,
27
26
  .semi-row-flex {
28
27
  text-align: center;
@@ -7,9 +7,6 @@ body {
7
7
 
8
8
 
9
9
  // 给每个组件的 story 区域加个 padding,如果需要更大的 padding 可以在组件内自定义样式
10
- .sb-show-main.sb-main-padded {
11
-
12
- #root {
13
- padding: 20px;
14
- }
10
+ .sb-show-main.sb-main-padded > #root {
11
+ padding: 20px;
15
12
  }
@@ -0,0 +1,16 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { getActiveElement } from '../index';
3
+ import { get, isFunction } from 'lodash';
4
+
5
+ export function usePrevFocus() {
6
+ const [prevFocusElement, setPrevFocus] = useState<HTMLElement>(getActiveElement());
7
+
8
+ useEffect(() => {
9
+ return function cleanup() {
10
+ const blur = get(prevFocusElement, 'blur');
11
+ isFunction(blur) && blur();
12
+ };
13
+ }, [prevFocusElement]);
14
+
15
+ return [prevFocusElement, setPrevFocus];
16
+ }
package/_utils/index.ts CHANGED
@@ -160,3 +160,7 @@ export interface HighLightTextHTMLChunk {
160
160
  * @returns boolean
161
161
  */
162
162
  export const isSemiIcon = (icon: any): boolean => React.isValidElement(icon) && get(icon.type, 'elementType') === 'Icon';
163
+
164
+ export function getActiveElement() {
165
+ return document ? document.activeElement as HTMLElement : null;
166
+ }
@@ -15,7 +15,7 @@ const Link = Anchor.Link;
15
15
  export const Size = () => (
16
16
  <div>
17
17
  <div>小号尺寸</div>
18
- <Anchor size={'small'}>
18
+ <Anchor aria-label='小号尺寸' size={'small'}>
19
19
  <Link href="#welcome" title="welcome" />
20
20
  <Link href="#api" title="api too much to show" />
21
21
  <Link href="#contact" title="contact" />
package/anchor/index.tsx CHANGED
@@ -31,6 +31,7 @@ export interface AnchorProps {
31
31
  targetOffset?: number;
32
32
  onChange?: (currentLink: string, previousLink: string) => void;
33
33
  onClick?: (e: React.MouseEvent<HTMLElement>, currentLink: string) => void;
34
+ 'aria-label'?: React.AriaAttributes['aria-label'];
34
35
  }
35
36
 
36
37
  export interface AnchorState {
@@ -60,6 +61,7 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
60
61
  onChange: PropTypes.func,
61
62
  onClick: PropTypes.func,
62
63
  defaultAnchor: PropTypes.string,
64
+ 'aria-label': PropTypes.string,
63
65
  };
64
66
 
65
67
  static defaultProps = {
@@ -251,6 +253,7 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
251
253
  position,
252
254
  autoCollapse,
253
255
  } = this.props;
256
+ const ariaLabel = this.props['aria-label'];
254
257
  const { activeLink, scrollHeight, slideBarTop } = this.state;
255
258
  const wrapperCls = cls(prefixCls, className, {
256
259
  [`${prefixCls}-size-${size}`]: size,
@@ -282,8 +285,8 @@ class Anchor extends BaseComponent<AnchorProps, AnchorState> {
282
285
  removeLink: this.removeLink,
283
286
  }}
284
287
  >
285
- <div className={wrapperCls} style={wrapperStyle} id={this.anchorID}>
286
- <div className={slideCls} style={{ height: scrollHeight }}>
288
+ <div role="navigation" aria-label={ ariaLabel || 'Side navigation'} className={wrapperCls} style={wrapperStyle} id={this.anchorID}>
289
+ <div aria-hidden className={slideCls} style={{ height: scrollHeight }}>
287
290
  <span className={slideBarCls} style={{ top: slideBarTop }} />
288
291
  </div>
289
292
  <div className={anchorWrapper}>{children}</div>
package/anchor/link.tsx CHANGED
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4
4
  import BaseComponent from '../_base/baseComponent';
5
5
  import { cssClasses } from '@douyinfe/semi-foundation/anchor/constants';
6
6
  import LinkFoundation, { LinkAdapter } from '@douyinfe/semi-foundation/anchor/linkFoundation';
7
- import AnchorContext from './anchor-context';
7
+ import AnchorContext, { AnchorContextType } from './anchor-context';
8
8
  import Typography from '../typography/index';
9
9
 
10
10
  const prefixCls = cssClasses.PREFIX;
@@ -36,9 +36,11 @@ export default class Link extends BaseComponent<LinkProps, {}> {
36
36
 
37
37
  foundation: LinkFoundation;
38
38
 
39
+ context!: AnchorContextType;
39
40
  constructor(props: LinkProps) {
40
41
  super(props);
41
42
  this.foundation = new LinkFoundation(this.adapter);
43
+ this.handleClick = this.handleClick.bind(this);
42
44
  }
43
45
 
44
46
  get adapter(): LinkAdapter {
@@ -65,6 +67,12 @@ export default class Link extends BaseComponent<LinkProps, {}> {
65
67
  this.foundation.handleUpdateLink(href, prevHref);
66
68
  }
67
69
 
70
+ handleClick(e: React.KeyboardEvent | React.MouseEvent) {
71
+ const { disabled, href } = this.props;
72
+ const { onClick } = this.context;
73
+ !disabled && onClick(e as any, href);
74
+ }
75
+
68
76
  componentDidMount() {
69
77
  this.handleAddLink();
70
78
  }
@@ -115,18 +123,35 @@ export default class Link extends BaseComponent<LinkProps, {}> {
115
123
  };
116
124
 
117
125
  render() {
118
- const { href, className, style, disabled = false } = this.props;
119
- const { activeLink, onClick } = this.context;
126
+ const { href, className, style, disabled = false, title } = this.props;
127
+ const { activeLink, showTooltip } = this.context;
120
128
  const active = activeLink === href;
121
129
  const linkCls = cls(`${prefixCls}-link`, className);
122
130
  const linkTitleCls = cls(`${prefixCls}-link-title`, {
123
131
  [`${prefixCls}-link-title-active`]: active,
124
132
  [`${prefixCls}-link-title-disabled`]: disabled,
125
133
  });
134
+ const ariaProps = {
135
+ 'aria-disabled': disabled,
136
+ 'aria-label': href,
137
+ };
138
+ if (active) {
139
+ ariaProps['aria-details'] = 'active';
140
+ }
141
+ if (!showTooltip && typeof title === 'string') {
142
+ ariaProps['title'] = title;
143
+ }
126
144
 
127
145
  return (
128
146
  <div className={linkCls} style={style}>
129
- <div className={linkTitleCls} onClick={e => !disabled && onClick(e, href)}>
147
+ <div
148
+ role="link"
149
+ tabIndex={0}
150
+ {...ariaProps}
151
+ className={linkTitleCls}
152
+ onClick={e => this.handleClick(e)}
153
+ onKeyPress={e => this.handleClick(e)}
154
+ >
130
155
  {this.renderTitle()}
131
156
  </div>
132
157
  {this.renderChildren()}
@@ -39,6 +39,12 @@ export interface BaseDataItem extends DataItem {
39
39
  export type AutoCompleteItems = BaseDataItem | string | number;
40
40
 
41
41
  export interface AutoCompleteProps<T extends AutoCompleteItems> {
42
+ 'aria-describedby'?: React.AriaAttributes['aria-describedby'];
43
+ 'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
44
+ 'aria-invalid'?: React.AriaAttributes['aria-invalid'];
45
+ 'aria-label'?: React.AriaAttributes['aria-label'];
46
+ 'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
47
+ 'aria-required'?: React.AriaAttributes['aria-required'];
42
48
  autoAdjustOverflow?: boolean;
43
49
  autoFocus?: boolean;
44
50
  className?: string;
@@ -54,6 +60,8 @@ export interface AutoCompleteProps<T extends AutoCompleteItems> {
54
60
  emptyContent?: React.ReactNode | null;
55
61
  getPopupContainer?: () => HTMLElement;
56
62
  insetLabel?: React.ReactNode;
63
+ insetLabelId?: string;
64
+ id?: string;
57
65
  loading?: boolean;
58
66
  motion?: Motion;
59
67
  maxHeight?: string | number;
@@ -101,6 +109,12 @@ interface AutoCompleteState {
101
109
 
102
110
  class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoCompleteProps<T>, AutoCompleteState> {
103
111
  static propTypes = {
112
+ 'aria-label': PropTypes.string,
113
+ 'aria-labelledby': PropTypes.string,
114
+ 'aria-invalid': PropTypes.bool,
115
+ 'aria-errormessage': PropTypes.string,
116
+ 'aria-describedby': PropTypes.string,
117
+ 'aria-required': PropTypes.bool,
104
118
  autoFocus: PropTypes.bool,
105
119
  autoAdjustOverflow: PropTypes.bool,
106
120
  className: PropTypes.string,
@@ -114,6 +128,9 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
114
128
  dropdownClassName: PropTypes.string,
115
129
  dropdownStyle: PropTypes.object,
116
130
  emptyContent: PropTypes.node,
131
+ id: PropTypes.string,
132
+ insetLabel: PropTypes.node,
133
+ insetLabelId: PropTypes.string,
117
134
  onSearch: PropTypes.func,
118
135
  onSelect: PropTypes.func,
119
136
  onClear: PropTypes.func,
@@ -313,6 +330,7 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
313
330
  size,
314
331
  prefix,
315
332
  insetLabel,
333
+ insetLabelId,
316
334
  suffix,
317
335
  placeholder,
318
336
  style,
@@ -322,7 +340,8 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
322
340
  triggerRender,
323
341
  validateStatus,
324
342
  autoFocus,
325
- value
343
+ value,
344
+ id,
326
345
  } = this.props;
327
346
  const { inputValue, keyboardEventSet, selection } = this.state;
328
347
 
@@ -341,6 +360,7 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
341
360
  ),
342
361
  onClick: this.handleInputClick,
343
362
  ref: this.triggerRef,
363
+ id,
344
364
  ...keyboardEventSet,
345
365
  };
346
366
 
@@ -350,9 +370,16 @@ class AutoComplete<T extends AutoCompleteItems> extends BaseComponent<AutoComple
350
370
  autofocus: autoFocus,
351
371
  onChange: this.onSearch,
352
372
  onClear: this.onInputClear,
373
+ 'aria-label': this.props['aria-label'],
374
+ 'aria-labelledby': this.props['aria-labelledby'],
375
+ 'aria-invalid': this.props['aria-invalid'],
376
+ 'aria-errormessage': this.props['aria-errormessage'],
377
+ 'aria-describedby': this.props['aria-describedby'],
378
+ 'aria-required': this.props['aria-required'],
353
379
  // TODO: remove in next major version
354
380
  suffix,
355
381
  prefix: prefix || insetLabel,
382
+ insetLabelId,
356
383
  showClear,
357
384
  validateStatus,
358
385
  size,
@@ -11,7 +11,7 @@ export const Basic = () => (
11
11
  <div>
12
12
  <div>
13
13
  <Avatar>U</Avatar>
14
- <Avatar size="large">U</Avatar>
14
+ <Avatar autoFocus size="large" onClick={() => console.log('ok')}>U</Avatar>
15
15
  <Avatar size="extra-small">U</Avatar>
16
16
  <Avatar size="small">U</Avatar>
17
17
  <Avatar size="default">U</Avatar>
@@ -45,9 +45,9 @@ export const CustomAvatar = () => (
45
45
  <Avatar color="red" size="default">
46
46
  DF
47
47
  </Avatar>
48
- <Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
49
- <Avatar size="default" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
50
- <Avatar size="small" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" />
48
+ <Avatar src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="a man" />
49
+ <Avatar size="default" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="a man" />
50
+ <Avatar size="small" src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png" alt="a man" />
51
51
  <Avatar style={{ color: '#f56a00', backgroundColor: '#fde3cf' }}>U</Avatar>
52
52
  <Avatar style={{ backgroundColor: '#87d068' }}>YZ</Avatar>
53
53
  </div>
package/avatar/index.tsx CHANGED
@@ -47,6 +47,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
47
47
  onMouseLeave: PropTypes.func,
48
48
  };
49
49
 
50
+ foundation!: AvatarFoundation;
50
51
  constructor(props: AvatarProps) {
51
52
  super(props);
52
53
  this.state = {
@@ -106,12 +107,12 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
106
107
  this.foundation.destroy();
107
108
  }
108
109
 
109
- onEnter() {
110
- this.foundation.handleEnter();
110
+ onEnter(e: React.MouseEvent) {
111
+ this.foundation.handleEnter(e);
111
112
  }
112
113
 
113
- onLeave() {
114
- this.foundation.handleLeave();
114
+ onLeave(e: React.MouseEvent) {
115
+ this.foundation.handleLeave(e);
115
116
  }
116
117
 
117
118
  handleError() {
@@ -147,6 +148,7 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
147
148
  );
148
149
  }
149
150
  return (
151
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
150
152
  <span
151
153
  {...(others as any)}
152
154
  style={style}
package/banner/index.tsx CHANGED
@@ -112,6 +112,7 @@ export default class Banner extends BaseComponent<BannerProps, BannerState> {
112
112
  theme="borderless"
113
113
  size="small"
114
114
  type="tertiary"
115
+ aria-label='Close'
115
116
  />
116
117
  );
117
118
  return closer;
@@ -153,7 +154,7 @@ export default class Banner extends BaseComponent<BannerProps, BannerState> {
153
154
  [`${prefixCls}-bordered`]: !fullMode && bordered,
154
155
  });
155
156
  const banner = visible ? (
156
- <div className={wrapper} style={style}>
157
+ <div className={wrapper} style={style} role="alert">
157
158
  <div className={`${prefixCls}-content-wrapper`}>
158
159
  <div className={`${prefixCls}-content`}>
159
160
  {this.renderIcon()}
@@ -25,9 +25,11 @@ export const Default = () => (
25
25
  'breadcrumb',
26
26
  'default',
27
27
  ]}
28
+ aria-label='example-1'
28
29
  onClick={item => console.log(item)}
29
30
  />
30
31
  <Breadcrumb
32
+ aria-label='example-2'
31
33
  routes={[
32
34
  {
33
35
  path: '/home',
@@ -44,6 +46,7 @@ export const Default = () => (
44
46
  onClick={item => console.log(item)}
45
47
  />
46
48
  <Breadcrumb
49
+ aria-label='example-3'
47
50
  routes={[
48
51
  {
49
52
  path: '/home',
@@ -57,6 +60,7 @@ export const Default = () => (
57
60
  separator={'>'}
58
61
  />
59
62
  <Breadcrumb
63
+ aria-label='example-4'
60
64
  routes={[
61
65
  {
62
66
  path: '/home',
@@ -70,10 +74,12 @@ export const Default = () => (
70
74
  separator={<IconArrowRight size={'small'} />}
71
75
  />
72
76
  <Breadcrumb
77
+ aria-label='example-5'
73
78
  routes={['首页', '当这个页面标题很长时需要省略', '详情页']}
74
79
  onClick={item => console.log(item)}
75
80
  />
76
81
  <Breadcrumb
82
+ aria-label='example-6'
77
83
  routes={[
78
84
  '首页',
79
85
  '当层级很多的时候',
@@ -91,6 +97,7 @@ export const Default = () => (
91
97
  export const Compact = () => (
92
98
  <div>
93
99
  <Breadcrumb
100
+ aria-label='example-1'
94
101
  routes={[
95
102
  {
96
103
  path: '/home',
@@ -103,6 +110,7 @@ export const Compact = () => (
103
110
  compact={true}
104
111
  />
105
112
  <Breadcrumb
113
+ aria-label='example-2'
106
114
  routes={[
107
115
  {
108
116
  path: '/home',
@@ -119,6 +127,7 @@ export const Compact = () => (
119
127
  compact={true}
120
128
  />
121
129
  <Breadcrumb
130
+ aria-label='example-3'
122
131
  routes={[
123
132
  {
124
133
  path: '/home',
@@ -133,6 +142,7 @@ export const Compact = () => (
133
142
  compact={true}
134
143
  />
135
144
  <Breadcrumb
145
+ aria-label='example-4'
136
146
  routes={[
137
147
  {
138
148
  path: '/home',
@@ -147,11 +157,13 @@ export const Compact = () => (
147
157
  compact={true}
148
158
  />
149
159
  <Breadcrumb
160
+ aria-label='example-5'
150
161
  routes={['首页', '当这个页面标题很长时需要省略', '详情页']}
151
162
  onClick={item => console.log(item)}
152
163
  compact={true}
153
164
  />
154
165
  <Breadcrumb
166
+ aria-label='example-6'
155
167
  routes={[
156
168
  '首页',
157
169
  '当层级很多的时候',
@@ -169,32 +181,32 @@ export const Compact = () => (
169
181
 
170
182
  export const BreadcrumbItemJSX = () => (
171
183
  <div>
172
- <Breadcrumb onClick={item => console.log(item)}>
184
+ <Breadcrumb aria-label='example-1' onClick={item => console.log(item)}>
173
185
  <Breadcrumb.Item onClick={item => console.log('child', item)}>home</Breadcrumb.Item>
174
186
  <Breadcrumb.Item href="#">breadcrumb</Breadcrumb.Item>
175
187
  <Breadcrumb.Item>default</Breadcrumb.Item>
176
188
  </Breadcrumb>
177
- <Breadcrumb onClick={item => console.log(item)}>
189
+ <Breadcrumb aria-label='example-2' onClick={item => console.log(item)}>
178
190
  <Breadcrumb.Item icon={<IconHome />}></Breadcrumb.Item>
179
191
  <Breadcrumb.Item>breadcrumb</Breadcrumb.Item>
180
192
  <Breadcrumb.Item>default</Breadcrumb.Item>
181
193
  </Breadcrumb>
182
- <Breadcrumb separator={'>'} onClick={item => console.log(item)}>
194
+ <Breadcrumb aria-label='example-3' separator={'>'} onClick={item => console.log(item)}>
183
195
  <Breadcrumb.Item>home</Breadcrumb.Item>
184
196
  <Breadcrumb.Item href="#">breadcrumb</Breadcrumb.Item>
185
197
  <Breadcrumb.Item>separator</Breadcrumb.Item>
186
198
  </Breadcrumb>
187
- <Breadcrumb compact={true} onClick={item => console.log(item)}>
199
+ <Breadcrumb aria-label='example-4' compact={true} onClick={item => console.log(item)}>
188
200
  <Breadcrumb.Item>home</Breadcrumb.Item>
189
201
  <Breadcrumb.Item>breadcrumb</Breadcrumb.Item>
190
202
  <Breadcrumb.Item>compact</Breadcrumb.Item>
191
203
  </Breadcrumb>
192
- <Breadcrumb onClick={item => console.log(item)}>
204
+ <Breadcrumb aria-label='example-5' onClick={item => console.log(item)}>
193
205
  <Breadcrumb.Item>首页</Breadcrumb.Item>
194
206
  <Breadcrumb.Item>当这个页面标题很长时需要省略</Breadcrumb.Item>
195
207
  <Breadcrumb.Item>详情页</Breadcrumb.Item>
196
208
  </Breadcrumb>
197
- <Breadcrumb onClick={item => console.log(item)}>
209
+ <Breadcrumb aria-label='example-6' onClick={item => console.log(item)}>
198
210
  <Breadcrumb.Item>首页</Breadcrumb.Item>
199
211
  <Breadcrumb.Item>当层级很多的时候</Breadcrumb.Item>
200
212
  <Breadcrumb.Item>又一层很长需要省略的时候</Breadcrumb.Item>
@@ -209,14 +221,14 @@ export const BreadcrumbItemJSX = () => (
209
221
 
210
222
  export const Test = () => (
211
223
  <div>
212
- <Breadcrumb onClick={item => console.log(item)}>
224
+ <Breadcrumb aria-label='example-1' onClick={item => console.log(item)}>
213
225
  <Breadcrumb.Item onClick={item => console.log('child', item)}>home jump</Breadcrumb.Item>
214
226
  <Breadcrumb.Item href="#">breadcrumb</Breadcrumb.Item>
215
227
  <Breadcrumb.Item>
216
228
  <h1>default</h1>
217
229
  </Breadcrumb.Item>
218
230
  </Breadcrumb>
219
- <Breadcrumb>
231
+ <Breadcrumb aria-label='example-2'>
220
232
  <Breadcrumb.Item icon={<IconHome />}></Breadcrumb.Item>
221
233
  <Breadcrumb.Item icon={<IconArticle />}>
222
234
  <h5>breadcrumb</h5>
@@ -268,6 +280,7 @@ export const RenderMore = () => (
268
280
  }}
269
281
  >
270
282
  <Breadcrumb
283
+ aria-label='example-1'
271
284
  renderMore={restItem => renderMore(restItem)}
272
285
  onClick={(item, e) => console.log(item, e)}
273
286
  >
@@ -283,6 +296,7 @@ export const RenderMore = () => (
283
296
  <br />
284
297
  <div>
285
298
  <Breadcrumb
299
+ aria-label='example-2'
286
300
  renderMore={restItem => renderMore(restItem)}
287
301
  onClick={(item, e) => console.log(item, e)}
288
302
  routes={[
@@ -41,6 +41,7 @@ export interface BreadcrumbProps extends BaseProps {
41
41
  renderMore?: (restItem: Array<React.ReactNode>) => React.ReactNode;
42
42
  /* Style type for ellipsis area */
43
43
  moreType?: MoreType;
44
+ 'aria-label'?: React.AriaAttributes['aria-label'];
44
45
  }
45
46
 
46
47
  interface BreadcrumbState {
@@ -77,6 +78,7 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
77
78
 
78
79
  /* Type of ellipsis area */
79
80
  moreType: propTypes.oneOf(strings.MORE_TYPE),
81
+ 'aria-label': propTypes.string,
80
82
  };
81
83
  static defaultProps = {
82
84
  routes: [] as [],
@@ -91,6 +93,7 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
91
93
  autoCollapse: true,
92
94
  moreType: 'default',
93
95
  maxItemCount: 4,
96
+ 'aria-label': 'Breadcrumb'
94
97
  };
95
98
 
96
99
  constructor(props: BreadcrumbProps) {
@@ -164,8 +167,12 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
164
167
  <span className={`${clsPrefix}-collapse`} key={`more-${itemsLen}`}>
165
168
  <span className={`${clsPrefix}-item-wrap`}>
166
169
  <span
170
+ role='button'
171
+ tabIndex={0}
172
+ aria-label='Expand breadcrumb items'
167
173
  className={`${clsPrefix}-item ${clsPrefix}-item-more`}
168
174
  onClick={item => this.foundation.handleExpand(item)}
175
+ onKeyPress={e => this.foundation.handleExpandEnterPress(e)}
169
176
  >
170
177
  {hasRenderMore && renderMore(restItem)}
171
178
  {!hasRenderMore && moreType === 'default' && <IconMore />}
@@ -282,7 +289,7 @@ class Breadcrumb extends BaseComponent<BreadcrumbProps, BreadcrumbState> {
282
289
  separator,
283
290
  }}
284
291
  >
285
- <nav aria-label={`${clsPrefix}`} className={sizeCls} style={style}>
292
+ <nav aria-label={this.props['aria-label']} className={sizeCls} style={style}>
286
293
  {breadcrumbs}
287
294
  </nav>
288
295
  </BreadContext.Provider>
@@ -188,7 +188,7 @@ export default class BreadcrumbItem extends BaseComponent<BreadcrumbItemProps, B
188
188
  shouldRenderSeparator
189
189
  // children,
190
190
  } = this.props;
191
- const pageLabel = active ? {} : { 'aria-current': 'page' as const };
191
+ const pageLabel = active ? { 'aria-current': 'page' as const } : {} ;
192
192
  const item = this.renderItem();
193
193
  const separator = !active ?
194
194
  this.props.separator || <span className={`${clsPrefix}-separator`}>{this.context.separator}</span> :
package/button/Button.tsx CHANGED
@@ -33,6 +33,7 @@ export interface ButtonProps {
33
33
  onMouseDown?: React.MouseEventHandler<HTMLButtonElement>;
34
34
  onMouseEnter?: React.MouseEventHandler<HTMLButtonElement>;
35
35
  onMouseLeave?: React.MouseEventHandler<HTMLButtonElement>;
36
+ 'aria-label'?: React.AriaAttributes['aria-label'];
36
37
  }
37
38
 
38
39
  // TODO: icon configuration
@@ -68,6 +69,7 @@ export default class Button extends PureComponent<ButtonProps> {
68
69
  className: PropTypes.string,
69
70
  onMouseEnter: PropTypes.func,
70
71
  onMouseLeave: PropTypes.func,
72
+ 'aria-label': PropTypes.string,
71
73
  };
72
74
 
73
75
  render() {
@@ -107,6 +109,7 @@ export default class Button extends PureComponent<ButtonProps> {
107
109
  className
108
110
  ),
109
111
  type: htmlType,
112
+ 'aria-disabled': disabled,
110
113
  };
111
114
 
112
115
  return (
@@ -117,6 +120,7 @@ export default class Button extends PureComponent<ButtonProps> {
117
120
  onMouseDown={this.props.onMouseDown}
118
121
  style={style}
119
122
  >
123
+ {/* eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions */}
120
124
  <span className={`${prefixCls}-content`} onClick={e => disabled && e.stopPropagation()}>
121
125
  {children}
122
126
  </span>
@@ -29,7 +29,7 @@ describe('Button', () => {
29
29
 
30
30
  it(`test loading`, () => {
31
31
  const elem = mount(<Button icon={<IconEdit />} loading />);
32
- expect(elem.find(`#Artboard`).length).toBe(1);
32
+ expect(elem.find({ 'data-icon': 'spin' }).length).toBe(1);
33
33
  });
34
34
 
35
35
  it('test button type',()=>{