rsuite 6.1.2 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/Timeline/styles/index.css +11 -0
- package/Timeline/styles/index.scss +13 -0
- package/Uploader/styles/index.css +3 -0
- package/Uploader/styles/index.scss +3 -0
- package/cjs/Affix/Affix.js +4 -4
- package/cjs/Animation/Collapse.js +4 -5
- package/cjs/Animation/Transition.d.ts +2 -2
- package/cjs/Animation/Transition.js +17 -20
- package/cjs/AutoComplete/AutoComplete.d.ts +2 -0
- package/cjs/AutoComplete/AutoComplete.js +12 -10
- package/cjs/Avatar/useImage.js +1 -1
- package/cjs/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/cjs/Badge/Badge.js +1 -4
- package/cjs/Breadcrumb/Breadcrumb.js +4 -4
- package/cjs/Button/Button.js +6 -6
- package/cjs/Calendar/Calendar.js +5 -5
- package/cjs/Calendar/CalendarBody.js +1 -1
- package/cjs/Calendar/CalendarContainer.js +14 -33
- package/cjs/Calendar/CalendarHeader.js +7 -8
- package/cjs/Calendar/Grid/GridCell.js +2 -2
- package/cjs/Calendar/Grid/GridHeaderRow.js +1 -1
- package/cjs/Calendar/Grid/GridRow.js +5 -6
- package/cjs/Calendar/MonthDropdown/MonthDropdown.js +1 -1
- package/cjs/Calendar/MonthDropdown/MonthDropdownItem.js +1 -1
- package/cjs/Calendar/TimeDropdown/TimeDropdown.js +12 -14
- package/cjs/Calendar/hooks/useCalendar.d.ts +16 -17
- package/cjs/Calendar/hooks/useCalendar.js +2 -4
- package/cjs/Calendar/hooks/useCalendarDate.js +5 -9
- package/cjs/Calendar/hooks/useCalendarState.js +6 -12
- package/cjs/Calendar/types.d.ts +0 -1
- package/cjs/Carousel/Carousel.js +5 -6
- package/cjs/CascadeTree/CascadeTree.js +6 -16
- package/cjs/CascadeTree/TreeView.js +5 -7
- package/cjs/CascadeTree/hooks/useSearch.d.ts +0 -1
- package/cjs/CascadeTree/hooks/useSearch.js +1 -1
- package/cjs/CascadeTree/hooks/useSelect.d.ts +0 -1
- package/cjs/CascadeTree/hooks/useSelect.js +3 -4
- package/cjs/CascadeTree/types.d.ts +0 -1
- package/cjs/CascadeTree/utils.js +1 -2
- package/cjs/Cascader/Cascader.js +18 -29
- package/cjs/Cascader/useActive.d.ts +0 -1
- package/cjs/Cascader/useActive.js +4 -6
- package/cjs/CheckPicker/CheckPicker.js +14 -15
- package/cjs/CheckTree/CheckTree.js +1 -1
- package/cjs/CheckTree/CheckTreeNode.js +3 -4
- package/cjs/CheckTree/CheckTreeView.js +5 -5
- package/cjs/CheckTree/hooks/useTreeCheckState.js +2 -2
- package/cjs/CheckTree/utils.js +9 -17
- package/cjs/CheckTreePicker/CheckTreePicker.js +7 -7
- package/cjs/CheckTreePicker/hooks/useFocusState.d.ts +0 -1
- package/cjs/CheckTreePicker/hooks/useFocusState.js +3 -6
- package/cjs/Checkbox/Checkbox.js +4 -5
- package/cjs/Checkbox/hooks/useIndeterminateCheckbox.d.ts +0 -1
- package/cjs/Checkbox/hooks/useIndeterminateCheckbox.js +1 -1
- package/cjs/CheckboxGroup/CheckboxGroup.js +2 -2
- package/cjs/DOMHelper/index.d.ts +1 -2
- package/cjs/DOMHelper/isElement.js +1 -1
- package/cjs/DateInput/DateField.d.ts +122 -3
- package/cjs/DateInput/DateField.js +12 -15
- package/cjs/DateInput/DateInput.js +3 -4
- package/cjs/DateInput/hooks/useDateInputState.d.ts +124 -4
- package/cjs/DateInput/hooks/useDateInputState.js +2 -2
- package/cjs/DateInput/hooks/useIsFocused.js +2 -2
- package/cjs/DateInput/hooks/useKeyboardInputEvent.d.ts +0 -1
- package/cjs/DateInput/hooks/useKeyboardInputEvent.js +8 -9
- package/cjs/DateInput/hooks/useSelectedState.d.ts +0 -1
- package/cjs/DateInput/utils.d.ts +0 -1
- package/cjs/DateInput/utils.js +2 -3
- package/cjs/DatePicker/DatePicker.js +18 -25
- package/cjs/DatePicker/PredefinedRanges.js +3 -3
- package/cjs/DatePicker/Toolbar.js +4 -4
- package/cjs/DatePicker/hooks/useCustomizedInput.d.ts +0 -1
- package/cjs/DatePicker/hooks/useFocus.js +5 -8
- package/cjs/DatePicker/hooks/useMonthView.d.ts +0 -1
- package/cjs/DatePicker/hooks/useMonthView.js +1 -1
- package/cjs/DatePicker/utils.d.ts +1 -2
- package/cjs/DatePicker/utils.js +2 -2
- package/cjs/DateRangeInput/DateRangeInput.js +8 -9
- package/cjs/DateRangePicker/Calendar.js +2 -2
- package/cjs/DateRangePicker/DateRangePicker.js +25 -29
- package/cjs/DateRangePicker/Header.js +3 -3
- package/cjs/DateRangePicker/disabledDateUtils.js +2 -2
- package/cjs/DateRangePicker/hooks/useCalendarHandlers.d.ts +0 -1
- package/cjs/DateRangePicker/hooks/useCalendarHandlers.js +5 -5
- package/cjs/DateRangePicker/utils.js +1 -2
- package/cjs/Dropdown/Dropdown.js +3 -3
- package/cjs/Dropdown/DropdownItem.js +4 -5
- package/cjs/Dropdown/DropdownMenu.d.ts +1 -1
- package/cjs/Dropdown/DropdownMenu.js +1 -1
- package/cjs/Form/Form.d.ts +38 -3
- package/cjs/Form/Form.js +25 -12
- package/cjs/Form/hooks/useFormRef.d.ts +0 -1
- package/cjs/Form/hooks/useFormValidate.d.ts +2 -1
- package/cjs/Form/hooks/useFormValidate.js +136 -20
- package/cjs/Form/hooks/useFormValue.d.ts +0 -1
- package/cjs/Form/index.d.ts +1 -0
- package/cjs/Form/resolvers.d.ts +59 -0
- package/cjs/Form/resolvers.js +4 -0
- package/cjs/FormControl/FormControl.js +5 -5
- package/cjs/FormGroup/FormGroupContext.d.ts +1 -1
- package/cjs/Highlight/utils/highlightText.js +1 -1
- package/cjs/InlineEdit/renderChildren.js +5 -6
- package/cjs/InlineEdit/useEditState.js +9 -12
- package/cjs/InlineEdit/useFocusEvent.d.ts +0 -1
- package/cjs/InlineEdit/useFocusEvent.js +7 -11
- package/cjs/Input/Input.js +1 -1
- package/cjs/InputGroup/InputGroupContext.d.ts +2 -1
- package/cjs/InputNumber/index.d.ts +0 -1
- package/cjs/InputPicker/InputAutosize.js +1 -1
- package/cjs/InputPicker/InputPicker.js +30 -35
- package/cjs/InputPicker/InputSearch.js +1 -2
- package/cjs/InputPicker/hooks/useData.d.ts +0 -1
- package/cjs/InputPicker/hooks/useData.js +1 -1
- package/cjs/InputPicker/hooks/useInput.js +3 -6
- package/cjs/InputPicker/hooks/useMaxWidth.js +2 -4
- package/cjs/List/helper/AutoScroller.js +2 -4
- package/cjs/List/helper/useSortHelper.d.ts +4 -4
- package/cjs/List/helper/useSortHelper.js +13 -19
- package/cjs/MaskedInput/TextMask.d.ts +5 -5
- package/cjs/MaskedInput/TextMask.js +3 -5
- package/cjs/MaskedInput/conformToMask.d.ts +1 -1
- package/cjs/MaskedInput/createTextMaskInputElement.js +2 -3
- package/cjs/Menu/MenuItem.js +3 -4
- package/cjs/Message/Message.js +1 -1
- package/cjs/Modal/Modal.js +8 -10
- package/cjs/Modal/ModalBody.js +1 -1
- package/cjs/Modal/utils.d.ts +2 -3
- package/cjs/Modal/utils.js +2 -3
- package/cjs/MultiCascadeTree/SearchView.js +1 -1
- package/cjs/MultiCascadeTree/TreeView.js +2 -2
- package/cjs/MultiCascadeTree/hooks/useCascadeValue.d.ts +0 -1
- package/cjs/MultiCascadeTree/hooks/useCascadeValue.js +5 -8
- package/cjs/MultiCascadeTree/hooks/useColumnData.d.ts +0 -1
- package/cjs/MultiCascadeTree/hooks/useSearch.d.ts +0 -1
- package/cjs/MultiCascadeTree/hooks/useSearch.js +2 -2
- package/cjs/MultiCascadeTree/hooks/useSelect.js +3 -4
- package/cjs/MultiCascadeTree/types.d.ts +0 -1
- package/cjs/MultiCascadeTree/utils.d.ts +4 -4
- package/cjs/MultiCascadeTree/utils.js +2 -3
- package/cjs/MultiCascader/MultiCascader.js +13 -16
- package/cjs/Nav/AdaptiveNavItem.js +2 -3
- package/cjs/Nav/Nav.d.ts +1 -1
- package/cjs/Nav/Nav.js +4 -4
- package/cjs/Nav/NavDropdown.d.ts +1 -1
- package/cjs/Nav/NavDropdown.js +3 -3
- package/cjs/Nav/NavDropdownItem.js +2 -2
- package/cjs/Nav/NavDropdownMenu.d.ts +1 -1
- package/cjs/Nav/NavDropdownMenu.js +1 -1
- package/cjs/Nav/NavItem.js +4 -4
- package/cjs/Navbar/Navbar.js +1 -1
- package/cjs/Navbar/NavbarContent.js +1 -1
- package/cjs/Navbar/NavbarDrawer.js +1 -1
- package/cjs/Navbar/NavbarDropdown.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdown.js +3 -3
- package/cjs/Navbar/NavbarDropdownItem.js +5 -6
- package/cjs/Navbar/NavbarDropdownMenu.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdownMenu.js +1 -1
- package/cjs/Navbar/NavbarItem.js +4 -4
- package/cjs/Navbar/NavbarToggle.js +2 -2
- package/cjs/Notification/Notification.js +1 -1
- package/cjs/NumberInput/NumberInput.js +3 -3
- package/cjs/NumberInput/hooks/useEvents.d.ts +0 -1
- package/cjs/NumberInput/hooks/useEvents.js +2 -3
- package/cjs/NumberInput/hooks/useWheelHandler.js +1 -2
- package/cjs/Pagination/Pagination.js +1 -1
- package/cjs/Pagination/PaginationButton.js +1 -1
- package/cjs/Pagination/PaginationGroup.js +3 -4
- package/cjs/Panel/Panel.js +2 -2
- package/cjs/PanelGroup/PanelGroup.js +1 -1
- package/cjs/PasswordInput/PasswordInput.js +2 -2
- package/cjs/PinInput/PinInput.js +1 -1
- package/cjs/PinInput/hooks/usePinInputRefs.d.ts +0 -1
- package/cjs/PinInput/hooks/usePinInputRefs.js +2 -4
- package/cjs/PinInput/hooks/usePinValue.d.ts +1 -1
- package/cjs/PinInput/hooks/usePinValue.js +2 -2
- package/cjs/Progress/ProgressLine.js +1 -1
- package/cjs/Progress/types.d.ts +0 -1
- package/cjs/ProgressCircle/hooks/useProgressCirclePath.d.ts +0 -1
- package/cjs/Radio/Radio.js +3 -3
- package/cjs/RadioGroup/RadioGroup.js +1 -1
- package/cjs/RadioTile/RadioTile.js +2 -2
- package/cjs/RadioTileGroup/RadioTileGroup.js +1 -1
- package/cjs/RangeSlider/RangeSlider.js +6 -6
- package/cjs/Rate/Character.js +2 -2
- package/cjs/Rate/Rate.js +3 -3
- package/cjs/Rate/useRatingStates.d.ts +0 -1
- package/cjs/SegmentedControl/SegmentedControl.js +3 -3
- package/cjs/SegmentedControl/hooks/useIndicatorPosition.js +1 -1
- package/cjs/SelectPicker/SelectPicker.js +13 -16
- package/cjs/Sidebar/Sidebar.js +1 -1
- package/cjs/Sidenav/ExpandedSidenavDropdown.js +6 -6
- package/cjs/Sidenav/ExpandedSidenavDropdownItem.js +4 -5
- package/cjs/Sidenav/Node.js +9 -16
- package/cjs/Sidenav/Sidenav.js +2 -2
- package/cjs/Sidenav/SidenavDropdown.d.ts +1 -1
- package/cjs/Sidenav/SidenavDropdown.js +4 -4
- package/cjs/Sidenav/SidenavDropdownItem.js +3 -4
- package/cjs/Sidenav/SidenavItem.js +5 -6
- package/cjs/Sidenav/SidenavToggle.js +2 -2
- package/cjs/Slider/Slider.js +3 -3
- package/cjs/Slider/useDrag.d.ts +0 -1
- package/cjs/Slider/useDrag.js +7 -12
- package/cjs/Slider/utils.d.ts +1 -2
- package/cjs/Slider/utils.js +2 -3
- package/cjs/Steps/StepItem.js +1 -2
- package/cjs/Table/Table.d.ts +3 -3
- package/cjs/Tabs/Tabs.js +3 -4
- package/cjs/TimePicker/TimePicker.js +2 -2
- package/cjs/Timeline/Timeline.d.ts +6 -1
- package/cjs/Timeline/Timeline.js +14 -10
- package/cjs/Toggle/Toggle.js +2 -2
- package/cjs/Tree/Tree.js +2 -2
- package/cjs/Tree/TreeNode.js +10 -11
- package/cjs/Tree/TreeView.js +5 -5
- package/cjs/Tree/hooks/useExpandTree.js +1 -1
- package/cjs/Tree/hooks/useFlattenTree.js +6 -9
- package/cjs/Tree/hooks/useFocusTree.d.ts +1 -2
- package/cjs/Tree/hooks/useFocusTree.js +12 -14
- package/cjs/Tree/hooks/useTreeDrag.d.ts +0 -1
- package/cjs/Tree/hooks/useTreeDrag.js +10 -12
- package/cjs/Tree/hooks/useTreeNodeProps.js +1 -1
- package/cjs/Tree/hooks/useTreeSearch.js +4 -4
- package/cjs/Tree/hooks/useVirtualizedTreeData.js +2 -2
- package/cjs/Tree/types.d.ts +2 -3
- package/cjs/Tree/utils/flattenTree.d.ts +1 -1
- package/cjs/Tree/utils/focusableTree.js +5 -8
- package/cjs/Tree/utils/getNodeParentKeys.js +2 -4
- package/cjs/Tree/utils/hasVisibleChildren.d.ts +1 -1
- package/cjs/Tree/utils/treeKeyboardInteractions.js +3 -3
- package/cjs/TreePicker/TreePicker.js +8 -9
- package/cjs/TreePicker/hooks/useFocusState.d.ts +0 -1
- package/cjs/TreePicker/hooks/useFocusState.js +4 -8
- package/cjs/Uploader/UploadFileItem.js +8 -10
- package/cjs/Uploader/UploadTrigger.js +8 -10
- package/cjs/Uploader/Uploader.d.ts +2 -0
- package/cjs/Uploader/Uploader.js +66 -26
- package/cjs/Uploader/utils/ajaxUpload.js +5 -5
- package/cjs/Uploader/utils/previewFile.js +1 -1
- package/cjs/internals/Disclosure/Disclosure.js +5 -8
- package/cjs/internals/Disclosure/DisclosureButton.js +2 -2
- package/cjs/internals/InputBase/InputBase.js +5 -6
- package/cjs/internals/Menu/Menu.js +16 -20
- package/cjs/internals/Menu/MenuItem.js +4 -5
- package/cjs/internals/Menu/Menubar.js +5 -7
- package/cjs/internals/Menu/useMenu.js +5 -10
- package/cjs/internals/Overlay/Modal.js +8 -11
- package/cjs/internals/Overlay/ModalManager.js +3 -5
- package/cjs/internals/Overlay/Overlay.js +1 -1
- package/cjs/internals/Overlay/OverlayTrigger.d.ts +0 -1
- package/cjs/internals/Overlay/OverlayTrigger.js +5 -7
- package/cjs/internals/Overlay/Position.js +6 -8
- package/cjs/internals/Picker/ListCheckItem.js +3 -3
- package/cjs/internals/Picker/ListItem.js +1 -1
- package/cjs/internals/Picker/Listbox.js +9 -10
- package/cjs/internals/Picker/PickerIndicator.js +13 -11
- package/cjs/internals/Picker/PickerPopup.js +4 -5
- package/cjs/internals/Picker/PickerToggle.js +3 -4
- package/cjs/internals/Picker/SelectedElement.js +1 -1
- package/cjs/internals/Picker/hooks/useFocusItemValue.d.ts +0 -1
- package/cjs/internals/Picker/hooks/useFocusItemValue.js +14 -28
- package/cjs/internals/Picker/hooks/usePickerRef.d.ts +0 -1
- package/cjs/internals/Picker/hooks/usePickerRef.js +9 -15
- package/cjs/internals/Picker/hooks/useSearch.d.ts +0 -1
- package/cjs/internals/Picker/hooks/useSearch.js +2 -2
- package/cjs/internals/Picker/hooks/useToggleKeyDownEvent.d.ts +0 -1
- package/cjs/internals/Picker/hooks/useToggleKeyDownEvent.js +13 -17
- package/cjs/internals/Picker/utils.js +9 -9
- package/cjs/internals/Ripple/Ripple.js +3 -4
- package/cjs/internals/SafeAnchor/SafeAnchor.js +1 -1
- package/cjs/internals/ScrollView/hooks/useScrollState.d.ts +0 -1
- package/cjs/internals/ScrollView/hooks/useScrollState.js +2 -3
- package/cjs/internals/Tree/TreeProvider.d.ts +4 -4
- package/cjs/internals/Tree/TreeProvider.js +2 -8
- package/cjs/internals/Tree/types.d.ts +0 -1
- package/cjs/internals/Tree/utils/getParentMap.d.ts +0 -1
- package/cjs/internals/Windowing/AutoSizer.js +2 -3
- package/cjs/internals/Windowing/List.js +4 -8
- package/cjs/internals/constants/index.d.ts +2 -2
- package/cjs/internals/hooks/useClickOutside.js +2 -4
- package/cjs/internals/hooks/useCustom.d.ts +0 -1
- package/cjs/internals/hooks/useCustom.js +5 -7
- package/cjs/internals/hooks/useElementResize.d.ts +0 -1
- package/cjs/internals/hooks/useEventCallback.js +1 -2
- package/cjs/internals/hooks/useEventListener.js +1 -1
- package/cjs/internals/hooks/useFocus.js +2 -4
- package/cjs/internals/hooks/useFocusVirtualListItem.d.ts +0 -1
- package/cjs/internals/hooks/useMount.js +1 -2
- package/cjs/internals/hooks/useRootClose.js +6 -6
- package/cjs/internals/hooks/useTimeout.js +1 -2
- package/cjs/internals/hooks/useToggleCaret.d.ts +0 -1
- package/cjs/internals/hooks/useUniqueId.js +1 -1
- package/cjs/internals/hooks/useUpdatedRef.d.ts +0 -1
- package/cjs/internals/styled-system/style-manager.js +1 -1
- package/cjs/internals/styled-system/useStyled.js +2 -2
- package/cjs/internals/types/utils.d.ts +0 -1
- package/cjs/internals/utils/colours.d.ts +4 -4
- package/cjs/internals/utils/colours.js +1 -1
- package/cjs/internals/utils/date/disableTime.js +6 -12
- package/cjs/internals/utils/date/omitHideDisabledProps.d.ts +1 -1
- package/cjs/internals/utils/date/useDateMode.d.ts +1 -1
- package/cjs/internals/utils/react/ReactChildren.js +1 -2
- package/cjs/internals/utils/react/deprecateComponent.js +1 -2
- package/cjs/internals/utils/react/getDOMNode.js +4 -5
- package/cjs/internals/utils/sizes.d.ts +2 -2
- package/cjs/internals/utils/style-sheet/css.d.ts +0 -1
- package/cjs/internals/utils/style-sheet/css.js +1 -1
- package/cjs/internals/utils/style-sheet/prefix.d.ts +0 -1
- package/cjs/internals/utils/style-sheet/responsive.d.ts +1 -1
- package/cjs/internals/utils/style-sheet/styles.d.ts +3 -3
- package/cjs/internals/utils/style-sheet/styles.js +1 -1
- package/cjs/toaster/ToastContainer.js +3 -5
- package/cjs/toaster/hooks/useDelayedClosure.d.ts +0 -1
- package/cjs/toaster/hooks/useDelayedClosure.js +3 -4
- package/cjs/toaster/toaster.js +42 -15
- package/cjs/useDialog/Dialog.d.ts +1 -1
- package/cjs/useDialog/Dialog.js +1 -1
- package/cjs/useDialog/useDialog.d.ts +1 -1
- package/cjs/useDialog/useDialog.js +3 -3
- package/cjs/useFormControl/hooks/useField.d.ts +0 -1
- package/cjs/useFormControl/hooks/useField.js +5 -7
- package/cjs/useFormControl/hooks/useRegisterModel.js +2 -2
- package/cjs/useFormControl/useFormControl.js +8 -8
- package/cjs/useToaster/useToaster.js +4 -5
- package/dist/rsuite-no-reset.css +14 -0
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite.css +14 -0
- package/dist/rsuite.js +224 -224
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Affix/Affix.js +4 -4
- package/esm/Animation/Collapse.js +1 -2
- package/esm/Animation/Transition.d.ts +2 -2
- package/esm/Animation/Transition.js +17 -20
- package/esm/AutoComplete/AutoComplete.d.ts +2 -0
- package/esm/AutoComplete/AutoComplete.js +12 -10
- package/esm/Avatar/useImage.js +1 -1
- package/esm/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/esm/Badge/Badge.js +1 -4
- package/esm/Breadcrumb/Breadcrumb.js +4 -4
- package/esm/Button/Button.js +6 -6
- package/esm/Calendar/Calendar.js +5 -5
- package/esm/Calendar/CalendarBody.js +1 -1
- package/esm/Calendar/CalendarContainer.js +14 -33
- package/esm/Calendar/CalendarHeader.js +7 -8
- package/esm/Calendar/Grid/GridCell.js +2 -2
- package/esm/Calendar/Grid/GridHeaderRow.js +1 -1
- package/esm/Calendar/Grid/GridRow.js +5 -6
- package/esm/Calendar/MonthDropdown/MonthDropdown.js +1 -1
- package/esm/Calendar/MonthDropdown/MonthDropdownItem.js +1 -1
- package/esm/Calendar/TimeDropdown/TimeDropdown.js +12 -14
- package/esm/Calendar/hooks/useCalendar.d.ts +16 -17
- package/esm/Calendar/hooks/useCalendar.js +2 -4
- package/esm/Calendar/hooks/useCalendarDate.js +5 -9
- package/esm/Calendar/hooks/useCalendarState.js +6 -12
- package/esm/Calendar/types.d.ts +0 -1
- package/esm/Carousel/Carousel.js +5 -6
- package/esm/CascadeTree/CascadeTree.js +6 -16
- package/esm/CascadeTree/TreeView.js +5 -7
- package/esm/CascadeTree/hooks/useSearch.d.ts +0 -1
- package/esm/CascadeTree/hooks/useSearch.js +1 -1
- package/esm/CascadeTree/hooks/useSelect.d.ts +0 -1
- package/esm/CascadeTree/hooks/useSelect.js +3 -4
- package/esm/CascadeTree/types.d.ts +0 -1
- package/esm/CascadeTree/utils.js +1 -2
- package/esm/Cascader/Cascader.js +18 -29
- package/esm/Cascader/useActive.d.ts +0 -1
- package/esm/Cascader/useActive.js +4 -6
- package/esm/CheckPicker/CheckPicker.js +14 -15
- package/esm/CheckTree/CheckTree.js +1 -1
- package/esm/CheckTree/CheckTreeNode.js +3 -4
- package/esm/CheckTree/CheckTreeView.js +5 -5
- package/esm/CheckTree/hooks/useTreeCheckState.js +2 -2
- package/esm/CheckTree/utils.js +9 -17
- package/esm/CheckTreePicker/CheckTreePicker.js +7 -7
- package/esm/CheckTreePicker/hooks/useFocusState.d.ts +0 -1
- package/esm/CheckTreePicker/hooks/useFocusState.js +3 -6
- package/esm/Checkbox/Checkbox.js +4 -5
- package/esm/Checkbox/hooks/useIndeterminateCheckbox.d.ts +0 -1
- package/esm/Checkbox/hooks/useIndeterminateCheckbox.js +1 -1
- package/esm/CheckboxGroup/CheckboxGroup.js +2 -2
- package/esm/DOMHelper/index.d.ts +1 -2
- package/esm/DOMHelper/isElement.js +1 -1
- package/esm/DateInput/DateField.d.ts +122 -3
- package/esm/DateInput/DateField.js +12 -15
- package/esm/DateInput/DateInput.js +3 -4
- package/esm/DateInput/hooks/useDateInputState.d.ts +124 -4
- package/esm/DateInput/hooks/useDateInputState.js +2 -2
- package/esm/DateInput/hooks/useIsFocused.js +2 -2
- package/esm/DateInput/hooks/useKeyboardInputEvent.d.ts +0 -1
- package/esm/DateInput/hooks/useKeyboardInputEvent.js +8 -9
- package/esm/DateInput/hooks/useSelectedState.d.ts +0 -1
- package/esm/DateInput/utils.d.ts +0 -1
- package/esm/DateInput/utils.js +2 -3
- package/esm/DatePicker/DatePicker.js +18 -25
- package/esm/DatePicker/PredefinedRanges.js +3 -3
- package/esm/DatePicker/Toolbar.js +4 -4
- package/esm/DatePicker/hooks/useCustomizedInput.d.ts +0 -1
- package/esm/DatePicker/hooks/useFocus.js +5 -8
- package/esm/DatePicker/hooks/useMonthView.d.ts +0 -1
- package/esm/DatePicker/hooks/useMonthView.js +1 -1
- package/esm/DatePicker/utils.d.ts +1 -2
- package/esm/DatePicker/utils.js +2 -2
- package/esm/DateRangeInput/DateRangeInput.js +8 -9
- package/esm/DateRangePicker/Calendar.js +2 -2
- package/esm/DateRangePicker/DateRangePicker.js +25 -29
- package/esm/DateRangePicker/Header.js +3 -3
- package/esm/DateRangePicker/disabledDateUtils.js +2 -2
- package/esm/DateRangePicker/hooks/useCalendarHandlers.d.ts +0 -1
- package/esm/DateRangePicker/hooks/useCalendarHandlers.js +5 -5
- package/esm/DateRangePicker/utils.js +1 -2
- package/esm/Dropdown/Dropdown.js +3 -3
- package/esm/Dropdown/DropdownItem.js +4 -5
- package/esm/Dropdown/DropdownMenu.d.ts +1 -1
- package/esm/Dropdown/DropdownMenu.js +1 -1
- package/esm/Form/Form.d.ts +38 -3
- package/esm/Form/Form.js +25 -12
- package/esm/Form/hooks/useFormRef.d.ts +0 -1
- package/esm/Form/hooks/useFormValidate.d.ts +2 -1
- package/esm/Form/hooks/useFormValidate.js +136 -20
- package/esm/Form/hooks/useFormValue.d.ts +0 -1
- package/esm/Form/index.d.ts +1 -0
- package/esm/Form/resolvers.d.ts +59 -0
- package/esm/Form/resolvers.js +2 -0
- package/esm/FormControl/FormControl.js +5 -5
- package/esm/FormGroup/FormGroupContext.d.ts +1 -1
- package/esm/Highlight/utils/highlightText.js +1 -1
- package/esm/InlineEdit/renderChildren.js +5 -6
- package/esm/InlineEdit/useEditState.js +9 -12
- package/esm/InlineEdit/useFocusEvent.d.ts +0 -1
- package/esm/InlineEdit/useFocusEvent.js +7 -11
- package/esm/Input/Input.js +1 -1
- package/esm/InputGroup/InputGroupContext.d.ts +2 -1
- package/esm/InputNumber/index.d.ts +0 -1
- package/esm/InputPicker/InputAutosize.js +1 -1
- package/esm/InputPicker/InputPicker.js +30 -35
- package/esm/InputPicker/InputSearch.js +1 -2
- package/esm/InputPicker/hooks/useData.d.ts +0 -1
- package/esm/InputPicker/hooks/useData.js +1 -1
- package/esm/InputPicker/hooks/useInput.js +3 -6
- package/esm/InputPicker/hooks/useMaxWidth.js +2 -4
- package/esm/List/helper/AutoScroller.js +2 -4
- package/esm/List/helper/useSortHelper.d.ts +4 -4
- package/esm/List/helper/useSortHelper.js +13 -19
- package/esm/MaskedInput/TextMask.d.ts +5 -5
- package/esm/MaskedInput/TextMask.js +3 -5
- package/esm/MaskedInput/conformToMask.d.ts +1 -1
- package/esm/MaskedInput/createTextMaskInputElement.js +2 -3
- package/esm/Menu/MenuItem.js +3 -4
- package/esm/Message/Message.js +1 -1
- package/esm/Modal/Modal.js +8 -10
- package/esm/Modal/ModalBody.js +1 -1
- package/esm/Modal/utils.d.ts +2 -3
- package/esm/Modal/utils.js +2 -3
- package/esm/MultiCascadeTree/SearchView.js +1 -1
- package/esm/MultiCascadeTree/TreeView.js +2 -2
- package/esm/MultiCascadeTree/hooks/useCascadeValue.d.ts +0 -1
- package/esm/MultiCascadeTree/hooks/useCascadeValue.js +5 -8
- package/esm/MultiCascadeTree/hooks/useColumnData.d.ts +0 -1
- package/esm/MultiCascadeTree/hooks/useSearch.d.ts +0 -1
- package/esm/MultiCascadeTree/hooks/useSearch.js +2 -2
- package/esm/MultiCascadeTree/hooks/useSelect.js +3 -4
- package/esm/MultiCascadeTree/types.d.ts +0 -1
- package/esm/MultiCascadeTree/utils.d.ts +4 -4
- package/esm/MultiCascadeTree/utils.js +2 -3
- package/esm/MultiCascader/MultiCascader.js +13 -16
- package/esm/Nav/AdaptiveNavItem.js +2 -3
- package/esm/Nav/Nav.d.ts +1 -1
- package/esm/Nav/Nav.js +4 -4
- package/esm/Nav/NavDropdown.d.ts +1 -1
- package/esm/Nav/NavDropdown.js +3 -3
- package/esm/Nav/NavDropdownItem.js +2 -2
- package/esm/Nav/NavDropdownMenu.d.ts +1 -1
- package/esm/Nav/NavDropdownMenu.js +1 -1
- package/esm/Nav/NavItem.js +4 -4
- package/esm/Navbar/Navbar.js +1 -1
- package/esm/Navbar/NavbarContent.js +1 -1
- package/esm/Navbar/NavbarDrawer.js +1 -1
- package/esm/Navbar/NavbarDropdown.d.ts +1 -1
- package/esm/Navbar/NavbarDropdown.js +3 -3
- package/esm/Navbar/NavbarDropdownItem.js +5 -6
- package/esm/Navbar/NavbarDropdownMenu.d.ts +1 -1
- package/esm/Navbar/NavbarDropdownMenu.js +1 -1
- package/esm/Navbar/NavbarItem.js +4 -4
- package/esm/Navbar/NavbarToggle.js +2 -2
- package/esm/Notification/Notification.js +1 -1
- package/esm/NumberInput/NumberInput.js +3 -3
- package/esm/NumberInput/hooks/useEvents.d.ts +0 -1
- package/esm/NumberInput/hooks/useEvents.js +2 -3
- package/esm/NumberInput/hooks/useWheelHandler.js +1 -2
- package/esm/Pagination/Pagination.js +1 -1
- package/esm/Pagination/PaginationButton.js +1 -1
- package/esm/Pagination/PaginationGroup.js +3 -4
- package/esm/Panel/Panel.js +2 -2
- package/esm/PanelGroup/PanelGroup.js +1 -1
- package/esm/PasswordInput/PasswordInput.js +2 -2
- package/esm/PinInput/PinInput.js +1 -1
- package/esm/PinInput/hooks/usePinInputRefs.d.ts +0 -1
- package/esm/PinInput/hooks/usePinInputRefs.js +2 -4
- package/esm/PinInput/hooks/usePinValue.d.ts +1 -1
- package/esm/PinInput/hooks/usePinValue.js +2 -2
- package/esm/Progress/ProgressLine.js +1 -1
- package/esm/Progress/types.d.ts +0 -1
- package/esm/ProgressCircle/hooks/useProgressCirclePath.d.ts +0 -1
- package/esm/Radio/Radio.js +3 -3
- package/esm/RadioGroup/RadioGroup.js +1 -1
- package/esm/RadioTile/RadioTile.js +2 -2
- package/esm/RadioTileGroup/RadioTileGroup.js +1 -1
- package/esm/RangeSlider/RangeSlider.js +6 -6
- package/esm/Rate/Character.js +2 -2
- package/esm/Rate/Rate.js +3 -3
- package/esm/Rate/useRatingStates.d.ts +0 -1
- package/esm/SegmentedControl/SegmentedControl.js +3 -3
- package/esm/SegmentedControl/hooks/useIndicatorPosition.js +1 -1
- package/esm/SelectPicker/SelectPicker.js +13 -16
- package/esm/Sidebar/Sidebar.js +1 -1
- package/esm/Sidenav/ExpandedSidenavDropdown.js +6 -6
- package/esm/Sidenav/ExpandedSidenavDropdownItem.js +4 -5
- package/esm/Sidenav/Node.js +9 -16
- package/esm/Sidenav/Sidenav.js +2 -2
- package/esm/Sidenav/SidenavDropdown.d.ts +1 -1
- package/esm/Sidenav/SidenavDropdown.js +4 -4
- package/esm/Sidenav/SidenavDropdownItem.js +3 -4
- package/esm/Sidenav/SidenavItem.js +5 -6
- package/esm/Sidenav/SidenavToggle.js +2 -2
- package/esm/Slider/Slider.js +3 -3
- package/esm/Slider/useDrag.d.ts +0 -1
- package/esm/Slider/useDrag.js +7 -12
- package/esm/Slider/utils.d.ts +1 -2
- package/esm/Slider/utils.js +2 -3
- package/esm/Steps/StepItem.js +1 -2
- package/esm/Table/Table.d.ts +3 -3
- package/esm/Tabs/Tabs.js +3 -4
- package/esm/TimePicker/TimePicker.js +2 -2
- package/esm/Timeline/Timeline.d.ts +6 -1
- package/esm/Timeline/Timeline.js +14 -10
- package/esm/Toggle/Toggle.js +2 -2
- package/esm/Tree/Tree.js +2 -2
- package/esm/Tree/TreeNode.js +10 -11
- package/esm/Tree/TreeView.js +5 -5
- package/esm/Tree/hooks/useExpandTree.js +1 -1
- package/esm/Tree/hooks/useFlattenTree.js +6 -9
- package/esm/Tree/hooks/useFocusTree.d.ts +1 -2
- package/esm/Tree/hooks/useFocusTree.js +12 -14
- package/esm/Tree/hooks/useTreeDrag.d.ts +0 -1
- package/esm/Tree/hooks/useTreeDrag.js +10 -12
- package/esm/Tree/hooks/useTreeNodeProps.js +1 -1
- package/esm/Tree/hooks/useTreeSearch.js +4 -4
- package/esm/Tree/hooks/useVirtualizedTreeData.js +2 -2
- package/esm/Tree/types.d.ts +2 -3
- package/esm/Tree/utils/flattenTree.d.ts +1 -1
- package/esm/Tree/utils/focusableTree.js +5 -8
- package/esm/Tree/utils/getNodeParentKeys.js +2 -4
- package/esm/Tree/utils/hasVisibleChildren.d.ts +1 -1
- package/esm/Tree/utils/treeKeyboardInteractions.js +3 -3
- package/esm/TreePicker/TreePicker.js +8 -9
- package/esm/TreePicker/hooks/useFocusState.d.ts +0 -1
- package/esm/TreePicker/hooks/useFocusState.js +4 -8
- package/esm/Uploader/UploadFileItem.js +8 -10
- package/esm/Uploader/UploadTrigger.js +8 -10
- package/esm/Uploader/Uploader.d.ts +2 -0
- package/esm/Uploader/Uploader.js +66 -26
- package/esm/Uploader/utils/ajaxUpload.js +5 -5
- package/esm/Uploader/utils/previewFile.js +1 -1
- package/esm/internals/Disclosure/Disclosure.js +5 -8
- package/esm/internals/Disclosure/DisclosureButton.js +2 -2
- package/esm/internals/InputBase/InputBase.js +5 -6
- package/esm/internals/Menu/Menu.js +16 -20
- package/esm/internals/Menu/MenuItem.js +4 -5
- package/esm/internals/Menu/Menubar.js +5 -7
- package/esm/internals/Menu/useMenu.js +5 -10
- package/esm/internals/Overlay/Modal.js +8 -11
- package/esm/internals/Overlay/ModalManager.js +3 -5
- package/esm/internals/Overlay/Overlay.js +1 -1
- package/esm/internals/Overlay/OverlayTrigger.d.ts +0 -1
- package/esm/internals/Overlay/OverlayTrigger.js +5 -7
- package/esm/internals/Overlay/Position.js +6 -8
- package/esm/internals/Picker/ListCheckItem.js +3 -3
- package/esm/internals/Picker/ListItem.js +1 -1
- package/esm/internals/Picker/Listbox.js +9 -10
- package/esm/internals/Picker/PickerIndicator.js +13 -11
- package/esm/internals/Picker/PickerPopup.js +4 -5
- package/esm/internals/Picker/PickerToggle.js +3 -4
- package/esm/internals/Picker/SelectedElement.js +1 -1
- package/esm/internals/Picker/hooks/useFocusItemValue.d.ts +0 -1
- package/esm/internals/Picker/hooks/useFocusItemValue.js +14 -28
- package/esm/internals/Picker/hooks/usePickerRef.d.ts +0 -1
- package/esm/internals/Picker/hooks/usePickerRef.js +9 -15
- package/esm/internals/Picker/hooks/useSearch.d.ts +0 -1
- package/esm/internals/Picker/hooks/useSearch.js +2 -2
- package/esm/internals/Picker/hooks/useToggleKeyDownEvent.d.ts +0 -1
- package/esm/internals/Picker/hooks/useToggleKeyDownEvent.js +13 -17
- package/esm/internals/Picker/utils.js +9 -9
- package/esm/internals/Ripple/Ripple.js +3 -4
- package/esm/internals/SafeAnchor/SafeAnchor.js +1 -1
- package/esm/internals/ScrollView/hooks/useScrollState.d.ts +0 -1
- package/esm/internals/ScrollView/hooks/useScrollState.js +2 -3
- package/esm/internals/Tree/TreeProvider.d.ts +4 -4
- package/esm/internals/Tree/TreeProvider.js +2 -8
- package/esm/internals/Tree/types.d.ts +0 -1
- package/esm/internals/Tree/utils/getParentMap.d.ts +0 -1
- package/esm/internals/Windowing/AutoSizer.js +2 -3
- package/esm/internals/Windowing/List.js +4 -8
- package/esm/internals/constants/index.d.ts +2 -2
- package/esm/internals/hooks/useClickOutside.js +2 -4
- package/esm/internals/hooks/useCustom.d.ts +0 -1
- package/esm/internals/hooks/useCustom.js +5 -7
- package/esm/internals/hooks/useElementResize.d.ts +0 -1
- package/esm/internals/hooks/useEventCallback.js +1 -2
- package/esm/internals/hooks/useEventListener.js +1 -1
- package/esm/internals/hooks/useFocus.js +2 -4
- package/esm/internals/hooks/useFocusVirtualListItem.d.ts +0 -1
- package/esm/internals/hooks/useMount.js +1 -2
- package/esm/internals/hooks/useRootClose.js +6 -6
- package/esm/internals/hooks/useTimeout.js +1 -2
- package/esm/internals/hooks/useToggleCaret.d.ts +0 -1
- package/esm/internals/hooks/useUniqueId.js +1 -1
- package/esm/internals/hooks/useUpdatedRef.d.ts +0 -1
- package/esm/internals/styled-system/style-manager.js +1 -1
- package/esm/internals/styled-system/useStyled.js +2 -2
- package/esm/internals/types/utils.d.ts +0 -1
- package/esm/internals/utils/colours.d.ts +4 -4
- package/esm/internals/utils/colours.js +1 -1
- package/esm/internals/utils/date/disableTime.js +6 -12
- package/esm/internals/utils/date/omitHideDisabledProps.d.ts +1 -1
- package/esm/internals/utils/date/useDateMode.d.ts +1 -1
- package/esm/internals/utils/react/ReactChildren.js +1 -2
- package/esm/internals/utils/react/deprecateComponent.js +1 -2
- package/esm/internals/utils/react/getDOMNode.js +4 -5
- package/esm/internals/utils/sizes.d.ts +2 -2
- package/esm/internals/utils/style-sheet/css.d.ts +0 -1
- package/esm/internals/utils/style-sheet/css.js +1 -1
- package/esm/internals/utils/style-sheet/prefix.d.ts +0 -1
- package/esm/internals/utils/style-sheet/responsive.d.ts +1 -1
- package/esm/internals/utils/style-sheet/styles.d.ts +3 -3
- package/esm/internals/utils/style-sheet/styles.js +1 -1
- package/esm/toaster/ToastContainer.js +3 -5
- package/esm/toaster/hooks/useDelayedClosure.d.ts +0 -1
- package/esm/toaster/hooks/useDelayedClosure.js +3 -4
- package/esm/toaster/toaster.js +42 -15
- package/esm/useDialog/Dialog.d.ts +1 -1
- package/esm/useDialog/Dialog.js +1 -1
- package/esm/useDialog/useDialog.d.ts +1 -1
- package/esm/useDialog/useDialog.js +3 -3
- package/esm/useFormControl/hooks/useField.d.ts +0 -1
- package/esm/useFormControl/hooks/useField.js +5 -7
- package/esm/useFormControl/hooks/useRegisterModel.js +2 -2
- package/esm/useFormControl/useFormControl.js +8 -8
- package/esm/useToaster/useToaster.js +4 -5
- package/package.json +1 -1
|
@@ -31,7 +31,6 @@ import { addMonths, addDays, copyTime, calendarOnlyProps, endOfDay, isValid, isB
|
|
|
31
31
|
* @see https://rsuitejs.com/components/date-range-picker
|
|
32
32
|
*/
|
|
33
33
|
const DateRangePicker = forwardRef((props, ref) => {
|
|
34
|
-
var _ref, _ref2;
|
|
35
34
|
const {
|
|
36
35
|
formatDate,
|
|
37
36
|
propsWithDefaults
|
|
@@ -106,9 +105,9 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
106
105
|
merge,
|
|
107
106
|
prefix
|
|
108
107
|
} = useStyles(classPrefix);
|
|
109
|
-
const formatStr = format ||
|
|
108
|
+
const formatStr = format || locale?.shortDateFormat || 'yyyy-MM-dd';
|
|
110
109
|
const rangeFormatStr = `${formatStr}${character}${formatStr}`;
|
|
111
|
-
const [value, setValue] = useControlled(valueProp, defaultValue
|
|
110
|
+
const [value, setValue] = useControlled(valueProp, defaultValue ?? null);
|
|
112
111
|
const {
|
|
113
112
|
mode,
|
|
114
113
|
has
|
|
@@ -142,14 +141,14 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
142
141
|
* the second click to determine the end date of the date range.
|
|
143
142
|
*
|
|
144
143
|
*/
|
|
145
|
-
const [selectedDates, setSelectedDates] = useState(
|
|
144
|
+
const [selectedDates, setSelectedDates] = useState(valueProp ?? defaultValue ?? []);
|
|
146
145
|
|
|
147
146
|
// The date of the current hover, used to reduce the calculation of `handleMouseMove`
|
|
148
147
|
const [hoverDateRange, setHoverDateRange] = useState(value);
|
|
149
148
|
|
|
150
149
|
// The displayed calendar panel is rendered based on this value.
|
|
151
150
|
const [calendarDateRange, setCalendarDateRangeValue] = useState(getSafeCalendarDate({
|
|
152
|
-
value:
|
|
151
|
+
value: value ?? defaultCalendarValue ?? null,
|
|
153
152
|
allowSameMonth
|
|
154
153
|
}));
|
|
155
154
|
|
|
@@ -172,7 +171,7 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
172
171
|
*/
|
|
173
172
|
const getCalendarDatetime = calendarKey => {
|
|
174
173
|
const index = calendarKey === 'start' ? 0 : 1;
|
|
175
|
-
return
|
|
174
|
+
return calendarDateRange?.[index] || defaultCalendarValue?.[index];
|
|
176
175
|
};
|
|
177
176
|
|
|
178
177
|
/**
|
|
@@ -187,7 +186,7 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
187
186
|
let nextValue = dateRange;
|
|
188
187
|
|
|
189
188
|
// The time should remain the same when the dates in the date range are changed.
|
|
190
|
-
if (has('time') && dateRange
|
|
189
|
+
if (has('time') && dateRange?.length && (eventName === 'changeDate' || eventName === 'changeMonth')) {
|
|
191
190
|
const startDate = copyTime({
|
|
192
191
|
from: getCalendarDatetime('start'),
|
|
193
192
|
to: dateRange[0]
|
|
@@ -213,8 +212,8 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
213
212
|
};
|
|
214
213
|
useEffect(() => {
|
|
215
214
|
// If value changes, update the selected and hover date values on the calendar panel.
|
|
216
|
-
setSelectedDates(valueProp
|
|
217
|
-
setHoverDateRange(valueProp
|
|
215
|
+
setSelectedDates(valueProp ?? []);
|
|
216
|
+
setHoverDateRange(valueProp ?? null);
|
|
218
217
|
}, [valueProp]);
|
|
219
218
|
const getInputHtmlSize = () => {
|
|
220
219
|
const padding = 4;
|
|
@@ -235,7 +234,7 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
235
234
|
return date => getWeekHoverRange(date, {
|
|
236
235
|
isoWeek,
|
|
237
236
|
weekStart,
|
|
238
|
-
locale: locale
|
|
237
|
+
locale: locale?.dateLocale
|
|
239
238
|
});
|
|
240
239
|
} else if (hoverRange === 'month') {
|
|
241
240
|
return getMonthHoverRange;
|
|
@@ -258,10 +257,10 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
258
257
|
};
|
|
259
258
|
const setDateRange = (event, nextValue, closeOverlay = true) => {
|
|
260
259
|
// If nextValue is null, it means that the user is erasing the selected dates.
|
|
261
|
-
setSelectedDates(nextValue
|
|
260
|
+
setSelectedDates(nextValue ?? []);
|
|
262
261
|
setValue(nextValue);
|
|
263
262
|
if (!isSameRange(nextValue, value, formatStr)) {
|
|
264
|
-
onChange
|
|
263
|
+
onChange?.(nextValue, event);
|
|
265
264
|
}
|
|
266
265
|
|
|
267
266
|
// `closeOverlay` default value is `true`
|
|
@@ -303,14 +302,14 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
303
302
|
*/
|
|
304
303
|
const handleSelectDate = useEventCallback((index, date, event) => {
|
|
305
304
|
const calendarKey = index === 0 ? 'start' : 'end';
|
|
306
|
-
let nextSelectDates = hoverDateRange
|
|
305
|
+
let nextSelectDates = hoverDateRange ?? [];
|
|
307
306
|
const hoverRangeValue = getHoverRangeValue(date);
|
|
308
307
|
const noHoverRangeValid = isNil(hoverRangeValue);
|
|
309
308
|
|
|
310
309
|
// in `oneTap` mode
|
|
311
310
|
if (oneTap) {
|
|
312
311
|
setDateRange(event, noHoverRangeValid ? [startOfDay(date), endOfDay(date)] : hoverRangeValue);
|
|
313
|
-
onSelect
|
|
312
|
+
onSelect?.(date, event);
|
|
314
313
|
return;
|
|
315
314
|
}
|
|
316
315
|
|
|
@@ -363,7 +362,7 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
363
362
|
eventName: 'changeDate'
|
|
364
363
|
});
|
|
365
364
|
}
|
|
366
|
-
onSelect
|
|
365
|
+
onSelect?.(date, event);
|
|
367
366
|
setSelectedIdle(!isSelectedIdle);
|
|
368
367
|
});
|
|
369
368
|
|
|
@@ -421,11 +420,11 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
421
420
|
} else {
|
|
422
421
|
// Reset the date on the calendar to the default date
|
|
423
422
|
nextCalendarDate = getSafeCalendarDate({
|
|
424
|
-
value: defaultCalendarValue
|
|
423
|
+
value: defaultCalendarValue ?? null,
|
|
425
424
|
allowSameMonth
|
|
426
425
|
});
|
|
427
426
|
}
|
|
428
|
-
setSelectedDates(value
|
|
427
|
+
setSelectedDates(value ?? []);
|
|
429
428
|
setCalendarDateRange({
|
|
430
429
|
dateRange: nextCalendarDate
|
|
431
430
|
});
|
|
@@ -446,9 +445,9 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
446
445
|
if (closeOverlay) {
|
|
447
446
|
setDateRange(event, value, closeOverlay);
|
|
448
447
|
} else {
|
|
449
|
-
setSelectedDates(value
|
|
448
|
+
setSelectedDates(value ?? []);
|
|
450
449
|
}
|
|
451
|
-
onShortcutClick
|
|
450
|
+
onShortcutClick?.(range, event);
|
|
452
451
|
|
|
453
452
|
// End unfinished selections.
|
|
454
453
|
setSelectedIdle(true);
|
|
@@ -463,14 +462,14 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
463
462
|
const handleClickOK = useEventCallback(event => {
|
|
464
463
|
const nextValue = calculateDateRange();
|
|
465
464
|
setDateRange(event, nextValue);
|
|
466
|
-
onOk
|
|
465
|
+
onOk?.(nextValue, event);
|
|
467
466
|
});
|
|
468
467
|
const handleClean = useEventCallback(event => {
|
|
469
468
|
setCalendarDateRange({
|
|
470
469
|
dateRange: null
|
|
471
470
|
});
|
|
472
471
|
setDateRange(event, null);
|
|
473
|
-
onClean
|
|
472
|
+
onClean?.(event);
|
|
474
473
|
event.stopPropagation();
|
|
475
474
|
});
|
|
476
475
|
|
|
@@ -559,20 +558,17 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
559
558
|
return isRangeDisabled(startDate, endDate, TARGET.TOOLBAR_SHORTCUT);
|
|
560
559
|
};
|
|
561
560
|
const handleClose = useEventCallback(() => {
|
|
562
|
-
|
|
563
|
-
(_trigger$current = trigger.current) === null || _trigger$current === void 0 || (_trigger$current$clos = _trigger$current.close) === null || _trigger$current$clos === void 0 || _trigger$current$clos.call(_trigger$current);
|
|
561
|
+
trigger.current?.close?.();
|
|
564
562
|
});
|
|
565
563
|
const handleInputKeyDown = useEventCallback(event => {
|
|
566
564
|
onMenuKeyDown(event, {
|
|
567
565
|
esc: handleClose,
|
|
568
566
|
enter: () => {
|
|
569
|
-
var _trigger$current2;
|
|
570
567
|
const {
|
|
571
568
|
open
|
|
572
|
-
} =
|
|
569
|
+
} = trigger.current?.getState() || {};
|
|
573
570
|
if (!open) {
|
|
574
|
-
|
|
575
|
-
(_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 || _trigger$current3.open();
|
|
571
|
+
trigger.current?.open();
|
|
576
572
|
}
|
|
577
573
|
}
|
|
578
574
|
});
|
|
@@ -613,7 +609,7 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
613
609
|
format: formatStr,
|
|
614
610
|
value: selectedDates,
|
|
615
611
|
monthDropdownProps,
|
|
616
|
-
hoverRangeValue: hoverDateRange
|
|
612
|
+
hoverRangeValue: hoverDateRange ?? undefined,
|
|
617
613
|
hideHours,
|
|
618
614
|
hideMinutes,
|
|
619
615
|
hideSeconds,
|
|
@@ -724,7 +720,7 @@ const DateRangePicker = forwardRef((props, ref) => {
|
|
|
724
720
|
selectedDone: isSelectedIdle,
|
|
725
721
|
target: TARGET.INPUT
|
|
726
722
|
};
|
|
727
|
-
if (isDateDisabled
|
|
723
|
+
if (isDateDisabled?.(startDate, disabledOptions) || isDateDisabled?.(endDate, disabledOptions)) {
|
|
728
724
|
return true;
|
|
729
725
|
}
|
|
730
726
|
return false;
|
|
@@ -16,7 +16,7 @@ function Header(props) {
|
|
|
16
16
|
clickable,
|
|
17
17
|
onSelect
|
|
18
18
|
} = props;
|
|
19
|
-
const [startDate, endDate] = value
|
|
19
|
+
const [startDate, endDate] = value ?? [null, null];
|
|
20
20
|
const v = startDate && endDate ? [startDate, endDate].sort(compareAsc) : [startDate, endDate];
|
|
21
21
|
const start = v[0] ? /*#__PURE__*/React.createElement(FormattedDate, {
|
|
22
22
|
date: v[0],
|
|
@@ -35,7 +35,7 @@ function Header(props) {
|
|
|
35
35
|
size: "xs",
|
|
36
36
|
appearance: "subtle",
|
|
37
37
|
className: prefix('header-date'),
|
|
38
|
-
onClick: () => onSelect
|
|
38
|
+
onClick: () => onSelect?.('start'),
|
|
39
39
|
"aria-label": "Select start date"
|
|
40
40
|
}, start), /*#__PURE__*/React.createElement("span", {
|
|
41
41
|
className: prefix('header-character')
|
|
@@ -43,7 +43,7 @@ function Header(props) {
|
|
|
43
43
|
size: "xs",
|
|
44
44
|
appearance: "subtle",
|
|
45
45
|
className: prefix('header-date'),
|
|
46
|
-
onClick: () => onSelect
|
|
46
|
+
onClick: () => onSelect?.('end'),
|
|
47
47
|
"aria-label": "Select end date"
|
|
48
48
|
}, end)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
|
|
49
49
|
className: prefix('header-date')
|
|
@@ -15,7 +15,7 @@ export function allowedMaxDays(days) {
|
|
|
15
15
|
return (date, selectValue, selectedDone, target) => {
|
|
16
16
|
let beforeLimit = false;
|
|
17
17
|
let afterLimit = false;
|
|
18
|
-
if (selectValue
|
|
18
|
+
if (selectValue?.[0]) {
|
|
19
19
|
const startDate = selectValue[0];
|
|
20
20
|
beforeLimit = composeFunctions(f => DateUtils.addDays(f, -days + 1), f => isAfterDay(f, date))(startDate);
|
|
21
21
|
afterLimit = composeFunctions(f => DateUtils.addDays(f, days - 1), f => isBeforeDay(f, date))(startDate);
|
|
@@ -34,7 +34,7 @@ export function allowedDays(days) {
|
|
|
34
34
|
return (date, selectValue, selectedDone, target) => {
|
|
35
35
|
let beforeLimit = false;
|
|
36
36
|
let afterLimit = false;
|
|
37
|
-
if (selectValue
|
|
37
|
+
if (selectValue?.[0]) {
|
|
38
38
|
const startDate = selectValue[0];
|
|
39
39
|
beforeLimit = composeFunctions(f => DateUtils.addDays(f, -days + 1), f => !DateUtils.isSameDay(f, date))(startDate);
|
|
40
40
|
afterLimit = composeFunctions(f => DateUtils.addDays(f, days - 1), f => !DateUtils.isSameDay(f, date))(startDate);
|
|
@@ -11,19 +11,19 @@ export function useCalendarHandlers({
|
|
|
11
11
|
}) {
|
|
12
12
|
const calendarDate = useMemo(() => calendarDateRange[index], [calendarDateRange, index]);
|
|
13
13
|
const handleSelect = useEventCallback((date, event) => {
|
|
14
|
-
onSelect
|
|
14
|
+
onSelect?.(index, date, event);
|
|
15
15
|
});
|
|
16
16
|
const handleChangeMonth = useEventCallback(nextPageDate => {
|
|
17
|
-
onChangeCalendarMonth
|
|
17
|
+
onChangeCalendarMonth?.(index, nextPageDate);
|
|
18
18
|
});
|
|
19
19
|
const handleChangeTime = useEventCallback(nextPageDate => {
|
|
20
|
-
onChangeCalendarTime
|
|
20
|
+
onChangeCalendarTime?.(index, nextPageDate);
|
|
21
21
|
});
|
|
22
22
|
const handleMoveForward = useEventCallback(() => {
|
|
23
|
-
onChangeCalendarMonth
|
|
23
|
+
onChangeCalendarMonth?.(index, addMonths(calendarDate, 1));
|
|
24
24
|
});
|
|
25
25
|
const handleMoveBackward = useEventCallback(() => {
|
|
26
|
-
onChangeCalendarMonth
|
|
26
|
+
onChangeCalendarMonth?.(index, addMonths(calendarDate, -1));
|
|
27
27
|
});
|
|
28
28
|
return {
|
|
29
29
|
calendarDate,
|
|
@@ -5,9 +5,8 @@ export function getSafeCalendarDate({
|
|
|
5
5
|
calendarKey = 'start',
|
|
6
6
|
allowSameMonth
|
|
7
7
|
}) {
|
|
8
|
-
var _value;
|
|
9
8
|
// Update calendarDate if the value is not null
|
|
10
|
-
value =
|
|
9
|
+
value = value ?? [];
|
|
11
10
|
const gap = allowSameMonth ? 0 : 1;
|
|
12
11
|
if (value[0] && value[1]) {
|
|
13
12
|
const diffMonth = differenceInCalendarMonths(value[1], value[0]);
|
package/esm/Dropdown/Dropdown.js
CHANGED
|
@@ -128,11 +128,11 @@ const Dropdown = forwardRef((props, ref) => {
|
|
|
128
128
|
}, popupProps), children);
|
|
129
129
|
},
|
|
130
130
|
onToggleMenu: open => {
|
|
131
|
-
onToggle
|
|
131
|
+
onToggle?.(open);
|
|
132
132
|
if (open) {
|
|
133
|
-
onOpen
|
|
133
|
+
onOpen?.();
|
|
134
134
|
} else {
|
|
135
|
-
onClose
|
|
135
|
+
onClose?.();
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
}, ({
|
|
@@ -45,12 +45,11 @@ const DropdownItem = forwardRef((props, ref) => {
|
|
|
45
45
|
prefix
|
|
46
46
|
} = useStyles(classPrefix);
|
|
47
47
|
const handleSelectItem = useCallback(event => {
|
|
48
|
-
|
|
49
|
-
onSelect
|
|
50
|
-
dropdown === null || dropdown === void 0 || (_dropdown$onSelect = dropdown.onSelect) === null || _dropdown$onSelect === void 0 || _dropdown$onSelect.call(dropdown, eventKey, event);
|
|
48
|
+
onSelect?.(eventKey, event);
|
|
49
|
+
dropdown?.onSelect?.(eventKey, event);
|
|
51
50
|
}, [onSelect, eventKey, dropdown]);
|
|
52
|
-
const selected = activeProp || !isNil(eventKey) && shallowEqual(dropdown
|
|
53
|
-
const dispatch = dropdown
|
|
51
|
+
const selected = activeProp || !isNil(eventKey) && shallowEqual(dropdown?.activeKey, eventKey);
|
|
52
|
+
const dispatch = dropdown?.dispatch;
|
|
54
53
|
useEffect(() => {
|
|
55
54
|
if (dispatch) {
|
|
56
55
|
dispatch({
|
|
@@ -39,5 +39,5 @@ export interface DropdownMenuProps<T = string | number> extends StandardProps {
|
|
|
39
39
|
* </Dropdown.Menu>
|
|
40
40
|
* </Dropdown>
|
|
41
41
|
*/
|
|
42
|
-
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps<string | number> & SanitizedHTMListProps
|
|
42
|
+
declare const DropdownMenu: React.ForwardRefExoticComponent<DropdownMenuProps<string | number> & SanitizedHTMListProps & React.RefAttributes<HTMLElement>>;
|
|
43
43
|
export default DropdownMenu;
|
|
@@ -48,7 +48,7 @@ const DropdownMenu = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
48
48
|
rtl
|
|
49
49
|
} = useCustom();
|
|
50
50
|
const handleToggleSubmenu = useCallback((_, event) => {
|
|
51
|
-
onToggle
|
|
51
|
+
onToggle?.(eventKey, event);
|
|
52
52
|
}, [eventKey, onToggle]);
|
|
53
53
|
const {
|
|
54
54
|
merge,
|
package/esm/Form/Form.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { FormControlComponent } from '../FormControl';
|
|
|
3
3
|
import { FormInstance } from './hooks/useFormRef';
|
|
4
4
|
import { Schema } from 'schema-typed';
|
|
5
5
|
import type { WithAsProps, CheckTriggerType } from '../internals/types';
|
|
6
|
+
import type { Resolver } from './resolvers';
|
|
6
7
|
export interface FormProps<V = Record<string, any>, M = any, E = {
|
|
7
8
|
[P in keyof V]?: M;
|
|
8
9
|
}> extends WithAsProps, Omit<FormHTMLAttributes<HTMLFormElement>, 'onChange' | 'onSubmit' | 'onError' | 'onReset'> {
|
|
@@ -40,6 +41,42 @@ export interface FormProps<V = Record<string, any>, M = any, E = {
|
|
|
40
41
|
* @see https://github.com/rsuite/schema-typed
|
|
41
42
|
*/
|
|
42
43
|
model?: Schema;
|
|
44
|
+
/**
|
|
45
|
+
* A resolver function for integrating third-party validation libraries such as
|
|
46
|
+
* Yup, Zod, AJV, Joi, Valibot, etc.
|
|
47
|
+
*
|
|
48
|
+
* When provided, the `resolver` takes precedence over the `model` prop for
|
|
49
|
+
* form-level validation (`check` / `checkAsync`). Field-level inline `rule`
|
|
50
|
+
* props on `<Form.Control>` components are still respected.
|
|
51
|
+
*
|
|
52
|
+
* The resolver receives the current form values and must return (or resolve to)
|
|
53
|
+
* a `{ errors }` object where each key is a field name and each value is an
|
|
54
|
+
* error message or error object. An empty `errors` object means the form is valid.
|
|
55
|
+
*
|
|
56
|
+
* **Note:** If the resolver is asynchronous, form-level sync validation
|
|
57
|
+
* (`check()`) will return `false` and log a warning. Use `checkAsync()` or
|
|
58
|
+
* rely on the `onSubmit` callback (which always awaits the resolver).
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```tsx
|
|
62
|
+
* import * as yup from 'yup';
|
|
63
|
+
*
|
|
64
|
+
* const schema = yup.object({ name: yup.string().email().required() });
|
|
65
|
+
* const resolver = async (formValue) => {
|
|
66
|
+
* try {
|
|
67
|
+
* await schema.validate(formValue, { abortEarly: false });
|
|
68
|
+
* return { errors: {} };
|
|
69
|
+
* } catch (e) {
|
|
70
|
+
* const errors = {};
|
|
71
|
+
* e.inner.forEach(err => { if (err.path) errors[err.path] = err.message; });
|
|
72
|
+
* return { errors };
|
|
73
|
+
* }
|
|
74
|
+
* };
|
|
75
|
+
*
|
|
76
|
+
* <Form resolver={resolver} onSubmit={handleSubmit}>…</Form>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
resolver?: Resolver<V>;
|
|
43
80
|
/**
|
|
44
81
|
* Make the form readonly
|
|
45
82
|
*/
|
|
@@ -98,9 +135,7 @@ export interface FormProps<V = Record<string, any>, M = any, E = {
|
|
|
98
135
|
declare const Form: import("../internals/types").InternalRefForwardingComponent<"form", FormProps<Record<string, any>, any, {
|
|
99
136
|
[x: string]: any;
|
|
100
137
|
}> & {
|
|
101
|
-
ref?: React.Ref<FormInstance
|
|
102
|
-
[x: string]: string | undefined;
|
|
103
|
-
}>> | undefined;
|
|
138
|
+
ref?: React.Ref<FormInstance>;
|
|
104
139
|
}, never> & {
|
|
105
140
|
Stack: import("../internals/types").InternalRefForwardingComponent<"span", import("../FormStack").FormStackProps, never> & Record<string, never>;
|
|
106
141
|
Control: FormControlComponent;
|
package/esm/Form/Form.js
CHANGED
|
@@ -52,6 +52,7 @@ const Form = forwardRef((props, ref) => {
|
|
|
52
52
|
fluid,
|
|
53
53
|
layout,
|
|
54
54
|
model: formModel = defaultSchema,
|
|
55
|
+
resolver,
|
|
55
56
|
readOnly,
|
|
56
57
|
plaintext,
|
|
57
58
|
children,
|
|
@@ -82,7 +83,8 @@ const Form = forwardRef((props, ref) => {
|
|
|
82
83
|
getCombinedModel,
|
|
83
84
|
onCheck,
|
|
84
85
|
onError,
|
|
85
|
-
nestedField
|
|
86
|
+
nestedField,
|
|
87
|
+
resolver
|
|
86
88
|
};
|
|
87
89
|
const {
|
|
88
90
|
formError,
|
|
@@ -98,23 +100,35 @@ const Form = forwardRef((props, ref) => {
|
|
|
98
100
|
cleanErrorForField
|
|
99
101
|
} = useFormValidate(controlledFormError, formValidateProps);
|
|
100
102
|
const submit = useEventCallback(event => {
|
|
103
|
+
if (resolver) {
|
|
104
|
+
// When a resolver is provided, always use the async validation path so that
|
|
105
|
+
// both sync and async resolvers are handled correctly.
|
|
106
|
+
checkAsync().then(({
|
|
107
|
+
hasError
|
|
108
|
+
}) => {
|
|
109
|
+
if (!hasError) {
|
|
110
|
+
onSubmit?.(formValue, event);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
101
116
|
// Check the form before submitting
|
|
102
117
|
if (check()) {
|
|
103
|
-
onSubmit
|
|
118
|
+
onSubmit?.(formValue, event);
|
|
104
119
|
}
|
|
105
120
|
});
|
|
106
121
|
const reset = useEventCallback(event => {
|
|
107
122
|
resetErrors();
|
|
108
123
|
const resetValue = resetFormValue();
|
|
109
124
|
if (resetValue) {
|
|
110
|
-
onChange
|
|
125
|
+
onChange?.(resetValue);
|
|
111
126
|
}
|
|
112
|
-
onReset
|
|
127
|
+
onReset?.(resetValue, event);
|
|
113
128
|
});
|
|
114
129
|
const handleSubmit = useEventCallback(event => {
|
|
115
|
-
|
|
116
|
-
event
|
|
117
|
-
event === null || event === void 0 || (_event$stopPropagatio = event.stopPropagation) === null || _event$stopPropagatio === void 0 || _event$stopPropagatio.call(event);
|
|
130
|
+
event?.preventDefault?.();
|
|
131
|
+
event?.stopPropagation?.();
|
|
118
132
|
|
|
119
133
|
// Prevent submission when the form is disabled, readOnly, or plaintext
|
|
120
134
|
if (disabled || readOnly || plaintext) {
|
|
@@ -123,9 +137,8 @@ const Form = forwardRef((props, ref) => {
|
|
|
123
137
|
submit(event);
|
|
124
138
|
});
|
|
125
139
|
const handleReset = useEventCallback(event => {
|
|
126
|
-
|
|
127
|
-
event
|
|
128
|
-
event === null || event === void 0 || (_event$stopPropagatio2 = event.stopPropagation) === null || _event$stopPropagatio2 === void 0 || _event$stopPropagatio2.call(event);
|
|
140
|
+
event?.preventDefault?.();
|
|
141
|
+
event?.stopPropagation?.();
|
|
129
142
|
|
|
130
143
|
// Prevent reset when the form is disabled, readOnly, or plaintext
|
|
131
144
|
if (disabled || readOnly || plaintext) {
|
|
@@ -149,14 +162,14 @@ const Form = forwardRef((props, ref) => {
|
|
|
149
162
|
});
|
|
150
163
|
const removeFieldValue = useEventCallback(name => {
|
|
151
164
|
const formValue = onRemoveValue(name);
|
|
152
|
-
onChange
|
|
165
|
+
onChange?.(formValue);
|
|
153
166
|
});
|
|
154
167
|
const removeFieldError = useEventCallback(name => {
|
|
155
168
|
onRemoveError(name);
|
|
156
169
|
});
|
|
157
170
|
const onFieldChange = useEventCallback((name, value, event) => {
|
|
158
171
|
const nextFormValue = setFieldValue(name, value);
|
|
159
|
-
onChange
|
|
172
|
+
onChange?.(nextFormValue, event);
|
|
160
173
|
});
|
|
161
174
|
const formContextValue = {
|
|
162
175
|
errorFromContext,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Resolver } from '../resolvers';
|
|
2
2
|
export interface FormErrorProps {
|
|
3
3
|
formValue: any;
|
|
4
4
|
getCombinedModel: () => any;
|
|
5
5
|
onCheck?: (formError: any) => void;
|
|
6
6
|
onError?: (formError: any) => void;
|
|
7
7
|
nestedField?: boolean;
|
|
8
|
+
resolver?: Resolver;
|
|
8
9
|
}
|
|
9
10
|
export default function useFormValidate(_formError: any, props: FormErrorProps): {
|
|
10
11
|
formError: any;
|