rsuite 5.71.0 → 5.73.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/Accordion/styles/index.css +20 -6
- package/Animation/styles/collapse.less +2 -1
- package/Animation/styles/fade.less +1 -1
- package/Animation/styles/index.css +8 -0
- package/Animation/styles/index.less +1 -0
- package/Animation/styles/variables.less +4 -0
- package/AutoComplete/styles/index.css +11 -0
- package/CHANGELOG.md +34 -0
- package/Calendar/styles/index.css +71 -44
- package/Calendar/styles/index.less +54 -28
- package/Cascader/styles/index.css +11 -0
- package/CheckPicker/styles/index.css +11 -1
- package/CheckTree/styles/index.css +11 -0
- package/CheckTreePicker/styles/index.css +11 -0
- package/DatePicker/styles/index.css +89 -49
- package/DatePicker/styles/index.less +8 -5
- package/DateRangePicker/styles/index.css +93 -54
- package/DateRangePicker/styles/index.less +7 -6
- package/InputPicker/styles/index.css +11 -1
- package/MultiCascadeTree/styles/index.css +11 -0
- package/MultiCascader/styles/index.css +11 -0
- package/Pagination/styles/index.css +11 -1
- package/Panel/styles/index.css +20 -6
- package/SelectPicker/styles/index.css +11 -1
- package/TagInput/styles/index.css +11 -1
- package/TagPicker/styles/index.css +11 -1
- package/TimePicker/package.json +7 -0
- package/TimePicker/styles/index.css +4155 -0
- package/TimePicker/styles/index.less +1 -0
- package/TimeRangePicker/package.json +7 -0
- package/TimeRangePicker/styles/index.css +4255 -0
- package/TimeRangePicker/styles/index.less +1 -0
- package/cjs/Calendar/Calendar.d.ts +1 -1
- package/cjs/Calendar/Calendar.js +22 -26
- package/cjs/Calendar/CalendarBody.js +9 -9
- package/cjs/Calendar/CalendarContainer.d.ts +10 -2
- package/cjs/Calendar/CalendarContainer.js +40 -68
- package/cjs/Calendar/CalendarHeader.d.ts +0 -2
- package/cjs/Calendar/CalendarHeader.js +28 -46
- package/cjs/Calendar/{CalendarContext.d.ts → CalendarProvider.d.ts} +3 -22
- package/cjs/Calendar/CalendarProvider.js +13 -0
- package/cjs/Calendar/Grid/Grid.d.ts +6 -0
- package/cjs/Calendar/{Table.js → Grid/Grid.js} +11 -17
- package/{esm/Calendar/TableCell.d.ts → cjs/Calendar/Grid/GridCell.d.ts} +4 -4
- package/cjs/Calendar/{TableCell.js → Grid/GridCell.js} +13 -13
- package/cjs/Calendar/Grid/GridHeaderRow.d.ts +4 -0
- package/cjs/Calendar/{TableHeaderRow.js → Grid/GridHeaderRow.js} +11 -11
- package/cjs/Calendar/Grid/GridRow.d.ts +7 -0
- package/cjs/Calendar/{TableRow.js → Grid/GridRow.js} +21 -21
- package/cjs/Calendar/Grid/index.d.ts +2 -0
- package/cjs/Calendar/Grid/index.js +8 -0
- package/cjs/Calendar/MonthDropdown/MonthDropdown.d.ts +11 -0
- package/cjs/Calendar/{MonthDropdown.js → MonthDropdown/MonthDropdown.js} +19 -25
- package/cjs/Calendar/{MonthDropdownItem.d.ts → MonthDropdown/MonthDropdownItem.d.ts} +1 -1
- package/cjs/Calendar/{MonthDropdownItem.js → MonthDropdown/MonthDropdownItem.js} +11 -11
- package/cjs/Calendar/MonthDropdown/index.d.ts +2 -0
- package/cjs/Calendar/MonthDropdown/index.js +8 -0
- package/cjs/Calendar/TimeDropdown/TimeColumn.d.ts +8 -0
- package/cjs/Calendar/TimeDropdown/TimeColumn.js +27 -0
- package/{esm/Calendar → cjs/Calendar/TimeDropdown}/TimeDropdown.d.ts +2 -25
- package/cjs/Calendar/{TimeDropdown.js → TimeDropdown/TimeDropdown.js} +79 -112
- package/cjs/Calendar/TimeDropdown/index.d.ts +2 -0
- package/cjs/Calendar/TimeDropdown/index.js +8 -0
- package/cjs/Calendar/TimeDropdown/utils/formatWithLeadingZero.d.ts +1 -0
- package/cjs/Calendar/TimeDropdown/utils/formatWithLeadingZero.js +8 -0
- package/cjs/Calendar/TimeDropdown/utils/getClockTime.d.ts +11 -0
- package/cjs/Calendar/TimeDropdown/utils/getClockTime.js +43 -0
- package/cjs/Calendar/TimeDropdown/utils/getTimeLimits.d.ts +11 -0
- package/cjs/Calendar/TimeDropdown/utils/getTimeLimits.js +24 -0
- package/cjs/Calendar/TimeDropdown/utils/index.d.ts +4 -0
- package/cjs/Calendar/TimeDropdown/utils/index.js +23 -0
- package/cjs/Calendar/TimeDropdown/utils/scrollToTime.d.ts +2 -0
- package/cjs/Calendar/TimeDropdown/utils/scrollToTime.js +28 -0
- package/cjs/Calendar/hooks/index.d.ts +3 -0
- package/cjs/Calendar/hooks/index.js +24 -0
- package/cjs/Calendar/hooks/useCalendar.d.ts +2 -0
- package/cjs/Calendar/hooks/useCalendar.js +10 -0
- package/cjs/Calendar/{useCalendarDate.d.ts → hooks/useCalendarDate.d.ts} +1 -2
- package/cjs/Calendar/{useCalendarDate.js → hooks/useCalendarDate.js} +8 -8
- package/cjs/Calendar/hooks/useCalendarState.d.ts +22 -0
- package/cjs/Calendar/hooks/useCalendarState.js +60 -0
- package/cjs/Calendar/index.d.ts +2 -4
- package/cjs/Calendar/index.js +2 -4
- package/cjs/Calendar/types.d.ts +19 -0
- package/cjs/Calendar/types.js +4 -0
- package/cjs/Calendar/{utils.js → utils/getAriaLabel.js} +1 -1
- package/cjs/Calendar/utils/index.d.ts +2 -0
- package/cjs/Calendar/utils/index.js +9 -0
- package/cjs/Calendar/utils/isEveryDateInMonth.d.ts +1 -0
- package/cjs/Calendar/utils/isEveryDateInMonth.js +15 -0
- package/cjs/CascadeTree/TreeView.js +3 -3
- package/cjs/CustomProvider/CustomProvider.d.ts +38 -4
- package/cjs/CustomProvider/CustomProvider.js +20 -6
- package/cjs/DateInput/DateField.js +2 -2
- package/cjs/DateInput/DateInput.js +17 -6
- package/cjs/DateInput/hooks/useDateInputState.js +1 -1
- package/cjs/DatePicker/DatePicker.d.ts +6 -2
- package/cjs/DatePicker/DatePicker.js +58 -67
- package/cjs/DatePicker/utils.js +1 -1
- package/cjs/DateRangeInput/DateRangeInput.js +16 -5
- package/cjs/DateRangePicker/Calendar.d.ts +4 -5
- package/cjs/DateRangePicker/Calendar.js +18 -44
- package/cjs/DateRangePicker/DateRangePicker.d.ts +21 -4
- package/cjs/DateRangePicker/DateRangePicker.js +98 -72
- package/cjs/DateRangePicker/DateRangePickerProvider.d.ts +10 -0
- package/cjs/DateRangePicker/{DateRangePickerContext.js → DateRangePickerProvider.js} +3 -3
- package/cjs/DateRangePicker/hooks/index.d.ts +3 -0
- package/cjs/DateRangePicker/hooks/index.js +11 -0
- package/cjs/DateRangePicker/hooks/useCalendarHandlers.d.ts +17 -0
- package/cjs/DateRangePicker/hooks/useCalendarHandlers.js +43 -0
- package/cjs/DateRangePicker/hooks/useDateDisabled.d.ts +1 -1
- package/cjs/DateRangePicker/hooks/useDateDisabled.js +1 -0
- package/cjs/DateRangePicker/hooks/useDateRangePicker.d.ts +2 -0
- package/cjs/DateRangePicker/hooks/useDateRangePicker.js +10 -0
- package/cjs/DateRangePicker/utils.js +1 -1
- package/cjs/Dropdown/Dropdown.d.ts +1 -1
- package/cjs/Dropdown/DropdownItem.d.ts +1 -1
- package/cjs/Dropdown/DropdownMenu.d.ts +1 -1
- package/cjs/Dropdown/DropdownMenu.js +3 -3
- package/cjs/Dropdown/DropdownToggle.d.ts +1 -1
- package/cjs/FormHelpText/FormHelpText.js +2 -2
- package/cjs/IconButton/IconButton.d.ts +1 -1
- package/cjs/InlineEdit/renderChildren.d.ts +1 -1
- package/cjs/InlineEdit/renderChildren.js +13 -4
- package/cjs/InlineEdit/useFocusEvent.d.ts +2 -2
- package/cjs/InlineEdit/useFocusEvent.js +9 -4
- package/cjs/MultiCascadeTree/TreeView.js +3 -3
- package/cjs/Nav/NavDropdownItem.d.ts +1 -1
- package/cjs/Nav/NavDropdownMenu.d.ts +1 -1
- package/cjs/Nav/NavDropdownMenu.js +3 -3
- package/cjs/Nav/NavItem.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdown.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdownItem.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdownMenu.d.ts +1 -1
- package/cjs/Navbar/NavbarDropdownMenu.js +3 -3
- package/cjs/Navbar/NavbarItem.d.ts +1 -1
- package/cjs/Pagination/Pagination.js +5 -5
- package/cjs/Panel/AccordionButton.js +2 -2
- package/cjs/Sidenav/ExpandedSidenavDropdown.d.ts +1 -1
- package/cjs/Sidenav/ExpandedSidenavDropdownItem.d.ts +1 -1
- package/cjs/Sidenav/ExpandedSidenavDropdownMenu.d.ts +1 -1
- package/cjs/Sidenav/SidenavDropdown.d.ts +1 -1
- package/cjs/Sidenav/SidenavDropdownItem.d.ts +1 -1
- package/cjs/Sidenav/SidenavDropdownMenu.d.ts +1 -1
- package/cjs/Sidenav/SidenavItem.d.ts +1 -1
- package/cjs/Sidenav/SidenavToggle.js +3 -3
- package/cjs/Steps/StepItem.d.ts +1 -1
- package/cjs/TimePicker/TimePicker.d.ts +81 -0
- package/cjs/TimePicker/TimePicker.js +31 -0
- package/cjs/TimePicker/index.d.ts +3 -0
- package/cjs/TimePicker/index.js +8 -0
- package/cjs/TimeRangePicker/TimeRangePicker.d.ts +77 -0
- package/cjs/TimeRangePicker/TimeRangePicker.js +23 -0
- package/cjs/TimeRangePicker/index.d.ts +3 -0
- package/cjs/TimeRangePicker/index.js +8 -0
- package/cjs/index.d.ts +4 -0
- package/cjs/index.js +6 -1
- package/cjs/internals/Picker/ListItemGroup.js +1 -1
- package/cjs/internals/Picker/Listbox.js +4 -2
- package/cjs/internals/Picker/PickerIndicator.js +2 -2
- package/cjs/internals/Picker/PickerToggle.d.ts +1 -1
- package/cjs/internals/SearchBox/SearchBox.js +1 -1
- package/cjs/internals/constants/statusIcons.js +7 -7
- package/cjs/internals/hooks/useCustom.js +2 -2
- package/cjs/internals/hooks/useToggleCaret.d.ts +1 -1
- package/cjs/internals/utils/date/extractTimeFormat.d.ts +4 -0
- package/cjs/internals/utils/date/extractTimeFormat.js +12 -0
- package/cjs/internals/utils/date/formatCheck.d.ts +4 -0
- package/cjs/internals/utils/date/formatCheck.js +8 -1
- package/cjs/internals/utils/date/index.d.ts +4 -2
- package/cjs/internals/utils/date/index.js +72 -7
- package/cjs/internals/utils/date/useDateMode.d.ts +16 -0
- package/cjs/internals/utils/date/useDateMode.js +57 -0
- package/cjs/internals/utils/index.d.ts +0 -1
- package/cjs/internals/utils/index.js +1 -4
- package/cjs/locales/ar_EG.d.ts +10 -0
- package/cjs/locales/ar_EG.js +8 -4
- package/cjs/locales/ca_ES.d.ts +10 -0
- package/cjs/locales/ca_ES.js +8 -4
- package/cjs/locales/cs_CZ.d.ts +10 -0
- package/cjs/locales/cs_CZ.js +8 -4
- package/cjs/locales/da_DK.d.ts +10 -0
- package/cjs/locales/da_DK.js +8 -4
- package/cjs/locales/de_DE.d.ts +10 -0
- package/cjs/locales/de_DE.js +8 -4
- package/cjs/locales/en_GB.d.ts +130 -2
- package/cjs/locales/en_GB.js +85 -2
- package/cjs/locales/en_US.d.ts +10 -0
- package/cjs/locales/en_US.js +8 -4
- package/cjs/locales/es_AR.d.ts +10 -0
- package/cjs/locales/es_AR.js +8 -4
- package/cjs/locales/es_ES.d.ts +10 -0
- package/cjs/locales/es_ES.js +8 -4
- package/cjs/locales/fa_IR.d.ts +10 -0
- package/cjs/locales/fa_IR.js +8 -4
- package/cjs/locales/fi_FI.d.ts +10 -0
- package/cjs/locales/fi_FI.js +8 -4
- package/cjs/locales/fr_FR.d.ts +10 -0
- package/cjs/locales/fr_FR.js +8 -4
- package/cjs/locales/hu_HU.d.ts +12 -0
- package/cjs/locales/hu_HU.js +11 -5
- package/cjs/locales/index.d.ts +1 -1
- package/cjs/locales/it_IT.d.ts +10 -0
- package/cjs/locales/it_IT.js +8 -4
- package/cjs/locales/ja_JP.d.ts +10 -0
- package/cjs/locales/ja_JP.js +8 -4
- package/cjs/locales/kk_KZ.d.ts +10 -0
- package/cjs/locales/kk_KZ.js +8 -4
- package/cjs/locales/ko_KR.d.ts +10 -0
- package/cjs/locales/ko_KR.js +8 -4
- package/cjs/locales/ne_NP.d.ts +10 -0
- package/cjs/locales/ne_NP.js +8 -4
- package/cjs/locales/nl_NL.d.ts +10 -0
- package/cjs/locales/nl_NL.js +8 -4
- package/cjs/locales/pt_BR.d.ts +10 -0
- package/cjs/locales/pt_BR.js +8 -4
- package/cjs/locales/ru_RU.d.ts +10 -0
- package/cjs/locales/ru_RU.js +8 -4
- package/cjs/locales/sv_SE.d.ts +10 -0
- package/cjs/locales/sv_SE.js +8 -4
- package/cjs/locales/tr_TR.d.ts +10 -0
- package/cjs/locales/tr_TR.js +8 -4
- package/cjs/locales/zh_CN.d.ts +10 -0
- package/cjs/locales/zh_CN.js +8 -4
- package/cjs/locales/zh_TW.d.ts +10 -0
- package/cjs/locales/zh_TW.js +8 -4
- package/dist/rsuite-no-reset-rtl.css +116 -60
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +116 -60
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +116 -60
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +116 -60
- package/dist/rsuite.js +822 -5375
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Calendar/Calendar.d.ts +1 -1
- package/esm/Calendar/Calendar.js +21 -23
- package/esm/Calendar/CalendarBody.js +9 -9
- package/esm/Calendar/CalendarContainer.d.ts +10 -2
- package/esm/Calendar/CalendarContainer.js +42 -70
- package/esm/Calendar/CalendarHeader.d.ts +0 -2
- package/esm/Calendar/CalendarHeader.js +29 -47
- package/esm/Calendar/{CalendarContext.d.ts → CalendarProvider.d.ts} +3 -22
- package/esm/Calendar/CalendarProvider.js +9 -0
- package/esm/Calendar/Grid/Grid.d.ts +6 -0
- package/esm/Calendar/{Table.js → Grid/Grid.js} +11 -17
- package/{cjs/Calendar/TableCell.d.ts → esm/Calendar/Grid/GridCell.d.ts} +4 -4
- package/esm/Calendar/{TableCell.js → Grid/GridCell.js} +13 -13
- package/esm/Calendar/Grid/GridHeaderRow.d.ts +4 -0
- package/esm/Calendar/{TableHeaderRow.js → Grid/GridHeaderRow.js} +11 -11
- package/esm/Calendar/Grid/GridRow.d.ts +7 -0
- package/esm/Calendar/{TableRow.js → Grid/GridRow.js} +21 -21
- package/esm/Calendar/Grid/index.d.ts +2 -0
- package/esm/Calendar/Grid/index.js +3 -0
- package/esm/Calendar/MonthDropdown/MonthDropdown.d.ts +11 -0
- package/esm/Calendar/{MonthDropdown.js → MonthDropdown/MonthDropdown.js} +18 -23
- package/esm/Calendar/{MonthDropdownItem.d.ts → MonthDropdown/MonthDropdownItem.d.ts} +1 -1
- package/esm/Calendar/{MonthDropdownItem.js → MonthDropdown/MonthDropdownItem.js} +12 -12
- package/esm/Calendar/MonthDropdown/index.d.ts +2 -0
- package/esm/Calendar/MonthDropdown/index.js +3 -0
- package/esm/Calendar/TimeDropdown/TimeColumn.d.ts +8 -0
- package/esm/Calendar/TimeDropdown/TimeColumn.js +22 -0
- package/{cjs/Calendar → esm/Calendar/TimeDropdown}/TimeDropdown.d.ts +2 -25
- package/esm/Calendar/TimeDropdown/TimeDropdown.js +161 -0
- package/esm/Calendar/TimeDropdown/index.d.ts +2 -0
- package/esm/Calendar/TimeDropdown/index.js +3 -0
- package/esm/Calendar/TimeDropdown/utils/formatWithLeadingZero.d.ts +1 -0
- package/esm/Calendar/TimeDropdown/utils/formatWithLeadingZero.js +4 -0
- package/esm/Calendar/TimeDropdown/utils/getClockTime.d.ts +11 -0
- package/esm/Calendar/TimeDropdown/utils/getClockTime.js +39 -0
- package/esm/Calendar/TimeDropdown/utils/getTimeLimits.d.ts +11 -0
- package/esm/Calendar/TimeDropdown/utils/getTimeLimits.js +20 -0
- package/esm/Calendar/TimeDropdown/utils/index.d.ts +4 -0
- package/esm/Calendar/TimeDropdown/utils/index.js +5 -0
- package/esm/Calendar/TimeDropdown/utils/scrollToTime.d.ts +2 -0
- package/esm/Calendar/TimeDropdown/utils/scrollToTime.js +23 -0
- package/esm/Calendar/hooks/index.d.ts +3 -0
- package/esm/Calendar/hooks/index.js +4 -0
- package/esm/Calendar/hooks/useCalendar.d.ts +2 -0
- package/esm/Calendar/hooks/useCalendar.js +6 -0
- package/esm/Calendar/{useCalendarDate.d.ts → hooks/useCalendarDate.d.ts} +1 -2
- package/esm/Calendar/{useCalendarDate.js → hooks/useCalendarDate.js} +7 -7
- package/esm/Calendar/hooks/useCalendarState.d.ts +22 -0
- package/esm/Calendar/hooks/useCalendarState.js +56 -0
- package/esm/Calendar/index.d.ts +2 -4
- package/esm/Calendar/index.js +2 -3
- package/esm/Calendar/types.d.ts +19 -0
- package/esm/Calendar/types.js +2 -0
- package/esm/Calendar/{utils.js → utils/getAriaLabel.js} +1 -1
- package/esm/Calendar/utils/index.d.ts +2 -0
- package/esm/Calendar/utils/index.js +3 -0
- package/esm/Calendar/utils/isEveryDateInMonth.d.ts +1 -0
- package/esm/Calendar/utils/isEveryDateInMonth.js +11 -0
- package/esm/CascadeTree/TreeView.js +3 -3
- package/esm/CustomProvider/CustomProvider.d.ts +38 -4
- package/esm/CustomProvider/CustomProvider.js +20 -6
- package/esm/DateInput/DateField.js +2 -2
- package/esm/DateInput/DateInput.js +17 -6
- package/esm/DateInput/hooks/useDateInputState.js +1 -1
- package/esm/DatePicker/DatePicker.d.ts +6 -2
- package/esm/DatePicker/DatePicker.js +30 -38
- package/esm/DatePicker/hooks/useFocus.js +1 -1
- package/esm/DatePicker/utils.js +2 -2
- package/esm/DateRangeInput/DateRangeInput.js +16 -5
- package/esm/DateRangePicker/Calendar.d.ts +4 -5
- package/esm/DateRangePicker/Calendar.js +19 -47
- package/esm/DateRangePicker/DateRangePicker.d.ts +21 -4
- package/esm/DateRangePicker/DateRangePicker.js +99 -73
- package/esm/DateRangePicker/DateRangePickerProvider.d.ts +10 -0
- package/esm/DateRangePicker/{DateRangePickerContext.js → DateRangePickerProvider.js} +2 -2
- package/esm/DateRangePicker/hooks/index.d.ts +3 -0
- package/esm/DateRangePicker/hooks/index.js +4 -0
- package/esm/DateRangePicker/hooks/useCalendarHandlers.d.ts +17 -0
- package/esm/DateRangePicker/hooks/useCalendarHandlers.js +38 -0
- package/esm/DateRangePicker/hooks/useDateDisabled.d.ts +1 -1
- package/esm/DateRangePicker/hooks/useDateDisabled.js +1 -1
- package/esm/DateRangePicker/hooks/useDateRangePicker.d.ts +2 -0
- package/esm/DateRangePicker/hooks/useDateRangePicker.js +6 -0
- package/esm/DateRangePicker/utils.js +2 -2
- package/esm/Dropdown/Dropdown.d.ts +1 -1
- package/esm/Dropdown/DropdownItem.d.ts +1 -1
- package/esm/Dropdown/DropdownMenu.d.ts +1 -1
- package/esm/Dropdown/DropdownMenu.js +3 -3
- package/esm/Dropdown/DropdownToggle.d.ts +1 -1
- package/esm/FormHelpText/FormHelpText.js +2 -2
- package/esm/IconButton/IconButton.d.ts +1 -1
- package/esm/InlineEdit/renderChildren.d.ts +1 -1
- package/esm/InlineEdit/renderChildren.js +13 -4
- package/esm/InlineEdit/useFocusEvent.d.ts +2 -2
- package/esm/InlineEdit/useFocusEvent.js +9 -4
- package/esm/MultiCascadeTree/TreeView.js +3 -3
- package/esm/Nav/NavDropdownItem.d.ts +1 -1
- package/esm/Nav/NavDropdownMenu.d.ts +1 -1
- package/esm/Nav/NavDropdownMenu.js +3 -3
- package/esm/Nav/NavItem.d.ts +1 -1
- package/esm/Navbar/NavbarDropdown.d.ts +1 -1
- package/esm/Navbar/NavbarDropdownItem.d.ts +1 -1
- package/esm/Navbar/NavbarDropdownMenu.d.ts +1 -1
- package/esm/Navbar/NavbarDropdownMenu.js +3 -3
- package/esm/Navbar/NavbarItem.d.ts +1 -1
- package/esm/Pagination/Pagination.js +10 -10
- package/esm/Panel/AccordionButton.js +1 -1
- package/esm/Sidenav/ExpandedSidenavDropdown.d.ts +1 -1
- package/esm/Sidenav/ExpandedSidenavDropdownItem.d.ts +1 -1
- package/esm/Sidenav/ExpandedSidenavDropdownMenu.d.ts +1 -1
- package/esm/Sidenav/SidenavDropdown.d.ts +1 -1
- package/esm/Sidenav/SidenavDropdownItem.d.ts +1 -1
- package/esm/Sidenav/SidenavDropdownMenu.d.ts +1 -1
- package/esm/Sidenav/SidenavItem.d.ts +1 -1
- package/esm/Sidenav/SidenavToggle.js +3 -3
- package/esm/Steps/StepItem.d.ts +1 -1
- package/esm/TimePicker/TimePicker.d.ts +81 -0
- package/esm/TimePicker/TimePicker.js +24 -0
- package/esm/TimePicker/index.d.ts +3 -0
- package/esm/TimePicker/index.js +3 -0
- package/esm/TimeRangePicker/TimeRangePicker.d.ts +77 -0
- package/esm/TimeRangePicker/TimeRangePicker.js +18 -0
- package/esm/TimeRangePicker/index.d.ts +3 -0
- package/esm/TimeRangePicker/index.js +3 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +2 -0
- package/esm/internals/Picker/ListItemGroup.js +2 -2
- package/esm/internals/Picker/Listbox.js +4 -2
- package/esm/internals/Picker/PickerIndicator.js +1 -1
- package/esm/internals/Picker/PickerToggle.d.ts +1 -1
- package/esm/internals/SearchBox/SearchBox.js +2 -2
- package/esm/internals/constants/statusIcons.js +7 -7
- package/esm/internals/hooks/useCustom.js +1 -1
- package/esm/internals/hooks/useToggleCaret.d.ts +1 -1
- package/esm/internals/utils/date/extractTimeFormat.d.ts +4 -0
- package/esm/internals/utils/date/extractTimeFormat.js +8 -0
- package/esm/internals/utils/date/formatCheck.d.ts +4 -0
- package/esm/internals/utils/date/formatCheck.js +7 -0
- package/esm/internals/utils/date/index.d.ts +4 -2
- package/esm/internals/utils/date/index.js +4 -2
- package/esm/internals/utils/date/useDateMode.d.ts +16 -0
- package/esm/internals/utils/date/useDateMode.js +54 -0
- package/esm/internals/utils/index.d.ts +0 -1
- package/esm/internals/utils/index.js +0 -1
- package/esm/locales/ar_EG.d.ts +10 -0
- package/esm/locales/ar_EG.js +8 -4
- package/esm/locales/ca_ES.d.ts +10 -0
- package/esm/locales/ca_ES.js +8 -4
- package/esm/locales/cs_CZ.d.ts +10 -0
- package/esm/locales/cs_CZ.js +8 -4
- package/esm/locales/da_DK.d.ts +10 -0
- package/esm/locales/da_DK.js +8 -4
- package/esm/locales/de_DE.d.ts +10 -0
- package/esm/locales/de_DE.js +8 -4
- package/esm/locales/en_GB.d.ts +130 -2
- package/esm/locales/en_GB.js +85 -2
- package/esm/locales/en_US.d.ts +10 -0
- package/esm/locales/en_US.js +8 -4
- package/esm/locales/es_AR.d.ts +10 -0
- package/esm/locales/es_AR.js +8 -4
- package/esm/locales/es_ES.d.ts +10 -0
- package/esm/locales/es_ES.js +8 -4
- package/esm/locales/fa_IR.d.ts +10 -0
- package/esm/locales/fa_IR.js +8 -4
- package/esm/locales/fi_FI.d.ts +10 -0
- package/esm/locales/fi_FI.js +8 -4
- package/esm/locales/fr_FR.d.ts +10 -0
- package/esm/locales/fr_FR.js +8 -4
- package/esm/locales/hu_HU.d.ts +12 -0
- package/esm/locales/hu_HU.js +11 -5
- package/esm/locales/index.d.ts +1 -1
- package/esm/locales/it_IT.d.ts +10 -0
- package/esm/locales/it_IT.js +8 -4
- package/esm/locales/ja_JP.d.ts +10 -0
- package/esm/locales/ja_JP.js +8 -4
- package/esm/locales/kk_KZ.d.ts +10 -0
- package/esm/locales/kk_KZ.js +8 -4
- package/esm/locales/ko_KR.d.ts +10 -0
- package/esm/locales/ko_KR.js +8 -4
- package/esm/locales/ne_NP.d.ts +10 -0
- package/esm/locales/ne_NP.js +8 -4
- package/esm/locales/nl_NL.d.ts +10 -0
- package/esm/locales/nl_NL.js +8 -4
- package/esm/locales/pt_BR.d.ts +10 -0
- package/esm/locales/pt_BR.js +8 -4
- package/esm/locales/ru_RU.d.ts +10 -0
- package/esm/locales/ru_RU.js +8 -4
- package/esm/locales/sv_SE.d.ts +10 -0
- package/esm/locales/sv_SE.js +8 -4
- package/esm/locales/tr_TR.d.ts +10 -0
- package/esm/locales/tr_TR.js +8 -4
- package/esm/locales/zh_CN.d.ts +10 -0
- package/esm/locales/zh_CN.js +8 -4
- package/esm/locales/zh_TW.d.ts +10 -0
- package/esm/locales/zh_TW.js +8 -4
- package/internals/Picker/styles/index.less +17 -0
- package/internals/Picker/styles/mixin.less +0 -1
- package/internals/ScrollView/styles/index.less +1 -5
- package/package.json +2 -2
- package/styles/color-modes/dark.less +5 -0
- package/styles/color-modes/high-contrast.less +5 -0
- package/styles/color-modes/light.less +5 -0
- package/styles/common.less +3 -3
- package/styles/variables.less +3 -3
- package/cjs/Calendar/CalendarContext.js +0 -22
- package/cjs/Calendar/MonthDropdown.d.ts +0 -27
- package/cjs/Calendar/Table.d.ts +0 -6
- package/cjs/Calendar/TableHeaderRow.d.ts +0 -4
- package/cjs/Calendar/TableRow.d.ts +0 -7
- package/cjs/Calendar/useCalendarState.d.ts +0 -11
- package/cjs/Calendar/useCalendarState.js +0 -32
- package/cjs/DateRangePicker/DateRangePickerContext.d.ts +0 -10
- package/cjs/internals/utils/date/getReversedTimeMeridian.d.ts +0 -8
- package/cjs/internals/utils/date/getReversedTimeMeridian.js +0 -21
- package/cjs/internals/utils/scrollTopAnimation.d.ts +0 -5
- package/cjs/internals/utils/scrollTopAnimation.js +0 -32
- package/cjs/locales/default.d.ts +0 -120
- package/cjs/locales/default.js +0 -87
- package/esm/Calendar/CalendarContext.js +0 -17
- package/esm/Calendar/MonthDropdown.d.ts +0 -27
- package/esm/Calendar/Table.d.ts +0 -6
- package/esm/Calendar/TableHeaderRow.d.ts +0 -4
- package/esm/Calendar/TableRow.d.ts +0 -7
- package/esm/Calendar/TimeDropdown.js +0 -192
- package/esm/Calendar/useCalendarState.d.ts +0 -11
- package/esm/Calendar/useCalendarState.js +0 -28
- package/esm/DateRangePicker/DateRangePickerContext.d.ts +0 -10
- package/esm/internals/utils/date/getReversedTimeMeridian.d.ts +0 -8
- package/esm/internals/utils/date/getReversedTimeMeridian.js +0 -17
- package/esm/internals/utils/scrollTopAnimation.d.ts +0 -5
- package/esm/internals/utils/scrollTopAnimation.js +0 -27
- package/esm/locales/default.d.ts +0 -120
- package/esm/locales/default.js +0 -82
- package/locales/default/package.json +0 -7
- /package/cjs/Calendar/{utils.d.ts → utils/getAriaLabel.d.ts} +0 -0
- /package/esm/Calendar/{utils.d.ts → utils/getAriaLabel.d.ts} +0 -0
|
@@ -3,18 +3,18 @@ import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTempla
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
var _templateObject, _templateObject2;
|
|
6
|
-
var _excluded = ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "calendarSnapping", "defaultCalendarValue", "defaultValue", "plaintext", "disabled", "disabledDate", "shouldDisableDate", "format", "hoverRange", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "readOnly", "showOneCalendar", "showWeekNumbers", "showMeridian", "showHeader", "style", "size", "caretAs", "value", "monthDropdownProps", "hideHours", "hideMinutes", "hideSeconds", "onChange", "onClean", "onEnter", "onExit", "onOk", "onSelect", "onShortcutClick", "renderTitle", "renderValue"];
|
|
6
|
+
var _excluded = ["as", "classPrefix", "className", "appearance", "editable", "cleanable", "character", "calendarSnapping", "defaultCalendarValue", "defaultValue", "plaintext", "disabled", "disabledDate", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "format", "hoverRange", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "oneTap", "placeholder", "placement", "ranges", "readOnly", "showOneCalendar", "showWeekNumbers", "showMeridian", "showMeridiem", "showHeader", "style", "size", "caretAs", "value", "monthDropdownProps", "hideHours", "hideMinutes", "hideSeconds", "onChange", "onClean", "onEnter", "onExit", "onOk", "onSelect", "onShortcutClick", "renderTitle", "renderValue"];
|
|
7
7
|
import React, { useEffect, useRef, useState, useMemo } from 'react';
|
|
8
8
|
import isNil from 'lodash/isNil';
|
|
9
9
|
import omit from 'lodash/omit';
|
|
10
10
|
import pick from 'lodash/pick';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import CalendarIcon from '@rsuite/icons/Calendar';
|
|
13
|
+
import TimeIcon from '@rsuite/icons/Time';
|
|
14
14
|
import Toolbar from "../DatePicker/Toolbar.js";
|
|
15
15
|
import PredefinedRanges from "../DatePicker/PredefinedRanges.js";
|
|
16
16
|
import Stack from "../Stack/index.js";
|
|
17
|
-
import
|
|
17
|
+
import { DateRangePickerProvider } from "./DateRangePickerProvider.js";
|
|
18
18
|
import DateRangeInput from "../DateRangeInput/index.js";
|
|
19
19
|
import InputGroup from "../InputGroup/index.js";
|
|
20
20
|
import Header from "./Header.js";
|
|
@@ -27,7 +27,7 @@ import { DATERANGE_DISABLED_TARGET as TARGET } from "../internals/constants/inde
|
|
|
27
27
|
import { omitTriggerPropKeys, PickerPopup, pickerPropTypes, PickerToggleTrigger, PickerIndicator, PickerLabel, pickTriggerPropKeys, usePickerClassName, usePickerRef, onMenuKeyDown } from "../internals/Picker/index.js";
|
|
28
28
|
import { useClassNames, useControlled, useCustom, useUniqueId, useEventCallback } from "../internals/hooks/index.js";
|
|
29
29
|
import { createChainedFunction, mergeRefs, partitionHTMLProps, getStringLength } from "../internals/utils/index.js";
|
|
30
|
-
import { addMonths,
|
|
30
|
+
import { addMonths, addDays, copyTime, calendarOnlyProps, endOfDay, isValid, isBefore, isSameDay, isAfter, isSameMonth, reverseDateRangeOmitTime, startOfDay, DateMode, useDateMode } from "../internals/utils/date/index.js";
|
|
31
31
|
/**
|
|
32
32
|
* A date range picker allows you to select a date range from a calendar.
|
|
33
33
|
*
|
|
@@ -55,8 +55,10 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
55
55
|
disabled = props.disabled,
|
|
56
56
|
DEPRECATED_disabledDate = props.disabledDate,
|
|
57
57
|
shouldDisableDate = props.shouldDisableDate,
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
shouldDisableHour = props.shouldDisableHour,
|
|
59
|
+
shouldDisableMinute = props.shouldDisableMinute,
|
|
60
|
+
shouldDisableSecond = props.shouldDisableSecond,
|
|
61
|
+
format = props.format,
|
|
60
62
|
hoverRange = props.hoverRange,
|
|
61
63
|
idProp = props.id,
|
|
62
64
|
_props$isoWeek = props.isoWeek,
|
|
@@ -81,7 +83,9 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
81
83
|
_props$showOneCalenda = props.showOneCalendar,
|
|
82
84
|
showOneCalendar = _props$showOneCalenda === void 0 ? false : _props$showOneCalenda,
|
|
83
85
|
showWeekNumbers = props.showWeekNumbers,
|
|
84
|
-
|
|
86
|
+
DEPRECATED_showMeridian = props.showMeridian,
|
|
87
|
+
_props$showMeridiem = props.showMeridiem,
|
|
88
|
+
showMeridiem = _props$showMeridiem === void 0 ? DEPRECATED_showMeridian : _props$showMeridiem,
|
|
85
89
|
_props$showHeader = props.showHeader,
|
|
86
90
|
showHeader = _props$showHeader === void 0 ? true : _props$showHeader,
|
|
87
91
|
style = props.style,
|
|
@@ -114,16 +118,26 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
114
118
|
var _useCustom = useCustom('DateRangePicker', overrideLocale),
|
|
115
119
|
locale = _useCustom.locale,
|
|
116
120
|
formatDate = _useCustom.formatDate;
|
|
117
|
-
|
|
118
|
-
// Default gap between two calendars, if `showOneCalendar` is set, the gap is 0
|
|
119
|
-
var calendarGap = showOneCalendar ? 0 : 1;
|
|
121
|
+
var formatStr = format || locale.shortDateFormat || 'yyyy-MM-dd';
|
|
120
122
|
var rangeFormatStr = "" + formatStr + character + formatStr;
|
|
121
123
|
var _useControlled = useControlled(valueProp, defaultValue !== null && defaultValue !== void 0 ? defaultValue : null),
|
|
122
124
|
value = _useControlled[0],
|
|
123
125
|
setValue = _useControlled[1];
|
|
126
|
+
var _useDateMode = useDateMode(formatStr),
|
|
127
|
+
mode = _useDateMode.mode,
|
|
128
|
+
has = _useDateMode.has;
|
|
124
129
|
|
|
125
130
|
// Show only the calendar month panel. formatStr = 'yyyy-MM'
|
|
126
|
-
var onlyShowMonth =
|
|
131
|
+
var onlyShowMonth = mode === DateMode.Month;
|
|
132
|
+
|
|
133
|
+
// Only show the time panel. formatStr = 'HH:mm:ss'
|
|
134
|
+
var onlyShowTime = mode === DateMode.Time;
|
|
135
|
+
|
|
136
|
+
// Allows two calendar panels to display the same month.
|
|
137
|
+
var allowSameMonth = onlyShowMonth || showOneCalendar || onlyShowTime;
|
|
138
|
+
|
|
139
|
+
// Default gap between two calendars, if `showOneCalendar` is set, the gap is 0
|
|
140
|
+
var calendarGap = allowSameMonth ? 0 : 1;
|
|
127
141
|
|
|
128
142
|
/**
|
|
129
143
|
* Whether to complete the selection.
|
|
@@ -154,10 +168,11 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
154
168
|
|
|
155
169
|
// The displayed calendar panel is rendered based on this value.
|
|
156
170
|
var _useState4 = useState(getSafeCalendarDate({
|
|
157
|
-
value: (_ref2 = value !== null && value !== void 0 ? value : defaultCalendarValue) !== null && _ref2 !== void 0 ? _ref2 : null
|
|
171
|
+
value: (_ref2 = value !== null && value !== void 0 ? value : defaultCalendarValue) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
172
|
+
allowSameMonth: allowSameMonth
|
|
158
173
|
})),
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
calendarDateRange = _useState4[0],
|
|
175
|
+
setCalendarDateRangeValue = _useState4[1];
|
|
161
176
|
|
|
162
177
|
/**
|
|
163
178
|
* When hoverRange is set, `selectValue` will be updated during the hover process,
|
|
@@ -180,7 +195,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
180
195
|
*/
|
|
181
196
|
var getCalendarDatetime = function getCalendarDatetime(calendarKey) {
|
|
182
197
|
var index = calendarKey === 'start' ? 0 : 1;
|
|
183
|
-
return (
|
|
198
|
+
return (calendarDateRange === null || calendarDateRange === void 0 ? void 0 : calendarDateRange[index]) || (defaultCalendarValue === null || defaultCalendarValue === void 0 ? void 0 : defaultCalendarValue[index]);
|
|
184
199
|
};
|
|
185
200
|
|
|
186
201
|
/**
|
|
@@ -194,7 +209,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
194
209
|
var nextValue = dateRange;
|
|
195
210
|
|
|
196
211
|
// The time should remain the same when the dates in the date range are changed.
|
|
197
|
-
if (
|
|
212
|
+
if (has('time') && dateRange !== null && dateRange !== void 0 && dateRange.length && (eventName === 'changeDate' || eventName === 'changeMonth')) {
|
|
198
213
|
var startDate = copyTime({
|
|
199
214
|
from: getCalendarDatetime('start'),
|
|
200
215
|
to: dateRange[0]
|
|
@@ -211,11 +226,9 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
211
226
|
var nextCalendarDate = getSafeCalendarDate({
|
|
212
227
|
value: nextValue,
|
|
213
228
|
calendarKey: calendarKey,
|
|
214
|
-
|
|
215
|
-
// there is no need to add a month and two calendar panels are allowed to display the same month
|
|
216
|
-
allowSameMonth: onlyShowMonth || showOneCalendar
|
|
229
|
+
allowSameMonth: allowSameMonth
|
|
217
230
|
});
|
|
218
|
-
|
|
231
|
+
setCalendarDateRangeValue(nextCalendarDate);
|
|
219
232
|
if (onlyShowMonth && eventName === 'changeMonth') {
|
|
220
233
|
setSelectedDates(nextCalendarDate);
|
|
221
234
|
}
|
|
@@ -354,7 +367,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
354
367
|
if (isAfter(nextSelectDates[0], nextSelectDates[1])) {
|
|
355
368
|
nextSelectDates = reverseDateRangeOmitTime(nextSelectDates);
|
|
356
369
|
}
|
|
357
|
-
if (
|
|
370
|
+
if (has('time')) {
|
|
358
371
|
nextSelectDates = [copyTime({
|
|
359
372
|
from: getCalendarDatetime('start'),
|
|
360
373
|
to: nextSelectDates[0]
|
|
@@ -373,7 +386,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
373
386
|
setActiveCalendarKey('start');
|
|
374
387
|
}
|
|
375
388
|
setSelectedDates(nextSelectDates);
|
|
376
|
-
if (!isSameMonth(
|
|
389
|
+
if (!isSameMonth(calendarDateRange[index], date) || calendarSnapping) {
|
|
377
390
|
setCalendarDateRange({
|
|
378
391
|
dateRange: nextSelectDates,
|
|
379
392
|
calendarKey: calendarKey,
|
|
@@ -396,7 +409,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
396
409
|
}, [selectedDates]);
|
|
397
410
|
var onChangeCalendarMonth = useEventCallback(function (index, date) {
|
|
398
411
|
var calendarKey = index === 0 ? 'start' : 'end';
|
|
399
|
-
var nextCalendarDate = Array.from(
|
|
412
|
+
var nextCalendarDate = Array.from(calendarDateRange);
|
|
400
413
|
nextCalendarDate[index] = date;
|
|
401
414
|
setCalendarDateRange({
|
|
402
415
|
dateRange: nextCalendarDate,
|
|
@@ -406,7 +419,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
406
419
|
});
|
|
407
420
|
var onChangeCalendarTime = useEventCallback(function (index, date) {
|
|
408
421
|
var calendarKey = index === 0 ? 'start' : 'end';
|
|
409
|
-
var nextCalendarDate = Array.from(
|
|
422
|
+
var nextCalendarDate = Array.from(calendarDateRange);
|
|
410
423
|
nextCalendarDate[index] = date;
|
|
411
424
|
setCalendarDateRange({
|
|
412
425
|
dateRange: nextCalendarDate,
|
|
@@ -424,22 +437,6 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
424
437
|
return next;
|
|
425
438
|
});
|
|
426
439
|
});
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* The callback triggered when PM/AM is switched.
|
|
430
|
-
*/
|
|
431
|
-
var onToggleMeridian = useEventCallback(function (index) {
|
|
432
|
-
var nextCalendarDate = Array.from(calendarDate);
|
|
433
|
-
nextCalendarDate[index] = getReversedTimeMeridian(nextCalendarDate[index]);
|
|
434
|
-
setCalendarDate(nextCalendarDate);
|
|
435
|
-
|
|
436
|
-
// If the value already exists, update the value again.
|
|
437
|
-
if (selectedDates.length === 2) {
|
|
438
|
-
var nextSelectedDates = Array.from(selectedDates);
|
|
439
|
-
nextSelectedDates[index] = getReversedTimeMeridian(nextSelectedDates[index]);
|
|
440
|
-
setSelectedDates(nextSelectedDates);
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
440
|
var handleEnter = useEventCallback(function () {
|
|
444
441
|
var nextCalendarDate;
|
|
445
442
|
if (value && value.length) {
|
|
@@ -449,7 +446,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
449
446
|
} else {
|
|
450
447
|
// Reset the date on the calendar to the default date
|
|
451
448
|
nextCalendarDate = getSafeCalendarDate({
|
|
452
|
-
value: defaultCalendarValue !== null && defaultCalendarValue !== void 0 ? defaultCalendarValue : null
|
|
449
|
+
value: defaultCalendarValue !== null && defaultCalendarValue !== void 0 ? defaultCalendarValue : null,
|
|
450
|
+
allowSameMonth: allowSameMonth
|
|
453
451
|
});
|
|
454
452
|
}
|
|
455
453
|
setSelectedDates(value !== null && value !== void 0 ? value : []);
|
|
@@ -480,9 +478,20 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
480
478
|
// End unfinished selections.
|
|
481
479
|
setSelectedIdle(true);
|
|
482
480
|
});
|
|
481
|
+
var calculateDateRange = function calculateDateRange() {
|
|
482
|
+
var _selectedDates$ = selectedDates[0],
|
|
483
|
+
start = _selectedDates$ === void 0 ? calendarDateRange[0] : _selectedDates$,
|
|
484
|
+
_selectedDates$2 = selectedDates[1],
|
|
485
|
+
end = _selectedDates$2 === void 0 ? calendarDateRange[1] : _selectedDates$2;
|
|
486
|
+
if (onlyShowTime) {
|
|
487
|
+
return [start, end];
|
|
488
|
+
}
|
|
489
|
+
return selectedDates;
|
|
490
|
+
};
|
|
483
491
|
var handleClickOK = useEventCallback(function (event) {
|
|
484
|
-
|
|
485
|
-
|
|
492
|
+
var nextValue = calculateDateRange();
|
|
493
|
+
setDateRange(event, nextValue);
|
|
494
|
+
onOk === null || onOk === void 0 ? void 0 : onOk(nextValue, event);
|
|
486
495
|
});
|
|
487
496
|
var handleClean = useEventCallback(function (event) {
|
|
488
497
|
setCalendarDateRange({
|
|
@@ -540,34 +549,48 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
540
549
|
};
|
|
541
550
|
|
|
542
551
|
/**
|
|
543
|
-
*
|
|
552
|
+
* Determine if the OK button should be disabled
|
|
544
553
|
*/
|
|
545
|
-
var
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
554
|
+
var shouldDisableOkButton = function shouldDisableOkButton() {
|
|
555
|
+
var _calculateDateRange = calculateDateRange(),
|
|
556
|
+
startDate = _calculateDateRange[0],
|
|
557
|
+
endDate = _calculateDateRange[1];
|
|
558
|
+
|
|
559
|
+
// Check if start or end dates are missing
|
|
560
|
+
if (!startDate || !endDate) {
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// Additional condition if only showing time
|
|
565
|
+
if (!onlyShowTime && !isSelectedIdle) {
|
|
549
566
|
return true;
|
|
550
567
|
}
|
|
551
|
-
|
|
568
|
+
|
|
569
|
+
// Check if there is any error in the selected date range
|
|
570
|
+
if (isErrorValue([startDate, endDate])) {
|
|
552
571
|
return true;
|
|
553
572
|
}
|
|
554
573
|
return false;
|
|
555
574
|
};
|
|
556
575
|
|
|
557
576
|
/**
|
|
558
|
-
* Check if
|
|
577
|
+
* Check if a shortcut is disabled based on the selected date range
|
|
559
578
|
*/
|
|
560
|
-
var
|
|
561
|
-
if (
|
|
562
|
-
|
|
563
|
-
}
|
|
564
|
-
var
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
579
|
+
var shouldDisableShortcut = function shouldDisableShortcut(selectedDates) {
|
|
580
|
+
if (selectedDates === void 0) {
|
|
581
|
+
selectedDates = [];
|
|
582
|
+
}
|
|
583
|
+
var _selectedDates = selectedDates,
|
|
584
|
+
startDate = _selectedDates[0],
|
|
585
|
+
endDate = _selectedDates[1];
|
|
586
|
+
|
|
587
|
+
// Disable if either start or end date is missing
|
|
588
|
+
if (!startDate || !endDate) {
|
|
568
589
|
return true;
|
|
569
590
|
}
|
|
570
|
-
|
|
591
|
+
|
|
592
|
+
// Check if the date range is disabled for the shortcut
|
|
593
|
+
return isRangeDisabled(startDate, endDate, TARGET.TOOLBAR_SHORTCUT);
|
|
571
594
|
};
|
|
572
595
|
var handleClose = useEventCallback(function () {
|
|
573
596
|
var _trigger$current, _trigger$current$clos;
|
|
@@ -600,7 +623,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
600
623
|
className = positionProps.className;
|
|
601
624
|
var classes = merge(className, menuClassName, prefix('popup-daterange'));
|
|
602
625
|
var panelClasses = prefix('daterange-panel', {
|
|
603
|
-
'daterange-panel-show-one-calendar': showOneCalendar
|
|
626
|
+
'daterange-panel-show-one-calendar': showOneCalendar,
|
|
627
|
+
'daterange-panel-only-time': onlyShowTime
|
|
604
628
|
});
|
|
605
629
|
|
|
606
630
|
/**
|
|
@@ -608,7 +632,7 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
608
632
|
* @see https://github.com/rsuite/rsuite/issues/3522
|
|
609
633
|
*/
|
|
610
634
|
var panelStyles = {
|
|
611
|
-
minWidth: showOneCalendar ? 'auto' : 528
|
|
635
|
+
minWidth: showOneCalendar || onlyShowTime ? 'auto' : 528
|
|
612
636
|
};
|
|
613
637
|
var styles = _extends({}, menuStyle, {
|
|
614
638
|
left: left,
|
|
@@ -619,8 +643,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
619
643
|
isoWeek: isoWeek,
|
|
620
644
|
weekStart: weekStart,
|
|
621
645
|
limitEndYear: limitEndYear,
|
|
622
|
-
|
|
623
|
-
|
|
646
|
+
showMeridiem: showMeridiem,
|
|
647
|
+
calendarDateRange: calendarDateRange,
|
|
624
648
|
limitStartYear: limitStartYear,
|
|
625
649
|
showWeekNumbers: showWeekNumbers,
|
|
626
650
|
format: formatStr,
|
|
@@ -630,11 +654,13 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
630
654
|
hideHours: hideHours,
|
|
631
655
|
hideMinutes: hideMinutes,
|
|
632
656
|
hideSeconds: hideSeconds,
|
|
657
|
+
disabledHours: shouldDisableHour,
|
|
658
|
+
disabledMinutes: shouldDisableMinute,
|
|
659
|
+
disabledSeconds: shouldDisableSecond,
|
|
633
660
|
disabledDate: disableCalendarDate,
|
|
634
661
|
onSelect: handleSelectDate,
|
|
635
662
|
onChangeCalendarMonth: onChangeCalendarMonth,
|
|
636
663
|
onChangeCalendarTime: onChangeCalendarTime,
|
|
637
|
-
onToggleMeridian: onToggleMeridian,
|
|
638
664
|
onMouseMove: onMouseMove,
|
|
639
665
|
renderTitle: renderTitle
|
|
640
666
|
};
|
|
@@ -674,9 +700,9 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
674
700
|
spacing: 0,
|
|
675
701
|
className: prefix('daterange-predefined'),
|
|
676
702
|
ranges: sideRanges,
|
|
677
|
-
calendarDate:
|
|
703
|
+
calendarDate: calendarDateRange,
|
|
678
704
|
locale: locale,
|
|
679
|
-
disableShortcut:
|
|
705
|
+
disableShortcut: shouldDisableShortcut,
|
|
680
706
|
onShortcutClick: handleShortcutPageDate,
|
|
681
707
|
"data-testid": "daterange-predefined-side"
|
|
682
708
|
}), /*#__PURE__*/React.createElement(Stack.Item, null, /*#__PURE__*/React.createElement("div", {
|
|
@@ -690,15 +716,15 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
690
716
|
onSelect: setActiveCalendarKey
|
|
691
717
|
}), /*#__PURE__*/React.createElement("div", {
|
|
692
718
|
className: prefix("daterange-calendar-" + (showOneCalendar ? 'single' : 'group'))
|
|
693
|
-
}, /*#__PURE__*/React.createElement(
|
|
719
|
+
}, /*#__PURE__*/React.createElement(DateRangePickerProvider, {
|
|
694
720
|
value: {
|
|
695
721
|
isSelectedIdle: isSelectedIdle
|
|
696
722
|
}
|
|
697
723
|
}, getCalendars()))), /*#__PURE__*/React.createElement(Toolbar, {
|
|
698
724
|
locale: locale,
|
|
699
725
|
calendarDate: selectedDates,
|
|
700
|
-
disableOkBtn:
|
|
701
|
-
disableShortcut:
|
|
726
|
+
disableOkBtn: shouldDisableOkButton,
|
|
727
|
+
disableShortcut: shouldDisableShortcut,
|
|
702
728
|
hideOkBtn: oneTap,
|
|
703
729
|
onOk: handleClickOK,
|
|
704
730
|
onShortcutClick: handleShortcutPageDate,
|
|
@@ -719,8 +745,8 @@ var DateRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
719
745
|
if (caretAsProp === null) {
|
|
720
746
|
return null;
|
|
721
747
|
}
|
|
722
|
-
return caretAsProp || (
|
|
723
|
-
}, [caretAsProp,
|
|
748
|
+
return caretAsProp || (onlyShowTime ? TimeIcon : CalendarIcon);
|
|
749
|
+
}, [caretAsProp, onlyShowTime]);
|
|
724
750
|
var isErrorValue = function isErrorValue(value) {
|
|
725
751
|
if (!value) {
|
|
726
752
|
return false;
|
|
@@ -838,7 +864,7 @@ DateRangePicker.propTypes = _extends({}, pickerPropTypes, {
|
|
|
838
864
|
shouldDisableDate: PropTypes.func,
|
|
839
865
|
onSelect: PropTypes.func,
|
|
840
866
|
showWeekNumbers: PropTypes.bool,
|
|
841
|
-
|
|
867
|
+
showMeridiem: PropTypes.bool,
|
|
842
868
|
showOneCalendar: PropTypes.bool
|
|
843
869
|
});
|
|
844
870
|
export default DateRangePicker;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DateRangePickerContextValue {
|
|
3
|
+
/**
|
|
4
|
+
* Whether to complete the selection.
|
|
5
|
+
*/
|
|
6
|
+
isSelectedIdle?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const DateRangePickerContext: React.Context<DateRangePickerContextValue>;
|
|
9
|
+
export declare const useDateRangePickerContext: () => DateRangePickerContextValue;
|
|
10
|
+
export declare const DateRangePickerProvider: React.Provider<DateRangePickerContextValue>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
-
var DateRangePickerContext = /*#__PURE__*/React.createContext({});
|
|
3
|
+
export var DateRangePickerContext = /*#__PURE__*/React.createContext({});
|
|
4
4
|
export var useDateRangePickerContext = function useDateRangePickerContext() {
|
|
5
5
|
return useContext(DateRangePickerContext) || {};
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export var DateRangePickerProvider = DateRangePickerContext.Provider;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface CalendarHandlerProps {
|
|
3
|
+
index: number;
|
|
4
|
+
calendarDateRange: Date[];
|
|
5
|
+
onChangeCalendarMonth?: (index: number, nextPageDate: Date) => void;
|
|
6
|
+
onChangeCalendarTime?: (index: number, nextPageDate: Date) => void;
|
|
7
|
+
onSelect?: (index: number, date: Date, event: React.SyntheticEvent) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useCalendarHandlers({ index, calendarDateRange, onChangeCalendarMonth, onChangeCalendarTime, onSelect }: CalendarHandlerProps): {
|
|
10
|
+
calendarDate: Date;
|
|
11
|
+
onSelect: (...args: any[]) => any;
|
|
12
|
+
onChangeMonth: (...args: any[]) => any;
|
|
13
|
+
onChangeTime: (...args: any[]) => any;
|
|
14
|
+
onMoveForward: (...args: any[]) => any;
|
|
15
|
+
onMoveBackward: (...args: any[]) => any;
|
|
16
|
+
};
|
|
17
|
+
export default useCalendarHandlers;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { useEventCallback } from "../../internals/hooks/index.js";
|
|
4
|
+
import { addMonths } from "../../internals/utils/date/index.js";
|
|
5
|
+
export function useCalendarHandlers(_ref) {
|
|
6
|
+
var index = _ref.index,
|
|
7
|
+
calendarDateRange = _ref.calendarDateRange,
|
|
8
|
+
onChangeCalendarMonth = _ref.onChangeCalendarMonth,
|
|
9
|
+
onChangeCalendarTime = _ref.onChangeCalendarTime,
|
|
10
|
+
onSelect = _ref.onSelect;
|
|
11
|
+
var calendarDate = useMemo(function () {
|
|
12
|
+
return calendarDateRange[index];
|
|
13
|
+
}, [calendarDateRange, index]);
|
|
14
|
+
var handleSelect = useEventCallback(function (date, event) {
|
|
15
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(index, date, event);
|
|
16
|
+
});
|
|
17
|
+
var handleChangeMonth = useEventCallback(function (nextPageDate) {
|
|
18
|
+
onChangeCalendarMonth === null || onChangeCalendarMonth === void 0 ? void 0 : onChangeCalendarMonth(index, nextPageDate);
|
|
19
|
+
});
|
|
20
|
+
var handleChangeTime = useEventCallback(function (nextPageDate) {
|
|
21
|
+
onChangeCalendarTime === null || onChangeCalendarTime === void 0 ? void 0 : onChangeCalendarTime(index, nextPageDate);
|
|
22
|
+
});
|
|
23
|
+
var handleMoveForward = useEventCallback(function () {
|
|
24
|
+
onChangeCalendarMonth === null || onChangeCalendarMonth === void 0 ? void 0 : onChangeCalendarMonth(index, addMonths(calendarDate, 1));
|
|
25
|
+
});
|
|
26
|
+
var handleMoveBackward = useEventCallback(function () {
|
|
27
|
+
onChangeCalendarMonth === null || onChangeCalendarMonth === void 0 ? void 0 : onChangeCalendarMonth(index, addMonths(calendarDate, -1));
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
calendarDate: calendarDate,
|
|
31
|
+
onSelect: handleSelect,
|
|
32
|
+
onChangeMonth: handleChangeMonth,
|
|
33
|
+
onChangeTime: handleChangeTime,
|
|
34
|
+
onMoveForward: handleMoveForward,
|
|
35
|
+
onMoveBackward: handleMoveBackward
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export default useCalendarHandlers;
|
|
@@ -12,5 +12,5 @@ interface DateDisabledOptions {
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns a function that determines whether a date is disabled and is compatible with the deprecated `disabledDate` prop.
|
|
14
14
|
*/
|
|
15
|
-
declare function useDateDisabled(props: UseDateDisabledProps): ((date: Date, options: DateDisabledOptions) => boolean) | undefined;
|
|
15
|
+
export declare function useDateDisabled(props: UseDateDisabledProps): ((date: Date, options: DateDisabledOptions) => boolean) | undefined;
|
|
16
16
|
export default useDateDisabled;
|
|
@@ -3,7 +3,7 @@ import { useCallback } from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a function that determines whether a date is disabled and is compatible with the deprecated `disabledDate` prop.
|
|
5
5
|
*/
|
|
6
|
-
function useDateDisabled(props) {
|
|
6
|
+
export function useDateDisabled(props) {
|
|
7
7
|
var shouldDisableDate = props.shouldDisableDate,
|
|
8
8
|
DEPRECATED_disabledDate = props.DEPRECATED_disabledDate;
|
|
9
9
|
var isDateDisabled = useCallback(function (date, options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { addMonths, isSameDay, shouldRenderTime, isSameSecond, startOfMonth, endOfMonth, startOfISOWeek, endOfISOWeek, startOfWeek, endOfWeek, differenceInCalendarMonths, copyTime } from "../internals/utils/date/index.js";
|
|
2
|
+
import { addMonths, isSameDay, shouldRenderTime, isSameSecond, startOfMonth, endOfMonth, startOfISOWeek, endOfISOWeek, startOfWeek, startOfToday, endOfWeek, differenceInCalendarMonths, copyTime } from "../internals/utils/date/index.js";
|
|
3
3
|
export function getSafeCalendarDate(_ref) {
|
|
4
4
|
var _value;
|
|
5
5
|
var value = _ref.value,
|
|
@@ -27,7 +27,7 @@ export function getSafeCalendarDate(_ref) {
|
|
|
27
27
|
} else if (value[0]) {
|
|
28
28
|
return [value[0], addMonths(value[0], gap)];
|
|
29
29
|
}
|
|
30
|
-
var todayDate =
|
|
30
|
+
var todayDate = startOfToday();
|
|
31
31
|
return [todayDate, addMonths(todayDate, gap)];
|
|
32
32
|
}
|
|
33
33
|
export var isSameRange = function isSameRange(source, dest, format) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import DropdownMenu from './DropdownMenu';
|
|
3
3
|
import { TypeAttributes, WithAsProps, RsRefForwardingComponent } from '../internals/types';
|
|
4
|
-
import { IconProps } from '@rsuite/icons/
|
|
4
|
+
import { IconProps } from '@rsuite/icons/Icon';
|
|
5
5
|
import DropdownItem from './DropdownItem';
|
|
6
6
|
import Button from '../Button';
|
|
7
7
|
import DropdownSeparator from './DropdownSeparator';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IconProps } from '@rsuite/icons/
|
|
2
|
+
import { IconProps } from '@rsuite/icons/Icon';
|
|
3
3
|
import type { RsRefForwardingComponent, WithAsProps } from '../internals/types';
|
|
4
4
|
export interface DropdownMenuItemProps<T = any> extends WithAsProps, Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
|
|
5
5
|
/** Active the current option */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { StandardProps } from '../internals/types';
|
|
3
|
-
import { IconProps } from '@rsuite/icons/
|
|
3
|
+
import { IconProps } from '@rsuite/icons/Icon';
|
|
4
4
|
export interface DropdownMenuProps<T = string> extends StandardProps {
|
|
5
5
|
/** Define the title as a submenu */
|
|
6
6
|
title?: React.ReactNode;
|
|
@@ -18,8 +18,8 @@ import { oneOf } from "../internals/propTypes/index.js";
|
|
|
18
18
|
import { useClassNames, useCustom } from "../internals/hooks/index.js";
|
|
19
19
|
import { mergeRefs, warnOnce } from "../internals/utils/index.js";
|
|
20
20
|
import PropTypes from 'prop-types';
|
|
21
|
-
import
|
|
22
|
-
import
|
|
21
|
+
import PagePreviousIcon from '@rsuite/icons/PagePrevious';
|
|
22
|
+
import PageNextIcon from '@rsuite/icons/PageNext';
|
|
23
23
|
import DropdownContext from "./DropdownContext.js";
|
|
24
24
|
import Nav from "../Nav/index.js";
|
|
25
25
|
import NavContext from "../Nav/NavContext.js";
|
|
@@ -108,7 +108,7 @@ var DropdownMenu = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
108
108
|
icon = _omit.icon,
|
|
109
109
|
disabled = _omit.disabled,
|
|
110
110
|
menuProps = _objectWithoutPropertiesLoose(_omit, _excluded2);
|
|
111
|
-
var Icon = rtl ?
|
|
111
|
+
var Icon = rtl ? PagePreviousIcon : PageNextIcon;
|
|
112
112
|
return /*#__PURE__*/React.createElement(Menu, {
|
|
113
113
|
openMenuOn: ['mouseover', 'click'],
|
|
114
114
|
renderMenuButton: function renderMenuButton(_ref, buttonRef) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from '../Button';
|
|
3
|
-
import { IconProps } from '@rsuite/icons/
|
|
3
|
+
import { IconProps } from '@rsuite/icons/Icon';
|
|
4
4
|
import { WithAsProps, RsRefForwardingComponent, TypeAttributes } from '../internals/types';
|
|
5
5
|
export interface DropdownToggleProps extends WithAsProps {
|
|
6
6
|
icon?: React.ReactElement<IconProps>;
|
|
@@ -8,7 +8,7 @@ import Tooltip from "../Tooltip/index.js";
|
|
|
8
8
|
import Whisper from "../Whisper/index.js";
|
|
9
9
|
import { useClassNames } from "../internals/hooks/index.js";
|
|
10
10
|
import { useFormGroup } from "../FormGroup/index.js";
|
|
11
|
-
import
|
|
11
|
+
import HelpOutlineIcon from '@rsuite/icons/HelpOutline';
|
|
12
12
|
/**
|
|
13
13
|
* The `<Form.HelpText>` component is used to display help information in the form.
|
|
14
14
|
* @see https://rsuitejs.com/components/form/
|
|
@@ -43,7 +43,7 @@ var FormHelpText = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
43
43
|
role: "img",
|
|
44
44
|
"aria-label": "help",
|
|
45
45
|
className: classes
|
|
46
|
-
}, /*#__PURE__*/React.createElement(
|
|
46
|
+
}, /*#__PURE__*/React.createElement(HelpOutlineIcon, {
|
|
47
47
|
"aria-hidden": true
|
|
48
48
|
})));
|
|
49
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IconProps } from '@rsuite/icons/
|
|
2
|
+
import { IconProps } from '@rsuite/icons/Icon';
|
|
3
3
|
import { RsRefForwardingComponent } from '../internals/types';
|
|
4
4
|
import Button, { ButtonProps } from '../Button';
|
|
5
5
|
export interface IconButtonProps extends ButtonProps {
|
|
@@ -6,7 +6,7 @@ export interface ChildrenProps {
|
|
|
6
6
|
plaintext?: boolean;
|
|
7
7
|
value: any;
|
|
8
8
|
onChange: (value: any, event: React.SyntheticEvent) => void;
|
|
9
|
-
onBlur?: (event
|
|
9
|
+
onBlur?: (event?: React.FocusEvent) => void;
|
|
10
10
|
}
|
|
11
11
|
export declare function defaultRenderInput(props: ChildrenProps, ref: React.Ref<any>): React.JSX.Element;
|
|
12
12
|
export declare function renderChildren(children: ((props: ChildrenProps, ref: React.Ref<any>) => React.ReactElement) | React.ReactElement, props: ChildrenProps, ref: React.Ref<any>): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|