@douyinfe/semi-ui 2.2.2 → 2.3.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 (434) hide show
  1. package/_base/_story/a11y.jsx +6 -6
  2. package/_utils/hooks/usePrevFocus.ts +16 -0
  3. package/_utils/index.ts +4 -0
  4. package/anchor/_story/anchor.stories.js +1 -1
  5. package/anchor/index.tsx +5 -2
  6. package/anchor/link.tsx +29 -4
  7. package/autoComplete/index.tsx +28 -1
  8. package/avatar/_story/avatar.stories.js +4 -4
  9. package/avatar/avatarGroup.tsx +1 -1
  10. package/avatar/index.tsx +10 -4
  11. package/banner/index.tsx +2 -1
  12. package/breadcrumb/_story/breadcrumb.stories.js +22 -8
  13. package/breadcrumb/index.tsx +8 -1
  14. package/breadcrumb/item.tsx +1 -1
  15. package/button/Button.tsx +4 -0
  16. package/button/__test__/button.test.js +1 -1
  17. package/button/_story/button.stories.js +10 -10
  18. package/button/buttonGroup.tsx +4 -2
  19. package/button/splitButtonGroup.tsx +5 -2
  20. package/card/_story/card.stories.js +8 -1
  21. package/card/_story/card.stories.tsx +3 -0
  22. package/card/index.tsx +5 -2
  23. package/cascader/index.tsx +33 -5
  24. package/checkbox/_story/checkbox.stories.js +21 -14
  25. package/checkbox/checkbox.tsx +40 -5
  26. package/checkbox/checkboxGroup.tsx +30 -5
  27. package/checkbox/checkboxInner.tsx +25 -2
  28. package/collapse/index.tsx +2 -2
  29. package/collapse/item.tsx +15 -8
  30. package/collapsible/index.tsx +4 -2
  31. package/configProvider/_story/configProvider.stories.tsx +27 -0
  32. package/datePicker/datePicker.tsx +19 -0
  33. package/dist/css/semi.css +8 -3
  34. package/dist/css/semi.min.css +1 -1
  35. package/dist/umd/semi-ui.js +2470 -1242
  36. package/dist/umd/semi-ui.js.map +1 -1
  37. package/dist/umd/semi-ui.min.js +1 -1
  38. package/dist/umd/semi-ui.min.js.map +1 -1
  39. package/dropdown/dropdownItem.tsx +1 -1
  40. package/dropdown/dropdownMenu.tsx +1 -1
  41. package/empty/index.tsx +5 -5
  42. package/form/_story/FormApi/formApiDemo.jsx +3 -2
  43. package/form/_story/Validate/validateDemo.jsx +1 -1
  44. package/form/_story/demo.jsx +12 -3
  45. package/form/_story/form.stories.js +0 -7
  46. package/form/baseForm.tsx +2 -0
  47. package/form/errorMessage.tsx +13 -2
  48. package/form/hoc/withField.tsx +37 -8
  49. package/form/index.tsx +0 -2
  50. package/form/interface.ts +2 -0
  51. package/form/label.tsx +4 -2
  52. package/input/index.tsx +49 -4
  53. package/input/inputGroup.tsx +9 -4
  54. package/input/textarea.tsx +25 -6
  55. package/inputNumber/index.tsx +28 -1
  56. package/layout/Sider.tsx +6 -2
  57. package/layout/index.tsx +4 -3
  58. package/lib/cjs/_utils/hooks/usePrevFocus.d.ts +2 -0
  59. package/lib/cjs/_utils/hooks/usePrevFocus.js +30 -0
  60. package/lib/cjs/_utils/index.d.ts +1 -0
  61. package/lib/cjs/_utils/index.js +6 -1
  62. package/lib/cjs/anchor/index.d.ts +2 -0
  63. package/lib/cjs/anchor/index.js +6 -1
  64. package/lib/cjs/anchor/link.d.ts +4 -1
  65. package/lib/cjs/anchor/link.js +39 -5
  66. package/lib/cjs/autoComplete/index.d.ts +17 -0
  67. package/lib/cjs/autoComplete/index.js +21 -2
  68. package/lib/cjs/avatar/avatarGroup.js +2 -1
  69. package/lib/cjs/avatar/index.d.ts +4 -3
  70. package/lib/cjs/avatar/index.js +20 -11
  71. package/lib/cjs/banner/index.js +4 -2
  72. package/lib/cjs/breadcrumb/index.d.ts +3 -0
  73. package/lib/cjs/breadcrumb/index.js +10 -4
  74. package/lib/cjs/breadcrumb/item.js +2 -2
  75. package/lib/cjs/button/Button.d.ts +2 -0
  76. package/lib/cjs/button/Button.js +4 -2
  77. package/lib/cjs/button/buttonGroup.d.ts +3 -0
  78. package/lib/cjs/button/buttonGroup.js +8 -4
  79. package/lib/cjs/button/index.d.ts +1 -0
  80. package/lib/cjs/button/splitButtonGroup.d.ts +3 -0
  81. package/lib/cjs/button/splitButtonGroup.js +5 -2
  82. package/lib/cjs/card/index.d.ts +3 -0
  83. package/lib/cjs/card/index.js +3 -1
  84. package/lib/cjs/cascader/index.d.ts +14 -0
  85. package/lib/cjs/cascader/index.js +35 -7
  86. package/lib/cjs/checkbox/checkbox.d.ts +21 -1
  87. package/lib/cjs/checkbox/checkbox.js +51 -17
  88. package/lib/cjs/checkbox/checkboxGroup.d.ts +13 -1
  89. package/lib/cjs/checkbox/checkboxGroup.js +16 -3
  90. package/lib/cjs/checkbox/checkboxInner.d.ts +15 -0
  91. package/lib/cjs/checkbox/checkboxInner.js +20 -3
  92. package/lib/cjs/collapse/index.js +2 -1
  93. package/lib/cjs/collapse/item.d.ts +2 -1
  94. package/lib/cjs/collapse/item.js +17 -3
  95. package/lib/cjs/collapsible/index.d.ts +1 -0
  96. package/lib/cjs/collapsible/index.js +4 -2
  97. package/lib/cjs/datePicker/datePicker.d.ts +12 -0
  98. package/lib/cjs/datePicker/datePicker.js +14 -1
  99. package/lib/cjs/dropdown/dropdownItem.js +3 -1
  100. package/lib/cjs/dropdown/dropdownMenu.js +4 -1
  101. package/lib/cjs/empty/index.js +2 -1
  102. package/lib/cjs/form/baseForm.d.ts +9 -0
  103. package/lib/cjs/form/baseForm.js +3 -1
  104. package/lib/cjs/form/errorMessage.d.ts +4 -0
  105. package/lib/cjs/form/errorMessage.js +21 -3
  106. package/lib/cjs/form/field.d.ts +7 -0
  107. package/lib/cjs/form/hoc/withField.js +49 -16
  108. package/lib/cjs/form/index.d.ts +0 -1
  109. package/lib/cjs/form/interface.d.ts +2 -0
  110. package/lib/cjs/form/label.d.ts +2 -0
  111. package/lib/cjs/form/label.js +5 -2
  112. package/lib/cjs/input/index.d.ts +16 -0
  113. package/lib/cjs/input/index.js +51 -15
  114. package/lib/cjs/input/inputGroup.d.ts +2 -1
  115. package/lib/cjs/input/inputGroup.js +11 -1
  116. package/lib/cjs/input/textarea.js +12 -1
  117. package/lib/cjs/inputNumber/index.d.ts +8 -0
  118. package/lib/cjs/inputNumber/index.js +32 -2
  119. package/lib/cjs/layout/Sider.d.ts +4 -0
  120. package/lib/cjs/layout/Sider.js +4 -1
  121. package/lib/cjs/layout/index.js +2 -0
  122. package/lib/cjs/list/item.js +0 -1
  123. package/lib/cjs/modal/Modal.js +2 -0
  124. package/lib/cjs/modal/ModalContent.d.ts +3 -1
  125. package/lib/cjs/modal/ModalContent.js +47 -5
  126. package/lib/cjs/navigation/Item.d.ts +4 -2
  127. package/lib/cjs/navigation/Item.js +25 -5
  128. package/lib/cjs/navigation/SubNav.d.ts +4 -2
  129. package/lib/cjs/navigation/SubNav.js +8 -1
  130. package/lib/cjs/navigation/index.js +2 -0
  131. package/lib/cjs/notification/notice.d.ts +1 -1
  132. package/lib/cjs/notification/notice.js +32 -22
  133. package/lib/cjs/pagination/index.js +16 -6
  134. package/lib/cjs/popover/index.js +7 -3
  135. package/lib/cjs/progress/index.d.ts +8 -0
  136. package/lib/cjs/progress/index.js +42 -9
  137. package/lib/cjs/radio/radio.d.ts +6 -1
  138. package/lib/cjs/radio/radio.js +17 -5
  139. package/lib/cjs/radio/radioGroup.d.ts +16 -1
  140. package/lib/cjs/radio/radioGroup.js +18 -3
  141. package/lib/cjs/radio/radioInner.d.ts +6 -1
  142. package/lib/cjs/radio/radioInner.js +11 -3
  143. package/lib/cjs/rating/index.d.ts +14 -0
  144. package/lib/cjs/rating/index.js +14 -3
  145. package/lib/cjs/rating/item.d.ts +2 -0
  146. package/lib/cjs/rating/item.js +6 -1
  147. package/lib/cjs/select/index.d.ts +16 -0
  148. package/lib/cjs/select/index.js +65 -19
  149. package/lib/cjs/select/option.js +28 -22
  150. package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
  151. package/lib/cjs/sideSheet/SideSheetContent.js +12 -5
  152. package/lib/cjs/sideSheet/index.d.ts +1 -0
  153. package/lib/cjs/sideSheet/index.js +2 -1
  154. package/lib/cjs/slider/index.d.ts +2 -1
  155. package/lib/cjs/slider/index.js +64 -17
  156. package/lib/cjs/spin/icon.js +2 -4
  157. package/lib/cjs/steps/basicStep.d.ts +3 -0
  158. package/lib/cjs/steps/basicStep.js +23 -25
  159. package/lib/cjs/steps/basicSteps.d.ts +1 -0
  160. package/lib/cjs/steps/basicSteps.js +2 -1
  161. package/lib/cjs/steps/fillStep.d.ts +3 -0
  162. package/lib/cjs/steps/fillStep.js +19 -4
  163. package/lib/cjs/steps/fillSteps.d.ts +1 -0
  164. package/lib/cjs/steps/fillSteps.js +2 -1
  165. package/lib/cjs/steps/navStep.d.ts +3 -0
  166. package/lib/cjs/steps/navStep.js +22 -25
  167. package/lib/cjs/steps/navSteps.d.ts +1 -0
  168. package/lib/cjs/steps/navSteps.js +2 -1
  169. package/lib/cjs/switch/index.d.ts +12 -0
  170. package/lib/cjs/switch/index.js +19 -4
  171. package/lib/cjs/table/Body/BaseRow.js +35 -3
  172. package/lib/cjs/table/Body/index.js +9 -1
  173. package/lib/cjs/table/ColumnFilter.js +4 -0
  174. package/lib/cjs/table/ColumnSelection.d.ts +3 -0
  175. package/lib/cjs/table/ColumnSelection.js +6 -2
  176. package/lib/cjs/table/ColumnSorter.js +19 -3
  177. package/lib/cjs/table/CustomExpandIcon.js +7 -1
  178. package/lib/cjs/table/Table.d.ts +2 -0
  179. package/lib/cjs/table/Table.js +31 -15
  180. package/lib/cjs/table/TableCell.d.ts +2 -0
  181. package/lib/cjs/table/TableCell.js +6 -2
  182. package/lib/cjs/table/TableHeaderRow.js +8 -2
  183. package/lib/cjs/tabs/TabBar.js +11 -3
  184. package/lib/cjs/tabs/TabPane.js +3 -1
  185. package/lib/cjs/tabs/index.js +0 -1
  186. package/lib/cjs/tagInput/index.d.ts +4 -1
  187. package/lib/cjs/tagInput/index.js +29 -3
  188. package/lib/cjs/timePicker/TimePicker.d.ts +12 -0
  189. package/lib/cjs/timePicker/TimePicker.js +9 -1
  190. package/lib/cjs/timePicker/index.d.ts +6 -0
  191. package/lib/cjs/timeline/index.d.ts +1 -1
  192. package/lib/cjs/timeline/index.js +1 -0
  193. package/lib/cjs/timeline/item.js +4 -2
  194. package/lib/cjs/toast/toast.js +2 -0
  195. package/lib/cjs/tooltip/TriangleArrow.js +1 -0
  196. package/lib/cjs/tooltip/TriangleArrowVertical.js +1 -0
  197. package/lib/cjs/tooltip/index.d.ts +16 -12
  198. package/lib/cjs/tooltip/index.js +55 -39
  199. package/lib/cjs/transfer/index.js +32 -14
  200. package/lib/cjs/tree/index.d.ts +1 -0
  201. package/lib/cjs/tree/index.js +15 -6
  202. package/lib/cjs/tree/treeNode.d.ts +12 -4
  203. package/lib/cjs/tree/treeNode.js +44 -4
  204. package/lib/cjs/treeSelect/index.d.ts +16 -0
  205. package/lib/cjs/treeSelect/index.js +60 -12
  206. package/lib/cjs/typography/base.js +18 -7
  207. package/lib/cjs/typography/copyable.js +6 -1
  208. package/lib/cjs/upload/fileCard.js +23 -4
  209. package/lib/cjs/upload/index.js +19 -4
  210. package/lib/es/_utils/hooks/usePrevFocus.d.ts +2 -0
  211. package/lib/es/_utils/hooks/usePrevFocus.js +15 -0
  212. package/lib/es/_utils/index.d.ts +1 -0
  213. package/lib/es/_utils/index.js +4 -1
  214. package/lib/es/anchor/index.d.ts +2 -0
  215. package/lib/es/anchor/index.js +6 -1
  216. package/lib/es/anchor/link.d.ts +4 -1
  217. package/lib/es/anchor/link.js +38 -5
  218. package/lib/es/autoComplete/index.d.ts +17 -0
  219. package/lib/es/autoComplete/index.js +21 -2
  220. package/lib/es/avatar/avatarGroup.js +2 -1
  221. package/lib/es/avatar/index.d.ts +4 -3
  222. package/lib/es/avatar/index.js +20 -11
  223. package/lib/es/banner/index.js +4 -2
  224. package/lib/es/breadcrumb/index.d.ts +3 -0
  225. package/lib/es/breadcrumb/index.js +10 -4
  226. package/lib/es/breadcrumb/item.js +2 -2
  227. package/lib/es/button/Button.d.ts +2 -0
  228. package/lib/es/button/Button.js +4 -2
  229. package/lib/es/button/buttonGroup.d.ts +3 -0
  230. package/lib/es/button/buttonGroup.js +8 -4
  231. package/lib/es/button/index.d.ts +1 -0
  232. package/lib/es/button/splitButtonGroup.d.ts +3 -0
  233. package/lib/es/button/splitButtonGroup.js +5 -2
  234. package/lib/es/card/index.d.ts +3 -0
  235. package/lib/es/card/index.js +3 -1
  236. package/lib/es/cascader/index.d.ts +14 -0
  237. package/lib/es/cascader/index.js +35 -7
  238. package/lib/es/checkbox/checkbox.d.ts +21 -1
  239. package/lib/es/checkbox/checkbox.js +50 -17
  240. package/lib/es/checkbox/checkboxGroup.d.ts +13 -1
  241. package/lib/es/checkbox/checkboxGroup.js +18 -5
  242. package/lib/es/checkbox/checkboxInner.d.ts +15 -0
  243. package/lib/es/checkbox/checkboxInner.js +20 -3
  244. package/lib/es/collapse/index.js +2 -1
  245. package/lib/es/collapse/item.d.ts +2 -1
  246. package/lib/es/collapse/item.js +16 -3
  247. package/lib/es/collapsible/index.d.ts +1 -0
  248. package/lib/es/collapsible/index.js +4 -2
  249. package/lib/es/datePicker/datePicker.d.ts +12 -0
  250. package/lib/es/datePicker/datePicker.js +14 -1
  251. package/lib/es/dropdown/dropdownItem.js +3 -1
  252. package/lib/es/dropdown/dropdownMenu.js +4 -1
  253. package/lib/es/empty/index.js +2 -1
  254. package/lib/es/form/baseForm.d.ts +9 -0
  255. package/lib/es/form/baseForm.js +3 -1
  256. package/lib/es/form/errorMessage.d.ts +4 -0
  257. package/lib/es/form/errorMessage.js +21 -3
  258. package/lib/es/form/field.d.ts +7 -0
  259. package/lib/es/form/hoc/withField.js +48 -15
  260. package/lib/es/form/index.d.ts +0 -1
  261. package/lib/es/form/index.js +0 -1
  262. package/lib/es/form/interface.d.ts +2 -0
  263. package/lib/es/form/label.d.ts +2 -0
  264. package/lib/es/form/label.js +5 -2
  265. package/lib/es/input/index.d.ts +16 -0
  266. package/lib/es/input/index.js +51 -15
  267. package/lib/es/input/inputGroup.d.ts +2 -1
  268. package/lib/es/input/inputGroup.js +11 -1
  269. package/lib/es/input/textarea.js +12 -1
  270. package/lib/es/inputNumber/index.d.ts +8 -0
  271. package/lib/es/inputNumber/index.js +33 -2
  272. package/lib/es/layout/Sider.d.ts +4 -0
  273. package/lib/es/layout/Sider.js +4 -1
  274. package/lib/es/layout/index.js +2 -0
  275. package/lib/es/list/item.js +0 -1
  276. package/lib/es/modal/Modal.js +2 -0
  277. package/lib/es/modal/ModalContent.d.ts +3 -1
  278. package/lib/es/modal/ModalContent.js +46 -5
  279. package/lib/es/navigation/Item.d.ts +4 -2
  280. package/lib/es/navigation/Item.js +25 -5
  281. package/lib/es/navigation/SubNav.d.ts +4 -2
  282. package/lib/es/navigation/SubNav.js +8 -1
  283. package/lib/es/navigation/index.js +2 -0
  284. package/lib/es/notification/notice.d.ts +1 -1
  285. package/lib/es/notification/notice.js +33 -24
  286. package/lib/es/pagination/index.js +16 -6
  287. package/lib/es/popover/index.js +7 -3
  288. package/lib/es/progress/index.d.ts +8 -0
  289. package/lib/es/progress/index.js +42 -9
  290. package/lib/es/radio/radio.d.ts +6 -1
  291. package/lib/es/radio/radio.js +16 -5
  292. package/lib/es/radio/radioGroup.d.ts +16 -1
  293. package/lib/es/radio/radioGroup.js +18 -3
  294. package/lib/es/radio/radioInner.d.ts +6 -1
  295. package/lib/es/radio/radioInner.js +11 -3
  296. package/lib/es/rating/index.d.ts +14 -0
  297. package/lib/es/rating/index.js +14 -3
  298. package/lib/es/rating/item.d.ts +2 -0
  299. package/lib/es/rating/item.js +6 -1
  300. package/lib/es/select/index.d.ts +16 -0
  301. package/lib/es/select/index.js +63 -17
  302. package/lib/es/select/option.js +28 -22
  303. package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
  304. package/lib/es/sideSheet/SideSheetContent.js +12 -5
  305. package/lib/es/sideSheet/index.d.ts +1 -0
  306. package/lib/es/sideSheet/index.js +2 -1
  307. package/lib/es/slider/index.d.ts +2 -1
  308. package/lib/es/slider/index.js +63 -16
  309. package/lib/es/spin/icon.js +2 -4
  310. package/lib/es/steps/basicStep.d.ts +3 -0
  311. package/lib/es/steps/basicStep.js +23 -23
  312. package/lib/es/steps/basicSteps.d.ts +1 -0
  313. package/lib/es/steps/basicSteps.js +2 -1
  314. package/lib/es/steps/fillStep.d.ts +3 -0
  315. package/lib/es/steps/fillStep.js +19 -4
  316. package/lib/es/steps/fillSteps.d.ts +1 -0
  317. package/lib/es/steps/fillSteps.js +2 -1
  318. package/lib/es/steps/navStep.d.ts +3 -0
  319. package/lib/es/steps/navStep.js +22 -23
  320. package/lib/es/steps/navSteps.d.ts +1 -0
  321. package/lib/es/steps/navSteps.js +2 -1
  322. package/lib/es/switch/index.d.ts +12 -0
  323. package/lib/es/switch/index.js +19 -4
  324. package/lib/es/table/Body/BaseRow.js +35 -3
  325. package/lib/es/table/Body/index.js +9 -2
  326. package/lib/es/table/ColumnFilter.js +4 -0
  327. package/lib/es/table/ColumnSelection.d.ts +3 -0
  328. package/lib/es/table/ColumnSelection.js +6 -2
  329. package/lib/es/table/ColumnSorter.js +17 -3
  330. package/lib/es/table/CustomExpandIcon.js +6 -1
  331. package/lib/es/table/Table.d.ts +2 -0
  332. package/lib/es/table/Table.js +31 -15
  333. package/lib/es/table/TableCell.d.ts +2 -0
  334. package/lib/es/table/TableCell.js +6 -2
  335. package/lib/es/table/TableHeaderRow.js +8 -2
  336. package/lib/es/tabs/TabBar.js +11 -3
  337. package/lib/es/tabs/TabPane.js +3 -1
  338. package/lib/es/tabs/index.js +0 -1
  339. package/lib/es/tagInput/index.d.ts +4 -1
  340. package/lib/es/tagInput/index.js +29 -3
  341. package/lib/es/timePicker/TimePicker.d.ts +12 -0
  342. package/lib/es/timePicker/TimePicker.js +9 -1
  343. package/lib/es/timePicker/index.d.ts +6 -0
  344. package/lib/es/timeline/index.d.ts +1 -1
  345. package/lib/es/timeline/index.js +1 -0
  346. package/lib/es/timeline/item.js +4 -2
  347. package/lib/es/toast/toast.js +2 -0
  348. package/lib/es/tooltip/TriangleArrow.js +1 -0
  349. package/lib/es/tooltip/TriangleArrowVertical.js +1 -0
  350. package/lib/es/tooltip/index.d.ts +16 -12
  351. package/lib/es/tooltip/index.js +53 -39
  352. package/lib/es/transfer/index.js +32 -14
  353. package/lib/es/tree/index.d.ts +1 -0
  354. package/lib/es/tree/index.js +15 -6
  355. package/lib/es/tree/treeNode.d.ts +12 -4
  356. package/lib/es/tree/treeNode.js +44 -4
  357. package/lib/es/treeSelect/index.d.ts +16 -0
  358. package/lib/es/treeSelect/index.js +57 -10
  359. package/lib/es/typography/base.js +17 -7
  360. package/lib/es/typography/copyable.js +5 -1
  361. package/lib/es/upload/fileCard.js +23 -4
  362. package/lib/es/upload/index.js +19 -4
  363. package/list/item.tsx +0 -1
  364. package/modal/Modal.tsx +2 -0
  365. package/modal/ModalContent.tsx +35 -5
  366. package/navigation/Item.tsx +15 -0
  367. package/navigation/SubNav.tsx +13 -1
  368. package/navigation/index.tsx +1 -1
  369. package/notification/notice.tsx +19 -14
  370. package/package.json +8 -8
  371. package/pagination/index.tsx +9 -5
  372. package/popover/index.tsx +5 -0
  373. package/progress/_story/progress.stories.js +18 -18
  374. package/progress/index.tsx +58 -20
  375. package/radio/radio.tsx +12 -2
  376. package/radio/radioGroup.tsx +29 -3
  377. package/radio/radioInner.tsx +10 -1
  378. package/rating/index.tsx +19 -2
  379. package/rating/item.tsx +6 -0
  380. package/select/__test__/select.test.js +45 -0
  381. package/select/_story/select.stories.js +29 -0
  382. package/select/index.tsx +52 -4
  383. package/select/option.tsx +3 -0
  384. package/sideSheet/SideSheetContent.tsx +13 -9
  385. package/sideSheet/index.tsx +3 -2
  386. package/slider/__test__/slider.test.js +9 -0
  387. package/slider/_story/slider.stories.js +1 -1
  388. package/slider/index.tsx +44 -7
  389. package/spin/icon.tsx +3 -3
  390. package/steps/basicStep.tsx +15 -4
  391. package/steps/basicSteps.tsx +3 -2
  392. package/steps/fillStep.tsx +27 -12
  393. package/steps/fillSteps.tsx +2 -0
  394. package/steps/navStep.tsx +15 -4
  395. package/steps/navSteps.tsx +3 -2
  396. package/switch/_story/switch.stories.js +20 -19
  397. package/switch/_story/switch.stories.tsx +13 -13
  398. package/switch/index.tsx +23 -5
  399. package/table/Body/BaseRow.tsx +25 -1
  400. package/table/Body/index.tsx +7 -2
  401. package/table/ColumnFilter.tsx +7 -1
  402. package/table/ColumnSelection.tsx +4 -1
  403. package/table/ColumnSorter.tsx +18 -1
  404. package/table/CustomExpandIcon.tsx +5 -0
  405. package/table/Table.tsx +26 -13
  406. package/table/TableCell.tsx +11 -1
  407. package/table/TableHeaderRow.tsx +16 -2
  408. package/table/__test__/table.test.js +46 -0
  409. package/tabs/TabBar.tsx +8 -5
  410. package/tabs/TabPane.tsx +3 -1
  411. package/tabs/index.tsx +0 -1
  412. package/tagInput/__test__/tagInput.test.js +46 -0
  413. package/tagInput/_story/tagInput.stories.js +2 -2
  414. package/tagInput/index.tsx +31 -8
  415. package/timePicker/TimePicker.tsx +14 -1
  416. package/timeline/_story/timeline.stories.js +1 -1
  417. package/timeline/index.tsx +2 -2
  418. package/timeline/item.tsx +2 -1
  419. package/toast/toast.tsx +2 -0
  420. package/tooltip/TriangleArrow.tsx +1 -1
  421. package/tooltip/TriangleArrowVertical.tsx +1 -1
  422. package/tooltip/_story/tooltip.stories.js +562 -514
  423. package/tooltip/index.tsx +50 -33
  424. package/transfer/index.tsx +29 -25
  425. package/tree/_story/tree.stories.js +3 -3
  426. package/tree/index.tsx +10 -2
  427. package/tree/treeNode.tsx +46 -10
  428. package/treeSelect/__test__/treeMultiple.test.js +5 -0
  429. package/treeSelect/_story/treeSelect.stories.js +12 -0
  430. package/treeSelect/index.tsx +58 -7
  431. package/typography/base.tsx +7 -1
  432. package/typography/copyable.tsx +10 -1
  433. package/upload/fileCard.tsx +13 -15
  434. package/upload/index.tsx +10 -6
@@ -92,7 +92,7 @@ class DropdownItem extends BaseComponent<DropdownItemProps> {
92
92
  );
93
93
  }
94
94
  return (
95
- <li {...events} ref={ref => forwardRef(ref)} className={itemclass} style={style}>
95
+ <li role="menuitem" {...events} ref={ref => forwardRef(ref)} className={itemclass} style={style}>
96
96
  {tick}
97
97
  {iconContent}
98
98
  {children}
@@ -18,7 +18,7 @@ class DropdownMenu extends BaseComponent<DropdownMenuProps> {
18
18
  render() {
19
19
  const { children, className, style, ...rest } = this.props;
20
20
  return (
21
- <ul {...rest} className={classnames(`${prefixCls}-menu`, className)} style={style}>
21
+ <ul role="menu" aria-orientation="vertical" {...rest} className={classnames(`${prefixCls}-menu`, className)} style={style}>
22
22
  {children}
23
23
  </ul>
24
24
  );
package/empty/index.tsx CHANGED
@@ -108,17 +108,17 @@ export default class Empty extends BaseComponent<EmptyProps, EmptyState> {
108
108
  style: { fontWeight: 400 },
109
109
  };
110
110
  return (
111
- <div className={wrapperCls} style={style}>
112
- <div className={`${prefixCls}-image`} style={imageStyle}>
111
+ <div className={wrapperCls} style={style} aria-label="empty placeholder image">
112
+ <div className={`${prefixCls}-image`} style={imageStyle} >
113
113
  {imageNode}
114
114
  </div>
115
- <div className={`${prefixCls}-content`}>
115
+ <div className={`${prefixCls}-content`} >
116
116
  {title ? (
117
- <Typography.Title {...(titleProps as any)} className={`${prefixCls}-title`}>
117
+ <Typography.Title {...(titleProps as any)} className={`${prefixCls}-title`} >
118
118
  {title}
119
119
  </Typography.Title>
120
120
  ) : null}
121
- {description ? <div className={`${prefixCls}-description`}>{description}</div> : null}
121
+ {description ? <div className={`${prefixCls}-description`} >{description}</div> : null}
122
122
  {children ? <div className={`${prefixCls}-footer`}>{children}</div> : null}
123
123
  </div>
124
124
  </div>
@@ -17,6 +17,7 @@ import {
17
17
  } from '../../../index';
18
18
  const { Input, Select, DatePicker, Switch, Slider, CheckboxGroup, Checkbox, RadioGroup, Radio, TimePicker, InputNumber, InputGroup } = Form;
19
19
 
20
+ import { IconPlusCircle, IconMinusCircle } from '@douyinfe/semi-icons';
20
21
 
21
22
  const SetValueUsingParentPath = () => {
22
23
  const { Option } = Form.Select;
@@ -51,7 +52,7 @@ const SetValueUsingParentPath = () => {
51
52
  <React.Fragment>
52
53
  <Button onClick={add} icon="plus_circle" theme="light">新增空白行</Button>
53
54
  <Button
54
- icon="plus_circle" onClick={() => {
55
+ icon={<IconPlusCircle></IconPlusCircle>} onClick={() => {
55
56
  addWithInitValue({ name: '自定义贴纸', type: '2D' });
56
57
  }} style={{ marginLeft: 8 }}>新增带有初始值的行
57
58
  </Button>
@@ -68,7 +69,7 @@ const SetValueUsingParentPath = () => {
68
69
  label={`素材类型:(${field}.type)`}
69
70
  style={{ width: 90 }}
70
71
  />
71
- <Button type="danger" theme="borderless" icon="minus_circle" onClick={remove} style={{ margin: 12 }} />
72
+ <Button type="danger" theme="borderless" icon={<IconMinusCircle></IconMinusCircle>} onClick={remove} style={{ margin: 12 }} />
72
73
  </div>
73
74
  ))
74
75
  }
@@ -201,7 +201,7 @@ class PartValidAndResetDemo extends Component {
201
201
  }
202
202
 
203
203
  render() {
204
- let options = ['a', 'b', 'c', 'd'].map(item => ({ label: item, value: item }));
204
+ let options = ['a', 'b', 'c', 'd', 'b.name'].map(item => ({ label: item, value: item }));
205
205
  return (
206
206
  <Form getFormApi={this.getFormApi} autoScrollToError>
207
207
  <Input field="a[1]" validate={this.validate} trigger="blur" />
@@ -196,6 +196,8 @@ class BasicDemoWithInit extends Component {
196
196
  onValueChange={(v)=>console.log(v)}
197
197
  style={{ padding: '10px', width: 600 }}
198
198
  autoScrollToError
199
+ aria-label='Demo Form'
200
+ id='demo-form-id'
199
201
  >
200
202
  <Form.Section text={'基本信息'}>
201
203
  <Row>
@@ -265,13 +267,20 @@ class BasicDemoWithInit extends Component {
265
267
  <Row>
266
268
  <Col span={12}>
267
269
  <Form.TimePicker
268
- treeData={treeData}
269
270
  field='time'
271
+ helpText='原则上应当在 9:00 - 18:00 之间'
270
272
  label='时间选择'
271
273
  >
272
- </Form.TimePicker>
274
+ </Form.TimePicker>
275
+ </Col>
276
+ <Col span={12}>
277
+ <Form.AutoComplete
278
+ field='typeData'
279
+ label='类型选择'
280
+ data={['1', '2' , '3']}
281
+ >
282
+ </Form.AutoComplete>
273
283
  </Col>
274
-
275
284
  </Row>
276
285
  </Form.Section>
277
286
  <Form.Section text='资源详情'>
@@ -54,7 +54,6 @@ import { AssistComponent } from './Layout/slotDemo';
54
54
  import { ModalFormDemo } from './Layout/modalFormDemo';
55
55
 
56
56
  import { WithFieldDemo, CustomFieldDemo, NumberRange } from './HOC/withFieldDemo';
57
- import { WithDisplayName } from './HOC/displayName';
58
57
  import {
59
58
  CustomValidateDemo,
60
59
  ValidateFieldsDemo,
@@ -426,12 +425,6 @@ DebugRerenderTwice.story = {
426
425
  name: 'Debug-RerenderTwice',
427
426
  };
428
427
 
429
- export const FieldDisplayName = () => <WithDisplayName attr="form" />;
430
-
431
- FieldDisplayName.story = {
432
- name: 'Field displayName',
433
- };
434
-
435
428
  export const _ChildDidMount = () => <ChildDidMount />;
436
429
 
437
430
  _ChildDidMount.story = {
package/form/baseForm.tsx CHANGED
@@ -49,6 +49,7 @@ interface BaseFormState {
49
49
  }
50
50
  class Form extends BaseComponent<BaseFormProps, BaseFormState> {
51
51
  static propTypes = {
52
+ 'aria-label': PropTypes.string,
52
53
  onSubmit: PropTypes.func,
53
54
  onSubmitFail: PropTypes.func,
54
55
  /* Triggered from update, including field mount/unmount/value change/blur/verification status change/error prompt change, input parameter is formState, currentField */
@@ -74,6 +75,7 @@ class Form extends BaseComponent<BaseFormProps, BaseFormState> {
74
75
  disabled: PropTypes.bool,
75
76
  showValidateIcon: PropTypes.bool,
76
77
  extraTextPosition: PropTypes.oneOf(strings.EXTRA_POS),
78
+ id: PropTypes.string,
77
79
  };
78
80
 
79
81
  static defaultProps = {
@@ -17,6 +17,8 @@ export interface ErrorMessageProps {
17
17
  validateStatus?: string;
18
18
  helpText?: React.ReactNode;
19
19
  isInInputGroup?: boolean;
20
+ errorMessageId?: string;
21
+ helpTextId?: string;
20
22
  }
21
23
 
22
24
  export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
@@ -28,14 +30,23 @@ export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
28
30
  showValidateIcon: PropTypes.bool,
29
31
  helpText: PropTypes.node,
30
32
  isInInputGroup: PropTypes.bool,
33
+ // internal props
34
+ errorMessageId: PropTypes.string,
35
+ helpTextId: PropTypes.string,
31
36
  };
32
37
 
33
38
  generatorText(error: ReactFieldError) {
39
+ const { helpTextId, errorMessageId } = this.props;
40
+ const propsError = this.props.error;
41
+ let id = errorMessageId;
42
+ if (!propsError) {
43
+ id = helpTextId;
44
+ }
34
45
  if (typeof error === 'string') {
35
- return <span>{error}</span>;
46
+ return <span id={id}>{error}</span>;
36
47
  } else if (Array.isArray(error)) {
37
48
  const err = error.filter(e => e);
38
- return err.length ? <span>{err.join(', ')}</span> : null;
49
+ return err.length ? <span id={id}>{err.join(', ')}</span> : null;
39
50
  } else if (React.isValidElement(error)) {
40
51
  return error;
41
52
  }
@@ -63,6 +63,7 @@ function withField<
63
63
  extraText,
64
64
  extraTextPosition,
65
65
  pure,
66
+ id,
66
67
  rest,
67
68
  } = mergeProps(props);
68
69
  let { options, shouldInject } = mergeOptions(opts, props);
@@ -406,11 +407,27 @@ function withField<
406
407
  let mergeWrapperCol = wrapperCol || formProps.wrapperCol;
407
408
  let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom';
408
409
 
410
+ // id attribute to improve a11y
411
+ const a11yId = id ? id : field;
412
+ const labelId = `${a11yId}-label`;
413
+ const helpTextId = `${a11yId}-helpText`;
414
+ const extraTextId = `${a11yId}-extraText`;
415
+ const errorMessageId = `${a11yId}-errormessage`;
416
+
409
417
  let FieldComponent = (() => {
410
418
  // prefer to use validateStatus which pass by user throught props
411
419
  let blockStatus = validateStatus ? validateStatus : status;
412
420
 
421
+ const extraCls = classNames(`${prefix}-field-extra`, {
422
+ [`${prefix}-field-extra-string`]: typeof extraText === 'string',
423
+ [`${prefix}-field-extra-middle`]: mergeExtraPos === 'middle',
424
+ [`${prefix}-field-extra-botttom`]: mergeExtraPos === 'bottom',
425
+ });
426
+
427
+ const extraContent = extraText ? <div className={extraCls} id={extraTextId}>{extraText}</div> : null;
428
+
413
429
  let newProps: Record<string, any> = {
430
+ id: a11yId,
414
431
  disabled: formProps.disabled,
415
432
  ...rest,
416
433
  ref,
@@ -418,8 +435,23 @@ function withField<
418
435
  [options.onKeyChangeFnName]: handleChange,
419
436
  [options.valueKey]: value,
420
437
  validateStatus: blockStatus,
438
+ 'aria-required': required,
439
+ 'aria-labelledby': labelId,
421
440
  };
422
441
 
442
+ if (helpText) {
443
+ newProps['aria-describedby'] = extraText ? `${helpTextId} ${extraTextId}` : helpTextId;
444
+ }
445
+
446
+ if (extraText) {
447
+ newProps['aria-describedby'] = helpText ? `${helpTextId} ${extraTextId}` : extraTextId;
448
+ }
449
+
450
+ if (status === 'error') {
451
+ newProps['aria-errormessage'] = errorMessageId;
452
+ newProps['aria-invalid'] = true;
453
+ }
454
+
423
455
  const fieldCls = classNames({
424
456
  [`${prefix}-field`]: true,
425
457
  [`${prefix}-field-${name}`]: Boolean(name),
@@ -431,8 +463,10 @@ function withField<
431
463
 
432
464
  if (mergeLabelPos === 'inset' && !noLabel) {
433
465
  newProps.insetLabel = label || field;
466
+ newProps.insetLabelId = labelId;
434
467
  if (typeof label === 'object' && !isElement(label)) {
435
468
  newProps.insetLabel = label.text;
469
+ newProps.insetLabelId = labelId;
436
470
  }
437
471
  }
438
472
 
@@ -463,6 +497,7 @@ function withField<
463
497
  labelContent = (
464
498
  <Label
465
499
  text={label || field}
500
+ id={labelId}
466
501
  required={required}
467
502
  name={name || field}
468
503
  width={mergeLabelWidth}
@@ -472,14 +507,6 @@ function withField<
472
507
  );
473
508
  }
474
509
 
475
- const extraCls = classNames(`${prefix}-field-extra`, {
476
- [`${prefix}-field-extra-string`]: typeof extraText === 'string',
477
- [`${prefix}-field-extra-middle`]: mergeExtraPos === 'middle',
478
- [`${prefix}-field-extra-botttom`]: mergeExtraPos === 'bottom',
479
- });
480
-
481
- const extraContent = extraText ? <div className={extraCls}>{extraText}</div> : null;
482
-
483
510
  const fieldMainContent = (
484
511
  <div className={fieldMaincls}>
485
512
  {mergeExtraPos === 'middle' ? extraContent : null}
@@ -489,6 +516,8 @@ function withField<
489
516
  error={error}
490
517
  validateStatus={blockStatus}
491
518
  helpText={helpText}
519
+ helpTextId={helpTextId}
520
+ errorMessageId={errorMessageId}
492
521
  showValidateIcon={formProps.showValidateIcon}
493
522
  />
494
523
  ) : null}
package/form/index.tsx CHANGED
@@ -19,8 +19,6 @@ import withField from './hoc/withField';
19
19
  import withFormState from './hoc/withFormState';
20
20
  import withFormApi from './hoc/withFormApi';
21
21
 
22
- export * from './interface';
23
-
24
22
  export {
25
23
  Form,
26
24
  ArrayField,
package/form/interface.ts CHANGED
@@ -103,6 +103,7 @@ interface setValuesConfig {
103
103
  }
104
104
 
105
105
  export interface BaseFormProps {
106
+ 'aria-label'?: React.AriaAttributes['aria-label'];
106
107
  onSubmit?: (values: Record<string, any>) => void;
107
108
  onSubmitFail?: (errors: Record<string, FieldError>, values: any) => void;
108
109
  onReset?: () => void;
@@ -111,6 +112,7 @@ export interface BaseFormProps {
111
112
  validateFields?: (values: Record<string, any>) => string | Record<string, any>;
112
113
  /** Use this if you want to populate the form with initial values. */
113
114
  initValues?: Record<string, any>;
115
+ id?: string;
114
116
  /** getFormApi will be call once when Form mounted, u can save formApi reference in your component */
115
117
  getFormApi?: (formApi: FormApi) => void;
116
118
  style?: React.CSSProperties;
package/form/label.tsx CHANGED
@@ -6,6 +6,7 @@ import { cssClasses } from '@douyinfe/semi-foundation/form/constants';
6
6
  const prefixCls = cssClasses.PREFIX;
7
7
 
8
8
  export interface LabelProps {
9
+ id?: string;
9
10
  /** Whether to display the required * symbol */
10
11
  required?: boolean;
11
12
  /** Content of label */
@@ -31,6 +32,7 @@ export default class Label extends PureComponent<LabelProps> {
31
32
  };
32
33
 
33
34
  static propTypes = {
35
+ id: PropTypes.string,
34
36
  children: PropTypes.node,
35
37
  required: PropTypes.bool,
36
38
  text: PropTypes.node,
@@ -44,7 +46,7 @@ export default class Label extends PureComponent<LabelProps> {
44
46
  };
45
47
 
46
48
  render() {
47
- const { children, required, text, disabled, name, width, align, style, className, extra } = this.props;
49
+ const { children, required, text, disabled, name, width, align, style, className, extra, id } = this.props;
48
50
 
49
51
  const labelCls = classNames(className, {
50
52
  [`${prefixCls}-field-label`]: true,
@@ -71,7 +73,7 @@ export default class Label extends PureComponent<LabelProps> {
71
73
  );
72
74
 
73
75
  return (
74
- <label className={labelCls} htmlFor={name} style={labelStyle}>
76
+ <label className={labelCls} htmlFor={name} style={labelStyle} id={id}>
75
77
  {extra ? contentWithExtra : textContent}
76
78
  </label>
77
79
  );
package/input/index.tsx CHANGED
@@ -26,6 +26,12 @@ export type ValidateStatus = "default" | "error" | "warning" | "success";
26
26
 
27
27
  export interface InputProps extends
28
28
  Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'prefix' | 'size' | 'autoFocus' | 'placeholder' | 'onFocus' | 'onBlur'> {
29
+ 'aria-label'?: React.AriaAttributes['aria-label'];
30
+ 'aria-describedby'?: React.AriaAttributes['aria-describedby'];
31
+ 'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
32
+ 'aria-invalid'?: React.AriaAttributes['aria-invalid'];
33
+ 'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
34
+ 'aria-required'?: React.AriaAttributes['aria-required'];
29
35
  addonBefore?: React.ReactNode;
30
36
  addonAfter?: React.ReactNode;
31
37
  prefix?: React.ReactNode;
@@ -41,6 +47,7 @@ export interface InputProps extends
41
47
  hideSuffix?: boolean;
42
48
  placeholder?: React.ReactText;
43
49
  insetLabel?: React.ReactNode;
50
+ insetLabelId?: string;
44
51
  size?: InputSize;
45
52
  className?: string;
46
53
  style?: React.CSSProperties;
@@ -73,6 +80,12 @@ export interface InputState {
73
80
 
74
81
  class Input extends BaseComponent<InputProps, InputState> {
75
82
  static propTypes = {
83
+ 'aria-label': PropTypes.string,
84
+ 'aria-labelledby': PropTypes.string,
85
+ 'aria-invalid': PropTypes.bool,
86
+ 'aria-errormessage': PropTypes.string,
87
+ 'aria-describedby': PropTypes.string,
88
+ 'aria-required': PropTypes.bool,
76
89
  addonBefore: PropTypes.node,
77
90
  addonAfter: PropTypes.node,
78
91
  prefix: PropTypes.node,
@@ -101,6 +114,7 @@ class Input extends BaseComponent<InputProps, InputState> {
101
114
  onKeyPress: PropTypes.func,
102
115
  onEnterPress: PropTypes.func,
103
116
  insetLabel: PropTypes.node,
117
+ insetLabelId: PropTypes.string,
104
118
  inputStyle: PropTypes.object,
105
119
  getValueLength: PropTypes.func,
106
120
  };
@@ -207,6 +221,10 @@ class Input extends BaseComponent<InputProps, InputState> {
207
221
  this.foundation.handleClear(e);
208
222
  };
209
223
 
224
+ handleClearEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
225
+ this.foundation.handleClearEnterPress(e);
226
+ };
227
+
210
228
  handleClick = (e: React.MouseEvent<HTMLDivElement>) => {
211
229
  this.foundation.handleClick(e);
212
230
  };
@@ -235,6 +253,10 @@ class Input extends BaseComponent<InputProps, InputState> {
235
253
  this.foundation.handleMouseUp(e);
236
254
  };
237
255
 
256
+ handleModeEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
257
+ this.foundation.handleModeEnterPress(e);
258
+ }
259
+
238
260
  handleClickPrefixOrSuffix = (e: React.MouseEvent<HTMLInputElement>) => {
239
261
  this.foundation.handleClickPrefixOrSuffix(e);
240
262
  };
@@ -275,7 +297,14 @@ class Input extends BaseComponent<InputProps, InputState> {
275
297
  // use onMouseDown to fix issue 1203
276
298
  if (allowClear) {
277
299
  return (
278
- <div className={clearCls} onMouseDown={this.handleClear}>
300
+ <div
301
+ role="button"
302
+ tabIndex={0}
303
+ aria-label="Clear input value"
304
+ className={clearCls}
305
+ onMouseDown={this.handleClear}
306
+ onKeyPress={this.handleClearEnterPress}
307
+ >
279
308
  <IconClear />
280
309
  </div>
281
310
  );
@@ -289,9 +318,19 @@ class Input extends BaseComponent<InputProps, InputState> {
289
318
  const modeCls = cls(`${prefixCls}-modebtn`);
290
319
  const modeIcon = eyeClosed ? <IconEyeClosedSolid /> : <IconEyeOpened />;
291
320
  const showModeBtn = mode === 'password' && value && !disabled && (isFocus || isHovering);
321
+ const ariaLabel = eyeClosed ? 'Show password' : 'Hidden password';
292
322
  if (showModeBtn) {
293
323
  return (
294
- <div className={modeCls} onClick={this.handleClickEye} onMouseDown={this.handleMouseDown} onMouseUp={this.handleMouseUp}>
324
+ <div
325
+ role="button"
326
+ tabIndex={0}
327
+ aria-label={ariaLabel}
328
+ className={modeCls}
329
+ onClick={this.handleClickEye}
330
+ onMouseDown={this.handleMouseDown}
331
+ onMouseUp={this.handleMouseUp}
332
+ onKeyPress={this.handleModeEnterPress}
333
+ >
295
334
  {modeIcon}
296
335
  </div>
297
336
  );
@@ -300,7 +339,7 @@ class Input extends BaseComponent<InputProps, InputState> {
300
339
  }
301
340
 
302
341
  renderPrefix() {
303
- const { prefix, insetLabel } = this.props;
342
+ const { prefix, insetLabel, insetLabelId } = this.props;
304
343
  const labelNode = prefix || insetLabel;
305
344
  if (!labelNode) {
306
345
  return null;
@@ -312,7 +351,8 @@ class Input extends BaseComponent<InputProps, InputState> {
312
351
  [`${prefixCls}-prefix-icon`]: isSemiIcon(labelNode),
313
352
  });
314
353
 
315
- return <div className={prefixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix}>{labelNode}</div>;
354
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
355
+ return <div className={prefixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix} id={insetLabelId}>{labelNode}</div>;
316
356
  }
317
357
 
318
358
  showClearBtn() {
@@ -332,6 +372,7 @@ class Input extends BaseComponent<InputProps, InputState> {
332
372
  [`${prefixCls }-suffix-icon`]: isSemiIcon(suffix),
333
373
  [`${prefixCls}-suffix-hidden`]: suffixAllowClear && Boolean(hideSuffix),
334
374
  });
375
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
335
376
  return <div className={suffixWrapperCls} onMouseDown={this.handlePreventMouseDown} onClick={this.handleClickPrefixOrSuffix}>{suffix}</div>;
336
377
  }
337
378
 
@@ -417,7 +458,11 @@ class Input extends BaseComponent<InputProps, InputState> {
417
458
  if (stateMinLength) {
418
459
  inputProps.minLength = stateMinLength;
419
460
  }
461
+ if (validateStatus === 'error') {
462
+ inputProps['aria-invalid'] = "true";
463
+ }
420
464
  return (
465
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
421
466
  <div
422
467
  className={wrapperCls}
423
468
  style={style}
@@ -4,7 +4,7 @@ import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import { cssClasses, strings } from '@douyinfe/semi-foundation/input/constants';
6
6
  import BaseComponent from '../_base/baseComponent';
7
- import Label from '../form/label';
7
+ import Label, { LabelProps } from '../form/label';
8
8
 
9
9
  import { noop } from '@douyinfe/semi-foundation/utils/function';
10
10
  import { isFunction } from 'lodash';
@@ -21,7 +21,7 @@ export interface InputGroupProps {
21
21
  style?: Record<string, any>;
22
22
  onBlur?: (e: React.FocusEvent<HTMLSpanElement>) => void;
23
23
  onFocus?: (e: React.FocusEvent<HTMLSpanElement>) => void;
24
- label?: Record<string, any>;
24
+ label?: LabelProps;
25
25
  labelPosition?: string;
26
26
  disabled?: boolean;
27
27
  }
@@ -64,10 +64,12 @@ export default class inputGroup extends BaseComponent<InputGroupProps, InputGrou
64
64
  }
65
65
  );
66
66
  // const labelCls = cls(label.className, '');
67
+ const defaultName = 'input-group';
67
68
  return (
68
- <div className={groupWrapperCls}>
69
- {label && label.text ? <Label {...label} /> : null}
69
+ <div role="group" aria-label="Input group" aria-disabled={this.props.disabled} className={groupWrapperCls}>
70
+ {label && label.text ? <Label name={defaultName} {...label} /> : null}
70
71
  <span
72
+ id={label && label.name || defaultName}
71
73
  className={groupCls}
72
74
  style={this.props.style}
73
75
  onFocus={this.props.onFocus}
@@ -107,6 +109,9 @@ export default class inputGroup extends BaseComponent<InputGroupProps, InputGrou
107
109
 
108
110
  return (
109
111
  <span
112
+ role="group"
113
+ aria-label="Input group"
114
+ aria-disabled={this.props.disabled}
110
115
  className={groupCls}
111
116
  style={style}
112
117
  onFocus={this.props.onFocus}
@@ -101,6 +101,7 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
101
101
  libRef: React.RefObject<React.ReactNode>;
102
102
  _resizeLock: boolean;
103
103
  _resizeListener: any;
104
+ foundation: TextAreaFoundation;
104
105
 
105
106
  constructor(props: TextAreaProps) {
106
107
  super(props);
@@ -197,6 +198,10 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
197
198
  this.foundation.handleClear(e);
198
199
  };
199
200
 
201
+ handleClearEnterPress = (e: React.KeyboardEvent<HTMLDivElement>) => {
202
+ this.foundation.handleClearEnterPress(e);
203
+ }
204
+
200
205
  renderClearBtn() {
201
206
  const { showClear } = this.props;
202
207
  const displayClearBtn = this.foundation.isAllowClear();
@@ -205,7 +210,14 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
205
210
  });
206
211
  if (showClear) {
207
212
  return (
208
- <div className={clearCls} onClick={this.handleClear}>
213
+ <div
214
+ role="button"
215
+ tabIndex={0}
216
+ aria-label="Clear textarea value"
217
+ className={clearCls}
218
+ onClick={this.handleClear}
219
+ onKeyPress={this.handleClearEnterPress}
220
+ >
209
221
  <IconClear />
210
222
  </div>
211
223
  );
@@ -214,10 +226,10 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
214
226
  }
215
227
 
216
228
  renderCounter() {
217
- let counter,
218
- current,
219
- total,
220
- countCls;
229
+ let counter: React.ReactNode,
230
+ current: number,
231
+ total: number,
232
+ countCls: string;
221
233
  const { showCounter, maxCount, getValueLength } = this.props;
222
234
  if (showCounter || maxCount) {
223
235
  const { value } = this.state;
@@ -231,7 +243,14 @@ class TextArea extends BaseComponent<TextAreaProps, TextAreaState> {
231
243
  }
232
244
  );
233
245
  counter = (
234
- <div className={countCls}>{current}{total ? '/' : null}{total}</div>
246
+ <div
247
+ aria-label="Textarea value length counter"
248
+ aria-valuemax={maxCount}
249
+ aria-valuenow={current}
250
+ className={countCls}
251
+ >
252
+ {current}{total ? '/' : null}{total}
253
+ </div>
235
254
  );
236
255
  } else {
237
256
  counter = null;