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

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 (150) hide show
  1. package/AdapterMoment/AdapterMoment.js +10 -0
  2. package/CHANGELOG.md +228 -7
  3. package/DateCalendar/DateCalendar.types.d.ts +2 -1
  4. package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  5. package/DateCalendar/PickersSlideTransition.js +12 -5
  6. package/DateCalendar/useCalendarState.d.ts +6 -4
  7. package/DateField/DateField.js +5 -4
  8. package/DateField/DateField.types.d.ts +10 -9
  9. package/DatePicker/DatePicker.types.d.ts +3 -3
  10. package/DatePicker/DatePickerToolbar.d.ts +3 -2
  11. package/DatePicker/shared.d.ts +6 -5
  12. package/DateTimeField/DateTimeField.js +5 -4
  13. package/DateTimeField/DateTimeField.types.d.ts +10 -10
  14. package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  15. package/DateTimePicker/DateTimePickerTabs.js +8 -6
  16. package/DateTimePicker/DateTimePickerToolbar.d.ts +2 -3
  17. package/DateTimePicker/shared.d.ts +6 -6
  18. package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  19. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
  20. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
  21. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
  22. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
  23. package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  24. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
  25. package/PickersLayout/PickersLayout.d.ts +7 -5
  26. package/PickersLayout/PickersLayout.js +22 -27
  27. package/PickersLayout/PickersLayout.types.d.ts +14 -15
  28. package/PickersLayout/usePickerLayout.d.ts +5 -4
  29. package/PickersLayout/usePickerLayout.js +19 -12
  30. package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
  31. package/README.md +7 -4
  32. package/TimeField/TimeField.js +5 -4
  33. package/TimeField/TimeField.types.d.ts +10 -10
  34. package/TimePicker/TimePicker.types.d.ts +3 -3
  35. package/TimePicker/TimePickerToolbar.d.ts +2 -3
  36. package/TimePicker/shared.d.ts +6 -6
  37. package/hooks/useParsedFormat.d.ts +2 -2
  38. package/hooks/useParsedFormat.js +1 -1
  39. package/index.js +1 -1
  40. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  41. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
  42. package/internals/components/PickersToolbar.d.ts +3 -3
  43. package/internals/hooks/useClockReferenceDate.d.ts +2 -1
  44. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
  45. package/internals/hooks/useField/useField.d.ts +3 -3
  46. package/internals/hooks/useField/useField.types.d.ts +45 -45
  47. package/internals/hooks/useField/useField.utils.d.ts +4 -3
  48. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
  49. package/internals/hooks/useField/useFieldState.d.ts +9 -8
  50. package/internals/hooks/useField/useFieldState.js +0 -1
  51. package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
  52. package/internals/hooks/useFieldOwnerState.d.ts +6 -0
  53. package/internals/hooks/useFieldOwnerState.js +12 -0
  54. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
  55. package/internals/hooks/usePicker/usePicker.d.ts +3 -3
  56. package/internals/hooks/usePicker/usePicker.js +2 -8
  57. package/internals/hooks/usePicker/usePicker.types.d.ts +7 -7
  58. package/internals/hooks/usePicker/usePickerProvider.d.ts +4 -5
  59. package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
  60. package/internals/hooks/usePicker/usePickerValue.js +0 -1
  61. package/internals/hooks/usePicker/usePickerValue.types.d.ts +25 -24
  62. package/internals/hooks/usePicker/usePickerViews.d.ts +10 -10
  63. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
  64. package/internals/hooks/useValueWithTimezone.d.ts +5 -4
  65. package/internals/hooks/useViews.d.ts +5 -5
  66. package/internals/index.d.ts +4 -2
  67. package/internals/index.js +1 -0
  68. package/internals/models/fields.d.ts +6 -1
  69. package/internals/models/pickers.d.ts +1 -0
  70. package/internals/models/pickers.js +1 -0
  71. package/internals/models/props/basePickerProps.d.ts +4 -3
  72. package/internals/models/props/time.d.ts +2 -1
  73. package/internals/models/props/toolbar.d.ts +2 -1
  74. package/internals/models/value.d.ts +9 -0
  75. package/internals/utils/date-utils.d.ts +1 -1
  76. package/internals/utils/valueManagers.d.ts +4 -3
  77. package/locales/nlNL.js +7 -7
  78. package/models/adapters.d.ts +4 -4
  79. package/models/fields.d.ts +19 -5
  80. package/models/validation.d.ts +2 -1
  81. package/modern/AdapterMoment/AdapterMoment.js +10 -0
  82. package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  83. package/modern/DateCalendar/PickersSlideTransition.js +12 -5
  84. package/modern/DateField/DateField.js +5 -4
  85. package/modern/DateTimeField/DateTimeField.js +5 -4
  86. package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
  87. package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  88. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
  89. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  90. package/modern/PickersLayout/PickersLayout.js +22 -27
  91. package/modern/PickersLayout/usePickerLayout.js +19 -12
  92. package/modern/TimeField/TimeField.js +5 -4
  93. package/modern/hooks/useParsedFormat.js +1 -1
  94. package/modern/index.js +1 -1
  95. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  96. package/modern/internals/hooks/useField/useFieldState.js +0 -1
  97. package/modern/internals/hooks/useFieldOwnerState.js +12 -0
  98. package/modern/internals/hooks/usePicker/usePicker.js +2 -8
  99. package/modern/internals/hooks/usePicker/usePickerValue.js +0 -1
  100. package/modern/internals/index.js +1 -0
  101. package/modern/internals/models/pickers.js +1 -0
  102. package/modern/locales/nlNL.js +7 -7
  103. package/modern/validation/useValidation.js +1 -1
  104. package/modern/validation/validateDate.js +8 -0
  105. package/modern/validation/validateDateTime.js +8 -0
  106. package/modern/validation/validateTime.js +8 -0
  107. package/node/AdapterMoment/AdapterMoment.js +10 -0
  108. package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  109. package/node/DateCalendar/PickersSlideTransition.js +12 -5
  110. package/node/DateField/DateField.js +5 -4
  111. package/node/DateTimeField/DateTimeField.js +5 -4
  112. package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
  113. package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  114. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -22
  115. package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  116. package/node/PickersLayout/PickersLayout.js +22 -27
  117. package/node/PickersLayout/usePickerLayout.js +19 -12
  118. package/node/TimeField/TimeField.js +5 -4
  119. package/node/hooks/useParsedFormat.js +1 -1
  120. package/node/index.js +1 -1
  121. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  122. package/node/internals/hooks/useField/useFieldState.js +0 -1
  123. package/node/internals/hooks/useFieldOwnerState.js +20 -0
  124. package/node/internals/hooks/usePicker/usePicker.js +3 -8
  125. package/node/internals/index.js +7 -0
  126. package/node/internals/models/pickers.js +5 -0
  127. package/node/locales/nlNL.js +7 -7
  128. package/node/validation/useValidation.js +1 -1
  129. package/node/validation/validateDate.js +8 -0
  130. package/node/validation/validateDateTime.js +8 -0
  131. package/node/validation/validateTime.js +8 -0
  132. package/package.json +2 -2
  133. package/themeAugmentation/overrides.d.ts +1 -1
  134. package/themeAugmentation/props.d.ts +3 -2
  135. package/validation/useValidation.d.ts +7 -6
  136. package/validation/useValidation.js +1 -1
  137. package/validation/validateDate.d.ts +12 -3
  138. package/validation/validateDate.js +8 -0
  139. package/validation/validateDateTime.d.ts +12 -4
  140. package/validation/validateDateTime.js +8 -0
  141. package/validation/validateTime.d.ts +12 -3
  142. package/validation/validateTime.js +8 -0
  143. package/internals/hooks/useIsLandscape.d.ts +0 -4
  144. package/internals/hooks/useIsLandscape.js +0 -35
  145. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -32
  146. package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
  147. package/modern/internals/hooks/useIsLandscape.js +0 -35
  148. package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
  149. package/node/internals/hooks/useIsLandscape.js +0 -43
  150. package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -38
@@ -1,13 +1,14 @@
1
1
  import { FieldChangeHandlerContext, UseFieldInternalProps } from '../useField';
2
2
  import { Validator } from '../../../validation';
3
3
  import { PickerVariant } from '../../models/common';
4
- import { FieldSection, TimezoneProps, MuiPickersAdapter, PickersTimezone, PickerChangeHandlerContext, PickerValidDate, OnErrorProps, InferError, PickerValueType } from '../../../models';
4
+ import { TimezoneProps, MuiPickersAdapter, PickersTimezone, PickerChangeHandlerContext, PickerValidDate, OnErrorProps, InferError, PickerValueType } from '../../../models';
5
5
  import { GetDefaultReferenceDateProps } from '../../utils/getDefaultReferenceDate';
6
6
  import { PickerShortcutChangeImportance, PickersShortcutsItemContext } from '../../../PickersShortcuts';
7
- export interface PickerValueManager<TValue, TError> {
7
+ import { InferNonNullablePickerValue, PickerValidValue } from '../../models';
8
+ export interface PickerValueManager<TValue extends PickerValidValue, TError> {
8
9
  /**
9
10
  * Determines if two values are equal.
10
- * @template TValue
11
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
11
12
  * @param {MuiPickersAdapter} utils The adapter.
12
13
  * @param {TValue} valueLeft The first value to compare.
13
14
  * @param {TValue} valueRight The second value to compare.
@@ -20,7 +21,7 @@ export interface PickerValueManager<TValue, TError> {
20
21
  emptyValue: TValue;
21
22
  /**
22
23
  * Method returning the value to set when clicking the "Today" button
23
- * @template TValue
24
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
24
25
  * @param {MuiPickersAdapter} utils The adapter.
25
26
  * @param {PickersTimezone} timezone The current timezone.
26
27
  * @param {PickerValueType} valueType The type of the value being edited.
@@ -28,7 +29,7 @@ export interface PickerValueManager<TValue, TError> {
28
29
  */
29
30
  getTodayValue: (utils: MuiPickersAdapter, timezone: PickersTimezone, valueType: PickerValueType) => TValue;
30
31
  /**
31
- * @template TValue
32
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
32
33
  * Method returning the reference value to use when mounting the component.
33
34
  * @param {object} params The params of the method.
34
35
  * @param {PickerValidDate | undefined} params.referenceDate The referenceDate provided by the user.
@@ -48,10 +49,10 @@ export interface PickerValueManager<TValue, TError> {
48
49
  granularity: number;
49
50
  timezone: PickersTimezone;
50
51
  getTodayDate?: () => PickerValidDate;
51
- }) => TValue;
52
+ }) => InferNonNullablePickerValue<TValue>;
52
53
  /**
53
54
  * Method parsing the input value to replace all invalid dates by `null`.
54
- * @template TValue
55
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
55
56
  * @param {MuiPickersAdapter} utils The adapter.
56
57
  * @param {TValue} value The value to parse.
57
58
  * @returns {TValue} The value without invalid date.
@@ -59,7 +60,7 @@ export interface PickerValueManager<TValue, TError> {
59
60
  cleanValue: (utils: MuiPickersAdapter, value: TValue) => TValue;
60
61
  /**
61
62
  * Generates the new value, given the previous value and the new proposed value.
62
- * @template TValue
63
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
63
64
  * @param {MuiPickersAdapter} utils The adapter.
64
65
  * @param {TValue} lastValidDateValue The last valid value.
65
66
  * @param {TValue} value The proposed value.
@@ -88,7 +89,7 @@ export interface PickerValueManager<TValue, TError> {
88
89
  /**
89
90
  * Return the timezone of the date inside a value.
90
91
  * Throw an error on range picker if both values don't have the same timezone.
91
- @template TValue
92
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
92
93
  @param {MuiPickersAdapter} utils The utils to manipulate the date.
93
94
  @param {TValue} value The current value.
94
95
  @returns {string | null} The timezone of the current value.
@@ -96,7 +97,7 @@ export interface PickerValueManager<TValue, TError> {
96
97
  getTimezone: (utils: MuiPickersAdapter, value: TValue) => string | null;
97
98
  /**
98
99
  * Change the timezone of the dates inside a value.
99
- @template TValue
100
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
100
101
  @param {MuiPickersAdapter} utils The utils to manipulate the date.
101
102
  @param {PickersTimezone} timezone The current timezone.
102
103
  @param {TValue} value The value to convert.
@@ -105,19 +106,19 @@ export interface PickerValueManager<TValue, TError> {
105
106
  setTimezone: (utils: MuiPickersAdapter, timezone: PickersTimezone, value: TValue) => TValue;
106
107
  }
107
108
  export type PickerSelectionState = 'partial' | 'shallow' | 'finish';
108
- export interface UsePickerValueState<TValue> {
109
+ export interface UsePickerValueState<TValue extends PickerValidValue> {
109
110
  /**
110
111
  * Date displayed on the views and the field.
111
112
  * It is updated whenever the user modifies something.
112
113
  */
113
114
  draft: TValue;
114
115
  /**
115
- * Last value published (e.g: the last value for which `shouldPublishValue` returned `true`).
116
+ * Last value published (the last value for which `shouldPublishValue` returned `true`).
116
117
  * If `onChange` is defined, it's the value that was passed on the last call to this callback.
117
118
  */
118
119
  lastPublishedValue: TValue;
119
120
  /**
120
- * Last value committed (e.g: the last value for which `shouldCommitValue` returned `true`).
121
+ * Last value committed (the last value for which `shouldCommitValue` returned `true`).
121
122
  * If `onAccept` is defined, it's the value that was passed on the last call to this callback.
122
123
  */
123
124
  lastCommittedValue: TValue;
@@ -135,12 +136,12 @@ export interface UsePickerValueState<TValue> {
135
136
  */
136
137
  hasBeenModifiedSinceMount: boolean;
137
138
  }
138
- export interface PickerValueUpdaterParams<TValue, TError> {
139
+ export interface PickerValueUpdaterParams<TValue extends PickerValidValue, TError> {
139
140
  action: PickerValueUpdateAction<TValue, TError>;
140
141
  dateState: UsePickerValueState<TValue>;
141
142
  /**
142
143
  * Check if the new draft value has changed compared to some given value.
143
- * @template TValue
144
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
144
145
  * @param {TValue} comparisonValue The value to compare the new draft value with.
145
146
  * @returns {boolean} `true` if the new draft value is equal to the comparison value.
146
147
  */
@@ -148,7 +149,7 @@ export interface PickerValueUpdaterParams<TValue, TError> {
148
149
  isControlled: boolean;
149
150
  closeOnSelect: boolean;
150
151
  }
151
- export type PickerValueUpdateAction<TValue, TError> = {
152
+ export type PickerValueUpdateAction<TValue extends PickerValidValue, TError> = {
152
153
  name: 'setValueFromView';
153
154
  value: TValue;
154
155
  selectionState: PickerSelectionState;
@@ -169,7 +170,7 @@ export type PickerValueUpdateAction<TValue, TError> = {
169
170
  /**
170
171
  * Props used to handle the value that are common to all pickers.
171
172
  */
172
- export interface UsePickerValueBaseProps<TValue, TError> extends OnErrorProps<TValue, TError> {
173
+ export interface UsePickerValueBaseProps<TValue extends PickerValidValue, TError> extends OnErrorProps<TValue, TError> {
173
174
  /**
174
175
  * The selected value.
175
176
  * Used when the component is controlled.
@@ -225,10 +226,10 @@ export interface UsePickerValueNonStaticProps {
225
226
  /**
226
227
  * Props used to handle the value of the pickers.
227
228
  */
228
- export interface UsePickerValueProps<TValue, TError> extends UsePickerValueBaseProps<TValue, TError>, UsePickerValueNonStaticProps, TimezoneProps {
229
+ export interface UsePickerValueProps<TValue extends PickerValidValue, TError> extends UsePickerValueBaseProps<TValue, TError>, UsePickerValueNonStaticProps, TimezoneProps {
229
230
  referenceDate?: PickerValidDate;
230
231
  }
231
- export interface UsePickerValueParams<TValue, TExternalProps extends UsePickerValueProps<TValue, any>> {
232
+ export interface UsePickerValueParams<TValue extends PickerValidValue, TExternalProps extends UsePickerValueProps<TValue, any>> {
232
233
  props: TExternalProps;
233
234
  valueManager: PickerValueManager<TValue, InferError<TExternalProps>>;
234
235
  valueType: PickerValueType;
@@ -244,11 +245,11 @@ export interface UsePickerValueActions {
244
245
  onOpen: (event: React.UIEvent) => void;
245
246
  onClose: (event?: React.UIEvent) => void;
246
247
  }
247
- export type UsePickerValueFieldResponse<TValue, TSection extends FieldSection, TError> = Required<Pick<UseFieldInternalProps<TValue, TSection, any, TError>, 'value' | 'onChange'>>;
248
+ export type UsePickerValueFieldResponse<TValue extends PickerValidValue, TError> = Required<Pick<UseFieldInternalProps<TValue, any, TError>, 'value' | 'onChange'>>;
248
249
  /**
249
250
  * Props passed to `usePickerViews`.
250
251
  */
251
- export interface UsePickerValueViewsResponse<TValue> {
252
+ export interface UsePickerValueViewsResponse<TValue extends PickerValidValue> {
252
253
  value: TValue;
253
254
  onChange: (value: TValue, selectionState?: PickerSelectionState) => void;
254
255
  open: boolean;
@@ -257,16 +258,16 @@ export interface UsePickerValueViewsResponse<TValue> {
257
258
  /**
258
259
  * Props passed to `usePickerLayoutProps`.
259
260
  */
260
- export interface UsePickerValueLayoutResponse<TValue> extends UsePickerValueActions {
261
+ export interface UsePickerValueLayoutResponse<TValue extends PickerValidValue> extends UsePickerValueActions {
261
262
  value: TValue;
262
263
  onChange: (newValue: TValue) => void;
263
264
  onSelectShortcut: (newValue: TValue, changeImportance: PickerShortcutChangeImportance, shortcut: PickersShortcutsItemContext) => void;
264
265
  isValid: (value: TValue) => boolean;
265
266
  }
266
- export interface UsePickerValueResponse<TValue, TSection extends FieldSection, TError> {
267
+ export interface UsePickerValueResponse<TValue extends PickerValidValue, TError> {
267
268
  open: boolean;
268
269
  actions: UsePickerValueActions;
269
270
  viewProps: UsePickerValueViewsResponse<TValue>;
270
- fieldProps: UsePickerValueFieldResponse<TValue, TSection, TError>;
271
+ fieldProps: UsePickerValueFieldResponse<TValue, TError>;
271
272
  layoutProps: UsePickerValueLayoutResponse<TValue>;
272
273
  }
@@ -3,11 +3,11 @@ import { SxProps } from '@mui/system';
3
3
  import { Theme } from '@mui/material/styles';
4
4
  import { UseViewsOptions } from '../useViews';
5
5
  import type { UsePickerValueViewsResponse } from './usePickerValue.types';
6
- import { DateOrTimeViewWithMeridiem } from '../../models';
7
- import { FieldRef, FieldSection, PickerValidDate, TimezoneProps } from '../../../models';
6
+ import { DateOrTimeViewWithMeridiem, PickerRangeValue, PickerValidValue, PickerValue } from '../../models';
7
+ import { FieldRef, PickerValidDate, TimezoneProps } from '../../../models';
8
8
  interface PickerViewsRendererBaseExternalProps<TView extends DateOrTimeViewWithMeridiem> extends Omit<UsePickerViewsProps<any, TView, any, any>, 'openTo' | 'viewRenderers'> {
9
9
  }
10
- export type PickerViewsRendererProps<TValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends PickerViewsRendererBaseExternalProps<TView>, TAdditionalProps extends {}> = Omit<TExternalProps, 'className' | 'sx'> & TAdditionalProps & UsePickerValueViewsResponse<TValue> & {
10
+ export type PickerViewsRendererProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends PickerViewsRendererBaseExternalProps<TView>, TAdditionalProps extends {}> = Omit<TExternalProps, 'className' | 'sx'> & TAdditionalProps & UsePickerValueViewsResponse<TValue> & {
11
11
  view: TView;
12
12
  views: readonly TView[];
13
13
  focusedView: TView | null;
@@ -15,14 +15,14 @@ export type PickerViewsRendererProps<TValue, TView extends DateOrTimeViewWithMer
15
15
  showViewSwitcher: boolean;
16
16
  timeViewsCount: number;
17
17
  };
18
- export type PickerViewRenderer<TValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends PickerViewsRendererBaseExternalProps<TView>, TAdditionalProps extends {}> = (props: PickerViewsRendererProps<TValue, TView, TExternalProps, TAdditionalProps>) => React.ReactNode;
19
- export type PickerViewRendererLookup<TValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends PickerViewsRendererBaseExternalProps<any>, TAdditionalProps extends {}> = {
18
+ export type PickerViewRenderer<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends PickerViewsRendererBaseExternalProps<TView>, TAdditionalProps extends {}> = (props: PickerViewsRendererProps<TValue, TView, TExternalProps, TAdditionalProps>) => React.ReactNode;
19
+ export type PickerViewRendererLookup<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends PickerViewsRendererBaseExternalProps<any>, TAdditionalProps extends {}> = {
20
20
  [K in TView]: PickerViewRenderer<TValue, K, TExternalProps, TAdditionalProps> | null;
21
21
  };
22
22
  /**
23
23
  * Props used to handle the views that are common to all pickers.
24
24
  */
25
- export interface UsePickerViewsBaseProps<TValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends Omit<UseViewsOptions<any, TView>, 'onChange' | 'onFocusedViewChange' | 'focusedView'>, TimezoneProps {
25
+ export interface UsePickerViewsBaseProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends Omit<UseViewsOptions<any, TView>, 'onChange' | 'onFocusedViewChange' | 'focusedView'>, TimezoneProps {
26
26
  /**
27
27
  * If `null`, the section will only have field editing.
28
28
  * If `undefined`, internally defined view will be used.
@@ -52,16 +52,16 @@ export interface UsePickerViewsNonStaticProps {
52
52
  /**
53
53
  * Props used to handle the value of the pickers.
54
54
  */
55
- export interface UsePickerViewsProps<TValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends UsePickerViewsBaseProps<TValue, TView, TExternalProps, TAdditionalProps> {
55
+ export interface UsePickerViewsProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends UsePickerViewsBaseProps<TValue, TView, TExternalProps, TAdditionalProps> {
56
56
  className?: string;
57
57
  sx?: SxProps<Theme>;
58
58
  }
59
- export interface UsePickerViewParams<TValue, TView extends DateOrTimeViewWithMeridiem, TSection extends FieldSection, TExternalProps extends UsePickerViewsProps<TValue, TView, TExternalProps, TAdditionalProps>, TAdditionalProps extends {}> {
59
+ export interface UsePickerViewParams<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerViewsProps<TValue, TView, TExternalProps, TAdditionalProps>, TAdditionalProps extends {}> {
60
60
  props: TExternalProps;
61
61
  propsFromPickerValue: UsePickerValueViewsResponse<TValue>;
62
62
  additionalViewProps: TAdditionalProps;
63
63
  autoFocusView: boolean;
64
- fieldRef: React.RefObject<FieldRef<TSection>> | undefined;
64
+ fieldRef: React.RefObject<FieldRef<PickerValue> | FieldRef<PickerRangeValue>> | undefined;
65
65
  /**
66
66
  * A function that intercepts the regular picker rendering.
67
67
  * Can be used to consume the provided `viewRenderers` and render a custom component wrapping them.
@@ -93,5 +93,5 @@ export interface UsePickerViewsLayoutResponse<TView extends DateOrTimeViewWithMe
93
93
  * - Handles the switch between UI views and field views
94
94
  * - Handles the focus management when switching views
95
95
  */
96
- export declare const usePickerViews: <TValue, TView extends DateOrTimeViewWithMeridiem, TSection extends FieldSection, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}>({ props, propsFromPickerValue, additionalViewProps, autoFocusView, rendererInterceptor, fieldRef, }: UsePickerViewParams<TValue, TView, TSection, TExternalProps, TAdditionalProps>) => UsePickerViewsResponse<TView>;
96
+ export declare const usePickerViews: <TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}>({ props, propsFromPickerValue, additionalViewProps, autoFocusView, rendererInterceptor, fieldRef, }: UsePickerViewParams<TValue, TView, TExternalProps, TAdditionalProps>) => UsePickerViewsResponse<TView>;
97
97
  export {};
@@ -3,11 +3,10 @@ import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '../.
3
3
  import { BasePickerProps } from '../../models/props/basePickerProps';
4
4
  import { UsePickerParams } from '../usePicker';
5
5
  import { UsePickerViewsProps } from '../usePicker/usePickerViews';
6
- import { FieldSection, PickerValidDate } from '../../../models';
7
- import { DateOrTimeViewWithMeridiem } from '../../models';
8
- export interface UseStaticPickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerValidDate | null, TView> {
6
+ import { DateOrTimeViewWithMeridiem, PickerValue } from '../../models';
7
+ export interface UseStaticPickerSlots<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<PickerValue, TView> {
9
8
  }
10
- export interface UseStaticPickerSlotProps<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<PickerValidDate | null, TView> {
9
+ export interface UseStaticPickerSlotProps<TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<PickerValue, TView> {
11
10
  }
12
11
  export interface StaticOnlyPickerProps {
13
12
  /**
@@ -27,7 +26,7 @@ export interface StaticOnlyPickerProps {
27
26
  */
28
27
  onClose?: () => void;
29
28
  }
30
- export interface UseStaticPickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<PickerValidDate | null, TView, any, any>> extends BasePickerProps<PickerValidDate | null, TView, TError, TExternalProps, {}>, StaticOnlyPickerProps {
29
+ export interface UseStaticPickerProps<TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<PickerValue, TView, any, any>> extends BasePickerProps<PickerValue, TView, TError, TExternalProps, {}>, StaticOnlyPickerProps {
31
30
  /**
32
31
  * Overridable component slots.
33
32
  * @default {}
@@ -39,7 +38,7 @@ export interface UseStaticPickerProps<TView extends DateOrTimeViewWithMeridiem,
39
38
  */
40
39
  slotProps?: UseStaticPickerSlotProps<TView>;
41
40
  }
42
- export interface UseStaticPickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerValidDate | null, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
41
+ export interface UseStaticPickerParams<TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TView, any, TExternalProps>> extends Pick<UsePickerParams<PickerValue, TView, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
43
42
  props: TExternalProps;
44
43
  /**
45
44
  * Ref to pass to the root element
@@ -1,11 +1,12 @@
1
1
  import type { PickerValueManager } from './usePicker';
2
2
  import { PickersTimezone, PickerValidDate } from '../../models';
3
+ import { PickerValidValue } from '../models';
3
4
  /**
4
5
  * Hooks making sure that:
5
6
  * - The value returned by `onChange` always have the timezone of `props.value` or `props.defaultValue` if defined
6
7
  * - The value rendered is always the one from `props.timezone` if defined
7
8
  */
8
- export declare const useValueWithTimezone: <TValue, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange, valueManager, }: UseValueWithTimezoneParameters<TValue, TChange>) => {
9
+ export declare const useValueWithTimezone: <TValue extends PickerValidValue, TChange extends (...params: any[]) => void>({ timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange, valueManager, }: UseValueWithTimezoneParameters<TValue, TChange>) => {
9
10
  value: TValue;
10
11
  handleValueChange: TChange;
11
12
  timezone: string;
@@ -13,12 +14,12 @@ export declare const useValueWithTimezone: <TValue, TChange extends (...params:
13
14
  /**
14
15
  * Wrapper around `useControlled` and `useValueWithTimezone`
15
16
  */
16
- export declare const useControlledValueWithTimezone: <TValue, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange: onChangeProp, valueManager, }: UseControlledValueWithTimezoneParameters<TValue, TChange>) => {
17
+ export declare const useControlledValueWithTimezone: <TValue extends PickerValidValue, TChange extends (...params: any[]) => void>({ name, timezone: timezoneProp, value: valueProp, defaultValue, referenceDate, onChange: onChangeProp, valueManager, }: UseControlledValueWithTimezoneParameters<TValue, TChange>) => {
17
18
  value: TValue;
18
19
  handleValueChange: TChange;
19
20
  timezone: string;
20
21
  };
21
- interface UseValueWithTimezoneParameters<TValue, TChange extends (...params: any[]) => void> {
22
+ interface UseValueWithTimezoneParameters<TValue extends PickerValidValue, TChange extends (...params: any[]) => void> {
22
23
  timezone: PickersTimezone | undefined;
23
24
  value: TValue | undefined;
24
25
  defaultValue: TValue | undefined;
@@ -31,7 +32,7 @@ interface UseValueWithTimezoneParameters<TValue, TChange extends (...params: any
31
32
  onChange: TChange | undefined;
32
33
  valueManager: PickerValueManager<TValue, any>;
33
34
  }
34
- interface UseControlledValueWithTimezoneParameters<TValue, TChange extends (...params: any[]) => void> extends UseValueWithTimezoneParameters<TValue, TChange> {
35
+ interface UseControlledValueWithTimezoneParameters<TValue extends PickerValidValue, TChange extends (...params: any[]) => void> extends UseValueWithTimezoneParameters<TValue, TChange> {
35
36
  name: string;
36
37
  }
37
38
  export {};
@@ -1,9 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import type { PickerSelectionState } from './usePicker';
3
- import { DateOrTimeViewWithMeridiem } from '../models';
3
+ import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../models';
4
4
  import { PickerValidDate } from '../../models';
5
5
  export type PickerOnChangeFn = (date: PickerValidDate | null, selectionState?: PickerSelectionState) => void;
6
- export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> {
6
+ export interface UseViewsOptions<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
7
7
  /**
8
8
  * Callback fired when the value changes.
9
9
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
@@ -54,9 +54,9 @@ export interface UseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridie
54
54
  */
55
55
  onFocusedViewChange?: (view: TView, hasFocus: boolean) => void;
56
56
  }
57
- export interface ExportedUseViewsOptions<TValue, TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<TValue, TView>, 'onChange' | 'openTo' | 'views'> {
57
+ export interface ExportedUseViewsOptions<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends MakeOptional<UseViewsOptions<TValue, TView>, 'onChange' | 'openTo' | 'views'> {
58
58
  }
59
- interface UseViewsResponse<TValue, TView extends DateOrTimeViewWithMeridiem> {
59
+ interface UseViewsResponse<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> {
60
60
  view: TView;
61
61
  setView: (view: TView) => void;
62
62
  focusedView: TView | null;
@@ -67,5 +67,5 @@ interface UseViewsResponse<TValue, TView extends DateOrTimeViewWithMeridiem> {
67
67
  goToNextView: () => void;
68
68
  setValueAndGoToNextView: (value: TValue, currentViewSelectionState?: PickerSelectionState, selectedView?: TView) => void;
69
69
  }
70
- export declare function useViews<TValue, TView extends DateOrTimeViewWithMeridiem>({ onChange, onViewChange, openTo, view: inView, views, autoFocus, focusedView: inFocusedView, onFocusedViewChange, }: UseViewsOptions<TValue, TView>): UseViewsResponse<TValue, TView>;
70
+ export declare function useViews<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>({ onChange, onViewChange, openTo, view: inView, views, autoFocus, focusedView: inFocusedView, onFocusedViewChange, }: UseViewsOptions<TValue, TView>): UseViewsResponse<TValue, TView>;
71
71
  export {};
@@ -26,6 +26,7 @@ export { useControlledValueWithTimezone } from './hooks/useValueWithTimezone';
26
26
  export type { DesktopOnlyPickerProps } from './hooks/useDesktopPicker';
27
27
  export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections, } from './hooks/useField';
28
28
  export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext, } from './hooks/useField';
29
+ export { useFieldOwnerState } from './hooks/useFieldOwnerState';
29
30
  export type { MobileOnlyPickerProps } from './hooks/useMobilePicker';
30
31
  export { usePicker } from './hooks/usePicker';
31
32
  export type { UsePickerResponse, UsePickerParams, UsePickerProps, UsePickerValueFieldResponse, PickerViewsRendererProps, } from './hooks/usePicker';
@@ -38,7 +39,8 @@ export { useLocalizationContext, useDefaultDates, useUtils, useNow } from './hoo
38
39
  export type { ExportedUseViewsOptions, UseViewsOptions } from './hooks/useViews';
39
40
  export { useViews } from './hooks/useViews';
40
41
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
41
- export type { BaseSingleInputFieldProps } from './models/fields';
42
+ export type { RangePosition } from './models/pickers';
43
+ export type { BaseSingleInputFieldProps, FieldRangeSection } from './models/fields';
42
44
  export type { BasePickerProps, BasePickerInputProps, BaseNonStaticPickerProps, } from './models/props/basePickerProps';
43
45
  export type { BaseClockProps, DesktopOnlyTimePickerProps, AmPmProps } from './models/props/time';
44
46
  export type { BaseTabsProps, ExportedBaseTabsProps } from './models/props/tabs';
@@ -46,7 +48,7 @@ export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/
46
48
  export type { FormProps } from './models/formProps';
47
49
  export type { PickerVariant, TimeViewWithMeridiem, DateOrTimeViewWithMeridiem, } from './models/common';
48
50
  export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
49
- export type { PickerRangeValue } from './models/value';
51
+ export type { PickerValue, PickerRangeValue, PickerNonNullableRangeValue, InferNonNullablePickerValue, PickerValidValue, } from './models/value';
50
52
  export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
51
53
  export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem, } from './utils/date-utils';
52
54
  export { resolveTimeViewsResponse, resolveDateTimeFormat } from './utils/date-time-utils';
@@ -12,6 +12,7 @@ export { PickersToolbarButton } from "./components/PickersToolbarButton.js";
12
12
  export { DAY_MARGIN, DIALOG_WIDTH, VIEW_HEIGHT } from "./constants/dimensions.js";
13
13
  export { useControlledValueWithTimezone } from "./hooks/useValueWithTimezone.js";
14
14
  export { useField, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./hooks/useField/index.js";
15
+ export { useFieldOwnerState } from "./hooks/useFieldOwnerState.js";
15
16
  export { usePicker } from "./hooks/usePicker/index.js";
16
17
  export { usePickerPrivateContext } from "./hooks/usePickerPrivateContext.js";
17
18
  export { useStaticPicker } from "./hooks/useStaticPicker/index.js";
@@ -3,6 +3,11 @@ import { MakeRequired } from '@mui/x-internals/types';
3
3
  import type { ExportedUseClearableFieldProps, UseClearableFieldSlotProps, UseClearableFieldSlots } from '../../hooks/useClearableField';
4
4
  import type { FieldSection, PickerOwnerState } from '../../models';
5
5
  import type { UseFieldInternalProps } from '../hooks/useField';
6
+ import { RangePosition } from './pickers';
7
+ import { PickerValidValue } from './value';
8
+ export interface FieldRangeSection extends FieldSection {
9
+ dateName: RangePosition;
10
+ }
6
11
  export interface BaseForwardedSingleInputFieldProps extends ExportedUseClearableFieldProps {
7
12
  className: string | undefined;
8
13
  sx: SxProps<any> | undefined;
@@ -32,4 +37,4 @@ export interface BaseForwardedSingleInputFieldProps extends ExportedUseClearable
32
37
  * Props the single input field can receive when used inside a picker.
33
38
  * Only contains what the MUI components are passing to the field, not what users can pass using the `props.slotProps.field`.
34
39
  */
35
- export type BaseSingleInputFieldProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> = MakeRequired<Pick<UseFieldInternalProps<TValue, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'value' | 'onChange' | 'unstableFieldRef' | 'autoFocus'>, 'format' | 'value' | 'onChange' | 'timezone'> & BaseForwardedSingleInputFieldProps;
40
+ export type BaseSingleInputFieldProps<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean, TError> = MakeRequired<Pick<UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, TError>, 'readOnly' | 'disabled' | 'format' | 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange' | 'timezone' | 'value' | 'onChange' | 'unstableFieldRef' | 'autoFocus'>, 'format' | 'value' | 'onChange' | 'timezone'> & BaseForwardedSingleInputFieldProps;
@@ -0,0 +1 @@
1
+ export type RangePosition = 'start' | 'end';
@@ -0,0 +1 @@
1
+ export {};
@@ -7,10 +7,11 @@ import { PickersInputComponentLocaleText } from '../../../locales/utils/pickersL
7
7
  import type { UsePickerViewsProps } from '../../hooks/usePicker/usePickerViews';
8
8
  import { DateOrTimeViewWithMeridiem } from '../common';
9
9
  import { UseFieldInternalProps } from '../../hooks/useField';
10
+ import { PickerValidValue } from '../value';
10
11
  /**
11
12
  * Props common to all pickers after applying the default props on each picker.
12
13
  */
13
- export interface BasePickerProps<TValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps, TAdditionalProps> {
14
+ export interface BasePickerProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<TValue, TView, any, any>, TAdditionalProps extends {}> extends UsePickerBaseProps<TValue, TView, TError, TExternalProps, TAdditionalProps> {
14
15
  className?: string;
15
16
  /**
16
17
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -25,13 +26,13 @@ export interface BasePickerProps<TValue, TView extends DateOrTimeViewWithMeridie
25
26
  /**
26
27
  * Props common to all pickers before applying the default props on each picker.
27
28
  */
28
- export interface BasePickerInputProps<TValue, TView extends DateOrTimeViewWithMeridiem, TError> extends Omit<MakeOptional<BasePickerProps<TValue, TView, TError, any, any>, 'openTo' | 'views'>, 'viewRenderers'> {
29
+ export interface BasePickerInputProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError> extends Omit<MakeOptional<BasePickerProps<TValue, TView, TError, any, any>, 'openTo' | 'views'>, 'viewRenderers'> {
29
30
  }
30
31
  /**
31
32
  * Props common to all non-static pickers.
32
33
  * These props are handled by the headless wrappers.
33
34
  */
34
- export interface BaseNonStaticPickerProps extends Pick<UseFieldInternalProps<any, any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {
35
+ export interface BaseNonStaticPickerProps extends Pick<UseFieldInternalProps<any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {
35
36
  /**
36
37
  * Format of the date when rendered in the input(s).
37
38
  * Defaults to localized format based on the used `views`.
@@ -6,6 +6,7 @@ import type { ExportedUseViewsOptions } from '../../hooks/useViews';
6
6
  import { TimeViewWithMeridiem } from '../common';
7
7
  import { ExportedValidateTimeProps } from '../../../validation/validateTime';
8
8
  import { FormProps } from '../formProps';
9
+ import { PickerValue } from '../value';
9
10
  export interface AmPmProps {
10
11
  /**
11
12
  * 12h/24h view for hour selection clock.
@@ -15,7 +16,7 @@ export interface AmPmProps {
15
16
  }
16
17
  export interface ExportedBaseClockProps extends ExportedValidateTimeProps, TimezoneProps, AmPmProps {
17
18
  }
18
- export interface BaseClockProps<TView extends TimeViewWithMeridiem> extends ExportedUseViewsOptions<PickerValidDate | null, TView>, ExportedBaseClockProps, FormProps {
19
+ export interface BaseClockProps<TView extends TimeViewWithMeridiem> extends ExportedUseViewsOptions<PickerValue, TView>, ExportedBaseClockProps, FormProps {
19
20
  className?: string;
20
21
  /**
21
22
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -2,7 +2,8 @@ import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { Theme } from '@mui/material/styles';
4
4
  import { DateOrTimeViewWithMeridiem } from '../common';
5
- export interface BaseToolbarProps<TValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedBaseToolbarProps {
5
+ import { PickerValidValue } from '../value';
6
+ export interface BaseToolbarProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends ExportedBaseToolbarProps {
6
7
  isLandscape: boolean;
7
8
  onChange: (newValue: TValue) => void;
8
9
  value: TValue;
@@ -1,3 +1,12 @@
1
1
  import { PickerValidDate } from '../../models/pickers';
2
+ /**
3
+ * The type that the `value` and `defaultValue` props can receive on non-range components (date, time and date-time).
4
+ */
2
5
  export type PickerValue = PickerValidDate | null;
6
+ /**
7
+ * The type that the `value` and `defaultValue` props can receive on range components (date-range, time-range and date-time-range).
8
+ */
3
9
  export type PickerRangeValue = [PickerValidDate | null, PickerValidDate | null];
10
+ export type PickerNonNullableRangeValue = [PickerValidDate, PickerValidDate];
11
+ export type PickerValidValue = PickerValue | PickerRangeValue;
12
+ export type InferNonNullablePickerValue<TValue extends PickerValidValue> = TValue extends PickerRangeValue ? TValue extends PickerValue ? PickerValidDate | PickerNonNullableRangeValue : PickerNonNullableRangeValue : PickerValidDate;
@@ -14,7 +14,7 @@ interface FindClosestDateParams {
14
14
  export declare const findClosestEnabledDate: ({ date, disableFuture, disablePast, maxDate, minDate, isDateDisabled, utils, timezone, }: FindClosestDateParams) => PickerValidDate | null;
15
15
  export declare const replaceInvalidDateByNull: (utils: MuiPickersAdapter, value: PickerValidDate | null) => PickerValidDate | null;
16
16
  export declare const applyDefaultDate: (utils: MuiPickersAdapter, value: PickerValidDate | null | undefined, defaultValue: PickerValidDate) => PickerValidDate;
17
- export declare const areDatesEqual: (utils: MuiPickersAdapter, a: PickerValidDate, b: PickerValidDate) => boolean;
17
+ export declare const areDatesEqual: (utils: MuiPickersAdapter, a: PickerValidDate | null, b: PickerValidDate | null) => boolean;
18
18
  export declare const getMonthsInYear: (utils: MuiPickersAdapter, year: PickerValidDate) => PickerValidDate[];
19
19
  export declare const getTodayDate: (utils: MuiPickersAdapter, timezone: PickersTimezone, valueType?: PickerValueType) => PickerValidDate;
20
20
  export declare const formatMeridiem: (utils: MuiPickersAdapter, meridiem: "am" | "pm") => string;
@@ -1,6 +1,7 @@
1
1
  import type { PickerValueManager } from '../hooks/usePicker';
2
- import { DateValidationError, TimeValidationError, DateTimeValidationError, FieldSection } from '../../models';
2
+ import { DateValidationError, TimeValidationError, DateTimeValidationError } from '../../models';
3
3
  import type { FieldValueManager } from '../hooks/useField';
4
- export type SingleItemPickerValueManager<TValue = any, TError extends DateValidationError | TimeValidationError | DateTimeValidationError = any> = PickerValueManager<TValue, TError>;
4
+ import { PickerValue } from '../models';
5
+ export type SingleItemPickerValueManager<TError extends DateValidationError | TimeValidationError | DateTimeValidationError = any> = PickerValueManager<PickerValue, TError>;
5
6
  export declare const singleItemValueManager: SingleItemPickerValueManager;
6
- export declare const singleItemFieldValueManager: FieldValueManager<any, FieldSection>;
7
+ export declare const singleItemFieldValueManager: FieldValueManager<PickerValue>;
package/locales/nlNL.js CHANGED
@@ -16,10 +16,10 @@ const nlNLPickers = {
16
16
  // DateRange labels
17
17
  start: 'Start',
18
18
  end: 'Einde',
19
- startDate: 'Start datum',
20
- startTime: 'Start tijd',
21
- endDate: 'Eind datum',
22
- endTime: 'Eind tijd',
19
+ startDate: 'Startdatum',
20
+ startTime: 'Starttijd',
21
+ endDate: 'Einddatum',
22
+ endTime: 'Eindtijd',
23
23
  // Action bar
24
24
  cancelButtonLabel: 'Annuleren',
25
25
  clearButtonLabel: 'Resetten',
@@ -50,11 +50,11 @@ const nlNLPickers = {
50
50
  timeTableLabel: 'kies tijd',
51
51
  dateTableLabel: 'kies datum',
52
52
  // Field section placeholders
53
- fieldYearPlaceholder: params => 'Y'.repeat(params.digitAmount),
53
+ fieldYearPlaceholder: params => 'J'.repeat(params.digitAmount),
54
54
  fieldMonthPlaceholder: params => params.contentType === 'letter' ? 'MMMM' : 'MM',
55
55
  fieldDayPlaceholder: () => 'DD',
56
56
  fieldWeekDayPlaceholder: params => params.contentType === 'letter' ? 'EEEE' : 'EE',
57
- fieldHoursPlaceholder: () => 'hh',
57
+ fieldHoursPlaceholder: () => 'uu',
58
58
  fieldMinutesPlaceholder: () => 'mm',
59
59
  fieldSecondsPlaceholder: () => 'ss',
60
60
  fieldMeridiemPlaceholder: () => 'aa',
@@ -68,6 +68,6 @@ const nlNLPickers = {
68
68
  seconds: 'Seconden',
69
69
  meridiem: 'Middag',
70
70
  // Common
71
- empty: 'Legen'
71
+ empty: 'Leeg'
72
72
  };
73
73
  export const nlNL = getPickersLocalization(nlNLPickers);
@@ -215,7 +215,7 @@ export interface MuiPickersAdapter<TLocale = any> {
215
215
  */
216
216
  is12HourCycleInCurrentLocale(): boolean;
217
217
  /**
218
- * Create a format with no meta-token (e.g: `LLL` or `PP`).
218
+ * Create a format with no meta-token (for example: `LLL` or `PP`).
219
219
  * @param {string} format The format to expand.
220
220
  * @returns {string} The expanded format.
221
221
  */
@@ -248,7 +248,7 @@ export interface MuiPickersAdapter<TLocale = any> {
248
248
  */
249
249
  formatNumber(numberToFormat: string): string;
250
250
  /**
251
- * Check if the two dates are equal (e.g: they represent the same timestamp).
251
+ * Check if the two dates are equal (which means they represent the same timestamp).
252
252
  * @param {PickerValidDate | null} value The reference date.
253
253
  * @param {PickerValidDate | null} comparing The date to compare with the reference date.
254
254
  * @returns {boolean} `true` if the two dates are equal.
@@ -442,7 +442,7 @@ export interface MuiPickersAdapter<TLocale = any> {
442
442
  */
443
443
  getMonth(value: PickerValidDate): number;
444
444
  /**
445
- * Get the date (e.g: the day in the month) of the given date.
445
+ * Get the date (day in the month) of the given date.
446
446
  * @param {PickerValidDate} value The given date.
447
447
  * @returns {number} The date of the given date.
448
448
  */
@@ -486,7 +486,7 @@ export interface MuiPickersAdapter<TLocale = any> {
486
486
  */
487
487
  setMonth(value: PickerValidDate, month: number): PickerValidDate;
488
488
  /**
489
- * Set the date (e.g: the day in the month) to the given date.
489
+ * Set the date (day in the month) to the given date.
490
490
  * @param {PickerValidDate} value The date to be changed.
491
491
  * @param {number} date The date of the new date.
492
492
  * @returns {PickerValidDate} The new date with the date set.