rsuite 5.2.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) 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/Button/styles/index.less +6 -0
  5. package/ButtonGroup/styles/index.less +0 -18
  6. package/CHANGELOG.md +49 -0
  7. package/CheckTreePicker/styles/index.less +14 -1
  8. package/PanelGroup/styles/index.less +12 -12
  9. package/Table/styles/index.less +0 -4
  10. package/TreePicker/styles/index.less +10 -0
  11. package/cjs/@types/common.d.ts +9 -8
  12. package/cjs/@types/utils.d.ts +12 -0
  13. package/cjs/Affix/Affix.js +5 -5
  14. package/cjs/Animation/Transition.d.ts +21 -12
  15. package/cjs/Animation/Transition.js +4 -1
  16. package/cjs/AutoComplete/AutoComplete.js +1 -1
  17. package/cjs/AutoComplete/utils.d.ts +1 -1
  18. package/cjs/Avatar/Avatar.js +10 -3
  19. package/cjs/AvatarGroup/AvatarGroup.d.ts +15 -0
  20. package/cjs/AvatarGroup/AvatarGroup.js +71 -0
  21. package/cjs/AvatarGroup/index.d.ts +3 -0
  22. package/cjs/AvatarGroup/index.js +11 -0
  23. package/cjs/Breadcrumb/Breadcrumb.js +1 -1
  24. package/cjs/Button/Button.js +8 -2
  25. package/cjs/ButtonGroup/ButtonGroup.js +8 -2
  26. package/cjs/ButtonGroup/ButtonGroupContext.d.ts +7 -0
  27. package/cjs/ButtonGroup/ButtonGroupContext.js +13 -0
  28. package/cjs/ButtonGroup/index.d.ts +2 -0
  29. package/cjs/ButtonGroup/index.js +3 -0
  30. package/cjs/Calendar/Calendar.d.ts +4 -4
  31. package/cjs/Calendar/Calendar.js +5 -2
  32. package/cjs/Calendar/CalendarContext.js +1 -1
  33. package/cjs/Calendar/TableRow.js +1 -1
  34. package/cjs/Calendar/TimeDropdown.js +6 -5
  35. package/cjs/Calendar/types.d.ts +2 -2
  36. package/cjs/Calendar/useCalendarDate.d.ts +2 -2
  37. package/cjs/Carousel/Carousel.d.ts +2 -2
  38. package/cjs/Carousel/Carousel.js +1 -1
  39. package/cjs/Cascader/Cascader.d.ts +1 -1
  40. package/cjs/Cascader/Cascader.js +10 -10
  41. package/cjs/Cascader/DropdownMenu.d.ts +5 -4
  42. package/cjs/Cascader/utils.d.ts +3 -3
  43. package/cjs/CheckPicker/CheckPicker.js +4 -4
  44. package/cjs/CheckTreePicker/CheckTreeNode.d.ts +1 -1
  45. package/cjs/CheckTreePicker/CheckTreeNode.js +7 -9
  46. package/cjs/CheckTreePicker/CheckTreePicker.js +34 -27
  47. package/cjs/CheckTreePicker/utils.d.ts +3 -1
  48. package/cjs/CheckTreePicker/utils.js +12 -10
  49. package/cjs/Checkbox/Checkbox.d.ts +1 -1
  50. package/cjs/CheckboxGroup/CheckboxGroup.js +2 -2
  51. package/cjs/CustomProvider/CustomProvider.d.ts +31 -57
  52. package/cjs/DOMHelper/index.d.ts +12 -12
  53. package/cjs/DatePicker/DatePicker.d.ts +1 -1
  54. package/cjs/DatePicker/DatePicker.js +15 -9
  55. package/cjs/DatePicker/Toolbar.d.ts +12 -9
  56. package/cjs/DatePicker/Toolbar.js +6 -8
  57. package/cjs/DatePicker/types.d.ts +4 -4
  58. package/cjs/DatePicker/utils.d.ts +4 -3
  59. package/cjs/DateRangePicker/Calendar.d.ts +9 -7
  60. package/cjs/DateRangePicker/Calendar.js +27 -6
  61. package/cjs/DateRangePicker/DateRangePicker.d.ts +8 -6
  62. package/cjs/DateRangePicker/DateRangePicker.js +126 -107
  63. package/cjs/DateRangePicker/types.d.ts +2 -1
  64. package/cjs/DateRangePicker/utils.d.ts +6 -6
  65. package/cjs/DateRangePicker/utils.js +7 -2
  66. package/cjs/Disclosure/Disclosure.js +4 -2
  67. package/cjs/Disclosure/DisclosureButton.js +9 -7
  68. package/cjs/Disclosure/DisclosureContent.js +4 -6
  69. package/cjs/Disclosure/DisclosureContext.d.ts +2 -2
  70. package/cjs/Disclosure/useDisclosureContext.d.ts +2 -0
  71. package/cjs/Disclosure/useDisclosureContext.js +20 -0
  72. package/cjs/Dropdown/Dropdown.d.ts +1 -1
  73. package/cjs/Dropdown/DropdownContext.d.ts +2 -2
  74. package/cjs/Dropdown/DropdownItem.js +3 -2
  75. package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
  76. package/cjs/Dropdown/DropdownState.d.ts +1 -1
  77. package/cjs/Dropdown/DropdownToggle.js +2 -1
  78. package/cjs/Dropdown/useRenderDropdownItem.d.ts +1 -1
  79. package/cjs/Form/Form.js +1 -1
  80. package/cjs/Form/FormContext.d.ts +1 -1
  81. package/cjs/FormControl/FormControl.d.ts +1 -1
  82. package/cjs/FormControl/FormControl.js +5 -4
  83. package/cjs/FormGroup/FormGroup.d.ts +1 -1
  84. package/cjs/Input/Input.d.ts +3 -2
  85. package/cjs/InputGroup/InputGroup.d.ts +1 -1
  86. package/cjs/InputNumber/InputNumber.js +6 -2
  87. package/cjs/InputPicker/InputAutosize.js +4 -4
  88. package/cjs/InputPicker/InputPicker.d.ts +2 -2
  89. package/cjs/InputPicker/InputPicker.js +16 -11
  90. package/cjs/List/ListContext.d.ts +1 -1
  91. package/cjs/List/ListContext.js +8 -1
  92. package/cjs/List/helper/AutoScroller.js +4 -2
  93. package/cjs/List/helper/useManager.d.ts +3 -3
  94. package/cjs/List/helper/useManager.js +1 -1
  95. package/cjs/List/helper/useSortHelper.d.ts +3 -3
  96. package/cjs/List/helper/useSortHelper.js +6 -4
  97. package/cjs/List/helper/utils.d.ts +2 -2
  98. package/cjs/MaskedInput/MaskedInput.d.ts +5 -42
  99. package/cjs/MaskedInput/MaskedInput.js +9 -63
  100. package/cjs/MaskedInput/TextMask.d.ts +43 -0
  101. package/cjs/MaskedInput/TextMask.js +80 -0
  102. package/cjs/MaskedInput/adjustCaretPosition.d.ts +6 -6
  103. package/cjs/MaskedInput/conformToMask.js +5 -4
  104. package/cjs/MaskedInput/createTextMaskInputElement.d.ts +2 -2
  105. package/cjs/MaskedInput/utilities.d.ts +1 -1
  106. package/cjs/Menu/Menu.js +60 -41
  107. package/cjs/Menu/MenuContext.d.ts +1 -1
  108. package/cjs/Menu/MenuItem.d.ts +1 -1
  109. package/cjs/Menu/MenuItem.js +31 -23
  110. package/cjs/Menu/Menubar.js +8 -8
  111. package/cjs/Menu/useMenu.js +17 -7
  112. package/cjs/Modal/Modal.js +12 -6
  113. package/cjs/Modal/ModalContext.d.ts +2 -2
  114. package/cjs/Modal/utils.d.ts +1 -1
  115. package/cjs/Modal/utils.js +12 -15
  116. package/cjs/MultiCascader/DropdownMenu.d.ts +4 -4
  117. package/cjs/MultiCascader/MultiCascader.js +6 -6
  118. package/cjs/MultiCascader/utils.d.ts +14 -14
  119. package/cjs/Nav/Nav.d.ts +1 -1
  120. package/cjs/Nav/NavContext.d.ts +1 -1
  121. package/cjs/Nav/NavItem.d.ts +1 -1
  122. package/cjs/Navbar/Navbar.js +1 -1
  123. package/cjs/Navbar/NavbarItem.d.ts +1 -1
  124. package/cjs/Overlay/Modal.d.ts +2 -2
  125. package/cjs/Overlay/Modal.js +41 -31
  126. package/cjs/Overlay/ModalManager.d.ts +17 -8
  127. package/cjs/Overlay/ModalManager.js +11 -20
  128. package/cjs/Overlay/Overlay.d.ts +2 -2
  129. package/cjs/Overlay/Overlay.js +1 -1
  130. package/cjs/Overlay/OverlayTrigger.d.ts +11 -11
  131. package/cjs/Overlay/OverlayTrigger.js +14 -6
  132. package/cjs/Overlay/Position.d.ts +3 -3
  133. package/cjs/Overlay/Position.js +21 -12
  134. package/cjs/Overlay/positionUtils.d.ts +1 -1
  135. package/cjs/Overlay/positionUtils.js +8 -8
  136. package/cjs/Pagination/Pagination.d.ts +1 -1
  137. package/cjs/Pagination/PaginationButton.d.ts +3 -3
  138. package/cjs/Pagination/PaginationGroup.js +5 -3
  139. package/cjs/Panel/Panel.d.ts +1 -1
  140. package/cjs/Panel/Panel.js +2 -2
  141. package/cjs/PanelGroup/PanelGroup.d.ts +2 -2
  142. package/cjs/Picker/DropdownMenu.d.ts +8 -5
  143. package/cjs/Picker/DropdownMenu.js +5 -5
  144. package/cjs/Picker/PickerOverlay.js +4 -3
  145. package/cjs/Picker/PickerToggle.js +11 -8
  146. package/cjs/Picker/PickerToggleTrigger.d.ts +2 -6
  147. package/cjs/Picker/SearchBar.d.ts +1 -1
  148. package/cjs/Picker/SelectedElement.js +2 -1
  149. package/cjs/Picker/VirtualizedList.d.ts +29 -2
  150. package/cjs/Picker/propTypes.d.ts +2 -2
  151. package/cjs/Picker/utils.d.ts +17 -25
  152. package/cjs/Picker/utils.js +71 -46
  153. package/cjs/Placeholder/PlaceholderGrid.js +1 -1
  154. package/cjs/Plaintext/Plaintext.js +2 -1
  155. package/cjs/Radio/Radio.d.ts +1 -1
  156. package/cjs/RadioGroup/RadioGroup.d.ts +2 -2
  157. package/cjs/RadioGroup/RadioGroup.js +3 -3
  158. package/cjs/RangeSlider/RangeSlider.d.ts +2 -2
  159. package/cjs/RangeSlider/RangeSlider.js +6 -4
  160. package/cjs/Rate/Character.js +4 -2
  161. package/cjs/Rate/Rate.js +5 -2
  162. package/cjs/Ripple/Ripple.js +1 -1
  163. package/cjs/SelectPicker/SelectPicker.js +4 -4
  164. package/cjs/Sidenav/Node.d.ts +1 -1
  165. package/cjs/Sidenav/Sidenav.d.ts +4 -4
  166. package/cjs/Sidenav/Sidenav.js +5 -2
  167. package/cjs/Sidenav/SidenavDropdown.js +11 -8
  168. package/cjs/Sidenav/SidenavDropdownItem.js +10 -5
  169. package/cjs/Sidenav/SidenavDropdownMenu.js +9 -5
  170. package/cjs/Sidenav/SidenavItem.d.ts +1 -1
  171. package/cjs/Sidenav/SidenavItem.js +4 -0
  172. package/cjs/Slider/Graduated.d.ts +5 -5
  173. package/cjs/Slider/Handle.d.ts +1 -1
  174. package/cjs/Slider/Handle.js +10 -6
  175. package/cjs/Slider/Mark.d.ts +1 -1
  176. package/cjs/Slider/Slider.d.ts +1 -1
  177. package/cjs/Slider/Slider.js +2 -2
  178. package/cjs/Slider/utils.d.ts +2 -1
  179. package/cjs/Slider/utils.js +4 -5
  180. package/cjs/Steps/StepItem.js +2 -2
  181. package/cjs/TagInput/index.js +1 -1
  182. package/cjs/Toggle/Toggle.js +1 -1
  183. package/cjs/Tree/Tree.d.ts +3 -1
  184. package/cjs/TreePicker/TreeNode.js +6 -8
  185. package/cjs/TreePicker/TreePicker.js +36 -27
  186. package/cjs/Uploader/UploadFileItem.d.ts +1 -1
  187. package/cjs/Uploader/UploadFileItem.js +2 -2
  188. package/cjs/Uploader/UploadTrigger.d.ts +1 -1
  189. package/cjs/Uploader/UploadTrigger.js +2 -3
  190. package/cjs/Uploader/Uploader.d.ts +5 -5
  191. package/cjs/Uploader/Uploader.js +1 -2
  192. package/cjs/index.d.ts +2 -0
  193. package/cjs/index.js +5 -1
  194. package/cjs/locales/index.d.ts +3 -3
  195. package/cjs/toaster/ToastContainer.d.ts +1 -1
  196. package/cjs/toaster/ToastContainer.js +1 -1
  197. package/cjs/toaster/toaster.js +3 -1
  198. package/cjs/utils/BrowserDetection.js +1 -1
  199. package/cjs/utils/ReactChildren.d.ts +2 -2
  200. package/cjs/utils/ajaxUpload.d.ts +1 -1
  201. package/cjs/utils/ajaxUpload.js +5 -4
  202. package/cjs/utils/appendTooltip.d.ts +1 -1
  203. package/cjs/utils/constants.d.ts +4 -4
  204. package/cjs/utils/createChainedFunction.d.ts +1 -1
  205. package/cjs/utils/getDataGroupBy.d.ts +1 -1
  206. package/cjs/utils/mergeRefs.d.ts +2 -2
  207. package/cjs/utils/previewFile.d.ts +1 -1
  208. package/cjs/utils/propTypeChecker.d.ts +6 -2
  209. package/cjs/utils/propTypeChecker.js +7 -6
  210. package/cjs/utils/reactToString.d.ts +2 -1
  211. package/cjs/utils/statusIcons.d.ts +1 -1
  212. package/cjs/utils/stringToObject.d.ts +1 -1
  213. package/cjs/utils/treeUtils.d.ts +32 -29
  214. package/cjs/utils/treeUtils.js +46 -23
  215. package/cjs/utils/useControlled.d.ts +6 -1
  216. package/cjs/utils/useControlled.js +0 -8
  217. package/cjs/utils/useCustom.js +6 -4
  218. package/cjs/utils/useElementResize.d.ts +1 -1
  219. package/cjs/utils/useElementResize.js +11 -6
  220. package/cjs/utils/useFocus.d.ts +2 -2
  221. package/cjs/utils/usePortal.d.ts +1 -1
  222. package/cjs/utils/useRootClose.d.ts +2 -2
  223. package/cjs/utils/useTimeout.d.ts +1 -1
  224. package/cjs/utils/useTimeout.js +5 -3
  225. package/dist/rsuite-rtl.css +85 -165
  226. package/dist/rsuite-rtl.min.css +1 -1
  227. package/dist/rsuite-rtl.min.css.map +1 -1
  228. package/dist/rsuite.css +85 -165
  229. package/dist/rsuite.js +468 -445
  230. package/dist/rsuite.js.map +1 -1
  231. package/dist/rsuite.min.css +1 -1
  232. package/dist/rsuite.min.css.map +1 -1
  233. package/dist/rsuite.min.js +1 -1
  234. package/dist/rsuite.min.js.LICENSE.txt +9 -0
  235. package/dist/rsuite.min.js.map +1 -1
  236. package/esm/@types/common.d.ts +9 -8
  237. package/esm/@types/utils.d.ts +12 -0
  238. package/esm/Affix/Affix.js +5 -5
  239. package/esm/Animation/Transition.d.ts +21 -12
  240. package/esm/Animation/Transition.js +4 -1
  241. package/esm/AutoComplete/AutoComplete.js +1 -1
  242. package/esm/AutoComplete/utils.d.ts +1 -1
  243. package/esm/Avatar/Avatar.js +7 -3
  244. package/esm/AvatarGroup/AvatarGroup.d.ts +15 -0
  245. package/esm/AvatarGroup/AvatarGroup.js +54 -0
  246. package/esm/AvatarGroup/index.d.ts +3 -0
  247. package/esm/AvatarGroup/index.js +2 -0
  248. package/esm/Breadcrumb/Breadcrumb.js +1 -1
  249. package/esm/Button/Button.js +6 -2
  250. package/esm/ButtonGroup/ButtonGroup.js +7 -2
  251. package/esm/ButtonGroup/ButtonGroupContext.d.ts +7 -0
  252. package/esm/ButtonGroup/ButtonGroupContext.js +3 -0
  253. package/esm/ButtonGroup/index.d.ts +2 -0
  254. package/esm/ButtonGroup/index.js +2 -0
  255. package/esm/Calendar/Calendar.d.ts +4 -4
  256. package/esm/Calendar/Calendar.js +5 -2
  257. package/esm/Calendar/CalendarContext.js +1 -1
  258. package/esm/Calendar/TableRow.js +1 -1
  259. package/esm/Calendar/TimeDropdown.js +5 -4
  260. package/esm/Calendar/types.d.ts +2 -2
  261. package/esm/Calendar/useCalendarDate.d.ts +2 -2
  262. package/esm/Carousel/Carousel.d.ts +2 -2
  263. package/esm/Carousel/Carousel.js +1 -1
  264. package/esm/Cascader/Cascader.d.ts +1 -1
  265. package/esm/Cascader/Cascader.js +10 -10
  266. package/esm/Cascader/DropdownMenu.d.ts +5 -4
  267. package/esm/Cascader/utils.d.ts +3 -3
  268. package/esm/CheckPicker/CheckPicker.js +4 -4
  269. package/esm/CheckTreePicker/CheckTreeNode.d.ts +1 -1
  270. package/esm/CheckTreePicker/CheckTreeNode.js +4 -7
  271. package/esm/CheckTreePicker/CheckTreePicker.js +33 -25
  272. package/esm/CheckTreePicker/utils.d.ts +3 -1
  273. package/esm/CheckTreePicker/utils.js +12 -10
  274. package/esm/Checkbox/Checkbox.d.ts +1 -1
  275. package/esm/CheckboxGroup/CheckboxGroup.js +2 -2
  276. package/esm/CustomProvider/CustomProvider.d.ts +31 -57
  277. package/esm/DOMHelper/index.d.ts +12 -12
  278. package/esm/DatePicker/DatePicker.d.ts +1 -1
  279. package/esm/DatePicker/DatePicker.js +14 -9
  280. package/esm/DatePicker/Toolbar.d.ts +12 -9
  281. package/esm/DatePicker/Toolbar.js +6 -8
  282. package/esm/DatePicker/types.d.ts +4 -4
  283. package/esm/DatePicker/utils.d.ts +4 -3
  284. package/esm/DateRangePicker/Calendar.d.ts +9 -7
  285. package/esm/DateRangePicker/Calendar.js +28 -6
  286. package/esm/DateRangePicker/DateRangePicker.d.ts +8 -6
  287. package/esm/DateRangePicker/DateRangePicker.js +124 -107
  288. package/esm/DateRangePicker/types.d.ts +2 -1
  289. package/esm/DateRangePicker/utils.d.ts +6 -6
  290. package/esm/DateRangePicker/utils.js +6 -2
  291. package/esm/Disclosure/Disclosure.js +4 -2
  292. package/esm/Disclosure/DisclosureButton.js +8 -7
  293. package/esm/Disclosure/DisclosureContent.js +5 -7
  294. package/esm/Disclosure/DisclosureContext.d.ts +2 -2
  295. package/esm/Disclosure/useDisclosureContext.d.ts +2 -0
  296. package/esm/Disclosure/useDisclosureContext.js +11 -0
  297. package/esm/Dropdown/Dropdown.d.ts +1 -1
  298. package/esm/Dropdown/DropdownContext.d.ts +2 -2
  299. package/esm/Dropdown/DropdownItem.js +3 -2
  300. package/esm/Dropdown/DropdownMenu.d.ts +3 -3
  301. package/esm/Dropdown/DropdownState.d.ts +1 -1
  302. package/esm/Dropdown/DropdownToggle.js +2 -1
  303. package/esm/Dropdown/useRenderDropdownItem.d.ts +1 -1
  304. package/esm/Form/Form.js +1 -1
  305. package/esm/Form/FormContext.d.ts +1 -1
  306. package/esm/FormControl/FormControl.d.ts +1 -1
  307. package/esm/FormControl/FormControl.js +5 -4
  308. package/esm/FormGroup/FormGroup.d.ts +1 -1
  309. package/esm/Input/Input.d.ts +3 -2
  310. package/esm/InputGroup/InputGroup.d.ts +1 -1
  311. package/esm/InputNumber/InputNumber.js +6 -2
  312. package/esm/InputPicker/InputAutosize.js +4 -4
  313. package/esm/InputPicker/InputPicker.d.ts +2 -2
  314. package/esm/InputPicker/InputPicker.js +16 -11
  315. package/esm/List/ListContext.d.ts +1 -1
  316. package/esm/List/ListContext.js +7 -1
  317. package/esm/List/helper/AutoScroller.js +4 -2
  318. package/esm/List/helper/useManager.d.ts +3 -3
  319. package/esm/List/helper/useManager.js +1 -1
  320. package/esm/List/helper/useSortHelper.d.ts +3 -3
  321. package/esm/List/helper/useSortHelper.js +6 -4
  322. package/esm/List/helper/utils.d.ts +2 -2
  323. package/esm/MaskedInput/MaskedInput.d.ts +5 -42
  324. package/esm/MaskedInput/MaskedInput.js +9 -63
  325. package/esm/MaskedInput/TextMask.d.ts +43 -0
  326. package/esm/MaskedInput/TextMask.js +67 -0
  327. package/esm/MaskedInput/adjustCaretPosition.d.ts +6 -6
  328. package/esm/MaskedInput/conformToMask.js +5 -4
  329. package/esm/MaskedInput/createTextMaskInputElement.d.ts +2 -2
  330. package/esm/MaskedInput/utilities.d.ts +1 -1
  331. package/esm/Menu/Menu.js +59 -43
  332. package/esm/Menu/MenuContext.d.ts +1 -1
  333. package/esm/Menu/MenuItem.d.ts +1 -1
  334. package/esm/Menu/MenuItem.js +30 -23
  335. package/esm/Menu/Menubar.js +7 -8
  336. package/esm/Menu/useMenu.js +17 -7
  337. package/esm/Modal/Modal.js +12 -6
  338. package/esm/Modal/ModalContext.d.ts +2 -2
  339. package/esm/Modal/utils.d.ts +1 -1
  340. package/esm/Modal/utils.js +11 -12
  341. package/esm/MultiCascader/DropdownMenu.d.ts +4 -4
  342. package/esm/MultiCascader/MultiCascader.js +6 -6
  343. package/esm/MultiCascader/utils.d.ts +14 -14
  344. package/esm/Nav/Nav.d.ts +1 -1
  345. package/esm/Nav/NavContext.d.ts +1 -1
  346. package/esm/Nav/NavItem.d.ts +1 -1
  347. package/esm/Navbar/Navbar.js +1 -1
  348. package/esm/Navbar/NavbarItem.d.ts +1 -1
  349. package/esm/Overlay/Modal.d.ts +2 -2
  350. package/esm/Overlay/Modal.js +42 -32
  351. package/esm/Overlay/ModalManager.d.ts +17 -8
  352. package/esm/Overlay/ModalManager.js +11 -20
  353. package/esm/Overlay/Overlay.d.ts +2 -2
  354. package/esm/Overlay/Overlay.js +1 -1
  355. package/esm/Overlay/OverlayTrigger.d.ts +11 -11
  356. package/esm/Overlay/OverlayTrigger.js +14 -6
  357. package/esm/Overlay/Position.d.ts +3 -3
  358. package/esm/Overlay/Position.js +20 -11
  359. package/esm/Overlay/positionUtils.d.ts +1 -1
  360. package/esm/Overlay/positionUtils.js +6 -6
  361. package/esm/Pagination/Pagination.d.ts +1 -1
  362. package/esm/Pagination/PaginationButton.d.ts +3 -3
  363. package/esm/Pagination/PaginationGroup.js +5 -3
  364. package/esm/Panel/Panel.d.ts +1 -1
  365. package/esm/Panel/Panel.js +2 -2
  366. package/esm/PanelGroup/PanelGroup.d.ts +2 -2
  367. package/esm/Picker/DropdownMenu.d.ts +8 -5
  368. package/esm/Picker/DropdownMenu.js +5 -5
  369. package/esm/Picker/PickerOverlay.js +4 -3
  370. package/esm/Picker/PickerToggle.js +11 -8
  371. package/esm/Picker/PickerToggleTrigger.d.ts +2 -6
  372. package/esm/Picker/SearchBar.d.ts +1 -1
  373. package/esm/Picker/SelectedElement.js +2 -1
  374. package/esm/Picker/VirtualizedList.d.ts +29 -2
  375. package/esm/Picker/propTypes.d.ts +2 -2
  376. package/esm/Picker/utils.d.ts +17 -25
  377. package/esm/Picker/utils.js +70 -46
  378. package/esm/Placeholder/PlaceholderGrid.js +1 -1
  379. package/esm/Plaintext/Plaintext.js +2 -1
  380. package/esm/Radio/Radio.d.ts +1 -1
  381. package/esm/RadioGroup/RadioGroup.d.ts +2 -2
  382. package/esm/RadioGroup/RadioGroup.js +3 -3
  383. package/esm/RangeSlider/RangeSlider.d.ts +2 -2
  384. package/esm/RangeSlider/RangeSlider.js +5 -4
  385. package/esm/Rate/Character.js +3 -2
  386. package/esm/Rate/Rate.js +4 -2
  387. package/esm/Ripple/Ripple.js +1 -1
  388. package/esm/SelectPicker/SelectPicker.js +4 -4
  389. package/esm/Sidenav/Node.d.ts +1 -1
  390. package/esm/Sidenav/Sidenav.d.ts +4 -4
  391. package/esm/Sidenav/Sidenav.js +5 -2
  392. package/esm/Sidenav/SidenavDropdown.js +11 -7
  393. package/esm/Sidenav/SidenavDropdownItem.js +11 -5
  394. package/esm/Sidenav/SidenavDropdownMenu.js +9 -5
  395. package/esm/Sidenav/SidenavItem.d.ts +1 -1
  396. package/esm/Sidenav/SidenavItem.js +4 -0
  397. package/esm/Slider/Graduated.d.ts +5 -5
  398. package/esm/Slider/Handle.d.ts +1 -1
  399. package/esm/Slider/Handle.js +10 -6
  400. package/esm/Slider/Mark.d.ts +1 -1
  401. package/esm/Slider/Slider.d.ts +1 -1
  402. package/esm/Slider/Slider.js +2 -2
  403. package/esm/Slider/utils.d.ts +2 -1
  404. package/esm/Slider/utils.js +5 -2
  405. package/esm/Steps/StepItem.js +2 -2
  406. package/esm/TagInput/index.js +1 -1
  407. package/esm/Toggle/Toggle.js +1 -1
  408. package/esm/Tree/Tree.d.ts +3 -1
  409. package/esm/TreePicker/TreeNode.js +4 -7
  410. package/esm/TreePicker/TreePicker.js +35 -25
  411. package/esm/Uploader/UploadFileItem.d.ts +1 -1
  412. package/esm/Uploader/UploadFileItem.js +2 -2
  413. package/esm/Uploader/UploadTrigger.d.ts +1 -1
  414. package/esm/Uploader/UploadTrigger.js +2 -3
  415. package/esm/Uploader/Uploader.d.ts +5 -5
  416. package/esm/Uploader/Uploader.js +1 -2
  417. package/esm/index.d.ts +2 -0
  418. package/esm/index.js +1 -0
  419. package/esm/locales/index.d.ts +3 -3
  420. package/esm/toaster/ToastContainer.d.ts +1 -1
  421. package/esm/toaster/ToastContainer.js +1 -1
  422. package/esm/toaster/toaster.js +3 -1
  423. package/esm/utils/BrowserDetection.js +1 -1
  424. package/esm/utils/ReactChildren.d.ts +2 -2
  425. package/esm/utils/ajaxUpload.d.ts +1 -1
  426. package/esm/utils/ajaxUpload.js +5 -4
  427. package/esm/utils/appendTooltip.d.ts +1 -1
  428. package/esm/utils/constants.d.ts +4 -4
  429. package/esm/utils/createChainedFunction.d.ts +1 -1
  430. package/esm/utils/getDataGroupBy.d.ts +1 -1
  431. package/esm/utils/mergeRefs.d.ts +2 -2
  432. package/esm/utils/previewFile.d.ts +1 -1
  433. package/esm/utils/propTypeChecker.d.ts +6 -2
  434. package/esm/utils/propTypeChecker.js +7 -6
  435. package/esm/utils/reactToString.d.ts +2 -1
  436. package/esm/utils/statusIcons.d.ts +1 -1
  437. package/esm/utils/stringToObject.d.ts +1 -1
  438. package/esm/utils/treeUtils.d.ts +32 -29
  439. package/esm/utils/treeUtils.js +45 -21
  440. package/esm/utils/useControlled.d.ts +6 -1
  441. package/esm/utils/useControlled.js +0 -8
  442. package/esm/utils/useCustom.js +6 -4
  443. package/esm/utils/useElementResize.d.ts +1 -1
  444. package/esm/utils/useElementResize.js +12 -5
  445. package/esm/utils/useFocus.d.ts +2 -2
  446. package/esm/utils/usePortal.d.ts +1 -1
  447. package/esm/utils/useRootClose.d.ts +2 -2
  448. package/esm/utils/useTimeout.d.ts +1 -1
  449. package/esm/utils/useTimeout.js +5 -3
  450. package/package.json +4 -4
  451. package/styles/index.less +1 -0
@@ -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,34 +5,34 @@ 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
@@ -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;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  export interface NavContextProps {
3
3
  activeKey: string | null;
4
- onSelect: (eventKey: string, event: React.SyntheticEvent) => void;
4
+ onSelect?: (eventKey: string | undefined, event: React.SyntheticEvent) => void;
5
5
  }
6
6
  declare const NavContext: React.Context<NavContextProps>;
7
7
  export default NavContext;
@@ -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,
@@ -13,7 +13,7 @@ export interface NavItemProps<T = string> extends WithAsProps, Omit<React.HTMLAt
13
13
  /** Providing a `href` will render an `<a>` element */
14
14
  href?: string;
15
15
  /** Select the callback function that the event triggers. */
16
- onSelect?: (eventKey: T, event: React.SyntheticEvent) => void;
16
+ onSelect?: (eventKey: T | undefined, event: React.SyntheticEvent) => void;
17
17
  }
18
18
  declare const NavbarItem: RsRefForwardingComponent<'a', NavItemProps>;
19
19
  export default NavbarItem;
@@ -44,8 +44,8 @@ interface ModalProps extends BaseModalProps {
44
44
  containerClassName?: string;
45
45
  backdropTransitionTimeout?: number;
46
46
  dialogTransitionTimeout?: number;
47
- transition: React.ElementType;
48
- onEscapeKeyUp?: React.KeyboardEventHandler;
47
+ transition?: React.ElementType;
48
+ onEsc?: React.KeyboardEventHandler;
49
49
  onBackdropClick?: React.MouseEventHandler;
50
50
  }
51
51
  declare const Modal: RsRefForwardingComponent<'div', ModalProps>;
@@ -10,7 +10,7 @@ import on from 'dom-lib/on';
10
10
  import ModalManager from './ModalManager';
11
11
  import Fade from '../Animation/Fade';
12
12
  import { animationPropTypes } from '../Animation/utils';
13
- import { mergeRefs, getDOMNode, usePortal, createChainedFunction, useWillUnmount } from '../utils';
13
+ import { mergeRefs, usePortal, createChainedFunction, useWillUnmount, KEY_VALUES } from '../utils';
14
14
  var manager;
15
15
 
16
16
  function getManager() {
@@ -25,6 +25,12 @@ var useModalManager = function useModalManager() {
25
25
  backdrop: null
26
26
  });
27
27
  return {
28
+ get dialog() {
29
+ var _modal$current;
30
+
31
+ return (_modal$current = modal.current) === null || _modal$current === void 0 ? void 0 : _modal$current.dialog;
32
+ },
33
+
28
34
  add: function add(containerElement, containerClassName) {
29
35
  return modalManager.add(modal.current, containerElement, containerClassName);
30
36
  },
@@ -67,7 +73,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
67
73
  _props$autoFocus = props.autoFocus,
68
74
  autoFocus = _props$autoFocus === void 0 ? true : _props$autoFocus,
69
75
  onBackdropClick = props.onBackdropClick,
70
- onEscapeKeyUp = props.onEscapeKeyUp,
76
+ onEsc = props.onEsc,
71
77
  onExit = props.onExit,
72
78
  onExiting = props.onExiting,
73
79
  onExited = props.onExited,
@@ -76,7 +82,7 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
76
82
  onEntered = props.onEntered,
77
83
  onClose = props.onClose,
78
84
  onOpen = props.onOpen,
79
- rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onBackdropClick", "onEscapeKeyUp", "onExit", "onExiting", "onExited", "onEnter", "onEntering", "onEntered", "onClose", "onOpen"]);
85
+ rest = _objectWithoutPropertiesLoose(props, ["as", "children", "transition", "dialogTransitionTimeout", "style", "className", "container", "animationProps", "containerClassName", "keyboard", "enforceFocus", "backdrop", "backdropTransitionTimeout", "backdropStyle", "backdropClassName", "open", "autoFocus", "onBackdropClick", "onEsc", "onExit", "onExiting", "onExited", "onEnter", "onEntering", "onEntered", "onClose", "onOpen"]);
80
86
 
81
87
  var _useState = useState(!open),
82
88
  exited = _useState[0],
@@ -96,19 +102,13 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
96
102
  }
97
103
 
98
104
  var mountModal = open || Transition && !exited;
99
- var rootRef = useRef();
100
- var lastFocus = useRef();
101
- var handleDocumentKeyUp = useCallback(function (event) {
102
- if (keyboard && event.keyCode === 27 && modal.isTopModal()) {
103
- onEscapeKeyUp === null || onEscapeKeyUp === void 0 ? void 0 : onEscapeKeyUp(event);
105
+ var lastFocus = useRef(null);
106
+ var handleDocumentKeyDown = useCallback(function (event) {
107
+ if (keyboard && event.key === KEY_VALUES.ESC && modal.isTopModal()) {
108
+ onEsc === null || onEsc === void 0 ? void 0 : onEsc(event);
104
109
  onClose === null || onClose === void 0 ? void 0 : onClose(event);
105
110
  }
106
- }, [keyboard, modal, onEscapeKeyUp, onClose]);
107
- var checkForFocus = useCallback(function () {
108
- if (canUseDOM) {
109
- lastFocus.current = document.activeElement;
110
- }
111
- }, []);
111
+ }, [keyboard, modal, onEsc, onClose]);
112
112
  var restoreLastFocus = useCallback(function () {
113
113
  if (lastFocus.current) {
114
114
  var _lastFocus$current$fo, _lastFocus$current;
@@ -117,21 +117,18 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
117
117
  lastFocus.current = null;
118
118
  }
119
119
  }, []);
120
- var getDialogElement = useCallback(function () {
121
- return getDOMNode(rootRef.current);
122
- }, []);
123
120
  var handleEnforceFocus = useCallback(function () {
124
121
  if (!enforceFocus || !modal.isTopModal()) {
125
122
  return;
126
123
  }
127
124
 
128
125
  var currentActiveElement = document.activeElement;
129
- var dialog = getDialogElement();
126
+ var dialog = modal.dialog;
130
127
 
131
128
  if (dialog && dialog !== currentActiveElement && !contains(dialog, currentActiveElement)) {
132
129
  dialog.focus();
133
130
  }
134
- }, [enforceFocus, getDialogElement, modal]);
131
+ }, [enforceFocus, modal]);
135
132
  var handleBackdropClick = useCallback(function (event) {
136
133
  if (event.target !== event.currentTarget) {
137
134
  return;
@@ -143,27 +140,40 @@ var Modal = /*#__PURE__*/React.forwardRef(function (props, ref) {
143
140
  onClose === null || onClose === void 0 ? void 0 : onClose(event);
144
141
  }
145
142
  }, [backdrop, onBackdropClick, onClose]);
146
- var documentKeyupListener = useRef();
147
- var docusinListener = useRef();
143
+ var documentKeyDownListener = useRef();
144
+ var documentFocusListener = useRef();
148
145
  var handleOpen = useCallback(function () {
149
- var dialog = getDialogElement();
150
146
  var containerElement = getContainer(container, document.body);
151
147
  modal.add(containerElement, containerClassName);
152
- documentKeyupListener.current = on(document, 'keydown', handleDocumentKeyUp);
153
- docusinListener.current = on(document, 'focus', handleEnforceFocus, true);
154
- onOpen === null || onOpen === void 0 ? void 0 : onOpen();
155
- checkForFocus();
148
+
149
+ if (!documentKeyDownListener.current) {
150
+ documentKeyDownListener.current = on(document, 'keydown', handleDocumentKeyDown);
151
+ }
152
+
153
+ if (!documentFocusListener.current) {
154
+ documentFocusListener.current = on(document, 'focus', handleEnforceFocus, true);
155
+ }
156
+
157
+ if (canUseDOM) {
158
+ lastFocus.current = document.activeElement;
159
+ }
156
160
 
157
161
  if (autoFocus) {
158
- dialog === null || dialog === void 0 ? void 0 : dialog.focus();
162
+ var _modal$dialog;
163
+
164
+ (_modal$dialog = modal.dialog) === null || _modal$dialog === void 0 ? void 0 : _modal$dialog.focus();
159
165
  }
160
- }, [autoFocus, checkForFocus, container, containerClassName, getDialogElement, handleDocumentKeyUp, handleEnforceFocus, modal, onOpen]);
166
+
167
+ onOpen === null || onOpen === void 0 ? void 0 : onOpen();
168
+ }, [autoFocus, container, containerClassName, handleDocumentKeyDown, handleEnforceFocus, modal, onOpen]);
161
169
  var handleClose = useCallback(function () {
162
- var _documentKeyupListene, _docusinListener$curr;
170
+ var _documentKeyDownListe, _documentFocusListene;
163
171
 
164
172
  modal.remove();
165
- (_documentKeyupListene = documentKeyupListener.current) === null || _documentKeyupListene === void 0 ? void 0 : _documentKeyupListene.off();
166
- (_docusinListener$curr = docusinListener.current) === null || _docusinListener$curr === void 0 ? void 0 : _docusinListener$curr.off();
173
+ (_documentKeyDownListe = documentKeyDownListener.current) === null || _documentKeyDownListe === void 0 ? void 0 : _documentKeyDownListe.off();
174
+ documentKeyDownListener.current = null;
175
+ (_documentFocusListene = documentFocusListener.current) === null || _documentFocusListene === void 0 ? void 0 : _documentFocusListene.off();
176
+ documentFocusListener.current = null;
167
177
  restoreLastFocus();
168
178
  }, [modal, restoreLastFocus]);
169
179
  useEffect(function () {
@@ -264,7 +274,7 @@ Modal.propTypes = _extends({}, animationPropTypes, modalPropTypes, {
264
274
  dialogTransitionTimeout: PropTypes.number,
265
275
  backdropTransitionTimeout: PropTypes.number,
266
276
  transition: PropTypes.any,
267
- onEscapeKeyUp: PropTypes.func,
277
+ onEsc: PropTypes.func,
268
278
  onBackdropClick: PropTypes.func
269
279
  });
270
280
  export default Modal;
@@ -1,11 +1,20 @@
1
+ import React from 'react';
2
+ export interface ModalInstance {
3
+ dialog: HTMLElement | null;
4
+ backdrop: HTMLElement | null;
5
+ }
6
+ export interface ContainerState {
7
+ classes: string[];
8
+ modals: ModalInstance[];
9
+ style: React.CSSProperties;
10
+ overflowing: boolean;
11
+ }
1
12
  declare class ModalManager {
2
- constructor(hideSiblingNodes?: boolean);
3
- hideSiblingNodes: any;
4
- modals: any[];
5
- containers: any[];
6
- data: any[];
7
- add(modal: any, container: any, className?: string): number;
8
- remove(modal: any): void;
9
- isTopModal(modal: any): boolean;
13
+ modals: ModalInstance[];
14
+ containers: HTMLElement[];
15
+ data: ContainerState[];
16
+ add(modal: ModalInstance, container: HTMLElement, className?: string): number;
17
+ remove(modal: ModalInstance): void;
18
+ isTopModal(modal: ModalInstance): boolean;
10
19
  }
11
20
  export default ModalManager;
@@ -25,16 +25,7 @@ function findContainer(data, modal) {
25
25
  }
26
26
 
27
27
  var ModalManager = /*#__PURE__*/function () {
28
- function ModalManager(hideSiblingNodes) {
29
- if (hideSiblingNodes === void 0) {
30
- hideSiblingNodes = true;
31
- }
32
-
33
- this.hideSiblingNodes = null;
34
- this.modals = [];
35
- this.containers = [];
36
- this.data = [];
37
- this.hideSiblingNodes = hideSiblingNodes;
28
+ function ModalManager() {
38
29
  this.modals = [];
39
30
  this.containers = [];
40
31
  this.data = [];
@@ -58,7 +49,7 @@ var ModalManager = /*#__PURE__*/function () {
58
49
  return modalIndex;
59
50
  }
60
51
 
61
- var data = {
52
+ var containerState = {
62
53
  modals: [modal],
63
54
  classes: className ? className.split(/\s+/) : [],
64
55
  style: {
@@ -68,7 +59,7 @@ var ModalManager = /*#__PURE__*/function () {
68
59
  overflowing: isOverflowing(container)
69
60
  };
70
61
 
71
- if (data.overflowing) {
62
+ if (containerState.overflowing) {
72
63
  var paddingRight = parseInt(getStyle(container, 'paddingRight') || 0, 10);
73
64
  var barSize = getScrollbarSize();
74
65
  addStyle(container, {
@@ -76,9 +67,9 @@ var ModalManager = /*#__PURE__*/function () {
76
67
  });
77
68
  }
78
69
 
79
- data.classes.forEach(addClass.bind(null, container));
70
+ containerState.classes.forEach(addClass.bind(null, container));
80
71
  this.containers.push(container);
81
- this.data.push(data);
72
+ this.data.push(containerState);
82
73
  return modalIndex;
83
74
  };
84
75
 
@@ -90,16 +81,16 @@ var ModalManager = /*#__PURE__*/function () {
90
81
  }
91
82
 
92
83
  var containerIndex = findContainer(this.data, modal);
93
- var data = this.data[containerIndex];
84
+ var containerState = this.data[containerIndex];
94
85
  var container = this.containers[containerIndex];
95
- data.modals.splice(data.modals.indexOf(modal), 1);
86
+ containerState.modals.splice(containerState.modals.indexOf(modal), 1);
96
87
  this.modals.splice(modalIndex, 1);
97
88
 
98
- if (data.modals.length === 0) {
99
- Object.keys(data.style).forEach(function (key) {
100
- return container.style[key] = data.style[key];
89
+ if (containerState.modals.length === 0) {
90
+ Object.keys(containerState.style).forEach(function (key) {
91
+ return container.style[key] = containerState.style[key];
101
92
  });
102
- data.classes.forEach(removeClass.bind(null, container));
93
+ containerState.classes.forEach(removeClass.bind(null, container));
103
94
  this.containers.splice(containerIndex, 1);
104
95
  this.data.splice(containerIndex, 1);
105
96
  }
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
3
3
  import { TypeAttributes, AnimationEventProps } from '../@types/common';
4
4
  export interface OverlayProps extends AnimationEventProps {
5
5
  container?: HTMLElement | (() => HTMLElement);
6
- children?: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
6
+ children: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
7
7
  childrenProps?: React.HTMLAttributes<HTMLElement>;
8
8
  className?: string;
9
9
  containerPadding?: number;
@@ -13,7 +13,7 @@ export interface OverlayProps extends AnimationEventProps {
13
13
  rootClose?: boolean;
14
14
  transition?: React.ElementType;
15
15
  triggerTarget?: React.RefObject<any>;
16
- onClose?: () => void;
16
+ onClose?: React.ReactEventHandler;
17
17
  }
18
18
  export declare const overlayPropTypes: {
19
19
  container: PropTypes.Requireable<any>;
@@ -49,7 +49,7 @@ var Overlay = /*#__PURE__*/React.forwardRef(function (props, ref) {
49
49
  exited = _useState[0],
50
50
  setExited = _useState[1];
51
51
 
52
- var overlayTarget = useRef();
52
+ var overlayTarget = useRef(null);
53
53
 
54
54
  if (open) {
55
55
  if (exited) setExited(false);
@@ -17,7 +17,7 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
17
17
  /** Container padding */
18
18
  containerPadding?: number;
19
19
  /** display element */
20
- speaker?: React.ReactElement | ((props: any, ref: React.RefObject<any>) => React.ReactElement);
20
+ speaker: React.ReactElement | ((props: any, ref: React.RefObject<any>) => React.ReactElement);
21
21
  /** Prevent floating element overflow */
22
22
  preventOverflow?: boolean;
23
23
  /** Opern overlay */
@@ -27,7 +27,7 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
27
27
  /** Whether mouse is allowed to enter the floating layer of popover, whose default value is false. */
28
28
  enterable?: boolean;
29
29
  /** For the monitored component, the event will be bound to this component. */
30
- children?: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
30
+ children: React.ReactElement | ((props: any, ref: any) => React.ReactElement);
31
31
  /** Whether to allow clicking document to close the overlay */
32
32
  rootClose?: boolean;
33
33
  /** Once disabled, the event cannot be triggered. */
@@ -39,27 +39,27 @@ export interface OverlayTriggerProps extends StandardProps, AnimationEventProps
39
39
  /** Set the `id` on `<Overlay>` and `aria-describedby` on `<OverlayTrigger>` */
40
40
  controlId?: string;
41
41
  /** Lose Focus callback function */
42
- onBlur?: () => void;
42
+ onBlur?: React.FocusEventHandler;
43
43
  /** Click on the callback function */
44
- onClick?: () => void;
44
+ onClick?: React.MouseEventHandler;
45
45
  /** RightClick on the callback function */
46
46
  onContextMenu?: React.MouseEventHandler;
47
47
  /** Callback function to get focus */
48
- onFocus?: () => void;
48
+ onFocus?: React.FocusEventHandler;
49
49
  /** Mouse leave callback function */
50
- onMouseOut?: () => void;
50
+ onMouseOut?: React.MouseEventHandler;
51
51
  /** Mouse over callback function */
52
- onMouseOver?: () => void;
52
+ onMouseOver?: React.MouseEventHandler;
53
53
  /** Callback fired when open component */
54
54
  onOpen?: () => void;
55
55
  /** Callback fired when close component */
56
56
  onClose?: () => void;
57
57
  }
58
58
  export interface OverlayTriggerInstance {
59
- root: Element;
60
- updatePosition?: () => void;
61
- open?: () => void;
62
- close?: () => void;
59
+ root: HTMLElement;
60
+ updatePosition: () => void;
61
+ open: () => void;
62
+ close: () => void;
63
63
  }
64
64
  declare const OverlayTrigger: React.ForwardRefExoticComponent<OverlayTriggerProps & React.RefAttributes<unknown>>;
65
65
  export default OverlayTrigger;
@@ -90,8 +90,8 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
90
90
  // In order to keep the overlay open, a timer is used to delay the closing.
91
91
 
92
92
 
93
- var delayOpenTimer = useRef();
94
- var delayCloseTimer = useRef();
93
+ var delayOpenTimer = useRef(null);
94
+ var delayCloseTimer = useRef(null);
95
95
  var delayOpen = isNil(delayOpenProp) ? delay : delayOpenProp;
96
96
  var delayClose = isNil(delayCloseProp) ? delay : delayCloseProp; // Whether the cursor is on the overlay
97
97
 
@@ -100,8 +100,13 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
100
100
  var isOnTrigger = useRef(false);
101
101
  useEffect(function () {
102
102
  return function () {
103
- clearTimeout(delayOpenTimer.current);
104
- clearTimeout(delayCloseTimer.current);
103
+ if (!isNil(delayOpenTimer.current)) {
104
+ clearTimeout(delayOpenTimer.current);
105
+ }
106
+
107
+ if (!isNil(delayCloseTimer.current)) {
108
+ clearTimeout(delayCloseTimer.current);
109
+ }
105
110
  };
106
111
  }, []);
107
112
  var handleOpen = useCallback(function (delay) {
@@ -207,8 +212,11 @@ var OverlayTrigger = /*#__PURE__*/React.forwardRef(function (props, ref) {
207
212
  }
208
213
 
209
214
  delayCloseTimer.current = setTimeout(function () {
210
- clearTimeout(delayCloseTimer.current);
211
- delayCloseTimer.current = null;
215
+ if (!isNil(delayCloseTimer.current)) {
216
+ clearTimeout(delayCloseTimer.current);
217
+ delayCloseTimer.current = null;
218
+ }
219
+
212
220
  handleCloseWhenLeave();
213
221
  }, 200);
214
222
  }, [enterable, open, handleClose, handleCloseWhenLeave]);
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { TypeAttributes } from '../@types/common';
3
3
  export interface PositionChildProps {
4
4
  className: string;
5
- left: number;
6
- top: number;
5
+ left?: number;
6
+ top?: number;
7
7
  }
8
8
  export interface PositionProps {
9
- children?: (props: PositionChildProps, ref: any) => React.ReactElement;
9
+ children: (props: PositionChildProps, ref: any) => React.ReactElement;
10
10
  className?: string;
11
11
  container?: HTMLElement | (() => HTMLElement);
12
12
  containerPadding?: number;