@mui/x-date-pickers-pro 7.22.2 → 8.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/CHANGELOG.md +142 -155
  2. package/DateRangeCalendar/DateRangeCalendar.d.ts +1 -2
  3. package/DateRangeCalendar/DateRangeCalendar.js +23 -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 +12 -2
  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 +3 -5
  22. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +12 -2
  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 +2 -2
  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 +20 -14
  71. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +6 -7
  72. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -13
  73. package/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -4
  74. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -2
  75. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
  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/useMultiInputDateTimeRangeField.d.ts +1 -2
  80. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +1 -2
  81. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -2
  82. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
  83. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +8 -9
  84. package/internals/models/dateRange.d.ts +3 -4
  85. package/internals/models/dateTimeRange.d.ts +5 -10
  86. package/internals/models/fields.d.ts +26 -0
  87. package/internals/models/fields.js +1 -0
  88. package/internals/models/timeRange.d.ts +5 -9
  89. package/internals/utils/date-range-manager.d.ts +10 -9
  90. package/internals/utils/date-utils.d.ts +5 -5
  91. package/internals/utils/releaseInfo.js +1 -1
  92. package/internals/utils/valueManagers.d.ts +5 -6
  93. package/models/dateRange.d.ts +4 -5
  94. package/models/fields.d.ts +5 -32
  95. package/models/range.d.ts +1 -1
  96. package/modern/DateRangeCalendar/DateRangeCalendar.js +23 -22
  97. package/modern/DateRangeCalendar/useDragRange.js +3 -3
  98. package/modern/DateRangePicker/DateRangePicker.js +12 -8
  99. package/modern/DateRangePicker/DateRangePickerToolbar.js +12 -2
  100. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  101. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +2 -2
  102. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +12 -2
  103. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  104. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  105. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  106. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  107. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  108. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  109. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  110. package/modern/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +2 -2
  111. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  112. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  113. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  114. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  115. package/modern/index.js +1 -7
  116. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +20 -14
  117. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +4 -4
  118. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +21 -15
  119. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +5 -5
  120. package/modern/internals/models/fields.js +1 -0
  121. package/modern/internals/utils/releaseInfo.js +1 -1
  122. package/modern/validation/validateDateRange.js +5 -0
  123. package/modern/validation/validateDateTimeRange.js +5 -0
  124. package/modern/validation/validateTimeRange.js +5 -0
  125. package/node/DateRangeCalendar/DateRangeCalendar.js +22 -21
  126. package/node/DateRangeCalendar/useDragRange.js +3 -3
  127. package/node/DateRangePicker/DateRangePicker.js +12 -8
  128. package/node/DateRangePicker/DateRangePickerToolbar.js +11 -1
  129. package/node/DateTimeRangePicker/DateTimeRangePicker.js +13 -10
  130. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +1 -1
  131. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +11 -1
  132. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +16 -8
  133. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +13 -10
  134. package/node/MobileDateRangePicker/MobileDateRangePicker.js +16 -8
  135. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -10
  136. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +6 -6
  137. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +7 -8
  138. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +6 -6
  139. package/node/PickersRangeCalendarHeader/PickersRangeCalendarHeader.js +1 -1
  140. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +6 -6
  141. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +7 -8
  142. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +6 -6
  143. package/node/StaticDateRangePicker/StaticDateRangePicker.js +11 -7
  144. package/node/index.js +2 -41
  145. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +19 -13
  146. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +3 -3
  147. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +19 -13
  148. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +4 -4
  149. package/node/internals/models/fields.js +5 -0
  150. package/node/internals/utils/releaseInfo.js +1 -1
  151. package/node/validation/validateDateRange.js +4 -0
  152. package/node/validation/validateDateTimeRange.js +4 -0
  153. package/node/validation/validateTimeRange.js +4 -0
  154. package/package.json +5 -5
  155. package/themeAugmentation/props.d.ts +16 -17
  156. package/validation/validateDateRange.d.ts +9 -5
  157. package/validation/validateDateRange.js +5 -0
  158. package/validation/validateDateTimeRange.d.ts +11 -6
  159. package/validation/validateDateTimeRange.js +5 -0
  160. package/validation/validateTimeRange.d.ts +9 -4
  161. package/validation/validateTimeRange.js +5 -0
@@ -5,8 +5,8 @@ import * as React from 'react';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
6
  import { useLicenseVerifier } from '@mui/x-license';
7
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
8
- import { usePicker, PickersModalDialog, PickersProvider } from '@mui/x-date-pickers/internals';
9
- import { usePickersTranslations } from '@mui/x-date-pickers/hooks';
8
+ import { usePicker, PickersModalDialog, PickerProvider } from '@mui/x-date-pickers/internals';
9
+ import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
10
10
  import useId from '@mui/utils/useId';
11
11
  import { useEnrichedRangePickerFieldProps } from "../useEnrichedRangePickerFieldProps.js";
12
12
  import { getReleaseInfo } from "../../utils/releaseInfo.js";
@@ -46,19 +46,21 @@ export const useMobileRangePicker = _ref => {
46
46
  onRangePositionChange
47
47
  } = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
48
48
  const labelId = useId();
49
- const contextTranslations = usePickersTranslations();
49
+ const contextTranslations = usePickerTranslations();
50
50
  const {
51
51
  open,
52
52
  actions,
53
53
  layoutProps,
54
+ providerProps,
54
55
  renderCurrentView,
55
56
  fieldProps: pickerFieldProps,
56
- contextValue
57
+ ownerState
57
58
  } = usePicker(_extends({}, pickerParams, {
58
59
  props,
59
60
  wrapperVariant: 'mobile',
60
61
  autoFocusView: true,
61
62
  fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
63
+ localeText,
62
64
  additionalViewProps: {
63
65
  rangePosition,
64
66
  onRangePositionChange
@@ -68,22 +70,28 @@ export const useMobileRangePicker = _ref => {
68
70
  const fieldProps = useSlotProps({
69
71
  elementType: Field,
70
72
  externalSlotProps: innerSlotProps?.field,
71
- additionalProps: _extends({}, pickerFieldProps, {
73
+ additionalProps: _extends({
74
+ // Internal props
72
75
  readOnly: readOnly ?? true,
73
76
  disabled,
74
- className,
75
- sx,
76
77
  format,
77
78
  formatDensity,
78
79
  enableAccessibleFieldDOMStructure,
79
80
  selectedSections,
80
81
  onSelectedSectionsChange,
81
82
  timezone
82
- }, fieldType === 'single-input' ? {
83
- inputRef,
83
+ }, pickerFieldProps, {
84
+ // onChange and value
85
+
86
+ // Forwarded props
87
+ className,
88
+ sx
89
+ }, fieldType === 'single-input' && !!inputRef && {
90
+ inputRef
91
+ }, fieldType === 'single-input' && {
84
92
  name
85
- } : {}),
86
- ownerState: props
93
+ }),
94
+ ownerState
87
95
  });
88
96
  const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
89
97
  const enrichedFieldProps = useEnrichedRangePickerFieldProps({
@@ -137,9 +145,7 @@ export const useMobileRangePicker = _ref => {
137
145
  'aria-labelledby': labelledById
138
146
  }, innerSlotProps?.mobilePaper)
139
147
  });
140
- const renderPicker = () => /*#__PURE__*/_jsxs(PickersProvider, {
141
- contextValue: contextValue,
142
- localeText: localeText,
148
+ const renderPicker = () => /*#__PURE__*/_jsxs(PickerProvider, _extends({}, providerProps, {
143
149
  children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
144
150
  open: open,
145
151
  slots: slots,
@@ -150,7 +156,7 @@ export const useMobileRangePicker = _ref => {
150
156
  children: renderCurrentView()
151
157
  }))
152
158
  }))]
153
- });
159
+ }));
154
160
  return {
155
161
  renderPicker
156
162
  };
@@ -1,25 +1,24 @@
1
1
  import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
2
  import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
4
- export interface UseMobileRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersModalDialogSlots {
3
+ export interface UseMobileRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TView>, PickersModalDialogSlots {
5
4
  }
6
- export interface UseMobileRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {
5
+ export interface UseMobileRangePickerSlotProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {
7
6
  }
8
7
  export interface MobileRangeOnlyPickerProps extends RangeOnlyPickerProps {
9
8
  }
10
- export interface UseMobileRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
9
+ export interface UseMobileRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, TView, any, any>> extends UseRangePickerProps<TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
11
10
  /**
12
11
  * Overridable component slots.
13
12
  * @default {}
14
13
  */
15
- slots: UseMobileRangePickerSlots<TDate, TView>;
14
+ slots: UseMobileRangePickerSlots<TView>;
16
15
  /**
17
16
  * The props used for each component slot.
18
17
  * @default {}
19
18
  */
20
- slotProps?: UseMobileRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>;
19
+ slotProps?: UseMobileRangePickerSlotProps<TView, TEnableAccessibleFieldDOMStructure>;
21
20
  }
22
21
  export interface MobileRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
23
22
  }
24
- export interface UseMobileRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
23
+ export interface UseMobileRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
25
24
  }
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
3
3
  import { FieldRef, FieldSelectedSections } from '@mui/x-date-pickers/models';
4
4
  import { RangeFieldSection } from '../../models';
5
- interface UseMultiInputFieldSelectedSectionsParams extends Pick<UseFieldInternalProps<any, any, RangeFieldSection, any, any>, 'selectedSections' | 'onSelectedSectionsChange'> {
5
+ interface UseMultiInputFieldSelectedSectionsParams extends Pick<UseFieldInternalProps<any, RangeFieldSection, any, any>, 'selectedSections' | 'onSelectedSectionsChange'> {
6
6
  unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
7
7
  unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
8
8
  }
@@ -1,4 +1,3 @@
1
- import { PickerValidDate } from '@mui/x-date-pickers/models';
2
1
  import { UseMultiInputDateRangeFieldParams } from '../../../MultiInputDateRangeField/MultiInputDateRangeField.types';
3
2
  import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
4
- export declare const useMultiInputDateRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
3
+ export declare const useMultiInputDateRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateRangeFieldParams<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
@@ -1,4 +1,3 @@
1
- import { PickerValidDate } from '@mui/x-date-pickers/models';
2
1
  import type { UseMultiInputDateTimeRangeFieldParams } from '../../../MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types';
3
2
  import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
4
- export declare const useMultiInputDateTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateTimeRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
3
+ export declare const useMultiInputDateTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputDateTimeRangeFieldParams<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
@@ -1,4 +1,3 @@
1
- import { PickerValidDate } from '@mui/x-date-pickers/models';
2
1
  import type { UseMultiInputTimeRangeFieldParams } from '../../../MultiInputTimeRangeField/MultiInputTimeRangeField.types';
3
2
  import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
4
- export declare const useMultiInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
3
+ export declare const useMultiInputTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
@@ -1,11 +1,10 @@
1
1
  import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
- import { PickerValidDate } from '@mui/x-date-pickers/models';
4
3
  import { UseStaticRangePickerParams, UseStaticRangePickerProps } from './useStaticRangePicker.types';
5
4
  /**
6
5
  * Hook managing all the range static pickers:
7
6
  * - StaticDateRangePicker
8
7
  */
9
- export declare const useStaticRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ref, ...pickerParams }: UseStaticRangePickerParams<TDate, TView, TExternalProps>) => {
8
+ export declare const useStaticRangePicker: <TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>>({ props, ref, ...pickerParams }: UseStaticRangePickerParams<TView, TExternalProps>) => {
10
9
  renderPicker: () => React.JSX.Element;
11
10
  };
@@ -4,9 +4,8 @@ const _excluded = ["props", "ref"];
4
4
  import * as React from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { styled } from '@mui/material/styles';
7
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
8
7
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
9
- import { usePicker, DIALOG_WIDTH } from '@mui/x-date-pickers/internals';
8
+ import { usePicker, DIALOG_WIDTH, PickerProvider } from '@mui/x-date-pickers/internals';
10
9
  import { useRangePosition } from "../useRangePosition.js";
11
10
  import { jsx as _jsx } from "react/jsx-runtime";
12
11
  const PickerStaticLayout = styled(PickersLayout)(({
@@ -42,11 +41,13 @@ export const useStaticRangePicker = _ref => {
42
41
  } = useRangePosition(props);
43
42
  const {
44
43
  layoutProps,
44
+ providerProps,
45
45
  renderCurrentView
46
46
  } = usePicker(_extends({}, pickerParams, {
47
47
  props,
48
48
  autoFocusView: autoFocus ?? false,
49
49
  fieldRef: undefined,
50
+ localeText,
50
51
  additionalViewProps: {
51
52
  rangePosition,
52
53
  onRangePositionChange
@@ -60,8 +61,7 @@ export const useStaticRangePicker = _ref => {
60
61
  onRangePositionChange
61
62
  })
62
63
  });
63
- const renderPicker = () => /*#__PURE__*/_jsx(LocalizationProvider, {
64
- localeText: localeText,
64
+ const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
65
65
  children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
66
66
  slots: slots,
67
67
  slotProps: slotPropsForLayout,
@@ -70,7 +70,7 @@ export const useStaticRangePicker = _ref => {
70
70
  ref: ref,
71
71
  children: renderCurrentView()
72
72
  }))
73
- });
73
+ }));
74
74
  return {
75
75
  renderPicker
76
76
  };
@@ -1,29 +1,28 @@
1
1
  import * as React from 'react';
2
- import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
- import { PickerValidDate } from '@mui/x-date-pickers/models';
2
+ import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem, PickerRangeValue } from '@mui/x-date-pickers/internals';
4
3
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
5
- import { RangeFieldSection, DateRange } from '../../../models';
4
+ import { RangeFieldSection } from '../../../models';
6
5
  import { UseRangePositionProps } from '../useRangePosition';
7
- export interface UseStaticRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView> {
6
+ export interface UseStaticRangePickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerRangeValue, TView> {
8
7
  }
9
- export interface UseStaticRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView> {
8
+ export interface UseStaticRangePickerSlotProps<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<PickerRangeValue, TView> {
10
9
  toolbar?: ExportedBaseToolbarProps;
11
10
  }
12
11
  export interface StaticRangeOnlyPickerProps extends StaticOnlyPickerProps, UseRangePositionProps {
13
12
  }
14
- export interface UseStaticRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UseStaticRangePickerProps<TDate, TView, any, TExternalProps>> extends BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, {}>, StaticRangeOnlyPickerProps {
13
+ export interface UseStaticRangePickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends BasePickerProps<PickerRangeValue, TView, TError, TExternalProps, {}>, StaticRangeOnlyPickerProps {
15
14
  /**
16
15
  * Overridable components.
17
16
  * @default {}
18
17
  */
19
- slots?: UseStaticRangePickerSlots<TDate, TView>;
18
+ slots?: UseStaticRangePickerSlots<TView>;
20
19
  /**
21
20
  * The props used for each component slot.
22
21
  * @default {}
23
22
  */
24
- slotProps?: UseStaticRangePickerSlotProps<TDate, TView>;
23
+ slotProps?: UseStaticRangePickerSlotProps<TView>;
25
24
  }
26
- export interface UseStaticRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<DateRange<TDate>, TDate, TView, RangeFieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
25
+ export interface UseStaticRangePickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticRangePickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerRangeValue, TView, RangeFieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
27
26
  props: TExternalProps;
28
27
  /**
29
28
  * Ref to pass to the root element
@@ -2,16 +2,15 @@ import { PickerValidDate } from '@mui/x-date-pickers/models';
2
2
  /**
3
3
  * Props used to validate a day value in range pickers.
4
4
  */
5
- export interface DayRangeValidationProps<TDate extends PickerValidDate> {
5
+ export interface DayRangeValidationProps {
6
6
  /**
7
7
  * Disable specific date.
8
8
  *
9
9
  * 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.
10
10
  *
11
- * @template TDate
12
- * @param {TDate} day The date to test.
11
+ * @param {PickerValidDate} day The date to test.
13
12
  * @param {string} position The date to test, 'start' or 'end'.
14
13
  * @returns {boolean} Returns `true` if the date should be disabled.
15
14
  */
16
- shouldDisableDate?: (day: TDate, position: 'start' | 'end') => boolean;
15
+ shouldDisableDate?: (day: PickerValidDate, position: 'start' | 'end') => boolean;
17
16
  }
@@ -1,13 +1,8 @@
1
- import { BaseDateValidationProps, TimeValidationProps, MakeOptional, UseFieldInternalProps, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import { DayRangeValidationProps } from './dateRange';
4
- import { DateTimeRangeValidationError, RangeFieldSection, DateRange, RangeFieldSeparatorProps } from '../../models';
5
- export interface UseDateTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate> {
6
- /**
7
- * 12h/24h view for hour selection clock.
8
- * @default utils.is12HourCycleInCurrentLocale()
9
- */
10
- ampm?: boolean;
1
+ import { MakeOptional } from '@mui/x-internals/types';
2
+ import { UseFieldInternalProps, DateOrTimeViewWithMeridiem, AmPmProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
3
+ import { DateTimeRangeValidationError, RangeFieldSection, RangeFieldSeparatorProps } from '../../models';
4
+ import { ExportedValidateDateTimeRangeProps } from '../../validation/validateDateTimeRange';
5
+ export interface UseDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateTimeRangeProps, AmPmProps {
11
6
  }
12
7
  export type DateTimeRangePickerView = Exclude<DateOrTimeViewWithMeridiem, 'month' | 'year'>;
13
8
  export type DateTimeRangePickerViewExternal = Exclude<DateTimeRangePickerView, 'meridiem'>;
@@ -0,0 +1,26 @@
1
+ import { SxProps } from '@mui/material/styles';
2
+ import { SlotComponentProps } from '@mui/utils';
3
+ import { MakeRequired } from '@mui/x-internals/types';
4
+ import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
5
+ import { FieldSection } from '@mui/x-date-pickers/models';
6
+ import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
7
+ import type { MultiInputFieldRefs, MultiInputFieldSlotRootProps, RangeFieldSeparatorProps, RangePosition } from '../../models';
8
+ /**
9
+ * Props the multi input field can receive when used inside a picker.
10
+ * Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
11
+ */
12
+ export interface BaseMultiInputFieldProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends MakeRequired<Pick<UseFieldInternalProps<TValue, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'autoFocus' | 'value' | 'onChange'>, 'format' | 'value' | 'onChange' | 'timezone'>, RangeFieldSeparatorProps, MultiInputFieldRefs {
13
+ className: string | undefined;
14
+ sx: SxProps<any> | undefined;
15
+ slots?: {
16
+ root?: React.ElementType;
17
+ separator?: React.ElementType;
18
+ textField?: React.ElementType;
19
+ };
20
+ slotProps?: {
21
+ root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, Record<string, any>>;
22
+ textField?: SlotComponentProps<typeof PickersTextField, {}, {
23
+ position?: RangePosition;
24
+ } & Record<string, any>>;
25
+ };
26
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,10 +1,6 @@
1
- import { BaseTimeValidationProps, TimeValidationProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import { TimeRangeValidationError, RangeFieldSection, DateRange, RangeFieldSeparatorProps } from '../../models';
4
- export interface UseTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, TimeValidationProps<TDate>, BaseTimeValidationProps {
5
- /**
6
- * 12h/24h view for hour selection clock.
7
- * @default utils.is12HourCycleInCurrentLocale()
8
- */
9
- ampm?: boolean;
1
+ import { MakeOptional } from '@mui/x-internals/types';
2
+ import { UseFieldInternalProps, AmPmProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
3
+ import { TimeRangeValidationError, RangeFieldSection, RangeFieldSeparatorProps } from '../../models';
4
+ import type { ExportedValidateTimeRangeProps } from '../../validation/validateTimeRange';
5
+ export interface UseTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateTimeRangeProps, AmPmProps {
10
6
  }
@@ -1,9 +1,10 @@
1
1
  import { MuiPickersAdapter, PickerValidDate } from '@mui/x-date-pickers/models';
2
- import { DateRange, RangePosition } from '../../models';
3
- interface CalculateRangeChangeOptions<TDate extends PickerValidDate> {
4
- utils: MuiPickersAdapter<TDate>;
5
- range: DateRange<TDate>;
6
- newDate: TDate | null;
2
+ import { PickerRangeValue } from '@mui/x-date-pickers/internals';
3
+ import { RangePosition } from '../../models';
4
+ interface CalculateRangeChangeOptions {
5
+ utils: MuiPickersAdapter;
6
+ range: PickerRangeValue;
7
+ newDate: PickerValidDate | null;
7
8
  rangePosition: RangePosition;
8
9
  /**
9
10
  * Should allow flipping range `start` and `end` dates if the `newDate` would result in a new range creation.
@@ -13,10 +14,10 @@ interface CalculateRangeChangeOptions<TDate extends PickerValidDate> {
13
14
  allowRangeFlip?: boolean;
14
15
  shouldMergeDateAndTime?: boolean;
15
16
  }
16
- interface CalculateRangeChangeResponse<TDate extends PickerValidDate> {
17
+ interface CalculateRangeChangeResponse {
17
18
  nextSelection: RangePosition;
18
- newRange: DateRange<TDate>;
19
+ newRange: PickerRangeValue;
19
20
  }
20
- export declare function calculateRangeChange<TDate extends PickerValidDate>({ utils, range, newDate: selectedDate, rangePosition, allowRangeFlip, shouldMergeDateAndTime, }: CalculateRangeChangeOptions<TDate>): CalculateRangeChangeResponse<TDate>;
21
- export declare function calculateRangePreview<TDate extends PickerValidDate>(options: CalculateRangeChangeOptions<TDate>): DateRange<TDate>;
21
+ export declare function calculateRangeChange({ utils, range, newDate: selectedDate, rangePosition, allowRangeFlip, shouldMergeDateAndTime, }: CalculateRangeChangeOptions): CalculateRangeChangeResponse;
22
+ export declare function calculateRangePreview(options: CalculateRangeChangeOptions): PickerRangeValue;
22
23
  export {};
@@ -1,6 +1,6 @@
1
1
  import { MuiPickersAdapter, PickerValidDate } from '@mui/x-date-pickers/models';
2
- import { DateRange, NonEmptyDateRange } from '../../models';
3
- export declare const isRangeValid: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, range: DateRange<TDate> | null) => range is NonEmptyDateRange<TDate>;
4
- export declare const isWithinRange: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, day: TDate, range: DateRange<TDate> | null) => boolean;
5
- export declare const isStartOfRange: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, day: TDate, range: DateRange<TDate> | null) => boolean;
6
- export declare const isEndOfRange: <TDate extends PickerValidDate>(utils: MuiPickersAdapter<TDate>, day: TDate, range: DateRange<TDate> | null) => boolean;
2
+ import { PickerRangeValue } from '@mui/x-date-pickers/internals';
3
+ export declare const isRangeValid: (utils: MuiPickersAdapter, range: PickerRangeValue | null) => range is [PickerValidDate, PickerValidDate];
4
+ export declare const isWithinRange: (utils: MuiPickersAdapter, day: PickerValidDate, range: PickerRangeValue | null) => boolean;
5
+ export declare const isStartOfRange: (utils: MuiPickersAdapter, day: PickerValidDate, range: PickerRangeValue | null) => boolean;
6
+ export declare const isEndOfRange: (utils: MuiPickersAdapter, day: PickerValidDate, range: PickerRangeValue | null) => boolean;
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTczMTAyMDQwMDAwMA==";
3
+ const releaseInfo = "MTczMTUzODgwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -1,8 +1,7 @@
1
- import { PickerValueManager, FieldValueManager } from '@mui/x-date-pickers/internals';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import type { DateRangeValidationError, DateTimeRangeValidationError, TimeRangeValidationError, RangeFieldSection, DateRange } from '../../models';
4
- export type RangePickerValueManager<TValue = [any, any], TDate extends PickerValidDate = any, TError extends DateRangeValidationError | TimeRangeValidationError | DateTimeRangeValidationError = any> = PickerValueManager<TValue, TDate, TError>;
1
+ import { PickerValueManager, FieldValueManager, PickerRangeValue } from '@mui/x-date-pickers/internals';
2
+ import type { DateRangeValidationError, DateTimeRangeValidationError, TimeRangeValidationError, RangeFieldSection } from '../../models';
3
+ export type RangePickerValueManager<TValue = [any, any], TError extends DateRangeValidationError | TimeRangeValidationError | DateTimeRangeValidationError = any> = PickerValueManager<TValue, TError>;
5
4
  export declare const rangeValueManager: RangePickerValueManager;
6
- export declare const getRangeFieldValueManager: <TDate extends PickerValidDate>({ dateSeparator, }: {
5
+ export declare const getRangeFieldValueManager: ({ dateSeparator, }: {
7
6
  dateSeparator: string | undefined;
8
- }) => FieldValueManager<DateRange<TDate>, TDate, RangeFieldSection>;
7
+ }) => FieldValueManager<PickerRangeValue, RangeFieldSection>;
@@ -1,8 +1,7 @@
1
- import { BaseDateValidationProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
2
- import { PickerValidDate } from '@mui/x-date-pickers/models';
1
+ import { MakeOptional } from '@mui/x-internals/types';
2
+ import { UseFieldInternalProps, PickerRangeValue } from '@mui/x-date-pickers/internals';
3
3
  import { RangeFieldSection, RangeFieldSeparatorProps } from './fields';
4
4
  import { DateRangeValidationError } from './validation';
5
- import { DateRange } from './range';
6
- import { DayRangeValidationProps } from '../internals/models/dateRange';
7
- export interface UseDateRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate> {
5
+ import type { ExportedValidateDateRangeProps } from '../validation/validateDateRange';
6
+ export interface UseDateRangeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<PickerRangeValue, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'unstableFieldRef'>, 'format'>, RangeFieldSeparatorProps, ExportedValidateDateRangeProps {
8
7
  }
@@ -1,10 +1,7 @@
1
1
  import * as React from 'react';
2
- import { SlotComponentProps } from '@mui/utils';
3
- import { BaseFieldProps, UseFieldResponse } from '@mui/x-date-pickers/internals';
4
- import { BaseSingleInputPickersTextFieldProps, FieldRef, FieldSection, PickerValidDate } from '@mui/x-date-pickers/models';
2
+ import { UseFieldResponse, FormProps } from '@mui/x-date-pickers/internals';
3
+ import { FieldRef, FieldSection, PickerFieldSlotProps } from '@mui/x-date-pickers/models';
5
4
  import { UseClearableFieldResponse } from '@mui/x-date-pickers/hooks';
6
- import { SxProps } from '@mui/material/styles';
7
- import TextField from '@mui/material/TextField';
8
5
  import { RangePosition } from './range';
9
6
  export interface RangeFieldSection extends FieldSection {
10
7
  dateName: RangePosition;
@@ -13,11 +10,9 @@ export type FieldType = 'single-input' | 'multi-input';
13
10
  /**
14
11
  * Props the `textField` slot of the multi input field can receive when used inside a picker.
15
12
  */
16
- export interface MultiInputFieldSlotTextFieldProps {
13
+ export interface MultiInputFieldSlotTextFieldProps extends FormProps {
17
14
  label?: React.ReactNode;
18
15
  id?: string;
19
- disabled?: boolean;
20
- readOnly?: boolean;
21
16
  onKeyDown?: React.KeyboardEventHandler;
22
17
  onClick?: React.MouseEventHandler;
23
18
  onFocus?: React.FocusEventHandler;
@@ -46,33 +41,11 @@ export interface RangeFieldSeparatorProps {
46
41
  dateSeparator?: string;
47
42
  }
48
43
  /**
49
- * Props the multi input field can receive when used inside a picker.
50
- * Only contains what the MUI components are passing to the field,
51
- * not what users can pass using the `props.slotProps.field`.
44
+ * Props the `slotProps.field` of a range picker component can receive.
52
45
  */
53
- export interface BaseMultiInputFieldProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Omit<BaseFieldProps<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'unstableFieldRef'>, RangeFieldSeparatorProps {
54
- sx?: SxProps<any>;
55
- unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
56
- unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
57
- slots?: {
58
- root?: React.ElementType;
59
- separator?: React.ElementType;
60
- textField?: React.ElementType;
61
- };
62
- slotProps?: {
63
- root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, Record<string, any>>;
64
- textField?: SlotComponentProps<typeof TextField, {}, {
65
- position?: RangePosition;
66
- } & Record<string, any>>;
67
- };
68
- }
46
+ export type PickerRangeFieldSlotProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean> = PickerFieldSlotProps<TValue, TSection, TEnableAccessibleFieldDOMStructure> & RangeFieldSeparatorProps;
69
47
  /**
70
48
  * Props the text field receives when used with a multi input picker.
71
49
  * Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.textField`.
72
50
  */
73
51
  export type BaseMultiInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseClearableFieldResponse<UseFieldResponse<TEnableAccessibleFieldDOMStructure, MultiInputFieldSlotTextFieldProps>>;
74
- /**
75
- * Props the text field receives when used with a single or multi input picker.
76
- * Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` or `props.slotProps.textField`.
77
- */
78
- export type BasePickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure> & BaseMultiInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure>;
package/models/range.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { PickerValidDate } from '@mui/x-date-pickers/models';
2
2
  export type DateRange<TDate extends PickerValidDate> = [TDate | null, TDate | null];
3
- export type NonEmptyDateRange<TDate extends PickerValidDate> = [TDate, TDate];
3
+ export type NonEmptyDateRange = [PickerValidDate, PickerValidDate];
4
4
  export type RangePosition = 'start' | 'end';