@mui/x-date-pickers-pro 8.0.0-alpha.0 → 8.0.0-alpha.10
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/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.d.ts +1 -1
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.d.ts +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
- package/CHANGELOG.md +2215 -119
- package/DateRangeCalendar/DateRangeCalendar.js +18 -14
- package/DateRangePicker/DateRangePicker.js +1 -4
- package/DateRangePicker/DateRangePicker.types.d.ts +6 -2
- package/DateRangePicker/DateRangePickerToolbar.d.ts +2 -3
- package/DateRangePicker/DateRangePickerToolbar.js +33 -53
- package/DateRangePicker/shared.d.ts +4 -3
- package/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
- package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +1 -2
- package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +4 -5
- package/DateTimeRangePicker/DateTimeRangePickerTabs.js +35 -33
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -10
- package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +2 -5
- package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +85 -123
- package/DateTimeRangePicker/shared.d.ts +6 -5
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
- package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +7 -2
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +2 -3
- package/MobileDateRangePicker/MobileDateRangePicker.js +4 -8
- package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +2 -2
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -16
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +2 -3
- package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +9 -4
- package/MultiInputDateRangeField/MultiInputDateRangeField.js +15 -121
- package/MultiInputDateRangeField/index.d.ts +5 -3
- package/MultiInputDateRangeField/index.js +2 -2
- package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.d.ts +6 -0
- package/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +9 -4
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +15 -121
- package/MultiInputDateTimeRangeField/index.d.ts +5 -3
- package/MultiInputDateTimeRangeField/index.js +2 -2
- package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.d.ts +6 -0
- package/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +9 -4
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -122
- package/MultiInputTimeRangeField/index.d.ts +5 -3
- package/MultiInputTimeRangeField/index.js +2 -2
- package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.d.ts +6 -0
- package/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
- package/README.md +10 -7
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -33
- package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +6 -16
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +23 -33
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +6 -17
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +23 -33
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +6 -17
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
- package/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +2 -2
- package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -2
- package/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +2 -0
- package/hooks/package.json +6 -0
- package/hooks/useMultiInputRangeField/index.d.ts +1 -0
- package/hooks/useMultiInputRangeField/index.js +1 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +53 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.d.ts +17 -0
- package/{modern/internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.d.ts +17 -0
- package/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
- package/hooks/usePickerRangePositionContext.d.ts +7 -0
- package/hooks/usePickerRangePositionContext.js +15 -0
- package/index.d.ts +2 -0
- package/index.js +4 -2
- package/internals/hooks/models/index.d.ts +1 -1
- package/internals/hooks/models/useRangePicker.d.ts +8 -11
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +70 -102
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +8 -10
- package/internals/hooks/{useEnrichedRangePickerFieldProps.d.ts → useEnrichedRangePickerField.d.ts} +26 -17
- package/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +55 -68
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +59 -82
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -9
- package/internals/hooks/useNullablePickerRangePositionContext.d.ts +5 -0
- package/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
- package/internals/hooks/useRangePosition.d.ts +4 -3
- package/internals/hooks/useRangePosition.js +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -1
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +18 -31
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -12
- package/internals/models/dateTimeRange.d.ts +1 -6
- package/internals/models/fields.d.ts +7 -11
- package/internals/models/index.d.ts +0 -1
- package/internals/models/index.js +0 -1
- package/internals/models/managers.d.ts +3 -0
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.d.ts +3 -0
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +136 -0
- package/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.d.ts +72 -0
- package/internals/utils/createMultiInputRangeField/index.d.ts +3 -0
- package/internals/utils/createMultiInputRangeField/index.js +2 -0
- package/internals/utils/date-fields-utils.d.ts +6 -6
- package/internals/utils/date-range-manager.d.ts +2 -1
- package/internals/utils/date-range-manager.js +13 -10
- package/internals/utils/releaseInfo.js +1 -1
- package/internals/utils/valueManagers.d.ts +4 -3
- package/internals/utils/valueManagers.js +7 -7
- package/managers/index.d.ts +6 -0
- package/managers/index.js +3 -0
- package/managers/package.json +6 -0
- package/managers/useDateRangeManager.d.ts +15 -0
- package/managers/useDateRangeManager.js +33 -0
- package/managers/useDateTimeRangeManager.d.ts +15 -0
- package/managers/useDateTimeRangeManager.js +33 -0
- package/managers/useTimeRangeManager.d.ts +15 -0
- package/managers/useTimeRangeManager.js +31 -0
- package/models/fields.d.ts +7 -11
- package/models/index.d.ts +1 -2
- package/models/index.js +1 -2
- package/models/range.d.ts +0 -2
- package/modern/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/modern/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/modern/DateRangeCalendar/DateRangeCalendar.js +18 -14
- package/modern/DateRangePicker/DateRangePicker.js +1 -4
- package/modern/DateRangePicker/DateRangePickerToolbar.js +33 -53
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
- package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +35 -33
- package/modern/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
- package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +85 -123
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +4 -8
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -16
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +15 -121
- package/modern/MultiInputDateRangeField/index.js +2 -2
- package/modern/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +4 -0
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +15 -121
- package/modern/MultiInputDateTimeRangeField/index.js +2 -2
- package/modern/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +4 -0
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +16 -122
- package/modern/MultiInputTimeRangeField/index.js +2 -2
- package/modern/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +4 -0
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +23 -33
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +14 -14
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +23 -33
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +14 -14
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +23 -33
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +14 -14
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/modern/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/modern/hooks/index.js +2 -0
- package/modern/hooks/useMultiInputRangeField/index.js +1 -0
- package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.js +149 -0
- package/{internals/hooks/useMultiInputFieldSelectedSections.js → modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +10 -8
- package/modern/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +59 -0
- package/modern/hooks/usePickerRangePositionContext.js +15 -0
- package/modern/index.js +4 -2
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +70 -102
- package/modern/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +55 -68
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +59 -82
- package/modern/internals/hooks/useNullablePickerRangePositionContext.js +10 -0
- package/modern/internals/hooks/useRangePosition.js +1 -1
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +18 -31
- package/modern/internals/models/index.js +0 -1
- package/modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +136 -0
- package/modern/internals/utils/createMultiInputRangeField/index.js +2 -0
- package/modern/internals/utils/date-range-manager.js +13 -10
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/internals/utils/valueManagers.js +7 -7
- package/modern/managers/index.js +3 -0
- package/modern/managers/useDateRangeManager.js +33 -0
- package/modern/managers/useDateTimeRangeManager.js +33 -0
- package/modern/managers/useTimeRangeManager.js +31 -0
- package/modern/models/index.js +1 -2
- package/modern/validation/validateDateRange.js +8 -0
- package/modern/validation/validateDateTimeRange.js +4 -0
- package/modern/validation/validateTimeRange.js +8 -0
- package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
- package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
- package/node/DateRangeCalendar/DateRangeCalendar.js +17 -13
- package/node/DateRangePicker/DateRangePicker.js +1 -4
- package/node/DateRangePicker/DateRangePickerToolbar.js +31 -51
- package/node/DateTimeRangePicker/DateTimeRangePicker.js +2 -5
- package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +33 -31
- package/node/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +8 -6
- package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +83 -121
- package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +11 -9
- package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -22
- package/node/MobileDateRangePicker/MobileDateRangePicker.js +4 -8
- package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +18 -16
- package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +14 -124
- package/node/MultiInputDateRangeField/index.js +3 -9
- package/node/MultiInputDateRangeField/multiInputDateRangeFieldClasses.js +12 -0
- package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +14 -124
- package/node/MultiInputDateTimeRangeField/index.js +3 -9
- package/node/MultiInputDateTimeRangeField/multiInputDateTimeRangeFieldClasses.js +12 -0
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +15 -125
- package/node/MultiInputTimeRangeField/index.js +3 -9
- package/node/MultiInputTimeRangeField/multiInputTimeRangeFieldClasses.js +12 -0
- package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +22 -32
- package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +13 -14
- package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +22 -32
- package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +13 -14
- package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +22 -32
- package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +13 -14
- package/node/StaticDateRangePicker/StaticDateRangePicker.js +2 -2
- package/node/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -6
- package/node/hooks/index.js +19 -0
- package/node/hooks/useMultiInputRangeField/index.js +12 -0
- package/node/hooks/useMultiInputRangeField/useMultiInputRangeField.js +155 -0
- package/node/{internals/hooks/useMultiInputFieldSelectedSections.js → hooks/useMultiInputRangeField/useMultiInputRangeFieldSelectedSections.js} +11 -10
- package/node/hooks/useMultiInputRangeField/useMultiInputRangeFieldTextFieldProps.js +66 -0
- package/node/hooks/usePickerRangePositionContext.js +22 -0
- package/node/index.js +23 -1
- package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +70 -102
- package/node/internals/hooks/{useEnrichedRangePickerFieldProps.js → useEnrichedRangePickerField.js} +57 -70
- package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +59 -82
- package/node/internals/hooks/useNullablePickerRangePositionContext.js +16 -0
- package/node/internals/hooks/useRangePosition.js +1 -1
- package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +17 -30
- package/node/internals/models/index.js +0 -11
- package/node/internals/utils/createMultiInputRangeField/createMultiInputRangeField.js +143 -0
- package/node/internals/utils/createMultiInputRangeField/index.js +19 -0
- package/node/internals/utils/date-range-manager.js +13 -10
- package/node/internals/utils/releaseInfo.js +1 -1
- package/node/internals/utils/valueManagers.js +7 -7
- package/node/managers/index.js +26 -0
- package/node/managers/useDateRangeManager.js +40 -0
- package/node/managers/useDateTimeRangeManager.js +40 -0
- package/node/managers/useTimeRangeManager.js +38 -0
- package/node/models/index.js +0 -22
- package/node/validation/validateDateRange.js +8 -0
- package/node/validation/validateDateTimeRange.js +4 -0
- package/node/validation/validateTimeRange.js +8 -0
- package/package.json +8 -8
- package/themeAugmentation/overrides.d.ts +6 -4
- package/themeAugmentation/props.d.ts +2 -2
- package/validation/validateDateRange.d.ts +9 -1
- package/validation/validateDateRange.js +8 -0
- package/validation/validateDateTimeRange.d.ts +6 -2
- package/validation/validateDateTimeRange.js +4 -0
- package/validation/validateTimeRange.d.ts +9 -1
- package/validation/validateTimeRange.js +8 -0
- package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +0 -53
- package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +0 -54
- package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +0 -54
- package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +0 -21
- package/internals/hooks/useMultiInputRangeField/shared.d.ts +0 -1
- package/internals/hooks/useMultiInputRangeField/shared.js +0 -9
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +0 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -111
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +0 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -111
- package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +0 -11
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +0 -3
- package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -111
- package/internals/models/timeRange.d.ts +0 -6
- package/internals/models/timeRange.js +0 -1
- package/models/dateRange.d.ts +0 -7
- package/models/dateRange.js +0 -1
- package/models/multiInputRangeFieldClasses.d.ts +0 -7
- package/models/multiInputRangeFieldClasses.js +0 -1
- package/modern/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
- package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
- package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
- package/modern/internals/hooks/useMultiInputRangeField/shared.js +0 -9
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -111
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -111
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
- package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -111
- package/modern/internals/models/timeRange.js +0 -1
- package/modern/models/dateRange.js +0 -1
- package/modern/models/multiInputRangeFieldClasses.js +0 -1
- package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -5
- package/node/internals/hooks/useMultiInputRangeField/shared.js +0 -16
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -119
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -119
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -5
- package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -119
- package/node/internals/models/timeRange.js +0 -5
- package/node/models/dateRange.js +0 -5
- package/node/models/multiInputRangeFieldClasses.js +0 -5
- /package/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
- /package/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
- /package/{MultiInputTimeRangeField/MultiInputTimeRangeField.types.js → modern/internals/models/managers.js} +0 -0
- /package/{internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js → modern/internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
- /package/node/{MultiInputDateRangeField/MultiInputDateRangeField.types.js → internals/models/managers.js} +0 -0
- /package/node/{MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js → internals/utils/createMultiInputRangeField/createMultiInputRangeField.types.js} +0 -0
|
@@ -15,7 +15,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
15
15
|
import composeClasses from '@mui/utils/composeClasses';
|
|
16
16
|
import useId from '@mui/utils/useId';
|
|
17
17
|
import { Watermark } from '@mui/x-license';
|
|
18
|
-
import { applyDefaultDate, DayCalendar,
|
|
18
|
+
import { applyDefaultDate, DayCalendar, useReduceAnimations, useCalendarState, useDefaultDates, useUtils, useNow, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, useControlledValueWithTimezone, useViews, usePickerPrivateContext } from '@mui/x-date-pickers/internals';
|
|
19
19
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
20
20
|
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
21
21
|
import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from "./dateRangeCalendarClasses.js";
|
|
@@ -27,6 +27,7 @@ import { useDragRange } from "./useDragRange.js";
|
|
|
27
27
|
import { useRangePosition } from "../internals/hooks/useRangePosition.js";
|
|
28
28
|
import { DAY_RANGE_SIZE, DAY_MARGIN } from "../internals/constants/dimensions.js";
|
|
29
29
|
import { PickersRangeCalendarHeader } from "../PickersRangeCalendarHeader/index.js";
|
|
30
|
+
import { useNullablePickerRangePositionContext } from "../internals/hooks/useNullablePickerRangePositionContext.js";
|
|
30
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
32
|
const releaseInfo = getReleaseInfo();
|
|
32
33
|
const DateRangeCalendarRoot = styled('div', {
|
|
@@ -75,16 +76,16 @@ const DayCalendarForRange = InnerDayCalendarForRange;
|
|
|
75
76
|
function useDateRangeCalendarDefaultizedProps(props, name) {
|
|
76
77
|
const utils = useUtils();
|
|
77
78
|
const defaultDates = useDefaultDates();
|
|
78
|
-
const defaultReduceAnimations = useDefaultReduceAnimations();
|
|
79
79
|
const themeProps = useThemeProps({
|
|
80
80
|
props,
|
|
81
81
|
name
|
|
82
82
|
});
|
|
83
|
+
const reduceAnimations = useReduceAnimations(themeProps.reduceAnimations);
|
|
83
84
|
return _extends({}, themeProps, {
|
|
84
85
|
renderLoading: themeProps.renderLoading ?? (() => /*#__PURE__*/_jsx("span", {
|
|
85
86
|
children: "..."
|
|
86
87
|
})),
|
|
87
|
-
reduceAnimations
|
|
88
|
+
reduceAnimations,
|
|
88
89
|
loading: props.loading ?? false,
|
|
89
90
|
disablePast: props.disablePast ?? false,
|
|
90
91
|
disableFuture: props.disableFuture ?? false,
|
|
@@ -135,8 +136,8 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
135
136
|
reduceAnimations,
|
|
136
137
|
onMonthChange,
|
|
137
138
|
rangePosition: rangePositionProp,
|
|
138
|
-
defaultRangePosition:
|
|
139
|
-
onRangePositionChange:
|
|
139
|
+
defaultRangePosition: defaultRangePositionProp,
|
|
140
|
+
onRangePositionChange: onRangePositionChangeProp,
|
|
140
141
|
calendars,
|
|
141
142
|
currentMonthCalendarPosition = 1,
|
|
142
143
|
slots,
|
|
@@ -161,6 +162,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
161
162
|
onViewChange
|
|
162
163
|
} = props,
|
|
163
164
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
165
|
+
const rangePositionContext = useNullablePickerRangePositionContext();
|
|
164
166
|
const {
|
|
165
167
|
value,
|
|
166
168
|
handleValueChange,
|
|
@@ -169,6 +171,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
169
171
|
name: 'DateRangeCalendar',
|
|
170
172
|
timezone: timezoneProp,
|
|
171
173
|
value: valueProp,
|
|
174
|
+
referenceDate,
|
|
172
175
|
defaultValue,
|
|
173
176
|
onChange,
|
|
174
177
|
valueManager: rangeValueManager
|
|
@@ -189,15 +192,15 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
189
192
|
const id = useId();
|
|
190
193
|
const {
|
|
191
194
|
rangePosition,
|
|
192
|
-
|
|
195
|
+
setRangePosition
|
|
193
196
|
} = useRangePosition({
|
|
194
|
-
rangePosition: rangePositionProp,
|
|
195
|
-
defaultRangePosition:
|
|
196
|
-
onRangePositionChange:
|
|
197
|
+
rangePosition: rangePositionProp ?? rangePositionContext?.rangePosition,
|
|
198
|
+
defaultRangePosition: defaultRangePositionProp,
|
|
199
|
+
onRangePositionChange: onRangePositionChangeProp ?? rangePositionContext?.setRangePosition
|
|
197
200
|
});
|
|
198
201
|
const handleDatePositionChange = useEventCallback(position => {
|
|
199
202
|
if (rangePosition !== position) {
|
|
200
|
-
|
|
203
|
+
setRangePosition(position);
|
|
201
204
|
}
|
|
202
205
|
});
|
|
203
206
|
const handleSelectedDayChange = useEventCallback((newDate, selectionState, allowRangeFlip = false) => {
|
|
@@ -210,11 +213,12 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
210
213
|
range: value,
|
|
211
214
|
rangePosition,
|
|
212
215
|
allowRangeFlip,
|
|
213
|
-
shouldMergeDateAndTime: true
|
|
216
|
+
shouldMergeDateAndTime: true,
|
|
217
|
+
referenceDate
|
|
214
218
|
});
|
|
215
219
|
const isNextSectionAvailable = availableRangePositions.includes(nextSelection);
|
|
216
220
|
if (isNextSectionAvailable) {
|
|
217
|
-
|
|
221
|
+
setRangePosition(nextSelection);
|
|
218
222
|
}
|
|
219
223
|
const isFullRangeSelected = rangePosition === 'end' && isRangeValid(utils, newRange);
|
|
220
224
|
setValueAndGoToNextView(newRange, isFullRangeSelected || !isNextSectionAvailable ? 'finish' : 'partial', view);
|
|
@@ -226,7 +230,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
226
230
|
|
|
227
231
|
// Range going for the start of the start day to the end of the end day.
|
|
228
232
|
// This makes sure that `isWithinRange` works with any time in the start and end day.
|
|
229
|
-
const valueDayRange = React.useMemo(() => [
|
|
233
|
+
const valueDayRange = React.useMemo(() => [!utils.isValid(value[0]) ? value[0] : utils.startOfDay(value[0]), !utils.isValid(value[1]) ? value[1] : utils.endOfDay(value[1])], [value, utils]);
|
|
230
234
|
const _useDragRange = useDragRange({
|
|
231
235
|
disableDragEditing: shouldDisableDragEditing,
|
|
232
236
|
onDrop: handleDrop,
|
|
@@ -314,7 +318,7 @@ const DateRangeCalendar = /*#__PURE__*/React.forwardRef(function DateRangeCalend
|
|
|
314
318
|
const prevValue = React.useRef(null);
|
|
315
319
|
React.useEffect(() => {
|
|
316
320
|
const date = rangePosition === 'start' ? value[0] : value[1];
|
|
317
|
-
if (!
|
|
321
|
+
if (!utils.isValid(date)) {
|
|
318
322
|
return;
|
|
319
323
|
}
|
|
320
324
|
const prevDate = rangePosition === 'start' ? prevValue.current?.[0] : prevValue.current?.[1];
|
|
@@ -63,7 +63,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
63
63
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
64
64
|
className: PropTypes.string,
|
|
65
65
|
/**
|
|
66
|
-
* If `true`, the
|
|
66
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
67
67
|
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
68
68
|
*/
|
|
69
69
|
closeOnSelect: PropTypes.bool,
|
|
@@ -158,12 +158,10 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
158
158
|
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
159
159
|
/**
|
|
160
160
|
* Pass a ref to the `input` element.
|
|
161
|
-
* Ignored if the field has several inputs.
|
|
162
161
|
*/
|
|
163
162
|
inputRef: refType,
|
|
164
163
|
/**
|
|
165
164
|
* The label content.
|
|
166
|
-
* Ignored if the field has several inputs.
|
|
167
165
|
*/
|
|
168
166
|
label: PropTypes.node,
|
|
169
167
|
/**
|
|
@@ -189,7 +187,6 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
189
187
|
minDate: PropTypes.object,
|
|
190
188
|
/**
|
|
191
189
|
* Name attribute used by the `input` element in the Field.
|
|
192
|
-
* Ignored if the field has several inputs.
|
|
193
190
|
*/
|
|
194
191
|
name: PropTypes.string,
|
|
195
192
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseSingleInputFieldProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { DesktopDateRangePickerProps, DesktopDateRangePickerSlots, DesktopDateRangePickerSlotProps } from '../DesktopDateRangePicker';
|
|
3
3
|
import { MobileDateRangePickerProps, MobileDateRangePickerSlots, MobileDateRangePickerSlotProps } from '../MobileDateRangePicker';
|
|
4
|
-
import { DateRangeValidationError, RangeFieldSection } from '../models';
|
|
5
4
|
import { ValidateDateRangeProps } from '../validation';
|
|
6
5
|
export interface DateRangePickerSlots extends DesktopDateRangePickerSlots, MobileDateRangePickerSlots {
|
|
7
6
|
}
|
|
@@ -24,8 +23,13 @@ export interface DateRangePickerProps<TEnableAccessibleFieldDOMStructure extends
|
|
|
24
23
|
* @default {}
|
|
25
24
|
*/
|
|
26
25
|
slotProps?: DateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
|
|
26
|
+
/**
|
|
27
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
28
|
+
* @default `true` for desktop, `false` for mobile (based on the chosen wrapper and `desktopModeMediaQuery` prop).
|
|
29
|
+
*/
|
|
30
|
+
closeOnSelect?: boolean;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* Props the field can receive when used inside a date range picker (<DateRangePicker />, <DesktopDateRangePicker /> or <MobileDateRangePicker /> component).
|
|
30
34
|
*/
|
|
31
|
-
export type DateRangePickerFieldProps
|
|
35
|
+
export type DateRangePickerFieldProps = ValidateDateRangeProps & BaseSingleInputFieldProps<PickerRangeValue>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { BaseToolbarProps, ExportedBaseToolbarProps
|
|
3
|
-
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
2
|
+
import { BaseToolbarProps, ExportedBaseToolbarProps } from '@mui/x-date-pickers/internals';
|
|
4
3
|
import { DateRangePickerToolbarClasses } from './dateRangePickerToolbarClasses';
|
|
5
|
-
export interface DateRangePickerToolbarProps extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps
|
|
4
|
+
export interface DateRangePickerToolbarProps extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps, 'onChange' | 'isLandscape'> {
|
|
6
5
|
}
|
|
7
6
|
export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
8
7
|
/**
|
|
@@ -2,21 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["toolbarFormat", "className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Typography from '@mui/material/Typography';
|
|
10
10
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
|
-
import { PickersToolbar, PickersToolbarButton, useUtils } from '@mui/x-date-pickers/internals';
|
|
13
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
|
+
import { PickersToolbar, PickersToolbarButton, useUtils, useToolbarOwnerState } from '@mui/x-date-pickers/internals';
|
|
13
|
+
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
14
14
|
import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
|
|
15
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
-
const useUtilityClasses =
|
|
17
|
-
const {
|
|
18
|
-
classes
|
|
19
|
-
} = ownerState;
|
|
17
|
+
const useUtilityClasses = classes => {
|
|
20
18
|
const slots = {
|
|
21
19
|
root: ['root'],
|
|
22
20
|
container: ['container']
|
|
@@ -52,39 +50,50 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
|
|
|
52
50
|
name: 'MuiDateRangePickerToolbar'
|
|
53
51
|
});
|
|
54
52
|
const {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
toolbarFormat,
|
|
59
|
-
className
|
|
53
|
+
toolbarFormat: toolbarFormatProp,
|
|
54
|
+
className,
|
|
55
|
+
classes: classesProp
|
|
60
56
|
} = props,
|
|
61
57
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
58
|
+
const {
|
|
59
|
+
value
|
|
60
|
+
} = usePickerContext();
|
|
62
61
|
const translations = usePickerTranslations();
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
const ownerState = useToolbarOwnerState();
|
|
63
|
+
const {
|
|
64
|
+
rangePosition,
|
|
65
|
+
setRangePosition
|
|
66
|
+
} = usePickerRangePositionContext();
|
|
67
|
+
const classes = useUtilityClasses(classesProp);
|
|
68
|
+
|
|
69
|
+
// This can't be a default value when spreading because it breaks the API generation.
|
|
70
|
+
const toolbarFormat = toolbarFormatProp ?? utils.formats.shortDate;
|
|
71
|
+
const formatDate = (date, fallback) => {
|
|
72
|
+
if (!utils.isValid(date)) {
|
|
73
|
+
return fallback;
|
|
74
|
+
}
|
|
75
|
+
return utils.formatByString(date, toolbarFormat);
|
|
76
|
+
};
|
|
67
77
|
return /*#__PURE__*/_jsx(DateRangePickerToolbarRoot, _extends({}, other, {
|
|
68
78
|
toolbarTitle: translations.dateRangePickerToolbarTitle,
|
|
69
|
-
isLandscape: false,
|
|
70
79
|
className: clsx(classes.root, className),
|
|
71
80
|
ownerState: ownerState,
|
|
72
81
|
ref: ref,
|
|
73
82
|
children: /*#__PURE__*/_jsxs(DateRangePickerToolbarContainer, {
|
|
74
83
|
className: classes.container,
|
|
75
84
|
children: [/*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
76
|
-
variant:
|
|
77
|
-
value:
|
|
85
|
+
variant: value[0] == null ? 'h6' : 'h5',
|
|
86
|
+
value: formatDate(value[0], translations.start),
|
|
78
87
|
selected: rangePosition === 'start',
|
|
79
|
-
onClick: () =>
|
|
88
|
+
onClick: () => setRangePosition('start')
|
|
80
89
|
}), /*#__PURE__*/_jsxs(Typography, {
|
|
81
90
|
variant: "h5",
|
|
82
91
|
children: ["\xA0", '–', "\xA0"]
|
|
83
92
|
}), /*#__PURE__*/_jsx(PickersToolbarButton, {
|
|
84
|
-
variant:
|
|
85
|
-
value:
|
|
93
|
+
variant: value[1] == null ? 'h6' : 'h5',
|
|
94
|
+
value: formatDate(value[1], translations.end),
|
|
86
95
|
selected: rangePosition === 'end',
|
|
87
|
-
onClick: () =>
|
|
96
|
+
onClick: () => setRangePosition('end')
|
|
88
97
|
})]
|
|
89
98
|
})
|
|
90
99
|
}));
|
|
@@ -99,31 +108,11 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
99
108
|
*/
|
|
100
109
|
classes: PropTypes.object,
|
|
101
110
|
className: PropTypes.string,
|
|
102
|
-
/**
|
|
103
|
-
* If `true`, the component is disabled.
|
|
104
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
105
|
-
* @default false
|
|
106
|
-
*/
|
|
107
|
-
disabled: PropTypes.bool,
|
|
108
111
|
/**
|
|
109
112
|
* If `true`, show the toolbar even in desktop mode.
|
|
110
113
|
* @default `true` for Desktop, `false` for Mobile.
|
|
111
114
|
*/
|
|
112
115
|
hidden: PropTypes.bool,
|
|
113
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
114
|
-
/**
|
|
115
|
-
* Callback called when a toolbar is clicked
|
|
116
|
-
* @template TView
|
|
117
|
-
* @param {TView} view The view to open
|
|
118
|
-
*/
|
|
119
|
-
onViewChange: PropTypes.func.isRequired,
|
|
120
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
121
|
-
/**
|
|
122
|
-
* If `true`, the component is read-only.
|
|
123
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
readOnly: PropTypes.bool,
|
|
127
116
|
/**
|
|
128
117
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
129
118
|
*/
|
|
@@ -137,15 +126,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
|
|
|
137
126
|
* Toolbar value placeholder—it is displayed when the value is empty.
|
|
138
127
|
* @default "––"
|
|
139
128
|
*/
|
|
140
|
-
toolbarPlaceholder: PropTypes.node
|
|
141
|
-
value: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
142
|
-
/**
|
|
143
|
-
* Currently visible picker view.
|
|
144
|
-
*/
|
|
145
|
-
view: PropTypes.oneOf(['day']).isRequired,
|
|
146
|
-
/**
|
|
147
|
-
* Available views.
|
|
148
|
-
*/
|
|
149
|
-
views: PropTypes.arrayOf(PropTypes.oneOf(['day'])).isRequired
|
|
129
|
+
toolbarPlaceholder: PropTypes.node
|
|
150
130
|
} : void 0;
|
|
151
131
|
export { DateRangePickerToolbar };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { LocalizedComponent } from '@mui/x-date-pickers/locales';
|
|
4
|
-
import {
|
|
4
|
+
import { BasePickerInputProps, PickerViewRendererLookup, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { DateRangeValidationError } from '../models';
|
|
6
6
|
import { DateRangeCalendarSlots, DateRangeCalendarSlotProps, ExportedDateRangeCalendarProps } from '../DateRangeCalendar';
|
|
7
7
|
import { DateRangePickerToolbarProps, ExportedDateRangePickerToolbarProps } from './DateRangePickerToolbar';
|
|
8
8
|
import { DateRangeViewRendererProps } from '../dateRangeViewRenderers';
|
|
9
|
+
import { ValidateDateRangePropsToDefault } from '../validation/validateDateRange';
|
|
9
10
|
export interface BaseDateRangePickerSlots extends DateRangeCalendarSlots {
|
|
10
11
|
/**
|
|
11
12
|
* Custom component for the toolbar rendered above the views.
|
|
@@ -32,8 +33,8 @@ export interface BaseDateRangePickerProps extends Omit<BasePickerInputProps<Pick
|
|
|
32
33
|
* If `null`, the section will only have field editing.
|
|
33
34
|
* If `undefined`, internally defined view will be used.
|
|
34
35
|
*/
|
|
35
|
-
viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'
|
|
36
|
+
viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'>>>;
|
|
36
37
|
}
|
|
37
|
-
type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props,
|
|
38
|
+
type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props, ValidateDateRangePropsToDefault>>;
|
|
38
39
|
export declare function useDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps>(props: Props, name: string): UseDateRangePickerDefaultizedProps<Props>;
|
|
39
40
|
export {};
|
|
@@ -68,8 +68,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
68
68
|
calendars: PropTypes.oneOf([1, 2, 3]),
|
|
69
69
|
className: PropTypes.string,
|
|
70
70
|
/**
|
|
71
|
-
* If `true`, the
|
|
72
|
-
* @default
|
|
71
|
+
* If `true`, the Picker will close after submitting the full date.
|
|
72
|
+
* @default false
|
|
73
73
|
*/
|
|
74
74
|
closeOnSelect: PropTypes.bool,
|
|
75
75
|
/**
|
|
@@ -168,12 +168,10 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
168
168
|
formatDensity: PropTypes.oneOf(['dense', 'spacious']),
|
|
169
169
|
/**
|
|
170
170
|
* Pass a ref to the `input` element.
|
|
171
|
-
* Ignored if the field has several inputs.
|
|
172
171
|
*/
|
|
173
172
|
inputRef: refType,
|
|
174
173
|
/**
|
|
175
174
|
* The label content.
|
|
176
|
-
* Ignored if the field has several inputs.
|
|
177
175
|
*/
|
|
178
176
|
label: PropTypes.node,
|
|
179
177
|
/**
|
|
@@ -222,7 +220,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
222
220
|
minutesStep: PropTypes.number,
|
|
223
221
|
/**
|
|
224
222
|
* Name attribute used by the `input` element in the Field.
|
|
225
|
-
* Ignored if the field has several inputs.
|
|
226
223
|
*/
|
|
227
224
|
name: PropTypes.string,
|
|
228
225
|
/**
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseSingleInputFieldProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
2
2
|
import { DesktopDateTimeRangePickerProps, DesktopDateTimeRangePickerSlots, DesktopDateTimeRangePickerSlotProps } from '../DesktopDateTimeRangePicker';
|
|
3
3
|
import { MobileDateTimeRangePickerProps, MobileDateTimeRangePickerSlots, MobileDateTimeRangePickerSlotProps } from '../MobileDateTimeRangePicker';
|
|
4
|
-
import { DateTimeRangeValidationError, RangeFieldSection } from '../models';
|
|
5
4
|
import type { ValidateDateTimeRangeProps } from '../validation';
|
|
6
5
|
export interface DateTimeRangePickerSlots extends DesktopDateTimeRangePickerSlots, MobileDateTimeRangePickerSlots {
|
|
7
6
|
}
|
|
@@ -28,4 +27,4 @@ export interface DateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure ext
|
|
|
28
27
|
/**
|
|
29
28
|
* Props the field can receive when used inside a date time range picker (<DateTimeRangePicker />, <DesktopDateTimeRangePicker /> or <MobileDateTimeRangePicker /> component).
|
|
30
29
|
*/
|
|
31
|
-
export type DateTimeRangePickerFieldProps
|
|
30
|
+
export type DateTimeRangePickerFieldProps = ValidateDateTimeRangeProps & BaseSingleInputFieldProps<PickerRangeValue>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
|
|
3
3
|
import { DateTimeRangePickerTabsClasses } from './dateTimeRangePickerTabsClasses';
|
|
4
|
-
import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
|
|
5
4
|
export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsProps {
|
|
6
5
|
/**
|
|
7
6
|
* Toggles visibility of the tabs allowing view switching.
|
|
@@ -12,18 +11,18 @@ export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsPr
|
|
|
12
11
|
* Date tab icon.
|
|
13
12
|
* @default DateRangeIcon
|
|
14
13
|
*/
|
|
15
|
-
dateIcon?: React.ReactElement
|
|
14
|
+
dateIcon?: React.ReactElement<any>;
|
|
16
15
|
/**
|
|
17
16
|
* Time tab icon.
|
|
18
17
|
* @default TimeIcon
|
|
19
18
|
*/
|
|
20
|
-
timeIcon?: React.ReactElement
|
|
19
|
+
timeIcon?: React.ReactElement<any>;
|
|
21
20
|
/**
|
|
22
21
|
* Override or extend the styles applied to the component.
|
|
23
22
|
*/
|
|
24
23
|
classes?: Partial<DateTimeRangePickerTabsClasses>;
|
|
25
24
|
}
|
|
26
|
-
export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps
|
|
25
|
+
export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps {
|
|
27
26
|
}
|
|
28
27
|
declare const DateTimeRangePickerTabs: {
|
|
29
28
|
(inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
|
|
@@ -7,11 +7,12 @@ import { styled, useThemeProps } from '@mui/material/styles';
|
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
8
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
9
9
|
import { TimeIcon, DateRangeIcon, ArrowLeftIcon, ArrowRightIcon } from '@mui/x-date-pickers/icons';
|
|
10
|
-
import { isDatePickerView } from '@mui/x-date-pickers/internals';
|
|
11
|
-
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
10
|
+
import { isDatePickerView, usePickerPrivateContext } from '@mui/x-date-pickers/internals';
|
|
11
|
+
import { usePickerContext, usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
12
12
|
import IconButton from '@mui/material/IconButton';
|
|
13
13
|
import Button from '@mui/material/Button';
|
|
14
14
|
import { getDateTimeRangePickerTabsUtilityClass } from "./dateTimeRangePickerTabsClasses.js";
|
|
15
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
15
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
17
|
const viewToTab = (view, rangePosition) => {
|
|
17
18
|
if (isDatePickerView(view)) {
|
|
@@ -25,10 +26,7 @@ const tabToView = tab => {
|
|
|
25
26
|
}
|
|
26
27
|
return 'hours';
|
|
27
28
|
};
|
|
28
|
-
const useUtilityClasses =
|
|
29
|
-
const {
|
|
30
|
-
classes
|
|
31
|
-
} = ownerState;
|
|
29
|
+
const useUtilityClasses = classes => {
|
|
32
30
|
const slots = {
|
|
33
31
|
root: ['root'],
|
|
34
32
|
tabButton: ['tabButton'],
|
|
@@ -72,18 +70,26 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
72
70
|
});
|
|
73
71
|
const {
|
|
74
72
|
dateIcon = /*#__PURE__*/_jsx(DateRangeIcon, {}),
|
|
75
|
-
onViewChange,
|
|
76
73
|
timeIcon = /*#__PURE__*/_jsx(TimeIcon, {}),
|
|
77
|
-
view,
|
|
78
74
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
79
|
-
rangePosition,
|
|
80
|
-
onRangePositionChange,
|
|
81
75
|
className,
|
|
76
|
+
classes: classesProp,
|
|
82
77
|
sx
|
|
83
78
|
} = props;
|
|
84
79
|
const translations = usePickerTranslations();
|
|
85
|
-
const
|
|
86
|
-
|
|
80
|
+
const {
|
|
81
|
+
ownerState
|
|
82
|
+
} = usePickerPrivateContext();
|
|
83
|
+
const {
|
|
84
|
+
view,
|
|
85
|
+
setView
|
|
86
|
+
} = usePickerContext();
|
|
87
|
+
const classes = useUtilityClasses(classesProp);
|
|
88
|
+
const {
|
|
89
|
+
rangePosition,
|
|
90
|
+
setRangePosition
|
|
91
|
+
} = usePickerRangePositionContext();
|
|
92
|
+
const value = React.useMemo(() => view == null ? null : viewToTab(view, rangePosition), [view, rangePosition]);
|
|
87
93
|
const isPreviousHidden = value === 'start-date';
|
|
88
94
|
const isNextHidden = value === 'end-time';
|
|
89
95
|
const tabLabel = React.useMemo(() => {
|
|
@@ -102,26 +108,34 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
102
108
|
}, [translations.endDate, translations.endTime, translations.startDate, translations.startTime, value]);
|
|
103
109
|
const handleRangePositionChange = useEventCallback(newTab => {
|
|
104
110
|
if (newTab.includes('start')) {
|
|
105
|
-
|
|
111
|
+
setRangePosition('start');
|
|
106
112
|
} else {
|
|
107
|
-
|
|
113
|
+
setRangePosition('end');
|
|
108
114
|
}
|
|
109
115
|
});
|
|
110
116
|
const changeToPreviousTab = useEventCallback(() => {
|
|
111
|
-
const previousTab = tabOptions[tabOptions.indexOf(value) - 1];
|
|
112
|
-
|
|
117
|
+
const previousTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) - 1];
|
|
118
|
+
setView(tabToView(previousTab));
|
|
113
119
|
handleRangePositionChange(previousTab);
|
|
114
120
|
});
|
|
115
121
|
const changeToNextTab = useEventCallback(() => {
|
|
116
|
-
const nextTab = tabOptions[tabOptions.indexOf(value) + 1];
|
|
117
|
-
|
|
122
|
+
const nextTab = value == null ? tabOptions[0] : tabOptions[tabOptions.indexOf(value) + 1];
|
|
123
|
+
setView(tabToView(nextTab));
|
|
118
124
|
handleRangePositionChange(nextTab);
|
|
119
125
|
});
|
|
120
126
|
if (hidden) {
|
|
121
127
|
return null;
|
|
122
128
|
}
|
|
129
|
+
let startIcon;
|
|
130
|
+
if (view == null) {
|
|
131
|
+
startIcon = null;
|
|
132
|
+
} else if (isDatePickerView(view)) {
|
|
133
|
+
startIcon = dateIcon;
|
|
134
|
+
} else {
|
|
135
|
+
startIcon = timeIcon;
|
|
136
|
+
}
|
|
123
137
|
return /*#__PURE__*/_jsxs(DateTimeRangePickerTabsRoot, {
|
|
124
|
-
ownerState:
|
|
138
|
+
ownerState: ownerState,
|
|
125
139
|
className: clsx(classes.root, className),
|
|
126
140
|
sx: sx,
|
|
127
141
|
children: [!isPreviousHidden ? /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -132,7 +146,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
|
|
|
132
146
|
}) : /*#__PURE__*/_jsx(DateTimeRangePickerTabFiller, {
|
|
133
147
|
className: classes.filler
|
|
134
148
|
}), /*#__PURE__*/_jsx(DateTimeRangePickerTab, {
|
|
135
|
-
startIcon:
|
|
149
|
+
startIcon: startIcon,
|
|
136
150
|
className: classes.tabButton,
|
|
137
151
|
size: "large",
|
|
138
152
|
children: tabLabel
|
|
@@ -166,14 +180,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerTabs.propTypes = {
|
|
|
166
180
|
* @default `window.innerHeight < 667` for `DesktopDateTimeRangePicker` and `MobileDateTimeRangePicker`
|
|
167
181
|
*/
|
|
168
182
|
hidden: PropTypes.bool,
|
|
169
|
-
onRangePositionChange: PropTypes.func.isRequired,
|
|
170
|
-
/**
|
|
171
|
-
* Callback called when a tab is clicked.
|
|
172
|
-
* @template TView
|
|
173
|
-
* @param {TView} view The view to open
|
|
174
|
-
*/
|
|
175
|
-
onViewChange: PropTypes.func.isRequired,
|
|
176
|
-
rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
|
|
177
183
|
/**
|
|
178
184
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
179
185
|
*/
|
|
@@ -182,10 +188,6 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePickerTabs.propTypes = {
|
|
|
182
188
|
* Time tab icon.
|
|
183
189
|
* @default TimeIcon
|
|
184
190
|
*/
|
|
185
|
-
timeIcon: PropTypes.element
|
|
186
|
-
/**
|
|
187
|
-
* Currently visible picker view.
|
|
188
|
-
*/
|
|
189
|
-
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired
|
|
191
|
+
timeIcon: PropTypes.element
|
|
190
192
|
} : void 0;
|
|
191
193
|
export { DateTimeRangePickerTabs };
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
2
|
import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
view:
|
|
7
|
-
|
|
8
|
-
views: readonly TView[];
|
|
3
|
+
export type DateTimeRangePickerTimeWrapperProps<TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TimeViewWithMeridiem>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
|
|
4
|
+
view: TimeViewWithMeridiem;
|
|
5
|
+
onViewChange?: (view: TimeViewWithMeridiem) => void;
|
|
6
|
+
views: readonly TimeViewWithMeridiem[];
|
|
9
7
|
value?: PickerRangeValue;
|
|
10
8
|
defaultValue?: PickerRangeValue;
|
|
11
|
-
onChange?: (value: PickerRangeValue, selectionState: PickerSelectionState, selectedView:
|
|
12
|
-
viewRenderer?: PickerViewRenderer<PickerRangeValue,
|
|
13
|
-
openTo?:
|
|
9
|
+
onChange?: (value: PickerRangeValue, selectionState: PickerSelectionState, selectedView: TimeViewWithMeridiem) => void;
|
|
10
|
+
viewRenderer?: PickerViewRenderer<PickerRangeValue, TComponentProps> | null;
|
|
11
|
+
openTo?: TimeViewWithMeridiem;
|
|
14
12
|
};
|
|
15
13
|
/**
|
|
16
14
|
* @ignore - internal component.
|
|
17
15
|
*/
|
|
18
|
-
declare function DateTimeRangePickerTimeWrapper<
|
|
16
|
+
declare function DateTimeRangePickerTimeWrapper<TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TimeViewWithMeridiem>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TComponentProps>): import("react").ReactNode;
|
|
19
17
|
export { DateTimeRangePickerTimeWrapper };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["viewRenderer", "value", "onChange", "defaultValue", "onViewChange", "views", "className"];
|
|
4
4
|
import { isInternalTimeView, useUtils } from '@mui/x-date-pickers/internals';
|
|
5
5
|
import { isRangeValid } from "../internals/utils/date-utils.js";
|
|
6
6
|
import { calculateRangeChange } from "../internals/utils/date-range-manager.js";
|
|
7
|
+
import { usePickerRangePositionContext } from "../hooks/index.js";
|
|
7
8
|
/**
|
|
8
9
|
* @ignore - internal component.
|
|
9
10
|
*/
|
|
10
|
-
function DateTimeRangePickerTimeWrapper(props
|
|
11
|
+
function DateTimeRangePickerTimeWrapper(props) {
|
|
11
12
|
const utils = useUtils();
|
|
12
13
|
const {
|
|
13
|
-
rangePosition,
|
|
14
|
-
onRangePositionChange,
|
|
15
14
|
viewRenderer,
|
|
16
15
|
value,
|
|
17
16
|
onChange,
|
|
@@ -20,6 +19,10 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
|
20
19
|
views
|
|
21
20
|
} = props,
|
|
22
21
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
rangePosition,
|
|
24
|
+
setRangePosition
|
|
25
|
+
} = usePickerRangePositionContext();
|
|
23
26
|
if (!viewRenderer) {
|
|
24
27
|
return null;
|
|
25
28
|
}
|
|
@@ -42,12 +45,11 @@ function DateTimeRangePickerTimeWrapper(props, ref) {
|
|
|
42
45
|
// reset view to the first time view and swap range position after selecting the last time view (start or end position)
|
|
43
46
|
if (selectedView === timeViews[timeViews.length - 1] && onViewChange) {
|
|
44
47
|
onViewChange(views[0]);
|
|
45
|
-
|
|
48
|
+
setRangePosition(rangePosition === 'start' ? 'end' : 'start');
|
|
46
49
|
}
|
|
47
50
|
onChange(newRange, isFullRangeSelected ? 'finish' : 'partial', selectedView);
|
|
48
51
|
};
|
|
49
52
|
return viewRenderer(_extends({}, other, {
|
|
50
|
-
ref,
|
|
51
53
|
views,
|
|
52
54
|
onViewChange,
|
|
53
55
|
value: currentValue,
|