@mui/x-date-pickers 6.7.0 → 6.9.0
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.
- package/AdapterDayjs/AdapterDayjs.d.ts +5 -1
- package/AdapterDayjs/AdapterDayjs.js +42 -15
- package/AdapterLuxon/AdapterLuxon.d.ts +1 -0
- package/AdapterLuxon/AdapterLuxon.js +12 -5
- package/AdapterMoment/AdapterMoment.js +18 -9
- package/CHANGELOG.md +145 -5541
- package/DateCalendar/DateCalendar.js +49 -21
- package/DateCalendar/DateCalendar.types.d.ts +8 -3
- package/DateCalendar/DayCalendar.d.ts +3 -1
- package/DateCalendar/DayCalendar.js +24 -17
- package/DateCalendar/PickersCalendarHeader.js +6 -3
- package/DateCalendar/useCalendarState.d.ts +5 -3
- package/DateCalendar/useCalendarState.js +41 -17
- package/DateCalendar/useIsDateDisabled.d.ts +1 -1
- package/DateCalendar/useIsDateDisabled.js +5 -3
- package/DateField/DateField.js +9 -1
- package/DatePicker/DatePicker.js +9 -1
- package/DateTimeField/DateTimeField.js +9 -1
- package/DateTimePicker/DateTimePicker.js +9 -1
- package/DesktopDatePicker/DesktopDatePicker.js +9 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -1
- package/DesktopTimePicker/DesktopTimePicker.js +8 -0
- package/DigitalClock/DigitalClock.js +28 -15
- package/MobileDatePicker/MobileDatePicker.js +9 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/MobileTimePicker/MobileTimePicker.js +8 -0
- package/MonthCalendar/MonthCalendar.js +57 -24
- package/MonthCalendar/MonthCalendar.types.d.ts +8 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +28 -15
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -1
- package/PickersLayout/PickersLayout.js +1 -0
- package/PickersLayout/usePickerLayout.js +4 -3
- package/PickersShortcuts/PickersShortcuts.d.ts +12 -2
- package/PickersShortcuts/PickersShortcuts.js +10 -2
- package/PickersShortcuts/index.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +9 -1
- package/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/StaticTimePicker/StaticTimePicker.js +8 -0
- package/TimeClock/TimeClock.js +27 -15
- package/TimeField/TimeField.js +9 -1
- package/TimePicker/TimePicker.js +8 -0
- package/YearCalendar/YearCalendar.js +55 -22
- package/YearCalendar/YearCalendar.types.d.ts +8 -2
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +5 -2
- package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.js +4 -2
- package/index.js +1 -1
- package/internals/hooks/date-helpers-hooks.d.ts +4 -2
- package/internals/hooks/date-helpers-hooks.js +8 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/internals/hooks/useField/useField.d.ts +3 -1
- package/internals/hooks/useField/useField.js +23 -7
- package/internals/hooks/useField/useField.types.d.ts +6 -4
- package/internals/hooks/useField/useField.utils.d.ts +13 -11
- package/internals/hooks/useField/useField.utils.js +55 -43
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +3 -2
- package/internals/hooks/useField/useFieldCharacterEditing.js +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +1 -0
- package/internals/hooks/useField/useFieldState.js +33 -23
- package/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/internals/hooks/usePicker/usePickerValue.js +45 -9
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +22 -6
- package/internals/hooks/usePicker/usePickerViews.d.ts +2 -1
- package/internals/hooks/usePicker/usePickerViews.js +7 -2
- package/internals/hooks/useUtils.d.ts +3 -2
- package/internals/hooks/useUtils.js +5 -2
- package/internals/hooks/useValueWithTimezone.d.ts +33 -0
- package/internals/hooks/useValueWithTimezone.js +69 -0
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/models/props/clock.d.ts +2 -2
- package/internals/utils/date-utils.d.ts +4 -4
- package/internals/utils/date-utils.js +4 -12
- package/internals/utils/fields.js +1 -1
- package/internals/utils/getDefaultReferenceDate.d.ts +12 -3
- package/internals/utils/getDefaultReferenceDate.js +4 -4
- package/internals/utils/validation/extractValidationProps.d.ts +1 -1
- package/internals/utils/validation/validateDate.d.ts +3 -2
- package/internals/utils/validation/validateDate.js +14 -6
- package/internals/utils/validation/validateTime.d.ts +3 -2
- package/internals/utils/validation/validateTime.js +8 -8
- package/internals/utils/valueManagers.js +2 -1
- package/legacy/AdapterDayjs/AdapterDayjs.js +45 -16
- package/legacy/AdapterLuxon/AdapterLuxon.js +13 -6
- package/legacy/AdapterMoment/AdapterMoment.js +18 -9
- package/legacy/DateCalendar/DateCalendar.js +47 -24
- package/legacy/DateCalendar/DayCalendar.js +24 -17
- package/legacy/DateCalendar/PickersCalendarHeader.js +6 -3
- package/legacy/DateCalendar/useCalendarState.js +40 -17
- package/legacy/DateCalendar/useIsDateDisabled.js +5 -3
- package/legacy/DateField/DateField.js +9 -1
- package/legacy/DatePicker/DatePicker.js +9 -1
- package/legacy/DateTimeField/DateTimeField.js +9 -1
- package/legacy/DateTimePicker/DateTimePicker.js +9 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +9 -1
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +8 -0
- package/legacy/DigitalClock/DigitalClock.js +26 -16
- package/legacy/MobileDatePicker/MobileDatePicker.js +9 -1
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +8 -0
- package/legacy/MonthCalendar/MonthCalendar.js +61 -32
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +27 -16
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -1
- package/legacy/PickersLayout/PickersLayout.js +1 -0
- package/legacy/PickersLayout/usePickerLayout.js +3 -2
- package/legacy/PickersShortcuts/PickersShortcuts.js +10 -2
- package/legacy/StaticDatePicker/StaticDatePicker.js +9 -1
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/legacy/StaticTimePicker/StaticTimePicker.js +8 -0
- package/legacy/TimeClock/TimeClock.js +25 -18
- package/legacy/TimeField/TimeField.js +9 -1
- package/legacy/TimePicker/TimePicker.js +8 -0
- package/legacy/YearCalendar/YearCalendar.js +59 -30
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +5 -2
- package/legacy/dateViewRenderers/dateViewRenderers.js +4 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/date-helpers-hooks.js +8 -6
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +22 -6
- package/legacy/internals/hooks/useField/useField.utils.js +56 -44
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +6 -5
- package/legacy/internals/hooks/useField/useFieldState.js +42 -33
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/legacy/internals/hooks/usePicker/usePickerValue.js +46 -9
- package/legacy/internals/hooks/usePicker/usePickerViews.js +7 -2
- package/legacy/internals/hooks/useUtils.js +5 -2
- package/legacy/internals/hooks/useValueWithTimezone.js +81 -0
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/date-utils.js +5 -13
- package/legacy/internals/utils/fields.js +1 -1
- package/legacy/internals/utils/getDefaultReferenceDate.js +4 -4
- package/legacy/internals/utils/validation/validateDate.js +12 -6
- package/legacy/internals/utils/validation/validateTime.js +8 -8
- package/legacy/internals/utils/valueManagers.js +3 -0
- package/legacy/locales/csCZ.js +2 -2
- package/legacy/locales/elGR.js +93 -0
- package/legacy/locales/index.js +1 -0
- package/legacy/tests/describeAdapters/describeAdapters.js +3 -1
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +69 -27
- package/legacy/tests/describeJalaliAdapter/testCalculations.js +21 -0
- package/legacy/timeViewRenderers/timeViewRenderers.js +12 -6
- package/locales/csCZ.js +2 -2
- package/locales/elGR.d.ts +53 -0
- package/locales/elGR.js +57 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/models/adapters.d.ts +2 -2
- package/models/timezone.d.ts +10 -0
- package/modern/AdapterDayjs/AdapterDayjs.js +41 -15
- package/modern/AdapterLuxon/AdapterLuxon.js +12 -4
- package/modern/AdapterMoment/AdapterMoment.js +18 -9
- package/modern/DateCalendar/DateCalendar.js +49 -21
- package/modern/DateCalendar/DayCalendar.js +24 -17
- package/modern/DateCalendar/PickersCalendarHeader.js +6 -3
- package/modern/DateCalendar/useCalendarState.js +41 -16
- package/modern/DateCalendar/useIsDateDisabled.js +5 -3
- package/modern/DateField/DateField.js +9 -1
- package/modern/DatePicker/DatePicker.js +9 -1
- package/modern/DateTimeField/DateTimeField.js +9 -1
- package/modern/DateTimePicker/DateTimePicker.js +9 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +9 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +8 -0
- package/modern/DigitalClock/DigitalClock.js +28 -15
- package/modern/MobileDatePicker/MobileDatePicker.js +9 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +8 -0
- package/modern/MonthCalendar/MonthCalendar.js +57 -24
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +28 -15
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -1
- package/modern/PickersLayout/PickersLayout.js +1 -0
- package/modern/PickersLayout/usePickerLayout.js +4 -3
- package/modern/PickersShortcuts/PickersShortcuts.js +10 -2
- package/modern/StaticDatePicker/StaticDatePicker.js +9 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/modern/StaticTimePicker/StaticTimePicker.js +8 -0
- package/modern/TimeClock/TimeClock.js +27 -15
- package/modern/TimeField/TimeField.js +9 -1
- package/modern/TimePicker/TimePicker.js +8 -0
- package/modern/YearCalendar/YearCalendar.js +55 -22
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +5 -2
- package/modern/dateViewRenderers/dateViewRenderers.js +4 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/date-helpers-hooks.js +8 -6
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +23 -7
- package/modern/internals/hooks/useField/useField.utils.js +55 -43
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +6 -5
- package/modern/internals/hooks/useField/useFieldState.js +33 -22
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/modern/internals/hooks/usePicker/usePickerValue.js +45 -9
- package/modern/internals/hooks/usePicker/usePickerViews.js +7 -2
- package/modern/internals/hooks/useUtils.js +5 -2
- package/modern/internals/hooks/useValueWithTimezone.js +68 -0
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/date-utils.js +4 -12
- package/modern/internals/utils/fields.js +1 -1
- package/modern/internals/utils/getDefaultReferenceDate.js +4 -4
- package/modern/internals/utils/validation/validateDate.js +14 -6
- package/modern/internals/utils/validation/validateTime.js +8 -8
- package/modern/internals/utils/valueManagers.js +2 -1
- package/modern/locales/csCZ.js +2 -2
- package/modern/locales/elGR.js +57 -0
- package/modern/locales/index.js +1 -0
- package/modern/tests/describeAdapters/describeAdapters.js +3 -1
- package/modern/tests/describeGregorianAdapter/testCalculations.js +69 -27
- package/modern/tests/describeJalaliAdapter/testCalculations.js +21 -0
- package/modern/timeViewRenderers/timeViewRenderers.js +12 -6
- package/node/AdapterDayjs/AdapterDayjs.js +41 -15
- package/node/AdapterLuxon/AdapterLuxon.js +12 -4
- package/node/AdapterMoment/AdapterMoment.js +18 -9
- package/node/DateCalendar/DateCalendar.js +48 -20
- package/node/DateCalendar/DayCalendar.js +24 -17
- package/node/DateCalendar/PickersCalendarHeader.js +6 -3
- package/node/DateCalendar/useCalendarState.js +41 -16
- package/node/DateCalendar/useIsDateDisabled.js +5 -3
- package/node/DateField/DateField.js +9 -1
- package/node/DatePicker/DatePicker.js +9 -1
- package/node/DateTimeField/DateTimeField.js +9 -1
- package/node/DateTimePicker/DateTimePicker.js +9 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +9 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +9 -1
- package/node/DesktopTimePicker/DesktopTimePicker.js +8 -0
- package/node/DigitalClock/DigitalClock.js +28 -15
- package/node/MobileDatePicker/MobileDatePicker.js +9 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +9 -1
- package/node/MobileTimePicker/MobileTimePicker.js +8 -0
- package/node/MonthCalendar/MonthCalendar.js +57 -24
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +28 -15
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -1
- package/node/PickersLayout/PickersLayout.js +1 -0
- package/node/PickersLayout/usePickerLayout.js +4 -3
- package/node/PickersShortcuts/PickersShortcuts.js +10 -2
- package/node/StaticDatePicker/StaticDatePicker.js +9 -1
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +9 -1
- package/node/StaticTimePicker/StaticTimePicker.js +8 -0
- package/node/TimeClock/TimeClock.js +26 -14
- package/node/TimeField/TimeField.js +9 -1
- package/node/TimePicker/TimePicker.js +8 -0
- package/node/YearCalendar/YearCalendar.js +55 -22
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +5 -2
- package/node/dateViewRenderers/dateViewRenderers.js +4 -2
- package/node/index.js +1 -1
- package/node/internals/hooks/date-helpers-hooks.js +8 -6
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +23 -7
- package/node/internals/hooks/useField/useField.utils.js +55 -43
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +6 -5
- package/node/internals/hooks/useField/useFieldState.js +33 -22
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +2 -0
- package/node/internals/hooks/usePicker/usePickerValue.js +44 -9
- package/node/internals/hooks/usePicker/usePickerViews.js +7 -2
- package/node/internals/hooks/useUtils.js +5 -2
- package/node/internals/hooks/useValueWithTimezone.js +79 -0
- package/node/internals/index.js +7 -0
- package/node/internals/utils/date-utils.js +5 -14
- package/node/internals/utils/fields.js +1 -1
- package/node/internals/utils/getDefaultReferenceDate.js +5 -4
- package/node/internals/utils/validation/validateDate.js +14 -6
- package/node/internals/utils/validation/validateTime.js +8 -8
- package/node/internals/utils/valueManagers.js +2 -1
- package/node/locales/csCZ.js +2 -2
- package/node/locales/elGR.js +64 -0
- package/node/locales/index.js +11 -0
- package/node/tests/describeAdapters/describeAdapters.js +3 -1
- package/node/tests/describeGregorianAdapter/testCalculations.js +69 -27
- package/node/tests/describeJalaliAdapter/testCalculations.js +21 -0
- package/node/timeViewRenderers/timeViewRenderers.js +12 -6
- package/package.json +2 -2
- package/tests/describeAdapters/describeAdapters.js +3 -1
- package/tests/describeGregorianAdapter/testCalculations.js +69 -27
- package/tests/describeJalaliAdapter/testCalculations.js +21 -0
- package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
- package/timeViewRenderers/timeViewRenderers.js +12 -6
|
@@ -239,7 +239,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
239
239
|
*/
|
|
240
240
|
readOnly: _propTypes.default.bool,
|
|
241
241
|
/**
|
|
242
|
-
* The date used to generate a part of the
|
|
242
|
+
* The date used to generate a part of the new value that is not present in the format when both `value` and `defaultValue` are empty.
|
|
243
243
|
* For example, on time fields it will be used to determine the date to set.
|
|
244
244
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
245
245
|
*/
|
|
@@ -317,6 +317,14 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
317
317
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
318
318
|
*/
|
|
319
319
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
320
|
+
/**
|
|
321
|
+
* Choose which timezone to use for the value.
|
|
322
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
323
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
324
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
325
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
326
|
+
*/
|
|
327
|
+
timezone: _propTypes.default.string,
|
|
320
328
|
/**
|
|
321
329
|
* The ref object used to imperatively interact with the field.
|
|
322
330
|
*/
|
|
@@ -83,7 +83,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
83
83
|
*/
|
|
84
84
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
85
85
|
/**
|
|
86
|
-
* Default calendar month displayed when `value
|
|
86
|
+
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
87
87
|
*/
|
|
88
88
|
defaultCalendarMonth: _propTypes.default.any,
|
|
89
89
|
/**
|
|
@@ -320,6 +320,14 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
320
320
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
321
321
|
*/
|
|
322
322
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
323
|
+
/**
|
|
324
|
+
* Choose which timezone to use for the value.
|
|
325
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
326
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
327
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
328
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
329
|
+
*/
|
|
330
|
+
timezone: _propTypes.default.string,
|
|
323
331
|
/**
|
|
324
332
|
* The selected value.
|
|
325
333
|
* Used when the component is controlled.
|
|
@@ -272,7 +272,7 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
272
272
|
*/
|
|
273
273
|
readOnly: _propTypes.default.bool,
|
|
274
274
|
/**
|
|
275
|
-
* The date used to generate a part of the
|
|
275
|
+
* The date used to generate a part of the new value that is not present in the format when both `value` and `defaultValue` are empty.
|
|
276
276
|
* For example, on time fields it will be used to determine the date to set.
|
|
277
277
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
278
278
|
*/
|
|
@@ -366,6 +366,14 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
366
366
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
367
367
|
*/
|
|
368
368
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
369
|
+
/**
|
|
370
|
+
* Choose which timezone to use for the value.
|
|
371
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
372
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
373
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
374
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
375
|
+
*/
|
|
376
|
+
timezone: _propTypes.default.string,
|
|
369
377
|
/**
|
|
370
378
|
* The ref object used to imperatively interact with the field.
|
|
371
379
|
*/
|
|
@@ -93,7 +93,7 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
93
93
|
*/
|
|
94
94
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
95
95
|
/**
|
|
96
|
-
* Default calendar month displayed when `value
|
|
96
|
+
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
97
97
|
*/
|
|
98
98
|
defaultCalendarMonth: _propTypes.default.any,
|
|
99
99
|
/**
|
|
@@ -390,6 +390,14 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
390
390
|
minutes: _propTypes.default.number,
|
|
391
391
|
seconds: _propTypes.default.number
|
|
392
392
|
}),
|
|
393
|
+
/**
|
|
394
|
+
* Choose which timezone to use for the value.
|
|
395
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
396
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
397
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
398
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
399
|
+
*/
|
|
400
|
+
timezone: _propTypes.default.string,
|
|
393
401
|
/**
|
|
394
402
|
* The selected value.
|
|
395
403
|
* Used when the component is controlled.
|
|
@@ -103,7 +103,7 @@ DesktopDatePicker.propTypes = {
|
|
|
103
103
|
*/
|
|
104
104
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
105
105
|
/**
|
|
106
|
-
* Default calendar month displayed when `value
|
|
106
|
+
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
107
107
|
*/
|
|
108
108
|
defaultCalendarMonth: _propTypes.default.any,
|
|
109
109
|
/**
|
|
@@ -334,6 +334,14 @@ DesktopDatePicker.propTypes = {
|
|
|
334
334
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
335
335
|
*/
|
|
336
336
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
337
|
+
/**
|
|
338
|
+
* Choose which timezone to use for the value.
|
|
339
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
340
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
341
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
342
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
343
|
+
*/
|
|
344
|
+
timezone: _propTypes.default.string,
|
|
337
345
|
/**
|
|
338
346
|
* The selected value.
|
|
339
347
|
* Used when the component is controlled.
|
|
@@ -149,7 +149,7 @@ DesktopDateTimePicker.propTypes = {
|
|
|
149
149
|
*/
|
|
150
150
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
151
151
|
/**
|
|
152
|
-
* Default calendar month displayed when `value
|
|
152
|
+
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
153
153
|
*/
|
|
154
154
|
defaultCalendarMonth: _propTypes.default.any,
|
|
155
155
|
/**
|
|
@@ -440,6 +440,14 @@ DesktopDateTimePicker.propTypes = {
|
|
|
440
440
|
minutes: _propTypes.default.number,
|
|
441
441
|
seconds: _propTypes.default.number
|
|
442
442
|
}),
|
|
443
|
+
/**
|
|
444
|
+
* Choose which timezone to use for the value.
|
|
445
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
446
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
447
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
448
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
449
|
+
*/
|
|
450
|
+
timezone: _propTypes.default.string,
|
|
443
451
|
/**
|
|
444
452
|
* The selected value.
|
|
445
453
|
* Used when the component is controlled.
|
|
@@ -324,6 +324,14 @@ DesktopTimePicker.propTypes = {
|
|
|
324
324
|
minutes: _propTypes.default.number,
|
|
325
325
|
seconds: _propTypes.default.number
|
|
326
326
|
}),
|
|
327
|
+
/**
|
|
328
|
+
* Choose which timezone to use for the value.
|
|
329
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
330
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
331
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
332
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
333
|
+
*/
|
|
334
|
+
timezone: _propTypes.default.string,
|
|
327
335
|
/**
|
|
328
336
|
* The selected value.
|
|
329
337
|
* Used when the component is controlled.
|
|
@@ -13,7 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
15
15
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
|
-
var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
|
|
17
16
|
var _MenuItem = _interopRequireDefault(require("@mui/material/MenuItem"));
|
|
18
17
|
var _MenuList = _interopRequireDefault(require("@mui/material/MenuList"));
|
|
19
18
|
var _useForkRef = _interopRequireDefault(require("@mui/utils/useForkRef"));
|
|
@@ -23,8 +22,10 @@ var _PickerViewRoot = require("../internals/components/PickerViewRoot");
|
|
|
23
22
|
var _digitalClockClasses = require("./digitalClockClasses");
|
|
24
23
|
var _useViews = require("../internals/hooks/useViews");
|
|
25
24
|
var _dimensions = require("../internals/constants/dimensions");
|
|
25
|
+
var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
|
|
26
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
-
const _excluded = ["ampm", "timeStep", "autoFocus", "components", "componentsProps", "slots", "slotProps", "value", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "defaultValue", "view", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "views", "skipDisabled"];
|
|
28
|
+
const _excluded = ["ampm", "timeStep", "autoFocus", "components", "componentsProps", "slots", "slotProps", "value", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "defaultValue", "view", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "views", "skipDisabled", "timezone"];
|
|
28
29
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
30
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
31
|
const useUtilityClasses = ownerState => {
|
|
@@ -84,11 +85,9 @@ const DigitalClockItem = (0, _styles.styled)(_MenuItem.default, {
|
|
|
84
85
|
}
|
|
85
86
|
}));
|
|
86
87
|
const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(inProps, ref) {
|
|
87
|
-
const now = (0, _useUtils.useNow)();
|
|
88
88
|
const utils = (0, _useUtils.useUtils)();
|
|
89
89
|
const containerRef = React.useRef(null);
|
|
90
90
|
const handleRef = (0, _useForkRef.default)(ref, containerRef);
|
|
91
|
-
const localeText = (0, _useUtils.useLocaleText)();
|
|
92
91
|
const props = (0, _styles.useThemeProps)({
|
|
93
92
|
props: inProps,
|
|
94
93
|
name: 'MuiDigitalClock'
|
|
@@ -121,25 +120,31 @@ const DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(inProps
|
|
|
121
120
|
disabled,
|
|
122
121
|
readOnly,
|
|
123
122
|
views = ['hours'],
|
|
124
|
-
skipDisabled = false
|
|
123
|
+
skipDisabled = false,
|
|
124
|
+
timezone: timezoneProp
|
|
125
125
|
} = props,
|
|
126
126
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
127
|
+
const {
|
|
128
|
+
value,
|
|
129
|
+
handleValueChange: handleRawValueChange,
|
|
130
|
+
timezone
|
|
131
|
+
} = (0, _useValueWithTimezone.useControlledValueWithTimezone)({
|
|
132
|
+
name: 'DigitalClock',
|
|
133
|
+
timezone: timezoneProp,
|
|
134
|
+
value: valueProp,
|
|
135
|
+
defaultValue,
|
|
136
|
+
onChange,
|
|
137
|
+
valueManager: _valueManagers.singleItemValueManager
|
|
138
|
+
});
|
|
139
|
+
const localeText = (0, _useUtils.useLocaleText)();
|
|
140
|
+
const now = (0, _useUtils.useNow)(timezone);
|
|
127
141
|
const ownerState = React.useMemo(() => (0, _extends2.default)({}, props, {
|
|
128
142
|
alreadyRendered: !!containerRef.current
|
|
129
143
|
}), [props]);
|
|
130
144
|
const classes = useUtilityClasses(ownerState);
|
|
131
145
|
const ClockItem = slots?.digitalClockItem ?? components?.DigitalClockItem ?? DigitalClockItem;
|
|
132
146
|
const clockItemProps = slotProps?.digitalClockItem ?? componentsProps?.digitalClockItem;
|
|
133
|
-
const
|
|
134
|
-
name: 'DigitalClock',
|
|
135
|
-
state: 'value',
|
|
136
|
-
controlled: valueProp,
|
|
137
|
-
default: defaultValue ?? null
|
|
138
|
-
});
|
|
139
|
-
const handleValueChange = (0, _useEventCallback.default)(newValue => {
|
|
140
|
-
setValue(newValue);
|
|
141
|
-
onChange?.(newValue, 'finish');
|
|
142
|
-
});
|
|
147
|
+
const handleValueChange = (0, _useEventCallback.default)(newValue => handleRawValueChange(newValue, 'finish'));
|
|
143
148
|
const {
|
|
144
149
|
setValueAndGoToNextView
|
|
145
150
|
} = (0, _useViews.useViews)({
|
|
@@ -388,6 +393,14 @@ process.env.NODE_ENV !== "production" ? DigitalClock.propTypes = {
|
|
|
388
393
|
* @default 30
|
|
389
394
|
*/
|
|
390
395
|
timeStep: _propTypes.default.number,
|
|
396
|
+
/**
|
|
397
|
+
* Choose which timezone to use for the value.
|
|
398
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
399
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
400
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
401
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
402
|
+
*/
|
|
403
|
+
timezone: _propTypes.default.string,
|
|
391
404
|
/**
|
|
392
405
|
* The selected value.
|
|
393
406
|
* Used when the component is controlled.
|
|
@@ -100,7 +100,7 @@ MobileDatePicker.propTypes = {
|
|
|
100
100
|
*/
|
|
101
101
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
102
102
|
/**
|
|
103
|
-
* Default calendar month displayed when `value
|
|
103
|
+
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
104
104
|
*/
|
|
105
105
|
defaultCalendarMonth: _propTypes.default.any,
|
|
106
106
|
/**
|
|
@@ -331,6 +331,14 @@ MobileDatePicker.propTypes = {
|
|
|
331
331
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
332
332
|
*/
|
|
333
333
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
334
|
+
/**
|
|
335
|
+
* Choose which timezone to use for the value.
|
|
336
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
337
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
338
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
339
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
340
|
+
*/
|
|
341
|
+
timezone: _propTypes.default.string,
|
|
334
342
|
/**
|
|
335
343
|
* The selected value.
|
|
336
344
|
* Used when the component is controlled.
|
|
@@ -121,7 +121,7 @@ MobileDateTimePicker.propTypes = {
|
|
|
121
121
|
*/
|
|
122
122
|
dayOfWeekFormatter: _propTypes.default.func,
|
|
123
123
|
/**
|
|
124
|
-
* Default calendar month displayed when `value
|
|
124
|
+
* Default calendar month displayed when `value` and `defaultValue` are empty.
|
|
125
125
|
*/
|
|
126
126
|
defaultCalendarMonth: _propTypes.default.any,
|
|
127
127
|
/**
|
|
@@ -396,6 +396,14 @@ MobileDateTimePicker.propTypes = {
|
|
|
396
396
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
397
397
|
*/
|
|
398
398
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
399
|
+
/**
|
|
400
|
+
* Choose which timezone to use for the value.
|
|
401
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
402
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
403
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
404
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
405
|
+
*/
|
|
406
|
+
timezone: _propTypes.default.string,
|
|
399
407
|
/**
|
|
400
408
|
* The selected value.
|
|
401
409
|
* Used when the component is controlled.
|
|
@@ -281,6 +281,14 @@ MobileTimePicker.propTypes = {
|
|
|
281
281
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
282
282
|
*/
|
|
283
283
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
284
|
+
/**
|
|
285
|
+
* Choose which timezone to use for the value.
|
|
286
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
287
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
288
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
289
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
290
|
+
*/
|
|
291
|
+
timezone: _propTypes.default.string,
|
|
284
292
|
/**
|
|
285
293
|
* The selected value.
|
|
286
294
|
* Used when the component is controlled.
|
|
@@ -18,8 +18,11 @@ var _PickersMonth = require("./PickersMonth");
|
|
|
18
18
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
19
19
|
var _monthCalendarClasses = require("./monthCalendarClasses");
|
|
20
20
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
21
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
22
|
+
var _getDefaultReferenceDate = require("../internals/utils/getDefaultReferenceDate");
|
|
23
|
+
var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
|
|
21
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["className", "value", "defaultValue", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow"];
|
|
25
|
+
const _excluded = ["className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "shouldDisableMonth", "readOnly", "disableHighlightToday", "autoFocus", "onMonthFocus", "hasFocus", "onFocusedViewChange", "monthsPerRow", "timezone"];
|
|
23
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
27
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
28
|
const useUtilityClasses = ownerState => {
|
|
@@ -58,14 +61,12 @@ const MonthCalendarRoot = (0, _styles.styled)('div', {
|
|
|
58
61
|
width: 320
|
|
59
62
|
});
|
|
60
63
|
const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inProps, ref) {
|
|
61
|
-
const now = (0, _useUtils.useNow)();
|
|
62
|
-
const theme = (0, _system.useTheme)();
|
|
63
|
-
const utils = (0, _useUtils.useUtils)();
|
|
64
64
|
const props = useMonthCalendarDefaultizedProps(inProps, 'MuiMonthCalendar');
|
|
65
65
|
const {
|
|
66
66
|
className,
|
|
67
67
|
value: valueProp,
|
|
68
68
|
defaultValue,
|
|
69
|
+
referenceDate: referenceDateProp,
|
|
69
70
|
disabled,
|
|
70
71
|
disableFuture,
|
|
71
72
|
disablePast,
|
|
@@ -79,19 +80,38 @@ const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inPro
|
|
|
79
80
|
onMonthFocus,
|
|
80
81
|
hasFocus,
|
|
81
82
|
onFocusedViewChange,
|
|
82
|
-
monthsPerRow = 3
|
|
83
|
+
monthsPerRow = 3,
|
|
84
|
+
timezone: timezoneProp
|
|
83
85
|
} = props,
|
|
84
86
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
const {
|
|
88
|
+
value,
|
|
89
|
+
handleValueChange,
|
|
90
|
+
timezone
|
|
91
|
+
} = (0, _useValueWithTimezone.useControlledValueWithTimezone)({
|
|
88
92
|
name: 'MonthCalendar',
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
timezone: timezoneProp,
|
|
94
|
+
value: valueProp,
|
|
95
|
+
defaultValue,
|
|
96
|
+
onChange: onChange,
|
|
97
|
+
valueManager: _valueManagers.singleItemValueManager
|
|
92
98
|
});
|
|
99
|
+
const now = (0, _useUtils.useNow)(timezone);
|
|
100
|
+
const theme = (0, _system.useTheme)();
|
|
101
|
+
const utils = (0, _useUtils.useUtils)();
|
|
102
|
+
const referenceDate = React.useMemo(() => _valueManagers.singleItemValueManager.getInitialReferenceValue({
|
|
103
|
+
value,
|
|
104
|
+
utils,
|
|
105
|
+
props,
|
|
106
|
+
timezone,
|
|
107
|
+
referenceDate: referenceDateProp,
|
|
108
|
+
granularity: _getDefaultReferenceDate.SECTION_TYPE_GRANULARITY.month
|
|
109
|
+
}), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const ownerState = props;
|
|
113
|
+
const classes = useUtilityClasses(ownerState);
|
|
93
114
|
const todayMonth = React.useMemo(() => utils.getMonth(now), [utils, now]);
|
|
94
|
-
const selectedDateOrStartOfMonth = React.useMemo(() => value ?? utils.startOfMonth(now), [now, utils, value]);
|
|
95
115
|
const selectedMonth = React.useMemo(() => {
|
|
96
116
|
if (value != null) {
|
|
97
117
|
return utils.getMonth(value);
|
|
@@ -99,8 +119,8 @@ const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inPro
|
|
|
99
119
|
if (disableHighlightToday) {
|
|
100
120
|
return null;
|
|
101
121
|
}
|
|
102
|
-
return utils.getMonth(
|
|
103
|
-
}, [
|
|
122
|
+
return utils.getMonth(referenceDate);
|
|
123
|
+
}, [value, utils, disableHighlightToday, referenceDate]);
|
|
104
124
|
const [focusedMonth, setFocusedMonth] = React.useState(() => selectedMonth || todayMonth);
|
|
105
125
|
const [internalHasFocus, setInternalHasFocus] = (0, _utils.unstable_useControlled)({
|
|
106
126
|
name: 'MonthCalendar',
|
|
@@ -114,30 +134,30 @@ const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inPro
|
|
|
114
134
|
onFocusedViewChange(newHasFocus);
|
|
115
135
|
}
|
|
116
136
|
});
|
|
117
|
-
const isMonthDisabled = React.useCallback(
|
|
137
|
+
const isMonthDisabled = React.useCallback(dateToValidate => {
|
|
118
138
|
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
|
|
119
139
|
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
|
|
120
|
-
|
|
140
|
+
const monthToValidate = utils.startOfMonth(dateToValidate);
|
|
141
|
+
if (utils.isBefore(monthToValidate, firstEnabledMonth)) {
|
|
121
142
|
return true;
|
|
122
143
|
}
|
|
123
|
-
if (utils.isAfter(
|
|
144
|
+
if (utils.isAfter(monthToValidate, lastEnabledMonth)) {
|
|
124
145
|
return true;
|
|
125
146
|
}
|
|
126
147
|
if (!shouldDisableMonth) {
|
|
127
148
|
return false;
|
|
128
149
|
}
|
|
129
|
-
return shouldDisableMonth(
|
|
150
|
+
return shouldDisableMonth(monthToValidate);
|
|
130
151
|
}, [disableFuture, disablePast, maxDate, minDate, now, shouldDisableMonth, utils]);
|
|
131
152
|
const handleMonthSelection = (0, _utils.unstable_useEventCallback)((event, month) => {
|
|
132
153
|
if (readOnly) {
|
|
133
154
|
return;
|
|
134
155
|
}
|
|
135
|
-
const newDate = utils.setMonth(
|
|
136
|
-
|
|
137
|
-
onChange?.(newDate);
|
|
156
|
+
const newDate = utils.setMonth(value ?? referenceDate, month);
|
|
157
|
+
handleValueChange(newDate);
|
|
138
158
|
});
|
|
139
159
|
const focusMonth = (0, _utils.unstable_useEventCallback)(month => {
|
|
140
|
-
if (!isMonthDisabled(utils.setMonth(
|
|
160
|
+
if (!isMonthDisabled(utils.setMonth(value ?? referenceDate, month))) {
|
|
141
161
|
setFocusedMonth(month);
|
|
142
162
|
changeHasFocus(true);
|
|
143
163
|
if (onMonthFocus) {
|
|
@@ -185,7 +205,7 @@ const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inPro
|
|
|
185
205
|
className: (0, _clsx.default)(classes.root, className),
|
|
186
206
|
ownerState: ownerState
|
|
187
207
|
}, other, {
|
|
188
|
-
children: (0, _dateUtils.getMonthsInYear)(utils,
|
|
208
|
+
children: (0, _dateUtils.getMonthsInYear)(utils, value ?? referenceDate).map(month => {
|
|
189
209
|
const monthNumber = utils.getMonth(month);
|
|
190
210
|
const monthText = utils.format(month, 'monthShort');
|
|
191
211
|
const isSelected = monthNumber === selectedMonth;
|
|
@@ -263,7 +283,7 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
263
283
|
/**
|
|
264
284
|
* Callback fired when the value changes.
|
|
265
285
|
* @template TDate
|
|
266
|
-
* @param {TDate
|
|
286
|
+
* @param {TDate} value The new value.
|
|
267
287
|
*/
|
|
268
288
|
onChange: _propTypes.default.func,
|
|
269
289
|
onFocusedViewChange: _propTypes.default.func,
|
|
@@ -272,6 +292,11 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
272
292
|
* If `true` picker is readonly
|
|
273
293
|
*/
|
|
274
294
|
readOnly: _propTypes.default.bool,
|
|
295
|
+
/**
|
|
296
|
+
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
297
|
+
* @default The closest valid month using the validation props, except callbacks such as `shouldDisableDate`.
|
|
298
|
+
*/
|
|
299
|
+
referenceDate: _propTypes.default.any,
|
|
275
300
|
/**
|
|
276
301
|
* Disable specific month.
|
|
277
302
|
* @template TDate
|
|
@@ -283,6 +308,14 @@ process.env.NODE_ENV !== "production" ? MonthCalendar.propTypes = {
|
|
|
283
308
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
284
309
|
*/
|
|
285
310
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
311
|
+
/**
|
|
312
|
+
* Choose which timezone to use for the value.
|
|
313
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
314
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
315
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
316
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
317
|
+
*/
|
|
318
|
+
timezone: _propTypes.default.string,
|
|
286
319
|
/**
|
|
287
320
|
* The selected value.
|
|
288
321
|
* Used when the component is controlled.
|
|
@@ -13,7 +13,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
15
15
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
|
-
var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
|
|
17
16
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
18
17
|
var _timeUtils = require("../internals/utils/time-utils");
|
|
19
18
|
var _useViews = require("../internals/hooks/useViews");
|
|
@@ -22,8 +21,10 @@ var _PickerViewRoot = require("../internals/components/PickerViewRoot");
|
|
|
22
21
|
var _multiSectionDigitalClockClasses = require("./multiSectionDigitalClockClasses");
|
|
23
22
|
var _MultiSectionDigitalClockSection = require("./MultiSectionDigitalClockSection");
|
|
24
23
|
var _MultiSectionDigitalClock = require("./MultiSectionDigitalClock.utils");
|
|
24
|
+
var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
|
|
25
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
25
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["ampm", "timeSteps", "autoFocus", "components", "componentsProps", "slots", "slotProps", "value", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "defaultValue", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "skipDisabled"];
|
|
27
|
+
const _excluded = ["ampm", "timeSteps", "autoFocus", "components", "componentsProps", "slots", "slotProps", "value", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "onChange", "defaultValue", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "skipDisabled", "timezone"];
|
|
27
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
30
|
const useUtilityClasses = ownerState => {
|
|
@@ -48,9 +49,7 @@ const MultiSectionDigitalClockRoot = (0, _styles.styled)(_PickerViewRoot.PickerV
|
|
|
48
49
|
borderBottom: `1px solid ${(theme.vars || theme).palette.divider}`
|
|
49
50
|
}));
|
|
50
51
|
const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function MultiSectionDigitalClock(inProps, ref) {
|
|
51
|
-
const now = (0, _useUtils.useNow)();
|
|
52
52
|
const utils = (0, _useUtils.useUtils)();
|
|
53
|
-
const localeText = (0, _useUtils.useLocaleText)();
|
|
54
53
|
const props = (0, _styles.useThemeProps)({
|
|
55
54
|
props: inProps,
|
|
56
55
|
name: 'MuiMultiSectionDigitalClock'
|
|
@@ -83,24 +82,30 @@ const MultiSectionDigitalClock = /*#__PURE__*/React.forwardRef(function MultiSec
|
|
|
83
82
|
className,
|
|
84
83
|
disabled,
|
|
85
84
|
readOnly,
|
|
86
|
-
skipDisabled = false
|
|
85
|
+
skipDisabled = false,
|
|
86
|
+
timezone: timezoneProp
|
|
87
87
|
} = props,
|
|
88
88
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
89
|
+
const {
|
|
90
|
+
value,
|
|
91
|
+
handleValueChange: handleRawValueChange,
|
|
92
|
+
timezone
|
|
93
|
+
} = (0, _useValueWithTimezone.useControlledValueWithTimezone)({
|
|
94
|
+
name: 'MultiSectionDigitalClock',
|
|
95
|
+
timezone: timezoneProp,
|
|
96
|
+
value: valueProp,
|
|
97
|
+
defaultValue,
|
|
98
|
+
onChange,
|
|
99
|
+
valueManager: _valueManagers.singleItemValueManager
|
|
100
|
+
});
|
|
101
|
+
const localeText = (0, _useUtils.useLocaleText)();
|
|
102
|
+
const now = (0, _useUtils.useNow)(timezone);
|
|
89
103
|
const timeSteps = React.useMemo(() => (0, _extends2.default)({
|
|
90
104
|
hours: 1,
|
|
91
105
|
minutes: 5,
|
|
92
106
|
seconds: 5
|
|
93
107
|
}, inTimeSteps), [inTimeSteps]);
|
|
94
|
-
const
|
|
95
|
-
name: 'MultiSectionDigitalClock',
|
|
96
|
-
state: 'value',
|
|
97
|
-
controlled: valueProp,
|
|
98
|
-
default: defaultValue ?? null
|
|
99
|
-
});
|
|
100
|
-
const handleValueChange = (0, _useEventCallback.default)((newValue, selectionState, selectedView) => {
|
|
101
|
-
setValue(newValue);
|
|
102
|
-
onChange?.(newValue, selectionState, selectedView);
|
|
103
|
-
});
|
|
108
|
+
const handleValueChange = (0, _useEventCallback.default)((newValue, selectionState, selectedView) => handleRawValueChange(newValue, selectionState, selectedView));
|
|
104
109
|
const views = React.useMemo(() => {
|
|
105
110
|
if (!ampm || !inViews.includes('hours')) {
|
|
106
111
|
return inViews;
|
|
@@ -471,6 +476,14 @@ process.env.NODE_ENV !== "production" ? MultiSectionDigitalClock.propTypes = {
|
|
|
471
476
|
minutes: _propTypes.default.number,
|
|
472
477
|
seconds: _propTypes.default.number
|
|
473
478
|
}),
|
|
479
|
+
/**
|
|
480
|
+
* Choose which timezone to use for the value.
|
|
481
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
482
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
483
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
484
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
485
|
+
*/
|
|
486
|
+
timezone: _propTypes.default.string,
|
|
474
487
|
/**
|
|
475
488
|
* The selected value.
|
|
476
489
|
* Used when the component is controlled.
|
|
@@ -143,7 +143,7 @@ const MultiSectionDigitalClockSection = /*#__PURE__*/React.forwardRef(function M
|
|
|
143
143
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(DigitalClockSectionItem, (0, _extends2.default)({
|
|
144
144
|
onClick: () => !readOnly && onChange(option.value),
|
|
145
145
|
selected: isSelected,
|
|
146
|
-
disabled: disabled
|
|
146
|
+
disabled: disabled || option.isDisabled?.(option.value),
|
|
147
147
|
disableRipple: readOnly,
|
|
148
148
|
role: "option"
|
|
149
149
|
// aria-readonly is not supported here and does not have any effect
|
|
@@ -146,6 +146,7 @@ process.env.NODE_ENV !== "production" ? PickersLayout.propTypes = {
|
|
|
146
146
|
onClose: _propTypes.default.func.isRequired,
|
|
147
147
|
onDismiss: _propTypes.default.func.isRequired,
|
|
148
148
|
onOpen: _propTypes.default.func.isRequired,
|
|
149
|
+
onSelectShortcut: _propTypes.default.func.isRequired,
|
|
149
150
|
onSetToday: _propTypes.default.func.isRequired,
|
|
150
151
|
onViewChange: _propTypes.default.func.isRequired,
|
|
151
152
|
/**
|
|
@@ -47,6 +47,7 @@ const usePickerLayout = props => {
|
|
|
47
47
|
onViewChange,
|
|
48
48
|
value,
|
|
49
49
|
onChange,
|
|
50
|
+
onSelectShortcut,
|
|
50
51
|
isValid,
|
|
51
52
|
isLandscape,
|
|
52
53
|
disabled,
|
|
@@ -59,7 +60,7 @@ const usePickerLayout = props => {
|
|
|
59
60
|
// TODO: Remove this "as" hack. It get introduced to mark `value` prop in PickersLayoutProps as not required.
|
|
60
61
|
// The true type should be
|
|
61
62
|
// - For pickers value: TDate | null
|
|
62
|
-
// - For
|
|
63
|
+
// - For range pickers value: [TDate | null, TDate | null]
|
|
63
64
|
} = props;
|
|
64
65
|
const slots = innerSlots ?? (0, _slotsMigration.uncapitalizeObjectKeys)(components);
|
|
65
66
|
const slotProps = innerSlotProps ?? componentsProps;
|
|
@@ -129,13 +130,13 @@ const usePickerLayout = props => {
|
|
|
129
130
|
additionalProps: {
|
|
130
131
|
isValid,
|
|
131
132
|
isLandscape,
|
|
132
|
-
onChange,
|
|
133
|
+
onChange: onSelectShortcut,
|
|
133
134
|
className: classes.shortcuts
|
|
134
135
|
},
|
|
135
136
|
ownerState: {
|
|
136
137
|
isValid,
|
|
137
138
|
isLandscape,
|
|
138
|
-
onChange,
|
|
139
|
+
onChange: onSelectShortcut,
|
|
139
140
|
className: classes.shortcuts,
|
|
140
141
|
wrapperVariant
|
|
141
142
|
}
|