@mui/x-date-pickers 8.0.0-alpha.12 → 8.0.0-alpha.14

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 (299) hide show
  1. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
  2. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +96 -94
  3. package/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
  4. package/AdapterDateFnsV2/AdapterDateFnsV2.js +96 -94
  5. package/AdapterDayjs/AdapterDayjs.js +11 -5
  6. package/CHANGELOG.md +430 -0
  7. package/DateCalendar/DateCalendar.js +1 -1
  8. package/DateField/useDateField.d.ts +1 -1
  9. package/DatePicker/DatePicker.types.d.ts +2 -2
  10. package/DatePicker/shared.d.ts +1 -1
  11. package/DateTimeField/useDateTimeField.d.ts +1 -1
  12. package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  13. package/DateTimePicker/DateTimePickerToolbar.d.ts +1 -1
  14. package/DateTimePicker/DateTimePickerToolbar.js +1 -1
  15. package/DateTimePicker/shared.d.ts +18 -10
  16. package/DateTimePicker/shared.js +23 -2
  17. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -11
  18. package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -7
  19. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  20. package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -2
  21. package/MobileDateTimePicker/MobileDateTimePicker.js +61 -6
  22. package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +1 -3
  23. package/PickersTextField/PickersTextField.js +3 -1
  24. package/StaticDateTimePicker/StaticDateTimePicker.js +60 -6
  25. package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +1 -2
  26. package/TimeClock/Clock.js +2 -2
  27. package/TimeClock/ClockPointer.js +1 -1
  28. package/TimeField/useTimeField.d.ts +1 -1
  29. package/TimePicker/TimePicker.types.d.ts +2 -2
  30. package/TimePicker/shared.d.ts +1 -1
  31. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
  32. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
  33. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
  34. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
  35. package/esm/AdapterDayjs/AdapterDayjs.js +9 -5
  36. package/esm/DateCalendar/DateCalendar.js +1 -1
  37. package/esm/DateField/useDateField.d.ts +1 -1
  38. package/esm/DatePicker/DatePicker.types.d.ts +2 -2
  39. package/esm/DatePicker/shared.d.ts +1 -1
  40. package/esm/DateTimeField/useDateTimeField.d.ts +1 -1
  41. package/esm/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  42. package/esm/DateTimePicker/DateTimePickerToolbar.d.ts +1 -1
  43. package/esm/DateTimePicker/DateTimePickerToolbar.js +1 -1
  44. package/esm/DateTimePicker/shared.d.ts +18 -10
  45. package/esm/DateTimePicker/shared.js +23 -2
  46. package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -12
  47. package/esm/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -7
  48. package/esm/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  49. package/esm/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -2
  50. package/esm/MobileDateTimePicker/MobileDateTimePicker.js +62 -7
  51. package/esm/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +1 -3
  52. package/esm/PickersTextField/PickersTextField.js +3 -1
  53. package/esm/StaticDateTimePicker/StaticDateTimePicker.js +61 -7
  54. package/esm/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +1 -2
  55. package/esm/TimeClock/Clock.js +2 -2
  56. package/esm/TimeClock/ClockPointer.js +1 -1
  57. package/esm/TimeField/useTimeField.d.ts +1 -1
  58. package/esm/TimePicker/TimePicker.types.d.ts +2 -2
  59. package/esm/TimePicker/shared.d.ts +1 -1
  60. package/esm/hooks/useSplitFieldProps.d.ts +1 -1
  61. package/esm/hooks/useSplitFieldProps.js +1 -1
  62. package/esm/index.js +1 -1
  63. package/esm/internals/components/PickerFieldUI.d.ts +7 -0
  64. package/esm/internals/components/PickerFieldUI.js +8 -4
  65. package/esm/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
  66. package/esm/internals/components/PickerPopper/PickerPopper.js +26 -14
  67. package/esm/internals/components/PickerProvider.d.ts +158 -7
  68. package/esm/internals/components/PickerProvider.js +7 -2
  69. package/esm/internals/demo/DemoContainer.js +3 -3
  70. package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
  71. package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +4 -12
  72. package/esm/internals/hooks/useField/index.d.ts +1 -2
  73. package/esm/internals/hooks/useField/useField.js +7 -8
  74. package/esm/internals/hooks/useField/useField.types.d.ts +56 -47
  75. package/esm/internals/hooks/useField/useField.utils.js +4 -1
  76. package/esm/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
  77. package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
  78. package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
  79. package/esm/internals/hooks/useField/useFieldState.d.ts +2 -1
  80. package/esm/internals/hooks/useField/useFieldState.js +136 -83
  81. package/esm/internals/hooks/useField/useFieldV6TextField.js +9 -7
  82. package/esm/internals/hooks/useField/useFieldV7TextField.js +9 -8
  83. package/esm/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
  84. package/esm/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +4 -7
  85. package/esm/internals/hooks/useNullableFieldPrivateContext.d.ts +9 -0
  86. package/esm/internals/hooks/useNullableFieldPrivateContext.js +5 -0
  87. package/esm/internals/hooks/usePicker/hooks/useOrientation.d.ts +2 -0
  88. package/esm/internals/hooks/usePicker/hooks/useOrientation.js +34 -0
  89. package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.d.ts +19 -0
  90. package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +210 -0
  91. package/esm/internals/hooks/usePicker/index.d.ts +1 -3
  92. package/esm/internals/hooks/usePicker/usePicker.d.ts +5 -5
  93. package/esm/internals/hooks/usePicker/usePicker.js +276 -34
  94. package/esm/internals/hooks/usePicker/usePicker.types.d.ts +181 -9
  95. package/esm/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
  96. package/esm/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +3 -4
  97. package/esm/internals/hooks/useValueWithTimezone.d.ts +1 -1
  98. package/esm/internals/index.d.ts +7 -9
  99. package/esm/internals/index.js +2 -1
  100. package/esm/internals/models/fields.d.ts +3 -10
  101. package/esm/internals/models/manager.d.ts +108 -4
  102. package/esm/internals/models/props/basePickerProps.d.ts +2 -2
  103. package/esm/internals/models/props/time.d.ts +1 -1
  104. package/esm/internals/utils/date-time-utils.d.ts +2 -2
  105. package/esm/internals/utils/valueManagers.d.ts +1 -1
  106. package/esm/internals/utils/valueManagers.js +10 -18
  107. package/esm/locales/bnBD.d.ts +80 -0
  108. package/esm/locales/bnBD.js +73 -0
  109. package/esm/locales/index.d.ts +1 -0
  110. package/esm/locales/index.js +1 -0
  111. package/esm/managers/useDateManager.d.ts +3 -4
  112. package/esm/managers/useDateTimeManager.d.ts +3 -4
  113. package/esm/managers/useTimeManager.d.ts +3 -4
  114. package/esm/models/adapters.d.ts +2 -1
  115. package/esm/models/fields.d.ts +2 -2
  116. package/esm/models/manager.d.ts +4 -5
  117. package/esm/validation/extractValidationProps.d.ts +1 -1
  118. package/esm/validation/index.d.ts +1 -1
  119. package/esm/validation/useValidation.d.ts +2 -2
  120. package/hooks/useSplitFieldProps.d.ts +1 -1
  121. package/hooks/useSplitFieldProps.js +1 -1
  122. package/index.js +1 -1
  123. package/internals/components/PickerFieldUI.d.ts +7 -0
  124. package/internals/components/PickerFieldUI.js +9 -3
  125. package/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
  126. package/internals/components/PickerPopper/PickerPopper.js +25 -13
  127. package/internals/components/PickerProvider.d.ts +158 -7
  128. package/internals/components/PickerProvider.js +8 -3
  129. package/internals/demo/DemoContainer.js +3 -3
  130. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
  131. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +4 -12
  132. package/internals/hooks/useField/index.d.ts +1 -2
  133. package/internals/hooks/useField/useField.js +7 -8
  134. package/internals/hooks/useField/useField.types.d.ts +56 -47
  135. package/internals/hooks/useField/useField.utils.js +4 -1
  136. package/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
  137. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
  138. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -10
  139. package/internals/hooks/useField/useFieldState.d.ts +2 -1
  140. package/internals/hooks/useField/useFieldState.js +135 -82
  141. package/internals/hooks/useField/useFieldV6TextField.js +9 -7
  142. package/internals/hooks/useField/useFieldV7TextField.js +9 -8
  143. package/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
  144. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +4 -7
  145. package/internals/hooks/useNullableFieldPrivateContext.d.ts +9 -0
  146. package/internals/hooks/useNullableFieldPrivateContext.js +13 -0
  147. package/internals/hooks/usePicker/hooks/useOrientation.d.ts +2 -0
  148. package/internals/hooks/usePicker/hooks/useOrientation.js +42 -0
  149. package/internals/hooks/usePicker/hooks/useValueAndOpenStates.d.ts +19 -0
  150. package/internals/hooks/usePicker/{usePickerValue.js → hooks/useValueAndOpenStates.js} +97 -114
  151. package/internals/hooks/usePicker/index.d.ts +1 -3
  152. package/internals/hooks/usePicker/usePicker.d.ts +5 -5
  153. package/internals/hooks/usePicker/usePicker.js +278 -34
  154. package/internals/hooks/usePicker/usePicker.types.d.ts +181 -9
  155. package/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
  156. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +3 -4
  157. package/internals/hooks/useValueWithTimezone.d.ts +1 -1
  158. package/internals/index.d.ts +7 -9
  159. package/internals/index.js +19 -0
  160. package/internals/models/fields.d.ts +3 -10
  161. package/internals/models/manager.d.ts +108 -4
  162. package/internals/models/props/basePickerProps.d.ts +2 -2
  163. package/internals/models/props/time.d.ts +1 -1
  164. package/internals/utils/date-time-utils.d.ts +2 -2
  165. package/internals/utils/valueManagers.d.ts +1 -1
  166. package/internals/utils/valueManagers.js +10 -18
  167. package/locales/bnBD.d.ts +80 -0
  168. package/locales/bnBD.js +79 -0
  169. package/locales/index.d.ts +1 -0
  170. package/locales/index.js +11 -0
  171. package/managers/useDateManager.d.ts +3 -4
  172. package/managers/useDateTimeManager.d.ts +3 -4
  173. package/managers/useTimeManager.d.ts +3 -4
  174. package/models/adapters.d.ts +2 -1
  175. package/models/fields.d.ts +2 -2
  176. package/models/manager.d.ts +4 -5
  177. package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
  178. package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
  179. package/modern/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
  180. package/modern/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
  181. package/modern/AdapterDayjs/AdapterDayjs.js +9 -5
  182. package/modern/DateCalendar/DateCalendar.js +1 -1
  183. package/modern/DateField/useDateField.d.ts +1 -1
  184. package/modern/DatePicker/DatePicker.types.d.ts +2 -2
  185. package/modern/DatePicker/shared.d.ts +1 -1
  186. package/modern/DateTimeField/useDateTimeField.d.ts +1 -1
  187. package/modern/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  188. package/modern/DateTimePicker/DateTimePickerToolbar.d.ts +1 -1
  189. package/modern/DateTimePicker/DateTimePickerToolbar.js +1 -1
  190. package/modern/DateTimePicker/shared.d.ts +18 -10
  191. package/modern/DateTimePicker/shared.js +23 -2
  192. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -12
  193. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -7
  194. package/modern/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  195. package/modern/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -2
  196. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +62 -7
  197. package/modern/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +1 -3
  198. package/modern/PickersTextField/PickersTextField.js +3 -1
  199. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +61 -7
  200. package/modern/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +1 -2
  201. package/modern/TimeClock/Clock.js +2 -2
  202. package/modern/TimeClock/ClockPointer.js +1 -1
  203. package/modern/TimeField/useTimeField.d.ts +1 -1
  204. package/modern/TimePicker/TimePicker.types.d.ts +2 -2
  205. package/modern/TimePicker/shared.d.ts +1 -1
  206. package/modern/hooks/useSplitFieldProps.d.ts +1 -1
  207. package/modern/hooks/useSplitFieldProps.js +1 -1
  208. package/modern/index.js +1 -1
  209. package/modern/internals/components/PickerFieldUI.d.ts +7 -0
  210. package/modern/internals/components/PickerFieldUI.js +8 -4
  211. package/modern/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
  212. package/modern/internals/components/PickerPopper/PickerPopper.js +26 -14
  213. package/modern/internals/components/PickerProvider.d.ts +158 -7
  214. package/modern/internals/components/PickerProvider.js +7 -2
  215. package/modern/internals/demo/DemoContainer.js +3 -3
  216. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
  217. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +4 -12
  218. package/modern/internals/hooks/useField/index.d.ts +1 -2
  219. package/modern/internals/hooks/useField/useField.js +7 -8
  220. package/modern/internals/hooks/useField/useField.types.d.ts +56 -47
  221. package/modern/internals/hooks/useField/useField.utils.js +4 -1
  222. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
  223. package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
  224. package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
  225. package/modern/internals/hooks/useField/useFieldState.d.ts +2 -1
  226. package/modern/internals/hooks/useField/useFieldState.js +136 -83
  227. package/modern/internals/hooks/useField/useFieldV6TextField.js +9 -7
  228. package/modern/internals/hooks/useField/useFieldV7TextField.js +9 -8
  229. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
  230. package/modern/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +4 -7
  231. package/modern/internals/hooks/useNullableFieldPrivateContext.d.ts +9 -0
  232. package/modern/internals/hooks/useNullableFieldPrivateContext.js +5 -0
  233. package/modern/internals/hooks/usePicker/hooks/useOrientation.d.ts +2 -0
  234. package/modern/internals/hooks/usePicker/hooks/useOrientation.js +34 -0
  235. package/modern/internals/hooks/usePicker/hooks/useValueAndOpenStates.d.ts +19 -0
  236. package/modern/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +210 -0
  237. package/modern/internals/hooks/usePicker/index.d.ts +1 -3
  238. package/modern/internals/hooks/usePicker/usePicker.d.ts +5 -5
  239. package/modern/internals/hooks/usePicker/usePicker.js +276 -34
  240. package/modern/internals/hooks/usePicker/usePicker.types.d.ts +181 -9
  241. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
  242. package/modern/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +3 -4
  243. package/modern/internals/hooks/useValueWithTimezone.d.ts +1 -1
  244. package/modern/internals/index.d.ts +7 -9
  245. package/modern/internals/index.js +2 -1
  246. package/modern/internals/models/fields.d.ts +3 -10
  247. package/modern/internals/models/manager.d.ts +108 -4
  248. package/modern/internals/models/props/basePickerProps.d.ts +2 -2
  249. package/modern/internals/models/props/time.d.ts +1 -1
  250. package/modern/internals/utils/date-time-utils.d.ts +2 -2
  251. package/modern/internals/utils/valueManagers.d.ts +1 -1
  252. package/modern/internals/utils/valueManagers.js +10 -18
  253. package/modern/locales/bnBD.d.ts +80 -0
  254. package/modern/locales/bnBD.js +73 -0
  255. package/modern/locales/index.d.ts +1 -0
  256. package/modern/locales/index.js +1 -0
  257. package/modern/managers/useDateManager.d.ts +3 -4
  258. package/modern/managers/useDateTimeManager.d.ts +3 -4
  259. package/modern/managers/useTimeManager.d.ts +3 -4
  260. package/modern/models/adapters.d.ts +2 -1
  261. package/modern/models/fields.d.ts +2 -2
  262. package/modern/models/manager.d.ts +4 -5
  263. package/modern/validation/extractValidationProps.d.ts +1 -1
  264. package/modern/validation/index.d.ts +1 -1
  265. package/modern/validation/useValidation.d.ts +2 -2
  266. package/package.json +2 -2
  267. package/tsconfig.build.tsbuildinfo +1 -1
  268. package/validation/extractValidationProps.d.ts +1 -1
  269. package/validation/index.d.ts +1 -1
  270. package/validation/useValidation.d.ts +2 -2
  271. package/esm/internals/hooks/useOpenState.d.ts +0 -14
  272. package/esm/internals/hooks/useOpenState.js +0 -37
  273. package/esm/internals/hooks/usePicker/usePickerProvider.d.ts +0 -60
  274. package/esm/internals/hooks/usePicker/usePickerProvider.js +0 -111
  275. package/esm/internals/hooks/usePicker/usePickerValue.d.ts +0 -12
  276. package/esm/internals/hooks/usePicker/usePickerValue.js +0 -226
  277. package/esm/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -327
  278. package/esm/internals/hooks/usePicker/usePickerValue.types.js +0 -1
  279. package/esm/internals/hooks/usePicker/usePickerViews.d.ts +0 -120
  280. package/esm/internals/hooks/usePicker/usePickerViews.js +0 -176
  281. package/internals/hooks/useOpenState.d.ts +0 -14
  282. package/internals/hooks/useOpenState.js +0 -46
  283. package/internals/hooks/usePicker/usePickerProvider.d.ts +0 -60
  284. package/internals/hooks/usePicker/usePickerProvider.js +0 -121
  285. package/internals/hooks/usePicker/usePickerValue.d.ts +0 -12
  286. package/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -327
  287. package/internals/hooks/usePicker/usePickerValue.types.js +0 -5
  288. package/internals/hooks/usePicker/usePickerViews.d.ts +0 -120
  289. package/internals/hooks/usePicker/usePickerViews.js +0 -183
  290. package/modern/internals/hooks/useOpenState.d.ts +0 -14
  291. package/modern/internals/hooks/useOpenState.js +0 -37
  292. package/modern/internals/hooks/usePicker/usePickerProvider.d.ts +0 -60
  293. package/modern/internals/hooks/usePicker/usePickerProvider.js +0 -111
  294. package/modern/internals/hooks/usePicker/usePickerValue.d.ts +0 -12
  295. package/modern/internals/hooks/usePicker/usePickerValue.js +0 -226
  296. package/modern/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -327
  297. package/modern/internals/hooks/usePicker/usePickerValue.types.js +0 -1
  298. package/modern/internals/hooks/usePicker/usePickerViews.d.ts +0 -120
  299. package/modern/internals/hooks/usePicker/usePickerViews.js +0 -176
@@ -4,11 +4,15 @@ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
7
- import { renderTimeViewClock } from "../timeViewRenderers/index.js";
7
+ import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "../timeViewRenderers/index.js";
8
8
  import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
9
9
  import { singleItemValueManager } from "../internals/utils/valueManagers.js";
10
10
  import { useStaticPicker } from "../internals/hooks/useStaticPicker/index.js";
11
11
  import { validateDateTime } from "../validation/index.js";
12
+ import { mergeSx } from "../internals/utils/utils.js";
13
+ import { multiSectionDigitalClockClasses, multiSectionDigitalClockSectionClasses } from "../MultiSectionDigitalClock/index.js";
14
+ import { DIALOG_WIDTH, VIEW_HEIGHT } from "../internals/constants/dimensions.js";
15
+ import { digitalClockClasses } from "../DigitalClock/index.js";
12
16
  /**
13
17
  * Demos:
14
18
  *
@@ -23,19 +27,26 @@ const StaticDateTimePicker = /*#__PURE__*/React.forwardRef(function StaticDateTi
23
27
  const defaultizedProps = useDateTimePickerDefaultizedProps(inProps, 'MuiStaticDateTimePicker');
24
28
  const displayStaticWrapperAs = defaultizedProps.displayStaticWrapperAs ?? 'mobile';
25
29
  const ampmInClock = defaultizedProps.ampmInClock ?? displayStaticWrapperAs === 'desktop';
30
+ const renderTimeView = defaultizedProps.shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView : renderMultiSectionDigitalClockTimeView;
26
31
  const viewRenderers = _extends({
27
32
  day: renderDateViewCalendar,
28
33
  month: renderDateViewCalendar,
29
34
  year: renderDateViewCalendar,
30
- hours: renderTimeViewClock,
31
- minutes: renderTimeViewClock,
32
- seconds: renderTimeViewClock
35
+ hours: renderTimeView,
36
+ minutes: renderTimeView,
37
+ seconds: renderTimeView,
38
+ meridiem: renderTimeView
33
39
  }, defaultizedProps.viewRenderers);
34
40
 
41
+ // Need to avoid adding the `meridiem` view when unexpected renderer is specified
42
+ const shouldHoursRendererContainMeridiemView = viewRenderers.hours?.name === renderMultiSectionDigitalClockTimeView.name;
43
+ const views = !shouldHoursRendererContainMeridiemView ? defaultizedProps.views.filter(view => view !== 'meridiem') : defaultizedProps.views;
44
+
35
45
  // Props with the default values specific to the static variant
36
46
  const props = _extends({}, defaultizedProps, {
37
47
  viewRenderers,
38
48
  displayStaticWrapperAs,
49
+ views,
39
50
  ampmInClock,
40
51
  yearsPerRow: defaultizedProps.yearsPerRow ?? (displayStaticWrapperAs === 'mobile' ? 3 : 4),
41
52
  slotProps: _extends({}, defaultizedProps.slotProps, {
@@ -46,7 +57,28 @@ const StaticDateTimePicker = /*#__PURE__*/React.forwardRef(function StaticDateTi
46
57
  hidden: displayStaticWrapperAs === 'desktop',
47
58
  ampmInClock
48
59
  }, defaultizedProps.slotProps?.toolbar)
49
- })
60
+ }),
61
+ sx: mergeSx([{
62
+ [`& .${multiSectionDigitalClockClasses.root}`]: {
63
+ width: DIALOG_WIDTH
64
+ },
65
+ [`& .${multiSectionDigitalClockSectionClasses.root}`]: {
66
+ flex: 1,
67
+ // account for the border on `MultiSectionDigitalClock`
68
+ maxHeight: VIEW_HEIGHT - 1,
69
+ [`.${multiSectionDigitalClockSectionClasses.item}`]: {
70
+ width: 'auto'
71
+ }
72
+ },
73
+ [`& .${digitalClockClasses.root}`]: {
74
+ width: DIALOG_WIDTH,
75
+ maxHeight: VIEW_HEIGHT,
76
+ flex: 1,
77
+ [`.${digitalClockClasses.item}`]: {
78
+ justifyContent: 'center'
79
+ }
80
+ }
81
+ }], defaultizedProps?.sx)
50
82
  });
51
83
  const {
52
84
  renderPicker
@@ -236,7 +268,7 @@ StaticDateTimePicker.propTypes = {
236
268
  * Used when the component view is not controlled.
237
269
  * Must be a valid option from `views` list.
238
270
  */
239
- openTo: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
271
+ openTo: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
240
272
  /**
241
273
  * Force rendering in particular orientation.
242
274
  */
@@ -302,6 +334,11 @@ StaticDateTimePicker.propTypes = {
302
334
  * @default false
303
335
  */
304
336
  showDaysOutsideCurrentMonth: PropTypes.bool,
337
+ /**
338
+ * If `true`, disabled digital clock items will not be rendered.
339
+ * @default false
340
+ */
341
+ skipDisabled: PropTypes.bool,
305
342
  /**
306
343
  * The props used for each component slot.
307
344
  * @default {}
@@ -316,6 +353,22 @@ StaticDateTimePicker.propTypes = {
316
353
  * The system prop that allows defining system overrides as well as additional CSS styles.
317
354
  */
318
355
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
356
+ /**
357
+ * Amount of time options below or at which the single column time renderer is used.
358
+ * @default 24
359
+ */
360
+ thresholdToRenderTimeInASingleColumn: PropTypes.number,
361
+ /**
362
+ * The time steps between two time unit options.
363
+ * For example, if `timeStep.minutes = 8`, then the available minute options will be `[0, 8, 16, 24, 32, 40, 48, 56]`.
364
+ * When single column time renderer is used, only `timeStep.minutes` will be used.
365
+ * @default{ hours: 1, minutes: 5, seconds: 5 }
366
+ */
367
+ timeSteps: PropTypes.shape({
368
+ hours: PropTypes.number,
369
+ minutes: PropTypes.number,
370
+ seconds: PropTypes.number
371
+ }),
319
372
  /**
320
373
  * Choose which timezone to use for the value.
321
374
  * Example: "default", "system", "UTC", "America/New_York".
@@ -334,7 +387,7 @@ StaticDateTimePicker.propTypes = {
334
387
  * Used when the component view is controlled.
335
388
  * Must be a valid option from `views` list.
336
389
  */
337
- view: PropTypes.oneOf(['day', 'hours', 'minutes', 'month', 'seconds', 'year']),
390
+ view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
338
391
  /**
339
392
  * Define custom view renderers for each section.
340
393
  * If `null`, the section will only have field editing.
@@ -343,6 +396,7 @@ StaticDateTimePicker.propTypes = {
343
396
  viewRenderers: PropTypes.shape({
344
397
  day: PropTypes.func,
345
398
  hours: PropTypes.func,
399
+ meridiem: PropTypes.func,
346
400
  minutes: PropTypes.func,
347
401
  month: PropTypes.func,
348
402
  seconds: PropTypes.func,
@@ -1,10 +1,9 @@
1
1
  import { MakeOptional } from '@mui/x-internals/types';
2
2
  import { BaseDateTimePickerProps, BaseDateTimePickerSlots, BaseDateTimePickerSlotProps } from "../DateTimePicker/shared.js";
3
3
  import { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps } from "../internals/hooks/useStaticPicker/index.js";
4
- import { DateOrTimeView } from "../models/index.js";
5
4
  export interface StaticDateTimePickerSlots extends BaseDateTimePickerSlots, UseStaticPickerSlots {}
6
5
  export interface StaticDateTimePickerSlotProps extends BaseDateTimePickerSlotProps, UseStaticPickerSlotProps {}
7
- export interface StaticDateTimePickerProps extends BaseDateTimePickerProps<DateOrTimeView>, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
6
+ export interface StaticDateTimePickerProps extends BaseDateTimePickerProps, MakeOptional<StaticOnlyPickerProps, 'displayStaticWrapperAs'> {
8
7
  /**
9
8
  * Overridable component slots.
10
9
  * @default {}
@@ -104,7 +104,7 @@ const ClockPin = styled('div', {
104
104
  left: '50%',
105
105
  transform: 'translate(-50%, -50%)'
106
106
  }));
107
- const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
107
+ const meridiemButtonCommonStyles = (theme, clockMeridiemMode) => ({
108
108
  zIndex: 1,
109
109
  bottom: 8,
110
110
  paddingLeft: 4,
@@ -112,7 +112,7 @@ const meridiemButtonCommonStyles = (theme, meridiemMode) => ({
112
112
  width: CLOCK_HOUR_WIDTH,
113
113
  variants: [{
114
114
  props: {
115
- meridiemMode
115
+ clockMeridiemMode
116
116
  },
117
117
  style: {
118
118
  backgroundColor: (theme.vars || theme).palette.primary.main,
@@ -58,7 +58,7 @@ const ClockPointerThumb = styled('div', {
58
58
  boxSizing: 'content-box',
59
59
  variants: [{
60
60
  props: {
61
- isBetweenTwoClockValues: false
61
+ isClockPointerBetweenTwoValues: false
62
62
  },
63
63
  style: {
64
64
  backgroundColor: (theme.vars || theme).palette.primary.main
@@ -1,2 +1,2 @@
1
1
  import { UseTimeFieldProps } from "./TimeField.types.js";
2
- export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "ampm" | "timezone" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "referenceDate" | "formatDensity" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
2
+ export declare const useTimeField: <TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TAllProps) => import("../internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps, "disabled" | "readOnly" | "value" | "defaultValue" | "autoFocus" | "onChange" | "onError" | "format" | "focused" | keyof import("../internals").BaseTimeValidationProps | keyof import("../internals").TimeValidationProps | "ampm" | "referenceDate" | "formatDensity" | "timezone" | "shouldRespectLeadingZeros" | "selectedSections" | "onSelectedSectionsChange" | "unstableFieldRef" | "unstableStartFieldRef" | "unstableEndFieldRef" | "enableAccessibleFieldDOMStructure" | "dateSeparator">>;
@@ -1,5 +1,5 @@
1
1
  import { DesktopTimePickerProps, DesktopTimePickerSlots, DesktopTimePickerSlotProps } from "../DesktopTimePicker/index.js";
2
- import { BaseSingleInputFieldProps, PickerValue, TimeViewWithMeridiem } from "../internals/models/index.js";
2
+ import { BaseSingleInputFieldProps, TimeViewWithMeridiem } from "../internals/models/index.js";
3
3
  import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from "../MobileTimePicker/index.js";
4
4
  import { ValidateTimeProps } from "../validation/validateTime.js";
5
5
  export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots {}
@@ -25,4 +25,4 @@ export interface TimePickerProps<TEnableAccessibleFieldDOMStructure extends bool
25
25
  /**
26
26
  * Props the field can receive when used inside a time picker (<TimePicker />, <DesktopTimePicker /> or <MobileTimePicker /> component).
27
27
  */
28
- export type TimePickerFieldProps = ValidateTimeProps & BaseSingleInputFieldProps<PickerValue>;
28
+ export type TimePickerFieldProps = ValidateTimeProps & BaseSingleInputFieldProps;
@@ -5,7 +5,7 @@ import { BasePickerInputProps } from "../internals/models/props/basePickerProps.
5
5
  import { LocalizedComponent } from "../locales/utils/pickersLocaleTextApi.js";
6
6
  import { TimePickerToolbarProps, ExportedTimePickerToolbarProps } from "./TimePickerToolbar.js";
7
7
  import { TimeValidationError } from "../models/index.js";
8
- import { PickerViewRendererLookup } from "../internals/hooks/usePicker/usePickerViews.js";
8
+ import { PickerViewRendererLookup } from "../internals/hooks/usePicker/index.js";
9
9
  import { TimeViewRendererProps } from "../timeViewRenderers/index.js";
10
10
  import { BaseClockProps, ExportedBaseClockProps } from "../internals/models/props/time.js";
11
11
  import { PickerValue, TimeViewWithMeridiem } from "../internals/models/index.js";
@@ -1,6 +1,6 @@
1
1
  import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from "../validation/extractValidationProps.js";
2
2
  import { PickerValueType } from "../models/common.js";
3
- declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus"];
3
+ declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "unstableStartFieldRef", "unstableEndFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator", "autoFocus", "focused"];
4
4
  type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
5
5
  /**
6
6
  * Split the props received by the field component into:
@@ -3,7 +3,7 @@
3
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import * as React from 'react';
5
5
  import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from "../validation/extractValidationProps.js";
6
- const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus'];
6
+ const SHARED_FIELD_INTERNAL_PROP_NAMES = ['value', 'defaultValue', 'referenceDate', 'format', 'formatDensity', 'onChange', 'timezone', 'onError', 'shouldRespectLeadingZeros', 'selectedSections', 'onSelectedSectionsChange', 'unstableFieldRef', 'unstableStartFieldRef', 'unstableEndFieldRef', 'enableAccessibleFieldDOMStructure', 'disabled', 'readOnly', 'dateSeparator', 'autoFocus', 'focused'];
7
7
  /**
8
8
  * Split the props received by the field component into:
9
9
  * - `internalProps` which are used by the various hooks called by the field component.
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v8.0.0-alpha.12
2
+ * @mui/x-date-pickers v8.0.0-alpha.14
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -17,6 +17,7 @@ export declare const cleanFieldResponse: <TFieldResponse extends MakeOptional<Us
17
17
  openPickerAriaLabel: string;
18
18
  textFieldProps: TextFieldProps | PickersTextFieldProps;
19
19
  };
20
+ export declare const PickerFieldUIContext: React.Context<PickerFieldUIContextValue>;
20
21
  /**
21
22
  * Adds the button to open the picker and the button to clear the value of the field.
22
23
  * @ignore - internal component.
@@ -111,6 +112,12 @@ export interface PickerFieldUISlotPropsFromContext extends PickerFieldUISlotProp
111
112
  interface FieldInputAdornmentOwnerState extends FieldOwnerState {
112
113
  position: 'start' | 'end';
113
114
  }
115
+ interface PickerFieldUIContextValue {
116
+ inputRef: React.Ref<HTMLInputElement> | undefined;
117
+ slots: PickerFieldUISlotsFromContext;
118
+ slotProps: PickerFieldUISlotPropsFromContext;
119
+ }
120
+ export declare function mergeSlotProps<TProps extends {}, TOwnerState extends FieldOwnerState>(slotPropsA: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined, slotPropsB: SlotComponentPropsFromProps<TProps, {}, TOwnerState> | undefined): Partial<TProps> | ((ownerState: TOwnerState) => {}) | undefined;
114
121
  /**
115
122
  * The `textField` slot props cannot be handled inside `PickerFieldUI` because it would be a breaking change to not pass the enriched props to `useField`.
116
123
  * Once the non-accessible DOM structure will be removed, we will be able to remove the `textField` slot and clean this logic.
@@ -85,7 +85,7 @@ export const cleanFieldResponse = _ref => {
85
85
  })
86
86
  };
87
87
  };
88
- const PickerFieldUIContext = /*#__PURE__*/React.createContext({
88
+ export const PickerFieldUIContext = /*#__PURE__*/React.createContext({
89
89
  slots: {},
90
90
  slotProps: {},
91
91
  inputRef: undefined
@@ -154,7 +154,9 @@ export function PickerFieldUI(props) {
154
154
  disabled: triggerStatus === 'disabled',
155
155
  onClick: handleClickOpeningButton,
156
156
  'aria-label': openPickerAriaLabel,
157
- edge: clearButtonPosition === 'start' && openPickerButtonPosition === 'start' ? undefined : openPickerButtonPosition
157
+ edge:
158
+ // open button is always rendered at the edge
159
+ textFieldProps.variant !== 'standard' ? openPickerButtonPosition : false
158
160
  },
159
161
  ownerState
160
162
  }),
@@ -176,7 +178,9 @@ export function PickerFieldUI(props) {
176
178
  tabIndex: -1,
177
179
  onClick: onClear,
178
180
  disabled: fieldResponse.disabled || fieldResponse.readOnly,
179
- edge: clearButtonPosition === 'end' && openPickerButtonPosition === 'end' ? undefined : clearButtonPosition
181
+ edge:
182
+ // clear button can only be at the edge if it's position differs from the open button
183
+ textFieldProps.variant !== 'standard' && clearButtonPosition !== openPickerButtonPosition ? clearButtonPosition : false
180
184
  },
181
185
  ownerState
182
186
  }),
@@ -234,7 +238,7 @@ export function PickerFieldUI(props) {
234
238
  }
235
239
  return /*#__PURE__*/_jsx(TextField, _extends({}, textFieldProps));
236
240
  }
237
- function mergeSlotProps(slotPropsA, slotPropsB) {
241
+ export function mergeSlotProps(slotPropsA, slotPropsB) {
238
242
  if (!slotPropsA) {
239
243
  return slotPropsB;
240
244
  }
@@ -60,10 +60,7 @@ export interface ExportedPickerPopperProps {
60
60
  placement?: MuiPopperProps['placement'];
61
61
  }
62
62
  export interface PickerPopperProps extends ExportedPickerPopperProps {
63
- role: 'tooltip' | 'dialog';
64
- containerRef?: React.Ref<HTMLDivElement>;
65
63
  children?: React.ReactNode;
66
- onBlur?: () => void;
67
64
  slots?: PickerPopperSlots;
68
65
  slotProps?: PickerPopperSlotProps;
69
66
  }
@@ -11,7 +11,7 @@ import BaseFocusTrap from '@mui/material/Unstable_TrapFocus';
11
11
  import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEventCallback, unstable_ownerDocument as ownerDocument, unstable_composeClasses as composeClasses } from '@mui/utils';
12
12
  import { styled, useThemeProps } from '@mui/material/styles';
13
13
  import { getPickerPopperUtilityClass } from "./pickerPopperClasses.js";
14
- import { getActiveElement } from "../../utils/utils.js";
14
+ import { executeInTheNextEventLoopTick, getActiveElement } from "../../utils/utils.js";
15
15
  import { usePickerPrivateContext } from "../../hooks/usePickerPrivateContext.js";
16
16
  import { usePickerContext } from "../../../hooks/index.js";
17
17
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -206,9 +206,6 @@ export function PickerPopper(inProps) {
206
206
  });
207
207
  const {
208
208
  children,
209
- containerRef = null,
210
- onBlur,
211
- role,
212
209
  placement = 'bottom-start',
213
210
  slots,
214
211
  slotProps,
@@ -217,11 +214,13 @@ export function PickerPopper(inProps) {
217
214
  const {
218
215
  open,
219
216
  triggerRef,
217
+ popupRef,
220
218
  reduceAnimations
221
219
  } = usePickerContext();
222
220
  const {
223
221
  dismissViews,
224
- doesTheCurrentViewHasAnUI
222
+ getCurrentViewMode,
223
+ viewContainerRole
225
224
  } = usePickerPrivateContext();
226
225
  React.useEffect(() => {
227
226
  function handleKeyDown(nativeEvent) {
@@ -236,7 +235,7 @@ export function PickerPopper(inProps) {
236
235
  }, [dismissViews, open]);
237
236
  const lastFocusedElementRef = React.useRef(null);
238
237
  React.useEffect(() => {
239
- if (role === 'tooltip' || !doesTheCurrentViewHasAnUI()) {
238
+ if (viewContainerRole === 'tooltip' || getCurrentViewMode() === 'field') {
240
239
  return;
241
240
  }
242
241
  if (open) {
@@ -250,18 +249,31 @@ export function PickerPopper(inProps) {
250
249
  }
251
250
  });
252
251
  }
253
- }, [open, role, doesTheCurrentViewHasAnUI]);
254
- const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, onBlur ?? dismissViews);
255
- const paperRef = React.useRef(null);
256
- const handleRef = useForkRef(paperRef, containerRef);
257
- const handlePaperRef = useForkRef(handleRef, clickAwayRef);
252
+ }, [open, viewContainerRole, getCurrentViewMode]);
258
253
  const classes = useUtilityClasses(classesProp);
259
254
  const {
260
- ownerState: pickerOwnerState
255
+ ownerState: pickerOwnerState,
256
+ rootRefObject
261
257
  } = usePickerPrivateContext();
262
258
  const ownerState = _extends({}, pickerOwnerState, {
263
259
  popperPlacement: placement
264
260
  });
261
+ const handleClickAway = useEventCallback(() => {
262
+ if (viewContainerRole === 'tooltip') {
263
+ executeInTheNextEventLoopTick(() => {
264
+ if (rootRefObject.current?.contains(getActiveElement(document)) || popupRef.current?.contains(getActiveElement(document))) {
265
+ return;
266
+ }
267
+ dismissViews();
268
+ });
269
+ } else {
270
+ dismissViews();
271
+ }
272
+ });
273
+ const [clickAwayRef, onPaperClick, onPaperTouchStart] = useClickAwayListener(open, handleClickAway);
274
+ const paperRef = React.useRef(null);
275
+ const handleRef = useForkRef(paperRef, popupRef);
276
+ const handlePaperRef = useForkRef(handleRef, clickAwayRef);
265
277
  const handleKeyDown = event => {
266
278
  if (event.key === 'Escape') {
267
279
  // stop the propagation to avoid closing parent modal
@@ -278,7 +290,7 @@ export function PickerPopper(inProps) {
278
290
  externalSlotProps: slotProps?.popper,
279
291
  additionalProps: {
280
292
  transition: true,
281
- role,
293
+ role: viewContainerRole == null ? undefined : viewContainerRole,
282
294
  open,
283
295
  placement,
284
296
  anchorEl: triggerRef.current,
@@ -298,7 +310,7 @@ export function PickerPopper(inProps) {
298
310
  // which would force screen readers to read too old label
299
311
  ,
300
312
  disableRestoreFocus: true,
301
- disableEnforceFocus: role === 'tooltip',
313
+ disableEnforceFocus: viewContainerRole === 'tooltip',
302
314
  isEnabled: () => true
303
315
  }, slotProps?.desktopTrapFocus, {
304
316
  children: /*#__PURE__*/_jsx(Transition, _extends({}, TransitionProps, slotProps?.desktopTransition, {
@@ -1,12 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { Theme } from '@mui/material/styles';
4
- import { PickerOwnerState } from "../../models/index.js";
4
+ import { PickerChangeImportance, PickerOwnerState, PickersTimezone } from "../../models/index.js";
5
5
  import { PickersInputLocaleText } from "../../locales/index.js";
6
6
  import { DateOrTimeViewWithMeridiem, PickerOrientation, PickerValidValue, PickerVariant } from "../models/index.js";
7
- import type { UsePickerValueActionsContextValue, UsePickerValueContextValue, UsePickerValuePrivateContextValue } from '../hooks/usePicker/usePickerValue.types';
8
- import { UsePickerViewsActionsContextValue, UsePickerViewsContextValue, UsePickerViewsPrivateContextValue } from "../hooks/usePicker/usePickerViews.js";
9
- import { PickerFieldPrivateContextValue } from "../hooks/useField/useFieldInternalPropsWithDefaults.js";
7
+ import { PickerFieldPrivateContextValue } from "../hooks/useNullableFieldPrivateContext.js";
8
+ import type { PickersShortcutsItemContext } from '../../PickersShortcuts';
10
9
  export declare const PickerActionsContext: React.Context<PickerActionsContextValue<any, any, any> | null>;
11
10
  export declare const PickerPrivateContext: React.Context<PickerPrivateContextValue>;
12
11
  /**
@@ -26,7 +25,24 @@ export interface PickerProviderProps<TValue extends PickerValidValue> {
26
25
  localeText: PickersInputLocaleText | undefined;
27
26
  children: React.ReactNode;
28
27
  }
29
- export interface PickerContextValue<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError> extends UsePickerValueContextValue<TValue, TError>, UsePickerViewsContextValue<TView> {
28
+ export interface PickerContextValue<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError> extends PickerActionsContextValue<TValue, TView, TError> {
29
+ /**
30
+ * The current value of the picker.
31
+ */
32
+ value: TValue;
33
+ /**
34
+ * The timezone to use when rendering the dates.
35
+ * If a `timezone` prop is provided, it will be used.
36
+ * If the `value` prop contains a valid date, its timezone will be used.
37
+ * If no `value` prop is provided, but the `defaultValue` contains a valid date, its timezone will be used.
38
+ * If no `value` or `defaultValue` is provided, but the `referenceDate` is provided, its timezone will be used.
39
+ * Otherwise, the timezone will be the default one of your date library.
40
+ */
41
+ timezone: PickersTimezone;
42
+ /**
43
+ * Whether the picker is open.
44
+ */
45
+ open: boolean;
30
46
  /**
31
47
  * Whether the picker is disabled.
32
48
  */
@@ -35,6 +51,31 @@ export interface PickerContextValue<TValue extends PickerValidValue, TView exten
35
51
  * Whether the picker is read-only.
36
52
  */
37
53
  readOnly: boolean;
54
+ /**
55
+ * Whether the picker should be focused on mount.
56
+ * If the picker has a field and is not open, the field should be focused.
57
+ * If the picker does not have a field (if it is a static picker) or is not open, the view should be focused.
58
+ */
59
+ autoFocus: boolean;
60
+ /**
61
+ * The views that the picker has to render.
62
+ * It is equal to the picker `views` prop—if defined.
63
+ * Otherwise, a default set of views is provided based on the component you are using:
64
+ * - Date Pickers: ['year', 'day']
65
+ * - Time Pickers: ['hours', 'minutes']
66
+ * - Date Time Pickers: ['year', 'day', 'hours', 'minutes']
67
+ * - Date Range Pickers: ['day']
68
+ * - Date Time Range Pickers: ['day', 'hours', 'minutes']
69
+ */
70
+ views: readonly TView[];
71
+ /**
72
+ * The currently rendered view.
73
+ */
74
+ view: TView | null;
75
+ /**
76
+ * The view showed when first opening the picker.
77
+ */
78
+ initialView: TView | null;
38
79
  /**
39
80
  * The responsive variant of the picker.
40
81
  * It is equal to "desktop" when using a desktop picker (like <DesktopDatePicker />).
@@ -68,6 +109,11 @@ export interface PickerContextValue<TValue extends PickerValidValue, TView exten
68
109
  * If it is "enabled", the field should render an interactive UI to open the Picker.
69
110
  */
70
111
  triggerStatus: 'hidden' | 'disabled' | 'enabled';
112
+ /**
113
+ * The ref to attach to the popup's outermost element that contains the view, if any.
114
+ * When using a built-in popup component, this property is automatically attached to the appropriate element.
115
+ */
116
+ popupRef: React.RefObject<any>;
71
117
  /**
72
118
  * The format to use when rendering the value in the field.
73
119
  * It is equal to the picker `format` prop if defined.
@@ -111,10 +157,115 @@ export interface PickerContextValue<TValue extends PickerValidValue, TView exten
111
157
  */
112
158
  rootRef: React.ForwardedRef<HTMLDivElement> | undefined;
113
159
  }
114
- export interface PickerActionsContextValue<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError = string | null> extends UsePickerValueActionsContextValue<TValue, TError>, UsePickerViewsActionsContextValue<TView> {}
115
- export interface PickerPrivateContextValue extends UsePickerValuePrivateContextValue, UsePickerViewsPrivateContextValue {
160
+ export interface PickerActionsContextValue<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem, TError = string | null> {
161
+ /**
162
+ * Set the current value of the picker.
163
+ * @param {TValue} value The new value of the picker.
164
+ * @param {SetValueActionOptions<TError>} options The options to customize the behavior of this update.
165
+ */
166
+ setValue: (value: TValue, options?: SetValueActionOptions<TError>) => void;
167
+ /**
168
+ * Set the current open state of the Picker.
169
+ * It can be a function that will receive the current open state as parameter.
170
+ * ```ts
171
+ * setOpen(true); // Opens the picker.
172
+ * setOpen(false); // Closes the picker.
173
+ * setOpen((prevOpen) => !prevOpen); // Toggles the open state.
174
+ * ```
175
+ * @param {React.SetStateAction<boolean>} action The new open state of the Picker.
176
+ */
177
+ setOpen: React.Dispatch<React.SetStateAction<boolean>>;
178
+ /**
179
+ * Set the current view.
180
+ * @template TView
181
+ * @param {TView} view The view to render
182
+ */
183
+ setView: (view: TView) => void;
184
+ /**
185
+ * Set the current value of the picker to be empty.
186
+ * The value will be `null` on single pickers and `[null, null]` on range pickers.
187
+ */
188
+ clearValue: () => void;
189
+ /**
190
+ * Set the current value of the picker to be the current date.
191
+ * The value will be `today` on single pickers and `[today, today]` on range pickers.
192
+ * With `today` being the current date, with its time set to `00:00:00` on Date Pickers and its time set to the current time on Time and Date Pickers.
193
+ */
194
+ setValueToToday: () => void;
195
+ /**
196
+ * Accept the current value of the picker.
197
+ * Will call `onAccept` if defined.
198
+ * If the picker is re-opened, this value will be the one used to initialize the views.
199
+ */
200
+ acceptValueChanges: () => void;
201
+ /**
202
+ * Cancel the changes made to the current value of the picker.
203
+ * The value will be reset to the last accepted value.
204
+ */
205
+ cancelValueChanges: () => void;
206
+ }
207
+ export interface SetValueActionOptions<TError = string | null> {
208
+ /**
209
+ * The importance of the change when picking a value:
210
+ * - "accept": fires `onChange`, fires `onAccept` and closes the picker.
211
+ * - "set": fires `onChange` but do not fire `onAccept` and does not close the picker.
212
+ * @default "accept"
213
+ */
214
+ changeImportance?: PickerChangeImportance;
215
+ /**
216
+ * The validation error associated to the current value.
217
+ * If not defined, the validation will be computed by the picker.
218
+ */
219
+ validationError?: TError;
220
+ /**
221
+ * The shortcut that triggered this change.
222
+ * It should not be defined if the change does not come from a shortcut.
223
+ */
224
+ shortcut?: PickersShortcutsItemContext;
225
+ /**
226
+ * Whether the value should call `onChange` and `onAccept` when the value is not controlled and has never been modified.
227
+ * If `true`, the `onChange` and `onAccept` callback will only be fired if the value has been modified (and is not equal to the last published value).
228
+ * If `false`, the `onChange` and `onAccept` callback will be fired when the value has never been modified (`onAccept` only if `changeImportance` is set to "accept").
229
+ * @default false
230
+ */
231
+ skipPublicationIfPristine?: boolean;
232
+ /**
233
+ * Whether the picker should close.
234
+ * @default changeImportance === "accept"
235
+ */
236
+ shouldClose?: boolean;
237
+ }
238
+ export interface PickerPrivateContextValue {
116
239
  /**
117
240
  * The ownerState of the picker.
118
241
  */
119
242
  ownerState: PickerOwnerState;
243
+ /**
244
+ * The ref of the root element.
245
+ * This is the object counterpart of the `usePickerContext().rootRef` property which can be a function.
246
+ */
247
+ rootRefObject: React.RefObject<HTMLDivElement | null>;
248
+ /**
249
+ * The id of the label element.
250
+ */
251
+ labelId: string | undefined;
252
+ dismissViews: () => void;
253
+ /**
254
+ * Whether at least one view has an UI (it has a view renderer associated).
255
+ */
256
+ hasUIView: boolean;
257
+ /**
258
+ * Return the mode of the current view.
259
+ * @returns {boolean} The mode of the current view.
260
+ */
261
+ getCurrentViewMode: () => 'UI' | 'field';
262
+ /**
263
+ * The aria role associated with the view container.
264
+ * It is equal to "dialog" when the view is rendered inside a `@mui/material/Dialog`.
265
+ * It is equal to "dialog" when the view is rendered inside a `@mui/material/Popper` and the focus is trapped inside the view.
266
+ * It is equal to "tooltip" when the view is rendered inside a `@mui/material/Popper` and the focus remains inside the field.
267
+ * It is always equal to null if the picker does not have a field (static pickers).
268
+ * It is always equal to null if the component you are accessing the context from is not wrapped by a picker.
269
+ */
270
+ viewContainerRole: 'dialog' | 'tooltip' | null;
120
271
  }
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { LocalizationProvider } from "../../LocalizationProvider/index.js";
3
3
  import { IsValidValueContext } from "../../hooks/useIsValidValue.js";
4
- import { PickerFieldPrivateContext } from "../hooks/useField/useFieldInternalPropsWithDefaults.js";
4
+ import { PickerFieldPrivateContext } from "../hooks/useNullableFieldPrivateContext.js";
5
5
  import { PickerContext } from "../../hooks/usePickerContext.js";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  export const PickerActionsContext = /*#__PURE__*/React.createContext(null);
@@ -16,7 +16,12 @@ export const PickerPrivateContext = /*#__PURE__*/React.createContext({
16
16
  },
17
17
  dismissViews: () => {},
18
18
  hasUIView: true,
19
- doesTheCurrentViewHasAnUI: () => true
19
+ getCurrentViewMode: () => 'UI',
20
+ rootRefObject: {
21
+ current: null
22
+ },
23
+ viewContainerRole: null,
24
+ labelId: undefined
20
25
  });
21
26
 
22
27
  /**