@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
@@ -4,20 +4,22 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import useSlotProps from '@mui/utils/useSlotProps';
6
6
  import composeClasses from '@mui/utils/composeClasses';
7
+ import { useRtl } from '@mui/system/RtlProvider';
7
8
  import { PickersActionBar } from "../PickersActionBar/index.js";
8
9
  import { getPickersLayoutUtilityClass } from "./pickersLayoutClasses.js";
9
10
  import { PickersShortcuts } from "../PickersShortcuts/index.js";
10
11
  import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
12
+ import { usePickerContext } from "../hooks/index.js";
11
13
  import { jsx as _jsx } from "react/jsx-runtime";
12
14
  function toolbarHasView(toolbarProps) {
13
15
  return toolbarProps.view !== null;
14
16
  }
15
17
  const useUtilityClasses = (classes, ownerState) => {
16
18
  const {
17
- isLandscape
19
+ pickerOrientation
18
20
  } = ownerState;
19
21
  const slots = {
20
- root: ['root', isLandscape && 'landscape'],
22
+ root: ['root', pickerOrientation === 'landscape' && 'landscape'],
21
23
  contentWrapper: ['contentWrapper'],
22
24
  toolbar: ['toolbar'],
23
25
  actionBar: ['actionBar'],
@@ -29,10 +31,14 @@ const useUtilityClasses = (classes, ownerState) => {
29
31
  };
30
32
  const usePickerLayout = props => {
31
33
  const {
32
- ownerState: pickersOwnerState
34
+ ownerState: pickerOwnerState
33
35
  } = usePickerPrivateContext();
34
36
  const {
35
- wrapperVariant,
37
+ variant,
38
+ orientation
39
+ } = usePickerContext();
40
+ const isRtl = useRtl();
41
+ const {
36
42
  onAccept,
37
43
  onClear,
38
44
  onCancel,
@@ -44,7 +50,6 @@ const usePickerLayout = props => {
44
50
  onChange,
45
51
  onSelectShortcut,
46
52
  isValid,
47
- isLandscape,
48
53
  children,
49
54
  slots,
50
55
  slotProps,
@@ -54,9 +59,8 @@ const usePickerLayout = props => {
54
59
  // - For pickers value: PickerValidDate | null
55
60
  // - For range pickers value: [PickerValidDate | null, PickerValidDate | null]
56
61
  } = props;
57
- const ownerState = _extends({}, pickersOwnerState, {
58
- wrapperVariant,
59
- isLandscape
62
+ const ownerState = _extends({}, pickerOwnerState, {
63
+ isRtl
60
64
  });
61
65
  const classes = useUtilityClasses(classesProp, ownerState);
62
66
 
@@ -70,7 +74,7 @@ const usePickerLayout = props => {
70
74
  onClear,
71
75
  onCancel,
72
76
  onSetToday,
73
- actions: wrapperVariant === 'desktop' ? [] : ['cancel', 'accept']
77
+ actions: variant === 'desktop' ? [] : ['cancel', 'accept']
74
78
  },
75
79
  className: classes.actionBar,
76
80
  ownerState
@@ -83,7 +87,8 @@ const usePickerLayout = props => {
83
87
  elementType: Toolbar,
84
88
  externalSlotProps: slotProps?.toolbar,
85
89
  additionalProps: {
86
- isLandscape,
90
+ isLandscape: orientation === 'landscape',
91
+ // Will be removed in a follow up PR?
87
92
  onChange,
88
93
  value,
89
94
  view,
@@ -113,7 +118,8 @@ const usePickerLayout = props => {
113
118
  externalSlotProps: slotProps?.shortcuts,
114
119
  additionalProps: {
115
120
  isValid,
116
- isLandscape,
121
+ isLandscape: orientation === 'landscape',
122
+ // Will be removed in a follow up PR?
117
123
  onChange: onSelectShortcut
118
124
  },
119
125
  className: classes.shortcuts,
@@ -125,7 +131,8 @@ const usePickerLayout = props => {
125
131
  content,
126
132
  tabs,
127
133
  actionBar,
128
- shortcuts
134
+ shortcuts,
135
+ ownerState
129
136
  };
130
137
  };
131
138
  export default usePickerLayout;
@@ -13,6 +13,7 @@ import { useTimeField } from "./useTimeField.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 TimeField = /*#__PURE__*/React.forwardRef(function TimeField(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,
@@ -268,10 +269,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
268
269
  */
269
270
  shouldDisableTime: PropTypes.func,
270
271
  /**
271
- * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
272
- * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
272
+ * If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
273
+ * If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
273
274
  *
274
- * 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`.
275
+ * 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`.
275
276
  *
276
277
  * 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.
277
278
  * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
@@ -8,7 +8,7 @@ import { getLocalizedDigits } from "../internals/hooks/useField/useField.utils.j
8
8
  import { usePickerTranslations } from "./usePickerTranslations.js";
9
9
  /**
10
10
  * Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
11
- * This format is localized (e.g: `AAAA` for the year with the French locale) and cannot be parsed by your date library.
11
+ * This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
12
12
  * @param {object} The parameters needed to build the placeholder.
13
13
  * @param {string} params.format Format of the date to use.
14
14
  * @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.0.0-alpha.1
2
+ * @mui/x-date-pickers v8.0.0-alpha.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId"],
3
+ const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId", "classes"],
4
4
  _excluded2 = ["ownerState"],
5
5
  _excluded3 = ["ownerState"];
6
6
  import * as React from 'react';
@@ -13,6 +13,7 @@ import useSlotProps from '@mui/utils/useSlotProps';
13
13
  import IconButton from '@mui/material/IconButton';
14
14
  import { ArrowLeftIcon, ArrowRightIcon } from "../../../icons/index.js";
15
15
  import { getPickersArrowSwitcherUtilityClass } from "./pickersArrowSwitcherClasses.js";
16
+ import { usePickerPrivateContext } from "../../hooks/usePickerPrivateContext.js";
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const PickersArrowSwitcherRoot = styled('div', {
18
19
  name: 'MuiPickersArrowSwitcher',
@@ -44,10 +45,7 @@ const PickersArrowSwitcherButton = styled(IconButton, {
44
45
  }
45
46
  }]
46
47
  });
47
- const useUtilityClasses = ownerState => {
48
- const {
49
- classes
50
- } = ownerState;
48
+ const useUtilityClasses = classes => {
51
49
  const slots = {
52
50
  root: ['root'],
53
51
  spacer: ['spacer'],
@@ -78,11 +76,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
78
76
  isPreviousHidden,
79
77
  onGoToPrevious,
80
78
  previousLabel,
81
- labelId
79
+ labelId,
80
+ classes: classesProp
82
81
  } = props,
83
82
  other = _objectWithoutPropertiesLoose(props, _excluded);
84
- const ownerState = props;
85
- const classes = useUtilityClasses(ownerState);
83
+ const {
84
+ ownerState
85
+ } = usePickerPrivateContext();
86
+ const classes = useUtilityClasses(classesProp);
86
87
  const nextProps = {
87
88
  isDisabled: isNextDisabled,
88
89
  isHidden: isNextHidden,
@@ -108,7 +109,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
108
109
  onClick: previousProps.goTo
109
110
  },
110
111
  ownerState: _extends({}, ownerState, {
111
- hidden: previousProps.isHidden
112
+ hidden: previousProps.isHidden ?? false
112
113
  }),
113
114
  className: clsx(classes.button, classes.previousIconButton)
114
115
  });
@@ -125,7 +126,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
125
126
  onClick: nextProps.goTo
126
127
  },
127
128
  ownerState: _extends({}, ownerState, {
128
- hidden: nextProps.isHidden
129
+ hidden: nextProps.isHidden ?? false
129
130
  }),
130
131
  className: clsx(classes.button, classes.nextIconButton)
131
132
  });
@@ -64,7 +64,6 @@ export const useFieldState = params => {
64
64
  const stateWithoutReferenceDate = {
65
65
  sections,
66
66
  value: valueFromTheOutside,
67
- referenceValue: valueManager.emptyValue,
68
67
  tempValueStrAndroid: null
69
68
  };
70
69
  const granularity = getSectionTypeGranularity(sections);
@@ -0,0 +1,12 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { usePickerPrivateContext } from "./usePickerPrivateContext.js";
4
+ export function useFieldOwnerState(parameters) {
5
+ const {
6
+ ownerState: pickerOwnerState
7
+ } = usePickerPrivateContext();
8
+ return React.useMemo(() => _extends({}, pickerOwnerState, {
9
+ isFieldDisabled: parameters.disabled ?? false,
10
+ isFieldReadOnly: parameters.readOnly ?? false
11
+ }), [pickerOwnerState, parameters.disabled, parameters.readOnly]);
12
+ }
@@ -1,7 +1,7 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { warnOnce } from '@mui/x-internals/warning';
2
3
  import { usePickerValue } from "./usePickerValue.js";
3
4
  import { usePickerViews } from "./usePickerViews.js";
4
- import { usePickerLayoutProps } from "./usePickerLayoutProps.js";
5
5
  import { usePickerProvider } from "./usePickerProvider.js";
6
6
  export const usePicker = ({
7
7
  props,
@@ -35,12 +35,6 @@ export const usePicker = ({
35
35
  propsFromPickerValue: pickerValueResponse.viewProps,
36
36
  rendererInterceptor
37
37
  });
38
- const pickerLayoutResponse = usePickerLayoutProps({
39
- props,
40
- variant,
41
- propsFromPickerValue: pickerValueResponse.layoutProps,
42
- propsFromPickerViews: pickerViewsResponse.layoutProps
43
- });
44
38
  const providerProps = usePickerProvider({
45
39
  props,
46
40
  pickerValueResponse,
@@ -59,7 +53,7 @@ export const usePicker = ({
59
53
  hasUIView: pickerViewsResponse.hasUIView,
60
54
  shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
61
55
  // Picker layout
62
- layoutProps: pickerLayoutResponse.layoutProps,
56
+ layoutProps: _extends({}, pickerViewsResponse.layoutProps, pickerValueResponse.layoutProps),
63
57
  // Picker provider
64
58
  providerProps,
65
59
  // Picker owner state
@@ -5,7 +5,6 @@ import { useOpenState } from "../useOpenState.js";
5
5
  import { useLocalizationContext, useUtils } from "../useUtils.js";
6
6
  import { useValidation } from "../../../validation/index.js";
7
7
  import { useValueWithTimezone } from "../useValueWithTimezone.js";
8
-
9
8
  /**
10
9
  * Decide if the new value should be published
11
10
  * The published value will be passed to `onChange` if defined.
@@ -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";
@@ -0,0 +1 @@
1
+ export {};
@@ -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);
@@ -5,7 +5,7 @@ import useEventCallback from '@mui/utils/useEventCallback';
5
5
  import { useLocalizationContext } from "../internals/hooks/useUtils.js";
6
6
  /**
7
7
  * Utility hook to check if a given value is valid based on the provided validation props.
8
- * @template TValue The value type. It will be either the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
8
+ * @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.
9
9
  * @template TError The validation error type. It will be either `string` or a `null`. It can be in `[start, end]` format in case of range value.
10
10
  * @param {UseValidationOptions<TValue, TError, TValidationProps>} options The options to configure the hook.
11
11
  * @param {TValue} options.value The value to validate.
@@ -5,6 +5,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
5
5
  * Validation props used by the Date Picker, Date Field and Date Calendar components.
6
6
  */
7
7
 
8
+ /**
9
+ * Validation props as received by the validateDate method.
10
+ */
11
+
12
+ /**
13
+ * Name of the props that should be defaulted before being passed to the validateDate method.
14
+ */
15
+
8
16
  export const validateDate = ({
9
17
  props,
10
18
  value,
@@ -6,6 +6,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
6
6
  * Validation props used by the Date Time Picker and Date Time Field components.
7
7
  */
8
8
 
9
+ /**
10
+ * Validation props as received by the validateDateTime method.
11
+ */
12
+
13
+ /**
14
+ * Name of the props that should be defaulted before being passed to the validateDateTime method.
15
+ */
16
+
9
17
  export const validateDateTime = ({
10
18
  adapter,
11
19
  value,
@@ -5,6 +5,14 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
5
5
  * Validation props used by the Time Picker, Time Field and Clock components.
6
6
  */
7
7
 
8
+ /**
9
+ * Validation props as received by the validateTime method.
10
+ */
11
+
12
+ /**
13
+ * Name of the props that should be defaulted before being passed to the validateTime method.
14
+ */
15
+
8
16
  export const validateTime = ({
9
17
  adapter,
10
18
  value,
@@ -438,12 +438,22 @@ class AdapterMoment {
438
438
  const end = this.endOfWeek(this.endOfMonth(value));
439
439
  let count = 0;
440
440
  let current = start;
441
+ let currentDayOfYear = current.get('dayOfYear');
441
442
  const nestedWeeks = [];
442
443
  while (current.isBefore(end)) {
443
444
  const weekNumber = Math.floor(count / 7);
444
445
  nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
445
446
  nestedWeeks[weekNumber].push(current);
447
+ const prevDayOfYear = currentDayOfYear;
446
448
  current = this.addDays(current, 1);
449
+ currentDayOfYear = current.get('dayOfYear');
450
+
451
+ // If there is a TZ change at midnight, adding 1 day may only increase the date by 23 hours to 11pm
452
+ // To fix, bump the date into the next day (add 12 hours) and then revert to the start of the day
453
+ // See https://github.com/moment/moment/issues/4743#issuecomment-811306874 for context.
454
+ if (prevDayOfYear === currentDayOfYear) {
455
+ current = current.add(12, 'h').startOf('day');
456
+ }
447
457
  count += 1;
448
458
  }
449
459
  return nestedWeeks;
@@ -14,10 +14,7 @@ var _styles = require("@mui/material/styles");
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
15
  var _pickersFadeTransitionGroupClasses = require("./pickersFadeTransitionGroupClasses");
16
16
  var _jsxRuntime = require("react/jsx-runtime");
17
- const useUtilityClasses = ownerState => {
18
- const {
19
- classes
20
- } = ownerState;
17
+ const useUtilityClasses = classes => {
21
18
  const slots = {
22
19
  root: ['root']
23
20
  };
@@ -44,9 +41,10 @@ function PickersFadeTransitionGroup(inProps) {
44
41
  children,
45
42
  className,
46
43
  reduceAnimations,
47
- transKey
44
+ transKey,
45
+ classes: classesProp
48
46
  } = props;
49
- const classes = useUtilityClasses(props);
47
+ const classes = useUtilityClasses(classesProp);
50
48
  const theme = (0, _styles.useTheme)();
51
49
  if (reduceAnimations) {
52
50
  return children;
@@ -14,11 +14,11 @@ var _styles = require("@mui/material/styles");
14
14
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
15
  var _reactTransitionGroup = require("react-transition-group");
16
16
  var _pickersSlideTransitionClasses = require("./pickersSlideTransitionClasses");
17
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
17
18
  var _jsxRuntime = require("react/jsx-runtime");
18
19
  const _excluded = ["children", "className", "reduceAnimations", "slideDirection", "transKey", "classes"];
19
- const useUtilityClasses = ownerState => {
20
+ const useUtilityClasses = (classes, ownerState) => {
20
21
  const {
21
- classes,
22
22
  slideDirection
23
23
  } = ownerState;
24
24
  const slots = {
@@ -107,11 +107,18 @@ function PickersSlideTransition(inProps) {
107
107
  children,
108
108
  className,
109
109
  reduceAnimations,
110
- transKey
111
- // extracting `classes` from `other`
110
+ slideDirection,
111
+ transKey,
112
+ classes: classesProp
112
113
  } = props,
113
114
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
114
- const classes = useUtilityClasses(props);
115
+ const {
116
+ ownerState: pickerOwnerState
117
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
118
+ const ownerState = (0, _extends2.default)({}, pickerOwnerState, {
119
+ slideDirection
120
+ });
121
+ const classes = useUtilityClasses(classesProp, ownerState);
115
122
  const theme = (0, _styles.useTheme)();
116
123
  if (reduceAnimations) {
117
124
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
@@ -19,6 +19,7 @@ var _useDateField = require("./useDateField");
19
19
  var _hooks = require("../hooks");
20
20
  var _PickersTextField = require("../PickersTextField");
21
21
  var _convertFieldResponseIntoMuiTextFieldProps = require("../internals/utils/convertFieldResponseIntoMuiTextFieldProps");
22
+ var _useFieldOwnerState = require("../internals/hooks/useFieldOwnerState");
22
23
  var _jsxRuntime = require("react/jsx-runtime");
23
24
  const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
24
25
  /**
@@ -43,7 +44,7 @@ const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function Dat
43
44
  inputProps
44
45
  } = themeProps,
45
46
  other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
46
- const ownerState = themeProps;
47
+ const ownerState = (0, _useFieldOwnerState.useFieldOwnerState)(themeProps);
47
48
  const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
48
49
  const textFieldProps = (0, _useSlotProps.default)({
49
50
  elementType: TextField,
@@ -274,10 +275,10 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
274
275
  */
275
276
  shouldDisableYear: _propTypes.default.func,
276
277
  /**
277
- * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
278
- * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
278
+ * If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
279
+ * If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
279
280
  *
280
- * 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`.
281
+ * 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`.
281
282
  *
282
283
  * 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.
283
284
  * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
@@ -19,6 +19,7 @@ var _useDateTimeField = require("./useDateTimeField");
19
19
  var _hooks = require("../hooks");
20
20
  var _PickersTextField = require("../PickersTextField");
21
21
  var _convertFieldResponseIntoMuiTextFieldProps = require("../internals/utils/convertFieldResponseIntoMuiTextFieldProps");
22
+ var _useFieldOwnerState = require("../internals/hooks/useFieldOwnerState");
22
23
  var _jsxRuntime = require("react/jsx-runtime");
23
24
  const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
24
25
  /**
@@ -43,7 +44,7 @@ const DateTimeField = exports.DateTimeField = /*#__PURE__*/React.forwardRef(func
43
44
  inputProps
44
45
  } = themeProps,
45
46
  other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
46
- const ownerState = themeProps;
47
+ const ownerState = (0, _useFieldOwnerState.useFieldOwnerState)(themeProps);
47
48
  const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? _TextField.default : _PickersTextField.PickersTextField);
48
49
  const textFieldProps = (0, _useSlotProps.default)({
49
50
  elementType: TextField,
@@ -314,10 +315,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
314
315
  */
315
316
  shouldDisableYear: _propTypes.default.func,
316
317
  /**
317
- * If `true`, the format will respect the leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
318
- * If `false`, the format will always add leading zeroes (e.g: on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
318
+ * If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
319
+ * If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
319
320
  *
320
- * 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`.
321
+ * 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`.
321
322
  *
322
323
  * 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.
323
324
  * If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
@@ -18,6 +18,7 @@ var _icons = require("../icons");
18
18
  var _usePickerTranslations = require("../hooks/usePickerTranslations");
19
19
  var _dateTimePickerTabsClasses = require("./dateTimePickerTabsClasses");
20
20
  var _dateUtils = require("../internals/utils/date-utils");
21
+ var _usePickerPrivateContext = require("../internals/hooks/usePickerPrivateContext");
21
22
  var _jsxRuntime = require("react/jsx-runtime");
22
23
  const viewToTab = view => {
23
24
  if ((0, _dateUtils.isDatePickerView)(view)) {
@@ -31,10 +32,7 @@ const tabToView = tab => {
31
32
  }
32
33
  return 'hours';
33
34
  };
34
- const useUtilityClasses = ownerState => {
35
- const {
36
- classes
37
- } = ownerState;
35
+ const useUtilityClasses = classes => {
38
36
  const slots = {
39
37
  root: ['root']
40
38
  };
@@ -79,10 +77,14 @@ const DateTimePickerTabs = exports.DateTimePickerTabs = function DateTimePickerT
79
77
  view,
80
78
  hidden = typeof window === 'undefined' || window.innerHeight < 667,
81
79
  className,
80
+ classes: classesProp,
82
81
  sx
83
82
  } = props;
84
83
  const translations = (0, _usePickerTranslations.usePickerTranslations)();
85
- const classes = useUtilityClasses(props);
84
+ const {
85
+ ownerState
86
+ } = (0, _usePickerPrivateContext.usePickerPrivateContext)();
87
+ const classes = useUtilityClasses(classesProp);
86
88
  const handleChange = (event, value) => {
87
89
  onViewChange(tabToView(value));
88
90
  };
@@ -90,7 +92,7 @@ const DateTimePickerTabs = exports.DateTimePickerTabs = function DateTimePickerT
90
92
  return null;
91
93
  }
92
94
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DateTimePickerTabsRoot, {
93
- ownerState: props,
95
+ ownerState: ownerState,
94
96
  variant: "fullWidth",
95
97
  value: viewToTab(view),
96
98
  onChange: handleChange,
@@ -18,11 +18,8 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
18
18
  var _dimensions = require("../internals/constants/dimensions");
19
19
  var _dayCalendarSkeletonClasses = require("./dayCalendarSkeletonClasses");
20
20
  var _jsxRuntime = require("react/jsx-runtime");
21
- const _excluded = ["className"];
22
- const useUtilityClasses = ownerState => {
23
- const {
24
- classes
25
- } = ownerState;
21
+ const _excluded = ["className", "classes"];
22
+ const useUtilityClasses = classes => {
26
23
  const slots = {
27
24
  root: ['root'],
28
25
  week: ['week'],
@@ -52,14 +49,9 @@ const DayCalendarSkeletonDay = (0, _styles.styled)(_Skeleton.default, {
52
49
  overridesResolver: (props, styles) => styles.daySkeleton
53
50
  })({
54
51
  margin: `0 ${_dimensions.DAY_MARGIN}px`,
55
- variants: [{
56
- props: {
57
- day: 0
58
- },
59
- style: {
60
- visibility: 'hidden'
61
- }
62
- }]
52
+ '&[data-day-in-month="0"]': {
53
+ visibility: 'hidden'
54
+ }
63
55
  });
64
56
  const monthMap = [[0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0]];
65
57
 
@@ -78,23 +70,22 @@ function DayCalendarSkeleton(inProps) {
78
70
  name: 'MuiDayCalendarSkeleton'
79
71
  });
80
72
  const {
81
- className
73
+ className,
74
+ classes: classesProp
82
75
  } = props,
83
76
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
84
- const classes = useUtilityClasses(other);
77
+ const classes = useUtilityClasses(classesProp);
85
78
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonRoot, (0, _extends2.default)({
86
79
  className: (0, _clsx.default)(classes.root, className)
87
80
  }, other, {
88
81
  children: monthMap.map((week, index) => /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonWeek, {
89
82
  className: classes.week,
90
- children: week.map((day, index2) => /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonDay, {
83
+ children: week.map((dayInMonth, index2) => /*#__PURE__*/(0, _jsxRuntime.jsx)(DayCalendarSkeletonDay, {
91
84
  variant: "circular",
92
85
  width: _dimensions.DAY_SIZE,
93
86
  height: _dimensions.DAY_SIZE,
94
87
  className: classes.daySkeleton,
95
- ownerState: {
96
- day
97
- }
88
+ "data-day-in-month": dayInMonth
98
89
  }, index2))
99
90
  }, index))
100
91
  }));