@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
|
@@ -14,12 +14,13 @@ var _ListItem = _interopRequireDefault(require("@mui/material/ListItem"));
|
|
|
14
14
|
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
15
15
|
var _dimensions = require("../internals/constants/dimensions");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["items", "isLandscape", "onChange", "isValid"];
|
|
17
|
+
const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"];
|
|
18
18
|
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); }
|
|
19
19
|
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; }
|
|
20
20
|
function PickersShortcuts(props) {
|
|
21
21
|
const {
|
|
22
22
|
items,
|
|
23
|
+
changeImportance,
|
|
23
24
|
onChange,
|
|
24
25
|
isValid
|
|
25
26
|
} = props,
|
|
@@ -34,7 +35,7 @@ function PickersShortcuts(props) {
|
|
|
34
35
|
return {
|
|
35
36
|
label: item.label,
|
|
36
37
|
onClick: () => {
|
|
37
|
-
onChange(newValue);
|
|
38
|
+
onChange(newValue, changeImportance);
|
|
38
39
|
},
|
|
39
40
|
disabled: !isValid(newValue)
|
|
40
41
|
};
|
|
@@ -59,6 +60,13 @@ process.env.NODE_ENV !== "production" ? PickersShortcuts.propTypes = {
|
|
|
59
60
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
60
61
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
61
62
|
// ----------------------------------------------------------------------
|
|
63
|
+
/**
|
|
64
|
+
* Importance of the change when picking a shortcut:
|
|
65
|
+
* - "accept": fires `onChange`, fires `onAccept` and closes the picker.
|
|
66
|
+
* - "set": fires `onChange` but do not fire `onAccept` and does not close the picker.
|
|
67
|
+
* @default "accept"
|
|
68
|
+
*/
|
|
69
|
+
changeImportance: _propTypes.default.oneOf(['accept', 'set']),
|
|
62
70
|
className: _propTypes.default.string,
|
|
63
71
|
/**
|
|
64
72
|
* If `true`, compact vertical padding designed for keyboard and mouse input is used for
|
|
@@ -83,7 +83,7 @@ StaticDatePicker.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
|
/**
|
|
@@ -266,6 +266,14 @@ StaticDatePicker.propTypes = {
|
|
|
266
266
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
267
267
|
*/
|
|
268
268
|
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]),
|
|
269
|
+
/**
|
|
270
|
+
* Choose which timezone to use for the value.
|
|
271
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
272
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
273
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
274
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
275
|
+
*/
|
|
276
|
+
timezone: _propTypes.default.string,
|
|
269
277
|
/**
|
|
270
278
|
* The selected value.
|
|
271
279
|
* Used when the component is controlled.
|
|
@@ -103,7 +103,7 @@ StaticDateTimePicker.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
|
/**
|
|
@@ -330,6 +330,14 @@ StaticDateTimePicker.propTypes = {
|
|
|
330
330
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
331
331
|
*/
|
|
332
332
|
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]),
|
|
333
|
+
/**
|
|
334
|
+
* Choose which timezone to use for the value.
|
|
335
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
336
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
337
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
338
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
339
|
+
*/
|
|
340
|
+
timezone: _propTypes.default.string,
|
|
333
341
|
/**
|
|
334
342
|
* The selected value.
|
|
335
343
|
* Used when the component is controlled.
|
|
@@ -214,6 +214,14 @@ StaticTimePicker.propTypes = {
|
|
|
214
214
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
215
215
|
*/
|
|
216
216
|
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]),
|
|
217
|
+
/**
|
|
218
|
+
* Choose which timezone to use for the value.
|
|
219
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
220
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
221
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
222
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
223
|
+
*/
|
|
224
|
+
timezone: _propTypes.default.string,
|
|
217
225
|
/**
|
|
218
226
|
* The selected value.
|
|
219
227
|
* Used when the component is controlled.
|
|
@@ -12,7 +12,6 @@ var _clsx = _interopRequireDefault(require("clsx"));
|
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _utils = require("@mui/utils");
|
|
15
|
-
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
16
15
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
17
16
|
var _PickersArrowSwitcher = require("../internals/components/PickersArrowSwitcher");
|
|
18
17
|
var _timeUtils = require("../internals/utils/time-utils");
|
|
@@ -22,9 +21,11 @@ var _PickerViewRoot = require("../internals/components/PickerViewRoot");
|
|
|
22
21
|
var _timeClockClasses = require("./timeClockClasses");
|
|
23
22
|
var _Clock = require("./Clock");
|
|
24
23
|
var _ClockNumbers = require("./ClockNumbers");
|
|
24
|
+
var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
|
|
25
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
25
26
|
var _slotsMigration = require("../internals/utils/slots-migration");
|
|
26
27
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
|
-
const _excluded = ["ampm", "ampmInClock", "autoFocus", "components", "componentsProps", "slots", "slotProps", "value", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "showViewSwitcher", "onChange", "defaultValue", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly"];
|
|
28
|
+
const _excluded = ["ampm", "ampmInClock", "autoFocus", "components", "componentsProps", "slots", "slotProps", "value", "disableIgnoringDatePartForTimeValidation", "maxTime", "minTime", "disableFuture", "disablePast", "minutesStep", "shouldDisableClock", "shouldDisableTime", "showViewSwitcher", "onChange", "defaultValue", "view", "views", "openTo", "onViewChange", "focusedView", "onFocusedViewChange", "className", "disabled", "readOnly", "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 => {
|
|
@@ -62,8 +63,6 @@ const TimeClockArrowSwitcher = (0, _styles.styled)(_PickersArrowSwitcher.Pickers
|
|
|
62
63
|
* - [TimeClock API](https://mui.com/x/api/date-pickers/time-clock/)
|
|
63
64
|
*/
|
|
64
65
|
const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProps, ref) {
|
|
65
|
-
const localeText = (0, _useUtils.useLocaleText)();
|
|
66
|
-
const now = (0, _useUtils.useNow)();
|
|
67
66
|
const utils = (0, _useUtils.useUtils)();
|
|
68
67
|
const props = (0, _styles.useThemeProps)({
|
|
69
68
|
props: inProps,
|
|
@@ -97,21 +96,26 @@ const TimeClock = /*#__PURE__*/React.forwardRef(function TimeClock(inProps, ref)
|
|
|
97
96
|
onFocusedViewChange,
|
|
98
97
|
className,
|
|
99
98
|
disabled,
|
|
100
|
-
readOnly
|
|
99
|
+
readOnly,
|
|
100
|
+
timezone: timezoneProp
|
|
101
101
|
} = props,
|
|
102
102
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
103
103
|
const slots = innerSlots ?? (0, _slotsMigration.uncapitalizeObjectKeys)(components);
|
|
104
104
|
const slotProps = innerSlotProps ?? componentsProps;
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
const {
|
|
106
|
+
value,
|
|
107
|
+
handleValueChange,
|
|
108
|
+
timezone
|
|
109
|
+
} = (0, _useValueWithTimezone.useControlledValueWithTimezone)({
|
|
110
|
+
name: 'TimeClock',
|
|
111
|
+
timezone: timezoneProp,
|
|
112
|
+
value: valueProp,
|
|
113
|
+
defaultValue,
|
|
114
|
+
onChange,
|
|
115
|
+
valueManager: _valueManagers.singleItemValueManager
|
|
114
116
|
});
|
|
117
|
+
const localeText = (0, _useUtils.useLocaleText)();
|
|
118
|
+
const now = (0, _useUtils.useNow)(timezone);
|
|
115
119
|
const {
|
|
116
120
|
view,
|
|
117
121
|
setView,
|
|
@@ -456,6 +460,14 @@ process.env.NODE_ENV !== "production" ? TimeClock.propTypes = {
|
|
|
456
460
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
457
461
|
*/
|
|
458
462
|
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]),
|
|
463
|
+
/**
|
|
464
|
+
* Choose which timezone to use for the value.
|
|
465
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
466
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
467
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
468
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
469
|
+
*/
|
|
470
|
+
timezone: _propTypes.default.string,
|
|
459
471
|
/**
|
|
460
472
|
* The selected value.
|
|
461
473
|
* Used when the component is controlled.
|
|
@@ -256,7 +256,7 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
256
256
|
*/
|
|
257
257
|
readOnly: _propTypes.default.bool,
|
|
258
258
|
/**
|
|
259
|
-
* The date used to generate a part of the
|
|
259
|
+
* 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.
|
|
260
260
|
* For example, on time fields it will be used to determine the date to set.
|
|
261
261
|
* @default The closest valid date using the validation props, except callbacks such as `shouldDisableDate`. Value is rounded to the most granular section used.
|
|
262
262
|
*/
|
|
@@ -329,6 +329,14 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
329
329
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
330
330
|
*/
|
|
331
331
|
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]),
|
|
332
|
+
/**
|
|
333
|
+
* Choose which timezone to use for the value.
|
|
334
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
335
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
336
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
337
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
338
|
+
*/
|
|
339
|
+
timezone: _propTypes.default.string,
|
|
332
340
|
/**
|
|
333
341
|
* The ref object used to imperatively interact with the field.
|
|
334
342
|
*/
|
|
@@ -287,6 +287,14 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
287
287
|
minutes: _propTypes.default.number,
|
|
288
288
|
seconds: _propTypes.default.number
|
|
289
289
|
}),
|
|
290
|
+
/**
|
|
291
|
+
* Choose which timezone to use for the value.
|
|
292
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
293
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
294
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
295
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
296
|
+
*/
|
|
297
|
+
timezone: _propTypes.default.string,
|
|
290
298
|
/**
|
|
291
299
|
* The selected value.
|
|
292
300
|
* Used when the component is controlled.
|
|
@@ -17,8 +17,11 @@ var _PickersYear = require("./PickersYear");
|
|
|
17
17
|
var _useUtils = require("../internals/hooks/useUtils");
|
|
18
18
|
var _yearCalendarClasses = require("./yearCalendarClasses");
|
|
19
19
|
var _dateUtils = require("../internals/utils/date-utils");
|
|
20
|
+
var _valueManagers = require("../internals/utils/valueManagers");
|
|
21
|
+
var _getDefaultReferenceDate = require("../internals/utils/getDefaultReferenceDate");
|
|
22
|
+
var _useValueWithTimezone = require("../internals/hooks/useValueWithTimezone");
|
|
20
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const _excluded = ["autoFocus", "className", "value", "defaultValue", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "readOnly", "shouldDisableYear", "disableHighlightToday", "onYearFocus", "hasFocus", "onFocusedViewChange", "yearsPerRow"];
|
|
24
|
+
const _excluded = ["autoFocus", "className", "value", "defaultValue", "referenceDate", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onChange", "readOnly", "shouldDisableYear", "disableHighlightToday", "onYearFocus", "hasFocus", "onFocusedViewChange", "yearsPerRow", "timezone"];
|
|
22
25
|
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); }
|
|
23
26
|
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; }
|
|
24
27
|
const useUtilityClasses = ownerState => {
|
|
@@ -60,15 +63,13 @@ const YearCalendarRoot = (0, _styles.styled)('div', {
|
|
|
60
63
|
maxHeight: 304
|
|
61
64
|
});
|
|
62
65
|
const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
|
|
63
|
-
const now = (0, _useUtils.useNow)();
|
|
64
|
-
const theme = (0, _system.useTheme)();
|
|
65
|
-
const utils = (0, _useUtils.useUtils)();
|
|
66
66
|
const props = useYearCalendarDefaultizedProps(inProps, 'MuiYearCalendar');
|
|
67
67
|
const {
|
|
68
68
|
autoFocus,
|
|
69
69
|
className,
|
|
70
70
|
value: valueProp,
|
|
71
71
|
defaultValue,
|
|
72
|
+
referenceDate: referenceDateProp,
|
|
72
73
|
disabled,
|
|
73
74
|
disableFuture,
|
|
74
75
|
disablePast,
|
|
@@ -81,18 +82,37 @@ const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps
|
|
|
81
82
|
onYearFocus,
|
|
82
83
|
hasFocus,
|
|
83
84
|
onFocusedViewChange,
|
|
84
|
-
yearsPerRow = 3
|
|
85
|
+
yearsPerRow = 3,
|
|
86
|
+
timezone: timezoneProp
|
|
85
87
|
} = props,
|
|
86
88
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
const {
|
|
90
|
+
value,
|
|
91
|
+
handleValueChange,
|
|
92
|
+
timezone
|
|
93
|
+
} = (0, _useValueWithTimezone.useControlledValueWithTimezone)({
|
|
90
94
|
name: 'YearCalendar',
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
timezone: timezoneProp,
|
|
96
|
+
value: valueProp,
|
|
97
|
+
defaultValue,
|
|
98
|
+
onChange: onChange,
|
|
99
|
+
valueManager: _valueManagers.singleItemValueManager
|
|
94
100
|
});
|
|
95
|
-
const
|
|
101
|
+
const now = (0, _useUtils.useNow)(timezone);
|
|
102
|
+
const theme = (0, _system.useTheme)();
|
|
103
|
+
const utils = (0, _useUtils.useUtils)();
|
|
104
|
+
const referenceDate = React.useMemo(() => _valueManagers.singleItemValueManager.getInitialReferenceValue({
|
|
105
|
+
value,
|
|
106
|
+
utils,
|
|
107
|
+
props,
|
|
108
|
+
timezone,
|
|
109
|
+
referenceDate: referenceDateProp,
|
|
110
|
+
granularity: _getDefaultReferenceDate.SECTION_TYPE_GRANULARITY.year
|
|
111
|
+
}), [] // eslint-disable-line react-hooks/exhaustive-deps
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const ownerState = props;
|
|
115
|
+
const classes = useUtilityClasses(ownerState);
|
|
96
116
|
const todayYear = React.useMemo(() => utils.getYear(now), [utils, now]);
|
|
97
117
|
const selectedYear = React.useMemo(() => {
|
|
98
118
|
if (value != null) {
|
|
@@ -101,8 +121,8 @@ const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps
|
|
|
101
121
|
if (disableHighlightToday) {
|
|
102
122
|
return null;
|
|
103
123
|
}
|
|
104
|
-
return utils.getYear(
|
|
105
|
-
}, [
|
|
124
|
+
return utils.getYear(referenceDate);
|
|
125
|
+
}, [value, utils, disableHighlightToday, referenceDate]);
|
|
106
126
|
const [focusedYear, setFocusedYear] = React.useState(() => selectedYear || todayYear);
|
|
107
127
|
const [internalHasFocus, setInternalHasFocus] = (0, _utils.unstable_useControlled)({
|
|
108
128
|
name: 'YearCalendar',
|
|
@@ -129,21 +149,21 @@ const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps
|
|
|
129
149
|
if (maxDate && utils.isAfterYear(dateToValidate, maxDate)) {
|
|
130
150
|
return true;
|
|
131
151
|
}
|
|
132
|
-
if (shouldDisableYear
|
|
133
|
-
return
|
|
152
|
+
if (!shouldDisableYear) {
|
|
153
|
+
return false;
|
|
134
154
|
}
|
|
135
|
-
|
|
155
|
+
const yearToValidate = utils.startOfYear(dateToValidate);
|
|
156
|
+
return shouldDisableYear(yearToValidate);
|
|
136
157
|
}, [disableFuture, disablePast, maxDate, minDate, now, shouldDisableYear, utils]);
|
|
137
158
|
const handleYearSelection = (0, _utils.unstable_useEventCallback)((event, year) => {
|
|
138
159
|
if (readOnly) {
|
|
139
160
|
return;
|
|
140
161
|
}
|
|
141
|
-
const newDate = utils.setYear(
|
|
142
|
-
|
|
143
|
-
onChange?.(newDate);
|
|
162
|
+
const newDate = utils.setYear(value ?? referenceDate, year);
|
|
163
|
+
handleValueChange(newDate);
|
|
144
164
|
});
|
|
145
165
|
const focusYear = (0, _utils.unstable_useEventCallback)(year => {
|
|
146
|
-
if (!isYearDisabled(utils.setYear(
|
|
166
|
+
if (!isYearDisabled(utils.setYear(value ?? referenceDate, year))) {
|
|
147
167
|
setFocusedYear(year);
|
|
148
168
|
changeHasFocus(true);
|
|
149
169
|
onYearFocus?.(year);
|
|
@@ -282,7 +302,7 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
282
302
|
/**
|
|
283
303
|
* Callback fired when the value changes.
|
|
284
304
|
* @template TDate
|
|
285
|
-
* @param {TDate
|
|
305
|
+
* @param {TDate} value The new value.
|
|
286
306
|
*/
|
|
287
307
|
onChange: _propTypes.default.func,
|
|
288
308
|
onFocusedViewChange: _propTypes.default.func,
|
|
@@ -291,6 +311,11 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
291
311
|
* If `true` picker is readonly
|
|
292
312
|
*/
|
|
293
313
|
readOnly: _propTypes.default.bool,
|
|
314
|
+
/**
|
|
315
|
+
* The date used to generate the new value when both `value` and `defaultValue` are empty.
|
|
316
|
+
* @default The closest valid year using the validation props, except callbacks such as `shouldDisableDate`.
|
|
317
|
+
*/
|
|
318
|
+
referenceDate: _propTypes.default.any,
|
|
294
319
|
/**
|
|
295
320
|
* Disable specific year.
|
|
296
321
|
* @template TDate
|
|
@@ -302,6 +327,14 @@ process.env.NODE_ENV !== "production" ? YearCalendar.propTypes = {
|
|
|
302
327
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
303
328
|
*/
|
|
304
329
|
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]),
|
|
330
|
+
/**
|
|
331
|
+
* Choose which timezone to use for the value.
|
|
332
|
+
* Example: "default", "system", "UTC", "America/New_York".
|
|
333
|
+
* If you pass values from other timezones to some props, they will be converted to this timezone before being used.
|
|
334
|
+
* @see See the {@link https://mui.com/x/react-date-pickers/timezone/ timezones documention} for more details.
|
|
335
|
+
* @default The timezone of the `value` or `defaultValue` prop is defined, 'default' otherwise.
|
|
336
|
+
*/
|
|
337
|
+
timezone: _propTypes.default.string,
|
|
305
338
|
/**
|
|
306
339
|
* The selected value.
|
|
307
340
|
* Used when the component is controlled.
|
|
@@ -62,6 +62,7 @@ const renderDesktopDateTimeView = ({
|
|
|
62
62
|
autoFocus,
|
|
63
63
|
fixedWeekNumber,
|
|
64
64
|
displayWeekNumber,
|
|
65
|
+
timezone,
|
|
65
66
|
disableIgnoringDatePartForTimeValidation,
|
|
66
67
|
timeSteps,
|
|
67
68
|
skipDisabled,
|
|
@@ -108,7 +109,8 @@ const renderDesktopDateTimeView = ({
|
|
|
108
109
|
sx: sx,
|
|
109
110
|
autoFocus: autoFocus,
|
|
110
111
|
fixedWeekNumber: fixedWeekNumber,
|
|
111
|
-
displayWeekNumber: displayWeekNumber
|
|
112
|
+
displayWeekNumber: displayWeekNumber,
|
|
113
|
+
timezone: timezone
|
|
112
114
|
}), timeViewsCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
113
115
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {
|
|
114
116
|
orientation: "vertical"
|
|
@@ -147,7 +149,8 @@ const renderDesktopDateTimeView = ({
|
|
|
147
149
|
autoFocus: autoFocus,
|
|
148
150
|
disableIgnoringDatePartForTimeValidation: disableIgnoringDatePartForTimeValidation,
|
|
149
151
|
timeSteps: timeSteps,
|
|
150
|
-
skipDisabled: skipDisabled
|
|
152
|
+
skipDisabled: skipDisabled,
|
|
153
|
+
timezone: timezone
|
|
151
154
|
})]
|
|
152
155
|
})]
|
|
153
156
|
}), isActionBarVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Divider.default, {})]
|
|
@@ -48,7 +48,8 @@ const renderDateViewCalendar = ({
|
|
|
48
48
|
sx,
|
|
49
49
|
autoFocus,
|
|
50
50
|
fixedWeekNumber,
|
|
51
|
-
displayWeekNumber
|
|
51
|
+
displayWeekNumber,
|
|
52
|
+
timezone
|
|
52
53
|
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_DateCalendar.DateCalendar, {
|
|
53
54
|
view: view,
|
|
54
55
|
onViewChange: onViewChange,
|
|
@@ -87,6 +88,7 @@ const renderDateViewCalendar = ({
|
|
|
87
88
|
sx: sx,
|
|
88
89
|
autoFocus: autoFocus,
|
|
89
90
|
fixedWeekNumber: fixedWeekNumber,
|
|
90
|
-
displayWeekNumber: displayWeekNumber
|
|
91
|
+
displayWeekNumber: displayWeekNumber,
|
|
92
|
+
timezone: timezone
|
|
91
93
|
});
|
|
92
94
|
exports.renderDateViewCalendar = renderDateViewCalendar;
|
package/node/index.js
CHANGED
|
@@ -13,25 +13,27 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
13
13
|
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; }
|
|
14
14
|
function useNextMonthDisabled(month, {
|
|
15
15
|
disableFuture,
|
|
16
|
-
maxDate
|
|
16
|
+
maxDate,
|
|
17
|
+
timezone
|
|
17
18
|
}) {
|
|
18
19
|
const utils = (0, _useUtils.useUtils)();
|
|
19
20
|
return React.useMemo(() => {
|
|
20
|
-
const now = utils.
|
|
21
|
+
const now = utils.dateWithTimezone(undefined, timezone);
|
|
21
22
|
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
|
|
22
23
|
return !utils.isAfter(lastEnabledMonth, month);
|
|
23
|
-
}, [disableFuture, maxDate, month, utils]);
|
|
24
|
+
}, [disableFuture, maxDate, month, utils, timezone]);
|
|
24
25
|
}
|
|
25
26
|
function usePreviousMonthDisabled(month, {
|
|
26
27
|
disablePast,
|
|
27
|
-
minDate
|
|
28
|
+
minDate,
|
|
29
|
+
timezone
|
|
28
30
|
}) {
|
|
29
31
|
const utils = (0, _useUtils.useUtils)();
|
|
30
32
|
return React.useMemo(() => {
|
|
31
|
-
const now = utils.
|
|
33
|
+
const now = utils.dateWithTimezone(undefined, timezone);
|
|
32
34
|
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
|
|
33
35
|
return !utils.isBefore(firstEnabledMonth, month);
|
|
34
|
-
}, [disablePast, minDate, month, utils]);
|
|
36
|
+
}, [disablePast, minDate, month, utils, timezone]);
|
|
35
37
|
}
|
|
36
38
|
function useMeridiemMode(date, ampm, onChange, selectionState) {
|
|
37
39
|
const utils = (0, _useUtils.useUtils)();
|
|
@@ -43,6 +43,7 @@ const useDesktopPicker = _ref => {
|
|
|
43
43
|
sx,
|
|
44
44
|
format,
|
|
45
45
|
formatDensity,
|
|
46
|
+
timezone,
|
|
46
47
|
label,
|
|
47
48
|
inputRef,
|
|
48
49
|
readOnly,
|
|
@@ -107,6 +108,7 @@ const useDesktopPicker = _ref => {
|
|
|
107
108
|
sx,
|
|
108
109
|
format,
|
|
109
110
|
formatDensity,
|
|
111
|
+
timezone,
|
|
110
112
|
label,
|
|
111
113
|
autoFocus: autoFocus && !props.open,
|
|
112
114
|
focused: open ? true : undefined
|
|
@@ -33,14 +33,16 @@ const useField = params => {
|
|
|
33
33
|
updateValueFromValueStr,
|
|
34
34
|
setTempAndroidValueStr,
|
|
35
35
|
sectionsValueBoundaries,
|
|
36
|
-
placeholder
|
|
36
|
+
placeholder,
|
|
37
|
+
timezone
|
|
37
38
|
} = (0, _useFieldState.useFieldState)(params);
|
|
38
39
|
const {
|
|
39
40
|
inputRef: inputRefProp,
|
|
40
41
|
internalProps,
|
|
41
42
|
internalProps: {
|
|
42
43
|
readOnly = false,
|
|
43
|
-
unstableFieldRef
|
|
44
|
+
unstableFieldRef,
|
|
45
|
+
minutesStep
|
|
44
46
|
},
|
|
45
47
|
forwardedProps: {
|
|
46
48
|
onClick,
|
|
@@ -63,7 +65,8 @@ const useField = params => {
|
|
|
63
65
|
sections: state.sections,
|
|
64
66
|
updateSectionValue,
|
|
65
67
|
sectionsValueBoundaries,
|
|
66
|
-
setTempAndroidValueStr
|
|
68
|
+
setTempAndroidValueStr,
|
|
69
|
+
timezone
|
|
67
70
|
});
|
|
68
71
|
const inputRef = React.useRef(null);
|
|
69
72
|
const handleRef = (0, _useForkRef.default)(inputRefProp, inputRef);
|
|
@@ -104,7 +107,7 @@ const useField = params => {
|
|
|
104
107
|
onFocus?.(...args);
|
|
105
108
|
// The ref is guaranteed to be resolved at this point.
|
|
106
109
|
const input = inputRef.current;
|
|
107
|
-
clearTimeout(focusTimeoutRef.current);
|
|
110
|
+
window.clearTimeout(focusTimeoutRef.current);
|
|
108
111
|
focusTimeoutRef.current = setTimeout(() => {
|
|
109
112
|
// The ref changed, the component got remounted, the focus event is no longer relevant.
|
|
110
113
|
if (!input || input !== inputRef.current) {
|
|
@@ -151,6 +154,7 @@ const useField = params => {
|
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
event.preventDefault();
|
|
157
|
+
resetCharacterQuery();
|
|
154
158
|
updateValueFromValueStr(pastedValue);
|
|
155
159
|
});
|
|
156
160
|
const handleInputChange = (0, _useEventCallback.default)(event => {
|
|
@@ -275,7 +279,9 @@ const useField = params => {
|
|
|
275
279
|
}
|
|
276
280
|
const activeSection = state.sections[selectedSectionIndexes.startIndex];
|
|
277
281
|
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
278
|
-
const newSectionValue = (0, _useField.adjustSectionValue)(utils, activeSection, event.key, sectionsValueBoundaries, activeDateManager.date
|
|
282
|
+
const newSectionValue = (0, _useField.adjustSectionValue)(utils, timezone, activeSection, event.key, sectionsValueBoundaries, activeDateManager.date, {
|
|
283
|
+
minutesStep
|
|
284
|
+
});
|
|
279
285
|
updateSectionValue({
|
|
280
286
|
activeSection,
|
|
281
287
|
newSectionValue,
|
|
@@ -286,6 +292,9 @@ const useField = params => {
|
|
|
286
292
|
}
|
|
287
293
|
});
|
|
288
294
|
(0, _useEnhancedEffect.default)(() => {
|
|
295
|
+
if (!inputRef.current) {
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
289
298
|
if (selectedSectionIndexes == null) {
|
|
290
299
|
if (inputRef.current.scrollLeft) {
|
|
291
300
|
// Ensure that input content is not marked as selected.
|
|
@@ -309,7 +318,7 @@ const useField = params => {
|
|
|
309
318
|
// On multi input range pickers we want to update selection range only for the active input
|
|
310
319
|
// This helps avoiding the focus jumping on Safari https://github.com/mui/mui-x/issues/9003
|
|
311
320
|
// because WebKit implements the `setSelectionRange` based on the spec: https://bugs.webkit.org/show_bug.cgi?id=224425
|
|
312
|
-
if (inputRef.current
|
|
321
|
+
if (inputRef.current === (0, _utils.getActiveElement)(document)) {
|
|
313
322
|
inputRef.current.setSelectionRange(selectionStart, selectionEnd);
|
|
314
323
|
}
|
|
315
324
|
// Even reading this variable seems to do the trick, but also setting it just to make use of it
|
|
@@ -317,7 +326,8 @@ const useField = params => {
|
|
|
317
326
|
}
|
|
318
327
|
});
|
|
319
328
|
const validationError = (0, _useValidation.useValidation)((0, _extends2.default)({}, internalProps, {
|
|
320
|
-
value: state.value
|
|
329
|
+
value: state.value,
|
|
330
|
+
timezone
|
|
321
331
|
}), validator, valueManager.isSameError, valueManager.defaultErrorState);
|
|
322
332
|
const inputError = React.useMemo(() => {
|
|
323
333
|
// only override when `error` is undefined.
|
|
@@ -327,6 +337,12 @@ const useField = params => {
|
|
|
327
337
|
}
|
|
328
338
|
return valueManager.hasError(validationError);
|
|
329
339
|
}, [valueManager, validationError, error]);
|
|
340
|
+
React.useEffect(() => {
|
|
341
|
+
if (!inputError && !selectedSectionIndexes) {
|
|
342
|
+
resetCharacterQuery();
|
|
343
|
+
}
|
|
344
|
+
}, [state.referenceValue, selectedSectionIndexes, inputError]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
345
|
+
|
|
330
346
|
React.useEffect(() => {
|
|
331
347
|
// Select the right section when focused on mount (`autoFocus = true` on the input)
|
|
332
348
|
if (inputRef.current && inputRef.current === document.activeElement) {
|