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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (710) 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 +429 -30
  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 +14 -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 +4 -4
  43. package/DateTimePicker/DateTimePickerToolbar.js +6 -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/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
  64. package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +6 -4
  65. package/PickersLayout/PickersLayout.js +6 -0
  66. package/PickersLayout/PickersLayout.types.d.ts +6 -0
  67. package/PickersSectionList/PickersSectionList.d.ts +4 -4
  68. package/PickersSectionList/PickersSectionList.js +1 -2
  69. package/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
  70. package/PickersTextField/PickersInput/PickersInput.js +3 -3
  71. package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +1 -1
  72. package/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
  73. package/PickersTextField/PickersInputBase/PickersInputBase.types.d.ts +1 -0
  74. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
  75. package/PickersTextField/PickersTextField.d.ts +1 -1
  76. package/PickersTextField/PickersTextField.js +9 -5
  77. package/StaticDatePicker/StaticDatePicker.js +0 -1
  78. package/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  79. package/TimeField/TimeField.d.ts +1 -1
  80. package/TimeField/TimeField.js +11 -9
  81. package/TimeField/TimeField.types.d.ts +12 -15
  82. package/TimeField/index.d.ts +1 -1
  83. package/TimeField/useTimeField.d.ts +2 -2
  84. package/TimeField/useTimeField.js +1 -13
  85. package/TimePicker/TimePicker.d.ts +1 -1
  86. package/TimePicker/TimePicker.js +9 -8
  87. package/TimePicker/TimePicker.types.d.ts +3 -3
  88. package/TimePicker/TimePickerToolbar.d.ts +5 -4
  89. package/TimePicker/TimePickerToolbar.js +14 -3
  90. package/hooks/index.d.ts +1 -1
  91. package/hooks/useClearableField.d.ts +10 -2
  92. package/index.js +1 -1
  93. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +3 -0
  94. package/internals/components/PickersPopper.d.ts +3 -0
  95. package/internals/components/PickersPopper.js +1 -2
  96. package/internals/components/PickersToolbar.js +13 -9
  97. package/internals/demo/DemoContainer.js +6 -5
  98. package/internals/hooks/defaultizedFieldProps.d.ts +19 -0
  99. package/internals/hooks/defaultizedFieldProps.js +43 -0
  100. package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
  101. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
  102. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -13
  103. package/internals/hooks/useField/buildSectionsFromFormat.d.ts +16 -0
  104. package/internals/hooks/useField/buildSectionsFromFormat.js +251 -0
  105. package/internals/hooks/useField/index.d.ts +2 -2
  106. package/internals/hooks/useField/index.js +1 -1
  107. package/internals/hooks/useField/useField.d.ts +4 -4
  108. package/internals/hooks/useField/useField.js +82 -309
  109. package/internals/hooks/useField/useField.types.d.ts +92 -56
  110. package/internals/hooks/useField/useField.utils.d.ts +10 -10
  111. package/internals/hooks/useField/useField.utils.js +78 -228
  112. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +7 -6
  113. package/internals/hooks/useField/useFieldCharacterEditing.js +7 -7
  114. package/internals/hooks/useField/useFieldState.d.ts +13 -11
  115. package/internals/hooks/useField/useFieldState.js +45 -61
  116. package/internals/hooks/useField/useFieldV6TextField.d.ts +25 -0
  117. package/internals/hooks/useField/useFieldV6TextField.js +326 -0
  118. package/internals/hooks/useField/useFieldV7TextField.d.ts +2 -0
  119. package/internals/hooks/useField/useFieldV7TextField.js +402 -0
  120. package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
  121. package/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
  122. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +12 -12
  123. package/internals/hooks/usePicker/usePicker.d.ts +1 -1
  124. package/internals/hooks/usePicker/usePicker.js +3 -3
  125. package/internals/hooks/usePicker/usePicker.types.d.ts +2 -2
  126. package/internals/hooks/usePicker/usePickerValue.d.ts +1 -1
  127. package/internals/hooks/usePicker/usePickerValue.js +2 -18
  128. package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -6
  129. package/internals/hooks/usePicker/usePickerViews.d.ts +4 -4
  130. package/internals/hooks/usePicker/usePickerViews.js +5 -6
  131. package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
  132. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +1 -0
  133. package/internals/index.d.ts +5 -4
  134. package/internals/index.js +2 -1
  135. package/internals/models/fields.d.ts +2 -4
  136. package/internals/models/helpers.d.ts +1 -0
  137. package/internals/models/props/basePickerProps.d.ts +2 -7
  138. package/internals/models/props/tabs.d.ts +6 -0
  139. package/internals/models/props/toolbar.d.ts +6 -0
  140. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +1 -1
  141. package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
  142. package/internals/utils/fields.js +1 -1
  143. package/internals/utils/valueManagers.js +5 -4
  144. package/locales/beBY.d.ts +9 -0
  145. package/locales/beBY.js +13 -0
  146. package/locales/caES.d.ts +9 -0
  147. package/locales/caES.js +13 -0
  148. package/locales/csCZ.d.ts +9 -0
  149. package/locales/csCZ.js +13 -0
  150. package/locales/daDK.d.ts +9 -0
  151. package/locales/daDK.js +13 -0
  152. package/locales/deDE.d.ts +9 -0
  153. package/locales/deDE.js +13 -0
  154. package/locales/elGR.d.ts +9 -0
  155. package/locales/elGR.js +13 -0
  156. package/locales/enUS.d.ts +9 -0
  157. package/locales/enUS.js +12 -1
  158. package/locales/esES.d.ts +9 -0
  159. package/locales/esES.js +13 -0
  160. package/locales/eu.d.ts +9 -0
  161. package/locales/eu.js +13 -0
  162. package/locales/faIR.d.ts +9 -0
  163. package/locales/faIR.js +13 -0
  164. package/locales/fiFI.d.ts +9 -0
  165. package/locales/fiFI.js +13 -0
  166. package/locales/frFR.d.ts +9 -0
  167. package/locales/frFR.js +13 -0
  168. package/locales/heIL.d.ts +9 -0
  169. package/locales/heIL.js +13 -0
  170. package/locales/huHU.d.ts +9 -0
  171. package/locales/huHU.js +13 -0
  172. package/locales/isIS.d.ts +9 -0
  173. package/locales/isIS.js +13 -0
  174. package/locales/itIT.d.ts +9 -0
  175. package/locales/itIT.js +13 -0
  176. package/locales/jaJP.d.ts +9 -0
  177. package/locales/jaJP.js +13 -0
  178. package/locales/koKR.d.ts +9 -0
  179. package/locales/koKR.js +14 -2
  180. package/locales/kzKZ.d.ts +9 -0
  181. package/locales/kzKZ.js +13 -0
  182. package/locales/mk.d.ts +9 -0
  183. package/locales/mk.js +13 -0
  184. package/locales/nbNO.d.ts +9 -0
  185. package/locales/nbNO.js +13 -0
  186. package/locales/nlNL.d.ts +9 -0
  187. package/locales/nlNL.js +13 -0
  188. package/locales/plPL.d.ts +9 -0
  189. package/locales/plPL.js +13 -0
  190. package/locales/ptBR.d.ts +9 -0
  191. package/locales/ptBR.js +13 -0
  192. package/locales/roRO.d.ts +9 -0
  193. package/locales/roRO.js +13 -0
  194. package/locales/ruRU.d.ts +9 -0
  195. package/locales/ruRU.js +13 -0
  196. package/locales/skSK.d.ts +9 -0
  197. package/locales/skSK.js +13 -0
  198. package/locales/svSE.d.ts +9 -0
  199. package/locales/svSE.js +13 -0
  200. package/locales/trTR.d.ts +9 -0
  201. package/locales/trTR.js +13 -0
  202. package/locales/ukUA.d.ts +9 -0
  203. package/locales/ukUA.js +13 -0
  204. package/locales/urPK.d.ts +9 -0
  205. package/locales/urPK.js +13 -0
  206. package/locales/utils/getPickersLocalization.d.ts +9 -0
  207. package/locales/utils/pickersLocaleTextApi.d.ts +9 -0
  208. package/locales/viVN.d.ts +9 -0
  209. package/locales/viVN.js +13 -0
  210. package/locales/zhCN.d.ts +9 -0
  211. package/locales/zhCN.js +18 -9
  212. package/locales/zhHK.d.ts +9 -0
  213. package/locales/zhHK.js +13 -0
  214. package/models/adapters.d.ts +13 -0
  215. package/models/fields.d.ts +47 -32
  216. package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
  217. package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
  218. package/modern/AdapterDayjs/AdapterDayjs.js +6 -0
  219. package/modern/AdapterLuxon/AdapterLuxon.js +6 -0
  220. package/modern/AdapterMoment/AdapterMoment.js +4 -0
  221. package/modern/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
  222. package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
  223. package/modern/DateCalendar/DateCalendar.js +3 -1
  224. package/modern/DateCalendar/DayCalendar.js +1 -1
  225. package/modern/DateField/DateField.js +11 -9
  226. package/modern/DateField/useDateField.js +1 -14
  227. package/modern/DatePicker/DatePicker.js +9 -9
  228. package/modern/DatePicker/DatePickerToolbar.js +14 -3
  229. package/modern/DateTimeField/DateTimeField.js +11 -9
  230. package/modern/DateTimeField/useDateTimeField.js +1 -19
  231. package/modern/DateTimePicker/DateTimePicker.js +9 -9
  232. package/modern/DateTimePicker/DateTimePickerTabs.js +7 -1
  233. package/modern/DateTimePicker/DateTimePickerToolbar.js +6 -0
  234. package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -9
  235. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
  236. package/modern/DesktopTimePicker/DesktopTimePicker.js +9 -8
  237. package/modern/LocalizationProvider/LocalizationProvider.js +1 -0
  238. package/modern/MobileDatePicker/MobileDatePicker.js +9 -9
  239. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
  240. package/modern/MobileTimePicker/MobileTimePicker.js +9 -8
  241. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
  242. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +5 -3
  243. package/modern/PickersLayout/PickersLayout.js +6 -0
  244. package/modern/PickersSectionList/PickersSectionList.js +1 -2
  245. package/modern/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
  246. package/modern/PickersTextField/PickersInput/PickersInput.js +3 -3
  247. package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
  248. package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
  249. package/modern/PickersTextField/PickersTextField.js +9 -5
  250. package/modern/StaticDatePicker/StaticDatePicker.js +0 -1
  251. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  252. package/modern/TimeField/TimeField.js +11 -9
  253. package/modern/TimeField/useTimeField.js +1 -12
  254. package/modern/TimePicker/TimePicker.js +9 -8
  255. package/modern/TimePicker/TimePickerToolbar.js +14 -3
  256. package/modern/index.js +1 -1
  257. package/modern/internals/components/PickersPopper.js +1 -2
  258. package/modern/internals/components/PickersToolbar.js +13 -9
  259. package/modern/internals/demo/DemoContainer.js +6 -5
  260. package/modern/internals/hooks/defaultizedFieldProps.js +40 -0
  261. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
  262. package/modern/internals/hooks/useField/buildSectionsFromFormat.js +251 -0
  263. package/modern/internals/hooks/useField/index.js +1 -1
  264. package/modern/internals/hooks/useField/useField.js +82 -303
  265. package/modern/internals/hooks/useField/useField.utils.js +78 -228
  266. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +7 -7
  267. package/modern/internals/hooks/useField/useFieldState.js +45 -61
  268. package/modern/internals/hooks/useField/useFieldV6TextField.js +320 -0
  269. package/modern/internals/hooks/useField/useFieldV7TextField.js +400 -0
  270. package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
  271. package/modern/internals/hooks/usePicker/usePicker.js +3 -3
  272. package/modern/internals/hooks/usePicker/usePickerValue.js +2 -18
  273. package/modern/internals/hooks/usePicker/usePickerViews.js +4 -6
  274. package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
  275. package/modern/internals/index.js +2 -1
  276. package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
  277. package/modern/internals/utils/fields.js +1 -1
  278. package/modern/internals/utils/valueManagers.js +5 -4
  279. package/modern/locales/beBY.js +13 -0
  280. package/modern/locales/caES.js +13 -0
  281. package/modern/locales/csCZ.js +13 -0
  282. package/modern/locales/daDK.js +13 -0
  283. package/modern/locales/deDE.js +13 -0
  284. package/modern/locales/elGR.js +13 -0
  285. package/modern/locales/enUS.js +12 -1
  286. package/modern/locales/esES.js +13 -0
  287. package/modern/locales/eu.js +13 -0
  288. package/modern/locales/faIR.js +13 -0
  289. package/modern/locales/fiFI.js +13 -0
  290. package/modern/locales/frFR.js +13 -0
  291. package/modern/locales/heIL.js +13 -0
  292. package/modern/locales/huHU.js +13 -0
  293. package/modern/locales/isIS.js +13 -0
  294. package/modern/locales/itIT.js +13 -0
  295. package/modern/locales/jaJP.js +13 -0
  296. package/modern/locales/koKR.js +14 -2
  297. package/modern/locales/kzKZ.js +13 -0
  298. package/modern/locales/mk.js +13 -0
  299. package/modern/locales/nbNO.js +13 -0
  300. package/modern/locales/nlNL.js +13 -0
  301. package/modern/locales/plPL.js +13 -0
  302. package/modern/locales/ptBR.js +13 -0
  303. package/modern/locales/roRO.js +13 -0
  304. package/modern/locales/ruRU.js +13 -0
  305. package/modern/locales/skSK.js +13 -0
  306. package/modern/locales/svSE.js +13 -0
  307. package/modern/locales/trTR.js +13 -0
  308. package/modern/locales/ukUA.js +13 -0
  309. package/modern/locales/urPK.js +13 -0
  310. package/modern/locales/viVN.js +13 -0
  311. package/modern/locales/zhCN.js +18 -9
  312. package/modern/locales/zhHK.js +13 -0
  313. package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +4 -0
  314. package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +4 -0
  315. package/node/AdapterDayjs/AdapterDayjs.js +6 -0
  316. package/node/AdapterLuxon/AdapterLuxon.js +6 -0
  317. package/node/AdapterMoment/AdapterMoment.js +4 -0
  318. package/node/AdapterMomentHijri/AdapterMomentHijri.js +3 -0
  319. package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +3 -0
  320. package/node/DateCalendar/DateCalendar.js +3 -1
  321. package/node/DateCalendar/DayCalendar.js +1 -1
  322. package/node/DateField/DateField.js +11 -9
  323. package/node/DateField/useDateField.js +2 -16
  324. package/node/DatePicker/DatePicker.js +9 -9
  325. package/node/DatePicker/DatePickerToolbar.js +14 -3
  326. package/node/DateTimeField/DateTimeField.js +11 -9
  327. package/node/DateTimeField/useDateTimeField.js +2 -21
  328. package/node/DateTimePicker/DateTimePicker.js +9 -9
  329. package/node/DateTimePicker/DateTimePickerTabs.js +7 -1
  330. package/node/DateTimePicker/DateTimePickerToolbar.js +6 -0
  331. package/node/DesktopDatePicker/DesktopDatePicker.js +9 -9
  332. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -9
  333. package/node/DesktopTimePicker/DesktopTimePicker.js +9 -8
  334. package/node/LocalizationProvider/LocalizationProvider.js +1 -0
  335. package/node/MobileDatePicker/MobileDatePicker.js +9 -9
  336. package/node/MobileDateTimePicker/MobileDateTimePicker.js +9 -9
  337. package/node/MobileTimePicker/MobileTimePicker.js +9 -8
  338. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +4 -4
  339. package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +5 -3
  340. package/node/PickersLayout/PickersLayout.js +6 -0
  341. package/node/PickersSectionList/PickersSectionList.js +4 -5
  342. package/node/PickersTextField/PickersFilledInput/PickersFilledInput.js +3 -3
  343. package/node/PickersTextField/PickersInput/PickersInput.js +3 -3
  344. package/node/PickersTextField/PickersInputBase/PickersInputBase.js +11 -5
  345. package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +3 -3
  346. package/node/PickersTextField/PickersTextField.js +9 -5
  347. package/node/StaticDatePicker/StaticDatePicker.js +0 -1
  348. package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -1
  349. package/node/TimeField/TimeField.js +11 -9
  350. package/node/TimeField/useTimeField.js +2 -14
  351. package/node/TimePicker/TimePicker.js +9 -8
  352. package/node/TimePicker/TimePickerToolbar.js +14 -3
  353. package/node/index.js +1 -1
  354. package/node/internals/components/PickersPopper.js +1 -2
  355. package/node/internals/components/PickersToolbar.js +13 -9
  356. package/node/internals/demo/DemoContainer.js +6 -5
  357. package/node/internals/hooks/defaultizedFieldProps.js +50 -0
  358. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -5
  359. package/node/internals/hooks/useField/buildSectionsFromFormat.js +259 -0
  360. package/node/internals/hooks/useField/index.js +4 -10
  361. package/node/internals/hooks/useField/useField.js +81 -302
  362. package/node/internals/hooks/useField/useField.utils.js +86 -236
  363. package/node/internals/hooks/useField/useFieldCharacterEditing.js +7 -7
  364. package/node/internals/hooks/useField/useFieldState.js +44 -60
  365. package/node/internals/hooks/useField/useFieldV6TextField.js +331 -0
  366. package/node/internals/hooks/useField/useFieldV7TextField.js +410 -0
  367. package/node/internals/hooks/useMobilePicker/useMobilePicker.js +13 -5
  368. package/node/internals/hooks/usePicker/usePicker.js +3 -3
  369. package/node/internals/hooks/usePicker/usePickerValue.js +2 -18
  370. package/node/internals/hooks/usePicker/usePickerViews.js +4 -6
  371. package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -0
  372. package/node/internals/index.js +27 -8
  373. package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +21 -3
  374. package/node/internals/utils/fields.js +1 -1
  375. package/node/internals/utils/valueManagers.js +4 -3
  376. package/node/locales/beBY.js +13 -0
  377. package/node/locales/caES.js +13 -0
  378. package/node/locales/csCZ.js +13 -0
  379. package/node/locales/daDK.js +13 -0
  380. package/node/locales/deDE.js +13 -0
  381. package/node/locales/elGR.js +13 -0
  382. package/node/locales/enUS.js +12 -1
  383. package/node/locales/esES.js +13 -0
  384. package/node/locales/eu.js +13 -0
  385. package/node/locales/faIR.js +13 -0
  386. package/node/locales/fiFI.js +13 -0
  387. package/node/locales/frFR.js +13 -0
  388. package/node/locales/heIL.js +13 -0
  389. package/node/locales/huHU.js +13 -0
  390. package/node/locales/isIS.js +13 -0
  391. package/node/locales/itIT.js +13 -0
  392. package/node/locales/jaJP.js +13 -0
  393. package/node/locales/koKR.js +14 -2
  394. package/node/locales/kzKZ.js +13 -0
  395. package/node/locales/mk.js +13 -0
  396. package/node/locales/nbNO.js +13 -0
  397. package/node/locales/nlNL.js +13 -0
  398. package/node/locales/plPL.js +13 -0
  399. package/node/locales/ptBR.js +13 -0
  400. package/node/locales/roRO.js +13 -0
  401. package/node/locales/ruRU.js +13 -0
  402. package/node/locales/skSK.js +13 -0
  403. package/node/locales/svSE.js +13 -0
  404. package/node/locales/trTR.js +13 -0
  405. package/node/locales/ukUA.js +13 -0
  406. package/node/locales/urPK.js +13 -0
  407. package/node/locales/viVN.js +13 -0
  408. package/node/locales/zhCN.js +18 -9
  409. package/node/locales/zhHK.js +13 -0
  410. package/package.json +4 -4
  411. package/themeAugmentation/props.d.ts +12 -13
  412. package/timeViewRenderers/timeViewRenderers.d.ts +1 -1
  413. package/legacy/AdapterDateFns/AdapterDateFns.js +0 -298
  414. package/legacy/AdapterDateFns/index.js +0 -1
  415. package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +0 -293
  416. package/legacy/AdapterDateFnsBase/index.js +0 -1
  417. package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +0 -547
  418. package/legacy/AdapterDateFnsJalali/index.js +0 -1
  419. package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +0 -306
  420. package/legacy/AdapterDateFnsV3/index.js +0 -1
  421. package/legacy/AdapterDayjs/AdapterDayjs.js +0 -568
  422. package/legacy/AdapterDayjs/index.js +0 -1
  423. package/legacy/AdapterLuxon/AdapterLuxon.js +0 -508
  424. package/legacy/AdapterLuxon/index.js +0 -1
  425. package/legacy/AdapterMoment/AdapterMoment.js +0 -481
  426. package/legacy/AdapterMoment/index.js +0 -1
  427. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +0 -238
  428. package/legacy/AdapterMomentHijri/index.js +0 -1
  429. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -235
  430. package/legacy/AdapterMomentJalaali/index.js +0 -1
  431. package/legacy/DateCalendar/DateCalendar.js +0 -573
  432. package/legacy/DateCalendar/DateCalendar.types.js +0 -1
  433. package/legacy/DateCalendar/DayCalendar.js +0 -515
  434. package/legacy/DateCalendar/PickersFadeTransitionGroup.js +0 -58
  435. package/legacy/DateCalendar/PickersSlideTransition.js +0 -118
  436. package/legacy/DateCalendar/dateCalendarClasses.js +0 -5
  437. package/legacy/DateCalendar/dayCalendarClasses.js +0 -5
  438. package/legacy/DateCalendar/index.js +0 -5
  439. package/legacy/DateCalendar/pickersFadeTransitionGroupClasses.js +0 -5
  440. package/legacy/DateCalendar/pickersSlideTransitionClasses.js +0 -5
  441. package/legacy/DateCalendar/useCalendarState.js +0 -124
  442. package/legacy/DateCalendar/useIsDateDisabled.js +0 -30
  443. package/legacy/DateField/DateField.js +0 -319
  444. package/legacy/DateField/DateField.types.js +0 -1
  445. package/legacy/DateField/index.js +0 -2
  446. package/legacy/DateField/useDateField.js +0 -33
  447. package/legacy/DatePicker/DatePicker.js +0 -353
  448. package/legacy/DatePicker/DatePicker.types.js +0 -1
  449. package/legacy/DatePicker/DatePickerToolbar.js +0 -132
  450. package/legacy/DatePicker/datePickerToolbarClasses.js +0 -5
  451. package/legacy/DatePicker/index.js +0 -3
  452. package/legacy/DatePicker/shared.js +0 -41
  453. package/legacy/DateTimeField/DateTimeField.js +0 -360
  454. package/legacy/DateTimeField/DateTimeField.types.js +0 -1
  455. package/legacy/DateTimeField/index.js +0 -2
  456. package/legacy/DateTimeField/useDateTimeField.js +0 -38
  457. package/legacy/DateTimePicker/DateTimePicker.js +0 -424
  458. package/legacy/DateTimePicker/DateTimePicker.types.js +0 -1
  459. package/legacy/DateTimePicker/DateTimePickerTabs.js +0 -142
  460. package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -385
  461. package/legacy/DateTimePicker/dateTimePickerTabsClasses.js +0 -5
  462. package/legacy/DateTimePicker/dateTimePickerToolbarClasses.js +0 -5
  463. package/legacy/DateTimePicker/index.js +0 -5
  464. package/legacy/DateTimePicker/shared.js +0 -56
  465. package/legacy/DayCalendarSkeleton/DayCalendarSkeleton.js +0 -119
  466. package/legacy/DayCalendarSkeleton/dayCalendarSkeletonClasses.js +0 -5
  467. package/legacy/DayCalendarSkeleton/index.js +0 -2
  468. package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -372
  469. package/legacy/DesktopDatePicker/DesktopDatePicker.types.js +0 -1
  470. package/legacy/DesktopDatePicker/index.js +0 -1
  471. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -480
  472. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.types.js +0 -1
  473. package/legacy/DesktopDateTimePicker/index.js +0 -1
  474. package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -355
  475. package/legacy/DesktopTimePicker/DesktopTimePicker.types.js +0 -1
  476. package/legacy/DesktopTimePicker/index.js +0 -1
  477. package/legacy/DigitalClock/DigitalClock.js +0 -443
  478. package/legacy/DigitalClock/DigitalClock.types.js +0 -1
  479. package/legacy/DigitalClock/digitalClockClasses.js +0 -6
  480. package/legacy/DigitalClock/index.js +0 -2
  481. package/legacy/LocalizationProvider/LocalizationProvider.js +0 -140
  482. package/legacy/LocalizationProvider/index.js +0 -1
  483. package/legacy/MobileDatePicker/MobileDatePicker.js +0 -369
  484. package/legacy/MobileDatePicker/MobileDatePicker.types.js +0 -1
  485. package/legacy/MobileDatePicker/index.js +0 -1
  486. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -428
  487. package/legacy/MobileDateTimePicker/MobileDateTimePicker.types.js +0 -1
  488. package/legacy/MobileDateTimePicker/index.js +0 -1
  489. package/legacy/MobileTimePicker/MobileTimePicker.js +0 -311
  490. package/legacy/MobileTimePicker/MobileTimePicker.types.js +0 -1
  491. package/legacy/MobileTimePicker/index.js +0 -1
  492. package/legacy/MonthCalendar/MonthCalendar.js +0 -338
  493. package/legacy/MonthCalendar/MonthCalendar.types.js +0 -1
  494. package/legacy/MonthCalendar/PickersMonth.js +0 -135
  495. package/legacy/MonthCalendar/index.js +0 -3
  496. package/legacy/MonthCalendar/monthCalendarClasses.js +0 -5
  497. package/legacy/MonthCalendar/pickersMonthClasses.js +0 -5
  498. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +0 -521
  499. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.types.js +0 -1
  500. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +0 -76
  501. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +0 -173
  502. package/legacy/MultiSectionDigitalClock/index.js +0 -3
  503. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +0 -6
  504. package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +0 -6
  505. package/legacy/PickersActionBar/PickersActionBar.js +0 -86
  506. package/legacy/PickersActionBar/index.js +0 -1
  507. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -284
  508. package/legacy/PickersCalendarHeader/PickersCalendarHeader.types.js +0 -1
  509. package/legacy/PickersCalendarHeader/index.js +0 -2
  510. package/legacy/PickersCalendarHeader/pickersCalendarHeaderClasses.js +0 -5
  511. package/legacy/PickersDay/PickersDay.js +0 -367
  512. package/legacy/PickersDay/index.js +0 -2
  513. package/legacy/PickersDay/pickersDayClasses.js +0 -5
  514. package/legacy/PickersLayout/PickersLayout.js +0 -159
  515. package/legacy/PickersLayout/PickersLayout.types.js +0 -1
  516. package/legacy/PickersLayout/index.js +0 -3
  517. package/legacy/PickersLayout/pickersLayoutClasses.js +0 -6
  518. package/legacy/PickersLayout/usePickerLayout.js +0 -134
  519. package/legacy/PickersSectionList/PickersSectionList.js +0 -235
  520. package/legacy/PickersSectionList/PickersSectionList.types.js +0 -1
  521. package/legacy/PickersSectionList/index.js +0 -2
  522. package/legacy/PickersSectionList/pickersSectionListClasses.js +0 -6
  523. package/legacy/PickersShortcuts/PickersShortcuts.js +0 -110
  524. package/legacy/PickersShortcuts/index.js +0 -1
  525. package/legacy/PickersTextField/PickersFilledInput/PickersFilledInput.js +0 -234
  526. package/legacy/PickersTextField/PickersFilledInput/index.js +0 -2
  527. package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +0 -8
  528. package/legacy/PickersTextField/PickersInput/PickersInput.js +0 -190
  529. package/legacy/PickersTextField/PickersInput/index.js +0 -2
  530. package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +0 -8
  531. package/legacy/PickersTextField/PickersInputBase/PickersInputBase.js +0 -340
  532. package/legacy/PickersTextField/PickersInputBase/PickersInputBase.types.js +0 -1
  533. package/legacy/PickersTextField/PickersInputBase/index.js +0 -2
  534. package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +0 -6
  535. package/legacy/PickersTextField/PickersOutlinedInput/Outline.js +0 -121
  536. package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +0 -183
  537. package/legacy/PickersTextField/PickersOutlinedInput/index.js +0 -2
  538. package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +0 -8
  539. package/legacy/PickersTextField/PickersTextField.js +0 -258
  540. package/legacy/PickersTextField/PickersTextField.types.js +0 -1
  541. package/legacy/PickersTextField/index.js +0 -6
  542. package/legacy/PickersTextField/pickersTextFieldClasses.js +0 -6
  543. package/legacy/StaticDatePicker/StaticDatePicker.js +0 -297
  544. package/legacy/StaticDatePicker/StaticDatePicker.types.js +0 -1
  545. package/legacy/StaticDatePicker/index.js +0 -1
  546. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -356
  547. package/legacy/StaticDateTimePicker/StaticDateTimePicker.types.js +0 -1
  548. package/legacy/StaticDateTimePicker/index.js +0 -1
  549. package/legacy/StaticTimePicker/StaticTimePicker.js +0 -238
  550. package/legacy/StaticTimePicker/StaticTimePicker.types.js +0 -1
  551. package/legacy/StaticTimePicker/index.js +0 -1
  552. package/legacy/TimeClock/Clock.js +0 -358
  553. package/legacy/TimeClock/ClockNumber.js +0 -87
  554. package/legacy/TimeClock/ClockNumbers.js +0 -73
  555. package/legacy/TimeClock/ClockPointer.js +0 -106
  556. package/legacy/TimeClock/TimeClock.js +0 -481
  557. package/legacy/TimeClock/TimeClock.types.js +0 -1
  558. package/legacy/TimeClock/clockClasses.js +0 -5
  559. package/legacy/TimeClock/clockNumberClasses.js +0 -5
  560. package/legacy/TimeClock/clockPointerClasses.js +0 -5
  561. package/legacy/TimeClock/index.js +0 -5
  562. package/legacy/TimeClock/shared.js +0 -53
  563. package/legacy/TimeClock/timeClockClasses.js +0 -5
  564. package/legacy/TimeField/TimeField.js +0 -320
  565. package/legacy/TimeField/TimeField.types.js +0 -1
  566. package/legacy/TimeField/index.js +0 -2
  567. package/legacy/TimeField/useTimeField.js +0 -31
  568. package/legacy/TimePicker/TimePicker.js +0 -314
  569. package/legacy/TimePicker/TimePicker.types.js +0 -1
  570. package/legacy/TimePicker/TimePickerToolbar.js +0 -260
  571. package/legacy/TimePicker/index.js +0 -3
  572. package/legacy/TimePicker/shared.js +0 -45
  573. package/legacy/TimePicker/timePickerToolbarClasses.js +0 -5
  574. package/legacy/YearCalendar/PickersYear.js +0 -137
  575. package/legacy/YearCalendar/YearCalendar.js +0 -362
  576. package/legacy/YearCalendar/YearCalendar.types.js +0 -1
  577. package/legacy/YearCalendar/index.js +0 -3
  578. package/legacy/YearCalendar/pickersYearClasses.js +0 -5
  579. package/legacy/YearCalendar/yearCalendarClasses.js +0 -5
  580. package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -162
  581. package/legacy/dateTimeViewRenderers/index.js +0 -1
  582. package/legacy/dateViewRenderers/dateViewRenderers.js +0 -82
  583. package/legacy/dateViewRenderers/index.js +0 -1
  584. package/legacy/hooks/index.js +0 -1
  585. package/legacy/hooks/useClearableField.js +0 -76
  586. package/legacy/icons/index.js +0 -68
  587. package/legacy/index.js +0 -59
  588. package/legacy/internals/components/DateTimeViewWrapper/DateTimeViewWrapper.js +0 -5
  589. package/legacy/internals/components/DateTimeViewWrapper/index.js +0 -1
  590. package/legacy/internals/components/PickerViewRoot/PickerViewRoot.js +0 -10
  591. package/legacy/internals/components/PickerViewRoot/index.js +0 -1
  592. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +0 -170
  593. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.js +0 -1
  594. package/legacy/internals/components/PickersArrowSwitcher/index.js +0 -2
  595. package/legacy/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +0 -5
  596. package/legacy/internals/components/PickersModalDialog.js +0 -42
  597. package/legacy/internals/components/PickersPopper.js +0 -325
  598. package/legacy/internals/components/PickersToolbar.js +0 -92
  599. package/legacy/internals/components/PickersToolbarButton.js +0 -61
  600. package/legacy/internals/components/PickersToolbarText.js +0 -52
  601. package/legacy/internals/components/pickersPopperClasses.js +0 -5
  602. package/legacy/internals/components/pickersToolbarButtonClasses.js +0 -5
  603. package/legacy/internals/components/pickersToolbarClasses.js +0 -5
  604. package/legacy/internals/components/pickersToolbarTextClasses.js +0 -5
  605. package/legacy/internals/constants/dimensions.js +0 -7
  606. package/legacy/internals/demo/DemoContainer.js +0 -163
  607. package/legacy/internals/demo/index.js +0 -1
  608. package/legacy/internals/hooks/date-helpers-hooks.js +0 -37
  609. package/legacy/internals/hooks/useClockReferenceDate.js +0 -28
  610. package/legacy/internals/hooks/useDefaultReduceAnimations.js +0 -14
  611. package/legacy/internals/hooks/useDesktopPicker/index.js +0 -1
  612. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +0 -174
  613. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.types.js +0 -1
  614. package/legacy/internals/hooks/useField/index.js +0 -2
  615. package/legacy/internals/hooks/useField/useField.js +0 -470
  616. package/legacy/internals/hooks/useField/useField.types.js +0 -1
  617. package/legacy/internals/hooks/useField/useField.utils.js +0 -828
  618. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +0 -277
  619. package/legacy/internals/hooks/useField/useFieldState.js +0 -321
  620. package/legacy/internals/hooks/useIsLandscape.js +0 -39
  621. package/legacy/internals/hooks/useMobilePicker/index.js +0 -1
  622. package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +0 -126
  623. package/legacy/internals/hooks/useMobilePicker/useMobilePicker.types.js +0 -1
  624. package/legacy/internals/hooks/useOpenState.js +0 -38
  625. package/legacy/internals/hooks/usePicker/index.js +0 -1
  626. package/legacy/internals/hooks/usePicker/usePicker.js +0 -54
  627. package/legacy/internals/hooks/usePicker/usePicker.types.js +0 -1
  628. package/legacy/internals/hooks/usePicker/usePickerLayoutProps.js +0 -28
  629. package/legacy/internals/hooks/usePicker/usePickerValue.js +0 -365
  630. package/legacy/internals/hooks/usePicker/usePickerValue.types.js +0 -1
  631. package/legacy/internals/hooks/usePicker/usePickerViews.js +0 -172
  632. package/legacy/internals/hooks/useStaticPicker/index.js +0 -1
  633. package/legacy/internals/hooks/useStaticPicker/useStaticPicker.js +0 -66
  634. package/legacy/internals/hooks/useStaticPicker/useStaticPicker.types.js +0 -1
  635. package/legacy/internals/hooks/useUtils.js +0 -38
  636. package/legacy/internals/hooks/useValidation.js +0 -20
  637. package/legacy/internals/hooks/useValueWithTimezone.js +0 -81
  638. package/legacy/internals/hooks/useViews.js +0 -124
  639. package/legacy/internals/index.js +0 -35
  640. package/legacy/internals/models/common.js +0 -1
  641. package/legacy/internals/models/fields.js +0 -1
  642. package/legacy/internals/models/helpers.js +0 -1
  643. package/legacy/internals/models/index.js +0 -2
  644. package/legacy/internals/models/props/basePickerProps.js +0 -1
  645. package/legacy/internals/models/props/clock.js +0 -1
  646. package/legacy/internals/models/props/tabs.js +0 -1
  647. package/legacy/internals/models/props/toolbar.js +0 -1
  648. package/legacy/internals/models/validation.js +0 -1
  649. package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -24
  650. package/legacy/internals/utils/date-time-utils.js +0 -71
  651. package/legacy/internals/utils/date-utils.js +0 -129
  652. package/legacy/internals/utils/fields.js +0 -28
  653. package/legacy/internals/utils/getDefaultReferenceDate.js +0 -65
  654. package/legacy/internals/utils/time-utils.js +0 -63
  655. package/legacy/internals/utils/utils.js +0 -40
  656. package/legacy/internals/utils/validation/extractValidationProps.js +0 -16
  657. package/legacy/internals/utils/validation/validateDate.js +0 -38
  658. package/legacy/internals/utils/validation/validateDateTime.js +0 -20
  659. package/legacy/internals/utils/validation/validateTime.js +0 -42
  660. package/legacy/internals/utils/valueManagers.js +0 -67
  661. package/legacy/internals/utils/views.js +0 -29
  662. package/legacy/internals/utils/warning.js +0 -39
  663. package/legacy/locales/beBY.js +0 -99
  664. package/legacy/locales/caES.js +0 -100
  665. package/legacy/locales/csCZ.js +0 -100
  666. package/legacy/locales/daDK.js +0 -102
  667. package/legacy/locales/deDE.js +0 -101
  668. package/legacy/locales/elGR.js +0 -100
  669. package/legacy/locales/enUS.js +0 -96
  670. package/legacy/locales/esES.js +0 -99
  671. package/legacy/locales/eu.js +0 -99
  672. package/legacy/locales/faIR.js +0 -100
  673. package/legacy/locales/fiFI.js +0 -100
  674. package/legacy/locales/frFR.js +0 -98
  675. package/legacy/locales/heIL.js +0 -100
  676. package/legacy/locales/huHU.js +0 -99
  677. package/legacy/locales/index.js +0 -35
  678. package/legacy/locales/isIS.js +0 -100
  679. package/legacy/locales/itIT.js +0 -98
  680. package/legacy/locales/jaJP.js +0 -102
  681. package/legacy/locales/koKR.js +0 -98
  682. package/legacy/locales/kzKZ.js +0 -99
  683. package/legacy/locales/mk.js +0 -96
  684. package/legacy/locales/nbNO.js +0 -100
  685. package/legacy/locales/nlNL.js +0 -100
  686. package/legacy/locales/plPL.js +0 -85
  687. package/legacy/locales/ptBR.js +0 -100
  688. package/legacy/locales/roRO.js +0 -99
  689. package/legacy/locales/ruRU.js +0 -98
  690. package/legacy/locales/skSK.js +0 -100
  691. package/legacy/locales/svSE.js +0 -85
  692. package/legacy/locales/trTR.js +0 -100
  693. package/legacy/locales/ukUA.js +0 -100
  694. package/legacy/locales/urPK.js +0 -85
  695. package/legacy/locales/utils/getPickersLocalization.js +0 -12
  696. package/legacy/locales/utils/pickersLocaleTextApi.js +0 -1
  697. package/legacy/locales/viVN.js +0 -100
  698. package/legacy/locales/zhCN.js +0 -100
  699. package/legacy/locales/zhHK.js +0 -100
  700. package/legacy/models/adapters.js +0 -1
  701. package/legacy/models/common.js +0 -1
  702. package/legacy/models/fields.js +0 -1
  703. package/legacy/models/index.js +0 -7
  704. package/legacy/models/pickers.js +0 -1
  705. package/legacy/models/timezone.js +0 -1
  706. package/legacy/models/validation.js +0 -1
  707. package/legacy/models/views.js +0 -1
  708. package/legacy/themeAugmentation/index.js +0 -3
  709. package/legacy/timeViewRenderers/index.js +0 -1
  710. package/legacy/timeViewRenderers/timeViewRenderers.js +0 -186
@@ -57,7 +57,7 @@ export const useFieldCharacterEditing = ({
57
57
  if (query != null) {
58
58
  const timeout = setTimeout(() => resetQuery(), QUERY_LIFE_DURATION_MS);
59
59
  return () => {
60
- window.clearTimeout(timeout);
60
+ clearTimeout(timeout);
61
61
  };
62
62
  }
63
63
  return () => {};
@@ -244,13 +244,13 @@ export const useFieldCharacterEditing = ({
244
244
  })) : applyLetterEditing(params);
245
245
  if (response == null) {
246
246
  setTempAndroidValueStr(null);
247
- } else {
248
- updateSectionValue({
249
- activeSection,
250
- newSectionValue: response.sectionValue,
251
- shouldGoToNextSection: response.shouldGoToNextSection
252
- });
247
+ return;
253
248
  }
249
+ updateSectionValue({
250
+ activeSection,
251
+ newSectionValue: response.sectionValue,
252
+ shouldGoToNextSection: response.shouldGoToNextSection
253
+ });
254
254
  });
255
255
  return {
256
256
  applyCharacterEditing,
@@ -1,5 +1,5 @@
1
- import { UseFieldForwardedProps, UseFieldInternalProps, UseFieldParams, UseFieldState, FieldSelectedSectionsIndexes } from './useField.types';
2
- import { FieldSection, FieldSelectedSections, PickerValidDate } from '../../../models';
1
+ import { UseFieldInternalProps, UseFieldParams, UseFieldState, FieldParsedSelectedSections, FieldSectionsValueBoundaries, UseFieldForwardedProps } from './useField.types';
2
+ import { FieldSection, FieldSelectedSections, PickersTimezone, PickerValidDate } from '../../../models';
3
3
  export interface UpdateSectionValueParams<TSection extends FieldSection> {
4
4
  /**
5
5
  * The section on which we want to apply the new value.
@@ -14,17 +14,19 @@ export interface UpdateSectionValueParams<TSection extends FieldSection> {
14
14
  */
15
15
  shouldGoToNextSection: boolean;
16
16
  }
17
- export declare const useFieldState: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TForwardedProps extends UseFieldForwardedProps, TInternalProps extends UseFieldInternalProps<any, any, any, any>>(params: UseFieldParams<TValue, TDate, TSection, TForwardedProps, TInternalProps>) => {
17
+ export interface UseFieldStateResponse<TValue, TDate extends PickerValidDate, TSection extends FieldSection> {
18
18
  state: UseFieldState<TValue, TSection>;
19
- selectedSectionIndexes: FieldSelectedSectionsIndexes | null;
20
- setSelectedSections: (newSelectedSections: FieldSelectedSections) => void;
19
+ activeSectionIndex: number | null;
20
+ parsedSelectedSections: FieldParsedSelectedSections;
21
+ setSelectedSections: (sections: FieldSelectedSections) => void;
21
22
  clearValue: () => void;
22
23
  clearActiveSection: () => void;
23
- updateSectionValue: ({ activeSection, newSectionValue, shouldGoToNextSection, }: UpdateSectionValueParams<TSection>) => void;
24
+ updateSectionValue: (params: UpdateSectionValueParams<TSection>) => void;
24
25
  updateValueFromValueStr: (valueStr: string) => void;
25
- setTempAndroidValueStr: (tempValueStrAndroid: string | null) => void;
26
- sectionsValueBoundaries: import("./useField.types").FieldSectionsValueBoundaries<TDate>;
26
+ setTempAndroidValueStr: (tempAndroidValueStr: string | null) => void;
27
+ sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>;
28
+ getSectionsFromValue: (value: TValue, fallbackSections?: TSection[] | null) => TSection[];
27
29
  localizedDigits: string[];
28
- placeholder: string;
29
- timezone: string;
30
- };
30
+ timezone: PickersTimezone;
31
+ }
32
+ export declare const useFieldState: <TValue, TDate extends PickerValidDate, TSection extends FieldSection, TEnableAccessibleFieldDOMStructure extends boolean, TForwardedProps extends UseFieldForwardedProps<TEnableAccessibleFieldDOMStructure>, TInternalProps extends UseFieldInternalProps<any, any, any, any, any>>(params: UseFieldParams<TValue, TDate, TSection, TEnableAccessibleFieldDOMStructure, TForwardedProps, TInternalProps>) => UseFieldStateResponse<TValue, TDate, TSection>;
@@ -3,7 +3,8 @@ import * as React from 'react';
3
3
  import useControlled from '@mui/utils/useControlled';
4
4
  import { useTheme } from '@mui/material/styles';
5
5
  import { useUtils, useLocaleText, useLocalizationContext } from '../useUtils';
6
- import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, getLocalizedDigits } from './useField.utils';
6
+ import { mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, parseSelectedSections, getLocalizedDigits } from './useField.utils';
7
+ import { buildSectionsFromFormat } from './buildSectionsFromFormat';
7
8
  import { useValueWithTimezone } from '../useValueWithTimezone';
8
9
  import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
9
10
  export const useFieldState = params => {
@@ -28,7 +29,8 @@ export const useFieldState = params => {
28
29
  selectedSections: selectedSectionsProp,
29
30
  onSelectedSectionsChange,
30
31
  shouldRespectLeadingZeros = false,
31
- timezone: timezoneProp
32
+ timezone: timezoneProp,
33
+ enableAccessibleFieldDOMStructure = false
32
34
  }
33
35
  } = params;
34
36
  const {
@@ -44,8 +46,18 @@ export const useFieldState = params => {
44
46
  });
45
47
  const localizedDigits = React.useMemo(() => getLocalizedDigits(utils), [utils]);
46
48
  const sectionsValueBoundaries = React.useMemo(() => getSectionsBoundaries(utils, localizedDigits, timezone), [utils, localizedDigits, timezone]);
47
- const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, date => splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL)), [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
48
- const placeholder = React.useMemo(() => fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
49
+ const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, date => buildSectionsFromFormat({
50
+ utils,
51
+ timezone,
52
+ localeText,
53
+ localizedDigits,
54
+ format,
55
+ date,
56
+ formatDensity,
57
+ shouldRespectLeadingZeros,
58
+ enableAccessibleFieldDOMStructure,
59
+ isRTL
60
+ })), [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone, enableAccessibleFieldDOMStructure]);
49
61
  const [state, setState] = React.useState(() => {
50
62
  const sections = getSectionsFromValue(valueFromTheOutside);
51
63
  validateSections(sections, valueType);
@@ -72,45 +84,14 @@ export const useFieldState = params => {
72
84
  controlled: selectedSectionsProp,
73
85
  default: null,
74
86
  name: 'useField',
75
- state: 'selectedSectionIndexes'
87
+ state: 'selectedSections'
76
88
  });
77
89
  const setSelectedSections = newSelectedSections => {
78
90
  innerSetSelectedSections(newSelectedSections);
79
91
  onSelectedSectionsChange == null || onSelectedSectionsChange(newSelectedSections);
80
- setState(prevState => _extends({}, prevState, {
81
- selectedSectionQuery: null
82
- }));
83
92
  };
84
- const selectedSectionIndexes = React.useMemo(() => {
85
- if (selectedSections == null) {
86
- return null;
87
- }
88
- if (selectedSections === 'all') {
89
- return {
90
- startIndex: 0,
91
- endIndex: state.sections.length - 1,
92
- shouldSelectBoundarySelectors: true
93
- };
94
- }
95
- if (typeof selectedSections === 'number') {
96
- return {
97
- startIndex: selectedSections,
98
- endIndex: selectedSections,
99
- shouldSelectBoundarySelectors: state.sections[selectedSections].type === 'empty'
100
- };
101
- }
102
- if (typeof selectedSections === 'string') {
103
- const selectedSectionIndex = state.sections.findIndex(section => section.type === selectedSections);
104
- return {
105
- startIndex: selectedSectionIndex,
106
- endIndex: selectedSectionIndex,
107
- shouldSelectBoundarySelectors: state.sections[selectedSectionIndex].type === 'empty'
108
- };
109
- }
110
- return _extends({}, selectedSections, {
111
- shouldSelectBoundarySelectors: selectedSections.startIndex === selectedSections.endIndex && state.sections[selectedSections.startIndex].type === 'empty'
112
- });
113
- }, [selectedSections, state.sections]);
93
+ const parsedSelectedSections = React.useMemo(() => parseSelectedSections(selectedSections, state.sections), [selectedSections, state.sections]);
94
+ const activeSectionIndex = parsedSelectedSections === 'all' ? 0 : parsedSelectedSections;
114
95
  const publishValue = ({
115
96
  value,
116
97
  referenceValue,
@@ -143,7 +124,7 @@ export const useFieldState = params => {
143
124
  value: newSectionValue,
144
125
  modified: true
145
126
  });
146
- return addPositionPropertiesToSections(newSections, localizedDigits, isRTL);
127
+ return newSections;
147
128
  };
148
129
  const clearValue = () => {
149
130
  publishValue({
@@ -153,26 +134,19 @@ export const useFieldState = params => {
153
134
  });
154
135
  };
155
136
  const clearActiveSection = () => {
156
- if (selectedSectionIndexes == null) {
137
+ if (activeSectionIndex == null) {
157
138
  return;
158
139
  }
159
- const activeSection = state.sections[selectedSectionIndexes.startIndex];
140
+ const activeSection = state.sections[activeSectionIndex];
160
141
  const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
161
142
  const nonEmptySectionCountBefore = activeDateManager.getSections(state.sections).filter(section => section.value !== '').length;
162
143
  const hasNoOtherNonEmptySections = nonEmptySectionCountBefore === (activeSection.value === '' ? 0 : 1);
163
- const newSections = setSectionValue(selectedSectionIndexes.startIndex, '');
144
+ const newSections = setSectionValue(activeSectionIndex, '');
164
145
  const newActiveDate = hasNoOtherNonEmptySections ? null : utils.getInvalidDate();
165
146
  const newValues = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
166
- if ((newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date))) {
167
- publishValue(_extends({}, newValues, {
168
- sections: newSections
169
- }));
170
- } else {
171
- setState(prevState => _extends({}, prevState, newValues, {
172
- sections: newSections,
173
- tempValueStrAndroid: null
174
- }));
175
- }
147
+ publishValue(_extends({}, newValues, {
148
+ sections: newSections
149
+ }));
176
150
  };
177
151
  const updateValueFromValueStr = valueStr => {
178
152
  const parseDateStr = (dateStr, referenceDate) => {
@@ -180,7 +154,18 @@ export const useFieldState = params => {
180
154
  if (date == null || !utils.isValid(date)) {
181
155
  return null;
182
156
  }
183
- const sections = splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
157
+ const sections = buildSectionsFromFormat({
158
+ utils,
159
+ timezone,
160
+ localeText,
161
+ localizedDigits,
162
+ format,
163
+ date,
164
+ formatDensity,
165
+ shouldRespectLeadingZeros,
166
+ enableAccessibleFieldDOMStructure,
167
+ isRTL
168
+ });
184
169
  return mergeDateIntoReferenceDate(utils, timezone, date, sections, referenceDate, false);
185
170
  };
186
171
  const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
@@ -199,17 +184,15 @@ export const useFieldState = params => {
199
184
  /**
200
185
  * 1. Decide which section should be focused
201
186
  */
202
- if (shouldGoToNextSection && selectedSectionIndexes && selectedSectionIndexes.startIndex < state.sections.length - 1) {
203
- setSelectedSections(selectedSectionIndexes.startIndex + 1);
204
- } else if (selectedSectionIndexes && selectedSectionIndexes.startIndex !== selectedSectionIndexes.endIndex) {
205
- setSelectedSections(selectedSectionIndexes.startIndex);
187
+ if (shouldGoToNextSection && activeSectionIndex < state.sections.length - 1) {
188
+ setSelectedSections(activeSectionIndex + 1);
206
189
  }
207
190
 
208
191
  /**
209
192
  * 2. Try to build a valid date from the new section value
210
193
  */
211
194
  const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
212
- const newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
195
+ const newSections = setSectionValue(activeSectionIndex, newSectionValue);
213
196
  const newActiveDateSections = activeDateManager.getSections(newSections);
214
197
  const newActiveDate = getDateFromDateSections(utils, newActiveDateSections, localizedDigits);
215
198
  let values;
@@ -251,7 +234,7 @@ export const useFieldState = params => {
251
234
  setState(prevState => _extends({}, prevState, {
252
235
  sections
253
236
  }));
254
- }, [format, utils.locale]); // eslint-disable-line react-hooks/exhaustive-deps
237
+ }, [format, utils.locale, isRTL]); // eslint-disable-line react-hooks/exhaustive-deps
255
238
 
256
239
  React.useEffect(() => {
257
240
  let shouldUpdate;
@@ -271,16 +254,17 @@ export const useFieldState = params => {
271
254
 
272
255
  return {
273
256
  state,
274
- selectedSectionIndexes,
257
+ activeSectionIndex,
258
+ parsedSelectedSections,
275
259
  setSelectedSections,
276
260
  clearValue,
277
261
  clearActiveSection,
278
262
  updateSectionValue,
279
263
  updateValueFromValueStr,
280
264
  setTempAndroidValueStr,
265
+ getSectionsFromValue,
281
266
  sectionsValueBoundaries,
282
267
  localizedDigits,
283
- placeholder,
284
268
  timezone
285
269
  };
286
270
  };
@@ -0,0 +1,25 @@
1
+ import { UseFieldTextField } from './useField.types';
2
+ import { FieldSection } from '../../../models';
3
+ type FieldSectionWithPositions<TSection> = TSection & {
4
+ /**
5
+ * Start index of the section in the format
6
+ */
7
+ start: number;
8
+ /**
9
+ * End index of the section in the format
10
+ */
11
+ end: number;
12
+ /**
13
+ * Start index of the section value in the input.
14
+ * Takes into account invisible unicode characters such as \u2069 but does not include them
15
+ */
16
+ startInInput: number;
17
+ /**
18
+ * End index of the section value in the input.
19
+ * Takes into account invisible unicode characters such as \u2069 but does not include them
20
+ */
21
+ endInInput: number;
22
+ };
23
+ export declare const addPositionPropertiesToSections: <TSection extends FieldSection>(sections: TSection[], localizedDigits: string[], isRTL: boolean) => FieldSectionWithPositions<TSection>[];
24
+ export declare const useFieldV6TextField: UseFieldTextField<false>;
25
+ export {};
@@ -0,0 +1,326 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { useTheme } from '@mui/material/styles';
4
+ import useEventCallback from '@mui/utils/useEventCallback';
5
+ import useForkRef from '@mui/utils/useForkRef';
6
+ import { getActiveElement } from '../../utils/utils';
7
+ import { getSectionVisibleValue, isAndroid } from './useField.utils';
8
+ const cleanString = dirtyString => dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
9
+ export const addPositionPropertiesToSections = (sections, localizedDigits, isRTL) => {
10
+ let position = 0;
11
+ let positionInInput = isRTL ? 1 : 0;
12
+ const newSections = [];
13
+ for (let i = 0; i < sections.length; i += 1) {
14
+ const section = sections[i];
15
+ const renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
16
+ const sectionStr = `${section.startSeparator}${renderedValue}${section.endSeparator}`;
17
+ const sectionLength = cleanString(sectionStr).length;
18
+ const sectionLengthInInput = sectionStr.length;
19
+
20
+ // The ...InInput values consider the unicode characters but do include them in their indexes
21
+ const cleanedValue = cleanString(renderedValue);
22
+ const startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
23
+ const endInInput = startInInput + cleanedValue.length;
24
+ newSections.push(_extends({}, section, {
25
+ start: position,
26
+ end: position + sectionLength,
27
+ startInInput,
28
+ endInInput
29
+ }));
30
+ position += sectionLength;
31
+ // Move position to the end of string associated to the current section
32
+ positionInInput += sectionLengthInInput;
33
+ }
34
+ return newSections;
35
+ };
36
+ export const useFieldV6TextField = params => {
37
+ const theme = useTheme();
38
+ const isRTL = theme.direction === 'rtl';
39
+ const focusTimeoutRef = React.useRef();
40
+ const {
41
+ forwardedProps: {
42
+ onFocus,
43
+ onClick,
44
+ onPaste,
45
+ onBlur,
46
+ inputRef: inputRefProp
47
+ },
48
+ internalProps: {
49
+ readOnly = false
50
+ },
51
+ parsedSelectedSections,
52
+ activeSectionIndex,
53
+ state,
54
+ fieldValueManager,
55
+ valueManager,
56
+ applyCharacterEditing,
57
+ resetCharacterQuery,
58
+ updateSectionValue,
59
+ updateValueFromValueStr,
60
+ clearActiveSection,
61
+ clearValue,
62
+ setTempAndroidValueStr,
63
+ setSelectedSections,
64
+ getSectionsFromValue,
65
+ areAllSectionsEmpty,
66
+ localizedDigits
67
+ } = params;
68
+ const inputRef = React.useRef(null);
69
+ const handleRef = useForkRef(inputRefProp, inputRef);
70
+ const sections = React.useMemo(() => addPositionPropertiesToSections(state.sections, localizedDigits, isRTL), [state.sections, localizedDigits, isRTL]);
71
+ const interactions = React.useMemo(() => ({
72
+ syncSelectionToDOM: () => {
73
+ if (!inputRef.current) {
74
+ return;
75
+ }
76
+ if (parsedSelectedSections == null) {
77
+ if (inputRef.current.scrollLeft) {
78
+ // Ensure that input content is not marked as selected.
79
+ // setting selection range to 0 causes issues in Safari.
80
+ // https://bugs.webkit.org/show_bug.cgi?id=224425
81
+ inputRef.current.scrollLeft = 0;
82
+ }
83
+ return;
84
+ }
85
+
86
+ // On multi input range pickers we want to update selection range only for the active input
87
+ // This helps to avoid the focus jumping on Safari https://github.com/mui/mui-x/issues/9003
88
+ // because WebKit implements the `setSelectionRange` based on the spec: https://bugs.webkit.org/show_bug.cgi?id=224425
89
+ if (inputRef.current !== getActiveElement(document)) {
90
+ return;
91
+ }
92
+
93
+ // Fix scroll jumping on iOS browser: https://github.com/mui/mui-x/issues/8321
94
+ const currentScrollTop = inputRef.current.scrollTop;
95
+ if (parsedSelectedSections === 'all') {
96
+ inputRef.current.select();
97
+ } else {
98
+ const selectedSection = sections[parsedSelectedSections];
99
+ const selectionStart = selectedSection.type === 'empty' ? selectedSection.startInInput - selectedSection.startSeparator.length : selectedSection.startInInput;
100
+ const selectionEnd = selectedSection.type === 'empty' ? selectedSection.endInInput + selectedSection.endSeparator.length : selectedSection.endInInput;
101
+ if (selectionStart !== inputRef.current.selectionStart || selectionEnd !== inputRef.current.selectionEnd) {
102
+ if (inputRef.current === getActiveElement(document)) {
103
+ inputRef.current.setSelectionRange(selectionStart, selectionEnd);
104
+ }
105
+ }
106
+ }
107
+
108
+ // Even reading this variable seems to do the trick, but also setting it just to make use of it
109
+ inputRef.current.scrollTop = currentScrollTop;
110
+ },
111
+ getActiveSectionIndexFromDOM: () => {
112
+ var _selectionStart, _selectionEnd;
113
+ const browserStartIndex = (_selectionStart = inputRef.current.selectionStart) != null ? _selectionStart : 0;
114
+ const browserEndIndex = (_selectionEnd = inputRef.current.selectionEnd) != null ? _selectionEnd : 0;
115
+ if (browserStartIndex === 0 && browserEndIndex === 0) {
116
+ return null;
117
+ }
118
+ const nextSectionIndex = browserStartIndex <= sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
119
+ : sections.findIndex(section => section.startInInput - section.startSeparator.length > browserStartIndex);
120
+ return nextSectionIndex === -1 ? sections.length - 1 : nextSectionIndex - 1;
121
+ },
122
+ focusField: (newSelectedSection = 0) => {
123
+ var _inputRef$current;
124
+ (_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
125
+ setSelectedSections(newSelectedSection);
126
+ },
127
+ setSelectedSections: newSelectedSections => setSelectedSections(newSelectedSections),
128
+ isFieldFocused: () => inputRef.current === getActiveElement(document)
129
+ }), [inputRef, parsedSelectedSections, sections, setSelectedSections]);
130
+ const syncSelectionFromDOM = () => {
131
+ var _selectionStart2;
132
+ if (readOnly) {
133
+ setSelectedSections(null);
134
+ return;
135
+ }
136
+ const browserStartIndex = (_selectionStart2 = inputRef.current.selectionStart) != null ? _selectionStart2 : 0;
137
+ let nextSectionIndex;
138
+ if (browserStartIndex <= sections[0].startInInput) {
139
+ // Special case if browser index is in invisible characters at the beginning
140
+ nextSectionIndex = 1;
141
+ } else if (browserStartIndex >= sections[sections.length - 1].endInInput) {
142
+ // If the click is after the last character of the input, then we want to select the 1st section.
143
+ nextSectionIndex = 1;
144
+ } else {
145
+ nextSectionIndex = sections.findIndex(section => section.startInInput - section.startSeparator.length > browserStartIndex);
146
+ }
147
+ const sectionIndex = nextSectionIndex === -1 ? sections.length - 1 : nextSectionIndex - 1;
148
+ setSelectedSections(sectionIndex);
149
+ };
150
+ const handleInputFocus = useEventCallback((...args) => {
151
+ onFocus == null || onFocus(...args);
152
+ // The ref is guaranteed to be resolved at this point.
153
+ const input = inputRef.current;
154
+ clearTimeout(focusTimeoutRef.current);
155
+ focusTimeoutRef.current = setTimeout(() => {
156
+ // The ref changed, the component got remounted, the focus event is no longer relevant.
157
+ if (!input || input !== inputRef.current) {
158
+ return;
159
+ }
160
+ if (activeSectionIndex != null || readOnly) {
161
+ return;
162
+ }
163
+ if (
164
+ // avoid selecting all sections when focusing empty field without value
165
+ input.value.length && Number(input.selectionEnd) - Number(input.selectionStart) === input.value.length) {
166
+ setSelectedSections('all');
167
+ } else {
168
+ syncSelectionFromDOM();
169
+ }
170
+ });
171
+ });
172
+ const handleInputClick = useEventCallback((event, ...args) => {
173
+ // The click event on the clear button would propagate to the input, trigger this handler and result in a wrong section selection.
174
+ // We avoid this by checking if the call of `handleInputClick` is actually intended, or a side effect.
175
+ if (event.isDefaultPrevented()) {
176
+ return;
177
+ }
178
+ onClick == null || onClick(event, ...args);
179
+ syncSelectionFromDOM();
180
+ });
181
+ const handleInputPaste = useEventCallback(event => {
182
+ onPaste == null || onPaste(event);
183
+
184
+ // prevent default to avoid the input `onChange` handler being called
185
+ event.preventDefault();
186
+ if (readOnly) {
187
+ return;
188
+ }
189
+ const pastedValue = event.clipboardData.getData('text');
190
+ if (typeof parsedSelectedSections === 'number') {
191
+ const activeSection = state.sections[parsedSelectedSections];
192
+ const lettersOnly = /^[a-zA-Z]+$/.test(pastedValue);
193
+ const digitsOnly = /^[0-9]+$/.test(pastedValue);
194
+ const digitsAndLetterOnly = /^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(pastedValue);
195
+ const isValidPastedValue = activeSection.contentType === 'letter' && lettersOnly || activeSection.contentType === 'digit' && digitsOnly || activeSection.contentType === 'digit-with-letter' && digitsAndLetterOnly;
196
+ if (isValidPastedValue) {
197
+ resetCharacterQuery();
198
+ updateSectionValue({
199
+ activeSection,
200
+ newSectionValue: pastedValue,
201
+ shouldGoToNextSection: true
202
+ });
203
+ return;
204
+ }
205
+ if (lettersOnly || digitsOnly) {
206
+ // The pasted value corresponds to a single section, but not the expected type,
207
+ // skip the modification
208
+ return;
209
+ }
210
+ }
211
+ resetCharacterQuery();
212
+ updateValueFromValueStr(pastedValue);
213
+ });
214
+ const handleContainerBlur = useEventCallback((...args) => {
215
+ onBlur == null || onBlur(...args);
216
+ setSelectedSections(null);
217
+ });
218
+ const handleInputChange = useEventCallback(event => {
219
+ if (readOnly) {
220
+ return;
221
+ }
222
+ const targetValue = event.target.value;
223
+ if (targetValue === '') {
224
+ resetCharacterQuery();
225
+ clearValue();
226
+ return;
227
+ }
228
+ const eventData = event.nativeEvent.data;
229
+ // Calling `.fill(04/11/2022)` in playwright will trigger a change event with the requested content to insert in `event.nativeEvent.data`
230
+ // usual changes have only the currently typed character in the `event.nativeEvent.data`
231
+ const shouldUseEventData = eventData && eventData.length > 1;
232
+ const valueStr = shouldUseEventData ? eventData : targetValue;
233
+ const cleanValueStr = cleanString(valueStr);
234
+
235
+ // If no section is selected or eventData should be used, we just try to parse the new value
236
+ // This line is mostly triggered by imperative code / application tests.
237
+ if (activeSectionIndex == null || shouldUseEventData) {
238
+ updateValueFromValueStr(shouldUseEventData ? eventData : cleanValueStr);
239
+ return;
240
+ }
241
+ let keyPressed;
242
+ if (parsedSelectedSections === 'all' && cleanValueStr.length === 1) {
243
+ keyPressed = cleanValueStr;
244
+ } else {
245
+ const prevValueStr = cleanString(fieldValueManager.getV6InputValueFromSections(sections, localizedDigits, isRTL));
246
+ let startOfDiffIndex = -1;
247
+ let endOfDiffIndex = -1;
248
+ for (let i = 0; i < prevValueStr.length; i += 1) {
249
+ if (startOfDiffIndex === -1 && prevValueStr[i] !== cleanValueStr[i]) {
250
+ startOfDiffIndex = i;
251
+ }
252
+ if (endOfDiffIndex === -1 && prevValueStr[prevValueStr.length - i - 1] !== cleanValueStr[cleanValueStr.length - i - 1]) {
253
+ endOfDiffIndex = i;
254
+ }
255
+ }
256
+ const activeSection = sections[activeSectionIndex];
257
+ const hasDiffOutsideOfActiveSection = startOfDiffIndex < activeSection.start || prevValueStr.length - endOfDiffIndex - 1 > activeSection.end;
258
+ if (hasDiffOutsideOfActiveSection) {
259
+ // TODO: Support if the new date is valid
260
+ return;
261
+ }
262
+
263
+ // The active section being selected, the browser has replaced its value with the key pressed by the user.
264
+ const activeSectionEndRelativeToNewValue = cleanValueStr.length - prevValueStr.length + activeSection.end - cleanString(activeSection.endSeparator || '').length;
265
+ keyPressed = cleanValueStr.slice(activeSection.start + cleanString(activeSection.startSeparator || '').length, activeSectionEndRelativeToNewValue);
266
+ }
267
+ if (keyPressed.length === 0) {
268
+ if (isAndroid()) {
269
+ setTempAndroidValueStr(valueStr);
270
+ } else {
271
+ resetCharacterQuery();
272
+ clearActiveSection();
273
+ }
274
+ return;
275
+ }
276
+ applyCharacterEditing({
277
+ keyPressed,
278
+ sectionIndex: activeSectionIndex
279
+ });
280
+ });
281
+ const placeholder = React.useMemo(() => fieldValueManager.getV6InputValueFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
282
+ const valueStr = React.useMemo(() => {
283
+ var _state$tempValueStrAn;
284
+ return (_state$tempValueStrAn = state.tempValueStrAndroid) != null ? _state$tempValueStrAn : fieldValueManager.getV6InputValueFromSections(state.sections, localizedDigits, isRTL);
285
+ }, [state.sections, fieldValueManager, state.tempValueStrAndroid, localizedDigits, isRTL]);
286
+ React.useEffect(() => {
287
+ // Select all the sections when focused on mount (`autoFocus = true` on the input)
288
+ if (inputRef.current && inputRef.current === getActiveElement(document)) {
289
+ setSelectedSections('all');
290
+ }
291
+ return () => {
292
+ clearTimeout(focusTimeoutRef.current);
293
+ };
294
+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
295
+
296
+ const inputMode = React.useMemo(() => {
297
+ if (activeSectionIndex == null) {
298
+ return 'text';
299
+ }
300
+ if (state.sections[activeSectionIndex].contentType === 'letter') {
301
+ return 'text';
302
+ }
303
+ return 'numeric';
304
+ }, [activeSectionIndex, state.sections]);
305
+ const inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
306
+ const shouldShowPlaceholder = !inputHasFocus && areAllSectionsEmpty;
307
+ return {
308
+ interactions,
309
+ returnedValue: {
310
+ // Forwarded
311
+ readOnly,
312
+ onBlur: handleContainerBlur,
313
+ onClick: handleInputClick,
314
+ onFocus: handleInputFocus,
315
+ onPaste: handleInputPaste,
316
+ inputRef: handleRef,
317
+ // Additional
318
+ enableAccessibleFieldDOMStructure: false,
319
+ placeholder,
320
+ inputMode,
321
+ autoComplete: 'off',
322
+ value: shouldShowPlaceholder ? '' : valueStr,
323
+ onChange: handleInputChange
324
+ }
325
+ };
326
+ };
@@ -0,0 +1,2 @@
1
+ import { UseFieldTextField } from './useField.types';
2
+ export declare const useFieldV7TextField: UseFieldTextField<true>;