rsuite 5.46.1 → 5.48.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 (667) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/CloseButton/styles/index.less +13 -7
  3. package/DateInput/package.json +7 -0
  4. package/Message/styles/mixin.less +8 -0
  5. package/Notification/styles/index.less +8 -0
  6. package/Picker/styles/index.less +0 -9
  7. package/Tag/styles/index.less +2 -5
  8. package/Uploader/styles/index.less +1 -2
  9. package/cjs/Affix/Affix.d.ts +6 -0
  10. package/cjs/Affix/Affix.js +7 -0
  11. package/cjs/Animation/Bounce.d.ts +4 -0
  12. package/cjs/Animation/Bounce.js +4 -0
  13. package/cjs/Animation/Collapse.d.ts +4 -0
  14. package/cjs/Animation/Collapse.js +5 -0
  15. package/cjs/Animation/Fade.d.ts +4 -0
  16. package/cjs/Animation/Fade.js +4 -0
  17. package/cjs/Animation/Slide.d.ts +4 -0
  18. package/cjs/Animation/Slide.js +4 -0
  19. package/cjs/Animation/Transition.d.ts +4 -0
  20. package/cjs/Animation/Transition.js +4 -0
  21. package/cjs/AutoComplete/AutoComplete.d.ts +3 -0
  22. package/cjs/AutoComplete/AutoComplete.js +3 -0
  23. package/cjs/Avatar/Avatar.d.ts +4 -0
  24. package/cjs/Avatar/Avatar.js +4 -0
  25. package/cjs/AvatarGroup/AvatarGroup.d.ts +4 -0
  26. package/cjs/AvatarGroup/AvatarGroup.js +5 -0
  27. package/cjs/Badge/Badge.d.ts +4 -0
  28. package/cjs/Badge/Badge.js +4 -0
  29. package/cjs/Breadcrumb/Breadcrumb.d.ts +4 -0
  30. package/cjs/Breadcrumb/Breadcrumb.js +4 -0
  31. package/cjs/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  32. package/cjs/Breadcrumb/BreadcrumbItem.js +4 -0
  33. package/cjs/Button/Button.d.ts +4 -0
  34. package/cjs/Button/Button.js +4 -0
  35. package/cjs/ButtonGroup/ButtonGroup.d.ts +4 -0
  36. package/cjs/ButtonGroup/ButtonGroup.js +4 -0
  37. package/cjs/ButtonToolbar/ButtonToolbar.d.ts +4 -0
  38. package/cjs/ButtonToolbar/ButtonToolbar.js +4 -0
  39. package/cjs/Calendar/Calendar.d.ts +4 -0
  40. package/cjs/Calendar/Calendar.js +4 -0
  41. package/cjs/Carousel/Carousel.d.ts +4 -0
  42. package/cjs/Carousel/Carousel.js +4 -0
  43. package/cjs/Cascader/Cascader.d.ts +4 -0
  44. package/cjs/Cascader/Cascader.js +5 -0
  45. package/cjs/CheckPicker/CheckPicker.d.ts +4 -0
  46. package/cjs/CheckPicker/CheckPicker.js +4 -0
  47. package/cjs/CheckTree/index.d.ts +4 -0
  48. package/cjs/CheckTree/index.js +4 -0
  49. package/cjs/CheckTreePicker/CheckTreePicker.d.ts +5 -0
  50. package/cjs/CheckTreePicker/CheckTreePicker.js +6 -0
  51. package/cjs/Checkbox/Checkbox.d.ts +6 -0
  52. package/cjs/Checkbox/Checkbox.js +4 -0
  53. package/cjs/CheckboxGroup/CheckboxGroup.d.ts +4 -0
  54. package/cjs/CheckboxGroup/CheckboxGroup.js +4 -0
  55. package/cjs/CloseButton/CloseButton.js +3 -5
  56. package/cjs/Col/Col.d.ts +4 -0
  57. package/cjs/Col/Col.js +4 -0
  58. package/cjs/Container/Container.d.ts +4 -0
  59. package/cjs/Container/Container.js +4 -0
  60. package/cjs/Content/Content.d.ts +3 -0
  61. package/cjs/Content/Content.js +3 -0
  62. package/cjs/CustomProvider/CustomProvider.d.ts +8 -3
  63. package/cjs/CustomProvider/CustomProvider.js +6 -0
  64. package/cjs/DOMHelper/index.d.ts +4 -0
  65. package/cjs/DOMHelper/index.js +4 -0
  66. package/cjs/DateInput/DateField.d.ts +180 -0
  67. package/cjs/DateInput/DateField.js +151 -0
  68. package/cjs/DateInput/DateInput.d.ts +18 -0
  69. package/cjs/DateInput/DateInput.js +222 -0
  70. package/cjs/DateInput/index.d.ts +3 -0
  71. package/cjs/DateInput/index.js +9 -0
  72. package/cjs/DateInput/useDateInputState.d.ts +165 -0
  73. package/cjs/DateInput/useDateInputState.js +105 -0
  74. package/cjs/DateInput/utils.d.ts +41 -0
  75. package/cjs/DateInput/utils.js +159 -0
  76. package/cjs/DatePicker/DatePicker.d.ts +5 -0
  77. package/cjs/DatePicker/DatePicker.js +5 -0
  78. package/cjs/DateRangePicker/DateRangePicker.d.ts +5 -0
  79. package/cjs/DateRangePicker/DateRangePicker.js +5 -0
  80. package/cjs/Divider/Divider.d.ts +4 -0
  81. package/cjs/Divider/Divider.js +4 -0
  82. package/cjs/Drawer/Drawer.d.ts +4 -0
  83. package/cjs/Drawer/Drawer.js +4 -0
  84. package/cjs/Dropdown/Dropdown.d.ts +6 -3
  85. package/cjs/Dropdown/Dropdown.js +6 -3
  86. package/cjs/Dropdown/DropdownItem.d.ts +3 -3
  87. package/cjs/Dropdown/DropdownItem.js +3 -3
  88. package/cjs/Dropdown/DropdownMenu.d.ts +3 -3
  89. package/cjs/Dropdown/DropdownMenu.js +3 -3
  90. package/cjs/Dropdown/DropdownSeparator.d.ts +1 -1
  91. package/cjs/Dropdown/DropdownSeparator.js +1 -1
  92. package/cjs/FlexboxGrid/FlexboxGrid.d.ts +4 -0
  93. package/cjs/FlexboxGrid/FlexboxGrid.js +4 -0
  94. package/cjs/FlexboxGrid/FlexboxGridItem.d.ts +4 -0
  95. package/cjs/FlexboxGrid/FlexboxGridItem.js +4 -0
  96. package/cjs/Footer/Footer.d.ts +4 -0
  97. package/cjs/Footer/Footer.js +4 -0
  98. package/cjs/Form/Form.d.ts +4 -0
  99. package/cjs/Form/Form.js +4 -0
  100. package/cjs/FormControl/FormControl.d.ts +4 -0
  101. package/cjs/FormControl/FormControl.js +4 -0
  102. package/cjs/FormControlLabel/FormControlLabel.d.ts +4 -0
  103. package/cjs/FormControlLabel/FormControlLabel.js +4 -0
  104. package/cjs/FormErrorMessage/FormErrorMessage.d.ts +4 -0
  105. package/cjs/FormErrorMessage/FormErrorMessage.js +4 -0
  106. package/cjs/FormGroup/FormGroup.d.ts +4 -0
  107. package/cjs/FormGroup/FormGroup.js +5 -0
  108. package/cjs/FormHelpText/FormHelpText.d.ts +4 -0
  109. package/cjs/FormHelpText/FormHelpText.js +4 -0
  110. package/cjs/Grid/Grid.d.ts +4 -0
  111. package/cjs/Grid/Grid.js +4 -0
  112. package/cjs/Header/Header.d.ts +4 -0
  113. package/cjs/Header/Header.js +4 -0
  114. package/cjs/IconButton/IconButton.d.ts +4 -0
  115. package/cjs/IconButton/IconButton.js +4 -0
  116. package/cjs/Input/Input.d.ts +4 -0
  117. package/cjs/Input/Input.js +4 -0
  118. package/cjs/InputGroup/InputGroup.d.ts +4 -0
  119. package/cjs/InputGroup/InputGroup.js +4 -0
  120. package/cjs/InputGroup/InputGroupAddon.d.ts +4 -0
  121. package/cjs/InputGroup/InputGroupAddon.js +4 -0
  122. package/cjs/InputGroup/InputGroupButton.d.ts +4 -0
  123. package/cjs/InputGroup/InputGroupButton.js +4 -0
  124. package/cjs/InputNumber/InputNumber.d.ts +4 -0
  125. package/cjs/InputNumber/InputNumber.js +5 -0
  126. package/cjs/InputPicker/InputPicker.d.ts +8 -22
  127. package/cjs/InputPicker/InputPicker.js +13 -8
  128. package/cjs/InputPicker/InputPickerContext.d.ts +26 -0
  129. package/cjs/InputPicker/InputPickerContext.js +13 -0
  130. package/cjs/List/List.d.ts +4 -0
  131. package/cjs/List/List.js +4 -0
  132. package/cjs/List/ListItem.d.ts +4 -0
  133. package/cjs/List/ListItem.js +4 -0
  134. package/cjs/Loader/Loader.d.ts +4 -0
  135. package/cjs/Loader/Loader.js +4 -0
  136. package/cjs/MaskedInput/TextMask.d.ts +4 -0
  137. package/cjs/MaskedInput/TextMask.js +5 -0
  138. package/cjs/MaskedInput/createTextMaskInputElement.js +6 -16
  139. package/cjs/Message/Message.d.ts +4 -0
  140. package/cjs/Message/Message.js +4 -0
  141. package/cjs/Modal/Modal.d.ts +4 -0
  142. package/cjs/Modal/Modal.js +4 -0
  143. package/cjs/MultiCascader/MultiCascader.d.ts +4 -0
  144. package/cjs/MultiCascader/MultiCascader.js +5 -0
  145. package/cjs/Nav/Nav.d.ts +4 -0
  146. package/cjs/Nav/Nav.js +4 -0
  147. package/cjs/Nav/NavDropdown.d.ts +2 -1
  148. package/cjs/Nav/NavDropdown.js +2 -1
  149. package/cjs/Nav/NavItem.d.ts +6 -3
  150. package/cjs/Nav/NavItem.js +6 -3
  151. package/cjs/Nav/NavMenu.d.ts +6 -3
  152. package/cjs/Nav/NavMenu.js +6 -3
  153. package/cjs/Navbar/Navbar.d.ts +4 -0
  154. package/cjs/Navbar/Navbar.js +4 -0
  155. package/cjs/Notification/Notification.d.ts +5 -0
  156. package/cjs/Notification/Notification.js +5 -0
  157. package/cjs/Overlay/Overlay.d.ts +4 -0
  158. package/cjs/Overlay/Overlay.js +5 -0
  159. package/cjs/Overlay/OverlayTrigger.d.ts +4 -0
  160. package/cjs/Overlay/OverlayTrigger.js +16 -11
  161. package/cjs/Overlay/Position.d.ts +4 -0
  162. package/cjs/Overlay/Position.js +4 -0
  163. package/cjs/Pagination/Pagination.d.ts +5 -0
  164. package/cjs/Pagination/Pagination.js +5 -0
  165. package/cjs/Panel/Panel.d.ts +4 -0
  166. package/cjs/Panel/Panel.js +4 -0
  167. package/cjs/PanelGroup/PanelGroup.d.ts +4 -0
  168. package/cjs/PanelGroup/PanelGroup.js +5 -0
  169. package/cjs/Picker/DropdownMenu.d.ts +1 -0
  170. package/cjs/Picker/DropdownMenu.js +7 -3
  171. package/cjs/Picker/DropdownMenuCheckItem.d.ts +2 -0
  172. package/cjs/Picker/DropdownMenuCheckItem.js +18 -14
  173. package/cjs/Picker/PickerToggle.js +3 -1
  174. package/cjs/Placeholder/Placeholder.d.ts +4 -0
  175. package/cjs/Placeholder/Placeholder.js +4 -0
  176. package/cjs/Placeholder/PlaceholderGraph.d.ts +4 -0
  177. package/cjs/Placeholder/PlaceholderGraph.js +4 -0
  178. package/cjs/Placeholder/PlaceholderGrid.d.ts +4 -0
  179. package/cjs/Placeholder/PlaceholderGrid.js +4 -0
  180. package/cjs/Placeholder/PlaceholderParagraph.d.ts +4 -0
  181. package/cjs/Placeholder/PlaceholderParagraph.js +4 -0
  182. package/cjs/Plaintext/Plaintext.d.ts +2 -1
  183. package/cjs/Plaintext/Plaintext.js +5 -2
  184. package/cjs/Popover/Popover.d.ts +4 -0
  185. package/cjs/Popover/Popover.js +4 -0
  186. package/cjs/Progress/Progress.d.ts +4 -0
  187. package/cjs/Progress/Progress.js +4 -0
  188. package/cjs/Progress/ProgressCircle.d.ts +4 -0
  189. package/cjs/Progress/ProgressCircle.js +4 -0
  190. package/cjs/Progress/ProgressLine.d.ts +4 -0
  191. package/cjs/Progress/ProgressLine.js +4 -0
  192. package/cjs/Radio/Radio.d.ts +4 -0
  193. package/cjs/Radio/Radio.js +4 -0
  194. package/cjs/RadioGroup/RadioGroup.d.ts +4 -0
  195. package/cjs/RadioGroup/RadioGroup.js +5 -0
  196. package/cjs/RadioTile/RadioTile.d.ts +5 -0
  197. package/cjs/RadioTile/RadioTile.js +5 -0
  198. package/cjs/RadioTileGroup/RadioTileGroup.d.ts +5 -0
  199. package/cjs/RadioTileGroup/RadioTileGroup.js +6 -0
  200. package/cjs/RangeSlider/RangeSlider.d.ts +4 -0
  201. package/cjs/RangeSlider/RangeSlider.js +5 -0
  202. package/cjs/Rate/Rate.d.ts +4 -0
  203. package/cjs/Rate/Rate.js +4 -0
  204. package/cjs/Ripple/Ripple.d.ts +4 -0
  205. package/cjs/Ripple/Ripple.js +5 -0
  206. package/cjs/Row/Row.d.ts +4 -0
  207. package/cjs/Row/Row.js +4 -0
  208. package/cjs/SafeAnchor/SafeAnchor.d.ts +4 -0
  209. package/cjs/SafeAnchor/SafeAnchor.js +5 -0
  210. package/cjs/Schema/Schema.d.ts +6 -0
  211. package/cjs/Schema/Schema.js +6 -0
  212. package/cjs/SelectPicker/SelectPicker.d.ts +4 -0
  213. package/cjs/SelectPicker/SelectPicker.js +4 -0
  214. package/cjs/Sidebar/Sidebar.d.ts +4 -0
  215. package/cjs/Sidebar/Sidebar.js +4 -0
  216. package/cjs/Sidenav/Sidenav.d.ts +4 -0
  217. package/cjs/Sidenav/Sidenav.js +5 -0
  218. package/cjs/Sidenav/SidenavBody.d.ts +5 -0
  219. package/cjs/Sidenav/SidenavBody.js +5 -0
  220. package/cjs/Sidenav/SidenavHeader.d.ts +5 -0
  221. package/cjs/Sidenav/SidenavHeader.js +5 -0
  222. package/cjs/Slider/Slider.d.ts +5 -0
  223. package/cjs/Slider/Slider.js +6 -0
  224. package/cjs/Stack/Stack.d.ts +6 -0
  225. package/cjs/Stack/Stack.js +6 -0
  226. package/cjs/Stack/StackItem.d.ts +5 -0
  227. package/cjs/Stack/StackItem.js +5 -0
  228. package/cjs/Steps/StepItem.d.ts +5 -0
  229. package/cjs/Steps/StepItem.js +5 -0
  230. package/cjs/Steps/Steps.d.ts +5 -0
  231. package/cjs/Steps/Steps.js +5 -0
  232. package/cjs/Table/Table.d.ts +19 -2
  233. package/cjs/Table/Table.js +20 -1
  234. package/cjs/Tag/Tag.d.ts +6 -0
  235. package/cjs/Tag/Tag.js +13 -1
  236. package/cjs/TagGroup/TagGroup.d.ts +5 -0
  237. package/cjs/TagGroup/TagGroup.js +5 -0
  238. package/cjs/TagInput/index.d.ts +8 -15
  239. package/cjs/TagInput/index.js +8 -2
  240. package/cjs/TagPicker/index.d.ts +13 -10
  241. package/cjs/TagPicker/index.js +13 -5
  242. package/cjs/Timeline/Timeline.d.ts +5 -0
  243. package/cjs/Timeline/Timeline.js +5 -0
  244. package/cjs/Timeline/TimelineItem.d.ts +5 -0
  245. package/cjs/Timeline/TimelineItem.js +5 -0
  246. package/cjs/Toggle/Toggle.d.ts +5 -0
  247. package/cjs/Toggle/Toggle.js +5 -0
  248. package/cjs/Tooltip/Tooltip.d.ts +5 -0
  249. package/cjs/Tooltip/Tooltip.js +5 -0
  250. package/cjs/Tree/Tree.d.ts +5 -0
  251. package/cjs/Tree/Tree.js +5 -0
  252. package/cjs/TreePicker/TreePicker.d.ts +5 -0
  253. package/cjs/TreePicker/TreePicker.js +6 -0
  254. package/cjs/Uploader/UploadFileItem.js +19 -5
  255. package/cjs/Uploader/Uploader.d.ts +5 -0
  256. package/cjs/Uploader/Uploader.js +6 -0
  257. package/cjs/Whisper/Whisper.d.ts +6 -0
  258. package/cjs/Whisper/Whisper.js +6 -0
  259. package/cjs/Windowing/AutoSizer.d.ts +5 -0
  260. package/cjs/Windowing/AutoSizer.js +5 -0
  261. package/cjs/Windowing/List.d.ts +6 -1
  262. package/cjs/Windowing/List.js +5 -0
  263. package/cjs/index.d.ts +3 -0
  264. package/cjs/index.js +6 -2
  265. package/cjs/locales/ar_EG.d.ts +3 -0
  266. package/cjs/locales/ar_EG.js +5 -2
  267. package/cjs/locales/da_DK.d.ts +3 -0
  268. package/cjs/locales/da_DK.js +5 -2
  269. package/cjs/locales/de_DE.d.ts +3 -0
  270. package/cjs/locales/de_DE.js +5 -2
  271. package/cjs/locales/default.d.ts +3 -0
  272. package/cjs/locales/default.js +5 -2
  273. package/cjs/locales/en_US.d.ts +3 -0
  274. package/cjs/locales/en_US.js +5 -2
  275. package/cjs/locales/es_AR.d.ts +3 -0
  276. package/cjs/locales/es_AR.js +5 -2
  277. package/cjs/locales/es_ES.d.ts +3 -0
  278. package/cjs/locales/es_ES.js +5 -2
  279. package/cjs/locales/fa_IR.d.ts +3 -0
  280. package/cjs/locales/fa_IR.js +5 -2
  281. package/cjs/locales/fi_FI.d.ts +3 -0
  282. package/cjs/locales/fi_FI.js +5 -2
  283. package/cjs/locales/fr_FR.d.ts +3 -0
  284. package/cjs/locales/fr_FR.js +5 -2
  285. package/cjs/locales/hu_HU.d.ts +3 -0
  286. package/cjs/locales/hu_HU.js +5 -2
  287. package/cjs/locales/index.d.ts +1 -1
  288. package/cjs/locales/it_IT.d.ts +3 -0
  289. package/cjs/locales/it_IT.js +5 -2
  290. package/cjs/locales/ja_JP.d.ts +3 -0
  291. package/cjs/locales/ja_JP.js +5 -2
  292. package/cjs/locales/kk_KZ.d.ts +3 -0
  293. package/cjs/locales/kk_KZ.js +5 -2
  294. package/cjs/locales/ko_KR.d.ts +3 -0
  295. package/cjs/locales/ko_KR.js +5 -2
  296. package/cjs/locales/ne_NP.d.ts +3 -0
  297. package/cjs/locales/ne_NP.js +5 -2
  298. package/cjs/locales/nl_NL.d.ts +3 -0
  299. package/cjs/locales/nl_NL.js +5 -2
  300. package/cjs/locales/pt_BR.d.ts +3 -0
  301. package/cjs/locales/pt_BR.js +5 -2
  302. package/cjs/locales/ru_RU.d.ts +3 -0
  303. package/cjs/locales/ru_RU.js +6 -3
  304. package/cjs/locales/sv_SE.d.ts +3 -0
  305. package/cjs/locales/sv_SE.js +5 -2
  306. package/cjs/locales/tr_TR.d.ts +3 -0
  307. package/cjs/locales/tr_TR.js +5 -2
  308. package/cjs/locales/zh_CN.d.ts +3 -0
  309. package/cjs/locales/zh_CN.js +5 -2
  310. package/cjs/locales/zh_TW.d.ts +3 -0
  311. package/cjs/locales/zh_TW.js +5 -2
  312. package/cjs/toaster/toaster.d.ts +9 -7
  313. package/cjs/toaster/useToaster.d.ts +19 -1
  314. package/cjs/toaster/useToaster.js +19 -1
  315. package/cjs/useMediaQuery/index.d.ts +2 -0
  316. package/cjs/useMediaQuery/index.js +9 -0
  317. package/cjs/useMediaQuery/useMediaQuery.d.ts +23 -0
  318. package/cjs/useMediaQuery/useMediaQuery.js +123 -0
  319. package/cjs/utils/BrowserDetection.d.ts +1 -0
  320. package/cjs/utils/BrowserDetection.js +5 -1
  321. package/cjs/utils/dateUtils.d.ts +6 -0
  322. package/cjs/utils/dateUtils.js +13 -1
  323. package/cjs/utils/index.d.ts +1 -0
  324. package/cjs/utils/index.js +4 -1
  325. package/cjs/utils/safeSetSelection.d.ts +2 -0
  326. package/cjs/utils/safeSetSelection.js +21 -0
  327. package/cjs/utils/treeUtils.d.ts +2 -2
  328. package/dist/rsuite-no-reset-rtl.css +54 -25
  329. package/dist/rsuite-no-reset-rtl.min.css +1 -1
  330. package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
  331. package/dist/rsuite-no-reset.css +54 -25
  332. package/dist/rsuite-no-reset.min.css +1 -1
  333. package/dist/rsuite-no-reset.min.css.map +1 -1
  334. package/dist/rsuite-rtl.css +54 -25
  335. package/dist/rsuite-rtl.min.css +1 -1
  336. package/dist/rsuite-rtl.min.css.map +1 -1
  337. package/dist/rsuite.css +54 -25
  338. package/dist/rsuite.js +354 -129
  339. package/dist/rsuite.js.map +1 -1
  340. package/dist/rsuite.min.css +1 -1
  341. package/dist/rsuite.min.css.map +1 -1
  342. package/dist/rsuite.min.js +1 -1
  343. package/dist/rsuite.min.js.map +1 -1
  344. package/esm/Affix/Affix.d.ts +6 -0
  345. package/esm/Affix/Affix.js +7 -0
  346. package/esm/Animation/Bounce.d.ts +4 -0
  347. package/esm/Animation/Bounce.js +4 -0
  348. package/esm/Animation/Collapse.d.ts +4 -0
  349. package/esm/Animation/Collapse.js +5 -0
  350. package/esm/Animation/Fade.d.ts +4 -0
  351. package/esm/Animation/Fade.js +4 -0
  352. package/esm/Animation/Slide.d.ts +4 -0
  353. package/esm/Animation/Slide.js +4 -0
  354. package/esm/Animation/Transition.d.ts +4 -0
  355. package/esm/Animation/Transition.js +4 -0
  356. package/esm/AutoComplete/AutoComplete.d.ts +3 -0
  357. package/esm/AutoComplete/AutoComplete.js +3 -0
  358. package/esm/Avatar/Avatar.d.ts +4 -0
  359. package/esm/Avatar/Avatar.js +4 -0
  360. package/esm/AvatarGroup/AvatarGroup.d.ts +4 -0
  361. package/esm/AvatarGroup/AvatarGroup.js +5 -0
  362. package/esm/Badge/Badge.d.ts +4 -0
  363. package/esm/Badge/Badge.js +4 -0
  364. package/esm/Breadcrumb/Breadcrumb.d.ts +4 -0
  365. package/esm/Breadcrumb/Breadcrumb.js +4 -0
  366. package/esm/Breadcrumb/BreadcrumbItem.d.ts +4 -0
  367. package/esm/Breadcrumb/BreadcrumbItem.js +4 -0
  368. package/esm/Button/Button.d.ts +4 -0
  369. package/esm/Button/Button.js +4 -0
  370. package/esm/ButtonGroup/ButtonGroup.d.ts +4 -0
  371. package/esm/ButtonGroup/ButtonGroup.js +4 -0
  372. package/esm/ButtonToolbar/ButtonToolbar.d.ts +4 -0
  373. package/esm/ButtonToolbar/ButtonToolbar.js +4 -0
  374. package/esm/Calendar/Calendar.d.ts +4 -0
  375. package/esm/Calendar/Calendar.js +4 -0
  376. package/esm/Carousel/Carousel.d.ts +4 -0
  377. package/esm/Carousel/Carousel.js +4 -0
  378. package/esm/Cascader/Cascader.d.ts +4 -0
  379. package/esm/Cascader/Cascader.js +5 -0
  380. package/esm/CheckPicker/CheckPicker.d.ts +4 -0
  381. package/esm/CheckPicker/CheckPicker.js +4 -0
  382. package/esm/CheckTree/index.d.ts +4 -0
  383. package/esm/CheckTree/index.js +4 -0
  384. package/esm/CheckTreePicker/CheckTreePicker.d.ts +5 -0
  385. package/esm/CheckTreePicker/CheckTreePicker.js +6 -0
  386. package/esm/Checkbox/Checkbox.d.ts +6 -0
  387. package/esm/Checkbox/Checkbox.js +4 -0
  388. package/esm/CheckboxGroup/CheckboxGroup.d.ts +4 -0
  389. package/esm/CheckboxGroup/CheckboxGroup.js +4 -0
  390. package/esm/CloseButton/CloseButton.js +3 -5
  391. package/esm/Col/Col.d.ts +4 -0
  392. package/esm/Col/Col.js +4 -0
  393. package/esm/Container/Container.d.ts +4 -0
  394. package/esm/Container/Container.js +4 -0
  395. package/esm/Content/Content.d.ts +3 -0
  396. package/esm/Content/Content.js +3 -0
  397. package/esm/CustomProvider/CustomProvider.d.ts +8 -3
  398. package/esm/CustomProvider/CustomProvider.js +6 -0
  399. package/esm/DOMHelper/index.d.ts +4 -0
  400. package/esm/DOMHelper/index.js +5 -0
  401. package/esm/DateInput/DateField.d.ts +180 -0
  402. package/esm/DateInput/DateField.js +144 -0
  403. package/esm/DateInput/DateInput.d.ts +18 -0
  404. package/esm/DateInput/DateInput.js +215 -0
  405. package/esm/DateInput/index.d.ts +3 -0
  406. package/esm/DateInput/index.js +3 -0
  407. package/esm/DateInput/useDateInputState.d.ts +165 -0
  408. package/esm/DateInput/useDateInputState.js +99 -0
  409. package/esm/DateInput/utils.d.ts +41 -0
  410. package/esm/DateInput/utils.js +151 -0
  411. package/esm/DatePicker/DatePicker.d.ts +5 -0
  412. package/esm/DatePicker/DatePicker.js +5 -0
  413. package/esm/DateRangePicker/DateRangePicker.d.ts +5 -0
  414. package/esm/DateRangePicker/DateRangePicker.js +5 -0
  415. package/esm/Divider/Divider.d.ts +4 -0
  416. package/esm/Divider/Divider.js +4 -0
  417. package/esm/Drawer/Drawer.d.ts +4 -0
  418. package/esm/Drawer/Drawer.js +4 -0
  419. package/esm/Dropdown/Dropdown.d.ts +6 -3
  420. package/esm/Dropdown/Dropdown.js +6 -3
  421. package/esm/Dropdown/DropdownItem.d.ts +3 -3
  422. package/esm/Dropdown/DropdownItem.js +3 -3
  423. package/esm/Dropdown/DropdownMenu.d.ts +3 -3
  424. package/esm/Dropdown/DropdownMenu.js +3 -3
  425. package/esm/Dropdown/DropdownSeparator.d.ts +1 -1
  426. package/esm/Dropdown/DropdownSeparator.js +1 -1
  427. package/esm/FlexboxGrid/FlexboxGrid.d.ts +4 -0
  428. package/esm/FlexboxGrid/FlexboxGrid.js +4 -0
  429. package/esm/FlexboxGrid/FlexboxGridItem.d.ts +4 -0
  430. package/esm/FlexboxGrid/FlexboxGridItem.js +4 -0
  431. package/esm/Footer/Footer.d.ts +4 -0
  432. package/esm/Footer/Footer.js +4 -0
  433. package/esm/Form/Form.d.ts +4 -0
  434. package/esm/Form/Form.js +4 -0
  435. package/esm/FormControl/FormControl.d.ts +4 -0
  436. package/esm/FormControl/FormControl.js +4 -0
  437. package/esm/FormControlLabel/FormControlLabel.d.ts +4 -0
  438. package/esm/FormControlLabel/FormControlLabel.js +4 -0
  439. package/esm/FormErrorMessage/FormErrorMessage.d.ts +4 -0
  440. package/esm/FormErrorMessage/FormErrorMessage.js +4 -0
  441. package/esm/FormGroup/FormGroup.d.ts +4 -0
  442. package/esm/FormGroup/FormGroup.js +5 -0
  443. package/esm/FormHelpText/FormHelpText.d.ts +4 -0
  444. package/esm/FormHelpText/FormHelpText.js +4 -0
  445. package/esm/Grid/Grid.d.ts +4 -0
  446. package/esm/Grid/Grid.js +4 -0
  447. package/esm/Header/Header.d.ts +4 -0
  448. package/esm/Header/Header.js +4 -0
  449. package/esm/IconButton/IconButton.d.ts +4 -0
  450. package/esm/IconButton/IconButton.js +4 -0
  451. package/esm/Input/Input.d.ts +4 -0
  452. package/esm/Input/Input.js +4 -0
  453. package/esm/InputGroup/InputGroup.d.ts +4 -0
  454. package/esm/InputGroup/InputGroup.js +4 -0
  455. package/esm/InputGroup/InputGroupAddon.d.ts +4 -0
  456. package/esm/InputGroup/InputGroupAddon.js +4 -0
  457. package/esm/InputGroup/InputGroupButton.d.ts +4 -0
  458. package/esm/InputGroup/InputGroupButton.js +5 -0
  459. package/esm/InputNumber/InputNumber.d.ts +4 -0
  460. package/esm/InputNumber/InputNumber.js +5 -0
  461. package/esm/InputPicker/InputPicker.d.ts +8 -22
  462. package/esm/InputPicker/InputPicker.js +11 -5
  463. package/esm/InputPicker/InputPickerContext.d.ts +26 -0
  464. package/esm/InputPicker/InputPickerContext.js +7 -0
  465. package/esm/List/List.d.ts +4 -0
  466. package/esm/List/List.js +4 -0
  467. package/esm/List/ListItem.d.ts +4 -0
  468. package/esm/List/ListItem.js +4 -0
  469. package/esm/Loader/Loader.d.ts +4 -0
  470. package/esm/Loader/Loader.js +4 -0
  471. package/esm/MaskedInput/TextMask.d.ts +4 -0
  472. package/esm/MaskedInput/TextMask.js +5 -0
  473. package/esm/MaskedInput/createTextMaskInputElement.js +6 -16
  474. package/esm/Message/Message.d.ts +4 -0
  475. package/esm/Message/Message.js +4 -0
  476. package/esm/Modal/Modal.d.ts +4 -0
  477. package/esm/Modal/Modal.js +4 -0
  478. package/esm/MultiCascader/MultiCascader.d.ts +4 -0
  479. package/esm/MultiCascader/MultiCascader.js +5 -0
  480. package/esm/Nav/Nav.d.ts +4 -0
  481. package/esm/Nav/Nav.js +4 -0
  482. package/esm/Nav/NavDropdown.d.ts +2 -1
  483. package/esm/Nav/NavDropdown.js +2 -1
  484. package/esm/Nav/NavItem.d.ts +6 -3
  485. package/esm/Nav/NavItem.js +6 -3
  486. package/esm/Nav/NavMenu.d.ts +6 -3
  487. package/esm/Nav/NavMenu.js +6 -3
  488. package/esm/Navbar/Navbar.d.ts +4 -0
  489. package/esm/Navbar/Navbar.js +4 -0
  490. package/esm/Notification/Notification.d.ts +5 -0
  491. package/esm/Notification/Notification.js +5 -0
  492. package/esm/Overlay/Overlay.d.ts +4 -0
  493. package/esm/Overlay/Overlay.js +5 -0
  494. package/esm/Overlay/OverlayTrigger.d.ts +4 -0
  495. package/esm/Overlay/OverlayTrigger.js +16 -11
  496. package/esm/Overlay/Position.d.ts +4 -0
  497. package/esm/Overlay/Position.js +4 -0
  498. package/esm/Pagination/Pagination.d.ts +5 -0
  499. package/esm/Pagination/Pagination.js +5 -0
  500. package/esm/Panel/Panel.d.ts +4 -0
  501. package/esm/Panel/Panel.js +4 -0
  502. package/esm/PanelGroup/PanelGroup.d.ts +4 -0
  503. package/esm/PanelGroup/PanelGroup.js +5 -0
  504. package/esm/Picker/DropdownMenu.d.ts +1 -0
  505. package/esm/Picker/DropdownMenu.js +7 -3
  506. package/esm/Picker/DropdownMenuCheckItem.d.ts +2 -0
  507. package/esm/Picker/DropdownMenuCheckItem.js +18 -14
  508. package/esm/Picker/PickerToggle.js +4 -2
  509. package/esm/Placeholder/Placeholder.d.ts +4 -0
  510. package/esm/Placeholder/Placeholder.js +4 -0
  511. package/esm/Placeholder/PlaceholderGraph.d.ts +4 -0
  512. package/esm/Placeholder/PlaceholderGraph.js +4 -0
  513. package/esm/Placeholder/PlaceholderGrid.d.ts +4 -0
  514. package/esm/Placeholder/PlaceholderGrid.js +4 -0
  515. package/esm/Placeholder/PlaceholderParagraph.d.ts +4 -0
  516. package/esm/Placeholder/PlaceholderParagraph.js +4 -0
  517. package/esm/Plaintext/Plaintext.d.ts +2 -1
  518. package/esm/Plaintext/Plaintext.js +5 -2
  519. package/esm/Popover/Popover.d.ts +4 -0
  520. package/esm/Popover/Popover.js +4 -0
  521. package/esm/Progress/Progress.d.ts +4 -0
  522. package/esm/Progress/Progress.js +4 -0
  523. package/esm/Progress/ProgressCircle.d.ts +4 -0
  524. package/esm/Progress/ProgressCircle.js +4 -0
  525. package/esm/Progress/ProgressLine.d.ts +4 -0
  526. package/esm/Progress/ProgressLine.js +4 -0
  527. package/esm/Radio/Radio.d.ts +4 -0
  528. package/esm/Radio/Radio.js +4 -0
  529. package/esm/RadioGroup/RadioGroup.d.ts +4 -0
  530. package/esm/RadioGroup/RadioGroup.js +5 -0
  531. package/esm/RadioTile/RadioTile.d.ts +5 -0
  532. package/esm/RadioTile/RadioTile.js +5 -0
  533. package/esm/RadioTileGroup/RadioTileGroup.d.ts +5 -0
  534. package/esm/RadioTileGroup/RadioTileGroup.js +6 -0
  535. package/esm/RangeSlider/RangeSlider.d.ts +4 -0
  536. package/esm/RangeSlider/RangeSlider.js +5 -0
  537. package/esm/Rate/Rate.d.ts +4 -0
  538. package/esm/Rate/Rate.js +4 -0
  539. package/esm/Ripple/Ripple.d.ts +4 -0
  540. package/esm/Ripple/Ripple.js +5 -0
  541. package/esm/Row/Row.d.ts +4 -0
  542. package/esm/Row/Row.js +4 -0
  543. package/esm/SafeAnchor/SafeAnchor.d.ts +4 -0
  544. package/esm/SafeAnchor/SafeAnchor.js +5 -0
  545. package/esm/Schema/Schema.d.ts +6 -0
  546. package/esm/Schema/Schema.js +7 -0
  547. package/esm/SelectPicker/SelectPicker.d.ts +4 -0
  548. package/esm/SelectPicker/SelectPicker.js +4 -0
  549. package/esm/Sidebar/Sidebar.d.ts +4 -0
  550. package/esm/Sidebar/Sidebar.js +4 -0
  551. package/esm/Sidenav/Sidenav.d.ts +4 -0
  552. package/esm/Sidenav/Sidenav.js +5 -0
  553. package/esm/Sidenav/SidenavBody.d.ts +5 -0
  554. package/esm/Sidenav/SidenavBody.js +5 -0
  555. package/esm/Sidenav/SidenavHeader.d.ts +5 -0
  556. package/esm/Sidenav/SidenavHeader.js +5 -0
  557. package/esm/Slider/Slider.d.ts +5 -0
  558. package/esm/Slider/Slider.js +6 -0
  559. package/esm/Stack/Stack.d.ts +6 -0
  560. package/esm/Stack/Stack.js +6 -0
  561. package/esm/Stack/StackItem.d.ts +5 -0
  562. package/esm/Stack/StackItem.js +5 -0
  563. package/esm/Steps/StepItem.d.ts +5 -0
  564. package/esm/Steps/StepItem.js +5 -0
  565. package/esm/Steps/Steps.d.ts +5 -0
  566. package/esm/Steps/Steps.js +5 -0
  567. package/esm/Table/Table.d.ts +19 -2
  568. package/esm/Table/Table.js +23 -4
  569. package/esm/Tag/Tag.d.ts +6 -0
  570. package/esm/Tag/Tag.js +14 -2
  571. package/esm/TagGroup/TagGroup.d.ts +5 -0
  572. package/esm/TagGroup/TagGroup.js +5 -0
  573. package/esm/TagInput/index.d.ts +8 -15
  574. package/esm/TagInput/index.js +7 -1
  575. package/esm/TagPicker/index.d.ts +13 -10
  576. package/esm/TagPicker/index.js +12 -4
  577. package/esm/Timeline/Timeline.d.ts +5 -0
  578. package/esm/Timeline/Timeline.js +5 -0
  579. package/esm/Timeline/TimelineItem.d.ts +5 -0
  580. package/esm/Timeline/TimelineItem.js +5 -0
  581. package/esm/Toggle/Toggle.d.ts +5 -0
  582. package/esm/Toggle/Toggle.js +5 -0
  583. package/esm/Tooltip/Tooltip.d.ts +5 -0
  584. package/esm/Tooltip/Tooltip.js +5 -0
  585. package/esm/Tree/Tree.d.ts +5 -0
  586. package/esm/Tree/Tree.js +5 -0
  587. package/esm/TreePicker/TreePicker.d.ts +5 -0
  588. package/esm/TreePicker/TreePicker.js +6 -0
  589. package/esm/Uploader/UploadFileItem.js +19 -5
  590. package/esm/Uploader/Uploader.d.ts +5 -0
  591. package/esm/Uploader/Uploader.js +6 -0
  592. package/esm/Whisper/Whisper.d.ts +6 -0
  593. package/esm/Whisper/Whisper.js +6 -0
  594. package/esm/Windowing/AutoSizer.d.ts +5 -0
  595. package/esm/Windowing/AutoSizer.js +5 -0
  596. package/esm/Windowing/List.d.ts +6 -1
  597. package/esm/Windowing/List.js +5 -0
  598. package/esm/index.d.ts +3 -0
  599. package/esm/index.js +3 -1
  600. package/esm/locales/ar_EG.d.ts +3 -0
  601. package/esm/locales/ar_EG.js +5 -2
  602. package/esm/locales/da_DK.d.ts +3 -0
  603. package/esm/locales/da_DK.js +5 -2
  604. package/esm/locales/de_DE.d.ts +3 -0
  605. package/esm/locales/de_DE.js +5 -2
  606. package/esm/locales/default.d.ts +3 -0
  607. package/esm/locales/default.js +5 -2
  608. package/esm/locales/en_US.d.ts +3 -0
  609. package/esm/locales/en_US.js +5 -2
  610. package/esm/locales/es_AR.d.ts +3 -0
  611. package/esm/locales/es_AR.js +5 -2
  612. package/esm/locales/es_ES.d.ts +3 -0
  613. package/esm/locales/es_ES.js +5 -2
  614. package/esm/locales/fa_IR.d.ts +3 -0
  615. package/esm/locales/fa_IR.js +5 -2
  616. package/esm/locales/fi_FI.d.ts +3 -0
  617. package/esm/locales/fi_FI.js +5 -2
  618. package/esm/locales/fr_FR.d.ts +3 -0
  619. package/esm/locales/fr_FR.js +5 -2
  620. package/esm/locales/hu_HU.d.ts +3 -0
  621. package/esm/locales/hu_HU.js +5 -2
  622. package/esm/locales/index.d.ts +1 -1
  623. package/esm/locales/it_IT.d.ts +3 -0
  624. package/esm/locales/it_IT.js +5 -2
  625. package/esm/locales/ja_JP.d.ts +3 -0
  626. package/esm/locales/ja_JP.js +5 -2
  627. package/esm/locales/kk_KZ.d.ts +3 -0
  628. package/esm/locales/kk_KZ.js +5 -2
  629. package/esm/locales/ko_KR.d.ts +3 -0
  630. package/esm/locales/ko_KR.js +5 -2
  631. package/esm/locales/ne_NP.d.ts +3 -0
  632. package/esm/locales/ne_NP.js +5 -2
  633. package/esm/locales/nl_NL.d.ts +3 -0
  634. package/esm/locales/nl_NL.js +5 -2
  635. package/esm/locales/pt_BR.d.ts +3 -0
  636. package/esm/locales/pt_BR.js +5 -2
  637. package/esm/locales/ru_RU.d.ts +3 -0
  638. package/esm/locales/ru_RU.js +6 -3
  639. package/esm/locales/sv_SE.d.ts +3 -0
  640. package/esm/locales/sv_SE.js +5 -2
  641. package/esm/locales/tr_TR.d.ts +3 -0
  642. package/esm/locales/tr_TR.js +5 -2
  643. package/esm/locales/zh_CN.d.ts +3 -0
  644. package/esm/locales/zh_CN.js +5 -2
  645. package/esm/locales/zh_TW.d.ts +3 -0
  646. package/esm/locales/zh_TW.js +5 -2
  647. package/esm/toaster/toaster.d.ts +9 -7
  648. package/esm/toaster/useToaster.d.ts +19 -1
  649. package/esm/toaster/useToaster.js +19 -1
  650. package/esm/useMediaQuery/index.d.ts +2 -0
  651. package/esm/useMediaQuery/index.js +3 -0
  652. package/esm/useMediaQuery/useMediaQuery.d.ts +23 -0
  653. package/esm/useMediaQuery/useMediaQuery.js +113 -0
  654. package/esm/utils/BrowserDetection.d.ts +1 -0
  655. package/esm/utils/BrowserDetection.js +3 -0
  656. package/esm/utils/dateUtils.d.ts +6 -0
  657. package/esm/utils/dateUtils.js +6 -0
  658. package/esm/utils/index.d.ts +1 -0
  659. package/esm/utils/index.js +1 -0
  660. package/esm/utils/safeSetSelection.d.ts +2 -0
  661. package/esm/utils/safeSetSelection.js +16 -0
  662. package/esm/utils/treeUtils.d.ts +2 -2
  663. package/package.json +1 -1
  664. package/styles/color-modes/dark.less +3 -1
  665. package/styles/color-modes/high-contrast.less +3 -1
  666. package/styles/color-modes/light.less +3 -1
  667. package/useMediaQuery/package.json +7 -0
@@ -0,0 +1,222 @@
1
+ 'use client';
2
+ "use strict";
3
+
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
6
+ exports.__esModule = true;
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _Input = _interopRequireDefault(require("../Input"));
12
+ var _utils = require("../utils");
13
+ var _utils2 = require("./utils");
14
+ var _useDateInputState2 = _interopRequireDefault(require("./useDateInputState"));
15
+ var isTestEnvironment = process.env.RUN_ENV === 'test';
16
+ /**
17
+ * The DateInput component lets users select a date with the keyboard.
18
+ * @version 5.58.0
19
+ * @see https://rsuitejs.com/components/date-input/
20
+ */
21
+ var DateInput = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
22
+ var _props$format = props.format,
23
+ formatStr = _props$format === void 0 ? 'yyyy-MM-dd' : _props$format,
24
+ valueProp = props.value,
25
+ defaultValue = props.defaultValue,
26
+ onChange = props.onChange,
27
+ onKeyDown = props.onKeyDown,
28
+ rest = (0, _objectWithoutPropertiesLoose2.default)(props, ["format", "value", "defaultValue", "onChange", "onKeyDown"]);
29
+ var inputRef = (0, _react.useRef)();
30
+ var _useState = (0, _react.useState)({
31
+ selectedPattern: 'y',
32
+ selectionStart: 0,
33
+ selectionEnd: 0
34
+ }),
35
+ selectedState = _useState[0],
36
+ setSelectedState = _useState[1];
37
+ var _useCustom = (0, _utils.useCustom)('Calendar'),
38
+ locale = _useCustom.locale;
39
+ var localize = locale.dateLocale.localize;
40
+ var _useControlled = (0, _utils.useControlled)(valueProp, defaultValue),
41
+ value = _useControlled[0],
42
+ setValue = _useControlled[1],
43
+ isControlled = _useControlled[2];
44
+ var _useDateInputState = (0, _useDateInputState2.default)({
45
+ formatStr: formatStr,
46
+ localize: localize,
47
+ date: value,
48
+ isControlledDate: isControlled
49
+ }),
50
+ dateField = _useDateInputState.dateField,
51
+ setDateOffset = _useDateInputState.setDateOffset,
52
+ setDateField = _useDateInputState.setDateField,
53
+ getDateField = _useDateInputState.getDateField,
54
+ toDateString = _useDateInputState.toDateString;
55
+ var dateString = toDateString();
56
+ var keyPressOptions = (0, _react.useMemo)(function () {
57
+ return {
58
+ formatStr: formatStr,
59
+ localize: localize,
60
+ selectedMonth: dateField.month,
61
+ dateString: dateString
62
+ };
63
+ }, [dateField, dateString, formatStr, localize]);
64
+ var setSelectionRange = (0, _react.useCallback)(function (selectionStart, selectionEnd) {
65
+ if (selectionStart === void 0) {
66
+ selectionStart = selectedState.selectionStart;
67
+ }
68
+ if (selectionEnd === void 0) {
69
+ selectionEnd = selectedState.selectionEnd;
70
+ }
71
+ var input = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current;
72
+ if (isTestEnvironment) {
73
+ (0, _utils.safeSetSelection)(input, selectionStart, selectionEnd);
74
+ return;
75
+ }
76
+ requestAnimationFrame(function () {
77
+ (0, _utils.safeSetSelection)(input, selectionStart, selectionEnd);
78
+ });
79
+ }, [selectedState]);
80
+ var handleChange = (0, _react.useCallback)(function (value, event) {
81
+ setValue(value);
82
+ onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
83
+ }, [onChange, setValue]);
84
+ var handleChangeField = (0, _react.useCallback)(function (event, nextDirection) {
85
+ var input = event.target;
86
+ var direction = nextDirection || (event.key === 'ArrowRight' ? 'right' : 'left');
87
+ var state = (0, _utils2.getInputSelectedState)((0, _extends2.default)({}, keyPressOptions, {
88
+ input: input,
89
+ direction: direction
90
+ }));
91
+ setSelectionRange(state.selectionStart, state.selectionEnd);
92
+ setSelectedState(state);
93
+ }, [keyPressOptions, setSelectionRange]);
94
+ var handleChangeFieldValue = (0, _react.useCallback)(function (event) {
95
+ var key = event.key;
96
+ var input = event.target;
97
+ var offset = key === 'ArrowUp' ? 1 : -1;
98
+ var state = (0, _utils2.getInputSelectedState)((0, _extends2.default)({}, keyPressOptions, {
99
+ input: input,
100
+ valueOffset: offset
101
+ }));
102
+ setSelectedState(state);
103
+ setDateOffset(state.selectedPattern, offset, function (date) {
104
+ return handleChange(date, event);
105
+ });
106
+ setSelectionRange(state.selectionStart, state.selectionEnd);
107
+ }, [handleChange, keyPressOptions, setDateOffset, setSelectionRange]);
108
+ var isFieldFullValue = (0, _react.useCallback)(function (value, pattern) {
109
+ var patternGroup = (0, _utils2.getPatternGroups)(formatStr, pattern);
110
+ if (value.toString().length === patternGroup.length) {
111
+ return true;
112
+ }
113
+ switch (pattern) {
114
+ case 'M':
115
+ return parseInt(value + "0") > 12;
116
+ case 'd':
117
+ return parseInt(value + "0") > 31;
118
+ case 'H':
119
+ return parseInt(value + "0") > 23;
120
+ case 'h':
121
+ return parseInt(value + "0") > 12;
122
+ case 'm':
123
+ case 's':
124
+ return parseInt(value + "0") > 59;
125
+ default:
126
+ return false;
127
+ }
128
+ }, [formatStr]);
129
+ var handleChangeFieldValueWithNumericKeys = (0, _react.useCallback)(function (event) {
130
+ var key = event.key;
131
+ var input = event.target;
132
+ var pattern = selectedState.selectedPattern;
133
+ if (!pattern) {
134
+ return;
135
+ }
136
+ var field = getDateField(pattern);
137
+ var value = parseInt(key, 10);
138
+ var padValue = parseInt("" + (field.value || '') + key, 10);
139
+ var newValue = value;
140
+
141
+ // Check if the value entered by the user is a valid date
142
+ if ((0, _utils2.validateDateTime)(field.name, padValue)) {
143
+ newValue = padValue;
144
+ }
145
+ if (pattern === 'M') {
146
+ // Month cannot be less than 1.
147
+ newValue = Math.max(1, newValue);
148
+ }
149
+ setDateField(pattern, newValue, function (date) {
150
+ return handleChange(date, event);
151
+ });
152
+
153
+ // The currently selected month will be retained as a parameter of getInputSelectedState,
154
+ // but if the user enters a month, the month value will be replaced with the value entered by the user.
155
+ var selectedMonth = pattern === 'M' ? newValue : dateField.month;
156
+ var nextState = (0, _utils2.getInputSelectedState)((0, _extends2.default)({}, keyPressOptions, {
157
+ input: input,
158
+ selectedMonth: selectedMonth
159
+ }));
160
+ setSelectedState(nextState);
161
+ setSelectionRange(nextState.selectionStart, nextState.selectionEnd);
162
+
163
+ // If the field is full value, move the cursor to the next field
164
+ if (isFieldFullValue(newValue, pattern) && input.selectionEnd !== input.value.length) {
165
+ handleChangeField(event, 'right');
166
+ }
167
+ }, [dateField, getDateField, handleChange, handleChangeField, isFieldFullValue, keyPressOptions, selectedState.selectedPattern, setDateField, setSelectionRange]);
168
+ var handleRemoveFieldValue = (0, _react.useCallback)(function (event) {
169
+ if (selectedState.selectedPattern) {
170
+ setDateField(selectedState.selectedPattern, null, function (date) {
171
+ return handleChange(date, event);
172
+ });
173
+ setSelectionRange();
174
+ }
175
+ }, [handleChange, selectedState, setDateField, setSelectionRange]);
176
+ var handleKeyDown = function handleKeyDown(event) {
177
+ var _key$match;
178
+ var key = event.key;
179
+ switch (key) {
180
+ case 'ArrowRight':
181
+ case 'ArrowLeft':
182
+ handleChangeField(event);
183
+ event.preventDefault();
184
+ break;
185
+ case 'ArrowUp':
186
+ case 'ArrowDown':
187
+ handleChangeFieldValue(event);
188
+ event.preventDefault();
189
+ break;
190
+ case 'Backspace':
191
+ handleRemoveFieldValue(event);
192
+ event.preventDefault();
193
+ break;
194
+ case (_key$match = key.match(/\d/)) === null || _key$match === void 0 ? void 0 : _key$match.input:
195
+ handleChangeFieldValueWithNumericKeys(event);
196
+ event.preventDefault();
197
+ break;
198
+ }
199
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
200
+ };
201
+ var handleClick = (0, _react.useCallback)(function (event) {
202
+ var input = event.target;
203
+ var state = (0, _utils2.getInputSelectedState)((0, _extends2.default)({}, keyPressOptions, {
204
+ input: input
205
+ }));
206
+ setSelectedState(state);
207
+ setSelectionRange(state.selectionStart, state.selectionEnd);
208
+ }, [keyPressOptions, setSelectionRange]);
209
+ return /*#__PURE__*/_react.default.createElement(_Input.default, (0, _extends2.default)({
210
+ inputMode: "text",
211
+ autoComplete: "off",
212
+ autoCorrect: "off",
213
+ spellCheck: false,
214
+ ref: (0, _utils.mergeRefs)(inputRef, ref),
215
+ onKeyDown: handleKeyDown,
216
+ onClick: handleClick,
217
+ value: dateString
218
+ }, rest));
219
+ });
220
+ DateInput.displayName = 'DateInput';
221
+ var _default = DateInput;
222
+ exports.default = _default;
@@ -0,0 +1,3 @@
1
+ import DateInput from './DateInput';
2
+ export type { DateInputProps } from './DateInput';
3
+ export default DateInput;
@@ -0,0 +1,9 @@
1
+ 'use client';
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+ var _DateInput = _interopRequireDefault(require("./DateInput"));
8
+ var _default = _DateInput.default;
9
+ exports.default = _default;
@@ -0,0 +1,165 @@
1
+ import type { Locale } from 'date-fns';
2
+ interface DateInputState {
3
+ formatStr: string;
4
+ localize: Locale['localize'];
5
+ date?: Date | null;
6
+ isControlledDate?: boolean;
7
+ }
8
+ declare function useDateInputState({ formatStr, localize, date, isControlledDate }: DateInputState): {
9
+ dateField: {
10
+ year: any;
11
+ format: string;
12
+ patternArray: {
13
+ pattern: string;
14
+ key: string;
15
+ }[];
16
+ month: number | null;
17
+ day: number | null;
18
+ hour: number | null;
19
+ minute: number | null;
20
+ second: number | null;
21
+ meridian: "AM" | "PM" | null;
22
+ constructor: Function;
23
+ toString(): string;
24
+ toLocaleString(): string;
25
+ valueOf(): Object;
26
+ hasOwnProperty(v: PropertyKey): boolean;
27
+ isPrototypeOf(v: Object): boolean;
28
+ propertyIsEnumerable(v: PropertyKey): boolean;
29
+ should: Chai.Assertion;
30
+ } | {
31
+ month: any;
32
+ format: string;
33
+ patternArray: {
34
+ pattern: string;
35
+ key: string;
36
+ }[];
37
+ year: number | null;
38
+ day: number | null;
39
+ hour: number | null;
40
+ minute: number | null;
41
+ second: number | null;
42
+ meridian: "AM" | "PM" | null;
43
+ constructor: Function;
44
+ toString(): string;
45
+ toLocaleString(): string;
46
+ valueOf(): Object;
47
+ hasOwnProperty(v: PropertyKey): boolean;
48
+ isPrototypeOf(v: Object): boolean;
49
+ propertyIsEnumerable(v: PropertyKey): boolean;
50
+ should: Chai.Assertion;
51
+ } | {
52
+ day: any;
53
+ format: string;
54
+ patternArray: {
55
+ pattern: string;
56
+ key: string;
57
+ }[];
58
+ year: number | null;
59
+ month: number | null;
60
+ hour: number | null;
61
+ minute: number | null;
62
+ second: number | null;
63
+ meridian: "AM" | "PM" | null;
64
+ constructor: Function;
65
+ toString(): string;
66
+ toLocaleString(): string;
67
+ valueOf(): Object;
68
+ hasOwnProperty(v: PropertyKey): boolean;
69
+ isPrototypeOf(v: Object): boolean;
70
+ propertyIsEnumerable(v: PropertyKey): boolean;
71
+ should: Chai.Assertion;
72
+ } | {
73
+ hour: any;
74
+ format: string;
75
+ patternArray: {
76
+ pattern: string;
77
+ key: string;
78
+ }[];
79
+ year: number | null;
80
+ month: number | null;
81
+ day: number | null;
82
+ minute: number | null;
83
+ second: number | null;
84
+ meridian: "AM" | "PM" | null;
85
+ constructor: Function;
86
+ toString(): string;
87
+ toLocaleString(): string;
88
+ valueOf(): Object;
89
+ hasOwnProperty(v: PropertyKey): boolean;
90
+ isPrototypeOf(v: Object): boolean;
91
+ propertyIsEnumerable(v: PropertyKey): boolean;
92
+ should: Chai.Assertion;
93
+ } | {
94
+ minute: any;
95
+ format: string;
96
+ patternArray: {
97
+ pattern: string;
98
+ key: string;
99
+ }[];
100
+ year: number | null;
101
+ month: number | null;
102
+ day: number | null;
103
+ hour: number | null;
104
+ second: number | null;
105
+ meridian: "AM" | "PM" | null;
106
+ constructor: Function;
107
+ toString(): string;
108
+ toLocaleString(): string;
109
+ valueOf(): Object;
110
+ hasOwnProperty(v: PropertyKey): boolean;
111
+ isPrototypeOf(v: Object): boolean;
112
+ propertyIsEnumerable(v: PropertyKey): boolean;
113
+ should: Chai.Assertion;
114
+ } | {
115
+ second: any;
116
+ format: string;
117
+ patternArray: {
118
+ pattern: string;
119
+ key: string;
120
+ }[];
121
+ year: number | null;
122
+ month: number | null;
123
+ day: number | null;
124
+ hour: number | null;
125
+ minute: number | null;
126
+ meridian: "AM" | "PM" | null;
127
+ constructor: Function;
128
+ toString(): string;
129
+ toLocaleString(): string;
130
+ valueOf(): Object;
131
+ hasOwnProperty(v: PropertyKey): boolean;
132
+ isPrototypeOf(v: Object): boolean;
133
+ propertyIsEnumerable(v: PropertyKey): boolean;
134
+ should: Chai.Assertion;
135
+ } | {
136
+ meridian: any;
137
+ format: string;
138
+ patternArray: {
139
+ pattern: string;
140
+ key: string;
141
+ }[];
142
+ year: number | null;
143
+ month: number | null;
144
+ day: number | null;
145
+ hour: number | null;
146
+ minute: number | null;
147
+ second: number | null;
148
+ constructor: Function;
149
+ toString(): string;
150
+ toLocaleString(): string;
151
+ valueOf(): Object;
152
+ hasOwnProperty(v: PropertyKey): boolean;
153
+ isPrototypeOf(v: Object): boolean;
154
+ propertyIsEnumerable(v: PropertyKey): boolean;
155
+ should: Chai.Assertion;
156
+ };
157
+ setDateOffset: (pattern: string, offset: number, callback?: ((newDate: Date) => void) | undefined) => void;
158
+ setDateField: (pattern: string, value: number | null, callback?: ((newDate: Date) => void) | undefined) => void;
159
+ getDateField: (pattern: string) => {
160
+ name: any;
161
+ value: any;
162
+ };
163
+ toDateString: () => string;
164
+ };
165
+ export default useDateInputState;
@@ -0,0 +1,105 @@
1
+ 'use client';
2
+ "use strict";
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ exports.__esModule = true;
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _startCase = _interopRequireDefault(require("lodash/startCase"));
9
+ var _dateUtils = require("../utils/dateUtils");
10
+ var _DateField = require("./DateField");
11
+ function useDateInputState(_ref) {
12
+ var formatStr = _ref.formatStr,
13
+ localize = _ref.localize,
14
+ date = _ref.date,
15
+ isControlledDate = _ref.isControlledDate;
16
+ var _useDateField = (0, _DateField.useDateField)(formatStr, localize, date),
17
+ dateField = _useDateField.dateField,
18
+ dispatch = _useDateField.dispatch,
19
+ toDateString = _useDateField.toDateString,
20
+ toDate = _useDateField.toDate;
21
+ var setDateOffset = (0, _react.useCallback)(function (pattern, offset, callback) {
22
+ var currentDate = new Date();
23
+ var year = dateField.year || currentDate.getFullYear();
24
+ var month = dateField.month ? dateField.month - 1 : currentDate.getMonth();
25
+ var day = dateField.day || 0;
26
+ var hour = dateField.hour || 0;
27
+ var minute = dateField.minute || 0;
28
+ var second = dateField.second || 0;
29
+ var actionName;
30
+ var value;
31
+ switch (pattern) {
32
+ case 'y':
33
+ actionName = 'setYear';
34
+ value = (0, _dateUtils.addYears)(new Date(year, 0), offset).getFullYear();
35
+ break;
36
+ case 'M':
37
+ actionName = 'setMonth';
38
+ value = (0, _dateUtils.addMonths)(new Date(year, month), offset).getMonth() + 1;
39
+ break;
40
+ case 'd':
41
+ actionName = 'setDay';
42
+ var prevDate = new Date(year, month, day);
43
+ value = (0, _dateUtils.addDays)(prevDate, offset).getDate();
44
+ if (offset > 0) {
45
+ value = (0, _dateUtils.isLastDayOfMonth)(prevDate) ? 1 : value;
46
+ } else {
47
+ value = prevDate.getDate() === 1 ? (0, _dateUtils.lastDayOfMonth)(prevDate).getDate() : value;
48
+ }
49
+ break;
50
+ case 'H':
51
+ case 'h':
52
+ actionName = 'setHour';
53
+ value = (0, _dateUtils.addHours)(new Date(year, month, day, hour), offset).getHours();
54
+ break;
55
+ case 'm':
56
+ actionName = 'setMinute';
57
+ value = (0, _dateUtils.addMinutes)(new Date(year, month, day, hour, minute), offset).getMinutes();
58
+ break;
59
+ case 's':
60
+ actionName = 'setSecond';
61
+ value = (0, _dateUtils.addSeconds)(new Date(year, month, day, hour, minute, second), offset).getSeconds();
62
+ break;
63
+ case 'a':
64
+ actionName = 'setMeridian';
65
+ value = dateField.meridian === 'AM' ? 'PM' : 'AM';
66
+ break;
67
+ }
68
+ if (actionName && value) {
69
+ dispatch({
70
+ type: actionName,
71
+ value: value
72
+ });
73
+ var field = _DateField.patternMap[pattern];
74
+ callback === null || callback === void 0 ? void 0 : callback(toDate(field, value));
75
+ }
76
+ }, [dateField, toDate, dispatch]);
77
+ var setDateField = (0, _react.useCallback)(function (pattern, value, callback) {
78
+ var field = _DateField.patternMap[pattern];
79
+ var actionName = "set" + (0, _startCase.default)(field);
80
+ dispatch({
81
+ type: actionName,
82
+ value: value
83
+ });
84
+ callback === null || callback === void 0 ? void 0 : callback(toDate(field, value));
85
+ }, [toDate, dispatch]);
86
+ var getDateField = (0, _react.useCallback)(function (pattern) {
87
+ var fieldName = _DateField.patternMap[pattern];
88
+ return {
89
+ name: fieldName,
90
+ value: dateField[fieldName]
91
+ };
92
+ }, [dateField]);
93
+ var toControlledDateString = (0, _react.useCallback)(function () {
94
+ return (0, _dateUtils.format)(date || new Date(), formatStr);
95
+ }, [date, formatStr]);
96
+ return {
97
+ dateField: dateField,
98
+ setDateOffset: setDateOffset,
99
+ setDateField: setDateField,
100
+ getDateField: getDateField,
101
+ toDateString: isControlledDate ? toControlledDateString : toDateString
102
+ };
103
+ }
104
+ var _default = useDateInputState;
105
+ exports.default = _default;
@@ -0,0 +1,41 @@
1
+ import { type Locale } from 'date-fns';
2
+ interface SelectedStateOptions {
3
+ /**
4
+ * The input element
5
+ */
6
+ input: HTMLInputElement;
7
+ /**
8
+ * The direction of the arrow key, left or right
9
+ */
10
+ direction?: 'left' | 'right';
11
+ /**
12
+ * Format of the string is based on Unicode Technical Standard: https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
13
+ */
14
+ formatStr: string;
15
+ /**
16
+ * The locale object, date-fns locale object
17
+ */
18
+ localize: Locale['localize'];
19
+ /**
20
+ * The selected month, used to calculate the offset of the character selection range
21
+ */
22
+ selectedMonth: number | null;
23
+ /**
24
+ * The offset of the value, which is used to calculate the month.
25
+ * This value will be changed when pressing the up and down arrow keys.
26
+ */
27
+ valueOffset?: number;
28
+ /**
29
+ * The date is rendered in string format according to format
30
+ */
31
+ dateString: string;
32
+ }
33
+ export declare function getPatternGroups(format: string, pattern: string): string;
34
+ export declare function getInputSelectedState(options: SelectedStateOptions): {
35
+ selectionStart: number;
36
+ selectionEnd: number;
37
+ selectedPattern: string;
38
+ };
39
+ export declare function validateDateTime(type: string, value: number): boolean;
40
+ export declare function modifyDate(date: Date, type: string, value: number): Date;
41
+ export {};