@mui/x-date-pickers 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 (701) hide show
  1. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +1 -0
  2. package/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
  3. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
  4. package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
  5. package/AdapterDayjs/AdapterDayjs.d.ts +1 -0
  6. package/AdapterDayjs/AdapterDayjs.js +6 -0
  7. package/AdapterLuxon/AdapterLuxon.d.ts +1 -0
  8. package/AdapterLuxon/AdapterLuxon.js +6 -0
  9. package/AdapterMoment/AdapterMoment.d.ts +1 -0
  10. package/AdapterMoment/AdapterMoment.js +4 -0
  11. package/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
  12. package/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
  13. package/CHANGELOG.md +298 -23
  14. package/DateCalendar/DateCalendar.js +3 -1
  15. package/DateCalendar/DateCalendar.types.d.ts +3 -0
  16. package/DateCalendar/DayCalendar.d.ts +3 -1
  17. package/DateCalendar/DayCalendar.js +1 -1
  18. package/DateCalendar/PickersFadeTransitionGroup.d.ts +3 -0
  19. package/DateCalendar/PickersSlideTransition.d.ts +3 -0
  20. package/DateField/DateField.d.ts +1 -1
  21. package/DateField/DateField.js +11 -9
  22. package/DateField/DateField.types.d.ts +12 -15
  23. package/DateField/index.d.ts +1 -1
  24. package/DateField/useDateField.d.ts +2 -2
  25. package/DateField/useDateField.js +1 -15
  26. package/DatePicker/DatePicker.d.ts +1 -1
  27. package/DatePicker/DatePicker.js +9 -9
  28. package/DatePicker/DatePicker.types.d.ts +3 -3
  29. package/DatePicker/DatePickerToolbar.d.ts +5 -4
  30. package/DatePicker/DatePickerToolbar.js +11 -3
  31. package/DateTimeField/DateTimeField.d.ts +1 -1
  32. package/DateTimeField/DateTimeField.js +11 -9
  33. package/DateTimeField/DateTimeField.types.d.ts +12 -15
  34. package/DateTimeField/index.d.ts +1 -1
  35. package/DateTimeField/useDateTimeField.d.ts +2 -2
  36. package/DateTimeField/useDateTimeField.js +1 -20
  37. package/DateTimePicker/DateTimePicker.d.ts +1 -1
  38. package/DateTimePicker/DateTimePicker.js +9 -9
  39. package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
  40. package/DateTimePicker/DateTimePickerTabs.d.ts +2 -2
  41. package/DateTimePicker/DateTimePickerTabs.js +7 -1
  42. package/DateTimePicker/DateTimePickerToolbar.d.ts +2 -2
  43. package/DateTimePicker/DateTimePickerToolbar.js +3 -0
  44. package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
  45. package/DesktopDatePicker/DesktopDatePicker.js +9 -9
  46. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +3 -3
  47. package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
  48. package/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
  49. package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +3 -3
  50. package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
  51. package/DesktopTimePicker/DesktopTimePicker.js +9 -8
  52. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +3 -3
  53. package/LocalizationProvider/LocalizationProvider.js +1 -0
  54. package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
  55. package/MobileDatePicker/MobileDatePicker.js +9 -9
  56. package/MobileDatePicker/MobileDatePicker.types.d.ts +3 -3
  57. package/MobileDateTimePicker/MobileDateTimePicker.d.ts +2 -2
  58. package/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
  59. package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +4 -4
  60. package/MobileTimePicker/MobileTimePicker.d.ts +2 -2
  61. package/MobileTimePicker/MobileTimePicker.js +9 -8
  62. package/MobileTimePicker/MobileTimePicker.types.d.ts +4 -4
  63. package/PickersLayout/PickersLayout.js +6 -0
  64. package/PickersLayout/PickersLayout.types.d.ts +6 -0
  65. package/PickersSectionList/PickersSectionList.d.ts +4 -4
  66. package/PickersSectionList/PickersSectionList.js +1 -2
  67. package/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
  68. package/PickersTextField/PickersInput/PickersInput.js +3 -3
  69. package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +1 -1
  70. package/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
  71. package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +1 -0
  72. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
  73. package/PickersTextField/PickersTextField.d.ts +1 -1
  74. package/PickersTextField/PickersTextField.js +9 -5
  75. package/StaticDatePicker/StaticDatePicker.js +0 -1
  76. package/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  77. package/TimeField/TimeField.d.ts +1 -1
  78. package/TimeField/TimeField.js +11 -9
  79. package/TimeField/TimeField.types.d.ts +12 -15
  80. package/TimeField/index.d.ts +1 -1
  81. package/TimeField/useTimeField.d.ts +2 -2
  82. package/TimeField/useTimeField.js +1 -13
  83. package/TimePicker/TimePicker.d.ts +1 -1
  84. package/TimePicker/TimePicker.js +9 -8
  85. package/TimePicker/TimePicker.types.d.ts +3 -3
  86. package/TimePicker/TimePickerToolbar.d.ts +5 -4
  87. package/TimePicker/TimePickerToolbar.js +11 -3
  88. package/hooks/index.d.ts +1 -1
  89. package/hooks/useClearableField.d.ts +10 -2
  90. package/index.js +1 -1
  91. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +3 -0
  92. package/internals/components/PickersPopper.d.ts +3 -0
  93. package/internals/components/PickersPopper.js +1 -2
  94. package/internals/demo/DemoContainer.js +6 -5
  95. package/internals/hooks/defaultizedFieldProps.d.ts +19 -0
  96. package/internals/hooks/defaultizedFieldProps.js +43 -0
  97. package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
  98. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
  99. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -13
  100. package/internals/hooks/useField/buildSectionsFromFormat.d.ts +16 -0
  101. package/internals/hooks/useField/buildSectionsFromFormat.js +251 -0
  102. package/internals/hooks/useField/index.d.ts +2 -2
  103. package/internals/hooks/useField/index.js +1 -1
  104. package/internals/hooks/useField/useField.d.ts +4 -4
  105. package/internals/hooks/useField/useField.js +82 -309
  106. package/internals/hooks/useField/useField.types.d.ts +92 -56
  107. package/internals/hooks/useField/useField.utils.d.ts +10 -10
  108. package/internals/hooks/useField/useField.utils.js +78 -228
  109. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +7 -6
  110. package/internals/hooks/useField/useFieldCharacterEditing.js +6 -6
  111. package/internals/hooks/useField/useFieldState.d.ts +13 -11
  112. package/internals/hooks/useField/useFieldState.js +45 -61
  113. package/internals/hooks/useField/useFieldV6TextField.d.ts +25 -0
  114. package/internals/hooks/useField/useFieldV6TextField.js +324 -0
  115. package/internals/hooks/useField/useFieldV7TextField.d.ts +2 -0
  116. package/internals/hooks/useField/useFieldV7TextField.js +402 -0
  117. package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
  118. package/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
  119. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
  120. package/internals/hooks/usePicker/usePicker.d.ts +1 -1
  121. package/internals/hooks/usePicker/usePicker.js +3 -3
  122. package/internals/hooks/usePicker/usePicker.types.d.ts +2 -2
  123. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  124. package/internals/hooks/usePicker/usePickerValue.js +2 -18
  125. package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -6
  126. package/internals/hooks/usePicker/usePickerViews.d.ts +4 -4
  127. package/internals/hooks/usePicker/usePickerViews.js +5 -6
  128. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
  129. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +1 -0
  130. package/internals/index.d.ts +5 -4
  131. package/internals/index.js +2 -1
  132. package/internals/models/fields.d.ts +2 -4
  133. package/internals/models/helpers.d.ts +1 -0
  134. package/internals/models/props/basePickerProps.d.ts +2 -7
  135. package/internals/models/props/tabs.d.ts +6 -0
  136. package/internals/models/props/toolbar.d.ts +3 -0
  137. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +1 -1
  138. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
  139. package/internals/utils/fields.js +1 -1
  140. package/internals/utils/valueManagers.js +5 -4
  141. package/locales/beBY.d.ts +9 -0
  142. package/locales/beBY.js +13 -0
  143. package/locales/caES.d.ts +9 -0
  144. package/locales/caES.js +13 -0
  145. package/locales/csCZ.d.ts +9 -0
  146. package/locales/csCZ.js +13 -0
  147. package/locales/daDK.d.ts +9 -0
  148. package/locales/daDK.js +13 -0
  149. package/locales/deDE.d.ts +9 -0
  150. package/locales/deDE.js +13 -0
  151. package/locales/elGR.d.ts +9 -0
  152. package/locales/elGR.js +13 -0
  153. package/locales/enUS.d.ts +9 -0
  154. package/locales/enUS.js +12 -1
  155. package/locales/esES.d.ts +9 -0
  156. package/locales/esES.js +13 -0
  157. package/locales/eu.d.ts +9 -0
  158. package/locales/eu.js +13 -0
  159. package/locales/faIR.d.ts +9 -0
  160. package/locales/faIR.js +13 -0
  161. package/locales/fiFI.d.ts +9 -0
  162. package/locales/fiFI.js +13 -0
  163. package/locales/frFR.d.ts +9 -0
  164. package/locales/frFR.js +13 -0
  165. package/locales/heIL.d.ts +9 -0
  166. package/locales/heIL.js +13 -0
  167. package/locales/huHU.d.ts +9 -0
  168. package/locales/huHU.js +13 -0
  169. package/locales/isIS.d.ts +9 -0
  170. package/locales/isIS.js +13 -0
  171. package/locales/itIT.d.ts +9 -0
  172. package/locales/itIT.js +13 -0
  173. package/locales/jaJP.d.ts +9 -0
  174. package/locales/jaJP.js +13 -0
  175. package/locales/koKR.d.ts +9 -0
  176. package/locales/koKR.js +13 -0
  177. package/locales/kzKZ.d.ts +9 -0
  178. package/locales/kzKZ.js +13 -0
  179. package/locales/mk.d.ts +9 -0
  180. package/locales/mk.js +13 -0
  181. package/locales/nbNO.d.ts +9 -0
  182. package/locales/nbNO.js +13 -0
  183. package/locales/nlNL.d.ts +9 -0
  184. package/locales/nlNL.js +13 -0
  185. package/locales/plPL.d.ts +9 -0
  186. package/locales/plPL.js +13 -0
  187. package/locales/ptBR.d.ts +9 -0
  188. package/locales/ptBR.js +13 -0
  189. package/locales/roRO.d.ts +9 -0
  190. package/locales/roRO.js +13 -0
  191. package/locales/ruRU.d.ts +9 -0
  192. package/locales/ruRU.js +13 -0
  193. package/locales/skSK.d.ts +9 -0
  194. package/locales/skSK.js +13 -0
  195. package/locales/svSE.d.ts +9 -0
  196. package/locales/svSE.js +13 -0
  197. package/locales/trTR.d.ts +9 -0
  198. package/locales/trTR.js +13 -0
  199. package/locales/ukUA.d.ts +9 -0
  200. package/locales/ukUA.js +13 -0
  201. package/locales/urPK.d.ts +9 -0
  202. package/locales/urPK.js +13 -0
  203. package/locales/utils/getPickersLocalization.d.ts +9 -0
  204. package/locales/utils/pickersLocaleTextApi.d.ts +9 -0
  205. package/locales/viVN.d.ts +9 -0
  206. package/locales/viVN.js +13 -0
  207. package/locales/zhCN.d.ts +9 -0
  208. package/locales/zhCN.js +13 -0
  209. package/locales/zhHK.d.ts +9 -0
  210. package/locales/zhHK.js +13 -0
  211. package/models/adapters.d.ts +13 -0
  212. package/models/fields.d.ts +47 -32
  213. package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
  214. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
  215. package/modern/AdapterDayjs/AdapterDayjs.js +6 -0
  216. package/modern/AdapterLuxon/AdapterLuxon.js +6 -0
  217. package/modern/AdapterMoment/AdapterMoment.js +4 -0
  218. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
  219. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
  220. package/modern/DateCalendar/DateCalendar.js +3 -1
  221. package/modern/DateCalendar/DayCalendar.js +1 -1
  222. package/modern/DateField/DateField.js +11 -9
  223. package/modern/DateField/useDateField.js +1 -14
  224. package/modern/DatePicker/DatePicker.js +9 -9
  225. package/modern/DatePicker/DatePickerToolbar.js +11 -3
  226. package/modern/DateTimeField/DateTimeField.js +11 -9
  227. package/modern/DateTimeField/useDateTimeField.js +1 -19
  228. package/modern/DateTimePicker/DateTimePicker.js +9 -9
  229. package/modern/DateTimePicker/DateTimePickerTabs.js +7 -1
  230. package/modern/DateTimePicker/DateTimePickerToolbar.js +3 -0
  231. package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -9
  232. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
  233. package/modern/DesktopTimePicker/DesktopTimePicker.js +9 -8
  234. package/modern/LocalizationProvider/LocalizationProvider.js +1 -0
  235. package/modern/MobileDatePicker/MobileDatePicker.js +9 -9
  236. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
  237. package/modern/MobileTimePicker/MobileTimePicker.js +9 -8
  238. package/modern/PickersLayout/PickersLayout.js +6 -0
  239. package/modern/PickersSectionList/PickersSectionList.js +1 -2
  240. package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
  241. package/modern/PickersTextField/PickersInput/PickersInput.js +3 -3
  242. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
  243. package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
  244. package/modern/PickersTextField/PickersTextField.js +9 -5
  245. package/modern/StaticDatePicker/StaticDatePicker.js +0 -1
  246. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  247. package/modern/TimeField/TimeField.js +11 -9
  248. package/modern/TimeField/useTimeField.js +1 -12
  249. package/modern/TimePicker/TimePicker.js +9 -8
  250. package/modern/TimePicker/TimePickerToolbar.js +11 -3
  251. package/modern/index.js +1 -1
  252. package/modern/internals/components/PickersPopper.js +1 -2
  253. package/modern/internals/demo/DemoContainer.js +6 -5
  254. package/modern/internals/hooks/defaultizedFieldProps.js +40 -0
  255. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
  256. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +251 -0
  257. package/modern/internals/hooks/useField/index.js +1 -1
  258. package/modern/internals/hooks/useField/useField.js +82 -303
  259. package/modern/internals/hooks/useField/useField.utils.js +78 -228
  260. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +6 -6
  261. package/modern/internals/hooks/useField/useFieldState.js +45 -61
  262. package/modern/internals/hooks/useField/useFieldV6TextField.js +318 -0
  263. package/modern/internals/hooks/useField/useFieldV7TextField.js +400 -0
  264. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
  265. package/modern/internals/hooks/usePicker/usePicker.js +3 -3
  266. package/modern/internals/hooks/usePicker/usePickerValue.js +2 -18
  267. package/modern/internals/hooks/usePicker/usePickerViews.js +4 -6
  268. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
  269. package/modern/internals/index.js +2 -1
  270. package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
  271. package/modern/internals/utils/fields.js +1 -1
  272. package/modern/internals/utils/valueManagers.js +5 -4
  273. package/modern/locales/beBY.js +13 -0
  274. package/modern/locales/caES.js +13 -0
  275. package/modern/locales/csCZ.js +13 -0
  276. package/modern/locales/daDK.js +13 -0
  277. package/modern/locales/deDE.js +13 -0
  278. package/modern/locales/elGR.js +13 -0
  279. package/modern/locales/enUS.js +12 -1
  280. package/modern/locales/esES.js +13 -0
  281. package/modern/locales/eu.js +13 -0
  282. package/modern/locales/faIR.js +13 -0
  283. package/modern/locales/fiFI.js +13 -0
  284. package/modern/locales/frFR.js +13 -0
  285. package/modern/locales/heIL.js +13 -0
  286. package/modern/locales/huHU.js +13 -0
  287. package/modern/locales/isIS.js +13 -0
  288. package/modern/locales/itIT.js +13 -0
  289. package/modern/locales/jaJP.js +13 -0
  290. package/modern/locales/koKR.js +13 -0
  291. package/modern/locales/kzKZ.js +13 -0
  292. package/modern/locales/mk.js +13 -0
  293. package/modern/locales/nbNO.js +13 -0
  294. package/modern/locales/nlNL.js +13 -0
  295. package/modern/locales/plPL.js +13 -0
  296. package/modern/locales/ptBR.js +13 -0
  297. package/modern/locales/roRO.js +13 -0
  298. package/modern/locales/ruRU.js +13 -0
  299. package/modern/locales/skSK.js +13 -0
  300. package/modern/locales/svSE.js +13 -0
  301. package/modern/locales/trTR.js +13 -0
  302. package/modern/locales/ukUA.js +13 -0
  303. package/modern/locales/urPK.js +13 -0
  304. package/modern/locales/viVN.js +13 -0
  305. package/modern/locales/zhCN.js +13 -0
  306. package/modern/locales/zhHK.js +13 -0
  307. package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
  308. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
  309. package/node/AdapterDayjs/AdapterDayjs.js +6 -0
  310. package/node/AdapterLuxon/AdapterLuxon.js +6 -0
  311. package/node/AdapterMoment/AdapterMoment.js +4 -0
  312. package/node/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
  313. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
  314. package/node/DateCalendar/DateCalendar.js +3 -1
  315. package/node/DateCalendar/DayCalendar.js +1 -1
  316. package/node/DateField/DateField.js +11 -9
  317. package/node/DateField/useDateField.js +2 -16
  318. package/node/DatePicker/DatePicker.js +9 -9
  319. package/node/DatePicker/DatePickerToolbar.js +11 -3
  320. package/node/DateTimeField/DateTimeField.js +11 -9
  321. package/node/DateTimeField/useDateTimeField.js +2 -21
  322. package/node/DateTimePicker/DateTimePicker.js +9 -9
  323. package/node/DateTimePicker/DateTimePickerTabs.js +7 -1
  324. package/node/DateTimePicker/DateTimePickerToolbar.js +3 -0
  325. package/node/DesktopDatePicker/DesktopDatePicker.js +9 -9
  326. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
  327. package/node/DesktopTimePicker/DesktopTimePicker.js +9 -8
  328. package/node/LocalizationProvider/LocalizationProvider.js +1 -0
  329. package/node/MobileDatePicker/MobileDatePicker.js +9 -9
  330. package/node/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
  331. package/node/MobileTimePicker/MobileTimePicker.js +9 -8
  332. package/node/PickersLayout/PickersLayout.js +6 -0
  333. package/node/PickersSectionList/PickersSectionList.js +4 -5
  334. package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
  335. package/node/PickersTextField/PickersInput/PickersInput.js +3 -3
  336. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
  337. package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
  338. package/node/PickersTextField/PickersTextField.js +9 -5
  339. package/node/StaticDatePicker/StaticDatePicker.js +0 -1
  340. package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  341. package/node/TimeField/TimeField.js +11 -9
  342. package/node/TimeField/useTimeField.js +2 -14
  343. package/node/TimePicker/TimePicker.js +9 -8
  344. package/node/TimePicker/TimePickerToolbar.js +11 -3
  345. package/node/index.js +1 -1
  346. package/node/internals/components/PickersPopper.js +1 -2
  347. package/node/internals/demo/DemoContainer.js +6 -5
  348. package/node/internals/hooks/defaultizedFieldProps.js +50 -0
  349. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
  350. package/node/internals/hooks/useField/buildSectionsFromFormat.js +259 -0
  351. package/node/internals/hooks/useField/index.js +4 -10
  352. package/node/internals/hooks/useField/useField.js +81 -302
  353. package/node/internals/hooks/useField/useField.utils.js +86 -236
  354. package/node/internals/hooks/useField/useFieldCharacterEditing.js +6 -6
  355. package/node/internals/hooks/useField/useFieldState.js +44 -60
  356. package/node/internals/hooks/useField/useFieldV6TextField.js +329 -0
  357. package/node/internals/hooks/useField/useFieldV7TextField.js +410 -0
  358. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
  359. package/node/internals/hooks/usePicker/usePicker.js +3 -3
  360. package/node/internals/hooks/usePicker/usePickerValue.js +2 -18
  361. package/node/internals/hooks/usePicker/usePickerViews.js +4 -6
  362. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
  363. package/node/internals/index.js +27 -8
  364. package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
  365. package/node/internals/utils/fields.js +1 -1
  366. package/node/internals/utils/valueManagers.js +4 -3
  367. package/node/locales/beBY.js +13 -0
  368. package/node/locales/caES.js +13 -0
  369. package/node/locales/csCZ.js +13 -0
  370. package/node/locales/daDK.js +13 -0
  371. package/node/locales/deDE.js +13 -0
  372. package/node/locales/elGR.js +13 -0
  373. package/node/locales/enUS.js +12 -1
  374. package/node/locales/esES.js +13 -0
  375. package/node/locales/eu.js +13 -0
  376. package/node/locales/faIR.js +13 -0
  377. package/node/locales/fiFI.js +13 -0
  378. package/node/locales/frFR.js +13 -0
  379. package/node/locales/heIL.js +13 -0
  380. package/node/locales/huHU.js +13 -0
  381. package/node/locales/isIS.js +13 -0
  382. package/node/locales/itIT.js +13 -0
  383. package/node/locales/jaJP.js +13 -0
  384. package/node/locales/koKR.js +13 -0
  385. package/node/locales/kzKZ.js +13 -0
  386. package/node/locales/mk.js +13 -0
  387. package/node/locales/nbNO.js +13 -0
  388. package/node/locales/nlNL.js +13 -0
  389. package/node/locales/plPL.js +13 -0
  390. package/node/locales/ptBR.js +13 -0
  391. package/node/locales/roRO.js +13 -0
  392. package/node/locales/ruRU.js +13 -0
  393. package/node/locales/skSK.js +13 -0
  394. package/node/locales/svSE.js +13 -0
  395. package/node/locales/trTR.js +13 -0
  396. package/node/locales/ukUA.js +13 -0
  397. package/node/locales/urPK.js +13 -0
  398. package/node/locales/viVN.js +13 -0
  399. package/node/locales/zhCN.js +13 -0
  400. package/node/locales/zhHK.js +13 -0
  401. package/package.json +4 -4
  402. package/themeAugmentation/props.d.ts +3 -3
  403. package/timeViewRenderers/timeViewRenderers.d.ts +1 -1
  404. package/legacy/AdapterDateFns/AdapterDateFns.js +0 -298
  405. package/legacy/AdapterDateFns/index.js +0 -1
  406. package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +0 -293
  407. package/legacy/AdapterDateFnsBase/index.js +0 -1
  408. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +0 -547
  409. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  410. package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -306
  411. package/legacy/AdapterDateFnsV3/index.js +0 -1
  412. package/legacy/AdapterDayjs/AdapterDayjs.js +0 -568
  413. package/legacy/AdapterDayjs/index.js +0 -1
  414. package/legacy/AdapterLuxon/AdapterLuxon.js +0 -508
  415. package/legacy/AdapterLuxon/index.js +0 -1
  416. package/legacy/AdapterMoment/AdapterMoment.js +0 -481
  417. package/legacy/AdapterMoment/index.js +0 -1
  418. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +0 -238
  419. package/legacy/AdapterMomentHijri/index.js +0 -1
  420. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -235
  421. package/legacy/AdapterMomentJalaali/index.js +0 -1
  422. package/legacy/DateCalendar/DateCalendar.js +0 -573
  423. package/legacy/DateCalendar/DateCalendar.types.js +0 -1
  424. package/legacy/DateCalendar/DayCalendar.js +0 -515
  425. package/legacy/DateCalendar/PickersFadeTransitionGroup.js +0 -58
  426. package/legacy/DateCalendar/PickersSlideTransition.js +0 -118
  427. package/legacy/DateCalendar/dateCalendarClasses.js +0 -5
  428. package/legacy/DateCalendar/dayCalendarClasses.js +0 -5
  429. package/legacy/DateCalendar/index.js +0 -5
  430. package/legacy/DateCalendar/pickersFadeTransitionGroupClasses.js +0 -5
  431. package/legacy/DateCalendar/pickersSlideTransitionClasses.js +0 -5
  432. package/legacy/DateCalendar/useCalendarState.js +0 -124
  433. package/legacy/DateCalendar/useIsDateDisabled.js +0 -30
  434. package/legacy/DateField/DateField.js +0 -319
  435. package/legacy/DateField/DateField.types.js +0 -1
  436. package/legacy/DateField/index.js +0 -2
  437. package/legacy/DateField/useDateField.js +0 -33
  438. package/legacy/DatePicker/DatePicker.js +0 -353
  439. package/legacy/DatePicker/DatePicker.types.js +0 -1
  440. package/legacy/DatePicker/DatePickerToolbar.js +0 -132
  441. package/legacy/DatePicker/datePickerToolbarClasses.js +0 -5
  442. package/legacy/DatePicker/index.js +0 -3
  443. package/legacy/DatePicker/shared.js +0 -41
  444. package/legacy/DateTimeField/DateTimeField.js +0 -360
  445. package/legacy/DateTimeField/DateTimeField.types.js +0 -1
  446. package/legacy/DateTimeField/index.js +0 -2
  447. package/legacy/DateTimeField/useDateTimeField.js +0 -38
  448. package/legacy/DateTimePicker/DateTimePicker.js +0 -424
  449. package/legacy/DateTimePicker/DateTimePicker.types.js +0 -1
  450. package/legacy/DateTimePicker/DateTimePickerTabs.js +0 -142
  451. package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -385
  452. package/legacy/DateTimePicker/dateTimePickerTabsClasses.js +0 -5
  453. package/legacy/DateTimePicker/dateTimePickerToolbarClasses.js +0 -5
  454. package/legacy/DateTimePicker/index.js +0 -5
  455. package/legacy/DateTimePicker/shared.js +0 -56
  456. package/legacy/DayCalendarSkeleton/DayCalendarSkeleton.js +0 -119
  457. package/legacy/DayCalendarSkeleton/dayCalendarSkeletonClasses.js +0 -5
  458. package/legacy/DayCalendarSkeleton/index.js +0 -2
  459. package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -372
  460. package/legacy/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
  461. package/legacy/DesktopDatePicker/index.js +0 -1
  462. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -480
  463. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
  464. package/legacy/DesktopDateTimePicker/index.js +0 -1
  465. package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -355
  466. package/legacy/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
  467. package/legacy/DesktopTimePicker/index.js +0 -1
  468. package/legacy/DigitalClock/DigitalClock.js +0 -443
  469. package/legacy/DigitalClock/DigitalClock.types.js +0 -1
  470. package/legacy/DigitalClock/digitalClockClasses.js +0 -6
  471. package/legacy/DigitalClock/index.js +0 -2
  472. package/legacy/LocalizationProvider/LocalizationProvider.js +0 -140
  473. package/legacy/LocalizationProvider/index.js +0 -1
  474. package/legacy/MobileDatePicker/MobileDatePicker.js +0 -369
  475. package/legacy/MobileDatePicker/MobileDatePicker.types.js +0 -1
  476. package/legacy/MobileDatePicker/index.js +0 -1
  477. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -428
  478. package/legacy/MobileDateTimePicker/MobileDateTimePicker.types.js +0 -1
  479. package/legacy/MobileDateTimePicker/index.js +0 -1
  480. package/legacy/MobileTimePicker/MobileTimePicker.js +0 -311
  481. package/legacy/MobileTimePicker/MobileTimePicker.types.js +0 -1
  482. package/legacy/MobileTimePicker/index.js +0 -1
  483. package/legacy/MonthCalendar/MonthCalendar.js +0 -338
  484. package/legacy/MonthCalendar/MonthCalendar.types.js +0 -1
  485. package/legacy/MonthCalendar/PickersMonth.js +0 -135
  486. package/legacy/MonthCalendar/index.js +0 -3
  487. package/legacy/MonthCalendar/monthCalendarClasses.js +0 -5
  488. package/legacy/MonthCalendar/pickersMonthClasses.js +0 -5
  489. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +0 -521
  490. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +0 -1
  491. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +0 -76
  492. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +0 -173
  493. package/legacy/MultiSectionDigitalClock/index.js +0 -3
  494. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +0 -6
  495. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +0 -6
  496. package/legacy/PickersActionBar/PickersActionBar.js +0 -86
  497. package/legacy/PickersActionBar/index.js +0 -1
  498. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -284
  499. package/legacy/PickersCalendarHeader/PickersCalendarHeader.types.js +0 -1
  500. package/legacy/PickersCalendarHeader/index.js +0 -2
  501. package/legacy/PickersCalendarHeader/pickersCalendarHeaderClasses.js +0 -5
  502. package/legacy/PickersDay/PickersDay.js +0 -367
  503. package/legacy/PickersDay/index.js +0 -2
  504. package/legacy/PickersDay/pickersDayClasses.js +0 -5
  505. package/legacy/PickersLayout/PickersLayout.js +0 -159
  506. package/legacy/PickersLayout/PickersLayout.types.js +0 -1
  507. package/legacy/PickersLayout/index.js +0 -3
  508. package/legacy/PickersLayout/pickersLayoutClasses.js +0 -6
  509. package/legacy/PickersLayout/usePickerLayout.js +0 -134
  510. package/legacy/PickersSectionList/PickersSectionList.js +0 -235
  511. package/legacy/PickersSectionList/PickersSectionList.types.js +0 -1
  512. package/legacy/PickersSectionList/index.js +0 -2
  513. package/legacy/PickersSectionList/pickersSectionListClasses.js +0 -6
  514. package/legacy/PickersShortcuts/PickersShortcuts.js +0 -110
  515. package/legacy/PickersShortcuts/index.js +0 -1
  516. package/legacy/PickersTextField/PickersFilledInput/PickersFilledInput.js +0 -234
  517. package/legacy/PickersTextField/PickersFilledInput/index.js +0 -2
  518. package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +0 -8
  519. package/legacy/PickersTextField/PickersInput/PickersInput.js +0 -190
  520. package/legacy/PickersTextField/PickersInput/index.js +0 -2
  521. package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +0 -8
  522. package/legacy/PickersTextField/PickersInputBase/PickersInputBase.js +0 -340
  523. package/legacy/PickersTextField/PickersInputBase/PickersInputBase.types.js +0 -1
  524. package/legacy/PickersTextField/PickersInputBase/index.js +0 -2
  525. package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +0 -6
  526. package/legacy/PickersTextField/PickersOutlinedInput/Outline.js +0 -121
  527. package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +0 -183
  528. package/legacy/PickersTextField/PickersOutlinedInput/index.js +0 -2
  529. package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +0 -8
  530. package/legacy/PickersTextField/PickersTextField.js +0 -258
  531. package/legacy/PickersTextField/PickersTextField.types.js +0 -1
  532. package/legacy/PickersTextField/index.js +0 -6
  533. package/legacy/PickersTextField/pickersTextFieldClasses.js +0 -6
  534. package/legacy/StaticDatePicker/StaticDatePicker.js +0 -297
  535. package/legacy/StaticDatePicker/StaticDatePicker.types.js +0 -1
  536. package/legacy/StaticDatePicker/index.js +0 -1
  537. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -356
  538. package/legacy/StaticDateTimePicker/StaticDateTimePicker.types.js +0 -1
  539. package/legacy/StaticDateTimePicker/index.js +0 -1
  540. package/legacy/StaticTimePicker/StaticTimePicker.js +0 -238
  541. package/legacy/StaticTimePicker/StaticTimePicker.types.js +0 -1
  542. package/legacy/StaticTimePicker/index.js +0 -1
  543. package/legacy/TimeClock/Clock.js +0 -358
  544. package/legacy/TimeClock/ClockNumber.js +0 -87
  545. package/legacy/TimeClock/ClockNumbers.js +0 -73
  546. package/legacy/TimeClock/ClockPointer.js +0 -106
  547. package/legacy/TimeClock/TimeClock.js +0 -481
  548. package/legacy/TimeClock/TimeClock.types.js +0 -1
  549. package/legacy/TimeClock/clockClasses.js +0 -5
  550. package/legacy/TimeClock/clockNumberClasses.js +0 -5
  551. package/legacy/TimeClock/clockPointerClasses.js +0 -5
  552. package/legacy/TimeClock/index.js +0 -5
  553. package/legacy/TimeClock/shared.js +0 -53
  554. package/legacy/TimeClock/timeClockClasses.js +0 -5
  555. package/legacy/TimeField/TimeField.js +0 -320
  556. package/legacy/TimeField/TimeField.types.js +0 -1
  557. package/legacy/TimeField/index.js +0 -2
  558. package/legacy/TimeField/useTimeField.js +0 -31
  559. package/legacy/TimePicker/TimePicker.js +0 -314
  560. package/legacy/TimePicker/TimePicker.types.js +0 -1
  561. package/legacy/TimePicker/TimePickerToolbar.js +0 -260
  562. package/legacy/TimePicker/index.js +0 -3
  563. package/legacy/TimePicker/shared.js +0 -45
  564. package/legacy/TimePicker/timePickerToolbarClasses.js +0 -5
  565. package/legacy/YearCalendar/PickersYear.js +0 -137
  566. package/legacy/YearCalendar/YearCalendar.js +0 -362
  567. package/legacy/YearCalendar/YearCalendar.types.js +0 -1
  568. package/legacy/YearCalendar/index.js +0 -3
  569. package/legacy/YearCalendar/pickersYearClasses.js +0 -5
  570. package/legacy/YearCalendar/yearCalendarClasses.js +0 -5
  571. package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
  572. package/legacy/dateTimeViewRenderers/index.js +0 -1
  573. package/legacy/dateViewRenderers/dateViewRenderers.js +0 -82
  574. package/legacy/dateViewRenderers/index.js +0 -1
  575. package/legacy/hooks/index.js +0 -1
  576. package/legacy/hooks/useClearableField.js +0 -76
  577. package/legacy/icons/index.js +0 -68
  578. package/legacy/index.js +0 -59
  579. package/legacy/internals/components/DateTimeViewWrapper/DateTimeViewWrapper.js +0 -5
  580. package/legacy/internals/components/DateTimeViewWrapper/index.js +0 -1
  581. package/legacy/internals/components/PickerViewRoot/PickerViewRoot.js +0 -10
  582. package/legacy/internals/components/PickerViewRoot/index.js +0 -1
  583. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +0 -170
  584. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.js +0 -1
  585. package/legacy/internals/components/PickersArrowSwitcher/index.js +0 -2
  586. package/legacy/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +0 -5
  587. package/legacy/internals/components/PickersModalDialog.js +0 -42
  588. package/legacy/internals/components/PickersPopper.js +0 -325
  589. package/legacy/internals/components/PickersToolbar.js +0 -92
  590. package/legacy/internals/components/PickersToolbarButton.js +0 -61
  591. package/legacy/internals/components/PickersToolbarText.js +0 -52
  592. package/legacy/internals/components/pickersPopperClasses.js +0 -5
  593. package/legacy/internals/components/pickersToolbarButtonClasses.js +0 -5
  594. package/legacy/internals/components/pickersToolbarClasses.js +0 -5
  595. package/legacy/internals/components/pickersToolbarTextClasses.js +0 -5
  596. package/legacy/internals/constants/dimensions.js +0 -7
  597. package/legacy/internals/demo/DemoContainer.js +0 -163
  598. package/legacy/internals/demo/index.js +0 -1
  599. package/legacy/internals/hooks/date-helpers-hooks.js +0 -37
  600. package/legacy/internals/hooks/useClockReferenceDate.js +0 -28
  601. package/legacy/internals/hooks/useDefaultReduceAnimations.js +0 -14
  602. package/legacy/internals/hooks/useDesktopPicker/index.js +0 -1
  603. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +0 -174
  604. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.types.js +0 -1
  605. package/legacy/internals/hooks/useField/index.js +0 -2
  606. package/legacy/internals/hooks/useField/useField.js +0 -470
  607. package/legacy/internals/hooks/useField/useField.types.js +0 -1
  608. package/legacy/internals/hooks/useField/useField.utils.js +0 -828
  609. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +0 -277
  610. package/legacy/internals/hooks/useField/useFieldState.js +0 -321
  611. package/legacy/internals/hooks/useIsLandscape.js +0 -39
  612. package/legacy/internals/hooks/useMobilePicker/index.js +0 -1
  613. package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +0 -126
  614. package/legacy/internals/hooks/useMobilePicker/useMobilePicker.types.js +0 -1
  615. package/legacy/internals/hooks/useOpenState.js +0 -38
  616. package/legacy/internals/hooks/usePicker/index.js +0 -1
  617. package/legacy/internals/hooks/usePicker/usePicker.js +0 -54
  618. package/legacy/internals/hooks/usePicker/usePicker.types.js +0 -1
  619. package/legacy/internals/hooks/usePicker/usePickerLayoutProps.js +0 -28
  620. package/legacy/internals/hooks/usePicker/usePickerValue.js +0 -365
  621. package/legacy/internals/hooks/usePicker/usePickerValue.types.js +0 -1
  622. package/legacy/internals/hooks/usePicker/usePickerViews.js +0 -172
  623. package/legacy/internals/hooks/useStaticPicker/index.js +0 -1
  624. package/legacy/internals/hooks/useStaticPicker/useStaticPicker.js +0 -66
  625. package/legacy/internals/hooks/useStaticPicker/useStaticPicker.types.js +0 -1
  626. package/legacy/internals/hooks/useUtils.js +0 -38
  627. package/legacy/internals/hooks/useValidation.js +0 -20
  628. package/legacy/internals/hooks/useValueWithTimezone.js +0 -81
  629. package/legacy/internals/hooks/useViews.js +0 -124
  630. package/legacy/internals/index.js +0 -35
  631. package/legacy/internals/models/common.js +0 -1
  632. package/legacy/internals/models/fields.js +0 -1
  633. package/legacy/internals/models/helpers.js +0 -1
  634. package/legacy/internals/models/index.js +0 -2
  635. package/legacy/internals/models/props/basePickerProps.js +0 -1
  636. package/legacy/internals/models/props/clock.js +0 -1
  637. package/legacy/internals/models/props/tabs.js +0 -1
  638. package/legacy/internals/models/props/toolbar.js +0 -1
  639. package/legacy/internals/models/validation.js +0 -1
  640. package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -24
  641. package/legacy/internals/utils/date-time-utils.js +0 -71
  642. package/legacy/internals/utils/date-utils.js +0 -129
  643. package/legacy/internals/utils/fields.js +0 -28
  644. package/legacy/internals/utils/getDefaultReferenceDate.js +0 -65
  645. package/legacy/internals/utils/time-utils.js +0 -63
  646. package/legacy/internals/utils/utils.js +0 -40
  647. package/legacy/internals/utils/validation/extractValidationProps.js +0 -16
  648. package/legacy/internals/utils/validation/validateDate.js +0 -38
  649. package/legacy/internals/utils/validation/validateDateTime.js +0 -20
  650. package/legacy/internals/utils/validation/validateTime.js +0 -42
  651. package/legacy/internals/utils/valueManagers.js +0 -67
  652. package/legacy/internals/utils/views.js +0 -29
  653. package/legacy/internals/utils/warning.js +0 -39
  654. package/legacy/locales/beBY.js +0 -99
  655. package/legacy/locales/caES.js +0 -100
  656. package/legacy/locales/csCZ.js +0 -100
  657. package/legacy/locales/daDK.js +0 -102
  658. package/legacy/locales/deDE.js +0 -101
  659. package/legacy/locales/elGR.js +0 -100
  660. package/legacy/locales/enUS.js +0 -96
  661. package/legacy/locales/esES.js +0 -99
  662. package/legacy/locales/eu.js +0 -99
  663. package/legacy/locales/faIR.js +0 -100
  664. package/legacy/locales/fiFI.js +0 -100
  665. package/legacy/locales/frFR.js +0 -98
  666. package/legacy/locales/heIL.js +0 -100
  667. package/legacy/locales/huHU.js +0 -99
  668. package/legacy/locales/index.js +0 -35
  669. package/legacy/locales/isIS.js +0 -100
  670. package/legacy/locales/itIT.js +0 -98
  671. package/legacy/locales/jaJP.js +0 -102
  672. package/legacy/locales/koKR.js +0 -98
  673. package/legacy/locales/kzKZ.js +0 -99
  674. package/legacy/locales/mk.js +0 -96
  675. package/legacy/locales/nbNO.js +0 -100
  676. package/legacy/locales/nlNL.js +0 -100
  677. package/legacy/locales/plPL.js +0 -85
  678. package/legacy/locales/ptBR.js +0 -100
  679. package/legacy/locales/roRO.js +0 -99
  680. package/legacy/locales/ruRU.js +0 -98
  681. package/legacy/locales/skSK.js +0 -100
  682. package/legacy/locales/svSE.js +0 -85
  683. package/legacy/locales/trTR.js +0 -100
  684. package/legacy/locales/ukUA.js +0 -100
  685. package/legacy/locales/urPK.js +0 -85
  686. package/legacy/locales/utils/getPickersLocalization.js +0 -12
  687. package/legacy/locales/utils/pickersLocaleTextApi.js +0 -1
  688. package/legacy/locales/viVN.js +0 -100
  689. package/legacy/locales/zhCN.js +0 -100
  690. package/legacy/locales/zhHK.js +0 -100
  691. package/legacy/models/adapters.js +0 -1
  692. package/legacy/models/common.js +0 -1
  693. package/legacy/models/fields.js +0 -1
  694. package/legacy/models/index.js +0 -7
  695. package/legacy/models/pickers.js +0 -1
  696. package/legacy/models/timezone.js +0 -1
  697. package/legacy/models/validation.js +0 -1
  698. package/legacy/models/views.js +0 -1
  699. package/legacy/themeAugmentation/index.js +0 -3
  700. package/legacy/timeViewRenderers/index.js +0 -1
  701. package/legacy/timeViewRenderers/timeViewRenderers.js +0 -186
@@ -1,277 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import * as React from 'react';
4
- import useEventCallback from '@mui/utils/useEventCallback';
5
- import { useUtils } from '../useUtils';
6
- import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions, applyLocalizedDigits, removeLocalizedDigits, isStringNumber } from './useField.utils';
7
-
8
- /**
9
- * The letter editing and the numeric editing each define a `CharacterEditingApplier`.
10
- * This function decides what the new section value should be and if the focus should switch to the next section.
11
- *
12
- * If it returns `null`, then the section value is not updated and the focus does not move.
13
- */
14
-
15
- /**
16
- * Function called by `applyQuery` which decides:
17
- * - what is the new section value ?
18
- * - should the query used to get this value be stored for the next key press ?
19
- *
20
- * If it returns `{ sectionValue: string; shouldGoToNextSection: boolean }`,
21
- * Then we store the query and update the section with the new value.
22
- *
23
- * If it returns `{ saveQuery: true` },
24
- * Then we store the query and don't update the section.
25
- *
26
- * If it returns `{ saveQuery: false },
27
- * Then we do nothing.
28
- */
29
-
30
- var QUERY_LIFE_DURATION_MS = 5000;
31
- var isQueryResponseWithoutValue = function isQueryResponseWithoutValue(response) {
32
- return response.saveQuery != null;
33
- };
34
-
35
- /**
36
- * Update the active section value when the user pressed a key that is not a navigation key (arrow key for example).
37
- * This hook has two main editing behaviors
38
- *
39
- * 1. The numeric editing when the user presses a digit
40
- * 2. The letter editing when the user presses another key
41
- */
42
- export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
43
- var sections = _ref.sections,
44
- updateSectionValue = _ref.updateSectionValue,
45
- sectionsValueBoundaries = _ref.sectionsValueBoundaries,
46
- localizedDigits = _ref.localizedDigits,
47
- setTempAndroidValueStr = _ref.setTempAndroidValueStr,
48
- timezone = _ref.timezone;
49
- var utils = useUtils();
50
- var _React$useState = React.useState(null),
51
- _React$useState2 = _slicedToArray(_React$useState, 2),
52
- query = _React$useState2[0],
53
- setQuery = _React$useState2[1];
54
- var resetQuery = useEventCallback(function () {
55
- return setQuery(null);
56
- });
57
- React.useEffect(function () {
58
- var _sections$query$secti;
59
- if (query != null && ((_sections$query$secti = sections[query.sectionIndex]) == null ? void 0 : _sections$query$secti.type) !== query.sectionType) {
60
- resetQuery();
61
- }
62
- }, [sections, query, resetQuery]);
63
- React.useEffect(function () {
64
- if (query != null) {
65
- var timeout = setTimeout(function () {
66
- return resetQuery();
67
- }, QUERY_LIFE_DURATION_MS);
68
- return function () {
69
- window.clearTimeout(timeout);
70
- };
71
- }
72
- return function () {};
73
- }, [query, resetQuery]);
74
- var applyQuery = function applyQuery(_ref2, getFirstSectionValueMatchingWithQuery, isValidQueryValue) {
75
- var keyPressed = _ref2.keyPressed,
76
- sectionIndex = _ref2.sectionIndex;
77
- var cleanKeyPressed = keyPressed.toLowerCase();
78
- var activeSection = sections[sectionIndex];
79
-
80
- // The current query targets the section being editing
81
- // We can try to concatenate the value
82
- if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
83
- var concatenatedQueryValue = "".concat(query.value).concat(cleanKeyPressed);
84
- var _queryResponse = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
85
- if (!isQueryResponseWithoutValue(_queryResponse)) {
86
- setQuery({
87
- sectionIndex: sectionIndex,
88
- value: concatenatedQueryValue,
89
- sectionType: activeSection.type
90
- });
91
- return _queryResponse;
92
- }
93
- }
94
- var queryResponse = getFirstSectionValueMatchingWithQuery(cleanKeyPressed, activeSection);
95
- if (isQueryResponseWithoutValue(queryResponse) && !queryResponse.saveQuery) {
96
- resetQuery();
97
- return null;
98
- }
99
- setQuery({
100
- sectionIndex: sectionIndex,
101
- value: cleanKeyPressed,
102
- sectionType: activeSection.type
103
- });
104
- if (isQueryResponseWithoutValue(queryResponse)) {
105
- return null;
106
- }
107
- return queryResponse;
108
- };
109
- var applyLetterEditing = function applyLetterEditing(params) {
110
- var findMatchingOptions = function findMatchingOptions(format, options, queryValue) {
111
- var matchingValues = options.filter(function (option) {
112
- return option.toLowerCase().startsWith(queryValue);
113
- });
114
- if (matchingValues.length === 0) {
115
- return {
116
- saveQuery: false
117
- };
118
- }
119
- return {
120
- sectionValue: matchingValues[0],
121
- shouldGoToNextSection: matchingValues.length === 1
122
- };
123
- };
124
- var testQueryOnFormatAndFallbackFormat = function testQueryOnFormatAndFallbackFormat(queryValue, activeSection, fallbackFormat, formatFallbackValue) {
125
- var getOptions = function getOptions(format) {
126
- return getLetterEditingOptions(utils, timezone, activeSection.type, format);
127
- };
128
- if (activeSection.contentType === 'letter') {
129
- return findMatchingOptions(activeSection.format, getOptions(activeSection.format), queryValue);
130
- }
131
-
132
- // When editing a digit-format month / weekDay and the user presses a letter,
133
- // We can support the letter editing by using the letter-format month / weekDay and re-formatting the result.
134
- // We just have to make sure that the default month / weekDay format is a letter format,
135
- if (fallbackFormat && formatFallbackValue != null && getDateSectionConfigFromFormatToken(utils, fallbackFormat).contentType === 'letter') {
136
- var _fallbackOptions = getOptions(fallbackFormat);
137
- var response = findMatchingOptions(fallbackFormat, _fallbackOptions, queryValue);
138
- if (isQueryResponseWithoutValue(response)) {
139
- return {
140
- saveQuery: false
141
- };
142
- }
143
- return _extends({}, response, {
144
- sectionValue: formatFallbackValue(response.sectionValue, _fallbackOptions)
145
- });
146
- }
147
- return {
148
- saveQuery: false
149
- };
150
- };
151
- var getFirstSectionValueMatchingWithQuery = function getFirstSectionValueMatchingWithQuery(queryValue, activeSection) {
152
- switch (activeSection.type) {
153
- case 'month':
154
- {
155
- var formatFallbackValue = function formatFallbackValue(fallbackValue) {
156
- return changeSectionValueFormat(utils, fallbackValue, utils.formats.month, activeSection.format);
157
- };
158
- return testQueryOnFormatAndFallbackFormat(queryValue, activeSection, utils.formats.month, formatFallbackValue);
159
- }
160
- case 'weekDay':
161
- {
162
- var _formatFallbackValue = function _formatFallbackValue(fallbackValue, fallbackOptions) {
163
- return fallbackOptions.indexOf(fallbackValue).toString();
164
- };
165
- return testQueryOnFormatAndFallbackFormat(queryValue, activeSection, utils.formats.weekday, _formatFallbackValue);
166
- }
167
- case 'meridiem':
168
- {
169
- return testQueryOnFormatAndFallbackFormat(queryValue, activeSection);
170
- }
171
- default:
172
- {
173
- return {
174
- saveQuery: false
175
- };
176
- }
177
- }
178
- };
179
- return applyQuery(params, getFirstSectionValueMatchingWithQuery);
180
- };
181
- var applyNumericEditing = function applyNumericEditing(params) {
182
- var getNewSectionValue = function getNewSectionValue(queryValue, section) {
183
- var cleanQueryValue = removeLocalizedDigits(queryValue, localizedDigits);
184
- var queryValueNumber = Number(cleanQueryValue);
185
- var sectionBoundaries = sectionsValueBoundaries[section.type]({
186
- currentDate: null,
187
- format: section.format,
188
- contentType: section.contentType
189
- });
190
- if (queryValueNumber > sectionBoundaries.maximum) {
191
- return {
192
- saveQuery: false
193
- };
194
- }
195
-
196
- // If the user types `0` on a month section,
197
- // It is below the minimum, but we want to store the `0` in the query,
198
- // So that when he pressed `1`, it will store `01` and move to the next section.
199
- if (queryValueNumber < sectionBoundaries.minimum) {
200
- return {
201
- saveQuery: true
202
- };
203
- }
204
- var shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
205
- var newSectionValue = cleanDigitSectionValue(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
206
- return {
207
- sectionValue: newSectionValue,
208
- shouldGoToNextSection: shouldGoToNextSection
209
- };
210
- };
211
- var getFirstSectionValueMatchingWithQuery = function getFirstSectionValueMatchingWithQuery(queryValue, activeSection) {
212
- if (activeSection.contentType === 'digit' || activeSection.contentType === 'digit-with-letter') {
213
- return getNewSectionValue(queryValue, activeSection);
214
- }
215
-
216
- // When editing a letter-format month and the user presses a digit,
217
- // We can support the numeric editing by using the digit-format month and re-formatting the result.
218
- if (activeSection.type === 'month') {
219
- var hasLeadingZerosInFormat = doesSectionFormatHaveLeadingZeros(utils, timezone, 'digit', 'month', 'MM');
220
- var response = getNewSectionValue(queryValue, {
221
- type: activeSection.type,
222
- format: 'MM',
223
- hasLeadingZerosInFormat: hasLeadingZerosInFormat,
224
- hasLeadingZerosInInput: true,
225
- contentType: 'digit',
226
- maxLength: 2
227
- });
228
- if (isQueryResponseWithoutValue(response)) {
229
- return response;
230
- }
231
- var formattedValue = changeSectionValueFormat(utils, response.sectionValue, 'MM', activeSection.format);
232
- return _extends({}, response, {
233
- sectionValue: formattedValue
234
- });
235
- }
236
-
237
- // When editing a letter-format weekDay and the user presses a digit,
238
- // We can support the numeric editing by returning the nth day in the week day array.
239
- if (activeSection.type === 'weekDay') {
240
- var _response = getNewSectionValue(queryValue, activeSection);
241
- if (isQueryResponseWithoutValue(_response)) {
242
- return _response;
243
- }
244
- var _formattedValue = getDaysInWeekStr(utils, timezone, activeSection.format)[Number(_response.sectionValue) - 1];
245
- return _extends({}, _response, {
246
- sectionValue: _formattedValue
247
- });
248
- }
249
- return {
250
- saveQuery: false
251
- };
252
- };
253
- return applyQuery(params, getFirstSectionValueMatchingWithQuery, function (queryValue) {
254
- return isStringNumber(queryValue, localizedDigits);
255
- });
256
- };
257
- var applyCharacterEditing = useEventCallback(function (params) {
258
- var activeSection = sections[params.sectionIndex];
259
- var isNumericEditing = isStringNumber(params.keyPressed, localizedDigits);
260
- var response = isNumericEditing ? applyNumericEditing(_extends({}, params, {
261
- keyPressed: applyLocalizedDigits(params.keyPressed, localizedDigits)
262
- })) : applyLetterEditing(params);
263
- if (response == null) {
264
- setTempAndroidValueStr(null);
265
- } else {
266
- updateSectionValue({
267
- activeSection: activeSection,
268
- newSectionValue: response.sectionValue,
269
- shouldGoToNextSection: response.shouldGoToNextSection
270
- });
271
- }
272
- });
273
- return {
274
- applyCharacterEditing: applyCharacterEditing,
275
- resetCharacterQuery: resetQuery
276
- };
277
- };
@@ -1,321 +0,0 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- import * as React from 'react';
5
- import useControlled from '@mui/utils/useControlled';
6
- import { useTheme } from '@mui/material/styles';
7
- import { useUtils, useLocaleText, useLocalizationContext } from '../useUtils';
8
- import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, getLocalizedDigits } from './useField.utils';
9
- import { useValueWithTimezone } from '../useValueWithTimezone';
10
- import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
11
- export var useFieldState = function useFieldState(params) {
12
- var utils = useUtils();
13
- var localeText = useLocaleText();
14
- var adapter = useLocalizationContext();
15
- var theme = useTheme();
16
- var isRTL = theme.direction === 'rtl';
17
- var valueManager = params.valueManager,
18
- fieldValueManager = params.fieldValueManager,
19
- valueType = params.valueType,
20
- validator = params.validator,
21
- internalProps = params.internalProps,
22
- _params$internalProps = params.internalProps,
23
- valueProp = _params$internalProps.value,
24
- defaultValue = _params$internalProps.defaultValue,
25
- referenceDateProp = _params$internalProps.referenceDate,
26
- onChange = _params$internalProps.onChange,
27
- format = _params$internalProps.format,
28
- _params$internalProps2 = _params$internalProps.formatDensity,
29
- formatDensity = _params$internalProps2 === void 0 ? 'dense' : _params$internalProps2,
30
- selectedSectionsProp = _params$internalProps.selectedSections,
31
- onSelectedSectionsChange = _params$internalProps.onSelectedSectionsChange,
32
- _params$internalProps3 = _params$internalProps.shouldRespectLeadingZeros,
33
- shouldRespectLeadingZeros = _params$internalProps3 === void 0 ? false : _params$internalProps3,
34
- timezoneProp = _params$internalProps.timezone;
35
- var _useValueWithTimezone = useValueWithTimezone({
36
- timezone: timezoneProp,
37
- value: valueProp,
38
- defaultValue: defaultValue,
39
- onChange: onChange,
40
- valueManager: valueManager
41
- }),
42
- timezone = _useValueWithTimezone.timezone,
43
- valueFromTheOutside = _useValueWithTimezone.value,
44
- handleValueChange = _useValueWithTimezone.handleValueChange;
45
- var localizedDigits = React.useMemo(function () {
46
- return getLocalizedDigits(utils);
47
- }, [utils]);
48
- var sectionsValueBoundaries = React.useMemo(function () {
49
- return getSectionsBoundaries(utils, localizedDigits, timezone);
50
- }, [utils, localizedDigits, timezone]);
51
- var getSectionsFromValue = React.useCallback(function (value) {
52
- var fallbackSections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
53
- return fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, function (date) {
54
- return splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
55
- });
56
- }, [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
57
- var placeholder = React.useMemo(function () {
58
- return fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL);
59
- }, [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
60
- var _React$useState = React.useState(function () {
61
- var sections = getSectionsFromValue(valueFromTheOutside);
62
- validateSections(sections, valueType);
63
- var stateWithoutReferenceDate = {
64
- sections: sections,
65
- value: valueFromTheOutside,
66
- referenceValue: valueManager.emptyValue,
67
- tempValueStrAndroid: null
68
- };
69
- var granularity = getSectionTypeGranularity(sections);
70
- var referenceValue = valueManager.getInitialReferenceValue({
71
- referenceDate: referenceDateProp,
72
- value: valueFromTheOutside,
73
- utils: utils,
74
- props: internalProps,
75
- granularity: granularity,
76
- timezone: timezone
77
- });
78
- return _extends({}, stateWithoutReferenceDate, {
79
- referenceValue: referenceValue
80
- });
81
- }),
82
- _React$useState2 = _slicedToArray(_React$useState, 2),
83
- state = _React$useState2[0],
84
- setState = _React$useState2[1];
85
- var _useControlled = useControlled({
86
- controlled: selectedSectionsProp,
87
- default: null,
88
- name: 'useField',
89
- state: 'selectedSectionIndexes'
90
- }),
91
- _useControlled2 = _slicedToArray(_useControlled, 2),
92
- selectedSections = _useControlled2[0],
93
- innerSetSelectedSections = _useControlled2[1];
94
- var setSelectedSections = function setSelectedSections(newSelectedSections) {
95
- innerSetSelectedSections(newSelectedSections);
96
- onSelectedSectionsChange == null || onSelectedSectionsChange(newSelectedSections);
97
- setState(function (prevState) {
98
- return _extends({}, prevState, {
99
- selectedSectionQuery: null
100
- });
101
- });
102
- };
103
- var selectedSectionIndexes = React.useMemo(function () {
104
- if (selectedSections == null) {
105
- return null;
106
- }
107
- if (selectedSections === 'all') {
108
- return {
109
- startIndex: 0,
110
- endIndex: state.sections.length - 1,
111
- shouldSelectBoundarySelectors: true
112
- };
113
- }
114
- if (typeof selectedSections === 'number') {
115
- return {
116
- startIndex: selectedSections,
117
- endIndex: selectedSections,
118
- shouldSelectBoundarySelectors: state.sections[selectedSections].type === 'empty'
119
- };
120
- }
121
- if (typeof selectedSections === 'string') {
122
- var selectedSectionIndex = state.sections.findIndex(function (section) {
123
- return section.type === selectedSections;
124
- });
125
- return {
126
- startIndex: selectedSectionIndex,
127
- endIndex: selectedSectionIndex,
128
- shouldSelectBoundarySelectors: state.sections[selectedSectionIndex].type === 'empty'
129
- };
130
- }
131
- return _extends({}, selectedSections, {
132
- shouldSelectBoundarySelectors: selectedSections.startIndex === selectedSections.endIndex && state.sections[selectedSections.startIndex].type === 'empty'
133
- });
134
- }, [selectedSections, state.sections]);
135
- var publishValue = function publishValue(_ref) {
136
- var value = _ref.value,
137
- referenceValue = _ref.referenceValue,
138
- sections = _ref.sections;
139
- setState(function (prevState) {
140
- return _extends({}, prevState, {
141
- sections: sections,
142
- value: value,
143
- referenceValue: referenceValue,
144
- tempValueStrAndroid: null
145
- });
146
- });
147
- if (valueManager.areValuesEqual(utils, state.value, value)) {
148
- return;
149
- }
150
- var context = {
151
- validationError: validator({
152
- adapter: adapter,
153
- value: value,
154
- props: _extends({}, internalProps, {
155
- value: value,
156
- timezone: timezone
157
- })
158
- })
159
- };
160
- handleValueChange(value, context);
161
- };
162
- var setSectionValue = function setSectionValue(sectionIndex, newSectionValue) {
163
- var newSections = _toConsumableArray(state.sections);
164
- newSections[sectionIndex] = _extends({}, newSections[sectionIndex], {
165
- value: newSectionValue,
166
- modified: true
167
- });
168
- return addPositionPropertiesToSections(newSections, localizedDigits, isRTL);
169
- };
170
- var clearValue = function clearValue() {
171
- publishValue({
172
- value: valueManager.emptyValue,
173
- referenceValue: state.referenceValue,
174
- sections: getSectionsFromValue(valueManager.emptyValue)
175
- });
176
- };
177
- var clearActiveSection = function clearActiveSection() {
178
- if (selectedSectionIndexes == null) {
179
- return;
180
- }
181
- var activeSection = state.sections[selectedSectionIndexes.startIndex];
182
- var activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
183
- var nonEmptySectionCountBefore = activeDateManager.getSections(state.sections).filter(function (section) {
184
- return section.value !== '';
185
- }).length;
186
- var hasNoOtherNonEmptySections = nonEmptySectionCountBefore === (activeSection.value === '' ? 0 : 1);
187
- var newSections = setSectionValue(selectedSectionIndexes.startIndex, '');
188
- var newActiveDate = hasNoOtherNonEmptySections ? null : utils.getInvalidDate();
189
- var newValues = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
190
- if ((newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date))) {
191
- publishValue(_extends({}, newValues, {
192
- sections: newSections
193
- }));
194
- } else {
195
- setState(function (prevState) {
196
- return _extends({}, prevState, newValues, {
197
- sections: newSections,
198
- tempValueStrAndroid: null
199
- });
200
- });
201
- }
202
- };
203
- var updateValueFromValueStr = function updateValueFromValueStr(valueStr) {
204
- var parseDateStr = function parseDateStr(dateStr, referenceDate) {
205
- var date = utils.parse(dateStr, format);
206
- if (date == null || !utils.isValid(date)) {
207
- return null;
208
- }
209
- var sections = splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
210
- return mergeDateIntoReferenceDate(utils, timezone, date, sections, referenceDate, false);
211
- };
212
- var newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
213
- var newReferenceValue = fieldValueManager.updateReferenceValue(utils, newValue, state.referenceValue);
214
- publishValue({
215
- value: newValue,
216
- referenceValue: newReferenceValue,
217
- sections: getSectionsFromValue(newValue, state.sections)
218
- });
219
- };
220
- var updateSectionValue = function updateSectionValue(_ref2) {
221
- var activeSection = _ref2.activeSection,
222
- newSectionValue = _ref2.newSectionValue,
223
- shouldGoToNextSection = _ref2.shouldGoToNextSection;
224
- /**
225
- * 1. Decide which section should be focused
226
- */
227
- if (shouldGoToNextSection && selectedSectionIndexes && selectedSectionIndexes.startIndex < state.sections.length - 1) {
228
- setSelectedSections(selectedSectionIndexes.startIndex + 1);
229
- } else if (selectedSectionIndexes && selectedSectionIndexes.startIndex !== selectedSectionIndexes.endIndex) {
230
- setSelectedSections(selectedSectionIndexes.startIndex);
231
- }
232
-
233
- /**
234
- * 2. Try to build a valid date from the new section value
235
- */
236
- var activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
237
- var newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
238
- var newActiveDateSections = activeDateManager.getSections(newSections);
239
- var newActiveDate = getDateFromDateSections(utils, newActiveDateSections, localizedDigits);
240
- var values;
241
- var shouldPublish;
242
-
243
- /**
244
- * If the new date is valid,
245
- * Then we merge the value of the modified sections into the reference date.
246
- * This makes sure that we don't lose some information of the initial date (like the time on a date field).
247
- */
248
- if (newActiveDate != null && utils.isValid(newActiveDate)) {
249
- var mergedDate = mergeDateIntoReferenceDate(utils, timezone, newActiveDate, newActiveDateSections, activeDateManager.referenceDate, true);
250
- values = activeDateManager.getNewValuesFromNewActiveDate(mergedDate);
251
- shouldPublish = true;
252
- } else {
253
- values = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
254
- shouldPublish = (newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date));
255
- }
256
-
257
- /**
258
- * Publish or update the internal state with the new value and sections.
259
- */
260
- if (shouldPublish) {
261
- return publishValue(_extends({}, values, {
262
- sections: newSections
263
- }));
264
- }
265
- return setState(function (prevState) {
266
- return _extends({}, prevState, values, {
267
- sections: newSections,
268
- tempValueStrAndroid: null
269
- });
270
- });
271
- };
272
- var setTempAndroidValueStr = function setTempAndroidValueStr(tempValueStrAndroid) {
273
- return setState(function (prev) {
274
- return _extends({}, prev, {
275
- tempValueStrAndroid: tempValueStrAndroid
276
- });
277
- });
278
- };
279
- React.useEffect(function () {
280
- var sections = getSectionsFromValue(state.value);
281
- validateSections(sections, valueType);
282
- setState(function (prevState) {
283
- return _extends({}, prevState, {
284
- sections: sections
285
- });
286
- });
287
- }, [format, utils.locale]); // eslint-disable-line react-hooks/exhaustive-deps
288
-
289
- React.useEffect(function () {
290
- var shouldUpdate;
291
- if (!valueManager.areValuesEqual(utils, state.value, valueFromTheOutside)) {
292
- shouldUpdate = true;
293
- } else {
294
- shouldUpdate = valueManager.getTimezone(utils, state.value) !== valueManager.getTimezone(utils, valueFromTheOutside);
295
- }
296
- if (shouldUpdate) {
297
- setState(function (prevState) {
298
- return _extends({}, prevState, {
299
- value: valueFromTheOutside,
300
- referenceValue: fieldValueManager.updateReferenceValue(utils, valueFromTheOutside, prevState.referenceValue),
301
- sections: getSectionsFromValue(valueFromTheOutside)
302
- });
303
- });
304
- }
305
- }, [valueFromTheOutside]); // eslint-disable-line react-hooks/exhaustive-deps
306
-
307
- return {
308
- state: state,
309
- selectedSectionIndexes: selectedSectionIndexes,
310
- setSelectedSections: setSelectedSections,
311
- clearValue: clearValue,
312
- clearActiveSection: clearActiveSection,
313
- updateSectionValue: updateSectionValue,
314
- updateValueFromValueStr: updateValueFromValueStr,
315
- setTempAndroidValueStr: setTempAndroidValueStr,
316
- sectionsValueBoundaries: sectionsValueBoundaries,
317
- localizedDigits: localizedDigits,
318
- placeholder: placeholder,
319
- timezone: timezone
320
- };
321
- };
@@ -1,39 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import * as React from 'react';
3
- import { unstable_useEnhancedEffect as useEnhancedEffect } from '@mui/utils';
4
- import { arrayIncludes } from '../utils/utils';
5
- function getOrientation() {
6
- if (typeof window === 'undefined') {
7
- return 'portrait';
8
- }
9
- if (window.screen && window.screen.orientation && window.screen.orientation.angle) {
10
- return Math.abs(window.screen.orientation.angle) === 90 ? 'landscape' : 'portrait';
11
- }
12
-
13
- // Support IOS safari
14
- if (window.orientation) {
15
- return Math.abs(Number(window.orientation)) === 90 ? 'landscape' : 'portrait';
16
- }
17
- return 'portrait';
18
- }
19
- export var useIsLandscape = function useIsLandscape(views, customOrientation) {
20
- var _React$useState = React.useState(getOrientation),
21
- _React$useState2 = _slicedToArray(_React$useState, 2),
22
- orientation = _React$useState2[0],
23
- setOrientation = _React$useState2[1];
24
- useEnhancedEffect(function () {
25
- var eventHandler = function eventHandler() {
26
- setOrientation(getOrientation());
27
- };
28
- window.addEventListener('orientationchange', eventHandler);
29
- return function () {
30
- window.removeEventListener('orientationchange', eventHandler);
31
- };
32
- }, []);
33
- if (arrayIncludes(views, ['hours', 'minutes', 'seconds'])) {
34
- // could not display 13:34:44 in landscape mode
35
- return false;
36
- }
37
- var orientationToUse = customOrientation || orientation;
38
- return orientationToUse === 'landscape';
39
- };
@@ -1 +0,0 @@
1
- export { useMobilePicker } from './useMobilePicker';