rsuite 5.16.6 → 5.17.0-beta.2

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 (486) hide show
  1. package/Animation/styles/animation.less +0 -0
  2. package/Animation/styles/index.less +0 -0
  3. package/Animation/styles/mixin.less +0 -0
  4. package/AutoComplete/styles/index.less +0 -0
  5. package/Avatar/styles/mixin.less +0 -0
  6. package/Badge/styles/index.less +0 -0
  7. package/Breadcrumb/styles/index.less +0 -0
  8. package/Button/styles/mixin.less +0 -0
  9. package/CHANGELOG.md +6 -0
  10. package/Cascader/styles/index.less +0 -0
  11. package/CheckPicker/styles/index.less +0 -0
  12. package/Checkbox/styles/index.less +0 -0
  13. package/Checkbox/styles/mixin.less +0 -0
  14. package/CheckboxGroup/styles/index.less +0 -0
  15. package/CloseButton/styles/index.less +0 -0
  16. package/Container/styles/index.less +0 -0
  17. package/Content/styles/index.less +0 -0
  18. package/DatePicker/styles/index.less +0 -10
  19. package/DateRangePicker/styles/index.less +12 -5
  20. package/Divider/styles/index.less +0 -0
  21. package/Drawer/styles/mixin.less +0 -0
  22. package/FlexboxGrid/styles/index.less +0 -0
  23. package/Footer/styles/index.less +0 -0
  24. package/Form/styles/index.less +0 -0
  25. package/FormControlLabel/styles/index.less +0 -0
  26. package/FormErrorMessage/styles/animation.less +0 -0
  27. package/FormErrorMessage/styles/index.less +0 -0
  28. package/FormGroup/styles/index.less +0 -0
  29. package/FormHelpText/styles/index.less +0 -0
  30. package/Grid/styles/grid-framework.less +0 -0
  31. package/Grid/styles/mixin.less +0 -0
  32. package/Header/styles/index.less +0 -0
  33. package/Input/styles/index.less +0 -0
  34. package/InputNumber/styles/index.less +0 -0
  35. package/InputNumber/styles/mixin.less +0 -0
  36. package/InputPicker/styles/index.less +0 -0
  37. package/LICENSE +0 -0
  38. package/List/styles/index.less +0 -0
  39. package/Loader/styles/index.less +0 -0
  40. package/Loader/styles/mixin.less +0 -0
  41. package/Message/styles/index.less +0 -0
  42. package/Message/styles/mixin.less +0 -0
  43. package/Modal/styles/animation.less +0 -0
  44. package/Notification/styles/index.less +0 -0
  45. package/Notification/styles/mixin.less +0 -0
  46. package/Pagination/styles/index.less +0 -0
  47. package/Pagination/styles/mixin.less +0 -0
  48. package/Pagination/styles/pagination-group.less +0 -0
  49. package/Panel/styles/index.less +0 -0
  50. package/Placeholder/styles/index.less +0 -0
  51. package/Popover/styles/index.less +0 -0
  52. package/Popover/styles/mixins.less +0 -0
  53. package/Progress/styles/animation.less +0 -0
  54. package/Progress/styles/index.less +0 -0
  55. package/Radio/styles/mixin.less +0 -0
  56. package/RadioGroup/styles/index.less +0 -0
  57. package/Rate/styles/index.less +0 -0
  58. package/Ripple/styles/index.less +0 -0
  59. package/Ripple/styles/mixins.less +0 -0
  60. package/Row/styles/index.less +0 -0
  61. package/SelectPicker/styles/index.less +0 -0
  62. package/Sidebar/styles/index.less +0 -0
  63. package/Sidenav/styles/mixin.less +0 -0
  64. package/Steps/styles/index.less +0 -0
  65. package/Table/styles/mixin.less +0 -0
  66. package/Tag/styles/index.less +0 -0
  67. package/TagInput/styles/index.less +0 -0
  68. package/TagPicker/styles/index.less +0 -0
  69. package/Timeline/styles/index.less +0 -0
  70. package/Timeline/styles/mixin.less +0 -0
  71. package/Tooltip/styles/mixins.less +0 -0
  72. package/TreePicker/styles/mixin.less +0 -0
  73. package/Uploader/styles/mixin.less +0 -0
  74. package/Windowing/package.json +7 -0
  75. package/cjs/@types/global.d.ts +0 -0
  76. package/cjs/Affix/index.js +0 -0
  77. package/cjs/Animation/Bounce.js +0 -0
  78. package/cjs/Animation/Fade.js +0 -0
  79. package/cjs/Animation/Slide.js +0 -0
  80. package/cjs/Animation/index.js +0 -0
  81. package/cjs/Animation/utils.js +0 -0
  82. package/cjs/AutoComplete/index.js +0 -0
  83. package/cjs/Avatar/index.js +0 -0
  84. package/cjs/Badge/index.js +0 -0
  85. package/cjs/Breadcrumb/index.js +0 -0
  86. package/cjs/Button/index.js +0 -0
  87. package/cjs/ButtonToolbar/ButtonToolbar.js +0 -0
  88. package/cjs/ButtonToolbar/index.js +0 -0
  89. package/cjs/Calendar/MonthDropdown.d.ts +1 -0
  90. package/cjs/Calendar/MonthDropdown.js +27 -40
  91. package/cjs/Calendar/index.js +0 -0
  92. package/cjs/Carousel/index.js +0 -0
  93. package/cjs/Cascader/Cascader.d.ts +2 -2
  94. package/cjs/Cascader/DropdownMenu.js +5 -2
  95. package/cjs/Cascader/index.js +0 -0
  96. package/cjs/CheckPicker/CheckPicker.d.ts +2 -2
  97. package/cjs/CheckPicker/CheckPicker.js +4 -1
  98. package/cjs/CheckPicker/index.js +0 -0
  99. package/cjs/CheckTreePicker/CheckTreePicker.js +31 -31
  100. package/cjs/CheckTreePicker/index.js +0 -0
  101. package/cjs/Checkbox/index.js +0 -0
  102. package/cjs/CloseButton/CloseButton.js +0 -0
  103. package/cjs/CloseButton/index.js +0 -0
  104. package/cjs/Col/index.js +0 -0
  105. package/cjs/Container/index.js +0 -0
  106. package/cjs/Content/Content.js +0 -0
  107. package/cjs/Content/index.js +0 -0
  108. package/cjs/CustomProvider/FormattedDate.js +0 -0
  109. package/cjs/CustomProvider/index.js +0 -0
  110. package/cjs/DatePicker/PredefinedRanges.d.ts +13 -0
  111. package/cjs/DatePicker/PredefinedRanges.js +79 -0
  112. package/cjs/DatePicker/Toolbar.d.ts +2 -9
  113. package/cjs/DatePicker/Toolbar.js +45 -62
  114. package/cjs/DatePicker/index.js +0 -0
  115. package/cjs/DateRangePicker/DateRangePicker.js +32 -5
  116. package/cjs/DateRangePicker/disabledDateUtils.js +0 -0
  117. package/cjs/DateRangePicker/types.d.ts +2 -1
  118. package/cjs/Disclosure/Disclosure.d.ts +2 -2
  119. package/cjs/Disclosure/Disclosure.js +6 -6
  120. package/cjs/Disclosure/index.js +0 -0
  121. package/cjs/Divider/index.js +0 -0
  122. package/cjs/Drawer/index.js +0 -0
  123. package/cjs/Dropdown/DropdownState.js +0 -0
  124. package/cjs/Dropdown/index.js +0 -0
  125. package/cjs/FlexboxGrid/index.js +0 -0
  126. package/cjs/Footer/Footer.js +0 -0
  127. package/cjs/Footer/index.js +0 -0
  128. package/cjs/FormControl/index.js +0 -0
  129. package/cjs/FormControlLabel/FormControlLabel.js +0 -0
  130. package/cjs/FormControlLabel/index.js +0 -0
  131. package/cjs/FormErrorMessage/FormErrorMessage.js +0 -0
  132. package/cjs/FormErrorMessage/index.js +0 -0
  133. package/cjs/FormGroup/index.js +0 -0
  134. package/cjs/FormHelpText/index.js +0 -0
  135. package/cjs/Grid/Grid.js +0 -0
  136. package/cjs/Grid/index.js +0 -0
  137. package/cjs/Header/Header.js +0 -0
  138. package/cjs/Header/index.js +0 -0
  139. package/cjs/IconButton/index.js +0 -0
  140. package/cjs/Input/index.js +0 -0
  141. package/cjs/InputGroup/InputGroupButton.js +0 -0
  142. package/cjs/InputGroup/index.js +0 -0
  143. package/cjs/InputNumber/index.js +0 -0
  144. package/cjs/InputPicker/InputPicker.js +4 -1
  145. package/cjs/InputPicker/index.js +0 -0
  146. package/cjs/List/index.js +0 -0
  147. package/cjs/Loader/index.js +0 -0
  148. package/cjs/Menu/MenuContext.js +0 -0
  149. package/cjs/Menu/index.js +0 -0
  150. package/cjs/Message/index.js +0 -0
  151. package/cjs/Modal/ModalFooter.js +0 -0
  152. package/cjs/Modal/index.js +0 -0
  153. package/cjs/MultiCascader/DropdownMenu.js +5 -2
  154. package/cjs/MultiCascader/index.js +0 -0
  155. package/cjs/Nav/index.js +0 -0
  156. package/cjs/Navbar/NavbarBody.js +0 -0
  157. package/cjs/Navbar/NavbarBrand.js +0 -0
  158. package/cjs/Navbar/NavbarDropdownMenu.js +16 -10
  159. package/cjs/Navbar/NavbarHeader.js +0 -0
  160. package/cjs/Notification/index.js +0 -0
  161. package/cjs/Overlay/OverlayTrigger.d.ts +2 -2
  162. package/cjs/Overlay/index.js +0 -0
  163. package/cjs/Pagination/index.js +0 -0
  164. package/cjs/Panel/index.js +0 -0
  165. package/cjs/PanelGroup/index.js +0 -0
  166. package/cjs/Picker/DropdownMenu.d.ts +2 -1
  167. package/cjs/Picker/DropdownMenu.js +39 -33
  168. package/cjs/Picker/PickerOverlay.d.ts +2 -2
  169. package/cjs/Picker/PickerToggleTrigger.d.ts +2 -2
  170. package/cjs/Picker/index.d.ts +3 -3
  171. package/cjs/Picker/types.d.ts +7 -5
  172. package/cjs/Picker/utils.d.ts +11 -12
  173. package/cjs/Picker/utils.js +4 -0
  174. package/cjs/Placeholder/Placeholder.js +0 -0
  175. package/cjs/Placeholder/index.js +0 -0
  176. package/cjs/Plaintext/index.js +0 -0
  177. package/cjs/Popover/index.js +0 -0
  178. package/cjs/Progress/Progress.js +0 -0
  179. package/cjs/Progress/index.js +0 -0
  180. package/cjs/Radio/index.js +0 -0
  181. package/cjs/RadioGroup/index.js +0 -0
  182. package/cjs/RangeSlider/index.js +0 -0
  183. package/cjs/Rate/index.js +0 -0
  184. package/cjs/Ripple/index.js +0 -0
  185. package/cjs/Row/Row.js +0 -0
  186. package/cjs/Row/index.js +0 -0
  187. package/cjs/SafeAnchor/index.js +0 -0
  188. package/cjs/Schema/Schema.js +0 -0
  189. package/cjs/Schema/index.js +0 -0
  190. package/cjs/SelectPicker/SelectPicker.d.ts +4 -5
  191. package/cjs/SelectPicker/SelectPicker.js +4 -1
  192. package/cjs/Sidebar/index.js +0 -0
  193. package/cjs/Sidenav/SidenavBody.js +0 -0
  194. package/cjs/Sidenav/SidenavHeader.js +0 -0
  195. package/cjs/Sidenav/index.js +0 -0
  196. package/cjs/Slider/index.js +0 -0
  197. package/cjs/Steps/index.js +0 -0
  198. package/cjs/Table/index.js +0 -0
  199. package/cjs/Tag/Tag.js +0 -0
  200. package/cjs/Tag/index.js +0 -0
  201. package/cjs/TagGroup/TagGroup.js +0 -0
  202. package/cjs/TagGroup/index.js +0 -0
  203. package/cjs/Timeline/index.js +0 -0
  204. package/cjs/Toggle/index.js +0 -0
  205. package/cjs/Tooltip/index.js +0 -0
  206. package/cjs/Tree/Tree.d.ts +2 -5
  207. package/cjs/Tree/index.js +0 -0
  208. package/cjs/TreePicker/TreePicker.js +34 -34
  209. package/cjs/TreePicker/index.js +0 -0
  210. package/cjs/TreePicker/test/TreePicker.test.js +14 -0
  211. package/cjs/Whisper/Whisper.d.ts +3 -3
  212. package/cjs/Whisper/index.js +0 -0
  213. package/cjs/Windowing/AutoSizer.d.ts +25 -0
  214. package/cjs/Windowing/AutoSizer.js +107 -0
  215. package/cjs/Windowing/List.d.ts +45 -0
  216. package/cjs/Windowing/List.js +72 -0
  217. package/cjs/Windowing/index.d.ts +5 -0
  218. package/cjs/Windowing/index.js +19 -0
  219. package/cjs/index.d.ts +1 -0
  220. package/cjs/locales/ar_EG.js +0 -0
  221. package/cjs/locales/da_DK.js +0 -0
  222. package/cjs/locales/de_DE.js +0 -0
  223. package/cjs/locales/default.js +0 -0
  224. package/cjs/locales/en_GB.js +0 -0
  225. package/cjs/locales/en_US.js +0 -0
  226. package/cjs/locales/es_AR.js +0 -0
  227. package/cjs/locales/es_ES.js +0 -0
  228. package/cjs/locales/fi_FI.js +0 -0
  229. package/cjs/locales/it_IT.js +0 -0
  230. package/cjs/locales/ko_KR.js +0 -0
  231. package/cjs/locales/pt_BR.js +0 -0
  232. package/cjs/locales/ru_RU.js +0 -0
  233. package/cjs/locales/sv_SE.js +0 -0
  234. package/cjs/locales/zh_CN.js +0 -0
  235. package/cjs/locales/zh_TW.js +0 -0
  236. package/cjs/toaster/ToastContainer.d.ts +2 -1
  237. package/cjs/toaster/ToastContainer.js +27 -26
  238. package/cjs/toaster/toaster.d.ts +1 -1
  239. package/cjs/toaster/toaster.js +43 -13
  240. package/cjs/toaster/useToaster.d.ts +1 -1
  241. package/cjs/utils/clone.js +0 -0
  242. package/cjs/utils/events.js +0 -0
  243. package/cjs/utils/getDOMNode.js +0 -0
  244. package/cjs/utils/getSafeRegExpString.js +0 -0
  245. package/cjs/utils/guid.js +0 -0
  246. package/cjs/utils/htmlPropsUtils.js +0 -0
  247. package/cjs/utils/index.d.ts +1 -0
  248. package/cjs/utils/index.js +6 -1
  249. package/cjs/utils/isOneOf.js +0 -0
  250. package/cjs/utils/prefix.js +0 -0
  251. package/cjs/utils/render.d.ts +3 -0
  252. package/cjs/utils/render.js +49 -0
  253. package/cjs/utils/shallowEqual.js +0 -0
  254. package/cjs/utils/shallowEqualArray.js +0 -0
  255. package/cjs/utils/statusIcons.js +0 -0
  256. package/cjs/utils/stringToObject.js +0 -0
  257. package/cjs/utils/tplTransform.js +0 -0
  258. package/cjs/utils/treeUtils.d.ts +2 -2
  259. package/cjs/utils/useClassNames.js +0 -0
  260. package/cjs/utils/useEnsuredRef.js +0 -0
  261. package/cjs/utils/useEventCallback.js +0 -0
  262. package/cjs/utils/useToggleCaret.js +0 -0
  263. package/cjs/utils/useUniqueId.js +10 -2
  264. package/cjs/utils/useUpdateEffect.js +0 -0
  265. package/cjs/utils/useUpdatedRef.js +0 -0
  266. package/cjs/utils/useWillUnmount.js +0 -0
  267. package/dist/rsuite-rtl.css +10 -18
  268. package/dist/rsuite-rtl.min.css +1 -1
  269. package/dist/rsuite-rtl.min.css.map +1 -1
  270. package/dist/rsuite.css +10 -18
  271. package/dist/rsuite.js +301 -528
  272. package/dist/rsuite.js.map +1 -1
  273. package/dist/rsuite.min.css +1 -1
  274. package/dist/rsuite.min.css.map +1 -1
  275. package/dist/rsuite.min.js +1 -1
  276. package/dist/rsuite.min.js.LICENSE.txt +2 -0
  277. package/dist/rsuite.min.js.map +1 -1
  278. package/esm/@types/global.d.ts +0 -0
  279. package/esm/Affix/index.js +0 -0
  280. package/esm/Animation/Bounce.js +0 -0
  281. package/esm/Animation/Fade.js +0 -0
  282. package/esm/Animation/Slide.js +0 -0
  283. package/esm/Animation/index.js +0 -0
  284. package/esm/Animation/utils.js +0 -0
  285. package/esm/AutoComplete/index.js +0 -0
  286. package/esm/Avatar/index.js +0 -0
  287. package/esm/Badge/index.js +0 -0
  288. package/esm/Breadcrumb/index.js +0 -0
  289. package/esm/Button/index.js +0 -0
  290. package/esm/ButtonToolbar/ButtonToolbar.js +0 -0
  291. package/esm/ButtonToolbar/index.js +0 -0
  292. package/esm/Calendar/MonthDropdown.d.ts +1 -0
  293. package/esm/Calendar/MonthDropdown.js +26 -41
  294. package/esm/Calendar/index.js +0 -0
  295. package/esm/Carousel/index.js +0 -0
  296. package/esm/Cascader/Cascader.d.ts +2 -2
  297. package/esm/Cascader/DropdownMenu.js +5 -2
  298. package/esm/Cascader/index.js +0 -0
  299. package/esm/CheckPicker/CheckPicker.d.ts +2 -2
  300. package/esm/CheckPicker/CheckPicker.js +4 -1
  301. package/esm/CheckPicker/index.js +0 -0
  302. package/esm/CheckTreePicker/CheckTreePicker.js +31 -30
  303. package/esm/CheckTreePicker/index.js +0 -0
  304. package/esm/Checkbox/index.js +0 -0
  305. package/esm/CloseButton/CloseButton.js +0 -0
  306. package/esm/CloseButton/index.js +0 -0
  307. package/esm/Col/index.js +0 -0
  308. package/esm/Container/index.js +0 -0
  309. package/esm/Content/Content.js +0 -0
  310. package/esm/Content/index.js +0 -0
  311. package/esm/CustomProvider/FormattedDate.js +0 -0
  312. package/esm/CustomProvider/index.js +0 -0
  313. package/esm/DatePicker/PredefinedRanges.d.ts +13 -0
  314. package/esm/DatePicker/PredefinedRanges.js +62 -0
  315. package/esm/DatePicker/Toolbar.d.ts +2 -9
  316. package/esm/DatePicker/Toolbar.js +45 -61
  317. package/esm/DatePicker/index.js +0 -0
  318. package/esm/DateRangePicker/DateRangePicker.js +30 -5
  319. package/esm/DateRangePicker/disabledDateUtils.js +0 -0
  320. package/esm/DateRangePicker/types.d.ts +2 -1
  321. package/esm/Disclosure/Disclosure.d.ts +2 -2
  322. package/esm/Disclosure/Disclosure.js +6 -6
  323. package/esm/Disclosure/index.js +0 -0
  324. package/esm/Divider/index.js +0 -0
  325. package/esm/Drawer/index.js +0 -0
  326. package/esm/Dropdown/DropdownState.js +0 -0
  327. package/esm/Dropdown/index.js +0 -0
  328. package/esm/FlexboxGrid/index.js +0 -0
  329. package/esm/Footer/Footer.js +0 -0
  330. package/esm/Footer/index.js +0 -0
  331. package/esm/FormControl/index.js +0 -0
  332. package/esm/FormControlLabel/FormControlLabel.js +0 -0
  333. package/esm/FormControlLabel/index.js +0 -0
  334. package/esm/FormErrorMessage/FormErrorMessage.js +0 -0
  335. package/esm/FormErrorMessage/index.js +0 -0
  336. package/esm/FormGroup/index.js +0 -0
  337. package/esm/FormHelpText/index.js +0 -0
  338. package/esm/Grid/Grid.js +0 -0
  339. package/esm/Grid/index.js +0 -0
  340. package/esm/Header/Header.js +0 -0
  341. package/esm/Header/index.js +0 -0
  342. package/esm/IconButton/index.js +0 -0
  343. package/esm/Input/index.js +0 -0
  344. package/esm/InputGroup/InputGroupButton.js +0 -0
  345. package/esm/InputGroup/index.js +0 -0
  346. package/esm/InputNumber/index.js +0 -0
  347. package/esm/InputPicker/InputPicker.js +4 -1
  348. package/esm/InputPicker/index.js +0 -0
  349. package/esm/List/index.js +0 -0
  350. package/esm/Loader/index.js +0 -0
  351. package/esm/Menu/MenuContext.js +0 -0
  352. package/esm/Menu/index.js +0 -0
  353. package/esm/Message/index.js +0 -0
  354. package/esm/Modal/ModalFooter.js +0 -0
  355. package/esm/Modal/index.js +0 -0
  356. package/esm/MultiCascader/DropdownMenu.js +5 -2
  357. package/esm/MultiCascader/index.js +0 -0
  358. package/esm/Nav/index.js +0 -0
  359. package/esm/Navbar/NavbarBody.js +0 -0
  360. package/esm/Navbar/NavbarBrand.js +0 -0
  361. package/esm/Navbar/NavbarDropdownMenu.js +14 -8
  362. package/esm/Navbar/NavbarHeader.js +0 -0
  363. package/esm/Notification/index.js +0 -0
  364. package/esm/Overlay/OverlayTrigger.d.ts +2 -2
  365. package/esm/Overlay/index.js +0 -0
  366. package/esm/Pagination/index.js +0 -0
  367. package/esm/Panel/index.js +0 -0
  368. package/esm/PanelGroup/index.js +0 -0
  369. package/esm/Picker/DropdownMenu.d.ts +2 -1
  370. package/esm/Picker/DropdownMenu.js +39 -35
  371. package/esm/Picker/PickerOverlay.d.ts +2 -2
  372. package/esm/Picker/PickerToggleTrigger.d.ts +2 -2
  373. package/esm/Picker/index.d.ts +3 -3
  374. package/esm/Picker/types.d.ts +7 -5
  375. package/esm/Picker/utils.d.ts +11 -12
  376. package/esm/Picker/utils.js +4 -0
  377. package/esm/Placeholder/Placeholder.js +0 -0
  378. package/esm/Placeholder/index.js +0 -0
  379. package/esm/Plaintext/index.js +0 -0
  380. package/esm/Popover/index.js +0 -0
  381. package/esm/Progress/Progress.js +0 -0
  382. package/esm/Progress/index.js +0 -0
  383. package/esm/Radio/index.js +0 -0
  384. package/esm/RadioGroup/index.js +0 -0
  385. package/esm/RangeSlider/index.js +0 -0
  386. package/esm/Rate/index.js +0 -0
  387. package/esm/Ripple/index.js +0 -0
  388. package/esm/Row/Row.js +0 -0
  389. package/esm/Row/index.js +0 -0
  390. package/esm/SafeAnchor/index.js +0 -0
  391. package/esm/Schema/Schema.js +0 -0
  392. package/esm/Schema/index.js +0 -0
  393. package/esm/SelectPicker/SelectPicker.d.ts +4 -5
  394. package/esm/SelectPicker/SelectPicker.js +4 -1
  395. package/esm/Sidebar/index.js +0 -0
  396. package/esm/Sidenav/SidenavBody.js +0 -0
  397. package/esm/Sidenav/SidenavHeader.js +0 -0
  398. package/esm/Sidenav/index.js +0 -0
  399. package/esm/Slider/index.js +0 -0
  400. package/esm/Steps/index.js +0 -0
  401. package/esm/Table/index.js +0 -0
  402. package/esm/Tag/Tag.js +0 -0
  403. package/esm/Tag/index.js +0 -0
  404. package/esm/TagGroup/TagGroup.js +0 -0
  405. package/esm/TagGroup/index.js +0 -0
  406. package/esm/Timeline/index.js +0 -0
  407. package/esm/Toggle/index.js +0 -0
  408. package/esm/Tooltip/index.js +0 -0
  409. package/esm/Tree/Tree.d.ts +2 -5
  410. package/esm/Tree/index.js +0 -0
  411. package/esm/TreePicker/TreePicker.js +33 -32
  412. package/esm/TreePicker/index.js +0 -0
  413. package/esm/TreePicker/test/TreePicker.test.js +14 -0
  414. package/esm/Whisper/Whisper.d.ts +3 -3
  415. package/esm/Whisper/index.js +0 -0
  416. package/esm/Windowing/AutoSizer.d.ts +25 -0
  417. package/esm/Windowing/AutoSizer.js +92 -0
  418. package/esm/Windowing/List.d.ts +45 -0
  419. package/esm/Windowing/List.js +58 -0
  420. package/esm/Windowing/index.d.ts +5 -0
  421. package/esm/Windowing/index.js +3 -0
  422. package/esm/index.d.ts +1 -0
  423. package/esm/locales/ar_EG.js +0 -0
  424. package/esm/locales/da_DK.js +0 -0
  425. package/esm/locales/de_DE.js +0 -0
  426. package/esm/locales/default.js +0 -0
  427. package/esm/locales/en_GB.js +0 -0
  428. package/esm/locales/en_US.js +0 -0
  429. package/esm/locales/es_AR.js +0 -0
  430. package/esm/locales/es_ES.js +0 -0
  431. package/esm/locales/fi_FI.js +0 -0
  432. package/esm/locales/it_IT.js +0 -0
  433. package/esm/locales/ko_KR.js +0 -0
  434. package/esm/locales/pt_BR.js +0 -0
  435. package/esm/locales/ru_RU.js +0 -0
  436. package/esm/locales/sv_SE.js +0 -0
  437. package/esm/locales/zh_CN.js +0 -0
  438. package/esm/locales/zh_TW.js +0 -0
  439. package/esm/toaster/ToastContainer.d.ts +2 -1
  440. package/esm/toaster/ToastContainer.js +28 -26
  441. package/esm/toaster/toaster.d.ts +1 -1
  442. package/esm/toaster/toaster.js +41 -13
  443. package/esm/toaster/useToaster.d.ts +1 -1
  444. package/esm/utils/clone.js +0 -0
  445. package/esm/utils/events.js +0 -0
  446. package/esm/utils/getDOMNode.js +0 -0
  447. package/esm/utils/getSafeRegExpString.js +0 -0
  448. package/esm/utils/guid.js +0 -0
  449. package/esm/utils/htmlPropsUtils.js +0 -0
  450. package/esm/utils/index.d.ts +1 -0
  451. package/esm/utils/index.js +1 -0
  452. package/esm/utils/isOneOf.js +0 -0
  453. package/esm/utils/prefix.js +0 -0
  454. package/esm/utils/render.d.ts +3 -0
  455. package/esm/utils/render.js +37 -0
  456. package/esm/utils/shallowEqual.js +0 -0
  457. package/esm/utils/shallowEqualArray.js +0 -0
  458. package/esm/utils/statusIcons.js +0 -0
  459. package/esm/utils/stringToObject.js +0 -0
  460. package/esm/utils/tplTransform.js +0 -0
  461. package/esm/utils/treeUtils.d.ts +2 -2
  462. package/esm/utils/useClassNames.js +0 -0
  463. package/esm/utils/useEnsuredRef.js +0 -0
  464. package/esm/utils/useEventCallback.js +0 -0
  465. package/esm/utils/useToggleCaret.js +0 -0
  466. package/esm/utils/useUniqueId.js +7 -2
  467. package/esm/utils/useUpdateEffect.js +0 -0
  468. package/esm/utils/useUpdatedRef.js +0 -0
  469. package/esm/utils/useWillUnmount.js +0 -0
  470. package/package.json +5 -5
  471. package/styles/color-modes.less +0 -0
  472. package/styles/colors/light.less +0 -0
  473. package/styles/common.less +0 -0
  474. package/styles/mixins/color-modes.less +0 -0
  475. package/styles/mixins/hacks.less +0 -0
  476. package/styles/mixins/listbox.less +0 -0
  477. package/styles/mixins/menu.less +0 -0
  478. package/styles/normalize.less +0 -0
  479. package/styles/scaffolding.less +0 -0
  480. package/styles/typography.less +0 -0
  481. package/toaster/styles/animation.less +0 -0
  482. package/toaster/styles/index.less +0 -0
  483. package/cjs/Picker/VirtualizedList.d.ts +0 -37
  484. package/cjs/Picker/VirtualizedList.js +0 -15
  485. package/esm/Picker/VirtualizedList.d.ts +0 -37
  486. package/esm/Picker/VirtualizedList.js +0 -4
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { RsRefForwardingComponent, WithAsProps } from '../@types/common';
3
3
  export interface MonthDropdownProps extends WithAsProps {
4
4
  show?: boolean;
5
+ limitStartYear?: number;
5
6
  limitEndYear?: number;
6
7
  height?: number;
7
8
  width?: number;
@@ -1,35 +1,19 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import React, { useCallback } from 'react';
3
+ import React, { useCallback, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import { AutoSizer, List } from '../Picker/VirtualizedList';
5
+ import { AutoSizer, FixedSizeList } from '../Windowing';
6
6
  import { DateUtils, useClassNames } from '../utils';
7
7
  import MonthDropdownItem from './MonthDropdownItem';
8
8
  import { useCalendarContext } from './CalendarContext';
9
9
  var monthMap = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
10
- /**
11
- * Set the row height.
12
- * Add 1px to the first and last lines.
13
- */
14
-
15
- function getRowHeight(count) {
16
- return function (_ref) {
17
- var index = _ref.index;
18
-
19
- if (index === 0 || count - 1 === index) {
20
- return 75 + 1;
21
- }
22
-
23
- return 75;
24
- };
25
- }
26
-
27
10
  var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
28
11
  var _props$as = props.as,
29
12
  Component = _props$as === void 0 ? 'div' : _props$as,
30
13
  className = props.className,
31
14
  _props$classPrefix = props.classPrefix,
32
15
  classPrefix = _props$classPrefix === void 0 ? 'calendar-month-dropdown' : _props$classPrefix,
16
+ limitStartYear = props.limitStartYear,
33
17
  _props$limitEndYear = props.limitEndYear,
34
18
  limitEndYear = _props$limitEndYear === void 0 ? 5 : _props$limitEndYear,
35
19
  show = props.show,
@@ -38,7 +22,7 @@ var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
38
22
  _props$width = props.width,
39
23
  defaultWidth = _props$width === void 0 ? 256 : _props$width,
40
24
  disabledMonth = props.disabledMonth,
41
- rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "limitEndYear", "show", "height", "width", "disabledMonth"]);
25
+ rest = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "limitStartYear", "limitEndYear", "show", "height", "width", "disabledMonth"]);
42
26
 
43
27
  var _useCalendarContext = useCalendarContext(),
44
28
  _useCalendarContext$d = _useCalendarContext.date,
@@ -49,9 +33,12 @@ var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
49
33
  merge = _useClassNames.merge,
50
34
  withClassPrefix = _useClassNames.withClassPrefix;
51
35
 
52
- var getRowCount = useCallback(function () {
53
- return DateUtils.getYear(new Date()) + limitEndYear;
54
- }, [limitEndYear]);
36
+ var thisYear = DateUtils.getYear(new Date());
37
+ var startYear = limitStartYear ? thisYear - limitStartYear : 1900;
38
+ var rowCount = useMemo(function () {
39
+ var endYear = thisYear + limitEndYear;
40
+ return endYear - startYear;
41
+ }, [limitEndYear, startYear, thisYear]);
55
42
  var isMonthDisabled = useCallback(function (year, month) {
56
43
  if (disabledMonth) {
57
44
  var days = DateUtils.getDaysInMonth(new Date(year, month)); // If all dates in a month are disabled, disable the current month
@@ -68,26 +55,23 @@ var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
68
55
  return false;
69
56
  }, [disabledMonth]);
70
57
 
71
- var rowRenderer = function rowRenderer(_ref2) {
72
- var index = _ref2.index,
73
- key = _ref2.key,
74
- style = _ref2.style;
58
+ var rowRenderer = function rowRenderer(_ref) {
59
+ var index = _ref.index,
60
+ style = _ref.style;
75
61
  var selectedMonth = DateUtils.getMonth(date);
76
62
  var selectedYear = DateUtils.getYear(date);
77
- var year = index + 1;
63
+ var year = startYear + index;
78
64
  var isSelectedYear = year === selectedYear;
79
- var count = getRowCount();
80
65
  var titleClassName = prefix('year', {
81
66
  'year-active': isSelectedYear
82
67
  });
83
68
  var rowClassName = merge(prefix('row'), {
84
69
  'first-row': index === 0,
85
- 'last-row': index === count - 1
70
+ 'last-row': index === rowCount - 1
86
71
  });
87
72
  return /*#__PURE__*/React.createElement("div", {
88
73
  className: rowClassName,
89
74
  role: "row",
90
- key: key,
91
75
  style: style
92
76
  }, /*#__PURE__*/React.createElement("div", {
93
77
  className: titleClassName,
@@ -106,10 +90,12 @@ var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
106
90
  })));
107
91
  };
108
92
 
109
- var count = getRowCount();
110
93
  var classes = merge(className, withClassPrefix(), {
111
94
  show: show
112
95
  });
96
+ var itemSize = 75;
97
+ var initialItemIndex = DateUtils.getYear(date) - startYear;
98
+ var initialScrollOffset = itemSize * initialItemIndex;
113
99
  return /*#__PURE__*/React.createElement(Component, _extends({
114
100
  role: "menu"
115
101
  }, rest, {
@@ -122,18 +108,17 @@ var MonthDropdown = /*#__PURE__*/React.forwardRef(function (props, ref) {
122
108
  }, show && /*#__PURE__*/React.createElement(AutoSizer, {
123
109
  defaultHeight: defaultHeight,
124
110
  defaultWidth: defaultWidth
125
- }, function (_ref3) {
126
- var height = _ref3.height,
127
- width = _ref3.width;
128
- return /*#__PURE__*/React.createElement(List, {
111
+ }, function (_ref2) {
112
+ var height = _ref2.height,
113
+ width = _ref2.width;
114
+ return /*#__PURE__*/React.createElement(FixedSizeList, {
129
115
  className: prefix('row-wrapper'),
130
116
  width: width || defaultWidth,
131
117
  height: height || defaultHeight,
132
- rowHeight: getRowHeight(count),
133
- rowCount: count,
134
- scrollToIndex: DateUtils.getYear(date),
135
- rowRenderer: rowRenderer
136
- });
118
+ itemSize: itemSize,
119
+ itemCount: rowCount,
120
+ initialScrollOffset: initialScrollOffset
121
+ }, rowRenderer);
137
122
  }))));
138
123
  });
139
124
  MonthDropdown.displayName = 'MonthDropdown';
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { PickerLocale } from '../locales';
3
- import { PickerInstance } from '../Picker';
3
+ import { PickerHandle } from '../Picker';
4
4
  import { ItemDataType, FormControlPickerProps } from '../@types/common';
5
5
  export declare type ValueType = number | string;
6
6
  export interface CascaderProps<T = ValueType> extends FormControlPickerProps<T | null, PickerLocale, ItemDataType<T>> {
@@ -33,7 +33,7 @@ export interface CascaderProps<T = ValueType> extends FormControlPickerProps<T |
33
33
  }
34
34
  export interface CascaderComponent {
35
35
  <T>(props: CascaderProps<T> & {
36
- ref?: React.Ref<PickerInstance>;
36
+ ref?: React.Ref<PickerHandle>;
37
37
  }): JSX.Element | null;
38
38
  displayName?: string;
39
39
  propTypes?: React.WeakValidationMap<CascaderProps<any>>;
@@ -45,7 +45,10 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
45
45
 
46
46
  var classes = merge(className, prefix('items'));
47
47
  var rootRef = useRef();
48
- var rtl = useCustom('DropdownMenu');
48
+
49
+ var _useCustom = useCustom('DropdownMenu'),
50
+ rtl = _useCustom.rtl;
51
+
49
52
  useEffect(function () {
50
53
  var _rootRef$current;
51
54
 
@@ -96,7 +99,7 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
96
99
  }); // Use `value` in keys when If `value` is string or number
97
100
 
98
101
  var onlyKey = typeof value === 'number' || typeof value === 'string' ? value : index;
99
- var Icon = node.loading ? SpinnerIcon : rtl ? AngleRightIcon : AngleLeftIcon;
102
+ var Icon = node.loading ? SpinnerIcon : rtl ? AngleLeftIcon : AngleRightIcon;
100
103
  return /*#__PURE__*/React.createElement(DropdownMenuItem, {
101
104
  classPrefix: "picker-cascader-menu-item",
102
105
  as: 'li',
File without changes
@@ -1,6 +1,6 @@
1
1
  import React, { Ref } from 'react';
2
2
  import { PickerLocale } from '../locales';
3
- import { PickerInstance, PickerToggleProps } from '../Picker';
3
+ import { PickerHandle, PickerToggleProps } from '../Picker';
4
4
  import { ItemDataType, FormControlPickerProps } from '../@types/common';
5
5
  import type { MultipleSelectProps } from '../SelectPicker';
6
6
  export declare type ValueType = (number | string)[];
@@ -12,7 +12,7 @@ export interface CheckPickerProps<T> extends FormControlPickerProps<T[], PickerL
12
12
  }
13
13
  export interface CheckPickerComponent {
14
14
  <T>(props: CheckPickerProps<T> & {
15
- ref?: Ref<PickerInstance>;
15
+ ref?: Ref<PickerHandle>;
16
16
  }): JSX.Element | null;
17
17
  displayName?: string;
18
18
  propTypes?: React.WeakValidationMap<CheckPickerProps<any>>;
@@ -81,6 +81,7 @@ var CheckPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
81
81
  var targetRef = useRef(null);
82
82
  var overlayRef = useRef(null);
83
83
  var searchInputRef = useRef(null);
84
+ var listRef = useRef(null);
84
85
 
85
86
  var _useCustom = useCustom('Picker', overrideLocale),
86
87
  locale = _useCustom.locale;
@@ -235,7 +236,8 @@ var CheckPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
235
236
  usePublicMethods(ref, {
236
237
  triggerRef: triggerRef,
237
238
  overlayRef: overlayRef,
238
- targetRef: targetRef
239
+ targetRef: targetRef,
240
+ listRef: listRef
239
241
  });
240
242
  var selectedItems = data.filter(function (item) {
241
243
  return value === null || value === void 0 ? void 0 : value.some(function (val) {
@@ -308,6 +310,7 @@ var CheckPicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
308
310
  var menu = items.length || filteredStickyItems.length ? /*#__PURE__*/React.createElement(DropdownMenu, {
309
311
  id: id ? id + "-listbox" : undefined,
310
312
  listProps: listProps,
313
+ listRef: listRef,
311
314
  disabledItemValues: disabledItemValues,
312
315
  valueKey: valueKey,
313
316
  labelKey: labelKey,
File without changes
@@ -9,7 +9,7 @@ import _isNil from "lodash/isNil";
9
9
  import React, { useState, useRef, useEffect, useCallback, useContext } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import classNames from 'classnames';
12
- import { List, AutoSizer } from '../Picker/VirtualizedList';
12
+ import { List, AutoSizer } from '../Windowing';
13
13
  import CheckTreeNode from './CheckTreeNode';
14
14
  import TreeContext from '../Tree/TreeContext';
15
15
  import { getTreeNodeIndent } from '../utils/treeUtils';
@@ -19,6 +19,11 @@ import { isEveryChildChecked, isSomeNodeHasChildren, isAllSiblingNodeUncheckable
19
19
  import { hasVisibleChildren, getExpandWhenSearching, useTreeSearch, useTreeNodeRefs, getDefaultExpandItemValues, useFlattenTreeData, focusNextItem, getFocusableItems, focusPreviousItem, toggleExpand, getActiveItem, useGetTreeNodeChildren, focusToActiveTreeNode, focusTreeNode, leftArrowHandler, rightArrowHandler, isSearching } from '../utils/treeUtils';
20
20
  import { maxTreeHeight } from '../TreePicker/TreePicker';
21
21
  var emptyArray = [];
22
+
23
+ var itemSize = function itemSize() {
24
+ return 36;
25
+ };
26
+
22
27
  var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
23
28
  var _props$as = props.as,
24
29
  Component = _props$as === void 0 ? 'div' : _props$as,
@@ -608,31 +613,28 @@ var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
608
613
  }, nodeProps));
609
614
  };
610
615
 
611
- var renderVirtualListNode = function renderVirtualListNode(nodes) {
612
- return function (_ref3) {
613
- var key = _ref3.key,
614
- index = _ref3.index,
615
- style = _ref3.style;
616
- var node = nodes[index];
617
- var layer = node.layer,
618
- refKey = node.refKey,
619
- visible = node.visible;
620
- var expand = getExpandWhenSearching(searchKeywordState, expandItemValues.includes(node[valueKey]));
621
-
622
- var nodeProps = _extends({}, getTreeNodeProps(_extends({}, node, {
623
- expand: expand
624
- }), layer), {
625
- hasChildren: node.hasChildren
626
- });
616
+ var renderVirtualListNode = function renderVirtualListNode(_ref3) {
617
+ var index = _ref3.index,
618
+ style = _ref3.style,
619
+ data = _ref3.data;
620
+ var node = data[index];
621
+ var layer = node.layer,
622
+ refKey = node.refKey,
623
+ visible = node.visible;
624
+ var expand = getExpandWhenSearching(searchKeywordState, expandItemValues.includes(node[valueKey]));
627
625
 
628
- return visible && /*#__PURE__*/React.createElement(CheckTreeNode, _extends({
629
- style: style,
630
- key: key,
631
- ref: function ref(_ref4) {
632
- return saveTreeNodeRef(_ref4, refKey);
633
- }
634
- }, nodeProps));
635
- };
626
+ var nodeProps = _extends({}, getTreeNodeProps(_extends({}, node, {
627
+ expand: expand
628
+ }), layer), {
629
+ hasChildren: node.hasChildren
630
+ });
631
+
632
+ return visible && /*#__PURE__*/React.createElement(CheckTreeNode, _extends({
633
+ style: style,
634
+ ref: function ref(_ref4) {
635
+ return saveTreeNodeRef(_ref4, refKey);
636
+ }
637
+ }, nodeProps));
636
638
  };
637
639
 
638
640
  var renderCheckTree = function renderCheckTree() {
@@ -677,11 +679,10 @@ var CheckTreePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
677
679
  ref: listRef,
678
680
  width: width,
679
681
  height: height,
680
- rowHeight: 36,
681
- rowCount: formattedNodes.length,
682
- rowRenderer: renderVirtualListNode(formattedNodes),
683
- scrollToAlignment: "center"
684
- }, listProps));
682
+ itemSize: itemSize,
683
+ itemCount: formattedNodes.length,
684
+ itemData: formattedNodes
685
+ }, listProps), renderVirtualListNode);
685
686
  }) : formattedNodes));
686
687
  };
687
688
 
File without changes
File without changes
File without changes
File without changes
package/esm/Col/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { StackProps } from '../Stack';
3
+ import { RangeType } from './types';
4
+ import { CalendarLocale } from '../locales';
5
+ export interface PredefinedRangesProps<T = any, Shortcut = T> extends StackProps {
6
+ ranges?: RangeType<Shortcut>[];
7
+ calendarDate: T;
8
+ locale: CalendarLocale;
9
+ disabledShortcut?: (value: T) => boolean;
10
+ onClickShortcut?: (value: Shortcut, closeOverlay: boolean, event: React.MouseEvent) => void;
11
+ }
12
+ declare const PredefinedRanges: React.ForwardRefExoticComponent<PredefinedRangesProps<any, any> & React.RefAttributes<HTMLDivElement>>;
13
+ export default PredefinedRanges;
@@ -0,0 +1,62 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ import React, { useCallback, useState } from 'react';
4
+ import Button from '../Button';
5
+ import Stack from '../Stack';
6
+ import { useUpdateEffect } from '../utils';
7
+ import { getDefaultRanges, getRanges } from './utils';
8
+ var PredefinedRanges = /*#__PURE__*/React.forwardRef(function (props, ref) {
9
+ var className = props.className,
10
+ disabledShortcut = props.disabledShortcut,
11
+ onClickShortcut = props.onClickShortcut,
12
+ calendarDate = props.calendarDate,
13
+ rangesProp = props.ranges,
14
+ locale = props.locale,
15
+ rest = _objectWithoutPropertiesLoose(props, ["className", "disabledShortcut", "onClickShortcut", "calendarDate", "ranges", "locale"]);
16
+
17
+ var _useState = useState(getRanges(props)),
18
+ ranges = _useState[0],
19
+ setRanges = _useState[1];
20
+
21
+ useUpdateEffect(function () {
22
+ setRanges(getRanges({
23
+ ranges: rangesProp,
24
+ calendarDate: calendarDate
25
+ }));
26
+ }, [calendarDate, rangesProp]);
27
+ var hasLocaleKey = useCallback(function (key) {
28
+ return getDefaultRanges(calendarDate).some(function (item) {
29
+ return item.label === key;
30
+ });
31
+ }, [calendarDate]);
32
+ return /*#__PURE__*/React.createElement(Stack, _extends({
33
+ className: className,
34
+ ref: ref,
35
+ alignItems: "flex-start",
36
+ spacing: 4
37
+ }, rest), ranges.map(function (_ref, index) {
38
+ var value = _ref.value,
39
+ closeOverlay = _ref.closeOverlay,
40
+ label = _ref.label,
41
+ rest = _objectWithoutPropertiesLoose(_ref, ["value", "closeOverlay", "label"]);
42
+
43
+ var disabled = disabledShortcut === null || disabledShortcut === void 0 ? void 0 : disabledShortcut(value);
44
+
45
+ var handleClickShortcut = function handleClickShortcut(event) {
46
+ if (disabled) {
47
+ return;
48
+ }
49
+
50
+ onClickShortcut === null || onClickShortcut === void 0 ? void 0 : onClickShortcut(value, closeOverlay !== false ? true : false, event);
51
+ };
52
+
53
+ return /*#__PURE__*/React.createElement(Button, _extends({
54
+ appearance: "link",
55
+ size: "sm",
56
+ key: index,
57
+ disabled: disabled,
58
+ onClick: handleClickShortcut
59
+ }, rest), hasLocaleKey(label) && typeof label === 'string' ? locale === null || locale === void 0 ? void 0 : locale[label] : label);
60
+ }));
61
+ });
62
+ export default PredefinedRanges;
@@ -1,17 +1,10 @@
1
1
  import React from 'react';
2
- import { StandardProps } from '../@types/common';
3
- import { RangeType } from './types';
4
- import { CalendarLocale } from '../locales';
2
+ import { PredefinedRangesProps } from './PredefinedRanges';
5
3
  export type { RangeType } from './types';
6
- export interface ToolbarProps<T = any, Shortcut = T> extends StandardProps {
4
+ export interface ToolbarProps<T = any, Shortcut = T> extends PredefinedRangesProps<T, Shortcut> {
7
5
  hideOkBtn?: boolean;
8
- locale?: CalendarLocale;
9
- calendarDate: T;
10
- ranges?: RangeType<Shortcut>[];
11
6
  disabledOkBtn?: (value: T) => boolean;
12
- disabledShortcut?: (value: T) => boolean;
13
7
  onOk?: (event: React.MouseEvent) => void;
14
- onClickShortcut?: (value: Shortcut, closeOverlay: boolean, event: React.MouseEvent) => void;
15
8
  }
16
9
  declare type ToolbarComponent = React.ForwardRefExoticComponent<ToolbarProps> & {
17
10
  <T = any, Shortcut = T>(props: ToolbarProps<T, Shortcut>): React.ReactElement | null;
@@ -1,14 +1,36 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- import React, { useCallback, useState } from 'react';
3
+ import React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import Button from '../Button';
6
- import { useClassNames, useUpdateEffect } from '../utils';
7
- import { getDefaultRanges, getRanges } from './utils';
6
+ import { useClassNames } from '../utils';
7
+ import PredefinedRanges from './PredefinedRanges';
8
+ import Stack from '../Stack';
8
9
 
10
+ var SubmitButton = function SubmitButton(_ref) {
11
+ var hide = _ref.hide,
12
+ disabledOkBtn = _ref.disabledOkBtn,
13
+ calendarDate = _ref.calendarDate,
14
+ onOk = _ref.onOk,
15
+ children = _ref.children;
16
+
17
+ if (hide) {
18
+ return null;
19
+ }
20
+
21
+ var disabled = disabledOkBtn === null || disabledOkBtn === void 0 ? void 0 : disabledOkBtn(calendarDate);
22
+ return /*#__PURE__*/React.createElement(Button, {
23
+ appearance: "primary",
24
+ size: "sm",
25
+ disabled: disabled,
26
+ onClick: disabled ? undefined : onOk
27
+ }, children);
28
+ };
9
29
  /**
10
30
  * Toolbar for DatePicker and DateRangePicker
11
31
  */
32
+
33
+
12
34
  var Toolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
13
35
  var className = props.className,
14
36
  _props$classPrefix = props.classPrefix,
@@ -19,78 +41,40 @@ var Toolbar = /*#__PURE__*/React.forwardRef(function (props, ref) {
19
41
  onOk = props.onOk,
20
42
  onClickShortcut = props.onClickShortcut,
21
43
  calendarDate = props.calendarDate,
22
- rangesProp = props.ranges,
44
+ ranges = props.ranges,
23
45
  locale = props.locale,
24
46
  rest = _objectWithoutPropertiesLoose(props, ["className", "classPrefix", "disabledOkBtn", "disabledShortcut", "hideOkBtn", "onOk", "onClickShortcut", "calendarDate", "ranges", "locale"]);
25
47
 
26
- var _useState = useState(getRanges(props)),
27
- ranges = _useState[0],
28
- setRanges = _useState[1];
29
-
30
48
  var _useClassNames = useClassNames(classPrefix),
31
49
  merge = _useClassNames.merge,
32
50
  prefix = _useClassNames.prefix,
33
51
  withClassPrefix = _useClassNames.withClassPrefix;
34
52
 
35
- useUpdateEffect(function () {
36
- setRanges(getRanges({
37
- ranges: rangesProp,
38
- calendarDate: calendarDate
39
- }));
40
- }, [calendarDate, rangesProp]);
41
- var hasLocaleKey = useCallback(function (key) {
42
- return getDefaultRanges(calendarDate).some(function (item) {
43
- return item.label === key;
44
- });
45
- }, [calendarDate]);
46
- var renderOkButton = useCallback(function () {
47
- if (hideOkBtn) {
48
- return null;
49
- }
50
-
51
- var disabled = disabledOkBtn === null || disabledOkBtn === void 0 ? void 0 : disabledOkBtn(calendarDate);
52
- return /*#__PURE__*/React.createElement("div", {
53
- className: prefix('right')
54
- }, /*#__PURE__*/React.createElement(Button, {
55
- appearance: "primary",
56
- size: "sm",
57
- disabled: disabled,
58
- onClick: disabled ? undefined : onOk
59
- }, locale === null || locale === void 0 ? void 0 : locale.ok));
60
- }, [disabledOkBtn, hideOkBtn, locale, onOk, calendarDate, prefix]);
61
-
62
- if (hideOkBtn && ranges.length === 0) {
53
+ if (hideOkBtn && (ranges === null || ranges === void 0 ? void 0 : ranges.length) === 0) {
63
54
  return null;
64
55
  }
65
56
 
66
57
  var classes = merge(className, withClassPrefix());
67
- return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
58
+ return /*#__PURE__*/React.createElement(Stack, _extends({
68
59
  ref: ref,
69
- className: classes
60
+ className: classes,
61
+ justifyContent: "space-between",
62
+ alignItems: "flex-start"
63
+ }, rest), /*#__PURE__*/React.createElement(PredefinedRanges, {
64
+ className: prefix('ranges'),
65
+ ranges: ranges,
66
+ calendarDate: calendarDate,
67
+ locale: locale,
68
+ disabledShortcut: disabledShortcut,
69
+ onClickShortcut: onClickShortcut
70
70
  }), /*#__PURE__*/React.createElement("div", {
71
- className: prefix('ranges')
72
- }, ranges.map(function (_ref, index) {
73
- var value = _ref.value,
74
- closeOverlay = _ref.closeOverlay,
75
- label = _ref.label;
76
- var disabled = disabledShortcut === null || disabledShortcut === void 0 ? void 0 : disabledShortcut(value);
77
-
78
- var handleClickShortcut = function handleClickShortcut(event) {
79
- if (disabled) {
80
- return;
81
- }
82
-
83
- onClickShortcut === null || onClickShortcut === void 0 ? void 0 : onClickShortcut(value, closeOverlay !== false ? true : false, event);
84
- };
85
-
86
- return /*#__PURE__*/React.createElement(Button, {
87
- appearance: "link",
88
- size: "sm",
89
- key: index,
90
- disabled: disabled,
91
- onClick: handleClickShortcut
92
- }, hasLocaleKey(label) && typeof label === 'string' ? locale === null || locale === void 0 ? void 0 : locale[label] : label);
93
- })), renderOkButton());
71
+ className: prefix('right')
72
+ }, /*#__PURE__*/React.createElement(SubmitButton, {
73
+ disabledOkBtn: disabledOkBtn,
74
+ hide: hideOkBtn,
75
+ calendarDate: calendarDate,
76
+ onOk: onOk
77
+ }, locale === null || locale === void 0 ? void 0 : locale.ok)));
94
78
  });
95
79
  Toolbar.displayName = 'Toolbar';
96
80
  Toolbar.propTypes = {
File without changes