rsuite 5.2.3 → 5.4.1

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 (495) hide show
  1. package/Avatar/styles/index.less +2 -2
  2. package/AvatarGroup/package.json +7 -0
  3. package/AvatarGroup/styles/index.less +19 -0
  4. package/ButtonGroup/styles/index.less +0 -18
  5. package/CHANGELOG.md +63 -0
  6. package/CheckTreePicker/styles/index.less +14 -1
  7. package/Dropdown/styles/index.less +4 -3
  8. package/Nav/styles/index.less +1 -0
  9. package/Navbar/styles/index.less +7 -0
  10. package/Radio/styles/index.less +6 -0
  11. package/Sidenav/styles/index.less +2 -2
  12. package/Stack/package.json +7 -0
  13. package/Stack/styles/index.less +5 -0
  14. package/Table/styles/index.less +0 -4
  15. package/TreePicker/styles/index.less +10 -14
  16. package/cjs/@types/common.d.ts +13 -12
  17. package/cjs/@types/utils.d.ts +12 -0
  18. package/cjs/Affix/Affix.js +5 -5
  19. package/cjs/Animation/Transition.d.ts +21 -12
  20. package/cjs/Animation/Transition.js +4 -1
  21. package/cjs/AutoComplete/AutoComplete.js +1 -1
  22. package/cjs/AutoComplete/utils.d.ts +1 -1
  23. package/cjs/Avatar/Avatar.js +10 -3
  24. package/cjs/AvatarGroup/AvatarGroup.d.ts +15 -0
  25. package/cjs/AvatarGroup/AvatarGroup.js +76 -0
  26. package/cjs/AvatarGroup/index.d.ts +3 -0
  27. package/cjs/AvatarGroup/index.js +11 -0
  28. package/cjs/Breadcrumb/Breadcrumb.js +1 -1
  29. package/cjs/Button/Button.js +8 -2
  30. package/cjs/ButtonGroup/ButtonGroup.js +14 -3
  31. package/cjs/ButtonGroup/ButtonGroupContext.d.ts +7 -0
  32. package/cjs/ButtonGroup/ButtonGroupContext.js +13 -0
  33. package/cjs/ButtonGroup/index.d.ts +2 -0
  34. package/cjs/ButtonGroup/index.js +3 -0
  35. package/cjs/Calendar/Calendar.d.ts +4 -4
  36. package/cjs/Calendar/Calendar.js +26 -22
  37. package/cjs/Calendar/CalendarContext.js +1 -1
  38. package/cjs/Calendar/Header.js +1 -3
  39. package/cjs/Calendar/Table.js +1 -1
  40. package/cjs/Calendar/TableRow.js +13 -8
  41. package/cjs/Calendar/TimeDropdown.js +6 -5
  42. package/cjs/Calendar/View.js +9 -5
  43. package/cjs/Calendar/types.d.ts +2 -2
  44. package/cjs/Calendar/useCalendarDate.d.ts +2 -2
  45. package/cjs/Carousel/Carousel.d.ts +2 -2
  46. package/cjs/Carousel/Carousel.js +1 -1
  47. package/cjs/Cascader/Cascader.d.ts +1 -1
  48. package/cjs/Cascader/Cascader.js +10 -10
  49. package/cjs/Cascader/DropdownMenu.d.ts +5 -4
  50. package/cjs/Cascader/utils.d.ts +10 -10
  51. package/cjs/CheckPicker/CheckPicker.d.ts +9 -4
  52. package/cjs/CheckPicker/CheckPicker.js +4 -4
  53. package/cjs/CheckPicker/test/CheckPicker.test.d.ts +1 -0
  54. package/cjs/CheckPicker/test/CheckPicker.test.js +76 -0
  55. package/cjs/CheckTree/index.js +6 -5
  56. package/cjs/CheckTreePicker/CheckTreeNode.d.ts +1 -1
  57. package/cjs/CheckTreePicker/CheckTreeNode.js +7 -9
  58. package/cjs/CheckTreePicker/CheckTreePicker.js +34 -27
  59. package/cjs/CheckTreePicker/utils.d.ts +3 -1
  60. package/cjs/CheckTreePicker/utils.js +12 -10
  61. package/cjs/Checkbox/Checkbox.d.ts +1 -1
  62. package/cjs/Container/Container.js +6 -3
  63. package/cjs/CustomProvider/CustomProvider.d.ts +31 -57
  64. package/cjs/DOMHelper/index.d.ts +12 -12
  65. package/cjs/DatePicker/DatePicker.d.ts +1 -1
  66. package/cjs/DatePicker/DatePicker.js +19 -11
  67. package/cjs/DatePicker/Toolbar.d.ts +12 -9
  68. package/cjs/DatePicker/Toolbar.js +6 -8
  69. package/cjs/DatePicker/types.d.ts +4 -4
  70. package/cjs/DatePicker/utils.d.ts +4 -3
  71. package/cjs/DateRangePicker/Calendar.d.ts +9 -7
  72. package/cjs/DateRangePicker/Calendar.js +27 -6
  73. package/cjs/DateRangePicker/DateRangePicker.d.ts +8 -6
  74. package/cjs/DateRangePicker/DateRangePicker.js +133 -110
  75. package/cjs/DateRangePicker/types.d.ts +2 -1
  76. package/cjs/DateRangePicker/utils.d.ts +6 -6
  77. package/cjs/DateRangePicker/utils.js +7 -2
  78. package/cjs/Disclosure/Disclosure.js +6 -4
  79. package/cjs/Disclosure/DisclosureButton.js +9 -7
  80. package/cjs/Disclosure/DisclosureContent.js +4 -6
  81. package/cjs/Disclosure/DisclosureContext.d.ts +2 -2
  82. package/cjs/Disclosure/useDisclosureContext.d.ts +2 -0
  83. package/cjs/Disclosure/useDisclosureContext.js +20 -0
  84. package/cjs/Dropdown/Dropdown.d.ts +1 -1
  85. package/cjs/Dropdown/DropdownContext.d.ts +2 -2
  86. package/cjs/Dropdown/DropdownItem.js +1 -1
  87. package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
  88. package/cjs/Dropdown/DropdownMenu.js +9 -6
  89. package/cjs/Dropdown/DropdownState.d.ts +1 -1
  90. package/cjs/Dropdown/DropdownToggle.js +10 -2
  91. package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
  92. package/cjs/Form/Form.js +1 -1
  93. package/cjs/Form/FormContext.d.ts +1 -1
  94. package/cjs/FormControl/FormControl.d.ts +1 -1
  95. package/cjs/FormControl/FormControl.js +5 -4
  96. package/cjs/FormGroup/FormGroup.d.ts +1 -1
  97. package/cjs/FormGroup/FormGroup.js +9 -4
  98. package/cjs/Input/Input.d.ts +3 -2
  99. package/cjs/InputGroup/InputGroup.d.ts +1 -1
  100. package/cjs/InputNumber/InputNumber.js +6 -2
  101. package/cjs/InputPicker/InputAutosize.js +4 -4
  102. package/cjs/InputPicker/InputPicker.d.ts +2 -2
  103. package/cjs/InputPicker/InputPicker.js +15 -10
  104. package/cjs/List/ListContext.d.ts +1 -1
  105. package/cjs/List/ListContext.js +8 -1
  106. package/cjs/List/helper/AutoScroller.js +4 -2
  107. package/cjs/List/helper/useManager.d.ts +3 -3
  108. package/cjs/List/helper/useManager.js +1 -1
  109. package/cjs/List/helper/useSortHelper.d.ts +3 -3
  110. package/cjs/List/helper/useSortHelper.js +6 -4
  111. package/cjs/List/helper/utils.d.ts +2 -2
  112. package/cjs/MaskedInput/TextMask.d.ts +5 -5
  113. package/cjs/MaskedInput/adjustCaretPosition.d.ts +6 -6
  114. package/cjs/MaskedInput/conformToMask.js +5 -4
  115. package/cjs/MaskedInput/createTextMaskInputElement.d.ts +2 -2
  116. package/cjs/MaskedInput/utilities.d.ts +1 -1
  117. package/cjs/Menu/Menu.js +14 -7
  118. package/cjs/Menu/MenuContext.d.ts +1 -1
  119. package/cjs/Menu/MenuItem.d.ts +1 -1
  120. package/cjs/Menu/MenuItem.js +19 -15
  121. package/cjs/Menu/Menubar.js +8 -8
  122. package/cjs/Menu/useMenu.js +17 -7
  123. package/cjs/Modal/Modal.js +12 -6
  124. package/cjs/Modal/ModalContext.d.ts +2 -2
  125. package/cjs/Modal/utils.d.ts +1 -1
  126. package/cjs/Modal/utils.js +3 -5
  127. package/cjs/MultiCascader/DropdownMenu.d.ts +4 -4
  128. package/cjs/MultiCascader/MultiCascader.js +6 -6
  129. package/cjs/MultiCascader/utils.d.ts +17 -17
  130. package/cjs/Nav/Nav.d.ts +1 -1
  131. package/cjs/Nav/Nav.js +10 -12
  132. package/cjs/Nav/NavContext.d.ts +7 -1
  133. package/cjs/Nav/NavContext.js +1 -0
  134. package/cjs/Nav/NavItem.d.ts +1 -1
  135. package/cjs/Navbar/Navbar.js +1 -1
  136. package/cjs/Navbar/NavbarItem.d.ts +1 -1
  137. package/cjs/Overlay/Modal.d.ts +2 -2
  138. package/cjs/Overlay/Modal.js +70 -45
  139. package/cjs/Overlay/ModalManager.d.ts +17 -8
  140. package/cjs/Overlay/ModalManager.js +11 -20
  141. package/cjs/Overlay/Overlay.d.ts +3 -3
  142. package/cjs/Overlay/Overlay.js +8 -2
  143. package/cjs/Overlay/OverlayContext.d.ts +6 -0
  144. package/cjs/Overlay/OverlayContext.js +14 -0
  145. package/cjs/Overlay/OverlayTrigger.d.ts +11 -11
  146. package/cjs/Overlay/OverlayTrigger.js +21 -7
  147. package/cjs/Overlay/Position.d.ts +4 -4
  148. package/cjs/Overlay/Position.js +14 -8
  149. package/cjs/Overlay/positionUtils.d.ts +1 -1
  150. package/cjs/Overlay/positionUtils.js +8 -8
  151. package/cjs/Pagination/Pagination.d.ts +1 -1
  152. package/cjs/Pagination/PaginationButton.d.ts +3 -3
  153. package/cjs/Pagination/PaginationGroup.js +5 -3
  154. package/cjs/Panel/Panel.d.ts +1 -1
  155. package/cjs/Panel/Panel.js +2 -2
  156. package/cjs/PanelGroup/PanelGroup.d.ts +2 -2
  157. package/cjs/PanelGroup/PanelGroup.js +8 -5
  158. package/cjs/Picker/DropdownMenu.d.ts +8 -5
  159. package/cjs/Picker/DropdownMenu.js +5 -5
  160. package/cjs/Picker/PickerOverlay.js +4 -3
  161. package/cjs/Picker/PickerToggle.js +4 -3
  162. package/cjs/Picker/PickerToggleTrigger.d.ts +2 -6
  163. package/cjs/Picker/SearchBar.d.ts +1 -1
  164. package/cjs/Picker/SelectedElement.js +2 -1
  165. package/cjs/Picker/VirtualizedList.d.ts +29 -2
  166. package/cjs/Picker/propTypes.d.ts +5 -7
  167. package/cjs/Picker/propTypes.js +4 -3
  168. package/cjs/Picker/utils.d.ts +15 -23
  169. package/cjs/Picker/utils.js +71 -46
  170. package/cjs/Placeholder/PlaceholderGrid.js +1 -1
  171. package/cjs/Plaintext/Plaintext.js +2 -1
  172. package/cjs/Radio/Radio.d.ts +1 -1
  173. package/cjs/RadioGroup/RadioGroup.d.ts +2 -2
  174. package/cjs/RadioGroup/RadioGroup.js +1 -1
  175. package/cjs/RangeSlider/RangeSlider.d.ts +2 -2
  176. package/cjs/RangeSlider/RangeSlider.js +6 -4
  177. package/cjs/Rate/Character.js +4 -2
  178. package/cjs/Rate/Rate.js +2 -1
  179. package/cjs/Ripple/Ripple.js +1 -1
  180. package/cjs/SelectPicker/SelectPicker.d.ts +12 -5
  181. package/cjs/SelectPicker/SelectPicker.js +8 -8
  182. package/cjs/SelectPicker/index.d.ts +1 -1
  183. package/cjs/SelectPicker/test/SelectPicker.test.d.ts +1 -0
  184. package/cjs/SelectPicker/test/SelectPicker.test.js +62 -0
  185. package/cjs/Sidenav/Node.d.ts +1 -1
  186. package/cjs/Sidenav/Sidenav.d.ts +4 -4
  187. package/cjs/Sidenav/Sidenav.js +5 -2
  188. package/cjs/Sidenav/SidenavDropdown.js +11 -8
  189. package/cjs/Sidenav/SidenavDropdownItem.js +10 -5
  190. package/cjs/Sidenav/SidenavDropdownMenu.js +9 -5
  191. package/cjs/Sidenav/SidenavItem.d.ts +1 -1
  192. package/cjs/Sidenav/SidenavItem.js +4 -0
  193. package/cjs/Slider/Graduated.d.ts +5 -5
  194. package/cjs/Slider/Handle.d.ts +1 -1
  195. package/cjs/Slider/Handle.js +10 -6
  196. package/cjs/Slider/Mark.d.ts +1 -1
  197. package/cjs/Slider/Slider.d.ts +1 -1
  198. package/cjs/Slider/Slider.js +2 -2
  199. package/cjs/Slider/utils.d.ts +2 -1
  200. package/cjs/Slider/utils.js +4 -5
  201. package/cjs/Stack/Stack.d.ts +26 -0
  202. package/cjs/Stack/Stack.js +86 -0
  203. package/cjs/Stack/index.d.ts +3 -0
  204. package/cjs/Stack/index.js +11 -0
  205. package/cjs/Steps/StepItem.js +1 -1
  206. package/cjs/TagInput/index.js +1 -1
  207. package/cjs/Toggle/Toggle.js +5 -4
  208. package/cjs/Tree/Tree.d.ts +3 -2
  209. package/cjs/Tree/Tree.js +6 -5
  210. package/cjs/Tree/TreeContext.d.ts +0 -1
  211. package/cjs/TreePicker/TreeNode.js +7 -22
  212. package/cjs/TreePicker/TreePicker.js +37 -54
  213. package/cjs/Uploader/UploadFileItem.d.ts +1 -1
  214. package/cjs/Uploader/UploadFileItem.js +2 -2
  215. package/cjs/Uploader/UploadTrigger.d.ts +1 -1
  216. package/cjs/Uploader/UploadTrigger.js +2 -3
  217. package/cjs/Uploader/Uploader.d.ts +5 -5
  218. package/cjs/Uploader/Uploader.js +1 -2
  219. package/cjs/index.d.ts +6 -2
  220. package/cjs/index.js +13 -5
  221. package/cjs/locales/index.d.ts +3 -3
  222. package/cjs/toaster/ToastContainer.d.ts +1 -1
  223. package/cjs/toaster/ToastContainer.js +1 -1
  224. package/cjs/toaster/toaster.js +3 -1
  225. package/cjs/utils/BrowserDetection.js +1 -1
  226. package/cjs/utils/ReactChildren.d.ts +2 -2
  227. package/cjs/utils/ajaxUpload.d.ts +1 -1
  228. package/cjs/utils/ajaxUpload.js +5 -4
  229. package/cjs/utils/appendTooltip.d.ts +1 -1
  230. package/cjs/utils/constants.d.ts +4 -4
  231. package/cjs/utils/createChainedFunction.d.ts +1 -1
  232. package/cjs/utils/getDataGroupBy.d.ts +1 -1
  233. package/cjs/utils/mergeRefs.d.ts +2 -2
  234. package/cjs/utils/previewFile.d.ts +1 -1
  235. package/cjs/utils/propTypeChecker.d.ts +6 -2
  236. package/cjs/utils/propTypeChecker.js +7 -6
  237. package/cjs/utils/reactToString.d.ts +2 -1
  238. package/cjs/utils/statusIcons.d.ts +1 -1
  239. package/cjs/utils/stringToObject.d.ts +1 -1
  240. package/cjs/utils/treeUtils.d.ts +35 -32
  241. package/cjs/utils/treeUtils.js +46 -23
  242. package/cjs/utils/useControlled.d.ts +6 -1
  243. package/cjs/utils/useControlled.js +0 -8
  244. package/cjs/utils/useCustom.js +6 -4
  245. package/cjs/utils/useFocus.d.ts +2 -2
  246. package/cjs/utils/usePortal.d.ts +2 -2
  247. package/cjs/utils/useRootClose.d.ts +2 -2
  248. package/cjs/utils/useTimeout.d.ts +1 -1
  249. package/cjs/utils/useTimeout.js +5 -3
  250. package/dist/rsuite-rtl.css +63 -193
  251. package/dist/rsuite-rtl.min.css +1 -1
  252. package/dist/rsuite-rtl.min.css.map +1 -1
  253. package/dist/rsuite.css +63 -193
  254. package/dist/rsuite.js +194 -117
  255. package/dist/rsuite.js.map +1 -1
  256. package/dist/rsuite.min.css +1 -1
  257. package/dist/rsuite.min.css.map +1 -1
  258. package/dist/rsuite.min.js +1 -1
  259. package/dist/rsuite.min.js.map +1 -1
  260. package/esm/@types/common.d.ts +13 -12
  261. package/esm/@types/utils.d.ts +12 -0
  262. package/esm/Affix/Affix.js +5 -5
  263. package/esm/Animation/Transition.d.ts +21 -12
  264. package/esm/Animation/Transition.js +4 -1
  265. package/esm/AutoComplete/AutoComplete.js +1 -1
  266. package/esm/AutoComplete/utils.d.ts +1 -1
  267. package/esm/Avatar/Avatar.js +7 -3
  268. package/esm/AvatarGroup/AvatarGroup.d.ts +15 -0
  269. package/esm/AvatarGroup/AvatarGroup.js +57 -0
  270. package/esm/AvatarGroup/index.d.ts +3 -0
  271. package/esm/AvatarGroup/index.js +2 -0
  272. package/esm/Breadcrumb/Breadcrumb.js +1 -1
  273. package/esm/Button/Button.js +6 -2
  274. package/esm/ButtonGroup/ButtonGroup.js +11 -3
  275. package/esm/ButtonGroup/ButtonGroupContext.d.ts +7 -0
  276. package/esm/ButtonGroup/ButtonGroupContext.js +3 -0
  277. package/esm/ButtonGroup/index.d.ts +2 -0
  278. package/esm/ButtonGroup/index.js +2 -0
  279. package/esm/Calendar/Calendar.d.ts +4 -4
  280. package/esm/Calendar/Calendar.js +27 -23
  281. package/esm/Calendar/CalendarContext.js +1 -1
  282. package/esm/Calendar/Header.js +1 -3
  283. package/esm/Calendar/Table.js +1 -1
  284. package/esm/Calendar/TableRow.js +14 -9
  285. package/esm/Calendar/TimeDropdown.js +5 -4
  286. package/esm/Calendar/View.js +10 -6
  287. package/esm/Calendar/types.d.ts +2 -2
  288. package/esm/Calendar/useCalendarDate.d.ts +2 -2
  289. package/esm/Carousel/Carousel.d.ts +2 -2
  290. package/esm/Carousel/Carousel.js +1 -1
  291. package/esm/Cascader/Cascader.d.ts +1 -1
  292. package/esm/Cascader/Cascader.js +10 -10
  293. package/esm/Cascader/DropdownMenu.d.ts +5 -4
  294. package/esm/Cascader/utils.d.ts +10 -10
  295. package/esm/CheckPicker/CheckPicker.d.ts +9 -4
  296. package/esm/CheckPicker/CheckPicker.js +4 -4
  297. package/esm/CheckPicker/test/CheckPicker.test.d.ts +1 -0
  298. package/esm/CheckPicker/test/CheckPicker.test.js +64 -0
  299. package/esm/CheckTree/index.js +7 -6
  300. package/esm/CheckTreePicker/CheckTreeNode.d.ts +1 -1
  301. package/esm/CheckTreePicker/CheckTreeNode.js +4 -7
  302. package/esm/CheckTreePicker/CheckTreePicker.js +33 -25
  303. package/esm/CheckTreePicker/utils.d.ts +3 -1
  304. package/esm/CheckTreePicker/utils.js +12 -10
  305. package/esm/Checkbox/Checkbox.d.ts +1 -1
  306. package/esm/Container/Container.js +7 -4
  307. package/esm/CustomProvider/CustomProvider.d.ts +31 -57
  308. package/esm/DOMHelper/index.d.ts +12 -12
  309. package/esm/DatePicker/DatePicker.d.ts +1 -1
  310. package/esm/DatePicker/DatePicker.js +18 -11
  311. package/esm/DatePicker/Toolbar.d.ts +12 -9
  312. package/esm/DatePicker/Toolbar.js +6 -8
  313. package/esm/DatePicker/types.d.ts +4 -4
  314. package/esm/DatePicker/utils.d.ts +4 -3
  315. package/esm/DateRangePicker/Calendar.d.ts +9 -7
  316. package/esm/DateRangePicker/Calendar.js +28 -6
  317. package/esm/DateRangePicker/DateRangePicker.d.ts +8 -6
  318. package/esm/DateRangePicker/DateRangePicker.js +131 -110
  319. package/esm/DateRangePicker/types.d.ts +2 -1
  320. package/esm/DateRangePicker/utils.d.ts +6 -6
  321. package/esm/DateRangePicker/utils.js +6 -2
  322. package/esm/Disclosure/Disclosure.js +6 -4
  323. package/esm/Disclosure/DisclosureButton.js +8 -7
  324. package/esm/Disclosure/DisclosureContent.js +5 -7
  325. package/esm/Disclosure/DisclosureContext.d.ts +2 -2
  326. package/esm/Disclosure/useDisclosureContext.d.ts +2 -0
  327. package/esm/Disclosure/useDisclosureContext.js +11 -0
  328. package/esm/Dropdown/Dropdown.d.ts +1 -1
  329. package/esm/Dropdown/DropdownContext.d.ts +2 -2
  330. package/esm/Dropdown/DropdownItem.js +1 -1
  331. package/esm/Dropdown/DropdownMenu.d.ts +3 -3
  332. package/esm/Dropdown/DropdownMenu.js +10 -7
  333. package/esm/Dropdown/DropdownState.d.ts +1 -1
  334. package/esm/Dropdown/DropdownToggle.js +9 -2
  335. package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
  336. package/esm/Form/Form.js +1 -1
  337. package/esm/Form/FormContext.d.ts +1 -1
  338. package/esm/FormControl/FormControl.d.ts +1 -1
  339. package/esm/FormControl/FormControl.js +5 -4
  340. package/esm/FormGroup/FormGroup.d.ts +1 -1
  341. package/esm/FormGroup/FormGroup.js +7 -4
  342. package/esm/Input/Input.d.ts +3 -2
  343. package/esm/InputGroup/InputGroup.d.ts +1 -1
  344. package/esm/InputNumber/InputNumber.js +6 -2
  345. package/esm/InputPicker/InputAutosize.js +4 -4
  346. package/esm/InputPicker/InputPicker.d.ts +2 -2
  347. package/esm/InputPicker/InputPicker.js +15 -10
  348. package/esm/List/ListContext.d.ts +1 -1
  349. package/esm/List/ListContext.js +7 -1
  350. package/esm/List/helper/AutoScroller.js +4 -2
  351. package/esm/List/helper/useManager.d.ts +3 -3
  352. package/esm/List/helper/useManager.js +1 -1
  353. package/esm/List/helper/useSortHelper.d.ts +3 -3
  354. package/esm/List/helper/useSortHelper.js +6 -4
  355. package/esm/List/helper/utils.d.ts +2 -2
  356. package/esm/MaskedInput/TextMask.d.ts +5 -5
  357. package/esm/MaskedInput/adjustCaretPosition.d.ts +6 -6
  358. package/esm/MaskedInput/conformToMask.js +5 -4
  359. package/esm/MaskedInput/createTextMaskInputElement.d.ts +2 -2
  360. package/esm/MaskedInput/utilities.d.ts +1 -1
  361. package/esm/Menu/Menu.js +13 -7
  362. package/esm/Menu/MenuContext.d.ts +1 -1
  363. package/esm/Menu/MenuItem.d.ts +1 -1
  364. package/esm/Menu/MenuItem.js +18 -15
  365. package/esm/Menu/Menubar.js +7 -8
  366. package/esm/Menu/useMenu.js +17 -7
  367. package/esm/Modal/Modal.js +12 -6
  368. package/esm/Modal/ModalContext.d.ts +2 -2
  369. package/esm/Modal/utils.d.ts +1 -1
  370. package/esm/Modal/utils.js +3 -5
  371. package/esm/MultiCascader/DropdownMenu.d.ts +4 -4
  372. package/esm/MultiCascader/MultiCascader.js +6 -6
  373. package/esm/MultiCascader/utils.d.ts +17 -17
  374. package/esm/Nav/Nav.d.ts +1 -1
  375. package/esm/Nav/Nav.js +11 -13
  376. package/esm/Nav/NavContext.d.ts +7 -1
  377. package/esm/Nav/NavContext.js +1 -0
  378. package/esm/Nav/NavItem.d.ts +1 -1
  379. package/esm/Navbar/Navbar.js +1 -1
  380. package/esm/Navbar/NavbarItem.d.ts +1 -1
  381. package/esm/Overlay/Modal.d.ts +2 -2
  382. package/esm/Overlay/Modal.js +71 -46
  383. package/esm/Overlay/ModalManager.d.ts +17 -8
  384. package/esm/Overlay/ModalManager.js +11 -20
  385. package/esm/Overlay/Overlay.d.ts +3 -3
  386. package/esm/Overlay/Overlay.js +8 -3
  387. package/esm/Overlay/OverlayContext.d.ts +6 -0
  388. package/esm/Overlay/OverlayContext.js +4 -0
  389. package/esm/Overlay/OverlayTrigger.d.ts +11 -11
  390. package/esm/Overlay/OverlayTrigger.js +21 -8
  391. package/esm/Overlay/Position.d.ts +4 -4
  392. package/esm/Overlay/Position.js +14 -8
  393. package/esm/Overlay/positionUtils.d.ts +1 -1
  394. package/esm/Overlay/positionUtils.js +6 -6
  395. package/esm/Pagination/Pagination.d.ts +1 -1
  396. package/esm/Pagination/PaginationButton.d.ts +3 -3
  397. package/esm/Pagination/PaginationGroup.js +5 -3
  398. package/esm/Panel/Panel.d.ts +1 -1
  399. package/esm/Panel/Panel.js +2 -2
  400. package/esm/PanelGroup/PanelGroup.d.ts +2 -2
  401. package/esm/PanelGroup/PanelGroup.js +9 -6
  402. package/esm/Picker/DropdownMenu.d.ts +8 -5
  403. package/esm/Picker/DropdownMenu.js +5 -5
  404. package/esm/Picker/PickerOverlay.js +4 -3
  405. package/esm/Picker/PickerToggle.js +4 -3
  406. package/esm/Picker/PickerToggleTrigger.d.ts +2 -6
  407. package/esm/Picker/SearchBar.d.ts +1 -1
  408. package/esm/Picker/SelectedElement.js +2 -1
  409. package/esm/Picker/VirtualizedList.d.ts +29 -2
  410. package/esm/Picker/propTypes.d.ts +5 -7
  411. package/esm/Picker/propTypes.js +4 -3
  412. package/esm/Picker/utils.d.ts +15 -23
  413. package/esm/Picker/utils.js +70 -46
  414. package/esm/Placeholder/PlaceholderGrid.js +1 -1
  415. package/esm/Plaintext/Plaintext.js +2 -1
  416. package/esm/Radio/Radio.d.ts +1 -1
  417. package/esm/RadioGroup/RadioGroup.d.ts +2 -2
  418. package/esm/RadioGroup/RadioGroup.js +1 -1
  419. package/esm/RangeSlider/RangeSlider.d.ts +2 -2
  420. package/esm/RangeSlider/RangeSlider.js +5 -4
  421. package/esm/Rate/Character.js +3 -2
  422. package/esm/Rate/Rate.js +2 -1
  423. package/esm/Ripple/Ripple.js +1 -1
  424. package/esm/SelectPicker/SelectPicker.d.ts +12 -5
  425. package/esm/SelectPicker/SelectPicker.js +8 -8
  426. package/esm/SelectPicker/index.d.ts +1 -1
  427. package/esm/SelectPicker/test/SelectPicker.test.d.ts +1 -0
  428. package/esm/SelectPicker/test/SelectPicker.test.js +52 -0
  429. package/esm/Sidenav/Node.d.ts +1 -1
  430. package/esm/Sidenav/Sidenav.d.ts +4 -4
  431. package/esm/Sidenav/Sidenav.js +5 -2
  432. package/esm/Sidenav/SidenavDropdown.js +11 -7
  433. package/esm/Sidenav/SidenavDropdownItem.js +11 -5
  434. package/esm/Sidenav/SidenavDropdownMenu.js +9 -5
  435. package/esm/Sidenav/SidenavItem.d.ts +1 -1
  436. package/esm/Sidenav/SidenavItem.js +4 -0
  437. package/esm/Slider/Graduated.d.ts +5 -5
  438. package/esm/Slider/Handle.d.ts +1 -1
  439. package/esm/Slider/Handle.js +10 -6
  440. package/esm/Slider/Mark.d.ts +1 -1
  441. package/esm/Slider/Slider.d.ts +1 -1
  442. package/esm/Slider/Slider.js +2 -2
  443. package/esm/Slider/utils.d.ts +2 -1
  444. package/esm/Slider/utils.js +5 -2
  445. package/esm/Stack/Stack.d.ts +26 -0
  446. package/esm/Stack/Stack.js +71 -0
  447. package/esm/Stack/index.d.ts +3 -0
  448. package/esm/Stack/index.js +2 -0
  449. package/esm/Steps/StepItem.js +1 -1
  450. package/esm/TagInput/index.js +1 -1
  451. package/esm/Toggle/Toggle.js +5 -4
  452. package/esm/Tree/Tree.d.ts +3 -2
  453. package/esm/Tree/Tree.js +7 -6
  454. package/esm/Tree/TreeContext.d.ts +0 -1
  455. package/esm/TreePicker/TreeNode.js +6 -21
  456. package/esm/TreePicker/TreePicker.js +36 -52
  457. package/esm/Uploader/UploadFileItem.d.ts +1 -1
  458. package/esm/Uploader/UploadFileItem.js +2 -2
  459. package/esm/Uploader/UploadTrigger.d.ts +1 -1
  460. package/esm/Uploader/UploadTrigger.js +2 -3
  461. package/esm/Uploader/Uploader.d.ts +5 -5
  462. package/esm/Uploader/Uploader.js +1 -2
  463. package/esm/index.d.ts +6 -2
  464. package/esm/index.js +3 -1
  465. package/esm/locales/index.d.ts +3 -3
  466. package/esm/toaster/ToastContainer.d.ts +1 -1
  467. package/esm/toaster/ToastContainer.js +1 -1
  468. package/esm/toaster/toaster.js +3 -1
  469. package/esm/utils/BrowserDetection.js +1 -1
  470. package/esm/utils/ReactChildren.d.ts +2 -2
  471. package/esm/utils/ajaxUpload.d.ts +1 -1
  472. package/esm/utils/ajaxUpload.js +5 -4
  473. package/esm/utils/appendTooltip.d.ts +1 -1
  474. package/esm/utils/constants.d.ts +4 -4
  475. package/esm/utils/createChainedFunction.d.ts +1 -1
  476. package/esm/utils/getDataGroupBy.d.ts +1 -1
  477. package/esm/utils/mergeRefs.d.ts +2 -2
  478. package/esm/utils/previewFile.d.ts +1 -1
  479. package/esm/utils/propTypeChecker.d.ts +6 -2
  480. package/esm/utils/propTypeChecker.js +7 -6
  481. package/esm/utils/reactToString.d.ts +2 -1
  482. package/esm/utils/statusIcons.d.ts +1 -1
  483. package/esm/utils/stringToObject.d.ts +1 -1
  484. package/esm/utils/treeUtils.d.ts +35 -32
  485. package/esm/utils/treeUtils.js +45 -21
  486. package/esm/utils/useControlled.d.ts +6 -1
  487. package/esm/utils/useControlled.js +0 -8
  488. package/esm/utils/useCustom.js +6 -4
  489. package/esm/utils/useFocus.d.ts +2 -2
  490. package/esm/utils/usePortal.d.ts +2 -2
  491. package/esm/utils/useRootClose.d.ts +2 -2
  492. package/esm/utils/useTimeout.d.ts +1 -1
  493. package/esm/utils/useTimeout.js +5 -3
  494. package/package.json +3 -3
  495. package/styles/index.less +2 -0
@@ -1,7 +1,7 @@
1
1
  export default function createTextMaskInputElement(config: any): {
2
2
  state: {
3
- previousConformedValue: any;
4
- previousPlaceholder: any;
3
+ previousConformedValue: undefined;
4
+ previousPlaceholder: undefined;
5
5
  };
6
6
  update(rawValue: any, { inputElement, mask: providedMask, guide, pipe, placeholderChar, keepCharPositions, showMask }?: any): void;
7
7
  };
@@ -3,5 +3,5 @@ export declare const defaultPlaceholderChar = "_";
3
3
  export declare function convertMaskToPlaceholder(mask?: MaskType | MaskFunctionType, placeholderChar?: string): string;
4
4
  export declare function processCaretTraps(mask: any): {
5
5
  maskWithoutCaretTraps: any;
6
- indexes: any[];
6
+ indexes: number[];
7
7
  };
package/esm/Menu/Menu.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import React, { useCallback, useContext, useRef, useMemo } from 'react';
3
3
  import PropTypes from 'prop-types';
4
+ import isNil from 'lodash/isNil';
4
5
  import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
5
6
  import { KEY_VALUES, useCustom } from '../utils';
6
7
  import useUniqueId from '../utils/useUniqueId';
@@ -25,8 +26,8 @@ function Menu(props) {
25
26
  renderMenuButton = props.renderMenuButton,
26
27
  renderMenuPopup = props.renderMenuPopup,
27
28
  onToggleMenu = props.onToggleMenu;
28
- var buttonElementRef = useRef();
29
- var menuElementRef = useRef();
29
+ var buttonElementRef = useRef(null);
30
+ var menuElementRef = useRef(null);
30
31
  var parentMenu = useContext(MenuContext);
31
32
  var isSubmenu = !!parentMenu;
32
33
  var menu = useMenu();
@@ -39,7 +40,7 @@ function Menu(props) {
39
40
  var _useCustom = useCustom('Menu'),
40
41
  rtl = _useCustom.rtl;
41
42
 
42
- var activeItem = (_items$activeItemInde = items[activeItemIndex]) === null || _items$activeItemInde === void 0 ? void 0 : _items$activeItemInde.element;
43
+ var activeItem = isNil(activeItemIndex) ? null : (_items$activeItemInde = items[activeItemIndex]) === null || _items$activeItemInde === void 0 ? void 0 : _items$activeItemInde.element;
43
44
 
44
45
  var _useFocus = useFocus(menuElementRef),
45
46
  grabFocus = _useFocus.grab;
@@ -74,7 +75,9 @@ function Menu(props) {
74
75
  onToggleMenu === null || onToggleMenu === void 0 ? void 0 : onToggleMenu(false, event);
75
76
 
76
77
  if (returnFocusToButton) {
77
- buttonElementRef.current.focus({
78
+ var _buttonElementRef$cur;
79
+
80
+ (_buttonElementRef$cur = buttonElementRef.current) === null || _buttonElementRef$cur === void 0 ? void 0 : _buttonElementRef$cur.focus({
78
81
  preventScroll: true
79
82
  });
80
83
  }
@@ -89,7 +92,9 @@ function Menu(props) {
89
92
  useClickOutside({
90
93
  enabled: open,
91
94
  isOutside: function isOutside(event) {
92
- return !buttonElementRef.current.contains(event.target) && !menuElementRef.current.contains(event.target);
95
+ var _buttonElementRef$cur2, _menuElementRef$curre;
96
+
97
+ return !((_buttonElementRef$cur2 = buttonElementRef.current) !== null && _buttonElementRef$cur2 !== void 0 && _buttonElementRef$cur2.contains(event.target)) && !((_menuElementRef$curre = menuElementRef.current) !== null && _menuElementRef$curre !== void 0 && _menuElementRef$curre.contains(event.target));
93
98
  },
94
99
  // fixme if clicking on a focusable element, don't move focus to menu button
95
100
  handle: function handle(event) {
@@ -330,7 +335,8 @@ function Menu(props) {
330
335
 
331
336
  var customMenuPopup = renderMenuPopup === null || renderMenuPopup === void 0 ? void 0 : renderMenuPopup(_extends({}, menuProps, {
332
337
  open: open
333
- }), menuElementRef);
338
+ }), menuElementRef); // fixme Wrong children here
339
+
334
340
  var menuElement = customMenuPopup !== null && customMenuPopup !== void 0 ? customMenuPopup : /*#__PURE__*/React.createElement("ul", _extends({
335
341
  ref: menuElementRef
336
342
  }, menuProps, {
@@ -346,7 +352,7 @@ function Menu(props) {
346
352
  closeMenu(e);
347
353
  }
348
354
  }, [disabled, closeMenu]);
349
- var rootElementRef = useRef();
355
+ var rootElementRef = useRef(null);
350
356
  var handleContainerBlur = useCallback(function (event) {
351
357
  if (isFocusLeaving(event)) {
352
358
  closeMenu(event, false);
@@ -47,5 +47,5 @@ export declare type MenuAction = {
47
47
  to: MoveFocusTo.Specific;
48
48
  id: string;
49
49
  };
50
- declare const MenuContext: React.Context<MenuContextProps>;
50
+ declare const MenuContext: React.Context<MenuContextProps | null>;
51
51
  export default MenuContext;
@@ -8,7 +8,7 @@ export interface MenuItemProps {
8
8
  /** Render prop */
9
9
  children: (menuitem: React.LiHTMLAttributes<HTMLLIElement> & MenuitemRenderProps, ref: React.Ref<HTMLLIElement>) => React.ReactElement;
10
10
  /** Callback when menuitem is being activated */
11
- onActivate?: (event: React.SyntheticEvent) => void;
11
+ onActivate?: React.MouseEventHandler;
12
12
  }
13
13
  export interface MenuitemRenderProps {
14
14
  selected: boolean;
@@ -1,5 +1,6 @@
1
1
  import { useCallback, useContext, useEffect, useRef } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import isNil from 'lodash/isNil';
3
4
  import useUniqueId from '../utils/useUniqueId';
4
5
  import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
5
6
 
@@ -7,22 +8,24 @@ import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
7
8
  * Headless ARIA `menuitem`
8
9
  */
9
10
  function MenuItem(props) {
10
- var _menuState$items$menu;
11
-
12
11
  var children = props.children,
13
- selected = props.selected,
14
- disabled = props.disabled,
12
+ _props$selected = props.selected,
13
+ selected = _props$selected === void 0 ? false : _props$selected,
14
+ _props$disabled = props.disabled,
15
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
15
16
  onActivate = props.onActivate;
16
- var menuitemRef = useRef();
17
+ var menuitemRef = useRef(null);
17
18
  var menuitemId = useUniqueId('menuitem-');
18
- var menu = useContext(MenuContext); // fixme make sure <MenuItem> is used inside a <Menu>
19
+ var menu = useContext(MenuContext);
19
20
 
20
- var _ref = menu !== null && menu !== void 0 ? menu : [],
21
- menuState = _ref[0],
22
- dispatch = _ref[1]; // Whether this menuitem has focus (indicated by `aria-activedescendant` from parent menu)
21
+ if (!menu) {
22
+ throw new Error('<MenuItem> must be rendered within a <Menu>');
23
+ }
23
24
 
25
+ var menuState = menu[0],
26
+ dispatch = menu[1]; // Whether this menuitem has focus (indicated by `aria-activedescendant` from parent menu)
24
27
 
25
- var hasFocus = (menuState === null || menuState === void 0 ? void 0 : (_menuState$items$menu = menuState.items[menuState === null || menuState === void 0 ? void 0 : menuState.activeItemIndex]) === null || _menuState$items$menu === void 0 ? void 0 : _menuState$items$menu.element) === menuitemRef.current && !!menuitemRef.current;
28
+ var hasFocus = !isNil(menuitemRef.current) && !isNil(menuState.activeItemIndex) && menuState.items[menuState.activeItemIndex].element === menuitemRef.current;
26
29
  var handleClick = useCallback(function (event) {
27
30
  if (disabled) {
28
31
  return;
@@ -32,17 +35,17 @@ function MenuItem(props) {
32
35
  }, [disabled, onActivate]); // Gain/release focus on mousedown in `menubar`
33
36
 
34
37
  var handleMouseDown = useCallback(function () {
35
- if (!hasFocus) {
38
+ if (!isNil(menuitemRef.current) && !hasFocus) {
36
39
  dispatch({
37
40
  type: MenuActionTypes.MoveFocus,
38
41
  to: MoveFocusTo.Specific,
39
42
  id: menuitemRef.current.id
40
43
  });
41
44
  }
42
- }, [hasFocus, dispatch]); // Gain/release focus on mouseenter/mouseleave in `menu`
45
+ }, [dispatch, hasFocus]); // Gain/release focus on mouseenter/mouseleave in `menu`
43
46
 
44
47
  var handleMouseMove = useCallback(function () {
45
- if (!hasFocus) {
48
+ if (!isNil(menuitemRef.current) && !hasFocus) {
46
49
  dispatch({
47
50
  type: MenuActionTypes.MoveFocus,
48
51
  to: MoveFocusTo.Specific,
@@ -58,7 +61,7 @@ function MenuItem(props) {
58
61
  }, [dispatch]);
59
62
  useEffect(function () {
60
63
  var menuitemElement = menuitemRef.current;
61
- dispatch === null || dispatch === void 0 ? void 0 : dispatch({
64
+ dispatch({
62
65
  type: MenuActionTypes.RegisterItem,
63
66
  element: menuitemElement,
64
67
  props: {
@@ -66,7 +69,7 @@ function MenuItem(props) {
66
69
  }
67
70
  });
68
71
  return function () {
69
- dispatch === null || dispatch === void 0 ? void 0 : dispatch({
72
+ dispatch({
70
73
  type: MenuActionTypes.UnregisterItem,
71
74
  id: menuitemElement.id
72
75
  });
@@ -1,12 +1,11 @@
1
1
  // Headless ARIA `menubar`
2
2
  import React, { useCallback, useRef } from 'react';
3
+ import isNil from 'lodash/isNil';
3
4
  import MenuContext, { MenuActionTypes, MoveFocusTo } from './MenuContext';
4
5
  import { KEY_VALUES, useCustom } from '../utils';
5
6
  import { isFocusEntering, isFocusLeaving } from '../utils/events';
6
7
  import useMenu from './useMenu';
7
8
  export default function Menubar(_ref) {
8
- var _items$activeItemInde;
9
-
10
9
  var _ref$vertical = _ref.vertical,
11
10
  vertical = _ref$vertical === void 0 ? false : _ref$vertical,
12
11
  children = _ref.children,
@@ -18,7 +17,7 @@ export default function Menubar(_ref) {
18
17
  items = _menubar$.items,
19
18
  activeItemIndex = _menubar$.activeItemIndex,
20
19
  dispatch = menubar[1];
21
- var menubarElementRef = useRef();
20
+ var menubarElementRef = useRef(null);
22
21
  var onFocus = useCallback(function (event) {
23
22
  // Focus moves inside Menubar
24
23
  if (isFocusEntering(event)) {
@@ -44,7 +43,7 @@ export default function Menubar(_ref) {
44
43
  rtl = _useCustom.rtl;
45
44
 
46
45
  var onKeyDown = useCallback(function (event) {
47
- var activeItem = items[activeItemIndex];
46
+ var activeItemElement = isNil(activeItemIndex) ? null : items[activeItemIndex].element;
48
47
 
49
48
  switch (true) {
50
49
  case !vertical && !rtl && event.key === KEY_VALUES.RIGHT:
@@ -90,10 +89,10 @@ export default function Menubar(_ref) {
90
89
  case !vertical && event.key === KEY_VALUES.DOWN:
91
90
  case vertical && !rtl && event.key === KEY_VALUES.RIGHT:
92
91
  case vertical && rtl && event.key === KEY_VALUES.LEFT:
93
- if ((activeItem === null || activeItem === void 0 ? void 0 : activeItem.element.getAttribute('aria-haspopup')) === 'menu') {
92
+ if ((activeItemElement === null || activeItemElement === void 0 ? void 0 : activeItemElement.getAttribute('aria-haspopup')) === 'menu') {
94
93
  event.preventDefault();
95
94
  event.stopPropagation();
96
- activeItem.element.click();
95
+ activeItemElement.click();
97
96
  }
98
97
 
99
98
  break;
@@ -102,7 +101,7 @@ export default function Menubar(_ref) {
102
101
  case event.key === KEY_VALUES.SPACE:
103
102
  event.preventDefault();
104
103
  event.stopPropagation();
105
- activeItem === null || activeItem === void 0 ? void 0 : activeItem.element.click();
104
+ activeItemElement === null || activeItemElement === void 0 ? void 0 : activeItemElement.click();
106
105
  break;
107
106
  }
108
107
  }, [rtl, items, activeItemIndex, dispatch, vertical]); // Only used for handling click events bubbling from children
@@ -124,7 +123,7 @@ export default function Menubar(_ref) {
124
123
  onBlur: onBlur,
125
124
  onKeyDown: onKeyDown,
126
125
  onClick: onClick,
127
- 'aria-activedescendant': (_items$activeItemInde = items[activeItemIndex]) === null || _items$activeItemInde === void 0 ? void 0 : _items$activeItemInde.element.id,
126
+ 'aria-activedescendant': isNil(activeItemIndex) ? undefined : items[activeItemIndex].element.id,
128
127
  'aria-orientation': vertical ? 'vertical' : undefined // implicitly set 'horizontal'
129
128
 
130
129
  }, menubarElementRef));
@@ -43,8 +43,10 @@ export function menuReducer(state, action) {
43
43
 
44
44
  switch (action.to) {
45
45
  case MoveFocusTo.Next:
46
- for (var i = nextActiveItemIndex === null ? 0 : activeItemIndex + 1; i < items.length; i++) {
47
- if (!items[i].props.disabled) {
46
+ for (var i = activeItemIndex === null ? 0 : activeItemIndex + 1; i < items.length; i++) {
47
+ var _items$i$props;
48
+
49
+ if (!((_items$i$props = items[i].props) !== null && _items$i$props !== void 0 && _items$i$props.disabled)) {
48
50
  nextActiveItemIndex = i;
49
51
  break;
50
52
  }
@@ -53,8 +55,10 @@ export function menuReducer(state, action) {
53
55
  break;
54
56
 
55
57
  case MoveFocusTo.Prev:
56
- for (var _i = nextActiveItemIndex === null ? items.length - 1 : activeItemIndex - 1; _i >= 0; _i--) {
57
- if (!items[_i].props.disabled) {
58
+ for (var _i = activeItemIndex === null ? items.length - 1 : activeItemIndex - 1; _i >= 0; _i--) {
59
+ var _items$_i$props;
60
+
61
+ if (!((_items$_i$props = items[_i].props) !== null && _items$_i$props !== void 0 && _items$_i$props.disabled)) {
58
62
  nextActiveItemIndex = _i;
59
63
  break;
60
64
  }
@@ -64,7 +68,9 @@ export function menuReducer(state, action) {
64
68
 
65
69
  case MoveFocusTo.First:
66
70
  for (var _i2 = 0; _i2 < items.length; _i2++) {
67
- if (!items[_i2].props.disabled) {
71
+ var _items$_i2$props;
72
+
73
+ if (!((_items$_i2$props = items[_i2].props) !== null && _items$_i2$props !== void 0 && _items$_i2$props.disabled)) {
68
74
  nextActiveItemIndex = _i2;
69
75
  break;
70
76
  }
@@ -74,7 +80,9 @@ export function menuReducer(state, action) {
74
80
 
75
81
  case MoveFocusTo.Last:
76
82
  for (var _i3 = items.length - 1; _i3 >= 0; _i3--) {
77
- if (!items[_i3].props.disabled) {
83
+ var _items$_i3$props;
84
+
85
+ if (!((_items$_i3$props = items[_i3].props) !== null && _items$_i3$props !== void 0 && _items$_i3$props.disabled)) {
78
86
  nextActiveItemIndex = _i3;
79
87
  break;
80
88
  }
@@ -84,7 +92,9 @@ export function menuReducer(state, action) {
84
92
 
85
93
  case MoveFocusTo.Specific:
86
94
  for (var _i4 = 0; _i4 < items.length; _i4++) {
87
- if (items[_i4].element.id === action.id && !items[_i4].props.disabled) {
95
+ var _items$_i4$props;
96
+
97
+ if (items[_i4].element.id === action.id && !((_items$_i4$props = items[_i4].props) !== null && _items$_i4$props !== void 0 && _items$_i4$props.disabled)) {
88
98
  nextActiveItemIndex = _i4;
89
99
  break;
90
100
  }
@@ -8,7 +8,7 @@ import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react'
8
8
  import PropTypes from 'prop-types';
9
9
  import pick from 'lodash/pick';
10
10
  import on from 'dom-lib/on';
11
- import getTransitionEnd from 'dom-lib/getTransitionEnd';
11
+ import getAnimationEnd from 'dom-lib/getAnimationEnd';
12
12
  import BaseModal, { modalPropTypes } from '../Overlay/Modal';
13
13
  import Bounce from '../Animation/Bounce';
14
14
  import { useClassNames, mergeRefs, SIZE } from '../utils';
@@ -43,7 +43,8 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
43
43
  animationTimeout = _props$animationTimeo === void 0 ? 300 : _props$animationTimeo,
44
44
  _props$overflow = props.overflow,
45
45
  overflow = _props$overflow === void 0 ? true : _props$overflow,
46
- drawer = props.drawer,
46
+ _props$drawer = props.drawer,
47
+ drawer = _props$drawer === void 0 ? false : _props$drawer,
47
48
  onClose = props.onClose,
48
49
  onEntered = props.onEntered,
49
50
  onEntering = props.onEntering,
@@ -66,7 +67,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
66
67
  var classes = merge(className, prefix(size, {
67
68
  full: full
68
69
  }));
69
- var dialogRef = useRef();
70
+ var dialogRef = useRef(null);
70
71
  var transitionEndListener = useRef(); // The style of the Modal body will be updated with the size of the window or container.
71
72
 
72
73
  var _useBodyStyles = useBodyStyles(dialogRef, {
@@ -98,9 +99,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
98
99
  // When the value of `backdrop` is `static`, a jitter animation will be added to the dialog when clicked.
99
100
  if (backdrop === 'static') {
100
101
  setShake(true);
101
- transitionEndListener.current = on(dialogRef.current, getTransitionEnd(), function () {
102
- setShake(false);
103
- });
102
+
103
+ if (!transitionEndListener.current && dialogRef.current) {
104
+ //fix: https://github.com/rsuite/rsuite/blob/a93d13c14fb20cc58204babe3331d3c3da3fe1fd/src/Modal/styles/index.less#L59
105
+ transitionEndListener.current = on(dialogRef.current, getAnimationEnd(), function () {
106
+ setShake(false);
107
+ });
108
+ }
104
109
  }
105
110
  }, [backdrop]);
106
111
  var handleExited = useCallback(function (node) {
@@ -109,6 +114,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
109
114
  onExited === null || onExited === void 0 ? void 0 : onExited(node);
110
115
  onDestroyEvents();
111
116
  (_transitionEndListene = transitionEndListener.current) === null || _transitionEndListene === void 0 ? void 0 : _transitionEndListene.off();
117
+ transitionEndListener.current = null;
112
118
  }, [onDestroyEvents, onExited]);
113
119
  var handleEntered = useCallback(function (node) {
114
120
  onEntered === null || onEntered === void 0 ? void 0 : onEntered(node);
@@ -3,10 +3,10 @@ export interface ModalContextProps {
3
3
  /** ID of the dialog element */
4
4
  dialogId: string;
5
5
  /** Pass the close event callback to the header close button. */
6
- onModalClose: (event: React.MouseEvent<Element, MouseEvent>) => void;
6
+ onModalClose?: (event: React.MouseEvent<Element, MouseEvent>) => void;
7
7
  /** Pass the latest style to body. */
8
8
  getBodyStyles?: () => React.CSSProperties;
9
9
  /** Whether this Modal is a Drawer */
10
10
  isDrawer: boolean;
11
11
  }
12
- export declare const ModalContext: React.Context<ModalContextProps>;
12
+ export declare const ModalContext: React.Context<ModalContextProps | null>;
@@ -3,4 +3,4 @@ export declare const useBodyStyles: (ref: React.RefObject<HTMLElement>, options:
3
3
  overflow: boolean;
4
4
  drawer: boolean;
5
5
  prefix: (...classes: any) => string;
6
- }) => [import("react").CSSProperties, (entering?: boolean) => void, () => void];
6
+ }) => [import("react").CSSProperties, (entering?: boolean | undefined) => void, () => void];
@@ -11,7 +11,7 @@ export var useBodyStyles = function useBodyStyles(ref, options) {
11
11
  drawer = options.drawer,
12
12
  prefix = options.prefix;
13
13
  var windowResizeListener = useRef();
14
- var contentElement = useRef();
14
+ var contentElement = useRef(null);
15
15
  var contentElementResizeObserver = useRef();
16
16
  var updateBodyStyles = useCallback(function (_event, entering) {
17
17
  var dialog = ref.current;
@@ -48,10 +48,8 @@ export var useBodyStyles = function useBodyStyles(ref, options) {
48
48
  }, []);
49
49
  var onChangeBodyStyles = useCallback(function (entering) {
50
50
  if (overflow && !drawer) {
51
- var _ref$current;
52
-
53
- updateBodyStyles(null, entering);
54
- contentElement.current = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector("." + prefix('content'));
51
+ updateBodyStyles(undefined, entering);
52
+ contentElement.current = ref.current.querySelector("." + prefix('content'));
55
53
  windowResizeListener.current = on(window, 'resize', updateBodyStyles);
56
54
  contentElementResizeObserver.current = new ResizeObserver(function () {
57
55
  return updateBodyStyles();
@@ -3,15 +3,15 @@ import { ItemDataType, WithAsProps, RsRefForwardingComponent } from '../@types/c
3
3
  import { ValueType } from './MultiCascader';
4
4
  export interface DropdownMenuProps extends WithAsProps {
5
5
  disabledItemValues: ValueType;
6
- value?: ValueType;
6
+ value: ValueType;
7
7
  childrenKey: string;
8
8
  valueKey: string;
9
9
  labelKey: string;
10
- menuWidth: number;
11
- menuHeight: number | string;
10
+ menuWidth?: number;
11
+ menuHeight?: number | string;
12
12
  cascade?: boolean;
13
13
  cascadeData: ItemDataType[][];
14
- cascadePaths: ItemDataType[];
14
+ cascadePaths?: ItemDataType[];
15
15
  uncheckableItemValues: ValueType;
16
16
  renderMenuItem?: (itemLabel: React.MouseEventHandler, item: ItemDataType) => React.ReactNode;
17
17
  renderMenu?: (children: ItemDataType[], menu: React.ReactNode, parentNode?: ItemDataType, layer?: number) => React.ReactNode;
@@ -113,10 +113,10 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
113
113
  selectedPaths = _useState2[0],
114
114
  setSelectedPaths = _useState2[1];
115
115
 
116
- var triggerRef = useRef();
117
- var overlayRef = useRef();
118
- var targetRef = useRef();
119
- var searchInputRef = useRef();
116
+ var triggerRef = useRef(null);
117
+ var overlayRef = useRef(null);
118
+ var targetRef = useRef(null);
119
+ var searchInputRef = useRef(null);
120
120
  usePublicMethods(ref, {
121
121
  triggerRef: triggerRef,
122
122
  overlayRef: overlayRef,
@@ -164,7 +164,7 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
164
164
  */
165
165
 
166
166
 
167
- var hasValue = selectedItems.length > 0 || (valueProp === null || valueProp === void 0 ? void 0 : valueProp.length) > 0 && isFunction(renderValue);
167
+ var hasValue = selectedItems.length > 0 || Number(valueProp === null || valueProp === void 0 ? void 0 : valueProp.length) > 0 && isFunction(renderValue);
168
168
 
169
169
  var _useClassNames = useClassNames(classPrefix),
170
170
  prefix = _useClassNames.prefix,
@@ -446,7 +446,7 @@ var MultiCascader = /*#__PURE__*/React.forwardRef(function (props, ref) {
446
446
  }
447
447
 
448
448
  if (hasValue && isFunction(renderValue)) {
449
- selectedElement = renderValue(value.length ? value : valueProp, selectedItems, selectedElement); // If renderValue returns null or undefined, hasValue is false.
449
+ selectedElement = renderValue(value.length ? value : valueProp !== null && valueProp !== void 0 ? valueProp : [], selectedItems, selectedElement); // If renderValue returns null or undefined, hasValue is false.
450
450
 
451
451
  if (isNil(selectedElement)) {
452
452
  hasValue = false;
@@ -5,50 +5,50 @@ export interface ItemType extends ItemDataType {
5
5
  parent?: ItemType;
6
6
  }
7
7
  interface ItemKeys {
8
- valueKey?: string;
9
- labelKey?: string;
10
- childrenKey?: string;
8
+ valueKey: string;
9
+ labelKey: string;
10
+ childrenKey: string;
11
11
  }
12
12
  /**
13
13
  * Get all parents of a node
14
14
  * @param node
15
15
  */
16
- export declare const getParents: (node: ItemType) => any[];
16
+ export declare const getParents: (node: ItemType) => ItemType[];
17
17
  /**
18
18
  * Check if any child nodes are selected.
19
19
  * @param node
20
20
  * @param value
21
21
  * @param itemKeys
22
22
  */
23
- export declare const isSomeChildChecked: (node: ItemDataType, value: ValueType, itemKeys: ItemKeys) => any;
23
+ export declare const isSomeChildChecked: (node: ItemDataType, value: ValueType, itemKeys: Omit<ItemKeys, 'labelKey'>) => any;
24
24
  /**
25
25
  * Check if the parent is selected.
26
26
  * @param node
27
27
  * @param value
28
28
  * @param itemKeys
29
29
  */
30
- export declare const isSomeParentChecked: (node: ItemDataType, value: ValueType, itemKeys: ItemKeys) => any;
31
- export declare const getOtherItemValuesByUnselectChild: (itemNode: ItemType, value: any, itemKeys: ItemKeys) => any[];
30
+ export declare const isSomeParentChecked: (node: ItemDataType, value: ValueType, itemKeys: Pick<ItemKeys, 'valueKey'>) => any;
31
+ export declare const getOtherItemValuesByUnselectChild: <T>(itemNode: ItemType, value: any, itemKeys: Omit<ItemKeys, 'labelKey'>) => T[];
32
32
  /**
33
33
  * Remove the values of all children.
34
34
  */
35
- export declare const removeAllChildrenValue: (value: ValueType, item: ItemType, itemKeys: ItemKeys) => any[];
35
+ export declare const removeAllChildrenValue: <T>(value: T[], item: ItemType, itemKeys: Omit<ItemKeys, 'labelKey'>) => T[] | undefined;
36
36
  /**
37
37
  * A hook to flatten tree structure data
38
38
  * @param data
39
39
  */
40
40
  export declare function useFlattenData(data: ItemDataType[], itemKeys: ItemKeys): {
41
41
  addFlattenData: (children: ItemDataType[], parent: ItemDataType) => void;
42
- flattenData: ItemDataType[];
42
+ flattenData: ItemDataType<string | number>[];
43
43
  };
44
44
  /**
45
45
  * A hook for column data
46
46
  * @param flattenData
47
47
  */
48
48
  export declare function useColumnData(flattenData: ItemType[]): {
49
- columnData: ItemDataType[][];
49
+ columnData: ItemDataType<string | number>[][];
50
50
  addColumn: (column: ItemDataType[], index: number) => void;
51
- setColumnData: import("react").Dispatch<import("react").SetStateAction<ItemDataType[][]>>;
51
+ setColumnData: import("react").Dispatch<import("react").SetStateAction<ItemDataType<string | number>[][]>>;
52
52
  enforceUpdateColumnData: (nextData: ItemDataType[]) => void;
53
53
  };
54
54
  /**
@@ -56,12 +56,12 @@ export declare function useColumnData(flattenData: ItemType[]): {
56
56
  * @param props
57
57
  * @param flattenData
58
58
  */
59
- export declare function useCascadeValue(props: Partial<MultiCascaderProps>, flattenData: ItemType[]): {
60
- value: ValueType;
61
- setValue: import("react").Dispatch<import("react").SetStateAction<ValueType>>;
62
- splitValue: (item: ItemType, checked: boolean, value: ValueType) => {
63
- value: ValueType;
64
- removedValue: ValueType;
59
+ export declare function useCascadeValue<T>(props: Partial<MultiCascaderProps<T[]>> & ItemKeys, flattenData: ItemType[]): {
60
+ value: T[];
61
+ setValue: import("react").Dispatch<import("react").SetStateAction<T[]>>;
62
+ splitValue: (item: ItemType, checked: boolean, value: T[]) => {
63
+ value: T[];
64
+ removedValue: T[];
65
65
  };
66
66
  };
67
67
  export {};
package/esm/Nav/Nav.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface NavProps<T = any> extends WithAsProps, Omit<React.HTMLAttribute
16
16
  /** Active key, corresponding to eventkey in <Nav.item>. */
17
17
  activeKey?: T;
18
18
  /** Callback function triggered after selection */
19
- onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
19
+ onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
20
20
  }
21
21
  interface NavComponent extends RsRefForwardingComponent<'div', NavProps> {
22
22
  Dropdown: typeof Dropdown;
package/esm/Nav/Nav.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import React, { useContext } from 'react';
3
+ import React, { useContext, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import NavItem from './NavItem';
6
6
  import Dropdown from '../Dropdown';
@@ -55,13 +55,17 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
55
55
  onSelectFromSidenav = _ref$onSelect === void 0 ? onSelectProp : _ref$onSelect;
56
56
 
57
57
  var activeKey = activeKeyProp !== null && activeKeyProp !== void 0 ? activeKeyProp : activeKeyFromSidenav;
58
+ var contextValue = useMemo(function () {
59
+ return {
60
+ withinNav: true,
61
+ activeKey: activeKey,
62
+ onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
63
+ };
64
+ }, [activeKey, onSelectFromSidenav, onSelectProp]);
58
65
 
59
66
  if (sidenav !== null && sidenav !== void 0 && sidenav.expanded) {
60
67
  return /*#__PURE__*/React.createElement(NavContext.Provider, {
61
- value: {
62
- activeKey: activeKey,
63
- onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
64
- }
68
+ value: contextValue
65
69
  }, /*#__PURE__*/React.createElement("ul", _extends({
66
70
  ref: ref,
67
71
  className: classes
@@ -72,10 +76,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
72
76
 
73
77
  if (sidenav) {
74
78
  return /*#__PURE__*/React.createElement(NavContext.Provider, {
75
- value: {
76
- activeKey: activeKey,
77
- onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
78
- }
79
+ value: contextValue
79
80
  }, /*#__PURE__*/React.createElement(Menubar, {
80
81
  vertical: !!sidenav
81
82
  }, function (menubar, ref) {
@@ -88,10 +89,7 @@ var Nav = /*#__PURE__*/React.forwardRef(function (props, ref) {
88
89
  }
89
90
 
90
91
  return /*#__PURE__*/React.createElement(NavContext.Provider, {
91
- value: {
92
- activeKey: activeKey,
93
- onSelect: onSelectProp !== null && onSelectProp !== void 0 ? onSelectProp : onSelectFromSidenav
94
- }
92
+ value: contextValue
95
93
  }, /*#__PURE__*/React.createElement(Component, _extends({}, rest, {
96
94
  ref: menubarRef,
97
95
  className: classes
@@ -1,7 +1,13 @@
1
1
  import React from 'react';
2
2
  export interface NavContextProps {
3
+ /**
4
+ * Whether component is rendered within a <Nav>
5
+ *
6
+ * FIXME: Bad design. Should use NavContextProps | null to determin whether within a <Nav>
7
+ */
8
+ withinNav: boolean;
3
9
  activeKey: string | null;
4
- onSelect: (eventKey: string, event: React.SyntheticEvent) => void;
10
+ onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
5
11
  }
6
12
  declare const NavContext: React.Context<NavContextProps>;
7
13
  export default NavContext;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import noop from 'lodash/noop';
3
3
  var NavContext = /*#__PURE__*/React.createContext({
4
+ withinNav: false,
4
5
  activeKey: null,
5
6
  onSelect: noop
6
7
  });
@@ -17,7 +17,7 @@ export interface NavItemProps<T = string> extends WithAsProps, Omit<React.HTMLAt
17
17
  /** Providing a `href` will render an `<a>` element */
18
18
  href?: string;
19
19
  /** Select the callback function that the event triggers. */
20
- onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
20
+ onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
21
21
  }
22
22
  /**
23
23
  * The <Nav.Item> API
@@ -5,7 +5,7 @@ import NavbarBody from './NavbarBody';
5
5
  import NavbarHeader from './NavbarHeader';
6
6
  import NavbarBrand from './NavbarBrand';
7
7
  import { useClassNames } from '../utils';
8
- export var NavbarContext = /*#__PURE__*/React.createContext(null);
8
+ export var NavbarContext = /*#__PURE__*/React.createContext(false);
9
9
  var Navbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
10
10
  var className = props.className,
11
11
  _props$as = props.as,