rsuite 5.71.0 → 5.72.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 +17 -0
- package/Calendar/styles/index.css +43 -13
- package/Calendar/styles/index.less +34 -2
- package/Cascader/styles/index.css +11 -0
- package/CheckPicker/styles/index.css +11 -0
- package/CheckTree/styles/index.css +11 -0
- package/CheckTreePicker/styles/index.css +11 -0
- package/DatePicker/styles/index.css +61 -15
- package/DatePicker/styles/index.less +8 -1
- package/DateRangePicker/styles/index.css +65 -17
- package/DateRangePicker/styles/index.less +7 -2
- package/InputPicker/styles/index.css +11 -0
- package/MultiCascadeTree/styles/index.css +11 -0
- package/MultiCascader/styles/index.css +11 -0
- package/Pagination/styles/index.css +11 -0
- package/Panel/styles/index.css +20 -6
- package/SelectPicker/styles/index.css +11 -0
- package/TagInput/styles/index.css +11 -0
- package/TagPicker/styles/index.css +11 -0
- package/TimePicker/package.json +7 -0
- package/TimePicker/styles/index.css +4161 -0
- package/TimePicker/styles/index.less +1 -0
- package/TimeRangePicker/package.json +7 -0
- package/TimeRangePicker/styles/index.css +4264 -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 +24 -42
- 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/cjs/Calendar/{TableCell.d.ts → 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.d.ts +0 -15
- package/cjs/Calendar/MonthDropdown.js +6 -6
- package/cjs/Calendar/MonthDropdownItem.js +6 -6
- 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 +1 -0
- package/cjs/Calendar/utils/index.js +7 -0
- package/cjs/CustomProvider/CustomProvider.d.ts +19 -3
- 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 +46 -55
- 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 +97 -71
- 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/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/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/Listbox.js +4 -2
- package/cjs/internals/hooks/useCustom.js +2 -2
- 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 +10 -0
- package/cjs/locales/hu_HU.js +8 -4
- 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 +88 -21
- 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 +88 -21
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +88 -21
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +88 -21
- package/dist/rsuite.js +361 -141
- 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 +41 -69
- package/esm/Calendar/CalendarHeader.d.ts +0 -2
- package/esm/Calendar/CalendarHeader.js +25 -43
- 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/esm/Calendar/{TableCell.d.ts → 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.d.ts +0 -15
- package/esm/Calendar/MonthDropdown.js +6 -6
- package/esm/Calendar/MonthDropdownItem.js +9 -9
- 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 +1 -0
- package/esm/Calendar/utils/index.js +2 -0
- package/esm/CustomProvider/CustomProvider.d.ts +19 -3
- 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 +28 -36
- 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 +98 -72
- 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/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/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/Listbox.js +4 -2
- package/esm/internals/hooks/useCustom.js +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 +10 -0
- package/esm/locales/hu_HU.js +8 -4
- 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/ScrollView/styles/index.less +1 -5
- package/package.json +1 -1
- 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 +2 -2
- package/cjs/Calendar/CalendarContext.js +0 -22
- 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/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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import getPosition from 'dom-lib/getPosition';
|
|
3
|
+
import scrollTop from 'dom-lib/scrollTop';
|
|
4
|
+
export function scrollToTime(time, row) {
|
|
5
|
+
if (!row) return;
|
|
6
|
+
var scrollToPosition = function scrollToPosition(container, value, type) {
|
|
7
|
+
var node = container.querySelector("[data-key=\"" + type + "-" + value + "\"]");
|
|
8
|
+
if (node) {
|
|
9
|
+
var position = getPosition(node, container);
|
|
10
|
+
if (position) {
|
|
11
|
+
scrollTop(container, position.top);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
Object.entries(time).forEach(function (_ref) {
|
|
16
|
+
var type = _ref[0],
|
|
17
|
+
value = _ref[1];
|
|
18
|
+
var container = row.querySelector("[data-type=\"" + type + "\"]");
|
|
19
|
+
if (container) {
|
|
20
|
+
scrollToPosition(container, value, type);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
declare const useCalendarDate: (value: Date | null | undefined, defaultDate: Date | undefined) => {
|
|
1
|
+
export declare const useCalendarDate: (value: Date | null | undefined, defaultDate: Date | undefined) => {
|
|
2
2
|
calendarDate: Date;
|
|
3
3
|
setCalendarDate: (date: React.SetStateAction<Date> | undefined) => void;
|
|
4
4
|
resetCalendarDate: (nextValue?: any) => void;
|
|
5
5
|
};
|
|
6
|
-
export default useCalendarDate;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { useState, useCallback, useRef } from 'react';
|
|
3
|
-
import { useUpdateEffect } from "
|
|
4
|
-
|
|
3
|
+
import { useUpdateEffect } from "../../internals/hooks/index.js";
|
|
4
|
+
import { startOfToday } from "../../internals/utils/date/index.js";
|
|
5
|
+
export var useCalendarDate = function useCalendarDate(value, defaultDate) {
|
|
5
6
|
var _ref;
|
|
6
7
|
var valueRef = useRef(value);
|
|
7
|
-
var _useState = useState((_ref = value !== null && value !== void 0 ? value : defaultDate) !== null && _ref !== void 0 ? _ref :
|
|
8
|
+
var _useState = useState((_ref = value !== null && value !== void 0 ? value : defaultDate) !== null && _ref !== void 0 ? _ref : startOfToday()),
|
|
8
9
|
calendarDate = _useState[0],
|
|
9
10
|
setValue = _useState[1];
|
|
10
11
|
var setCalendarDate = useCallback(function (date) {
|
|
@@ -17,13 +18,13 @@ var useCalendarDate = function useCalendarDate(value, defaultDate) {
|
|
|
17
18
|
if (nextValue === void 0) {
|
|
18
19
|
nextValue = value;
|
|
19
20
|
}
|
|
20
|
-
setValue((_ref2 = (_nextValue = nextValue) !== null && _nextValue !== void 0 ? _nextValue : defaultDate) !== null && _ref2 !== void 0 ? _ref2 :
|
|
21
|
+
setValue((_ref2 = (_nextValue = nextValue) !== null && _nextValue !== void 0 ? _nextValue : defaultDate) !== null && _ref2 !== void 0 ? _ref2 : startOfToday());
|
|
21
22
|
}, [defaultDate, value]);
|
|
22
23
|
useUpdateEffect(function () {
|
|
23
24
|
var _valueRef$current;
|
|
24
25
|
if ((value === null || value === void 0 ? void 0 : value.valueOf()) !== ((_valueRef$current = valueRef.current) === null || _valueRef$current === void 0 ? void 0 : _valueRef$current.valueOf())) {
|
|
25
26
|
var _ref3;
|
|
26
|
-
setCalendarDate((_ref3 = value !== null && value !== void 0 ? value : defaultDate) !== null && _ref3 !== void 0 ? _ref3 :
|
|
27
|
+
setCalendarDate((_ref3 = value !== null && value !== void 0 ? value : defaultDate) !== null && _ref3 !== void 0 ? _ref3 : startOfToday());
|
|
27
28
|
valueRef.current = value;
|
|
28
29
|
}
|
|
29
30
|
}, [value, defaultDate]);
|
|
@@ -32,5 +33,4 @@ var useCalendarDate = function useCalendarDate(value, defaultDate) {
|
|
|
32
33
|
setCalendarDate: setCalendarDate,
|
|
33
34
|
resetCalendarDate: resetCalendarDate
|
|
34
35
|
};
|
|
35
|
-
};
|
|
36
|
-
export default useCalendarDate;
|
|
36
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare enum CalendarState {
|
|
2
|
+
'TIME' = "TIME",
|
|
3
|
+
'MONTH' = "MONTH"
|
|
4
|
+
}
|
|
5
|
+
export interface CalendarStateProps {
|
|
6
|
+
defaultState?: CalendarState;
|
|
7
|
+
calendarDate: Date;
|
|
8
|
+
onMoveForward?: (date: Date) => void;
|
|
9
|
+
onMoveBackward?: (date: Date) => void;
|
|
10
|
+
onToggleTimeDropdown?: (toggle: boolean) => void;
|
|
11
|
+
onToggleMonthDropdown?: (toggle: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const useCalendarState: (props: CalendarStateProps) => {
|
|
14
|
+
calendarState: CalendarState | undefined;
|
|
15
|
+
handlers: {
|
|
16
|
+
onMoveForward: (...args: any[]) => any;
|
|
17
|
+
onMoveBackward: (...args: any[]) => any;
|
|
18
|
+
onToggleTimeDropdown: (...args: any[]) => any;
|
|
19
|
+
onToggleMonthDropdown: (...args: any[]) => any;
|
|
20
|
+
};
|
|
21
|
+
reset: () => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { addMonths } from "../../internals/utils/date/index.js";
|
|
4
|
+
import { useEventCallback } from "../../internals/hooks/index.js";
|
|
5
|
+
export var CalendarState = /*#__PURE__*/function (CalendarState) {
|
|
6
|
+
CalendarState["TIME"] = "TIME";
|
|
7
|
+
CalendarState["MONTH"] = "MONTH";
|
|
8
|
+
return CalendarState;
|
|
9
|
+
}({});
|
|
10
|
+
export var useCalendarState = function useCalendarState(props) {
|
|
11
|
+
var _useState = useState(props.defaultState),
|
|
12
|
+
calendarState = _useState[0],
|
|
13
|
+
setCalendarState = _useState[1];
|
|
14
|
+
var reset = useCallback(function () {
|
|
15
|
+
setCalendarState(undefined);
|
|
16
|
+
}, []);
|
|
17
|
+
var onMoveForward = useEventCallback(function () {
|
|
18
|
+
var _props$onMoveForward;
|
|
19
|
+
(_props$onMoveForward = props.onMoveForward) === null || _props$onMoveForward === void 0 ? void 0 : _props$onMoveForward.call(props, addMonths(props.calendarDate, 1));
|
|
20
|
+
});
|
|
21
|
+
var onMoveBackward = useEventCallback(function () {
|
|
22
|
+
var _props$onMoveBackward;
|
|
23
|
+
(_props$onMoveBackward = props.onMoveBackward) === null || _props$onMoveBackward === void 0 ? void 0 : _props$onMoveBackward.call(props, addMonths(props.calendarDate, -1));
|
|
24
|
+
});
|
|
25
|
+
var onToggleTimeDropdown = useEventCallback(function () {
|
|
26
|
+
var _props$onToggleTimeDr;
|
|
27
|
+
if (calendarState === CalendarState.TIME) {
|
|
28
|
+
reset();
|
|
29
|
+
} else {
|
|
30
|
+
setCalendarState(CalendarState.TIME);
|
|
31
|
+
}
|
|
32
|
+
(_props$onToggleTimeDr = props.onToggleTimeDropdown) === null || _props$onToggleTimeDr === void 0 ? void 0 : _props$onToggleTimeDr.call(props, calendarState !== CalendarState.TIME);
|
|
33
|
+
});
|
|
34
|
+
var onToggleMonthDropdown = useEventCallback(function () {
|
|
35
|
+
var _props$onToggleMonthD;
|
|
36
|
+
if (calendarState === CalendarState.MONTH) {
|
|
37
|
+
reset();
|
|
38
|
+
} else {
|
|
39
|
+
setCalendarState(CalendarState.MONTH);
|
|
40
|
+
}
|
|
41
|
+
(_props$onToggleMonthD = props.onToggleMonthDropdown) === null || _props$onToggleMonthD === void 0 ? void 0 : _props$onToggleMonthD.call(props, calendarState !== CalendarState.MONTH);
|
|
42
|
+
});
|
|
43
|
+
var handlers = useMemo(function () {
|
|
44
|
+
return {
|
|
45
|
+
onMoveForward: onMoveForward,
|
|
46
|
+
onMoveBackward: onMoveBackward,
|
|
47
|
+
onToggleTimeDropdown: onToggleTimeDropdown,
|
|
48
|
+
onToggleMonthDropdown: onToggleMonthDropdown
|
|
49
|
+
};
|
|
50
|
+
}, [onMoveBackward, onMoveForward, onToggleMonthDropdown, onToggleTimeDropdown]);
|
|
51
|
+
return {
|
|
52
|
+
calendarState: calendarState,
|
|
53
|
+
handlers: handlers,
|
|
54
|
+
reset: reset
|
|
55
|
+
};
|
|
56
|
+
};
|
package/esm/Calendar/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import Calendar from './Calendar';
|
|
2
2
|
import CalendarContainer from './CalendarContainer';
|
|
3
|
-
import { CalendarState } from './
|
|
4
|
-
|
|
5
|
-
export { CalendarContainer, CalendarContext, CalendarState };
|
|
6
|
-
export type { CalendarContextValue };
|
|
3
|
+
import { CalendarState } from './hooks';
|
|
4
|
+
export { CalendarContainer, CalendarState };
|
|
7
5
|
export type { CalendarProps } from './Calendar';
|
|
8
6
|
export default Calendar;
|
package/esm/Calendar/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import Calendar from "./Calendar.js";
|
|
3
3
|
import CalendarContainer from "./CalendarContainer.js";
|
|
4
|
-
import { CalendarState } from "./
|
|
5
|
-
|
|
6
|
-
export { CalendarContainer, CalendarContext, CalendarState };
|
|
4
|
+
import { CalendarState } from "./hooks/index.js";
|
|
5
|
+
export { CalendarContainer, CalendarState };
|
|
7
6
|
export default Calendar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { FixedSizeListProps } from '../internals/Windowing';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the MonthDropdown component.
|
|
5
|
+
*/
|
|
6
|
+
export interface MonthDropdownProps extends Partial<FixedSizeListProps> {
|
|
7
|
+
/**
|
|
8
|
+
* The HTML element or React component to render as the root element of the MonthDropdown.
|
|
9
|
+
*/
|
|
10
|
+
as?: React.ElementType;
|
|
11
|
+
/**
|
|
12
|
+
* The HTML element or React component to render as each item in the MonthDropdown.
|
|
13
|
+
*/
|
|
14
|
+
itemAs?: React.ElementType;
|
|
15
|
+
/**
|
|
16
|
+
* The CSS class name to apply to each item in the MonthDropdown.
|
|
17
|
+
*/
|
|
18
|
+
itemClassName?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getAriaLabel } from './getAriaLabel';
|
|
@@ -112,6 +112,7 @@ export interface CustomProviderProps<T = Locale> extends Partial<CustomValue<T>>
|
|
|
112
112
|
toastContainer?: HTMLElement | (() => HTMLElement | null) | null;
|
|
113
113
|
}
|
|
114
114
|
declare const CustomContext: React.Context<CustomProviderProps<{
|
|
115
|
+
code?: string | undefined;
|
|
115
116
|
common?: {
|
|
116
117
|
loading: string;
|
|
117
118
|
emptyMessage: string;
|
|
@@ -144,11 +145,16 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
144
145
|
ok: string;
|
|
145
146
|
today: string;
|
|
146
147
|
yesterday: string;
|
|
148
|
+
now: string;
|
|
147
149
|
hours: string;
|
|
148
150
|
minutes: string;
|
|
149
151
|
seconds: string;
|
|
150
|
-
formattedMonthPattern: string;
|
|
152
|
+
formattedMonthPattern: string; /**
|
|
153
|
+
* The locale object that contains the language and formatting rules for the date.
|
|
154
|
+
*/
|
|
151
155
|
formattedDayPattern: string;
|
|
156
|
+
shortDateFormat: string;
|
|
157
|
+
shortTimeFormat: string;
|
|
152
158
|
dateLocale: any;
|
|
153
159
|
} | undefined;
|
|
154
160
|
DatePicker?: {
|
|
@@ -162,11 +168,16 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
162
168
|
ok: string;
|
|
163
169
|
today: string;
|
|
164
170
|
yesterday: string;
|
|
171
|
+
now: string;
|
|
165
172
|
hours: string;
|
|
166
173
|
minutes: string;
|
|
167
174
|
seconds: string;
|
|
168
|
-
formattedMonthPattern: string;
|
|
175
|
+
formattedMonthPattern: string; /**
|
|
176
|
+
* The locale object that contains the language and formatting rules for the date.
|
|
177
|
+
*/
|
|
169
178
|
formattedDayPattern: string;
|
|
179
|
+
shortDateFormat: string;
|
|
180
|
+
shortTimeFormat: string;
|
|
170
181
|
dateLocale: any;
|
|
171
182
|
} | undefined;
|
|
172
183
|
DateRangePicker?: {
|
|
@@ -181,11 +192,16 @@ declare const CustomContext: React.Context<CustomProviderProps<{
|
|
|
181
192
|
ok: string;
|
|
182
193
|
today: string;
|
|
183
194
|
yesterday: string;
|
|
195
|
+
now: string;
|
|
184
196
|
hours: string;
|
|
185
197
|
minutes: string;
|
|
186
198
|
seconds: string;
|
|
187
|
-
formattedMonthPattern: string;
|
|
199
|
+
formattedMonthPattern: string; /**
|
|
200
|
+
* The locale object that contains the language and formatting rules for the date.
|
|
201
|
+
*/
|
|
188
202
|
formattedDayPattern: string;
|
|
203
|
+
shortDateFormat: string;
|
|
204
|
+
shortTimeFormat: string;
|
|
189
205
|
dateLocale: any;
|
|
190
206
|
} | undefined;
|
|
191
207
|
Picker?: {
|
|
@@ -13,7 +13,7 @@ export var patternMap = {
|
|
|
13
13
|
h: 'hour',
|
|
14
14
|
m: 'minute',
|
|
15
15
|
s: 'second',
|
|
16
|
-
a: '
|
|
16
|
+
a: 'meridiem'
|
|
17
17
|
};
|
|
18
18
|
export var DateField = /*#__PURE__*/function (_Object) {
|
|
19
19
|
function DateField(format, value) {
|
|
@@ -183,7 +183,7 @@ export var useDateField = function useDateField(format, localize, date) {
|
|
|
183
183
|
// Invalid Date. If the type is day and the value is 0, it is considered an invalid date.
|
|
184
184
|
return new Date('');
|
|
185
185
|
}
|
|
186
|
-
if (type === '
|
|
186
|
+
if (type === 'meridiem' && typeof hour === 'number') {
|
|
187
187
|
var newHour = hour > 12 ? hour - 12 : hour + 12;
|
|
188
188
|
type = 'hour';
|
|
189
189
|
value = newHour;
|
|
@@ -20,8 +20,11 @@ import useSelectedState from "./hooks/useSelectedState.js";
|
|
|
20
20
|
* @see https://rsuitejs.com/components/date-input/
|
|
21
21
|
*/
|
|
22
22
|
var DateInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
23
|
+
var _useCustom = useCustom('Calendar'),
|
|
24
|
+
locale = _useCustom.locale,
|
|
25
|
+
parseDate = _useCustom.parseDate;
|
|
23
26
|
var _props$format = props.format,
|
|
24
|
-
formatStr = _props$format === void 0 ?
|
|
27
|
+
formatStr = _props$format === void 0 ? locale.shortDateFormat : _props$format,
|
|
25
28
|
valueProp = props.value,
|
|
26
29
|
defaultValue = props.defaultValue,
|
|
27
30
|
placeholder = props.placeholder,
|
|
@@ -35,9 +38,6 @@ var DateInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
35
38
|
var _useSelectedState = useSelectedState(),
|
|
36
39
|
selectedState = _useSelectedState.selectedState,
|
|
37
40
|
setSelectedState = _useSelectedState.setSelectedState;
|
|
38
|
-
var _useCustom = useCustom('Calendar'),
|
|
39
|
-
locale = _useCustom.locale,
|
|
40
|
-
parseDate = _useCustom.parseDate;
|
|
41
41
|
var dateLocale = locale.dateLocale;
|
|
42
42
|
var _useControlled = useControlled(valueProp, defaultValue),
|
|
43
43
|
value = _useControlled[0],
|
|
@@ -70,11 +70,17 @@ var DateInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
70
70
|
dateString: dateString
|
|
71
71
|
};
|
|
72
72
|
}, [dateField, dateString, formatStr, dateLocale]);
|
|
73
|
+
var setSelectionRange = useInputSelection(inputRef);
|
|
73
74
|
var handleChange = useEventCallback(function (value, event) {
|
|
74
75
|
onChange === null || onChange === void 0 ? void 0 : onChange(value, event);
|
|
75
76
|
setValue(value);
|
|
76
77
|
});
|
|
77
|
-
var
|
|
78
|
+
var handleClear = useEventCallback(function (event) {
|
|
79
|
+
handleChange(null, event);
|
|
80
|
+
setNewDate(null);
|
|
81
|
+
setSelectionRange(0, 0);
|
|
82
|
+
reset();
|
|
83
|
+
});
|
|
78
84
|
var onSegmentChange = useEventCallback(function (event, nextDirection) {
|
|
79
85
|
var input = event.target;
|
|
80
86
|
var key = event.key;
|
|
@@ -142,7 +148,12 @@ var DateInput = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
142
148
|
});
|
|
143
149
|
var onSegmentValueRemove = useEventCallback(function (event) {
|
|
144
150
|
var input = event.target;
|
|
145
|
-
|
|
151
|
+
var value = input.value;
|
|
152
|
+
|
|
153
|
+
// If the text is all selected, clear the value
|
|
154
|
+
if (input.selectionStart === 0 && value && input.selectionEnd === value.length) {
|
|
155
|
+
handleClear(event);
|
|
156
|
+
} else if (selectedState.selectedPattern) {
|
|
146
157
|
var nextState = getInputSelectedState(_extends({}, keyPressOptions, {
|
|
147
158
|
input: input,
|
|
148
159
|
valueOffset: null
|
|
@@ -3,7 +3,7 @@ import { RangeType } from './Toolbar';
|
|
|
3
3
|
import type { FormControlBaseProps, PickerBaseProps, RsRefForwardingComponent } from '../internals/types';
|
|
4
4
|
import type { DatePickerLocale } from '../locales';
|
|
5
5
|
import type { DeprecatedProps } from './types';
|
|
6
|
-
import type { MonthDropdownProps } from '../Calendar/
|
|
6
|
+
import type { MonthDropdownProps } from '../Calendar/types';
|
|
7
7
|
export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, FormControlBaseProps<Date | null>, DeprecatedProps {
|
|
8
8
|
/**
|
|
9
9
|
* Custom caret component
|
|
@@ -75,9 +75,13 @@ export interface DatePickerProps extends PickerBaseProps<DatePickerLocale>, Form
|
|
|
75
75
|
*/
|
|
76
76
|
showWeekNumbers?: boolean;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* @deprecated Use `showMeridiem` instead
|
|
79
79
|
*/
|
|
80
80
|
showMeridian?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Meridiem format for 12-hour time
|
|
83
|
+
*/
|
|
84
|
+
showMeridiem?: boolean;
|
|
81
85
|
/**
|
|
82
86
|
* The props for the Month Dropdown component.
|
|
83
87
|
*/
|
|
@@ -3,15 +3,15 @@ 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", "className", "classPrefix", "calendarDefaultDate", "cleanable", "caretAs", "editable", "defaultValue", "disabled", "readOnly", "plaintext", "format", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "appearance", "placement", "oneTap", "placeholder", "ranges", "value", "showMeridian", "showWeekNumbers", "style", "size", "monthDropdownProps", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "onChange", "onChangeCalendarDate", "onClean", "onEnter", "onExit", "onNextMonth", "onOk", "onPrevMonth", "onSelect", "onToggleMonthDropdown", "onToggleTimeDropdown", "onShortcutClick", "renderCell", "renderValue", "disabledDate", "disabledHours", "disabledMinutes", "disabledSeconds"];
|
|
6
|
+
var _excluded = ["as", "className", "classPrefix", "calendarDefaultDate", "cleanable", "caretAs", "editable", "defaultValue", "disabled", "readOnly", "plaintext", "format", "id", "isoWeek", "weekStart", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "appearance", "placement", "oneTap", "placeholder", "ranges", "value", "showMeridian", "showMeridiem", "showWeekNumbers", "style", "size", "monthDropdownProps", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "onChange", "onChangeCalendarDate", "onClean", "onEnter", "onExit", "onNextMonth", "onOk", "onPrevMonth", "onSelect", "onToggleMonthDropdown", "onToggleTimeDropdown", "onShortcutClick", "renderCell", "renderValue", "disabledDate", "disabledHours", "disabledMinutes", "disabledSeconds"];
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
9
|
import mapValues from 'lodash/mapValues';
|
|
10
10
|
import pick from 'lodash/pick';
|
|
11
11
|
import IconCalendar from '@rsuite/icons/legacy/Calendar';
|
|
12
|
-
import
|
|
12
|
+
import TimeIcon from '@rsuite/icons/Time';
|
|
13
13
|
import CalendarContainer from "../Calendar/CalendarContainer.js";
|
|
14
|
-
import useCalendarDate from "../Calendar/
|
|
14
|
+
import { useCalendarDate } from "../Calendar/hooks/index.js";
|
|
15
15
|
import Toolbar from "./Toolbar.js";
|
|
16
16
|
import Stack from "../Stack/index.js";
|
|
17
17
|
import PredefinedRanges from "./PredefinedRanges.js";
|
|
@@ -23,10 +23,11 @@ import useCustomizedInput from "./hooks/useCustomizedInput.js";
|
|
|
23
23
|
import { isEveryDateInMonth } from "../Calendar/MonthDropdown.js";
|
|
24
24
|
import { mergeRefs, partitionHTMLProps, createChainedFunction } from "../internals/utils/index.js";
|
|
25
25
|
import { useClassNames, useControlled, useCustom, useUniqueId, useEventCallback } from "../internals/hooks/index.js";
|
|
26
|
-
import {
|
|
26
|
+
import { isValid, copyTime, disableTime, DateMode, useDateMode, calendarOnlyProps } from "../internals/utils/date/index.js";
|
|
27
27
|
import { PickerPopup, PickerLabel, PickerIndicator, PickerToggleTrigger, pickerPropTypes, pickTriggerPropKeys, usePickerClassName, usePickerRef, onMenuKeyDown } from "../internals/Picker/index.js";
|
|
28
28
|
import { OverlayCloseCause } from "../internals/Overlay/OverlayTrigger.js";
|
|
29
29
|
import { splitRanges, deprecatedPropTypes, getRestProps } from "./utils.js";
|
|
30
|
+
import { startOfToday } from "../internals/utils/date/index.js";
|
|
30
31
|
/**
|
|
31
32
|
* A date picker allows users to select a date from a calendar.
|
|
32
33
|
*
|
|
@@ -49,8 +50,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
49
50
|
disabled = props.disabled,
|
|
50
51
|
readOnly = props.readOnly,
|
|
51
52
|
plaintext = props.plaintext,
|
|
52
|
-
|
|
53
|
-
formatStr = _props$format === void 0 ? 'yyyy-MM-dd' : _props$format,
|
|
53
|
+
format = props.format,
|
|
54
54
|
idProp = props.id,
|
|
55
55
|
isoWeek = props.isoWeek,
|
|
56
56
|
_props$weekStart = props.weekStart,
|
|
@@ -72,7 +72,9 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
72
72
|
placeholder = _props$placeholder === void 0 ? '' : _props$placeholder,
|
|
73
73
|
ranges = props.ranges,
|
|
74
74
|
valueProp = props.value,
|
|
75
|
-
|
|
75
|
+
DEPRECATED_showMeridian = props.showMeridian,
|
|
76
|
+
_props$showMeridiem = props.showMeridiem,
|
|
77
|
+
showMeridiem = _props$showMeridiem === void 0 ? DEPRECATED_showMeridian : _props$showMeridiem,
|
|
76
78
|
showWeekNumbers = props.showWeekNumbers,
|
|
77
79
|
style = props.style,
|
|
78
80
|
size = props.size,
|
|
@@ -108,6 +110,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
108
110
|
overlay = _usePickerRef.overlay;
|
|
109
111
|
var _useCustom = useCustom('DatePicker', overrideLocale),
|
|
110
112
|
locale = _useCustom.locale;
|
|
113
|
+
var formatStr = format || locale.shortDateFormat || 'yyyy-MM-dd';
|
|
111
114
|
var _useClassNames = useClassNames(classPrefix),
|
|
112
115
|
merge = _useClassNames.merge,
|
|
113
116
|
prefix = _useClassNames.prefix;
|
|
@@ -124,10 +127,11 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
124
127
|
setMonthView = _useMonthView.setMonthView,
|
|
125
128
|
monthView = _useMonthView.monthView,
|
|
126
129
|
toggleMonthView = _useMonthView.toggleMonthView;
|
|
130
|
+
var _useDateMode = useDateMode(formatStr),
|
|
131
|
+
mode = _useDateMode.mode;
|
|
127
132
|
|
|
128
133
|
// Show only the calendar month panel. formatStr = 'yyyy-MM'
|
|
129
|
-
var
|
|
130
|
-
var showMonth = onlyShowMonth || monthView;
|
|
134
|
+
var showMonth = mode === DateMode.Month || monthView;
|
|
131
135
|
var _useFocus = useFocus({
|
|
132
136
|
target: target,
|
|
133
137
|
showMonth: showMonth,
|
|
@@ -173,7 +177,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
173
177
|
* - If format is month, disable ok button if all dates in the month of selected date are disabled
|
|
174
178
|
*/
|
|
175
179
|
var isOkButtonDisabled = function isOkButtonDisabled(selectedDate) {
|
|
176
|
-
if (
|
|
180
|
+
if (mode === DateMode.Month) {
|
|
177
181
|
return isMonthDisabled(selectedDate);
|
|
178
182
|
}
|
|
179
183
|
return isDatetimeDisabled(selectedDate);
|
|
@@ -228,22 +232,12 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
228
232
|
var _trigger$current, _trigger$current$clos;
|
|
229
233
|
(_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : (_trigger$current$clos = _trigger$current.close) === null || _trigger$current$clos === void 0 ? void 0 : _trigger$current$clos.call(_trigger$current);
|
|
230
234
|
});
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* The callback triggered when PM/AM is switched.
|
|
234
|
-
*/
|
|
235
|
-
var handleToggleMeridian = useEventCallback(function () {
|
|
236
|
-
var hours = getHours(calendarDate);
|
|
237
|
-
var nextHours = hours >= 12 ? hours - 12 : hours + 12;
|
|
238
|
-
var nextDate = setHours(calendarDate, nextHours);
|
|
239
|
-
handleChangeTime(nextDate);
|
|
240
|
-
});
|
|
241
235
|
var updateValue = function updateValue(event, date, closeOverlay) {
|
|
242
236
|
if (closeOverlay === void 0) {
|
|
243
237
|
closeOverlay = true;
|
|
244
238
|
}
|
|
245
239
|
var nextValue = typeof date !== 'undefined' ? date : calendarDate;
|
|
246
|
-
setCalendarDate(nextValue ||
|
|
240
|
+
setCalendarDate(nextValue || startOfToday());
|
|
247
241
|
setValue(nextValue);
|
|
248
242
|
if (nextValue !== value) {
|
|
249
243
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextValue, event);
|
|
@@ -303,16 +297,15 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
303
297
|
/**
|
|
304
298
|
* Callback after the date is selected.
|
|
305
299
|
*/
|
|
306
|
-
var
|
|
300
|
+
var handleCalendarSelect = useEventCallback(function (date, event, updatableValue) {
|
|
307
301
|
if (updatableValue === void 0) {
|
|
308
302
|
updatableValue = true;
|
|
309
303
|
}
|
|
310
|
-
|
|
311
|
-
// Determine whether the current value contains time, if not, use calendarDate.
|
|
312
|
-
shouldRenderTime(formatStr) ? nextValue : copyTime({
|
|
304
|
+
var nextValue = copyTime({
|
|
313
305
|
from: calendarDate,
|
|
314
|
-
to:
|
|
315
|
-
})
|
|
306
|
+
to: date
|
|
307
|
+
});
|
|
308
|
+
setCalendarDate(nextValue);
|
|
316
309
|
handleDateChange(nextValue);
|
|
317
310
|
if (oneTap && updatableValue) {
|
|
318
311
|
updateValue(event, nextValue);
|
|
@@ -327,7 +320,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
327
320
|
setCalendarDate(nextPageDate);
|
|
328
321
|
handleDateChange(nextPageDate);
|
|
329
322
|
focusSelectedDate();
|
|
330
|
-
if (oneTap &&
|
|
323
|
+
if (oneTap && mode === DateMode.Month) {
|
|
331
324
|
updateValue(event, nextPageDate);
|
|
332
325
|
focusInput();
|
|
333
326
|
}
|
|
@@ -338,7 +331,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
338
331
|
*/
|
|
339
332
|
var handleInputChange = useEventCallback(function (value, event) {
|
|
340
333
|
if (!isErrorValue(value)) {
|
|
341
|
-
|
|
334
|
+
handleCalendarSelect(value, event);
|
|
342
335
|
}
|
|
343
336
|
updateValue(event, value, false);
|
|
344
337
|
});
|
|
@@ -403,7 +396,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
403
396
|
targetId: id,
|
|
404
397
|
locale: locale,
|
|
405
398
|
showWeekNumbers: showWeekNumbers,
|
|
406
|
-
|
|
399
|
+
showMeridiem: showMeridiem,
|
|
407
400
|
disabledDate: isDateDisabled,
|
|
408
401
|
disabledHours: shouldDisableHour !== null && shouldDisableHour !== void 0 ? shouldDisableHour : DEPRECATED_disabledHours,
|
|
409
402
|
disabledMinutes: shouldDisableMinute !== null && shouldDisableMinute !== void 0 ? shouldDisableMinute : DEPRECATED_disabledMinutes,
|
|
@@ -418,12 +411,11 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
418
411
|
renderCellOnPicker: renderCell,
|
|
419
412
|
onMoveForward: handleMoveForward,
|
|
420
413
|
onMoveBackward: handleMoveBackward,
|
|
421
|
-
onSelect:
|
|
414
|
+
onSelect: handleCalendarSelect,
|
|
422
415
|
onToggleMonthDropdown: toggleMonthView,
|
|
423
416
|
onToggleTimeDropdown: onToggleTimeDropdown,
|
|
424
417
|
onChangeMonth: handleChangeMonth,
|
|
425
|
-
onChangeTime: handleChangeTime
|
|
426
|
-
onToggleMeridian: handleToggleMeridian
|
|
418
|
+
onChangeTime: handleChangeTime
|
|
427
419
|
})), /*#__PURE__*/React.createElement(Toolbar, {
|
|
428
420
|
locale: locale,
|
|
429
421
|
ranges: bottomRanges,
|
|
@@ -449,8 +441,8 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
449
441
|
if (caretAsProp === null) {
|
|
450
442
|
return null;
|
|
451
443
|
}
|
|
452
|
-
return caretAsProp || (
|
|
453
|
-
}, [caretAsProp,
|
|
444
|
+
return caretAsProp || (mode === DateMode.Time ? TimeIcon : IconCalendar);
|
|
445
|
+
}, [caretAsProp, mode]);
|
|
454
446
|
var handleTriggerClose = useEventCallback(function (cause) {
|
|
455
447
|
var _props$onClose;
|
|
456
448
|
// Unless overlay is closing on user clicking "OK" button,
|
|
@@ -555,7 +547,7 @@ DatePicker.propTypes = _extends({}, pickerPropTypes, deprecatedPropTypes, {
|
|
|
555
547
|
onToggleTimeDropdown: PropTypes.func,
|
|
556
548
|
oneTap: PropTypes.bool,
|
|
557
549
|
ranges: PropTypes.array,
|
|
558
|
-
|
|
550
|
+
showMeridiem: PropTypes.bool,
|
|
559
551
|
showWeekNumbers: PropTypes.bool,
|
|
560
552
|
value: PropTypes.instanceOf(Date)
|
|
561
553
|
});
|
|
@@ -3,7 +3,7 @@ import delay from 'lodash/delay';
|
|
|
3
3
|
import addMonths from 'date-fns/addMonths';
|
|
4
4
|
import addDays from 'date-fns/addDays';
|
|
5
5
|
import { useEventCallback, useCustom } from "../../internals/hooks/index.js";
|
|
6
|
-
import { getAriaLabel } from "../../Calendar/utils.js";
|
|
6
|
+
import { getAriaLabel } from "../../Calendar/utils/index.js";
|
|
7
7
|
import { onMenuKeyDown } from "../../internals/Picker/utils.js";
|
|
8
8
|
function useFocus(props) {
|
|
9
9
|
var target = props.target,
|
package/esm/DatePicker/utils.js
CHANGED
|
@@ -6,9 +6,9 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import omit from 'lodash/omit';
|
|
7
7
|
import { deprecatePropTypeNew } from "../internals/propTypes/index.js";
|
|
8
8
|
import { omitTriggerPropKeys } from "../internals/Picker/index.js";
|
|
9
|
-
import { subDays, startOfDay, endOfDay, calendarOnlyProps } from "../internals/utils/date/index.js";
|
|
9
|
+
import { subDays, startOfDay, endOfDay, calendarOnlyProps, startOfToday } from "../internals/utils/date/index.js";
|
|
10
10
|
export function getDefaultRanges(value) {
|
|
11
|
-
var today =
|
|
11
|
+
var today = startOfToday();
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* If it is an array type, it returns the default shortcut key suitable for DateRangePicker Toolbar,
|