@mui/x-date-pickers-pro 7.22.3 → 8.0.0-alpha.1

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.
Files changed (170) hide show
  1. package/CHANGELOG.md +348 -12
  2. package/DateRangeCalendar/DateRangeCalendar.d.ts +1 -2
  3. package/DateRangeCalendar/DateRangeCalendar.js +24 -22
  4. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +24 -36
  5. package/DateRangeCalendar/useDragRange.d.ts +10 -9
  6. package/DateRangeCalendar/useDragRange.js +3 -3
  7. package/DateRangePicker/DateRangePicker.d.ts +1 -2
  8. package/DateRangePicker/DateRangePicker.js +12 -8
  9. package/DateRangePicker/DateRangePicker.types.d.ts +12 -6
  10. package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -5
  11. package/DateRangePicker/DateRangePickerToolbar.js +2 -4
  12. package/DateRangePicker/index.d.ts +1 -1
  13. package/DateRangePicker/shared.d.ts +12 -12
  14. package/DateRangePickerDay/DateRangePickerDay.d.ts +2 -3
  15. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -2
  16. package/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  17. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +12 -6
  18. package/DateTimeRangePicker/DateTimeRangePickerTabs.d.ts +1 -2
  19. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
  20. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +8 -9
  21. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +4 -6
  22. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -7
  23. package/DateTimeRangePicker/index.d.ts +1 -1
  24. package/DateTimeRangePicker/shared.d.ts +13 -13
  25. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -2
  26. package/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  27. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +6 -7
  28. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -2
  29. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  30. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +6 -7
  31. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -2
  32. package/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  33. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +6 -7
  34. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -2
  35. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  36. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +6 -7
  37. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -2
  38. package/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  39. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +9 -10
  40. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -2
  41. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  42. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +9 -10
  43. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -2
  44. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  45. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +9 -10
  46. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.d.ts +1 -2
  47. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  48. package/PickersRangeCalendarHeader/PickersRangeCalendarHeader.types.d.ts +3 -3
  49. package/README.md +4 -4
  50. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +1 -2
  51. package/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  52. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +8 -8
  53. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -2
  54. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +1 -2
  55. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  56. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +8 -8
  57. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -2
  58. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +1 -2
  59. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  60. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +8 -8
  61. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -2
  62. package/StaticDateRangePicker/StaticDateRangePicker.d.ts +1 -2
  63. package/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  64. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +6 -7
  65. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +2 -3
  66. package/index.d.ts +0 -7
  67. package/index.js +1 -7
  68. package/internals/hooks/models/useRangePicker.d.ts +6 -7
  69. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -2
  70. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +22 -16
  71. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +6 -7
  72. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +16 -14
  73. package/internals/hooks/useEnrichedRangePickerFieldProps.js +13 -13
  74. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -2
  75. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +23 -17
  76. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +6 -7
  77. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +1 -1
  78. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -2
  79. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
  80. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +1 -2
  81. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
  82. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -2
  83. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
  84. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -2
  85. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -6
  86. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +8 -9
  87. package/internals/models/dateRange.d.ts +3 -4
  88. package/internals/models/dateTimeRange.d.ts +5 -10
  89. package/internals/models/fields.d.ts +26 -0
  90. package/internals/models/fields.js +1 -0
  91. package/internals/models/timeRange.d.ts +5 -9
  92. package/internals/utils/date-range-manager.d.ts +11 -10
  93. package/internals/utils/date-utils.d.ts +5 -5
  94. package/internals/utils/releaseInfo.js +1 -1
  95. package/internals/utils/valueManagers.d.ts +5 -6
  96. package/models/dateRange.d.ts +4 -5
  97. package/models/fields.d.ts +5 -32
  98. package/models/range.d.ts +1 -1
  99. package/modern/DateRangeCalendar/DateRangeCalendar.js +24 -22
  100. package/modern/DateRangeCalendar/useDragRange.js +3 -3
  101. package/modern/DateRangePicker/DateRangePicker.js +12 -8
  102. package/modern/DateRangePicker/DateRangePickerToolbar.js +2 -4
  103. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  104. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
  105. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -7
  106. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  107. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  108. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  109. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  110. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  111. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  112. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  113. package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  114. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  115. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  116. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  117. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  118. package/modern/index.js +1 -7
  119. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +22 -16
  120. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +13 -13
  121. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +23 -17
  122. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
  123. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
  124. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
  125. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +6 -6
  126. package/modern/internals/models/fields.js +1 -0
  127. package/modern/internals/utils/releaseInfo.js +1 -1
  128. package/modern/validation/validateDateRange.js +5 -0
  129. package/modern/validation/validateDateTimeRange.js +5 -0
  130. package/modern/validation/validateTimeRange.js +5 -0
  131. package/node/DateRangeCalendar/DateRangeCalendar.js +23 -21
  132. package/node/DateRangeCalendar/useDragRange.js +3 -3
  133. package/node/DateRangePicker/DateRangePicker.js +12 -8
  134. package/node/DateRangePicker/DateRangePickerToolbar.js +1 -3
  135. package/node/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  136. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -1
  137. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -6
  138. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  139. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  140. package/node/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  141. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  142. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  143. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  144. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  145. package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
  146. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  147. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  148. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  149. package/node/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  150. package/node/index.js +2 -41
  151. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +21 -15
  152. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +12 -12
  153. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
  154. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +2 -0
  155. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +2 -0
  156. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +3 -1
  157. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
  158. package/node/internals/models/fields.js +5 -0
  159. package/node/internals/utils/releaseInfo.js +1 -1
  160. package/node/validation/validateDateRange.js +4 -0
  161. package/node/validation/validateDateTimeRange.js +4 -0
  162. package/node/validation/validateTimeRange.js +4 -0
  163. package/package.json +7 -7
  164. package/themeAugmentation/props.d.ts +16 -17
  165. package/validation/validateDateRange.d.ts +9 -5
  166. package/validation/validateDateRange.js +5 -0
  167. package/validation/validateDateTimeRange.d.ts +11 -6
  168. package/validation/validateDateTimeRange.js +5 -0
  169. package/validation/validateTimeRange.d.ts +9 -4
  170. package/validation/validateTimeRange.js +5 -0
@@ -2,52 +2,41 @@ import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { SlotComponentProps } from '@mui/utils';
4
4
  import { Theme } from '@mui/material/styles';
5
- import { PickerValidDate, TimezoneProps } from '@mui/x-date-pickers/models';
5
+ import { DefaultizedProps } from '@mui/x-internals/types';
6
+ import { PickerOwnerState, PickerValidDate, TimezoneProps } from '@mui/x-date-pickers/models';
6
7
  import { PickersCalendarHeader, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps } from '@mui/x-date-pickers/PickersCalendarHeader';
7
- import { BaseDateValidationProps, DefaultizedProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, DayCalendarProps, ExportedUseViewsOptions } from '@mui/x-date-pickers/internals';
8
- import { DayRangeValidationProps } from '../internals/models/dateRange';
9
- import { DateRange, RangePosition } from '../models';
8
+ import { PickerDayOwnerState } from '@mui/x-date-pickers/DateCalendar';
9
+ import { BaseDateValidationProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, ExportedUseViewsOptions, PickerRangeValue, FormProps } from '@mui/x-date-pickers/internals';
10
+ import { RangePosition } from '../models';
10
11
  import { DateRangeCalendarClasses } from './dateRangeCalendarClasses';
11
12
  import { DateRangePickerDay, DateRangePickerDayProps } from '../DateRangePickerDay';
12
13
  import { UseRangePositionProps } from '../internals/hooks/useRangePosition';
13
14
  import { PickersRangeCalendarHeaderProps } from '../PickersRangeCalendarHeader';
14
- export interface DateRangeCalendarSlots<TDate extends PickerValidDate> extends PickersArrowSwitcherSlots, Omit<DayCalendarSlots<TDate>, 'day'>, PickersCalendarHeaderSlots {
15
+ import { ExportedValidateDateRangeProps } from '../validation/validateDateRange';
16
+ export interface DateRangeCalendarSlots extends PickersArrowSwitcherSlots, Omit<DayCalendarSlots, 'day'>, PickersCalendarHeaderSlots {
15
17
  /**
16
18
  * Custom component for calendar header.
17
19
  * Check the [PickersCalendarHeader](https://mui.com/x/api/date-pickers/pickers-calendar-header/) component.
18
20
  * @default PickersCalendarHeader
19
21
  */
20
- calendarHeader?: React.ElementType<PickersRangeCalendarHeaderProps<TDate>>;
22
+ calendarHeader?: React.ElementType<PickersRangeCalendarHeaderProps>;
21
23
  /**
22
24
  * Custom component for day in range pickers.
23
25
  * Check the [DateRangePickersDay](https://mui.com/x/api/date-pickers/date-range-picker-day/) component.
24
26
  * @default DateRangePickersDay
25
27
  */
26
- day?: React.ElementType<DateRangePickerDayProps<TDate>>;
28
+ day?: React.ElementType<DateRangePickerDayProps>;
27
29
  }
28
- export interface DateRangeCalendarSlotProps<TDate extends PickerValidDate> extends PickersArrowSwitcherSlotProps, Omit<DayCalendarSlotProps<TDate>, 'day'>, PickersCalendarHeaderSlotProps<TDate> {
29
- calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, DateRangeCalendarProps<TDate>>;
30
- day?: SlotComponentProps<typeof DateRangePickerDay, {}, DayCalendarProps<TDate> & {
31
- day: TDate;
32
- selected: boolean;
33
- }>;
30
+ export interface DateRangeCalendarSlotProps extends PickersArrowSwitcherSlotProps, Omit<DayCalendarSlotProps, 'day'>, PickersCalendarHeaderSlotProps {
31
+ calendarHeader?: SlotComponentProps<typeof PickersCalendarHeader, {}, DateRangeCalendarOwnerState>;
32
+ day?: SlotComponentProps<typeof DateRangePickerDay, {}, PickerDayOwnerState>;
34
33
  }
35
- export interface ExportedDateRangeCalendarProps<TDate extends PickerValidDate> extends ExportedDayCalendarProps<TDate>, BaseDateValidationProps<TDate>, DayRangeValidationProps<TDate>, TimezoneProps {
34
+ export interface ExportedDateRangeCalendarProps extends ExportedDayCalendarProps, ExportedValidateDateRangeProps, TimezoneProps, FormProps {
36
35
  /**
37
36
  * If `true`, after selecting `start` date calendar will not automatically switch to the month of `end` date.
38
37
  * @default false
39
38
  */
40
39
  disableAutoMonthSwitching?: boolean;
41
- /**
42
- * If `true`, the picker and text field are disabled.
43
- * @default false
44
- */
45
- disabled?: boolean;
46
- /**
47
- * Make picker read only.
48
- * @default false
49
- */
50
- readOnly?: boolean;
51
40
  /**
52
41
  * If `true`, disable heavy animations.
53
42
  * @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
@@ -55,10 +44,9 @@ export interface ExportedDateRangeCalendarProps<TDate extends PickerValidDate> e
55
44
  reduceAnimations?: boolean;
56
45
  /**
57
46
  * Callback fired on month change.
58
- * @template TDate
59
- * @param {TDate} month The new month.
47
+ * @param {PickerValidDate} month The new month.
60
48
  */
61
- onMonthChange?: (month: TDate) => void;
49
+ onMonthChange?: (month: PickerValidDate) => void;
62
50
  /**
63
51
  * Position the current month is rendered in.
64
52
  * @default 1
@@ -70,22 +58,22 @@ export interface ExportedDateRangeCalendarProps<TDate extends PickerValidDate> e
70
58
  */
71
59
  disableDragEditing?: boolean;
72
60
  }
73
- export interface DateRangeCalendarProps<TDate extends PickerValidDate> extends ExportedDateRangeCalendarProps<TDate>, UseRangePositionProps, ExportedUseViewsOptions<'day'> {
61
+ export interface DateRangeCalendarProps extends ExportedDateRangeCalendarProps, UseRangePositionProps, ExportedUseViewsOptions<PickerRangeValue, 'day'> {
74
62
  /**
75
63
  * The selected value.
76
64
  * Used when the component is controlled.
77
65
  */
78
- value?: DateRange<TDate>;
66
+ value?: PickerRangeValue;
79
67
  /**
80
68
  * The default selected value.
81
69
  * Used when the component is not controlled.
82
70
  */
83
- defaultValue?: DateRange<TDate>;
71
+ defaultValue?: PickerRangeValue;
84
72
  /**
85
73
  * The date used to generate the new value when both `value` and `defaultValue` are empty.
86
74
  * @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`.
87
75
  */
88
- referenceDate?: TDate;
76
+ referenceDate?: PickerValidDate;
89
77
  /**
90
78
  * The number of calendars to render.
91
79
  * @default 2
@@ -104,12 +92,12 @@ export interface DateRangeCalendarProps<TDate extends PickerValidDate> extends E
104
92
  * Overridable component slots.
105
93
  * @default {}
106
94
  */
107
- slots?: DateRangeCalendarSlots<TDate>;
95
+ slots?: DateRangeCalendarSlots;
108
96
  /**
109
97
  * The props used for each component slot.
110
98
  * @default {}
111
99
  */
112
- slotProps?: DateRangeCalendarSlotProps<TDate>;
100
+ slotProps?: DateRangeCalendarSlotProps;
113
101
  /**
114
102
  * Range positions available for selection.
115
103
  * This list is checked against when checking if a next range position can be selected.
@@ -119,7 +107,7 @@ export interface DateRangeCalendarProps<TDate extends PickerValidDate> extends E
119
107
  */
120
108
  availableRangePositions?: RangePosition[];
121
109
  }
122
- export interface DateRangeCalendarOwnerState<TDate extends PickerValidDate> extends DateRangeCalendarProps<TDate> {
123
- isDragging: boolean;
110
+ export interface DateRangeCalendarOwnerState extends PickerOwnerState {
111
+ isDraggingDay: boolean;
124
112
  }
125
- export type DateRangeCalendarDefaultizedProps<TDate extends PickerValidDate> = DefaultizedProps<DateRangeCalendarProps<TDate>, 'views' | 'openTo' | 'reduceAnimations' | 'calendars' | 'disableDragEditing' | 'availableRangePositions' | keyof BaseDateValidationProps<TDate>>;
113
+ export type DateRangeCalendarDefaultizedProps = DefaultizedProps<DateRangeCalendarProps, 'views' | 'openTo' | 'reduceAnimations' | 'calendars' | 'disableDragEditing' | 'availableRangePositions' | keyof BaseDateValidationProps>;
@@ -1,15 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { MuiPickersAdapter, PickersTimezone, PickerValidDate } from '@mui/x-date-pickers/models';
3
- import { DateRange, RangePosition } from '../models';
4
- interface UseDragRangeParams<TDate extends PickerValidDate> {
3
+ import { PickerRangeValue } from '@mui/x-date-pickers/internals';
4
+ import { RangePosition } from '../models';
5
+ interface UseDragRangeParams {
5
6
  disableDragEditing?: boolean;
6
- utils: MuiPickersAdapter<TDate>;
7
- setRangeDragDay: (value: TDate | null) => void;
7
+ utils: MuiPickersAdapter;
8
+ setRangeDragDay: (value: PickerValidDate | null) => void;
8
9
  setIsDragging: (value: boolean) => void;
9
10
  isDragging: boolean;
10
11
  onDatePositionChange: (position: RangePosition) => void;
11
- onDrop: (newDate: TDate) => void;
12
- dateRange: DateRange<TDate>;
12
+ onDrop: (newDate: PickerValidDate) => void;
13
+ dateRange: PickerRangeValue;
13
14
  timezone: PickersTimezone;
14
15
  }
15
16
  interface UseDragRangeEvents {
@@ -23,10 +24,10 @@ interface UseDragRangeEvents {
23
24
  onTouchMove?: React.TouchEventHandler<HTMLButtonElement>;
24
25
  onTouchEnd?: React.TouchEventHandler<HTMLButtonElement>;
25
26
  }
26
- interface UseDragRangeResponse<TDate extends PickerValidDate> extends UseDragRangeEvents {
27
+ interface UseDragRangeResponse extends UseDragRangeEvents {
27
28
  isDragging: boolean;
28
- rangeDragDay: TDate | null;
29
+ rangeDragDay: PickerValidDate | null;
29
30
  draggingDatePosition: RangePosition | null;
30
31
  }
31
- export declare const useDragRange: <TDate extends PickerValidDate>({ disableDragEditing, utils, onDatePositionChange, onDrop, dateRange, timezone, }: Omit<UseDragRangeParams<TDate>, "setRangeDragDay" | "setIsDragging" | "isDragging">) => UseDragRangeResponse<TDate>;
32
+ export declare const useDragRange: ({ disableDragEditing, utils, onDatePositionChange, onDrop, dateRange, timezone, }: Omit<UseDragRangeParams, "setRangeDragDay" | "setIsDragging" | "isDragging">) => UseDragRangeResponse;
32
33
  export {};
@@ -214,9 +214,9 @@ export const useDragRange = ({
214
214
  }) => {
215
215
  const [isDragging, setIsDragging] = React.useState(false);
216
216
  const [rangeDragDay, setRangeDragDay] = React.useState(null);
217
- const handleRangeDragDayChange = useEventCallback(val => {
218
- if (!utils.isEqual(val, rangeDragDay)) {
219
- setRangeDragDay(val);
217
+ const handleRangeDragDayChange = useEventCallback(newValue => {
218
+ if (!utils.isEqual(newValue, rangeDragDay)) {
219
+ setRangeDragDay(newValue);
220
220
  }
221
221
  });
222
222
  const draggingDatePosition = React.useMemo(() => {
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
2
  import { DateRangePickerProps } from './DateRangePicker.types';
4
- type DatePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: DateRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
3
+ type DatePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
5
4
  propTypes?: any;
6
5
  };
7
6
  /**
@@ -74,9 +74,9 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
74
74
  currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
75
75
  /**
76
76
  * Formats the day of week displayed in the calendar header.
77
- * @param {TDate} date The date of the day of week provided by the adapter.
77
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
78
78
  * @returns {string} The name to display.
79
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
79
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
80
80
  */
81
81
  dayOfWeekFormatter: PropTypes.func,
82
82
  /**
@@ -102,7 +102,8 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
102
102
  */
103
103
  disableAutoMonthSwitching: PropTypes.bool,
104
104
  /**
105
- * If `true`, the picker and text field are disabled.
105
+ * If `true`, the component is disabled.
106
+ * When disabled, the value cannot be changed and no interaction is possible.
106
107
  * @default false
107
108
  */
108
109
  disabled: PropTypes.bool,
@@ -136,7 +137,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
136
137
  */
137
138
  displayWeekNumber: PropTypes.bool,
138
139
  /**
139
- * @default false
140
+ * @default true
140
141
  */
141
142
  enableAccessibleFieldDOMStructure: PropTypes.any,
142
143
  /**
@@ -224,8 +225,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
224
225
  onError: PropTypes.func,
225
226
  /**
226
227
  * Callback fired on month change.
227
- * @template TDate
228
- * @param {TDate} month The new month.
228
+ * @param {PickerValidDate} month The new month.
229
229
  */
230
230
  onMonthChange: PropTypes.func,
231
231
  /**
@@ -253,6 +253,11 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
253
253
  * Used when the component position is controlled.
254
254
  */
255
255
  rangePosition: PropTypes.oneOf(['end', 'start']),
256
+ /**
257
+ * If `true`, the component is read-only.
258
+ * When read-only, the value cannot be changed but the user can interact with the interface.
259
+ * @default false
260
+ */
256
261
  readOnly: PropTypes.bool,
257
262
  /**
258
263
  * If `true`, disable heavy animations.
@@ -285,8 +290,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
285
290
  *
286
291
  * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
287
292
  *
288
- * @template TDate
289
- * @param {TDate} day The date to test.
293
+ * @param {PickerValidDate} day The date to test.
290
294
  * @param {string} position The date to test, 'start' or 'end'.
291
295
  * @returns {boolean} Returns `true` if the date should be disabled.
292
296
  */
@@ -1,11 +1,13 @@
1
- import { PickerValidDate } from '@mui/x-date-pickers/models';
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
- export interface DateRangePickerSlots<TDate extends PickerValidDate> extends DesktopDateRangePickerSlots<TDate>, MobileDateRangePickerSlots<TDate> {
4
+ import { DateRangeValidationError, RangeFieldSection } from '../models';
5
+ import { ValidateDateRangeProps } from '../validation';
6
+ export interface DateRangePickerSlots extends DesktopDateRangePickerSlots, MobileDateRangePickerSlots {
5
7
  }
6
- export interface DateRangePickerSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateRangePickerSlotProps<TDate, TEnableAccessibleFieldDOMStructure>, MobileDateRangePickerSlotProps<TDate, TEnableAccessibleFieldDOMStructure> {
8
+ export interface DateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure> {
7
9
  }
8
- export interface DateRangePickerProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> extends DesktopDateRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure>, MobileDateRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> {
10
+ export interface DateRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDateRangePickerProps<TEnableAccessibleFieldDOMStructure>, MobileDateRangePickerProps<TEnableAccessibleFieldDOMStructure> {
9
11
  /**
10
12
  * CSS media query when `Mobile` mode will be changed to `Desktop`.
11
13
  * @default '@media (pointer: fine)'
@@ -16,10 +18,14 @@ export interface DateRangePickerProps<TDate extends PickerValidDate, TEnableAcce
16
18
  * Overridable component slots.
17
19
  * @default {}
18
20
  */
19
- slots?: DateRangePickerSlots<TDate>;
21
+ slots?: DateRangePickerSlots;
20
22
  /**
21
23
  * The props used for each component slot.
22
24
  * @default {}
23
25
  */
24
- slotProps?: DateRangePickerSlotProps<TDate, TEnableAccessibleFieldDOMStructure>;
26
+ slotProps?: DateRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
25
27
  }
28
+ /**
29
+ * Props the field can receive when used inside a date range picker (<DateRangePicker />, <DesktopDateRangePicker /> or <MobileDateRangePicker /> component).
30
+ */
31
+ export type DateRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateRangeProps & BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>;
@@ -1,10 +1,8 @@
1
1
  import * as React from 'react';
2
- import { BaseToolbarProps, ExportedBaseToolbarProps } from '@mui/x-date-pickers/internals';
3
- import { PickerValidDate } from '@mui/x-date-pickers/models';
4
- import { DateRange } from '../models';
2
+ import { BaseToolbarProps, ExportedBaseToolbarProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
5
3
  import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
6
4
  import { DateRangePickerToolbarClasses } from './dateRangePickerToolbarClasses';
7
- export interface DateRangePickerToolbarProps<TDate extends PickerValidDate> extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps<DateRange<TDate>, 'day'>, 'onChange' | 'isLandscape'>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
5
+ export interface DateRangePickerToolbarProps extends ExportedDateRangePickerToolbarProps, Omit<BaseToolbarProps<PickerRangeValue, 'day'>, 'onChange' | 'isLandscape'>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
8
6
  }
9
7
  export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbarProps {
10
8
  /**
@@ -12,7 +10,7 @@ export interface ExportedDateRangePickerToolbarProps extends ExportedBaseToolbar
12
10
  */
13
11
  classes?: Partial<DateRangePickerToolbarClasses>;
14
12
  }
15
- type DateRangePickerToolbarComponent = (<TDate extends PickerValidDate>(props: DateRangePickerToolbarProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
13
+ type DateRangePickerToolbarComponent = ((props: DateRangePickerToolbarProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
16
14
  propTypes?: any;
17
15
  };
18
16
  /**
@@ -10,7 +10,7 @@ import Typography from '@mui/material/Typography';
10
10
  import { styled, useThemeProps } from '@mui/material/styles';
11
11
  import composeClasses from '@mui/utils/composeClasses';
12
12
  import { PickersToolbar, PickersToolbarButton, useUtils } from '@mui/x-date-pickers/internals';
13
- import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
13
+ import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
14
14
  import { getDateRangePickerToolbarUtilityClass } from "./dateRangePickerToolbarClasses.js";
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  const useUtilityClasses = ownerState => {
@@ -59,7 +59,7 @@ const DateRangePickerToolbar = /*#__PURE__*/React.forwardRef(function DateRangeP
59
59
  className
60
60
  } = props,
61
61
  other = _objectWithoutPropertiesLoose(props, _excluded);
62
- const translations = usePickersTranslations();
62
+ const translations = usePickerTranslations();
63
63
  const startDateValue = start ? utils.formatByString(start, toolbarFormat || utils.formats.shortDate) : translations.start;
64
64
  const endDateValue = end ? utils.formatByString(end, toolbarFormat || utils.formats.shortDate) : translations.end;
65
65
  const ownerState = props;
@@ -99,7 +99,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
99
99
  */
100
100
  classes: PropTypes.object,
101
101
  className: PropTypes.string,
102
- disabled: PropTypes.bool,
103
102
  /**
104
103
  * If `true`, show the toolbar even in desktop mode.
105
104
  * @default `true` for Desktop, `false` for Mobile.
@@ -113,7 +112,6 @@ process.env.NODE_ENV !== "production" ? DateRangePickerToolbar.propTypes = {
113
112
  */
114
113
  onViewChange: PropTypes.func.isRequired,
115
114
  rangePosition: PropTypes.oneOf(['end', 'start']).isRequired,
116
- readOnly: PropTypes.bool,
117
115
  /**
118
116
  * The system prop that allows defining system overrides as well as additional CSS styles.
119
117
  */
@@ -1,5 +1,5 @@
1
1
  export { DateRangePicker } from './DateRangePicker';
2
- export type { DateRangePickerProps, DateRangePickerSlots, DateRangePickerSlotProps, } from './DateRangePicker.types';
2
+ export type { DateRangePickerProps, DateRangePickerSlots, DateRangePickerSlotProps, DateRangePickerFieldProps, } from './DateRangePicker.types';
3
3
  export { DateRangePickerToolbar } from './DateRangePickerToolbar';
4
4
  export type { DateRangePickerToolbarProps } from './DateRangePickerToolbar';
5
5
  export { getDateRangePickerToolbarUtilityClass, dateRangePickerToolbarClasses, } from './dateRangePickerToolbarClasses';
@@ -1,39 +1,39 @@
1
1
  import * as React from 'react';
2
+ import { DefaultizedProps } from '@mui/x-internals/types';
2
3
  import { LocalizedComponent } from '@mui/x-date-pickers/locales';
3
- import { DefaultizedProps, BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup } from '@mui/x-date-pickers/internals';
4
- import { PickerValidDate } from '@mui/x-date-pickers/models';
5
- import { DateRangeValidationError, DateRange } from '../models';
4
+ import { BaseDateValidationProps, BasePickerInputProps, PickerViewRendererLookup, PickerRangeValue } from '@mui/x-date-pickers/internals';
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
- export interface BaseDateRangePickerSlots<TDate extends PickerValidDate> extends DateRangeCalendarSlots<TDate> {
9
+ export interface BaseDateRangePickerSlots extends DateRangeCalendarSlots {
10
10
  /**
11
11
  * Custom component for the toolbar rendered above the views.
12
12
  * @default DateTimePickerToolbar
13
13
  */
14
- toolbar?: React.JSXElementConstructor<DateRangePickerToolbarProps<TDate>>;
14
+ toolbar?: React.JSXElementConstructor<DateRangePickerToolbarProps>;
15
15
  }
16
- export interface BaseDateRangePickerSlotProps<TDate extends PickerValidDate> extends DateRangeCalendarSlotProps<TDate> {
16
+ export interface BaseDateRangePickerSlotProps extends DateRangeCalendarSlotProps {
17
17
  toolbar?: ExportedDateRangePickerToolbarProps;
18
18
  }
19
- export interface BaseDateRangePickerProps<TDate extends PickerValidDate> extends Omit<BasePickerInputProps<DateRange<TDate>, TDate, 'day', DateRangeValidationError>, 'view' | 'views' | 'openTo' | 'onViewChange' | 'orientation'>, ExportedDateRangeCalendarProps<TDate>, BaseDateValidationProps<TDate> {
19
+ export interface BaseDateRangePickerProps extends Omit<BasePickerInputProps<PickerRangeValue, 'day', DateRangeValidationError>, 'view' | 'views' | 'openTo' | 'onViewChange' | 'orientation'>, ExportedDateRangeCalendarProps {
20
20
  /**
21
21
  * Overridable component slots.
22
22
  * @default {}
23
23
  */
24
- slots?: BaseDateRangePickerSlots<TDate>;
24
+ slots?: BaseDateRangePickerSlots;
25
25
  /**
26
26
  * The props used for each component slot.
27
27
  * @default {}
28
28
  */
29
- slotProps?: BaseDateRangePickerSlotProps<TDate>;
29
+ slotProps?: BaseDateRangePickerSlotProps;
30
30
  /**
31
31
  * Define custom view renderers for each section.
32
32
  * If `null`, the section will only have field editing.
33
33
  * If `undefined`, internally defined view will be used.
34
34
  */
35
- viewRenderers?: Partial<PickerViewRendererLookup<DateRange<TDate>, 'day', DateRangeViewRendererProps<TDate, 'day'>, {}>>;
35
+ viewRenderers?: Partial<PickerViewRendererLookup<PickerRangeValue, 'day', DateRangeViewRendererProps<'day'>, {}>>;
36
36
  }
37
- type UseDateRangePickerDefaultizedProps<TDate extends PickerValidDate, Props extends BaseDateRangePickerProps<TDate>> = LocalizedComponent<TDate, DefaultizedProps<Props, keyof BaseDateValidationProps<TDate>>>;
38
- export declare function useDateRangePickerDefaultizedProps<TDate extends PickerValidDate, Props extends BaseDateRangePickerProps<TDate>>(props: Props, name: string): UseDateRangePickerDefaultizedProps<TDate, Props>;
37
+ type UseDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps> = LocalizedComponent<DefaultizedProps<Props, keyof BaseDateValidationProps>>;
38
+ export declare function useDateRangePickerDefaultizedProps<Props extends BaseDateRangePickerProps>(props: Props, name: string): UseDateRangePickerDefaultizedProps<Props>;
39
39
  export {};
@@ -1,8 +1,7 @@
1
1
  import * as React from 'react';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
2
  import { PickersDayProps } from '@mui/x-date-pickers/PickersDay';
4
3
  import { DateRangePickerDayClasses } from './dateRangePickerDayClasses';
5
- export interface DateRangePickerDayProps<TDate extends PickerValidDate> extends Omit<PickersDayProps<TDate>, 'classes' | 'onBlur' | 'onFocus' | 'onKeyDown'> {
4
+ export interface DateRangePickerDayProps extends Omit<PickersDayProps, 'classes' | 'onBlur' | 'onFocus' | 'onKeyDown'> {
6
5
  /**
7
6
  * Set to `true` if the `day` is in a highlighted date range.
8
7
  */
@@ -41,7 +40,7 @@ export interface DateRangePickerDayProps<TDate extends PickerValidDate> extends
41
40
  */
42
41
  draggable?: boolean;
43
42
  }
44
- type DateRangePickerDayComponent = <TDate extends PickerValidDate>(props: DateRangePickerDayProps<TDate> & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element;
43
+ type DateRangePickerDayComponent = (props: DateRangePickerDayProps & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element;
45
44
  /**
46
45
  * Demos:
47
46
  *
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
2
  import { DateTimeRangePickerProps } from './DateTimeRangePicker.types';
4
- type DateTimeRangePickerComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: DateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
3
+ type DateTimeRangePickerComponent = (<TEnableAccessibleFieldDOMStructure extends boolean = true>(props: DateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
5
4
  propTypes?: any;
6
5
  };
7
6
  /**
@@ -79,9 +79,9 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
79
79
  currentMonthCalendarPosition: PropTypes.oneOf([1, 2, 3]),
80
80
  /**
81
81
  * Formats the day of week displayed in the calendar header.
82
- * @param {TDate} date The date of the day of week provided by the adapter.
82
+ * @param {PickerValidDate} date The date of the day of week provided by the adapter.
83
83
  * @returns {string} The name to display.
84
- * @default (date: TDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
84
+ * @default (date: PickerValidDate) => adapter.format(date, 'weekdayShort').charAt(0).toUpperCase()
85
85
  */
86
86
  dayOfWeekFormatter: PropTypes.func,
87
87
  /**
@@ -107,7 +107,8 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
107
107
  */
108
108
  disableAutoMonthSwitching: PropTypes.bool,
109
109
  /**
110
- * If `true`, the picker and text field are disabled.
110
+ * If `true`, the component is disabled.
111
+ * When disabled, the value cannot be changed and no interaction is possible.
111
112
  * @default false
112
113
  */
113
114
  disabled: PropTypes.bool,
@@ -146,7 +147,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
146
147
  */
147
148
  displayWeekNumber: PropTypes.bool,
148
149
  /**
149
- * @default false
150
+ * @default true
150
151
  */
151
152
  enableAccessibleFieldDOMStructure: PropTypes.any,
152
153
  /**
@@ -257,8 +258,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
257
258
  onError: PropTypes.func,
258
259
  /**
259
260
  * Callback fired on month change.
260
- * @template TDate
261
- * @param {TDate} month The new month.
261
+ * @param {PickerValidDate} month The new month.
262
262
  */
263
263
  onMonthChange: PropTypes.func,
264
264
  /**
@@ -298,6 +298,11 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
298
298
  * Used when the component position is controlled.
299
299
  */
300
300
  rangePosition: PropTypes.oneOf(['end', 'start']),
301
+ /**
302
+ * If `true`, the component is read-only.
303
+ * When read-only, the value cannot be changed but the user can interact with the interface.
304
+ * @default false
305
+ */
301
306
  readOnly: PropTypes.bool,
302
307
  /**
303
308
  * If `true`, disable heavy animations.
@@ -330,16 +335,14 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
330
335
  *
331
336
  * Warning: This function can be called multiple times (for example when rendering date calendar, checking if focus can be moved to a certain date, etc.). Expensive computations can impact performance.
332
337
  *
333
- * @template TDate
334
- * @param {TDate} day The date to test.
338
+ * @param {PickerValidDate} day The date to test.
335
339
  * @param {string} position The date to test, 'start' or 'end'.
336
340
  * @returns {boolean} Returns `true` if the date should be disabled.
337
341
  */
338
342
  shouldDisableDate: PropTypes.func,
339
343
  /**
340
344
  * Disable specific time.
341
- * @template TDate
342
- * @param {TDate} value The value to check.
345
+ * @param {PickerValidDate} value The value to check.
343
346
  * @param {TimeView} view The clock type of the timeValue.
344
347
  * @returns {boolean} If `true` the time will be disabled.
345
348
  */
@@ -1,11 +1,13 @@
1
- import { PickerValidDate } from '@mui/x-date-pickers/models';
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
- export interface DateTimeRangePickerSlots<TDate extends PickerValidDate> extends DesktopDateTimeRangePickerSlots<TDate>, MobileDateTimeRangePickerSlots<TDate> {
4
+ import { DateTimeRangeValidationError, RangeFieldSection } from '../models';
5
+ import type { ValidateDateTimeRangeProps } from '../validation';
6
+ export interface DateTimeRangePickerSlots extends DesktopDateTimeRangePickerSlots, MobileDateTimeRangePickerSlots {
5
7
  }
6
- export interface DateTimeRangePickerSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateTimeRangePickerSlotProps<TDate, TEnableAccessibleFieldDOMStructure>, MobileDateTimeRangePickerSlotProps<TDate, TEnableAccessibleFieldDOMStructure> {
8
+ export interface DateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends DesktopDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>, MobileDateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure> {
7
9
  }
8
- export interface DateTimeRangePickerProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> extends DesktopDateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure>, MobileDateTimeRangePickerProps<TDate, TEnableAccessibleFieldDOMStructure> {
10
+ export interface DateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure extends boolean = true> extends DesktopDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure>, MobileDateTimeRangePickerProps<TEnableAccessibleFieldDOMStructure> {
9
11
  /**
10
12
  * CSS media query when `Mobile` mode will be changed to `Desktop`.
11
13
  * @default '@media (pointer: fine)'
@@ -16,10 +18,14 @@ export interface DateTimeRangePickerProps<TDate extends PickerValidDate, TEnable
16
18
  * Overridable component slots.
17
19
  * @default {}
18
20
  */
19
- slots?: DateTimeRangePickerSlots<TDate>;
21
+ slots?: DateTimeRangePickerSlots;
20
22
  /**
21
23
  * The props used for each component slot.
22
24
  * @default {}
23
25
  */
24
- slotProps?: DateTimeRangePickerSlotProps<TDate, TEnableAccessibleFieldDOMStructure>;
26
+ slotProps?: DateTimeRangePickerSlotProps<TEnableAccessibleFieldDOMStructure>;
25
27
  }
28
+ /**
29
+ * Props the field can receive when used inside a date time range picker (<DateTimeRangePicker />, <DesktopDateTimeRangePicker /> or <MobileDateTimeRangePicker /> component).
30
+ */
31
+ export type DateTimeRangePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateDateTimeRangeProps & BaseSingleInputFieldProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>;
@@ -1,5 +1,4 @@
1
1
  import * as React from 'react';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
2
  import { DateOrTimeViewWithMeridiem, BaseTabsProps, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
4
3
  import { DateTimeRangePickerTabsClasses } from './dateTimeRangePickerTabsClasses';
5
4
  import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
@@ -27,7 +26,7 @@ export interface ExportedDateTimeRangePickerTabsProps extends ExportedBaseTabsPr
27
26
  export interface DateTimeRangePickerTabsProps extends ExportedDateTimeRangePickerTabsProps, BaseTabsProps<DateOrTimeViewWithMeridiem>, Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
28
27
  }
29
28
  declare const DateTimeRangePickerTabs: {
30
- <TDate extends PickerValidDate>(inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
29
+ (inProps: DateTimeRangePickerTabsProps): React.JSX.Element | null;
31
30
  propTypes: any;
32
31
  };
33
32
  export { DateTimeRangePickerTabs };
@@ -8,7 +8,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
10
  import { isDatePickerView } from '@mui/x-date-pickers/internals';
11
- import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
11
+ import { 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";
@@ -81,7 +81,7 @@ const DateTimeRangePickerTabs = function DateTimeRangePickerTabs(inProps) {
81
81
  className,
82
82
  sx
83
83
  } = props;
84
- const translations = usePickersTranslations();
84
+ const translations = usePickerTranslations();
85
85
  const classes = useUtilityClasses(props);
86
86
  const value = React.useMemo(() => viewToTab(view, rangePosition), [view, rangePosition]);
87
87
  const isPreviousHidden = value === 'start-date';
@@ -1,20 +1,19 @@
1
1
  import * as React from 'react';
2
- import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, DefaultizedProps } from '@mui/x-date-pickers/internals';
3
- import { PickerValidDate } from '@mui/x-date-pickers/models';
4
- import { DateRange } from '../models';
2
+ import { DefaultizedProps } from '@mui/x-internals/types';
3
+ import { PickerSelectionState, PickerViewRenderer, TimeViewWithMeridiem, BaseClockProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
5
4
  import { UseRangePositionResponse } from '../internals/hooks/useRangePosition';
6
- export type DateTimeRangePickerTimeWrapperProps<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TDate, TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> & Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
5
+ export type DateTimeRangePickerTimeWrapperProps<TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>> = Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> & Omit<TComponentProps, 'views' | 'view' | 'onViewChange' | 'value' | 'defaultValue' | 'onChange'> & {
7
6
  view: TView;
8
7
  onViewChange?: (view: TView) => void;
9
8
  views: readonly TView[];
10
- value?: DateRange<TDate>;
11
- defaultValue?: DateRange<TDate>;
12
- onChange?: (value: DateRange<TDate>, selectionState: PickerSelectionState, selectedView: TView) => void;
13
- viewRenderer?: PickerViewRenderer<DateRange<TDate>, TView, TComponentProps, any> | null;
9
+ value?: PickerRangeValue;
10
+ defaultValue?: PickerRangeValue;
11
+ onChange?: (value: PickerRangeValue, selectionState: PickerSelectionState, selectedView: TView) => void;
12
+ viewRenderer?: PickerViewRenderer<PickerRangeValue, TView, TComponentProps, any> | null;
14
13
  openTo?: TView;
15
14
  };
16
15
  /**
17
16
  * @ignore - internal component.
18
17
  */
19
- declare function DateTimeRangePickerTimeWrapper<TDate extends PickerValidDate, TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TDate, TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TDate, TView, TComponentProps>, ref: React.Ref<HTMLDivElement>): React.ReactNode;
18
+ declare function DateTimeRangePickerTimeWrapper<TView extends TimeViewWithMeridiem, TComponentProps extends DefaultizedProps<Omit<BaseClockProps<TView>, 'value' | 'defaultValue' | 'onChange'>, 'views'>>(props: DateTimeRangePickerTimeWrapperProps<TView, TComponentProps>, ref: React.Ref<HTMLDivElement>): React.ReactNode;
20
19
  export { DateTimeRangePickerTimeWrapper };