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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
  2. package/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +96 -94
  3. package/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
  4. package/AdapterDateFnsV2/AdapterDateFnsV2.js +96 -94
  5. package/AdapterDayjs/AdapterDayjs.js +11 -5
  6. package/CHANGELOG.md +430 -0
  7. package/DateCalendar/DateCalendar.js +1 -1
  8. package/DateField/useDateField.d.ts +1 -1
  9. package/DatePicker/DatePicker.types.d.ts +2 -2
  10. package/DatePicker/shared.d.ts +1 -1
  11. package/DateTimeField/useDateTimeField.d.ts +1 -1
  12. package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  13. package/DateTimePicker/DateTimePickerToolbar.d.ts +1 -1
  14. package/DateTimePicker/DateTimePickerToolbar.js +1 -1
  15. package/DateTimePicker/shared.d.ts +18 -10
  16. package/DateTimePicker/shared.js +23 -2
  17. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -11
  18. package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -7
  19. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  20. package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -2
  21. package/MobileDateTimePicker/MobileDateTimePicker.js +61 -6
  22. package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +1 -3
  23. package/PickersTextField/PickersTextField.js +3 -1
  24. package/StaticDateTimePicker/StaticDateTimePicker.js +60 -6
  25. package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +1 -2
  26. package/TimeClock/Clock.js +2 -2
  27. package/TimeClock/ClockPointer.js +1 -1
  28. package/TimeField/useTimeField.d.ts +1 -1
  29. package/TimePicker/TimePicker.types.d.ts +2 -2
  30. package/TimePicker/shared.d.ts +1 -1
  31. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
  32. package/esm/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
  33. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
  34. package/esm/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
  35. package/esm/AdapterDayjs/AdapterDayjs.js +9 -5
  36. package/esm/DateCalendar/DateCalendar.js +1 -1
  37. package/esm/DateField/useDateField.d.ts +1 -1
  38. package/esm/DatePicker/DatePicker.types.d.ts +2 -2
  39. package/esm/DatePicker/shared.d.ts +1 -1
  40. package/esm/DateTimeField/useDateTimeField.d.ts +1 -1
  41. package/esm/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  42. package/esm/DateTimePicker/DateTimePickerToolbar.d.ts +1 -1
  43. package/esm/DateTimePicker/DateTimePickerToolbar.js +1 -1
  44. package/esm/DateTimePicker/shared.d.ts +18 -10
  45. package/esm/DateTimePicker/shared.js +23 -2
  46. package/esm/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -12
  47. package/esm/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -7
  48. package/esm/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  49. package/esm/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -2
  50. package/esm/MobileDateTimePicker/MobileDateTimePicker.js +62 -7
  51. package/esm/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +1 -3
  52. package/esm/PickersTextField/PickersTextField.js +3 -1
  53. package/esm/StaticDateTimePicker/StaticDateTimePicker.js +61 -7
  54. package/esm/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +1 -2
  55. package/esm/TimeClock/Clock.js +2 -2
  56. package/esm/TimeClock/ClockPointer.js +1 -1
  57. package/esm/TimeField/useTimeField.d.ts +1 -1
  58. package/esm/TimePicker/TimePicker.types.d.ts +2 -2
  59. package/esm/TimePicker/shared.d.ts +1 -1
  60. package/esm/hooks/useSplitFieldProps.d.ts +1 -1
  61. package/esm/hooks/useSplitFieldProps.js +1 -1
  62. package/esm/index.js +1 -1
  63. package/esm/internals/components/PickerFieldUI.d.ts +7 -0
  64. package/esm/internals/components/PickerFieldUI.js +8 -4
  65. package/esm/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
  66. package/esm/internals/components/PickerPopper/PickerPopper.js +26 -14
  67. package/esm/internals/components/PickerProvider.d.ts +158 -7
  68. package/esm/internals/components/PickerProvider.js +7 -2
  69. package/esm/internals/demo/DemoContainer.js +3 -3
  70. package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
  71. package/esm/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +4 -12
  72. package/esm/internals/hooks/useField/index.d.ts +1 -2
  73. package/esm/internals/hooks/useField/useField.js +7 -8
  74. package/esm/internals/hooks/useField/useField.types.d.ts +56 -47
  75. package/esm/internals/hooks/useField/useField.utils.js +4 -1
  76. package/esm/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
  77. package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
  78. package/esm/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
  79. package/esm/internals/hooks/useField/useFieldState.d.ts +2 -1
  80. package/esm/internals/hooks/useField/useFieldState.js +136 -83
  81. package/esm/internals/hooks/useField/useFieldV6TextField.js +9 -7
  82. package/esm/internals/hooks/useField/useFieldV7TextField.js +9 -8
  83. package/esm/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
  84. package/esm/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +4 -7
  85. package/esm/internals/hooks/useNullableFieldPrivateContext.d.ts +9 -0
  86. package/esm/internals/hooks/useNullableFieldPrivateContext.js +5 -0
  87. package/esm/internals/hooks/usePicker/hooks/useOrientation.d.ts +2 -0
  88. package/esm/internals/hooks/usePicker/hooks/useOrientation.js +34 -0
  89. package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.d.ts +19 -0
  90. package/esm/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +210 -0
  91. package/esm/internals/hooks/usePicker/index.d.ts +1 -3
  92. package/esm/internals/hooks/usePicker/usePicker.d.ts +5 -5
  93. package/esm/internals/hooks/usePicker/usePicker.js +276 -34
  94. package/esm/internals/hooks/usePicker/usePicker.types.d.ts +181 -9
  95. package/esm/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
  96. package/esm/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +3 -4
  97. package/esm/internals/hooks/useValueWithTimezone.d.ts +1 -1
  98. package/esm/internals/index.d.ts +7 -9
  99. package/esm/internals/index.js +2 -1
  100. package/esm/internals/models/fields.d.ts +3 -10
  101. package/esm/internals/models/manager.d.ts +108 -4
  102. package/esm/internals/models/props/basePickerProps.d.ts +2 -2
  103. package/esm/internals/models/props/time.d.ts +1 -1
  104. package/esm/internals/utils/date-time-utils.d.ts +2 -2
  105. package/esm/internals/utils/valueManagers.d.ts +1 -1
  106. package/esm/internals/utils/valueManagers.js +10 -18
  107. package/esm/locales/bnBD.d.ts +80 -0
  108. package/esm/locales/bnBD.js +73 -0
  109. package/esm/locales/index.d.ts +1 -0
  110. package/esm/locales/index.js +1 -0
  111. package/esm/managers/useDateManager.d.ts +3 -4
  112. package/esm/managers/useDateTimeManager.d.ts +3 -4
  113. package/esm/managers/useTimeManager.d.ts +3 -4
  114. package/esm/models/adapters.d.ts +2 -1
  115. package/esm/models/fields.d.ts +2 -2
  116. package/esm/models/manager.d.ts +4 -5
  117. package/esm/validation/extractValidationProps.d.ts +1 -1
  118. package/esm/validation/index.d.ts +1 -1
  119. package/esm/validation/useValidation.d.ts +2 -2
  120. package/hooks/useSplitFieldProps.d.ts +1 -1
  121. package/hooks/useSplitFieldProps.js +1 -1
  122. package/index.js +1 -1
  123. package/internals/components/PickerFieldUI.d.ts +7 -0
  124. package/internals/components/PickerFieldUI.js +9 -3
  125. package/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
  126. package/internals/components/PickerPopper/PickerPopper.js +25 -13
  127. package/internals/components/PickerProvider.d.ts +158 -7
  128. package/internals/components/PickerProvider.js +8 -3
  129. package/internals/demo/DemoContainer.js +3 -3
  130. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
  131. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +4 -12
  132. package/internals/hooks/useField/index.d.ts +1 -2
  133. package/internals/hooks/useField/useField.js +7 -8
  134. package/internals/hooks/useField/useField.types.d.ts +56 -47
  135. package/internals/hooks/useField/useField.utils.js +4 -1
  136. package/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
  137. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
  138. package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -10
  139. package/internals/hooks/useField/useFieldState.d.ts +2 -1
  140. package/internals/hooks/useField/useFieldState.js +135 -82
  141. package/internals/hooks/useField/useFieldV6TextField.js +9 -7
  142. package/internals/hooks/useField/useFieldV7TextField.js +9 -8
  143. package/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
  144. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +4 -7
  145. package/internals/hooks/useNullableFieldPrivateContext.d.ts +9 -0
  146. package/internals/hooks/useNullableFieldPrivateContext.js +13 -0
  147. package/internals/hooks/usePicker/hooks/useOrientation.d.ts +2 -0
  148. package/internals/hooks/usePicker/hooks/useOrientation.js +42 -0
  149. package/internals/hooks/usePicker/hooks/useValueAndOpenStates.d.ts +19 -0
  150. package/internals/hooks/usePicker/{usePickerValue.js → hooks/useValueAndOpenStates.js} +97 -114
  151. package/internals/hooks/usePicker/index.d.ts +1 -3
  152. package/internals/hooks/usePicker/usePicker.d.ts +5 -5
  153. package/internals/hooks/usePicker/usePicker.js +278 -34
  154. package/internals/hooks/usePicker/usePicker.types.d.ts +181 -9
  155. package/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
  156. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +3 -4
  157. package/internals/hooks/useValueWithTimezone.d.ts +1 -1
  158. package/internals/index.d.ts +7 -9
  159. package/internals/index.js +19 -0
  160. package/internals/models/fields.d.ts +3 -10
  161. package/internals/models/manager.d.ts +108 -4
  162. package/internals/models/props/basePickerProps.d.ts +2 -2
  163. package/internals/models/props/time.d.ts +1 -1
  164. package/internals/utils/date-time-utils.d.ts +2 -2
  165. package/internals/utils/valueManagers.d.ts +1 -1
  166. package/internals/utils/valueManagers.js +10 -18
  167. package/locales/bnBD.d.ts +80 -0
  168. package/locales/bnBD.js +79 -0
  169. package/locales/index.d.ts +1 -0
  170. package/locales/index.js +11 -0
  171. package/managers/useDateManager.d.ts +3 -4
  172. package/managers/useDateTimeManager.d.ts +3 -4
  173. package/managers/useTimeManager.d.ts +3 -4
  174. package/models/adapters.d.ts +2 -1
  175. package/models/fields.d.ts +2 -2
  176. package/models/manager.d.ts +4 -5
  177. package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.d.ts +1 -1
  178. package/modern/AdapterDateFnsJalaliV2/AdapterDateFnsJalaliV2.js +47 -45
  179. package/modern/AdapterDateFnsV2/AdapterDateFnsV2.d.ts +1 -1
  180. package/modern/AdapterDateFnsV2/AdapterDateFnsV2.js +47 -45
  181. package/modern/AdapterDayjs/AdapterDayjs.js +9 -5
  182. package/modern/DateCalendar/DateCalendar.js +1 -1
  183. package/modern/DateField/useDateField.d.ts +1 -1
  184. package/modern/DatePicker/DatePicker.types.d.ts +2 -2
  185. package/modern/DatePicker/shared.d.ts +1 -1
  186. package/modern/DateTimeField/useDateTimeField.d.ts +1 -1
  187. package/modern/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  188. package/modern/DateTimePicker/DateTimePickerToolbar.d.ts +1 -1
  189. package/modern/DateTimePicker/DateTimePickerToolbar.js +1 -1
  190. package/modern/DateTimePicker/shared.d.ts +18 -10
  191. package/modern/DateTimePicker/shared.js +23 -2
  192. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -12
  193. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -7
  194. package/modern/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  195. package/modern/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -2
  196. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +62 -7
  197. package/modern/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +1 -3
  198. package/modern/PickersTextField/PickersTextField.js +3 -1
  199. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +61 -7
  200. package/modern/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +1 -2
  201. package/modern/TimeClock/Clock.js +2 -2
  202. package/modern/TimeClock/ClockPointer.js +1 -1
  203. package/modern/TimeField/useTimeField.d.ts +1 -1
  204. package/modern/TimePicker/TimePicker.types.d.ts +2 -2
  205. package/modern/TimePicker/shared.d.ts +1 -1
  206. package/modern/hooks/useSplitFieldProps.d.ts +1 -1
  207. package/modern/hooks/useSplitFieldProps.js +1 -1
  208. package/modern/index.js +1 -1
  209. package/modern/internals/components/PickerFieldUI.d.ts +7 -0
  210. package/modern/internals/components/PickerFieldUI.js +8 -4
  211. package/modern/internals/components/PickerPopper/PickerPopper.d.ts +0 -3
  212. package/modern/internals/components/PickerPopper/PickerPopper.js +26 -14
  213. package/modern/internals/components/PickerProvider.d.ts +158 -7
  214. package/modern/internals/components/PickerProvider.js +7 -2
  215. package/modern/internals/demo/DemoContainer.js +3 -3
  216. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +5 -22
  217. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +4 -12
  218. package/modern/internals/hooks/useField/index.d.ts +1 -2
  219. package/modern/internals/hooks/useField/useField.js +7 -8
  220. package/modern/internals/hooks/useField/useField.types.d.ts +56 -47
  221. package/modern/internals/hooks/useField/useField.utils.js +4 -1
  222. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +2 -2
  223. package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +9 -9
  224. package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +16 -8
  225. package/modern/internals/hooks/useField/useFieldState.d.ts +2 -1
  226. package/modern/internals/hooks/useField/useFieldState.js +136 -83
  227. package/modern/internals/hooks/useField/useFieldV6TextField.js +9 -7
  228. package/modern/internals/hooks/useField/useFieldV7TextField.js +9 -8
  229. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +5 -21
  230. package/modern/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +4 -7
  231. package/modern/internals/hooks/useNullableFieldPrivateContext.d.ts +9 -0
  232. package/modern/internals/hooks/useNullableFieldPrivateContext.js +5 -0
  233. package/modern/internals/hooks/usePicker/hooks/useOrientation.d.ts +2 -0
  234. package/modern/internals/hooks/usePicker/hooks/useOrientation.js +34 -0
  235. package/modern/internals/hooks/usePicker/hooks/useValueAndOpenStates.d.ts +19 -0
  236. package/modern/internals/hooks/usePicker/hooks/useValueAndOpenStates.js +210 -0
  237. package/modern/internals/hooks/usePicker/index.d.ts +1 -3
  238. package/modern/internals/hooks/usePicker/usePicker.d.ts +5 -5
  239. package/modern/internals/hooks/usePicker/usePicker.js +276 -34
  240. package/modern/internals/hooks/usePicker/usePicker.types.d.ts +181 -9
  241. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +3 -2
  242. package/modern/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +3 -4
  243. package/modern/internals/hooks/useValueWithTimezone.d.ts +1 -1
  244. package/modern/internals/index.d.ts +7 -9
  245. package/modern/internals/index.js +2 -1
  246. package/modern/internals/models/fields.d.ts +3 -10
  247. package/modern/internals/models/manager.d.ts +108 -4
  248. package/modern/internals/models/props/basePickerProps.d.ts +2 -2
  249. package/modern/internals/models/props/time.d.ts +1 -1
  250. package/modern/internals/utils/date-time-utils.d.ts +2 -2
  251. package/modern/internals/utils/valueManagers.d.ts +1 -1
  252. package/modern/internals/utils/valueManagers.js +10 -18
  253. package/modern/locales/bnBD.d.ts +80 -0
  254. package/modern/locales/bnBD.js +73 -0
  255. package/modern/locales/index.d.ts +1 -0
  256. package/modern/locales/index.js +1 -0
  257. package/modern/managers/useDateManager.d.ts +3 -4
  258. package/modern/managers/useDateTimeManager.d.ts +3 -4
  259. package/modern/managers/useTimeManager.d.ts +3 -4
  260. package/modern/models/adapters.d.ts +2 -1
  261. package/modern/models/fields.d.ts +2 -2
  262. package/modern/models/manager.d.ts +4 -5
  263. package/modern/validation/extractValidationProps.d.ts +1 -1
  264. package/modern/validation/index.d.ts +1 -1
  265. package/modern/validation/useValidation.d.ts +2 -2
  266. package/package.json +2 -2
  267. package/tsconfig.build.tsbuildinfo +1 -1
  268. package/validation/extractValidationProps.d.ts +1 -1
  269. package/validation/index.d.ts +1 -1
  270. package/validation/useValidation.d.ts +2 -2
  271. package/esm/internals/hooks/useOpenState.d.ts +0 -14
  272. package/esm/internals/hooks/useOpenState.js +0 -37
  273. package/esm/internals/hooks/usePicker/usePickerProvider.d.ts +0 -60
  274. package/esm/internals/hooks/usePicker/usePickerProvider.js +0 -111
  275. package/esm/internals/hooks/usePicker/usePickerValue.d.ts +0 -12
  276. package/esm/internals/hooks/usePicker/usePickerValue.js +0 -226
  277. package/esm/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -327
  278. package/esm/internals/hooks/usePicker/usePickerValue.types.js +0 -1
  279. package/esm/internals/hooks/usePicker/usePickerViews.d.ts +0 -120
  280. package/esm/internals/hooks/usePicker/usePickerViews.js +0 -176
  281. package/internals/hooks/useOpenState.d.ts +0 -14
  282. package/internals/hooks/useOpenState.js +0 -46
  283. package/internals/hooks/usePicker/usePickerProvider.d.ts +0 -60
  284. package/internals/hooks/usePicker/usePickerProvider.js +0 -121
  285. package/internals/hooks/usePicker/usePickerValue.d.ts +0 -12
  286. package/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -327
  287. package/internals/hooks/usePicker/usePickerValue.types.js +0 -5
  288. package/internals/hooks/usePicker/usePickerViews.d.ts +0 -120
  289. package/internals/hooks/usePicker/usePickerViews.js +0 -183
  290. package/modern/internals/hooks/useOpenState.d.ts +0 -14
  291. package/modern/internals/hooks/useOpenState.js +0 -37
  292. package/modern/internals/hooks/usePicker/usePickerProvider.d.ts +0 -60
  293. package/modern/internals/hooks/usePicker/usePickerProvider.js +0 -111
  294. package/modern/internals/hooks/usePicker/usePickerValue.d.ts +0 -12
  295. package/modern/internals/hooks/usePicker/usePickerValue.js +0 -226
  296. package/modern/internals/hooks/usePicker/usePickerValue.types.d.ts +0 -327
  297. package/modern/internals/hooks/usePicker/usePickerValue.types.js +0 -1
  298. package/modern/internals/hooks/usePicker/usePickerViews.d.ts +0 -120
  299. package/modern/internals/hooks/usePicker/usePickerViews.js +0 -176
@@ -15,10 +15,10 @@ const getChildTypeFromChildName = childName => {
15
15
  if (childName.match(/^Static([A-Za-z]+)/) || childName.match(/^([A-Za-z]+)(Calendar|Clock)$/)) {
16
16
  return 'UI-view';
17
17
  }
18
- if (childName.match(/^MultiInput([A-Za-z]+)RangeField$/) || childName.match(/^([A-Za-z]+)RangePicker$/)) {
18
+ if (childName.match(/^MultiInput([A-Za-z]+)RangeField$/)) {
19
19
  return 'multi-input-range-field';
20
20
  }
21
- if (childName.match(/^SingleInput([A-Za-z]+)RangeField$/)) {
21
+ if (childName.match(/^SingleInput([A-Za-z]+)RangeField$/) || childName.match(/^([A-Za-z]+)RangePicker$/)) {
22
22
  return 'single-input-range-field';
23
23
  }
24
24
  return 'single-input-field';
@@ -133,7 +133,7 @@ export function DemoContainer(props) {
133
133
  minWidth: {
134
134
  xs: 300,
135
135
  // If demo also contains MultiInputDateTimeRangeField, increase width to avoid cutting off the value.
136
- md: childrenTypes.has('multi-input-range-field') ? 460 : 400
136
+ md: childrenTypes.has('multi-input-range-field') ? 460 : 440
137
137
  }
138
138
  }
139
139
  };
@@ -4,8 +4,6 @@ const _excluded = ["props"],
4
4
  _excluded2 = ["ownerState"];
5
5
  import * as React from 'react';
6
6
  import useSlotProps from '@mui/utils/useSlotProps';
7
- import useForkRef from '@mui/utils/useForkRef';
8
- import useId from '@mui/utils/useId';
9
7
  import { PickerPopper } from "../../components/PickerPopper/PickerPopper.js";
10
8
  import { usePicker } from "../usePicker/index.js";
11
9
  import { PickersLayout } from "../../../PickersLayout/index.js";
@@ -29,35 +27,26 @@ export const useDesktopPicker = _ref => {
29
27
  slotProps: innerSlotProps,
30
28
  label,
31
29
  inputRef,
32
- readOnly,
33
- autoFocus,
34
30
  localeText
35
31
  } = props;
36
- const fieldRef = React.useRef(null);
37
- const labelId = useId();
38
- const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
39
32
  const {
40
33
  providerProps,
41
34
  renderCurrentView,
42
35
  ownerState
43
36
  } = usePicker(_extends({}, pickerParams, {
44
37
  props,
45
- fieldRef,
46
38
  localeText,
47
39
  autoFocusView: true,
40
+ viewContainerRole: 'dialog',
48
41
  variant: 'desktop'
49
42
  }));
43
+ const labelId = providerProps.privateContextValue.labelId;
44
+ const isToolbarHidden = innerSlotProps?.toolbar?.hidden ?? false;
50
45
  const Field = slots.field;
51
46
  const _useSlotProps = useSlotProps({
52
47
  elementType: Field,
53
48
  externalSlotProps: innerSlotProps?.field,
54
- additionalProps: _extends({
55
- // Internal props
56
- readOnly,
57
- autoFocus: autoFocus && !props.open,
58
- // Forwarded props
59
- focused: providerProps.contextValue.open ? true : undefined
60
- }, isToolbarHidden && {
49
+ additionalProps: _extends({}, isToolbarHidden && {
61
50
  id: labelId
62
51
  }),
63
52
  ownerState
@@ -80,18 +69,12 @@ export const useDesktopPicker = _ref => {
80
69
  'aria-labelledby': labelledById
81
70
  }, innerSlotProps?.popper)
82
71
  });
83
-
84
- // TODO: This `as any` will go away once the field ref is handled by the context.
85
- const handleFieldRef = useForkRef(fieldRef, fieldProps.unstableFieldRef);
86
72
  const renderPicker = () => /*#__PURE__*/_jsx(PickerProvider, _extends({}, providerProps, {
87
73
  children: /*#__PURE__*/_jsxs(PickerFieldUIContextProvider, {
88
74
  slots: slots,
89
75
  slotProps: slotProps,
90
76
  inputRef: inputRef,
91
- children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps, {
92
- unstableFieldRef: handleFieldRef
93
- })), /*#__PURE__*/_jsx(PickerPopper, {
94
- role: "dialog",
77
+ children: [/*#__PURE__*/_jsx(Field, _extends({}, fieldProps)), /*#__PURE__*/_jsx(PickerPopper, {
95
78
  slots: slots,
96
79
  slotProps: slotProps,
97
80
  children: /*#__PURE__*/_jsx(Layout, _extends({}, slotProps?.layout, {
@@ -2,37 +2,29 @@ import * as React from 'react';
2
2
  import { MakeRequired, SlotComponentPropsFromProps } from '@mui/x-internals/types';
3
3
  import { BasePickerProps } from "../../models/props/basePickerProps.js";
4
4
  import { PickerPopperSlots, PickerPopperSlotProps } from "../../components/PickerPopper/PickerPopper.js";
5
- import { UsePickerParams } from "../usePicker/index.js";
5
+ import { UsePickerParameters, UsePickerNonStaticProps, UsePickerProps } from "../usePicker/index.js";
6
6
  import { PickerFieldSlotProps, PickerOwnerState } from "../../../models/index.js";
7
7
  import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, PickersLayoutSlotProps } from "../../../PickersLayout/PickersLayout.types.js";
8
- import { UsePickerValueNonStaticProps } from "../usePicker/usePickerValue.types.js";
9
- import { UsePickerViewsProps } from "../usePicker/usePickerViews.js";
10
8
  import { DateOrTimeViewWithMeridiem, PickerValue } from "../../models/index.js";
11
9
  import { PickerFieldUISlotsFromContext, PickerFieldUISlotPropsFromContext } from "../../components/PickerFieldUI.js";
12
- import { UsePickerProviderNonStaticProps } from "../usePicker/usePickerProvider.js";
13
10
  export interface UseDesktopPickerSlots extends Pick<PickerPopperSlots, 'desktopPaper' | 'desktopTransition' | 'desktopTrapFocus' | 'popper'>, ExportedPickersLayoutSlots<PickerValue>, PickerFieldUISlotsFromContext {
14
11
  /**
15
12
  * Component used to enter the date with the keyboard.
16
13
  */
17
14
  field: React.ElementType;
18
- /**
19
- * Form control with an input to render the value inside the default field.
20
- * @default TextField from '@mui/material' or PickersTextField if `enableAccessibleFieldDOMStructure` is `true`.
21
- */
22
- textField?: React.ElementType;
23
15
  }
24
16
  export interface ExportedUseDesktopPickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends PickerPopperSlotProps, ExportedPickersLayoutSlotProps<PickerValue>, PickerFieldUISlotPropsFromContext {
25
17
  field?: SlotComponentPropsFromProps<PickerFieldSlotProps<PickerValue, TEnableAccessibleFieldDOMStructure>, {}, PickerOwnerState>;
26
18
  }
27
19
  export interface UseDesktopPickerSlotProps<TEnableAccessibleFieldDOMStructure extends boolean> extends ExportedUseDesktopPickerSlotProps<TEnableAccessibleFieldDOMStructure>, Pick<PickersLayoutSlotProps<PickerValue>, 'toolbar'> {}
28
- export interface DesktopOnlyPickerProps extends UsePickerValueNonStaticProps, UsePickerProviderNonStaticProps {
20
+ export interface DesktopOnlyPickerProps extends UsePickerNonStaticProps {
29
21
  /**
30
22
  * If `true`, the `input` element is focused during the first mount.
31
23
  * @default false
32
24
  */
33
25
  autoFocus?: boolean;
34
26
  }
35
- export interface UseDesktopPickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerViewsProps<PickerValue, TView, any>> extends BasePickerProps<PickerValue, any, TError, TExternalProps>, MakeRequired<DesktopOnlyPickerProps, 'format'> {
27
+ export interface UseDesktopPickerProps<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TError, TExternalProps extends UsePickerProps<PickerValue, TView, TError, any>> extends BasePickerProps<PickerValue, any, TError, TExternalProps>, MakeRequired<DesktopOnlyPickerProps, 'format'> {
36
28
  /**
37
29
  * Overridable component slots.
38
30
  * @default {}
@@ -44,6 +36,6 @@ export interface UseDesktopPickerProps<TView extends DateOrTimeViewWithMeridiem,
44
36
  */
45
37
  slotProps?: UseDesktopPickerSlotProps<TEnableAccessibleFieldDOMStructure>;
46
38
  }
47
- export interface UseDesktopPickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopPickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends Pick<UsePickerParams<PickerValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor' | 'ref'> {
39
+ export interface UseDesktopPickerParams<TView extends DateOrTimeViewWithMeridiem, TEnableAccessibleFieldDOMStructure extends boolean, TExternalProps extends UseDesktopPickerProps<TView, TEnableAccessibleFieldDOMStructure, any, TExternalProps>> extends Pick<UsePickerParameters<PickerValue, TView, TExternalProps>, 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor' | 'ref'> {
48
40
  props: TExternalProps;
49
41
  }
@@ -1,5 +1,4 @@
1
1
  export { useField } from "./useField.js";
2
2
  export type { FieldValueManager, UseFieldInternalProps, UseFieldParams, UseFieldResponse, FieldChangeHandler, FieldChangeHandlerContext } from './useField.types';
3
3
  export { createDateStrForV7HiddenInputFromSections, createDateStrForV6InputFromSections } from "./useField.utils.js";
4
- export { useFieldInternalPropsWithDefaults } from "./useFieldInternalPropsWithDefaults.js";
5
- export type { PickerFieldPrivateContextValue } from './useFieldInternalPropsWithDefaults';
4
+ export { useFieldInternalPropsWithDefaults } from "./useFieldInternalPropsWithDefaults.js";
@@ -29,7 +29,6 @@ export const useField = params => {
29
29
  onClear
30
30
  },
31
31
  fieldValueManager,
32
- valueManager,
33
32
  validator,
34
33
  getOpenPickerButtonAriaLabel: getOpenDialogAriaText
35
34
  } = params;
@@ -37,6 +36,7 @@ export const useField = params => {
37
36
  const stateResponse = useFieldState(params);
38
37
  const {
39
38
  state,
39
+ value,
40
40
  activeSectionIndex,
41
41
  parsedSelectedSections,
42
42
  setSelectedSections,
@@ -59,7 +59,7 @@ export const useField = params => {
59
59
  const {
60
60
  resetCharacterQuery
61
61
  } = characterEditingResponse;
62
- const areAllSectionsEmpty = valueManager.areValuesEqual(utils, state.value, valueManager.emptyValue);
62
+ const areAllSectionsEmpty = React.useMemo(() => state.sections.every(section => section.value === ''), [state.sections]);
63
63
  const useFieldTextField = enableAccessibleFieldDOMStructure ? useFieldV7TextField : useFieldV6TextField;
64
64
  const sectionOrder = React.useMemo(() => getSectionOrder(state.sections, isRtl && !enableAccessibleFieldDOMStructure), [state.sections, isRtl, enableAccessibleFieldDOMStructure]);
65
65
  const {
@@ -149,12 +149,11 @@ export const useField = params => {
149
149
  setSelectedSections(activeSectionIndex);
150
150
  }
151
151
  const activeSection = state.sections[activeSectionIndex];
152
- const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
153
- const newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, activeDateManager.date, {
152
+ const newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, fieldValueManager.getDateFromSection(value, activeSection), {
154
153
  minutesStep
155
154
  });
156
155
  updateSectionValue({
157
- activeSection,
156
+ section: activeSection,
158
157
  newSectionValue,
159
158
  shouldGoToNextSection: false
160
159
  });
@@ -171,7 +170,7 @@ export const useField = params => {
171
170
  props: internalProps,
172
171
  validator,
173
172
  timezone,
174
- value: state.value,
173
+ value,
175
174
  onError: internalProps.onError
176
175
  });
177
176
  const inputError = React.useMemo(() => {
@@ -225,8 +224,8 @@ export const useField = params => {
225
224
  };
226
225
  const localizationContext = useLocalizationContext();
227
226
  const openPickerAriaLabel = React.useMemo(() => getOpenDialogAriaText(_extends({}, localizationContext, {
228
- value: state.value
229
- })), [getOpenDialogAriaText, state.value, localizationContext]);
227
+ value
228
+ })), [getOpenDialogAriaText, value, localizationContext]);
230
229
  const commonAdditionalProps = {
231
230
  disabled,
232
231
  readOnly,
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, PickerValidDate, FieldRef, OnErrorProps, InferError, InferFieldSection, PickerValueType } from "../../../models/index.js";
3
- import type { PickerValueManager } from '../usePicker';
3
+ import type { PickerValueManager } from '../../models';
4
4
  import type { Validator } from '../../../validation';
5
5
  import type { UseFieldStateResponse } from './useFieldState';
6
6
  import type { UseFieldCharacterEditingResponse } from './useFieldCharacterEditing';
@@ -96,6 +96,10 @@ export interface UseFieldInternalProps<TValue extends PickerValidValue, TEnableA
96
96
  * @default false
97
97
  */
98
98
  autoFocus?: boolean;
99
+ /**
100
+ * If `true`, the component is displayed in focused state.
101
+ */
102
+ focused?: boolean;
99
103
  }
100
104
  export interface UseFieldCommonAdditionalProps extends Required<Pick<UseFieldInternalProps<any, any, any>, 'disabled' | 'readOnly' | 'autoFocus'>> {
101
105
  /**
@@ -110,21 +114,22 @@ export interface UseFieldCommonForwardedProps extends Pick<ExportedPickerFieldUI
110
114
  export type UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure extends boolean> = UseFieldCommonForwardedProps & (TEnableAccessibleFieldDOMStructure extends false ? UseFieldV6ForwardedProps : UseFieldV7ForwardedProps);
111
115
  export interface UseFieldV6ForwardedProps {
112
116
  inputRef?: React.Ref<HTMLInputElement>;
113
- onBlur?: () => void;
117
+ onBlur?: React.FocusEventHandler;
114
118
  onClick?: React.MouseEventHandler;
115
- onFocus?: () => void;
119
+ onFocus?: React.FocusEventHandler;
116
120
  onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
117
121
  placeholder?: string;
118
122
  }
119
123
  interface UseFieldV6AdditionalProps extends Required<Pick<React.InputHTMLAttributes<HTMLInputElement>, 'inputMode' | 'placeholder' | 'value' | 'onChange' | 'autoComplete'>> {
120
124
  enableAccessibleFieldDOMStructure: false;
125
+ focused?: boolean;
121
126
  }
122
127
  export interface UseFieldV7ForwardedProps {
123
128
  focused?: boolean;
124
129
  sectionListRef?: React.Ref<PickersSectionListRef>;
125
- onBlur?: () => void;
130
+ onBlur?: React.FocusEventHandler;
126
131
  onClick?: React.MouseEventHandler;
127
- onFocus?: () => void;
132
+ onFocus?: React.FocusEventHandler;
128
133
  onInput?: React.FormEventHandler<HTMLDivElement>;
129
134
  onPaste?: React.ClipboardEventHandler<HTMLDivElement>;
130
135
  }
@@ -136,6 +141,7 @@ interface UseFieldV7AdditionalProps {
136
141
  value: string;
137
142
  onChange: React.ChangeEventHandler<HTMLInputElement>;
138
143
  areAllSectionsEmpty: boolean;
144
+ focused: boolean;
139
145
  }
140
146
  export type UseFieldResponse<TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldCommonForwardedProps & {
141
147
  [key: string]: any;
@@ -159,47 +165,17 @@ export type FieldChangeHandler<TValue extends PickerValidValue, TError> = (value
159
165
  export interface FieldChangeHandlerContext<TError> {
160
166
  validationError: TError;
161
167
  }
162
- /**
163
- * Object used to access and update the active date (i.e: the date containing the active section).
164
- * Mainly useful in the range fields where we need to update the date containing the active section without impacting the other one.
165
- */
166
- interface FieldActiveDateManager<TValue extends PickerValidValue> {
167
- /**
168
- * Active date from `state.value`.
169
- */
170
- date: PickerValidDate | null;
171
- /**
172
- * Active date from the `state.referenceValue`.
173
- */
174
- referenceDate: PickerValidDate;
175
- /**
176
- * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
177
- * @param {InferFieldSection<TValue>[]} sections The sections of the full value.
178
- * @returns {InferFieldSection<TValue>[]} The sections of the active date.
179
- * Get the sections of the active date.
180
- */
181
- getSections: (sections: InferFieldSection<TValue>[]) => InferFieldSection<TValue>[];
182
- /**
183
- * Creates the new value and reference value based on the new active date and the current state.
184
- * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
185
- * @param {PickerValidDate | null} newActiveDate The new value of the date containing the active section.
186
- * @returns {Pick<UseFieldState<TValue>, 'value' | 'referenceValue'>} The new value and reference value to publish and store in the state.
187
- */
188
- getNewValuesFromNewActiveDate: (newActiveDate: PickerValidDate | null) => Pick<UseFieldState<TValue>, 'value' | 'referenceValue'>;
189
- }
190
168
  export type FieldParsedSelectedSections = number | 'all' | null;
191
169
  export interface FieldValueManager<TValue extends PickerValidValue> {
192
170
  /**
193
171
  * Creates the section list from the current value.
194
172
  * The `prevSections` are used on the range fields to avoid losing the sections of a partially filled date when editing the other date.
195
173
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
196
- * @param {MuiPickersAdapter} utils The utils to manipulate the date.
197
174
  * @param {TValue} value The current value to generate sections from.
198
- * @param {InferFieldSection<TValue>[] | null} fallbackSections The sections to use as a fallback if a date is null or invalid.
199
- * @param {(date: PickerValidDate) => FieldSection[]} getSectionsFromDate Returns the sections of the given date.
175
+ * @param {(date: PickerValidDate | null) => FieldSection[]} getSectionsFromDate Returns the sections of the given date.
200
176
  * @returns {InferFieldSection<TValue>[]} The new section list.
201
177
  */
202
- getSectionsFromValue: (utils: MuiPickersAdapter, value: TValue, fallbackSections: InferFieldSection<TValue>[] | null, getSectionsFromDate: (date: PickerValidDate) => FieldSection[]) => InferFieldSection<TValue>[];
178
+ getSectionsFromValue: (value: TValue, getSectionsFromDate: (date: PickerValidDate | null) => FieldSection[]) => InferFieldSection<TValue>[];
203
179
  /**
204
180
  * Creates the string value to render in the input based on the current section list.
205
181
  * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
@@ -216,15 +192,6 @@ export interface FieldValueManager<TValue extends PickerValidValue> {
216
192
  * @returns {string} The string value to render in the input.
217
193
  */
218
194
  getV7HiddenInputValueFromSections: (sections: InferFieldSection<TValue>[]) => string;
219
- /**
220
- * Returns the manager of the active date.
221
- * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
222
- * @param {MuiPickersAdapter} utils The utils to manipulate the date.
223
- * @param {UseFieldState<TValue>} state The current state of the field.
224
- * @param {InferFieldSection<TValue>} activeSection The active section.
225
- * @returns {FieldActiveDateManager<TValue>} The manager of the active date.
226
- */
227
- getActiveDateManager: (utils: MuiPickersAdapter, state: UseFieldState<TValue>, activeSection: InferFieldSection<TValue>) => FieldActiveDateManager<TValue>;
228
195
  /**
229
196
  * Parses a string version (most of the time coming from the input).
230
197
  * This method should only be used when the change does not come from a single section.
@@ -245,9 +212,51 @@ export interface FieldValueManager<TValue extends PickerValidValue> {
245
212
  * @returns {TValue} The new reference value with no invalid date.
246
213
  */
247
214
  updateReferenceValue: (utils: MuiPickersAdapter, value: TValue, prevReferenceValue: InferNonNullablePickerValue<TValue>) => InferNonNullablePickerValue<TValue>;
215
+ /**
216
+ * Extract from the given value the date that contains the given section.
217
+ * @param {TValue} value The value to extract the date from.
218
+ * @param {InferFieldSection<TValue>} section The section to get the date from.
219
+ * @returns {PickerValidDate | null} The date that contains the section.
220
+ */
221
+ getDateFromSection: (value: TValue, section: InferFieldSection<TValue>) => PickerValidDate | null;
222
+ /**
223
+ * Get the sections of the date that contains the given section.
224
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
225
+ * @param {InferFieldSection<TValue>[]} sections The sections of the full value.
226
+ * @param {InferFieldSection<TValue>} section A section of the date from which we want to get all the sections.
227
+ * @returns {InferFieldSection<TValue>[]} The sections of the date that contains the section.
228
+ */
229
+ getDateSectionsFromValue: (sections: InferFieldSection<TValue>[], section: InferFieldSection<TValue>) => InferFieldSection<TValue>[];
230
+ /**
231
+ * Creates a new value based on the provided date and the current value.
232
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
233
+ * @param {TValue} value The value to update the date in.
234
+ * @param {InferFieldSection<TValue>} section A section of the date we want to update in the value.
235
+ * @param {PickerValidDate | null} date The date that contains the section.
236
+ * @returns {TValue} The updated value.
237
+ */
238
+ updateDateInValue: (value: TValue, section: InferFieldSection<TValue>, date: PickerValidDate | null) => TValue;
239
+ /**
240
+ * @template TValue The value type. It will be the same type as `value` or `null`. It can be in `[start, end]` format in case of range value.
241
+ * @param {InferFieldSection<TValue>[]} sections The sections of the full value.
242
+ * @param {InferFieldSection<TValue>} section A section of the date from which we want to clear all the sections.
243
+ * @returns {InferFieldSection<TValue>[]} The sections of the full value with all the sections of the target date cleared.
244
+ */
245
+ clearDateSections: (sections: InferFieldSection<TValue>[], section: InferFieldSection<TValue>) => InferFieldSection<TValue>[];
248
246
  }
249
247
  export interface UseFieldState<TValue extends PickerValidValue> {
250
- value: TValue;
248
+ /**
249
+ * Last value returned by `useControlledValueWithTimezone`.
250
+ */
251
+ lastValue: TValue | undefined;
252
+ /**
253
+ * Last value of the parameters used to generate the sections.
254
+ */
255
+ lastSectionsDependencies: {
256
+ format: string;
257
+ isRtl: boolean;
258
+ locale: any;
259
+ };
251
260
  /**
252
261
  * Non-nullable value used to keep trace of the timezone and the date parts not present in the format.
253
262
  * It is updated whenever we have a valid date (for the range picker we update only the portion of the range that is valid).
@@ -447,8 +447,11 @@ const transferDateSectionValue = (utils, section, dateToTransferFrom, dateToTran
447
447
  }
448
448
  case 'weekDay':
449
449
  {
450
+ let dayInWeekStrOfActiveDate = utils.formatByString(dateToTransferFrom, section.format);
451
+ if (section.hasLeadingZerosInInput) {
452
+ dayInWeekStrOfActiveDate = cleanLeadingZeros(dayInWeekStrOfActiveDate, section.maxLength);
453
+ }
450
454
  const formattedDaysInWeek = getDaysInWeekStr(utils, section.format);
451
- const dayInWeekStrOfActiveDate = utils.formatByString(dateToTransferFrom, section.format);
452
455
  const dayInWeekOfActiveDate = formattedDaysInWeek.indexOf(dayInWeekStrOfActiveDate);
453
456
  const dayInWeekOfNewSectionValue = formattedDaysInWeek.indexOf(section.value);
454
457
  const diff = dayInWeekOfNewSectionValue - dayInWeekOfActiveDate;
@@ -236,7 +236,7 @@ export const useFieldCharacterEditing = ({
236
236
  return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue => isStringNumber(queryValue, localizedDigits));
237
237
  };
238
238
  const applyCharacterEditing = useEventCallback(params => {
239
- const activeSection = sections[params.sectionIndex];
239
+ const section = sections[params.sectionIndex];
240
240
  const isNumericEditing = isStringNumber(params.keyPressed, localizedDigits);
241
241
  const response = isNumericEditing ? applyNumericEditing(_extends({}, params, {
242
242
  keyPressed: applyLocalizedDigits(params.keyPressed, localizedDigits)
@@ -246,7 +246,7 @@ export const useFieldCharacterEditing = ({
246
246
  return;
247
247
  }
248
248
  updateSectionValue({
249
- activeSection,
249
+ section,
250
250
  newSectionValue: response.sectionValue,
251
251
  shouldGoToNextSection: response.shouldGoToNextSection
252
252
  });
@@ -1,17 +1,17 @@
1
- import * as React from 'react';
2
- import type { UseFieldInternalProps } from './useField.types';
3
1
  import { PickerAnyManager, PickerManagerFieldInternalProps, PickerManagerFieldInternalPropsWithDefaults } from "../../models/index.js";
4
- export declare const PickerFieldPrivateContext: React.Context<PickerFieldPrivateContextValue | null>;
5
2
  /**
6
3
  * Applies the default values to the field internal props.
7
4
  * This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
8
5
  * It is only here to allow the migration to be done in smaller steps.
9
6
  */
10
- export declare function useFieldInternalPropsWithDefaults<TManager extends PickerAnyManager>({
11
- manager,
12
- internalProps
13
- }: {
7
+ export declare function useFieldInternalPropsWithDefaults<TManager extends PickerAnyManager>(parameters: UseFieldInternalPropsWithDefaultsParameters<TManager>): PickerManagerFieldInternalPropsWithDefaults<TManager>;
8
+ interface UseFieldInternalPropsWithDefaultsParameters<TManager extends PickerAnyManager> {
14
9
  manager: TManager;
15
10
  internalProps: PickerManagerFieldInternalProps<TManager>;
16
- }): PickerManagerFieldInternalPropsWithDefaults<TManager>;
17
- export interface PickerFieldPrivateContextValue extends Pick<UseFieldInternalProps<any, any, any>, 'formatDensity' | 'enableAccessibleFieldDOMStructure' | 'selectedSections' | 'onSelectedSectionsChange'> {}
11
+ /**
12
+ * Hack to make sure that on multi input range field, the `useNullableFieldPrivateContext().fieldRef` is only bound to the field matching the range position.
13
+ * @default false
14
+ */
15
+ skipContextFieldRefAssignment?: boolean;
16
+ }
17
+ export {};
@@ -1,21 +1,25 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import useForkRef from '@mui/utils/useForkRef';
3
4
  import { useLocalizationContext } from "../useUtils.js";
4
5
  import { useNullablePickerContext } from "../useNullablePickerContext.js";
5
- export const PickerFieldPrivateContext = /*#__PURE__*/React.createContext(null);
6
+ import { useNullableFieldPrivateContext } from "../useNullableFieldPrivateContext.js";
6
7
 
7
8
  /**
8
9
  * Applies the default values to the field internal props.
9
10
  * This is a temporary hook that will be removed during a follow up when `useField` will receive the internal props without the defaults.
10
11
  * It is only here to allow the migration to be done in smaller steps.
11
12
  */
12
- export function useFieldInternalPropsWithDefaults({
13
- manager,
14
- internalProps
15
- }) {
13
+ export function useFieldInternalPropsWithDefaults(parameters) {
14
+ const {
15
+ manager,
16
+ internalProps,
17
+ skipContextFieldRefAssignment
18
+ } = parameters;
16
19
  const localizationContext = useLocalizationContext();
17
20
  const pickerContext = useNullablePickerContext();
18
- const fieldPrivateContext = React.useContext(PickerFieldPrivateContext);
21
+ const fieldPrivateContext = useNullableFieldPrivateContext();
22
+ const handleFieldRef = useForkRef(internalProps.unstableFieldRef, skipContextFieldRefAssignment ? null : fieldPrivateContext?.fieldRef);
19
23
  const setValue = pickerContext?.setValue;
20
24
  const handleChangeFromPicker = React.useCallback((newValue, ctx) => {
21
25
  return setValue?.(newValue, {
@@ -33,15 +37,19 @@ export function useFieldInternalPropsWithDefaults({
33
37
  onChange: handleChangeFromPicker,
34
38
  timezone: pickerContext.timezone,
35
39
  disabled: pickerContext.disabled,
40
+ readOnly: pickerContext.readOnly,
41
+ autoFocus: pickerContext.autoFocus && !pickerContext.open,
42
+ focused: pickerContext.open ? true : undefined,
36
43
  format: pickerContext.fieldFormat,
37
44
  formatDensity: fieldPrivateContext.formatDensity,
38
45
  enableAccessibleFieldDOMStructure: fieldPrivateContext.enableAccessibleFieldDOMStructure,
39
46
  selectedSections: fieldPrivateContext.selectedSections,
40
- onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange
47
+ onSelectedSectionsChange: fieldPrivateContext.onSelectedSectionsChange,
48
+ unstableFieldRef: handleFieldRef
41
49
  }, internalProps);
42
50
  }
43
51
  return manager.internal_applyDefaultsToFieldInternalProps(_extends({}, localizationContext, {
44
52
  internalProps: internalPropsWithDefaultsFromContext
45
53
  }));
46
- }, [manager, localizationContext, pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker]);
54
+ }, [manager, localizationContext, pickerContext, fieldPrivateContext, internalProps, handleChangeFromPicker, handleFieldRef]);
47
55
  }
@@ -5,7 +5,7 @@ export interface UpdateSectionValueParams<TValue extends PickerValidValue> {
5
5
  /**
6
6
  * The section on which we want to apply the new value.
7
7
  */
8
- activeSection: InferFieldSection<TValue>;
8
+ section: InferFieldSection<TValue>;
9
9
  /**
10
10
  * Value to apply to the active section.
11
11
  */
@@ -17,6 +17,7 @@ export interface UpdateSectionValueParams<TValue extends PickerValidValue> {
17
17
  }
18
18
  export interface UseFieldStateResponse<TValue extends PickerValidValue> {
19
19
  state: UseFieldState<TValue>;
20
+ value: TValue;
20
21
  activeSectionIndex: number | null;
21
22
  parsedSelectedSections: FieldParsedSelectedSections;
22
23
  setSelectedSections: (sections: FieldSelectedSections) => void;