@mui/x-date-pickers 7.0.0-alpha.7 → 7.0.0-alpha.9

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 (326) hide show
  1. package/AdapterDateFns/AdapterDateFns.d.ts +4 -21
  2. package/AdapterDateFns/AdapterDateFns.js +11 -255
  3. package/AdapterDateFnsBase/AdapterDateFnsBase.d.ts +62 -0
  4. package/AdapterDateFnsBase/AdapterDateFnsBase.js +291 -0
  5. package/AdapterDateFnsBase/index.d.ts +1 -0
  6. package/AdapterDateFnsBase/index.js +1 -0
  7. package/AdapterDateFnsBase/package.json +6 -0
  8. package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +1 -0
  9. package/AdapterDateFnsV3/AdapterDateFnsV3.d.ts +80 -0
  10. package/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
  11. package/AdapterDateFnsV3/index.d.ts +1 -0
  12. package/AdapterDateFnsV3/index.js +1 -0
  13. package/AdapterDateFnsV3/package.json +6 -0
  14. package/AdapterLuxon/AdapterLuxon.d.ts +1 -1
  15. package/AdapterLuxon/AdapterLuxon.js +4 -12
  16. package/CHANGELOG.md +554 -51
  17. package/DatePicker/DatePicker.js +0 -3
  18. package/DatePicker/DatePickerToolbar.d.ts +2 -2
  19. package/DatePicker/DatePickerToolbar.js +2 -10
  20. package/DateTimePicker/DateTimePicker.js +0 -3
  21. package/DateTimePicker/DateTimePickerToolbar.js +0 -3
  22. package/DesktopDatePicker/DesktopDatePicker.js +0 -3
  23. package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
  24. package/DesktopTimePicker/DesktopTimePicker.js +0 -3
  25. package/DigitalClock/DigitalClock.js +1 -0
  26. package/DigitalClock/DigitalClock.types.d.ts +5 -0
  27. package/LocalizationProvider/LocalizationProvider.js +1 -1
  28. package/MobileDatePicker/MobileDatePicker.js +0 -3
  29. package/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
  30. package/MobileTimePicker/MobileTimePicker.js +0 -3
  31. package/MonthCalendar/MonthCalendar.js +0 -3
  32. package/MonthCalendar/MonthCalendar.types.d.ts +0 -3
  33. package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  34. package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +5 -0
  35. package/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
  36. package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +0 -3
  37. package/PickersSectionList/PickersSectionList.js +7 -2
  38. package/PickersTextField/PickersFilledInput/PickersFilledInput.d.ts +11 -0
  39. package/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
  40. package/PickersTextField/PickersFilledInput/index.d.ts +4 -0
  41. package/PickersTextField/PickersFilledInput/index.js +2 -0
  42. package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +23 -0
  43. package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
  44. package/PickersTextField/PickersInput/PickersInput.d.ts +10 -0
  45. package/PickersTextField/PickersInput/PickersInput.js +196 -0
  46. package/{internals/components → PickersTextField}/PickersInput/index.d.ts +2 -2
  47. package/PickersTextField/PickersInput/index.js +2 -0
  48. package/PickersTextField/PickersInput/pickersInputClasses.d.ts +22 -0
  49. package/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
  50. package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +16 -0
  51. package/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -28
  52. package/{internals/components/PickersInput/PickersInput.types.d.ts → PickersTextField/PickersInputBase/PickersInputBase.types.d.ts} +3 -13
  53. package/PickersTextField/PickersInputBase/index.d.ts +4 -0
  54. package/PickersTextField/PickersInputBase/index.js +2 -0
  55. package/PickersTextField/PickersInputBase/pickersInputBaseClasses.d.ts +31 -0
  56. package/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
  57. package/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.d.ts +3 -0
  58. package/{modern/internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
  59. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.d.ts +10 -0
  60. package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
  61. package/PickersTextField/PickersOutlinedInput/index.d.ts +4 -0
  62. package/PickersTextField/PickersOutlinedInput/index.js +2 -0
  63. package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.d.ts +22 -0
  64. package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
  65. package/PickersTextField/PickersTextField.d.ts +3 -0
  66. package/PickersTextField/PickersTextField.js +258 -0
  67. package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.d.ts +5 -2
  68. package/PickersTextField/index.d.ts +8 -0
  69. package/PickersTextField/index.js +6 -0
  70. package/PickersTextField/package.json +6 -0
  71. package/README.md +1 -1
  72. package/StaticDatePicker/StaticDatePicker.js +0 -3
  73. package/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
  74. package/StaticTimePicker/StaticTimePicker.js +0 -3
  75. package/TimeClock/TimeClock.js +1 -0
  76. package/TimeClock/TimeClock.types.d.ts +5 -0
  77. package/TimePicker/TimePicker.js +0 -3
  78. package/TimePicker/TimePickerToolbar.js +0 -3
  79. package/YearCalendar/YearCalendar.js +0 -3
  80. package/YearCalendar/YearCalendar.types.d.ts +0 -3
  81. package/hooks/useClearableField.js +3 -3
  82. package/index.d.ts +2 -1
  83. package/index.js +3 -2
  84. package/internals/hooks/useField/useField.js +6 -4
  85. package/internals/hooks/useField/useField.types.d.ts +4 -2
  86. package/internals/hooks/useField/useField.utils.d.ts +19 -9
  87. package/internals/hooks/useField/useField.utils.js +73 -26
  88. package/internals/hooks/useField/useFieldCharacterEditing.d.ts +2 -1
  89. package/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
  90. package/internals/hooks/useField/useFieldState.d.ts +1 -0
  91. package/internals/hooks/useField/useFieldState.js +9 -7
  92. package/internals/hooks/usePicker/index.d.ts +1 -1
  93. package/internals/hooks/usePicker/usePickerValue.js +2 -2
  94. package/internals/hooks/useUtils.js +2 -2
  95. package/internals/hooks/useViews.js +2 -2
  96. package/internals/index.d.ts +9 -3
  97. package/internals/index.js +6 -2
  98. package/internals/models/common.d.ts +1 -1
  99. package/internals/models/helpers.d.ts +1 -0
  100. package/internals/models/props/basePickerProps.d.ts +0 -3
  101. package/internals/models/props/toolbar.d.ts +0 -3
  102. package/internals/utils/valueManagers.js +2 -2
  103. package/internals/utils/views.js +1 -1
  104. package/legacy/AdapterDateFns/AdapterDateFns.js +222 -458
  105. package/legacy/AdapterDateFnsBase/AdapterDateFnsBase.js +293 -0
  106. package/legacy/AdapterDateFnsBase/index.js +1 -0
  107. package/legacy/AdapterDateFnsV3/AdapterDateFnsV3.js +306 -0
  108. package/legacy/AdapterDateFnsV3/index.js +1 -0
  109. package/legacy/AdapterLuxon/AdapterLuxon.js +4 -12
  110. package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +5 -6
  111. package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +5 -6
  112. package/legacy/DatePicker/DatePicker.js +0 -3
  113. package/legacy/DatePicker/DatePickerToolbar.js +2 -10
  114. package/legacy/DateTimePicker/DateTimePicker.js +0 -3
  115. package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -3
  116. package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -3
  117. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
  118. package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -3
  119. package/legacy/DigitalClock/DigitalClock.js +1 -0
  120. package/legacy/LocalizationProvider/LocalizationProvider.js +1 -1
  121. package/legacy/MobileDatePicker/MobileDatePicker.js +0 -3
  122. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
  123. package/legacy/MobileTimePicker/MobileTimePicker.js +0 -3
  124. package/legacy/MonthCalendar/MonthCalendar.js +0 -3
  125. package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  126. package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
  127. package/legacy/PickersSectionList/PickersSectionList.js +7 -2
  128. package/legacy/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +99 -26
  129. package/legacy/PickersTextField/PickersFilledInput/index.js +2 -0
  130. package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
  131. package/legacy/PickersTextField/PickersInput/PickersInput.js +190 -0
  132. package/legacy/PickersTextField/PickersInput/index.js +2 -0
  133. package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
  134. package/legacy/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -28
  135. package/legacy/PickersTextField/PickersInputBase/index.js +2 -0
  136. package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
  137. package/legacy/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +7 -1
  138. package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +183 -0
  139. package/legacy/PickersTextField/PickersOutlinedInput/index.js +2 -0
  140. package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
  141. package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -8
  142. package/legacy/PickersTextField/index.js +6 -0
  143. package/legacy/StaticDatePicker/StaticDatePicker.js +0 -3
  144. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
  145. package/legacy/StaticTimePicker/StaticTimePicker.js +0 -3
  146. package/legacy/TimeClock/TimeClock.js +1 -0
  147. package/legacy/TimePicker/TimePicker.js +0 -3
  148. package/legacy/TimePicker/TimePickerToolbar.js +0 -3
  149. package/legacy/YearCalendar/YearCalendar.js +0 -3
  150. package/legacy/hooks/useClearableField.js +3 -3
  151. package/legacy/index.js +3 -2
  152. package/legacy/internals/hooks/useField/useField.js +6 -4
  153. package/legacy/internals/hooks/useField/useField.utils.js +76 -25
  154. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
  155. package/legacy/internals/hooks/useField/useFieldState.js +15 -11
  156. package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -2
  157. package/legacy/internals/hooks/useUtils.js +2 -2
  158. package/legacy/internals/hooks/useViews.js +2 -2
  159. package/legacy/internals/index.js +6 -2
  160. package/legacy/internals/utils/valueManagers.js +2 -2
  161. package/legacy/internals/utils/views.js +1 -1
  162. package/legacy/locales/index.js +1 -0
  163. package/locales/enUS.d.ts +1 -1
  164. package/locales/index.d.ts +1 -0
  165. package/locales/index.js +1 -0
  166. package/locales/mk.d.ts +1 -1
  167. package/locales/utils/getPickersLocalization.d.ts +1 -1
  168. package/modern/AdapterDateFns/AdapterDateFns.js +11 -254
  169. package/modern/AdapterDateFnsBase/AdapterDateFnsBase.js +290 -0
  170. package/modern/AdapterDateFnsBase/index.js +1 -0
  171. package/modern/AdapterDateFnsV3/AdapterDateFnsV3.js +287 -0
  172. package/modern/AdapterDateFnsV3/index.js +1 -0
  173. package/modern/AdapterLuxon/AdapterLuxon.js +3 -11
  174. package/modern/DatePicker/DatePicker.js +0 -3
  175. package/modern/DatePicker/DatePickerToolbar.js +2 -10
  176. package/modern/DateTimePicker/DateTimePicker.js +0 -3
  177. package/modern/DateTimePicker/DateTimePickerToolbar.js +0 -3
  178. package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -3
  179. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
  180. package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -3
  181. package/modern/DigitalClock/DigitalClock.js +1 -0
  182. package/modern/LocalizationProvider/LocalizationProvider.js +1 -1
  183. package/modern/MobileDatePicker/MobileDatePicker.js +0 -3
  184. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
  185. package/modern/MobileTimePicker/MobileTimePicker.js +0 -3
  186. package/modern/MonthCalendar/MonthCalendar.js +0 -3
  187. package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  188. package/modern/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
  189. package/modern/PickersSectionList/PickersSectionList.js +7 -2
  190. package/modern/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
  191. package/modern/PickersTextField/PickersFilledInput/index.js +2 -0
  192. package/modern/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
  193. package/modern/PickersTextField/PickersInput/PickersInput.js +196 -0
  194. package/modern/PickersTextField/PickersInput/index.js +2 -0
  195. package/modern/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
  196. package/modern/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -28
  197. package/modern/PickersTextField/PickersInputBase/index.js +2 -0
  198. package/modern/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
  199. package/{internals/components/PickersInput → modern/PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
  200. package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
  201. package/modern/PickersTextField/PickersOutlinedInput/index.js +2 -0
  202. package/modern/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
  203. package/modern/PickersTextField/PickersTextField.js +258 -0
  204. package/modern/PickersTextField/index.js +6 -0
  205. package/modern/StaticDatePicker/StaticDatePicker.js +0 -3
  206. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
  207. package/modern/StaticTimePicker/StaticTimePicker.js +0 -3
  208. package/modern/TimeClock/TimeClock.js +1 -0
  209. package/modern/TimePicker/TimePicker.js +0 -3
  210. package/modern/TimePicker/TimePickerToolbar.js +0 -3
  211. package/modern/YearCalendar/YearCalendar.js +0 -3
  212. package/modern/hooks/useClearableField.js +3 -3
  213. package/modern/index.js +3 -2
  214. package/modern/internals/hooks/useField/useField.js +5 -3
  215. package/modern/internals/hooks/useField/useField.utils.js +73 -26
  216. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
  217. package/modern/internals/hooks/useField/useFieldState.js +9 -7
  218. package/modern/internals/hooks/usePicker/usePickerValue.js +2 -2
  219. package/modern/internals/hooks/useUtils.js +2 -2
  220. package/modern/internals/hooks/useViews.js +2 -2
  221. package/modern/internals/index.js +6 -2
  222. package/modern/internals/utils/valueManagers.js +2 -2
  223. package/modern/internals/utils/views.js +1 -1
  224. package/modern/locales/index.js +1 -0
  225. package/node/AdapterDateFns/AdapterDateFns.js +11 -254
  226. package/node/AdapterDateFnsBase/AdapterDateFnsBase.js +298 -0
  227. package/node/AdapterDateFnsBase/index.js +12 -0
  228. package/node/AdapterDateFnsV3/AdapterDateFnsV3.js +295 -0
  229. package/node/AdapterDateFnsV3/index.js +12 -0
  230. package/node/AdapterLuxon/AdapterLuxon.js +3 -11
  231. package/node/DatePicker/DatePicker.js +0 -3
  232. package/node/DatePicker/DatePickerToolbar.js +0 -7
  233. package/node/DateTimePicker/DateTimePicker.js +0 -3
  234. package/node/DateTimePicker/DateTimePickerToolbar.js +0 -3
  235. package/node/DesktopDatePicker/DesktopDatePicker.js +0 -3
  236. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
  237. package/node/DesktopTimePicker/DesktopTimePicker.js +0 -3
  238. package/node/DigitalClock/DigitalClock.js +1 -0
  239. package/node/LocalizationProvider/LocalizationProvider.js +1 -1
  240. package/node/MobileDatePicker/MobileDatePicker.js +0 -3
  241. package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
  242. package/node/MobileTimePicker/MobileTimePicker.js +0 -3
  243. package/node/MonthCalendar/MonthCalendar.js +0 -3
  244. package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
  245. package/node/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
  246. package/node/PickersSectionList/PickersSectionList.js +7 -2
  247. package/node/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +102 -30
  248. package/node/PickersTextField/PickersFilledInput/index.js +25 -0
  249. package/node/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +16 -0
  250. package/node/PickersTextField/PickersInput/PickersInput.js +204 -0
  251. package/node/{internals/components → PickersTextField}/PickersInput/index.js +0 -7
  252. package/node/PickersTextField/PickersInput/pickersInputClasses.js +16 -0
  253. package/node/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +105 -28
  254. package/node/PickersTextField/PickersInputBase/index.js +25 -0
  255. package/node/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +14 -0
  256. package/node/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
  257. package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +197 -0
  258. package/node/PickersTextField/PickersOutlinedInput/index.js +25 -0
  259. package/node/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +16 -0
  260. package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -9
  261. package/node/PickersTextField/index.js +78 -0
  262. package/node/StaticDatePicker/StaticDatePicker.js +0 -3
  263. package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
  264. package/node/StaticTimePicker/StaticTimePicker.js +0 -3
  265. package/node/TimeClock/TimeClock.js +1 -0
  266. package/node/TimePicker/TimePicker.js +0 -3
  267. package/node/TimePicker/TimePickerToolbar.js +0 -3
  268. package/node/YearCalendar/YearCalendar.js +0 -3
  269. package/node/hooks/useClearableField.js +3 -3
  270. package/node/index.js +17 -5
  271. package/node/internals/hooks/useField/useField.js +5 -3
  272. package/node/internals/hooks/useField/useField.utils.js +78 -27
  273. package/node/internals/hooks/useField/useFieldCharacterEditing.js +11 -7
  274. package/node/internals/hooks/useField/useFieldState.js +8 -6
  275. package/node/internals/hooks/usePicker/usePickerValue.js +2 -2
  276. package/node/internals/hooks/useUtils.js +2 -2
  277. package/node/internals/hooks/useViews.js +2 -2
  278. package/node/internals/index.js +47 -1
  279. package/node/internals/utils/valueManagers.js +2 -2
  280. package/node/internals/utils/views.js +1 -1
  281. package/node/locales/index.js +11 -0
  282. package/package.json +8 -8
  283. package/themeAugmentation/components.d.ts +26 -0
  284. package/themeAugmentation/overrides.d.ts +16 -0
  285. package/themeAugmentation/props.d.ts +16 -0
  286. package/internals/components/PickersInput/PickersFilledInput.d.ts +0 -3
  287. package/internals/components/PickersInput/PickersInput.d.ts +0 -15
  288. package/internals/components/PickersInput/PickersOutlinedInput.d.ts +0 -3
  289. package/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
  290. package/internals/components/PickersInput/PickersStandardInput.d.ts +0 -3
  291. package/internals/components/PickersInput/PickersStandardInput.js +0 -123
  292. package/internals/components/PickersInput/index.js +0 -3
  293. package/internals/components/PickersInput/pickersInputClasses.d.ts +0 -84
  294. package/internals/components/PickersInput/pickersInputClasses.js +0 -18
  295. package/internals/components/PickersTextField/PickersTextField.d.ts +0 -2
  296. package/internals/components/PickersTextField/PickersTextField.js +0 -138
  297. package/internals/components/PickersTextField/index.d.ts +0 -1
  298. package/internals/components/PickersTextField/index.js +0 -1
  299. package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +0 -110
  300. package/legacy/internals/components/PickersInput/PickersStandardInput.js +0 -117
  301. package/legacy/internals/components/PickersInput/index.js +0 -3
  302. package/legacy/internals/components/PickersInput/pickersInputClasses.js +0 -18
  303. package/legacy/internals/components/PickersTextField/index.js +0 -1
  304. package/modern/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
  305. package/modern/internals/components/PickersInput/PickersStandardInput.js +0 -123
  306. package/modern/internals/components/PickersInput/index.js +0 -3
  307. package/modern/internals/components/PickersInput/pickersInputClasses.js +0 -18
  308. package/modern/internals/components/PickersTextField/PickersTextField.js +0 -138
  309. package/modern/internals/components/PickersTextField/index.js +0 -1
  310. package/node/internals/components/PickersInput/PickersOutlinedInput.js +0 -125
  311. package/node/internals/components/PickersInput/PickersStandardInput.js +0 -132
  312. package/node/internals/components/PickersInput/pickersInputClasses.js +0 -29
  313. package/node/internals/components/PickersTextField/index.js +0 -12
  314. /package/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
  315. /package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
  316. /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.d.ts +0 -0
  317. /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
  318. /package/legacy/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
  319. /package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
  320. /package/legacy/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
  321. /package/modern/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
  322. /package/modern/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
  323. /package/modern/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
  324. /package/node/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
  325. /package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
  326. /package/node/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
@@ -475,6 +475,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
475
475
  view: PropTypes.oneOf(['hours', 'minutes', 'seconds']),
476
476
  /**
477
477
  * Available views.
478
+ * @default ['hours', 'minutes']
478
479
  */
479
480
  views: PropTypes.arrayOf(PropTypes.oneOf(['hours', 'minutes', 'seconds']).isRequired)
480
481
  } : void 0;
@@ -64,9 +64,6 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
64
64
  * - the `input` element if there is a field rendered.
65
65
  */
66
66
  autoFocus: PropTypes.bool,
67
- /**
68
- * Class name applied to the root element.
69
- */
70
67
  className: PropTypes.string,
71
68
  /**
72
69
  * If `true`, the popover or modal will close after submitting the full date.
@@ -223,9 +223,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
223
223
  ampm: PropTypes.bool,
224
224
  ampmInClock: PropTypes.bool,
225
225
  classes: PropTypes.object,
226
- /**
227
- * className applied to the root component.
228
- */
229
226
  className: PropTypes.string,
230
227
  disabled: PropTypes.bool,
231
228
  /**
@@ -278,9 +278,6 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
278
278
  * Override or extend the styles applied to the component.
279
279
  */
280
280
  classes: PropTypes.object,
281
- /**
282
- * className applied to the root element.
283
- */
284
281
  className: PropTypes.string,
285
282
  /**
286
283
  * The default selected value.
@@ -42,8 +42,8 @@ export var useClearableField = function useClearableField(props) {
42
42
  });
43
43
  return _extends({}, other, {
44
44
  InputProps: _extends({}, InputProps, {
45
- endAdornment: clearable ? /*#__PURE__*/_jsxs(React.Fragment, {
46
- children: [/*#__PURE__*/_jsx(InputAdornment, {
45
+ endAdornment: /*#__PURE__*/_jsxs(React.Fragment, {
46
+ children: [clearable && /*#__PURE__*/_jsx(InputAdornment, {
47
47
  position: "end",
48
48
  sx: {
49
49
  marginRight: InputProps != null && InputProps.endAdornment ? -1 : -1.5
@@ -55,7 +55,7 @@ export var useClearableField = function useClearableField(props) {
55
55
  }, endClearIconProps))
56
56
  }))
57
57
  }), InputProps == null ? void 0 : InputProps.endAdornment]
58
- }) : InputProps == null ? void 0 : InputProps.endAdornment
58
+ })
59
59
  }),
60
60
  sx: [{
61
61
  '& .clearButton': {
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v7.0.0-alpha.7
2
+ * @mui/x-date-pickers v7.0.0-alpha.9
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,7 +11,7 @@ export * from './DigitalClock';
11
11
  export * from './MultiSectionDigitalClock';
12
12
  export * from './LocalizationProvider';
13
13
  export * from './PickersDay';
14
- export * from './locales';
14
+ export * from './locales/utils/pickersLocaleTextApi';
15
15
 
16
16
  // Fields
17
17
  export * from './DateField';
@@ -51,6 +51,7 @@ export * from './PickersShortcuts';
51
51
  export * from './PickersCalendarHeader';
52
52
 
53
53
  // Field utilities
54
+ export * from './PickersTextField';
54
55
  export * from './PickersSectionList';
55
56
  export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
56
57
  export * from './models';
@@ -25,6 +25,7 @@ export var useField = function useField(params) {
25
25
  updateValueFromValueStr = _useFieldState.updateValueFromValueStr,
26
26
  setTempAndroidValueStr = _useFieldState.setTempAndroidValueStr,
27
27
  sectionsValueBoundaries = _useFieldState.sectionsValueBoundaries,
28
+ localizedDigits = _useFieldState.localizedDigits,
28
29
  placeholder = _useFieldState.placeholder,
29
30
  timezone = _useFieldState.timezone;
30
31
  var internalProps = params.internalProps,
@@ -53,6 +54,7 @@ export var useField = function useField(params) {
53
54
  sections: state.sections,
54
55
  updateSectionValue: updateSectionValue,
55
56
  sectionsValueBoundaries: sectionsValueBoundaries,
57
+ localizedDigits: localizedDigits,
56
58
  setTempAndroidValueStr: setTempAndroidValueStr,
57
59
  timezone: timezone
58
60
  }),
@@ -200,7 +202,7 @@ export var useField = function useField(params) {
200
202
  if (selectedSectionIndexes.startIndex === 0 && selectedSectionIndexes.endIndex === state.sections.length - 1 && cleanValueStr.length === 1) {
201
203
  keyPressed = cleanValueStr;
202
204
  } else {
203
- var prevValueStr = cleanString(fieldValueManager.getValueStrFromSections(state.sections, isRTL));
205
+ var prevValueStr = cleanString(fieldValueManager.getValueStrFromSections(state.sections, localizedDigits, isRTL));
204
206
  var startOfDiffIndex = -1;
205
207
  var endOfDiffIndex = -1;
206
208
  for (var i = 0; i < prevValueStr.length; i += 1) {
@@ -310,7 +312,7 @@ export var useField = function useField(params) {
310
312
  }
311
313
  var activeSection = state.sections[selectedSectionIndexes.startIndex];
312
314
  var activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
313
- var newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, activeDateManager.date, {
315
+ var newSectionValue = adjustSectionValue(utils, timezone, activeSection, event.key, sectionsValueBoundaries, localizedDigits, activeDateManager.date, {
314
316
  minutesStep: minutesStep
315
317
  });
316
318
  updateSectionValue({
@@ -397,8 +399,8 @@ export var useField = function useField(params) {
397
399
 
398
400
  var valueStr = React.useMemo(function () {
399
401
  var _state$tempValueStrAn;
400
- return (_state$tempValueStrAn = state.tempValueStrAndroid) != null ? _state$tempValueStrAn : fieldValueManager.getValueStrFromSections(state.sections, isRTL);
401
- }, [state.sections, fieldValueManager, state.tempValueStrAndroid, isRTL]);
402
+ return (_state$tempValueStrAn = state.tempValueStrAndroid) != null ? _state$tempValueStrAn : fieldValueManager.getValueStrFromSections(state.sections, localizedDigits, isRTL);
403
+ }, [state.sections, fieldValueManager, state.tempValueStrAndroid, localizedDigits, isRTL]);
402
404
  var inputMode = React.useMemo(function () {
403
405
  if (selectedSectionIndexes == null) {
404
406
  return 'text';
@@ -4,7 +4,7 @@ import { getMonthsInYear } from '../../utils/date-utils';
4
4
  export var getDateSectionConfigFromFormatToken = function getDateSectionConfigFromFormatToken(utils, formatToken) {
5
5
  var config = utils.formatTokenMap[formatToken];
6
6
  if (config == null) {
7
- throw new Error(["MUI: The token \"".concat(formatToken, "\" is not supported by the Date and Time Pickers."), 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
7
+ throw new Error(["MUI X: The token \"".concat(formatToken, "\" is not supported by the Date and Time Pickers."), 'Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported.'].join('\n'));
8
8
  }
9
9
  if (typeof config === 'string') {
10
10
  return {
@@ -72,7 +72,58 @@ export var getLetterEditingOptions = function getLetterEditingOptions(utils, tim
72
72
  }
73
73
  }
74
74
  };
75
- export var cleanLeadingZeros = function cleanLeadingZeros(utils, valueStr, size) {
75
+
76
+ // This format should be the same on all the adapters
77
+ // If some adapter does not respect this convention, then we will need to hardcode the format on each adapter.
78
+ export var FORMAT_SECONDS_NO_LEADING_ZEROS = 's';
79
+ var NON_LOCALIZED_DIGITS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
80
+ export var getLocalizedDigits = function getLocalizedDigits(utils) {
81
+ var today = utils.date(undefined);
82
+ var formattedZero = utils.formatByString(utils.setSeconds(today, 0), FORMAT_SECONDS_NO_LEADING_ZEROS);
83
+ if (formattedZero === '0') {
84
+ return NON_LOCALIZED_DIGITS;
85
+ }
86
+ return Array.from({
87
+ length: 10
88
+ }).map(function (_, index) {
89
+ return utils.formatByString(utils.setSeconds(today, index), FORMAT_SECONDS_NO_LEADING_ZEROS);
90
+ });
91
+ };
92
+ export var removeLocalizedDigits = function removeLocalizedDigits(valueStr, localizedDigits) {
93
+ if (localizedDigits[0] === '0') {
94
+ return valueStr;
95
+ }
96
+ var digits = [];
97
+ var currentFormattedDigit = '';
98
+ for (var i = 0; i < valueStr.length; i += 1) {
99
+ currentFormattedDigit += valueStr[i];
100
+ var matchingDigitIndex = localizedDigits.indexOf(currentFormattedDigit);
101
+ if (matchingDigitIndex > -1) {
102
+ digits.push(matchingDigitIndex.toString());
103
+ currentFormattedDigit = '';
104
+ }
105
+ }
106
+ return digits.join('');
107
+ };
108
+ export var applyLocalizedDigits = function applyLocalizedDigits(valueStr, localizedDigits) {
109
+ if (localizedDigits[0] === '0') {
110
+ return valueStr;
111
+ }
112
+ return valueStr.split('').map(function (char) {
113
+ return localizedDigits[Number(char)];
114
+ }).join('');
115
+ };
116
+ export var isStringNumber = function isStringNumber(valueStr, localizedDigits) {
117
+ var nonLocalizedValueStr = removeLocalizedDigits(valueStr, localizedDigits);
118
+ return !Number.isNaN(Number(nonLocalizedValueStr));
119
+ };
120
+
121
+ /**
122
+ * Remove the leading zeroes to a digit section value.
123
+ * E.g.: `03` => `3`
124
+ * Warning: Should only be called with non-localized digits. Call `removeLocalizedDigits` with your value if needed.
125
+ */
126
+ export var cleanLeadingZeros = function cleanLeadingZeros(valueStr, size) {
76
127
  var cleanValueStr = valueStr;
77
128
 
78
129
  // Remove the leading zeros
@@ -84,10 +135,10 @@ export var cleanLeadingZeros = function cleanLeadingZeros(utils, valueStr, size)
84
135
  }
85
136
  return cleanValueStr;
86
137
  };
87
- export var cleanDigitSectionValue = function cleanDigitSectionValue(utils, timezone, value, sectionBoundaries, section) {
138
+ export var cleanDigitSectionValue = function cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section) {
88
139
  if (process.env.NODE_ENV !== 'production') {
89
140
  if (section.type !== 'day' && section.contentType === 'digit-with-letter') {
90
- throw new Error(["MUI: The token \"".concat(section.format, "\" is a digit format with letter in it.'\n This type of format is only supported for 'day' sections")].join('\n'));
141
+ throw new Error(["MUI X: The token \"".concat(section.format, "\" is a digit format with letter in it.'\n This type of format is only supported for 'day' sections")].join('\n'));
91
142
  }
92
143
  }
93
144
  if (section.type === 'day' && section.contentType === 'digit-with-letter') {
@@ -98,11 +149,11 @@ export var cleanDigitSectionValue = function cleanDigitSectionValue(utils, timez
98
149
  // queryValue without leading `0` (`01` => `1`)
99
150
  var valueStr = value.toString();
100
151
  if (section.hasLeadingZerosInInput) {
101
- return cleanLeadingZeros(utils, valueStr, section.maxLength);
152
+ valueStr = cleanLeadingZeros(valueStr, section.maxLength);
102
153
  }
103
- return valueStr;
154
+ return applyLocalizedDigits(valueStr, localizedDigits);
104
155
  };
105
- export var adjustSectionValue = function adjustSectionValue(utils, timezone, section, keyCode, sectionsValueBoundaries, activeDate, stepsAttributes) {
156
+ export var adjustSectionValue = function adjustSectionValue(utils, timezone, section, keyCode, sectionsValueBoundaries, localizedDigits, activeDate, stepsAttributes) {
106
157
  var delta = getDeltaFromKeyCode(keyCode);
107
158
  var isStart = keyCode === 'Home';
108
159
  var isEnd = keyCode === 'End';
@@ -114,10 +165,10 @@ export var adjustSectionValue = function adjustSectionValue(utils, timezone, sec
114
165
  contentType: section.contentType
115
166
  });
116
167
  var getCleanValue = function getCleanValue(value) {
117
- return cleanDigitSectionValue(utils, timezone, value, sectionBoundaries, section);
168
+ return cleanDigitSectionValue(utils, value, sectionBoundaries, localizedDigits, section);
118
169
  };
119
170
  var step = section.type === 'minutes' && stepsAttributes != null && stepsAttributes.minutesStep ? stepsAttributes.minutesStep : 1;
120
- var currentSectionValue = parseInt(section.value, 10);
171
+ var currentSectionValue = parseInt(removeLocalizedDigits(section.value, localizedDigits), 10);
121
172
  var newSectionValueNumber = currentSectionValue + delta * step;
122
173
  if (shouldSetAbsolute) {
123
174
  if (section.type === 'year' && !isEnd && !isStart) {
@@ -165,11 +216,11 @@ export var adjustSectionValue = function adjustSectionValue(utils, timezone, sec
165
216
  }
166
217
  return adjustLetterSection();
167
218
  };
168
- export var getSectionVisibleValue = function getSectionVisibleValue(section, target) {
219
+ export var getSectionVisibleValue = function getSectionVisibleValue(section, target, localizedDigits) {
169
220
  var value = section.value || section.placeholder;
170
221
  var hasLeadingZeros = target === 'non-input' ? section.hasLeadingZerosInFormat : section.hasLeadingZerosInInput;
171
222
  if (target === 'non-input' && section.hasLeadingZerosInInput && !section.hasLeadingZerosInFormat) {
172
- value = Number(value).toString();
223
+ value = Number(removeLocalizedDigits(value, localizedDigits)).toString();
173
224
  }
174
225
 
175
226
  // In the input, we add an empty character at the end of each section without leading zeros.
@@ -189,13 +240,13 @@ export var getSectionVisibleValue = function getSectionVisibleValue(section, tar
189
240
  export var cleanString = function cleanString(dirtyString) {
190
241
  return dirtyString.replace(/[\u2066\u2067\u2068\u2069]/g, '');
191
242
  };
192
- export var addPositionPropertiesToSections = function addPositionPropertiesToSections(sections, isRTL) {
243
+ export var addPositionPropertiesToSections = function addPositionPropertiesToSections(sections, localizedDigits, isRTL) {
193
244
  var position = 0;
194
245
  var positionInInput = isRTL ? 1 : 0;
195
246
  var newSections = [];
196
247
  for (var i = 0; i < sections.length; i += 1) {
197
248
  var section = sections[i];
198
- var renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
249
+ var renderedValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
199
250
  var sectionStr = "".concat(section.startSeparator).concat(renderedValue).concat(section.endSeparator);
200
251
  var sectionLength = cleanString(sectionStr).length;
201
252
  var sectionLengthInInput = sectionStr.length;
@@ -348,7 +399,7 @@ var getEscapedPartsFromFormat = function getEscapedPartsFromFormat(utils, format
348
399
  }
349
400
  return escapedParts;
350
401
  };
351
- export var splitFormatIntoSections = function splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) {
402
+ export var splitFormatIntoSections = function splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL) {
352
403
  var startSeparator = '';
353
404
  var sections = [];
354
405
  var now = utils.date();
@@ -367,11 +418,11 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
367
418
  maxLength = sectionValue === '' ? utils.formatByString(now, token).length : sectionValue.length;
368
419
  } else {
369
420
  if (sectionConfig.maxLength == null) {
370
- throw new Error("MUI: The token ".concat(token, " should have a 'maxDigitNumber' property on it's adapter"));
421
+ throw new Error("MUI X: The token ".concat(token, " should have a 'maxDigitNumber' property on it's adapter"));
371
422
  }
372
423
  maxLength = sectionConfig.maxLength;
373
424
  if (isValidDate) {
374
- sectionValue = cleanLeadingZeros(utils, sectionValue, maxLength);
425
+ sectionValue = applyLocalizedDigits(cleanLeadingZeros(removeLocalizedDigits(sectionValue, localizedDigits), maxLength), localizedDigits);
375
426
  }
376
427
  }
377
428
  }
@@ -398,7 +449,7 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
398
449
  nextFormat = utils.expandFormat(prevFormat);
399
450
  formatExpansionOverflow -= 1;
400
451
  if (formatExpansionOverflow < 0) {
401
- throw new Error('MUI: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component');
452
+ throw new Error('MUI X: The format expansion seems to be enter in an infinite loop. Please open an issue with the format passed to the picker component.');
402
453
  }
403
454
  }
404
455
  var expandedFormat = nextFormat;
@@ -480,7 +531,7 @@ export var splitFormatIntoSections = function splitFormatIntoSections(utils, tim
480
531
  * Some date libraries like `dayjs` don't support parsing from date with escaped characters.
481
532
  * To make sure that the parsing works, we are building a format and a date without any separator.
482
533
  */
483
- export var getDateFromDateSections = function getDateFromDateSections(utils, sections) {
534
+ export var getDateFromDateSections = function getDateFromDateSections(utils, sections, localizedDigits) {
484
535
  // If we have both a day and a weekDay section,
485
536
  // Then we skip the weekDay in the parsing because libraries like dayjs can't parse complicated formats containing a weekDay.
486
537
  // dayjs(dayjs().format('dddd MMMM D YYYY'), 'dddd MMMM D YYYY')) // returns `Invalid Date` even if the format is valid.
@@ -494,16 +545,16 @@ export var getDateFromDateSections = function getDateFromDateSections(utils, sec
494
545
  var shouldSkip = shouldSkipWeekDays && section.type === 'weekDay';
495
546
  if (!shouldSkip) {
496
547
  sectionFormats.push(section.format);
497
- sectionValues.push(getSectionVisibleValue(section, 'non-input'));
548
+ sectionValues.push(getSectionVisibleValue(section, 'non-input', localizedDigits));
498
549
  }
499
550
  }
500
551
  var formatWithoutSeparator = sectionFormats.join(' ');
501
552
  var dateWithoutSeparatorStr = sectionValues.join(' ');
502
553
  return utils.parse(dateWithoutSeparatorStr, formatWithoutSeparator);
503
554
  };
504
- export var createDateStrForInputFromSections = function createDateStrForInputFromSections(sections, isRTL) {
555
+ export var createDateStrForInputFromSections = function createDateStrForInputFromSections(sections, localizedDigits, isRTL) {
505
556
  var formattedSections = sections.map(function (section) {
506
- var dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr');
557
+ var dateValue = getSectionVisibleValue(section, isRTL ? 'input-rtl' : 'input-ltr', localizedDigits);
507
558
  return "".concat(section.startSeparator).concat(dateValue).concat(section.endSeparator);
508
559
  });
509
560
  var dateStr = formattedSections.join('');
@@ -518,7 +569,7 @@ export var createDateStrForInputFromSections = function createDateStrForInputFro
518
569
  // wrap into an isolated group such that separators can split the string in smaller ones by adding \u2069\u2068
519
570
  return "\u2066".concat(dateStr, "\u2069");
520
571
  };
521
- export var getSectionsBoundaries = function getSectionsBoundaries(utils, timezone) {
572
+ export var getSectionsBoundaries = function getSectionsBoundaries(utils, localizedDigits, timezone) {
522
573
  var today = utils.date(undefined, timezone);
523
574
  var endOfYear = utils.endOfYear(today);
524
575
  var endOfDay = utils.endOfDay(today);
@@ -578,11 +629,11 @@ export var getSectionsBoundaries = function getSectionsBoundaries(utils, timezon
578
629
  hours: function hours(_ref4) {
579
630
  var format = _ref4.format;
580
631
  var lastHourInDay = utils.getHours(endOfDay);
581
- var hasMeridiem = utils.formatByString(utils.endOfDay(today), format) !== lastHourInDay.toString();
632
+ var hasMeridiem = removeLocalizedDigits(utils.formatByString(utils.endOfDay(today), format), localizedDigits) !== lastHourInDay.toString();
582
633
  if (hasMeridiem) {
583
634
  return {
584
635
  minimum: 1,
585
- maximum: Number(utils.formatByString(utils.startOfDay(today), format))
636
+ maximum: Number(removeLocalizedDigits(utils.formatByString(utils.startOfDay(today), format), localizedDigits))
586
637
  };
587
638
  }
588
639
  return {
@@ -633,7 +684,7 @@ export var validateSections = function validateSections(sections, valueType) {
633
684
  return !supportedSections.includes(section.type);
634
685
  });
635
686
  if (invalidSection) {
636
- console.warn("MUI: The field component you are using is not compatible with the \"".concat(invalidSection.type, "\" date section."), "The supported date sections are [\"".concat(supportedSections.join('", "'), "\"]`."));
687
+ console.warn("MUI X: The field component you are using is not compatible with the \"".concat(invalidSection.type, "\" date section."), "The supported date sections are [\"".concat(supportedSections.join('", "'), "\"]`."));
637
688
  warnedOnceInvalidSection = true;
638
689
  }
639
690
  }
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
3
  import * as React from 'react';
4
4
  import useEventCallback from '@mui/utils/useEventCallback';
5
5
  import { useUtils } from '../useUtils';
6
- import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions } from './useField.utils';
6
+ import { changeSectionValueFormat, cleanDigitSectionValue, doesSectionFormatHaveLeadingZeros, getDateSectionConfigFromFormatToken, getDaysInWeekStr, getLetterEditingOptions, applyLocalizedDigits, removeLocalizedDigits, isStringNumber } from './useField.utils';
7
7
 
8
8
  /**
9
9
  * The letter editing and the numeric editing each define a `CharacterEditingApplier`.
@@ -43,6 +43,7 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
43
43
  var sections = _ref.sections,
44
44
  updateSectionValue = _ref.updateSectionValue,
45
45
  sectionsValueBoundaries = _ref.sectionsValueBoundaries,
46
+ localizedDigits = _ref.localizedDigits,
46
47
  setTempAndroidValueStr = _ref.setTempAndroidValueStr,
47
48
  timezone = _ref.timezone;
48
49
  var utils = useUtils();
@@ -77,7 +78,7 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
77
78
  var activeSection = sections[sectionIndex];
78
79
 
79
80
  // The current query targets the section being editing
80
- // We can try to concatenated value
81
+ // We can try to concatenate the value
81
82
  if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
82
83
  var concatenatedQueryValue = "".concat(query.value).concat(cleanKeyPressed);
83
84
  var _queryResponse = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
@@ -179,7 +180,8 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
179
180
  };
180
181
  var applyNumericEditing = function applyNumericEditing(params) {
181
182
  var getNewSectionValue = function getNewSectionValue(queryValue, section) {
182
- var queryValueNumber = Number("".concat(queryValue));
183
+ var cleanQueryValue = removeLocalizedDigits(queryValue, localizedDigits);
184
+ var queryValueNumber = Number(cleanQueryValue);
183
185
  var sectionBoundaries = sectionsValueBoundaries[section.type]({
184
186
  currentDate: null,
185
187
  format: section.format,
@@ -199,8 +201,8 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
199
201
  saveQuery: true
200
202
  };
201
203
  }
202
- var shouldGoToNextSection = Number("".concat(queryValue, "0")) > sectionBoundaries.maximum || queryValue.length === sectionBoundaries.maximum.toString().length;
203
- var newSectionValue = cleanDigitSectionValue(utils, timezone, queryValueNumber, sectionBoundaries, section);
204
+ var shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
205
+ var newSectionValue = cleanDigitSectionValue(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
204
206
  return {
205
207
  sectionValue: newSectionValue,
206
208
  shouldGoToNextSection: shouldGoToNextSection
@@ -249,13 +251,15 @@ export var useFieldCharacterEditing = function useFieldCharacterEditing(_ref) {
249
251
  };
250
252
  };
251
253
  return applyQuery(params, getFirstSectionValueMatchingWithQuery, function (queryValue) {
252
- return !Number.isNaN(Number(queryValue));
254
+ return isStringNumber(queryValue, localizedDigits);
253
255
  });
254
256
  };
255
257
  var applyCharacterEditing = useEventCallback(function (params) {
256
258
  var activeSection = sections[params.sectionIndex];
257
- var isNumericEditing = !Number.isNaN(Number(params.keyPressed));
258
- var response = isNumericEditing ? applyNumericEditing(params) : applyLetterEditing(params);
259
+ var isNumericEditing = isStringNumber(params.keyPressed, localizedDigits);
260
+ var response = isNumericEditing ? applyNumericEditing(_extends({}, params, {
261
+ keyPressed: applyLocalizedDigits(params.keyPressed, localizedDigits)
262
+ })) : applyLetterEditing(params);
259
263
  if (response == null) {
260
264
  setTempAndroidValueStr(null);
261
265
  } else {
@@ -5,7 +5,7 @@ import * as React from 'react';
5
5
  import useControlled from '@mui/utils/useControlled';
6
6
  import { useTheme } from '@mui/material/styles';
7
7
  import { useUtils, useLocaleText, useLocalizationContext } from '../useUtils';
8
- import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections } from './useField.utils';
8
+ import { addPositionPropertiesToSections, splitFormatIntoSections, mergeDateIntoReferenceDate, getSectionsBoundaries, validateSections, getDateFromDateSections, getLocalizedDigits } from './useField.utils';
9
9
  import { useValueWithTimezone } from '../useValueWithTimezone';
10
10
  import { getSectionTypeGranularity } from '../../utils/getDefaultReferenceDate';
11
11
  export var useFieldState = function useFieldState(params) {
@@ -42,18 +42,21 @@ export var useFieldState = function useFieldState(params) {
42
42
  timezone = _useValueWithTimezone.timezone,
43
43
  valueFromTheOutside = _useValueWithTimezone.value,
44
44
  handleValueChange = _useValueWithTimezone.handleValueChange;
45
+ var localizedDigits = React.useMemo(function () {
46
+ return getLocalizedDigits(utils);
47
+ }, [utils]);
45
48
  var sectionsValueBoundaries = React.useMemo(function () {
46
- return getSectionsBoundaries(utils, timezone);
47
- }, [utils, timezone]);
49
+ return getSectionsBoundaries(utils, localizedDigits, timezone);
50
+ }, [utils, localizedDigits, timezone]);
48
51
  var getSectionsFromValue = React.useCallback(function (value) {
49
52
  var fallbackSections = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
50
- return fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, isRTL, function (date) {
51
- return splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
53
+ return fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, function (date) {
54
+ return splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
52
55
  });
53
- }, [fieldValueManager, format, localeText, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
56
+ }, [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
54
57
  var placeholder = React.useMemo(function () {
55
- return fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), isRTL);
56
- }, [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, isRTL]);
58
+ return fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL);
59
+ }, [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
57
60
  var _React$useState = React.useState(function () {
58
61
  var sections = getSectionsFromValue(valueFromTheOutside);
59
62
  validateSections(sections, valueType);
@@ -162,7 +165,7 @@ export var useFieldState = function useFieldState(params) {
162
165
  value: newSectionValue,
163
166
  modified: true
164
167
  });
165
- return addPositionPropertiesToSections(newSections, isRTL);
168
+ return addPositionPropertiesToSections(newSections, localizedDigits, isRTL);
166
169
  };
167
170
  var clearValue = function clearValue() {
168
171
  publishValue({
@@ -203,7 +206,7 @@ export var useFieldState = function useFieldState(params) {
203
206
  if (date == null || !utils.isValid(date)) {
204
207
  return null;
205
208
  }
206
- var sections = splitFormatIntoSections(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
209
+ var sections = splitFormatIntoSections(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
207
210
  return mergeDateIntoReferenceDate(utils, timezone, date, sections, referenceDate, false);
208
211
  };
209
212
  var newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
@@ -233,7 +236,7 @@ export var useFieldState = function useFieldState(params) {
233
236
  var activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
234
237
  var newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
235
238
  var newActiveDateSections = activeDateManager.getSections(newSections);
236
- var newActiveDate = getDateFromDateSections(utils, newActiveDateSections);
239
+ var newActiveDate = getDateFromDateSections(utils, newActiveDateSections, localizedDigits);
237
240
  var values;
238
241
  var shouldPublish;
239
242
 
@@ -311,6 +314,7 @@ export var useFieldState = function useFieldState(params) {
311
314
  updateValueFromValueStr: updateValueFromValueStr,
312
315
  setTempAndroidValueStr: setTempAndroidValueStr,
313
316
  sectionsValueBoundaries: sectionsValueBoundaries,
317
+ localizedDigits: localizedDigits,
314
318
  placeholder: placeholder,
315
319
  timezone: timezone
316
320
  };
@@ -129,12 +129,12 @@ export var usePickerValue = function usePickerValue(_ref) {
129
129
  if (process.env.NODE_ENV !== 'production') {
130
130
  React.useEffect(function () {
131
131
  if (isControlled !== (inValue !== undefined)) {
132
- console.error(["MUI: A component is changing the ".concat(isControlled ? '' : 'un', "controlled value of a picker to be ").concat(isControlled ? 'un' : '', "controlled."), 'Elements should not switch from uncontrolled to controlled (or vice versa).', "Decide between using a controlled or uncontrolled value" + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
132
+ console.error(["MUI X: A component is changing the ".concat(isControlled ? '' : 'un', "controlled value of a picker to be ").concat(isControlled ? 'un' : '', "controlled."), 'Elements should not switch from uncontrolled to controlled (or vice versa).', "Decide between using a controlled or uncontrolled value" + 'for the lifetime of the component.', "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", 'More info: https://fb.me/react-controlled-components'].join('\n'));
133
133
  }
134
134
  }, [inValue]);
135
135
  React.useEffect(function () {
136
136
  if (!isControlled && defaultValue !== inDefaultValue) {
137
- console.error(["MUI: A component is changing the defaultValue of an uncontrolled picker after being initialized. " + "To suppress this warning opt to use a controlled value."].join('\n'));
137
+ console.error(["MUI X: A component is changing the defaultValue of an uncontrolled picker after being initialized. " + "To suppress this warning opt to use a controlled value."].join('\n'));
138
138
  }
139
139
  }, [JSON.stringify(defaultValue)]);
140
140
  }
@@ -5,10 +5,10 @@ import { DEFAULT_LOCALE } from '../../locales/enUS';
5
5
  export var useLocalizationContext = function useLocalizationContext() {
6
6
  var localization = React.useContext(MuiPickersAdapterContext);
7
7
  if (localization === null) {
8
- throw new Error(['MUI: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
8
+ throw new Error(['MUI X: Can not find the date and time pickers localization context.', 'It looks like you forgot to wrap your component in LocalizationProvider.', 'This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package'].join('\n'));
9
9
  }
10
10
  if (localization.utils === null) {
11
- throw new Error(['MUI: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
11
+ throw new Error(['MUI X: Can not find the date and time pickers adapter from its localization context.', 'It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider.'].join('\n'));
12
12
  }
13
13
  var localeText = React.useMemo(function () {
14
14
  return _extends({}, DEFAULT_LOCALE, localization.localeText);
@@ -16,11 +16,11 @@ export function useViews(_ref) {
16
16
  if (process.env.NODE_ENV !== 'production') {
17
17
  if (!warnedOnceNotValidView) {
18
18
  if (inView != null && !views.includes(inView)) {
19
- console.warn("MUI: `view=\"".concat(inView, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
19
+ console.warn("MUI X: `view=\"".concat(inView, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
20
20
  warnedOnceNotValidView = true;
21
21
  }
22
22
  if (inView == null && openTo != null && !views.includes(openTo)) {
23
- console.warn("MUI: `openTo=\"".concat(openTo, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
23
+ console.warn("MUI X: `openTo=\"".concat(openTo, "\"` is not a valid prop."), "It must be an element of `views=[\"".concat(views.join('", "'), "\"]`."));
24
24
  warnedOnceNotValidView = true;
25
25
  }
26
26
  }
@@ -14,10 +14,12 @@ export { useField, createDateStrForInputFromSections, addPositionPropertiesToSec
14
14
  export { usePicker } from './hooks/usePicker';
15
15
  export { useStaticPicker } from './hooks/useStaticPicker';
16
16
  export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow } from './hooks/useUtils';
17
+ export { useViews } from './hooks/useViews';
17
18
  export { useValidation } from './hooks/useValidation';
18
19
  export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
19
20
  export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
20
- export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate } from './utils/date-utils';
21
+ export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, isDatePickerView, mergeDateAndTime, formatMeridiem } from './utils/date-utils';
22
+ export { resolveTimeViewsResponse } from './utils/date-time-utils';
21
23
  export { splitFieldInternalAndForwardedProps } from './utils/fields';
22
24
  export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
23
25
  export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
@@ -26,6 +28,8 @@ export { extractValidationProps } from './utils/validation/extractValidationProp
26
28
  export { validateDate } from './utils/validation/validateDate';
27
29
  export { validateDateTime } from './utils/validation/validateDateTime';
28
30
  export { validateTime } from './utils/validation/validateTime';
31
+ export { applyDefaultViewProps } from './utils/views';
29
32
  export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
30
33
  export { DayCalendar } from '../DateCalendar/DayCalendar';
31
- export { useCalendarState } from '../DateCalendar/useCalendarState';
34
+ export { useCalendarState } from '../DateCalendar/useCalendarState';
35
+ export { isTimeView } from './utils/time-utils';
@@ -38,12 +38,12 @@ export var singleItemFieldValueManager = {
38
38
  updateReferenceValue: function updateReferenceValue(utils, value, prevReferenceValue) {
39
39
  return value == null || !utils.isValid(value) ? prevReferenceValue : value;
40
40
  },
41
- getSectionsFromValue: function getSectionsFromValue(utils, date, prevSections, isRTL, getSectionsFromDate) {
41
+ getSectionsFromValue: function getSectionsFromValue(utils, date, prevSections, localizedDigits, isRTL, getSectionsFromDate) {
42
42
  var shouldReUsePrevDateSections = !utils.isValid(date) && !!prevSections;
43
43
  if (shouldReUsePrevDateSections) {
44
44
  return prevSections;
45
45
  }
46
- return addPositionPropertiesToSections(getSectionsFromDate(date), isRTL);
46
+ return addPositionPropertiesToSections(getSectionsFromDate(date), localizedDigits, isRTL);
47
47
  },
48
48
  getValueStrFromSections: createDateStrForInputFromSections,
49
49
  getActiveDateManager: function getActiveDateManager(utils, state) {
@@ -20,7 +20,7 @@ export var applyDefaultViewProps = function applyDefaultViewProps(_ref) {
20
20
  } else if (viewsWithDefault.length > 0) {
21
21
  openToWithDefault = viewsWithDefault[0];
22
22
  } else {
23
- throw new Error('MUI: The `views` prop must contain at least one view');
23
+ throw new Error('MUI X: The `views` prop must contain at least one view.');
24
24
  }
25
25
  return {
26
26
  views: viewsWithDefault,
@@ -1,6 +1,7 @@
1
1
  export * from './beBY';
2
2
  export * from './caES';
3
3
  export * from './csCZ';
4
+ export * from './daDK';
4
5
  export * from './deDE';
5
6
  export * from './elGR';
6
7
  export * from './enUS';
package/locales/enUS.d.ts CHANGED
@@ -24,7 +24,7 @@ export declare const enUS: {
24
24
  hoursClockNumberText?: ((hours: string) => string) | undefined;
25
25
  minutesClockNumberText?: ((minutes: string) => string) | undefined;
26
26
  secondsClockNumberText?: ((seconds: string) => string) | undefined;
27
- selectViewText?: ((view: import("../internals/models").TimeViewWithMeridiem) => string) | undefined;
27
+ selectViewText?: ((view: import("../internals").TimeViewWithMeridiem) => string) | undefined;
28
28
  openDatePickerDialogue?: ((date: any, utils: import("..").MuiPickersAdapter<any, any>) => string) | undefined;
29
29
  openTimePickerDialogue?: ((date: any, utils: import("..").MuiPickersAdapter<any, any>) => string) | undefined;
30
30
  fieldClearLabel?: string | undefined;
@@ -1,6 +1,7 @@
1
1
  export * from './beBY';
2
2
  export * from './caES';
3
3
  export * from './csCZ';
4
+ export * from './daDK';
4
5
  export * from './deDE';
5
6
  export * from './elGR';
6
7
  export * from './enUS';