rsuite 5.40.0 → 5.42.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.
- package/CHANGELOG.md +30 -0
- package/Navbar/styles/index.less +1 -1
- package/SelectPicker/styles/index.less +4 -8
- package/cjs/@types/common.js +1 -0
- package/cjs/@types/utils.js +12 -2
- package/cjs/Affix/Affix.js +39 -59
- package/cjs/Affix/index.js +1 -3
- package/cjs/Animation/Bounce.js +4 -13
- package/cjs/Animation/Collapse.js +19 -40
- package/cjs/Animation/Fade.js +6 -15
- package/cjs/Animation/Slide.js +6 -15
- package/cjs/Animation/Transition.js +16 -83
- package/cjs/Animation/index.js +1 -7
- package/cjs/Animation/utils.js +1 -6
- package/cjs/AutoComplete/AutoComplete.js +55 -90
- package/cjs/AutoComplete/index.js +1 -3
- package/cjs/AutoComplete/utils.js +1 -9
- package/cjs/Avatar/Avatar.js +18 -32
- package/cjs/Avatar/index.js +1 -3
- package/cjs/AvatarGroup/AvatarGroup.js +13 -27
- package/cjs/AvatarGroup/index.js +1 -3
- package/cjs/Badge/Badge.js +14 -27
- package/cjs/Badge/index.js +1 -3
- package/cjs/Breadcrumb/Breadcrumb.js +19 -41
- package/cjs/Breadcrumb/BreadcrumbItem.js +14 -26
- package/cjs/Breadcrumb/index.js +1 -3
- package/cjs/Button/Button.js +22 -40
- package/cjs/Button/index.js +1 -3
- package/cjs/ButtonGroup/ButtonGroup.js +15 -26
- package/cjs/ButtonGroup/ButtonGroupContext.js +1 -4
- package/cjs/ButtonGroup/index.js +1 -4
- package/cjs/ButtonToolbar/ButtonToolbar.js +10 -20
- package/cjs/ButtonToolbar/index.js +1 -3
- package/cjs/Calendar/Calendar.js +24 -43
- package/cjs/Calendar/CalendarBody.js +14 -28
- package/cjs/Calendar/CalendarContainer.js +46 -69
- package/cjs/Calendar/CalendarContext.js +1 -6
- package/cjs/Calendar/CalendarHeader.js +32 -59
- package/cjs/Calendar/MonthDropdown.js +22 -45
- package/cjs/Calendar/MonthDropdownItem.js +16 -31
- package/cjs/Calendar/Table.js +10 -21
- package/cjs/Calendar/TableHeaderRow.js +11 -25
- package/cjs/Calendar/TableRow.js +35 -66
- package/cjs/Calendar/TimeDropdown.js +24 -64
- package/cjs/Calendar/index.js +1 -8
- package/cjs/Calendar/types.js +1 -0
- package/cjs/Calendar/useCalendarDate.js +3 -13
- package/cjs/Calendar/useCalendarState.js +3 -8
- package/cjs/Carousel/Carousel.js +40 -65
- package/cjs/Carousel/index.js +1 -3
- package/cjs/Cascader/Cascader.js +126 -197
- package/cjs/Cascader/DropdownMenu.js +33 -65
- package/cjs/Cascader/index.js +1 -3
- package/cjs/Cascader/utils.js +13 -24
- package/cjs/CheckPicker/CheckPicker.js +105 -156
- package/cjs/CheckPicker/index.js +1 -3
- package/cjs/CheckTree/index.js +1 -8
- package/cjs/CheckTreePicker/CheckTreeNode.js +28 -54
- package/cjs/CheckTreePicker/CheckTreePicker.js +165 -247
- package/cjs/CheckTreePicker/index.js +1 -3
- package/cjs/CheckTreePicker/utils.js +12 -52
- package/cjs/Checkbox/Checkbox.js +48 -77
- package/cjs/Checkbox/index.js +1 -3
- package/cjs/CheckboxGroup/CheckboxGroup.js +20 -38
- package/cjs/CheckboxGroup/CheckboxGroupContext.js +1 -4
- package/cjs/CheckboxGroup/index.js +1 -4
- package/cjs/CloseButton/CloseButton.js +10 -20
- package/cjs/CloseButton/index.js +1 -3
- package/cjs/Col/Col.js +10 -23
- package/cjs/Col/index.js +1 -3
- package/cjs/Container/Container.js +11 -24
- package/cjs/Container/index.js +1 -3
- package/cjs/Content/Content.js +1 -3
- package/cjs/Content/index.js +1 -3
- package/cjs/CustomProvider/CustomProvider.js +13 -28
- package/cjs/CustomProvider/FormattedDate.js +3 -9
- package/cjs/CustomProvider/index.js +1 -6
- package/cjs/DOMHelper/index.js +1 -7
- package/cjs/DOMHelper/isElement.js +1 -2
- package/cjs/DatePicker/DatePicker.js +108 -161
- package/cjs/DatePicker/PredefinedRanges.js +12 -29
- package/cjs/DatePicker/Toolbar.js +20 -36
- package/cjs/DatePicker/index.js +1 -3
- package/cjs/DatePicker/types.js +1 -0
- package/cjs/DatePicker/utils.js +5 -13
- package/cjs/DateRangePicker/Calendar.js +18 -28
- package/cjs/DateRangePicker/DateRangePicker.js +128 -207
- package/cjs/DateRangePicker/DateRangePickerContext.js +1 -6
- package/cjs/DateRangePicker/disabledDateUtils.js +9 -32
- package/cjs/DateRangePicker/index.js +1 -3
- package/cjs/DateRangePicker/types.js +1 -0
- package/cjs/DateRangePicker/utils.js +7 -20
- package/cjs/Disclosure/Disclosure.js +14 -34
- package/cjs/Disclosure/DisclosureButton.js +4 -12
- package/cjs/Disclosure/DisclosureContent.js +1 -5
- package/cjs/Disclosure/DisclosureContext.js +1 -6
- package/cjs/Disclosure/index.js +1 -3
- package/cjs/Disclosure/useDisclosureContext.js +1 -6
- package/cjs/Divider/Divider.js +11 -20
- package/cjs/Divider/index.js +1 -3
- package/cjs/Drawer/Drawer.js +10 -27
- package/cjs/Drawer/index.js +1 -3
- package/cjs/Dropdown/Dropdown.js +35 -68
- package/cjs/Dropdown/DropdownContext.js +1 -4
- package/cjs/Dropdown/DropdownItem.js +22 -49
- package/cjs/Dropdown/DropdownMenu.js +36 -63
- package/cjs/Dropdown/DropdownSeparator.js +8 -17
- package/cjs/Dropdown/DropdownState.js +1 -10
- package/cjs/Dropdown/DropdownToggle.js +17 -29
- package/cjs/Dropdown/index.js +1 -3
- package/cjs/Dropdown/useRenderDropdownItem.js +1 -5
- package/cjs/FlexboxGrid/FlexboxGrid.js +12 -22
- package/cjs/FlexboxGrid/FlexboxGridItem.js +12 -22
- package/cjs/FlexboxGrid/index.js +1 -3
- package/cjs/Footer/Footer.js +1 -3
- package/cjs/Footer/index.js +1 -3
- package/cjs/Form/Form.js +38 -79
- package/cjs/Form/FormContext.d.ts +2 -3
- package/cjs/Form/FormContext.js +1 -8
- package/cjs/Form/index.js +1 -4
- package/cjs/Form/useFormClassNames.js +11 -14
- package/cjs/Form/useSchemaModel.js +2 -6
- package/cjs/FormControl/FormControl.js +48 -84
- package/cjs/FormControl/index.js +1 -3
- package/cjs/FormControl/useRegisterModel.js +1 -3
- package/cjs/FormControlLabel/FormControlLabel.js +10 -22
- package/cjs/FormControlLabel/index.js +1 -3
- package/cjs/FormErrorMessage/FormErrorMessage.js +12 -27
- package/cjs/FormErrorMessage/index.js +1 -3
- package/cjs/FormGroup/FormGroup.js +9 -21
- package/cjs/FormGroup/index.js +1 -3
- package/cjs/FormHelpText/FormHelpText.js +11 -28
- package/cjs/FormHelpText/index.js +1 -3
- package/cjs/Grid/Grid.js +10 -19
- package/cjs/Grid/index.js +1 -3
- package/cjs/Header/Header.js +1 -3
- package/cjs/Header/index.js +1 -3
- package/cjs/IconButton/IconButton.js +11 -21
- package/cjs/IconButton/index.js +1 -3
- package/cjs/Input/Input.js +26 -43
- package/cjs/Input/index.js +1 -3
- package/cjs/InputGroup/InputGroup.js +23 -39
- package/cjs/InputGroup/InputGroupAddon.js +9 -18
- package/cjs/InputGroup/InputGroupButton.js +7 -17
- package/cjs/InputGroup/index.js +1 -3
- package/cjs/InputNumber/InputNumber.js +42 -88
- package/cjs/InputNumber/index.js +1 -3
- package/cjs/InputPicker/InputAutosize.js +17 -42
- package/cjs/InputPicker/InputPicker.d.ts +2 -0
- package/cjs/InputPicker/InputPicker.js +152 -251
- package/cjs/InputPicker/InputSearch.js +15 -28
- package/cjs/InputPicker/index.js +1 -3
- package/cjs/List/List.js +37 -51
- package/cjs/List/ListContext.js +1 -5
- package/cjs/List/ListItem.js +26 -40
- package/cjs/List/helper/AutoScroller.js +11 -21
- package/cjs/List/helper/useManager.js +1 -8
- package/cjs/List/helper/useSortHelper.js +58 -82
- package/cjs/List/helper/utils.js +6 -19
- package/cjs/List/index.js +1 -3
- package/cjs/Loader/Loader.js +17 -26
- package/cjs/Loader/index.js +1 -3
- package/cjs/MaskedInput/MaskedInput.js +2 -8
- package/cjs/MaskedInput/TextMask.js +14 -23
- package/cjs/MaskedInput/adjustCaretPosition.js +99 -70
- package/cjs/MaskedInput/conformToMask.js +79 -73
- package/cjs/MaskedInput/createTextMaskInputElement.js +65 -71
- package/cjs/MaskedInput/index.js +1 -3
- package/cjs/MaskedInput/types.js +1 -0
- package/cjs/MaskedInput/utilities.js +1 -8
- package/cjs/Menu/Menu.js +35 -79
- package/cjs/Menu/MenuContext.js +1 -8
- package/cjs/Menu/MenuItem.js +15 -26
- package/cjs/Menu/Menubar.js +13 -32
- package/cjs/Menu/index.js +1 -3
- package/cjs/Menu/useMenu.js +5 -34
- package/cjs/Message/Message.js +23 -45
- package/cjs/Message/index.js +1 -3
- package/cjs/Modal/Modal.js +70 -91
- package/cjs/Modal/ModalBody.js +11 -25
- package/cjs/Modal/ModalContext.js +1 -4
- package/cjs/Modal/ModalDialog.js +14 -26
- package/cjs/Modal/ModalFooter.js +1 -3
- package/cjs/Modal/ModalHeader.js +14 -29
- package/cjs/Modal/ModalTitle.js +9 -20
- package/cjs/Modal/index.js +1 -3
- package/cjs/Modal/utils.js +8 -19
- package/cjs/MultiCascader/DropdownMenu.js +38 -64
- package/cjs/MultiCascader/MultiCascader.js +129 -192
- package/cjs/MultiCascader/index.js +1 -3
- package/cjs/MultiCascader/utils.js +44 -106
- package/cjs/Nav/Nav.js +27 -69
- package/cjs/Nav/NavContext.js +1 -4
- package/cjs/Nav/NavDropdown.js +28 -60
- package/cjs/Nav/NavDropdownItem.js +20 -42
- package/cjs/Nav/NavDropdownMenu.js +26 -54
- package/cjs/Nav/NavDropdownToggle.js +12 -26
- package/cjs/Nav/NavItem.js +20 -39
- package/cjs/Nav/NavMenu.js +2 -28
- package/cjs/Nav/index.js +1 -3
- package/cjs/Navbar/Navbar.js +10 -23
- package/cjs/Navbar/NavbarBody.js +1 -6
- package/cjs/Navbar/NavbarBrand.js +1 -3
- package/cjs/Navbar/NavbarDropdown.js +25 -49
- package/cjs/Navbar/NavbarDropdownItem.js +18 -44
- package/cjs/Navbar/NavbarDropdownMenu.js +22 -51
- package/cjs/Navbar/NavbarDropdownToggle.js +12 -25
- package/cjs/Navbar/NavbarHeader.js +1 -6
- package/cjs/Navbar/NavbarItem.js +19 -35
- package/cjs/Navbar/index.js +1 -3
- package/cjs/Notification/Notification.js +20 -43
- package/cjs/Notification/index.js +1 -3
- package/cjs/Overlay/Modal.js +40 -79
- package/cjs/Overlay/ModalManager.js +1 -26
- package/cjs/Overlay/Overlay.js +28 -50
- package/cjs/Overlay/OverlayContext.js +1 -4
- package/cjs/Overlay/OverlayTrigger.js +67 -116
- package/cjs/Overlay/Position.js +25 -64
- package/cjs/Overlay/index.js +1 -3
- package/cjs/Overlay/positionUtils.js +25 -86
- package/cjs/Pagination/Pagination.js +30 -70
- package/cjs/Pagination/PaginationButton.js +15 -29
- package/cjs/Pagination/PaginationGroup.js +38 -63
- package/cjs/Pagination/index.js +1 -3
- package/cjs/Panel/Panel.js +37 -61
- package/cjs/Panel/index.js +1 -3
- package/cjs/PanelGroup/PanelGroup.js +16 -29
- package/cjs/PanelGroup/index.js +1 -3
- package/cjs/Picker/DropdownMenu.js +50 -93
- package/cjs/Picker/DropdownMenuCheckItem.js +22 -33
- package/cjs/Picker/DropdownMenuGroup.js +10 -22
- package/cjs/Picker/DropdownMenuItem.js +15 -26
- package/cjs/Picker/PickerOverlay.js +12 -28
- package/cjs/Picker/PickerToggle.js +57 -89
- package/cjs/Picker/PickerToggleTrigger.js +8 -19
- package/cjs/Picker/SearchBar.js +14 -26
- package/cjs/Picker/SelectedElement.js +9 -17
- package/cjs/Picker/ToggleButton.js +1 -6
- package/cjs/Picker/index.js +1 -24
- package/cjs/Picker/propTypes.js +1 -7
- package/cjs/Picker/types.js +1 -0
- package/cjs/Picker/utils.js +94 -200
- package/cjs/Placeholder/Placeholder.js +1 -5
- package/cjs/Placeholder/PlaceholderGraph.js +13 -22
- package/cjs/Placeholder/PlaceholderGrid.js +18 -34
- package/cjs/Placeholder/PlaceholderParagraph.js +17 -29
- package/cjs/Placeholder/index.js +1 -3
- package/cjs/Plaintext/Plaintext.js +14 -23
- package/cjs/Plaintext/index.js +1 -3
- package/cjs/Popover/Popover.js +16 -27
- package/cjs/Popover/index.js +1 -3
- package/cjs/Progress/Progress.js +1 -4
- package/cjs/Progress/ProgressCircle.js +30 -47
- package/cjs/Progress/ProgressLine.js +19 -29
- package/cjs/Progress/index.js +1 -3
- package/cjs/Radio/Radio.js +42 -62
- package/cjs/Radio/index.js +1 -3
- package/cjs/RadioGroup/RadioGroup.js +22 -37
- package/cjs/RadioGroup/index.js +1 -3
- package/cjs/RadioTile/RadioTile.js +30 -47
- package/cjs/RadioTile/index.js +1 -3
- package/cjs/RadioTileGroup/RadioTileGroup.js +17 -32
- package/cjs/RadioTileGroup/index.js +1 -3
- package/cjs/RangeSlider/RangeSlider.js +63 -104
- package/cjs/RangeSlider/index.js +1 -3
- package/cjs/Rate/Character.js +16 -31
- package/cjs/Rate/Rate.js +35 -62
- package/cjs/Rate/index.js +1 -3
- package/cjs/Rate/utils.js +1 -6
- package/cjs/Ripple/Ripple.js +16 -40
- package/cjs/Ripple/index.js +1 -3
- package/cjs/Row/Row.js +11 -22
- package/cjs/Row/index.js +1 -3
- package/cjs/SafeAnchor/SafeAnchor.js +8 -19
- package/cjs/SafeAnchor/index.js +1 -3
- package/cjs/Schema/Schema.js +1 -2
- package/cjs/Schema/index.js +1 -3
- package/cjs/SelectPicker/SelectPicker.js +136 -170
- package/cjs/SelectPicker/index.js +1 -3
- package/cjs/Sidebar/Sidebar.js +13 -26
- package/cjs/Sidebar/index.js +1 -3
- package/cjs/Sidenav/ExpandedSidenavDropdown.js +32 -54
- package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +19 -41
- package/cjs/Sidenav/ExpandedSidenavDropdownMenu.js +22 -46
- package/cjs/Sidenav/Node.js +1 -12
- package/cjs/Sidenav/Sidenav.js +22 -45
- package/cjs/Sidenav/SidenavBody.js +1 -3
- package/cjs/Sidenav/SidenavDropdown.js +39 -70
- package/cjs/Sidenav/SidenavDropdownCollapse.js +9 -22
- package/cjs/Sidenav/SidenavDropdownItem.js +19 -45
- package/cjs/Sidenav/SidenavDropdownMenu.js +26 -54
- package/cjs/Sidenav/SidenavDropdownToggle.js +12 -25
- package/cjs/Sidenav/SidenavHeader.js +1 -3
- package/cjs/Sidenav/SidenavItem.js +27 -55
- package/cjs/Sidenav/SidenavToggle.js +11 -31
- package/cjs/Sidenav/index.js +1 -3
- package/cjs/Slider/Graduated.js +14 -29
- package/cjs/Slider/Handle.js +27 -52
- package/cjs/Slider/Input.js +2 -8
- package/cjs/Slider/Mark.js +11 -20
- package/cjs/Slider/ProgressBar.js +14 -23
- package/cjs/Slider/Slider.js +51 -84
- package/cjs/Slider/index.js +1 -3
- package/cjs/Slider/utils.js +1 -6
- package/cjs/Stack/Stack.js +22 -35
- package/cjs/Stack/StackItem.js +11 -17
- package/cjs/Stack/index.js +1 -3
- package/cjs/Steps/StepItem.js +16 -32
- package/cjs/Steps/Steps.js +18 -32
- package/cjs/Steps/index.js +1 -3
- package/cjs/Table/Table.js +6 -16
- package/cjs/Table/index.js +1 -3
- package/cjs/Tag/Tag.js +16 -28
- package/cjs/Tag/index.js +1 -3
- package/cjs/TagGroup/TagGroup.js +1 -3
- package/cjs/TagGroup/index.js +1 -3
- package/cjs/TagInput/index.d.ts +3 -0
- package/cjs/TagInput/index.js +11 -16
- package/cjs/TagPicker/index.d.ts +3 -0
- package/cjs/TagPicker/index.js +9 -14
- package/cjs/Timeline/Timeline.js +14 -29
- package/cjs/Timeline/TimelineItem.js +14 -23
- package/cjs/Timeline/index.js +1 -3
- package/cjs/Toggle/Toggle.js +26 -45
- package/cjs/Toggle/index.js +1 -3
- package/cjs/Tooltip/Tooltip.js +13 -22
- package/cjs/Tooltip/index.js +1 -3
- package/cjs/Tree/Tree.js +1 -10
- package/cjs/Tree/TreeContext.js +1 -4
- package/cjs/Tree/index.js +1 -3
- package/cjs/TreePicker/TreeNode.js +37 -60
- package/cjs/TreePicker/TreePicker.js +155 -231
- package/cjs/TreePicker/index.js +1 -3
- package/cjs/Uploader/UploadFileItem.js +37 -82
- package/cjs/Uploader/UploadTrigger.js +24 -46
- package/cjs/Uploader/Uploader.js +89 -141
- package/cjs/Uploader/index.js +1 -3
- package/cjs/Whisper/Whisper.js +8 -20
- package/cjs/Whisper/index.js +1 -3
- package/cjs/Windowing/AutoSizer.js +13 -33
- package/cjs/Windowing/List.d.ts +2 -2
- package/cjs/Windowing/List.js +6 -22
- package/cjs/Windowing/index.js +1 -7
- package/cjs/index.js +1 -164
- package/cjs/locales/ar_EG.js +1 -4
- package/cjs/locales/da_DK.js +1 -5
- package/cjs/locales/de_DE.js +1 -5
- package/cjs/locales/default.js +1 -5
- package/cjs/locales/en_GB.js +1 -3
- package/cjs/locales/en_US.js +1 -4
- package/cjs/locales/es_AR.js +1 -5
- package/cjs/locales/es_ES.js +1 -5
- package/cjs/locales/fa_IR.js +1 -4
- package/cjs/locales/fi_FI.js +1 -5
- package/cjs/locales/fr_FR.js +1 -4
- package/cjs/locales/hu_HU.js +1 -5
- package/cjs/locales/index.js +1 -47
- package/cjs/locales/it_IT.js +1 -5
- package/cjs/locales/ja_JP.js +1 -5
- package/cjs/locales/kk_KZ.js +1 -4
- package/cjs/locales/ko_KR.js +1 -5
- package/cjs/locales/ne_NP.js +1 -5
- package/cjs/locales/nl_NL.js +1 -4
- package/cjs/locales/pt_BR.js +1 -4
- package/cjs/locales/ru_RU.js +1 -4
- package/cjs/locales/sv_SE.js +1 -5
- package/cjs/locales/tr_TR.js +1 -4
- package/cjs/locales/zh_CN.js +1 -4
- package/cjs/locales/zh_TW.js +1 -4
- package/cjs/toaster/ToastContainer.js +29 -52
- package/cjs/toaster/ToastContext.js +1 -4
- package/cjs/toaster/index.js +1 -4
- package/cjs/toaster/toaster.js +4 -27
- package/cjs/toaster/useToaster.js +2 -8
- package/cjs/utils/BrowserDetection.js +7 -24
- package/cjs/utils/ReactChildren.js +2 -19
- package/cjs/utils/ajaxUpload.js +15 -33
- package/cjs/utils/appendTooltip.js +3 -9
- package/cjs/utils/attachParent.js +1 -1
- package/cjs/utils/clone.js +1 -2
- package/cjs/utils/composeFunctions.js +1 -3
- package/cjs/utils/constants.js +3 -8
- package/cjs/utils/createChainedFunction.js +2 -6
- package/cjs/utils/createComponent.js +12 -24
- package/cjs/utils/dateUtils.js +7 -121
- package/cjs/utils/deprecateComponent.js +1 -8
- package/cjs/utils/deprecatePropType.js +2 -9
- package/cjs/utils/dom.js +3 -2
- package/cjs/utils/events.js +2 -3
- package/cjs/utils/getDOMNode.js +16 -9
- package/cjs/utils/getDataGroupBy.d.ts +0 -23
- package/cjs/utils/getDataGroupBy.js +5 -44
- package/cjs/utils/getSafeRegExpString.js +1 -1
- package/cjs/utils/guid.js +1 -1
- package/cjs/utils/htmlPropsUtils.js +23 -20
- package/cjs/utils/index.js +1 -86
- package/cjs/utils/isOneOf.js +1 -2
- package/cjs/utils/mergeRefs.js +1 -2
- package/cjs/utils/placementPolyfill.js +2 -5
- package/cjs/utils/prefix.js +4 -15
- package/cjs/utils/previewFile.js +1 -6
- package/cjs/utils/propTypeChecker.js +1 -8
- package/cjs/utils/reactToString.js +1 -5
- package/cjs/utils/render.js +3 -10
- package/cjs/utils/scrollTopAnimation.js +1 -9
- package/cjs/utils/shallowEqual.js +8 -14
- package/cjs/utils/shallowEqualArray.js +1 -7
- package/cjs/utils/statusIcons.js +1 -9
- package/cjs/utils/stringToObject.js +1 -7
- package/cjs/utils/tplTransform.js +2 -7
- package/cjs/utils/treeUtils.js +112 -327
- package/cjs/utils/useClassNames.js +9 -15
- package/cjs/utils/useClickOutside.js +4 -8
- package/cjs/utils/useControlled.js +11 -7
- package/cjs/utils/useCustom.js +12 -25
- package/cjs/utils/useElementResize.js +1 -6
- package/cjs/utils/useEnsuredRef.js +1 -4
- package/cjs/utils/useEventCallback.js +1 -4
- package/cjs/utils/useEventListener.js +1 -5
- package/cjs/utils/useFocus.js +5 -6
- package/cjs/utils/useInternalId.js +1 -6
- package/cjs/utils/useIsMounted.js +1 -3
- package/cjs/utils/useMap.js +5 -7
- package/cjs/utils/useMount.js +1 -4
- package/cjs/utils/usePortal.js +7 -20
- package/cjs/utils/useRootClose.js +9 -19
- package/cjs/utils/useTimeout.js +3 -8
- package/cjs/utils/useToggleCaret.js +2 -14
- package/cjs/utils/useUniqueId.js +2 -9
- package/cjs/utils/useUpdateEffect.js +3 -5
- package/cjs/utils/useUpdatedRef.js +1 -2
- package/cjs/utils/useWillUnmount.js +3 -5
- package/cjs/utils/warnOnce.js +2 -2
- package/dist/rsuite-no-reset-rtl.css +23 -25
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +23 -25
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +23 -25
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +23 -25
- package/dist/rsuite.js +438 -471
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/@types/common.js +1 -0
- package/esm/@types/utils.js +14 -2
- package/esm/Affix/Affix.js +39 -50
- package/esm/Affix/index.js +1 -0
- package/esm/Animation/Bounce.js +4 -5
- package/esm/Animation/Collapse.js +19 -26
- package/esm/Animation/Fade.js +6 -7
- package/esm/Animation/Slide.js +6 -7
- package/esm/Animation/Transition.js +16 -69
- package/esm/Animation/index.js +1 -0
- package/esm/Animation/utils.js +1 -2
- package/esm/AutoComplete/AutoComplete.js +55 -75
- package/esm/AutoComplete/index.js +1 -0
- package/esm/AutoComplete/utils.js +1 -4
- package/esm/Avatar/Avatar.js +18 -22
- package/esm/Avatar/index.js +1 -0
- package/esm/AvatarGroup/AvatarGroup.js +13 -16
- package/esm/AvatarGroup/index.js +1 -0
- package/esm/Badge/Badge.js +14 -19
- package/esm/Badge/index.js +1 -0
- package/esm/Breadcrumb/Breadcrumb.js +19 -30
- package/esm/Breadcrumb/BreadcrumbItem.js +14 -17
- package/esm/Breadcrumb/index.js +1 -0
- package/esm/Button/Button.js +22 -28
- package/esm/Button/index.js +1 -0
- package/esm/ButtonGroup/ButtonGroup.js +15 -16
- package/esm/ButtonGroup/ButtonGroupContext.js +1 -0
- package/esm/ButtonGroup/index.js +1 -0
- package/esm/ButtonToolbar/ButtonToolbar.js +10 -12
- package/esm/ButtonToolbar/index.js +1 -0
- package/esm/Calendar/Calendar.js +24 -29
- package/esm/Calendar/CalendarBody.js +14 -18
- package/esm/Calendar/CalendarContainer.js +46 -51
- package/esm/Calendar/CalendarContext.js +1 -0
- package/esm/Calendar/CalendarHeader.js +32 -41
- package/esm/Calendar/MonthDropdown.js +22 -27
- package/esm/Calendar/MonthDropdownItem.js +16 -20
- package/esm/Calendar/Table.js +10 -11
- package/esm/Calendar/TableHeaderRow.js +11 -15
- package/esm/Calendar/TableRow.js +36 -50
- package/esm/Calendar/TimeDropdown.js +24 -48
- package/esm/Calendar/index.js +1 -0
- package/esm/Calendar/types.js +1 -0
- package/esm/Calendar/useCalendarDate.js +3 -11
- package/esm/Calendar/useCalendarState.js +3 -6
- package/esm/Carousel/Carousel.js +40 -52
- package/esm/Carousel/index.js +1 -0
- package/esm/Cascader/Cascader.js +126 -178
- package/esm/Cascader/DropdownMenu.js +33 -45
- package/esm/Cascader/index.js +1 -0
- package/esm/Cascader/utils.js +13 -22
- package/esm/CheckPicker/CheckPicker.js +105 -139
- package/esm/CheckPicker/index.js +1 -0
- package/esm/CheckTree/index.js +1 -0
- package/esm/CheckTreePicker/CheckTreeNode.js +28 -44
- package/esm/CheckTreePicker/CheckTreePicker.js +165 -232
- package/esm/CheckTreePicker/index.js +1 -0
- package/esm/CheckTreePicker/utils.js +12 -35
- package/esm/Checkbox/Checkbox.js +48 -66
- package/esm/Checkbox/index.js +1 -0
- package/esm/CheckboxGroup/CheckboxGroup.js +20 -25
- package/esm/CheckboxGroup/CheckboxGroupContext.js +1 -0
- package/esm/CheckboxGroup/index.js +1 -0
- package/esm/CloseButton/CloseButton.js +10 -13
- package/esm/CloseButton/index.js +1 -0
- package/esm/Col/Col.js +10 -13
- package/esm/Col/index.js +1 -0
- package/esm/Container/Container.js +11 -13
- package/esm/Container/index.js +1 -0
- package/esm/Content/Content.js +1 -1
- package/esm/Content/index.js +1 -0
- package/esm/CustomProvider/CustomProvider.js +13 -16
- package/esm/CustomProvider/FormattedDate.js +3 -6
- package/esm/CustomProvider/index.js +1 -0
- package/esm/DOMHelper/index.js +1 -2
- package/esm/DOMHelper/isElement.js +1 -1
- package/esm/DatePicker/DatePicker.js +108 -131
- package/esm/DatePicker/PredefinedRanges.js +12 -19
- package/esm/DatePicker/Toolbar.js +20 -26
- package/esm/DatePicker/index.js +1 -0
- package/esm/DatePicker/types.js +1 -0
- package/esm/DatePicker/utils.js +5 -8
- package/esm/DateRangePicker/Calendar.js +18 -18
- package/esm/DateRangePicker/DateRangePicker.js +128 -184
- package/esm/DateRangePicker/DateRangePickerContext.js +1 -0
- package/esm/DateRangePicker/disabledDateUtils.js +9 -24
- package/esm/DateRangePicker/index.js +1 -0
- package/esm/DateRangePicker/types.js +1 -0
- package/esm/DateRangePicker/utils.js +7 -12
- package/esm/Disclosure/Disclosure.js +13 -24
- package/esm/Disclosure/DisclosureButton.js +4 -7
- package/esm/Disclosure/DisclosureContent.js +1 -2
- package/esm/Disclosure/DisclosureContext.js +1 -2
- package/esm/Disclosure/index.js +1 -0
- package/esm/Disclosure/useDisclosureContext.js +1 -2
- package/esm/Divider/Divider.js +11 -12
- package/esm/Divider/index.js +1 -0
- package/esm/Drawer/Drawer.js +10 -11
- package/esm/Drawer/index.js +1 -0
- package/esm/Dropdown/Dropdown.js +35 -50
- package/esm/Dropdown/DropdownContext.js +1 -0
- package/esm/Dropdown/DropdownItem.js +22 -31
- package/esm/Dropdown/DropdownMenu.js +36 -49
- package/esm/Dropdown/DropdownSeparator.js +8 -10
- package/esm/Dropdown/DropdownState.js +1 -7
- package/esm/Dropdown/DropdownToggle.js +17 -17
- package/esm/Dropdown/index.js +1 -0
- package/esm/Dropdown/useRenderDropdownItem.js +1 -2
- package/esm/FlexboxGrid/FlexboxGrid.js +12 -13
- package/esm/FlexboxGrid/FlexboxGridItem.js +12 -14
- package/esm/FlexboxGrid/index.js +1 -0
- package/esm/Footer/Footer.js +1 -0
- package/esm/Footer/index.js +1 -0
- package/esm/Form/Form.js +38 -66
- package/esm/Form/FormContext.d.ts +2 -3
- package/esm/Form/FormContext.js +1 -0
- package/esm/Form/index.js +1 -0
- package/esm/Form/useFormClassNames.js +11 -13
- package/esm/Form/useSchemaModel.js +2 -4
- package/esm/FormControl/FormControl.js +46 -70
- package/esm/FormControl/index.js +1 -0
- package/esm/FormControl/useRegisterModel.js +1 -2
- package/esm/FormControlLabel/FormControlLabel.js +10 -12
- package/esm/FormControlLabel/index.js +1 -0
- package/esm/FormErrorMessage/FormErrorMessage.js +12 -18
- package/esm/FormErrorMessage/index.js +1 -0
- package/esm/FormGroup/FormGroup.js +9 -10
- package/esm/FormGroup/index.js +1 -0
- package/esm/FormHelpText/FormHelpText.js +11 -15
- package/esm/FormHelpText/index.js +1 -0
- package/esm/Grid/Grid.js +10 -11
- package/esm/Grid/index.js +1 -0
- package/esm/Header/Header.js +1 -0
- package/esm/Header/index.js +1 -0
- package/esm/IconButton/IconButton.js +11 -12
- package/esm/IconButton/index.js +1 -0
- package/esm/Input/Input.js +26 -32
- package/esm/Input/index.js +1 -0
- package/esm/InputGroup/InputGroup.js +23 -26
- package/esm/InputGroup/InputGroupAddon.js +9 -10
- package/esm/InputGroup/InputGroupButton.js +7 -9
- package/esm/InputGroup/index.js +1 -0
- package/esm/InputNumber/InputNumber.js +42 -72
- package/esm/InputNumber/index.js +1 -0
- package/esm/InputPicker/InputAutosize.js +17 -37
- package/esm/InputPicker/InputPicker.d.ts +2 -0
- package/esm/InputPicker/InputPicker.js +152 -226
- package/esm/InputPicker/InputSearch.js +15 -20
- package/esm/InputPicker/index.js +1 -0
- package/esm/List/List.js +37 -39
- package/esm/List/ListContext.js +1 -0
- package/esm/List/ListItem.js +26 -30
- package/esm/List/helper/AutoScroller.js +11 -21
- package/esm/List/helper/useManager.js +1 -6
- package/esm/List/helper/useSortHelper.js +58 -74
- package/esm/List/helper/utils.js +6 -11
- package/esm/List/index.js +1 -0
- package/esm/Loader/Loader.js +17 -19
- package/esm/Loader/index.js +1 -0
- package/esm/MaskedInput/MaskedInput.js +2 -1
- package/esm/MaskedInput/TextMask.js +12 -14
- package/esm/MaskedInput/adjustCaretPosition.js +99 -69
- package/esm/MaskedInput/conformToMask.js +79 -70
- package/esm/MaskedInput/createTextMaskInputElement.js +65 -62
- package/esm/MaskedInput/index.js +1 -0
- package/esm/MaskedInput/types.js +1 -0
- package/esm/MaskedInput/utilities.js +1 -6
- package/esm/Menu/Menu.js +35 -66
- package/esm/Menu/MenuContext.js +1 -4
- package/esm/Menu/MenuItem.js +15 -19
- package/esm/Menu/Menubar.js +13 -23
- package/esm/Menu/index.js +1 -0
- package/esm/Menu/useMenu.js +4 -27
- package/esm/Message/Message.js +23 -34
- package/esm/Message/index.js +1 -0
- package/esm/Modal/Modal.js +70 -69
- package/esm/Modal/ModalBody.js +11 -13
- package/esm/Modal/ModalContext.js +1 -0
- package/esm/Modal/ModalDialog.js +14 -18
- package/esm/Modal/ModalFooter.js +1 -0
- package/esm/Modal/ModalHeader.js +14 -16
- package/esm/Modal/ModalTitle.js +9 -10
- package/esm/Modal/index.js +1 -0
- package/esm/Modal/utils.js +8 -12
- package/esm/MultiCascader/DropdownMenu.js +38 -48
- package/esm/MultiCascader/MultiCascader.js +129 -174
- package/esm/MultiCascader/index.js +1 -0
- package/esm/MultiCascader/utils.js +44 -87
- package/esm/Nav/Nav.js +27 -45
- package/esm/Nav/NavContext.js +1 -0
- package/esm/Nav/NavDropdown.js +28 -44
- package/esm/Nav/NavDropdownItem.js +20 -31
- package/esm/Nav/NavDropdownMenu.js +26 -42
- package/esm/Nav/NavDropdownToggle.js +12 -15
- package/esm/Nav/NavItem.js +20 -28
- package/esm/Nav/NavMenu.js +2 -13
- package/esm/Nav/index.js +1 -0
- package/esm/Navbar/Navbar.js +10 -11
- package/esm/Navbar/NavbarBody.js +1 -0
- package/esm/Navbar/NavbarBrand.js +1 -0
- package/esm/Navbar/NavbarDropdown.js +25 -33
- package/esm/Navbar/NavbarDropdownItem.js +18 -30
- package/esm/Navbar/NavbarDropdownMenu.js +22 -37
- package/esm/Navbar/NavbarDropdownToggle.js +12 -14
- package/esm/Navbar/NavbarHeader.js +1 -0
- package/esm/Navbar/NavbarItem.js +19 -23
- package/esm/Navbar/index.js +1 -0
- package/esm/Notification/Notification.js +20 -32
- package/esm/Notification/index.js +1 -0
- package/esm/Overlay/Modal.js +40 -64
- package/esm/Overlay/ModalManager.js +1 -19
- package/esm/Overlay/Overlay.js +28 -37
- package/esm/Overlay/OverlayContext.js +1 -0
- package/esm/Overlay/OverlayTrigger.js +68 -101
- package/esm/Overlay/Position.js +25 -47
- package/esm/Overlay/index.js +1 -0
- package/esm/Overlay/positionUtils.js +25 -73
- package/esm/Pagination/Pagination.js +30 -55
- package/esm/Pagination/PaginationButton.js +15 -19
- package/esm/Pagination/PaginationGroup.js +38 -49
- package/esm/Pagination/index.js +1 -0
- package/esm/Panel/Panel.js +37 -49
- package/esm/Panel/index.js +1 -0
- package/esm/PanelGroup/PanelGroup.js +16 -18
- package/esm/PanelGroup/index.js +1 -0
- package/esm/Picker/DropdownMenu.js +50 -72
- package/esm/Picker/DropdownMenuCheckItem.js +22 -24
- package/esm/Picker/DropdownMenuGroup.js +10 -13
- package/esm/Picker/DropdownMenuItem.js +15 -18
- package/esm/Picker/PickerOverlay.js +12 -17
- package/esm/Picker/PickerToggle.js +57 -71
- package/esm/Picker/PickerToggleTrigger.js +8 -10
- package/esm/Picker/SearchBar.js +14 -15
- package/esm/Picker/SelectedElement.js +9 -14
- package/esm/Picker/ToggleButton.js +1 -0
- package/esm/Picker/index.js +1 -0
- package/esm/Picker/propTypes.js +1 -1
- package/esm/Picker/types.js +1 -0
- package/esm/Picker/utils.js +94 -182
- package/esm/Placeholder/Placeholder.js +1 -0
- package/esm/Placeholder/PlaceholderGraph.js +13 -16
- package/esm/Placeholder/PlaceholderGrid.js +18 -25
- package/esm/Placeholder/PlaceholderParagraph.js +17 -20
- package/esm/Placeholder/index.js +1 -0
- package/esm/Plaintext/Plaintext.js +14 -17
- package/esm/Plaintext/index.js +1 -0
- package/esm/Popover/Popover.js +16 -21
- package/esm/Popover/index.js +1 -0
- package/esm/Progress/Progress.js +1 -0
- package/esm/Progress/ProgressCircle.js +30 -39
- package/esm/Progress/ProgressLine.js +19 -21
- package/esm/Progress/index.js +1 -0
- package/esm/Radio/Radio.js +42 -52
- package/esm/Radio/index.js +1 -0
- package/esm/RadioGroup/RadioGroup.js +22 -25
- package/esm/RadioGroup/index.js +1 -0
- package/esm/RadioTile/RadioTile.js +30 -34
- package/esm/RadioTile/index.js +1 -0
- package/esm/RadioTileGroup/RadioTileGroup.js +17 -20
- package/esm/RadioTileGroup/index.js +1 -0
- package/esm/RangeSlider/RangeSlider.js +63 -86
- package/esm/RangeSlider/index.js +1 -0
- package/esm/Rate/Character.js +16 -21
- package/esm/Rate/Rate.js +35 -48
- package/esm/Rate/index.js +1 -0
- package/esm/Rate/utils.js +1 -2
- package/esm/Ripple/Ripple.js +16 -30
- package/esm/Ripple/index.js +1 -0
- package/esm/Row/Row.js +11 -14
- package/esm/Row/index.js +1 -0
- package/esm/SafeAnchor/SafeAnchor.js +8 -13
- package/esm/SafeAnchor/index.js +1 -0
- package/esm/Schema/Schema.js +1 -0
- package/esm/Schema/index.js +1 -0
- package/esm/SelectPicker/SelectPicker.js +137 -157
- package/esm/SelectPicker/index.js +1 -0
- package/esm/Sidebar/Sidebar.js +13 -18
- package/esm/Sidebar/index.js +1 -0
- package/esm/Sidenav/ExpandedSidenavDropdown.js +32 -35
- package/esm/Sidenav/ExpandedSidenavDropdownItem.js +19 -27
- package/esm/Sidenav/ExpandedSidenavDropdownMenu.js +22 -29
- package/esm/Sidenav/Node.js +1 -10
- package/esm/Sidenav/Sidenav.js +22 -28
- package/esm/Sidenav/SidenavBody.js +1 -0
- package/esm/Sidenav/SidenavDropdown.js +39 -52
- package/esm/Sidenav/SidenavDropdownCollapse.js +9 -13
- package/esm/Sidenav/SidenavDropdownItem.js +19 -31
- package/esm/Sidenav/SidenavDropdownMenu.js +26 -41
- package/esm/Sidenav/SidenavDropdownToggle.js +12 -14
- package/esm/Sidenav/SidenavHeader.js +1 -0
- package/esm/Sidenav/SidenavItem.js +27 -37
- package/esm/Sidenav/SidenavToggle.js +11 -18
- package/esm/Sidenav/index.js +1 -0
- package/esm/Slider/Graduated.js +14 -21
- package/esm/Slider/Handle.js +27 -39
- package/esm/Slider/Input.js +2 -2
- package/esm/Slider/Mark.js +11 -14
- package/esm/Slider/ProgressBar.js +14 -18
- package/esm/Slider/Slider.js +51 -67
- package/esm/Slider/index.js +1 -0
- package/esm/Slider/utils.js +1 -5
- package/esm/Stack/Stack.js +22 -27
- package/esm/Stack/StackItem.js +11 -11
- package/esm/Stack/index.js +1 -0
- package/esm/Steps/StepItem.js +16 -22
- package/esm/Steps/Steps.js +18 -22
- package/esm/Steps/index.js +1 -0
- package/esm/Table/Table.js +6 -7
- package/esm/Table/index.js +1 -0
- package/esm/Tag/Tag.js +16 -19
- package/esm/Tag/index.js +1 -0
- package/esm/TagGroup/TagGroup.js +1 -0
- package/esm/TagGroup/index.js +1 -0
- package/esm/TagInput/index.d.ts +3 -0
- package/esm/TagInput/index.js +11 -9
- package/esm/TagPicker/index.d.ts +3 -0
- package/esm/TagPicker/index.js +9 -7
- package/esm/Timeline/Timeline.js +14 -19
- package/esm/Timeline/TimelineItem.js +14 -15
- package/esm/Timeline/index.js +1 -0
- package/esm/Toggle/Toggle.js +26 -35
- package/esm/Toggle/index.js +1 -0
- package/esm/Tooltip/Tooltip.js +13 -16
- package/esm/Tooltip/index.js +1 -0
- package/esm/Tree/Tree.js +1 -3
- package/esm/Tree/TreeContext.js +1 -0
- package/esm/Tree/index.js +1 -0
- package/esm/TreePicker/TreeNode.js +37 -49
- package/esm/TreePicker/TreePicker.js +155 -218
- package/esm/TreePicker/index.js +1 -0
- package/esm/Uploader/UploadFileItem.js +37 -68
- package/esm/Uploader/UploadTrigger.js +24 -38
- package/esm/Uploader/Uploader.js +90 -132
- package/esm/Uploader/index.js +1 -0
- package/esm/Whisper/Whisper.js +8 -10
- package/esm/Whisper/index.js +1 -0
- package/esm/Windowing/AutoSizer.js +13 -24
- package/esm/Windowing/List.d.ts +2 -2
- package/esm/Windowing/List.js +6 -15
- package/esm/Windowing/index.js +1 -0
- package/esm/index.js +3 -0
- package/esm/locales/ar_EG.js +1 -0
- package/esm/locales/da_DK.js +1 -1
- package/esm/locales/de_DE.js +1 -1
- package/esm/locales/default.js +1 -1
- package/esm/locales/en_GB.js +1 -0
- package/esm/locales/en_US.js +1 -0
- package/esm/locales/es_AR.js +1 -1
- package/esm/locales/es_ES.js +1 -1
- package/esm/locales/fa_IR.js +1 -0
- package/esm/locales/fi_FI.js +1 -1
- package/esm/locales/fr_FR.js +1 -0
- package/esm/locales/hu_HU.js +1 -1
- package/esm/locales/index.js +1 -0
- package/esm/locales/it_IT.js +1 -1
- package/esm/locales/ja_JP.js +1 -1
- package/esm/locales/kk_KZ.js +1 -0
- package/esm/locales/ko_KR.js +1 -1
- package/esm/locales/ne_NP.js +1 -1
- package/esm/locales/nl_NL.js +1 -0
- package/esm/locales/pt_BR.js +1 -0
- package/esm/locales/ru_RU.js +1 -0
- package/esm/locales/sv_SE.js +1 -1
- package/esm/locales/tr_TR.js +1 -0
- package/esm/locales/zh_CN.js +1 -0
- package/esm/locales/zh_TW.js +1 -0
- package/esm/toaster/ToastContainer.js +29 -42
- package/esm/toaster/ToastContext.js +1 -0
- package/esm/toaster/index.js +1 -0
- package/esm/toaster/toaster.js +4 -22
- package/esm/toaster/useToaster.js +3 -5
- package/esm/utils/BrowserDetection.js +9 -9
- package/esm/utils/ReactChildren.js +2 -8
- package/esm/utils/ajaxUpload.js +15 -32
- package/esm/utils/appendTooltip.js +3 -3
- package/esm/utils/attachParent.js +1 -0
- package/esm/utils/clone.js +1 -1
- package/esm/utils/composeFunctions.js +1 -1
- package/esm/utils/constants.js +4 -7
- package/esm/utils/createChainedFunction.js +2 -5
- package/esm/utils/createComponent.js +12 -16
- package/esm/utils/dateUtils.js +7 -23
- package/esm/utils/deprecateComponent.js +2 -2
- package/esm/utils/deprecatePropType.js +4 -6
- package/esm/utils/dom.js +3 -1
- package/esm/utils/events.js +2 -1
- package/esm/utils/getDOMNode.js +15 -8
- package/esm/utils/getDataGroupBy.d.ts +0 -23
- package/esm/utils/getDataGroupBy.js +5 -39
- package/esm/utils/getSafeRegExpString.js +1 -0
- package/esm/utils/guid.js +1 -0
- package/esm/utils/htmlPropsUtils.js +23 -14
- package/esm/utils/index.js +2 -1
- package/esm/utils/isOneOf.js +1 -1
- package/esm/utils/mergeRefs.js +1 -1
- package/esm/utils/placementPolyfill.js +2 -4
- package/esm/utils/prefix.js +4 -4
- package/esm/utils/previewFile.js +1 -3
- package/esm/utils/propTypeChecker.js +1 -3
- package/esm/utils/reactToString.js +1 -2
- package/esm/utils/render.js +3 -5
- package/esm/utils/scrollTopAnimation.js +1 -5
- package/esm/utils/shallowEqual.js +8 -13
- package/esm/utils/shallowEqualArray.js +1 -5
- package/esm/utils/statusIcons.js +1 -0
- package/esm/utils/stringToObject.js +3 -4
- package/esm/utils/tplTransform.js +2 -4
- package/esm/utils/treeUtils.js +113 -265
- package/esm/utils/useClassNames.js +9 -9
- package/esm/utils/useClickOutside.js +4 -6
- package/esm/utils/useControlled.js +12 -6
- package/esm/utils/useCustom.js +12 -20
- package/esm/utils/useElementResize.js +2 -4
- package/esm/utils/useEnsuredRef.js +2 -3
- package/esm/utils/useEventCallback.js +2 -3
- package/esm/utils/useEventListener.js +2 -2
- package/esm/utils/useFocus.js +5 -4
- package/esm/utils/useInternalId.js +2 -3
- package/esm/utils/useIsMounted.js +1 -2
- package/esm/utils/useMap.js +5 -5
- package/esm/utils/useMount.js +1 -3
- package/esm/utils/usePortal.js +7 -13
- package/esm/utils/useRootClose.js +9 -13
- package/esm/utils/useTimeout.js +3 -7
- package/esm/utils/useToggleCaret.js +2 -7
- package/esm/utils/useUniqueId.js +2 -4
- package/esm/utils/useUpdateEffect.js +3 -4
- package/esm/utils/useUpdatedRef.js +2 -1
- package/esm/utils/useWillUnmount.js +4 -2
- package/esm/utils/warnOnce.js +2 -2
- package/package.json +2 -2
- package/styles/color-modes/light.less +4 -4
- package/styles/mixins/listbox.less +0 -2
- package/cjs/SelectPicker/Listbox.d.ts +0 -34
- package/cjs/SelectPicker/Listbox.js +0 -263
- package/cjs/SelectPicker/ListboxOption.d.ts +0 -11
- package/cjs/SelectPicker/ListboxOption.js +0 -50
- package/cjs/SelectPicker/ListboxOptionGroup.d.ts +0 -9
- package/cjs/SelectPicker/ListboxOptionGroup.js +0 -69
- package/esm/SelectPicker/Listbox.d.ts +0 -34
- package/esm/SelectPicker/Listbox.js +0 -240
- package/esm/SelectPicker/ListboxOption.d.ts +0 -11
- package/esm/SelectPicker/ListboxOption.js +0 -37
- package/esm/SelectPicker/ListboxOptionGroup.d.ts +0 -9
- package/esm/SelectPicker/ListboxOptionGroup.js +0 -53
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
4
|
import IconCalendar from '@rsuite/icons/legacy/Calendar';
|
|
@@ -21,88 +22,81 @@ import { deprecatePropTypeNew } from '../utils/deprecatePropType';
|
|
|
21
22
|
import DateRangePickerContext from './DateRangePickerContext';
|
|
22
23
|
var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
23
24
|
var _ref, _ref2, _merge;
|
|
24
|
-
|
|
25
25
|
var _props$as = props.as,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
26
|
+
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
27
|
+
_props$classPrefix = props.classPrefix,
|
|
28
|
+
classPrefix = _props$classPrefix === void 0 ? 'picker' : _props$classPrefix,
|
|
29
|
+
className = props.className,
|
|
30
|
+
_props$appearance = props.appearance,
|
|
31
|
+
appearance = _props$appearance === void 0 ? 'default' : _props$appearance,
|
|
32
|
+
_props$editable = props.editable,
|
|
33
|
+
editable = _props$editable === void 0 ? true : _props$editable,
|
|
34
|
+
_props$cleanable = props.cleanable,
|
|
35
|
+
cleanable = _props$cleanable === void 0 ? true : _props$cleanable,
|
|
36
|
+
_props$character = props.character,
|
|
37
|
+
character = _props$character === void 0 ? ' ~ ' : _props$character,
|
|
38
|
+
defaultCalendarValue = props.defaultCalendarValue,
|
|
39
|
+
defaultValue = props.defaultValue,
|
|
40
|
+
disabled = props.disabled,
|
|
41
|
+
DEPRECATED_disabledDateProp = props.disabledDate,
|
|
42
|
+
shouldDisableDate = props.shouldDisableDate,
|
|
43
|
+
_props$format = props.format,
|
|
44
|
+
formatStr = _props$format === void 0 ? 'yyyy-MM-dd' : _props$format,
|
|
45
|
+
hoverRange = props.hoverRange,
|
|
46
|
+
_props$isoWeek = props.isoWeek,
|
|
47
|
+
isoWeek = _props$isoWeek === void 0 ? false : _props$isoWeek,
|
|
48
|
+
_props$limitEndYear = props.limitEndYear,
|
|
49
|
+
limitEndYear = _props$limitEndYear === void 0 ? 1000 : _props$limitEndYear,
|
|
50
|
+
limitStartYear = props.limitStartYear,
|
|
51
|
+
overrideLocale = props.locale,
|
|
52
|
+
menuClassName = props.menuClassName,
|
|
53
|
+
menuStyle = props.menuStyle,
|
|
54
|
+
oneTap = props.oneTap,
|
|
55
|
+
_props$placeholder = props.placeholder,
|
|
56
|
+
placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
|
|
57
|
+
_props$placement = props.placement,
|
|
58
|
+
placement = _props$placement === void 0 ? 'bottomStart' : _props$placement,
|
|
59
|
+
ranges = props.ranges,
|
|
60
|
+
renderValue = props.renderValue,
|
|
61
|
+
_props$showOneCalenda = props.showOneCalendar,
|
|
62
|
+
showOneCalendar = _props$showOneCalenda === void 0 ? false : _props$showOneCalenda,
|
|
63
|
+
showWeekNumbers = props.showWeekNumbers,
|
|
64
|
+
showMeridian = props.showMeridian,
|
|
65
|
+
style = props.style,
|
|
66
|
+
toggleAs = props.toggleAs,
|
|
67
|
+
caretAs = props.caretAs,
|
|
68
|
+
valueProp = props.value,
|
|
69
|
+
onChange = props.onChange,
|
|
70
|
+
onClean = props.onClean,
|
|
71
|
+
onClose = props.onClose,
|
|
72
|
+
onEnter = props.onEnter,
|
|
73
|
+
onEntered = props.onEntered,
|
|
74
|
+
onExited = props.onExited,
|
|
75
|
+
onOk = props.onOk,
|
|
76
|
+
onOpen = props.onOpen,
|
|
77
|
+
onSelect = props.onSelect,
|
|
78
|
+
renderTitle = props.renderTitle,
|
|
79
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "defaultCalendarValue", "defaultValue", "disabled", "disabledDate", "shouldDisableDate", "format", "hoverRange", "isoWeek", "limitEndYear", "limitStartYear", "locale", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "renderValue", "showOneCalendar", "showWeekNumbers", "showMeridian", "style", "toggleAs", "caretAs", "value", "onChange", "onClean", "onClose", "onEnter", "onEntered", "onExited", "onOk", "onOpen", "onSelect", "renderTitle"]);
|
|
81
80
|
var _useClassNames = useClassNames(classPrefix),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
merge = _useClassNames.merge,
|
|
82
|
+
prefix = _useClassNames.prefix;
|
|
85
83
|
var _useCustom = useCustom('DateRangePicker', overrideLocale),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
locale = _useCustom.locale,
|
|
85
|
+
formatDate = _useCustom.formatDate,
|
|
86
|
+
parseDate = _useCustom.parseDate;
|
|
90
87
|
var rangeFormatStr = "" + formatStr + character + formatStr;
|
|
91
|
-
|
|
92
88
|
var _useControlled = useControlled(valueProp, defaultValue !== null && defaultValue !== void 0 ? defaultValue : null),
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
value = _useControlled[0],
|
|
90
|
+
setValue = _useControlled[1];
|
|
95
91
|
/**
|
|
96
92
|
* Whether to complete the selection.
|
|
97
93
|
* Everytime selection will change this value. If the value is false, it means that the selection has not been completed.
|
|
98
94
|
*
|
|
99
95
|
* In `oneTap` mode, select action will not change this value, its value should be true always.
|
|
100
96
|
*/
|
|
101
|
-
|
|
102
|
-
|
|
103
97
|
var _useState = useState(true),
|
|
104
|
-
|
|
105
|
-
|
|
98
|
+
isSelectedIdle = _useState[0],
|
|
99
|
+
setSelectedIdle = _useState[1];
|
|
106
100
|
/**
|
|
107
101
|
* The currently selected date range.
|
|
108
102
|
*
|
|
@@ -111,93 +105,80 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
111
105
|
* the second click to determine the end date of the date range.
|
|
112
106
|
*
|
|
113
107
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
108
|
var _useState2 = useState((_ref = valueProp !== null && valueProp !== void 0 ? valueProp : defaultValue) !== null && _ref !== void 0 ? _ref : []),
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
109
|
+
selectedDates = _useState2[0],
|
|
110
|
+
setSelectedDates = _useState2[1]; // The date of the current hover, used to reduce the calculation of `handleMouseMove`
|
|
121
111
|
var _useState3 = useState(null),
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
112
|
+
hoverDateRange = _useState3[0],
|
|
113
|
+
setHoverDateRange = _useState3[1]; // The displayed calendar panel is rendered based on this value.
|
|
126
114
|
var _useState4 = useState(getSafeCalendarDate({
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
value: (_ref2 = value !== null && value !== void 0 ? value : defaultCalendarValue) !== null && _ref2 !== void 0 ? _ref2 : null
|
|
116
|
+
})),
|
|
117
|
+
calendarDate = _useState4[0],
|
|
118
|
+
setCalendarDate = _useState4[1];
|
|
132
119
|
var _useState5 = useState(),
|
|
133
|
-
|
|
134
|
-
|
|
120
|
+
inputState = _useState5[0],
|
|
121
|
+
setInputState = _useState5[1];
|
|
135
122
|
/**
|
|
136
123
|
* When hoverRange is set, `selectValue` will be updated during the hover process,
|
|
137
124
|
* which will cause the `selectValue` to be updated after the first click,
|
|
138
125
|
* so declare a Ref to temporarily store the `selectValue` of the first click.
|
|
139
126
|
*/
|
|
140
|
-
|
|
141
|
-
|
|
142
127
|
var selectRangeValueRef = useRef(null);
|
|
128
|
+
|
|
143
129
|
/**
|
|
144
130
|
* Get the time on the calendar.
|
|
145
131
|
*/
|
|
146
|
-
|
|
147
132
|
var getCalendarDatetime = useCallback(function (calendarKey) {
|
|
148
133
|
var index = calendarKey === 'start' ? 0 : 1;
|
|
149
134
|
return (calendarDate === null || calendarDate === void 0 ? void 0 : calendarDate[index]) || (defaultCalendarValue === null || defaultCalendarValue === void 0 ? void 0 : defaultCalendarValue[index]);
|
|
150
135
|
}, [calendarDate, defaultCalendarValue]);
|
|
136
|
+
|
|
151
137
|
/**
|
|
152
138
|
* Call this function to update the calendar panel rendering benchmark value.
|
|
153
139
|
* If params `value` is not passed, it defaults to [new Date(), addMonth(new Date(), 1)].
|
|
154
140
|
*/
|
|
155
|
-
|
|
156
141
|
var updateCalendarDateRange = useCallback(function (_ref3) {
|
|
157
142
|
var dateRange = _ref3.dateRange,
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var nextValue = dateRange;
|
|
143
|
+
calendarKey = _ref3.calendarKey,
|
|
144
|
+
eventName = _ref3.eventName;
|
|
145
|
+
var nextValue = dateRange;
|
|
161
146
|
|
|
147
|
+
// The time should remain the same when the dates in the date range are changed.
|
|
162
148
|
if (shouldRenderTime(formatStr) && dateRange !== null && dateRange !== void 0 && dateRange.length && eventName !== 'changeTime') {
|
|
163
149
|
var _startDate = copyTime({
|
|
164
150
|
from: getCalendarDatetime('start'),
|
|
165
151
|
to: dateRange[0]
|
|
166
152
|
});
|
|
167
|
-
|
|
168
153
|
var _endDate = copyTime({
|
|
169
154
|
from: getCalendarDatetime('end'),
|
|
170
155
|
to: dateRange.length === 1 ? addMonths(_startDate, 1) : dateRange[1]
|
|
171
156
|
});
|
|
172
|
-
|
|
173
157
|
nextValue = [_startDate, _endDate];
|
|
174
158
|
} else if (dateRange === null && typeof defaultCalendarValue !== 'undefined') {
|
|
175
159
|
// Make the calendar render the value of defaultCalendarValue after clearing the value.
|
|
176
160
|
nextValue = defaultCalendarValue;
|
|
177
161
|
}
|
|
178
|
-
|
|
179
162
|
setCalendarDate(getSafeCalendarDate({
|
|
180
163
|
value: nextValue,
|
|
181
164
|
calendarKey: calendarKey
|
|
182
165
|
}));
|
|
183
|
-
}, [formatStr, defaultCalendarValue, getCalendarDatetime]);
|
|
166
|
+
}, [formatStr, defaultCalendarValue, getCalendarDatetime]);
|
|
184
167
|
|
|
168
|
+
// if valueProp changed then update selectValue/hoverValue
|
|
185
169
|
useEffect(function () {
|
|
186
170
|
setSelectedDates(valueProp !== null && valueProp !== void 0 ? valueProp : []);
|
|
187
171
|
setHoverDateRange(valueProp !== null && valueProp !== void 0 ? valueProp : null);
|
|
188
172
|
}, [valueProp]);
|
|
189
|
-
|
|
190
173
|
var _useState6 = useState(false),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
174
|
+
isPickerToggleActive = _useState6[0],
|
|
175
|
+
setPickerToggleActive = _useState6[1];
|
|
194
176
|
var rootRef = useRef(null);
|
|
195
177
|
var overlayRef = useRef(null);
|
|
196
178
|
var targetRef = useRef(null);
|
|
197
179
|
var triggerRef = useRef(null);
|
|
198
180
|
var handleCloseDropdown = useCallback(function () {
|
|
199
181
|
var _triggerRef$current, _triggerRef$current$c;
|
|
200
|
-
|
|
201
182
|
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : (_triggerRef$current$c = _triggerRef$current.close) === null || _triggerRef$current$c === void 0 ? void 0 : _triggerRef$current$c.call(_triggerRef$current);
|
|
202
183
|
}, []);
|
|
203
184
|
usePublicMethods(ref, {
|
|
@@ -208,17 +189,13 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
208
189
|
});
|
|
209
190
|
var getDisplayString = useCallback(function (nextValue, isPlaintext) {
|
|
210
191
|
var _nextValue$, _nextValue$2;
|
|
211
|
-
|
|
212
192
|
var startDate = (_nextValue$ = nextValue === null || nextValue === void 0 ? void 0 : nextValue[0]) !== null && _nextValue$ !== void 0 ? _nextValue$ : null;
|
|
213
193
|
var endDate = (_nextValue$2 = nextValue === null || nextValue === void 0 ? void 0 : nextValue[1]) !== null && _nextValue$2 !== void 0 ? _nextValue$2 : null;
|
|
214
|
-
|
|
215
194
|
if (startDate && endDate) {
|
|
216
195
|
var displayValue = [startDate, endDate].sort(compareAsc);
|
|
217
|
-
|
|
218
196
|
if (isPlaintext) {
|
|
219
197
|
return formatDate(displayValue[0], formatStr) + character + formatDate(displayValue[1], formatStr);
|
|
220
198
|
}
|
|
221
|
-
|
|
222
199
|
return renderValue ? renderValue(displayValue, formatStr) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormattedDate, {
|
|
223
200
|
date: displayValue[0],
|
|
224
201
|
formatStr: formatStr
|
|
@@ -227,13 +204,12 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
227
204
|
formatStr: formatStr
|
|
228
205
|
}));
|
|
229
206
|
}
|
|
230
|
-
|
|
231
207
|
return isPlaintext ? '' : placeholder || rangeFormatStr;
|
|
232
208
|
}, [character, formatDate, formatStr, placeholder, rangeFormatStr, renderValue]);
|
|
209
|
+
|
|
233
210
|
/**
|
|
234
211
|
* preset hover range
|
|
235
212
|
*/
|
|
236
|
-
|
|
237
213
|
var getHoverRangeValue = useCallback(function (date) {
|
|
238
214
|
function getHoverRangeFunc() {
|
|
239
215
|
if (hoverRange === 'week') {
|
|
@@ -241,94 +217,86 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
241
217
|
} else if (hoverRange === 'month') {
|
|
242
218
|
return getMonthHoverRange;
|
|
243
219
|
}
|
|
244
|
-
|
|
245
220
|
return hoverRange;
|
|
246
221
|
}
|
|
247
|
-
|
|
248
222
|
var hoverRangeFunc = getHoverRangeFunc();
|
|
249
|
-
|
|
250
223
|
if (isNil(hoverRangeFunc)) {
|
|
251
224
|
return null;
|
|
252
225
|
}
|
|
253
|
-
|
|
254
226
|
var hoverValues = hoverRangeFunc(date);
|
|
255
227
|
var isHoverRangeValid = hoverValues instanceof Array && hoverValues.length === 2;
|
|
256
|
-
|
|
257
228
|
if (!isHoverRangeValid) {
|
|
258
229
|
return null;
|
|
259
230
|
}
|
|
260
|
-
|
|
261
231
|
if (isAfter(hoverValues[0], hoverValues[1])) {
|
|
262
232
|
hoverValues = reverseDateRangeOmitTime(hoverValues);
|
|
263
233
|
}
|
|
264
|
-
|
|
265
234
|
return hoverValues;
|
|
266
235
|
}, [hoverRange, isoWeek]);
|
|
267
236
|
var handleValueUpdate = useCallback(function (event, nextValue, closeOverlay) {
|
|
268
237
|
if (closeOverlay === void 0) {
|
|
269
238
|
closeOverlay = true;
|
|
270
239
|
}
|
|
271
|
-
|
|
272
240
|
// If nextValue is null, it means that the user is erasing the selected dates.
|
|
273
241
|
setSelectedDates(nextValue !== null && nextValue !== void 0 ? nextValue : []);
|
|
274
|
-
|
|
275
242
|
if (!isSameRange(nextValue, value, formatStr)) {
|
|
276
243
|
setValue(nextValue);
|
|
277
244
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
278
|
-
}
|
|
279
|
-
|
|
245
|
+
}
|
|
280
246
|
|
|
247
|
+
// `closeOverlay` default value is `true`
|
|
281
248
|
if (closeOverlay !== false) {
|
|
282
249
|
handleCloseDropdown();
|
|
283
250
|
}
|
|
284
251
|
}, [formatStr, handleCloseDropdown, onChange, setValue, value]);
|
|
252
|
+
|
|
285
253
|
/**
|
|
286
254
|
* Select the date range. If oneTap is not set, you need to click twice to select the start time and end time.
|
|
287
255
|
* The MouseMove event is called between the first click and the second click to update the selection state.
|
|
288
256
|
*/
|
|
289
|
-
|
|
290
257
|
var handleMouseMove = useCallback(function (date) {
|
|
291
|
-
var nextHoverDateRange = getHoverRangeValue(date);
|
|
258
|
+
var nextHoverDateRange = getHoverRangeValue(date);
|
|
259
|
+
|
|
260
|
+
// If hasDoneSelect is false,
|
|
292
261
|
// it means there's already one selected date
|
|
293
262
|
// and waiting for user to select the second date to complete the selection.
|
|
294
|
-
|
|
295
263
|
if (!isSelectedIdle) {
|
|
296
264
|
// If `hoverRange` is set, you need to change the value of hoverDateRange according to the rules
|
|
297
265
|
if (!isNil(nextHoverDateRange) && !isNil(selectRangeValueRef.current)) {
|
|
298
266
|
var nextSelectedDates = [selectRangeValueRef.current[0], nextHoverDateRange[1]];
|
|
299
|
-
|
|
300
267
|
if (DateUtils.isBefore(nextHoverDateRange[0], selectRangeValueRef.current[0])) {
|
|
301
268
|
nextSelectedDates = [nextHoverDateRange[0], selectRangeValueRef.current[1]];
|
|
302
269
|
}
|
|
303
|
-
|
|
304
270
|
setSelectedDates(nextSelectedDates);
|
|
305
271
|
} else {
|
|
306
272
|
setHoverDateRange(function (prevHoverValue) {
|
|
307
273
|
return isNil(prevHoverValue) ? null : [prevHoverValue[0], date];
|
|
308
274
|
});
|
|
309
|
-
}
|
|
275
|
+
}
|
|
310
276
|
|
|
277
|
+
// Before the first click, if nextHoverDateRange has a value, hoverDateRange needs to be updated
|
|
311
278
|
} else if (!isNil(nextHoverDateRange)) {
|
|
312
279
|
setHoverDateRange(nextHoverDateRange);
|
|
313
280
|
}
|
|
314
281
|
}, [getHoverRangeValue, isSelectedIdle]);
|
|
282
|
+
|
|
315
283
|
/**
|
|
316
284
|
* Callback for selecting a date cell in the calendar grid
|
|
317
285
|
*/
|
|
318
|
-
|
|
319
286
|
var handleSelectDate = useCallback(function (index, date, event) {
|
|
320
287
|
var calendarKey = index === 0 ? 'start' : 'end';
|
|
321
288
|
var nextSelectDates = hoverDateRange !== null && hoverDateRange !== void 0 ? hoverDateRange : [];
|
|
322
289
|
var hoverRangeValue = getHoverRangeValue(date);
|
|
323
|
-
var noHoverRangeValid = isNil(hoverRangeValue);
|
|
290
|
+
var noHoverRangeValid = isNil(hoverRangeValue);
|
|
324
291
|
|
|
292
|
+
// in `oneTap` mode
|
|
325
293
|
if (isSelectedIdle && oneTap) {
|
|
326
294
|
handleValueUpdate(event, noHoverRangeValid ? [startOfDay(date), endOfDay(date)] : hoverRangeValue);
|
|
327
295
|
setSelectedIdle(false);
|
|
328
296
|
return;
|
|
329
|
-
}
|
|
330
|
-
|
|
297
|
+
}
|
|
331
298
|
|
|
299
|
+
// no preset hover range can use
|
|
332
300
|
if (noHoverRangeValid) {
|
|
333
301
|
// start select
|
|
334
302
|
if (isSelectedIdle) {
|
|
@@ -346,13 +314,11 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
346
314
|
selectRangeValueRef.current = hoverRangeValue;
|
|
347
315
|
}
|
|
348
316
|
}
|
|
349
|
-
|
|
350
317
|
if (nextSelectDates.length === 2) {
|
|
351
318
|
// If user have completed the selection, then sort the selected dates.
|
|
352
319
|
if (isAfter(nextSelectDates[0], nextSelectDates[1])) {
|
|
353
320
|
nextSelectDates = reverseDateRangeOmitTime(nextSelectDates);
|
|
354
321
|
}
|
|
355
|
-
|
|
356
322
|
if (shouldRenderTime(formatStr)) {
|
|
357
323
|
nextSelectDates = [copyTime({
|
|
358
324
|
from: getCalendarDatetime('start'),
|
|
@@ -362,12 +328,10 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
362
328
|
to: nextSelectDates[1]
|
|
363
329
|
})];
|
|
364
330
|
}
|
|
365
|
-
|
|
366
331
|
setHoverDateRange(nextSelectDates);
|
|
367
332
|
} else {
|
|
368
333
|
setHoverDateRange([nextSelectDates[0], nextSelectDates[0]]);
|
|
369
334
|
}
|
|
370
|
-
|
|
371
335
|
setSelectedDates(nextSelectDates);
|
|
372
336
|
updateCalendarDateRange({
|
|
373
337
|
dateRange: nextSelectDates,
|
|
@@ -377,12 +341,12 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
377
341
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(date, event);
|
|
378
342
|
setSelectedIdle(!isSelectedIdle);
|
|
379
343
|
}, [formatStr, getCalendarDatetime, getHoverRangeValue, handleValueUpdate, hoverDateRange, isSelectedIdle, onSelect, oneTap, selectedDates, updateCalendarDateRange]);
|
|
344
|
+
|
|
380
345
|
/**
|
|
381
346
|
* If `selectValue` changed, there will be the following effects.
|
|
382
347
|
* 1. Check if the selection is completed.
|
|
383
348
|
* 2. if the selection is completed, set the temporary `hoverValue` empty.
|
|
384
349
|
*/
|
|
385
|
-
|
|
386
350
|
useEffect(function () {
|
|
387
351
|
var selectValueLength = selectedDates.length;
|
|
388
352
|
var doneSelected = selectValueLength === 0 || selectValueLength === 2;
|
|
@@ -408,8 +372,9 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
408
372
|
eventName: 'changeTime'
|
|
409
373
|
});
|
|
410
374
|
setSelectedDates(function (prev) {
|
|
411
|
-
var next = [].concat(prev);
|
|
375
|
+
var next = [].concat(prev);
|
|
412
376
|
|
|
377
|
+
// if next[index] is not empty, only update the time after aligning the year, month and day
|
|
413
378
|
next[index] = next[index] ? copyTime({
|
|
414
379
|
from: date,
|
|
415
380
|
to: next[index]
|
|
@@ -417,41 +382,40 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
417
382
|
return next;
|
|
418
383
|
});
|
|
419
384
|
}, [calendarDate, updateCalendarDateRange]);
|
|
385
|
+
|
|
420
386
|
/**
|
|
421
387
|
* The callback triggered when PM/AM is switched.
|
|
422
388
|
*/
|
|
423
|
-
|
|
424
389
|
var handleToggleMeridian = useCallback(function (index) {
|
|
425
390
|
var nextCalendarDate = Array.from(calendarDate);
|
|
426
391
|
nextCalendarDate[index] = getReversedTimeMeridian(nextCalendarDate[index]);
|
|
427
|
-
setCalendarDate(nextCalendarDate);
|
|
392
|
+
setCalendarDate(nextCalendarDate);
|
|
428
393
|
|
|
394
|
+
// If the value already exists, update the value again.
|
|
429
395
|
if (selectedDates.length === 2) {
|
|
430
396
|
var nextSelectedDates = Array.from(selectedDates);
|
|
431
397
|
nextSelectedDates[index] = getReversedTimeMeridian(nextSelectedDates[index]);
|
|
432
398
|
setSelectedDates(nextSelectedDates);
|
|
433
399
|
}
|
|
434
400
|
}, [calendarDate, selectedDates]);
|
|
401
|
+
|
|
435
402
|
/**
|
|
436
403
|
* Toolbar operation callback function
|
|
437
404
|
*/
|
|
438
|
-
|
|
439
405
|
var handleShortcutPageDate = useCallback(function (value, closeOverlay, event) {
|
|
440
406
|
if (closeOverlay === void 0) {
|
|
441
407
|
closeOverlay = false;
|
|
442
408
|
}
|
|
443
|
-
|
|
444
409
|
updateCalendarDateRange({
|
|
445
410
|
dateRange: value
|
|
446
411
|
});
|
|
447
|
-
|
|
448
412
|
if (closeOverlay) {
|
|
449
413
|
handleValueUpdate(event, value, closeOverlay);
|
|
450
414
|
} else {
|
|
451
415
|
setSelectedDates(value !== null && value !== void 0 ? value : []);
|
|
452
|
-
}
|
|
453
|
-
|
|
416
|
+
}
|
|
454
417
|
|
|
418
|
+
// End unfinished selections.
|
|
455
419
|
setSelectedIdle(true);
|
|
456
420
|
}, [handleValueUpdate, updateCalendarDateRange]);
|
|
457
421
|
var handleOK = useCallback(function (event) {
|
|
@@ -464,15 +428,16 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
464
428
|
});
|
|
465
429
|
handleValueUpdate(event, null);
|
|
466
430
|
}, [handleValueUpdate, updateCalendarDateRange]);
|
|
431
|
+
|
|
467
432
|
/**
|
|
468
433
|
* Callback after the input box value is changed.
|
|
469
434
|
*/
|
|
470
|
-
|
|
471
435
|
var handleInputChange = useCallback(function (value) {
|
|
472
436
|
setInputState('Typing');
|
|
473
|
-
var rangeValue = value.split(character);
|
|
474
|
-
// isMatch('2020-11-01', 'MM/dd/yyyy') ==> false
|
|
437
|
+
var rangeValue = value.split(character);
|
|
475
438
|
|
|
439
|
+
// isMatch('01/11/2020', 'MM/dd/yyyy') ==> true
|
|
440
|
+
// isMatch('2020-11-01', 'MM/dd/yyyy') ==> false
|
|
476
441
|
if (!DateUtils.isMatch(rangeValue[0], formatStr, {
|
|
477
442
|
locale: locale.dateLocale
|
|
478
443
|
}) || !DateUtils.isMatch(rangeValue[1], formatStr, {
|
|
@@ -481,45 +446,40 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
481
446
|
setInputState('Error');
|
|
482
447
|
return;
|
|
483
448
|
}
|
|
484
|
-
|
|
485
449
|
var startDate = parseDate(rangeValue[0], formatStr);
|
|
486
450
|
var endDate = parseDate(rangeValue[1], formatStr);
|
|
487
451
|
var selectValue = [startDate, endDate];
|
|
488
|
-
|
|
489
452
|
if (!DateUtils.isValid(startDate) || !DateUtils.isValid(endDate)) {
|
|
490
453
|
setInputState('Error');
|
|
491
454
|
return;
|
|
492
455
|
}
|
|
493
|
-
|
|
494
456
|
if (isDateDisabled(startDate, selectValue, true, DATERANGE_DISABLED_TARGET.CALENDAR)) {
|
|
495
457
|
setInputState('Error');
|
|
496
458
|
return;
|
|
497
459
|
}
|
|
498
|
-
|
|
499
460
|
setHoverDateRange(selectValue);
|
|
500
461
|
setSelectedDates(selectValue);
|
|
501
462
|
updateCalendarDateRange({
|
|
502
463
|
dateRange: selectValue
|
|
503
464
|
});
|
|
504
|
-
},
|
|
465
|
+
},
|
|
466
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
505
467
|
[character, rangeFormatStr, updateCalendarDateRange]);
|
|
468
|
+
|
|
506
469
|
/**
|
|
507
470
|
* The callback after the enter key is triggered on the input
|
|
508
471
|
*/
|
|
509
|
-
|
|
510
472
|
var handleInputPressEnd = useCallback(function (event) {
|
|
511
473
|
if (inputState === 'Typing') {
|
|
512
474
|
handleValueUpdate(event, selectedDates.length === 2 ? selectedDates : null);
|
|
513
475
|
}
|
|
514
|
-
|
|
515
476
|
setInputState('Initial');
|
|
516
477
|
}, [handleValueUpdate, selectedDates, inputState]);
|
|
517
478
|
var handleEnter = useCallback(function () {
|
|
518
479
|
var nextCalendarDate;
|
|
519
|
-
|
|
520
480
|
if (value && value.length) {
|
|
521
481
|
var _startDate2 = value[0],
|
|
522
|
-
|
|
482
|
+
endData = value[1];
|
|
523
483
|
nextCalendarDate = [_startDate2, isSameMonth(_startDate2, endData) ? addMonths(endData, 1) : endData];
|
|
524
484
|
} else {
|
|
525
485
|
// Reset the date on the calendar to the default date
|
|
@@ -527,7 +487,6 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
527
487
|
value: defaultCalendarValue !== null && defaultCalendarValue !== void 0 ? defaultCalendarValue : null
|
|
528
488
|
});
|
|
529
489
|
}
|
|
530
|
-
|
|
531
490
|
setSelectedDates(value !== null && value !== void 0 ? value : []);
|
|
532
491
|
updateCalendarDateRange({
|
|
533
492
|
dateRange: nextCalendarDate
|
|
@@ -546,11 +505,9 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
546
505
|
if (typeof shouldDisableDate === 'function') {
|
|
547
506
|
return shouldDisableDate(date, selectDate, selectedDone, target);
|
|
548
507
|
}
|
|
549
|
-
|
|
550
508
|
if (typeof DEPRECATED_disabledDateProp === 'function') {
|
|
551
509
|
return DEPRECATED_disabledDateProp(date, selectDate, selectedDone, target);
|
|
552
510
|
}
|
|
553
|
-
|
|
554
511
|
return false;
|
|
555
512
|
}, [DEPRECATED_disabledDateProp, shouldDisableDate]);
|
|
556
513
|
var disabledByBetween = useCallback(function (start, end, type) {
|
|
@@ -560,35 +517,28 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
560
517
|
if (isDateDisabled(start, selectedDates, isSelectedIdle, type)) {
|
|
561
518
|
return true;
|
|
562
519
|
}
|
|
563
|
-
|
|
564
520
|
start = DateUtils.addDays(start, 1);
|
|
565
521
|
}
|
|
566
|
-
|
|
567
522
|
return false;
|
|
568
523
|
}, [isDateDisabled, isSelectedIdle, selectedDates]);
|
|
569
524
|
var disabledOkButton = useCallback(function () {
|
|
570
525
|
var start = selectedDates[0],
|
|
571
|
-
|
|
572
|
-
|
|
526
|
+
end = selectedDates[1];
|
|
573
527
|
if (!start || !end || !isSelectedIdle) {
|
|
574
528
|
return true;
|
|
575
529
|
}
|
|
576
|
-
|
|
577
530
|
return disabledByBetween(start, end, DATERANGE_DISABLED_TARGET.TOOLBAR_BUTTON_OK);
|
|
578
531
|
}, [disabledByBetween, isSelectedIdle, selectedDates]);
|
|
579
532
|
var disabledShortcutButton = useCallback(function (value) {
|
|
580
533
|
if (value === void 0) {
|
|
581
534
|
value = [];
|
|
582
535
|
}
|
|
583
|
-
|
|
584
536
|
var _value = value,
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
537
|
+
start = _value[0],
|
|
538
|
+
end = _value[1];
|
|
588
539
|
if (!start || !end) {
|
|
589
540
|
return true;
|
|
590
541
|
}
|
|
591
|
-
|
|
592
542
|
return disabledByBetween(start, end, DATERANGE_DISABLED_TARGET.TOOLBAR_SHORTCUT);
|
|
593
543
|
}, [disabledByBetween]);
|
|
594
544
|
var handleDisabledDate = useCallback(function (date, values, type) {
|
|
@@ -600,21 +550,18 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
600
550
|
active: isPickerToggleActive,
|
|
601
551
|
onExit: handleClean
|
|
602
552
|
}, rest));
|
|
603
|
-
|
|
604
553
|
var renderDropdownMenu = function renderDropdownMenu(positionProps, speakerRef) {
|
|
605
554
|
var left = positionProps.left,
|
|
606
|
-
|
|
607
|
-
|
|
555
|
+
top = positionProps.top,
|
|
556
|
+
className = positionProps.className;
|
|
608
557
|
var classes = merge(className, menuClassName, prefix('daterange-menu'));
|
|
609
558
|
var panelClasses = prefix('daterange-panel', {
|
|
610
559
|
'daterange-panel-show-one-calendar': showOneCalendar
|
|
611
560
|
});
|
|
612
|
-
|
|
613
561
|
var styles = _extends({}, menuStyle, {
|
|
614
562
|
left: left,
|
|
615
563
|
top: top
|
|
616
564
|
});
|
|
617
|
-
|
|
618
565
|
var calendarProps = {
|
|
619
566
|
calendarDate: calendarDate,
|
|
620
567
|
disabledDate: handleDisabledDate,
|
|
@@ -684,19 +631,16 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
684
631
|
ranges: bottomRanges
|
|
685
632
|
})))));
|
|
686
633
|
};
|
|
687
|
-
|
|
688
634
|
var hasValue = !isNil(value) && value.length > 1;
|
|
689
|
-
|
|
690
635
|
var _usePickerClassName = usePickerClassName(_extends({}, props, {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
636
|
+
classPrefix: classPrefix,
|
|
637
|
+
name: 'daterange',
|
|
638
|
+
appearance: appearance,
|
|
639
|
+
hasValue: hasValue,
|
|
640
|
+
cleanable: cleanable
|
|
641
|
+
})),
|
|
642
|
+
classes = _usePickerClassName[0],
|
|
643
|
+
usedClassNamePropKeys = _usePickerClassName[1];
|
|
700
644
|
return /*#__PURE__*/React.createElement(PickerToggleTrigger, {
|
|
701
645
|
pickerProps: pick(props, pickTriggerPropKeys),
|
|
702
646
|
ref: triggerRef,
|