@mui/x-date-pickers 6.10.1 → 6.11.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 +8 -1
- package/AdapterDayjs/AdapterDayjs.js +66 -38
- package/CHANGELOG.md +156 -0
- package/DateCalendar/DateCalendar.d.ts +1 -1
- package/DateCalendar/DateCalendar.js +48 -38
- package/DateCalendar/DateCalendar.types.d.ts +9 -1
- package/DateCalendar/index.d.ts +1 -2
- package/DateCalendar/index.js +3 -2
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DateField/DateField.d.ts +1 -1
- package/DateField/DateField.js +2 -2
- package/DatePicker/DatePicker.d.ts +1 -1
- package/DatePicker/DatePickerToolbar.d.ts +1 -1
- package/DateTimeField/DateTimeField.d.ts +1 -1
- package/DateTimeField/DateTimeField.js +2 -2
- package/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/DayCalendarSkeleton/DayCalendarSkeleton.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.d.ts +1 -1
- package/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/DesktopTimePicker/DesktopTimePicker.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +2 -2
- package/DigitalClock/DigitalClock.d.ts +1 -1
- package/DigitalClock/DigitalClock.js +1 -1
- package/LocalizationProvider/LocalizationProvider.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +2 -2
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/MobileTimePicker/MobileTimePicker.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +2 -2
- package/MonthCalendar/MonthCalendar.d.ts +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.d.ts +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +1 -1
- package/{DateCalendar → PickersCalendarHeader}/PickersCalendarHeader.d.ts +21 -9
- package/{DateCalendar → PickersCalendarHeader}/PickersCalendarHeader.js +72 -28
- package/PickersCalendarHeader/index.d.ts +4 -0
- package/PickersCalendarHeader/index.js +2 -0
- package/PickersCalendarHeader/package.json +6 -0
- package/PickersDay/PickersDay.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.d.ts +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +1 -1
- package/StaticTimePicker/StaticTimePicker.d.ts +1 -1
- package/TimeClock/ClockNumbers.d.ts +1 -1
- package/TimeClock/TimeClock.d.ts +1 -1
- package/TimeField/TimeField.d.ts +1 -1
- package/TimeField/TimeField.js +2 -2
- package/TimePicker/TimePicker.d.ts +1 -1
- package/YearCalendar/YearCalendar.d.ts +2 -2
- package/index.js +1 -1
- package/internals/components/PickersModalDialog.d.ts +2 -2
- package/internals/components/PickersPopper.d.ts +3 -3
- package/internals/components/PickersToolbar.d.ts +1 -1
- package/internals/hooks/date-helpers-hooks.d.ts +1 -2
- package/internals/hooks/useDefaultReduceAnimations.d.ts +2 -0
- package/internals/hooks/useDefaultReduceAnimations.js +9 -0
- package/internals/hooks/useField/useField.js +9 -4
- package/internals/hooks/useField/useField.utils.d.ts +1 -1
- package/internals/hooks/useField/useField.utils.js +6 -5
- package/internals/index.d.ts +1 -3
- package/internals/index.js +1 -2
- package/internals/utils/valueManagers.js +1 -1
- package/legacy/AdapterDayjs/AdapterDayjs.js +64 -38
- package/legacy/DateCalendar/DateCalendar.js +50 -40
- package/legacy/DateCalendar/index.js +3 -2
- package/legacy/DateField/DateField.js +2 -2
- package/legacy/DateTimeField/DateTimeField.js +2 -2
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +2 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +2 -2
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +2 -2
- package/legacy/DigitalClock/DigitalClock.js +1 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +2 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +2 -2
- package/legacy/MobileTimePicker/MobileTimePicker.js +2 -2
- package/legacy/{DateCalendar → PickersCalendarHeader}/PickersCalendarHeader.js +57 -13
- package/legacy/PickersCalendarHeader/index.js +2 -0
- package/legacy/TimeField/TimeField.js +2 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/hooks/useDefaultReduceAnimations.js +9 -0
- package/legacy/internals/hooks/useField/useField.js +9 -4
- package/legacy/internals/hooks/useField/useField.utils.js +6 -5
- package/legacy/internals/index.js +1 -2
- package/legacy/internals/utils/valueManagers.js +1 -1
- package/legacy/tests/describeGregorianAdapter/testCalculations.js +63 -16
- package/modern/AdapterDayjs/AdapterDayjs.js +65 -38
- package/modern/DateCalendar/DateCalendar.js +46 -38
- package/modern/DateCalendar/index.js +3 -2
- package/modern/DateField/DateField.js +2 -2
- package/modern/DateTimeField/DateTimeField.js +2 -2
- package/modern/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -1
- package/modern/DigitalClock/DigitalClock.js +1 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +1 -1
- package/modern/{DateCalendar → PickersCalendarHeader}/PickersCalendarHeader.js +72 -28
- package/modern/PickersCalendarHeader/index.js +2 -0
- package/modern/TimeField/TimeField.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDefaultReduceAnimations.js +9 -0
- package/modern/internals/hooks/useField/useField.js +9 -4
- package/modern/internals/hooks/useField/useField.utils.js +6 -5
- package/modern/internals/index.js +1 -2
- package/modern/internals/utils/valueManagers.js +1 -1
- package/modern/tests/describeGregorianAdapter/testCalculations.js +63 -16
- package/node/AdapterDayjs/AdapterDayjs.js +65 -38
- package/node/DateCalendar/DateCalendar.js +52 -44
- package/node/DateCalendar/index.js +21 -8
- package/node/DateField/DateField.js +2 -2
- package/node/DateTimeField/DateTimeField.js +2 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -1
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -1
- package/node/DesktopTimePicker/DesktopTimePicker.js +1 -1
- package/node/DigitalClock/DigitalClock.js +1 -1
- package/node/MobileDatePicker/MobileDatePicker.js +1 -1
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +1 -1
- package/node/MobileTimePicker/MobileTimePicker.js +1 -1
- package/node/{DateCalendar → PickersCalendarHeader}/PickersCalendarHeader.js +73 -29
- package/node/PickersCalendarHeader/index.js +19 -0
- package/node/TimeField/TimeField.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/hooks/useDefaultReduceAnimations.js +18 -0
- package/node/internals/hooks/useField/useField.js +9 -4
- package/node/internals/hooks/useField/useField.utils.js +6 -5
- package/node/internals/index.js +7 -14
- package/node/internals/utils/valueManagers.js +1 -1
- package/node/tests/describeGregorianAdapter/testCalculations.js +61 -16
- package/package.json +2 -2
- package/tests/describeGregorianAdapter/testCalculations.js +63 -16
- package/themeAugmentation/props.d.ts +2 -2
- package/internals/utils/defaultReduceAnimations.d.ts +0 -1
- package/internals/utils/defaultReduceAnimations.js +0 -1
- package/legacy/internals/utils/defaultReduceAnimations.js +0 -1
- package/modern/internals/utils/defaultReduceAnimations.js +0 -1
- package/node/internals/utils/defaultReduceAnimations.js +0 -8
- /package/{DateCalendar → PickersCalendarHeader}/pickersCalendarHeaderClasses.d.ts +0 -0
- /package/{DateCalendar → PickersCalendarHeader}/pickersCalendarHeaderClasses.js +0 -0
- /package/legacy/{DateCalendar → PickersCalendarHeader}/pickersCalendarHeaderClasses.js +0 -0
- /package/modern/{DateCalendar → PickersCalendarHeader}/pickersCalendarHeaderClasses.js +0 -0
- /package/node/{DateCalendar → PickersCalendarHeader}/pickersCalendarHeaderClasses.js +0 -0
|
@@ -8,7 +8,7 @@ export interface PickersToolbarProps<TValue, TView extends DateOrTimeViewWithMer
|
|
|
8
8
|
toolbarTitle: React.ReactNode;
|
|
9
9
|
classes?: Partial<PickersToolbarClasses>;
|
|
10
10
|
}
|
|
11
|
-
type PickersToolbarComponent = (<TValue, TView extends DateOrTimeViewWithMeridiem>(props: React.PropsWithChildren<PickersToolbarProps<TValue, TView>> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
|
|
11
|
+
type PickersToolbarComponent = (<TValue, TView extends DateOrTimeViewWithMeridiem>(props: React.PropsWithChildren<PickersToolbarProps<TValue, TView>> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
12
12
|
propTypes?: any;
|
|
13
13
|
};
|
|
14
14
|
export declare const PickersToolbar: PickersToolbarComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PickerOnChangeFn } from './useViews';
|
|
2
2
|
import { PickerSelectionState } from './usePicker';
|
|
3
3
|
import { PickersTimezone } from '../../models';
|
|
4
|
-
interface MonthValidationOptions<TDate> {
|
|
4
|
+
export interface MonthValidationOptions<TDate> {
|
|
5
5
|
disablePast?: boolean;
|
|
6
6
|
disableFuture?: boolean;
|
|
7
7
|
minDate: TDate;
|
|
@@ -14,4 +14,3 @@ export declare function useMeridiemMode<TDate>(date: TDate | null, ampm: boolean
|
|
|
14
14
|
meridiemMode: import("../utils/time-utils").Meridiem | null;
|
|
15
15
|
handleMeridiemChange: (mode: 'am' | 'pm') => void;
|
|
16
16
|
};
|
|
17
|
-
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
2
|
+
const PREFERS_REDUCED_MOTION = '@media (prefers-reduced-motion: reduce)';
|
|
3
|
+
export const defaultReduceAnimations = typeof navigator !== 'undefined' && /(android)/i.test(navigator.userAgent);
|
|
4
|
+
export const useDefaultReduceAnimations = () => {
|
|
5
|
+
const prefersReduced = useMediaQuery(PREFERS_REDUCED_MOTION, {
|
|
6
|
+
defaultMatches: false
|
|
7
|
+
});
|
|
8
|
+
return prefersReduced || defaultReduceAnimations;
|
|
9
|
+
};
|
|
@@ -153,13 +153,18 @@ export const useField = params => {
|
|
|
153
153
|
if (readOnly) {
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
const
|
|
156
|
+
const targetValue = event.target.value;
|
|
157
|
+
const eventData = event.nativeEvent.data;
|
|
158
|
+
// Calling `.fill(04/11/2022)` in playwright will trigger a change event with the requested content to insert in `event.nativeEvent.data`
|
|
159
|
+
// usual changes have only the currently typed character in the `event.nativeEvent.data`
|
|
160
|
+
const shouldUseEventData = eventData && eventData.length > 1;
|
|
161
|
+
const valueStr = shouldUseEventData ? eventData : targetValue;
|
|
157
162
|
const cleanValueStr = cleanString(valueStr);
|
|
158
163
|
|
|
159
|
-
// If no section is selected, we just try to parse the new value
|
|
164
|
+
// If no section is selected or eventData should be used, we just try to parse the new value
|
|
160
165
|
// This line is mostly triggered by imperative code / application tests.
|
|
161
|
-
if (selectedSectionIndexes == null) {
|
|
162
|
-
updateValueFromValueStr(cleanValueStr);
|
|
166
|
+
if (selectedSectionIndexes == null || shouldUseEventData) {
|
|
167
|
+
updateValueFromValueStr(shouldUseEventData ? eventData : cleanValueStr);
|
|
163
168
|
return;
|
|
164
169
|
}
|
|
165
170
|
let keyPressed;
|
|
@@ -8,7 +8,7 @@ export declare const getDaysInWeekStr: <TDate>(utils: MuiPickersAdapter<TDate, a
|
|
|
8
8
|
export declare const getLetterEditingOptions: <TDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, sectionType: FieldSectionType, format: string) => string[];
|
|
9
9
|
export declare const cleanLeadingZeros: <TDate>(utils: MuiPickersAdapter<TDate, any>, valueStr: string, size: number) => string;
|
|
10
10
|
export declare const cleanDigitSectionValue: <TDate>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, value: number, sectionBoundaries: FieldSectionValueBoundaries<TDate, any>, section: Pick<FieldSection, 'format' | 'type' | 'contentType' | 'hasLeadingZerosInFormat' | 'hasLeadingZerosInInput' | 'maxLength'>) => string;
|
|
11
|
-
export declare const adjustSectionValue: <TDate, TSection extends FieldSection>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, section: TSection, keyCode: AvailableAdjustKeyCode, sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>, activeDate: TDate | null,
|
|
11
|
+
export declare const adjustSectionValue: <TDate, TSection extends FieldSection>(utils: MuiPickersAdapter<TDate, any>, timezone: PickersTimezone, section: TSection, keyCode: AvailableAdjustKeyCode, sectionsValueBoundaries: FieldSectionsValueBoundaries<TDate>, activeDate: TDate | null, stepsAttributes?: {
|
|
12
12
|
minutesStep?: number;
|
|
13
13
|
}) => string;
|
|
14
14
|
export declare const getSectionVisibleValue: (section: FieldSectionWithoutPosition, target: 'input-rtl' | 'input-ltr' | 'non-input') => string;
|
|
@@ -96,7 +96,7 @@ export const cleanDigitSectionValue = (utils, timezone, value, sectionBoundaries
|
|
|
96
96
|
}
|
|
97
97
|
return valueStr;
|
|
98
98
|
};
|
|
99
|
-
export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, activeDate,
|
|
99
|
+
export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsValueBoundaries, activeDate, stepsAttributes) => {
|
|
100
100
|
const delta = getDeltaFromKeyCode(keyCode);
|
|
101
101
|
const isStart = keyCode === 'Home';
|
|
102
102
|
const isEnd = keyCode === 'End';
|
|
@@ -108,7 +108,7 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
108
108
|
contentType: section.contentType
|
|
109
109
|
});
|
|
110
110
|
const getCleanValue = value => cleanDigitSectionValue(utils, timezone, value, sectionBoundaries, section);
|
|
111
|
-
const step = section.type === 'minutes' &&
|
|
111
|
+
const step = section.type === 'minutes' && stepsAttributes != null && stepsAttributes.minutesStep ? stepsAttributes.minutesStep : 1;
|
|
112
112
|
const currentSectionValue = parseInt(section.value, 10);
|
|
113
113
|
let newSectionValueNumber = currentSectionValue + delta * step;
|
|
114
114
|
if (shouldSetAbsolute) {
|
|
@@ -470,6 +470,7 @@ export const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
|
470
470
|
export const getSectionsBoundaries = (utils, timezone) => {
|
|
471
471
|
const today = utils.dateWithTimezone(undefined, timezone);
|
|
472
472
|
const endOfYear = utils.endOfYear(today);
|
|
473
|
+
const endOfDay = utils.endOfDay(today);
|
|
473
474
|
const {
|
|
474
475
|
maxDaysInMonth,
|
|
475
476
|
longestMonth
|
|
@@ -524,7 +525,7 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
524
525
|
hours: ({
|
|
525
526
|
format
|
|
526
527
|
}) => {
|
|
527
|
-
const lastHourInDay = utils.getHours(
|
|
528
|
+
const lastHourInDay = utils.getHours(endOfDay);
|
|
528
529
|
const hasMeridiem = utils.formatByString(utils.endOfDay(today), format) !== lastHourInDay.toString();
|
|
529
530
|
if (hasMeridiem) {
|
|
530
531
|
return {
|
|
@@ -540,12 +541,12 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
540
541
|
minutes: () => ({
|
|
541
542
|
minimum: 0,
|
|
542
543
|
// Assumption: All years have the same amount of minutes
|
|
543
|
-
maximum: utils.getMinutes(
|
|
544
|
+
maximum: utils.getMinutes(endOfDay)
|
|
544
545
|
}),
|
|
545
546
|
seconds: () => ({
|
|
546
547
|
minimum: 0,
|
|
547
548
|
// Assumption: All years have the same amount of seconds
|
|
548
|
-
maximum: utils.getSeconds(
|
|
549
|
+
maximum: utils.getSeconds(endOfDay)
|
|
549
550
|
}),
|
|
550
551
|
meridiem: () => ({
|
|
551
552
|
minimum: 0,
|
package/internals/index.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate
|
|
|
47
47
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
48
48
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
49
49
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, } from './utils/utils';
|
|
50
|
-
export {
|
|
50
|
+
export { useDefaultReduceAnimations } from './hooks/useDefaultReduceAnimations';
|
|
51
51
|
export { extractValidationProps } from './utils/validation/extractValidationProps';
|
|
52
52
|
export { validateDate } from './utils/validation/validateDate';
|
|
53
53
|
export { validateDateTime } from './utils/validation/validateDateTime';
|
|
@@ -55,8 +55,6 @@ export { validateTime } from './utils/validation/validateTime';
|
|
|
55
55
|
export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
|
|
56
56
|
export { uncapitalizeObjectKeys } from './utils/slots-migration';
|
|
57
57
|
export type { UncapitalizeObjectKeys, SlotsAndSlotProps } from './utils/slots-migration';
|
|
58
|
-
export { PickersCalendarHeader } from '../DateCalendar/PickersCalendarHeader';
|
|
59
|
-
export type { ExportedCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps, } from '../DateCalendar/PickersCalendarHeader';
|
|
60
58
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
61
59
|
export type { DayCalendarProps, DayCalendarSlotsComponent, DayCalendarSlotsComponentsProps, ExportedDayCalendarProps, } from '../DateCalendar/DayCalendar';
|
|
62
60
|
export type { ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
|
package/internals/index.js
CHANGED
|
@@ -20,13 +20,12 @@ export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate
|
|
|
20
20
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
21
21
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
22
22
|
export { executeInTheNextEventLoopTick, getActiveElement, onSpaceOrEnter, DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './utils/utils';
|
|
23
|
-
export {
|
|
23
|
+
export { useDefaultReduceAnimations } from './hooks/useDefaultReduceAnimations';
|
|
24
24
|
export { extractValidationProps } from './utils/validation/extractValidationProps';
|
|
25
25
|
export { validateDate } from './utils/validation/validateDate';
|
|
26
26
|
export { validateDateTime } from './utils/validation/validateDateTime';
|
|
27
27
|
export { validateTime } from './utils/validation/validateTime';
|
|
28
28
|
export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
|
|
29
29
|
export { uncapitalizeObjectKeys } from './utils/slots-migration';
|
|
30
|
-
export { PickersCalendarHeader } from '../DateCalendar/PickersCalendarHeader';
|
|
31
30
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
32
31
|
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
|
@@ -25,7 +25,7 @@ export const singleItemValueManager = {
|
|
|
25
25
|
isSameError: (a, b) => a === b,
|
|
26
26
|
hasError: error => error != null,
|
|
27
27
|
defaultErrorState: null,
|
|
28
|
-
getTimezone: (utils, value) => value == null ? null : utils.getTimezone(value),
|
|
28
|
+
getTimezone: (utils, value) => value == null || !utils.isValid(value) ? null : utils.getTimezone(value),
|
|
29
29
|
setTimezone: (utils, timezone, value) => value == null ? null : utils.setTimezone(value, timezone)
|
|
30
30
|
};
|
|
31
31
|
export const singleItemFieldValueManager = {
|
|
@@ -197,10 +197,23 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
197
197
|
return value.format(comparisonTemplate) === comparingInValueTimezone.format(comparisonTemplate);
|
|
198
198
|
};
|
|
199
199
|
/**
|
|
200
|
-
*
|
|
200
|
+
* Replaces "default" by undefined and "system" by the system timezone before passing it to `dayjs`.
|
|
201
201
|
*/
|
|
202
202
|
this.cleanTimezone = function (timezone) {
|
|
203
|
-
|
|
203
|
+
switch (timezone) {
|
|
204
|
+
case 'default':
|
|
205
|
+
{
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
case 'system':
|
|
209
|
+
{
|
|
210
|
+
return defaultDayjs.tz.guess();
|
|
211
|
+
}
|
|
212
|
+
default:
|
|
213
|
+
{
|
|
214
|
+
return timezone;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
204
217
|
};
|
|
205
218
|
this.createSystemDate = function (value) {
|
|
206
219
|
// TODO v7: Stop using `this.rawDayJsInstance` (drop the `instance` param on the adapters)
|
|
@@ -250,6 +263,28 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
250
263
|
}
|
|
251
264
|
return localeObject.formats;
|
|
252
265
|
};
|
|
266
|
+
/**
|
|
267
|
+
* If the new day does not have the same offset as the old one (when switching to summer day time for example),
|
|
268
|
+
* Then dayjs will not automatically adjust the offset (moment does).
|
|
269
|
+
* We have to parse again the value to make sure the `fixOffset` method is applied.
|
|
270
|
+
* See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
|
|
271
|
+
*/
|
|
272
|
+
this.adjustOffset = function (value) {
|
|
273
|
+
if (!_this.hasTimezonePlugin()) {
|
|
274
|
+
return value;
|
|
275
|
+
}
|
|
276
|
+
var timezone = _this.getTimezone(value);
|
|
277
|
+
if (timezone !== 'UTC') {
|
|
278
|
+
var _fixedValue$$offset, _value$$offset;
|
|
279
|
+
var fixedValue = value.tz(_this.cleanTimezone(timezone), true);
|
|
280
|
+
// @ts-ignore
|
|
281
|
+
if (((_fixedValue$$offset = fixedValue.$offset) != null ? _fixedValue$$offset : 0) === ((_value$$offset = value.$offset) != null ? _value$$offset : 0)) {
|
|
282
|
+
return value;
|
|
283
|
+
}
|
|
284
|
+
return fixedValue;
|
|
285
|
+
}
|
|
286
|
+
return value;
|
|
287
|
+
};
|
|
253
288
|
this.date = function (value) {
|
|
254
289
|
if (value === null) {
|
|
255
290
|
return null;
|
|
@@ -425,49 +460,49 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
425
460
|
return value >= start && value <= end;
|
|
426
461
|
};
|
|
427
462
|
this.startOfYear = function (value) {
|
|
428
|
-
return value.startOf('year');
|
|
463
|
+
return _this.adjustOffset(value.startOf('year'));
|
|
429
464
|
};
|
|
430
465
|
this.startOfMonth = function (value) {
|
|
431
|
-
return value.startOf('month');
|
|
466
|
+
return _this.adjustOffset(value.startOf('month'));
|
|
432
467
|
};
|
|
433
468
|
this.startOfWeek = function (value) {
|
|
434
|
-
return value.startOf('week');
|
|
469
|
+
return _this.adjustOffset(value.startOf('week'));
|
|
435
470
|
};
|
|
436
471
|
this.startOfDay = function (value) {
|
|
437
|
-
return value.startOf('day');
|
|
472
|
+
return _this.adjustOffset(value.startOf('day'));
|
|
438
473
|
};
|
|
439
474
|
this.endOfYear = function (value) {
|
|
440
|
-
return value.endOf('year');
|
|
475
|
+
return _this.adjustOffset(value.endOf('year'));
|
|
441
476
|
};
|
|
442
477
|
this.endOfMonth = function (value) {
|
|
443
|
-
return value.endOf('month');
|
|
478
|
+
return _this.adjustOffset(value.endOf('month'));
|
|
444
479
|
};
|
|
445
480
|
this.endOfWeek = function (value) {
|
|
446
|
-
return value.endOf('week');
|
|
481
|
+
return _this.adjustOffset(value.endOf('week'));
|
|
447
482
|
};
|
|
448
483
|
this.endOfDay = function (value) {
|
|
449
|
-
return value.endOf('day');
|
|
484
|
+
return _this.adjustOffset(value.endOf('day'));
|
|
450
485
|
};
|
|
451
486
|
this.addYears = function (value, amount) {
|
|
452
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'year') : value.add(amount, 'year');
|
|
487
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'year') : value.add(amount, 'year'));
|
|
453
488
|
};
|
|
454
489
|
this.addMonths = function (value, amount) {
|
|
455
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'month') : value.add(amount, 'month');
|
|
490
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'month') : value.add(amount, 'month'));
|
|
456
491
|
};
|
|
457
492
|
this.addWeeks = function (value, amount) {
|
|
458
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'week') : value.add(amount, 'week');
|
|
493
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'week') : value.add(amount, 'week'));
|
|
459
494
|
};
|
|
460
495
|
this.addDays = function (value, amount) {
|
|
461
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'day') : value.add(amount, 'day');
|
|
496
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'day') : value.add(amount, 'day'));
|
|
462
497
|
};
|
|
463
498
|
this.addHours = function (value, amount) {
|
|
464
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'hour') : value.add(amount, 'hour');
|
|
499
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'hour') : value.add(amount, 'hour'));
|
|
465
500
|
};
|
|
466
501
|
this.addMinutes = function (value, amount) {
|
|
467
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'minute') : value.add(amount, 'minute');
|
|
502
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'minute') : value.add(amount, 'minute'));
|
|
468
503
|
};
|
|
469
504
|
this.addSeconds = function (value, amount) {
|
|
470
|
-
return amount < 0 ? value.subtract(Math.abs(amount), 'second') : value.add(amount, 'second');
|
|
505
|
+
return _this.adjustOffset(amount < 0 ? value.subtract(Math.abs(amount), 'second') : value.add(amount, 'second'));
|
|
471
506
|
};
|
|
472
507
|
this.getYear = function (value) {
|
|
473
508
|
return value.year();
|
|
@@ -491,34 +526,34 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
491
526
|
return value.millisecond();
|
|
492
527
|
};
|
|
493
528
|
this.setYear = function (value, year) {
|
|
494
|
-
return value.set('year', year);
|
|
529
|
+
return _this.adjustOffset(value.set('year', year));
|
|
495
530
|
};
|
|
496
531
|
this.setMonth = function (value, month) {
|
|
497
|
-
return value.set('month', month);
|
|
532
|
+
return _this.adjustOffset(value.set('month', month));
|
|
498
533
|
};
|
|
499
534
|
this.setDate = function (value, date) {
|
|
500
|
-
return value.set('date', date);
|
|
535
|
+
return _this.adjustOffset(value.set('date', date));
|
|
501
536
|
};
|
|
502
537
|
this.setHours = function (value, hours) {
|
|
503
|
-
return value.set('hour', hours);
|
|
538
|
+
return _this.adjustOffset(value.set('hour', hours));
|
|
504
539
|
};
|
|
505
540
|
this.setMinutes = function (value, minutes) {
|
|
506
|
-
return value.set('minute', minutes);
|
|
541
|
+
return _this.adjustOffset(value.set('minute', minutes));
|
|
507
542
|
};
|
|
508
543
|
this.setSeconds = function (value, seconds) {
|
|
509
|
-
return value.set('second', seconds);
|
|
544
|
+
return _this.adjustOffset(value.set('second', seconds));
|
|
510
545
|
};
|
|
511
546
|
this.setMilliseconds = function (value, milliseconds) {
|
|
512
|
-
return value.set('millisecond', milliseconds);
|
|
547
|
+
return _this.adjustOffset(value.set('millisecond', milliseconds));
|
|
513
548
|
};
|
|
514
549
|
this.getDaysInMonth = function (value) {
|
|
515
550
|
return value.daysInMonth();
|
|
516
551
|
};
|
|
517
552
|
this.getNextMonth = function (value) {
|
|
518
|
-
return
|
|
553
|
+
return _this.addMonths(value, 1);
|
|
519
554
|
};
|
|
520
555
|
this.getPreviousMonth = function (value) {
|
|
521
|
-
return
|
|
556
|
+
return _this.addMonths(value, -1);
|
|
522
557
|
};
|
|
523
558
|
this.getMonthArray = function (value) {
|
|
524
559
|
var firstMonth = value.startOf('year');
|
|
@@ -535,11 +570,10 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
535
570
|
this.getWeekdays = function () {
|
|
536
571
|
var start = _this.dayjs().startOf('week');
|
|
537
572
|
return [0, 1, 2, 3, 4, 5, 6].map(function (diff) {
|
|
538
|
-
return _this.formatByString(
|
|
573
|
+
return _this.formatByString(_this.addDays(start, diff), 'dd');
|
|
539
574
|
});
|
|
540
575
|
};
|
|
541
576
|
this.getWeekArray = function (value) {
|
|
542
|
-
var timezone = _this.getTimezone(value);
|
|
543
577
|
var cleanValue = _this.setLocaleToValue(value);
|
|
544
578
|
var start = cleanValue.startOf('month').startOf('week');
|
|
545
579
|
var end = cleanValue.endOf('month').endOf('week');
|
|
@@ -550,15 +584,7 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
550
584
|
var weekNumber = Math.floor(count / 7);
|
|
551
585
|
nestedWeeks[weekNumber] = nestedWeeks[weekNumber] || [];
|
|
552
586
|
nestedWeeks[weekNumber].push(current);
|
|
553
|
-
current =
|
|
554
|
-
|
|
555
|
-
// If the new day does not have the same offset as the old one (when switching to summer day time for example),
|
|
556
|
-
// Then dayjs will not automatically adjust the offset (moment does)
|
|
557
|
-
// We have to parse again the value to make sure the `fixOffset` method is applied
|
|
558
|
-
// See https://github.com/iamkun/dayjs/blob/b3624de619d6e734cd0ffdbbd3502185041c1b60/src/plugin/timezone/index.js#L72
|
|
559
|
-
if (_this.hasTimezonePlugin() && timezone !== 'UTC' && timezone !== 'system') {
|
|
560
|
-
current = current.tz(_this.cleanTimezone(timezone), true);
|
|
561
|
-
}
|
|
587
|
+
current = _this.addDays(current, 1);
|
|
562
588
|
count += 1;
|
|
563
589
|
}
|
|
564
590
|
return nestedWeeks;
|
|
@@ -573,7 +599,7 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
573
599
|
var current = startDate;
|
|
574
600
|
while (current < endDate) {
|
|
575
601
|
years.push(current);
|
|
576
|
-
current =
|
|
602
|
+
current = _this.addYears(current, 1);
|
|
577
603
|
}
|
|
578
604
|
return years;
|
|
579
605
|
};
|
|
@@ -4,6 +4,7 @@ var _excluded = ["autoFocus", "onViewChange", "value", "defaultValue", "referenc
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
7
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
9
|
import { unstable_composeClasses as composeClasses, unstable_useId as useId, unstable_useEventCallback as useEventCallback } from '@mui/utils';
|
|
9
10
|
import { useCalendarState } from './useCalendarState';
|
|
@@ -13,10 +14,10 @@ import { DayCalendar } from './DayCalendar';
|
|
|
13
14
|
import { MonthCalendar } from '../MonthCalendar';
|
|
14
15
|
import { YearCalendar } from '../YearCalendar';
|
|
15
16
|
import { useViews } from '../internals/hooks/useViews';
|
|
16
|
-
import { PickersCalendarHeader } from '
|
|
17
|
+
import { PickersCalendarHeader } from '../PickersCalendarHeader';
|
|
17
18
|
import { findClosestEnabledDate, applyDefaultDate, mergeDateAndTime } from '../internals/utils/date-utils';
|
|
18
19
|
import { PickerViewRoot } from '../internals/components/PickerViewRoot';
|
|
19
|
-
import {
|
|
20
|
+
import { useDefaultReduceAnimations } from '../internals/hooks/useDefaultReduceAnimations';
|
|
20
21
|
import { getDateCalendarUtilityClass } from './dateCalendarClasses';
|
|
21
22
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
22
23
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
@@ -31,25 +32,26 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
31
32
|
return composeClasses(slots, getDateCalendarUtilityClass, classes);
|
|
32
33
|
};
|
|
33
34
|
function useDateCalendarDefaultizedProps(props, name) {
|
|
35
|
+
var _themeProps$loading, _themeProps$disablePa, _themeProps$disableFu, _themeProps$openTo, _themeProps$views, _themeProps$reduceAni, _themeProps$renderLoa;
|
|
34
36
|
var utils = useUtils();
|
|
35
37
|
var defaultDates = useDefaultDates();
|
|
38
|
+
var defaultReduceAnimations = useDefaultReduceAnimations();
|
|
36
39
|
var themeProps = useThemeProps({
|
|
37
40
|
props: props,
|
|
38
41
|
name: name
|
|
39
42
|
});
|
|
40
|
-
return _extends({
|
|
41
|
-
loading: false,
|
|
42
|
-
disablePast: false,
|
|
43
|
-
disableFuture: false,
|
|
44
|
-
openTo: 'day',
|
|
45
|
-
views: ['year', 'day'],
|
|
46
|
-
reduceAnimations: defaultReduceAnimations,
|
|
47
|
-
renderLoading: function
|
|
43
|
+
return _extends({}, themeProps, {
|
|
44
|
+
loading: (_themeProps$loading = themeProps.loading) != null ? _themeProps$loading : false,
|
|
45
|
+
disablePast: (_themeProps$disablePa = themeProps.disablePast) != null ? _themeProps$disablePa : false,
|
|
46
|
+
disableFuture: (_themeProps$disableFu = themeProps.disableFuture) != null ? _themeProps$disableFu : false,
|
|
47
|
+
openTo: (_themeProps$openTo = themeProps.openTo) != null ? _themeProps$openTo : 'day',
|
|
48
|
+
views: (_themeProps$views = themeProps.views) != null ? _themeProps$views : ['year', 'day'],
|
|
49
|
+
reduceAnimations: (_themeProps$reduceAni = themeProps.reduceAnimations) != null ? _themeProps$reduceAni : defaultReduceAnimations,
|
|
50
|
+
renderLoading: (_themeProps$renderLoa = themeProps.renderLoading) != null ? _themeProps$renderLoa : function () {
|
|
48
51
|
return /*#__PURE__*/_jsx("span", {
|
|
49
52
|
children: "..."
|
|
50
53
|
});
|
|
51
|
-
}
|
|
52
|
-
}, themeProps, {
|
|
54
|
+
},
|
|
53
55
|
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
54
56
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
|
|
55
57
|
});
|
|
@@ -82,6 +84,7 @@ var DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
|
|
|
82
84
|
* - [DateCalendar API](https://mui.com/x/api/date-pickers/date-calendar/)
|
|
83
85
|
*/
|
|
84
86
|
export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(inProps, ref) {
|
|
87
|
+
var _ref, _slots$calendarHeader, _slotProps$calendarHe;
|
|
85
88
|
var utils = useUtils();
|
|
86
89
|
var id = useId();
|
|
87
90
|
var props = useDateCalendarDefaultizedProps(inProps, 'MuiDateCalendar');
|
|
@@ -172,6 +175,40 @@ export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(in
|
|
|
172
175
|
handleChangeMonth = _useCalendarState.handleChangeMonth,
|
|
173
176
|
isDateDisabled = _useCalendarState.isDateDisabled,
|
|
174
177
|
onMonthSwitchingAnimationEnd = _useCalendarState.onMonthSwitchingAnimationEnd;
|
|
178
|
+
|
|
179
|
+
// When disabled, limit the view to the selected date
|
|
180
|
+
var minDateWithDisabled = disabled && value || minDate;
|
|
181
|
+
var maxDateWithDisabled = disabled && value || maxDate;
|
|
182
|
+
var gridLabelId = "".concat(id, "-grid-label");
|
|
183
|
+
var hasFocus = focusedView !== null;
|
|
184
|
+
var CalendarHeader = (_ref = (_slots$calendarHeader = slots == null ? void 0 : slots.calendarHeader) != null ? _slots$calendarHeader : components == null ? void 0 : components.CalendarHeader) != null ? _ref : PickersCalendarHeader;
|
|
185
|
+
var calendarHeaderProps = useSlotProps({
|
|
186
|
+
elementType: CalendarHeader,
|
|
187
|
+
externalSlotProps: (_slotProps$calendarHe = slotProps == null ? void 0 : slotProps.calendarHeader) != null ? _slotProps$calendarHe : componentsProps == null ? void 0 : componentsProps.calendarHeader,
|
|
188
|
+
additionalProps: {
|
|
189
|
+
views: views,
|
|
190
|
+
view: view,
|
|
191
|
+
currentMonth: calendarState.currentMonth,
|
|
192
|
+
onViewChange: setView,
|
|
193
|
+
onMonthChange: function onMonthChange(newMonth, direction) {
|
|
194
|
+
return handleChangeMonth({
|
|
195
|
+
newMonth: newMonth,
|
|
196
|
+
direction: direction
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
minDate: minDateWithDisabled,
|
|
200
|
+
maxDate: maxDateWithDisabled,
|
|
201
|
+
disabled: disabled,
|
|
202
|
+
disablePast: disablePast,
|
|
203
|
+
disableFuture: disableFuture,
|
|
204
|
+
reduceAnimations: reduceAnimations,
|
|
205
|
+
timezone: timezone,
|
|
206
|
+
labelId: gridLabelId,
|
|
207
|
+
slots: slots,
|
|
208
|
+
slotProps: slotProps
|
|
209
|
+
},
|
|
210
|
+
ownerState: props
|
|
211
|
+
});
|
|
175
212
|
var handleDateMonthChange = useEventCallback(function (newDate) {
|
|
176
213
|
var startOfMonth = utils.startOfMonth(newDate);
|
|
177
214
|
var endOfMonth = utils.endOfMonth(newDate);
|
|
@@ -237,18 +274,12 @@ export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(in
|
|
|
237
274
|
maxDate: maxDate,
|
|
238
275
|
minDate: minDate
|
|
239
276
|
};
|
|
240
|
-
|
|
241
|
-
// When disabled, limit the view to the selected date
|
|
242
|
-
var minDateWithDisabled = disabled && value || minDate;
|
|
243
|
-
var maxDateWithDisabled = disabled && value || maxDate;
|
|
244
277
|
var commonViewProps = {
|
|
245
278
|
disableHighlightToday: disableHighlightToday,
|
|
246
279
|
readOnly: readOnly,
|
|
247
280
|
disabled: disabled,
|
|
248
281
|
timezone: timezone
|
|
249
282
|
};
|
|
250
|
-
var gridLabelId = "".concat(id, "-grid-label");
|
|
251
|
-
var hasFocus = focusedView !== null;
|
|
252
283
|
var prevOpenViewRef = React.useRef(view);
|
|
253
284
|
React.useEffect(function () {
|
|
254
285
|
// If the view change and the focus was on the previous view
|
|
@@ -269,28 +300,7 @@ export var DateCalendar = /*#__PURE__*/React.forwardRef(function DateCalendar(in
|
|
|
269
300
|
className: clsx(classes.root, className),
|
|
270
301
|
ownerState: ownerState
|
|
271
302
|
}, other, {
|
|
272
|
-
children: [/*#__PURE__*/_jsx(
|
|
273
|
-
views: views,
|
|
274
|
-
view: view,
|
|
275
|
-
currentMonth: calendarState.currentMonth,
|
|
276
|
-
onViewChange: setView,
|
|
277
|
-
onMonthChange: function onMonthChange(newMonth, direction) {
|
|
278
|
-
return handleChangeMonth({
|
|
279
|
-
newMonth: newMonth,
|
|
280
|
-
direction: direction
|
|
281
|
-
});
|
|
282
|
-
},
|
|
283
|
-
minDate: minDateWithDisabled,
|
|
284
|
-
maxDate: maxDateWithDisabled,
|
|
285
|
-
disabled: disabled,
|
|
286
|
-
disablePast: disablePast,
|
|
287
|
-
disableFuture: disableFuture,
|
|
288
|
-
reduceAnimations: reduceAnimations,
|
|
289
|
-
labelId: gridLabelId,
|
|
290
|
-
slots: slots,
|
|
291
|
-
slotProps: slotProps,
|
|
292
|
-
timezone: timezone
|
|
293
|
-
}), /*#__PURE__*/_jsx(DateCalendarViewTransitionContainer, {
|
|
303
|
+
children: [/*#__PURE__*/_jsx(CalendarHeader, _extends({}, calendarHeaderProps)), /*#__PURE__*/_jsx(DateCalendarViewTransitionContainer, {
|
|
294
304
|
reduceAnimations: reduceAnimations,
|
|
295
305
|
className: classes.viewTransitionContainer,
|
|
296
306
|
transKey: view,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { DateCalendar } from './DateCalendar';
|
|
2
2
|
export { getDateCalendarUtilityClass, dateCalendarClasses } from './dateCalendarClasses';
|
|
3
3
|
export { dayPickerClasses } from './dayCalendarClasses';
|
|
4
|
-
export { pickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
5
4
|
export { pickersFadeTransitionGroupClasses } from './pickersFadeTransitionGroupClasses';
|
|
6
|
-
export { pickersSlideTransitionClasses } from './pickersSlideTransitionClasses';
|
|
5
|
+
export { pickersSlideTransitionClasses } from './pickersSlideTransitionClasses';
|
|
6
|
+
// TODO v7: Remove and export the `PickersCalendarHeader` folder from the root instead.
|
|
7
|
+
export * from '../PickersCalendarHeader';
|
|
@@ -35,8 +35,8 @@ var DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, ref) {
|
|
|
35
35
|
textFieldProps = _objectWithoutProperties(_useSlotProps, _excluded2);
|
|
36
36
|
|
|
37
37
|
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
38
|
-
textFieldProps.inputProps = _extends({},
|
|
39
|
-
textFieldProps.InputProps = _extends({},
|
|
38
|
+
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
39
|
+
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
40
40
|
var _useDateField = useDateField({
|
|
41
41
|
props: textFieldProps,
|
|
42
42
|
inputRef: externalInputRef
|
|
@@ -35,8 +35,8 @@ var DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inProps
|
|
|
35
35
|
textFieldProps = _objectWithoutProperties(_useSlotProps, _excluded2);
|
|
36
36
|
|
|
37
37
|
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
38
|
-
textFieldProps.inputProps = _extends({},
|
|
39
|
-
textFieldProps.InputProps = _extends({},
|
|
38
|
+
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
39
|
+
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
40
40
|
var _useDateTimeField = useDateTimeField({
|
|
41
41
|
props: textFieldProps,
|
|
42
42
|
inputRef: externalInputRef
|
|
@@ -12,7 +12,7 @@ import { extractValidationProps } from '../internals/utils/validation/extractVal
|
|
|
12
12
|
import { renderDateViewCalendar } from '../dateViewRenderers';
|
|
13
13
|
import { resolveDateFormat } from '../internals/utils/date-utils';
|
|
14
14
|
var DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePicker(inProps, ref) {
|
|
15
|
-
var _defaultizedProps$yea, _defaultizedProps$slo2;
|
|
15
|
+
var _defaultizedProps$yea, _defaultizedProps$slo2, _props$localeText$ope, _props$localeText;
|
|
16
16
|
var localeText = useLocaleText();
|
|
17
17
|
var utils = useUtils();
|
|
18
18
|
|
|
@@ -49,7 +49,7 @@ var DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePicker
|
|
|
49
49
|
props: props,
|
|
50
50
|
valueManager: singleItemValueManager,
|
|
51
51
|
valueType: 'date',
|
|
52
|
-
getOpenDialogAriaText: localeText.openDatePickerDialogue,
|
|
52
|
+
getOpenDialogAriaText: (_props$localeText$ope = (_props$localeText = props.localeText) == null ? void 0 : _props$localeText.openDatePickerDialogue) != null ? _props$localeText$ope : localeText.openDatePickerDialogue,
|
|
53
53
|
validator: validateDate
|
|
54
54
|
}),
|
|
55
55
|
renderPicker = _useDesktopPicker.renderPicker;
|
|
@@ -15,7 +15,7 @@ import { useDesktopPicker } from '../internals/hooks/useDesktopPicker';
|
|
|
15
15
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
16
16
|
import { resolveDateTimeFormat } from '../internals/utils/date-time-utils';
|
|
17
17
|
var DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimePicker(inProps, ref) {
|
|
18
|
-
var _defaultizedProps$amp, _defaultizedProps$yea, _defaultizedProps$slo2, _defaultizedProps$slo3, _defaultizedProps$slo4;
|
|
18
|
+
var _defaultizedProps$amp, _defaultizedProps$yea, _defaultizedProps$slo2, _defaultizedProps$slo3, _defaultizedProps$slo4, _props$localeText$ope, _props$localeText;
|
|
19
19
|
var localeText = useLocaleText();
|
|
20
20
|
var utils = useUtils();
|
|
21
21
|
|
|
@@ -86,7 +86,7 @@ var DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTi
|
|
|
86
86
|
props: props,
|
|
87
87
|
valueManager: singleItemValueManager,
|
|
88
88
|
valueType: 'date-time',
|
|
89
|
-
getOpenDialogAriaText: localeText.openDatePickerDialogue,
|
|
89
|
+
getOpenDialogAriaText: (_props$localeText$ope = (_props$localeText = props.localeText) == null ? void 0 : _props$localeText.openDatePickerDialogue) != null ? _props$localeText$ope : localeText.openDatePickerDialogue,
|
|
90
90
|
validator: validateDateTime
|
|
91
91
|
}),
|
|
92
92
|
renderPicker = _useDesktopPicker.renderPicker;
|
|
@@ -14,7 +14,7 @@ import { extractValidationProps } from '../internals/utils/validation/extractVal
|
|
|
14
14
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '../timeViewRenderers';
|
|
15
15
|
import { resolveTimeFormat } from '../internals/utils/time-utils';
|
|
16
16
|
var DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePicker(inProps, ref) {
|
|
17
|
-
var _defaultizedProps$thr, _defaultizedProps$amp, _viewRenderers$hours, _defaultizedProps$slo2, _defaultizedProps$slo3;
|
|
17
|
+
var _defaultizedProps$thr, _defaultizedProps$amp, _viewRenderers$hours, _defaultizedProps$slo2, _defaultizedProps$slo3, _props$localeText$ope, _props$localeText;
|
|
18
18
|
var localeText = useLocaleText();
|
|
19
19
|
var utils = useUtils();
|
|
20
20
|
|
|
@@ -73,7 +73,7 @@ var DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePicker
|
|
|
73
73
|
props: props,
|
|
74
74
|
valueManager: singleItemValueManager,
|
|
75
75
|
valueType: 'time',
|
|
76
|
-
getOpenDialogAriaText: localeText.openTimePickerDialogue,
|
|
76
|
+
getOpenDialogAriaText: (_props$localeText$ope = (_props$localeText = props.localeText) == null ? void 0 : _props$localeText.openTimePickerDialogue) != null ? _props$localeText$ope : localeText.openTimePickerDialogue,
|
|
77
77
|
validator: validateTime
|
|
78
78
|
}),
|
|
79
79
|
renderPicker = _useDesktopPicker.renderPicker;
|
|
@@ -229,7 +229,7 @@ export var DigitalClock = /*#__PURE__*/React.forwardRef(function DigitalClock(in
|
|
|
229
229
|
length: Math.ceil(24 * 60 / timeStep) - 1
|
|
230
230
|
}, function (_, index) {
|
|
231
231
|
return utils.addMinutes(startOfDay, timeStep * (index + 1));
|
|
232
|
-
}))
|
|
232
|
+
})));
|
|
233
233
|
}, [valueOrReferenceDate, timeStep, utils]);
|
|
234
234
|
return /*#__PURE__*/_jsx(DigitalClockRoot, _extends({
|
|
235
235
|
ref: handleRef,
|