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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (274) hide show
  1. package/CHANGELOG.md +298 -23
  2. package/DateRangeCalendar/DateRangeCalendar.js +3 -1
  3. package/DateRangeCalendar/DateRangeCalendar.types.d.ts +3 -0
  4. package/DateRangePicker/DateRangePicker.d.ts +1 -1
  5. package/DateRangePicker/DateRangePicker.js +9 -9
  6. package/DateRangePicker/DateRangePicker.types.d.ts +3 -3
  7. package/DateRangePicker/DateRangePickerToolbar.d.ts +3 -0
  8. package/DateRangePicker/DateRangePickerToolbar.js +6 -0
  9. package/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -1
  10. package/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  11. package/DateTimeRangePicker/DateTimeRangePicker.types.d.ts +3 -3
  12. package/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  13. package/DateTimeRangePicker/DateTimeRangePickerToolbar.d.ts +3 -0
  14. package/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
  15. package/DesktopDateRangePicker/DesktopDateRangePicker.d.ts +1 -1
  16. package/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  17. package/DesktopDateRangePicker/DesktopDateRangePicker.types.d.ts +3 -3
  18. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.d.ts +1 -1
  19. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  20. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.d.ts +3 -3
  21. package/MobileDateRangePicker/MobileDateRangePicker.d.ts +1 -1
  22. package/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  23. package/MobileDateRangePicker/MobileDateRangePicker.types.d.ts +3 -3
  24. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.d.ts +1 -1
  25. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
  26. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.d.ts +3 -3
  27. package/MultiInputDateRangeField/MultiInputDateRangeField.d.ts +1 -1
  28. package/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  29. package/MultiInputDateRangeField/MultiInputDateRangeField.types.d.ts +11 -14
  30. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.d.ts +1 -1
  31. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  32. package/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.d.ts +12 -16
  33. package/MultiInputTimeRangeField/MultiInputTimeRangeField.d.ts +1 -1
  34. package/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  35. package/MultiInputTimeRangeField/MultiInputTimeRangeField.types.d.ts +12 -16
  36. package/SingleInputDateRangeField/SingleInputDateRangeField.d.ts +2 -2
  37. package/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  38. package/SingleInputDateRangeField/SingleInputDateRangeField.types.d.ts +11 -14
  39. package/SingleInputDateRangeField/index.d.ts +1 -1
  40. package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +2 -3
  41. package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -15
  42. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.d.ts +2 -2
  43. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
  44. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.d.ts +12 -15
  45. package/SingleInputDateTimeRangeField/index.d.ts +1 -1
  46. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +2 -3
  47. package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -20
  48. package/SingleInputTimeRangeField/SingleInputTimeRangeField.d.ts +2 -2
  49. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  50. package/SingleInputTimeRangeField/SingleInputTimeRangeField.types.d.ts +12 -15
  51. package/SingleInputTimeRangeField/index.d.ts +1 -1
  52. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +2 -3
  53. package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -14
  54. package/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  55. package/index.d.ts +0 -1
  56. package/index.js +2 -1
  57. package/internals/hooks/models/useRangePicker.d.ts +5 -5
  58. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -1
  59. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  60. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +5 -5
  61. package/internals/hooks/useEnrichedRangePickerFieldProps.d.ts +15 -15
  62. package/internals/hooks/useEnrichedRangePickerFieldProps.js +37 -40
  63. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -1
  64. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
  65. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +5 -5
  66. package/internals/hooks/useMultiInputFieldSelectedSections.d.ts +21 -0
  67. package/internals/hooks/useMultiInputFieldSelectedSections.js +43 -0
  68. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.d.ts +1 -1
  69. package/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  70. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.d.ts +2 -3
  71. package/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  72. package/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.d.ts +4 -4
  73. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.d.ts +2 -3
  74. package/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  75. package/internals/hooks/useRangePosition.d.ts +2 -4
  76. package/internals/hooks/useRangePosition.js +3 -6
  77. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  78. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +1 -2
  79. package/internals/models/dateRange.d.ts +3 -15
  80. package/internals/models/dateTimeRange.d.ts +4 -6
  81. package/internals/models/index.d.ts +0 -1
  82. package/internals/models/index.js +0 -1
  83. package/internals/models/timeRange.d.ts +3 -6
  84. package/internals/utils/date-fields-utils.d.ts +1 -5
  85. package/internals/utils/releaseInfo.js +1 -1
  86. package/internals/utils/valueManagers.d.ts +1 -2
  87. package/internals/utils/valueManagers.js +11 -6
  88. package/models/fields.d.ts +69 -0
  89. package/models/index.d.ts +1 -0
  90. package/models/index.js +1 -0
  91. package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -1
  92. package/modern/DateRangePicker/DateRangePicker.js +9 -9
  93. package/modern/DateRangePicker/DateRangePickerToolbar.js +6 -0
  94. package/modern/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  95. package/modern/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  96. package/modern/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
  97. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  98. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  99. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  100. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +11 -12
  101. package/modern/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  102. package/modern/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  103. package/modern/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  104. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  105. package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -14
  106. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +12 -10
  107. package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -19
  108. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  109. package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -13
  110. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  111. package/modern/index.js +2 -1
  112. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  113. package/modern/internals/hooks/useEnrichedRangePickerFieldProps.js +34 -37
  114. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
  115. package/modern/internals/hooks/useMultiInputFieldSelectedSections.js +40 -0
  116. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +17 -12
  117. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -30
  118. package/modern/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -24
  119. package/modern/internals/hooks/useRangePosition.js +3 -6
  120. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  121. package/modern/internals/models/index.js +0 -1
  122. package/modern/internals/utils/releaseInfo.js +1 -1
  123. package/modern/internals/utils/valueManagers.js +11 -6
  124. package/modern/models/index.js +1 -0
  125. package/node/DateRangeCalendar/DateRangeCalendar.js +3 -1
  126. package/node/DateRangePicker/DateRangePicker.js +9 -9
  127. package/node/DateRangePicker/DateRangePickerToolbar.js +6 -0
  128. package/node/DateTimeRangePicker/DateTimeRangePicker.js +11 -12
  129. package/node/DateTimeRangePicker/DateTimeRangePickerTabs.js +7 -1
  130. package/node/DateTimeRangePicker/DateTimeRangePickerToolbar.js +6 -0
  131. package/node/DesktopDateRangePicker/DesktopDateRangePicker.js +9 -9
  132. package/node/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +11 -12
  133. package/node/MobileDateRangePicker/MobileDateRangePicker.js +9 -9
  134. package/node/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +13 -14
  135. package/node/MultiInputDateRangeField/MultiInputDateRangeField.js +17 -19
  136. package/node/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +17 -19
  137. package/node/MultiInputTimeRangeField/MultiInputTimeRangeField.js +17 -19
  138. package/node/SingleInputDateRangeField/SingleInputDateRangeField.js +12 -10
  139. package/node/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
  140. package/node/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +15 -13
  141. package/node/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -21
  142. package/node/SingleInputTimeRangeField/SingleInputTimeRangeField.js +11 -9
  143. package/node/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -15
  144. package/node/StaticDateRangePicker/StaticDateRangePicker.js +0 -1
  145. package/node/index.js +1 -1
  146. package/node/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +16 -7
  147. package/node/internals/hooks/useEnrichedRangePickerFieldProps.js +33 -36
  148. package/node/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +17 -8
  149. package/node/internals/hooks/useMultiInputFieldSelectedSections.js +50 -0
  150. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +16 -11
  151. package/node/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +23 -31
  152. package/node/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +23 -25
  153. package/node/internals/hooks/useRangePosition.js +3 -8
  154. package/node/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +1 -0
  155. package/node/internals/models/index.js +0 -11
  156. package/node/internals/utils/releaseInfo.js +1 -1
  157. package/node/internals/utils/valueManagers.js +10 -5
  158. package/node/models/index.js +11 -0
  159. package/package.json +5 -5
  160. package/themeAugmentation/props.d.ts +12 -12
  161. package/internals/models/fields.d.ts +0 -49
  162. package/legacy/AdapterDateFns/index.js +0 -1
  163. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  164. package/legacy/AdapterDateFnsV3/index.js +0 -1
  165. package/legacy/AdapterDayjs/index.js +0 -1
  166. package/legacy/AdapterLuxon/index.js +0 -1
  167. package/legacy/AdapterMoment/index.js +0 -1
  168. package/legacy/AdapterMomentHijri/index.js +0 -1
  169. package/legacy/AdapterMomentJalaali/index.js +0 -1
  170. package/legacy/DateRangeCalendar/DateRangeCalendar.js +0 -764
  171. package/legacy/DateRangeCalendar/DateRangeCalendar.types.js +0 -1
  172. package/legacy/DateRangeCalendar/dateRangeCalendarClasses.js +0 -5
  173. package/legacy/DateRangeCalendar/index.js +0 -2
  174. package/legacy/DateRangeCalendar/useDragRange.js +0 -258
  175. package/legacy/DateRangePicker/DateRangePicker.js +0 -334
  176. package/legacy/DateRangePicker/DateRangePicker.types.js +0 -1
  177. package/legacy/DateRangePicker/DateRangePickerToolbar.js +0 -127
  178. package/legacy/DateRangePicker/dateRangePickerToolbarClasses.js +0 -5
  179. package/legacy/DateRangePicker/index.js +0 -3
  180. package/legacy/DateRangePicker/shared.js +0 -33
  181. package/legacy/DateRangePickerDay/DateRangePickerDay.js +0 -366
  182. package/legacy/DateRangePickerDay/dateRangePickerDayClasses.js +0 -5
  183. package/legacy/DateRangePickerDay/index.js +0 -2
  184. package/legacy/DateTimeRangePicker/DateTimeRangePicker.js +0 -413
  185. package/legacy/DateTimeRangePicker/DateTimeRangePicker.types.js +0 -1
  186. package/legacy/DateTimeRangePicker/DateTimeRangePickerTabs.js +0 -191
  187. package/legacy/DateTimeRangePicker/DateTimeRangePickerTimeWrapper.js +0 -57
  188. package/legacy/DateTimeRangePicker/DateTimeRangePickerToolbar.js +0 -184
  189. package/legacy/DateTimeRangePicker/dateTimeRangePickerTabsClasses.js +0 -6
  190. package/legacy/DateTimeRangePicker/dateTimeRangePickerToolbarClasses.js +0 -5
  191. package/legacy/DateTimeRangePicker/index.js +0 -5
  192. package/legacy/DateTimeRangePicker/shared.js +0 -54
  193. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.js +0 -343
  194. package/legacy/DesktopDateRangePicker/DesktopDateRangePicker.types.js +0 -1
  195. package/legacy/DesktopDateRangePicker/index.js +0 -1
  196. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +0 -491
  197. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.types.js +0 -1
  198. package/legacy/DesktopDateTimeRangePicker/DesktopDateTimeRangePickerLayout.js +0 -48
  199. package/legacy/DesktopDateTimeRangePicker/index.js +0 -1
  200. package/legacy/MobileDateRangePicker/MobileDateRangePicker.js +0 -339
  201. package/legacy/MobileDateRangePicker/MobileDateRangePicker.types.js +0 -1
  202. package/legacy/MobileDateRangePicker/index.js +0 -1
  203. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +0 -484
  204. package/legacy/MobileDateTimeRangePicker/MobileDateTimeRangePicker.types.js +0 -1
  205. package/legacy/MobileDateTimeRangePicker/index.js +0 -1
  206. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.js +0 -316
  207. package/legacy/MultiInputDateRangeField/MultiInputDateRangeField.types.js +0 -1
  208. package/legacy/MultiInputDateRangeField/index.js +0 -2
  209. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.js +0 -357
  210. package/legacy/MultiInputDateTimeRangeField/MultiInputDateTimeRangeField.types.js +0 -1
  211. package/legacy/MultiInputDateTimeRangeField/index.js +0 -2
  212. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.js +0 -330
  213. package/legacy/MultiInputTimeRangeField/MultiInputTimeRangeField.types.js +0 -1
  214. package/legacy/MultiInputTimeRangeField/index.js +0 -2
  215. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.js +0 -307
  216. package/legacy/SingleInputDateRangeField/SingleInputDateRangeField.types.js +0 -1
  217. package/legacy/SingleInputDateRangeField/index.js +0 -2
  218. package/legacy/SingleInputDateRangeField/useSingleInputDateRangeField.js +0 -30
  219. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +0 -348
  220. package/legacy/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.types.js +0 -1
  221. package/legacy/SingleInputDateTimeRangeField/index.js +0 -2
  222. package/legacy/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +0 -35
  223. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.js +0 -321
  224. package/legacy/SingleInputTimeRangeField/SingleInputTimeRangeField.types.js +0 -1
  225. package/legacy/SingleInputTimeRangeField/index.js +0 -2
  226. package/legacy/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +0 -29
  227. package/legacy/StaticDateRangePicker/StaticDateRangePicker.js +0 -276
  228. package/legacy/StaticDateRangePicker/StaticDateRangePicker.types.js +0 -1
  229. package/legacy/StaticDateRangePicker/index.js +0 -1
  230. package/legacy/dateRangeViewRenderers/dateRangeViewRenderers.js +0 -87
  231. package/legacy/dateRangeViewRenderers/index.js +0 -1
  232. package/legacy/index.js +0 -52
  233. package/legacy/internals/constants/dimensions.js +0 -5
  234. package/legacy/internals/hooks/models/index.js +0 -1
  235. package/legacy/internals/hooks/models/useRangePicker.js +0 -1
  236. package/legacy/internals/hooks/useDesktopRangePicker/index.js +0 -1
  237. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +0 -154
  238. package/legacy/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.js +0 -1
  239. package/legacy/internals/hooks/useEnrichedRangePickerFieldProps.js +0 -258
  240. package/legacy/internals/hooks/useMobileRangePicker/index.js +0 -1
  241. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +0 -144
  242. package/legacy/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.js +0 -1
  243. package/legacy/internals/hooks/useMultiInputRangeField/shared.js +0 -9
  244. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateRangeField.js +0 -102
  245. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputDateTimeRangeField.js +0 -115
  246. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputRangeField.types.js +0 -1
  247. package/legacy/internals/hooks/useMultiInputRangeField/useMultiInputTimeRangeField.js +0 -109
  248. package/legacy/internals/hooks/useRangePosition.js +0 -39
  249. package/legacy/internals/hooks/useStaticRangePicker/index.js +0 -1
  250. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +0 -76
  251. package/legacy/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.js +0 -1
  252. package/legacy/internals/models/dateRange.js +0 -1
  253. package/legacy/internals/models/dateTimeRange.js +0 -1
  254. package/legacy/internals/models/index.js +0 -5
  255. package/legacy/internals/models/rangePickerProps.js +0 -1
  256. package/legacy/internals/models/timeRange.js +0 -1
  257. package/legacy/internals/utils/date-fields-utils.js +0 -26
  258. package/legacy/internals/utils/date-range-manager.js +0 -65
  259. package/legacy/internals/utils/date-utils.js +0 -12
  260. package/legacy/internals/utils/releaseInfo.js +0 -13
  261. package/legacy/internals/utils/validation/validateDateRange.js +0 -45
  262. package/legacy/internals/utils/validation/validateDateTimeRange.js +0 -45
  263. package/legacy/internals/utils/validation/validateTimeRange.js +0 -32
  264. package/legacy/internals/utils/valueManagers.js +0 -135
  265. package/legacy/locales/index.js +0 -1
  266. package/legacy/models/index.js +0 -3
  267. package/legacy/models/multiInputRangeFieldClasses.js +0 -1
  268. package/legacy/models/range.js +0 -1
  269. package/legacy/models/validation.js +0 -1
  270. package/legacy/themeAugmentation/index.js +0 -4
  271. package/modern/internals/models/fields.js +0 -1
  272. /package/{internals/models → models}/fields.js +0 -0
  273. /package/{legacy/internals → modern}/models/fields.js +0 -0
  274. /package/node/{internals/models → models}/fields.js +0 -0
@@ -1,144 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["props"];
4
- import * as React from 'react';
5
- import { useSlotProps } from '@mui/base/utils';
6
- import { useLicenseVerifier } from '@mui/x-license';
7
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
8
- import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
9
- import { usePicker, PickersModalDialog, useLocaleText } from '@mui/x-date-pickers/internals';
10
- import useId from '@mui/utils/useId';
11
- import { useEnrichedRangePickerFieldProps } from '../useEnrichedRangePickerFieldProps';
12
- import { getReleaseInfo } from '../../utils/releaseInfo';
13
- import { useRangePosition } from '../useRangePosition';
14
- import { jsx as _jsx } from "react/jsx-runtime";
15
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
- var releaseInfo = getReleaseInfo();
17
- export var useMobileRangePicker = function useMobileRangePicker(_ref) {
18
- var _fieldType, _innerSlotProps$toolb, _innerSlotProps$toolb2, _slots$layout;
19
- var props = _ref.props,
20
- pickerParams = _objectWithoutProperties(_ref, _excluded);
21
- useLicenseVerifier('x-date-pickers-pro', releaseInfo);
22
- var slots = props.slots,
23
- innerSlotProps = props.slotProps,
24
- className = props.className,
25
- sx = props.sx,
26
- format = props.format,
27
- formatDensity = props.formatDensity,
28
- timezone = props.timezone,
29
- label = props.label,
30
- inputRef = props.inputRef,
31
- name = props.name,
32
- readOnly = props.readOnly,
33
- disabled = props.disabled,
34
- disableOpenPicker = props.disableOpenPicker,
35
- localeText = props.localeText;
36
- var _useRangePosition = useRangePosition(props),
37
- rangePosition = _useRangePosition.rangePosition,
38
- onRangePositionChange = _useRangePosition.onRangePositionChange,
39
- singleInputFieldRef = _useRangePosition.singleInputFieldRef;
40
- var labelId = useId();
41
- var contextLocaleText = useLocaleText();
42
- var _usePicker = usePicker(_extends({}, pickerParams, {
43
- props: props,
44
- wrapperVariant: 'mobile',
45
- autoFocusView: true,
46
- additionalViewProps: {
47
- rangePosition: rangePosition,
48
- onRangePositionChange: onRangePositionChange
49
- }
50
- })),
51
- open = _usePicker.open,
52
- actions = _usePicker.actions,
53
- layoutProps = _usePicker.layoutProps,
54
- renderCurrentView = _usePicker.renderCurrentView,
55
- pickerFieldProps = _usePicker.fieldProps;
56
- var Field = slots.field;
57
- var fieldType = (_fieldType = Field.fieldType) != null ? _fieldType : 'multi-input';
58
- var fieldProps = useSlotProps({
59
- elementType: Field,
60
- externalSlotProps: innerSlotProps == null ? void 0 : innerSlotProps.field,
61
- additionalProps: _extends({}, pickerFieldProps, {
62
- readOnly: readOnly != null ? readOnly : true,
63
- disabled: disabled,
64
- className: className,
65
- sx: sx,
66
- format: format,
67
- formatDensity: formatDensity,
68
- timezone: timezone
69
- }, fieldType === 'single-input' && {
70
- inputRef: inputRef,
71
- name: name
72
- }),
73
- ownerState: props
74
- });
75
- var isToolbarHidden = (_innerSlotProps$toolb = innerSlotProps == null || (_innerSlotProps$toolb2 = innerSlotProps.toolbar) == null ? void 0 : _innerSlotProps$toolb2.hidden) != null ? _innerSlotProps$toolb : false;
76
- var enrichedFieldProps = useEnrichedRangePickerFieldProps({
77
- wrapperVariant: 'mobile',
78
- fieldType: fieldType,
79
- open: open,
80
- actions: actions,
81
- readOnly: readOnly,
82
- labelId: labelId,
83
- disableOpenPicker: disableOpenPicker,
84
- label: label,
85
- localeText: localeText,
86
- rangePosition: rangePosition,
87
- onRangePositionChange: onRangePositionChange,
88
- singleInputFieldRef: singleInputFieldRef,
89
- pickerSlots: slots,
90
- pickerSlotProps: innerSlotProps,
91
- fieldProps: fieldProps
92
- });
93
- var slotPropsForLayout = _extends({}, innerSlotProps, {
94
- tabs: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.tabs, {
95
- rangePosition: rangePosition,
96
- onRangePositionChange: onRangePositionChange
97
- }),
98
- toolbar: _extends({}, innerSlotProps == null ? void 0 : innerSlotProps.toolbar, {
99
- titleId: labelId,
100
- rangePosition: rangePosition,
101
- onRangePositionChange: onRangePositionChange
102
- })
103
- });
104
- var Layout = (_slots$layout = slots == null ? void 0 : slots.layout) != null ? _slots$layout : PickersLayout;
105
- var finalLocaleText = _extends({}, contextLocaleText, localeText);
106
- var labelledById = labelId;
107
- if (isToolbarHidden) {
108
- var labels = [];
109
- if (fieldType === 'multi-input') {
110
- if (finalLocaleText.start) {
111
- labels.push("".concat(labelId, "-start-label"));
112
- }
113
- if (finalLocaleText.end) {
114
- labels.push("".concat(labelId, "-end-label"));
115
- }
116
- } else if (label != null) {
117
- labels.push("".concat(labelId, "-label"));
118
- }
119
- labelledById = labels.length > 0 ? labels.join(' ') : undefined;
120
- }
121
- var slotProps = _extends({}, innerSlotProps, {
122
- mobilePaper: _extends({
123
- 'aria-labelledby': labelledById
124
- }, innerSlotProps == null ? void 0 : innerSlotProps.mobilePaper)
125
- });
126
- var renderPicker = function renderPicker() {
127
- return /*#__PURE__*/_jsxs(LocalizationProvider, {
128
- localeText: localeText,
129
- children: [/*#__PURE__*/_jsx(Field, _extends({}, enrichedFieldProps)), /*#__PURE__*/_jsx(PickersModalDialog, _extends({}, actions, {
130
- open: open,
131
- slots: slots,
132
- slotProps: slotProps,
133
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
134
- slots: slots,
135
- slotProps: slotPropsForLayout,
136
- children: renderCurrentView()
137
- }))
138
- }))]
139
- });
140
- };
141
- return {
142
- renderPicker: renderPicker
143
- };
144
- };
@@ -1,9 +0,0 @@
1
- /* TODO: remove this when a clearable behavior for multiple input range fields is implemented */
2
- export var excludeProps = function excludeProps(props, excludedProps) {
3
- return Object.keys(props).reduce(function (acc, key) {
4
- if (!excludedProps.includes(key)) {
5
- acc[key] = props[key];
6
- }
7
- return acc;
8
- }, {});
9
- };
@@ -1,102 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import useEventCallback from '@mui/utils/useEventCallback';
3
- import { unstable_useDateField as useDateField } from '@mui/x-date-pickers/DateField';
4
- import { useLocalizationContext, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
5
- import { useDefaultizedDateRangeFieldProps } from '../../../SingleInputDateRangeField/useSingleInputDateRangeField';
6
- import { validateDateRange } from '../../utils/validation/validateDateRange';
7
- import { rangeValueManager } from '../../utils/valueManagers';
8
- import { excludeProps } from './shared';
9
- export var useMultiInputDateRangeField = function useMultiInputDateRangeField(_ref) {
10
- var inSharedProps = _ref.sharedProps,
11
- startTextFieldProps = _ref.startTextFieldProps,
12
- unstableStartFieldRef = _ref.unstableStartFieldRef,
13
- endTextFieldProps = _ref.endTextFieldProps,
14
- unstableEndFieldRef = _ref.unstableEndFieldRef;
15
- var sharedProps = useDefaultizedDateRangeFieldProps(inSharedProps);
16
- var adapter = useLocalizationContext();
17
- var valueProp = sharedProps.value,
18
- defaultValue = sharedProps.defaultValue,
19
- format = sharedProps.format,
20
- formatDensity = sharedProps.formatDensity,
21
- shouldRespectLeadingZeros = sharedProps.shouldRespectLeadingZeros,
22
- onChange = sharedProps.onChange,
23
- disabled = sharedProps.disabled,
24
- readOnly = sharedProps.readOnly,
25
- selectedSections = sharedProps.selectedSections,
26
- onSelectedSectionsChange = sharedProps.onSelectedSectionsChange,
27
- timezoneProp = sharedProps.timezone;
28
- var _useControlledValueWi = useControlledValueWithTimezone({
29
- name: 'useMultiInputDateRangeField',
30
- timezone: timezoneProp,
31
- value: valueProp,
32
- defaultValue: defaultValue,
33
- onChange: onChange,
34
- valueManager: rangeValueManager
35
- }),
36
- value = _useControlledValueWi.value,
37
- handleValueChange = _useControlledValueWi.handleValueChange,
38
- timezone = _useControlledValueWi.timezone;
39
-
40
- // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
41
- var buildChangeHandler = function buildChangeHandler(index) {
42
- return function (newDate, rawContext) {
43
- var newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
44
- var context = _extends({}, rawContext, {
45
- validationError: validateDateRange({
46
- adapter: adapter,
47
- value: newDateRange,
48
- props: _extends({}, sharedProps, {
49
- timezone: timezone
50
- })
51
- })
52
- });
53
- handleValueChange(newDateRange, context);
54
- };
55
- };
56
- var handleStartDateChange = useEventCallback(buildChangeHandler(0));
57
- var handleEndDateChange = useEventCallback(buildChangeHandler(1));
58
- var validationError = useValidation(_extends({}, sharedProps, {
59
- value: value,
60
- timezone: timezone
61
- }), validateDateRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
62
- var startFieldProps = _extends({
63
- error: !!validationError[0]
64
- }, startTextFieldProps, {
65
- disabled: disabled,
66
- readOnly: readOnly,
67
- format: format,
68
- formatDensity: formatDensity,
69
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
70
- timezone: timezone,
71
- unstableFieldRef: unstableStartFieldRef,
72
- value: valueProp === undefined ? undefined : valueProp[0],
73
- defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
74
- onChange: handleStartDateChange,
75
- selectedSections: selectedSections,
76
- onSelectedSectionsChange: onSelectedSectionsChange
77
- });
78
- var endFieldProps = _extends({
79
- error: !!validationError[1]
80
- }, endTextFieldProps, {
81
- format: format,
82
- formatDensity: formatDensity,
83
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
84
- disabled: disabled,
85
- readOnly: readOnly,
86
- timezone: timezone,
87
- unstableFieldRef: unstableEndFieldRef,
88
- value: valueProp === undefined ? undefined : valueProp[1],
89
- defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
90
- onChange: handleEndDateChange,
91
- selectedSections: selectedSections,
92
- onSelectedSectionsChange: onSelectedSectionsChange
93
- });
94
- var startDateResponse = useDateField(startFieldProps);
95
- var endDateResponse = useDateField(endFieldProps);
96
-
97
- /* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
98
- return {
99
- startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
100
- endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
101
- };
102
- };
@@ -1,115 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import useEventCallback from '@mui/utils/useEventCallback';
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';
5
- import { validateDateTimeRange } from '../../utils/validation/validateDateTimeRange';
6
- import { rangeValueManager } from '../../utils/valueManagers';
7
- import { excludeProps } from './shared';
8
- export var useDefaultizedDateTimeRangeFieldProps = function useDefaultizedDateTimeRangeFieldProps(props) {
9
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format, _props$minDateTime, _props$maxDateTime, _props$minDateTime2, _props$maxDateTime2;
10
- var utils = useUtils();
11
- var defaultDates = useDefaultDates();
12
- var ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
13
- var 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
- };
25
- export var useMultiInputDateTimeRangeField = function useMultiInputDateTimeRangeField(_ref) {
26
- var inSharedProps = _ref.sharedProps,
27
- startTextFieldProps = _ref.startTextFieldProps,
28
- unstableStartFieldRef = _ref.unstableStartFieldRef,
29
- endTextFieldProps = _ref.endTextFieldProps,
30
- unstableEndFieldRef = _ref.unstableEndFieldRef;
31
- var sharedProps = useDefaultizedDateTimeRangeFieldProps(inSharedProps);
32
- var adapter = useLocalizationContext();
33
- var valueProp = sharedProps.value,
34
- defaultValue = sharedProps.defaultValue,
35
- format = sharedProps.format,
36
- shouldRespectLeadingZeros = sharedProps.shouldRespectLeadingZeros,
37
- timezoneProp = sharedProps.timezone,
38
- onChange = sharedProps.onChange,
39
- disabled = sharedProps.disabled,
40
- readOnly = sharedProps.readOnly,
41
- selectedSections = sharedProps.selectedSections,
42
- onSelectedSectionsChange = sharedProps.onSelectedSectionsChange;
43
- var _useControlledValueWi = useControlledValueWithTimezone({
44
- name: 'useMultiInputDateRangeField',
45
- timezone: timezoneProp,
46
- value: valueProp,
47
- defaultValue: defaultValue,
48
- onChange: onChange,
49
- valueManager: rangeValueManager
50
- }),
51
- value = _useControlledValueWi.value,
52
- handleValueChange = _useControlledValueWi.handleValueChange,
53
- timezone = _useControlledValueWi.timezone;
54
-
55
- // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
56
- var buildChangeHandler = function buildChangeHandler(index) {
57
- return function (newDate, rawContext) {
58
- var newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
59
- var context = _extends({}, rawContext, {
60
- validationError: validateDateTimeRange({
61
- adapter: adapter,
62
- value: newDateRange,
63
- props: _extends({}, sharedProps, {
64
- timezone: timezone
65
- })
66
- })
67
- });
68
- handleValueChange(newDateRange, context);
69
- };
70
- };
71
- var handleStartDateChange = useEventCallback(buildChangeHandler(0));
72
- var handleEndDateChange = useEventCallback(buildChangeHandler(1));
73
- var validationError = useValidation(_extends({}, sharedProps, {
74
- value: value,
75
- timezone: timezone
76
- }), validateDateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
77
- var startFieldProps = _extends({
78
- error: !!validationError[0]
79
- }, startTextFieldProps, {
80
- format: format,
81
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
82
- disabled: disabled,
83
- readOnly: readOnly,
84
- timezone: timezone,
85
- unstableFieldRef: unstableStartFieldRef,
86
- value: valueProp === undefined ? undefined : valueProp[0],
87
- defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
88
- onChange: handleStartDateChange,
89
- selectedSections: selectedSections,
90
- onSelectedSectionsChange: onSelectedSectionsChange
91
- });
92
- var endFieldProps = _extends({
93
- error: !!validationError[1]
94
- }, endTextFieldProps, {
95
- format: format,
96
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
97
- disabled: disabled,
98
- readOnly: readOnly,
99
- timezone: timezone,
100
- unstableFieldRef: unstableEndFieldRef,
101
- value: valueProp === undefined ? undefined : valueProp[1],
102
- defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
103
- onChange: handleEndDateChange,
104
- selectedSections: selectedSections,
105
- onSelectedSectionsChange: onSelectedSectionsChange
106
- });
107
- var startDateResponse = useDateTimeField(startFieldProps);
108
- var endDateResponse = useDateTimeField(endFieldProps);
109
-
110
- /* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
111
- return {
112
- startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
113
- endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
114
- };
115
- };
@@ -1,109 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import useEventCallback from '@mui/utils/useEventCallback';
3
- import { unstable_useTimeField as useTimeField } from '@mui/x-date-pickers/TimeField';
4
- import { useLocalizationContext, useUtils, useValidation, useControlledValueWithTimezone } from '@mui/x-date-pickers/internals';
5
- import { validateTimeRange } from '../../utils/validation/validateTimeRange';
6
- import { rangeValueManager } from '../../utils/valueManagers';
7
- import { excludeProps } from './shared';
8
- export var useDefaultizedTimeRangeFieldProps = function useDefaultizedTimeRangeFieldProps(props) {
9
- var _props$ampm, _props$disablePast, _props$disableFuture, _props$format;
10
- var utils = useUtils();
11
- var ampm = (_props$ampm = props.ampm) != null ? _props$ampm : utils.is12HourCycleInCurrentLocale();
12
- var 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
- };
19
- export var useMultiInputTimeRangeField = function useMultiInputTimeRangeField(_ref) {
20
- var inSharedProps = _ref.sharedProps,
21
- startTextFieldProps = _ref.startTextFieldProps,
22
- unstableStartFieldRef = _ref.unstableStartFieldRef,
23
- endTextFieldProps = _ref.endTextFieldProps,
24
- unstableEndFieldRef = _ref.unstableEndFieldRef;
25
- var sharedProps = useDefaultizedTimeRangeFieldProps(inSharedProps);
26
- var adapter = useLocalizationContext();
27
- var valueProp = sharedProps.value,
28
- defaultValue = sharedProps.defaultValue,
29
- format = sharedProps.format,
30
- shouldRespectLeadingZeros = sharedProps.shouldRespectLeadingZeros,
31
- timezoneProp = sharedProps.timezone,
32
- onChange = sharedProps.onChange,
33
- disabled = sharedProps.disabled,
34
- readOnly = sharedProps.readOnly,
35
- selectedSections = sharedProps.selectedSections,
36
- onSelectedSectionsChange = sharedProps.onSelectedSectionsChange;
37
- var _useControlledValueWi = useControlledValueWithTimezone({
38
- name: 'useMultiInputDateRangeField',
39
- timezone: timezoneProp,
40
- value: valueProp,
41
- defaultValue: defaultValue,
42
- onChange: onChange,
43
- valueManager: rangeValueManager
44
- }),
45
- value = _useControlledValueWi.value,
46
- handleValueChange = _useControlledValueWi.handleValueChange,
47
- timezone = _useControlledValueWi.timezone;
48
-
49
- // TODO: Maybe export utility from `useField` instead of copy/pasting the logic
50
- var buildChangeHandler = function buildChangeHandler(index) {
51
- return function (newDate, rawContext) {
52
- var newDateRange = index === 0 ? [newDate, value[1]] : [value[0], newDate];
53
- var context = _extends({}, rawContext, {
54
- validationError: validateTimeRange({
55
- adapter: adapter,
56
- value: newDateRange,
57
- props: _extends({}, sharedProps, {
58
- timezone: timezone
59
- })
60
- })
61
- });
62
- handleValueChange(newDateRange, context);
63
- };
64
- };
65
- var handleStartDateChange = useEventCallback(buildChangeHandler(0));
66
- var handleEndDateChange = useEventCallback(buildChangeHandler(1));
67
- var validationError = useValidation(_extends({}, sharedProps, {
68
- value: value,
69
- timezone: timezone
70
- }), validateTimeRange, rangeValueManager.isSameError, rangeValueManager.defaultErrorState);
71
- var startFieldProps = _extends({
72
- error: !!validationError[0]
73
- }, startTextFieldProps, {
74
- format: format,
75
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
76
- disabled: disabled,
77
- readOnly: readOnly,
78
- timezone: timezone,
79
- unstableFieldRef: unstableStartFieldRef,
80
- value: valueProp === undefined ? undefined : valueProp[0],
81
- defaultValue: defaultValue === undefined ? undefined : defaultValue[0],
82
- onChange: handleStartDateChange,
83
- selectedSections: selectedSections,
84
- onSelectedSectionsChange: onSelectedSectionsChange
85
- });
86
- var endFieldProps = _extends({
87
- error: !!validationError[1]
88
- }, endTextFieldProps, {
89
- format: format,
90
- shouldRespectLeadingZeros: shouldRespectLeadingZeros,
91
- disabled: disabled,
92
- readOnly: readOnly,
93
- timezone: timezone,
94
- unstableFieldRef: unstableEndFieldRef,
95
- value: valueProp === undefined ? undefined : valueProp[1],
96
- defaultValue: defaultValue === undefined ? undefined : defaultValue[1],
97
- onChange: handleEndDateChange,
98
- selectedSections: selectedSections,
99
- onSelectedSectionsChange: onSelectedSectionsChange
100
- });
101
- var startDateResponse = useTimeField(startFieldProps);
102
- var endDateResponse = useTimeField(endFieldProps);
103
-
104
- /* TODO: Undo this change when a clearable behavior for multiple input range fields is implemented */
105
- return {
106
- startDate: excludeProps(startDateResponse, ['clearable', 'onClear']),
107
- endDate: excludeProps(endDateResponse, ['clearable', 'onClear'])
108
- };
109
- };
@@ -1,39 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import * as React from 'react';
3
- import useControlled from '@mui/utils/useControlled';
4
- import useEventCallback from '@mui/utils/useEventCallback';
5
- export var useRangePosition = function useRangePosition(props) {
6
- var _props$defaultRangePo;
7
- var singleInputFieldRef = React.useRef();
8
- var _useControlled = useControlled({
9
- name: 'useRangePosition',
10
- state: 'rangePosition',
11
- controlled: props.rangePosition,
12
- default: (_props$defaultRangePo = props.defaultRangePosition) != null ? _props$defaultRangePo : 'start'
13
- }),
14
- _useControlled2 = _slicedToArray(_useControlled, 2),
15
- rangePosition = _useControlled2[0],
16
- setRangePosition = _useControlled2[1];
17
-
18
- // When using a single input field,
19
- // we want to select the 1st section of the edited date when updating the range position.
20
- var syncRangePositionWithSingleInputField = function syncRangePositionWithSingleInputField(newRangePosition) {
21
- if (singleInputFieldRef.current == null) {
22
- return;
23
- }
24
- var sections = singleInputFieldRef.current.getSections();
25
- var targetActiveSectionIndex = newRangePosition === 'start' ? 0 : sections.length / 2;
26
- singleInputFieldRef.current.setSelectedSections(targetActiveSectionIndex);
27
- };
28
- var handleRangePositionChange = useEventCallback(function (newRangePosition) {
29
- var _props$onRangePositio;
30
- setRangePosition(newRangePosition);
31
- (_props$onRangePositio = props.onRangePositionChange) == null || _props$onRangePositio.call(props, newRangePosition);
32
- syncRangePositionWithSingleInputField(newRangePosition);
33
- });
34
- return {
35
- rangePosition: rangePosition,
36
- onRangePositionChange: handleRangePositionChange,
37
- singleInputFieldRef: singleInputFieldRef
38
- };
39
- };
@@ -1 +0,0 @@
1
- export { useStaticRangePicker } from './useStaticRangePicker';
@@ -1,76 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
4
- var _excluded = ["props", "ref"];
5
- import * as React from 'react';
6
- import clsx from 'clsx';
7
- import { styled } from '@mui/material/styles';
8
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
9
- import { PickersLayout } from '@mui/x-date-pickers/PickersLayout';
10
- import { usePicker, DIALOG_WIDTH } from '@mui/x-date-pickers/internals';
11
- import { useRangePosition } from '../useRangePosition';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- var PickerStaticLayout = styled(PickersLayout)(function (_ref) {
14
- var theme = _ref.theme;
15
- return {
16
- overflow: 'hidden',
17
- minWidth: DIALOG_WIDTH,
18
- backgroundColor: (theme.vars || theme).palette.background.paper
19
- };
20
- });
21
-
22
- /**
23
- * Hook managing all the range static pickers:
24
- * - StaticDateRangePicker
25
- */
26
- export var useStaticRangePicker = function useStaticRangePicker(_ref2) {
27
- var _slots$layout;
28
- var props = _ref2.props,
29
- ref = _ref2.ref,
30
- pickerParams = _objectWithoutProperties(_ref2, _excluded);
31
- var localeText = props.localeText,
32
- slots = props.slots,
33
- slotProps = props.slotProps,
34
- className = props.className,
35
- sx = props.sx,
36
- displayStaticWrapperAs = props.displayStaticWrapperAs,
37
- autoFocus = props.autoFocus;
38
- var _useRangePosition = useRangePosition(props),
39
- rangePosition = _useRangePosition.rangePosition,
40
- onRangePositionChange = _useRangePosition.onRangePositionChange;
41
- var _usePicker = usePicker(_extends({}, pickerParams, {
42
- props: props,
43
- autoFocusView: autoFocus != null ? autoFocus : false,
44
- additionalViewProps: {
45
- rangePosition: rangePosition,
46
- onRangePositionChange: onRangePositionChange
47
- },
48
- wrapperVariant: displayStaticWrapperAs
49
- })),
50
- layoutProps = _usePicker.layoutProps,
51
- renderCurrentView = _usePicker.renderCurrentView;
52
- var Layout = (_slots$layout = slots == null ? void 0 : slots.layout) != null ? _slots$layout : PickerStaticLayout;
53
- var slotPropsForLayout = _extends({}, slotProps, {
54
- toolbar: _extends({}, slotProps == null ? void 0 : slotProps.toolbar, {
55
- rangePosition: rangePosition,
56
- onRangePositionChange: onRangePositionChange
57
- })
58
- });
59
- var renderPicker = function renderPicker() {
60
- var _slotProps$layout, _slotProps$layout2, _slotProps$layout3;
61
- return /*#__PURE__*/_jsx(LocalizationProvider, {
62
- localeText: localeText,
63
- children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps == null ? void 0 : slotProps.layout, {
64
- slots: slots,
65
- slotProps: slotPropsForLayout,
66
- sx: [].concat(_toConsumableArray(Array.isArray(sx) ? sx : [sx]), _toConsumableArray(Array.isArray(slotProps == null || (_slotProps$layout = slotProps.layout) == null ? void 0 : _slotProps$layout.sx) ? slotProps.layout.sx : [slotProps == null || (_slotProps$layout2 = slotProps.layout) == null ? void 0 : _slotProps$layout2.sx])),
67
- className: clsx(className, slotProps == null || (_slotProps$layout3 = slotProps.layout) == null ? void 0 : _slotProps$layout3.className),
68
- ref: ref,
69
- children: renderCurrentView()
70
- }))
71
- });
72
- };
73
- return {
74
- renderPicker: renderPicker
75
- };
76
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- export * from './dateRange';
2
- export * from './dateTimeRange';
3
- export * from './timeRange';
4
- export * from './fields';
5
- export * from './rangePickerProps';
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,26 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- export var splitDateRangeSections = function splitDateRangeSections(sections) {
3
- var startDateSections = [];
4
- var endDateSections = [];
5
- sections.forEach(function (section) {
6
- if (section.dateName === 'start') {
7
- startDateSections.push(section);
8
- } else {
9
- endDateSections.push(section);
10
- }
11
- });
12
- return {
13
- startDate: startDateSections,
14
- endDate: endDateSections
15
- };
16
- };
17
- export var removeLastSeparator = function removeLastSeparator(dateSections) {
18
- return dateSections.map(function (section, sectionIndex) {
19
- if (sectionIndex === dateSections.length - 1) {
20
- return _extends({}, section, {
21
- separator: null
22
- });
23
- }
24
- return section;
25
- });
26
- };