@mui/x-date-pickers-pro 7.0.0-beta.2 → 7.0.0-beta.4

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 (274) hide show
  1. package/CHANGELOG.md +298 -23
  2. package/DateRangeCalendar/DateRangeCalendar.js +3 -1
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +3 -0
  4. package/DateRangePicker/DateRangePicker.d.ts +1 -1
  5. package/DateRangePicker/DateRangePicker.js +9 -9
  6. package/DateRangePicker/DateRangePicker.types.d.ts +3 -3
  7. package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -0
  8. package/DateRangePicker/DateRangePickerToolbar.js +6 -0
  9. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
  10. package/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  11. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +3 -3
  12. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  13. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +3 -0
  14. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
  15. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -1
  16. package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  17. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +3 -3
  18. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -1
  19. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  20. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +3 -3
  21. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -1
  22. package/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  23. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +3 -3
  24. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -1
  25. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
  26. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +3 -3
  27. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -1
  28. package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  29. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +11 -14
  30. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -1
  31. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  32. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +12 -16
  33. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -1
  34. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  35. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +12 -16
  36. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +2 -2
  37. package/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  38. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -14
  39. package/SingleInputDateRangeField/index.d.ts +1 -1
  40. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +2 -3
  41. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
  42. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +2 -2
  43. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
  44. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -15
  45. package/SingleInputDateTimeRangeField/index.d.ts +1 -1
  46. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +2 -3
  47. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
  48. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +2 -2
  49. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  50. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -15
  51. package/SingleInputTimeRangeField/index.d.ts +1 -1
  52. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +2 -3
  53. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
  54. package/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  55. package/index.d.ts +0 -1
  56. package/index.js +2 -1
  57. package/internals/hooks/models/useRangePicker.d.ts +5 -5
  58. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
  59. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  60. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
  61. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
  62. package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
  63. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
  64. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
  65. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
  66. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
  67. package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
  68. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
  69. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  70. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -3
  71. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  72. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
  73. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -3
  74. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  75. package/internals/hooks/useRangePosition.d.ts +2 -4
  76. package/internals/hooks/useRangePosition.js +3 -6
  77. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  78. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
  79. package/internals/models/dateRange.d.ts +3 -15
  80. package/internals/models/dateTimeRange.d.ts +4 -6
  81. package/internals/models/index.d.ts +0 -1
  82. package/internals/models/index.js +0 -1
  83. package/internals/models/timeRange.d.ts +3 -6
  84. package/internals/utils/date-fields-utils.d.ts +1 -5
  85. package/internals/utils/releaseInfo.js +1 -1
  86. package/internals/utils/valueManagers.d.ts +1 -2
  87. package/internals/utils/valueManagers.js +11 -6
  88. package/models/fields.d.ts +69 -0
  89. package/models/index.d.ts +1 -0
  90. package/models/index.js +1 -0
  91. package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
  92. package/modern/DateRangePicker/DateRangePicker.js +9 -9
  93. package/modern/DateRangePicker/DateRangePickerToolbar.js +6 -0
  94. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  95. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  96. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
  97. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  98. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  99. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  100. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
  101. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  102. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  103. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  104. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  105. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
  106. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
  107. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
  108. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  109. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
  110. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  111. package/modern/index.js +2 -1
  112. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  113. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
  114. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
  115. package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
  116. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  117. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
  118. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
  119. package/modern/internals/hooks/useRangePosition.js +3 -6
  120. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  121. package/modern/internals/models/index.js +0 -1
  122. package/modern/internals/utils/releaseInfo.js +1 -1
  123. package/modern/internals/utils/valueManagers.js +11 -6
  124. package/modern/models/index.js +1 -0
  125. package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
  126. package/node/DateRangePicker/DateRangePicker.js +9 -9
  127. package/node/DateRangePicker/DateRangePickerToolbar.js +6 -0
  128. package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  129. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  130. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
  131. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  132. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  133. package/node/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  134. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -14
  135. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  136. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  137. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  138. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  139. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
  140. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +15 -13
  141. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
  142. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  143. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
  144. package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  145. package/node/index.js +1 -1
  146. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  147. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
  148. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
  149. package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
  150. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
  151. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  152. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  153. package/node/internals/hooks/useRangePosition.js +3 -8
  154. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  155. package/node/internals/models/index.js +0 -11
  156. package/node/internals/utils/releaseInfo.js +1 -1
  157. package/node/internals/utils/valueManagers.js +10 -5
  158. package/node/models/index.js +11 -0
  159. package/package.json +5 -5
  160. package/themeAugmentation/props.d.ts +12 -12
  161. package/internals/models/fields.d.ts +0 -49
  162. package/legacy/AdapterDateFns/index.js +0 -1
  163. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  164. package/legacy/AdapterDateFnsV3/index.js +0 -1
  165. package/legacy/AdapterDayjs/index.js +0 -1
  166. package/legacy/AdapterLuxon/index.js +0 -1
  167. package/legacy/AdapterMoment/index.js +0 -1
  168. package/legacy/AdapterMomentHijri/index.js +0 -1
  169. package/legacy/AdapterMomentJalaali/index.js +0 -1
  170. package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
  171. package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
  172. package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
  173. package/legacy/DateRangeCalendar/index.js +0 -2
  174. package/legacy/DateRangeCalendar/useDragRange.js +0 -258
  175. package/legacy/DateRangePicker/DateRangePicker.js +0 -334
  176. package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
  177. package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
  178. package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
  179. package/legacy/DateRangePicker/index.js +0 -3
  180. package/legacy/DateRangePicker/shared.js +0 -33
  181. package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
  182. package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
  183. package/legacy/DateRangePickerDay/index.js +0 -2
  184. package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
  185. package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
  186. package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
  187. package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
  188. package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
  189. package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
  190. package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
  191. package/legacy/DateTimeRangePicker/index.js +0 -5
  192. package/legacy/DateTimeRangePicker/shared.js +0 -54
  193. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
  194. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
  195. package/legacy/DesktopDateRangePicker/index.js +0 -1
  196. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
  197. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
  198. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
  199. package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
  200. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
  201. package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
  202. package/legacy/MobileDateRangePicker/index.js +0 -1
  203. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
  204. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
  205. package/legacy/MobileDateTimeRangePicker/index.js +0 -1
  206. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
  207. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  208. package/legacy/MultiInputDateRangeField/index.js +0 -2
  209. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
  210. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  211. package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
  212. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
  213. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  214. package/legacy/MultiInputTimeRangeField/index.js +0 -2
  215. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
  216. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
  217. package/legacy/SingleInputDateRangeField/index.js +0 -2
  218. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
  219. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
  220. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
  221. package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
  222. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
  223. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
  224. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
  225. package/legacy/SingleInputTimeRangeField/index.js +0 -2
  226. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
  227. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
  228. package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
  229. package/legacy/StaticDateRangePicker/index.js +0 -1
  230. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
  231. package/legacy/dateRangeViewRenderers/index.js +0 -1
  232. package/legacy/index.js +0 -52
  233. package/legacy/internals/constants/dimensions.js +0 -5
  234. package/legacy/internals/hooks/models/index.js +0 -1
  235. package/legacy/internals/hooks/models/useRangePicker.js +0 -1
  236. package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
  237. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
  238. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
  239. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
  240. package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
  241. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
  242. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
  243. package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  244. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
  245. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
  246. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  247. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
  248. package/legacy/internals/hooks/useRangePosition.js +0 -39
  249. package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
  250. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
  251. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
  252. package/legacy/internals/models/dateRange.js +0 -1
  253. package/legacy/internals/models/dateTimeRange.js +0 -1
  254. package/legacy/internals/models/index.js +0 -5
  255. package/legacy/internals/models/rangePickerProps.js +0 -1
  256. package/legacy/internals/models/timeRange.js +0 -1
  257. package/legacy/internals/utils/date-fields-utils.js +0 -26
  258. package/legacy/internals/utils/date-range-manager.js +0 -65
  259. package/legacy/internals/utils/date-utils.js +0 -12
  260. package/legacy/internals/utils/releaseInfo.js +0 -13
  261. package/legacy/internals/utils/validation/validateDateRange.js +0 -45
  262. package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
  263. package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
  264. package/legacy/internals/utils/valueManagers.js +0 -135
  265. package/legacy/locales/index.js +0 -1
  266. package/legacy/models/index.js +0 -3
  267. package/legacy/models/multiInputRangeFieldClasses.js +0 -1
  268. package/legacy/models/range.js +0 -1
  269. package/legacy/models/validation.js +0 -1
  270. package/legacy/themeAugmentation/index.js +0 -4
  271. package/modern/internals/models/fields.js +0 -1
  272. /package/{internals/models → models}/fields.js +0 -0
  273. /package/{legacy/internals → modern}/models/fields.js +0 -0
  274. /package/node/{internals/models → models}/fields.js +0 -0
@@ -1,4 +1,3 @@
1
1
  import { PickerValidDate } from '@mui/x-date-pickers/models';
2
- import { UseSingleInputDateTimeRangeFieldComponentProps, UseSingleInputDateTimeRangeFieldDefaultizedProps, UseSingleInputDateTimeRangeFieldProps } from './SingleInputDateTimeRangeField.types';
3
- export declare const useDefaultizedTimeRangeFieldProps: <TDate extends PickerValidDate, AdditionalProps extends {}>(props: UseSingleInputDateTimeRangeFieldProps<TDate>) => UseSingleInputDateTimeRangeFieldDefaultizedProps<TDate, AdditionalProps>;
4
- export declare const useSingleInputDateTimeRangeField: <TDate extends PickerValidDate, TChildProps extends {}>(inProps: UseSingleInputDateTimeRangeFieldComponentProps<TDate, TChildProps>) => import("@mui/x-date-pickers/internals").UseFieldResponse<Omit<UseSingleInputDateTimeRangeFieldDefaultizedProps<TDate, TChildProps>, keyof UseSingleInputDateTimeRangeFieldProps<any>>>;
2
+ import { UseSingleInputDateTimeRangeFieldProps } from './SingleInputDateTimeRangeField.types';
3
+ export declare const useSingleInputDateTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>> & Required<Pick<UseSingleInputDateTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedDateTimeFieldBaseProps<any>>>, keyof UseSingleInputDateTimeRangeFieldProps<any, any>>>;
@@ -1,26 +1,8 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { useUtils, useField, applyDefaultDate, useDefaultDates, splitFieldInternalAndForwardedProps } from '@mui/x-date-pickers/internals';
1
+ import { useField, splitFieldInternalAndForwardedProps, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
3
2
  import { rangeValueManager, rangeFieldValueManager } from '../internals/utils/valueManagers';
4
3
  import { validateDateTimeRange } from '../internals/utils/validation/validateDateTimeRange';
5
- export const useDefaultizedTimeRangeFieldProps = props => {
6
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
7
- const utils = useUtils();
8
- const defaultDates = useDefaultDates();
9
- const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
10
- const defaultFormat = ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h;
11
- return _extends({}, props, {
12
- disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
13
- disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
14
- format: (_props$format = props.format) != null ? _props$format : defaultFormat,
15
- minDate: applyDefaultDate(utils, (_props$minDateTime = props.minDateTime) != null ? _props$minDateTime : props.minDate, defaultDates.minDate),
16
- maxDate: applyDefaultDate(utils, (_props$maxDateTime = props.maxDateTime) != null ? _props$maxDateTime : props.maxDate, defaultDates.maxDate),
17
- minTime: (_props$minDateTime2 = props.minDateTime) != null ? _props$minDateTime2 : props.minTime,
18
- maxTime: (_props$maxDateTime2 = props.maxDateTime) != null ? _props$maxDateTime2 : props.maxTime,
19
- disableIgnoringDatePartForTimeValidation: Boolean(props.minDateTime || props.maxDateTime)
20
- });
21
- };
22
4
  export const useSingleInputDateTimeRangeField = inProps => {
23
- const props = useDefaultizedTimeRangeFieldProps(inProps);
5
+ const props = useDefaultizedDateTimeField(inProps);
24
6
  const {
25
7
  forwardedProps,
26
8
  internalProps
@@ -1,8 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers/models';
3
3
  import { SingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
4
- import { FieldType } from '../internals/models';
5
- type DateRangeFieldComponent = (<TDate extends PickerValidDate>(props: SingleInputTimeRangeFieldProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
4
+ import { FieldType } from '../models';
5
+ type DateRangeFieldComponent = (<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false>(props: SingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
6
6
  propTypes?: any;
7
7
  fieldType?: FieldType;
8
8
  };
@@ -6,6 +6,7 @@ import PropTypes from 'prop-types';
6
6
  import MuiTextField from '@mui/material/TextField';
7
7
  import { useClearableField } from '@mui/x-date-pickers/hooks';
8
8
  import { convertFieldResponseIntoMuiTextFieldProps } from '@mui/x-date-pickers/internals';
9
+ import { PickersTextField } from '@mui/x-date-pickers/PickersTextField';
9
10
  import { useThemeProps } from '@mui/material/styles';
10
11
  import { useSlotProps } from '@mui/base/utils';
11
12
  import { refType } from '@mui/utils';
@@ -35,7 +36,7 @@ const SingleInputTimeRangeField = /*#__PURE__*/React.forwardRef(function SingleI
35
36
  } = themeProps,
36
37
  other = _objectWithoutPropertiesLoose(themeProps, _excluded);
37
38
  const ownerState = themeProps;
38
- const TextField = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : MuiTextField;
39
+ const TextField = (_slots$textField = slots == null ? void 0 : slots.textField) != null ? _slots$textField : inProps.enableAccessibleFieldDOMStructure ? PickersTextField : MuiTextField;
39
40
  const textFieldProps = useSlotProps({
40
41
  elementType: TextField,
41
42
  externalSlotProps: slotProps == null ? void 0 : slotProps.textField,
@@ -111,6 +112,10 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
111
112
  * @default false
112
113
  */
113
114
  disablePast: PropTypes.bool,
115
+ /**
116
+ * @default false
117
+ */
118
+ enableAccessibleFieldDOMStructure: PropTypes.bool,
114
119
  /**
115
120
  * If `true`, the component is displayed in focused state.
116
121
  */
@@ -244,17 +249,14 @@ process.env.NODE_ENV !== "production" ? SingleInputTimeRangeField.propTypes = {
244
249
  required: PropTypes.bool,
245
250
  /**
246
251
  * The currently selected sections.
247
- * This prop accept four formats:
252
+ * This prop accepts four formats:
248
253
  * 1. If a number is provided, the section at this index will be selected.
249
- * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
250
- * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
251
- * 4. If `null` is provided, no section will be selected
254
+ * 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
255
+ * 3. If `"all"` is provided, all the sections will be selected.
256
+ * 4. If `null` is provided, no section will be selected.
252
257
  * If not provided, the selected sections will be handled internally.
253
258
  */
254
- selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
255
- endIndex: PropTypes.number.isRequired,
256
- startIndex: PropTypes.number.isRequired
257
- })]),
259
+ selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
258
260
  /**
259
261
  * Disable specific time.
260
262
  * @template TDate
@@ -1,15 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { SlotComponentProps } from '@mui/base/utils';
3
3
  import TextField from '@mui/material/TextField';
4
- import { FieldsTextFieldProps } from '@mui/x-date-pickers/internals';
5
- import { PickerValidDate } from '@mui/x-date-pickers/models';
6
- import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
7
- import { UseTimeRangeFieldDefaultizedProps, UseTimeRangeFieldProps } from '../internals/models';
8
- export interface UseSingleInputTimeRangeFieldProps<TDate extends PickerValidDate> extends UseTimeRangeFieldProps<TDate> {
4
+ import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
5
+ import { PickerValidDate, BuiltInFieldTextFieldProps } from '@mui/x-date-pickers/models';
6
+ import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
7
+ import { UseTimeRangeFieldProps } from '../internals/models';
8
+ import { DateRange, RangeFieldSection, TimeRangeValidationError } from '../models';
9
+ export interface UseSingleInputTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends UseTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, ExportedUseClearableFieldProps, Pick<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'> {
9
10
  }
10
- export type UseSingleInputTimeRangeFieldDefaultizedProps<TDate extends PickerValidDate, AdditionalProps extends {}> = UseTimeRangeFieldDefaultizedProps<TDate> & AdditionalProps;
11
- export type UseSingleInputTimeRangeFieldComponentProps<TDate extends PickerValidDate, TChildProps extends {}> = Omit<TChildProps, keyof UseSingleInputTimeRangeFieldProps<TDate>> & UseSingleInputTimeRangeFieldProps<TDate>;
12
- export interface SingleInputTimeRangeFieldProps<TDate extends PickerValidDate> extends UseSingleInputTimeRangeFieldComponentProps<TDate, FieldsTextFieldProps> {
11
+ export type SingleInputTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean = false> = Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>> & UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & {
13
12
  /**
14
13
  * Overridable component slots.
15
14
  * @default {}
@@ -19,17 +18,15 @@ export interface SingleInputTimeRangeFieldProps<TDate extends PickerValidDate> e
19
18
  * The props used for each component slot.
20
19
  * @default {}
21
20
  */
22
- slotProps?: SingleInputTimeRangeFieldSlotProps<TDate>;
23
- }
24
- export type SingleInputTimeRangeFieldOwnerState<TDate extends PickerValidDate> = SingleInputTimeRangeFieldProps<TDate>;
21
+ slotProps?: SingleInputTimeRangeFieldSlotProps<TDate, TEnableAccessibleFieldDOMStructure>;
22
+ };
25
23
  export interface SingleInputTimeRangeFieldSlots extends UseClearableFieldSlots {
26
24
  /**
27
25
  * Form control with an input to render the value.
28
- * Receives the same props as `@mui/material/TextField`.
29
- * @default TextField from '@mui/material'
26
+ * @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
30
27
  */
31
28
  textField?: React.ElementType;
32
29
  }
33
- export interface SingleInputTimeRangeFieldSlotProps<TDate extends PickerValidDate> extends UseClearableFieldSlotProps {
34
- textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldOwnerState<TDate>>;
30
+ export interface SingleInputTimeRangeFieldSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
31
+ textField?: SlotComponentProps<typeof TextField, {}, SingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>;
35
32
  }
@@ -1,3 +1,3 @@
1
1
  export { SingleInputTimeRangeField } from './SingleInputTimeRangeField';
2
2
  export { useSingleInputTimeRangeField as unstable_useSingleInputTimeRangeField } from './useSingleInputTimeRangeField';
3
- export type { UseSingleInputTimeRangeFieldProps, UseSingleInputTimeRangeFieldComponentProps, SingleInputTimeRangeFieldProps, } from './SingleInputTimeRangeField.types';
3
+ export type { UseSingleInputTimeRangeFieldProps, SingleInputTimeRangeFieldProps, } from './SingleInputTimeRangeField.types';
@@ -1,4 +1,3 @@
1
1
  import { PickerValidDate } from '@mui/x-date-pickers/models';
2
- import { UseSingleInputTimeRangeFieldComponentProps, UseSingleInputTimeRangeFieldDefaultizedProps, UseSingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
3
- export declare const useDefaultizedTimeRangeFieldProps: <TDate extends PickerValidDate, AdditionalProps extends {}>(props: UseSingleInputTimeRangeFieldProps<TDate>) => UseSingleInputTimeRangeFieldDefaultizedProps<TDate, AdditionalProps>;
4
- export declare const useSingleInputTimeRangeField: <TDate extends PickerValidDate, TChildProps extends {}>(inProps: UseSingleInputTimeRangeFieldComponentProps<TDate, TChildProps>) => import("@mui/x-date-pickers/internals").UseFieldResponse<Omit<UseSingleInputTimeRangeFieldDefaultizedProps<TDate, TChildProps>, keyof UseSingleInputTimeRangeFieldProps<any>>>;
2
+ import { UseSingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
3
+ export declare const useSingleInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TAllProps extends UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>>(inProps: TAllProps) => import("@mui/x-date-pickers/internals").UseFieldResponse<TEnableAccessibleFieldDOMStructure, Omit<TAllProps & Omit<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps> & Required<Pick<UseSingleInputTimeRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure>, keyof import("@mui/x-date-pickers/internals/hooks/defaultizedFieldProps").UseDefaultizedTimeFieldBaseProps>>, keyof UseSingleInputTimeRangeFieldProps<any, any>>>;
@@ -1,20 +1,8 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import { useUtils, useField, splitFieldInternalAndForwardedProps } from '@mui/x-date-pickers/internals';
1
+ import { useField, splitFieldInternalAndForwardedProps, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
3
2
  import { rangeValueManager, rangeFieldValueManager } from '../internals/utils/valueManagers';
4
3
  import { validateTimeRange } from '../internals/utils/validation/validateTimeRange';
5
- export const useDefaultizedTimeRangeFieldProps = props => {
6
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
7
- const utils = useUtils();
8
- const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
9
- const defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
10
- return _extends({}, props, {
11
- disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
12
- disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
13
- format: (_props$format = props.format) != null ? _props$format : defaultFormat
14
- });
15
- };
16
4
  export const useSingleInputTimeRangeField = inProps => {
17
- const props = useDefaultizedTimeRangeFieldProps(inProps);
5
+ const props = useDefaultizedTimeField(inProps);
18
6
  const {
19
7
  forwardedProps,
20
8
  internalProps
@@ -131,7 +131,6 @@ StaticDateRangePicker.propTypes = {
131
131
  /**
132
132
  * The day view will show as many weeks as needed after the end of the current month to match this value.
133
133
  * Put it to 6 to have a fixed number of weeks in Gregorian calendars
134
- * @default undefined
135
134
  */
136
135
  fixedWeekNumber: PropTypes.number,
137
136
  /**
package/index.d.ts CHANGED
@@ -13,7 +13,6 @@ export * from './MultiInputDateTimeRangeField';
13
13
  export * from './SingleInputDateRangeField';
14
14
  export * from './SingleInputTimeRangeField';
15
15
  export * from './SingleInputDateTimeRangeField';
16
- export type { RangeFieldSection, BaseMultiInputFieldProps, MultiInputFieldSlotTextFieldProps, } from './internals/models/fields';
17
16
  export * from './DateRangeCalendar';
18
17
  export * from './DateRangePicker';
19
18
  export * from './DesktopDateRangePicker';
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v7.0.0-beta.2
2
+ * @mui/x-date-pickers-pro v7.0.0-beta.4
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -21,6 +21,7 @@ export * from './MultiInputDateTimeRangeField';
21
21
  export * from './SingleInputDateRangeField';
22
22
  export * from './SingleInputTimeRangeField';
23
23
  export * from './SingleInputDateTimeRangeField';
24
+
24
25
  // Calendars
25
26
  export * from './DateRangeCalendar';
26
27
 
@@ -1,19 +1,19 @@
1
1
  import { UsePickerParams, BasePickerProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers/models';
3
3
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
4
- import { RangeFieldSection, BaseRangeNonStaticPickerProps } from '../../models';
4
+ import { BaseRangeNonStaticPickerProps } from '../../models';
5
5
  import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
6
6
  import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
7
- import { DateRange } from '../../../models';
7
+ import { DateRange, RangeFieldSection } from '../../../models';
8
8
  export interface UseRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
9
9
  }
10
- export interface UseRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate> {
10
+ export interface UseRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView>, RangePickerFieldSlotProps<TDate, TEnableAccessibleFieldDOMStructure> {
11
11
  tabs?: ExportedBaseTabsProps;
12
12
  toolbar?: ExportedBaseToolbarProps;
13
13
  }
14
- export interface RangeOnlyPickerProps<TDate extends PickerValidDate> extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps<DateRange<TDate>, RangeFieldSection>, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
14
+ export interface RangeOnlyPickerProps extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
15
15
  }
16
- export interface UseRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>, TAdditionalViewProps extends {}> extends RangeOnlyPickerProps<TDate>, BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, TAdditionalViewProps> {
16
+ export interface UseRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>, TAdditionalViewProps extends {}> extends RangeOnlyPickerProps, BasePickerProps<DateRange<TDate>, TDate, TView, TError, TExternalProps, TAdditionalViewProps> {
17
17
  }
18
18
  export interface RangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
19
19
  }
@@ -2,6 +2,6 @@ import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
3
  import { PickerValidDate } from '@mui/x-date-pickers/models';
4
4
  import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
5
- export declare const useDesktopRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TExternalProps>) => {
5
+ export declare const useDesktopRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, ...pickerParams }: UseDesktopRangePickerParams<TDate, TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
6
6
  renderPicker: () => React.JSX.Element;
7
7
  };
@@ -27,6 +27,9 @@ export const useDesktopRangePicker = _ref => {
27
27
  sx,
28
28
  format,
29
29
  formatDensity,
30
+ enableAccessibleFieldDOMStructure,
31
+ selectedSections,
32
+ onSelectedSectionsChange,
30
33
  timezone,
31
34
  label,
32
35
  inputRef,
@@ -41,12 +44,14 @@ export const useDesktopRangePicker = _ref => {
41
44
  const fieldContainerRef = React.useRef(null);
42
45
  const anchorRef = React.useRef(null);
43
46
  const popperRef = React.useRef(null);
47
+ const startFieldRef = React.useRef(null);
48
+ const endFieldRef = React.useRef(null);
44
49
  const initialView = React.useRef((_props$openTo = props.openTo) != null ? _props$openTo : null);
50
+ const fieldType = (_fieldType = slots.field.fieldType) != null ? _fieldType : 'multi-input';
45
51
  const {
46
52
  rangePosition,
47
- onRangePositionChange,
48
- singleInputFieldRef
49
- } = useRangePosition(props);
53
+ onRangePositionChange
54
+ } = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
50
55
  const {
51
56
  open,
52
57
  actions,
@@ -58,6 +63,7 @@ export const useDesktopRangePicker = _ref => {
58
63
  props,
59
64
  wrapperVariant: 'desktop',
60
65
  autoFocusView: false,
66
+ fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
61
67
  additionalViewProps: {
62
68
  rangePosition,
63
69
  onRangePositionChange
@@ -79,7 +85,6 @@ export const useDesktopRangePicker = _ref => {
79
85
  });
80
86
  };
81
87
  const Field = slots.field;
82
- const fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
83
88
  const fieldProps = useSlotProps({
84
89
  elementType: Field,
85
90
  externalSlotProps: slotProps == null ? void 0 : slotProps.field,
@@ -90,13 +95,16 @@ export const useDesktopRangePicker = _ref => {
90
95
  sx,
91
96
  format,
92
97
  formatDensity,
98
+ enableAccessibleFieldDOMStructure,
99
+ selectedSections,
100
+ onSelectedSectionsChange,
93
101
  timezone,
94
102
  autoFocus: autoFocus && !props.open,
95
103
  ref: fieldContainerRef
96
- }, fieldType === 'single-input' && {
104
+ }, inputRef ? {
97
105
  inputRef,
98
106
  name
99
- }),
107
+ } : {}),
100
108
  ownerState: props
101
109
  });
102
110
  const enrichedFieldProps = useEnrichedRangePickerFieldProps({
@@ -111,11 +119,12 @@ export const useDesktopRangePicker = _ref => {
111
119
  onBlur: handleBlur,
112
120
  rangePosition,
113
121
  onRangePositionChange,
114
- singleInputFieldRef,
115
122
  pickerSlotProps: slotProps,
116
123
  pickerSlots: slots,
117
124
  fieldProps,
118
125
  anchorRef,
126
+ startFieldRef,
127
+ endFieldRef,
119
128
  currentView: layoutProps.view !== props.openTo ? layoutProps.view : undefined,
120
129
  initialView: (_initialView$current = initialView.current) != null ? _initialView$current : undefined,
121
130
  onViewChange: layoutProps.onViewChange
@@ -3,15 +3,15 @@ import { PickerValidDate } from '@mui/x-date-pickers/models';
3
3
  import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
4
4
  export interface UseDesktopRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersPopperSlots {
5
5
  }
6
- export interface UseDesktopRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlotProps<TDate, TView>, PickersPopperSlotProps {
6
+ export interface UseDesktopRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>, PickersPopperSlotProps {
7
7
  }
8
- export interface DesktopRangeOnlyPickerProps<TDate extends PickerValidDate> extends RangeOnlyPickerProps<TDate> {
8
+ export interface DesktopRangeOnlyPickerProps extends RangeOnlyPickerProps {
9
9
  /**
10
10
  * If `true`, the start `input` element is focused during the first mount.
11
11
  */
12
12
  autoFocus?: boolean;
13
13
  }
14
- export interface UseDesktopRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
14
+ export interface UseDesktopRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, DesktopRangePickerAdditionalViewProps> {
15
15
  /**
16
16
  * Overridable component slots.
17
17
  * @default {}
@@ -21,9 +21,9 @@ export interface UseDesktopRangePickerProps<TDate extends PickerValidDate, TView
21
21
  * The props used for each component slot.
22
22
  * @default {}
23
23
  */
24
- slotProps?: UseDesktopRangePickerSlotProps<TDate, TView>;
24
+ slotProps?: UseDesktopRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>;
25
25
  }
26
26
  export interface DesktopRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
27
27
  }
28
- export interface UseDesktopRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, DesktopRangePickerAdditionalViewProps> {
28
+ export interface UseDesktopRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, DesktopRangePickerAdditionalViewProps> {
29
29
  }
@@ -1,14 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import Stack, { StackProps } from '@mui/material/Stack';
3
3
  import Typography, { TypographyProps } from '@mui/material/Typography';
4
- import TextField, { TextFieldProps } from '@mui/material/TextField';
4
+ import TextField from '@mui/material/TextField';
5
5
  import { SlotComponentProps } from '@mui/base/utils';
6
- import { BaseSingleInputFieldProps, PickerValidDate } from '@mui/x-date-pickers/models';
6
+ import { BaseSingleInputFieldProps, FieldRef, PickerValidDate } from '@mui/x-date-pickers/models';
7
7
  import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '@mui/x-date-pickers/hooks';
8
8
  import { PickersInputLocaleText } from '@mui/x-date-pickers/locales';
9
- import { BaseFieldProps, UsePickerResponse, WrapperVariant, UsePickerProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
10
- import { BaseMultiInputFieldProps, RangeFieldSection, UseDateRangeFieldProps, FieldType } from '../models';
11
- import { DateRange, RangePosition } from '../../models';
9
+ import { BaseFieldProps, UsePickerResponse, WrapperVariant, UsePickerProps, SlotComponentPropsFromProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
10
+ import { UseDateRangeFieldProps } from '../models';
11
+ import { BaseMultiInputFieldProps, RangeFieldSection, DateRange, RangePosition, FieldType } from '../../models';
12
12
  import { UseRangePositionResponse } from './useRangePosition';
13
13
  export interface RangePickerFieldSlots extends UseClearableFieldSlots {
14
14
  field: React.ElementType;
@@ -25,35 +25,35 @@ export interface RangePickerFieldSlots extends UseClearableFieldSlots {
25
25
  /**
26
26
  * Form control with an input to render a date or time inside the default field.
27
27
  * It is rendered twice: once for the start element and once for the end element.
28
- * Receives the same props as `@mui/material/TextField`.
29
- * @default TextField from '@mui/material'
28
+ * @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
30
29
  */
31
- textField?: React.ElementType<TextFieldProps>;
30
+ textField?: React.ElementType;
32
31
  }
33
- export interface RangePickerFieldSlotProps<TDate extends PickerValidDate> extends UseClearableFieldSlotProps {
34
- field?: SlotComponentProps<React.ElementType<BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, unknown>>, {}, UsePickerProps<DateRange<TDate>, TDate, any, RangeFieldSection, any, any, any>>;
32
+ export interface RangePickerFieldSlotProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends UseClearableFieldSlotProps {
33
+ field?: SlotComponentPropsFromProps<BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, unknown>, {}, UsePickerProps<DateRange<TDate>, TDate, any, any, any, any>>;
35
34
  fieldRoot?: SlotComponentProps<typeof Stack, {}, Record<string, any>>;
36
35
  fieldSeparator?: SlotComponentProps<typeof Typography, {}, Record<string, any>>;
37
- textField?: SlotComponentProps<typeof TextField, {}, UseDateRangeFieldProps<TDate> & {
36
+ textField?: SlotComponentProps<typeof TextField, {}, UseDateRangeFieldProps<TDate, TEnableAccessibleFieldDOMStructure> & {
38
37
  position?: RangePosition;
39
38
  }>;
40
39
  }
41
- export interface UseEnrichedRangePickerFieldPropsParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> = BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
40
+ export interface UseEnrichedRangePickerFieldPropsParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, FieldProps extends BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> = BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>> extends Pick<UsePickerResponse<DateRange<TDate>, TView, RangeFieldSection, any>, 'open' | 'actions'>, UseRangePositionResponse {
42
41
  wrapperVariant: WrapperVariant;
43
42
  fieldType: FieldType;
44
43
  readOnly?: boolean;
45
44
  labelId?: string;
46
45
  disableOpenPicker?: boolean;
47
46
  onBlur?: () => void;
48
- inputRef?: React.Ref<HTMLInputElement>;
49
47
  label?: React.ReactNode;
50
48
  localeText: PickersInputLocaleText<TDate> | undefined;
51
- pickerSlotProps: RangePickerFieldSlotProps<TDate> | undefined;
49
+ pickerSlotProps: RangePickerFieldSlotProps<TDate, TEnableAccessibleFieldDOMStructure> | undefined;
52
50
  pickerSlots: RangePickerFieldSlots | undefined;
53
51
  fieldProps: FieldProps;
54
52
  anchorRef?: React.Ref<HTMLDivElement>;
55
53
  currentView?: TView | null;
56
54
  initialView?: TView;
57
55
  onViewChange?: (view: TView) => void;
56
+ startFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
57
+ endFieldRef: React.RefObject<FieldRef<RangeFieldSection>>;
58
58
  }
59
- export declare const useEnrichedRangePickerFieldProps: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TError, BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError> | BaseSingleInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TError>;
59
+ export declare const useEnrichedRangePickerFieldProps: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError>(params: UseEnrichedRangePickerFieldPropsParams<TDate, TView, TEnableAccessibleFieldDOMStructure, TError, BaseFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>>) => BaseMultiInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError> | BaseSingleInputFieldProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TError>;
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import { resolveComponentProps } from '@mui/base/utils';
6
6
  import useEventCallback from '@mui/utils/useEventCallback';
7
7
  import useForkRef from '@mui/utils/useForkRef';
8
- import { onSpaceOrEnter, useLocaleText, getActiveElement } from '@mui/x-date-pickers/internals';
8
+ import { onSpaceOrEnter, useLocaleText } from '@mui/x-date-pickers/internals';
9
9
  const useMultiInputFieldSlotProps = ({
10
10
  wrapperVariant,
11
11
  open,
@@ -23,35 +23,33 @@ const useMultiInputFieldSlotProps = ({
23
23
  anchorRef,
24
24
  currentView,
25
25
  initialView,
26
- onViewChange
26
+ onViewChange,
27
+ startFieldRef,
28
+ endFieldRef
27
29
  }) => {
28
30
  const localeText = useLocaleText();
29
- const startRef = React.useRef(null);
30
- const endRef = React.useRef(null);
31
- const startFieldRef = React.useRef(null);
32
- const endFieldRef = React.useRef(null);
33
31
  const handleStartFieldRef = useForkRef(fieldProps.unstableStartFieldRef, startFieldRef);
34
- const handleEndFieldRef = useForkRef(fieldProps.unstableFieldRef, endFieldRef);
32
+ const handleEndFieldRef = useForkRef(fieldProps.unstableEndFieldRef, endFieldRef);
35
33
  const previousRangePosition = React.useRef(rangePosition);
36
34
  React.useEffect(() => {
37
- var _currentRef$current;
35
+ var _currentFieldRef$curr;
38
36
  if (!open) {
39
37
  return;
40
38
  }
41
- const currentRef = rangePosition === 'start' ? startRef : endRef;
42
- (_currentRef$current = currentRef.current) == null || _currentRef$current.focus();
43
39
  const currentFieldRef = rangePosition === 'start' ? startFieldRef : endFieldRef;
40
+ (_currentFieldRef$curr = currentFieldRef.current) == null || _currentFieldRef$curr.focusField();
44
41
  if (!currentFieldRef.current || !currentView) {
45
42
  // could happen when the user is switching between the inputs
46
43
  previousRangePosition.current = rangePosition;
47
44
  return;
48
45
  }
46
+
49
47
  // bring back focus to the field
50
48
  currentFieldRef.current.setSelectedSections(
51
49
  // use the current view or `0` when the range position has just been swapped
52
50
  previousRangePosition.current === rangePosition ? currentView : 0);
53
51
  previousRangePosition.current = rangePosition;
54
- }, [rangePosition, open, currentView]);
52
+ }, [rangePosition, open, currentView, startFieldRef, endFieldRef]);
55
53
  const openRangeStartSelection = event => {
56
54
  event.stopPropagation();
57
55
  onRangePositionChange('start');
@@ -90,12 +88,11 @@ const useMultiInputFieldSlotProps = ({
90
88
  const slotProps = _extends({}, fieldProps.slotProps, {
91
89
  textField: ownerState => {
92
90
  const resolvedComponentProps = resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.textField, ownerState);
93
- let inputProps;
91
+ let textFieldProps;
94
92
  let InputProps;
95
93
  if (ownerState.position === 'start') {
96
94
  var _inLocaleText$start;
97
- inputProps = _extends({
98
- inputRef: startRef,
95
+ textFieldProps = _extends({
99
96
  label: (_inLocaleText$start = inLocaleText == null ? void 0 : inLocaleText.start) != null ? _inLocaleText$start : localeText.start,
100
97
  onKeyDown: onSpaceOrEnter(openRangeStartSelection),
101
98
  onFocus: handleFocusStart,
@@ -112,8 +109,7 @@ const useMultiInputFieldSlotProps = ({
112
109
  }
113
110
  } else {
114
111
  var _inLocaleText$end;
115
- inputProps = _extends({
116
- inputRef: endRef,
112
+ textFieldProps = _extends({
117
113
  label: (_inLocaleText$end = inLocaleText == null ? void 0 : inLocaleText.end) != null ? _inLocaleText$end : localeText.end,
118
114
  onKeyDown: onSpaceOrEnter(openRangeEndSelection),
119
115
  onFocus: handleFocusEnd,
@@ -127,7 +123,7 @@ const useMultiInputFieldSlotProps = ({
127
123
  }
128
124
  return _extends({}, labelId != null && {
129
125
  id: `${labelId}-${ownerState.position}`
130
- }, inputProps, resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.textField, ownerState), {
126
+ }, textFieldProps, resolveComponentProps(pickerSlotProps == null ? void 0 : pickerSlotProps.textField, ownerState), {
131
127
  InputProps
132
128
  });
133
129
  },
@@ -141,12 +137,13 @@ const useMultiInputFieldSlotProps = ({
141
137
  });
142
138
 
143
139
  /* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
144
- const restFieldProps = _objectWithoutPropertiesLoose(fieldProps, _excluded);
140
+ const _ref = fieldProps,
141
+ restFieldProps = _objectWithoutPropertiesLoose(_ref, _excluded);
145
142
  const enrichedFieldProps = _extends({}, restFieldProps, {
146
- slots,
147
- slotProps,
148
143
  unstableStartFieldRef: handleStartFieldRef,
149
- unstableEndFieldRef: handleEndFieldRef
144
+ unstableEndFieldRef: handleEndFieldRef,
145
+ slots,
146
+ slotProps
150
147
  });
151
148
  return enrichedFieldProps;
152
149
  };
@@ -155,52 +152,53 @@ const useSingleInputFieldSlotProps = ({
155
152
  open,
156
153
  actions,
157
154
  readOnly,
158
- inputRef: inInputRef,
159
155
  labelId,
160
156
  disableOpenPicker,
161
157
  label,
162
158
  onBlur,
163
159
  rangePosition,
164
160
  onRangePositionChange,
165
- singleInputFieldRef,
161
+ startFieldRef,
162
+ endFieldRef,
166
163
  pickerSlots,
167
164
  pickerSlotProps,
168
165
  fieldProps,
169
166
  anchorRef,
170
167
  currentView
171
168
  }) => {
172
- const inputRef = React.useRef(null);
173
- const handleInputRef = useForkRef(inInputRef, inputRef);
174
- const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, singleInputFieldRef);
169
+ const handleFieldRef = useForkRef(fieldProps.unstableFieldRef, startFieldRef, endFieldRef);
175
170
  React.useEffect(() => {
176
- var _inputRef$current;
177
- if (!open) {
171
+ if (!open || !startFieldRef.current) {
178
172
  return;
179
173
  }
180
- (_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
181
- if (!singleInputFieldRef.current || !currentView) {
174
+ if (startFieldRef.current.isFieldFocused()) {
182
175
  return;
183
176
  }
184
- const sections = singleInputFieldRef.current.getSections().map(section => section.type);
177
+
185
178
  // bring back focus to the field with the current view section selected
186
- singleInputFieldRef.current.setSelectedSections(rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView));
187
- }, [rangePosition, open, currentView, singleInputFieldRef]);
179
+ if (currentView) {
180
+ var _startFieldRef$curren;
181
+ const sections = startFieldRef.current.getSections().map(section => section.type);
182
+ const newSelectedSection = rangePosition === 'start' ? sections.indexOf(currentView) : sections.lastIndexOf(currentView);
183
+ (_startFieldRef$curren = startFieldRef.current) == null || _startFieldRef$curren.focusField(newSelectedSection);
184
+ }
185
+ }, [rangePosition, open, currentView, startFieldRef]);
188
186
  const updateRangePosition = () => {
189
- var _singleInputFieldRef$;
190
- if (!singleInputFieldRef.current || inputRef.current !== getActiveElement(document)) {
187
+ var _startFieldRef$curren2, _startFieldRef$curren3;
188
+ if (!((_startFieldRef$curren2 = startFieldRef.current) != null && _startFieldRef$curren2.isFieldFocused())) {
191
189
  return;
192
190
  }
193
- const sections = singleInputFieldRef.current.getSections();
194
- const activeSectionIndex = (_singleInputFieldRef$ = singleInputFieldRef.current) == null ? void 0 : _singleInputFieldRef$.getActiveSectionIndex();
191
+ const sections = startFieldRef.current.getSections();
192
+ const activeSectionIndex = (_startFieldRef$curren3 = startFieldRef.current) == null ? void 0 : _startFieldRef$curren3.getActiveSectionIndex();
195
193
  const domRangePosition = activeSectionIndex == null || activeSectionIndex < sections.length / 2 ? 'start' : 'end';
196
194
  if (domRangePosition != null && domRangePosition !== rangePosition) {
197
195
  onRangePositionChange(domRangePosition);
198
196
  }
199
197
  };
200
- const handleSelectedSectionsChange = useEventCallback(selectedSections => {
198
+ const handleSelectedSectionsChange = useEventCallback(selectedSection => {
201
199
  var _fieldProps$onSelecte;
202
200
  setTimeout(updateRangePosition);
203
- (_fieldProps$onSelecte = fieldProps.onSelectedSectionsChange) == null || _fieldProps$onSelecte.call(fieldProps, selectedSections);
201
+ (_fieldProps$onSelecte = fieldProps.onSelectedSectionsChange) == null || _fieldProps$onSelecte.call(fieldProps, selectedSection);
204
202
  });
205
203
  const openPicker = event => {
206
204
  event.stopPropagation();
@@ -223,7 +221,6 @@ const useSingleInputFieldSlotProps = ({
223
221
  slotProps,
224
222
  label,
225
223
  unstableFieldRef: handleFieldRef,
226
- inputRef: handleInputRef,
227
224
  onKeyDown: onSpaceOrEnter(openPicker, fieldProps.onKeyDown),
228
225
  onSelectedSectionsChange: handleSelectedSectionsChange,
229
226
  onBlur,