@mui/x-date-pickers 6.11.1 → 6.12.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/AdapterDateFns/AdapterDateFns.d.ts +2 -2
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +2 -2
- package/AdapterDayjs/AdapterDayjs.d.ts +2 -2
- package/AdapterLuxon/AdapterLuxon.d.ts +2 -2
- package/AdapterMoment/AdapterMoment.d.ts +2 -2
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +2 -2
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +2 -2
- package/CHANGELOG.md +154 -31
- package/DateCalendar/DateCalendar.js +4 -4
- package/DateCalendar/DateCalendar.types.d.ts +2 -2
- package/DateCalendar/DayCalendar.js +2 -2
- package/DatePicker/DatePicker.js +2 -2
- package/DateTimePicker/DateTimePicker.js +2 -2
- package/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/DigitalClock/DigitalClock.js +3 -1
- package/MobileDatePicker/MobileDatePicker.js +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/MobileTimePicker/MobileTimePicker.js +5 -0
- package/MonthCalendar/PickersMonth.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/PickersShortcuts/PickersShortcuts.d.ts +2 -1
- package/PickersShortcuts/PickersShortcuts.js +9 -4
- package/PickersShortcuts/index.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +2 -2
- package/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/StaticTimePicker/StaticTimePicker.js +5 -0
- package/TimePicker/TimePicker.js +5 -0
- package/YearCalendar/YearCalendar.js +5 -2
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
- package/internals/components/PickersPopper.d.ts +7 -4
- package/internals/components/PickersPopper.js +65 -32
- package/internals/components/PickersToolbar.js +13 -13
- package/internals/hooks/useDefaultReduceAnimations.d.ts +1 -1
- package/internals/hooks/useDefaultReduceAnimations.js +7 -2
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +4 -2
- package/internals/hooks/useField/useField.js +6 -6
- package/internals/hooks/useField/useField.utils.d.ts +0 -1
- package/internals/hooks/useField/useField.utils.js +0 -48
- package/internals/hooks/useField/useFieldState.js +5 -25
- package/internals/hooks/usePicker/usePickerValue.js +11 -3
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +3 -5
- package/internals/hooks/usePicker/usePickerViews.d.ts +5 -0
- package/internals/hooks/usePicker/usePickerViews.js +1 -1
- package/internals/hooks/useValidation.d.ts +2 -4
- package/internals/hooks/useValueWithTimezone.js +2 -2
- package/internals/hooks/useViews.js +1 -1
- package/legacy/DateCalendar/DateCalendar.js +4 -4
- package/legacy/DateCalendar/DayCalendar.js +2 -2
- package/legacy/DatePicker/DatePicker.js +2 -2
- package/legacy/DateTimePicker/DateTimePicker.js +2 -2
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/legacy/DigitalClock/DigitalClock.js +3 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +2 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/legacy/MobileTimePicker/MobileTimePicker.js +5 -0
- package/legacy/MonthCalendar/PickersMonth.js +1 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/legacy/PickersShortcuts/PickersShortcuts.js +7 -4
- package/legacy/StaticDatePicker/StaticDatePicker.js +2 -2
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/legacy/StaticTimePicker/StaticTimePicker.js +5 -0
- package/legacy/TimePicker/TimePicker.js +5 -0
- package/legacy/YearCalendar/YearCalendar.js +5 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -15
- package/legacy/internals/components/PickersPopper.js +61 -32
- package/legacy/internals/components/PickersToolbar.js +11 -14
- package/legacy/internals/hooks/useDefaultReduceAnimations.js +7 -2
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +4 -2
- package/legacy/internals/hooks/useField/useField.js +6 -6
- package/legacy/internals/hooks/useField/useField.utils.js +0 -52
- package/legacy/internals/hooks/useField/useFieldState.js +4 -24
- package/legacy/internals/hooks/usePicker/usePickerValue.js +11 -3
- package/legacy/internals/hooks/usePicker/usePickerViews.js +1 -1
- package/legacy/internals/hooks/useValueWithTimezone.js +2 -2
- package/legacy/internals/hooks/useViews.js +1 -1
- package/legacy/models/index.js +2 -1
- package/legacy/models/pickers.js +1 -0
- package/legacy/tests/describeAdapters/describeAdapters.js +1 -1
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +1 -1
- package/legacy/tests/describeGregorianAdapter/testLocalization.js +1 -1
- package/legacy/tests/describeValidation/testDayViewValidation.js +1 -1
- package/legacy/tests/describeValidation/testMinutesViewValidation.js +2 -2
- package/legacy/tests/describeValidation/testMonthViewValidation.js +1 -1
- package/legacy/tests/describeValidation/testTextFieldValidation.js +1 -1
- package/legacy/tests/describeValidation/testYearViewValidation.js +1 -1
- package/legacy/tests/describeValue/describeValue.js +1 -1
- package/legacy/tests/describeValue/testControlledUnControlled.js +2 -2
- package/legacy/tests/describeValue/testPickerActionBar.js +1 -2
- package/legacy/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
- package/legacy/tests/describeValue/testShortcuts.js +1 -1
- package/models/adapters.d.ts +2 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/models/pickers.d.ts +9 -0
- package/models/pickers.js +1 -0
- package/modern/DateCalendar/DateCalendar.js +2 -2
- package/modern/DatePicker/DatePicker.js +2 -2
- package/modern/DateTimePicker/DateTimePicker.js +2 -2
- package/modern/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/modern/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/modern/DigitalClock/DigitalClock.js +3 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +2 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/modern/MobileTimePicker/MobileTimePicker.js +5 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/modern/PickersShortcuts/PickersShortcuts.js +9 -4
- package/modern/StaticDatePicker/StaticDatePicker.js +2 -2
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/modern/StaticTimePicker/StaticTimePicker.js +5 -0
- package/modern/TimePicker/TimePicker.js +5 -0
- package/modern/YearCalendar/YearCalendar.js +4 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
- package/modern/internals/components/PickersPopper.js +63 -30
- package/modern/internals/components/PickersToolbar.js +9 -12
- package/modern/internals/hooks/useDefaultReduceAnimations.js +7 -2
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +4 -2
- package/modern/internals/hooks/useField/useField.utils.js +0 -48
- package/modern/internals/hooks/useField/useFieldState.js +4 -24
- package/modern/internals/hooks/usePicker/usePickerValue.js +10 -2
- package/modern/models/index.js +2 -1
- package/modern/models/pickers.js +1 -0
- package/modern/tests/describeAdapters/describeAdapters.js +1 -1
- package/modern/tests/describeGregorianAdapter/testCalculations.js +1 -1
- package/modern/tests/describeGregorianAdapter/testLocalization.js +1 -1
- package/modern/tests/describeValidation/testDayViewValidation.js +1 -1
- package/modern/tests/describeValidation/testMinutesViewValidation.js +2 -2
- package/modern/tests/describeValidation/testMonthViewValidation.js +1 -1
- package/modern/tests/describeValidation/testTextFieldValidation.js +1 -1
- package/modern/tests/describeValidation/testYearViewValidation.js +1 -1
- package/modern/tests/describeValue/describeValue.js +1 -1
- package/modern/tests/describeValue/testControlledUnControlled.js +1 -1
- package/modern/tests/describeValue/testPickerActionBar.js +1 -2
- package/modern/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
- package/modern/tests/describeValue/testShortcuts.js +1 -1
- package/node/DateCalendar/DateCalendar.js +2 -2
- package/node/DatePicker/DatePicker.js +2 -2
- package/node/DateTimePicker/DateTimePicker.js +2 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/node/DesktopTimePicker/DesktopTimePicker.js +5 -0
- package/node/DigitalClock/DigitalClock.js +3 -1
- package/node/MobileDatePicker/MobileDatePicker.js +2 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/node/MobileTimePicker/MobileTimePicker.js +5 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +3 -1
- package/node/PickersShortcuts/PickersShortcuts.js +9 -4
- package/node/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +2 -2
- package/node/StaticTimePicker/StaticTimePicker.js +5 -0
- package/node/TimePicker/TimePicker.js +5 -0
- package/node/YearCalendar/YearCalendar.js +4 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +10 -11
- package/node/internals/components/PickersPopper.js +63 -30
- package/node/internals/components/PickersToolbar.js +9 -12
- package/node/internals/hooks/useDefaultReduceAnimations.js +9 -4
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +4 -2
- package/node/internals/hooks/useField/useField.utils.js +1 -50
- package/node/internals/hooks/useField/useFieldState.js +3 -23
- package/node/internals/hooks/usePicker/usePickerValue.js +10 -2
- package/node/models/index.js +11 -0
- package/node/models/pickers.js +5 -0
- package/node/tests/describeAdapters/describeAdapters.js +3 -3
- package/node/tests/describeGregorianAdapter/testCalculations.js +2 -2
- package/node/tests/describeGregorianAdapter/testLocalization.js +4 -4
- package/node/tests/describeValidation/testDayViewValidation.js +33 -33
- package/node/tests/describeValidation/testMinutesViewValidation.js +14 -14
- package/node/tests/describeValidation/testMonthViewValidation.js +22 -22
- package/node/tests/describeValidation/testTextFieldValidation.js +54 -54
- package/node/tests/describeValidation/testYearViewValidation.js +18 -18
- package/node/tests/describeValue/describeValue.js +2 -2
- package/node/tests/describeValue/testControlledUnControlled.js +3 -3
- package/node/tests/describeValue/testPickerActionBar.js +10 -11
- package/node/tests/describeValue/testPickerOpenCloseLifeCycle.js +10 -10
- package/node/tests/describeValue/testShortcuts.js +6 -6
- package/package.json +3 -3
- package/tests/describeAdapters/describeAdapters.js +1 -1
- package/tests/describeGregorianAdapter/testCalculations.js +1 -1
- package/tests/describeGregorianAdapter/testLocalization.js +1 -1
- package/tests/describeValidation/testDayViewValidation.js +1 -1
- package/tests/describeValidation/testMinutesViewValidation.js +2 -2
- package/tests/describeValidation/testMonthViewValidation.js +1 -1
- package/tests/describeValidation/testTextFieldValidation.js +1 -1
- package/tests/describeValidation/testYearViewValidation.js +1 -1
- package/tests/describeValue/describeValue.js +1 -1
- package/tests/describeValue/testControlledUnControlled.js +2 -2
- package/tests/describeValue/testPickerActionBar.js +1 -2
- package/tests/describeValue/testPickerOpenCloseLifeCycle.js +1 -1
- package/tests/describeValue/testShortcuts.js +1 -1
|
@@ -3,7 +3,7 @@ var _excluded = ["componentFamily", "render", "renderWithProps", "values", "empt
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { expect } from 'chai';
|
|
5
5
|
import { spy } from 'sinon';
|
|
6
|
-
import { expectPickerChangeHandlerValue } from 'test/utils/pickers
|
|
6
|
+
import { expectPickerChangeHandlerValue } from 'test/utils/pickers';
|
|
7
7
|
import { userEvent, screen } from '@mui/monorepo/test/utils';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
export var testShortcuts = function testShortcuts(ElementToTest, options) {
|
package/models/adapters.d.ts
CHANGED
|
@@ -171,6 +171,7 @@ export type AdapterOptions<TLocale, TInstance> = {
|
|
|
171
171
|
formats?: Partial<AdapterFormats>;
|
|
172
172
|
locale?: TLocale;
|
|
173
173
|
} & PropertyIfNotNever<'instance', TInstance>;
|
|
174
|
+
export type DateBuilderReturnType<T extends string | null | undefined, TDate> = T extends null ? null : TDate;
|
|
174
175
|
export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
175
176
|
/**
|
|
176
177
|
* A boolean confirming that the adapter used is an MUI adapter.
|
|
@@ -212,7 +213,7 @@ export interface MuiPickersAdapter<TDate, TLocale = any> {
|
|
|
212
213
|
* @param {PickersTimezone} timezone The timezone of the date.
|
|
213
214
|
* @returns {TDate | null} The parsed date.
|
|
214
215
|
*/
|
|
215
|
-
dateWithTimezone
|
|
216
|
+
dateWithTimezone<T extends string | null | undefined>(value: T, timezone: PickersTimezone): DateBuilderReturnType<T, TDate>;
|
|
216
217
|
/**
|
|
217
218
|
* Extracts the timezone from a date.
|
|
218
219
|
* @template TDate
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PickersShortcutsItemContext } from '../PickersShortcuts';
|
|
2
|
+
export interface PickerChangeHandlerContext<TError> {
|
|
3
|
+
validationError: TError;
|
|
4
|
+
/**
|
|
5
|
+
* Shortcut causing this `onChange` call.
|
|
6
|
+
* If the call has not been caused by a shortcut selection, this property will be `undefined`.
|
|
7
|
+
*/
|
|
8
|
+
shortcut?: PickersShortcutsItemContext;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -484,8 +484,8 @@ process.env.NODE_ENV !== "production" ? DateCalendar.propTypes = {
|
|
|
484
484
|
*/
|
|
485
485
|
readOnly: PropTypes.bool,
|
|
486
486
|
/**
|
|
487
|
-
*
|
|
488
|
-
* @default
|
|
487
|
+
* If `true`, disable heavy animations.
|
|
488
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
489
489
|
*/
|
|
490
490
|
reduceAnimations: PropTypes.bool,
|
|
491
491
|
/**
|
|
@@ -241,8 +241,8 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
241
241
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
242
242
|
readOnly: PropTypes.bool,
|
|
243
243
|
/**
|
|
244
|
-
*
|
|
245
|
-
* @default
|
|
244
|
+
* If `true`, disable heavy animations.
|
|
245
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
246
246
|
*/
|
|
247
247
|
reduceAnimations: PropTypes.bool,
|
|
248
248
|
/**
|
|
@@ -279,8 +279,8 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
|
|
|
279
279
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
280
280
|
readOnly: PropTypes.bool,
|
|
281
281
|
/**
|
|
282
|
-
*
|
|
283
|
-
* @default
|
|
282
|
+
* If `true`, disable heavy animations.
|
|
283
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
284
284
|
*/
|
|
285
285
|
reduceAnimations: PropTypes.bool,
|
|
286
286
|
/**
|
|
@@ -255,8 +255,8 @@ DesktopDatePicker.propTypes = {
|
|
|
255
255
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
256
256
|
readOnly: PropTypes.bool,
|
|
257
257
|
/**
|
|
258
|
-
*
|
|
259
|
-
* @default
|
|
258
|
+
* If `true`, disable heavy animations.
|
|
259
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
260
260
|
*/
|
|
261
261
|
reduceAnimations: PropTypes.bool,
|
|
262
262
|
/**
|
|
@@ -329,8 +329,8 @@ DesktopDateTimePicker.propTypes = {
|
|
|
329
329
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
330
330
|
readOnly: PropTypes.bool,
|
|
331
331
|
/**
|
|
332
|
-
*
|
|
333
|
-
* @default
|
|
332
|
+
* If `true`, disable heavy animations.
|
|
333
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
334
334
|
*/
|
|
335
335
|
reduceAnimations: PropTypes.bool,
|
|
336
336
|
/**
|
|
@@ -250,6 +250,11 @@ DesktopTimePicker.propTypes = {
|
|
|
250
250
|
*/
|
|
251
251
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
252
252
|
readOnly: PropTypes.bool,
|
|
253
|
+
/**
|
|
254
|
+
* If `true`, disable heavy animations.
|
|
255
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
256
|
+
*/
|
|
257
|
+
reduceAnimations: PropTypes.bool,
|
|
253
258
|
/**
|
|
254
259
|
* The currently selected sections.
|
|
255
260
|
* This prop accept four formats:
|
|
@@ -41,7 +41,9 @@ const DigitalClockRoot = styled(PickerViewRoot, {
|
|
|
41
41
|
}) => ({
|
|
42
42
|
overflowY: 'auto',
|
|
43
43
|
width: '100%',
|
|
44
|
-
|
|
44
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
45
|
+
scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
|
|
46
|
+
},
|
|
45
47
|
maxHeight: DIGITAL_CLOCK_VIEW_HEIGHT
|
|
46
48
|
}));
|
|
47
49
|
const DigitalClockList = styled(MenuList, {
|
|
@@ -252,8 +252,8 @@ MobileDatePicker.propTypes = {
|
|
|
252
252
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
253
253
|
readOnly: PropTypes.bool,
|
|
254
254
|
/**
|
|
255
|
-
*
|
|
256
|
-
* @default
|
|
255
|
+
* If `true`, disable heavy animations.
|
|
256
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
257
257
|
*/
|
|
258
258
|
reduceAnimations: PropTypes.bool,
|
|
259
259
|
/**
|
|
@@ -301,8 +301,8 @@ MobileDateTimePicker.propTypes = {
|
|
|
301
301
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
302
302
|
readOnly: PropTypes.bool,
|
|
303
303
|
/**
|
|
304
|
-
*
|
|
305
|
-
* @default
|
|
304
|
+
* If `true`, disable heavy animations.
|
|
305
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
306
306
|
*/
|
|
307
307
|
reduceAnimations: PropTypes.bool,
|
|
308
308
|
/**
|
|
@@ -228,6 +228,11 @@ MobileTimePicker.propTypes = {
|
|
|
228
228
|
*/
|
|
229
229
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
230
230
|
readOnly: PropTypes.bool,
|
|
231
|
+
/**
|
|
232
|
+
* If `true`, disable heavy animations.
|
|
233
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
234
|
+
*/
|
|
235
|
+
reduceAnimations: PropTypes.bool,
|
|
231
236
|
/**
|
|
232
237
|
* The currently selected sections.
|
|
233
238
|
* This prop accept four formats:
|
|
@@ -33,7 +33,9 @@ const MultiSectionDigitalClockSectionRoot = styled(MenuList, {
|
|
|
33
33
|
width: 56,
|
|
34
34
|
padding: 0,
|
|
35
35
|
overflow: 'hidden',
|
|
36
|
-
|
|
36
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
37
|
+
scrollBehavior: ownerState.alreadyRendered ? 'smooth' : 'auto'
|
|
38
|
+
},
|
|
37
39
|
'&:hover': {
|
|
38
40
|
overflowY: 'auto'
|
|
39
41
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"]
|
|
3
|
+
const _excluded = ["items", "changeImportance", "isLandscape", "onChange", "isValid"],
|
|
4
|
+
_excluded2 = ["getValue"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
7
|
import List from '@mui/material/List';
|
|
@@ -19,14 +20,18 @@ function PickersShortcuts(props) {
|
|
|
19
20
|
if (items == null || items.length === 0) {
|
|
20
21
|
return null;
|
|
21
22
|
}
|
|
22
|
-
const resolvedItems = items.map(
|
|
23
|
-
|
|
23
|
+
const resolvedItems = items.map(_ref => {
|
|
24
|
+
let {
|
|
25
|
+
getValue
|
|
26
|
+
} = _ref,
|
|
27
|
+
item = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
28
|
+
const newValue = getValue({
|
|
24
29
|
isValid
|
|
25
30
|
});
|
|
26
31
|
return {
|
|
27
32
|
label: item.label,
|
|
28
33
|
onClick: () => {
|
|
29
|
-
onChange(newValue, changeImportance);
|
|
34
|
+
onChange(newValue, changeImportance, item);
|
|
30
35
|
},
|
|
31
36
|
disabled: !isValid(newValue)
|
|
32
37
|
};
|
|
@@ -200,8 +200,8 @@ StaticDatePicker.propTypes = {
|
|
|
200
200
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
201
201
|
readOnly: PropTypes.bool,
|
|
202
202
|
/**
|
|
203
|
-
*
|
|
204
|
-
* @default
|
|
203
|
+
* If `true`, disable heavy animations.
|
|
204
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
205
205
|
*/
|
|
206
206
|
reduceAnimations: PropTypes.bool,
|
|
207
207
|
/**
|
|
@@ -248,8 +248,8 @@ StaticDateTimePicker.propTypes = {
|
|
|
248
248
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
249
249
|
readOnly: PropTypes.bool,
|
|
250
250
|
/**
|
|
251
|
-
*
|
|
252
|
-
* @default
|
|
251
|
+
* If `true`, disable heavy animations.
|
|
252
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
253
253
|
*/
|
|
254
254
|
reduceAnimations: PropTypes.bool,
|
|
255
255
|
/**
|
|
@@ -174,6 +174,11 @@ StaticTimePicker.propTypes = {
|
|
|
174
174
|
*/
|
|
175
175
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
176
176
|
readOnly: PropTypes.bool,
|
|
177
|
+
/**
|
|
178
|
+
* If `true`, disable heavy animations.
|
|
179
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
180
|
+
*/
|
|
181
|
+
reduceAnimations: PropTypes.bool,
|
|
177
182
|
/**
|
|
178
183
|
* Disable specific clock time.
|
|
179
184
|
* @param {number} clockValue The value to check.
|
|
@@ -213,6 +213,11 @@ process.env.NODE_ENV !== "production" ? TimePicker.propTypes = {
|
|
|
213
213
|
*/
|
|
214
214
|
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
215
215
|
readOnly: PropTypes.bool,
|
|
216
|
+
/**
|
|
217
|
+
* If `true`, disable heavy animations.
|
|
218
|
+
* @default `@media(prefers-reduced-motion: reduce)` || `navigator.userAgent` matches Android <10 or iOS <13
|
|
219
|
+
*/
|
|
220
|
+
reduceAnimations: PropTypes.bool,
|
|
216
221
|
/**
|
|
217
222
|
* The currently selected sections.
|
|
218
223
|
* This prop accept four formats:
|
|
@@ -51,7 +51,10 @@ const YearCalendarRoot = styled('div', {
|
|
|
51
51
|
height: '100%',
|
|
52
52
|
padding: '0 4px',
|
|
53
53
|
width: 320,
|
|
54
|
-
maxHeight: 304
|
|
54
|
+
maxHeight: 304,
|
|
55
|
+
// avoid padding increasing width over defined
|
|
56
|
+
boxSizing: 'border-box',
|
|
57
|
+
position: 'relative'
|
|
55
58
|
});
|
|
56
59
|
export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(inProps, ref) {
|
|
57
60
|
const props = useYearCalendarDefaultizedProps(inProps, 'MuiYearCalendar');
|
package/modern/index.js
CHANGED
|
@@ -86,21 +86,20 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
86
86
|
goTo: onGoToPrevious,
|
|
87
87
|
label: previousLabel
|
|
88
88
|
};
|
|
89
|
-
const [leftProps, rightProps] = isRTL ? [nextProps, previousProps] : [previousProps, nextProps];
|
|
90
89
|
const PreviousIconButton = slots?.previousIconButton ?? PickersArrowSwitcherButton;
|
|
91
90
|
const previousIconButtonProps = useSlotProps({
|
|
92
91
|
elementType: PreviousIconButton,
|
|
93
92
|
externalSlotProps: slotProps?.previousIconButton,
|
|
94
93
|
additionalProps: {
|
|
95
94
|
size: 'medium',
|
|
96
|
-
title:
|
|
97
|
-
'aria-label':
|
|
98
|
-
disabled:
|
|
95
|
+
title: previousProps.label,
|
|
96
|
+
'aria-label': previousProps.label,
|
|
97
|
+
disabled: previousProps.isDisabled,
|
|
99
98
|
edge: 'end',
|
|
100
|
-
onClick:
|
|
99
|
+
onClick: previousProps.goTo
|
|
101
100
|
},
|
|
102
101
|
ownerState: _extends({}, ownerState, {
|
|
103
|
-
hidden:
|
|
102
|
+
hidden: previousProps.isHidden
|
|
104
103
|
}),
|
|
105
104
|
className: classes.button
|
|
106
105
|
});
|
|
@@ -110,14 +109,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
110
109
|
externalSlotProps: slotProps?.nextIconButton,
|
|
111
110
|
additionalProps: {
|
|
112
111
|
size: 'medium',
|
|
113
|
-
title:
|
|
114
|
-
'aria-label':
|
|
115
|
-
disabled:
|
|
112
|
+
title: nextProps.label,
|
|
113
|
+
'aria-label': nextProps.label,
|
|
114
|
+
disabled: nextProps.isDisabled,
|
|
116
115
|
edge: 'start',
|
|
117
|
-
onClick:
|
|
116
|
+
onClick: nextProps.goTo
|
|
118
117
|
},
|
|
119
118
|
ownerState: _extends({}, ownerState, {
|
|
120
|
-
hidden:
|
|
119
|
+
hidden: nextProps.isHidden
|
|
121
120
|
}),
|
|
122
121
|
className: classes.button
|
|
123
122
|
});
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
1
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["PaperComponent", "popperPlacement", "ownerState", "children", "paperSlotProps", "paperClasses", "onPaperClick", "onPaperTouchStart"];
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import { useSlotProps } from '@mui/base/utils';
|
|
4
6
|
import Grow from '@mui/material/Grow';
|
|
7
|
+
import Fade from '@mui/material/Fade';
|
|
5
8
|
import MuiPaper from '@mui/material/Paper';
|
|
6
9
|
import MuiPopper from '@mui/material/Popper';
|
|
7
10
|
import MuiTrapFocus from '@mui/material/Unstable_TrapFocus';
|
|
@@ -9,6 +12,7 @@ import { unstable_useForkRef as useForkRef, unstable_useEventCallback as useEven
|
|
|
9
12
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
10
13
|
import { getPickersPopperUtilityClass } from './pickersPopperClasses';
|
|
11
14
|
import { getActiveElement } from '../utils/utils';
|
|
15
|
+
import { useDefaultReduceAnimations } from '../hooks/useDefaultReduceAnimations';
|
|
12
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
17
|
const useUtilityClasses = ownerState => {
|
|
14
18
|
const {
|
|
@@ -36,9 +40,9 @@ const PickersPopperPaper = styled(MuiPaper, {
|
|
|
36
40
|
})(({
|
|
37
41
|
ownerState
|
|
38
42
|
}) => _extends({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}, ownerState.placement
|
|
43
|
+
outline: 0,
|
|
44
|
+
transformOrigin: 'top center'
|
|
45
|
+
}, ownerState.placement.includes('top') && {
|
|
42
46
|
transformOrigin: 'bottom center'
|
|
43
47
|
}));
|
|
44
48
|
function clickedRootScrollbar(event, doc) {
|
|
@@ -156,6 +160,47 @@ function useClickAwayListener(active, onClickAway) {
|
|
|
156
160
|
}, [active, handleClickAway]);
|
|
157
161
|
return [nodeRef, handleSynthetic, handleSynthetic];
|
|
158
162
|
}
|
|
163
|
+
const PickersPopperPaperWrapper = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
164
|
+
const {
|
|
165
|
+
PaperComponent,
|
|
166
|
+
popperPlacement,
|
|
167
|
+
ownerState: inOwnerState,
|
|
168
|
+
children,
|
|
169
|
+
paperSlotProps,
|
|
170
|
+
paperClasses,
|
|
171
|
+
onPaperClick,
|
|
172
|
+
onPaperTouchStart
|
|
173
|
+
// picks up the style props provided by `Transition`
|
|
174
|
+
// https://mui.com/material-ui/transitions/#child-requirement
|
|
175
|
+
} = props,
|
|
176
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
177
|
+
const ownerState = _extends({}, inOwnerState, {
|
|
178
|
+
placement: popperPlacement
|
|
179
|
+
});
|
|
180
|
+
const paperProps = useSlotProps({
|
|
181
|
+
elementType: PaperComponent,
|
|
182
|
+
externalSlotProps: paperSlotProps,
|
|
183
|
+
additionalProps: {
|
|
184
|
+
tabIndex: -1,
|
|
185
|
+
elevation: 8,
|
|
186
|
+
ref
|
|
187
|
+
},
|
|
188
|
+
className: paperClasses,
|
|
189
|
+
ownerState
|
|
190
|
+
});
|
|
191
|
+
return /*#__PURE__*/_jsx(PaperComponent, _extends({}, other, paperProps, {
|
|
192
|
+
onClick: event => {
|
|
193
|
+
onPaperClick(event);
|
|
194
|
+
paperProps.onClick?.(event);
|
|
195
|
+
},
|
|
196
|
+
onTouchStart: event => {
|
|
197
|
+
onPaperTouchStart(event);
|
|
198
|
+
paperProps.onTouchStart?.(event);
|
|
199
|
+
},
|
|
200
|
+
ownerState: ownerState,
|
|
201
|
+
children: children
|
|
202
|
+
}));
|
|
203
|
+
});
|
|
159
204
|
export function PickersPopper(inProps) {
|
|
160
205
|
const props = useThemeProps({
|
|
161
206
|
props: inProps,
|
|
@@ -172,7 +217,8 @@ export function PickersPopper(inProps) {
|
|
|
172
217
|
role,
|
|
173
218
|
placement,
|
|
174
219
|
slots,
|
|
175
|
-
slotProps
|
|
220
|
+
slotProps,
|
|
221
|
+
reduceAnimations: inReduceAnimations
|
|
176
222
|
} = props;
|
|
177
223
|
React.useEffect(() => {
|
|
178
224
|
function handleKeyDown(nativeEvent) {
|
|
@@ -209,6 +255,8 @@ export function PickersPopper(inProps) {
|
|
|
209
255
|
const handlePaperRef = useForkRef(handleRef, clickAwayRef);
|
|
210
256
|
const ownerState = props;
|
|
211
257
|
const classes = useUtilityClasses(ownerState);
|
|
258
|
+
const defaultReduceAnimations = useDefaultReduceAnimations();
|
|
259
|
+
const reduceAnimations = inReduceAnimations ?? defaultReduceAnimations;
|
|
212
260
|
const handleKeyDown = event => {
|
|
213
261
|
if (event.key === 'Escape') {
|
|
214
262
|
// stop the propagation to avoid closing parent modal
|
|
@@ -216,21 +264,9 @@ export function PickersPopper(inProps) {
|
|
|
216
264
|
onDismiss();
|
|
217
265
|
}
|
|
218
266
|
};
|
|
219
|
-
const Transition = slots?.desktopTransition ?? Grow;
|
|
267
|
+
const Transition = slots?.desktopTransition ?? reduceAnimations ? Fade : Grow;
|
|
220
268
|
const TrapFocus = slots?.desktopTrapFocus ?? MuiTrapFocus;
|
|
221
269
|
const Paper = slots?.desktopPaper ?? PickersPopperPaper;
|
|
222
|
-
const paperProps = useSlotProps({
|
|
223
|
-
elementType: Paper,
|
|
224
|
-
externalSlotProps: slotProps?.desktopPaper,
|
|
225
|
-
additionalProps: {
|
|
226
|
-
tabIndex: -1,
|
|
227
|
-
elevation: 8,
|
|
228
|
-
ref: handlePaperRef
|
|
229
|
-
},
|
|
230
|
-
className: classes.paper,
|
|
231
|
-
ownerState: {} // Is overridden below to use `placement
|
|
232
|
-
});
|
|
233
|
-
|
|
234
270
|
const Popper = slots?.popper ?? PickersPopperRoot;
|
|
235
271
|
const popperProps = useSlotProps({
|
|
236
272
|
elementType: Popper,
|
|
@@ -262,20 +298,17 @@ export function PickersPopper(inProps) {
|
|
|
262
298
|
isEnabled: () => true
|
|
263
299
|
}, slotProps?.desktopTrapFocus, {
|
|
264
300
|
children: /*#__PURE__*/_jsx(Transition, _extends({}, TransitionProps, slotProps?.desktopTransition, {
|
|
265
|
-
children: /*#__PURE__*/_jsx(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
ownerState: _extends({}, ownerState, {
|
|
275
|
-
placement: popperPlacement
|
|
276
|
-
}),
|
|
301
|
+
children: /*#__PURE__*/_jsx(PickersPopperPaperWrapper, {
|
|
302
|
+
PaperComponent: Paper,
|
|
303
|
+
ownerState: ownerState,
|
|
304
|
+
popperPlacement: popperPlacement,
|
|
305
|
+
ref: handlePaperRef,
|
|
306
|
+
onPaperClick: onPaperClick,
|
|
307
|
+
onPaperTouchStart: onPaperTouchStart,
|
|
308
|
+
paperClasses: classes.paper,
|
|
309
|
+
paperSlotProps: slotProps?.desktopPaper,
|
|
277
310
|
children: children
|
|
278
|
-
})
|
|
311
|
+
})
|
|
279
312
|
}))
|
|
280
313
|
}))
|
|
281
314
|
}));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
|
-
import Grid from '@mui/material/Grid';
|
|
5
4
|
import Typography from '@mui/material/Typography';
|
|
6
5
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
7
6
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -40,16 +39,20 @@ const PickersToolbarRoot = styled('div', {
|
|
|
40
39
|
justifyContent: 'flex-start',
|
|
41
40
|
flexWrap: 'wrap'
|
|
42
41
|
}));
|
|
43
|
-
const PickersToolbarContent = styled(
|
|
42
|
+
const PickersToolbarContent = styled('div', {
|
|
44
43
|
name: 'MuiPickersToolbar',
|
|
45
44
|
slot: 'Content',
|
|
46
45
|
overridesResolver: (props, styles) => styles.content
|
|
47
46
|
})(({
|
|
48
47
|
ownerState
|
|
49
|
-
}) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
}) => ({
|
|
49
|
+
display: 'flex',
|
|
50
|
+
flexWrap: 'wrap',
|
|
51
|
+
width: '100%',
|
|
52
|
+
justifyContent: ownerState.isLandscape ? 'flex-start' : 'space-between',
|
|
53
|
+
flexDirection: ownerState.isLandscape ? ownerState.landscapeDirection ?? 'column' : 'row',
|
|
54
|
+
flex: 1,
|
|
55
|
+
alignItems: ownerState.isLandscape ? 'flex-start' : 'center'
|
|
53
56
|
}));
|
|
54
57
|
export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersToolbar(inProps, ref) {
|
|
55
58
|
const props = useThemeProps({
|
|
@@ -59,8 +62,6 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
|
|
|
59
62
|
const {
|
|
60
63
|
children,
|
|
61
64
|
className,
|
|
62
|
-
isLandscape,
|
|
63
|
-
landscapeDirection = 'column',
|
|
64
65
|
toolbarTitle,
|
|
65
66
|
hidden,
|
|
66
67
|
titleId
|
|
@@ -80,12 +81,8 @@ export const PickersToolbar = /*#__PURE__*/React.forwardRef(function PickersTool
|
|
|
80
81
|
id: titleId,
|
|
81
82
|
children: toolbarTitle
|
|
82
83
|
}), /*#__PURE__*/_jsx(PickersToolbarContent, {
|
|
83
|
-
container: true,
|
|
84
|
-
justifyContent: isLandscape ? 'flex-start' : 'space-between',
|
|
85
84
|
className: classes.content,
|
|
86
85
|
ownerState: ownerState,
|
|
87
|
-
direction: isLandscape ? landscapeDirection : 'row',
|
|
88
|
-
alignItems: isLandscape ? 'flex-start' : 'flex-end',
|
|
89
86
|
children: children
|
|
90
87
|
})]
|
|
91
88
|
});
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
2
2
|
const PREFERS_REDUCED_MOTION = '@media (prefers-reduced-motion: reduce)';
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// detect if user agent has Android version < 10 or iOS version < 13
|
|
5
|
+
const mobileVersionMatches = typeof navigator !== 'undefined' && navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i);
|
|
6
|
+
const androidVersion = mobileVersionMatches && mobileVersionMatches[1] ? parseInt(mobileVersionMatches[1], 10) : null;
|
|
7
|
+
const iOSVersion = mobileVersionMatches && mobileVersionMatches[2] ? parseInt(mobileVersionMatches[2], 10) : null;
|
|
8
|
+
export const slowAnimationDevices = androidVersion && androidVersion < 10 || iOSVersion && iOSVersion < 13 || false;
|
|
4
9
|
export const useDefaultReduceAnimations = () => {
|
|
5
10
|
const prefersReduced = useMediaQuery(PREFERS_REDUCED_MOTION, {
|
|
6
11
|
defaultMatches: false
|
|
7
12
|
});
|
|
8
|
-
return prefersReduced ||
|
|
13
|
+
return prefersReduced || slowAnimationDevices;
|
|
9
14
|
};
|
|
@@ -41,7 +41,8 @@ export const useDesktopPicker = _ref => {
|
|
|
41
41
|
readOnly,
|
|
42
42
|
disabled,
|
|
43
43
|
autoFocus,
|
|
44
|
-
localeText
|
|
44
|
+
localeText,
|
|
45
|
+
reduceAnimations
|
|
45
46
|
} = props;
|
|
46
47
|
const utils = useUtils();
|
|
47
48
|
const internalInputRef = React.useRef(null);
|
|
@@ -79,7 +80,7 @@ export const useDesktopPicker = _ref => {
|
|
|
79
80
|
externalSlotProps: innerSlotProps?.openPickerButton,
|
|
80
81
|
additionalProps: {
|
|
81
82
|
disabled: disabled || readOnly,
|
|
82
|
-
onClick: actions.onOpen,
|
|
83
|
+
onClick: open ? actions.onClose : actions.onOpen,
|
|
83
84
|
'aria-label': getOpenDialogAriaText(pickerFieldProps.value, utils),
|
|
84
85
|
edge: inputAdornmentProps.position
|
|
85
86
|
},
|
|
@@ -155,6 +156,7 @@ export const useDesktopPicker = _ref => {
|
|
|
155
156
|
slots: slots,
|
|
156
157
|
slotProps: slotProps,
|
|
157
158
|
shouldRestoreFocus: shouldRestoreFocus,
|
|
159
|
+
reduceAnimations: reduceAnimations,
|
|
158
160
|
children: /*#__PURE__*/_jsx(Layout, _extends({}, layoutProps, slotProps?.layout, {
|
|
159
161
|
slots: slots,
|
|
160
162
|
slotProps: slotProps,
|
|
@@ -645,54 +645,6 @@ export const mergeDateIntoReferenceDate = (utils, timezone, dateToTransferFrom,
|
|
|
645
645
|
return mergedDate;
|
|
646
646
|
}, referenceDate);
|
|
647
647
|
export const isAndroid = () => navigator.userAgent.toLowerCase().indexOf('android') > -1;
|
|
648
|
-
export const clampDaySectionIfPossible = (utils, timezone, sections, sectionsValueBoundaries) => {
|
|
649
|
-
// We can only clamp the day value if:
|
|
650
|
-
// 1. if all the sections are filled (except the week day section which can be empty)
|
|
651
|
-
// 2. there is a day section
|
|
652
|
-
const canClamp = sections.every(section => section.type === 'weekDay' || section.value !== '') && sections.some(section => section.type === 'day');
|
|
653
|
-
if (!canClamp) {
|
|
654
|
-
return null;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// We try to generate a valid date representing the start of the month of the invalid date typed by the user.
|
|
658
|
-
const sectionsForStartOfMonth = sections.map(section => {
|
|
659
|
-
if (section.type !== 'day') {
|
|
660
|
-
return section;
|
|
661
|
-
}
|
|
662
|
-
const dayBoundaries = sectionsValueBoundaries.day({
|
|
663
|
-
currentDate: null,
|
|
664
|
-
format: section.format,
|
|
665
|
-
contentType: section.contentType
|
|
666
|
-
});
|
|
667
|
-
return _extends({}, section, {
|
|
668
|
-
value: cleanDigitSectionValue(utils, timezone, dayBoundaries.minimum, dayBoundaries, section)
|
|
669
|
-
});
|
|
670
|
-
});
|
|
671
|
-
const startOfMonth = getDateFromDateSections(utils, sectionsForStartOfMonth);
|
|
672
|
-
|
|
673
|
-
// Even the start of the month is invalid, we probably have other invalid sections, the clamping failed.
|
|
674
|
-
if (startOfMonth == null || !utils.isValid(startOfMonth)) {
|
|
675
|
-
return null;
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// The only invalid section was the day of the month, we replace its value with the maximum boundary for the correct month.
|
|
679
|
-
return sections.map(section => {
|
|
680
|
-
if (section.type !== 'day') {
|
|
681
|
-
return section;
|
|
682
|
-
}
|
|
683
|
-
const dayBoundaries = sectionsValueBoundaries.day({
|
|
684
|
-
currentDate: startOfMonth,
|
|
685
|
-
format: section.format,
|
|
686
|
-
contentType: section.contentType
|
|
687
|
-
});
|
|
688
|
-
if (Number(section.value) <= dayBoundaries.maximum) {
|
|
689
|
-
return section;
|
|
690
|
-
}
|
|
691
|
-
return _extends({}, section, {
|
|
692
|
-
value: dayBoundaries.maximum.toString()
|
|
693
|
-
});
|
|
694
|
-
});
|
|
695
|
-
};
|
|
696
648
|
export const getSectionOrder = (sections, isRTL) => {
|
|
697
649
|
const neighbors = {};
|
|
698
650
|
if (!isRTL) {
|