@mui/x-date-pickers-pro 7.0.0-beta.1 → 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 (293) hide show
  1. package/CHANGELOG.md +437 -4
  2. package/DateRangeCalendar/DateRangeCalendar.d.ts +2 -1
  3. package/DateRangeCalendar/DateRangeCalendar.js +9 -7
  4. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +10 -7
  5. package/DateRangeCalendar/useDragRange.d.ts +4 -4
  6. package/DateRangePicker/DateRangePicker.d.ts +2 -1
  7. package/DateRangePicker/DateRangePicker.js +14 -14
  8. package/DateRangePicker/DateRangePicker.types.d.ts +5 -4
  9. package/DateRangePicker/DateRangePickerToolbar.d.ts +6 -2
  10. package/DateRangePicker/DateRangePickerToolbar.js +7 -1
  11. package/DateRangePicker/shared.d.ts +6 -5
  12. package/DateRangePickerDay/DateRangePickerDay.d.ts +3 -2
  13. package/DateRangePickerDay/DateRangePickerDay.js +2 -2
  14. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +2 -1
  15. package/DateTimeRangePicker/DateTimeRangePicker.js +20 -21
  16. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +5 -4
  17. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  18. package/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.d.ts +3 -2
  19. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +6 -2
  20. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -1
  21. package/DateTimeRangePicker/shared.d.ts +6 -5
  22. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +2 -1
  23. package/DesktopDateRangePicker/DesktopDateRangePicker.js +14 -14
  24. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +5 -4
  25. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +2 -1
  26. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -21
  27. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +5 -4
  28. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.d.ts +2 -1
  29. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +2 -1
  30. package/MobileDateRangePicker/MobileDateRangePicker.js +14 -14
  31. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +5 -4
  32. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +2 -1
  33. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -21
  34. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +5 -4
  35. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +2 -1
  36. package/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -24
  37. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +12 -14
  38. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +2 -1
  39. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +26 -28
  40. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +13 -16
  41. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +2 -1
  42. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +22 -24
  43. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +13 -16
  44. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +3 -2
  45. package/SingleInputDateRangeField/SingleInputDateRangeField.js +17 -15
  46. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -13
  47. package/SingleInputDateRangeField/index.d.ts +1 -1
  48. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +3 -3
  49. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
  50. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +3 -2
  51. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -19
  52. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -14
  53. package/SingleInputDateTimeRangeField/index.d.ts +1 -1
  54. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +3 -3
  55. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
  56. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +3 -2
  57. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +16 -14
  58. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -14
  59. package/SingleInputTimeRangeField/index.d.ts +1 -1
  60. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +3 -3
  61. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
  62. package/StaticDateRangePicker/StaticDateRangePicker.d.ts +2 -1
  63. package/StaticDateRangePicker/StaticDateRangePicker.js +5 -6
  64. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +4 -3
  65. package/dateRangeViewRenderers/dateRangeViewRenderers.d.ts +3 -2
  66. package/index.d.ts +7 -2
  67. package/index.js +8 -2
  68. package/internals/hooks/models/useRangePicker.d.ts +8 -7
  69. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +2 -1
  70. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +17 -8
  71. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +7 -6
  72. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
  73. package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
  74. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +2 -1
  75. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  76. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +7 -6
  77. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
  78. package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
  79. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +2 -1
  80. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  81. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +3 -3
  82. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  83. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
  84. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +3 -3
  85. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  86. package/internals/hooks/useRangePosition.d.ts +2 -4
  87. package/internals/hooks/useRangePosition.js +3 -6
  88. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +2 -1
  89. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  90. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +6 -6
  91. package/internals/models/dateRange.d.ts +5 -16
  92. package/internals/models/dateTimeRange.d.ts +5 -6
  93. package/internals/models/index.d.ts +0 -1
  94. package/internals/models/index.js +0 -1
  95. package/internals/models/timeRange.d.ts +4 -6
  96. package/internals/utils/date-fields-utils.d.ts +1 -5
  97. package/internals/utils/date-range-manager.d.ts +5 -5
  98. package/internals/utils/date-utils.d.ts +5 -5
  99. package/internals/utils/releaseInfo.js +1 -1
  100. package/internals/utils/validation/validateDateRange.d.ts +2 -2
  101. package/internals/utils/validation/validateDateTimeRange.d.ts +2 -2
  102. package/internals/utils/valueManagers.d.ts +3 -3
  103. package/internals/utils/valueManagers.js +11 -6
  104. package/models/fields.d.ts +69 -0
  105. package/models/index.d.ts +1 -0
  106. package/models/index.js +1 -0
  107. package/models/range.d.ts +3 -2
  108. package/modern/DateRangeCalendar/DateRangeCalendar.js +9 -7
  109. package/modern/DateRangePicker/DateRangePicker.js +14 -14
  110. package/modern/DateRangePicker/DateRangePickerToolbar.js +7 -1
  111. package/modern/DateRangePickerDay/DateRangePickerDay.js +2 -2
  112. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +20 -21
  113. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  114. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -1
  115. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +14 -14
  116. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -21
  117. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +14 -14
  118. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +20 -21
  119. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -24
  120. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +26 -28
  121. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +22 -24
  122. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +17 -15
  123. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
  124. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +21 -19
  125. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
  126. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +16 -14
  127. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
  128. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +5 -6
  129. package/modern/index.js +8 -2
  130. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +17 -8
  131. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
  132. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  133. package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
  134. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  135. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
  136. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
  137. package/modern/internals/hooks/useRangePosition.js +3 -6
  138. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  139. package/modern/internals/models/index.js +0 -1
  140. package/modern/internals/utils/releaseInfo.js +1 -1
  141. package/modern/internals/utils/valueManagers.js +11 -6
  142. package/modern/models/index.js +1 -0
  143. package/node/DateRangeCalendar/DateRangeCalendar.js +10 -8
  144. package/node/DateRangePicker/DateRangePicker.js +14 -14
  145. package/node/DateRangePicker/DateRangePickerToolbar.js +7 -1
  146. package/node/DateRangePickerDay/DateRangePickerDay.js +3 -3
  147. package/node/DateTimeRangePicker/DateTimeRangePicker.js +20 -21
  148. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  149. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +7 -1
  150. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +14 -14
  151. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +20 -21
  152. package/node/MobileDateRangePicker/MobileDateRangePicker.js +14 -14
  153. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +22 -23
  154. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +22 -24
  155. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +26 -28
  156. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +22 -24
  157. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +17 -15
  158. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
  159. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +24 -22
  160. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
  161. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +16 -14
  162. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
  163. package/node/StaticDateRangePicker/StaticDateRangePicker.js +5 -6
  164. package/node/index.js +18 -9
  165. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +18 -9
  166. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
  167. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +19 -10
  168. package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
  169. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
  170. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  171. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  172. package/node/internals/hooks/useRangePosition.js +3 -8
  173. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  174. package/node/internals/models/index.js +0 -11
  175. package/node/internals/utils/releaseInfo.js +1 -1
  176. package/node/internals/utils/valueManagers.js +10 -5
  177. package/node/models/index.js +11 -0
  178. package/package.json +6 -6
  179. package/themeAugmentation/props.d.ts +17 -17
  180. package/internals/models/fields.d.ts +0 -49
  181. package/legacy/AdapterDateFns/index.js +0 -1
  182. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  183. package/legacy/AdapterDateFnsV3/index.js +0 -1
  184. package/legacy/AdapterDayjs/index.js +0 -1
  185. package/legacy/AdapterLuxon/index.js +0 -1
  186. package/legacy/AdapterMoment/index.js +0 -1
  187. package/legacy/AdapterMomentHijri/index.js +0 -1
  188. package/legacy/AdapterMomentJalaali/index.js +0 -1
  189. package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
  190. package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
  191. package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
  192. package/legacy/DateRangeCalendar/index.js +0 -2
  193. package/legacy/DateRangeCalendar/useDragRange.js +0 -258
  194. package/legacy/DateRangePicker/DateRangePicker.js +0 -334
  195. package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
  196. package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
  197. package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
  198. package/legacy/DateRangePicker/index.js +0 -3
  199. package/legacy/DateRangePicker/shared.js +0 -33
  200. package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
  201. package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
  202. package/legacy/DateRangePickerDay/index.js +0 -2
  203. package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
  204. package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
  205. package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
  206. package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
  207. package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
  208. package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
  209. package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
  210. package/legacy/DateTimeRangePicker/index.js +0 -5
  211. package/legacy/DateTimeRangePicker/shared.js +0 -54
  212. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
  213. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
  214. package/legacy/DesktopDateRangePicker/index.js +0 -1
  215. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
  216. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
  217. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
  218. package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
  219. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
  220. package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
  221. package/legacy/MobileDateRangePicker/index.js +0 -1
  222. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
  223. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
  224. package/legacy/MobileDateTimeRangePicker/index.js +0 -1
  225. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
  226. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  227. package/legacy/MultiInputDateRangeField/index.js +0 -2
  228. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
  229. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  230. package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
  231. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
  232. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  233. package/legacy/MultiInputTimeRangeField/index.js +0 -2
  234. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
  235. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
  236. package/legacy/SingleInputDateRangeField/index.js +0 -2
  237. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
  238. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
  239. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
  240. package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
  241. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
  242. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
  243. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
  244. package/legacy/SingleInputTimeRangeField/index.js +0 -2
  245. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
  246. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
  247. package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
  248. package/legacy/StaticDateRangePicker/index.js +0 -1
  249. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
  250. package/legacy/dateRangeViewRenderers/index.js +0 -1
  251. package/legacy/index.js +0 -33
  252. package/legacy/internals/constants/dimensions.js +0 -5
  253. package/legacy/internals/hooks/models/index.js +0 -1
  254. package/legacy/internals/hooks/models/useRangePicker.js +0 -1
  255. package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
  256. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
  257. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
  258. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
  259. package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
  260. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
  261. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
  262. package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  263. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
  264. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
  265. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  266. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
  267. package/legacy/internals/hooks/useRangePosition.js +0 -39
  268. package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
  269. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
  270. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
  271. package/legacy/internals/models/dateRange.js +0 -1
  272. package/legacy/internals/models/dateTimeRange.js +0 -1
  273. package/legacy/internals/models/index.js +0 -5
  274. package/legacy/internals/models/rangePickerProps.js +0 -1
  275. package/legacy/internals/models/timeRange.js +0 -1
  276. package/legacy/internals/utils/date-fields-utils.js +0 -26
  277. package/legacy/internals/utils/date-range-manager.js +0 -65
  278. package/legacy/internals/utils/date-utils.js +0 -12
  279. package/legacy/internals/utils/releaseInfo.js +0 -13
  280. package/legacy/internals/utils/validation/validateDateRange.js +0 -45
  281. package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
  282. package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
  283. package/legacy/internals/utils/valueManagers.js +0 -135
  284. package/legacy/locales/index.js +0 -1
  285. package/legacy/models/index.js +0 -3
  286. package/legacy/models/multiInputRangeFieldClasses.js +0 -1
  287. package/legacy/models/range.js +0 -1
  288. package/legacy/models/validation.js +0 -1
  289. package/legacy/themeAugmentation/index.js +0 -4
  290. package/modern/internals/models/fields.js +0 -1
  291. /package/{internals/models → models}/fields.js +0 -0
  292. /package/{legacy/internals → modern}/models/fields.js +0 -0
  293. /package/node/{internals/models → models}/fields.js +0 -0
package/index.d.ts CHANGED
@@ -1,4 +1,10 @@
1
- export { LicenseInfo } from '@mui/x-license-pro';
1
+ import { LicenseInfo as LicenseInfoExport } from '@mui/x-license';
2
+ /**
3
+ * @deprecated Use `@mui/x-license` package instead:
4
+ * @example import { LicenseInfo } from '@mui/x-license';
5
+ */
6
+ export declare class LicenseInfo extends LicenseInfoExport {
7
+ }
2
8
  export * from '@mui/x-date-pickers';
3
9
  export * from './DateRangePickerDay';
4
10
  export * from './MultiInputDateRangeField';
@@ -7,7 +13,6 @@ export * from './MultiInputDateTimeRangeField';
7
13
  export * from './SingleInputDateRangeField';
8
14
  export * from './SingleInputTimeRangeField';
9
15
  export * from './SingleInputDateTimeRangeField';
10
- export type { RangeFieldSection, BaseMultiInputFieldProps, MultiInputFieldSlotTextFieldProps, } from './internals/models/fields';
11
16
  export * from './DateRangeCalendar';
12
17
  export * from './DateRangePicker';
13
18
  export * from './DesktopDateRangePicker';
package/index.js CHANGED
@@ -1,11 +1,16 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v7.0.0-beta.1
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
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- export { LicenseInfo } from '@mui/x-license-pro';
8
+ import { LicenseInfo as LicenseInfoExport } from '@mui/x-license';
9
+ /**
10
+ * @deprecated Use `@mui/x-license` package instead:
11
+ * @example import { LicenseInfo } from '@mui/x-license';
12
+ */
13
+ export class LicenseInfo extends LicenseInfoExport {}
9
14
  export * from '@mui/x-date-pickers';
10
15
  export * from './DateRangePickerDay';
11
16
 
@@ -16,6 +21,7 @@ export * from './MultiInputDateTimeRangeField';
16
21
  export * from './SingleInputDateRangeField';
17
22
  export * from './SingleInputTimeRangeField';
18
23
  export * from './SingleInputDateTimeRangeField';
24
+
19
25
  // Calendars
20
26
  export * from './DateRangeCalendar';
21
27
 
@@ -1,21 +1,22 @@
1
1
  import { UsePickerParams, BasePickerProps, ExportedBaseToolbarProps, UsePickerViewsProps, BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, DateOrTimeViewWithMeridiem, ExportedBaseTabsProps } from '@mui/x-date-pickers/internals';
2
+ import { PickerValidDate } from '@mui/x-date-pickers/models';
2
3
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
3
- import { RangeFieldSection, BaseRangeNonStaticPickerProps } from '../../models';
4
+ import { BaseRangeNonStaticPickerProps } from '../../models';
4
5
  import { UseRangePositionProps, UseRangePositionResponse } from '../useRangePosition';
5
6
  import { RangePickerFieldSlots, RangePickerFieldSlotProps } from '../useEnrichedRangePickerFieldProps';
6
- import { DateRange } from '../../../models';
7
- export interface UseRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
7
+ import { DateRange, RangeFieldSection } from '../../../models';
8
+ export interface UseRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView>, RangePickerFieldSlots {
8
9
  }
9
- export interface UseRangePickerSlotProps<TDate, 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> {
10
11
  tabs?: ExportedBaseTabsProps;
11
12
  toolbar?: ExportedBaseToolbarProps;
12
13
  }
13
- export interface RangeOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null, RangeFieldSection>, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
14
+ export interface RangeOnlyPickerProps extends BaseNonStaticPickerProps, UsePickerValueNonStaticProps, UsePickerViewsNonStaticProps, BaseRangeNonStaticPickerProps, UseRangePositionProps {
14
15
  }
15
- export interface UseRangePickerProps<TDate, 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> {
16
17
  }
17
18
  export interface RangePickerAdditionalViewProps extends Pick<UseRangePositionResponse, 'rangePosition' | 'onRangePositionChange'> {
18
19
  }
19
- export interface UseRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseRangePickerProps<TDate, TView, any, TExternalProps, TAdditionalViewProps>, TAdditionalViewProps extends {}> extends Pick<UsePickerParams<DateRange<TDate>, TDate, TView, RangeFieldSection, TExternalProps, TAdditionalViewProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor'> {
20
+ export interface UseRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseRangePickerProps<TDate, TView, any, TExternalProps, TAdditionalViewProps>, TAdditionalViewProps extends {}> extends Pick<UsePickerParams<DateRange<TDate>, TDate, TView, RangeFieldSection, TExternalProps, TAdditionalViewProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor'> {
20
21
  props: TExternalProps;
21
22
  }
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
+ import { PickerValidDate } from '@mui/x-date-pickers/models';
3
4
  import { UseDesktopRangePickerParams, UseDesktopRangePickerProps } from './useDesktopRangePicker.types';
4
- export declare const useDesktopRangePicker: <TDate, 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>) => {
5
6
  renderPicker: () => React.JSX.Element;
6
7
  };
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["props"];
4
4
  import * as React from 'react';
5
5
  import { useSlotProps } from '@mui/base/utils';
6
- import { useLicenseVerifier } from '@mui/x-license-pro';
6
+ import { useLicenseVerifier } from '@mui/x-license';
7
7
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
8
8
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
9
9
  import { executeInTheNextEventLoopTick, getActiveElement, usePicker, PickersPopper } from '@mui/x-date-pickers/internals';
@@ -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
@@ -1,16 +1,17 @@
1
1
  import { PickersPopperSlots, PickersPopperSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
+ import { PickerValidDate } from '@mui/x-date-pickers/models';
2
3
  import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
3
- export interface UseDesktopRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersPopperSlots {
4
+ export interface UseDesktopRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersPopperSlots {
4
5
  }
5
- export interface UseDesktopRangePickerSlotProps<TDate, 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 {
6
7
  }
7
- export interface DesktopRangeOnlyPickerProps<TDate> extends RangeOnlyPickerProps<TDate> {
8
+ export interface DesktopRangeOnlyPickerProps extends RangeOnlyPickerProps {
8
9
  /**
9
10
  * If `true`, the start `input` element is focused during the first mount.
10
11
  */
11
12
  autoFocus?: boolean;
12
13
  }
13
- export interface UseDesktopRangePickerProps<TDate, 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> {
14
15
  /**
15
16
  * Overridable component slots.
16
17
  * @default {}
@@ -20,9 +21,9 @@ export interface UseDesktopRangePickerProps<TDate, TView extends DateOrTimeViewW
20
21
  * The props used for each component slot.
21
22
  * @default {}
22
23
  */
23
- slotProps?: UseDesktopRangePickerSlotProps<TDate, TView>;
24
+ slotProps?: UseDesktopRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>;
24
25
  }
25
26
  export interface DesktopRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
26
27
  }
27
- export interface UseDesktopRangePickerParams<TDate, 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> {
28
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 } 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 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, 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, 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,
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
+ import { PickerValidDate } from '@mui/x-date-pickers/models';
3
4
  import { UseMobileRangePickerParams, UseMobileRangePickerProps } from './useMobileRangePicker.types';
4
- export declare const useMobileRangePicker: <TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TExternalProps>) => {
5
+ export declare const useMobileRangePicker: <TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>>({ props, ...pickerParams }: UseMobileRangePickerParams<TDate, TView, TEnableAccessibleFieldDOMStructure, TExternalProps>) => {
5
6
  renderPicker: () => React.JSX.Element;
6
7
  };
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
  const _excluded = ["props"];
4
4
  import * as React from 'react';
5
5
  import { useSlotProps } from '@mui/base/utils';
6
- import { useLicenseVerifier } from '@mui/x-license-pro';
6
+ import { useLicenseVerifier } from '@mui/x-license';
7
7
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
8
8
  import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
9
9
  import { usePicker, PickersModalDialog, useLocaleText } from '@mui/x-date-pickers/internals';
@@ -28,6 +28,9 @@ export const useMobileRangePicker = _ref => {
28
28
  sx,
29
29
  format,
30
30
  formatDensity,
31
+ enableAccessibleFieldDOMStructure,
32
+ selectedSections,
33
+ onSelectedSectionsChange,
31
34
  timezone,
32
35
  label,
33
36
  inputRef,
@@ -37,11 +40,13 @@ export const useMobileRangePicker = _ref => {
37
40
  disableOpenPicker,
38
41
  localeText
39
42
  } = props;
43
+ const startFieldRef = React.useRef(null);
44
+ const endFieldRef = React.useRef(null);
45
+ const fieldType = (_fieldType = slots.field.fieldType) != null ? _fieldType : 'multi-input';
40
46
  const {
41
47
  rangePosition,
42
- onRangePositionChange,
43
- singleInputFieldRef
44
- } = useRangePosition(props);
48
+ onRangePositionChange
49
+ } = useRangePosition(props, fieldType === 'single-input' ? startFieldRef : undefined);
45
50
  const labelId = useId();
46
51
  const contextLocaleText = useLocaleText();
47
52
  const {
@@ -54,13 +59,13 @@ export const useMobileRangePicker = _ref => {
54
59
  props,
55
60
  wrapperVariant: 'mobile',
56
61
  autoFocusView: true,
62
+ fieldRef: rangePosition === 'start' ? startFieldRef : endFieldRef,
57
63
  additionalViewProps: {
58
64
  rangePosition,
59
65
  onRangePositionChange
60
66
  }
61
67
  }));
62
68
  const Field = slots.field;
63
- const fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
64
69
  const fieldProps = useSlotProps({
65
70
  elementType: Field,
66
71
  externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
@@ -71,11 +76,14 @@ export const useMobileRangePicker = _ref => {
71
76
  sx,
72
77
  format,
73
78
  formatDensity,
79
+ enableAccessibleFieldDOMStructure,
80
+ selectedSections,
81
+ onSelectedSectionsChange,
74
82
  timezone
75
- }, fieldType === 'single-input' && {
83
+ }, inputRef ? {
76
84
  inputRef,
77
85
  name
78
- }),
86
+ } : {}),
79
87
  ownerState: props
80
88
  });
81
89
  const isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null || (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
@@ -91,10 +99,11 @@ export const useMobileRangePicker = _ref => {
91
99
  localeText,
92
100
  rangePosition,
93
101
  onRangePositionChange,
94
- singleInputFieldRef,
95
102
  pickerSlots: slots,
96
103
  pickerSlotProps: innerSlotProps,
97
- fieldProps
104
+ fieldProps,
105
+ startFieldRef,
106
+ endFieldRef
98
107
  });
99
108
  const slotPropsForLayout = _extends({}, innerSlotProps, {
100
109
  tabs: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.tabs, {
@@ -1,12 +1,13 @@
1
1
  import { PickersModalDialogSlots, PickersModalDialogSlotProps, UsePickerViewsProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
+ import { PickerValidDate } from '@mui/x-date-pickers/models';
2
3
  import { RangeOnlyPickerProps, RangePickerAdditionalViewProps, UseRangePickerParams, UseRangePickerProps, UseRangePickerSlotProps, UseRangePickerSlots } from '../models/useRangePicker';
3
- export interface UseMobileRangePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersModalDialogSlots {
4
+ export interface UseMobileRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlots<TDate, TView>, PickersModalDialogSlots {
4
5
  }
5
- export interface UseMobileRangePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends UseRangePickerSlotProps<TDate, TView>, PickersModalDialogSlotProps {
6
+ export interface UseMobileRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean> extends UseRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>, PickersModalDialogSlotProps {
6
7
  }
7
- export interface MobileRangeOnlyPickerProps<TDate> extends RangeOnlyPickerProps<TDate> {
8
+ export interface MobileRangeOnlyPickerProps extends RangeOnlyPickerProps {
8
9
  }
9
- export interface UseMobileRangePickerProps<TDate, TView extends DateOrTimeViewWithMeridiem, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
10
+ export interface UseMobileRangePickerProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<any, any, TView, any, any>> extends UseRangePickerProps<TDate, TView, TError, TExternalProps, MobileRangePickerAdditionalViewProps> {
10
11
  /**
11
12
  * Overridable component slots.
12
13
  * @default {}
@@ -16,9 +17,9 @@ export interface UseMobileRangePickerProps<TDate, TView extends DateOrTimeViewWi
16
17
  * The props used for each component slot.
17
18
  * @default {}
18
19
  */
19
- slotProps?: UseMobileRangePickerSlotProps<TDate, TView>;
20
+ slotProps?: UseMobileRangePickerSlotProps<TDate, TView, TEnableAccessibleFieldDOMStructure>;
20
21
  }
21
22
  export interface MobileRangePickerAdditionalViewProps extends RangePickerAdditionalViewProps {
22
23
  }
23
- export interface UseMobileRangePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobileRangePickerProps<TDate, TView, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
24
+ export interface UseMobileRangePickerParams<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseMobileRangePickerProps<TDate, TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends UseRangePickerParams<TDate, TView, TExternalProps, MobileRangePickerAdditionalViewProps> {
24
25
  }
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { UseFieldInternalProps } from '@mui/x-date-pickers/internals';
3
+ import { FieldRef, FieldSelectedSections } from '@mui/x-date-pickers/models';
4
+ import { RangeFieldSection } from '../../models';
5
+ interface UseMultiInputFieldSelectedSectionsParams extends Pick<UseFieldInternalProps<any, any, RangeFieldSection, any, any>, 'selectedSections' | 'onSelectedSectionsChange'> {
6
+ unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
7
+ unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
8
+ }
9
+ export declare const useMultiInputFieldSelectedSections: (params: UseMultiInputFieldSelectedSectionsParams) => {
10
+ start: {
11
+ unstableFieldRef: React.Ref<FieldRef<RangeFieldSection>> | undefined;
12
+ selectedSections: FieldSelectedSections;
13
+ onSelectedSectionsChange: (newSelectedSections: FieldSelectedSections) => void;
14
+ };
15
+ end: {
16
+ unstableFieldRef: ((instance: FieldRef<RangeFieldSection> | null) => void) | null;
17
+ selectedSections: FieldSelectedSections;
18
+ onSelectedSectionsChange: (newSelectedSections: FieldSelectedSections) => void;
19
+ };
20
+ };
21
+ export {};