rsuite 6.1.2 → 6.1.3
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 +9 -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.js +9 -9
- 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 +7 -16
- 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 +1 -3
- package/cjs/Form/Form.js +9 -11
- package/cjs/Form/hooks/useFormRef.d.ts +0 -1
- package/cjs/Form/hooks/useFormValidate.d.ts +0 -1
- package/cjs/Form/hooks/useFormValidate.js +19 -19
- package/cjs/Form/hooks/useFormValue.d.ts +0 -1
- 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 +1 -1
- package/cjs/Timeline/Timeline.js +1 -4
- 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 +1 -1
- 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.js +18 -24
- 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/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 +4 -12
- 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.js +223 -223
- 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.js +9 -9
- 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 +7 -16
- 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 +1 -3
- package/esm/Form/Form.js +9 -11
- package/esm/Form/hooks/useFormRef.d.ts +0 -1
- package/esm/Form/hooks/useFormValidate.d.ts +0 -1
- package/esm/Form/hooks/useFormValidate.js +19 -19
- package/esm/Form/hooks/useFormValue.d.ts +0 -1
- 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 +1 -1
- package/esm/Timeline/Timeline.js +1 -4
- 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 +1 -1
- 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.js +18 -24
- 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/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 +4 -12
- 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
|
@@ -79,7 +79,7 @@ const DateInput = (0, _utils.forwardRef)((props, ref) => {
|
|
|
79
79
|
}), [dateField, dateString, formatStr, dateLocale]);
|
|
80
80
|
const setSelectionRange = (0, _utils2.useInputSelection)(inputRef);
|
|
81
81
|
const handleChange = (0, _hooks.useEventCallback)((value, event) => {
|
|
82
|
-
onChange
|
|
82
|
+
onChange?.(value, event);
|
|
83
83
|
setValue(value);
|
|
84
84
|
});
|
|
85
85
|
const handleClear = (0, _hooks.useEventCallback)(event => {
|
|
@@ -211,15 +211,14 @@ const DateInput = (0, _utils.forwardRef)((props, ref) => {
|
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
213
|
const handlePaste = (0, _hooks.useEventCallback)(event => {
|
|
214
|
-
var _event$clipboardData;
|
|
215
214
|
event.preventDefault();
|
|
216
|
-
const pasteText =
|
|
215
|
+
const pasteText = event.clipboardData?.getData('text');
|
|
217
216
|
const nextDate = parseDate(pasteText, formatStr);
|
|
218
217
|
if ((0, _date.isValid)(nextDate)) {
|
|
219
218
|
handleChange(nextDate, event);
|
|
220
219
|
setNewDate(nextDate);
|
|
221
220
|
}
|
|
222
|
-
onPaste
|
|
221
|
+
onPaste?.(event);
|
|
223
222
|
});
|
|
224
223
|
const onKeyboardInput = (0, _useKeyboardInputEvent.default)({
|
|
225
224
|
onSegmentChange,
|
|
@@ -6,15 +6,135 @@ interface DateInputState {
|
|
|
6
6
|
isControlledDate?: boolean;
|
|
7
7
|
}
|
|
8
8
|
export declare function useDateInputState({ formatStr, locale, date, isControlledDate }: DateInputState): {
|
|
9
|
-
dateField:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
dateField: {
|
|
10
|
+
year: any;
|
|
11
|
+
format: string;
|
|
12
|
+
patternArray: {
|
|
13
|
+
pattern: string;
|
|
14
|
+
key: string;
|
|
15
|
+
}[];
|
|
16
|
+
month: number | null;
|
|
17
|
+
day: number | null;
|
|
18
|
+
hour: number | null;
|
|
19
|
+
minute: number | null;
|
|
20
|
+
second: number | null;
|
|
21
|
+
constructor: Function;
|
|
22
|
+
toString(): string;
|
|
23
|
+
toLocaleString(): string;
|
|
24
|
+
valueOf(): Object;
|
|
25
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
26
|
+
isPrototypeOf(v: Object): boolean;
|
|
27
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
28
|
+
should: Chai.Assertion;
|
|
29
|
+
} | {
|
|
30
|
+
month: any;
|
|
31
|
+
format: string;
|
|
32
|
+
patternArray: {
|
|
33
|
+
pattern: string;
|
|
34
|
+
key: string;
|
|
35
|
+
}[];
|
|
36
|
+
year: number | null;
|
|
37
|
+
day: number | null;
|
|
38
|
+
hour: number | null;
|
|
39
|
+
minute: number | null;
|
|
40
|
+
second: number | null;
|
|
41
|
+
constructor: Function;
|
|
42
|
+
toString(): string;
|
|
43
|
+
toLocaleString(): string;
|
|
44
|
+
valueOf(): Object;
|
|
45
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
46
|
+
isPrototypeOf(v: Object): boolean;
|
|
47
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
48
|
+
should: Chai.Assertion;
|
|
49
|
+
} | {
|
|
50
|
+
day: any;
|
|
51
|
+
format: string;
|
|
52
|
+
patternArray: {
|
|
53
|
+
pattern: string;
|
|
54
|
+
key: string;
|
|
55
|
+
}[];
|
|
56
|
+
year: number | null;
|
|
57
|
+
month: number | null;
|
|
58
|
+
hour: number | null;
|
|
59
|
+
minute: number | null;
|
|
60
|
+
second: number | null;
|
|
61
|
+
constructor: Function;
|
|
62
|
+
toString(): string;
|
|
63
|
+
toLocaleString(): string;
|
|
64
|
+
valueOf(): Object;
|
|
65
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
66
|
+
isPrototypeOf(v: Object): boolean;
|
|
67
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
68
|
+
should: Chai.Assertion;
|
|
69
|
+
} | {
|
|
70
|
+
hour: any;
|
|
71
|
+
format: string;
|
|
72
|
+
patternArray: {
|
|
73
|
+
pattern: string;
|
|
74
|
+
key: string;
|
|
75
|
+
}[];
|
|
76
|
+
year: number | null;
|
|
77
|
+
month: number | null;
|
|
78
|
+
day: number | null;
|
|
79
|
+
minute: number | null;
|
|
80
|
+
second: number | null;
|
|
81
|
+
constructor: Function;
|
|
82
|
+
toString(): string;
|
|
83
|
+
toLocaleString(): string;
|
|
84
|
+
valueOf(): Object;
|
|
85
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
86
|
+
isPrototypeOf(v: Object): boolean;
|
|
87
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
88
|
+
should: Chai.Assertion;
|
|
89
|
+
} | {
|
|
90
|
+
minute: any;
|
|
91
|
+
format: string;
|
|
92
|
+
patternArray: {
|
|
93
|
+
pattern: string;
|
|
94
|
+
key: string;
|
|
95
|
+
}[];
|
|
96
|
+
year: number | null;
|
|
97
|
+
month: number | null;
|
|
98
|
+
day: number | null;
|
|
99
|
+
hour: number | null;
|
|
100
|
+
second: number | null;
|
|
101
|
+
constructor: Function;
|
|
102
|
+
toString(): string;
|
|
103
|
+
toLocaleString(): string;
|
|
104
|
+
valueOf(): Object;
|
|
105
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
106
|
+
isPrototypeOf(v: Object): boolean;
|
|
107
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
108
|
+
should: Chai.Assertion;
|
|
109
|
+
} | {
|
|
110
|
+
second: any;
|
|
111
|
+
format: string;
|
|
112
|
+
patternArray: {
|
|
113
|
+
pattern: string;
|
|
114
|
+
key: string;
|
|
115
|
+
}[];
|
|
116
|
+
year: number | null;
|
|
117
|
+
month: number | null;
|
|
118
|
+
day: number | null;
|
|
119
|
+
hour: number | null;
|
|
120
|
+
minute: number | null;
|
|
121
|
+
constructor: Function;
|
|
122
|
+
toString(): string;
|
|
123
|
+
toLocaleString(): string;
|
|
124
|
+
valueOf(): Object;
|
|
125
|
+
hasOwnProperty(v: PropertyKey): boolean;
|
|
126
|
+
isPrototypeOf(v: Object): boolean;
|
|
127
|
+
propertyIsEnumerable(v: PropertyKey): boolean;
|
|
128
|
+
should: Chai.Assertion;
|
|
129
|
+
};
|
|
130
|
+
setDateOffset: (pattern: string, offset: number, callback?: (newDate: Date | null) => void) => void;
|
|
131
|
+
setDateField: (pattern: string, value: number | null, callback?: (newDate: Date | null) => void) => void;
|
|
12
132
|
setNewDate: (value: Date | null) => void;
|
|
13
133
|
getDateField: (pattern: string) => {
|
|
14
134
|
name: any;
|
|
15
135
|
value: any;
|
|
16
136
|
};
|
|
17
137
|
toDateString: () => string;
|
|
18
|
-
isEmptyValue: (type?: string
|
|
138
|
+
isEmptyValue: (type?: string, value?: number | null) => boolean | undefined;
|
|
19
139
|
};
|
|
20
140
|
export default useDateInputState;
|
|
@@ -81,7 +81,7 @@ function useDateInputState({
|
|
|
81
81
|
value
|
|
82
82
|
});
|
|
83
83
|
const field = _DateField.patternMap[pattern];
|
|
84
|
-
callback
|
|
84
|
+
callback?.(toDate(field, value));
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
const setDateField = (pattern, value, callback) => {
|
|
@@ -91,7 +91,7 @@ function useDateInputState({
|
|
|
91
91
|
type: actionName,
|
|
92
92
|
value
|
|
93
93
|
});
|
|
94
|
-
callback
|
|
94
|
+
callback?.(toDate(field, value));
|
|
95
95
|
};
|
|
96
96
|
const getDateField = pattern => {
|
|
97
97
|
const fieldName = _DateField.patternMap[pattern];
|
|
@@ -12,11 +12,11 @@ function useIsFocused({
|
|
|
12
12
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
13
13
|
const onFocus = (0, _react.useCallback)(event => {
|
|
14
14
|
setIsFocused(true);
|
|
15
|
-
onFocusProp
|
|
15
|
+
onFocusProp?.(event);
|
|
16
16
|
}, [onFocusProp]);
|
|
17
17
|
const onBlur = (0, _react.useCallback)(event => {
|
|
18
18
|
setIsFocused(false);
|
|
19
|
-
onBlurProp
|
|
19
|
+
onBlurProp?.(event);
|
|
20
20
|
}, [onBlurProp]);
|
|
21
21
|
return [isFocused, {
|
|
22
22
|
onFocus,
|
|
@@ -13,26 +13,25 @@ function useKeyboardInputEvent({
|
|
|
13
13
|
onKeyDown
|
|
14
14
|
}) {
|
|
15
15
|
return event => {
|
|
16
|
-
var _key$match, _key$match2;
|
|
17
16
|
const key = event.key;
|
|
18
17
|
switch (key) {
|
|
19
18
|
case 'ArrowRight':
|
|
20
19
|
case 'ArrowLeft':
|
|
21
|
-
onSegmentChange
|
|
20
|
+
onSegmentChange?.(event);
|
|
22
21
|
event.preventDefault();
|
|
23
22
|
break;
|
|
24
23
|
case 'ArrowUp':
|
|
25
24
|
case 'ArrowDown':
|
|
26
|
-
onSegmentValueChange
|
|
25
|
+
onSegmentValueChange?.(event);
|
|
27
26
|
event.preventDefault();
|
|
28
27
|
break;
|
|
29
28
|
case 'Backspace':
|
|
30
|
-
onSegmentValueRemove
|
|
29
|
+
onSegmentValueRemove?.(event);
|
|
31
30
|
event.preventDefault();
|
|
32
31
|
break;
|
|
33
|
-
case
|
|
32
|
+
case key.match(/\d/)?.input:
|
|
34
33
|
// Allow numeric keys to be entered
|
|
35
|
-
onSegmentValueChangeWithNumericKeys
|
|
34
|
+
onSegmentValueChangeWithNumericKeys?.(event);
|
|
36
35
|
event.preventDefault();
|
|
37
36
|
break;
|
|
38
37
|
case 'a':
|
|
@@ -45,10 +44,10 @@ function useKeyboardInputEvent({
|
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
// Handle AM/PM toggle with 'a' or 'p' keys
|
|
48
|
-
onAmPmToggle
|
|
47
|
+
onAmPmToggle?.(event);
|
|
49
48
|
event.preventDefault();
|
|
50
49
|
break;
|
|
51
|
-
case
|
|
50
|
+
case key.match(/[a-z]/)?.[0]:
|
|
52
51
|
// Determine whether the Ctrl or Command key is pressed, does not affect user copy and paste
|
|
53
52
|
if (event.ctrlKey || event.metaKey) {
|
|
54
53
|
break;
|
|
@@ -58,7 +57,7 @@ function useKeyboardInputEvent({
|
|
|
58
57
|
event.preventDefault();
|
|
59
58
|
break;
|
|
60
59
|
}
|
|
61
|
-
onKeyDown
|
|
60
|
+
onKeyDown?.(event);
|
|
62
61
|
};
|
|
63
62
|
}
|
|
64
63
|
var _default = exports.default = useKeyboardInputEvent;
|
package/cjs/DateInput/utils.d.ts
CHANGED
package/cjs/DateInput/utils.js
CHANGED
|
@@ -13,8 +13,7 @@ exports.validateDateTime = validateDateTime;
|
|
|
13
13
|
var _date = require("../internals/utils/date");
|
|
14
14
|
var _utils = require("../internals/utils");
|
|
15
15
|
function getPatternGroups(format, pattern) {
|
|
16
|
-
|
|
17
|
-
return ((_format$match = format.match(new RegExp(`(${pattern})+`))) === null || _format$match === void 0 ? void 0 : _format$match[0]) || '';
|
|
16
|
+
return format.match(new RegExp(`(${pattern})+`))?.[0] || '';
|
|
18
17
|
}
|
|
19
18
|
function getSelectIndexGap(options) {
|
|
20
19
|
const {
|
|
@@ -48,7 +47,7 @@ function getSelectIndexGap(options) {
|
|
|
48
47
|
} else if (month === 0) {
|
|
49
48
|
month = 12;
|
|
50
49
|
}
|
|
51
|
-
const monthStr = localize
|
|
50
|
+
const monthStr = localize?.month(month - 1, {
|
|
52
51
|
width: monthIsFull ? 'wide' : 'abbreviated'
|
|
53
52
|
});
|
|
54
53
|
gap = monthStr.length - (monthIsFull ? 4 : 3);
|
|
@@ -100,7 +100,7 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
100
100
|
target,
|
|
101
101
|
overlay
|
|
102
102
|
} = (0, _Picker.usePickerRef)(ref);
|
|
103
|
-
const formatStr = format ||
|
|
103
|
+
const formatStr = format || locale?.shortDateFormat || 'yyyy-MM-dd';
|
|
104
104
|
const {
|
|
105
105
|
merge,
|
|
106
106
|
prefix
|
|
@@ -149,7 +149,7 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
149
149
|
* Check whether the time is within the time range of the shortcut option in the toolbar.
|
|
150
150
|
*/
|
|
151
151
|
const isDatetimeDisabled = date => {
|
|
152
|
-
return
|
|
152
|
+
return isDateDisabled?.(date) || (0, _date.disableTime)(props, date);
|
|
153
153
|
};
|
|
154
154
|
|
|
155
155
|
/**
|
|
@@ -186,8 +186,8 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
186
186
|
*/
|
|
187
187
|
const handleMoveForward = (0, _hooks2.useEventCallback)(nextPageDate => {
|
|
188
188
|
setCalendarDate(nextPageDate);
|
|
189
|
-
onNextMonth
|
|
190
|
-
onChangeCalendarDate
|
|
189
|
+
onNextMonth?.(nextPageDate);
|
|
190
|
+
onChangeCalendarDate?.(nextPageDate);
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
/**
|
|
@@ -195,16 +195,16 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
195
195
|
*/
|
|
196
196
|
const handleMoveBackward = (0, _hooks2.useEventCallback)(nextPageDate => {
|
|
197
197
|
setCalendarDate(nextPageDate);
|
|
198
|
-
onPrevMonth
|
|
199
|
-
onChangeCalendarDate
|
|
198
|
+
onPrevMonth?.(nextPageDate);
|
|
199
|
+
onChangeCalendarDate?.(nextPageDate);
|
|
200
200
|
});
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
203
|
* The callback triggered when the date changes.
|
|
204
204
|
*/
|
|
205
205
|
const handleDateChange = (0, _hooks2.useEventCallback)((nextValue, event) => {
|
|
206
|
-
onSelect
|
|
207
|
-
onChangeCalendarDate
|
|
206
|
+
onSelect?.(nextValue, event);
|
|
207
|
+
onChangeCalendarDate?.(nextValue, event);
|
|
208
208
|
});
|
|
209
209
|
|
|
210
210
|
/**
|
|
@@ -219,15 +219,14 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
219
219
|
* Close the calendar panel.
|
|
220
220
|
*/
|
|
221
221
|
const handleClose = (0, _hooks2.useEventCallback)(() => {
|
|
222
|
-
|
|
223
|
-
(_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);
|
|
222
|
+
trigger.current?.close?.();
|
|
224
223
|
});
|
|
225
224
|
const updateValue = (event, date, closeOverlay = true) => {
|
|
226
225
|
const nextValue = typeof date !== 'undefined' ? date : calendarDate;
|
|
227
226
|
setCalendarDate(nextValue || (0, _date.startOfToday)());
|
|
228
227
|
setValue(nextValue);
|
|
229
228
|
if (nextValue !== value) {
|
|
230
|
-
onChange
|
|
229
|
+
onChange?.(nextValue, event);
|
|
231
230
|
}
|
|
232
231
|
|
|
233
232
|
// `closeOverlay` default value is `true`
|
|
@@ -243,7 +242,7 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
243
242
|
const value = range.value;
|
|
244
243
|
updateValue(event, value, closeOverlay);
|
|
245
244
|
handleDateChange(value, event);
|
|
246
|
-
onShortcutClick
|
|
245
|
+
onShortcutClick?.(range, event);
|
|
247
246
|
});
|
|
248
247
|
|
|
249
248
|
/**
|
|
@@ -251,7 +250,7 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
251
250
|
*/
|
|
252
251
|
const handleOK = (0, _hooks2.useEventCallback)(event => {
|
|
253
252
|
updateValue(event);
|
|
254
|
-
onOk
|
|
253
|
+
onOk?.(calendarDate, event);
|
|
255
254
|
focusInput();
|
|
256
255
|
});
|
|
257
256
|
|
|
@@ -260,10 +259,10 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
260
259
|
*/
|
|
261
260
|
|
|
262
261
|
const handleClean = (0, _hooks2.useEventCallback)(event => {
|
|
263
|
-
event
|
|
262
|
+
event?.stopPropagation();
|
|
264
263
|
updateValue(event, null);
|
|
265
264
|
resetCalendarDate(null);
|
|
266
|
-
onClean
|
|
265
|
+
onClean?.(event);
|
|
267
266
|
});
|
|
268
267
|
const handlePickerPopupKeyDown = (0, _hooks2.useEventCallback)(event => {
|
|
269
268
|
onKeyFocusEvent(event, {
|
|
@@ -323,26 +322,21 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
323
322
|
(0, _Picker.onMenuKeyDown)(event, {
|
|
324
323
|
esc: handleClose,
|
|
325
324
|
enter: () => {
|
|
326
|
-
var _trigger$current2;
|
|
327
325
|
const {
|
|
328
326
|
open
|
|
329
|
-
} =
|
|
327
|
+
} = trigger.current?.getState() || {};
|
|
330
328
|
if (open) {
|
|
331
329
|
if ((0, _date.isValid)(calendarDate) && !isDateDisabled(calendarDate)) {
|
|
332
330
|
updateValue(event);
|
|
333
331
|
focusInput();
|
|
334
332
|
}
|
|
335
333
|
} else {
|
|
336
|
-
|
|
337
|
-
(_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 || _trigger$current3.open();
|
|
334
|
+
trigger.current?.open();
|
|
338
335
|
}
|
|
339
336
|
}
|
|
340
337
|
});
|
|
341
338
|
});
|
|
342
|
-
const calendarProps = (0, _mapValues.default)((0, _pick.default)(props, _date.calendarOnlyProps), func => (next, date) =>
|
|
343
|
-
var _func;
|
|
344
|
-
return (_func = func === null || func === void 0 ? void 0 : func(next, date)) !== null && _func !== void 0 ? _func : false;
|
|
345
|
-
});
|
|
339
|
+
const calendarProps = (0, _mapValues.default)((0, _pick.default)(props, _date.calendarOnlyProps), func => (next, date) => func?.(next, date) ?? false);
|
|
346
340
|
const {
|
|
347
341
|
sideRanges,
|
|
348
342
|
bottomRanges
|
|
@@ -418,14 +412,13 @@ const DatePicker = (0, _utils2.forwardRef)((props, ref) => {
|
|
|
418
412
|
return caretAsProp || (mode === _date.DateMode.Time ? _Time.default : _CalenderSimple.default);
|
|
419
413
|
}, [caretAsProp, mode]);
|
|
420
414
|
const handleTriggerClose = (0, _hooks2.useEventCallback)(cause => {
|
|
421
|
-
var _props$onClose;
|
|
422
415
|
// Unless overlay is closing on user clicking "OK" button,
|
|
423
416
|
// reset the selected date on calendar panel
|
|
424
417
|
if (cause !== _OverlayTrigger.OverlayCloseCause.ImperativeHandle) {
|
|
425
418
|
resetCalendarDate();
|
|
426
419
|
}
|
|
427
420
|
setMonthView(false);
|
|
428
|
-
|
|
421
|
+
props.onClose?.();
|
|
429
422
|
});
|
|
430
423
|
const showCleanButton = cleanable && hasValue && !readOnly;
|
|
431
424
|
const [ariaProps, rest] = (0, _utils2.partitionHTMLProps)(restProps, {
|
|
@@ -44,12 +44,12 @@ const PredefinedRanges = /*#__PURE__*/_react.default.forwardRef(function Predefi
|
|
|
44
44
|
label,
|
|
45
45
|
...rest
|
|
46
46
|
} = range;
|
|
47
|
-
const disabled = disableShortcut
|
|
47
|
+
const disabled = disableShortcut?.(value);
|
|
48
48
|
const handleClickShortcut = event => {
|
|
49
49
|
if (disabled) {
|
|
50
50
|
return;
|
|
51
51
|
}
|
|
52
|
-
onShortcutClick
|
|
52
|
+
onShortcutClick?.(range, closeOverlay !== false ? true : false, event);
|
|
53
53
|
};
|
|
54
54
|
return /*#__PURE__*/_react.default.createElement(_Button.default, (0, _extends2.default)({
|
|
55
55
|
appearance: "link",
|
|
@@ -57,7 +57,7 @@ const PredefinedRanges = /*#__PURE__*/_react.default.forwardRef(function Predefi
|
|
|
57
57
|
key: index,
|
|
58
58
|
disabled: disabled,
|
|
59
59
|
onClick: handleClickShortcut
|
|
60
|
-
}, rest), hasLocaleKey(label) && typeof label === 'string' ? locale
|
|
60
|
+
}, rest), hasLocaleKey(label) && typeof label === 'string' ? locale?.[label] : label);
|
|
61
61
|
}));
|
|
62
62
|
});
|
|
63
63
|
var _default = exports.default = PredefinedRanges;
|
|
@@ -16,7 +16,7 @@ const OkButton = ({
|
|
|
16
16
|
onOk,
|
|
17
17
|
children
|
|
18
18
|
}) => {
|
|
19
|
-
const disabled = disableOkBtn
|
|
19
|
+
const disabled = disableOkBtn?.(calendarDate);
|
|
20
20
|
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
21
21
|
appearance: "primary",
|
|
22
22
|
size: "sm",
|
|
@@ -47,13 +47,13 @@ const Toolbar = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
47
47
|
prefix,
|
|
48
48
|
withPrefix
|
|
49
49
|
} = (0, _hooks.useStyles)(classPrefix);
|
|
50
|
-
if (hideOkBtn &&
|
|
50
|
+
if (hideOkBtn && ranges?.length === 0) {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
const classes = merge(className, withPrefix());
|
|
54
54
|
|
|
55
55
|
// If there are no ranges, the ok button should be aligned to the right
|
|
56
|
-
const justify =
|
|
56
|
+
const justify = ranges?.length === 0 ? 'flex-end' : 'space-between';
|
|
57
57
|
return /*#__PURE__*/_react.default.createElement(_Stack.default, (0, _extends2.default)({
|
|
58
58
|
ref: ref,
|
|
59
59
|
className: classes,
|
|
@@ -74,7 +74,7 @@ const Toolbar = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
74
74
|
disableOkBtn: disableOkBtn,
|
|
75
75
|
calendarDate: calendarDate,
|
|
76
76
|
onOk: onOk
|
|
77
|
-
}, locale
|
|
77
|
+
}, locale?.ok)));
|
|
78
78
|
});
|
|
79
79
|
Toolbar.displayName = 'Toolbar';
|
|
80
80
|
var _default = exports.default = Toolbar;
|
|
@@ -40,8 +40,8 @@ function useFocus(props) {
|
|
|
40
40
|
const formatStr = showMonth ? formattedMonthPattern : formattedDayPattern;
|
|
41
41
|
const ariaLabel = (0, _utils.getAriaLabel)(date, formatStr, formatDate);
|
|
42
42
|
const container = getOverlayContainer();
|
|
43
|
-
const dateElement = container
|
|
44
|
-
if (
|
|
43
|
+
const dateElement = container?.querySelector(`[aria-label="${ariaLabel}"]`);
|
|
44
|
+
if (dateElement?.getAttribute('aria-disabled') === 'true') {
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
return true;
|
|
@@ -53,8 +53,8 @@ function useFocus(props) {
|
|
|
53
53
|
const focusSelectedDate = () => {
|
|
54
54
|
(0, _delay.default)(() => {
|
|
55
55
|
const container = getOverlayContainer();
|
|
56
|
-
const selectedElement = container
|
|
57
|
-
selectedElement
|
|
56
|
+
const selectedElement = container?.querySelector('[aria-selected="true"]');
|
|
57
|
+
selectedElement?.focus();
|
|
58
58
|
}, 1);
|
|
59
59
|
};
|
|
60
60
|
|
|
@@ -62,10 +62,7 @@ function useFocus(props) {
|
|
|
62
62
|
* Focus on the input element
|
|
63
63
|
*/
|
|
64
64
|
const focusInput = (0, _hooks.useEventCallback)(() => {
|
|
65
|
-
(0, _delay.default)(() =>
|
|
66
|
-
var _target$current;
|
|
67
|
-
return (_target$current = target.current) === null || _target$current === void 0 ? void 0 : _target$current.focus();
|
|
68
|
-
}, 1);
|
|
65
|
+
(0, _delay.default)(() => target.current?.focus(), 1);
|
|
69
66
|
});
|
|
70
67
|
const onKeyFocusEvent = (0, _hooks.useEventCallback)((event, options) => {
|
|
71
68
|
const {
|
|
@@ -15,7 +15,7 @@ function useMonthView(props) {
|
|
|
15
15
|
* The callback triggered after the month selection box is opened or closed.
|
|
16
16
|
*/
|
|
17
17
|
const toggleMonthView = (0, _hooks.useEventCallback)(show => {
|
|
18
|
-
onToggleMonthDropdown
|
|
18
|
+
onToggleMonthDropdown?.(show);
|
|
19
19
|
setMonthView(show);
|
|
20
20
|
});
|
|
21
21
|
return {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
1
|
import { ToolbarProps } from './Toolbar';
|
|
3
2
|
import type { DateOptionPreset } from '../internals/types';
|
|
4
3
|
import type { InnerRange } from './types';
|
|
@@ -9,7 +8,7 @@ export declare function getDefaultRanges<T extends Date | DateRange>(value: T):
|
|
|
9
8
|
* @param ranges
|
|
10
9
|
* @param calendarDate
|
|
11
10
|
*/
|
|
12
|
-
export declare const getRanges: <T extends Date | DateRange>({ ranges, calendarDate }: Pick<ToolbarProps<T
|
|
11
|
+
export declare const getRanges: <T extends Date | DateRange>({ ranges, calendarDate }: Pick<ToolbarProps<T>, "ranges" | "calendarDate">) => InnerRange<T | null>[];
|
|
13
12
|
export declare function splitRanges<T extends Date | DateRange>(ranges?: DateOptionPreset<T | null>[]): {
|
|
14
13
|
sideRanges: DateOptionPreset<T | null>[] | undefined;
|
|
15
14
|
bottomRanges: DateOptionPreset<T | null>[] | undefined;
|
package/cjs/DatePicker/utils.js
CHANGED
|
@@ -62,10 +62,10 @@ const getRanges = ({
|
|
|
62
62
|
exports.getRanges = getRanges;
|
|
63
63
|
function splitRanges(ranges) {
|
|
64
64
|
// The shortcut option on the left side of the calendar panel
|
|
65
|
-
const sideRanges = ranges
|
|
65
|
+
const sideRanges = ranges?.filter(range => range?.placement === 'left');
|
|
66
66
|
|
|
67
67
|
// The shortcut option on the bottom of the calendar panel
|
|
68
|
-
const bottomRanges = ranges
|
|
68
|
+
const bottomRanges = ranges?.filter(range => range?.placement === 'bottom' || range?.placement === undefined);
|
|
69
69
|
return {
|
|
70
70
|
sideRanges,
|
|
71
71
|
bottomRanges
|
|
@@ -63,11 +63,11 @@ const DateRangeInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
63
63
|
};
|
|
64
64
|
const startDateState = (0, _DateInput.useDateInputState)({
|
|
65
65
|
...dateInputOptions,
|
|
66
|
-
date:
|
|
66
|
+
date: value?.[0] || null
|
|
67
67
|
});
|
|
68
68
|
const endDateState = (0, _DateInput.useDateInputState)({
|
|
69
69
|
...dateInputOptions,
|
|
70
|
-
date:
|
|
70
|
+
date: value?.[1] || null
|
|
71
71
|
});
|
|
72
72
|
const {
|
|
73
73
|
isMoveCursor,
|
|
@@ -100,8 +100,8 @@ const DateRangeInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
100
100
|
};
|
|
101
101
|
const setSelectionRange = (0, _DateInput.useInputSelection)(inputRef);
|
|
102
102
|
const handleChange = (0, _hooks.useEventCallback)((date, event) => {
|
|
103
|
-
const nextValue = dateType === _utils2.DateType.Start ? [date, value
|
|
104
|
-
onChange
|
|
103
|
+
const nextValue = dateType === _utils2.DateType.Start ? [date, value?.[1]] : [value?.[0], date];
|
|
104
|
+
onChange?.(nextValue, event);
|
|
105
105
|
setValue(nextValue);
|
|
106
106
|
});
|
|
107
107
|
const handleClear = (0, _hooks.useEventCallback)(event => {
|
|
@@ -110,7 +110,7 @@ const DateRangeInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
110
110
|
setSelectionRange(0, 0);
|
|
111
111
|
reset();
|
|
112
112
|
setValue(null);
|
|
113
|
-
onChange
|
|
113
|
+
onChange?.(null, event);
|
|
114
114
|
});
|
|
115
115
|
const onSegmentChange = (0, _hooks.useEventCallback)((event, nextDirection) => {
|
|
116
116
|
const input = event.target;
|
|
@@ -253,18 +253,17 @@ const DateRangeInput = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
const handlePaste = (0, _hooks.useEventCallback)(event => {
|
|
256
|
-
var _event$clipboardData;
|
|
257
256
|
event.preventDefault();
|
|
258
|
-
const pasteText =
|
|
257
|
+
const pasteText = event.clipboardData?.getData('text');
|
|
259
258
|
const [start, end] = pasteText.split(character).map(date => parseDate(date, formatStr));
|
|
260
259
|
if ((0, _date.isValid)(start) && (0, _date.isValid)(end)) {
|
|
261
260
|
const nextValue = [start, end];
|
|
262
|
-
onChange
|
|
261
|
+
onChange?.(nextValue, event);
|
|
263
262
|
setValue(nextValue);
|
|
264
263
|
startDateState.setNewDate(start);
|
|
265
264
|
endDateState.setNewDate(end);
|
|
266
265
|
}
|
|
267
|
-
onPaste
|
|
266
|
+
onPaste?.(event);
|
|
268
267
|
});
|
|
269
268
|
const onKeyboardInput = (0, _DateInput.useKeyboardInputEvent)({
|
|
270
269
|
onSegmentChange,
|
|
@@ -37,10 +37,10 @@ const Calendar = (0, _utils.forwardRef)((props, ref) => {
|
|
|
37
37
|
onSelect
|
|
38
38
|
});
|
|
39
39
|
const disableCalendarDate = (0, _react.useCallback)(date => {
|
|
40
|
-
return disabledDate
|
|
40
|
+
return disabledDate?.(date, value, _constants.DATERANGE_DISABLED_TARGET.CALENDAR);
|
|
41
41
|
}, [disabledDate, value]);
|
|
42
42
|
const handleRenderTitle = (0, _react.useCallback)(date => {
|
|
43
|
-
return renderTitle
|
|
43
|
+
return renderTitle?.(date, calendarKey);
|
|
44
44
|
}, [renderTitle, calendarKey]);
|
|
45
45
|
return /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
|
|
46
46
|
"data-testid": `calendar-${calendarKey}`
|