@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
@@ -1,3 +1,4 @@
1
+ import _isFunction from "lodash/isFunction";
1
2
  import _isNull from "lodash/isNull";
2
3
  import _pick from "lodash/pick";
3
4
  import _isEqual from "lodash/isEqual";
@@ -37,7 +38,7 @@ import React from 'react';
37
38
  import PropTypes from 'prop-types';
38
39
  import classnames from 'classnames';
39
40
  import { VariableSizeList as List } from 'react-window';
40
- import { arrayAdd, getRecordKey, isExpanded, isSelected, isDisabled, getRecord, genExpandedRowKey, getDefaultVirtualizedRowConfig } from '@douyinfe/semi-foundation/lib/es/table/utils';
41
+ import { arrayAdd, getRecordKey, isExpanded, isSelected, isDisabled, getRecord, genExpandedRowKey, getDefaultVirtualizedRowConfig, isTreeTable } from '@douyinfe/semi-foundation/lib/es/table/utils';
41
42
  import BodyFoundation from '@douyinfe/semi-foundation/lib/es/table/bodyFoundation';
42
43
  import { strings } from '@douyinfe/semi-foundation/lib/es/table/constants';
43
44
  import BaseComponent from '../../_base/baseComponent';
@@ -494,7 +495,8 @@ class Body extends BaseComponent {
494
495
  includeHeader,
495
496
  dataSource,
496
497
  onScroll,
497
- groups
498
+ groups,
499
+ expandedRowRender
498
500
  } = this.props;
499
501
 
500
502
  const x = _get(scroll, 'x');
@@ -538,6 +540,11 @@ class Body extends BaseComponent {
538
540
  onWheel: handleWheel,
539
541
  onScroll: handleBodyScroll
540
542
  }, /*#__PURE__*/React.createElement(Table, {
543
+ role: _isMap(groups) || _isFunction(expandedRowRender) || isTreeTable({
544
+ dataSource
545
+ }) ? 'treegrid' : 'grid',
546
+ "aria-rowcount": dataSource && dataSource.length,
547
+ "aria-colcount": columns && columns.length,
541
548
  style: tableStyle,
542
549
  className: classnames(prefixCls, {
543
550
  ["".concat(prefixCls, "-fixed")]: anyColumnFixed
@@ -154,6 +154,10 @@ export default function ColumnFilter() {
154
154
  iconElem = /*#__PURE__*/React.createElement("div", {
155
155
  className: finalCls
156
156
  }, /*#__PURE__*/React.createElement(IconFilter, {
157
+ role: "button",
158
+ "aria-label": "Filter data with this column",
159
+ "aria-haspopup": "listbox",
160
+ tabIndex: -1,
157
161
  size: "small"
158
162
  }));
159
163
  }
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import BaseComponent from '../_base/baseComponent';
2
3
  import PropTypes from 'prop-types';
3
4
  import { TableSelectionCellAdapter, TableSelectionCellEvent } from '@douyinfe/semi-foundation/lib/es/table/tableSelectionCellFoundation';
@@ -12,6 +13,7 @@ export interface TableSelectionCellProps {
12
13
  indeterminate?: boolean;
13
14
  prefixCls?: string;
14
15
  className?: string;
16
+ 'aria-label'?: React.AriaAttributes['aria-label'];
15
17
  }
16
18
  /**
17
19
  * render selection cell
@@ -27,6 +29,7 @@ export default class TableSelectionCell extends BaseComponent<TableSelectionCell
27
29
  indeterminate: PropTypes.Requireable<boolean>;
28
30
  prefixCls: PropTypes.Requireable<string>;
29
31
  className: PropTypes.Requireable<string>;
32
+ 'aria-label': PropTypes.Requireable<string>;
30
33
  };
31
34
  static defaultProps: {
32
35
  disabled: boolean;
@@ -41,6 +41,7 @@ export default class TableSelectionCell extends BaseComponent {
41
41
  prefixCls,
42
42
  className
43
43
  } = this.props;
44
+ const ariaLabel = this.props['aria-label'];
44
45
  let checkboxProps = {
45
46
  onChange: this.handleChange,
46
47
  disabled,
@@ -57,7 +58,9 @@ export default class TableSelectionCell extends BaseComponent {
57
58
  }, className);
58
59
  return /*#__PURE__*/React.createElement("span", {
59
60
  className: wrapCls
60
- }, /*#__PURE__*/React.createElement(Checkbox, _Object$assign({}, checkboxProps)));
61
+ }, /*#__PURE__*/React.createElement(Checkbox, _Object$assign({
62
+ "aria-label": ariaLabel
63
+ }, checkboxProps)));
61
64
  }
62
65
 
63
66
  }
@@ -70,7 +73,8 @@ TableSelectionCell.propTypes = {
70
73
  disabled: PropTypes.bool,
71
74
  indeterminate: PropTypes.bool,
72
75
  prefixCls: PropTypes.string,
73
- className: PropTypes.string
76
+ className: PropTypes.string,
77
+ 'aria-label': PropTypes.string
74
78
  };
75
79
  TableSelectionCell.defaultProps = {
76
80
  disabled: false,
@@ -1,9 +1,11 @@
1
1
  import _noop from "lodash/noop";
2
+ import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
2
3
  import React, { PureComponent } from 'react';
3
4
  import PropTypes from 'prop-types';
4
5
  import cls from 'classnames';
5
6
  import { IconCaretup, IconCaretdown } from '@douyinfe/semi-icons';
6
7
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/table/constants';
8
+ import isEnterPress from '@douyinfe/semi-foundation/lib/es/utils/isEnterPress';
7
9
  export default class ColumnSorter extends PureComponent {
8
10
  render() {
9
11
  const {
@@ -19,11 +21,23 @@ export default class ColumnSorter extends PureComponent {
19
21
  const downCls = cls("".concat(prefixCls, "-column-sorter-down"), {
20
22
  on: sortOrder === strings.SORT_DIRECTIONS[1]
21
23
  });
22
- return /*#__PURE__*/React.createElement("div", {
24
+ const ariaProps = {
25
+ /**
26
+ * Set 'aria-sort' to aria-columnheader is difficult, so set 'aria-label' about sort info to sorter
27
+ * reference: https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaSort
28
+ */
29
+ 'aria-label': "Current sort order is ".concat(sortOrder ? "".concat(sortOrder, "ing") : 'none'),
30
+ 'aria-roledescription': 'Sort data with this column'
31
+ };
32
+ return /*#__PURE__*/React.createElement("div", _Object$assign({
33
+ role: 'button'
34
+ }, ariaProps, {
35
+ tabIndex: -1,
23
36
  style: style,
24
37
  className: "".concat(prefixCls, "-column-sorter"),
25
- onClick: onClick
26
- }, /*#__PURE__*/React.createElement("span", {
38
+ onClick: onClick,
39
+ onKeyPress: e => isEnterPress(e) && onClick(e)
40
+ }), /*#__PURE__*/React.createElement("span", {
27
41
  className: "".concat(upCls)
28
42
  }, /*#__PURE__*/React.createElement(IconCaretup, {
29
43
  size: iconBtnSize
@@ -5,6 +5,7 @@ import React, { useCallback } from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { IconChevronRight, IconChevronDown, IconTreeTriangleDown, IconTreeTriangleRight } from '@douyinfe/semi-icons';
7
7
  import { cssClasses } from '@douyinfe/semi-foundation/lib/es/table/constants';
8
+ import isEnterPress from '@douyinfe/semi-foundation/lib/es/utils/isEnterPress';
8
9
  import Rotate from '../motions/Rotate';
9
10
  /**
10
11
  * render expand icon
@@ -51,10 +52,14 @@ export default function CustomExpandIcon(props) {
51
52
  }
52
53
 
53
54
  return /*#__PURE__*/React.createElement("span", {
55
+ role: "button",
56
+ "aria-label": "Expand this row",
57
+ tabIndex: -1,
54
58
  onClick: handleClick,
55
59
  onMouseEnter: onMouseEnter,
56
60
  onMouseLeave: onMouseLeave,
57
- className: "".concat(prefixCls, "-expand-icon")
61
+ className: "".concat(prefixCls, "-expand-icon"),
62
+ onKeyPress: e => isEnterPress(e) && handleClick(e)
58
63
  }, icon);
59
64
  }
60
65
  CustomExpandIcon.propTypes = {
@@ -31,6 +31,7 @@ export interface NormalTableState<RecordType extends Record<string, any> = Data>
31
31
  bodyHasScrollBar?: boolean;
32
32
  prePropRowSelection?: TableStateRowSelection<RecordType>;
33
33
  tableWidth?: number;
34
+ prePagination?: Pagination;
34
35
  }
35
36
  export declare type TableStateRowSelection<RecordType extends Record<string, any> = Data> = (RowSelectionProps<RecordType> & {
36
37
  selectedRowKeysSet?: Set<(string | number)>;
@@ -229,6 +230,7 @@ declare class Table<RecordType extends Record<string, any>> extends BaseComponen
229
230
  /**
230
231
  * render pagination
231
232
  * @param {object} pagination
233
+ * @param {object} propRenderPagination
232
234
  */
233
235
  renderPagination: (pagination: TablePaginationProps, propRenderPagination: RenderPagination) => JSX.Element;
234
236
  renderTitle: (props?: {
@@ -335,6 +335,7 @@ class Table extends BaseComponent {
335
335
  const hasRowSelected = _this.foundation.hasRowSelected(selectedRowKeys, allRowKeysSet);
336
336
 
337
337
  return /*#__PURE__*/React.createElement(ColumnSelection, {
338
+ "aria-label": "".concat(allIsSelected ? 'Deselect' : 'Select', " all rows"),
338
339
  disabled: disabled,
339
340
  key: columnKey,
340
341
  selected: allIsSelected,
@@ -351,6 +352,7 @@ class Table extends BaseComponent {
351
352
  const checkboxPropsFn = () => typeof getCheckboxProps === 'function' ? getCheckboxProps(record) : {};
352
353
 
353
354
  return /*#__PURE__*/React.createElement(ColumnSelection, {
355
+ "aria-label": "".concat(selected ? 'Deselect' : 'Select', " this row"),
354
356
  getCheckboxProps: checkboxPropsFn,
355
357
  selected: selected,
356
358
  onChange: (status, e) => _this.toggleSelectRow(status, key, e)
@@ -535,6 +537,7 @@ class Table extends BaseComponent {
535
537
  /**
536
538
  * render pagination
537
539
  * @param {object} pagination
540
+ * @param {object} propRenderPagination
538
541
  */
539
542
 
540
543
 
@@ -841,7 +844,8 @@ class Table extends BaseComponent {
841
844
  disabledRowKeysSet: new _Set(),
842
845
  headWidths: [],
843
846
  bodyHasScrollBar: false,
844
- prePropRowSelection: undefined
847
+ prePropRowSelection: undefined,
848
+ prePagination: undefined
845
849
  };
846
850
  this.rootWrapRef = /*#__PURE__*/createRef();
847
851
  this.wrapRef = /*#__PURE__*/createRef(); // table's outside wrap
@@ -1081,7 +1085,8 @@ class Table extends BaseComponent {
1081
1085
  rowSelection,
1082
1086
  dataSource,
1083
1087
  childrenRecordName,
1084
- rowKey
1088
+ rowKey,
1089
+ pagination
1085
1090
  } = props;
1086
1091
  props.columns && props.children && logger.warn('columns should not given by object and children at the same time');
1087
1092
 
@@ -1136,6 +1141,21 @@ class Table extends BaseComponent {
1136
1141
  willUpdateStates.prePropRowSelection = rowSelection;
1137
1142
  }
1138
1143
 
1144
+ if (pagination !== state.prePagination) {
1145
+ let newPagination = {};
1146
+
1147
+ if (_isObject(state.pagination)) {
1148
+ newPagination = _Object$assign(_Object$assign({}, newPagination), state.pagination);
1149
+ }
1150
+
1151
+ if (_isObject(pagination)) {
1152
+ newPagination = _Object$assign(_Object$assign({}, newPagination), pagination);
1153
+ }
1154
+
1155
+ willUpdateStates.pagination = newPagination;
1156
+ willUpdateStates.prePagination = pagination;
1157
+ }
1158
+
1139
1159
  return willUpdateStates;
1140
1160
  }
1141
1161
 
@@ -1151,15 +1171,16 @@ class Table extends BaseComponent {
1151
1171
 
1152
1172
  componentDidUpdate(prevProps, prevState) {
1153
1173
  const {
1154
- pagination,
1155
1174
  dataSource,
1156
1175
  expandedRowKeys,
1157
1176
  expandAllRows,
1158
1177
  expandAllGroupRows,
1159
1178
  virtualized,
1160
- components
1179
+ components,
1180
+ pagination: propsPagination
1161
1181
  } = this.props;
1162
1182
  const {
1183
+ pagination: statePagination,
1163
1184
  queries: stateQueries,
1164
1185
  cachedColumns: stateCachedColumns,
1165
1186
  cachedChildren: stateCachedChildren,
@@ -1203,11 +1224,6 @@ class Table extends BaseComponent {
1203
1224
  this.foundation.initExpandedRowKeys({
1204
1225
  groups: stateGroups
1205
1226
  });
1206
- } // Update pagination
1207
-
1208
-
1209
- if (pagination !== prevProps.pagination) {
1210
- states.pagination = _isObject(pagination) ? _Object$assign({}, pagination) : pagination;
1211
1227
  }
1212
1228
  /**
1213
1229
  * After dataSource is updated || (cachedColumns || cachedChildren updated)
@@ -1222,11 +1238,11 @@ class Table extends BaseComponent {
1222
1238
  const _dataSource = [...dataSource];
1223
1239
  const filteredSortedDataSource = this.foundation.getFilteredSortedDataSource(_dataSource, stateQueries);
1224
1240
  this.foundation.setCachedFilteredSortedDataSource(filteredSortedDataSource);
1225
- states.dataSource = filteredSortedDataSource;
1241
+ states.dataSource = filteredSortedDataSource; // when dataSource has change, should reset currentPage
1226
1242
 
1227
- if (pagination === prevProps.pagination) {
1228
- states.pagination = _isObject(pagination) ? _Object$assign({}, pagination) : pagination;
1229
- }
1243
+ states.pagination = _isObject(statePagination) ? _Object$assign(_Object$assign({}, statePagination), {
1244
+ currentPage: _isObject(propsPagination) && propsPagination.currentPage ? propsPagination.currentPage : 1
1245
+ }) : statePagination;
1230
1246
 
1231
1247
  if (this.props.groupBy) {
1232
1248
  states.groups = null;
@@ -1236,11 +1252,11 @@ class Table extends BaseComponent {
1236
1252
  if (_Object$keys(states).length) {
1237
1253
  const {
1238
1254
  // eslint-disable-next-line @typescript-eslint/no-shadow
1255
+ pagination: mergedStatePagination = null,
1239
1256
  queries: stateQueries = null,
1240
- pagination: statePagination = null,
1241
1257
  dataSource: stateDataSource = null
1242
1258
  } = states;
1243
- const handledProps = this.foundation.getCurrentPageData(stateDataSource, statePagination, stateQueries); // After the pager is updated, reset allRowKeys of the current page
1259
+ const handledProps = this.foundation.getCurrentPageData(stateDataSource, mergedStatePagination, stateQueries); // After the pager is updated, reset allRowKeys of the current page
1244
1260
 
1245
1261
  this.adapter.setAllRowKeys(handledProps.allRowKeys);
1246
1262
  this.adapter.setDisabledRowKeys(handledProps.disabledRowKeys);
@@ -31,6 +31,7 @@ export interface TableCellProps extends BaseProps {
31
31
  selected?: boolean;
32
32
  expanded?: boolean;
33
33
  disabled?: boolean;
34
+ colIndex?: number;
34
35
  }
35
36
  export default class TableCell extends BaseComponent<TableCellProps, Record<string, any>> {
36
37
  static contextType: React.Context<import("./table-context").TableContextProps>;
@@ -65,6 +66,7 @@ export default class TableCell extends BaseComponent<TableCellProps, Record<stri
65
66
  height: PropTypes.Requireable<string | number>;
66
67
  selected: PropTypes.Requireable<boolean>;
67
68
  expanded: PropTypes.Requireable<boolean>;
69
+ colIndex: PropTypes.Requireable<number>;
68
70
  };
69
71
  get adapter(): TableCellAdapter;
70
72
  ref: React.MutableRefObject<any>;
@@ -288,7 +288,8 @@ export default class TableCell extends BaseComponent {
288
288
  fixedLeft,
289
289
  fixedRight,
290
290
  lastFixedLeft,
291
- firstFixedRight
291
+ firstFixedRight,
292
+ colIndex
292
293
  } = this.props;
293
294
  const {
294
295
  className
@@ -327,6 +328,8 @@ export default class TableCell extends BaseComponent {
327
328
  ["".concat(prefixCls, "-cell-fixed-right-first")]: firstFixedRight
328
329
  });
329
330
  return /*#__PURE__*/React.createElement(BodyCell, _Object$assign({
331
+ role: "gridcell",
332
+ "aria-colindex": colIndex + 1,
330
333
  className: columnCls,
331
334
  onClick: this.handleClick
332
335
  }, newTdProps, {
@@ -366,5 +369,6 @@ TableCell.propTypes = {
366
369
  width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
367
370
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
368
371
  selected: PropTypes.bool,
369
- expanded: PropTypes.bool
372
+ expanded: PropTypes.bool,
373
+ colIndex: PropTypes.number
370
374
  };
@@ -157,13 +157,19 @@ export default class TableHeaderRow extends BaseComponent {
157
157
  return null;
158
158
  }
159
159
 
160
- return /*#__PURE__*/React.createElement(HeaderCell, _Object$assign({}, props, {
160
+ return /*#__PURE__*/React.createElement(HeaderCell, _Object$assign({
161
+ role: "columnheader",
162
+ "aria-colindex": cellIndex + 1
163
+ }, props, {
161
164
  style: cellStyle,
162
165
  key: column.key || column.dataIndex || cellIndex
163
166
  }));
164
167
  });
165
168
 
166
- return /*#__PURE__*/React.createElement(HeaderRow, _Object$assign({}, rowProps, {
169
+ return /*#__PURE__*/React.createElement(HeaderRow, _Object$assign({
170
+ role: "row",
171
+ "aria-rowindex": index + 1
172
+ }, rowProps, {
167
173
  style: style,
168
174
  ref: this.cacheRef
169
175
  }), cells);
@@ -57,6 +57,8 @@ class TabBar extends React.Component {
57
57
  } = this.props;
58
58
  const panelIcon = panel.icon ? this.renderIcon(panel.icon) : null;
59
59
  const closableIcon = type === 'card' && panel.closable ? /*#__PURE__*/React.createElement(IconClose, {
60
+ "aria-label": "Close",
61
+ role: "button",
60
62
  className: "".concat(cssClasses.TABS_TAB, "-icon-close"),
61
63
  onClick: e => deleteTabItem(panel.itemKey, e)
62
64
  }) : null;
@@ -69,16 +71,20 @@ class TabBar extends React.Component {
69
71
  };
70
72
  }
71
73
 
74
+ const isSelected = this._isActive(key);
75
+
72
76
  const className = cls(cssClasses.TABS_TAB, {
73
- [cssClasses.TABS_TAB_ACTIVE]: this._isActive(key),
77
+ [cssClasses.TABS_TAB_ACTIVE]: isSelected,
74
78
  [cssClasses.TABS_TAB_DISABLED]: panel.disabled,
75
79
  ["".concat(cssClasses.TABS_TAB, "-small")]: size === 'small',
76
80
  ["".concat(cssClasses.TABS_TAB, "-medium")]: size === 'medium'
77
81
  });
78
82
  return /*#__PURE__*/React.createElement("div", _Object$assign({
79
83
  role: "tab",
84
+ id: "semiTab".concat(key),
85
+ "aria-controls": "semiTabPanel".concat(key),
80
86
  "aria-disabled": panel.disabled ? 'true' : 'false',
81
- "aria-selected": this._isActive(key) ? 'true' : 'false'
87
+ "aria-selected": isSelected ? 'true' : 'false'
82
88
  }, events, {
83
89
  className: className,
84
90
  key: this._getItemKey(key)
@@ -154,6 +160,7 @@ class TabBar extends React.Component {
154
160
  style: dropdownStyle,
155
161
  trigger: 'hover'
156
162
  }, /*#__PURE__*/React.createElement("div", {
163
+ role: "presentation",
157
164
  className: arrowCls,
158
165
  onClick: e => this.handleArrowClick(items, pos)
159
166
  }, /*#__PURE__*/React.createElement(Button, {
@@ -264,7 +271,8 @@ class TabBar extends React.Component {
264
271
  const extra = this.renderExtra();
265
272
  const contents = collapsible ? this.renderCollapsedTab() : this.renderTabComponents(list);
266
273
  return /*#__PURE__*/React.createElement("div", _Object$assign({
267
- role: "tab-list",
274
+ role: "tablist",
275
+ "aria-orientation": tabPosition === "left" ? "vertical" : "horizontal",
268
276
  className: classNames,
269
277
  style: style
270
278
  }, getDataAttr(restProps), {
@@ -105,7 +105,9 @@ class TabPane extends PureComponent {
105
105
  const shouldRender = this.shouldRender();
106
106
  return /*#__PURE__*/React.createElement("div", _Object$assign({
107
107
  ref: this.ref,
108
- role: "tab-panel",
108
+ role: "tabpanel",
109
+ id: "semiTabPanel".concat(itemKey),
110
+ "aria-labelledby": "semiTab".concat(itemKey),
109
111
  className: classNames,
110
112
  style: style,
111
113
  "aria-hidden": active ? 'false' : 'true'
@@ -328,7 +328,6 @@ class Tabs extends BaseComponent {
328
328
  }
329
329
  }, /*#__PURE__*/React.createElement("div", {
330
330
  ref: this.setContentRef,
331
- role: "tab-content",
332
331
  className: tabContentCls,
333
332
  style: _Object$assign({}, contentStyle)
334
333
  }, content)));
@@ -40,8 +40,9 @@ export interface TagInputProps {
40
40
  style?: React.CSSProperties;
41
41
  suffix?: React.ReactNode;
42
42
  validateStatus?: ValidateStatus;
43
- value?: string[];
43
+ value?: string[] | undefined;
44
44
  autoFocus?: boolean;
45
+ 'aria-label'?: string;
45
46
  }
46
47
  export interface TagInputState {
47
48
  tagsArray?: string[];
@@ -84,6 +85,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
84
85
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning">;
85
86
  prefix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
86
87
  suffix: PropTypes.Requireable<PropTypes.ReactNodeLike>;
88
+ 'aria-label': PropTypes.Requireable<string>;
87
89
  };
88
90
  static defaultProps: {
89
91
  showClear: boolean;
@@ -118,6 +120,7 @@ declare class TagInput extends BaseComponent<TagInputProps, TagInputState> {
118
120
  handleInputFocus: (e: React.MouseEvent<HTMLInputElement>) => void;
119
121
  handleInputBlur: (e: React.MouseEvent<HTMLInputElement>) => void;
120
122
  handleClearBtn: (e: React.MouseEvent<HTMLDivElement>) => void;
123
+ handleClearEnterPress: (e: React.KeyboardEvent<HTMLDivElement>) => void;
121
124
  handleTagClose: (idx: number) => void;
122
125
  handleInputMouseLeave: (e: React.MouseEvent<HTMLDivElement>) => void;
123
126
  handleInputMouseEnter: (e: React.MouseEvent<HTMLDivElement>) => void;
@@ -45,6 +45,10 @@ class TagInput extends BaseComponent {
45
45
  this.foundation.handleClearBtn(e);
46
46
  };
47
47
 
48
+ this.handleClearEnterPress = e => {
49
+ this.foundation.handleClearEnterPress(e);
50
+ };
51
+
48
52
  this.handleTagClose = idx => {
49
53
  this.foundation.handleTagClose(idx);
50
54
  };
@@ -72,8 +76,21 @@ class TagInput extends BaseComponent {
72
76
  value,
73
77
  inputValue
74
78
  } = nextProps;
79
+ const {
80
+ tagsArray: prevTagsArray
81
+ } = prevState;
82
+ let tagsArray;
83
+
84
+ if (_isArray(value)) {
85
+ tagsArray = value;
86
+ } else if ('value' in nextProps && !value) {
87
+ tagsArray = [];
88
+ } else {
89
+ tagsArray = prevTagsArray;
90
+ }
91
+
75
92
  return {
76
- tagsArray: _isArray(value) ? value : prevState.tagsArray,
93
+ tagsArray,
77
94
  inputValue: _isString(inputValue) ? inputValue : prevState.inputValue
78
95
  };
79
96
  }
@@ -151,8 +168,12 @@ class TagInput extends BaseComponent {
151
168
 
152
169
  if (showClear) {
153
170
  return /*#__PURE__*/React.createElement("div", {
171
+ role: "button",
172
+ tabIndex: 0,
173
+ "aria-label": "Clear TagInput value",
154
174
  className: clearCls,
155
- onClick: e => this.handleClearBtn(e)
175
+ onClick: e => this.handleClearBtn(e),
176
+ onKeyPress: e => this.handleClearEnterPress(e)
156
177
  }, /*#__PURE__*/React.createElement(IconClear, null));
157
178
  }
158
179
 
@@ -307,6 +328,9 @@ class TagInput extends BaseComponent {
307
328
  return /*#__PURE__*/React.createElement("div", {
308
329
  style: style,
309
330
  className: tagInputCls,
331
+ "aria-disabled": disabled,
332
+ "aria-label": this.props['aria-label'],
333
+ "aria-invalid": validateStatus === 'error',
310
334
  onMouseEnter: e => {
311
335
  this.handleInputMouseEnter(e);
312
336
  },
@@ -316,6 +340,7 @@ class TagInput extends BaseComponent {
316
340
  }, this.renderPrefix(), /*#__PURE__*/React.createElement("div", {
317
341
  className: wrapperCls
318
342
  }, this.renderTags(), /*#__PURE__*/React.createElement(Input, {
343
+ "aria-label": 'input value',
319
344
  ref: this.inputRef,
320
345
  className: inputCls,
321
346
  disabled: disabled,
@@ -372,7 +397,8 @@ TagInput.propTypes = {
372
397
  size: PropTypes.oneOf(strings.SIZE_SET),
373
398
  validateStatus: PropTypes.oneOf(strings.STATUS),
374
399
  prefix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
375
- suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.node])
400
+ suffix: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
401
+ 'aria-label': PropTypes.string
376
402
  };
377
403
  TagInput.defaultProps = {
378
404
  showClear: false,
@@ -15,6 +15,11 @@ export interface Panel {
15
15
  export declare type BaseValueType = string | number | Date;
16
16
  export declare type Type = 'time' | 'timeRange';
17
17
  export declare type TimePickerProps = {
18
+ 'aria-describedby'?: React.AriaAttributes['aria-describedby'];
19
+ 'aria-errormessage'?: React.AriaAttributes['aria-errormessage'];
20
+ 'aria-invalid'?: React.AriaAttributes['aria-invalid'];
21
+ 'aria-labelledby'?: React.AriaAttributes['aria-labelledby'];
22
+ 'aria-required'?: React.AriaAttributes['aria-required'];
18
23
  autoAdjustOverflow?: boolean;
19
24
  autoFocus?: boolean;
20
25
  className?: string;
@@ -35,6 +40,7 @@ export declare type TimePickerProps = {
35
40
  inputReadOnly?: boolean;
36
41
  inputStyle?: React.CSSProperties;
37
42
  insetLabel?: React.ReactNode;
43
+ insetLabelId?: string;
38
44
  locale?: Locale['TimePicker'];
39
45
  localeCode?: string;
40
46
  minuteStep?: number;
@@ -83,6 +89,11 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
83
89
  inputStyle: PropTypes.Requireable<object>;
84
90
  panelHeader: PropTypes.Requireable<PropTypes.ReactNodeLike>;
85
91
  panelFooter: PropTypes.Requireable<PropTypes.ReactNodeLike>;
92
+ 'aria-labelledby': PropTypes.Requireable<string>;
93
+ 'aria-invalid': PropTypes.Requireable<boolean>;
94
+ 'aria-errormessage': PropTypes.Requireable<string>;
95
+ 'aria-describedby': PropTypes.Requireable<string>;
96
+ 'aria-required': PropTypes.Requireable<boolean>;
86
97
  prefixCls: PropTypes.Requireable<string>;
87
98
  clearText: PropTypes.Requireable<string>;
88
99
  value: PropTypes.Requireable<string | number | string[] | number[] | Date | Date[]>;
@@ -124,6 +135,7 @@ export default class TimePicker extends BaseComponent<TimePickerProps, TimePicke
124
135
  dateFnsLocale: PropTypes.Requireable<object>;
125
136
  zIndex: PropTypes.Requireable<string | number>;
126
137
  insetLabel: PropTypes.Requireable<PropTypes.ReactNodeLike>;
138
+ insetLabelId: PropTypes.Requireable<string>;
127
139
  validateStatus: PropTypes.Requireable<"default" | "error" | "warning" | "success">;
128
140
  type: PropTypes.Requireable<Type>;
129
141
  rangeSeparator: PropTypes.Requireable<string>;
@@ -291,6 +291,7 @@ export default class TimePicker extends BaseComponent {
291
291
  zIndex,
292
292
  getPopupContainer,
293
293
  insetLabel,
294
+ insetLabelId,
294
295
  inputStyle,
295
296
  showClear,
296
297
  panelHeader,
@@ -308,7 +309,7 @@ export default class TimePicker extends BaseComponent {
308
309
  motion,
309
310
  autoAdjustOverflow
310
311
  } = _a,
311
- rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow"]);
312
+ rest = __rest(_a, ["prefixCls", "placeholder", "disabled", "defaultValue", "className", "popupStyle", "size", "style", "locale", "localeCode", "zIndex", "getPopupContainer", "insetLabel", "insetLabelId", "inputStyle", "showClear", "panelHeader", "panelFooter", "rangeSeparator", "onOpenChange", "popupClassName", "hideDisabledOptions", "use12Hours", "minuteStep", "hourStep", "secondStep", "scrollItemProps", "triggerRender", "motion", "autoAdjustOverflow"]);
312
313
 
313
314
  const format = this.foundation.getDefaultFormatIfNeed();
314
315
  const position = this.foundation.getPosition();
@@ -337,6 +338,7 @@ export default class TimePicker extends BaseComponent {
337
338
  value: inputValue,
338
339
  onFocus: this.handleFocus,
339
340
  insetLabel,
341
+ insetLabelId,
340
342
  format,
341
343
  locale,
342
344
  localeCode,
@@ -387,6 +389,11 @@ export default class TimePicker extends BaseComponent {
387
389
  }
388
390
  TimePicker.contextType = ConfigContext;
389
391
  TimePicker.propTypes = _Object$assign(_Object$assign({
392
+ 'aria-labelledby': PropTypes.string,
393
+ 'aria-invalid': PropTypes.bool,
394
+ 'aria-errormessage': PropTypes.string,
395
+ 'aria-describedby': PropTypes.string,
396
+ 'aria-required': PropTypes.bool,
390
397
  prefixCls: PropTypes.string,
391
398
  clearText: PropTypes.string,
392
399
  value: TimeShape,
@@ -425,6 +432,7 @@ TimePicker.propTypes = _Object$assign(_Object$assign({
425
432
  dateFnsLocale: PropTypes.object,
426
433
  zIndex: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
427
434
  insetLabel: PropTypes.node,
435
+ insetLabelId: PropTypes.string,
428
436
  validateStatus: PropTypes.oneOf(strings.STATUS),
429
437
  type: PropTypes.oneOf(strings.TYPES),
430
438
  rangeSeparator: PropTypes.string,
@@ -11,6 +11,11 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
11
11
  inputStyle: import("prop-types").Requireable<object>;
12
12
  panelHeader: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
13
13
  panelFooter: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
14
+ 'aria-labelledby': import("prop-types").Requireable<string>;
15
+ 'aria-invalid': import("prop-types").Requireable<boolean>;
16
+ 'aria-errormessage': import("prop-types").Requireable<string>;
17
+ 'aria-describedby': import("prop-types").Requireable<string>;
18
+ 'aria-required': import("prop-types").Requireable<boolean>;
14
19
  prefixCls: import("prop-types").Requireable<string>;
15
20
  clearText: import("prop-types").Requireable<string>;
16
21
  value: import("prop-types").Requireable<string | number | string[] | number[] | Date | Date[]>;
@@ -52,6 +57,7 @@ export default class LocaleTimePicker extends React.PureComponent<LocalePickerPr
52
57
  dateFnsLocale: import("prop-types").Requireable<object>;
53
58
  zIndex: import("prop-types").Requireable<string | number>;
54
59
  insetLabel: import("prop-types").Requireable<import("prop-types").ReactNodeLike>;
60
+ insetLabelId: import("prop-types").Requireable<string>;
55
61
  validateStatus: import("prop-types").Requireable<"default" | "error" | "warning" | "success">;
56
62
  type: import("prop-types").Requireable<import("./TimePicker").Type>;
57
63
  rangeSeparator: import("prop-types").Requireable<string>;
@@ -6,7 +6,7 @@ export { TimelineItemProps } from './item';
6
6
  export interface Data extends TimelineItemProps {
7
7
  content: React.ReactNode;
8
8
  }
9
- export interface TimelineProps {
9
+ export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'> {
10
10
  mode?: 'left' | 'right' | 'center' | 'alternate';
11
11
  className?: string;
12
12
  style?: React.CSSProperties;