@mui/x-date-pickers 6.0.0 → 6.0.2

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 (178) hide show
  1. package/AdapterDateFns/index.js +1 -0
  2. package/AdapterDayjs/index.js +1 -0
  3. package/AdapterMoment/index.js +1 -0
  4. package/AdapterMomentHijri/index.d.ts +1 -1
  5. package/CHANGELOG.md +103 -12
  6. package/DateCalendar/DateCalendar.js +2 -2
  7. package/DateCalendar/PickersCalendarHeader.d.ts +2 -2
  8. package/DateField/DateField.js +2 -2
  9. package/DatePicker/DatePicker.js +2 -2
  10. package/DatePicker/DatePicker.types.d.ts +2 -2
  11. package/DatePicker/shared.d.ts +2 -2
  12. package/DateTimeField/DateTimeField.js +2 -2
  13. package/DateTimeField/DateTimeField.types.d.ts +2 -2
  14. package/DateTimePicker/DateTimePicker.js +2 -2
  15. package/DateTimePicker/DateTimePicker.types.d.ts +2 -2
  16. package/DateTimePicker/shared.d.ts +2 -2
  17. package/DesktopDatePicker/DesktopDatePicker.js +2 -2
  18. package/DesktopDatePicker/DesktopDatePicker.types.d.ts +2 -2
  19. package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  20. package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +2 -2
  21. package/DesktopTimePicker/DesktopTimePicker.js +2 -2
  22. package/DesktopTimePicker/DesktopTimePicker.types.d.ts +2 -2
  23. package/MobileDatePicker/MobileDatePicker.js +2 -2
  24. package/MobileDatePicker/MobileDatePicker.types.d.ts +2 -2
  25. package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  26. package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +2 -2
  27. package/MobileTimePicker/MobileTimePicker.js +2 -2
  28. package/MobileTimePicker/MobileTimePicker.types.d.ts +2 -2
  29. package/PickersLayout/PickersLayout.js +2 -2
  30. package/PickersLayout/PickersLayout.types.d.ts +2 -2
  31. package/StaticDatePicker/StaticDatePicker.js +2 -2
  32. package/StaticDatePicker/StaticDatePicker.types.d.ts +2 -2
  33. package/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  34. package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +2 -2
  35. package/StaticTimePicker/StaticTimePicker.js +2 -2
  36. package/StaticTimePicker/StaticTimePicker.types.d.ts +2 -2
  37. package/TimeClock/TimeClock.js +2 -2
  38. package/TimeClock/TimeClock.types.d.ts +2 -2
  39. package/TimeField/TimeField.js +2 -2
  40. package/TimeField/TimeField.types.d.ts +2 -2
  41. package/TimePicker/TimePicker.js +2 -2
  42. package/TimePicker/TimePicker.types.d.ts +2 -2
  43. package/TimePicker/shared.d.ts +2 -2
  44. package/index.js +1 -1
  45. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +8 -2
  46. package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +2 -2
  47. package/internals/components/PickersModalDialog.d.ts +4 -4
  48. package/internals/components/PickersPopper.d.ts +1 -1
  49. package/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -11
  50. package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +1 -1
  51. package/internals/hooks/useField/useField.js +11 -5
  52. package/internals/hooks/useField/useField.types.d.ts +13 -8
  53. package/internals/hooks/useField/useField.utils.d.ts +3 -3
  54. package/internals/hooks/useField/useField.utils.js +63 -35
  55. package/internals/hooks/useField/useFieldCharacterEditing.js +4 -9
  56. package/internals/hooks/useField/useFieldState.js +43 -37
  57. package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +1 -1
  58. package/internals/hooks/usePicker/usePicker.js +7 -0
  59. package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +2 -2
  60. package/internals/hooks/useViews.js +1 -1
  61. package/internals/utils/slots-migration.d.ts +2 -2
  62. package/internals/utils/valueManagers.js +11 -7
  63. package/legacy/AdapterDateFns/index.js +1 -0
  64. package/legacy/AdapterDayjs/index.js +1 -0
  65. package/legacy/AdapterMoment/index.js +1 -0
  66. package/legacy/DateCalendar/DateCalendar.js +2 -2
  67. package/legacy/DateField/DateField.js +2 -2
  68. package/legacy/DatePicker/DatePicker.js +2 -2
  69. package/legacy/DateTimeField/DateTimeField.js +2 -2
  70. package/legacy/DateTimePicker/DateTimePicker.js +2 -2
  71. package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -2
  72. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  73. package/legacy/DesktopTimePicker/DesktopTimePicker.js +2 -2
  74. package/legacy/MobileDatePicker/MobileDatePicker.js +2 -2
  75. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  76. package/legacy/MobileTimePicker/MobileTimePicker.js +2 -2
  77. package/legacy/PickersLayout/PickersLayout.js +2 -2
  78. package/legacy/StaticDatePicker/StaticDatePicker.js +2 -2
  79. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  80. package/legacy/StaticTimePicker/StaticTimePicker.js +2 -2
  81. package/legacy/TimeClock/TimeClock.js +2 -2
  82. package/legacy/TimeField/TimeField.js +2 -2
  83. package/legacy/TimePicker/TimePicker.js +2 -2
  84. package/legacy/index.js +1 -1
  85. package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +8 -2
  86. package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +15 -12
  87. package/legacy/internals/hooks/useField/useField.js +11 -5
  88. package/legacy/internals/hooks/useField/useField.utils.js +64 -36
  89. package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +4 -9
  90. package/legacy/internals/hooks/useField/useFieldState.js +45 -39
  91. package/legacy/internals/hooks/usePicker/usePicker.js +7 -0
  92. package/legacy/internals/hooks/useViews.js +1 -1
  93. package/legacy/internals/utils/valueManagers.js +4 -0
  94. package/legacy/locales/deDE.js +8 -5
  95. package/legacy/locales/frFR.js +34 -20
  96. package/legacy/locales/heIL.js +71 -0
  97. package/legacy/locales/index.js +1 -0
  98. package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +20 -1
  99. package/locales/deDE.js +4 -5
  100. package/locales/frFR.js +16 -20
  101. package/locales/heIL.d.ts +51 -0
  102. package/locales/heIL.js +57 -0
  103. package/locales/index.d.ts +1 -0
  104. package/locales/index.js +1 -0
  105. package/modern/AdapterDateFns/index.js +1 -0
  106. package/modern/AdapterDayjs/index.js +1 -0
  107. package/modern/AdapterMoment/index.js +1 -0
  108. package/modern/DateCalendar/DateCalendar.js +2 -2
  109. package/modern/DateField/DateField.js +2 -2
  110. package/modern/DatePicker/DatePicker.js +2 -2
  111. package/modern/DateTimeField/DateTimeField.js +2 -2
  112. package/modern/DateTimePicker/DateTimePicker.js +2 -2
  113. package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -2
  114. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  115. package/modern/DesktopTimePicker/DesktopTimePicker.js +2 -2
  116. package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
  117. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  118. package/modern/MobileTimePicker/MobileTimePicker.js +2 -2
  119. package/modern/PickersLayout/PickersLayout.js +2 -2
  120. package/modern/StaticDatePicker/StaticDatePicker.js +2 -2
  121. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  122. package/modern/StaticTimePicker/StaticTimePicker.js +2 -2
  123. package/modern/TimeClock/TimeClock.js +2 -2
  124. package/modern/TimeField/TimeField.js +2 -2
  125. package/modern/TimePicker/TimePicker.js +2 -2
  126. package/modern/index.js +1 -1
  127. package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +8 -2
  128. package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -11
  129. package/modern/internals/hooks/useField/useField.js +11 -5
  130. package/modern/internals/hooks/useField/useField.utils.js +63 -35
  131. package/modern/internals/hooks/useField/useFieldCharacterEditing.js +4 -9
  132. package/modern/internals/hooks/useField/useFieldState.js +43 -37
  133. package/modern/internals/hooks/usePicker/usePicker.js +7 -0
  134. package/modern/internals/hooks/useViews.js +1 -1
  135. package/modern/internals/utils/valueManagers.js +11 -7
  136. package/modern/locales/deDE.js +4 -5
  137. package/modern/locales/frFR.js +16 -20
  138. package/modern/locales/heIL.js +57 -0
  139. package/modern/locales/index.js +1 -0
  140. package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +20 -1
  141. package/node/AdapterDateFns/index.js +1 -0
  142. package/node/AdapterDayjs/index.js +1 -0
  143. package/node/AdapterMoment/index.js +1 -0
  144. package/node/DateCalendar/DateCalendar.js +2 -2
  145. package/node/DateField/DateField.js +2 -2
  146. package/node/DatePicker/DatePicker.js +2 -2
  147. package/node/DateTimeField/DateTimeField.js +2 -2
  148. package/node/DateTimePicker/DateTimePicker.js +2 -2
  149. package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
  150. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
  151. package/node/DesktopTimePicker/DesktopTimePicker.js +2 -2
  152. package/node/MobileDatePicker/MobileDatePicker.js +2 -2
  153. package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
  154. package/node/MobileTimePicker/MobileTimePicker.js +2 -2
  155. package/node/PickersLayout/PickersLayout.js +2 -2
  156. package/node/StaticDatePicker/StaticDatePicker.js +2 -2
  157. package/node/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
  158. package/node/StaticTimePicker/StaticTimePicker.js +2 -2
  159. package/node/TimeClock/TimeClock.js +2 -2
  160. package/node/TimeField/TimeField.js +2 -2
  161. package/node/TimePicker/TimePicker.js +2 -2
  162. package/node/index.js +1 -1
  163. package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +8 -2
  164. package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +13 -11
  165. package/node/internals/hooks/useField/useField.js +11 -5
  166. package/node/internals/hooks/useField/useField.utils.js +66 -38
  167. package/node/internals/hooks/useField/useFieldCharacterEditing.js +3 -8
  168. package/node/internals/hooks/useField/useFieldState.js +43 -37
  169. package/node/internals/hooks/usePicker/usePicker.js +7 -0
  170. package/node/internals/hooks/useViews.js +1 -1
  171. package/node/internals/utils/valueManagers.js +11 -7
  172. package/node/locales/deDE.js +4 -5
  173. package/node/locales/frFR.js +16 -20
  174. package/node/locales/heIL.js +64 -0
  175. package/node/locales/index.js +11 -0
  176. package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +19 -0
  177. package/package.json +3 -3
  178. package/tests/describeValue/testPickerOpenCloseLifeCycle.js +20 -1
@@ -75,7 +75,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
75
75
  */
76
76
  color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
77
77
  /**
78
- * Overrideable components.
78
+ * Overridable components.
79
79
  * @default {}
80
80
  * @deprecated Please use `slots`.
81
81
  */
@@ -259,7 +259,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
259
259
  */
260
260
  slotProps: PropTypes.object,
261
261
  /**
262
- * Overrideable component slots.
262
+ * Overridable component slots.
263
263
  * @default {}
264
264
  */
265
265
  slots: PropTypes.object,
@@ -54,7 +54,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
54
54
  */
55
55
  closeOnSelect: PropTypes.bool,
56
56
  /**
57
- * Overrideable components.
57
+ * Overridable components.
58
58
  * @default {}
59
59
  * @deprecated Please use `slots`.
60
60
  */
@@ -296,7 +296,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
296
296
  */
297
297
  slotProps: PropTypes.object,
298
298
  /**
299
- * Overrideable component slots.
299
+ * Overridable component slots.
300
300
  * @default {}
301
301
  */
302
302
  slots: PropTypes.object,
@@ -80,7 +80,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
80
80
  */
81
81
  color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
82
82
  /**
83
- * Overrideable components.
83
+ * Overridable components.
84
84
  * @default {}
85
85
  * @deprecated Please use `slots`.
86
86
  */
@@ -307,7 +307,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
307
307
  */
308
308
  slotProps: PropTypes.object,
309
309
  /**
310
- * Overrideable component slots.
310
+ * Overridable component slots.
311
311
  * @default {}
312
312
  */
313
313
  slots: PropTypes.object,
@@ -64,7 +64,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
64
64
  */
65
65
  closeOnSelect: PropTypes.bool,
66
66
  /**
67
- * Overrideable components.
67
+ * Overridable components.
68
68
  * @default {}
69
69
  * @deprecated Please use `slots`.
70
70
  */
@@ -349,7 +349,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
349
349
  */
350
350
  slotProps: PropTypes.object,
351
351
  /**
352
- * Overrideable component slots.
352
+ * Overridable component slots.
353
353
  * @default {}
354
354
  */
355
355
  slots: PropTypes.object,
@@ -72,7 +72,7 @@ DesktopDatePicker.propTypes = {
72
72
  */
73
73
  closeOnSelect: PropTypes.bool,
74
74
  /**
75
- * Overrideable components.
75
+ * Overridable components.
76
76
  * @default {}
77
77
  * @deprecated Please use `slots`.
78
78
  */
@@ -308,7 +308,7 @@ DesktopDatePicker.propTypes = {
308
308
  */
309
309
  slotProps: PropTypes.object,
310
310
  /**
311
- * Overrideable component slots.
311
+ * Overridable component slots.
312
312
  * @default {}
313
313
  */
314
314
  slots: PropTypes.object,
@@ -90,7 +90,7 @@ DesktopDateTimePicker.propTypes = {
90
90
  */
91
91
  closeOnSelect: PropTypes.bool,
92
92
  /**
93
- * Overrideable components.
93
+ * Overridable components.
94
94
  * @default {}
95
95
  * @deprecated Please use `slots`.
96
96
  */
@@ -369,7 +369,7 @@ DesktopDateTimePicker.propTypes = {
369
369
  */
370
370
  slotProps: PropTypes.object,
371
371
  /**
372
- * Overrideable component slots.
372
+ * Overridable component slots.
373
373
  * @default {}
374
374
  */
375
375
  slots: PropTypes.object,
@@ -82,7 +82,7 @@ DesktopTimePicker.propTypes = {
82
82
  */
83
83
  closeOnSelect: PropTypes.bool,
84
84
  /**
85
- * Overrideable components.
85
+ * Overridable components.
86
86
  * @default {}
87
87
  * @deprecated Please use `slots`.
88
88
  */
@@ -253,7 +253,7 @@ DesktopTimePicker.propTypes = {
253
253
  */
254
254
  slotProps: PropTypes.object,
255
255
  /**
256
- * Overrideable component slots.
256
+ * Overridable component slots.
257
257
  * @default {}
258
258
  */
259
259
  slots: PropTypes.object,
@@ -69,7 +69,7 @@ MobileDatePicker.propTypes = {
69
69
  */
70
70
  closeOnSelect: PropTypes.bool,
71
71
  /**
72
- * Overrideable components.
72
+ * Overridable components.
73
73
  * @default {}
74
74
  * @deprecated Please use `slots`.
75
75
  */
@@ -305,7 +305,7 @@ MobileDatePicker.propTypes = {
305
305
  */
306
306
  slotProps: PropTypes.object,
307
307
  /**
308
- * Overrideable component slots.
308
+ * Overridable component slots.
309
309
  * @default {}
310
310
  */
311
311
  slots: PropTypes.object,
@@ -88,7 +88,7 @@ MobileDateTimePicker.propTypes = {
88
88
  */
89
89
  closeOnSelect: PropTypes.bool,
90
90
  /**
91
- * Overrideable components.
91
+ * Overridable components.
92
92
  * @default {}
93
93
  * @deprecated Please use `slots`.
94
94
  */
@@ -367,7 +367,7 @@ MobileDateTimePicker.propTypes = {
367
367
  */
368
368
  slotProps: PropTypes.object,
369
369
  /**
370
- * Overrideable component slots.
370
+ * Overridable component slots.
371
371
  * @default {}
372
372
  */
373
373
  slots: PropTypes.object,
@@ -81,7 +81,7 @@ MobileTimePicker.propTypes = {
81
81
  */
82
82
  closeOnSelect: PropTypes.bool,
83
83
  /**
84
- * Overrideable components.
84
+ * Overridable components.
85
85
  * @default {}
86
86
  * @deprecated Please use `slots`.
87
87
  */
@@ -252,7 +252,7 @@ MobileTimePicker.propTypes = {
252
252
  */
253
253
  slotProps: PropTypes.object,
254
254
  /**
255
- * Overrideable component slots.
255
+ * Overridable component slots.
256
256
  * @default {}
257
257
  */
258
258
  slots: PropTypes.object,
@@ -115,7 +115,7 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
115
115
  classes: PropTypes.object,
116
116
  className: PropTypes.string,
117
117
  /**
118
- * Overrideable components.
118
+ * Overridable components.
119
119
  * @default {}
120
120
  * @deprecated Please use `slots`.
121
121
  */
@@ -149,7 +149,7 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
149
149
  */
150
150
  slotProps: PropTypes.object,
151
151
  /**
152
- * Overrideable component slots.
152
+ * Overridable component slots.
153
153
  * @default {}
154
154
  */
155
155
  slots: PropTypes.object,
@@ -53,7 +53,7 @@ StaticDatePicker.propTypes = {
53
53
  */
54
54
  className: PropTypes.string,
55
55
  /**
56
- * Overrideable components.
56
+ * Overridable components.
57
57
  * @default {}
58
58
  * @deprecated Please use `slots`.
59
59
  */
@@ -247,7 +247,7 @@ StaticDatePicker.propTypes = {
247
247
  */
248
248
  slotProps: PropTypes.object,
249
249
  /**
250
- * Overrideable component slots.
250
+ * Overridable component slots.
251
251
  * @default {}
252
252
  */
253
253
  slots: PropTypes.object,
@@ -73,7 +73,7 @@ StaticDateTimePicker.propTypes = {
73
73
  */
74
74
  className: PropTypes.string,
75
75
  /**
76
- * Overrideable components.
76
+ * Overridable components.
77
77
  * @default {}
78
78
  * @deprecated Please use `slots`.
79
79
  */
@@ -310,7 +310,7 @@ StaticDateTimePicker.propTypes = {
310
310
  */
311
311
  slotProps: PropTypes.object,
312
312
  /**
313
- * Overrideable component slots.
313
+ * Overridable component slots.
314
314
  * @default {}
315
315
  */
316
316
  slots: PropTypes.object,
@@ -65,7 +65,7 @@ StaticTimePicker.propTypes = {
65
65
  */
66
66
  className: PropTypes.string,
67
67
  /**
68
- * Overrideable components.
68
+ * Overridable components.
69
69
  * @default {}
70
70
  * @deprecated Please use `slots`.
71
71
  */
@@ -194,7 +194,7 @@ StaticTimePicker.propTypes = {
194
194
  */
195
195
  slotProps: PropTypes.object,
196
196
  /**
197
- * Overrideable component slots.
197
+ * Overridable component slots.
198
198
  * @default {}
199
199
  */
200
200
  slots: PropTypes.object,
@@ -321,7 +321,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
321
321
  classes: PropTypes.object,
322
322
  className: PropTypes.string,
323
323
  /**
324
- * Overrideable components.
324
+ * Overridable components.
325
325
  * @default {}
326
326
  * @deprecated Please use `slots`.
327
327
  */
@@ -416,7 +416,7 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
416
416
  */
417
417
  slotProps: PropTypes.object,
418
418
  /**
419
- * Overrideable component slots.
419
+ * Overridable component slots.
420
420
  * @default {}
421
421
  */
422
422
  slots: PropTypes.object,
@@ -80,7 +80,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
80
80
  */
81
81
  color: PropTypes.oneOf(['error', 'info', 'primary', 'secondary', 'success', 'warning']),
82
82
  /**
83
- * Overrideable components.
83
+ * Overridable components.
84
84
  * @default {}
85
85
  * @deprecated Please use `slots`.
86
86
  */
@@ -270,7 +270,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
270
270
  */
271
271
  slotProps: PropTypes.object,
272
272
  /**
273
- * Overrideable component slots.
273
+ * Overridable component slots.
274
274
  * @default {}
275
275
  */
276
276
  slots: PropTypes.object,
@@ -64,7 +64,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
64
64
  */
65
65
  closeOnSelect: PropTypes.bool,
66
66
  /**
67
- * Overrideable components.
67
+ * Overridable components.
68
68
  * @default {}
69
69
  * @deprecated Please use `slots`.
70
70
  */
@@ -241,7 +241,7 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
241
241
  */
242
242
  slotProps: PropTypes.object,
243
243
  /**
244
- * Overrideable component slots.
244
+ * Overridable component slots.
245
245
  * @default {}
246
246
  */
247
247
  slots: PropTypes.object,
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers v6.0.0
2
+ * @mui/x-date-pickers v6.0.2
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -94,7 +94,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
94
94
  elementType: PreviousIconButton,
95
95
  externalSlotProps: slotProps?.previousIconButton ?? componentsProps?.previousIconButton,
96
96
  additionalProps: {
97
- size: 'small',
97
+ size: 'medium',
98
98
  title: leftProps.label,
99
99
  'aria-label': leftProps.label,
100
100
  disabled: leftProps.isDisabled,
@@ -111,7 +111,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
111
111
  elementType: NextIconButton,
112
112
  externalSlotProps: slotProps?.nextIconButton ?? componentsProps?.nextIconButton,
113
113
  additionalProps: {
114
- size: 'small',
114
+ size: 'medium',
115
115
  title: rightProps.label,
116
116
  'aria-label': rightProps.label,
117
117
  disabled: rightProps.isDisabled,
@@ -128,6 +128,9 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
128
128
  const _useSlotProps = useSlotProps({
129
129
  elementType: LeftArrowIcon,
130
130
  externalSlotProps: slotProps?.leftArrowIcon ?? componentsProps?.leftArrowIcon,
131
+ additionalProps: {
132
+ fontSize: 'inherit'
133
+ },
131
134
  ownerState: undefined
132
135
  }),
133
136
  leftArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
@@ -136,6 +139,9 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
136
139
  const _useSlotProps2 = useSlotProps({
137
140
  elementType: RightArrowIcon,
138
141
  externalSlotProps: slotProps?.rightArrowIcon ?? componentsProps?.rightArrowIcon,
142
+ additionalProps: {
143
+ fontSize: 'inherit'
144
+ },
139
145
  ownerState: undefined
140
146
  }),
141
147
  rightArrowIconProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded3);
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["ownerState"];
3
+ const _excluded = ["ownerState"],
4
+ _excluded2 = ["ownerState"];
4
5
  import * as React from 'react';
5
6
  import { useSlotProps } from '@mui/base/utils';
6
7
  import MuiInputAdornment from '@mui/material/InputAdornment';
@@ -62,16 +63,17 @@ export const useDesktopPicker = ({
62
63
  wrapperVariant: 'desktop'
63
64
  });
64
65
  const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
65
- const inputAdornmentProps = useSlotProps({
66
- elementType: InputAdornment,
67
- externalSlotProps: innerSlotProps?.inputAdornment,
68
- additionalProps: {
69
- position: 'end'
70
- },
71
- ownerState: props
72
- });
73
- const OpenPickerButton = slots.openPickerButton ?? IconButton;
74
66
  const _useSlotProps = useSlotProps({
67
+ elementType: InputAdornment,
68
+ externalSlotProps: innerSlotProps?.inputAdornment,
69
+ additionalProps: {
70
+ position: 'end'
71
+ },
72
+ ownerState: props
73
+ }),
74
+ inputAdornmentProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
75
+ const OpenPickerButton = slots.openPickerButton ?? IconButton;
76
+ const _useSlotProps2 = useSlotProps({
75
77
  elementType: OpenPickerButton,
76
78
  externalSlotProps: innerSlotProps?.openPickerButton,
77
79
  additionalProps: {
@@ -82,7 +84,7 @@ export const useDesktopPicker = ({
82
84
  },
83
85
  ownerState: props
84
86
  }),
85
- openPickerButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded);
87
+ openPickerButtonProps = _objectWithoutPropertiesLoose(_useSlotProps2, _excluded2);
86
88
  const OpenPickerIcon = slots.openPickerIcon;
87
89
  const Field = slots.field;
88
90
  const fieldProps = useSlotProps({
@@ -10,11 +10,9 @@ import { useUtils } from '../useUtils';
10
10
  import { adjustSectionValue, isAndroid, cleanString } from './useField.utils';
11
11
  import { useFieldState } from './useFieldState';
12
12
  import { useFieldCharacterEditing } from './useFieldCharacterEditing';
13
+ import { getActiveElement } from '../../utils/utils';
13
14
  export const useField = params => {
14
15
  const utils = useUtils();
15
- if (!utils.formatTokenMap) {
16
- throw new Error('This adapter is not compatible with the field components');
17
- }
18
16
  const {
19
17
  state,
20
18
  selectedSectionIndexes,
@@ -60,6 +58,10 @@ export const useField = params => {
60
58
  const handleRef = useForkRef(inputRefProp, inputRef);
61
59
  const focusTimeoutRef = React.useRef(undefined);
62
60
  const syncSelectionFromDOM = () => {
61
+ if (readOnly) {
62
+ setSelectedSections(null);
63
+ return;
64
+ }
63
65
  const browserStartIndex = inputRef.current.selectionStart ?? 0;
64
66
  const nextSectionIndex = browserStartIndex <= state.sections[0].startInInput ? 1 // Special case if browser index is in invisible characters at the beginning.
65
67
  : state.sections.findIndex(section => section.startInInput - section.startSeparator.length > browserStartIndex);
@@ -86,7 +88,7 @@ export const useField = params => {
86
88
  if (!input || input !== inputRef.current) {
87
89
  return;
88
90
  }
89
- if (selectedSectionIndexes != null) {
91
+ if (selectedSectionIndexes != null || readOnly) {
90
92
  return;
91
93
  }
92
94
  if (
@@ -257,6 +259,10 @@ export const useField = params => {
257
259
  });
258
260
  useEnhancedEffect(() => {
259
261
  if (selectedSectionIndexes == null) {
262
+ if (inputRef.current.selectionStart !== 0 || inputRef.current.selectionEnd !== 0) {
263
+ // Ensure input selection range is in sync with component selection indexes
264
+ inputRef.current.setSelectionRange(0, 0);
265
+ }
260
266
  return;
261
267
  }
262
268
  const firstSelectedSection = state.sections[selectedSectionIndexes.startIndex];
@@ -311,7 +317,7 @@ export const useField = params => {
311
317
  }
312
318
  return 'tel';
313
319
  }, [selectedSectionIndexes, state.sections]);
314
- const inputHasFocus = inputRef.current && inputRef.current === document.activeElement;
320
+ const inputHasFocus = inputRef.current && inputRef.current === getActiveElement(document);
315
321
  const shouldShowPlaceholder = !inputHasFocus && (!state.value || valueManager.areValuesEqual(utils, state.value, valueManager.emptyValue));
316
322
  return _extends({
317
323
  placeholder: state.placeholder,
@@ -41,19 +41,6 @@ export const getDaysInWeekStr = (utils, format) => {
41
41
  }
42
42
  return elements.map(weekDay => utils.formatByString(weekDay, format));
43
43
  };
44
- export const cleanLeadingZerosInNumericSectionValue = (utils, format, value) => {
45
- const size = utils.formatByString(utils.date(), format).length;
46
- let cleanValue = value;
47
-
48
- // We remove the leading zeros
49
- cleanValue = Number(cleanValue).toString();
50
-
51
- // We add enough leading zeros to fill the section
52
- while (cleanValue.length < size) {
53
- cleanValue = `0${cleanValue}`;
54
- }
55
- return cleanValue;
56
- };
57
44
  export const getLetterEditingOptions = (utils, sectionType, format) => {
58
45
  switch (sectionType) {
59
46
  case 'month':
@@ -75,42 +62,70 @@ export const getLetterEditingOptions = (utils, sectionType, format) => {
75
62
  }
76
63
  }
77
64
  };
65
+ export const cleanDigitSectionValue = (utils, value, sectionType, format, hasLeadingZeros, sectionBoundaries) => {
66
+ const hasLetter = () => {
67
+ const startOfYear = utils.startOfYear(utils.date());
68
+ const startOfYearStr = utils.formatByString(startOfYear, format);
69
+ return Number.isNaN(Number(startOfYearStr));
70
+ };
71
+ if (process.env.NODE_ENV !== 'production') {
72
+ if (sectionType !== 'day' && hasLetter()) {
73
+ throw new Error([`MUI: The token "${format}" is a digit format with letter in it.'
74
+ This type of format is only supported for 'day' sections`].join('\n'));
75
+ }
76
+ }
77
+ if (sectionType === 'day' && hasLetter()) {
78
+ const date = utils.setDate(sectionBoundaries.longestMonth, value);
79
+ return utils.formatByString(date, format);
80
+ }
81
+
82
+ // queryValue without leading `0` (`01` => `1`)
83
+ const valueStr = value.toString();
84
+ if (hasLeadingZeros) {
85
+ const size = utils.formatByString(utils.date(), format).length;
86
+ let cleanValueStr = valueStr;
87
+
88
+ // Remove the leading zeros
89
+ cleanValueStr = Number(cleanValueStr).toString();
90
+
91
+ // Add enough leading zeros to fill the section
92
+ while (cleanValueStr.length < size) {
93
+ cleanValueStr = `0${cleanValueStr}`;
94
+ }
95
+ return cleanValueStr;
96
+ }
97
+ return valueStr;
98
+ };
78
99
  export const adjustSectionValue = (utils, section, keyCode, sectionsValueBoundaries, activeDate) => {
79
100
  const delta = getDeltaFromKeyCode(keyCode);
80
101
  const isStart = keyCode === 'Home';
81
102
  const isEnd = keyCode === 'End';
82
103
  const shouldSetAbsolute = section.value === '' || isStart || isEnd;
83
- const cleanDigitSectionValue = value => {
84
- const valueStr = value.toString();
85
- if (section.hasLeadingZeros) {
86
- return cleanLeadingZerosInNumericSectionValue(utils, section.format, valueStr);
87
- }
88
- return valueStr;
89
- };
90
104
  const adjustDigitSection = () => {
91
105
  const sectionBoundaries = sectionsValueBoundaries[section.type]({
92
106
  currentDate: activeDate,
93
107
  format: section.format,
94
108
  contentType: section.contentType
95
109
  });
110
+ const getCleanValue = value => cleanDigitSectionValue(utils, value, section.type, section.format, section.hasLeadingZeros, sectionBoundaries);
96
111
  if (shouldSetAbsolute) {
97
112
  if (section.type === 'year' && !isEnd && !isStart) {
98
113
  return utils.formatByString(utils.date(), section.format);
99
114
  }
100
115
  if (delta > 0 || isStart) {
101
- return cleanDigitSectionValue(sectionBoundaries.minimum);
116
+ return getCleanValue(sectionBoundaries.minimum);
102
117
  }
103
- return cleanDigitSectionValue(sectionBoundaries.maximum);
118
+ return getCleanValue(sectionBoundaries.maximum);
104
119
  }
105
- const currentSectionValue = Number(section.value);
120
+ const currentSectionValue = parseInt(section.value, 10);
106
121
  const newSectionValueNumber = currentSectionValue + delta;
107
122
  if (newSectionValueNumber > sectionBoundaries.maximum) {
108
- return cleanDigitSectionValue(sectionBoundaries.minimum);
123
+ return getCleanValue(sectionBoundaries.minimum);
109
124
  }
110
125
  if (newSectionValueNumber < sectionBoundaries.minimum) {
111
- return cleanDigitSectionValue(sectionBoundaries.maximum);
126
+ return getCleanValue(sectionBoundaries.maximum);
112
127
  }
113
- return cleanDigitSectionValue(newSectionValueNumber);
128
+ return getCleanValue(newSectionValueNumber);
114
129
  };
115
130
  const adjustLetterSection = () => {
116
131
  const options = getLetterEditingOptions(utils, section.type, section.format);
@@ -233,7 +248,7 @@ export const changeSectionValueFormat = (utils, valueStr, currentFormat, newForm
233
248
  return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
234
249
  };
235
250
  const isFourDigitYearFormat = (utils, format) => utils.formatByString(utils.date(), format).length === 4;
236
- export const doesSectionHaveTrailingZeros = (utils, contentType, sectionType, format) => {
251
+ export const doesSectionHaveLeadingZeros = (utils, contentType, sectionType, format) => {
237
252
  if (contentType !== 'digit') {
238
253
  return false;
239
254
  }
@@ -307,13 +322,13 @@ export const splitFormatIntoSections = (utils, localeText, format, date) => {
307
322
  return expandedToken;
308
323
  }
309
324
  const sectionConfig = getDateSectionConfigFromFormatToken(utils, token);
310
- const sectionValue = date == null ? '' : utils.formatByString(date, token);
311
- const hasTrailingZeroes = doesSectionHaveTrailingZeros(utils, sectionConfig.contentType, sectionConfig.type, token);
325
+ const sectionValue = date == null || !utils.isValid(date) ? '' : utils.formatByString(date, token);
326
+ const hasLeadingZeros = doesSectionHaveLeadingZeros(utils, sectionConfig.contentType, sectionConfig.type, token);
312
327
  sections.push(_extends({}, sectionConfig, {
313
328
  format: token,
314
329
  value: sectionValue,
315
330
  placeholder: getSectionPlaceholder(utils, localeText, sectionConfig, token),
316
- hasLeadingZeros: hasTrailingZeroes,
331
+ hasLeadingZeros,
317
332
  startSeparator: sections.length === 0 ? startSeparator : '',
318
333
  endSeparator: '',
319
334
  modified: false
@@ -406,10 +421,22 @@ export const createDateStrForInputFromSections = sections => {
406
421
  export const getSectionsBoundaries = utils => {
407
422
  const today = utils.date();
408
423
  const endOfYear = utils.endOfYear(today);
409
- const maxDaysInMonth = utils.getMonthArray(today).reduce((acc, month) => {
424
+ const {
425
+ maxDaysInMonth,
426
+ longestMonth
427
+ } = utils.getMonthArray(today).reduce((acc, month) => {
410
428
  const daysInMonth = utils.getDaysInMonth(month);
411
- return Math.max(acc, daysInMonth);
412
- }, 0);
429
+ if (daysInMonth > acc.maxDaysInMonth) {
430
+ return {
431
+ maxDaysInMonth: daysInMonth,
432
+ longestMonth: month
433
+ };
434
+ }
435
+ return acc;
436
+ }, {
437
+ maxDaysInMonth: 0,
438
+ longestMonth: null
439
+ });
413
440
  return {
414
441
  year: ({
415
442
  format
@@ -426,7 +453,8 @@ export const getSectionsBoundaries = utils => {
426
453
  currentDate
427
454
  }) => ({
428
455
  minimum: 1,
429
- maximum: currentDate != null && utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth
456
+ maximum: currentDate != null && utils.isValid(currentDate) ? utils.getDaysInMonth(currentDate) : maxDaysInMonth,
457
+ longestMonth: longestMonth
430
458
  }),
431
459
  weekDay: ({
432
460
  format,
@@ -567,7 +595,7 @@ export const clampDaySection = (utils, sections, sectionsValueBoundaries) => {
567
595
  contentType: section.contentType
568
596
  });
569
597
  return _extends({}, section, {
570
- value: section.hasLeadingZeros ? cleanLeadingZerosInNumericSectionValue(utils, section.format, dayBoundaries.minimum.toString()) : dayBoundaries.minimum.toString()
598
+ value: cleanDigitSectionValue(utils, dayBoundaries.minimum, section.type, section.format, section.hasLeadingZeros, dayBoundaries)
571
599
  });
572
600
  });
573
601
  const startOfMonth = getDateFromDateSections(utils, sectionsForStartOfMonth);