rsuite 6.1.2 → 6.2.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 (651) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/Timeline/styles/index.css +11 -0
  3. package/Timeline/styles/index.scss +13 -0
  4. package/Uploader/styles/index.css +3 -0
  5. package/Uploader/styles/index.scss +3 -0
  6. package/cjs/Affix/Affix.js +4 -4
  7. package/cjs/Animation/Collapse.js +4 -5
  8. package/cjs/Animation/Transition.d.ts +2 -2
  9. package/cjs/Animation/Transition.js +17 -20
  10. package/cjs/AutoComplete/AutoComplete.d.ts +2 -0
  11. package/cjs/AutoComplete/AutoComplete.js +12 -10
  12. package/cjs/Avatar/useImage.js +1 -1
  13. package/cjs/AvatarGroup/AvatarGroup.d.ts +2 -2
  14. package/cjs/Badge/Badge.js +1 -4
  15. package/cjs/Breadcrumb/Breadcrumb.js +4 -4
  16. package/cjs/Button/Button.js +6 -6
  17. package/cjs/Calendar/Calendar.js +5 -5
  18. package/cjs/Calendar/CalendarBody.js +1 -1
  19. package/cjs/Calendar/CalendarContainer.js +14 -33
  20. package/cjs/Calendar/CalendarHeader.js +7 -8
  21. package/cjs/Calendar/Grid/GridCell.js +2 -2
  22. package/cjs/Calendar/Grid/GridHeaderRow.js +1 -1
  23. package/cjs/Calendar/Grid/GridRow.js +5 -6
  24. package/cjs/Calendar/MonthDropdown/MonthDropdown.js +1 -1
  25. package/cjs/Calendar/MonthDropdown/MonthDropdownItem.js +1 -1
  26. package/cjs/Calendar/TimeDropdown/TimeDropdown.js +12 -14
  27. package/cjs/Calendar/hooks/useCalendar.d.ts +16 -17
  28. package/cjs/Calendar/hooks/useCalendar.js +2 -4
  29. package/cjs/Calendar/hooks/useCalendarDate.js +5 -9
  30. package/cjs/Calendar/hooks/useCalendarState.js +6 -12
  31. package/cjs/Calendar/types.d.ts +0 -1
  32. package/cjs/Carousel/Carousel.js +5 -6
  33. package/cjs/CascadeTree/CascadeTree.js +6 -16
  34. package/cjs/CascadeTree/TreeView.js +5 -7
  35. package/cjs/CascadeTree/hooks/useSearch.d.ts +0 -1
  36. package/cjs/CascadeTree/hooks/useSearch.js +1 -1
  37. package/cjs/CascadeTree/hooks/useSelect.d.ts +0 -1
  38. package/cjs/CascadeTree/hooks/useSelect.js +3 -4
  39. package/cjs/CascadeTree/types.d.ts +0 -1
  40. package/cjs/CascadeTree/utils.js +1 -2
  41. package/cjs/Cascader/Cascader.js +18 -29
  42. package/cjs/Cascader/useActive.d.ts +0 -1
  43. package/cjs/Cascader/useActive.js +4 -6
  44. package/cjs/CheckPicker/CheckPicker.js +14 -15
  45. package/cjs/CheckTree/CheckTree.js +1 -1
  46. package/cjs/CheckTree/CheckTreeNode.js +3 -4
  47. package/cjs/CheckTree/CheckTreeView.js +5 -5
  48. package/cjs/CheckTree/hooks/useTreeCheckState.js +2 -2
  49. package/cjs/CheckTree/utils.js +9 -17
  50. package/cjs/CheckTreePicker/CheckTreePicker.js +7 -7
  51. package/cjs/CheckTreePicker/hooks/useFocusState.d.ts +0 -1
  52. package/cjs/CheckTreePicker/hooks/useFocusState.js +3 -6
  53. package/cjs/Checkbox/Checkbox.js +4 -5
  54. package/cjs/Checkbox/hooks/useIndeterminateCheckbox.d.ts +0 -1
  55. package/cjs/Checkbox/hooks/useIndeterminateCheckbox.js +1 -1
  56. package/cjs/CheckboxGroup/CheckboxGroup.js +2 -2
  57. package/cjs/DOMHelper/index.d.ts +1 -2
  58. package/cjs/DOMHelper/isElement.js +1 -1
  59. package/cjs/DateInput/DateField.d.ts +122 -3
  60. package/cjs/DateInput/DateField.js +12 -15
  61. package/cjs/DateInput/DateInput.js +3 -4
  62. package/cjs/DateInput/hooks/useDateInputState.d.ts +124 -4
  63. package/cjs/DateInput/hooks/useDateInputState.js +2 -2
  64. package/cjs/DateInput/hooks/useIsFocused.js +2 -2
  65. package/cjs/DateInput/hooks/useKeyboardInputEvent.d.ts +0 -1
  66. package/cjs/DateInput/hooks/useKeyboardInputEvent.js +8 -9
  67. package/cjs/DateInput/hooks/useSelectedState.d.ts +0 -1
  68. package/cjs/DateInput/utils.d.ts +0 -1
  69. package/cjs/DateInput/utils.js +2 -3
  70. package/cjs/DatePicker/DatePicker.js +18 -25
  71. package/cjs/DatePicker/PredefinedRanges.js +3 -3
  72. package/cjs/DatePicker/Toolbar.js +4 -4
  73. package/cjs/DatePicker/hooks/useCustomizedInput.d.ts +0 -1
  74. package/cjs/DatePicker/hooks/useFocus.js +5 -8
  75. package/cjs/DatePicker/hooks/useMonthView.d.ts +0 -1
  76. package/cjs/DatePicker/hooks/useMonthView.js +1 -1
  77. package/cjs/DatePicker/utils.d.ts +1 -2
  78. package/cjs/DatePicker/utils.js +2 -2
  79. package/cjs/DateRangeInput/DateRangeInput.js +8 -9
  80. package/cjs/DateRangePicker/Calendar.js +2 -2
  81. package/cjs/DateRangePicker/DateRangePicker.js +25 -29
  82. package/cjs/DateRangePicker/Header.js +3 -3
  83. package/cjs/DateRangePicker/disabledDateUtils.js +2 -2
  84. package/cjs/DateRangePicker/hooks/useCalendarHandlers.d.ts +0 -1
  85. package/cjs/DateRangePicker/hooks/useCalendarHandlers.js +5 -5
  86. package/cjs/DateRangePicker/utils.js +1 -2
  87. package/cjs/Dropdown/Dropdown.js +3 -3
  88. package/cjs/Dropdown/DropdownItem.js +4 -5
  89. package/cjs/Dropdown/DropdownMenu.d.ts +1 -1
  90. package/cjs/Dropdown/DropdownMenu.js +1 -1
  91. package/cjs/Form/Form.d.ts +38 -3
  92. package/cjs/Form/Form.js +25 -12
  93. package/cjs/Form/hooks/useFormRef.d.ts +0 -1
  94. package/cjs/Form/hooks/useFormValidate.d.ts +2 -1
  95. package/cjs/Form/hooks/useFormValidate.js +136 -20
  96. package/cjs/Form/hooks/useFormValue.d.ts +0 -1
  97. package/cjs/Form/index.d.ts +1 -0
  98. package/cjs/Form/resolvers.d.ts +59 -0
  99. package/cjs/Form/resolvers.js +4 -0
  100. package/cjs/FormControl/FormControl.js +5 -5
  101. package/cjs/FormGroup/FormGroupContext.d.ts +1 -1
  102. package/cjs/Highlight/utils/highlightText.js +1 -1
  103. package/cjs/InlineEdit/renderChildren.js +5 -6
  104. package/cjs/InlineEdit/useEditState.js +9 -12
  105. package/cjs/InlineEdit/useFocusEvent.d.ts +0 -1
  106. package/cjs/InlineEdit/useFocusEvent.js +7 -11
  107. package/cjs/Input/Input.js +1 -1
  108. package/cjs/InputGroup/InputGroupContext.d.ts +2 -1
  109. package/cjs/InputNumber/index.d.ts +0 -1
  110. package/cjs/InputPicker/InputAutosize.js +1 -1
  111. package/cjs/InputPicker/InputPicker.js +30 -35
  112. package/cjs/InputPicker/InputSearch.js +1 -2
  113. package/cjs/InputPicker/hooks/useData.d.ts +0 -1
  114. package/cjs/InputPicker/hooks/useData.js +1 -1
  115. package/cjs/InputPicker/hooks/useInput.js +3 -6
  116. package/cjs/InputPicker/hooks/useMaxWidth.js +2 -4
  117. package/cjs/List/helper/AutoScroller.js +2 -4
  118. package/cjs/List/helper/useSortHelper.d.ts +4 -4
  119. package/cjs/List/helper/useSortHelper.js +13 -19
  120. package/cjs/MaskedInput/TextMask.d.ts +5 -5
  121. package/cjs/MaskedInput/TextMask.js +3 -5
  122. package/cjs/MaskedInput/conformToMask.d.ts +1 -1
  123. package/cjs/MaskedInput/createTextMaskInputElement.js +2 -3
  124. package/cjs/Menu/MenuItem.js +3 -4
  125. package/cjs/Message/Message.js +1 -1
  126. package/cjs/Modal/Modal.js +8 -10
  127. package/cjs/Modal/ModalBody.js +1 -1
  128. package/cjs/Modal/utils.d.ts +2 -3
  129. package/cjs/Modal/utils.js +2 -3
  130. package/cjs/MultiCascadeTree/SearchView.js +1 -1
  131. package/cjs/MultiCascadeTree/TreeView.js +2 -2
  132. package/cjs/MultiCascadeTree/hooks/useCascadeValue.d.ts +0 -1
  133. package/cjs/MultiCascadeTree/hooks/useCascadeValue.js +5 -8
  134. package/cjs/MultiCascadeTree/hooks/useColumnData.d.ts +0 -1
  135. package/cjs/MultiCascadeTree/hooks/useSearch.d.ts +0 -1
  136. package/cjs/MultiCascadeTree/hooks/useSearch.js +2 -2
  137. package/cjs/MultiCascadeTree/hooks/useSelect.js +3 -4
  138. package/cjs/MultiCascadeTree/types.d.ts +0 -1
  139. package/cjs/MultiCascadeTree/utils.d.ts +4 -4
  140. package/cjs/MultiCascadeTree/utils.js +2 -3
  141. package/cjs/MultiCascader/MultiCascader.js +13 -16
  142. package/cjs/Nav/AdaptiveNavItem.js +2 -3
  143. package/cjs/Nav/Nav.d.ts +1 -1
  144. package/cjs/Nav/Nav.js +4 -4
  145. package/cjs/Nav/NavDropdown.d.ts +1 -1
  146. package/cjs/Nav/NavDropdown.js +3 -3
  147. package/cjs/Nav/NavDropdownItem.js +2 -2
  148. package/cjs/Nav/NavDropdownMenu.d.ts +1 -1
  149. package/cjs/Nav/NavDropdownMenu.js +1 -1
  150. package/cjs/Nav/NavItem.js +4 -4
  151. package/cjs/Navbar/Navbar.js +1 -1
  152. package/cjs/Navbar/NavbarContent.js +1 -1
  153. package/cjs/Navbar/NavbarDrawer.js +1 -1
  154. package/cjs/Navbar/NavbarDropdown.d.ts +1 -1
  155. package/cjs/Navbar/NavbarDropdown.js +3 -3
  156. package/cjs/Navbar/NavbarDropdownItem.js +5 -6
  157. package/cjs/Navbar/NavbarDropdownMenu.d.ts +1 -1
  158. package/cjs/Navbar/NavbarDropdownMenu.js +1 -1
  159. package/cjs/Navbar/NavbarItem.js +4 -4
  160. package/cjs/Navbar/NavbarToggle.js +2 -2
  161. package/cjs/Notification/Notification.js +1 -1
  162. package/cjs/NumberInput/NumberInput.js +3 -3
  163. package/cjs/NumberInput/hooks/useEvents.d.ts +0 -1
  164. package/cjs/NumberInput/hooks/useEvents.js +2 -3
  165. package/cjs/NumberInput/hooks/useWheelHandler.js +1 -2
  166. package/cjs/Pagination/Pagination.js +1 -1
  167. package/cjs/Pagination/PaginationButton.js +1 -1
  168. package/cjs/Pagination/PaginationGroup.js +3 -4
  169. package/cjs/Panel/Panel.js +2 -2
  170. package/cjs/PanelGroup/PanelGroup.js +1 -1
  171. package/cjs/PasswordInput/PasswordInput.js +2 -2
  172. package/cjs/PinInput/PinInput.js +1 -1
  173. package/cjs/PinInput/hooks/usePinInputRefs.d.ts +0 -1
  174. package/cjs/PinInput/hooks/usePinInputRefs.js +2 -4
  175. package/cjs/PinInput/hooks/usePinValue.d.ts +1 -1
  176. package/cjs/PinInput/hooks/usePinValue.js +2 -2
  177. package/cjs/Progress/ProgressLine.js +1 -1
  178. package/cjs/Progress/types.d.ts +0 -1
  179. package/cjs/ProgressCircle/hooks/useProgressCirclePath.d.ts +0 -1
  180. package/cjs/Radio/Radio.js +3 -3
  181. package/cjs/RadioGroup/RadioGroup.js +1 -1
  182. package/cjs/RadioTile/RadioTile.js +2 -2
  183. package/cjs/RadioTileGroup/RadioTileGroup.js +1 -1
  184. package/cjs/RangeSlider/RangeSlider.js +6 -6
  185. package/cjs/Rate/Character.js +2 -2
  186. package/cjs/Rate/Rate.js +3 -3
  187. package/cjs/Rate/useRatingStates.d.ts +0 -1
  188. package/cjs/SegmentedControl/SegmentedControl.js +3 -3
  189. package/cjs/SegmentedControl/hooks/useIndicatorPosition.js +1 -1
  190. package/cjs/SelectPicker/SelectPicker.js +13 -16
  191. package/cjs/Sidebar/Sidebar.js +1 -1
  192. package/cjs/Sidenav/ExpandedSidenavDropdown.js +6 -6
  193. package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +4 -5
  194. package/cjs/Sidenav/Node.js +9 -16
  195. package/cjs/Sidenav/Sidenav.js +2 -2
  196. package/cjs/Sidenav/SidenavDropdown.d.ts +1 -1
  197. package/cjs/Sidenav/SidenavDropdown.js +4 -4
  198. package/cjs/Sidenav/SidenavDropdownItem.js +3 -4
  199. package/cjs/Sidenav/SidenavItem.js +5 -6
  200. package/cjs/Sidenav/SidenavToggle.js +2 -2
  201. package/cjs/Slider/Slider.js +3 -3
  202. package/cjs/Slider/useDrag.d.ts +0 -1
  203. package/cjs/Slider/useDrag.js +7 -12
  204. package/cjs/Slider/utils.d.ts +1 -2
  205. package/cjs/Slider/utils.js +2 -3
  206. package/cjs/Steps/StepItem.js +1 -2
  207. package/cjs/Table/Table.d.ts +3 -3
  208. package/cjs/Tabs/Tabs.js +3 -4
  209. package/cjs/TimePicker/TimePicker.js +2 -2
  210. package/cjs/Timeline/Timeline.d.ts +6 -1
  211. package/cjs/Timeline/Timeline.js +14 -10
  212. package/cjs/Toggle/Toggle.js +2 -2
  213. package/cjs/Tree/Tree.js +2 -2
  214. package/cjs/Tree/TreeNode.js +10 -11
  215. package/cjs/Tree/TreeView.js +5 -5
  216. package/cjs/Tree/hooks/useExpandTree.js +1 -1
  217. package/cjs/Tree/hooks/useFlattenTree.js +6 -9
  218. package/cjs/Tree/hooks/useFocusTree.d.ts +1 -2
  219. package/cjs/Tree/hooks/useFocusTree.js +12 -14
  220. package/cjs/Tree/hooks/useTreeDrag.d.ts +0 -1
  221. package/cjs/Tree/hooks/useTreeDrag.js +10 -12
  222. package/cjs/Tree/hooks/useTreeNodeProps.js +1 -1
  223. package/cjs/Tree/hooks/useTreeSearch.js +4 -4
  224. package/cjs/Tree/hooks/useVirtualizedTreeData.js +2 -2
  225. package/cjs/Tree/types.d.ts +2 -3
  226. package/cjs/Tree/utils/flattenTree.d.ts +1 -1
  227. package/cjs/Tree/utils/focusableTree.js +5 -8
  228. package/cjs/Tree/utils/getNodeParentKeys.js +2 -4
  229. package/cjs/Tree/utils/hasVisibleChildren.d.ts +1 -1
  230. package/cjs/Tree/utils/treeKeyboardInteractions.js +3 -3
  231. package/cjs/TreePicker/TreePicker.js +8 -9
  232. package/cjs/TreePicker/hooks/useFocusState.d.ts +0 -1
  233. package/cjs/TreePicker/hooks/useFocusState.js +4 -8
  234. package/cjs/Uploader/UploadFileItem.js +8 -10
  235. package/cjs/Uploader/UploadTrigger.js +8 -10
  236. package/cjs/Uploader/Uploader.d.ts +2 -0
  237. package/cjs/Uploader/Uploader.js +66 -26
  238. package/cjs/Uploader/utils/ajaxUpload.js +5 -5
  239. package/cjs/Uploader/utils/previewFile.js +1 -1
  240. package/cjs/internals/Disclosure/Disclosure.js +5 -8
  241. package/cjs/internals/Disclosure/DisclosureButton.js +2 -2
  242. package/cjs/internals/InputBase/InputBase.js +5 -6
  243. package/cjs/internals/Menu/Menu.js +16 -20
  244. package/cjs/internals/Menu/MenuItem.js +4 -5
  245. package/cjs/internals/Menu/Menubar.js +5 -7
  246. package/cjs/internals/Menu/useMenu.js +5 -10
  247. package/cjs/internals/Overlay/Modal.js +8 -11
  248. package/cjs/internals/Overlay/ModalManager.js +3 -5
  249. package/cjs/internals/Overlay/Overlay.js +1 -1
  250. package/cjs/internals/Overlay/OverlayTrigger.d.ts +0 -1
  251. package/cjs/internals/Overlay/OverlayTrigger.js +5 -7
  252. package/cjs/internals/Overlay/Position.js +6 -8
  253. package/cjs/internals/Picker/ListCheckItem.js +3 -3
  254. package/cjs/internals/Picker/ListItem.js +1 -1
  255. package/cjs/internals/Picker/Listbox.js +9 -10
  256. package/cjs/internals/Picker/PickerIndicator.js +13 -11
  257. package/cjs/internals/Picker/PickerPopup.js +4 -5
  258. package/cjs/internals/Picker/PickerToggle.js +3 -4
  259. package/cjs/internals/Picker/SelectedElement.js +1 -1
  260. package/cjs/internals/Picker/hooks/useFocusItemValue.d.ts +0 -1
  261. package/cjs/internals/Picker/hooks/useFocusItemValue.js +14 -28
  262. package/cjs/internals/Picker/hooks/usePickerRef.d.ts +0 -1
  263. package/cjs/internals/Picker/hooks/usePickerRef.js +9 -15
  264. package/cjs/internals/Picker/hooks/useSearch.d.ts +0 -1
  265. package/cjs/internals/Picker/hooks/useSearch.js +2 -2
  266. package/cjs/internals/Picker/hooks/useToggleKeyDownEvent.d.ts +0 -1
  267. package/cjs/internals/Picker/hooks/useToggleKeyDownEvent.js +13 -17
  268. package/cjs/internals/Picker/utils.js +9 -9
  269. package/cjs/internals/Ripple/Ripple.js +3 -4
  270. package/cjs/internals/SafeAnchor/SafeAnchor.js +1 -1
  271. package/cjs/internals/ScrollView/hooks/useScrollState.d.ts +0 -1
  272. package/cjs/internals/ScrollView/hooks/useScrollState.js +2 -3
  273. package/cjs/internals/Tree/TreeProvider.d.ts +4 -4
  274. package/cjs/internals/Tree/TreeProvider.js +2 -8
  275. package/cjs/internals/Tree/types.d.ts +0 -1
  276. package/cjs/internals/Tree/utils/getParentMap.d.ts +0 -1
  277. package/cjs/internals/Windowing/AutoSizer.js +2 -3
  278. package/cjs/internals/Windowing/List.js +4 -8
  279. package/cjs/internals/constants/index.d.ts +2 -2
  280. package/cjs/internals/hooks/useClickOutside.js +2 -4
  281. package/cjs/internals/hooks/useCustom.d.ts +0 -1
  282. package/cjs/internals/hooks/useCustom.js +5 -7
  283. package/cjs/internals/hooks/useElementResize.d.ts +0 -1
  284. package/cjs/internals/hooks/useEventCallback.js +1 -2
  285. package/cjs/internals/hooks/useEventListener.js +1 -1
  286. package/cjs/internals/hooks/useFocus.js +2 -4
  287. package/cjs/internals/hooks/useFocusVirtualListItem.d.ts +0 -1
  288. package/cjs/internals/hooks/useMount.js +1 -2
  289. package/cjs/internals/hooks/useRootClose.js +6 -6
  290. package/cjs/internals/hooks/useTimeout.js +1 -2
  291. package/cjs/internals/hooks/useToggleCaret.d.ts +0 -1
  292. package/cjs/internals/hooks/useUniqueId.js +1 -1
  293. package/cjs/internals/hooks/useUpdatedRef.d.ts +0 -1
  294. package/cjs/internals/styled-system/style-manager.js +1 -1
  295. package/cjs/internals/styled-system/useStyled.js +2 -2
  296. package/cjs/internals/types/utils.d.ts +0 -1
  297. package/cjs/internals/utils/colours.d.ts +4 -4
  298. package/cjs/internals/utils/colours.js +1 -1
  299. package/cjs/internals/utils/date/disableTime.js +6 -12
  300. package/cjs/internals/utils/date/omitHideDisabledProps.d.ts +1 -1
  301. package/cjs/internals/utils/date/useDateMode.d.ts +1 -1
  302. package/cjs/internals/utils/react/ReactChildren.js +1 -2
  303. package/cjs/internals/utils/react/deprecateComponent.js +1 -2
  304. package/cjs/internals/utils/react/getDOMNode.js +4 -5
  305. package/cjs/internals/utils/sizes.d.ts +2 -2
  306. package/cjs/internals/utils/style-sheet/css.d.ts +0 -1
  307. package/cjs/internals/utils/style-sheet/css.js +1 -1
  308. package/cjs/internals/utils/style-sheet/prefix.d.ts +0 -1
  309. package/cjs/internals/utils/style-sheet/responsive.d.ts +1 -1
  310. package/cjs/internals/utils/style-sheet/styles.d.ts +3 -3
  311. package/cjs/internals/utils/style-sheet/styles.js +1 -1
  312. package/cjs/toaster/ToastContainer.js +3 -5
  313. package/cjs/toaster/hooks/useDelayedClosure.d.ts +0 -1
  314. package/cjs/toaster/hooks/useDelayedClosure.js +3 -4
  315. package/cjs/toaster/toaster.js +42 -15
  316. package/cjs/useDialog/Dialog.d.ts +1 -1
  317. package/cjs/useDialog/Dialog.js +1 -1
  318. package/cjs/useDialog/useDialog.d.ts +1 -1
  319. package/cjs/useDialog/useDialog.js +3 -3
  320. package/cjs/useFormControl/hooks/useField.d.ts +0 -1
  321. package/cjs/useFormControl/hooks/useField.js +5 -7
  322. package/cjs/useFormControl/hooks/useRegisterModel.js +2 -2
  323. package/cjs/useFormControl/useFormControl.js +8 -8
  324. package/cjs/useToaster/useToaster.js +4 -5
  325. package/dist/rsuite-no-reset.css +14 -0
  326. package/dist/rsuite-no-reset.min.css +1 -1
  327. package/dist/rsuite.css +14 -0
  328. package/dist/rsuite.js +224 -224
  329. package/dist/rsuite.min.css +1 -1
  330. package/dist/rsuite.min.js +1 -1
  331. package/dist/rsuite.min.js.map +1 -1
  332. package/esm/Affix/Affix.js +4 -4
  333. package/esm/Animation/Collapse.js +1 -2
  334. package/esm/Animation/Transition.d.ts +2 -2
  335. package/esm/Animation/Transition.js +17 -20
  336. package/esm/AutoComplete/AutoComplete.d.ts +2 -0
  337. package/esm/AutoComplete/AutoComplete.js +12 -10
  338. package/esm/Avatar/useImage.js +1 -1
  339. package/esm/AvatarGroup/AvatarGroup.d.ts +2 -2
  340. package/esm/Badge/Badge.js +1 -4
  341. package/esm/Breadcrumb/Breadcrumb.js +4 -4
  342. package/esm/Button/Button.js +6 -6
  343. package/esm/Calendar/Calendar.js +5 -5
  344. package/esm/Calendar/CalendarBody.js +1 -1
  345. package/esm/Calendar/CalendarContainer.js +14 -33
  346. package/esm/Calendar/CalendarHeader.js +7 -8
  347. package/esm/Calendar/Grid/GridCell.js +2 -2
  348. package/esm/Calendar/Grid/GridHeaderRow.js +1 -1
  349. package/esm/Calendar/Grid/GridRow.js +5 -6
  350. package/esm/Calendar/MonthDropdown/MonthDropdown.js +1 -1
  351. package/esm/Calendar/MonthDropdown/MonthDropdownItem.js +1 -1
  352. package/esm/Calendar/TimeDropdown/TimeDropdown.js +12 -14
  353. package/esm/Calendar/hooks/useCalendar.d.ts +16 -17
  354. package/esm/Calendar/hooks/useCalendar.js +2 -4
  355. package/esm/Calendar/hooks/useCalendarDate.js +5 -9
  356. package/esm/Calendar/hooks/useCalendarState.js +6 -12
  357. package/esm/Calendar/types.d.ts +0 -1
  358. package/esm/Carousel/Carousel.js +5 -6
  359. package/esm/CascadeTree/CascadeTree.js +6 -16
  360. package/esm/CascadeTree/TreeView.js +5 -7
  361. package/esm/CascadeTree/hooks/useSearch.d.ts +0 -1
  362. package/esm/CascadeTree/hooks/useSearch.js +1 -1
  363. package/esm/CascadeTree/hooks/useSelect.d.ts +0 -1
  364. package/esm/CascadeTree/hooks/useSelect.js +3 -4
  365. package/esm/CascadeTree/types.d.ts +0 -1
  366. package/esm/CascadeTree/utils.js +1 -2
  367. package/esm/Cascader/Cascader.js +18 -29
  368. package/esm/Cascader/useActive.d.ts +0 -1
  369. package/esm/Cascader/useActive.js +4 -6
  370. package/esm/CheckPicker/CheckPicker.js +14 -15
  371. package/esm/CheckTree/CheckTree.js +1 -1
  372. package/esm/CheckTree/CheckTreeNode.js +3 -4
  373. package/esm/CheckTree/CheckTreeView.js +5 -5
  374. package/esm/CheckTree/hooks/useTreeCheckState.js +2 -2
  375. package/esm/CheckTree/utils.js +9 -17
  376. package/esm/CheckTreePicker/CheckTreePicker.js +7 -7
  377. package/esm/CheckTreePicker/hooks/useFocusState.d.ts +0 -1
  378. package/esm/CheckTreePicker/hooks/useFocusState.js +3 -6
  379. package/esm/Checkbox/Checkbox.js +4 -5
  380. package/esm/Checkbox/hooks/useIndeterminateCheckbox.d.ts +0 -1
  381. package/esm/Checkbox/hooks/useIndeterminateCheckbox.js +1 -1
  382. package/esm/CheckboxGroup/CheckboxGroup.js +2 -2
  383. package/esm/DOMHelper/index.d.ts +1 -2
  384. package/esm/DOMHelper/isElement.js +1 -1
  385. package/esm/DateInput/DateField.d.ts +122 -3
  386. package/esm/DateInput/DateField.js +12 -15
  387. package/esm/DateInput/DateInput.js +3 -4
  388. package/esm/DateInput/hooks/useDateInputState.d.ts +124 -4
  389. package/esm/DateInput/hooks/useDateInputState.js +2 -2
  390. package/esm/DateInput/hooks/useIsFocused.js +2 -2
  391. package/esm/DateInput/hooks/useKeyboardInputEvent.d.ts +0 -1
  392. package/esm/DateInput/hooks/useKeyboardInputEvent.js +8 -9
  393. package/esm/DateInput/hooks/useSelectedState.d.ts +0 -1
  394. package/esm/DateInput/utils.d.ts +0 -1
  395. package/esm/DateInput/utils.js +2 -3
  396. package/esm/DatePicker/DatePicker.js +18 -25
  397. package/esm/DatePicker/PredefinedRanges.js +3 -3
  398. package/esm/DatePicker/Toolbar.js +4 -4
  399. package/esm/DatePicker/hooks/useCustomizedInput.d.ts +0 -1
  400. package/esm/DatePicker/hooks/useFocus.js +5 -8
  401. package/esm/DatePicker/hooks/useMonthView.d.ts +0 -1
  402. package/esm/DatePicker/hooks/useMonthView.js +1 -1
  403. package/esm/DatePicker/utils.d.ts +1 -2
  404. package/esm/DatePicker/utils.js +2 -2
  405. package/esm/DateRangeInput/DateRangeInput.js +8 -9
  406. package/esm/DateRangePicker/Calendar.js +2 -2
  407. package/esm/DateRangePicker/DateRangePicker.js +25 -29
  408. package/esm/DateRangePicker/Header.js +3 -3
  409. package/esm/DateRangePicker/disabledDateUtils.js +2 -2
  410. package/esm/DateRangePicker/hooks/useCalendarHandlers.d.ts +0 -1
  411. package/esm/DateRangePicker/hooks/useCalendarHandlers.js +5 -5
  412. package/esm/DateRangePicker/utils.js +1 -2
  413. package/esm/Dropdown/Dropdown.js +3 -3
  414. package/esm/Dropdown/DropdownItem.js +4 -5
  415. package/esm/Dropdown/DropdownMenu.d.ts +1 -1
  416. package/esm/Dropdown/DropdownMenu.js +1 -1
  417. package/esm/Form/Form.d.ts +38 -3
  418. package/esm/Form/Form.js +25 -12
  419. package/esm/Form/hooks/useFormRef.d.ts +0 -1
  420. package/esm/Form/hooks/useFormValidate.d.ts +2 -1
  421. package/esm/Form/hooks/useFormValidate.js +136 -20
  422. package/esm/Form/hooks/useFormValue.d.ts +0 -1
  423. package/esm/Form/index.d.ts +1 -0
  424. package/esm/Form/resolvers.d.ts +59 -0
  425. package/esm/Form/resolvers.js +2 -0
  426. package/esm/FormControl/FormControl.js +5 -5
  427. package/esm/FormGroup/FormGroupContext.d.ts +1 -1
  428. package/esm/Highlight/utils/highlightText.js +1 -1
  429. package/esm/InlineEdit/renderChildren.js +5 -6
  430. package/esm/InlineEdit/useEditState.js +9 -12
  431. package/esm/InlineEdit/useFocusEvent.d.ts +0 -1
  432. package/esm/InlineEdit/useFocusEvent.js +7 -11
  433. package/esm/Input/Input.js +1 -1
  434. package/esm/InputGroup/InputGroupContext.d.ts +2 -1
  435. package/esm/InputNumber/index.d.ts +0 -1
  436. package/esm/InputPicker/InputAutosize.js +1 -1
  437. package/esm/InputPicker/InputPicker.js +30 -35
  438. package/esm/InputPicker/InputSearch.js +1 -2
  439. package/esm/InputPicker/hooks/useData.d.ts +0 -1
  440. package/esm/InputPicker/hooks/useData.js +1 -1
  441. package/esm/InputPicker/hooks/useInput.js +3 -6
  442. package/esm/InputPicker/hooks/useMaxWidth.js +2 -4
  443. package/esm/List/helper/AutoScroller.js +2 -4
  444. package/esm/List/helper/useSortHelper.d.ts +4 -4
  445. package/esm/List/helper/useSortHelper.js +13 -19
  446. package/esm/MaskedInput/TextMask.d.ts +5 -5
  447. package/esm/MaskedInput/TextMask.js +3 -5
  448. package/esm/MaskedInput/conformToMask.d.ts +1 -1
  449. package/esm/MaskedInput/createTextMaskInputElement.js +2 -3
  450. package/esm/Menu/MenuItem.js +3 -4
  451. package/esm/Message/Message.js +1 -1
  452. package/esm/Modal/Modal.js +8 -10
  453. package/esm/Modal/ModalBody.js +1 -1
  454. package/esm/Modal/utils.d.ts +2 -3
  455. package/esm/Modal/utils.js +2 -3
  456. package/esm/MultiCascadeTree/SearchView.js +1 -1
  457. package/esm/MultiCascadeTree/TreeView.js +2 -2
  458. package/esm/MultiCascadeTree/hooks/useCascadeValue.d.ts +0 -1
  459. package/esm/MultiCascadeTree/hooks/useCascadeValue.js +5 -8
  460. package/esm/MultiCascadeTree/hooks/useColumnData.d.ts +0 -1
  461. package/esm/MultiCascadeTree/hooks/useSearch.d.ts +0 -1
  462. package/esm/MultiCascadeTree/hooks/useSearch.js +2 -2
  463. package/esm/MultiCascadeTree/hooks/useSelect.js +3 -4
  464. package/esm/MultiCascadeTree/types.d.ts +0 -1
  465. package/esm/MultiCascadeTree/utils.d.ts +4 -4
  466. package/esm/MultiCascadeTree/utils.js +2 -3
  467. package/esm/MultiCascader/MultiCascader.js +13 -16
  468. package/esm/Nav/AdaptiveNavItem.js +2 -3
  469. package/esm/Nav/Nav.d.ts +1 -1
  470. package/esm/Nav/Nav.js +4 -4
  471. package/esm/Nav/NavDropdown.d.ts +1 -1
  472. package/esm/Nav/NavDropdown.js +3 -3
  473. package/esm/Nav/NavDropdownItem.js +2 -2
  474. package/esm/Nav/NavDropdownMenu.d.ts +1 -1
  475. package/esm/Nav/NavDropdownMenu.js +1 -1
  476. package/esm/Nav/NavItem.js +4 -4
  477. package/esm/Navbar/Navbar.js +1 -1
  478. package/esm/Navbar/NavbarContent.js +1 -1
  479. package/esm/Navbar/NavbarDrawer.js +1 -1
  480. package/esm/Navbar/NavbarDropdown.d.ts +1 -1
  481. package/esm/Navbar/NavbarDropdown.js +3 -3
  482. package/esm/Navbar/NavbarDropdownItem.js +5 -6
  483. package/esm/Navbar/NavbarDropdownMenu.d.ts +1 -1
  484. package/esm/Navbar/NavbarDropdownMenu.js +1 -1
  485. package/esm/Navbar/NavbarItem.js +4 -4
  486. package/esm/Navbar/NavbarToggle.js +2 -2
  487. package/esm/Notification/Notification.js +1 -1
  488. package/esm/NumberInput/NumberInput.js +3 -3
  489. package/esm/NumberInput/hooks/useEvents.d.ts +0 -1
  490. package/esm/NumberInput/hooks/useEvents.js +2 -3
  491. package/esm/NumberInput/hooks/useWheelHandler.js +1 -2
  492. package/esm/Pagination/Pagination.js +1 -1
  493. package/esm/Pagination/PaginationButton.js +1 -1
  494. package/esm/Pagination/PaginationGroup.js +3 -4
  495. package/esm/Panel/Panel.js +2 -2
  496. package/esm/PanelGroup/PanelGroup.js +1 -1
  497. package/esm/PasswordInput/PasswordInput.js +2 -2
  498. package/esm/PinInput/PinInput.js +1 -1
  499. package/esm/PinInput/hooks/usePinInputRefs.d.ts +0 -1
  500. package/esm/PinInput/hooks/usePinInputRefs.js +2 -4
  501. package/esm/PinInput/hooks/usePinValue.d.ts +1 -1
  502. package/esm/PinInput/hooks/usePinValue.js +2 -2
  503. package/esm/Progress/ProgressLine.js +1 -1
  504. package/esm/Progress/types.d.ts +0 -1
  505. package/esm/ProgressCircle/hooks/useProgressCirclePath.d.ts +0 -1
  506. package/esm/Radio/Radio.js +3 -3
  507. package/esm/RadioGroup/RadioGroup.js +1 -1
  508. package/esm/RadioTile/RadioTile.js +2 -2
  509. package/esm/RadioTileGroup/RadioTileGroup.js +1 -1
  510. package/esm/RangeSlider/RangeSlider.js +6 -6
  511. package/esm/Rate/Character.js +2 -2
  512. package/esm/Rate/Rate.js +3 -3
  513. package/esm/Rate/useRatingStates.d.ts +0 -1
  514. package/esm/SegmentedControl/SegmentedControl.js +3 -3
  515. package/esm/SegmentedControl/hooks/useIndicatorPosition.js +1 -1
  516. package/esm/SelectPicker/SelectPicker.js +13 -16
  517. package/esm/Sidebar/Sidebar.js +1 -1
  518. package/esm/Sidenav/ExpandedSidenavDropdown.js +6 -6
  519. package/esm/Sidenav/ExpandedSidenavDropdownItem.js +4 -5
  520. package/esm/Sidenav/Node.js +9 -16
  521. package/esm/Sidenav/Sidenav.js +2 -2
  522. package/esm/Sidenav/SidenavDropdown.d.ts +1 -1
  523. package/esm/Sidenav/SidenavDropdown.js +4 -4
  524. package/esm/Sidenav/SidenavDropdownItem.js +3 -4
  525. package/esm/Sidenav/SidenavItem.js +5 -6
  526. package/esm/Sidenav/SidenavToggle.js +2 -2
  527. package/esm/Slider/Slider.js +3 -3
  528. package/esm/Slider/useDrag.d.ts +0 -1
  529. package/esm/Slider/useDrag.js +7 -12
  530. package/esm/Slider/utils.d.ts +1 -2
  531. package/esm/Slider/utils.js +2 -3
  532. package/esm/Steps/StepItem.js +1 -2
  533. package/esm/Table/Table.d.ts +3 -3
  534. package/esm/Tabs/Tabs.js +3 -4
  535. package/esm/TimePicker/TimePicker.js +2 -2
  536. package/esm/Timeline/Timeline.d.ts +6 -1
  537. package/esm/Timeline/Timeline.js +14 -10
  538. package/esm/Toggle/Toggle.js +2 -2
  539. package/esm/Tree/Tree.js +2 -2
  540. package/esm/Tree/TreeNode.js +10 -11
  541. package/esm/Tree/TreeView.js +5 -5
  542. package/esm/Tree/hooks/useExpandTree.js +1 -1
  543. package/esm/Tree/hooks/useFlattenTree.js +6 -9
  544. package/esm/Tree/hooks/useFocusTree.d.ts +1 -2
  545. package/esm/Tree/hooks/useFocusTree.js +12 -14
  546. package/esm/Tree/hooks/useTreeDrag.d.ts +0 -1
  547. package/esm/Tree/hooks/useTreeDrag.js +10 -12
  548. package/esm/Tree/hooks/useTreeNodeProps.js +1 -1
  549. package/esm/Tree/hooks/useTreeSearch.js +4 -4
  550. package/esm/Tree/hooks/useVirtualizedTreeData.js +2 -2
  551. package/esm/Tree/types.d.ts +2 -3
  552. package/esm/Tree/utils/flattenTree.d.ts +1 -1
  553. package/esm/Tree/utils/focusableTree.js +5 -8
  554. package/esm/Tree/utils/getNodeParentKeys.js +2 -4
  555. package/esm/Tree/utils/hasVisibleChildren.d.ts +1 -1
  556. package/esm/Tree/utils/treeKeyboardInteractions.js +3 -3
  557. package/esm/TreePicker/TreePicker.js +8 -9
  558. package/esm/TreePicker/hooks/useFocusState.d.ts +0 -1
  559. package/esm/TreePicker/hooks/useFocusState.js +4 -8
  560. package/esm/Uploader/UploadFileItem.js +8 -10
  561. package/esm/Uploader/UploadTrigger.js +8 -10
  562. package/esm/Uploader/Uploader.d.ts +2 -0
  563. package/esm/Uploader/Uploader.js +66 -26
  564. package/esm/Uploader/utils/ajaxUpload.js +5 -5
  565. package/esm/Uploader/utils/previewFile.js +1 -1
  566. package/esm/internals/Disclosure/Disclosure.js +5 -8
  567. package/esm/internals/Disclosure/DisclosureButton.js +2 -2
  568. package/esm/internals/InputBase/InputBase.js +5 -6
  569. package/esm/internals/Menu/Menu.js +16 -20
  570. package/esm/internals/Menu/MenuItem.js +4 -5
  571. package/esm/internals/Menu/Menubar.js +5 -7
  572. package/esm/internals/Menu/useMenu.js +5 -10
  573. package/esm/internals/Overlay/Modal.js +8 -11
  574. package/esm/internals/Overlay/ModalManager.js +3 -5
  575. package/esm/internals/Overlay/Overlay.js +1 -1
  576. package/esm/internals/Overlay/OverlayTrigger.d.ts +0 -1
  577. package/esm/internals/Overlay/OverlayTrigger.js +5 -7
  578. package/esm/internals/Overlay/Position.js +6 -8
  579. package/esm/internals/Picker/ListCheckItem.js +3 -3
  580. package/esm/internals/Picker/ListItem.js +1 -1
  581. package/esm/internals/Picker/Listbox.js +9 -10
  582. package/esm/internals/Picker/PickerIndicator.js +13 -11
  583. package/esm/internals/Picker/PickerPopup.js +4 -5
  584. package/esm/internals/Picker/PickerToggle.js +3 -4
  585. package/esm/internals/Picker/SelectedElement.js +1 -1
  586. package/esm/internals/Picker/hooks/useFocusItemValue.d.ts +0 -1
  587. package/esm/internals/Picker/hooks/useFocusItemValue.js +14 -28
  588. package/esm/internals/Picker/hooks/usePickerRef.d.ts +0 -1
  589. package/esm/internals/Picker/hooks/usePickerRef.js +9 -15
  590. package/esm/internals/Picker/hooks/useSearch.d.ts +0 -1
  591. package/esm/internals/Picker/hooks/useSearch.js +2 -2
  592. package/esm/internals/Picker/hooks/useToggleKeyDownEvent.d.ts +0 -1
  593. package/esm/internals/Picker/hooks/useToggleKeyDownEvent.js +13 -17
  594. package/esm/internals/Picker/utils.js +9 -9
  595. package/esm/internals/Ripple/Ripple.js +3 -4
  596. package/esm/internals/SafeAnchor/SafeAnchor.js +1 -1
  597. package/esm/internals/ScrollView/hooks/useScrollState.d.ts +0 -1
  598. package/esm/internals/ScrollView/hooks/useScrollState.js +2 -3
  599. package/esm/internals/Tree/TreeProvider.d.ts +4 -4
  600. package/esm/internals/Tree/TreeProvider.js +2 -8
  601. package/esm/internals/Tree/types.d.ts +0 -1
  602. package/esm/internals/Tree/utils/getParentMap.d.ts +0 -1
  603. package/esm/internals/Windowing/AutoSizer.js +2 -3
  604. package/esm/internals/Windowing/List.js +4 -8
  605. package/esm/internals/constants/index.d.ts +2 -2
  606. package/esm/internals/hooks/useClickOutside.js +2 -4
  607. package/esm/internals/hooks/useCustom.d.ts +0 -1
  608. package/esm/internals/hooks/useCustom.js +5 -7
  609. package/esm/internals/hooks/useElementResize.d.ts +0 -1
  610. package/esm/internals/hooks/useEventCallback.js +1 -2
  611. package/esm/internals/hooks/useEventListener.js +1 -1
  612. package/esm/internals/hooks/useFocus.js +2 -4
  613. package/esm/internals/hooks/useFocusVirtualListItem.d.ts +0 -1
  614. package/esm/internals/hooks/useMount.js +1 -2
  615. package/esm/internals/hooks/useRootClose.js +6 -6
  616. package/esm/internals/hooks/useTimeout.js +1 -2
  617. package/esm/internals/hooks/useToggleCaret.d.ts +0 -1
  618. package/esm/internals/hooks/useUniqueId.js +1 -1
  619. package/esm/internals/hooks/useUpdatedRef.d.ts +0 -1
  620. package/esm/internals/styled-system/style-manager.js +1 -1
  621. package/esm/internals/styled-system/useStyled.js +2 -2
  622. package/esm/internals/types/utils.d.ts +0 -1
  623. package/esm/internals/utils/colours.d.ts +4 -4
  624. package/esm/internals/utils/colours.js +1 -1
  625. package/esm/internals/utils/date/disableTime.js +6 -12
  626. package/esm/internals/utils/date/omitHideDisabledProps.d.ts +1 -1
  627. package/esm/internals/utils/date/useDateMode.d.ts +1 -1
  628. package/esm/internals/utils/react/ReactChildren.js +1 -2
  629. package/esm/internals/utils/react/deprecateComponent.js +1 -2
  630. package/esm/internals/utils/react/getDOMNode.js +4 -5
  631. package/esm/internals/utils/sizes.d.ts +2 -2
  632. package/esm/internals/utils/style-sheet/css.d.ts +0 -1
  633. package/esm/internals/utils/style-sheet/css.js +1 -1
  634. package/esm/internals/utils/style-sheet/prefix.d.ts +0 -1
  635. package/esm/internals/utils/style-sheet/responsive.d.ts +1 -1
  636. package/esm/internals/utils/style-sheet/styles.d.ts +3 -3
  637. package/esm/internals/utils/style-sheet/styles.js +1 -1
  638. package/esm/toaster/ToastContainer.js +3 -5
  639. package/esm/toaster/hooks/useDelayedClosure.d.ts +0 -1
  640. package/esm/toaster/hooks/useDelayedClosure.js +3 -4
  641. package/esm/toaster/toaster.js +42 -15
  642. package/esm/useDialog/Dialog.d.ts +1 -1
  643. package/esm/useDialog/Dialog.js +1 -1
  644. package/esm/useDialog/useDialog.d.ts +1 -1
  645. package/esm/useDialog/useDialog.js +3 -3
  646. package/esm/useFormControl/hooks/useField.d.ts +0 -1
  647. package/esm/useFormControl/hooks/useField.js +5 -7
  648. package/esm/useFormControl/hooks/useRegisterModel.js +2 -2
  649. package/esm/useFormControl/useFormControl.js +8 -8
  650. package/esm/useToaster/useToaster.js +4 -5
  651. package/package.json +1 -1
@@ -44,7 +44,6 @@ function getComponentLocaleKey(componentName) {
44
44
  * @param componentProps - The props of the component
45
45
  */
46
46
  function useCustom(componentName, componentProps) {
47
- var _globalLocale$DateTim;
48
47
  const {
49
48
  components = {},
50
49
  locale: globalLocale = _en_GB.default,
@@ -59,26 +58,25 @@ function useCustom(componentName, componentProps) {
59
58
  locale: componentLocale,
60
59
  ...restProps
61
60
  } = componentProps || {};
62
- const dateLocale = globalLocale === null || globalLocale === void 0 || (_globalLocale$DateTim = globalLocale.DateTimeFormats) === null || _globalLocale$DateTim === void 0 ? void 0 : _globalLocale$DateTim.dateLocale;
63
- const code = globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale.code;
61
+ const dateLocale = globalLocale?.DateTimeFormats?.dateLocale;
62
+ const code = globalLocale?.code;
64
63
  const getLocale = (0, _react.useCallback)((key, overrideLocale) => {
65
64
  // Initialize with common locale
66
- const publicLocale = (globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale.common) || {};
65
+ const publicLocale = globalLocale?.common || {};
67
66
 
68
67
  // Merge component-specific locale(s) based on key type
69
- const specificLocale = typeof key === 'string' ? globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale[key] : Array.isArray(key) ? (0, _assign.default)({}, ...key.map(k => globalLocale === null || globalLocale === void 0 ? void 0 : globalLocale[k])) : {};
68
+ const specificLocale = typeof key === 'string' ? globalLocale?.[key] : Array.isArray(key) ? (0, _assign.default)({}, ...key.map(k => globalLocale?.[k])) : {};
70
69
 
71
70
  // Merge all parts: public locale, specific locale, custom component locale
72
71
  return (0, _assign.default)({}, publicLocale, specificLocale, componentLocale, overrideLocale);
73
72
  }, [globalLocale, componentLocale]);
74
73
  const propsWithDefaults = (0, _react.useMemo)(() => {
75
- var _components$component;
76
74
  if (!componentName) {
77
75
  return;
78
76
  }
79
77
 
80
78
  //Memoize the global default props based on component name
81
- const globalDefaultProps = ((_components$component = components[componentName]) === null || _components$component === void 0 ? void 0 : _components$component.defaultProps) || {};
79
+ const globalDefaultProps = components[componentName]?.defaultProps || {};
82
80
  const mergedProps = (0, _assign.default)({}, globalDefaultProps, restProps);
83
81
  const localeKey = getComponentLocaleKey(componentName);
84
82
 
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Attach the event handler directly to the specified DOM element,
4
3
  * and it will be triggered when the size of the DOM element is changed.
@@ -22,8 +22,7 @@ function useEventCallback(fn) {
22
22
  ref.current = fn;
23
23
  });
24
24
  return (0, _react.useCallback)((...args) => {
25
- var _ref$current;
26
- return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.call(ref, ...args);
25
+ return ref.current?.(...args);
27
26
  }, []);
28
27
  }
29
28
  var _default = exports.default = useEventCallback;
@@ -20,7 +20,7 @@ function useEventListener(eventTarget, event, listener, capture = false) {
20
20
  const target = typeof eventTarget === 'function' ? eventTarget() : eventTarget;
21
21
  const controller = target ? (0, _on.default)(target, event, listener, capture) : null;
22
22
  return () => {
23
- controller === null || controller === void 0 || controller.off();
23
+ controller?.off();
24
24
  };
25
25
  }, [eventTarget, event, listener, capture]);
26
26
  }
@@ -14,9 +14,8 @@ function useFocus(elementRef) {
14
14
  const grab = (0, _react.useCallback)(() => {
15
15
  requestAnimationFrame(() => {
16
16
  if (document.activeElement !== elementRef.current) {
17
- var _elementRef$current;
18
17
  previousActiveElementRef.current = document.activeElement;
19
- (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.focus();
18
+ elementRef.current?.focus();
20
19
  }
21
20
  });
22
21
  }, [elementRef]);
@@ -24,8 +23,7 @@ function useFocus(elementRef) {
24
23
  // Return focus to previous active element
25
24
  const release = (0, _react.useCallback)(options => {
26
25
  requestAnimationFrame(() => {
27
- var _previousActiveElemen;
28
- (_previousActiveElemen = previousActiveElementRef.current) === null || _previousActiveElemen === void 0 || _previousActiveElemen.focus(options);
26
+ previousActiveElementRef.current?.focus(options);
29
27
  });
30
28
  }, []);
31
29
  return {
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Ensures that a virtualized list item retains focus after scrolling or clicking on options,
4
3
  * preventing unnecessary re-renders and loss of focus. If the current focus is on an interactive
@@ -8,8 +8,7 @@ const useMount = callback => {
8
8
  const mountRef = (0, _react.useRef)(callback);
9
9
  mountRef.current = callback;
10
10
  (0, _react.useEffect)(() => {
11
- var _mountRef$current;
12
- (_mountRef$current = mountRef.current) === null || _mountRef$current === void 0 || _mountRef$current.call(mountRef);
11
+ mountRef.current?.();
13
12
  }, []);
14
13
  };
15
14
  exports.useMount = useMount;
@@ -12,10 +12,10 @@ var _on = _interopRequireDefault(require("dom-lib/on"));
12
12
  var _utils = require("../utils");
13
13
  var _constants = require("../constants");
14
14
  function isLeftClickEvent(event) {
15
- return (event === null || event === void 0 ? void 0 : event.button) === 0;
15
+ return event?.button === 0;
16
16
  }
17
17
  function isModifiedEvent(event) {
18
- return !!(event.metaKey || event.altKey || event.ctrlKey || event !== null && event !== void 0 && event.shiftKey);
18
+ return !!(event.metaKey || event.altKey || event.ctrlKey || event?.shiftKey);
19
19
  }
20
20
  /**
21
21
  * A hook that listens to the document click event and closes the overlay.
@@ -31,7 +31,7 @@ function useRootClose(onRootClose, {
31
31
  }) {
32
32
  const handleDocumentKeyUp = (0, _react.useCallback)(event => {
33
33
  if (listenEscape && event.key === _constants.KEY_VALUES.ESC) {
34
- onRootClose === null || onRootClose === void 0 || onRootClose(event);
34
+ onRootClose?.(event);
35
35
  }
36
36
  }, [listenEscape, onRootClose]);
37
37
  const handleDocumentMouseDown = (0, _react.useCallback)(event => {
@@ -50,7 +50,7 @@ function useRootClose(onRootClose, {
50
50
  if (isModifiedEvent(event) || !isLeftClickEvent(event)) {
51
51
  return;
52
52
  }
53
- onRootClose === null || onRootClose === void 0 || onRootClose(event);
53
+ onRootClose?.(event);
54
54
  }, [onRootClose, triggerTarget, overlayTarget]);
55
55
  (0, _react.useEffect)(() => {
56
56
  const currentTarget = (0, _utils.getDOMNode)(triggerTarget);
@@ -59,8 +59,8 @@ function useRootClose(onRootClose, {
59
59
  const onDocumentMouseDownListener = (0, _on.default)(doc, 'mousedown', handleDocumentMouseDown, true);
60
60
  const onDocumentKeyupListener = (0, _on.default)(doc, 'keyup', handleDocumentKeyUp);
61
61
  return () => {
62
- onDocumentMouseDownListener === null || onDocumentMouseDownListener === void 0 || onDocumentMouseDownListener.off();
63
- onDocumentKeyupListener === null || onDocumentKeyupListener === void 0 || onDocumentKeyupListener.off();
62
+ onDocumentMouseDownListener?.off();
63
+ onDocumentKeyupListener?.off();
64
64
  };
65
65
  }, [triggerTarget, disabled, onRootClose, handleDocumentMouseDown, handleDocumentKeyUp]);
66
66
  }
@@ -21,8 +21,7 @@ function useTimeout(fn, ms = 0, enabled = true) {
21
21
  timeout.current && clearTimeout(timeout.current);
22
22
  if (enabled) {
23
23
  timeout.current = setTimeout(() => {
24
- var _callback$current;
25
- (_callback$current = callback.current) === null || _callback$current === void 0 || _callback$current.call(callback);
24
+ callback.current?.();
26
25
  }, ms);
27
26
  }
28
27
  }, [ms, enabled]);
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { PlacementCorners, Placement } from '../types';
3
2
  export declare function useToggleCaret(placement: PlacementCorners | Placement): import("react").ForwardRefExoticComponent<Omit<import("@rsuite/icons/esm/Icon").IconProps, "ref"> & import("react").RefAttributes<SVGElement>>;
4
3
  export default useToggleCaret;
@@ -12,6 +12,6 @@ var _react = require("react");
12
12
  */
13
13
  function useUniqueId(prefix, idProp) {
14
14
  const generatedId = (0, _react.useId)();
15
- return idProp !== null && idProp !== void 0 ? idProp : `${prefix}${generatedId}`;
15
+ return idProp ?? `${prefix}${generatedId}`;
16
16
  }
17
17
  var _default = exports.default = useUniqueId;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Returns a ref that is immediately updated with the new value
4
3
  *
@@ -28,7 +28,7 @@ const StyleManager = exports.StyleManager = {
28
28
  this.styleElement.setAttribute('data-rs-style-manager', '');
29
29
 
30
30
  // Apply CSP nonce if provided
31
- const nonce = (options === null || options === void 0 ? void 0 : options.nonce) || this.nonce;
31
+ const nonce = options?.nonce || this.nonce;
32
32
  if (nonce) {
33
33
  this.styleElement.setAttribute('nonce', nonce);
34
34
  this.nonce = nonce; // Store for future use
@@ -103,7 +103,7 @@ function useStyled(options) {
103
103
 
104
104
  // Add the base rule to the style manager
105
105
  _styleManager.StyleManager.addRule(`.${componentId}`, baseCssRules, {
106
- nonce: csp === null || csp === void 0 ? void 0 : csp.nonce
106
+ nonce: csp?.nonce
107
107
  });
108
108
 
109
109
  // Process responsive variables
@@ -168,7 +168,7 @@ function useStyled(options) {
168
168
  const bp = breakpoint;
169
169
  const minWidth = _responsive.breakpointValues[bp];
170
170
  _styleManager.StyleManager.addRule(`@media (min-width: ${minWidth}px)`, `.${componentId} { ${rules} }`, {
171
- nonce: csp === null || csp === void 0 ? void 0 : csp.nonce
171
+ nonce: csp?.nonce
172
172
  });
173
173
  }
174
174
  });
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type Partial<T> = {
3
2
  [P in keyof T]?: T[P];
4
3
  };
@@ -6,9 +6,9 @@ import { Color } from '../types/colours';
6
6
  * @returns The CSS variable if it's a valid color type, or the original value
7
7
  */
8
8
  export declare const getColorValue: (color: Color | string | undefined) => string | undefined;
9
- export declare const isPresetColor: (color?: Color | React.CSSProperties['color']) => boolean;
10
- export declare const getColorStyle: (value?: import("csstype").Property.Color | undefined, name?: string | undefined, prop?: string) => {
11
- [x: string]: string | (string & {}) | undefined;
9
+ export declare const isPresetColor: (color?: Color | React.CSSProperties["color"]) => boolean;
10
+ export declare const getColorStyle: (value?: import("csstype").Property.Color | undefined, name?: string, prop?: string) => {
11
+ [x: string]: string | undefined;
12
12
  } | undefined;
13
13
  /**
14
14
  * Convert short hex color to full hex color
@@ -28,4 +28,4 @@ export declare const getContrastText: (bgColor: string) => string;
28
28
  * Create CSS color variables for custom colors
29
29
  * Returns background and optional text color variables
30
30
  */
31
- export declare const createColorVariables: (color?: Color | React.CSSProperties['color'], bgFieldName?: string, textFieldName?: string) => React.CSSProperties | undefined;
31
+ export declare const createColorVariables: (color?: Color | React.CSSProperties["color"], bgFieldName?: string, textFieldName?: string) => React.CSSProperties | undefined;
@@ -22,7 +22,7 @@ const getColorValue = color => {
22
22
 
23
23
  // Check if color is a color with shade (e.g., 'red.50', 'gray.900')
24
24
  const colorWithShadeRegex = /^(red|orange|yellow|green|cyan|blue|violet|gray)\.([1-9]00|50)$/;
25
- const match = color === null || color === void 0 ? void 0 : color.match(colorWithShadeRegex);
25
+ const match = color?.match(colorWithShadeRegex);
26
26
  if (match) {
27
27
  const [, colorName, shade] = match;
28
28
  return `var(--rs-${colorName}-${shade})`;
@@ -34,16 +34,13 @@ function disableTime(props, date) {
34
34
  const mapProps = new Map(Object.entries(calendarProps));
35
35
  return Array.from(mapProps.keys()).some(key => {
36
36
  if (HOURS_PATTERN.test(key)) {
37
- var _mapProps$get;
38
- return (_mapProps$get = mapProps.get(key)) === null || _mapProps$get === void 0 ? void 0 : _mapProps$get((0, _getHours.getHours)(date), date);
37
+ return mapProps.get(key)?.((0, _getHours.getHours)(date), date);
39
38
  }
40
39
  if (MINUTES_PATTERN.test(key)) {
41
- var _mapProps$get2;
42
- return (_mapProps$get2 = mapProps.get(key)) === null || _mapProps$get2 === void 0 ? void 0 : _mapProps$get2((0, _getMinutes.getMinutes)(date), date);
40
+ return mapProps.get(key)?.((0, _getMinutes.getMinutes)(date), date);
43
41
  }
44
42
  if (SECONDS_PATTERN.test(key)) {
45
- var _mapProps$get3;
46
- return (_mapProps$get3 = mapProps.get(key)) === null || _mapProps$get3 === void 0 ? void 0 : _mapProps$get3((0, _getSeconds.getSeconds)(date), date);
43
+ return mapProps.get(key)?.((0, _getSeconds.getSeconds)(date), date);
47
44
  }
48
45
  return false;
49
46
  });
@@ -59,16 +56,13 @@ function useIsDateTimeDisabled(timeDropdownProps) {
59
56
  const date = (0, _pick.default)(dateTime, ['year', 'month', 'day']);
60
57
  return Array.from(mapProps.keys()).some(key => {
61
58
  if (HOURS_PATTERN.test(key)) {
62
- var _mapProps$get4;
63
- return (_mapProps$get4 = mapProps.get(key)) === null || _mapProps$get4 === void 0 ? void 0 : _mapProps$get4(dateTime.hour, date);
59
+ return mapProps.get(key)?.(dateTime.hour, date);
64
60
  }
65
61
  if (MINUTES_PATTERN.test(key)) {
66
- var _mapProps$get5;
67
- return (_mapProps$get5 = mapProps.get(key)) === null || _mapProps$get5 === void 0 ? void 0 : _mapProps$get5(dateTime.minute, date);
62
+ return mapProps.get(key)?.(dateTime.minute, date);
68
63
  }
69
64
  if (SECONDS_PATTERN.test(key)) {
70
- var _mapProps$get6;
71
- return (_mapProps$get6 = mapProps.get(key)) === null || _mapProps$get6 === void 0 ? void 0 : _mapProps$get6(dateTime.second, date);
65
+ return mapProps.get(key)?.(dateTime.second, date);
72
66
  }
73
67
  return false;
74
68
  });
@@ -6,5 +6,5 @@ type CalendarOnlyPropsType = TimeProp;
6
6
  * @param props - The object to omit props from.
7
7
  * @returns The object with calendar-only props omitted.
8
8
  */
9
- export declare const omitHideDisabledProps: <T extends Record<string, any>>(props: T) => Partial<Omit<T, TimeProp>>;
9
+ export declare const omitHideDisabledProps: <T extends Record<string, any>>(props: T) => Partial<Omit<T, CalendarOnlyPropsType>>;
10
10
  export default omitHideDisabledProps;
@@ -12,5 +12,5 @@ export declare enum DateMode {
12
12
  */
13
13
  export declare const useDateMode: (format: string) => {
14
14
  mode: DateMode;
15
- has: (part: 'year' | 'month' | 'day' | 'time') => boolean;
15
+ has: (part: "year" | "month" | "day" | "time") => boolean;
16
16
  };
@@ -20,8 +20,7 @@ var _ReactIs = require("./ReactIs");
20
20
  function flatChildren(children) {
21
21
  return _react.default.Children.toArray(_react.default.Children.map(children, child => {
22
22
  if ((0, _ReactIs.isFragment)(child)) {
23
- var _child$props;
24
- return _react.default.Children.toArray(((_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.children) || []);
23
+ return _react.default.Children.toArray(child.props?.children || []);
25
24
  }
26
25
  return child;
27
26
  }));
@@ -13,8 +13,7 @@ var _warnOnce = _interopRequireDefault(require("../warnOnce"));
13
13
  * fixme: Only display deprecation message in non-production environment
14
14
  */
15
15
  function deprecateComponent(Component, message) {
16
- var _Component$displayNam;
17
- const componentDisplayName = (_Component$displayNam = Component.displayName) !== null && _Component$displayNam !== void 0 ? _Component$displayNam : Component.name;
16
+ const componentDisplayName = Component.displayName ?? Component.name;
18
17
  const Deprecated = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
19
18
  (0, _warnOnce.default)(message);
20
19
  return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
@@ -6,21 +6,20 @@ exports.default = void 0;
6
6
  exports.getDOMNode = getDOMNode;
7
7
  function safeFindDOMNode(componentOrElement) {
8
8
  if (componentOrElement && 'setState' in componentOrElement) {
9
- var _ref$current, _ref;
10
9
  // Access the underlying DOM node through ref if available
11
- return (_ref$current = componentOrElement === null || componentOrElement === void 0 || (_ref = componentOrElement.ref) === null || _ref === void 0 ? void 0 : _ref.current) !== null && _ref$current !== void 0 ? _ref$current : null;
10
+ return componentOrElement?.ref?.current ?? null;
12
11
  }
13
- return componentOrElement !== null && componentOrElement !== void 0 ? componentOrElement : null;
12
+ return componentOrElement ?? null;
14
13
  }
15
14
  const getRefTarget = ref => {
16
15
  return ref && ('current' in ref ? ref.current : ref);
17
16
  };
18
17
  function getDOMNode(elementOrRef) {
19
18
  // If elementOrRef is an instance of Position, child is returned. [PositionInstance]
20
- const element = (elementOrRef === null || elementOrRef === void 0 ? void 0 : elementOrRef.root) || (elementOrRef === null || elementOrRef === void 0 ? void 0 : elementOrRef.child) || getRefTarget(elementOrRef);
19
+ const element = elementOrRef?.root || elementOrRef?.child || getRefTarget(elementOrRef);
21
20
 
22
21
  // Native HTML elements
23
- if (element !== null && element !== void 0 && element.nodeType && typeof (element === null || element === void 0 ? void 0 : element.nodeName) === 'string') {
22
+ if (element?.nodeType && typeof element?.nodeName === 'string') {
24
23
  return element;
25
24
  }
26
25
  return safeFindDOMNode(element);
@@ -1,9 +1,9 @@
1
1
  import { SizeEnum } from '../types';
2
2
  export declare const isPresetSize: (size?: SizeEnum | number | string | null) => boolean;
3
3
  export declare const getSizeValue: (type: string, size: SizeEnum | number | string | null) => string | undefined;
4
- export declare const getSizeStyle: (value?: string | number | undefined, name?: string | undefined, prop?: string) => {
4
+ export declare const getSizeStyle: (value?: string | number | undefined, name?: string, prop?: string) => {
5
5
  [x: string]: string | number | undefined;
6
6
  } | undefined;
7
- export declare const getLineHeightStyle: (value?: string | number | undefined, name?: string | undefined, prop?: string) => {
7
+ export declare const getLineHeightStyle: (value?: string | number | undefined, name?: string, prop?: string) => {
8
8
  [x: string]: string | number | undefined;
9
9
  } | undefined;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { StyleProperties } from '../../types';
3
2
  /**
4
3
  * Processes and returns a value suitable for CSS (with a unit).
@@ -36,7 +36,7 @@ function getCssValue(value, unit = 'px') {
36
36
  * Merge multiple style objects, filtering out undefined values
37
37
  */
38
38
  function mergeStyles(...styles) {
39
- const mergedStyles = styles === null || styles === void 0 ? void 0 : styles.filter(Boolean).reduce((acc, style) => {
39
+ const mergedStyles = styles?.filter(Boolean).reduce((acc, style) => {
40
40
  if (!style) return acc;
41
41
  return {
42
42
  ...acc,
@@ -1,4 +1,3 @@
1
- /// <reference types="lodash" />
2
1
  export declare const globalKey = "rs-";
3
2
  export declare const getClassNamePrefix: () => string;
4
3
  export declare const defaultClassPrefix: (name: string) => string;
@@ -14,4 +14,4 @@ import type { ResponsiveValue } from '../../types';
14
14
  * // Returns: ['rs-row-xs-top', 'rs-row-md-bottom']
15
15
  *
16
16
  */
17
- export declare const getResponsiveClasses: <T = string>(prefix: (...classes: any[]) => string, value?: T | ResponsiveValue<T> | undefined) => string[];
17
+ export declare const getResponsiveClasses: <T = string>(prefix: (...classes: any[]) => string, value?: T | ResponsiveValue<T>) => string[];
@@ -9,8 +9,8 @@ interface StylePropConfig<T = StyleValue> {
9
9
  presetChecker?: PresetChecker<T>;
10
10
  valueTransformer?: ValueTransformer<T>;
11
11
  }
12
- export declare const createStyleValueSetter: <T = string | number>(config: StylePropConfig<T>) => (value?: T | undefined, name?: string, prop?: string) => string | T | undefined;
13
- export declare const createStyleGetter: <T = string | number>(config: StylePropConfig<T>) => (value?: T | undefined, name?: string, prop?: string) => {
14
- [x: string]: string | T | undefined;
12
+ export declare const createStyleValueSetter: <T = string | number>(config: StylePropConfig<T>) => (value?: T, name?: string, prop?: string) => string | (T & ({} | null)) | undefined;
13
+ export declare const createStyleGetter: <T = string | number>(config: StylePropConfig<T>) => (value?: T, name?: string, prop?: string) => {
14
+ [x: string]: string | (T & ({} | null)) | undefined;
15
15
  } | undefined;
16
16
  export {};
@@ -13,7 +13,7 @@ const createStyleValueSetter = config => {
13
13
  if (typeof value === 'undefined' || !name) {
14
14
  return;
15
15
  }
16
- if (presetChecker !== null && presetChecker !== void 0 && presetChecker(value)) {
16
+ if (presetChecker?.(value)) {
17
17
  return useGlobalVar ? `var(--rs-${prop}-${value})` : `var(--rs-${name}-${prop}-${value})`;
18
18
  } else if (Array.isArray(value)) {
19
19
  // If value is an array, join it with spaces,
@@ -124,7 +124,6 @@ const ToastContainer = /*#__PURE__*/(0, _react.forwardRef)(function ToastContain
124
124
  enteredClassName: rootPrefix('toast-fade-entered'),
125
125
  timeout: 300
126
126
  }, (transitionProps, ref) => {
127
- var _node$props, _node$props2;
128
127
  const {
129
128
  className: transitionClassName,
130
129
  ...rest
@@ -133,8 +132,8 @@ const ToastContainer = /*#__PURE__*/(0, _react.forwardRef)(function ToastContain
133
132
  ...rest,
134
133
  ref,
135
134
  duration,
136
- onClose: (0, _utils.createChainedFunction)((_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.onClose, () => remove(item.key)),
137
- className: merge(rootPrefix('toast'), (_node$props2 = node.props) === null || _node$props2 === void 0 ? void 0 : _node$props2.className, transitionClassName)
135
+ onClose: (0, _utils.createChainedFunction)(node.props?.onClose, () => remove(item.key)),
136
+ className: merge(rootPrefix('toast'), node.props?.className, transitionClassName)
138
137
  });
139
138
  }));
140
139
  });
@@ -160,9 +159,8 @@ ToastContainer.getInstance = async props => {
160
159
  // Render the ToastContainer component into the specified container
161
160
  const containerId = (0, _render.render)(/*#__PURE__*/_react.default.createElement(ToastContainer, (0, _extends2.default)({}, toastProps, {
162
161
  ref: ref => {
163
- var _resolveContainerRef;
164
162
  toastContainerRef.current = ref;
165
- (_resolveContainerRef = resolveContainerRef) === null || _resolveContainerRef === void 0 || _resolveContainerRef();
163
+ resolveContainerRef?.();
166
164
  }
167
165
  })), container);
168
166
  await containerRefReady;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface UseDelayedClosureProps {
3
2
  /**
4
3
  * Callback function to be called when the closure is triggered.
@@ -29,16 +29,15 @@ function useDelayedClosure(props) {
29
29
  reset
30
30
  } = (0, _hooks.useTimeout)(onClose, duration, usedToaster && duration > 0);
31
31
  (0, _hooks.useMount)(() => {
32
- if (targetRef !== null && targetRef !== void 0 && targetRef.current && mouseReset) {
32
+ if (targetRef?.current && mouseReset) {
33
33
  if (mouseEnterRef.current || mouseLeaveRef.current) {
34
34
  return;
35
35
  }
36
36
  mouseEnterRef.current = (0, _on.default)(targetRef.current, 'mouseenter', clear);
37
37
  mouseLeaveRef.current = (0, _on.default)(targetRef.current, 'mouseleave', reset);
38
38
  return () => {
39
- var _mouseEnterRef$curren, _mouseLeaveRef$curren;
40
- (_mouseEnterRef$curren = mouseEnterRef.current) === null || _mouseEnterRef$curren === void 0 || _mouseEnterRef$curren.off();
41
- (_mouseLeaveRef$curren = mouseLeaveRef.current) === null || _mouseLeaveRef$curren === void 0 || _mouseLeaveRef$curren.off();
39
+ mouseEnterRef.current?.off();
40
+ mouseLeaveRef.current?.off();
42
41
  };
43
42
  }
44
43
  });
@@ -5,9 +5,17 @@ exports.__esModule = true;
5
5
  exports.default = void 0;
6
6
  var _ToastContainer = _interopRequireWildcard(require("./ToastContainer"));
7
7
  var _symbols = require("../internals/symbols");
8
+ var _utils = require("../internals/utils");
8
9
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
10
  const containers = new Map();
10
11
 
12
+ /**
13
+ * Track in-progress container creation promises keyed by `${containerId}_${placement}`.
14
+ * This prevents duplicate containers from being created when `push` is called multiple
15
+ * times synchronously (e.g. inside a loop) before the first container has mounted.
16
+ */
17
+ const pendingContainerPromises = new Map();
18
+
11
19
  /**
12
20
  * Create a container instance.
13
21
  * @param placement
@@ -15,7 +23,9 @@ const containers = new Map();
15
23
  */
16
24
  async function createContainer(placement, props) {
17
25
  const [container, containerId] = await _ToastContainer.default.getInstance(props);
18
- containers.set(`${containerId}_${placement}`, container);
26
+ const key = `${containerId}_${placement}`;
27
+ containers.set(key, container);
28
+ pendingContainerPromises.delete(key);
19
29
  return container;
20
30
  }
21
31
 
@@ -35,13 +45,37 @@ toaster.push = (message, options = {}) => {
35
45
  ...restOptions
36
46
  } = options;
37
47
  const containerElement = typeof container === 'function' ? container() : container;
38
- const containerElementId = containerElement ? containerElement[_symbols.RSUITE_TOASTER_ID] : null;
39
- if (containerElementId) {
48
+ if (containerElement) {
49
+ // Pre-assign the container ID so subsequent synchronous calls can find it
50
+ // before the async container creation has completed.
51
+ if (!containerElement[_symbols.RSUITE_TOASTER_ID]) {
52
+ containerElement[_symbols.RSUITE_TOASTER_ID] = (0, _utils.guid)();
53
+ }
54
+ const containerElementId = containerElement[_symbols.RSUITE_TOASTER_ID];
55
+ const key = `${containerElementId}_${placement}`;
40
56
  const existedContainer = getContainer(containerElementId, placement);
41
57
  if (existedContainer) {
42
- var _existedContainer$cur;
43
- return (_existedContainer$cur = existedContainer.current) === null || _existedContainer$cur === void 0 ? void 0 : _existedContainer$cur.push(message, restOptions);
58
+ return existedContainer.current?.push(message, restOptions);
44
59
  }
60
+
61
+ // A container creation for this placement may already be in progress (e.g. when `push`
62
+ // is called multiple times synchronously in a loop). Reuse that promise instead of
63
+ // creating a second container.
64
+ const pendingPromise = pendingContainerPromises.get(key);
65
+ if (pendingPromise) {
66
+ return pendingPromise.then(ref => ref.current?.push(message, restOptions));
67
+ }
68
+ const newOptions = {
69
+ ...options,
70
+ container: containerElement,
71
+ placement
72
+ };
73
+ const containerPromise = createContainer(placement, newOptions);
74
+
75
+ // Register the pending promise before any async work begins so that subsequent
76
+ // synchronous `push` calls for the same placement chain onto it.
77
+ pendingContainerPromises.set(key, containerPromise);
78
+ return containerPromise.then(ref => ref.current?.push(message, restOptions));
45
79
  }
46
80
  const newOptions = {
47
81
  ...options,
@@ -49,20 +83,13 @@ toaster.push = (message, options = {}) => {
49
83
  placement
50
84
  };
51
85
  return createContainer(placement, newOptions).then(ref => {
52
- var _ref$current;
53
- return (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.push(message, restOptions);
86
+ return ref.current?.push(message, restOptions);
54
87
  });
55
88
  };
56
89
  toaster.remove = key => {
57
- containers.forEach(c => {
58
- var _c$current;
59
- return (_c$current = c.current) === null || _c$current === void 0 ? void 0 : _c$current.remove(key);
60
- });
90
+ containers.forEach(c => c.current?.remove(key));
61
91
  };
62
92
  toaster.clear = () => {
63
- containers.forEach(c => {
64
- var _c$current2;
65
- return (_c$current2 = c.current) === null || _c$current2 === void 0 ? void 0 : _c$current2.clear();
66
- });
93
+ containers.forEach(c => c.current?.clear());
67
94
  };
68
95
  var _default = exports.default = toaster;
@@ -11,5 +11,5 @@ export interface DialogProps extends ModalProps {
11
11
  validate?: (value: string) => [isValid: boolean, errorMessage?: string];
12
12
  onClose?: (result?: any) => void;
13
13
  }
14
- declare const Dialog: import("../internals/types").InternalRefForwardingComponent<React.ElementType<any, keyof React.JSX.IntrinsicElements>, DialogProps, never> & Record<string, never>;
14
+ declare const Dialog: import("../internals/types").InternalRefForwardingComponent<React.ElementType, DialogProps, never> & Record<string, never>;
15
15
  export default Dialog;
@@ -51,7 +51,7 @@ const Dialog = (0, _utils.forwardRef)((props, ref) => {
51
51
  const handleCancel = (0, _react.useCallback)(result => {
52
52
  setIsOpen(false);
53
53
  setTimeout(() => {
54
- onClose === null || onClose === void 0 || onClose(result);
54
+ onClose?.(result);
55
55
  }, 300);
56
56
  }, [onClose]);
57
57
  const handleConfirm = (0, _react.useCallback)(() => {
@@ -10,6 +10,6 @@ export declare function useDialog(): {
10
10
  prompt: (message: React.ReactNode, options?: PromptOptions) => Promise<any>;
11
11
  open: <P extends object>(as: React.ComponentType<P & {
12
12
  onClose: (result?: any) => void;
13
- }>, payload?: P | undefined, options?: OpenOptions) => Promise<any>;
13
+ }>, payload?: P, options?: OpenOptions) => Promise<any>;
14
14
  };
15
15
  export default useDialog;
@@ -18,14 +18,14 @@ const WAIT_FOR_CONTAINER_TIMEOUT = 2000;
18
18
  const useDialogContainer = () => {
19
19
  const context = (0, _react.useContext)(_CustomContext.CustomContext);
20
20
  (0, _react.useEffect)(() => {
21
- if (_canUseDOM.default && !(context !== null && context !== void 0 && context.dialogContainer)) {
21
+ if (_canUseDOM.default && !context?.dialogContainer) {
22
22
  console.warn('Warning: useDialog is being used outside of a CustomProvider. ' + 'Please wrap your application with <CustomProvider> to ensure proper functionality.');
23
23
  }
24
- }, [context === null || context === void 0 ? void 0 : context.dialogContainer]);
24
+ }, [context?.dialogContainer]);
25
25
 
26
26
  // Return the ref from context directly instead of copying to a local ref
27
27
  // This ensures we always use the latest mounted DialogContainer instance
28
- return (context === null || context === void 0 ? void 0 : context.dialogContainer) || {
28
+ return context?.dialogContainer || {
29
29
  current: null
30
30
  };
31
31
  };
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface FieldProps {
3
2
  name: string;
4
3
  formValue?: Record<string, any>;