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

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 (165) hide show
  1. package/AdapterMoment/AdapterMoment.js +10 -0
  2. package/CHANGELOG.md +330 -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/PickersActionBar/PickersActionBar.js +8 -1
  24. package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  25. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
  26. package/PickersLayout/PickersLayout.d.ts +7 -5
  27. package/PickersLayout/PickersLayout.js +22 -27
  28. package/PickersLayout/PickersLayout.types.d.ts +14 -15
  29. package/PickersLayout/usePickerLayout.d.ts +5 -4
  30. package/PickersLayout/usePickerLayout.js +19 -12
  31. package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
  32. package/PickersShortcuts/PickersShortcuts.js +8 -1
  33. package/README.md +7 -4
  34. package/TimeField/TimeField.js +5 -4
  35. package/TimeField/TimeField.types.d.ts +10 -10
  36. package/TimePicker/TimePicker.types.d.ts +3 -3
  37. package/TimePicker/TimePickerToolbar.d.ts +2 -3
  38. package/TimePicker/shared.d.ts +6 -6
  39. package/hooks/useParsedFormat.d.ts +2 -2
  40. package/hooks/useParsedFormat.js +1 -1
  41. package/index.js +1 -1
  42. package/internals/components/PickerProvider.d.ts +2 -15
  43. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  44. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
  45. package/internals/components/PickersToolbar.d.ts +3 -3
  46. package/internals/hooks/useClockReferenceDate.d.ts +2 -1
  47. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
  48. package/internals/hooks/useField/useField.d.ts +3 -3
  49. package/internals/hooks/useField/useField.types.d.ts +45 -45
  50. package/internals/hooks/useField/useField.utils.d.ts +4 -3
  51. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
  52. package/internals/hooks/useField/useFieldState.d.ts +9 -8
  53. package/internals/hooks/useField/useFieldState.js +0 -1
  54. package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
  55. package/internals/hooks/useFieldOwnerState.d.ts +6 -0
  56. package/internals/hooks/useFieldOwnerState.js +12 -0
  57. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
  58. package/internals/hooks/useOpenState.d.ts +3 -2
  59. package/internals/hooks/useOpenState.js +10 -9
  60. package/internals/hooks/usePicker/usePicker.d.ts +3 -3
  61. package/internals/hooks/usePicker/usePicker.js +4 -10
  62. package/internals/hooks/usePicker/usePicker.types.d.ts +7 -7
  63. package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -6
  64. package/internals/hooks/usePicker/usePickerProvider.js +8 -10
  65. package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
  66. package/internals/hooks/usePicker/usePickerValue.js +22 -12
  67. package/internals/hooks/usePicker/usePickerValue.types.d.ts +51 -24
  68. package/internals/hooks/usePicker/usePickerViews.d.ts +10 -10
  69. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
  70. package/internals/hooks/useValueWithTimezone.d.ts +5 -4
  71. package/internals/hooks/useViews.d.ts +5 -5
  72. package/internals/index.d.ts +4 -2
  73. package/internals/index.js +1 -0
  74. package/internals/models/fields.d.ts +6 -1
  75. package/internals/models/pickers.d.ts +1 -0
  76. package/internals/models/pickers.js +1 -0
  77. package/internals/models/props/basePickerProps.d.ts +4 -3
  78. package/internals/models/props/time.d.ts +2 -1
  79. package/internals/models/props/toolbar.d.ts +2 -1
  80. package/internals/models/value.d.ts +9 -0
  81. package/internals/utils/date-utils.d.ts +1 -1
  82. package/internals/utils/valueManagers.d.ts +4 -3
  83. package/locales/nlNL.js +7 -7
  84. package/models/adapters.d.ts +4 -4
  85. package/models/fields.d.ts +19 -5
  86. package/models/validation.d.ts +2 -1
  87. package/modern/AdapterMoment/AdapterMoment.js +10 -0
  88. package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  89. package/modern/DateCalendar/PickersSlideTransition.js +12 -5
  90. package/modern/DateField/DateField.js +5 -4
  91. package/modern/DateTimeField/DateTimeField.js +5 -4
  92. package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
  93. package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  94. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
  95. package/modern/PickersActionBar/PickersActionBar.js +8 -1
  96. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  97. package/modern/PickersLayout/PickersLayout.js +22 -27
  98. package/modern/PickersLayout/usePickerLayout.js +19 -12
  99. package/modern/PickersShortcuts/PickersShortcuts.js +8 -1
  100. package/modern/TimeField/TimeField.js +5 -4
  101. package/modern/hooks/useParsedFormat.js +1 -1
  102. package/modern/index.js +1 -1
  103. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  104. package/modern/internals/hooks/useField/useFieldState.js +0 -1
  105. package/modern/internals/hooks/useFieldOwnerState.js +12 -0
  106. package/modern/internals/hooks/useOpenState.js +10 -9
  107. package/modern/internals/hooks/usePicker/usePicker.js +4 -10
  108. package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -10
  109. package/modern/internals/hooks/usePicker/usePickerValue.js +22 -12
  110. package/modern/internals/index.js +1 -0
  111. package/modern/internals/models/pickers.js +1 -0
  112. package/modern/locales/nlNL.js +7 -7
  113. package/modern/validation/useValidation.js +1 -1
  114. package/modern/validation/validateDate.js +8 -0
  115. package/modern/validation/validateDateTime.js +8 -0
  116. package/modern/validation/validateTime.js +8 -0
  117. package/node/AdapterMoment/AdapterMoment.js +10 -0
  118. package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
  119. package/node/DateCalendar/PickersSlideTransition.js +12 -5
  120. package/node/DateField/DateField.js +5 -4
  121. package/node/DateTimeField/DateTimeField.js +5 -4
  122. package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
  123. package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
  124. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -22
  125. package/node/PickersActionBar/PickersActionBar.js +8 -1
  126. package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
  127. package/node/PickersLayout/PickersLayout.js +22 -27
  128. package/node/PickersLayout/usePickerLayout.js +19 -12
  129. package/node/PickersShortcuts/PickersShortcuts.js +8 -1
  130. package/node/TimeField/TimeField.js +5 -4
  131. package/node/hooks/useParsedFormat.js +1 -1
  132. package/node/index.js +1 -1
  133. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
  134. package/node/internals/hooks/useField/useFieldState.js +0 -1
  135. package/node/internals/hooks/useFieldOwnerState.js +20 -0
  136. package/node/internals/hooks/useOpenState.js +10 -9
  137. package/node/internals/hooks/usePicker/usePicker.js +5 -10
  138. package/node/internals/hooks/usePicker/usePickerProvider.js +9 -11
  139. package/node/internals/hooks/usePicker/usePickerValue.js +22 -11
  140. package/node/internals/index.js +7 -0
  141. package/node/internals/models/pickers.js +5 -0
  142. package/node/locales/nlNL.js +7 -7
  143. package/node/validation/useValidation.js +1 -1
  144. package/node/validation/validateDate.js +8 -0
  145. package/node/validation/validateDateTime.js +8 -0
  146. package/node/validation/validateTime.js +8 -0
  147. package/package.json +2 -2
  148. package/themeAugmentation/overrides.d.ts +1 -1
  149. package/themeAugmentation/props.d.ts +3 -2
  150. package/validation/useValidation.d.ts +7 -6
  151. package/validation/useValidation.js +1 -1
  152. package/validation/validateDate.d.ts +12 -3
  153. package/validation/validateDate.js +8 -0
  154. package/validation/validateDateTime.d.ts +12 -4
  155. package/validation/validateDateTime.js +8 -0
  156. package/validation/validateTime.d.ts +12 -3
  157. package/validation/validateTime.js +8 -0
  158. package/internals/hooks/useIsLandscape.d.ts +0 -4
  159. package/internals/hooks/useIsLandscape.js +0 -35
  160. package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -32
  161. package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
  162. package/modern/internals/hooks/useIsLandscape.js +0 -35
  163. package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
  164. package/node/internals/hooks/useIsLandscape.js +0 -43
  165. package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -38
@@ -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.
@@ -4,7 +4,8 @@ import type { ExportedUseClearableFieldProps, UseClearableFieldResponse } from '
4
4
  import { ExportedPickersSectionListProps } from '../PickersSectionList';
5
5
  import type { UseFieldInternalProps, UseFieldResponse } from '../internals/hooks/useField';
6
6
  import type { PickersTextFieldProps } from '../PickersTextField';
7
- import { BaseForwardedSingleInputFieldProps } from '../internals/models';
7
+ import { BaseForwardedSingleInputFieldProps, FieldRangeSection, PickerRangeValue, PickerValidValue } from '../internals/models';
8
+ import { PickerOwnerState } from './pickers';
8
9
  export type FieldSectionType = 'year' | 'month' | 'day' | 'weekDay' | 'hours' | 'minutes' | 'seconds' | 'meridiem' | 'empty';
9
10
  export type FieldSectionContentType = 'digit' | 'digit-with-letter' | 'letter';
10
11
  export interface FieldSection {
@@ -69,12 +70,14 @@ export interface FieldSection {
69
70
  */
70
71
  endSeparator: string;
71
72
  }
72
- export interface FieldRef<TSection extends FieldSection> {
73
+ type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false;
74
+ export type InferFieldSection<TValue extends PickerValidValue> = IsAny<TValue> extends true ? FieldSection : TValue extends PickerRangeValue ? FieldRangeSection : FieldSection;
75
+ export interface FieldRef<TValue extends PickerValidValue> {
73
76
  /**
74
77
  * Returns the sections of the current value.
75
- * @returns {TSection[]} The sections of the current value.
78
+ * @returns {InferFieldSection<TValue>[]} The sections of the current value.
76
79
  */
77
- getSections: () => TSection[];
80
+ getSections: () => InferFieldSection<TValue>[];
78
81
  /**
79
82
  * Returns the index of the active section (the first focused section).
80
83
  * If no section is active, returns `null`.
@@ -98,10 +101,20 @@ export interface FieldRef<TSection extends FieldSection> {
98
101
  isFieldFocused: () => boolean;
99
102
  }
100
103
  export type FieldSelectedSections = number | FieldSectionType | null | 'all';
104
+ export interface FieldOwnerState extends PickerOwnerState {
105
+ /**
106
+ * `true` if the field is disabled, `false` otherwise.
107
+ */
108
+ isFieldDisabled: boolean;
109
+ /**
110
+ * `true` if the field is read-only, `false` otherwise.
111
+ */
112
+ isFieldReadOnly: boolean;
113
+ }
101
114
  /**
102
115
  * Props the prop `slotProps.field` of a picker can receive.
103
116
  */
104
- export type PickerFieldSlotProps<TValue, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean> = ExportedUseClearableFieldProps & Pick<UseFieldInternalProps<TValue, TSection, TEnableAccessibleFieldDOMStructure, unknown>, 'shouldRespectLeadingZeros' | 'readOnly'> & React.HTMLAttributes<HTMLDivElement> & {
117
+ export type PickerFieldSlotProps<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean> = ExportedUseClearableFieldProps & Pick<UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, unknown>, 'shouldRespectLeadingZeros' | 'readOnly'> & React.HTMLAttributes<HTMLDivElement> & {
105
118
  ref?: React.Ref<HTMLDivElement>;
106
119
  };
107
120
  /**
@@ -113,3 +126,4 @@ export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStruct
113
126
  * Props the built-in text field component can receive.
114
127
  */
115
128
  export type BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = TEnableAccessibleFieldDOMStructure extends false ? Omit<TextFieldProps, 'autoComplete' | 'error' | 'maxRows' | 'minRows' | 'multiline' | 'placeholder' | 'rows' | 'select' | 'SelectProps' | 'type'> : Partial<Omit<PickersTextFieldProps, keyof ExportedPickersSectionListProps>>;
129
+ export {};
@@ -1,3 +1,4 @@
1
+ import type { PickerValidValue } from '../internals/models';
1
2
  /**
2
3
  * Validation error types applicable to both date and time validation
3
4
  */
@@ -5,7 +6,7 @@ type CommonDateTimeValidationError = 'invalidDate' | 'disableFuture' | 'disableP
5
6
  export type DateValidationError = CommonDateTimeValidationError | 'shouldDisableDate' | 'shouldDisableMonth' | 'shouldDisableYear' | 'minDate' | 'maxDate';
6
7
  export type TimeValidationError = CommonDateTimeValidationError | 'minutesStep' | 'minTime' | 'maxTime' | 'shouldDisableTime-hours' | 'shouldDisableTime-minutes' | 'shouldDisableTime-seconds';
7
8
  export type DateTimeValidationError = DateValidationError | TimeValidationError;
8
- export interface OnErrorProps<TValue, TError> {
9
+ export interface OnErrorProps<TValue extends PickerValidValue, TError> {
9
10
  /**
10
11
  * Callback fired when the error associated with the current value changes.
11
12
  * When a validation error is detected, the `error` parameter contains a non-null value.
@@ -430,12 +430,22 @@ export class AdapterMoment {
430
430
  const end = this.endOfWeek(this.endOfMonth(value));
431
431
  let count = 0;
432
432
  let current = start;
433
+ let currentDayOfYear = current.get('dayOfYear');
433
434
  const nestedWeeks = [];
434
435
  while (current.isBefore(end)) {
435
436
  const weekNumber = Math.floor(count / 7);
436
437
  nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
437
438
  nestedWeeks[weekNumber].push(current);
439
+ const prevDayOfYear = currentDayOfYear;
438
440
  current = this.addDays(current, 1);
441
+ currentDayOfYear = current.get('dayOfYear');
442
+
443
+ // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
444
+ // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
445
+ // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
446
+ if (prevDayOfYear === currentDayOfYear) {
447
+ current = current.add(12, 'h').startOf('day');
448
+ }
439
449
  count += 1;
440
450
  }
441
451
  return nestedWeeks;
@@ -6,10 +6,7 @@ import { styled, useTheme, useThemeProps } from '@mui/material/styles';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
7
  import { getPickersFadeTransitionGroupUtilityClass } from "./pickersFadeTransitionGroupClasses.js";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const useUtilityClasses = ownerState => {
10
- const {
11
- classes
12
- } = ownerState;
9
+ const useUtilityClasses = classes => {
13
10
  const slots = {
14
11
  root: ['root']
15
12
  };
@@ -36,9 +33,10 @@ export function PickersFadeTransitionGroup(inProps) {
36
33
  children,
37
34
  className,
38
35
  reduceAnimations,
39
- transKey
36
+ transKey,
37
+ classes: classesProp
40
38
  } = props;
41
- const classes = useUtilityClasses(props);
39
+ const classes = useUtilityClasses(classesProp);
42
40
  const theme = useTheme();
43
41
  if (reduceAnimations) {
44
42
  return children;
@@ -7,10 +7,10 @@ import { styled, useTheme, useThemeProps } from '@mui/material/styles';
7
7
  import composeClasses from '@mui/utils/composeClasses';
8
8
  import { CSSTransition, TransitionGroup } from 'react-transition-group';
9
9
  import { getPickersSlideTransitionUtilityClass, pickersSlideTransitionClasses } from "./pickersSlideTransitionClasses.js";
10
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
- const useUtilityClasses = ownerState => {
12
+ const useUtilityClasses = (classes, ownerState) => {
12
13
  const {
13
- classes,
14
14
  slideDirection
15
15
  } = ownerState;
16
16
  const slots = {
@@ -99,11 +99,18 @@ export function PickersSlideTransition(inProps) {
99
99
  children,
100
100
  className,
101
101
  reduceAnimations,
102
- transKey
103
- // extracting `classes` from `other`
102
+ slideDirection,
103
+ transKey,
104
+ classes: classesProp
104
105
  } = props,
105
106
  other = _objectWithoutPropertiesLoose(props, _excluded);
106
- const classes = useUtilityClasses(props);
107
+ const {
108
+ ownerState: pickerOwnerState
109
+ } = usePickerPrivateContext();
110
+ const ownerState = _extends({}, pickerOwnerState, {
111
+ slideDirection
112
+ });
113
+ const classes = useUtilityClasses(classesProp, ownerState);
107
114
  const theme = useTheme();
108
115
  if (reduceAnimations) {
109
116
  return /*#__PURE__*/_jsx("div", {
@@ -13,6 +13,7 @@ import { useDateField } from "./useDateField.js";
13
13
  import { useClearableField } from "../hooks/index.js";
14
14
  import { PickersTextField } from "../PickersTextField/index.js";
15
15
  import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
16
+ import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  /**
18
19
  * Demos:
@@ -36,7 +37,7 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
36
37
  inputProps
37
38
  } = themeProps,
38
39
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
39
- const ownerState = themeProps;
40
+ const ownerState = useFieldOwnerState(themeProps);
40
41
  const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
41
42
  const textFieldProps = useSlotProps({
42
43
  elementType: TextField,
@@ -267,10 +268,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
267
268
  */
268
269
  shouldDisableYear: PropTypes.func,
269
270
  /**
270
- * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
271
- * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
271
+ * If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
272
+ * If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
272
273
  *
273
- * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
274
+ * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
274
275
  *
275
276
  * Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
276
277
  * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
@@ -13,6 +13,7 @@ import { useDateTimeField } from "./useDateTimeField.js";
13
13
  import { useClearableField } from "../hooks/index.js";
14
14
  import { PickersTextField } from "../PickersTextField/index.js";
15
15
  import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
16
+ import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
16
17
  import { jsx as _jsx } from "react/jsx-runtime";
17
18
  /**
18
19
  * Demos:
@@ -36,7 +37,7 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
36
37
  inputProps
37
38
  } = themeProps,
38
39
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
39
- const ownerState = themeProps;
40
+ const ownerState = useFieldOwnerState(themeProps);
40
41
  const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
41
42
  const textFieldProps = useSlotProps({
42
43
  elementType: TextField,
@@ -307,10 +308,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
307
308
  */
308
309
  shouldDisableYear: PropTypes.func,
309
310
  /**
310
- * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
311
- * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
311
+ * If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
312
+ * If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
312
313
  *
313
- * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (e.g: "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
314
+ * Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
314
315
  *
315
316
  * Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
316
317
  * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
@@ -11,6 +11,7 @@ import { TimeIcon, DateRangeIcon } from "../icons/index.js";
11
11
  import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
12
12
  import { getDateTimePickerTabsUtilityClass } from "./dateTimePickerTabsClasses.js";
13
13
  import { isDatePickerView } from "../internals/utils/date-utils.js";
14
+ import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
16
  const viewToTab = view => {
16
17
  if (isDatePickerView(view)) {
@@ -24,10 +25,7 @@ const tabToView = tab => {
24
25
  }
25
26
  return 'hours';
26
27
  };
27
- const useUtilityClasses = ownerState => {
28
- const {
29
- classes
30
- } = ownerState;
28
+ const useUtilityClasses = classes => {
31
29
  const slots = {
32
30
  root: ['root']
33
31
  };
@@ -72,10 +70,14 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
72
70
  view,
73
71
  hidden = typeof window === 'undefined' || window.innerHeight < 667,
74
72
  className,
73
+ classes: classesProp,
75
74
  sx
76
75
  } = props;
77
76
  const translations = usePickerTranslations();
78
- const classes = useUtilityClasses(props);
77
+ const {
78
+ ownerState
79
+ } = usePickerPrivateContext();
80
+ const classes = useUtilityClasses(classesProp);
79
81
  const handleChange = (event, value) => {
80
82
  onViewChange(tabToView(value));
81
83
  };
@@ -83,7 +85,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
83
85
  return null;
84
86
  }
85
87
  return /*#__PURE__*/_jsxs(DateTimePickerTabsRoot, {
86
- ownerState: props,
88
+ ownerState: ownerState,
87
89
  variant: "fullWidth",
88
90
  value: viewToTab(view),
89
91
  onChange: handleChange,