@mui/x-date-pickers 8.0.0-alpha.6 → 8.0.0-alpha.7

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 (281) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +2 -4
  2. package/AdapterDateFns/AdapterDateFns.js +49 -47
  3. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -1
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +2 -4
  5. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
  6. package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.d.ts → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts} +2 -2
  7. package/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
  8. package/AdapterDateFnsJalaliV2/index.d.ts +1 -0
  9. package/AdapterDateFnsJalaliV2/index.js +1 -0
  10. package/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/package.json +1 -1
  11. package/{AdapterDateFnsV3/AdapterDateFnsV3.d.ts → AdapterDateFnsV2/AdapterDateFnsV2.d.ts} +2 -2
  12. package/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
  13. package/AdapterDateFnsV2/index.d.ts +1 -0
  14. package/AdapterDateFnsV2/index.js +1 -0
  15. package/{AdapterDateFnsV3 → AdapterDateFnsV2}/package.json +1 -1
  16. package/AdapterDayjs/AdapterDayjs.d.ts +1 -1
  17. package/AdapterLuxon/AdapterLuxon.d.ts +1 -1
  18. package/AdapterMoment/AdapterMoment.d.ts +1 -1
  19. package/CHANGELOG.md +127 -1
  20. package/DateCalendar/DateCalendar.js +1 -1
  21. package/DateCalendar/PickersFadeTransitionGroup.d.ts +1 -1
  22. package/DateCalendar/PickersSlideTransition.d.ts +1 -1
  23. package/DateField/useDateField.d.ts +1 -1
  24. package/DateField/useDateField.js +13 -11
  25. package/DatePicker/DatePicker.js +1 -1
  26. package/DatePicker/DatePicker.types.d.ts +5 -0
  27. package/DatePicker/DatePickerToolbar.d.ts +1 -2
  28. package/DatePicker/DatePickerToolbar.js +7 -11
  29. package/DatePicker/shared.d.ts +1 -1
  30. package/DateTimeField/useDateTimeField.d.ts +1 -1
  31. package/DateTimeField/useDateTimeField.js +13 -11
  32. package/DateTimePicker/DateTimePicker.js +2 -2
  33. package/DateTimePicker/DateTimePickerTabs.js +2 -2
  34. package/DateTimePicker/DateTimePickerToolbar.d.ts +6 -2
  35. package/DateTimePicker/DateTimePickerToolbar.js +36 -31
  36. package/DateTimePicker/shared.d.ts +1 -1
  37. package/DesktopDatePicker/DesktopDatePicker.js +9 -3
  38. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +5 -0
  39. package/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  40. package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  41. package/DesktopTimePicker/DesktopTimePicker.js +3 -7
  42. package/MobileDatePicker/MobileDatePicker.js +2 -2
  43. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  44. package/MobileTimePicker/MobileTimePicker.js +2 -2
  45. package/PickersActionBar/PickersActionBar.d.ts +6 -3
  46. package/PickersActionBar/PickersActionBar.js +6 -3
  47. package/PickersLayout/PickersLayout.js +1 -5
  48. package/PickersLayout/PickersLayout.types.d.ts +2 -3
  49. package/PickersLayout/usePickerLayout.js +12 -31
  50. package/PickersShortcuts/PickersShortcuts.d.ts +2 -5
  51. package/PickersShortcuts/PickersShortcuts.js +13 -10
  52. package/PickersShortcuts/index.d.ts +1 -1
  53. package/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  54. package/PickersTextField/PickersTextField.js +1 -1
  55. package/TimeField/useTimeField.d.ts +1 -1
  56. package/TimeField/useTimeField.js +13 -11
  57. package/TimePicker/TimePicker.js +2 -2
  58. package/TimePicker/TimePickerToolbar.d.ts +1 -2
  59. package/TimePicker/TimePickerToolbar.js +20 -18
  60. package/TimePicker/shared.d.ts +1 -1
  61. package/hooks/index.d.ts +1 -0
  62. package/hooks/index.js +2 -1
  63. package/hooks/useIsValidValue.d.ts +7 -0
  64. package/hooks/useIsValidValue.js +11 -0
  65. package/hooks/usePickerActionsContext.d.ts +3 -1
  66. package/hooks/usePickerActionsContext.js +0 -1
  67. package/hooks/usePickerContext.d.ts +2 -2
  68. package/hooks/usePickerContext.js +1 -1
  69. package/index.d.ts +1 -0
  70. package/index.js +3 -2
  71. package/internals/components/PickerProvider.d.ts +11 -10
  72. package/internals/components/PickerProvider.js +8 -3
  73. package/internals/components/PickersToolbar.d.ts +2 -3
  74. package/internals/components/PickersToolbar.js +1 -1
  75. package/internals/hooks/date-helpers-hooks.js +4 -3
  76. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -3
  77. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +2 -2
  78. package/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  79. package/internals/hooks/useField/index.d.ts +1 -1
  80. package/internals/hooks/useField/index.js +1 -1
  81. package/internals/hooks/useField/useField.d.ts +10 -1
  82. package/internals/hooks/useField/useField.js +17 -1
  83. package/internals/hooks/useField/useField.utils.js +2 -2
  84. package/internals/hooks/useField/useFieldState.js +2 -2
  85. package/internals/hooks/useField/useFieldV6TextField.js +2 -2
  86. package/internals/hooks/useMobilePicker/useMobilePicker.js +1 -3
  87. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +2 -2
  88. package/internals/hooks/useOpenState.js +3 -2
  89. package/internals/hooks/usePicker/usePicker.d.ts +1 -1
  90. package/internals/hooks/usePicker/usePicker.js +0 -6
  91. package/internals/hooks/usePicker/usePicker.types.d.ts +5 -6
  92. package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -5
  93. package/internals/hooks/usePicker/usePickerProvider.js +4 -2
  94. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  95. package/internals/hooks/usePicker/usePickerValue.js +67 -184
  96. package/internals/hooks/usePicker/usePickerValue.types.d.ts +48 -54
  97. package/internals/hooks/usePicker/usePickerViews.d.ts +27 -23
  98. package/internals/hooks/usePicker/usePickerViews.js +17 -11
  99. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  100. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -2
  101. package/internals/hooks/useUtils.js +1 -1
  102. package/internals/index.d.ts +5 -3
  103. package/internals/index.js +5 -3
  104. package/internals/models/index.d.ts +1 -0
  105. package/internals/models/index.js +2 -1
  106. package/internals/models/manager.d.ts +12 -0
  107. package/internals/models/manager.js +1 -0
  108. package/internals/models/props/basePickerProps.d.ts +2 -2
  109. package/internals/models/props/toolbar.d.ts +1 -5
  110. package/internals/utils/date-utils.js +1 -1
  111. package/internals/utils/valueManagers.js +4 -4
  112. package/locales/index.d.ts +1 -0
  113. package/locales/index.js +1 -0
  114. package/locales/nbNO.js +15 -19
  115. package/locales/utils/getPickersLocalization.js +1 -1
  116. package/locales/zhTW.d.ts +80 -0
  117. package/locales/zhTW.js +73 -0
  118. package/managers/index.d.ts +6 -0
  119. package/managers/index.js +3 -0
  120. package/managers/package.json +6 -0
  121. package/managers/useDateManager.d.ts +27 -0
  122. package/managers/useDateManager.js +47 -0
  123. package/managers/useDateTimeManager.d.ts +28 -0
  124. package/managers/useDateTimeManager.js +52 -0
  125. package/managers/useTimeManager.d.ts +28 -0
  126. package/managers/useTimeManager.js +43 -0
  127. package/models/adapters.d.ts +1 -1
  128. package/models/index.d.ts +1 -0
  129. package/models/index.js +1 -0
  130. package/models/manager.d.ts +78 -0
  131. package/models/manager.js +1 -0
  132. package/models/pickers.d.ts +7 -0
  133. package/modern/AdapterDateFns/AdapterDateFns.js +49 -47
  134. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +48 -46
  135. package/modern/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +45 -52
  136. package/modern/AdapterDateFnsJalaliV2/index.js +1 -0
  137. package/modern/{AdapterDateFnsV3/AdapterDateFnsV3.js → AdapterDateFnsV2/AdapterDateFnsV2.js} +46 -54
  138. package/modern/AdapterDateFnsV2/index.js +1 -0
  139. package/modern/DateCalendar/DateCalendar.js +1 -1
  140. package/modern/DateField/useDateField.js +13 -11
  141. package/modern/DatePicker/DatePicker.js +1 -1
  142. package/modern/DatePicker/DatePickerToolbar.js +7 -11
  143. package/modern/DateTimeField/useDateTimeField.js +13 -11
  144. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  145. package/modern/DateTimePicker/DateTimePickerTabs.js +2 -2
  146. package/modern/DateTimePicker/DateTimePickerToolbar.js +36 -31
  147. package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -3
  148. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  149. package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  150. package/modern/DesktopTimePicker/DesktopTimePicker.js +3 -7
  151. package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
  152. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  153. package/modern/MobileTimePicker/MobileTimePicker.js +2 -2
  154. package/modern/PickersActionBar/PickersActionBar.js +6 -3
  155. package/modern/PickersLayout/PickersLayout.js +1 -5
  156. package/modern/PickersLayout/usePickerLayout.js +12 -31
  157. package/modern/PickersShortcuts/PickersShortcuts.js +13 -10
  158. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  159. package/modern/PickersTextField/PickersTextField.js +1 -1
  160. package/modern/TimeField/useTimeField.js +13 -11
  161. package/modern/TimePicker/TimePicker.js +2 -2
  162. package/modern/TimePicker/TimePickerToolbar.js +20 -18
  163. package/modern/hooks/index.js +2 -1
  164. package/modern/hooks/useIsValidValue.js +11 -0
  165. package/modern/hooks/usePickerActionsContext.js +0 -1
  166. package/modern/hooks/usePickerContext.js +1 -1
  167. package/modern/index.js +3 -2
  168. package/modern/internals/components/PickerProvider.js +8 -3
  169. package/modern/internals/components/PickersToolbar.js +1 -1
  170. package/modern/internals/hooks/date-helpers-hooks.js +4 -3
  171. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -3
  172. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  173. package/modern/internals/hooks/useField/index.js +1 -1
  174. package/modern/internals/hooks/useField/useField.js +17 -1
  175. package/modern/internals/hooks/useField/useField.utils.js +2 -2
  176. package/modern/internals/hooks/useField/useFieldState.js +2 -2
  177. package/modern/internals/hooks/useField/useFieldV6TextField.js +2 -2
  178. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +1 -3
  179. package/modern/internals/hooks/useOpenState.js +3 -2
  180. package/modern/internals/hooks/usePicker/usePicker.js +0 -6
  181. package/modern/internals/hooks/usePicker/usePickerProvider.js +4 -2
  182. package/modern/internals/hooks/usePicker/usePickerValue.js +67 -184
  183. package/modern/internals/hooks/usePicker/usePickerViews.js +17 -11
  184. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  185. package/modern/internals/hooks/useUtils.js +1 -1
  186. package/modern/internals/index.js +5 -3
  187. package/modern/internals/models/index.js +2 -1
  188. package/modern/internals/models/manager.js +1 -0
  189. package/modern/internals/utils/date-utils.js +1 -1
  190. package/modern/internals/utils/valueManagers.js +4 -4
  191. package/modern/locales/index.js +1 -0
  192. package/modern/locales/nbNO.js +15 -19
  193. package/modern/locales/utils/getPickersLocalization.js +1 -1
  194. package/modern/locales/zhTW.js +73 -0
  195. package/modern/managers/index.js +3 -0
  196. package/modern/managers/useDateManager.js +47 -0
  197. package/modern/managers/useDateTimeManager.js +52 -0
  198. package/modern/managers/useTimeManager.js +43 -0
  199. package/modern/models/index.js +1 -0
  200. package/modern/models/manager.js +1 -0
  201. package/node/AdapterDateFns/AdapterDateFns.js +97 -97
  202. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +97 -96
  203. package/node/{AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.js → AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js} +94 -101
  204. package/node/{AdapterDateFnsJalaliV3 → AdapterDateFnsJalaliV2}/index.js +1 -1
  205. package/node/AdapterDateFnsV2/AdapterDateFnsV2.js +291 -0
  206. package/node/{AdapterDateFnsV3 → AdapterDateFnsV2}/index.js +1 -1
  207. package/node/DateCalendar/DateCalendar.js +1 -1
  208. package/node/DateField/useDateField.js +12 -10
  209. package/node/DatePicker/DatePicker.js +1 -1
  210. package/node/DatePicker/DatePickerToolbar.js +7 -11
  211. package/node/DateTimeField/useDateTimeField.js +12 -10
  212. package/node/DateTimePicker/DateTimePicker.js +2 -2
  213. package/node/DateTimePicker/DateTimePickerTabs.js +2 -2
  214. package/node/DateTimePicker/DateTimePickerToolbar.js +36 -31
  215. package/node/DesktopDatePicker/DesktopDatePicker.js +9 -3
  216. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +13 -10
  217. package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +1 -5
  218. package/node/DesktopTimePicker/DesktopTimePicker.js +3 -7
  219. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  220. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  221. package/node/MobileTimePicker/MobileTimePicker.js +2 -2
  222. package/node/PickersActionBar/PickersActionBar.js +8 -5
  223. package/node/PickersLayout/PickersLayout.js +1 -5
  224. package/node/PickersLayout/usePickerLayout.js +16 -35
  225. package/node/PickersShortcuts/PickersShortcuts.js +13 -10
  226. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +7 -0
  227. package/node/PickersTextField/PickersTextField.js +1 -1
  228. package/node/TimeField/useTimeField.js +12 -10
  229. package/node/TimePicker/TimePicker.js +2 -2
  230. package/node/TimePicker/TimePickerToolbar.js +20 -18
  231. package/node/hooks/index.js +8 -1
  232. package/node/hooks/useIsValidValue.js +18 -0
  233. package/node/hooks/usePickerContext.js +1 -1
  234. package/node/index.js +13 -1
  235. package/node/internals/components/PickerProvider.js +8 -3
  236. package/node/internals/components/PickersToolbar.js +1 -1
  237. package/node/internals/hooks/date-helpers-hooks.js +4 -3
  238. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -3
  239. package/node/internals/hooks/useField/buildSectionsFromFormat.js +1 -1
  240. package/node/internals/hooks/useField/index.js +6 -0
  241. package/node/internals/hooks/useField/useField.js +18 -1
  242. package/node/internals/hooks/useField/useField.utils.js +2 -2
  243. package/node/internals/hooks/useField/useFieldState.js +2 -2
  244. package/node/internals/hooks/useField/useFieldV6TextField.js +2 -2
  245. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +1 -3
  246. package/node/internals/hooks/useOpenState.js +4 -2
  247. package/node/internals/hooks/usePicker/usePicker.js +0 -7
  248. package/node/internals/hooks/usePicker/usePickerProvider.js +4 -2
  249. package/node/internals/hooks/usePicker/usePickerValue.js +67 -184
  250. package/node/internals/hooks/usePicker/usePickerViews.js +17 -12
  251. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -4
  252. package/node/internals/hooks/useUtils.js +1 -1
  253. package/node/internals/index.js +26 -18
  254. package/node/internals/models/index.js +11 -0
  255. package/node/internals/models/manager.js +5 -0
  256. package/node/internals/utils/date-utils.js +1 -1
  257. package/node/internals/utils/valueManagers.js +4 -4
  258. package/node/locales/index.js +11 -0
  259. package/node/locales/nbNO.js +15 -19
  260. package/node/locales/utils/getPickersLocalization.js +1 -1
  261. package/node/locales/zhTW.js +79 -0
  262. package/node/managers/index.js +26 -0
  263. package/node/managers/useDateManager.js +55 -0
  264. package/node/managers/useDateTimeManager.js +60 -0
  265. package/node/managers/useTimeManager.js +51 -0
  266. package/node/models/index.js +11 -0
  267. package/node/models/manager.js +5 -0
  268. package/package.json +3 -3
  269. package/themeAugmentation/props.d.ts +1 -1
  270. package/validation/extractValidationProps.d.ts +1 -1
  271. package/AdapterDateFnsJalaliV3/index.d.ts +0 -1
  272. package/AdapterDateFnsJalaliV3/index.js +0 -1
  273. package/AdapterDateFnsV3/index.d.ts +0 -1
  274. package/AdapterDateFnsV3/index.js +0 -1
  275. package/internals/hooks/defaultizedFieldProps.d.ts +0 -18
  276. package/internals/hooks/defaultizedFieldProps.js +0 -40
  277. package/modern/AdapterDateFnsJalaliV3/index.js +0 -1
  278. package/modern/AdapterDateFnsV3/index.js +0 -1
  279. package/modern/internals/hooks/defaultizedFieldProps.js +0 -40
  280. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -299
  281. package/node/internals/hooks/defaultizedFieldProps.js +0 -50
@@ -27,11 +27,12 @@ export function usePreviousMonthDisabled(month, {
27
27
  }
28
28
  export function useMeridiemMode(date, ampm, onChange, selectionState) {
29
29
  const utils = useUtils();
30
- const meridiemMode = getMeridiem(date, utils);
30
+ const cleanDate = React.useMemo(() => !utils.isValid(date) ? null : date, [utils, date]);
31
+ const meridiemMode = getMeridiem(cleanDate, utils);
31
32
  const handleMeridiemChange = React.useCallback(mode => {
32
- const timeWithMeridiem = date == null ? null : convertToMeridiem(date, mode, Boolean(ampm), utils);
33
+ const timeWithMeridiem = cleanDate == null ? null : convertToMeridiem(cleanDate, mode, Boolean(ampm), utils);
33
34
  onChange(timeWithMeridiem, selectionState ?? 'partial');
34
- }, [ampm, date, onChange, selectionState, utils]);
35
+ }, [ampm, cleanDate, onChange, selectionState, utils]);
35
36
  return {
36
37
  meridiemMode,
37
38
  handleMeridiemChange
@@ -53,7 +53,6 @@ export const useDesktopPicker = _ref => {
53
53
  const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
54
54
  const {
55
55
  hasUIView,
56
- layoutProps,
57
56
  providerProps,
58
57
  renderCurrentView,
59
58
  shouldRestoreFocus,
@@ -64,7 +63,6 @@ export const useDesktopPicker = _ref => {
64
63
  fieldRef,
65
64
  localeText,
66
65
  autoFocusView: true,
67
- additionalViewProps: {},
68
66
  variant: 'desktop'
69
67
  }));
70
68
  const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
@@ -180,7 +178,7 @@ export const useDesktopPicker = _ref => {
180
178
  slotProps: slotProps,
181
179
  shouldRestoreFocus: shouldRestoreFocus,
182
180
  reduceAnimations: reduceAnimations,
183
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
181
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
184
182
  slots: slots,
185
183
  slotProps: slotProps,
186
184
  children: renderCurrentView()
@@ -113,7 +113,7 @@ const createSection = ({
113
113
  const sectionConfig = getDateSectionConfigFromFormatToken(utils, token);
114
114
  const hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(utils, sectionConfig.contentType, sectionConfig.type, token);
115
115
  const hasLeadingZerosInInput = shouldRespectLeadingZeros ? hasLeadingZerosInFormat : sectionConfig.contentType === 'digit';
116
- const isValidDate = date != null && utils.isValid(date);
116
+ const isValidDate = utils.isValid(date);
117
117
  let sectionValue = isValidDate ? utils.formatByString(date, token) : '';
118
118
  let maxLength = null;
119
119
  if (hasLeadingZerosInInput) {
@@ -1,2 +1,2 @@
1
- export { useField } from "./useField.js";
1
+ export { useField, useFieldInternalPropsWithDefaults } from "./useField.js";
2
2
  export { createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./useField.utils.js";
@@ -4,12 +4,28 @@ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
4
4
  import useEventCallback from '@mui/utils/useEventCallback';
5
5
  import { useRtl } from '@mui/system/RtlProvider';
6
6
  import { useValidation } from "../../../validation/index.js";
7
- import { useUtils } from "../useUtils.js";
7
+ import { useLocalizationContext, useUtils } from "../useUtils.js";
8
8
  import { adjustSectionValue, getSectionOrder } from "./useField.utils.js";
9
9
  import { useFieldState } from "./useFieldState.js";
10
10
  import { useFieldCharacterEditing } from "./useFieldCharacterEditing.js";
11
11
  import { useFieldV7TextField } from "./useFieldV7TextField.js";
12
12
  import { useFieldV6TextField } from "./useFieldV6TextField.js";
13
+ /**
14
+ * Applies the default values to the field internal props.
15
+ * This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
16
+ * It is only here to allow the migration to be done in smaller steps.
17
+ */
18
+ export const useFieldInternalPropsWithDefaults = ({
19
+ manager,
20
+ internalProps
21
+ }) => {
22
+ const localizationContext = useLocalizationContext();
23
+ return React.useMemo(() => {
24
+ return manager.internal_applyDefaultsToFieldInternalProps(_extends({}, localizationContext, {
25
+ internalProps
26
+ }));
27
+ }, [manager, internalProps, localizationContext]);
28
+ };
13
29
  export const useField = params => {
14
30
  const utils = useUtils();
15
31
  const {
@@ -361,7 +361,7 @@ export const getSectionsBoundaries = (utils, localizedDigits, timezone) => {
361
361
  currentDate
362
362
  }) => ({
363
363
  minimum: 1,
364
- maximum: currentDate != null && utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth,
364
+ maximum: utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth,
365
365
  longestMonth: longestMonth
366
366
  }),
367
367
  weekDay: ({
@@ -509,7 +509,7 @@ export const mergeDateIntoReferenceDate = (utils, dateToTransferFrom, sections,
509
509
  }, referenceDate);
510
510
  export const isAndroid = () => navigator.userAgent.toLowerCase().includes('android');
511
511
 
512
- // TODO v8: Remove if we drop the v6 TextField approach.
512
+ // TODO v9: Remove
513
513
  export const getSectionOrder = (sections, shouldApplyRTL) => {
514
514
  const neighbors = {};
515
515
  if (!shouldApplyRTL) {
@@ -148,7 +148,7 @@ export const useFieldState = params => {
148
148
  const updateValueFromValueStr = valueStr => {
149
149
  const parseDateStr = (dateStr, referenceDate) => {
150
150
  const date = utils.parse(dateStr, format);
151
- if (date == null || !utils.isValid(date)) {
151
+ if (!utils.isValid(date)) {
152
152
  return null;
153
153
  }
154
154
  const sections = buildSectionsFromFormat({
@@ -199,7 +199,7 @@ export const useFieldState = params => {
199
199
  * Then we merge the value of the modified sections into the reference date.
200
200
  * This makes sure that we don't lose some information of the initial date (like the time on a date field).
201
201
  */
202
- if (newActiveDate != null && utils.isValid(newActiveDate)) {
202
+ if (utils.isValid(newActiveDate)) {
203
203
  const mergedDate = mergeDateIntoReferenceDate(utils, newActiveDate, newActiveDateSections, activeDateManager.referenceDate, true);
204
204
  values = activeDateManager.getNewValuesFromNewActiveDate(mergedDate);
205
205
  shouldPublish = true;
@@ -35,8 +35,8 @@ export const addPositionPropertiesToSections = (sections, localizedDigits, isRtl
35
35
  };
36
36
  export const useFieldV6TextField = params => {
37
37
  const isRtl = useRtl();
38
- const focusTimeoutRef = React.useRef();
39
- const selectionSyncTimeoutRef = React.useRef();
38
+ const focusTimeoutRef = React.useRef(undefined);
39
+ const selectionSyncTimeoutRef = React.useRef(undefined);
40
40
  const {
41
41
  forwardedProps: {
42
42
  onFocus,
@@ -46,7 +46,6 @@ export const useMobilePicker = _ref => {
46
46
  const labelId = useId();
47
47
  const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
48
48
  const {
49
- layoutProps,
50
49
  providerProps,
51
50
  renderCurrentView,
52
51
  fieldProps: pickerFieldProps,
@@ -56,7 +55,6 @@ export const useMobilePicker = _ref => {
56
55
  fieldRef,
57
56
  localeText,
58
57
  autoFocusView: true,
59
- additionalViewProps: {},
60
58
  variant: 'mobile'
61
59
  }));
62
60
  const Field = slots.field;
@@ -129,7 +127,7 @@ export const useMobilePicker = _ref => {
129
127
  })), /*#__PURE__*/_jsx(PickersModalDialog, {
130
128
  slots: slots,
131
129
  slotProps: slotProps,
132
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
130
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
133
131
  slots: slots,
134
132
  slotProps: slotProps,
135
133
  children: renderCurrentView()
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import useEventCallback from '@mui/utils/useEventCallback';
2
3
  export const useOpenState = ({
3
4
  open,
4
5
  onOpen,
@@ -17,7 +18,7 @@ export const useOpenState = ({
17
18
  setOpenState(open);
18
19
  }
19
20
  }, [isControllingOpenProp, open]);
20
- const setOpen = React.useCallback(action => {
21
+ const setOpen = useEventCallback(action => {
21
22
  const newOpen = typeof action === 'function' ? action(openState) : action;
22
23
  if (!isControllingOpenProp) {
23
24
  setOpenState(newOpen);
@@ -28,7 +29,7 @@ export const useOpenState = ({
28
29
  if (!newOpen && onClose) {
29
30
  onClose();
30
31
  }
31
- }, [isControllingOpenProp, onOpen, onClose, openState]);
32
+ });
32
33
  return {
33
34
  open: openState,
34
35
  setOpen
@@ -1,4 +1,3 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
1
  import { warnOnce } from '@mui/x-internals/warning';
3
2
  import { usePickerValue } from "./usePickerValue.js";
4
3
  import { usePickerViews } from "./usePickerViews.js";
@@ -8,7 +7,6 @@ export const usePicker = ({
8
7
  valueManager,
9
8
  valueType,
10
9
  variant,
11
- additionalViewProps,
12
10
  validator,
13
11
  autoFocusView,
14
12
  rendererInterceptor,
@@ -24,12 +22,10 @@ export const usePicker = ({
24
22
  props,
25
23
  valueManager,
26
24
  valueType,
27
- variant,
28
25
  validator
29
26
  });
30
27
  const pickerViewsResponse = usePickerViews({
31
28
  props,
32
- additionalViewProps,
33
29
  autoFocusView,
34
30
  fieldRef,
35
31
  propsFromPickerValue: pickerValueResponse.viewProps,
@@ -50,8 +46,6 @@ export const usePicker = ({
50
46
  renderCurrentView: pickerViewsResponse.renderCurrentView,
51
47
  hasUIView: pickerViewsResponse.provider.hasUIView,
52
48
  shouldRestoreFocus: pickerViewsResponse.shouldRestoreFocus,
53
- // Picker layout
54
- layoutProps: _extends({}, pickerValueResponse.layoutProps),
55
49
  // Picker provider
56
50
  providerProps,
57
51
  // Picker owner state
@@ -62,11 +62,13 @@ export function usePickerProvider(parameters) {
62
62
  const privateContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.privateContextValue, {
63
63
  ownerState
64
64
  }), [paramsFromUsePickerValue, ownerState]);
65
+ const actionsContextValue = React.useMemo(() => _extends({}, paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue), [paramsFromUsePickerValue.actionsContextValue, paramsFromUsePickerViews.actionsContextValue]);
65
66
  return {
66
67
  localeText,
67
68
  contextValue,
68
- actionsContextValue: paramsFromUsePickerValue.actionsContextValue,
69
- privateContextValue
69
+ privateContextValue,
70
+ actionsContextValue,
71
+ isValidContextValue: paramsFromUsePickerValue.isValidContextValue
70
72
  };
71
73
  }
72
74
 
@@ -5,106 +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
- * Decide if the new value should be published
10
- * The published value will be passed to `onChange` if defined.
11
- */
12
- const shouldPublishValue = params => {
13
- const {
14
- action,
15
- hasChanged,
16
- dateState,
17
- isControlled
18
- } = params;
19
- const isCurrentValueTheDefaultValue = !isControlled && !dateState.hasBeenModifiedSinceMount;
20
-
21
- // The field is responsible for only calling `onChange` when needed.
22
- if (action.name === 'setValueFromField') {
23
- return true;
24
- }
25
- if (action.name === 'setValueFromAction') {
26
- // If the component is not controlled, and the value has not been modified since the mount,
27
- // Then we want to publish the default value whenever the user pressed the "Accept", "Today" or "Clear" button.
28
- if (isCurrentValueTheDefaultValue && ['accept', 'today', 'clear'].includes(action.pickerAction)) {
29
- return true;
30
- }
31
- return hasChanged(dateState.lastPublishedValue);
32
- }
33
- if (action.name === 'setValueFromView' && action.selectionState !== 'shallow') {
34
- // On the first view,
35
- // If the value is not controlled, then clicking on any value (including the one equal to `defaultValue`) should call `onChange`
36
- if (isCurrentValueTheDefaultValue) {
37
- return true;
38
- }
39
- return hasChanged(dateState.lastPublishedValue);
40
- }
41
- if (action.name === 'setValueFromShortcut') {
42
- // On the first view,
43
- // If the value is not controlled, then clicking on any value (including the one equal to `defaultValue`) should call `onChange`
44
- if (isCurrentValueTheDefaultValue) {
45
- return true;
46
- }
47
- return hasChanged(dateState.lastPublishedValue);
48
- }
49
- return false;
50
- };
51
-
52
- /**
53
- * Decide if the new value should be committed.
54
- * The committed value will be passed to `onAccept` if defined.
55
- * It will also be used as a reset target when calling the `cancel` picker action (when clicking on the "Cancel" button).
56
- */
57
- const shouldCommitValue = params => {
58
- const {
59
- action,
60
- hasChanged,
61
- dateState,
62
- isControlled,
63
- closeOnSelect
64
- } = params;
65
- const isCurrentValueTheDefaultValue = !isControlled && !dateState.hasBeenModifiedSinceMount;
66
- if (action.name === 'setValueFromAction') {
67
- // If the component is not controlled, and the value has not been modified since the mount,
68
- // Then we want to commit the default value whenever the user pressed the "Accept", "Today" or "Clear" button.
69
- if (isCurrentValueTheDefaultValue && ['accept', 'today', 'clear'].includes(action.pickerAction)) {
70
- return true;
71
- }
72
- return hasChanged(dateState.lastCommittedValue);
73
- }
74
- if (action.name === 'setValueFromView' && action.selectionState === 'finish' && closeOnSelect) {
75
- // On picker where the 1st view is also the last view,
76
- // If the value is not controlled, then clicking on any value (including the one equal to `defaultValue`) should call `onAccept`
77
- if (isCurrentValueTheDefaultValue) {
78
- return true;
79
- }
80
- return hasChanged(dateState.lastCommittedValue);
81
- }
82
- if (action.name === 'setValueFromShortcut') {
83
- return action.changeImportance === 'accept' && hasChanged(dateState.lastCommittedValue);
84
- }
85
- return false;
86
- };
87
-
88
- /**
89
- * Decide if the picker should be closed after the value is updated.
90
- */
91
- const shouldClosePicker = params => {
92
- const {
93
- action,
94
- closeOnSelect
95
- } = params;
96
- if (action.name === 'setValueFromAction') {
97
- return true;
98
- }
99
- if (action.name === 'setValueFromView') {
100
- return action.selectionState === 'finish' && closeOnSelect;
101
- }
102
- if (action.name === 'setValueFromShortcut') {
103
- return action.changeImportance === 'accept';
104
- }
105
- return false;
106
- };
107
-
108
8
  /**
109
9
  * Manage the value lifecycle of all the pickers.
110
10
  */
@@ -112,7 +12,6 @@ export const usePickerValue = ({
112
12
  props,
113
13
  valueManager,
114
14
  valueType,
115
- variant,
116
15
  validator
117
16
  }) => {
118
17
  const {
@@ -120,7 +19,7 @@ export const usePickerValue = ({
120
19
  onChange,
121
20
  value: inValueWithoutRenderTimezone,
122
21
  defaultValue: inDefaultValue,
123
- closeOnSelect = variant === 'desktop',
22
+ closeOnSelect = false,
124
23
  timezone: timezoneProp,
125
24
  referenceDate
126
25
  } = props;
@@ -200,43 +99,49 @@ export const usePickerValue = ({
200
99
  value: dateState.draft,
201
100
  onError: props.onError
202
101
  });
203
- const updateDate = useEventCallback(action => {
204
- const updaterParams = {
205
- action,
206
- dateState,
207
- hasChanged: comparison => !valueManager.areValuesEqual(utils, action.value, comparison),
208
- isControlled,
209
- closeOnSelect
210
- };
211
- const shouldPublish = shouldPublishValue(updaterParams);
212
- const shouldCommit = shouldCommitValue(updaterParams);
213
- const shouldClose = shouldClosePicker(updaterParams);
102
+ const setValue = useEventCallback((newValue, options) => {
103
+ const {
104
+ changeImportance = 'accept',
105
+ skipPublicationIfPristine = false,
106
+ validationError,
107
+ shortcut
108
+ } = options ?? {};
109
+ let shouldPublish;
110
+ let shouldCommit;
111
+ if (!skipPublicationIfPristine && !isControlled && !dateState.hasBeenModifiedSinceMount) {
112
+ // If the value is not controlled and the value has never been modified before,
113
+ // Then clicking on any value (including the one equal to `defaultValue`) should call `onChange` and `onAccept`
114
+ shouldPublish = true;
115
+ shouldCommit = changeImportance === 'accept';
116
+ } else {
117
+ shouldPublish = !valueManager.areValuesEqual(utils, newValue, dateState.lastPublishedValue);
118
+ shouldCommit = changeImportance === 'accept' && !valueManager.areValuesEqual(utils, newValue, dateState.lastCommittedValue);
119
+ }
214
120
  setDateState(prev => _extends({}, prev, {
215
- draft: action.value,
216
- lastPublishedValue: shouldPublish ? action.value : prev.lastPublishedValue,
217
- lastCommittedValue: shouldCommit ? action.value : prev.lastCommittedValue,
121
+ draft: newValue,
122
+ lastPublishedValue: shouldPublish ? newValue : prev.lastPublishedValue,
123
+ lastCommittedValue: shouldCommit ? newValue : prev.lastCommittedValue,
218
124
  hasBeenModifiedSinceMount: true
219
125
  }));
220
126
  let cachedContext = null;
221
127
  const getContext = () => {
222
128
  if (!cachedContext) {
223
- const validationError = action.name === 'setValueFromField' ? action.context.validationError : getValidationErrorForNewValue(action.value);
224
129
  cachedContext = {
225
- validationError
130
+ validationError: validationError == null ? getValidationErrorForNewValue(newValue) : validationError
226
131
  };
227
- if (action.name === 'setValueFromShortcut') {
228
- cachedContext.shortcut = action.shortcut;
132
+ if (shortcut) {
133
+ cachedContext.shortcut = shortcut;
229
134
  }
230
135
  }
231
136
  return cachedContext;
232
137
  };
233
138
  if (shouldPublish) {
234
- handleValueChange(action.value, getContext());
139
+ handleValueChange(newValue, getContext());
235
140
  }
236
141
  if (shouldCommit && onAccept) {
237
- onAccept(action.value, getContext());
142
+ onAccept(newValue, getContext());
238
143
  }
239
- if (shouldClose) {
144
+ if (changeImportance === 'accept') {
240
145
  setOpen(false);
241
146
  }
242
147
  });
@@ -251,33 +156,6 @@ export const usePickerValue = ({
251
156
  hasBeenModifiedSinceMount: true
252
157
  }));
253
158
  }
254
- const handleChange = useEventCallback((newValue, selectionState = 'partial') => updateDate({
255
- name: 'setValueFromView',
256
- value: newValue,
257
- selectionState
258
- }));
259
- const handleSelectShortcut = useEventCallback((newValue, changeImportance, shortcut) => updateDate({
260
- name: 'setValueFromShortcut',
261
- value: newValue,
262
- changeImportance,
263
- shortcut
264
- }));
265
- const handleChangeFromField = useEventCallback((newValue, context) => updateDate({
266
- name: 'setValueFromField',
267
- value: newValue,
268
- context
269
- }));
270
- const fieldResponse = {
271
- value: dateState.draft,
272
- onChange: handleChangeFromField
273
- };
274
- const valueWithoutError = React.useMemo(() => valueManager.cleanValue(utils, dateState.draft), [utils, valueManager, dateState.draft]);
275
- const viewResponse = {
276
- value: valueWithoutError,
277
- onChange: handleChange,
278
- open,
279
- setOpen
280
- };
281
159
  const isValid = testedValue => {
282
160
  const error = validator({
283
161
  adapter,
@@ -287,49 +165,54 @@ export const usePickerValue = ({
287
165
  });
288
166
  return !valueManager.hasError(error);
289
167
  };
290
- const layoutResponse = {
291
- value: valueWithoutError,
292
- onChange: handleChange,
293
- onSelectShortcut: handleSelectShortcut,
294
- isValid
295
- };
296
- const clearValue = useEventCallback(() => updateDate({
297
- value: valueManager.emptyValue,
298
- name: 'setValueFromAction',
299
- pickerAction: 'clear'
300
- }));
301
- const setValueToToday = useEventCallback(() => updateDate({
302
- value: valueManager.getTodayValue(utils, timezone, valueType),
303
- name: 'setValueFromAction',
304
- pickerAction: 'today'
305
- }));
306
- const acceptValueChanges = useEventCallback(() => updateDate({
307
- value: dateState.lastPublishedValue,
308
- name: 'setValueFromAction',
309
- pickerAction: 'accept'
310
- }));
311
- const cancelValueChanges = useEventCallback(() => updateDate({
312
- value: dateState.lastCommittedValue,
313
- name: 'setValueFromAction',
314
- pickerAction: 'cancel'
168
+ const clearValue = useEventCallback(() => setValue(valueManager.emptyValue));
169
+ const setValueToToday = useEventCallback(() => setValue(valueManager.getTodayValue(utils, timezone, valueType)));
170
+ const acceptValueChanges = useEventCallback(() => setValue(dateState.lastPublishedValue));
171
+ const cancelValueChanges = useEventCallback(() => setValue(dateState.lastCommittedValue, {
172
+ skipPublicationIfPristine: true
315
173
  }));
316
174
  const dismissViews = useEventCallback(() => {
317
- updateDate({
318
- value: dateState.lastPublishedValue,
319
- name: 'setValueFromAction',
320
- pickerAction: 'dismiss'
175
+ setValue(dateState.lastPublishedValue, {
176
+ skipPublicationIfPristine: true
321
177
  });
322
178
  });
179
+ const fieldResponse = {
180
+ value: dateState.draft,
181
+ onChange: (newValue, context) => setValue(newValue, {
182
+ validationError: context.validationError
183
+ })
184
+ };
185
+ const setValueFromView = useEventCallback((newValue, selectionState = 'partial') => {
186
+ // TODO: Expose a new method (private?) like `setView` that only updates the draft value.
187
+ if (selectionState === 'shallow') {
188
+ setDateState(prev => _extends({}, prev, {
189
+ draft: newValue,
190
+ hasBeenModifiedSinceMount: true
191
+ }));
192
+ }
193
+ setValue(newValue, {
194
+ changeImportance: selectionState === 'finish' && closeOnSelect ? 'accept' : 'set'
195
+ });
196
+ });
197
+ const valueWithoutError = React.useMemo(() => valueManager.cleanValue(utils, dateState.draft), [utils, valueManager, dateState.draft]);
198
+ const viewResponse = {
199
+ value: valueWithoutError,
200
+ onChange: setValueFromView,
201
+ open,
202
+ setOpen
203
+ };
323
204
  const actionsContextValue = React.useMemo(() => ({
205
+ setValue,
324
206
  setOpen,
325
207
  clearValue,
326
208
  setValueToToday,
327
209
  acceptValueChanges,
328
210
  cancelValueChanges
329
- }), [setOpen, clearValue, setValueToToday, acceptValueChanges, cancelValueChanges]);
211
+ }), [setValue, setOpen, clearValue, setValueToToday, acceptValueChanges, cancelValueChanges]);
330
212
  const contextValue = React.useMemo(() => _extends({}, actionsContextValue, {
331
- open
332
- }), [actionsContextValue, open]);
213
+ open,
214
+ value: dateState.draft
215
+ }), [actionsContextValue, open, dateState.draft]);
333
216
  const privateContextValue = React.useMemo(() => ({
334
217
  dismissViews
335
218
  }), [dismissViews]);
@@ -337,12 +220,12 @@ export const usePickerValue = ({
337
220
  value: valueWithoutError,
338
221
  contextValue,
339
222
  actionsContextValue,
340
- privateContextValue
223
+ privateContextValue,
224
+ isValidContextValue: isValid
341
225
  };
342
226
  return {
343
227
  fieldProps: fieldResponse,
344
228
  viewProps: viewResponse,
345
- layoutProps: layoutResponse,
346
229
  provider: providerParams
347
230
  };
348
231
  };
@@ -14,7 +14,7 @@ import { isTimeView } from "../../utils/time-utils.js";
14
14
  /**
15
15
  * Props used to handle the value of the pickers.
16
16
  */
17
-
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
18
  /**
19
19
  * Manage the views of all the pickers:
20
20
  * - Handles the view switch
@@ -24,9 +24,8 @@ import { isTimeView } from "../../utils/time-utils.js";
24
24
  export const usePickerViews = ({
25
25
  props,
26
26
  propsFromPickerValue,
27
- additionalViewProps,
28
27
  autoFocusView,
29
- rendererInterceptor,
28
+ rendererInterceptor: RendererInterceptor,
30
29
  fieldRef
31
30
  }) => {
32
31
  const {
@@ -124,15 +123,18 @@ export const usePickerViews = ({
124
123
  setFocusedView(newView, true);
125
124
  }, [open]); // eslint-disable-line react-hooks/exhaustive-deps
126
125
 
127
- const contextValue = React.useMemo(() => ({
126
+ const actionsContextValue = React.useMemo(() => ({
127
+ setView
128
+ }), [setView]);
129
+ const contextValue = React.useMemo(() => _extends({}, actionsContextValue, {
128
130
  views,
129
- view: popperView,
130
- onViewChange: setView
131
- }), [views, popperView, setView]);
131
+ view: popperView
132
+ }), [actionsContextValue, views, popperView]);
132
133
  const providerParams = {
133
134
  hasUIView,
134
135
  views,
135
- contextValue
136
+ contextValue,
137
+ actionsContextValue
136
138
  };
137
139
  return {
138
140
  shouldRestoreFocus,
@@ -145,7 +147,7 @@ export const usePickerViews = ({
145
147
  if (renderer == null) {
146
148
  return null;
147
149
  }
148
- const rendererProps = _extends({}, propsToForwardToView, additionalViewProps, {
150
+ const rendererProps = _extends({}, propsToForwardToView, {
149
151
  views,
150
152
  timezone,
151
153
  value,
@@ -157,8 +159,12 @@ export const usePickerViews = ({
157
159
  showViewSwitcher: timeViewsCount > 1,
158
160
  timeViewsCount
159
161
  });
160
- if (rendererInterceptor) {
161
- return rendererInterceptor(viewRenderers, popperView, rendererProps);
162
+ if (RendererInterceptor) {
163
+ return /*#__PURE__*/_jsx(RendererInterceptor, {
164
+ viewRenderers: viewRenderers,
165
+ popperView: popperView,
166
+ rendererProps: rendererProps
167
+ });
162
168
  }
163
169
  return renderer(rendererProps);
164
170
  }
@@ -39,20 +39,17 @@ export const useStaticPicker = _ref => {
39
39
  autoFocus
40
40
  } = props;
41
41
  const {
42
- layoutProps,
43
42
  providerProps,
44
43
  renderCurrentView
45
44
  } = usePicker(_extends({}, pickerParams, {
46
45
  props,
47
46
  autoFocusView: autoFocus ?? false,
48
- fieldRef: undefined,
49
47
  localeText,
50
- additionalViewProps: {},
51
48
  variant: displayStaticWrapperAs
52
49
  }));
53
50
  const Layout = slots?.layout ?? PickerStaticLayout;
54
51
  const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
55
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
52
+ children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
56
53
  slots: slots,
57
54
  slotProps: slotProps,
58
55
  sx: [...(Array.isArray(sx) ? sx : [sx]), ...(Array.isArray(slotProps?.layout?.sx) ? slotProps.layout.sx : [slotProps?.layout?.sx])],
@@ -19,7 +19,7 @@ export const useUtils = () => useLocalizationContext().utils;
19
19
  export const useDefaultDates = () => useLocalizationContext().defaultDates;
20
20
  export const useNow = timezone => {
21
21
  const utils = useUtils();
22
- const now = React.useRef();
22
+ const now = React.useRef(undefined);
23
23
  if (now.current === undefined) {
24
24
  now.current = utils.date(undefined, timezone);
25
25
  }