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,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) {
|
|
@@ -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>>;
|
|
@@ -4,12 +4,13 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
var _excluded = ["onBlur"];
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import Input from "../Input/index.js";
|
|
7
|
+
import { createChainedFunction } from "../internals/utils/index.js";
|
|
7
8
|
export function defaultRenderInput(props, ref) {
|
|
8
9
|
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
9
10
|
ref: ref
|
|
10
11
|
}, props));
|
|
11
12
|
}
|
|
12
|
-
var pickers = ['DatePicker', 'DateRangePicker', 'InputPicker', 'TagPicker', 'Cascader', 'MultiCascader', 'SelectPicker', 'CheckPicker', 'CheckTreePicker', 'TreePicker'];
|
|
13
|
+
var pickers = ['DatePicker', 'DateRangePicker', 'TimePicker', 'TimeRangePicker', 'InputPicker', 'TagPicker', 'Cascader', 'MultiCascader', 'SelectPicker', 'CheckPicker', 'CheckTreePicker', 'TreePicker'];
|
|
13
14
|
function getDisplayName(Component) {
|
|
14
15
|
var _Component$type;
|
|
15
16
|
if (typeof (Component === null || Component === void 0 ? void 0 : Component.type) === 'string') {
|
|
@@ -24,10 +25,18 @@ export function renderChildren(children, props, ref) {
|
|
|
24
25
|
if (pickers.includes(getDisplayName(children))) {
|
|
25
26
|
var onBlur = props.onBlur,
|
|
26
27
|
rest = _objectWithoutPropertiesLoose(props, _excluded);
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
var _children$props = children.props,
|
|
29
|
+
onExit = _children$props.onExit,
|
|
30
|
+
onClean = _children$props.onClean;
|
|
29
31
|
return /*#__PURE__*/React.cloneElement(children, _extends({}, rest, {
|
|
30
|
-
|
|
32
|
+
// Pass onBlur to the child component to automatically save or cancel after the focus event is processed.
|
|
33
|
+
// Special handling in the Picker component, call onBlur when onExit and onClean
|
|
34
|
+
onExit: createChainedFunction(function () {
|
|
35
|
+
return onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
36
|
+
}, onExit),
|
|
37
|
+
onClean: createChainedFunction(function () {
|
|
38
|
+
return onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
39
|
+
}, onClean),
|
|
31
40
|
ref: ref
|
|
32
41
|
}));
|
|
33
42
|
}
|
|
@@ -3,8 +3,8 @@ import { PickerHandle } from '../internals/Picker/types';
|
|
|
3
3
|
interface FocusEventProps {
|
|
4
4
|
isEditing: boolean;
|
|
5
5
|
stateOnBlur?: 'save' | 'cancel';
|
|
6
|
-
onSave?: (event?: React.FocusEvent) => void;
|
|
7
|
-
onCancel?: (event?: React.FocusEvent) => void;
|
|
6
|
+
onSave?: (event?: React.FocusEvent | null) => void;
|
|
7
|
+
onCancel?: (event?: React.FocusEvent | null) => void;
|
|
8
8
|
}
|
|
9
9
|
declare const useFocusEvent: ({ isEditing, stateOnBlur, onSave, onCancel }: FocusEventProps) => {
|
|
10
10
|
target: import("react").RefObject<HTMLInputElement | PickerHandle>;
|
|
@@ -15,12 +15,17 @@ var useFocusEvent = function useFocusEvent(_ref) {
|
|
|
15
15
|
var focus = function focus() {
|
|
16
16
|
if (isPicker) {
|
|
17
17
|
setTimeout(function () {
|
|
18
|
-
var
|
|
19
|
-
|
|
18
|
+
var _picker$target, _picker$target$focus, _picker$open;
|
|
19
|
+
var picker = ref.current;
|
|
20
|
+
// Auto focus the search input
|
|
21
|
+
picker === null || picker === void 0 ? void 0 : (_picker$target = picker.target) === null || _picker$target === void 0 ? void 0 : (_picker$target$focus = _picker$target.focus) === null || _picker$target$focus === void 0 ? void 0 : _picker$target$focus.call(_picker$target);
|
|
22
|
+
|
|
23
|
+
// Open the picker
|
|
24
|
+
picker === null || picker === void 0 ? void 0 : (_picker$open = picker.open) === null || _picker$open === void 0 ? void 0 : _picker$open.call(picker);
|
|
20
25
|
}, 100);
|
|
21
26
|
} else {
|
|
22
|
-
var _ref$
|
|
23
|
-
(_ref$
|
|
27
|
+
var _ref$current2, _ref$current2$focus;
|
|
28
|
+
(_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : (_ref$current2$focus = _ref$current2.focus) === null || _ref$current2$focus === void 0 ? void 0 : _ref$current2$focus.call(_ref$current2);
|
|
24
29
|
}
|
|
25
30
|
};
|
|
26
31
|
var handleBlur = useEventCallback(function (event) {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RangeType } from '../DatePicker';
|
|
3
|
+
import type { FormControlBaseProps, PickerBaseProps } from '../internals/types';
|
|
4
|
+
import type { PickerComponent } from '../internals/Picker/types';
|
|
5
|
+
import type { DatePickerLocale } from '../locales';
|
|
6
|
+
export interface TimePickerProps extends PickerBaseProps<DatePickerLocale>, FormControlBaseProps<Date | null> {
|
|
7
|
+
/**
|
|
8
|
+
* Custom caret component
|
|
9
|
+
*/
|
|
10
|
+
caretAs?: React.ElementType | null;
|
|
11
|
+
/**
|
|
12
|
+
* Calendar panel default presentation date and time
|
|
13
|
+
*/
|
|
14
|
+
calendarDefaultDate?: Date;
|
|
15
|
+
/**
|
|
16
|
+
* Whether disabled the component
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Rendered as an input, the date can be entered via the keyboard
|
|
21
|
+
*/
|
|
22
|
+
editable?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Format date string
|
|
25
|
+
*/
|
|
26
|
+
format?: string;
|
|
27
|
+
/**
|
|
28
|
+
* A label displayed at the beginning of toggle button
|
|
29
|
+
*/
|
|
30
|
+
label?: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* Whether to display a loading state indicator
|
|
33
|
+
*/
|
|
34
|
+
loading?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether plaintext the component
|
|
37
|
+
*/
|
|
38
|
+
plaintext?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether read only the component
|
|
41
|
+
*/
|
|
42
|
+
readOnly?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Meridiem format for 12-hour time
|
|
45
|
+
*/
|
|
46
|
+
showMeridiem?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Hide specific hour options
|
|
49
|
+
*/
|
|
50
|
+
hideHours?: (hour: number, date: Date) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Hide specific minute options
|
|
53
|
+
*/
|
|
54
|
+
hideMinutes?: (minute: number, date: Date) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Hide specific second options
|
|
57
|
+
*/
|
|
58
|
+
hideSeconds?: (second: number, date: Date) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Called when the option is selected
|
|
61
|
+
*/
|
|
62
|
+
onSelect?: (date: Date, event?: React.SyntheticEvent) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Called after clicking the OK button
|
|
65
|
+
*/
|
|
66
|
+
onOk?: (date: Date, event: React.SyntheticEvent) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Called after clicking the shortcut button
|
|
69
|
+
*/
|
|
70
|
+
onShortcutClick?: (range: RangeType<Date>, event: React.MouseEvent) => void;
|
|
71
|
+
/**
|
|
72
|
+
* Called when clean
|
|
73
|
+
*/
|
|
74
|
+
onClean?: (event: React.MouseEvent) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Custom rendering of the selected date.
|
|
77
|
+
*/
|
|
78
|
+
renderValue?: (value: Date, format: string) => string;
|
|
79
|
+
}
|
|
80
|
+
declare const TimePicker: PickerComponent<TimePickerProps>;
|
|
81
|
+
export default TimePicker;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import React, { useMemo } from 'react';
|
|
4
|
+
import DatePicker from "../DatePicker/index.js";
|
|
5
|
+
import { useCustom } from "../internals/hooks/index.js";
|
|
6
|
+
var TimePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
7
|
+
var _useCustom = useCustom('Calendar'),
|
|
8
|
+
locale = _useCustom.locale;
|
|
9
|
+
var defaultRanges = useMemo(function () {
|
|
10
|
+
return [{
|
|
11
|
+
label: locale.now,
|
|
12
|
+
value: function value() {
|
|
13
|
+
return new Date();
|
|
14
|
+
}
|
|
15
|
+
}];
|
|
16
|
+
}, [locale]);
|
|
17
|
+
return /*#__PURE__*/React.createElement(DatePicker, _extends({
|
|
18
|
+
ref: ref,
|
|
19
|
+
format: locale.shortTimeFormat,
|
|
20
|
+
ranges: defaultRanges
|
|
21
|
+
}, props));
|
|
22
|
+
});
|
|
23
|
+
TimePicker.displayName = 'TimePicker';
|
|
24
|
+
export default TimePicker;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { RangeType, DateRange } from '../DateRangePicker';
|
|
3
|
+
import type { FormControlBaseProps, PickerBaseProps } from '../internals/types';
|
|
4
|
+
import type { PickerComponent } from '../internals/Picker/types';
|
|
5
|
+
import type { DatePickerLocale } from '../locales';
|
|
6
|
+
export interface TimeRangePickerProps extends PickerBaseProps<DatePickerLocale>, FormControlBaseProps<DateRange | null> {
|
|
7
|
+
/**
|
|
8
|
+
* Custom caret component
|
|
9
|
+
*/
|
|
10
|
+
caretAs?: React.ElementType | null;
|
|
11
|
+
/** Predefined date ranges */
|
|
12
|
+
ranges?: RangeType[];
|
|
13
|
+
/**
|
|
14
|
+
* Format of the date displayed in the input box
|
|
15
|
+
*/
|
|
16
|
+
format?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Rendered as an input, the date can be entered via the keyboard.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
editable?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* A label displayed at the beginning of toggle button
|
|
24
|
+
*/
|
|
25
|
+
label?: React.ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to display a loading state indicator
|
|
28
|
+
*/
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Meridiem format for 12-hour time
|
|
32
|
+
*/
|
|
33
|
+
showMeridiem?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to display the formatted date range at the header of the calendar
|
|
36
|
+
*/
|
|
37
|
+
showHeader?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* The character that separates two dates
|
|
40
|
+
* @default ' ~ '
|
|
41
|
+
*/
|
|
42
|
+
character?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Hide specific hour options
|
|
45
|
+
*/
|
|
46
|
+
hideHours?: (hour: number, date: Date) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Hide specific minute options
|
|
49
|
+
*/
|
|
50
|
+
hideMinutes?: (minute: number, date: Date) => boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Hide specific second options
|
|
53
|
+
*/
|
|
54
|
+
hideSeconds?: (second: number, date: Date) => boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Called after clicking the OK button
|
|
57
|
+
*/
|
|
58
|
+
onOk?: (date: DateRange, event: React.SyntheticEvent) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Called after clicking the shortcut button
|
|
61
|
+
*/
|
|
62
|
+
onShortcutClick?: (range: RangeType, event: React.MouseEvent) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Called when the value is cleared
|
|
65
|
+
*/
|
|
66
|
+
onClean?: (event: React.MouseEvent) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Custom rendering of the selected date range.
|
|
69
|
+
*/
|
|
70
|
+
renderValue?: (value: DateRange, format: string) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Custom render for calendar title
|
|
73
|
+
*/
|
|
74
|
+
renderTitle?: (date: Date) => React.ReactNode;
|
|
75
|
+
}
|
|
76
|
+
declare const TimeRangePicker: PickerComponent<TimeRangePickerProps>;
|
|
77
|
+
export default TimeRangePicker;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { useCustom } from "../internals/hooks/index.js";
|
|
5
|
+
import DateRangePicker from "../DateRangePicker/index.js";
|
|
6
|
+
var defaultRanges = [];
|
|
7
|
+
var TimeRangePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
8
|
+
var _useCustom = useCustom('Calendar'),
|
|
9
|
+
locale = _useCustom.locale;
|
|
10
|
+
return /*#__PURE__*/React.createElement(DateRangePicker, _extends({
|
|
11
|
+
ref: ref,
|
|
12
|
+
showHeader: false,
|
|
13
|
+
format: locale.shortTimeFormat,
|
|
14
|
+
ranges: defaultRanges
|
|
15
|
+
}, props));
|
|
16
|
+
});
|
|
17
|
+
TimeRangePicker.displayName = 'TimeRangePicker';
|
|
18
|
+
export default TimeRangePicker;
|
package/esm/index.d.ts
CHANGED
|
@@ -105,10 +105,14 @@ export { default as DateInput } from './DateInput';
|
|
|
105
105
|
export type { DateInputProps } from './DateInput';
|
|
106
106
|
export { default as DatePicker } from './DatePicker';
|
|
107
107
|
export type { DatePickerProps } from './DatePicker';
|
|
108
|
+
export { default as TimePicker } from './TimePicker';
|
|
109
|
+
export type { TimePickerProps } from './TimePicker';
|
|
108
110
|
export { default as DateRangeInput } from './DateRangeInput';
|
|
109
111
|
export type { DateRangeInputProps } from './DateRangeInput';
|
|
110
112
|
export { default as DateRangePicker } from './DateRangePicker';
|
|
111
113
|
export type { DateRangePickerProps } from './DateRangePicker';
|
|
114
|
+
export { default as TimeRangePicker } from './TimeRangePicker';
|
|
115
|
+
export type { TimeRangePickerProps } from './TimeRangePicker';
|
|
112
116
|
export { default as AutoComplete } from './AutoComplete';
|
|
113
117
|
export type { AutoCompleteProps } from './AutoComplete';
|
|
114
118
|
export { default as Uploader } from './Uploader';
|
package/esm/index.js
CHANGED
|
@@ -69,8 +69,10 @@ export { default as Cascader } from "./Cascader/index.js";
|
|
|
69
69
|
export { default as MultiCascader } from "./MultiCascader/index.js";
|
|
70
70
|
export { default as DateInput } from "./DateInput/index.js";
|
|
71
71
|
export { default as DatePicker } from "./DatePicker/index.js";
|
|
72
|
+
export { default as TimePicker } from "./TimePicker/index.js";
|
|
72
73
|
export { default as DateRangeInput } from "./DateRangeInput/index.js";
|
|
73
74
|
export { default as DateRangePicker } from "./DateRangePicker/index.js";
|
|
75
|
+
export { default as TimeRangePicker } from "./TimeRangePicker/index.js";
|
|
74
76
|
export { default as AutoComplete } from "./AutoComplete/index.js";
|
|
75
77
|
export { default as Uploader } from "./Uploader/index.js";
|
|
76
78
|
export { default as Slider } from "./Slider/index.js";
|
|
@@ -69,7 +69,8 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
69
69
|
var _useClassNames = useClassNames(classPrefix),
|
|
70
70
|
withClassPrefix = _useClassNames.withClassPrefix,
|
|
71
71
|
prefix = _useClassNames.prefix,
|
|
72
|
-
merge = _useClassNames.merge
|
|
72
|
+
merge = _useClassNames.merge,
|
|
73
|
+
rootPrefix = _useClassNames.rootPrefix;
|
|
73
74
|
var groupable = typeof groupBy !== 'undefined';
|
|
74
75
|
var classes = merge(className, withClassPrefix('items', {
|
|
75
76
|
grouped: groupable
|
|
@@ -230,7 +231,8 @@ var Listbox = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
230
231
|
height: height || maxHeight,
|
|
231
232
|
itemCount: rowCount,
|
|
232
233
|
itemData: filteredItems,
|
|
233
|
-
itemSize: getRowHeight.bind(_this, filteredItems)
|
|
234
|
+
itemSize: getRowHeight.bind(_this, filteredItems),
|
|
235
|
+
className: rootPrefix('virt-list')
|
|
234
236
|
}, listProps), renderItem);
|
|
235
237
|
}) : filteredItems.map(function (item, index) {
|
|
236
238
|
return renderItem({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
import { useContext, useCallback } from 'react';
|
|
4
4
|
import { format, parse, isValid } from "../utils/date/index.js";
|
|
5
|
-
import defaultLocale from "../../locales/
|
|
5
|
+
import defaultLocale from "../../locales/en_GB.js";
|
|
6
6
|
import { CustomContext } from "../../CustomProvider/CustomProvider.js";
|
|
7
7
|
var mergeObject = function mergeObject(list) {
|
|
8
8
|
return list.reduce(function (a, b) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
/**
|
|
3
|
+
* Extracts the time format from a given date format.
|
|
4
|
+
*/
|
|
5
|
+
export function extractTimeFormat(format) {
|
|
6
|
+
var match = format.match(/([hH]{1,2}[:.]mm(?:[:.]ss)?(?: ?aa)?|(?:aa )?[hH]{1,2}[:.]mm(?:[:.]ss)?)/);
|
|
7
|
+
return match ? match[0] : null;
|
|
8
|
+
}
|
|
@@ -26,3 +26,7 @@ export declare const shouldRenderDate: (format: string) => boolean;
|
|
|
26
26
|
* @returns Whether only the time should be rendered.
|
|
27
27
|
*/
|
|
28
28
|
export declare const shouldOnlyRenderTime: (format: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Check if only the month should be rendered based on the format.
|
|
31
|
+
*/
|
|
32
|
+
export declare const shouldOnlyRenderMonth: (format: string) => boolean;
|
|
@@ -37,4 +37,11 @@ export var shouldRenderDate = function shouldRenderDate(format) {
|
|
|
37
37
|
*/
|
|
38
38
|
export var shouldOnlyRenderTime = function shouldOnlyRenderTime(format) {
|
|
39
39
|
return /([Hhms])/.test(format) && !/([YyMDd])/.test(format);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Check if only the month should be rendered based on the format.
|
|
44
|
+
*/
|
|
45
|
+
export var shouldOnlyRenderMonth = function shouldOnlyRenderMonth(format) {
|
|
46
|
+
return shouldRenderMonth(format) && !shouldRenderDate(format);
|
|
40
47
|
};
|
|
@@ -43,13 +43,15 @@ export { default as set } from 'date-fns/set';
|
|
|
43
43
|
export { default as differenceInCalendarMonths } from 'date-fns/differenceInCalendarMonths';
|
|
44
44
|
export { default as isLastDayOfMonth } from 'date-fns/isLastDayOfMonth';
|
|
45
45
|
export { default as lastDayOfMonth } from 'date-fns/lastDayOfMonth';
|
|
46
|
+
export { default as startOfToday } from 'date-fns/startOfToday';
|
|
46
47
|
export { getWeekStartDates } from './getWeekStartDates';
|
|
47
48
|
export { getWeekKeys } from './getWeekKeys';
|
|
48
|
-
export { getReversedTimeMeridian } from './getReversedTimeMeridian';
|
|
49
49
|
export { reverseDateRangeOmitTime } from './reverseDateRangeOmitTime';
|
|
50
50
|
export { omitHideDisabledProps } from './omitHideDisabledProps';
|
|
51
51
|
export { copyTime } from './copyTime';
|
|
52
52
|
export { disableTime } from './disableTime';
|
|
53
|
-
export {
|
|
53
|
+
export { useDateMode, DateMode } from './useDateMode';
|
|
54
|
+
export { extractTimeFormat } from './extractTimeFormat';
|
|
55
|
+
export * from './formatCheck';
|
|
54
56
|
export type { TimeProp, CalendarOnlyPropsType } from './types';
|
|
55
57
|
export { calendarOnlyProps } from './types';
|
|
@@ -45,16 +45,18 @@ export { default as set } from 'date-fns/set';
|
|
|
45
45
|
export { default as differenceInCalendarMonths } from 'date-fns/differenceInCalendarMonths';
|
|
46
46
|
export { default as isLastDayOfMonth } from 'date-fns/isLastDayOfMonth';
|
|
47
47
|
export { default as lastDayOfMonth } from 'date-fns/lastDayOfMonth';
|
|
48
|
+
export { default as startOfToday } from 'date-fns/startOfToday';
|
|
48
49
|
|
|
49
50
|
// Export custom functions
|
|
50
51
|
export { getWeekStartDates } from "./getWeekStartDates.js";
|
|
51
52
|
export { getWeekKeys } from "./getWeekKeys.js";
|
|
52
|
-
export { getReversedTimeMeridian } from "./getReversedTimeMeridian.js";
|
|
53
53
|
export { reverseDateRangeOmitTime } from "./reverseDateRangeOmitTime.js";
|
|
54
54
|
export { omitHideDisabledProps } from "./omitHideDisabledProps.js";
|
|
55
55
|
export { copyTime } from "./copyTime.js";
|
|
56
56
|
export { disableTime } from "./disableTime.js";
|
|
57
|
-
export {
|
|
57
|
+
export { useDateMode, DateMode } from "./useDateMode.js";
|
|
58
|
+
export { extractTimeFormat } from "./extractTimeFormat.js";
|
|
59
|
+
export * from "./formatCheck.js";
|
|
58
60
|
|
|
59
61
|
// Export types
|
|
60
62
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare enum DateMode {
|
|
2
|
+
Date = "date",
|
|
3
|
+
Month = "month",
|
|
4
|
+
Time = "time",
|
|
5
|
+
DateTime = "datetime"
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Custom hook to determine the date mode and check format parts.
|
|
9
|
+
*
|
|
10
|
+
* @param format - The format string.
|
|
11
|
+
* @returns An object containing the resolved DateMode and a `has` method to check format parts.
|
|
12
|
+
*/
|
|
13
|
+
export declare const useDateMode: (format: string) => {
|
|
14
|
+
mode: DateMode;
|
|
15
|
+
has: (part: 'year' | 'month' | 'day' | 'time') => boolean;
|
|
16
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useMemo, useCallback } from 'react';
|
|
3
|
+
import { shouldRenderDate, shouldRenderTime, shouldOnlyRenderMonth, shouldOnlyRenderTime } from "./formatCheck.js";
|
|
4
|
+
export var DateMode = /*#__PURE__*/function (DateMode) {
|
|
5
|
+
DateMode["Date"] = "date";
|
|
6
|
+
DateMode["Month"] = "month";
|
|
7
|
+
DateMode["Time"] = "time";
|
|
8
|
+
DateMode["DateTime"] = "datetime";
|
|
9
|
+
return DateMode;
|
|
10
|
+
}({});
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Custom hook to determine the date mode and check format parts.
|
|
14
|
+
*
|
|
15
|
+
* @param format - The format string.
|
|
16
|
+
* @returns An object containing the resolved DateMode and a `has` method to check format parts.
|
|
17
|
+
*/
|
|
18
|
+
export var useDateMode = function useDateMode(format) {
|
|
19
|
+
var mode = useMemo(function () {
|
|
20
|
+
if (shouldRenderDate(format) && shouldRenderTime(format)) {
|
|
21
|
+
return DateMode.DateTime;
|
|
22
|
+
}
|
|
23
|
+
if (shouldOnlyRenderMonth(format)) {
|
|
24
|
+
return DateMode.Month;
|
|
25
|
+
}
|
|
26
|
+
if (shouldOnlyRenderTime(format)) {
|
|
27
|
+
return DateMode.Time;
|
|
28
|
+
}
|
|
29
|
+
if (shouldRenderDate(format)) {
|
|
30
|
+
return DateMode.Date;
|
|
31
|
+
}
|
|
32
|
+
return DateMode.Date; // Default fallback
|
|
33
|
+
}, [format]);
|
|
34
|
+
|
|
35
|
+
// Use useCallback to memoize the has method
|
|
36
|
+
var has = useCallback(function (part) {
|
|
37
|
+
switch (part) {
|
|
38
|
+
case 'year':
|
|
39
|
+
return /[Yy]/.test(format);
|
|
40
|
+
case 'month':
|
|
41
|
+
return /[ML]/.test(format);
|
|
42
|
+
case 'day':
|
|
43
|
+
return /[Dd]/.test(format);
|
|
44
|
+
case 'time':
|
|
45
|
+
return /([Hhms])/.test(format);
|
|
46
|
+
default:
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}, [format]);
|
|
50
|
+
return {
|
|
51
|
+
mode: mode,
|
|
52
|
+
has: has
|
|
53
|
+
};
|
|
54
|
+
};
|
|
@@ -13,7 +13,6 @@ export { placementPolyfill } from './placementPolyfill';
|
|
|
13
13
|
export { mergeRefs } from './mergeRefs';
|
|
14
14
|
export { shallowEqual, shallowEqualArray } from './shallowEqual';
|
|
15
15
|
export { composeFunctions } from './composeFunctions';
|
|
16
|
-
export { scrollTopAnimation } from './scrollTopAnimation';
|
|
17
16
|
export { render } from './render';
|
|
18
17
|
export { safeSetSelection } from './safeSetSelection';
|
|
19
18
|
export { getStringLength } from './getStringLength';
|
|
@@ -14,7 +14,6 @@ export { placementPolyfill } from "./placementPolyfill.js";
|
|
|
14
14
|
export { mergeRefs } from "./mergeRefs.js";
|
|
15
15
|
export { shallowEqual, shallowEqualArray } from "./shallowEqual.js";
|
|
16
16
|
export { composeFunctions } from "./composeFunctions.js";
|
|
17
|
-
export { scrollTopAnimation } from "./scrollTopAnimation.js";
|
|
18
17
|
export { render } from "./render.js";
|
|
19
18
|
export { safeSetSelection } from "./safeSetSelection.js";
|
|
20
19
|
export { getStringLength } from "./getStringLength.js";
|