@douyinfe/semi-ui 2.2.0-beta.1 → 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 (444) 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/__test__/datePicker.test.js +108 -0
  33. package/datePicker/_story/datePicker.stories.js +146 -2
  34. package/datePicker/datePicker.tsx +24 -0
  35. package/datePicker/monthsGrid.tsx +2 -1
  36. package/dist/css/semi.css +34 -7
  37. package/dist/css/semi.min.css +1 -1
  38. package/dist/umd/semi-ui.js +2785 -1508
  39. package/dist/umd/semi-ui.js.map +1 -1
  40. package/dist/umd/semi-ui.min.js +1 -1
  41. package/dist/umd/semi-ui.min.js.map +1 -1
  42. package/dropdown/dropdownItem.tsx +1 -1
  43. package/dropdown/dropdownMenu.tsx +1 -1
  44. package/empty/index.tsx +5 -5
  45. package/form/_story/FormApi/formApiDemo.jsx +3 -2
  46. package/form/_story/Validate/validateDemo.jsx +1 -1
  47. package/form/_story/demo.jsx +12 -3
  48. package/form/_story/form.stories.js +0 -7
  49. package/form/baseForm.tsx +2 -0
  50. package/form/errorMessage.tsx +13 -2
  51. package/form/hoc/withField.tsx +37 -8
  52. package/form/index.tsx +0 -2
  53. package/form/interface.ts +2 -0
  54. package/form/label.tsx +4 -2
  55. package/input/index.tsx +49 -4
  56. package/input/inputGroup.tsx +9 -4
  57. package/input/textarea.tsx +25 -6
  58. package/inputNumber/_story/inputNumber.stories.js +12 -0
  59. package/inputNumber/index.tsx +33 -2
  60. package/layout/Sider.tsx +6 -2
  61. package/layout/index.tsx +4 -3
  62. package/lib/cjs/_utils/hooks/usePrevFocus.d.ts +2 -0
  63. package/lib/cjs/_utils/hooks/usePrevFocus.js +30 -0
  64. package/lib/cjs/_utils/index.d.ts +1 -0
  65. package/lib/cjs/_utils/index.js +6 -1
  66. package/lib/cjs/anchor/index.d.ts +2 -0
  67. package/lib/cjs/anchor/index.js +6 -1
  68. package/lib/cjs/anchor/link.d.ts +4 -1
  69. package/lib/cjs/anchor/link.js +39 -5
  70. package/lib/cjs/autoComplete/index.d.ts +17 -0
  71. package/lib/cjs/autoComplete/index.js +21 -2
  72. package/lib/cjs/avatar/avatarGroup.js +2 -1
  73. package/lib/cjs/avatar/index.d.ts +4 -3
  74. package/lib/cjs/avatar/index.js +20 -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/index.js +2 -1
  97. package/lib/cjs/collapse/item.d.ts +2 -1
  98. package/lib/cjs/collapse/item.js +17 -3
  99. package/lib/cjs/collapsible/index.d.ts +1 -0
  100. package/lib/cjs/collapsible/index.js +4 -2
  101. package/lib/cjs/datePicker/datePicker.d.ts +12 -0
  102. package/lib/cjs/datePicker/datePicker.js +22 -3
  103. package/lib/cjs/datePicker/monthsGrid.d.ts +1 -0
  104. package/lib/cjs/datePicker/monthsGrid.js +2 -1
  105. package/lib/cjs/dropdown/dropdownItem.js +3 -1
  106. package/lib/cjs/dropdown/dropdownMenu.js +4 -1
  107. package/lib/cjs/empty/index.js +2 -1
  108. package/lib/cjs/form/baseForm.d.ts +9 -0
  109. package/lib/cjs/form/baseForm.js +3 -1
  110. package/lib/cjs/form/errorMessage.d.ts +4 -0
  111. package/lib/cjs/form/errorMessage.js +21 -3
  112. package/lib/cjs/form/field.d.ts +7 -0
  113. package/lib/cjs/form/hoc/withField.js +49 -16
  114. package/lib/cjs/form/index.d.ts +0 -1
  115. package/lib/cjs/form/interface.d.ts +2 -0
  116. package/lib/cjs/form/label.d.ts +2 -0
  117. package/lib/cjs/form/label.js +5 -2
  118. package/lib/cjs/input/index.d.ts +16 -0
  119. package/lib/cjs/input/index.js +51 -15
  120. package/lib/cjs/input/inputGroup.d.ts +2 -1
  121. package/lib/cjs/input/inputGroup.js +11 -1
  122. package/lib/cjs/input/textarea.js +12 -1
  123. package/lib/cjs/inputNumber/index.d.ts +21 -12
  124. package/lib/cjs/inputNumber/index.js +37 -3
  125. package/lib/cjs/layout/Sider.d.ts +4 -0
  126. package/lib/cjs/layout/Sider.js +4 -1
  127. package/lib/cjs/layout/index.js +2 -0
  128. package/lib/cjs/list/item.js +0 -1
  129. package/lib/cjs/modal/Modal.js +2 -0
  130. package/lib/cjs/modal/ModalContent.d.ts +3 -1
  131. package/lib/cjs/modal/ModalContent.js +47 -5
  132. package/lib/cjs/navigation/Item.d.ts +4 -2
  133. package/lib/cjs/navigation/Item.js +25 -5
  134. package/lib/cjs/navigation/SubNav.d.ts +4 -2
  135. package/lib/cjs/navigation/SubNav.js +8 -1
  136. package/lib/cjs/navigation/index.js +2 -0
  137. package/lib/cjs/notification/notice.d.ts +1 -1
  138. package/lib/cjs/notification/notice.js +32 -22
  139. package/lib/cjs/pagination/index.js +16 -6
  140. package/lib/cjs/popover/index.js +7 -3
  141. package/lib/cjs/progress/index.d.ts +8 -0
  142. package/lib/cjs/progress/index.js +42 -9
  143. package/lib/cjs/radio/radio.d.ts +6 -1
  144. package/lib/cjs/radio/radio.js +17 -5
  145. package/lib/cjs/radio/radioGroup.d.ts +16 -1
  146. package/lib/cjs/radio/radioGroup.js +18 -3
  147. package/lib/cjs/radio/radioInner.d.ts +6 -1
  148. package/lib/cjs/radio/radioInner.js +11 -3
  149. package/lib/cjs/rating/index.d.ts +14 -0
  150. package/lib/cjs/rating/index.js +14 -3
  151. package/lib/cjs/rating/item.d.ts +2 -0
  152. package/lib/cjs/rating/item.js +6 -1
  153. package/lib/cjs/select/index.d.ts +16 -0
  154. package/lib/cjs/select/index.js +65 -19
  155. package/lib/cjs/select/option.js +28 -22
  156. package/lib/cjs/sideSheet/SideSheetContent.d.ts +1 -0
  157. package/lib/cjs/sideSheet/SideSheetContent.js +12 -5
  158. package/lib/cjs/sideSheet/index.d.ts +1 -0
  159. package/lib/cjs/sideSheet/index.js +2 -1
  160. package/lib/cjs/slider/index.d.ts +2 -1
  161. package/lib/cjs/slider/index.js +64 -17
  162. package/lib/cjs/spin/icon.js +2 -4
  163. package/lib/cjs/steps/basicStep.d.ts +3 -0
  164. package/lib/cjs/steps/basicStep.js +23 -25
  165. package/lib/cjs/steps/basicSteps.d.ts +1 -0
  166. package/lib/cjs/steps/basicSteps.js +2 -1
  167. package/lib/cjs/steps/fillStep.d.ts +3 -0
  168. package/lib/cjs/steps/fillStep.js +19 -4
  169. package/lib/cjs/steps/fillSteps.d.ts +1 -0
  170. package/lib/cjs/steps/fillSteps.js +2 -1
  171. package/lib/cjs/steps/navStep.d.ts +3 -0
  172. package/lib/cjs/steps/navStep.js +22 -25
  173. package/lib/cjs/steps/navSteps.d.ts +1 -0
  174. package/lib/cjs/steps/navSteps.js +2 -1
  175. package/lib/cjs/switch/index.d.ts +12 -0
  176. package/lib/cjs/switch/index.js +19 -4
  177. package/lib/cjs/table/Body/BaseRow.js +35 -3
  178. package/lib/cjs/table/Body/index.js +9 -1
  179. package/lib/cjs/table/ColumnFilter.js +4 -0
  180. package/lib/cjs/table/ColumnSelection.d.ts +3 -0
  181. package/lib/cjs/table/ColumnSelection.js +6 -2
  182. package/lib/cjs/table/ColumnSorter.js +19 -3
  183. package/lib/cjs/table/CustomExpandIcon.js +7 -1
  184. package/lib/cjs/table/Table.d.ts +2 -0
  185. package/lib/cjs/table/Table.js +31 -15
  186. package/lib/cjs/table/TableCell.d.ts +2 -0
  187. package/lib/cjs/table/TableCell.js +6 -2
  188. package/lib/cjs/table/TableHeaderRow.js +8 -2
  189. package/lib/cjs/tabs/TabBar.js +11 -3
  190. package/lib/cjs/tabs/TabPane.js +3 -1
  191. package/lib/cjs/tabs/index.js +3 -8
  192. package/lib/cjs/tagInput/index.d.ts +4 -1
  193. package/lib/cjs/tagInput/index.js +29 -3
  194. package/lib/cjs/timePicker/TimePicker.d.ts +12 -0
  195. package/lib/cjs/timePicker/TimePicker.js +9 -1
  196. package/lib/cjs/timePicker/index.d.ts +6 -0
  197. package/lib/cjs/timeline/index.d.ts +1 -1
  198. package/lib/cjs/timeline/index.js +1 -0
  199. package/lib/cjs/timeline/item.js +4 -2
  200. package/lib/cjs/toast/toast.js +2 -0
  201. package/lib/cjs/tooltip/TriangleArrow.js +1 -0
  202. package/lib/cjs/tooltip/TriangleArrowVertical.js +1 -0
  203. package/lib/cjs/tooltip/index.d.ts +16 -12
  204. package/lib/cjs/tooltip/index.js +55 -39
  205. package/lib/cjs/transfer/index.d.ts +1 -1
  206. package/lib/cjs/transfer/index.js +35 -17
  207. package/lib/cjs/tree/index.d.ts +1 -0
  208. package/lib/cjs/tree/index.js +15 -6
  209. package/lib/cjs/tree/treeNode.d.ts +12 -4
  210. package/lib/cjs/tree/treeNode.js +44 -4
  211. package/lib/cjs/treeSelect/index.d.ts +16 -0
  212. package/lib/cjs/treeSelect/index.js +60 -12
  213. package/lib/cjs/typography/base.js +18 -7
  214. package/lib/cjs/typography/copyable.js +6 -1
  215. package/lib/cjs/upload/fileCard.js +23 -4
  216. package/lib/cjs/upload/index.js +19 -4
  217. package/lib/es/_utils/hooks/usePrevFocus.d.ts +2 -0
  218. package/lib/es/_utils/hooks/usePrevFocus.js +15 -0
  219. package/lib/es/_utils/index.d.ts +1 -0
  220. package/lib/es/_utils/index.js +4 -1
  221. package/lib/es/anchor/index.d.ts +2 -0
  222. package/lib/es/anchor/index.js +6 -1
  223. package/lib/es/anchor/link.d.ts +4 -1
  224. package/lib/es/anchor/link.js +38 -5
  225. package/lib/es/autoComplete/index.d.ts +17 -0
  226. package/lib/es/autoComplete/index.js +21 -2
  227. package/lib/es/avatar/avatarGroup.js +2 -1
  228. package/lib/es/avatar/index.d.ts +4 -3
  229. package/lib/es/avatar/index.js +20 -11
  230. package/lib/es/banner/index.js +4 -2
  231. package/lib/es/breadcrumb/index.d.ts +3 -0
  232. package/lib/es/breadcrumb/index.js +10 -4
  233. package/lib/es/breadcrumb/item.js +2 -2
  234. package/lib/es/button/Button.d.ts +2 -0
  235. package/lib/es/button/Button.js +4 -2
  236. package/lib/es/button/buttonGroup.d.ts +3 -0
  237. package/lib/es/button/buttonGroup.js +8 -4
  238. package/lib/es/button/index.d.ts +1 -0
  239. package/lib/es/button/splitButtonGroup.d.ts +3 -0
  240. package/lib/es/button/splitButtonGroup.js +5 -2
  241. package/lib/es/card/index.d.ts +3 -0
  242. package/lib/es/card/index.js +3 -1
  243. package/lib/es/cascader/index.d.ts +14 -0
  244. package/lib/es/cascader/index.js +35 -7
  245. package/lib/es/checkbox/checkbox.d.ts +21 -1
  246. package/lib/es/checkbox/checkbox.js +50 -17
  247. package/lib/es/checkbox/checkboxGroup.d.ts +13 -1
  248. package/lib/es/checkbox/checkboxGroup.js +18 -5
  249. package/lib/es/checkbox/checkboxInner.d.ts +15 -0
  250. package/lib/es/checkbox/checkboxInner.js +20 -3
  251. package/lib/es/collapse/index.js +2 -1
  252. package/lib/es/collapse/item.d.ts +2 -1
  253. package/lib/es/collapse/item.js +16 -3
  254. package/lib/es/collapsible/index.d.ts +1 -0
  255. package/lib/es/collapsible/index.js +4 -2
  256. package/lib/es/datePicker/datePicker.d.ts +12 -0
  257. package/lib/es/datePicker/datePicker.js +22 -3
  258. package/lib/es/datePicker/monthsGrid.d.ts +1 -0
  259. package/lib/es/datePicker/monthsGrid.js +2 -1
  260. package/lib/es/dropdown/dropdownItem.js +3 -1
  261. package/lib/es/dropdown/dropdownMenu.js +4 -1
  262. package/lib/es/empty/index.js +2 -1
  263. package/lib/es/form/baseForm.d.ts +9 -0
  264. package/lib/es/form/baseForm.js +3 -1
  265. package/lib/es/form/errorMessage.d.ts +4 -0
  266. package/lib/es/form/errorMessage.js +21 -3
  267. package/lib/es/form/field.d.ts +7 -0
  268. package/lib/es/form/hoc/withField.js +48 -15
  269. package/lib/es/form/index.d.ts +0 -1
  270. package/lib/es/form/index.js +0 -1
  271. package/lib/es/form/interface.d.ts +2 -0
  272. package/lib/es/form/label.d.ts +2 -0
  273. package/lib/es/form/label.js +5 -2
  274. package/lib/es/input/index.d.ts +16 -0
  275. package/lib/es/input/index.js +51 -15
  276. package/lib/es/input/inputGroup.d.ts +2 -1
  277. package/lib/es/input/inputGroup.js +11 -1
  278. package/lib/es/input/textarea.js +12 -1
  279. package/lib/es/inputNumber/index.d.ts +21 -12
  280. package/lib/es/inputNumber/index.js +38 -3
  281. package/lib/es/layout/Sider.d.ts +4 -0
  282. package/lib/es/layout/Sider.js +4 -1
  283. package/lib/es/layout/index.js +2 -0
  284. package/lib/es/list/item.js +0 -1
  285. package/lib/es/modal/Modal.js +2 -0
  286. package/lib/es/modal/ModalContent.d.ts +3 -1
  287. package/lib/es/modal/ModalContent.js +46 -5
  288. package/lib/es/navigation/Item.d.ts +4 -2
  289. package/lib/es/navigation/Item.js +25 -5
  290. package/lib/es/navigation/SubNav.d.ts +4 -2
  291. package/lib/es/navigation/SubNav.js +8 -1
  292. package/lib/es/navigation/index.js +2 -0
  293. package/lib/es/notification/notice.d.ts +1 -1
  294. package/lib/es/notification/notice.js +33 -24
  295. package/lib/es/pagination/index.js +16 -6
  296. package/lib/es/popover/index.js +7 -3
  297. package/lib/es/progress/index.d.ts +8 -0
  298. package/lib/es/progress/index.js +42 -9
  299. package/lib/es/radio/radio.d.ts +6 -1
  300. package/lib/es/radio/radio.js +16 -5
  301. package/lib/es/radio/radioGroup.d.ts +16 -1
  302. package/lib/es/radio/radioGroup.js +18 -3
  303. package/lib/es/radio/radioInner.d.ts +6 -1
  304. package/lib/es/radio/radioInner.js +11 -3
  305. package/lib/es/rating/index.d.ts +14 -0
  306. package/lib/es/rating/index.js +14 -3
  307. package/lib/es/rating/item.d.ts +2 -0
  308. package/lib/es/rating/item.js +6 -1
  309. package/lib/es/select/index.d.ts +16 -0
  310. package/lib/es/select/index.js +63 -17
  311. package/lib/es/select/option.js +28 -22
  312. package/lib/es/sideSheet/SideSheetContent.d.ts +1 -0
  313. package/lib/es/sideSheet/SideSheetContent.js +12 -5
  314. package/lib/es/sideSheet/index.d.ts +1 -0
  315. package/lib/es/sideSheet/index.js +2 -1
  316. package/lib/es/slider/index.d.ts +2 -1
  317. package/lib/es/slider/index.js +63 -16
  318. package/lib/es/spin/icon.js +2 -4
  319. package/lib/es/steps/basicStep.d.ts +3 -0
  320. package/lib/es/steps/basicStep.js +23 -23
  321. package/lib/es/steps/basicSteps.d.ts +1 -0
  322. package/lib/es/steps/basicSteps.js +2 -1
  323. package/lib/es/steps/fillStep.d.ts +3 -0
  324. package/lib/es/steps/fillStep.js +19 -4
  325. package/lib/es/steps/fillSteps.d.ts +1 -0
  326. package/lib/es/steps/fillSteps.js +2 -1
  327. package/lib/es/steps/navStep.d.ts +3 -0
  328. package/lib/es/steps/navStep.js +22 -23
  329. package/lib/es/steps/navSteps.d.ts +1 -0
  330. package/lib/es/steps/navSteps.js +2 -1
  331. package/lib/es/switch/index.d.ts +12 -0
  332. package/lib/es/switch/index.js +19 -4
  333. package/lib/es/table/Body/BaseRow.js +35 -3
  334. package/lib/es/table/Body/index.js +9 -2
  335. package/lib/es/table/ColumnFilter.js +4 -0
  336. package/lib/es/table/ColumnSelection.d.ts +3 -0
  337. package/lib/es/table/ColumnSelection.js +6 -2
  338. package/lib/es/table/ColumnSorter.js +17 -3
  339. package/lib/es/table/CustomExpandIcon.js +6 -1
  340. package/lib/es/table/Table.d.ts +2 -0
  341. package/lib/es/table/Table.js +31 -15
  342. package/lib/es/table/TableCell.d.ts +2 -0
  343. package/lib/es/table/TableCell.js +6 -2
  344. package/lib/es/table/TableHeaderRow.js +8 -2
  345. package/lib/es/tabs/TabBar.js +11 -3
  346. package/lib/es/tabs/TabPane.js +3 -1
  347. package/lib/es/tabs/index.js +1 -6
  348. package/lib/es/tagInput/index.d.ts +4 -1
  349. package/lib/es/tagInput/index.js +29 -3
  350. package/lib/es/timePicker/TimePicker.d.ts +12 -0
  351. package/lib/es/timePicker/TimePicker.js +9 -1
  352. package/lib/es/timePicker/index.d.ts +6 -0
  353. package/lib/es/timeline/index.d.ts +1 -1
  354. package/lib/es/timeline/index.js +1 -0
  355. package/lib/es/timeline/item.js +4 -2
  356. package/lib/es/toast/toast.js +2 -0
  357. package/lib/es/tooltip/TriangleArrow.js +1 -0
  358. package/lib/es/tooltip/TriangleArrowVertical.js +1 -0
  359. package/lib/es/tooltip/index.d.ts +16 -12
  360. package/lib/es/tooltip/index.js +53 -39
  361. package/lib/es/transfer/index.d.ts +1 -1
  362. package/lib/es/transfer/index.js +35 -17
  363. package/lib/es/tree/index.d.ts +1 -0
  364. package/lib/es/tree/index.js +15 -6
  365. package/lib/es/tree/treeNode.d.ts +12 -4
  366. package/lib/es/tree/treeNode.js +44 -4
  367. package/lib/es/treeSelect/index.d.ts +16 -0
  368. package/lib/es/treeSelect/index.js +57 -10
  369. package/lib/es/typography/base.js +17 -7
  370. package/lib/es/typography/copyable.js +5 -1
  371. package/lib/es/upload/fileCard.js +23 -4
  372. package/lib/es/upload/index.js +19 -4
  373. package/list/item.tsx +0 -1
  374. package/modal/Modal.tsx +2 -0
  375. package/modal/ModalContent.tsx +35 -5
  376. package/navigation/Item.tsx +15 -0
  377. package/navigation/SubNav.tsx +13 -1
  378. package/navigation/index.tsx +1 -1
  379. package/notification/notice.tsx +19 -14
  380. package/package.json +8 -8
  381. package/pagination/index.tsx +9 -5
  382. package/popover/index.tsx +5 -0
  383. package/progress/_story/progress.stories.js +18 -18
  384. package/progress/index.tsx +58 -20
  385. package/radio/radio.tsx +12 -2
  386. package/radio/radioGroup.tsx +29 -3
  387. package/radio/radioInner.tsx +10 -1
  388. package/rating/index.tsx +19 -2
  389. package/rating/item.tsx +6 -0
  390. package/select/__test__/select.test.js +45 -0
  391. package/select/_story/select.stories.js +29 -0
  392. package/select/index.tsx +52 -4
  393. package/select/option.tsx +3 -0
  394. package/sideSheet/SideSheetContent.tsx +13 -9
  395. package/sideSheet/index.tsx +3 -2
  396. package/slider/__test__/slider.test.js +9 -0
  397. package/slider/_story/slider.stories.js +1 -1
  398. package/slider/index.tsx +44 -7
  399. package/spin/icon.tsx +3 -3
  400. package/steps/basicStep.tsx +15 -4
  401. package/steps/basicSteps.tsx +3 -2
  402. package/steps/fillStep.tsx +27 -12
  403. package/steps/fillSteps.tsx +2 -0
  404. package/steps/navStep.tsx +15 -4
  405. package/steps/navSteps.tsx +3 -2
  406. package/switch/_story/switch.stories.js +20 -19
  407. package/switch/_story/switch.stories.tsx +13 -13
  408. package/switch/index.tsx +23 -5
  409. package/table/Body/BaseRow.tsx +25 -1
  410. package/table/Body/index.tsx +7 -2
  411. package/table/ColumnFilter.tsx +7 -1
  412. package/table/ColumnSelection.tsx +4 -1
  413. package/table/ColumnSorter.tsx +18 -1
  414. package/table/CustomExpandIcon.tsx +5 -0
  415. package/table/Table.tsx +26 -13
  416. package/table/TableCell.tsx +11 -1
  417. package/table/TableHeaderRow.tsx +16 -2
  418. package/table/__test__/table.test.js +46 -0
  419. package/tabs/TabBar.tsx +8 -5
  420. package/tabs/TabPane.tsx +3 -1
  421. package/tabs/index.tsx +1 -2
  422. package/tagInput/__test__/tagInput.test.js +46 -0
  423. package/tagInput/_story/tagInput.stories.js +2 -2
  424. package/tagInput/index.tsx +31 -8
  425. package/timePicker/TimePicker.tsx +14 -1
  426. package/timeline/_story/timeline.stories.js +1 -1
  427. package/timeline/index.tsx +2 -2
  428. package/timeline/item.tsx +2 -1
  429. package/toast/toast.tsx +2 -0
  430. package/tooltip/TriangleArrow.tsx +1 -1
  431. package/tooltip/TriangleArrowVertical.tsx +1 -1
  432. package/tooltip/_story/tooltip.stories.js +562 -514
  433. package/tooltip/index.tsx +50 -33
  434. package/transfer/index.tsx +32 -28
  435. package/tree/_story/tree.stories.js +3 -3
  436. package/tree/index.tsx +10 -2
  437. package/tree/treeNode.tsx +46 -10
  438. package/treeSelect/__test__/treeMultiple.test.js +5 -0
  439. package/treeSelect/_story/treeSelect.stories.js +12 -0
  440. package/treeSelect/index.tsx +58 -7
  441. package/typography/base.tsx +7 -1
  442. package/typography/copyable.tsx +10 -1
  443. package/upload/fileCard.tsx +13 -15
  444. package/upload/index.tsx +10 -6
@@ -73,7 +73,9 @@ class DropdownItem extends BaseComponent {
73
73
  }, icon);
74
74
  }
75
75
 
76
- return /*#__PURE__*/React.createElement("li", _Object$assign({}, events, {
76
+ return /*#__PURE__*/React.createElement("li", _Object$assign({
77
+ role: "menuitem"
78
+ }, events, {
77
79
  ref: ref => forwardRef(ref),
78
80
  className: itemclass,
79
81
  style: style
@@ -30,7 +30,10 @@ class DropdownMenu extends BaseComponent {
30
30
  } = _a,
31
31
  rest = __rest(_a, ["children", "className", "style"]);
32
32
 
33
- return /*#__PURE__*/React.createElement("ul", _Object$assign({}, rest, {
33
+ return /*#__PURE__*/React.createElement("ul", _Object$assign({
34
+ role: "menu",
35
+ "aria-orientation": "vertical"
36
+ }, rest, {
34
37
  className: classnames("".concat(prefixCls, "-menu"), className),
35
38
  style: style
36
39
  }), children);
@@ -98,7 +98,8 @@ export default class Empty extends BaseComponent {
98
98
  };
99
99
  return /*#__PURE__*/React.createElement("div", {
100
100
  className: wrapperCls,
101
- style: style
101
+ style: style,
102
+ "aria-label": "empty placeholder image"
102
103
  }, /*#__PURE__*/React.createElement("div", {
103
104
  className: "".concat(prefixCls, "-image"),
104
105
  style: imageStyle
@@ -13,6 +13,7 @@ interface BaseFormState {
13
13
  }
14
14
  declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
15
15
  static propTypes: {
16
+ 'aria-label': PropTypes.Requireable<string>;
16
17
  onSubmit: PropTypes.Requireable<(...args: any[]) => any>;
17
18
  onSubmitFail: PropTypes.Requireable<(...args: any[]) => any>;
18
19
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
@@ -36,6 +37,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
36
37
  disabled: PropTypes.Requireable<boolean>;
37
38
  showValidateIcon: PropTypes.Requireable<boolean>;
38
39
  extraTextPosition: PropTypes.Requireable<string>;
40
+ id: PropTypes.Requireable<string>;
39
41
  };
40
42
  static defaultProps: {
41
43
  onChange: (...args: any[]) => void;
@@ -53,8 +55,14 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
53
55
  static TextArea: React.ComponentType<import("utility-types").Subtract<Omit<import("../input").TextAreaProps, "forwardRef"> & React.RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
54
56
  static InputNumber: React.ComponentType<import("utility-types").Subtract<import("../inputNumber").InputNumberProps & React.RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
55
57
  static Select: React.ComponentType<import("utility-types").Subtract<{
58
+ 'aria-describedby'?: string;
59
+ 'aria-errormessage'?: string;
60
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling";
61
+ 'aria-labelledby'?: string;
62
+ 'aria-required'?: boolean | "true" | "false";
56
63
  id?: string;
57
64
  autoFocus?: boolean;
65
+ autoClearSearchValue?: boolean;
58
66
  arrowIcon?: React.ReactNode;
59
67
  defaultValue?: string | number | any[] | Record<string, any>;
60
68
  value?: string | number | any[] | Record<string, any>;
@@ -90,6 +98,7 @@ declare class Form extends BaseComponent<BaseFormProps, BaseFormState> {
90
98
  suffix?: React.ReactNode;
91
99
  prefix?: React.ReactNode;
92
100
  insetLabel?: React.ReactNode;
101
+ insetLabelId?: string;
93
102
  inputProps?: import("utility-types").Subtract<import("../input").InputProps, {
94
103
  value?: React.ReactText;
95
104
  onFocus?: (e: React.FocusEvent<HTMLInputElement, Element>) => void;
@@ -220,6 +220,7 @@ class Form extends BaseComponent {
220
220
  }
221
221
 
222
222
  Form.propTypes = {
223
+ 'aria-label': PropTypes.string,
223
224
  onSubmit: PropTypes.func,
224
225
  onSubmitFail: PropTypes.func,
225
226
 
@@ -245,7 +246,8 @@ Form.propTypes = {
245
246
  autoScrollToError: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),
246
247
  disabled: PropTypes.bool,
247
248
  showValidateIcon: PropTypes.bool,
248
- extraTextPosition: PropTypes.oneOf(strings.EXTRA_POS)
249
+ extraTextPosition: PropTypes.oneOf(strings.EXTRA_POS),
250
+ id: PropTypes.string
249
251
  };
250
252
  Form.defaultProps = {
251
253
  onChange: _noop,
@@ -9,6 +9,8 @@ export interface ErrorMessageProps {
9
9
  validateStatus?: string;
10
10
  helpText?: React.ReactNode;
11
11
  isInInputGroup?: boolean;
12
+ errorMessageId?: string;
13
+ helpTextId?: string;
12
14
  }
13
15
  export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
14
16
  static propTypes: {
@@ -19,6 +21,8 @@ export default class ErrorMessage extends PureComponent<ErrorMessageProps> {
19
21
  showValidateIcon: PropTypes.Requireable<boolean>;
20
22
  helpText: PropTypes.Requireable<PropTypes.ReactNodeLike>;
21
23
  isInInputGroup: PropTypes.Requireable<boolean>;
24
+ errorMessageId: PropTypes.Requireable<string>;
25
+ helpTextId: PropTypes.Requireable<string>;
22
26
  };
23
27
  generatorText(error: ReactFieldError): JSX.Element;
24
28
  render(): JSX.Element;
@@ -10,12 +10,27 @@ import { IconAlertTriangle, IconAlertCircle } from '@douyinfe/semi-icons';
10
10
  const prefix = cssClasses.PREFIX;
11
11
  export default class ErrorMessage extends PureComponent {
12
12
  generatorText(error) {
13
+ const {
14
+ helpTextId,
15
+ errorMessageId
16
+ } = this.props;
17
+ const propsError = this.props.error;
18
+ let id = errorMessageId;
19
+
20
+ if (!propsError) {
21
+ id = helpTextId;
22
+ }
23
+
13
24
  if (typeof error === 'string') {
14
- return /*#__PURE__*/React.createElement("span", null, error);
25
+ return /*#__PURE__*/React.createElement("span", {
26
+ id: id
27
+ }, error);
15
28
  } else if (_Array$isArray(error)) {
16
29
  const err = _filterInstanceProperty(error).call(error, e => e);
17
30
 
18
- return err.length ? /*#__PURE__*/React.createElement("span", null, err.join(', ')) : null;
31
+ return err.length ? /*#__PURE__*/React.createElement("span", {
32
+ id: id
33
+ }, err.join(', ')) : null;
19
34
  } else if ( /*#__PURE__*/React.isValidElement(error)) {
20
35
  return error;
21
36
  }
@@ -76,5 +91,8 @@ ErrorMessage.propTypes = {
76
91
  validateStatus: PropTypes.string,
77
92
  showValidateIcon: PropTypes.bool,
78
93
  helpText: PropTypes.node,
79
- isInInputGroup: PropTypes.bool
94
+ isInInputGroup: PropTypes.bool,
95
+ // internal props
96
+ errorMessageId: PropTypes.string,
97
+ helpTextId: PropTypes.string
80
98
  };
@@ -3,8 +3,14 @@ declare const FormInput: import("react").ComponentType<import("utility-types").S
3
3
  declare const FormInputNumber: import("react").ComponentType<import("utility-types").Subtract<import("../inputNumber/index").InputNumberProps & import("react").RefAttributes<HTMLInputElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
4
4
  declare const FormTextArea: import("react").ComponentType<import("utility-types").Subtract<Omit<import("../input/textarea").TextAreaProps, "forwardRef"> & import("react").RefAttributes<HTMLTextAreaElement>, import("./interface").CommonexcludeType> & import("./interface").CommonFieldProps>;
5
5
  declare const FormSelect: import("react").ComponentType<import("utility-types").Subtract<{
6
+ 'aria-describedby'?: string;
7
+ 'aria-errormessage'?: string;
8
+ 'aria-invalid'?: boolean | "true" | "false" | "grammar" | "spelling";
9
+ 'aria-labelledby'?: string;
10
+ 'aria-required'?: boolean | "true" | "false";
6
11
  id?: string;
7
12
  autoFocus?: boolean;
13
+ autoClearSearchValue?: boolean;
8
14
  arrowIcon?: import("react").ReactNode;
9
15
  defaultValue?: string | number | any[] | Record<string, any>;
10
16
  value?: string | number | any[] | Record<string, any>;
@@ -40,6 +46,7 @@ declare const FormSelect: import("react").ComponentType<import("utility-types").
40
46
  suffix?: import("react").ReactNode;
41
47
  prefix?: import("react").ReactNode;
42
48
  insetLabel?: import("react").ReactNode;
49
+ insetLabelId?: string;
43
50
  inputProps?: import("utility-types").Subtract<import("../input/index").InputProps, {
44
51
  value?: import("react").ReactText;
45
52
  onFocus?: (e: import("react").FocusEvent<HTMLInputElement, Element>) => void;
@@ -60,6 +60,7 @@ function withField(Component, opts) {
60
60
  extraText,
61
61
  extraTextPosition,
62
62
  pure,
63
+ id,
63
64
  rest
64
65
  } = mergeProps(props);
65
66
  let {
@@ -396,27 +397,62 @@ function withField(Component, opts) {
396
397
  let mergeLabelAlign = labelAlign || formProps.labelAlign;
397
398
  let mergeLabelCol = labelCol || formProps.labelCol;
398
399
  let mergeWrapperCol = wrapperCol || formProps.wrapperCol;
399
- let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom';
400
+ let mergeExtraPos = extraTextPosition || formProps.extraTextPosition || 'bottom'; // id attribute to improve a11y
401
+
402
+ const a11yId = id ? id : field;
403
+ const labelId = "".concat(a11yId, "-label");
404
+ const helpTextId = "".concat(a11yId, "-helpText");
405
+ const extraTextId = "".concat(a11yId, "-extraText");
406
+ const errorMessageId = "".concat(a11yId, "-errormessage");
400
407
 
401
408
  let FieldComponent = (() => {
402
- var _context, _context3;
409
+ var _context3, _context5;
403
410
 
404
411
  // prefer to use validateStatus which pass by user throught props
405
412
  let blockStatus = validateStatus ? validateStatus : status;
413
+ const extraCls = classNames("".concat(prefix, "-field-extra"), {
414
+ ["".concat(prefix, "-field-extra-string")]: typeof extraText === 'string',
415
+ ["".concat(prefix, "-field-extra-middle")]: mergeExtraPos === 'middle',
416
+ ["".concat(prefix, "-field-extra-botttom")]: mergeExtraPos === 'bottom'
417
+ });
418
+ const extraContent = extraText ? /*#__PURE__*/React.createElement("div", {
419
+ className: extraCls,
420
+ id: extraTextId
421
+ }, extraText) : null;
406
422
 
407
423
  let newProps = _Object$assign(_Object$assign({
424
+ id: a11yId,
408
425
  disabled: formProps.disabled
409
426
  }, rest), {
410
427
  ref,
411
428
  onBlur: handleBlur,
412
429
  [options.onKeyChangeFnName]: handleChange,
413
430
  [options.valueKey]: value,
414
- validateStatus: blockStatus
431
+ validateStatus: blockStatus,
432
+ 'aria-required': required,
433
+ 'aria-labelledby': labelId
415
434
  });
416
435
 
436
+ if (helpText) {
437
+ var _context;
438
+
439
+ newProps['aria-describedby'] = extraText ? _concatInstanceProperty(_context = "".concat(helpTextId, " ")).call(_context, extraTextId) : helpTextId;
440
+ }
441
+
442
+ if (extraText) {
443
+ var _context2;
444
+
445
+ newProps['aria-describedby'] = helpText ? _concatInstanceProperty(_context2 = "".concat(helpTextId, " ")).call(_context2, extraTextId) : extraTextId;
446
+ }
447
+
448
+ if (status === 'error') {
449
+ newProps['aria-errormessage'] = errorMessageId;
450
+ newProps['aria-invalid'] = true;
451
+ }
452
+
417
453
  const fieldCls = classNames({
418
454
  ["".concat(prefix, "-field")]: true,
419
- [_concatInstanceProperty(_context = "".concat(prefix, "-field-")).call(_context, name)]: Boolean(name),
455
+ [_concatInstanceProperty(_context3 = "".concat(prefix, "-field-")).call(_context3, name)]: Boolean(name),
420
456
  [fieldClassName]: Boolean(fieldClassName)
421
457
  });
422
458
  const fieldMaincls = classNames({
@@ -425,9 +461,11 @@ function withField(Component, opts) {
425
461
 
426
462
  if (mergeLabelPos === 'inset' && !noLabel) {
427
463
  newProps.insetLabel = label || field;
464
+ newProps.insetLabelId = labelId;
428
465
 
429
466
  if (typeof label === 'object' && !isElement(label)) {
430
467
  newProps.insetLabel = label.text;
468
+ newProps.insetLabelId = labelId;
431
469
  }
432
470
  }
433
471
 
@@ -438,11 +476,11 @@ function withField(Component, opts) {
438
476
  }
439
477
 
440
478
  if (pure) {
441
- var _context2;
479
+ var _context4;
442
480
 
443
481
  let pureCls = classNames(rest.className, {
444
482
  ["".concat(prefix, "-field-pure")]: true,
445
- [_concatInstanceProperty(_context2 = "".concat(prefix, "-field-")).call(_context2, name)]: Boolean(name),
483
+ [_concatInstanceProperty(_context4 = "".concat(prefix, "-field-")).call(_context4, name)]: Boolean(name),
446
484
  [fieldClassName]: Boolean(fieldClassName)
447
485
  });
448
486
  newProps.className = pureCls;
@@ -450,7 +488,7 @@ function withField(Component, opts) {
450
488
  }
451
489
 
452
490
  let withCol = mergeLabelCol && mergeWrapperCol;
453
- const labelColCls = mergeLabelAlign ? _concatInstanceProperty(_context3 = "".concat(prefix, "-col-")).call(_context3, mergeLabelAlign) : ''; // get label
491
+ const labelColCls = mergeLabelAlign ? _concatInstanceProperty(_context5 = "".concat(prefix, "-col-")).call(_context5, mergeLabelAlign) : ''; // get label
454
492
 
455
493
  let labelContent = null;
456
494
 
@@ -458,6 +496,7 @@ function withField(Component, opts) {
458
496
  let needSpread = typeof label === 'object' && !isElement(label) ? label : {};
459
497
  labelContent = /*#__PURE__*/React.createElement(Label, _Object$assign({
460
498
  text: label || field,
499
+ id: labelId,
461
500
  required: required,
462
501
  name: name || field,
463
502
  width: mergeLabelWidth,
@@ -465,20 +504,14 @@ function withField(Component, opts) {
465
504
  }, needSpread));
466
505
  }
467
506
 
468
- const extraCls = classNames("".concat(prefix, "-field-extra"), {
469
- ["".concat(prefix, "-field-extra-string")]: typeof extraText === 'string',
470
- ["".concat(prefix, "-field-extra-middle")]: mergeExtraPos === 'middle',
471
- ["".concat(prefix, "-field-extra-botttom")]: mergeExtraPos === 'bottom'
472
- });
473
- const extraContent = extraText ? /*#__PURE__*/React.createElement("div", {
474
- className: extraCls
475
- }, extraText) : null;
476
507
  const fieldMainContent = /*#__PURE__*/React.createElement("div", {
477
508
  className: fieldMaincls
478
509
  }, mergeExtraPos === 'middle' ? extraContent : null, com, !noErrorMessage ? /*#__PURE__*/React.createElement(ErrorMessage, {
479
510
  error: error,
480
511
  validateStatus: blockStatus,
481
512
  helpText: helpText,
513
+ helpTextId: helpTextId,
514
+ errorMessageId: errorMessageId,
482
515
  showValidateIcon: formProps.showValidateIcon
483
516
  }) : null, mergeExtraPos === 'bottom' ? extraContent : null);
484
517
  const withColContent = /*#__PURE__*/React.createElement(React.Fragment, null, mergeLabelPos === 'top' ? /*#__PURE__*/React.createElement("div", {
@@ -11,7 +11,6 @@ import { useFormApi, useFormState, useFieldState, useFieldApi } from './hooks/in
11
11
  import withField from './hoc/withField';
12
12
  import withFormState from './hoc/withFormState';
13
13
  import withFormApi from './hoc/withFormApi';
14
- export * from './interface';
15
14
  export { Form, ArrayField, withField, useFormApi, useFormState, useFieldApi, useFieldState, withFormState, withFormApi };
16
15
  export * from './interface';
17
16
  export { ArrayFieldProps } from './arrayField';
@@ -14,6 +14,5 @@ import { useFormApi, useFormState, useFieldState, useFieldApi } from './hooks/in
14
14
  import withField from './hoc/withField';
15
15
  import withFormState from './hoc/withFormState';
16
16
  import withFormApi from './hoc/withFormApi';
17
- export * from './interface';
18
17
  export { Form, ArrayField, withField, useFormApi, useFormState, useFieldApi, useFieldState, withFormState, withFormApi };
19
18
  export * from './interface';
@@ -82,6 +82,7 @@ export interface FormFCChild<K extends Record<string, any> = any> {
82
82
  formApi: FormApi<K>;
83
83
  }
84
84
  export interface BaseFormProps {
85
+ 'aria-label'?: React.AriaAttributes['aria-label'];
85
86
  onSubmit?: (values: Record<string, any>) => void;
86
87
  onSubmitFail?: (errors: Record<string, FieldError>, values: any) => void;
87
88
  onReset?: () => void;
@@ -90,6 +91,7 @@ export interface BaseFormProps {
90
91
  validateFields?: (values: Record<string, any>) => string | Record<string, any>;
91
92
  /** Use this if you want to populate the form with initial values. */
92
93
  initValues?: Record<string, any>;
94
+ id?: string;
93
95
  /** getFormApi will be call once when Form mounted, u can save formApi reference in your component */
94
96
  getFormApi?: (formApi: FormApi) => void;
95
97
  style?: React.CSSProperties;
@@ -1,6 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  export interface LabelProps {
4
+ id?: string;
4
5
  /** Whether to display the required * symbol */
5
6
  required?: boolean;
6
7
  /** Content of label */
@@ -24,6 +25,7 @@ export default class Label extends PureComponent<LabelProps> {
24
25
  className: string;
25
26
  };
26
27
  static propTypes: {
28
+ id: PropTypes.Requireable<string>;
27
29
  children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
28
30
  required: PropTypes.Requireable<boolean>;
29
31
  text: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -15,7 +15,8 @@ export default class Label extends PureComponent {
15
15
  align,
16
16
  style,
17
17
  className,
18
- extra
18
+ extra,
19
+ id
19
20
  } = this.props;
20
21
  const labelCls = classNames(className, {
21
22
  ["".concat(prefixCls, "-field-label")]: true,
@@ -36,7 +37,8 @@ export default class Label extends PureComponent {
36
37
  return /*#__PURE__*/React.createElement("label", {
37
38
  className: labelCls,
38
39
  htmlFor: name,
39
- style: labelStyle
40
+ style: labelStyle,
41
+ id: id
40
42
  }, extra ? contentWithExtra : textContent);
41
43
  }
42
44
 
@@ -48,6 +50,7 @@ Label.defaultProps = {
48
50
  className: ''
49
51
  };
50
52
  Label.propTypes = {
53
+ id: PropTypes.string,
51
54
  children: PropTypes.node,
52
55
  required: PropTypes.bool,
53
56
  text: PropTypes.node,
@@ -9,6 +9,12 @@ export declare type InputSize = 'small' | 'large' | 'default';
9
9
  export declare type InputMode = 'password';
10
10
  export declare type ValidateStatus = "default" | "error" | "warning" | "success";
11
11
  export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'prefix' | 'size' | 'autoFocus' | 'placeholder' | 'onFocus' | 'onBlur'> {
12
+ 'aria-label'?: React.AriaAttributes['aria-label'];
13
+ 'aria-describedby'?: React.AriaAttributes['aria-describedby'];
14
+ 'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
15
+ 'aria-invalid'?: React.AriaAttributes['aria-invalid'];
16
+ 'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
17
+ 'aria-required'?: React.AriaAttributes['aria-required'];
12
18
  addonBefore?: React.ReactNode;
13
19
  addonAfter?: React.ReactNode;
14
20
  prefix?: React.ReactNode;
@@ -24,6 +30,7 @@ export interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElem
24
30
  hideSuffix?: boolean;
25
31
  placeholder?: React.ReactText;
26
32
  insetLabel?: React.ReactNode;
33
+ insetLabelId?: string;
27
34
  size?: InputSize;
28
35
  className?: string;
29
36
  style?: React.CSSProperties;
@@ -54,6 +61,12 @@ export interface InputState {
54
61
  }
55
62
  declare class Input extends BaseComponent<InputProps, InputState> {
56
63
  static propTypes: {
64
+ 'aria-label': PropTypes.Requireable<string>;
65
+ 'aria-labelledby': PropTypes.Requireable<string>;
66
+ 'aria-invalid': PropTypes.Requireable<boolean>;
67
+ 'aria-errormessage': PropTypes.Requireable<string>;
68
+ 'aria-describedby': PropTypes.Requireable<string>;
69
+ 'aria-required': PropTypes.Requireable<boolean>;
57
70
  addonBefore: PropTypes.Requireable<PropTypes.ReactNodeLike>;
58
71
  addonAfter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
59
72
  prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -82,6 +95,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
82
95
  onKeyPress: PropTypes.Requireable<(...args: any[]) => any>;
83
96
  onEnterPress: PropTypes.Requireable<(...args: any[]) => any>;
84
97
  insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
98
+ insetLabelId: PropTypes.Requireable<string>;
85
99
  inputStyle: PropTypes.Requireable<object>;
86
100
  getValueLength: PropTypes.Requireable<(...args: any[]) => any>;
87
101
  };
@@ -147,6 +161,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
147
161
  static getDerivedStateFromProps(props: InputProps, state: InputState): Partial<InputState>;
148
162
  componentDidUpdate(prevProps: InputProps): void;
149
163
  handleClear: (e: React.MouseEvent<HTMLInputElement>) => void;
164
+ handleClearEnterPress: (e: React.KeyboardEvent<HTMLDivElement>) => void;
150
165
  handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
151
166
  handleMouseOver: (e: React.MouseEvent<HTMLDivElement>) => void;
152
167
  handleMouseLeave: (e: React.MouseEvent<HTMLDivElement>) => void;
@@ -154,6 +169,7 @@ declare class Input extends BaseComponent<InputProps, InputState> {
154
169
  handleClickEye: (e: React.MouseEvent<HTMLInputElement>) => void;
155
170
  handleMouseDown: (e: React.MouseEvent<HTMLInputElement>) => void;
156
171
  handleMouseUp: (e: React.MouseEvent<HTMLInputElement>) => void;
172
+ handleModeEnterPress: (e: React.KeyboardEvent<HTMLDivElement>) => void;
157
173
  handleClickPrefixOrSuffix: (e: React.MouseEvent<HTMLInputElement>) => void;
158
174
  handlePreventMouseDown: (e: React.MouseEvent<HTMLInputElement>) => void;
159
175
  renderPrepend(): JSX.Element;
@@ -41,6 +41,10 @@ class Input extends BaseComponent {
41
41
  this.foundation.handleClear(e);
42
42
  };
43
43
 
44
+ this.handleClearEnterPress = e => {
45
+ this.foundation.handleClearEnterPress(e);
46
+ };
47
+
44
48
  this.handleClick = e => {
45
49
  this.foundation.handleClick(e);
46
50
  };
@@ -73,6 +77,10 @@ class Input extends BaseComponent {
73
77
  this.foundation.handleMouseUp(e);
74
78
  };
75
79
 
80
+ this.handleModeEnterPress = e => {
81
+ this.foundation.handleModeEnterPress(e);
82
+ };
83
+
76
84
  this.handleClickPrefixOrSuffix = e => {
77
85
  this.foundation.handleClickPrefixOrSuffix(e);
78
86
  };
@@ -207,8 +215,12 @@ class Input extends BaseComponent {
207
215
 
208
216
  if (allowClear) {
209
217
  return /*#__PURE__*/React.createElement("div", {
218
+ role: "button",
219
+ tabIndex: 0,
220
+ "aria-label": "Clear input value",
210
221
  className: clearCls,
211
- onMouseDown: this.handleClear
222
+ onMouseDown: this.handleClear,
223
+ onKeyPress: this.handleClearEnterPress
212
224
  }, /*#__PURE__*/React.createElement(IconClear, null));
213
225
  }
214
226
 
@@ -229,13 +241,18 @@ class Input extends BaseComponent {
229
241
  const modeCls = cls("".concat(prefixCls, "-modebtn"));
230
242
  const modeIcon = eyeClosed ? /*#__PURE__*/React.createElement(IconEyeClosedSolid, null) : /*#__PURE__*/React.createElement(IconEyeOpened, null);
231
243
  const showModeBtn = mode === 'password' && value && !disabled && (isFocus || isHovering);
244
+ const ariaLabel = eyeClosed ? 'Show password' : 'Hidden password';
232
245
 
233
246
  if (showModeBtn) {
234
247
  return /*#__PURE__*/React.createElement("div", {
248
+ role: "button",
249
+ tabIndex: 0,
250
+ "aria-label": ariaLabel,
235
251
  className: modeCls,
236
252
  onClick: this.handleClickEye,
237
253
  onMouseDown: this.handleMouseDown,
238
- onMouseUp: this.handleMouseUp
254
+ onMouseUp: this.handleMouseUp,
255
+ onKeyPress: this.handleModeEnterPress
239
256
  }, modeIcon);
240
257
  }
241
258
 
@@ -245,7 +262,8 @@ class Input extends BaseComponent {
245
262
  renderPrefix() {
246
263
  const {
247
264
  prefix,
248
- insetLabel
265
+ insetLabel,
266
+ insetLabelId
249
267
  } = this.props;
250
268
  const labelNode = prefix || insetLabel;
251
269
 
@@ -258,11 +276,13 @@ class Input extends BaseComponent {
258
276
  ["".concat(prefixCls, "-inset-label")]: insetLabel,
259
277
  ["".concat(prefixCls, "-prefix-text")]: labelNode && _isString(labelNode),
260
278
  ["".concat(prefixCls, "-prefix-icon")]: isSemiIcon(labelNode)
261
- });
279
+ }); // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
280
+
262
281
  return /*#__PURE__*/React.createElement("div", {
263
282
  className: prefixWrapperCls,
264
283
  onMouseDown: this.handlePreventMouseDown,
265
- onClick: this.handleClickPrefixOrSuffix
284
+ onClick: this.handleClickPrefixOrSuffix,
285
+ id: insetLabelId
266
286
  }, labelNode);
267
287
  }
268
288
 
@@ -294,7 +314,8 @@ class Input extends BaseComponent {
294
314
  ["".concat(prefixCls, "-suffix-text")]: suffix && _isString(suffix),
295
315
  ["".concat(prefixCls, "-suffix-icon")]: isSemiIcon(suffix),
296
316
  ["".concat(prefixCls, "-suffix-hidden")]: suffixAllowClear && Boolean(hideSuffix)
297
- });
317
+ }); // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
318
+
298
319
  return /*#__PURE__*/React.createElement("div", {
299
320
  className: suffixWrapperCls,
300
321
  onMouseDown: this.handlePreventMouseDown,
@@ -398,20 +419,34 @@ class Input extends BaseComponent {
398
419
  inputProps.minLength = stateMinLength;
399
420
  }
400
421
 
401
- return /*#__PURE__*/React.createElement("div", {
402
- className: wrapperCls,
403
- style: style,
404
- onMouseEnter: e => this.handleMouseOver(e),
405
- onMouseLeave: e => this.handleMouseLeave(e),
406
- onClick: e => this.handleClick(e)
407
- }, this.renderPrepend(), this.renderPrefix(), /*#__PURE__*/React.createElement("input", _Object$assign({}, inputProps, {
408
- ref: ref
409
- })), this.renderClearBtn(), this.renderSuffix(suffixAllowClear), this.renderModeBtn(), this.renderAppend());
422
+ if (validateStatus === 'error') {
423
+ inputProps['aria-invalid'] = "true";
424
+ }
425
+
426
+ return (
427
+ /*#__PURE__*/
428
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
429
+ React.createElement("div", {
430
+ className: wrapperCls,
431
+ style: style,
432
+ onMouseEnter: e => this.handleMouseOver(e),
433
+ onMouseLeave: e => this.handleMouseLeave(e),
434
+ onClick: e => this.handleClick(e)
435
+ }, this.renderPrepend(), this.renderPrefix(), /*#__PURE__*/React.createElement("input", _Object$assign({}, inputProps, {
436
+ ref: ref
437
+ })), this.renderClearBtn(), this.renderSuffix(suffixAllowClear), this.renderModeBtn(), this.renderAppend())
438
+ );
410
439
  }
411
440
 
412
441
  }
413
442
 
414
443
  Input.propTypes = {
444
+ 'aria-label': PropTypes.string,
445
+ 'aria-labelledby': PropTypes.string,
446
+ 'aria-invalid': PropTypes.bool,
447
+ 'aria-errormessage': PropTypes.string,
448
+ 'aria-describedby': PropTypes.string,
449
+ 'aria-required': PropTypes.bool,
415
450
  addonBefore: PropTypes.node,
416
451
  addonAfter: PropTypes.node,
417
452
  prefix: PropTypes.node,
@@ -440,6 +475,7 @@ Input.propTypes = {
440
475
  onKeyPress: PropTypes.func,
441
476
  onEnterPress: PropTypes.func,
442
477
  insetLabel: PropTypes.node,
478
+ insetLabelId: PropTypes.string,
443
479
  inputStyle: PropTypes.object,
444
480
  getValueLength: PropTypes.func
445
481
  };
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import BaseComponent from '../_base/baseComponent';
4
+ import { LabelProps } from '../form/label';
4
5
  import { noop } from '@douyinfe/semi-foundation/lib/es/utils/function';
5
6
  export declare type InputSize = 'small' | 'large' | 'default';
6
7
  export interface InputGroupProps {
@@ -10,7 +11,7 @@ export interface InputGroupProps {
10
11
  style?: Record<string, any>;
11
12
  onBlur?: (e: React.FocusEvent<HTMLSpanElement>) => void;
12
13
  onFocus?: (e: React.FocusEvent<HTMLSpanElement>) => void;
13
- label?: Record<string, any>;
14
+ label?: LabelProps;
14
15
  labelPosition?: string;
15
16
  disabled?: boolean;
16
17
  }
@@ -51,9 +51,16 @@ export default class inputGroup extends BaseComponent {
51
51
  [_concatInstanceProperty(_context = "".concat(prefixCls, "-")).call(_context, size)]: size !== 'default'
52
52
  }); // const labelCls = cls(label.className, '');
53
53
 
54
+ const defaultName = 'input-group';
54
55
  return /*#__PURE__*/React.createElement("div", {
56
+ role: "group",
57
+ "aria-label": "Input group",
58
+ "aria-disabled": this.props.disabled,
55
59
  className: groupWrapperCls
56
- }, label && label.text ? /*#__PURE__*/React.createElement(Label, _Object$assign({}, label)) : null, /*#__PURE__*/React.createElement("span", {
60
+ }, label && label.text ? /*#__PURE__*/React.createElement(Label, _Object$assign({
61
+ name: defaultName
62
+ }, label)) : null, /*#__PURE__*/React.createElement("span", {
63
+ id: label && label.name || defaultName,
57
64
  className: groupCls,
58
65
  style: this.props.style,
59
66
  onFocus: this.props.onFocus,
@@ -109,6 +116,9 @@ export default class inputGroup extends BaseComponent {
109
116
  }
110
117
 
111
118
  return /*#__PURE__*/React.createElement("span", {
119
+ role: "group",
120
+ "aria-label": "Input group",
121
+ "aria-disabled": this.props.disabled,
112
122
  className: groupCls,
113
123
  style: style,
114
124
  onFocus: this.props.onFocus,