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

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 (278) hide show
  1. package/CHANGELOG.md +429 -30
  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 +5 -2
  8. package/DateRangePicker/DateRangePickerToolbar.js +22 -2
  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 +45 -9
  15. package/DateTimeRangePicker/shared.js +8 -3
  16. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -1
  17. package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  18. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +3 -3
  19. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -1
  20. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  21. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +3 -3
  22. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -1
  23. package/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  24. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +3 -3
  25. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -1
  26. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
  27. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +3 -3
  28. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -1
  29. package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  30. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +11 -14
  31. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -1
  32. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  33. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +12 -16
  34. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -1
  35. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  36. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +12 -16
  37. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +2 -2
  38. package/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  39. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -14
  40. package/SingleInputDateRangeField/index.d.ts +1 -1
  41. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +2 -3
  42. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
  43. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +2 -2
  44. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
  45. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -15
  46. package/SingleInputDateTimeRangeField/index.d.ts +1 -1
  47. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +2 -3
  48. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
  49. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +2 -2
  50. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  51. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -15
  52. package/SingleInputTimeRangeField/index.d.ts +1 -1
  53. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +2 -3
  54. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
  55. package/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  56. package/StaticDateRangePicker/StaticDateRangePicker.types.d.ts +1 -1
  57. package/index.d.ts +0 -1
  58. package/index.js +2 -1
  59. package/internals/hooks/models/useRangePicker.d.ts +5 -5
  60. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
  61. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  62. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
  63. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
  64. package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
  65. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
  66. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  67. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
  68. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
  69. package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
  70. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
  71. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  72. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -3
  73. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  74. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
  75. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -3
  76. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  77. package/internals/hooks/useRangePosition.d.ts +2 -4
  78. package/internals/hooks/useRangePosition.js +3 -6
  79. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  80. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
  81. package/internals/models/dateRange.d.ts +3 -15
  82. package/internals/models/dateTimeRange.d.ts +4 -6
  83. package/internals/models/index.d.ts +0 -1
  84. package/internals/models/index.js +0 -1
  85. package/internals/models/timeRange.d.ts +3 -6
  86. package/internals/utils/date-fields-utils.d.ts +1 -5
  87. package/internals/utils/releaseInfo.js +1 -1
  88. package/internals/utils/valueManagers.d.ts +1 -2
  89. package/internals/utils/valueManagers.js +11 -6
  90. package/models/fields.d.ts +69 -0
  91. package/models/index.d.ts +1 -0
  92. package/models/index.js +1 -0
  93. package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
  94. package/modern/DateRangePicker/DateRangePicker.js +9 -9
  95. package/modern/DateRangePicker/DateRangePickerToolbar.js +22 -2
  96. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  97. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  98. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +45 -9
  99. package/modern/DateTimeRangePicker/shared.js +7 -2
  100. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  101. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  102. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  103. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
  104. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  105. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  106. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  107. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  108. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
  109. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
  110. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
  111. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  112. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
  113. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  114. package/modern/index.js +2 -1
  115. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  116. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
  117. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  118. package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
  119. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  120. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
  121. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
  122. package/modern/internals/hooks/useRangePosition.js +3 -6
  123. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  124. package/modern/internals/models/index.js +0 -1
  125. package/modern/internals/utils/releaseInfo.js +1 -1
  126. package/modern/internals/utils/valueManagers.js +11 -6
  127. package/modern/models/index.js +1 -0
  128. package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
  129. package/node/DateRangePicker/DateRangePicker.js +9 -9
  130. package/node/DateRangePicker/DateRangePickerToolbar.js +22 -2
  131. package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  132. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  133. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +45 -9
  134. package/node/DateTimeRangePicker/shared.js +7 -2
  135. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  136. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  137. package/node/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  138. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -14
  139. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  140. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  141. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  142. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  143. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
  144. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +15 -13
  145. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
  146. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  147. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
  148. package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  149. package/node/index.js +1 -1
  150. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  151. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
  152. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +18 -9
  153. package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
  154. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
  155. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  156. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  157. package/node/internals/hooks/useRangePosition.js +3 -8
  158. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  159. package/node/internals/models/index.js +0 -11
  160. package/node/internals/utils/releaseInfo.js +1 -1
  161. package/node/internals/utils/valueManagers.js +10 -5
  162. package/node/models/index.js +11 -0
  163. package/package.json +5 -5
  164. package/themeAugmentation/props.d.ts +15 -14
  165. package/internals/models/fields.d.ts +0 -49
  166. package/legacy/AdapterDateFns/index.js +0 -1
  167. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  168. package/legacy/AdapterDateFnsV3/index.js +0 -1
  169. package/legacy/AdapterDayjs/index.js +0 -1
  170. package/legacy/AdapterLuxon/index.js +0 -1
  171. package/legacy/AdapterMoment/index.js +0 -1
  172. package/legacy/AdapterMomentHijri/index.js +0 -1
  173. package/legacy/AdapterMomentJalaali/index.js +0 -1
  174. package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
  175. package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
  176. package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
  177. package/legacy/DateRangeCalendar/index.js +0 -2
  178. package/legacy/DateRangeCalendar/useDragRange.js +0 -258
  179. package/legacy/DateRangePicker/DateRangePicker.js +0 -334
  180. package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
  181. package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
  182. package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
  183. package/legacy/DateRangePicker/index.js +0 -3
  184. package/legacy/DateRangePicker/shared.js +0 -33
  185. package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
  186. package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
  187. package/legacy/DateRangePickerDay/index.js +0 -2
  188. package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
  189. package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
  190. package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
  191. package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
  192. package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
  193. package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
  194. package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
  195. package/legacy/DateTimeRangePicker/index.js +0 -5
  196. package/legacy/DateTimeRangePicker/shared.js +0 -54
  197. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
  198. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
  199. package/legacy/DesktopDateRangePicker/index.js +0 -1
  200. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
  201. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
  202. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
  203. package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
  204. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
  205. package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
  206. package/legacy/MobileDateRangePicker/index.js +0 -1
  207. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
  208. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
  209. package/legacy/MobileDateTimeRangePicker/index.js +0 -1
  210. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
  211. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  212. package/legacy/MultiInputDateRangeField/index.js +0 -2
  213. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
  214. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  215. package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
  216. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
  217. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  218. package/legacy/MultiInputTimeRangeField/index.js +0 -2
  219. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
  220. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
  221. package/legacy/SingleInputDateRangeField/index.js +0 -2
  222. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
  223. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
  224. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
  225. package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
  226. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
  227. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
  228. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
  229. package/legacy/SingleInputTimeRangeField/index.js +0 -2
  230. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
  231. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
  232. package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
  233. package/legacy/StaticDateRangePicker/index.js +0 -1
  234. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
  235. package/legacy/dateRangeViewRenderers/index.js +0 -1
  236. package/legacy/index.js +0 -52
  237. package/legacy/internals/constants/dimensions.js +0 -5
  238. package/legacy/internals/hooks/models/index.js +0 -1
  239. package/legacy/internals/hooks/models/useRangePicker.js +0 -1
  240. package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
  241. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
  242. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
  243. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
  244. package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
  245. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
  246. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
  247. package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  248. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
  249. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
  250. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  251. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
  252. package/legacy/internals/hooks/useRangePosition.js +0 -39
  253. package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
  254. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
  255. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
  256. package/legacy/internals/models/dateRange.js +0 -1
  257. package/legacy/internals/models/dateTimeRange.js +0 -1
  258. package/legacy/internals/models/index.js +0 -5
  259. package/legacy/internals/models/rangePickerProps.js +0 -1
  260. package/legacy/internals/models/timeRange.js +0 -1
  261. package/legacy/internals/utils/date-fields-utils.js +0 -26
  262. package/legacy/internals/utils/date-range-manager.js +0 -65
  263. package/legacy/internals/utils/date-utils.js +0 -12
  264. package/legacy/internals/utils/releaseInfo.js +0 -13
  265. package/legacy/internals/utils/validation/validateDateRange.js +0 -45
  266. package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
  267. package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
  268. package/legacy/internals/utils/valueManagers.js +0 -135
  269. package/legacy/locales/index.js +0 -1
  270. package/legacy/models/index.js +0 -3
  271. package/legacy/models/multiInputRangeFieldClasses.js +0 -1
  272. package/legacy/models/range.js +0 -1
  273. package/legacy/models/validation.js +0 -1
  274. package/legacy/themeAugmentation/index.js +0 -4
  275. package/modern/internals/models/fields.js +0 -1
  276. /package/{internals/models → models}/fields.js +0 -0
  277. /package/{legacy/internals → modern}/models/fields.js +0 -0
  278. /package/node/{internals/models → models}/fields.js +0 -0
@@ -1,27 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import useEventCallback from '@mui/utils/useEventCallback';
3
3
  import { unstable_useDateTimeField as useDateTimeField } from '@mui/x-date-pickers/DateTimeField';
4
- import { applyDefaultDate, useDefaultDates, useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
4
+ import { useLocalizationContext, useValidation, useControlledValueWithTimezone, useDefaultizedDateTimeField } from '@mui/x-date-pickers/internals';
5
5
  import { validateDateTimeRange } from '../../utils/validation/validateDateTimeRange';
6
6
  import { rangeValueManager } from '../../utils/valueManagers';
7
7
  import { excludeProps } from './shared';
8
- export const useDefaultizedDateTimeRangeFieldProps = props => {
9
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
10
- const utils = useUtils();
11
- const defaultDates = useDefaultDates();
12
- const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
13
- const defaultFormat = ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h;
14
- return _extends({}, props, {
15
- disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
16
- disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
17
- format: (_props$format = props.format) != null ? _props$format : defaultFormat,
18
- minDate: applyDefaultDate(utils, (_props$minDateTime = props.minDateTime) != null ? _props$minDateTime : props.minDate, defaultDates.minDate),
19
- maxDate: applyDefaultDate(utils, (_props$maxDateTime = props.maxDateTime) != null ? _props$maxDateTime : props.maxDate, defaultDates.maxDate),
20
- minTime: (_props$minDateTime2 = props.minDateTime) != null ? _props$minDateTime2 : props.minTime,
21
- maxTime: (_props$maxDateTime2 = props.maxDateTime) != null ? _props$maxDateTime2 : props.maxTime,
22
- disableIgnoringDatePartForTimeValidation: Boolean(props.minDateTime || props.maxDateTime)
23
- });
24
- };
8
+ import { useMultiInputFieldSelectedSections } from '../useMultiInputFieldSelectedSections';
25
9
  export const useMultiInputDateTimeRangeField = ({
26
10
  sharedProps: inSharedProps,
27
11
  startTextFieldProps,
@@ -29,19 +13,22 @@ export const useMultiInputDateTimeRangeField = ({
29
13
  endTextFieldProps,
30
14
  unstableEndFieldRef
31
15
  }) => {
32
- const sharedProps = useDefaultizedDateTimeRangeFieldProps(inSharedProps);
16
+ const sharedProps = useDefaultizedDateTimeField(inSharedProps);
33
17
  const adapter = useLocalizationContext();
34
18
  const {
35
19
  value: valueProp,
36
20
  defaultValue,
37
21
  format,
22
+ formatDensity,
38
23
  shouldRespectLeadingZeros,
39
- timezone: timezoneProp,
40
24
  onChange,
41
25
  disabled,
42
26
  readOnly,
43
27
  selectedSections,
44
- onSelectedSectionsChange
28
+ onSelectedSectionsChange,
29
+ timezone: timezoneProp,
30
+ enableAccessibleFieldDOMStructure,
31
+ autoFocus
45
32
  } = sharedProps;
46
33
  const {
47
34
  value,
@@ -78,35 +65,40 @@ export const useMultiInputDateTimeRangeField = ({
78
65
  value,
79
66
  timezone
80
67
  }), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
68
+ const selectedSectionsResponse = useMultiInputFieldSelectedSections({
69
+ selectedSections,
70
+ onSelectedSectionsChange,
71
+ unstableStartFieldRef,
72
+ unstableEndFieldRef
73
+ });
81
74
  const startFieldProps = _extends({
82
75
  error: !!validationError[0]
83
- }, startTextFieldProps, {
84
- format,
85
- shouldRespectLeadingZeros,
76
+ }, startTextFieldProps, selectedSectionsResponse.start, {
86
77
  disabled,
87
78
  readOnly,
79
+ format,
80
+ formatDensity,
81
+ shouldRespectLeadingZeros,
88
82
  timezone,
89
- unstableFieldRef: unstableStartFieldRef,
90
83
  value: valueProp === undefined ? undefined : valueProp[0],
91
84
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
92
85
  onChange: handleStartDateChange,
93
- selectedSections,
94
- onSelectedSectionsChange
86
+ enableAccessibleFieldDOMStructure,
87
+ autoFocus // Do not add on end field.
95
88
  });
96
89
  const endFieldProps = _extends({
97
90
  error: !!validationError[1]
98
- }, endTextFieldProps, {
91
+ }, endTextFieldProps, selectedSectionsResponse.end, {
99
92
  format,
93
+ formatDensity,
100
94
  shouldRespectLeadingZeros,
101
95
  disabled,
102
96
  readOnly,
103
97
  timezone,
104
- unstableFieldRef: unstableEndFieldRef,
105
98
  value: valueProp === undefined ? undefined : valueProp[1],
106
99
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
107
100
  onChange: handleEndDateChange,
108
- selectedSections,
109
- onSelectedSectionsChange
101
+ enableAccessibleFieldDOMStructure
110
102
  });
111
103
  const startDateResponse = useDateTimeField(startFieldProps);
112
104
  const endDateResponse = useDateTimeField(endFieldProps);
@@ -1,11 +1,11 @@
1
1
  import { UseFieldResponse } from '@mui/x-date-pickers/internals';
2
- import { MultiInputFieldRefs } from '../../models/fields';
2
+ import { MultiInputFieldRefs } from '../../../models';
3
3
  export interface UseMultiInputRangeFieldParams<TSharedProps extends {}, TTextFieldSlotProps extends {}> extends MultiInputFieldRefs {
4
4
  sharedProps: TSharedProps;
5
5
  startTextFieldProps: TTextFieldSlotProps;
6
6
  endTextFieldProps: TTextFieldSlotProps;
7
7
  }
8
- export interface UseMultiInputRangeFieldResponse<TForwardedProps extends {}> {
9
- startDate: UseFieldResponse<TForwardedProps>;
10
- endDate: UseFieldResponse<TForwardedProps>;
8
+ export interface UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends {}> {
9
+ startDate: UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
10
+ endDate: UseFieldResponse<TEnableAccessibleFieldDOMStructure, TForwardedProps>;
11
11
  }
@@ -1,5 +1,4 @@
1
1
  import { PickerValidDate } from '@mui/x-date-pickers/models';
2
- import type { UseMultiInputTimeRangeFieldDefaultizedProps, UseMultiInputTimeRangeFieldParams, UseMultiInputTimeRangeFieldProps } from '../../../MultiInputTimeRangeField/MultiInputTimeRangeField.types';
2
+ import type { UseMultiInputTimeRangeFieldParams } from '../../../MultiInputTimeRangeField/MultiInputTimeRangeField.types';
3
3
  import type { UseMultiInputRangeFieldResponse } from './useMultiInputRangeField.types';
4
- export declare const useDefaultizedTimeRangeFieldProps: <TDate extends PickerValidDate, AdditionalProps extends {}>(props: UseMultiInputTimeRangeFieldProps<TDate>) => UseMultiInputTimeRangeFieldDefaultizedProps<TDate, AdditionalProps>;
5
- export declare const useMultiInputTimeRangeField: <TDate extends PickerValidDate, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TDate, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TTextFieldSlotProps>;
4
+ export declare const useMultiInputTimeRangeField: <TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean, TTextFieldSlotProps extends {}>({ sharedProps: inSharedProps, startTextFieldProps, unstableStartFieldRef, endTextFieldProps, unstableEndFieldRef, }: UseMultiInputTimeRangeFieldParams<TDate, TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>) => UseMultiInputRangeFieldResponse<TEnableAccessibleFieldDOMStructure, TTextFieldSlotProps>;
@@ -1,21 +1,11 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import useEventCallback from '@mui/utils/useEventCallback';
3
3
  import { unstable_useTimeField as useTimeField } from '@mui/x-date-pickers/TimeField';
4
- import { useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
4
+ import { useLocalizationContext, useValidation, useControlledValueWithTimezone, useDefaultizedTimeField } from '@mui/x-date-pickers/internals';
5
5
  import { validateTimeRange } from '../../utils/validation/validateTimeRange';
6
6
  import { rangeValueManager } from '../../utils/valueManagers';
7
7
  import { excludeProps } from './shared';
8
- export const useDefaultizedTimeRangeFieldProps = props => {
9
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
10
- const utils = useUtils();
11
- const ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
12
- const defaultFormat = ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h;
13
- return _extends({}, props, {
14
- disablePast: (_props$disablePast = props.disablePast) != null ? _props$disablePast : false,
15
- disableFuture: (_props$disableFuture = props.disableFuture) != null ? _props$disableFuture : false,
16
- format: (_props$format = props.format) != null ? _props$format : defaultFormat
17
- });
18
- };
8
+ import { useMultiInputFieldSelectedSections } from '../useMultiInputFieldSelectedSections';
19
9
  export const useMultiInputTimeRangeField = ({
20
10
  sharedProps: inSharedProps,
21
11
  startTextFieldProps,
@@ -23,19 +13,22 @@ export const useMultiInputTimeRangeField = ({
23
13
  endTextFieldProps,
24
14
  unstableEndFieldRef
25
15
  }) => {
26
- const sharedProps = useDefaultizedTimeRangeFieldProps(inSharedProps);
16
+ const sharedProps = useDefaultizedTimeField(inSharedProps);
27
17
  const adapter = useLocalizationContext();
28
18
  const {
29
19
  value: valueProp,
30
20
  defaultValue,
31
21
  format,
22
+ formatDensity,
32
23
  shouldRespectLeadingZeros,
33
- timezone: timezoneProp,
34
24
  onChange,
35
25
  disabled,
36
26
  readOnly,
37
27
  selectedSections,
38
- onSelectedSectionsChange
28
+ onSelectedSectionsChange,
29
+ timezone: timezoneProp,
30
+ enableAccessibleFieldDOMStructure,
31
+ autoFocus
39
32
  } = sharedProps;
40
33
  const {
41
34
  value,
@@ -72,35 +65,40 @@ export const useMultiInputTimeRangeField = ({
72
65
  value,
73
66
  timezone
74
67
  }), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
68
+ const selectedSectionsResponse = useMultiInputFieldSelectedSections({
69
+ selectedSections,
70
+ onSelectedSectionsChange,
71
+ unstableStartFieldRef,
72
+ unstableEndFieldRef
73
+ });
75
74
  const startFieldProps = _extends({
76
75
  error: !!validationError[0]
77
- }, startTextFieldProps, {
78
- format,
79
- shouldRespectLeadingZeros,
76
+ }, startTextFieldProps, selectedSectionsResponse.start, {
80
77
  disabled,
81
78
  readOnly,
79
+ format,
80
+ formatDensity,
81
+ shouldRespectLeadingZeros,
82
82
  timezone,
83
- unstableFieldRef: unstableStartFieldRef,
84
83
  value: valueProp === undefined ? undefined : valueProp[0],
85
84
  defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
86
85
  onChange: handleStartDateChange,
87
- selectedSections,
88
- onSelectedSectionsChange
86
+ enableAccessibleFieldDOMStructure,
87
+ autoFocus // Do not add on end field.
89
88
  });
90
89
  const endFieldProps = _extends({
91
90
  error: !!validationError[1]
92
- }, endTextFieldProps, {
91
+ }, endTextFieldProps, selectedSectionsResponse.end, {
93
92
  format,
93
+ formatDensity,
94
94
  shouldRespectLeadingZeros,
95
95
  disabled,
96
96
  readOnly,
97
97
  timezone,
98
- unstableFieldRef: unstableEndFieldRef,
99
98
  value: valueProp === undefined ? undefined : valueProp[1],
100
99
  defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
101
100
  onChange: handleEndDateChange,
102
- selectedSections,
103
- onSelectedSectionsChange
101
+ enableAccessibleFieldDOMStructure
104
102
  });
105
103
  const startDateResponse = useTimeField(startFieldProps);
106
104
  const endDateResponse = useTimeField(endFieldProps);
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { FieldRef } from '@mui/x-date-pickers/models';
3
- import { RangePosition } from '../../models';
4
- import { RangeFieldSection } from '../models/fields';
3
+ import { RangePosition, RangeFieldSection } from '../../models';
5
4
  export interface UseRangePositionProps {
6
5
  /**
7
6
  * The position in the currently edited date range.
@@ -23,6 +22,5 @@ export interface UseRangePositionProps {
23
22
  export interface UseRangePositionResponse {
24
23
  rangePosition: RangePosition;
25
24
  onRangePositionChange: (newPosition: RangePosition) => void;
26
- singleInputFieldRef: React.MutableRefObject<FieldRef<RangeFieldSection> | undefined>;
27
25
  }
28
- export declare const useRangePosition: (props: UseRangePositionProps) => UseRangePositionResponse;
26
+ export declare const useRangePosition: (props: UseRangePositionProps, singleInputFieldRef?: React.RefObject<FieldRef<RangeFieldSection>>) => UseRangePositionResponse;
@@ -1,9 +1,7 @@
1
- import * as React from 'react';
2
1
  import useControlled from '@mui/utils/useControlled';
3
2
  import useEventCallback from '@mui/utils/useEventCallback';
4
- export const useRangePosition = props => {
3
+ export const useRangePosition = (props, singleInputFieldRef) => {
5
4
  var _props$defaultRangePo;
6
- const singleInputFieldRef = React.useRef();
7
5
  const [rangePosition, setRangePosition] = useControlled({
8
6
  name: 'useRangePosition',
9
7
  state: 'rangePosition',
@@ -14,7 +12,7 @@ export const useRangePosition = props => {
14
12
  // When using a single input field,
15
13
  // we want to select the 1st section of the edited date when updating the range position.
16
14
  const syncRangePositionWithSingleInputField = newRangePosition => {
17
- if (singleInputFieldRef.current == null) {
15
+ if ((singleInputFieldRef == null ? void 0 : singleInputFieldRef.current) == null) {
18
16
  return;
19
17
  }
20
18
  const sections = singleInputFieldRef.current.getSections();
@@ -29,7 +27,6 @@ export const useRangePosition = props => {
29
27
  });
30
28
  return {
31
29
  rangePosition,
32
- onRangePositionChange: handleRangePositionChange,
33
- singleInputFieldRef
30
+ onRangePositionChange: handleRangePositionChange
34
31
  };
35
32
  };
@@ -47,6 +47,7 @@ export const useStaticRangePicker = _ref => {
47
47
  } = usePicker(_extends({}, pickerParams, {
48
48
  props,
49
49
  autoFocusView: autoFocus != null ? autoFocus : false,
50
+ fieldRef: undefined,
50
51
  additionalViewProps: {
51
52
  rangePosition,
52
53
  onRangePositionChange
@@ -2,9 +2,8 @@ import * as React from 'react';
2
2
  import { BasePickerProps, UsePickerParams, ExportedBaseToolbarProps, StaticOnlyPickerProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
3
3
  import { PickerValidDate } from '@mui/x-date-pickers/models';
4
4
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '@mui/x-date-pickers/PickersLayout';
5
- import { DateRange } from '../../../models';
5
+ import { RangeFieldSection, DateRange } from '../../../models';
6
6
  import { UseRangePositionProps } from '../useRangePosition';
7
- import { RangeFieldSection } from '../../models/fields';
8
7
  export interface UseStaticRangePickerSlots<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<DateRange<TDate>, TDate, TView> {
9
8
  }
10
9
  export interface UseStaticRangePickerSlotProps<TDate extends PickerValidDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<DateRange<TDate>, TDate, TView> {
@@ -1,7 +1,6 @@
1
- import { BaseDateValidationProps, DefaultizedProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
1
+ import { BaseDateValidationProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import type { DateRangeValidationError, DateRange } from '../../models';
4
- import { RangeFieldSection } from './fields';
3
+ import type { DateRangeValidationError, RangeFieldSection, DateRange } from '../../models';
5
4
  /**
6
5
  * Props used to validate a day value in range pickers.
7
6
  */
@@ -18,16 +17,5 @@ export interface DayRangeValidationProps<TDate extends PickerValidDate> {
18
17
  */
19
18
  shouldDisableDate?: (day: TDate, position: 'start' | 'end') => boolean;
20
19
  }
21
- /**
22
- * Props used in every range picker.
23
- */
24
- export interface BaseRangeProps {
25
- /**
26
- * If `true`, the component is disabled.
27
- * @default false
28
- */
29
- disabled?: boolean;
30
- }
31
- export interface UseDateRangeFieldProps<TDate extends PickerValidDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, DateRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate>, BaseRangeProps {
20
+ export interface UseDateRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateRangeValidationError>, 'unstableFieldRef'>, 'format'>, DayRangeValidationProps<TDate>, BaseDateValidationProps<TDate> {
32
21
  }
33
- export type UseDateRangeFieldDefaultizedProps<TDate extends PickerValidDate> = DefaultizedProps<UseDateRangeFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format'>;
@@ -1,15 +1,13 @@
1
- import { BaseDateValidationProps, TimeValidationProps, DefaultizedProps, MakeOptional, UseFieldInternalProps, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
1
+ import { BaseDateValidationProps, TimeValidationProps, MakeOptional, UseFieldInternalProps, DateTimeValidationProps, DateOrTimeViewWithMeridiem } from '@mui/x-date-pickers/internals';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import { BaseRangeProps, DayRangeValidationProps } from './dateRange';
4
- import { DateTimeRangeValidationError, DateRange } from '../../models';
5
- import { RangeFieldSection } from './fields';
6
- export interface UseDateTimeRangeFieldProps<TDate extends PickerValidDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, DateTimeRangeValidationError>, 'format'>, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate>, BaseRangeProps {
3
+ import { DayRangeValidationProps } from './dateRange';
4
+ import { DateTimeRangeValidationError, RangeFieldSection, DateRange } from '../../models';
5
+ export interface UseDateTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, DateTimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, DayRangeValidationProps<TDate>, TimeValidationProps<TDate>, BaseDateValidationProps<TDate>, DateTimeValidationProps<TDate> {
7
6
  /**
8
7
  * 12h/24h view for hour selection clock.
9
8
  * @default `utils.is12HourCycleInCurrentLocale()`
10
9
  */
11
10
  ampm?: boolean;
12
11
  }
13
- export type UseDateTimeRangeFieldDefaultizedProps<TDate extends PickerValidDate> = DefaultizedProps<UseDateTimeRangeFieldProps<TDate>, keyof BaseDateValidationProps<TDate> | 'format' | 'disableIgnoringDatePartForTimeValidation'>;
14
12
  export type DateTimeRangePickerView = Exclude<DateOrTimeViewWithMeridiem, 'month' | 'year'>;
15
13
  export type DateTimeRangePickerViewExternal = Exclude<DateTimeRangePickerView, 'meridiem'>;
@@ -1,5 +1,4 @@
1
1
  export * from './dateRange';
2
2
  export * from './dateTimeRange';
3
3
  export * from './timeRange';
4
- export * from './fields';
5
4
  export * from './rangePickerProps';
@@ -1,5 +1,4 @@
1
1
  export * from './dateRange';
2
2
  export * from './dateTimeRange';
3
3
  export * from './timeRange';
4
- export * from './fields';
5
4
  export * from './rangePickerProps';
@@ -1,13 +1,10 @@
1
- import { BaseTimeValidationProps, TimeValidationProps, DefaultizedProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
1
+ import { BaseTimeValidationProps, TimeValidationProps, MakeOptional, UseFieldInternalProps } from '@mui/x-date-pickers/internals';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import { TimeRangeValidationError, DateRange } from '../../models';
4
- import { BaseRangeProps } from './dateRange';
5
- import { RangeFieldSection } from './fields';
6
- export interface UseTimeRangeFieldProps<TDate extends PickerValidDate> extends MakeOptional<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TimeRangeValidationError>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps, BaseRangeProps {
3
+ import { TimeRangeValidationError, RangeFieldSection, DateRange } from '../../models';
4
+ export interface UseTimeRangeFieldProps<TDate extends PickerValidDate, TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<Omit<UseFieldInternalProps<DateRange<TDate>, TDate, RangeFieldSection, TEnableAccessibleFieldDOMStructure, TimeRangeValidationError>, 'unstableFieldRef'>, 'format'>, TimeValidationProps<TDate>, BaseTimeValidationProps {
7
5
  /**
8
6
  * 12h/24h view for hour selection clock.
9
7
  * @default `utils.is12HourCycleInCurrentLocale()`
10
8
  */
11
9
  ampm?: boolean;
12
10
  }
13
- export type UseTimeRangeFieldDefaultizedProps<TDate extends PickerValidDate> = DefaultizedProps<UseTimeRangeFieldProps<TDate>, keyof BaseTimeValidationProps | 'format'>;
@@ -1,4 +1,4 @@
1
- import { RangeFieldSection } from '../models/fields';
1
+ import { RangeFieldSection } from '../../models';
2
2
  export declare const splitDateRangeSections: (sections: RangeFieldSection[]) => {
3
3
  startDate: RangeFieldSection[];
4
4
  endDate: RangeFieldSection[];
@@ -15,10 +15,6 @@ export declare const removeLastSeparator: (dateSections: RangeFieldSection[]) =>
15
15
  hasLeadingZerosInFormat: boolean;
16
16
  hasLeadingZerosInInput: boolean;
17
17
  modified: boolean;
18
- start: number;
19
- end: number;
20
- startInInput: number;
21
- endInInput: number;
22
18
  startSeparator: string;
23
19
  endSeparator: string;
24
20
  })[];
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTcwNzQyOTYwMDAwMA==";
3
+ const releaseInfo = "MTcwOTM1NTYwMDAwMA==";
4
4
  if (process.env.NODE_ENV !== 'production') {
5
5
  // A simple hack to set the value in the test environment (has no build step).
6
6
  // eslint-disable-next-line no-useless-concat
@@ -1,7 +1,6 @@
1
1
  import { PickerValueManager, FieldValueManager } from '@mui/x-date-pickers/internals';
2
2
  import { PickerValidDate } from '@mui/x-date-pickers/models';
3
- import type { DateRangeValidationError, DateTimeRangeValidationError, TimeRangeValidationError, DateRange } from '../../models';
4
- import { RangeFieldSection } from '../models/fields';
3
+ import type { DateRangeValidationError, DateTimeRangeValidationError, TimeRangeValidationError, RangeFieldSection, DateRange } from '../../models';
5
4
  export type RangePickerValueManager<TValue = [any, any], TDate extends PickerValidDate = any, TError extends DateRangeValidationError | TimeRangeValidationError | DateTimeRangeValidationError = any> = PickerValueManager<TValue, TDate, TError>;
6
5
  export declare const rangeValueManager: RangePickerValueManager;
7
6
  export declare const rangeFieldValueManager: FieldValueManager<DateRange<any>, any, RangeFieldSection>;
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["value", "referenceDate"];
4
- import { replaceInvalidDateByNull, addPositionPropertiesToSections, createDateStrForInputFromSections, areDatesEqual, getTodayDate, getDefaultReferenceDate } from '@mui/x-date-pickers/internals';
4
+ import { replaceInvalidDateByNull, createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections, areDatesEqual, getTodayDate, getDefaultReferenceDate } from '@mui/x-date-pickers/internals';
5
5
  import { splitDateRangeSections, removeLastSeparator } from './date-fields-utils';
6
6
  export const rangeValueManager = {
7
7
  emptyValue: [null, null],
@@ -50,7 +50,7 @@ export const rangeFieldValueManager = {
50
50
  }
51
51
  return [prevReferenceValue[1], value[1]];
52
52
  },
53
- getSectionsFromValue: (utils, [start, end], fallbackSections, localizedDigits, isRTL, getSectionsFromDate) => {
53
+ getSectionsFromValue: (utils, [start, end], fallbackSections, getSectionsFromDate) => {
54
54
  const separatedFallbackSections = fallbackSections == null ? {
55
55
  startDate: null,
56
56
  endDate: null
@@ -65,7 +65,8 @@ export const rangeFieldValueManager = {
65
65
  if (sectionIndex === sections.length - 1 && position === 'start') {
66
66
  return _extends({}, section, {
67
67
  dateName: position,
68
- endSeparator: `${section.endSeparator}${isRTL ? '\u2069 \u2066' : ' – '}`
68
+ // TODO: Check if RTL still works
69
+ endSeparator: `${section.endSeparator} – `
69
70
  });
70
71
  }
71
72
  return _extends({}, section, {
@@ -73,11 +74,15 @@ export const rangeFieldValueManager = {
73
74
  });
74
75
  });
75
76
  };
76
- return addPositionPropertiesToSections([...getSections(start, separatedFallbackSections.startDate, 'start'), ...getSections(end, separatedFallbackSections.endDate, 'end')], localizedDigits, isRTL);
77
+ return [...getSections(start, separatedFallbackSections.startDate, 'start'), ...getSections(end, separatedFallbackSections.endDate, 'end')];
77
78
  },
78
- getValueStrFromSections: (sections, localizedDigits, isRTL) => {
79
+ getV7HiddenInputValueFromSections: sections => {
79
80
  const dateRangeSections = splitDateRangeSections(sections);
80
- return createDateStrForInputFromSections([...dateRangeSections.startDate, ...dateRangeSections.endDate], localizedDigits, isRTL);
81
+ return createDateStrForV7HiddenInputFromSections([...dateRangeSections.startDate, ...dateRangeSections.endDate]);
82
+ },
83
+ getV6InputValueFromSections: (sections, localizedDigits, isRTL) => {
84
+ const dateRangeSections = splitDateRangeSections(sections);
85
+ return createDateStrForV6InputFromSections([...dateRangeSections.startDate, ...dateRangeSections.endDate], localizedDigits, isRTL);
81
86
  },
82
87
  parseValueStr: (valueStr, referenceValue, parseDate) => {
83
88
  // TODO: Improve because it would not work if the date format has `–` as a separator.
@@ -0,0 +1,69 @@
1
+ import * as React from 'react';
2
+ import { SlotComponentProps } from '@mui/base/utils';
3
+ import { BaseFieldProps, UseFieldResponse } from '@mui/x-date-pickers/internals';
4
+ import { BaseSingleInputPickersTextFieldProps, FieldRef, FieldSection, PickerValidDate } from '@mui/x-date-pickers/models';
5
+ import { UseClearableFieldResponse } from '@mui/x-date-pickers/hooks';
6
+ import { SxProps } from '@mui/material/styles';
7
+ export interface RangeFieldSection extends FieldSection {
8
+ dateName: 'start' | 'end';
9
+ }
10
+ export type FieldType = 'single-input' | 'multi-input';
11
+ /**
12
+ * Props the `textField` slot of the multi input field can receive when used inside a picker.
13
+ */
14
+ export interface MultiInputFieldSlotTextFieldProps {
15
+ label?: React.ReactNode;
16
+ id?: string;
17
+ disabled?: boolean;
18
+ readOnly?: boolean;
19
+ onKeyDown?: React.KeyboardEventHandler;
20
+ onClick?: React.MouseEventHandler;
21
+ onFocus?: React.FocusEventHandler;
22
+ focused?: boolean;
23
+ InputProps?: {
24
+ ref?: React.Ref<any>;
25
+ endAdornment?: React.ReactNode;
26
+ startAdornment?: React.ReactNode;
27
+ };
28
+ }
29
+ /**
30
+ * Props the `root` slot of the multi input field can receive when used inside a picker.
31
+ */
32
+ export interface MultiInputFieldSlotRootProps {
33
+ onBlur?: React.FocusEventHandler;
34
+ }
35
+ export interface MultiInputFieldRefs {
36
+ unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
37
+ unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
38
+ }
39
+ /**
40
+ * Props the multi input field can receive when used inside a picker.
41
+ * Only contains what the MUI components are passing to the field,
42
+ * not what users can pass using the `props.slotProps.field`.
43
+ */
44
+ export interface BaseMultiInputFieldProps<TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TError> extends Omit<BaseFieldProps<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TError>, 'unstableFieldRef'> {
45
+ sx?: SxProps<any>;
46
+ unstableStartFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
47
+ unstableEndFieldRef?: React.Ref<FieldRef<RangeFieldSection>>;
48
+ slots?: {
49
+ root?: React.ElementType;
50
+ separator?: React.ElementType;
51
+ textField?: React.ElementType;
52
+ };
53
+ slotProps?: {
54
+ root?: SlotComponentProps<React.ElementType<MultiInputFieldSlotRootProps>, {}, Record<string, any>>;
55
+ textField?: SlotComponentProps<React.ElementType<MultiInputFieldSlotTextFieldProps>, {}, {
56
+ position?: 'start' | 'end';
57
+ } & Record<string, any>>;
58
+ };
59
+ }
60
+ /**
61
+ * Props the text field receives when used with a multi input picker.
62
+ * Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.textField`.
63
+ */
64
+ export type BaseMultiInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseClearableFieldResponse<UseFieldResponse<TEnableAccessibleFieldDOMStructure, MultiInputFieldSlotTextFieldProps>>;
65
+ /**
66
+ * Props the text field receives when used with a single or multi input picker.
67
+ * Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` or `props.slotProps.textField`.
68
+ */
69
+ export type BasePickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure> & BaseMultiInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure>;
package/models/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './fields';
1
2
  export * from './range';
2
3
  export * from './validation';
3
4
  export * from './multiInputRangeFieldClasses';
package/models/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './fields';
1
2
  export * from './range';
2
3
  export * from './validation';
3
4
  export * from './multiInputRangeFieldClasses';
@@ -526,6 +526,9 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
526
526
  * @default 2
527
527
  */
528
528
  calendars: PropTypes.oneOf([1, 2, 3]),
529
+ /**
530
+ * Override or extend the styles applied to the component.
531
+ */
529
532
  classes: PropTypes.object,
530
533
  className: PropTypes.string,
531
534
  /**
@@ -588,7 +591,6 @@ process.env.NODE_ENV !== "production" ? DateRangeCalendar.propTypes = {
588
591
  /**
589
592
  * The day view will show as many weeks as needed after the end of the current month to match this value.
590
593
  * Put it to 6 to have a fixed number of weeks in Gregorian calendars
591
- * @default undefined
592
594
  */
593
595
  fixedWeekNumber: PropTypes.number,
594
596
  /**
@@ -133,10 +133,13 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
133
133
  * If `true`, the week number will be display in the calendar.
134
134
  */
135
135
  displayWeekNumber: PropTypes.bool,
136
+ /**
137
+ * @default false
138
+ */
139
+ enableAccessibleFieldDOMStructure: PropTypes.any,
136
140
  /**
137
141
  * The day view will show as many weeks as needed after the end of the current month to match this value.
138
142
  * Put it to 6 to have a fixed number of weeks in Gregorian calendars
139
- * @default undefined
140
143
  */
141
144
  fixedWeekNumber: PropTypes.number,
142
145
  /**
@@ -263,17 +266,14 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
263
266
  renderLoading: PropTypes.func,
264
267
  /**
265
268
  * The currently selected sections.
266
- * This prop accept four formats:
269
+ * This prop accepts four formats:
267
270
  * 1. If a number is provided, the section at this index will be selected.
268
- * 2. If an object with a `startIndex` and `endIndex` properties are provided, the sections between those two indexes will be selected.
269
- * 3. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
270
- * 4. If `null` is provided, no section will be selected
271
+ * 2. If a string of type `FieldSectionType` is provided, the first section with that name will be selected.
272
+ * 3. If `"all"` is provided, all the sections will be selected.
273
+ * 4. If `null` is provided, no section will be selected.
271
274
  * If not provided, the selected sections will be handled internally.
272
275
  */
273
- selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number, PropTypes.shape({
274
- endIndex: PropTypes.number.isRequired,
275
- startIndex: PropTypes.number.isRequired
276
- })]),
276
+ selectedSections: PropTypes.oneOfType([PropTypes.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), PropTypes.number]),
277
277
  /**
278
278
  * Disable specific date.
279
279
  *