@mui/x-date-pickers 8.0.0-alpha.1 → 8.0.0-alpha.3
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/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +330 -7
- package/DateCalendar/DateCalendar.types.d.ts +2 -1
- package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/DateCalendar/PickersSlideTransition.js +12 -5
- package/DateCalendar/useCalendarState.d.ts +6 -4
- package/DateField/DateField.js +5 -4
- package/DateField/DateField.types.d.ts +10 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +3 -2
- package/DatePicker/shared.d.ts +6 -5
- package/DateTimeField/DateTimeField.js +5 -4
- package/DateTimeField/DateTimeField.types.d.ts +10 -10
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/DateTimePicker/DateTimePickerToolbar.d.ts +2 -3
- package/DateTimePicker/shared.d.ts +6 -6
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
- package/PickersActionBar/PickersActionBar.js +8 -1
- package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
- package/PickersLayout/PickersLayout.d.ts +7 -5
- package/PickersLayout/PickersLayout.js +22 -27
- package/PickersLayout/PickersLayout.types.d.ts +14 -15
- package/PickersLayout/usePickerLayout.d.ts +5 -4
- package/PickersLayout/usePickerLayout.js +19 -12
- package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
- package/PickersShortcuts/PickersShortcuts.js +8 -1
- package/README.md +7 -4
- package/TimeField/TimeField.js +5 -4
- package/TimeField/TimeField.types.d.ts +10 -10
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -3
- package/TimePicker/shared.d.ts +6 -6
- package/hooks/useParsedFormat.d.ts +2 -2
- package/hooks/useParsedFormat.js +1 -1
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +2 -15
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/hooks/useClockReferenceDate.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.types.d.ts +45 -45
- package/internals/hooks/useField/useField.utils.d.ts +4 -3
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +9 -8
- package/internals/hooks/useField/useFieldState.js +0 -1
- package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
- package/internals/hooks/useFieldOwnerState.d.ts +6 -0
- package/internals/hooks/useFieldOwnerState.js +12 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
- package/internals/hooks/useOpenState.d.ts +3 -2
- package/internals/hooks/useOpenState.js +10 -9
- package/internals/hooks/usePicker/usePicker.d.ts +3 -3
- package/internals/hooks/usePicker/usePicker.js +4 -10
- package/internals/hooks/usePicker/usePicker.types.d.ts +7 -7
- package/internals/hooks/usePicker/usePickerProvider.d.ts +5 -6
- package/internals/hooks/usePicker/usePickerProvider.js +8 -10
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerValue.js +22 -12
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +51 -24
- package/internals/hooks/usePicker/usePickerViews.d.ts +10 -10
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
- package/internals/hooks/useValueWithTimezone.d.ts +5 -4
- package/internals/hooks/useViews.d.ts +5 -5
- package/internals/index.d.ts +4 -2
- package/internals/index.js +1 -0
- package/internals/models/fields.d.ts +6 -1
- package/internals/models/pickers.d.ts +1 -0
- package/internals/models/pickers.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -3
- package/internals/models/props/time.d.ts +2 -1
- package/internals/models/props/toolbar.d.ts +2 -1
- package/internals/models/value.d.ts +9 -0
- package/internals/utils/date-utils.d.ts +1 -1
- package/internals/utils/valueManagers.d.ts +4 -3
- package/locales/nlNL.js +7 -7
- package/models/adapters.d.ts +4 -4
- package/models/fields.d.ts +19 -5
- package/models/validation.d.ts +2 -1
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/modern/DateCalendar/PickersSlideTransition.js +12 -5
- package/modern/DateField/DateField.js +5 -4
- package/modern/DateTimeField/DateTimeField.js +5 -4
- package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -21
- package/modern/PickersActionBar/PickersActionBar.js +8 -1
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/modern/PickersLayout/PickersLayout.js +22 -27
- package/modern/PickersLayout/usePickerLayout.js +19 -12
- package/modern/PickersShortcuts/PickersShortcuts.js +8 -1
- package/modern/TimeField/TimeField.js +5 -4
- package/modern/hooks/useParsedFormat.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/modern/internals/hooks/useField/useFieldState.js +0 -1
- package/modern/internals/hooks/useFieldOwnerState.js +12 -0
- package/modern/internals/hooks/useOpenState.js +10 -9
- package/modern/internals/hooks/usePicker/usePicker.js +4 -10
- package/modern/internals/hooks/usePicker/usePickerProvider.js +8 -10
- package/modern/internals/hooks/usePicker/usePickerValue.js +22 -12
- package/modern/internals/index.js +1 -0
- package/modern/internals/models/pickers.js +1 -0
- package/modern/locales/nlNL.js +7 -7
- package/modern/validation/useValidation.js +1 -1
- package/modern/validation/validateDate.js +8 -0
- package/modern/validation/validateDateTime.js +8 -0
- package/modern/validation/validateTime.js +8 -0
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/node/DateCalendar/PickersSlideTransition.js +12 -5
- package/node/DateField/DateField.js +5 -4
- package/node/DateTimeField/DateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -22
- package/node/PickersActionBar/PickersActionBar.js +8 -1
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/node/PickersLayout/PickersLayout.js +22 -27
- package/node/PickersLayout/usePickerLayout.js +19 -12
- package/node/PickersShortcuts/PickersShortcuts.js +8 -1
- package/node/TimeField/TimeField.js +5 -4
- package/node/hooks/useParsedFormat.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/node/internals/hooks/useField/useFieldState.js +0 -1
- package/node/internals/hooks/useFieldOwnerState.js +20 -0
- package/node/internals/hooks/useOpenState.js +10 -9
- package/node/internals/hooks/usePicker/usePicker.js +5 -10
- package/node/internals/hooks/usePicker/usePickerProvider.js +9 -11
- package/node/internals/hooks/usePicker/usePickerValue.js +22 -11
- package/node/internals/index.js +7 -0
- package/node/internals/models/pickers.js +5 -0
- package/node/locales/nlNL.js +7 -7
- package/node/validation/useValidation.js +1 -1
- package/node/validation/validateDate.js +8 -0
- package/node/validation/validateDateTime.js +8 -0
- package/node/validation/validateTime.js +8 -0
- package/package.json +2 -2
- package/themeAugmentation/overrides.d.ts +1 -1
- package/themeAugmentation/props.d.ts +3 -2
- package/validation/useValidation.d.ts +7 -6
- package/validation/useValidation.js +1 -1
- package/validation/validateDate.d.ts +12 -3
- package/validation/validateDate.js +8 -0
- package/validation/validateDateTime.d.ts +12 -4
- package/validation/validateDateTime.js +8 -0
- package/validation/validateTime.d.ts +12 -3
- package/validation/validateTime.js +8 -0
- package/internals/hooks/useIsLandscape.d.ts +0 -4
- package/internals/hooks/useIsLandscape.js +0 -35
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -32
- package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
- package/modern/internals/hooks/useIsLandscape.js +0 -35
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -31
- package/node/internals/hooks/useIsLandscape.js +0 -43
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -38
package/DatePicker/shared.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { DateCalendarSlots, DateCalendarSlotProps, ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
|
|
4
|
-
import { DateValidationError, DateView
|
|
4
|
+
import { DateValidationError, DateView } from '../models';
|
|
5
5
|
import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
|
|
6
|
-
import { BaseDateValidationProps } from '../internals/models/validation';
|
|
7
6
|
import { LocalizedComponent } from '../locales/utils/pickersLocaleTextApi';
|
|
8
7
|
import { DatePickerToolbarProps, ExportedDatePickerToolbarProps } from './DatePickerToolbar';
|
|
9
8
|
import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePickerViews';
|
|
10
9
|
import { DateViewRendererProps } from '../dateViewRenderers';
|
|
10
|
+
import { PickerValue } from '../internals/models';
|
|
11
|
+
import { ValidateDatePropsToDefault } from '../validation/validateDate';
|
|
11
12
|
export interface BaseDatePickerSlots extends DateCalendarSlots {
|
|
12
13
|
/**
|
|
13
14
|
* Custom component for the toolbar rendered above the views.
|
|
@@ -18,8 +19,8 @@ export interface BaseDatePickerSlots extends DateCalendarSlots {
|
|
|
18
19
|
export interface BaseDatePickerSlotProps extends DateCalendarSlotProps {
|
|
19
20
|
toolbar?: ExportedDatePickerToolbarProps;
|
|
20
21
|
}
|
|
21
|
-
export type DatePickerViewRenderers<TView extends DateView, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<
|
|
22
|
-
export interface BaseDatePickerProps extends BasePickerInputProps<
|
|
22
|
+
export type DatePickerViewRenderers<TView extends DateView, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValue, TView, DateViewRendererProps<TView>, TAdditionalProps>;
|
|
23
|
+
export interface BaseDatePickerProps extends BasePickerInputProps<PickerValue, DateView, DateValidationError>, ExportedDateCalendarProps {
|
|
23
24
|
/**
|
|
24
25
|
* Overridable component slots.
|
|
25
26
|
* @default {}
|
|
@@ -37,6 +38,6 @@ export interface BaseDatePickerProps extends BasePickerInputProps<PickerValidDat
|
|
|
37
38
|
*/
|
|
38
39
|
viewRenderers?: Partial<DatePickerViewRenderers<DateView>>;
|
|
39
40
|
}
|
|
40
|
-
type UseDatePickerDefaultizedProps<Props extends BaseDatePickerProps> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' |
|
|
41
|
+
type UseDatePickerDefaultizedProps<Props extends BaseDatePickerProps> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | ValidateDatePropsToDefault>>;
|
|
41
42
|
export declare function useDatePickerDefaultizedProps<Props extends BaseDatePickerProps>(props: Props, name: string): UseDatePickerDefaultizedProps<Props>;
|
|
42
43
|
export {};
|
|
@@ -13,6 +13,7 @@ import { useDateTimeField } from "./useDateTimeField.js";
|
|
|
13
13
|
import { useClearableField } from "../hooks/index.js";
|
|
14
14
|
import { PickersTextField } from "../PickersTextField/index.js";
|
|
15
15
|
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
+
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
/**
|
|
18
19
|
* Demos:
|
|
@@ -36,7 +37,7 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
36
37
|
inputProps
|
|
37
38
|
} = themeProps,
|
|
38
39
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
|
-
const ownerState = themeProps;
|
|
40
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
40
41
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
42
|
const textFieldProps = useSlotProps({
|
|
42
43
|
elementType: TextField,
|
|
@@ -307,10 +308,10 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
307
308
|
*/
|
|
308
309
|
shouldDisableYear: PropTypes.func,
|
|
309
310
|
/**
|
|
310
|
-
* If `true`, the format will respect the leading zeroes (
|
|
311
|
-
* If `false`, the format will always add leading zeroes (
|
|
311
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
312
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
312
313
|
*
|
|
313
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
314
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
314
315
|
*
|
|
315
316
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
316
317
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { DateTimeValidationError, FieldSection, PickerValidDate, BuiltInFieldTextFieldProps } from '../models';
|
|
2
|
+
import { MakeOptional, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
3
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
4
|
+
import { DateTimeValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
|
|
6
5
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
7
6
|
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
8
7
|
import { ExportedValidateDateTimeProps } from '../validation/validateDateTime';
|
|
9
8
|
import { AmPmProps } from '../internals/models/props/time';
|
|
10
|
-
|
|
9
|
+
import { PickerValue } from '../internals/models';
|
|
10
|
+
import { PickersTextFieldProps } from '../PickersTextField';
|
|
11
|
+
export interface UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, DateTimeValidationError>, 'format'>, ExportedValidateDateTimeProps, ExportedUseClearableFieldProps, AmPmProps {
|
|
11
12
|
}
|
|
12
13
|
export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseDateTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
13
14
|
/**
|
|
@@ -19,16 +20,15 @@ export type DateTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolea
|
|
|
19
20
|
* The props used for each component slot.
|
|
20
21
|
* @default {}
|
|
21
22
|
*/
|
|
22
|
-
slotProps?: DateTimeFieldSlotProps
|
|
23
|
+
slotProps?: DateTimeFieldSlotProps;
|
|
23
24
|
};
|
|
24
|
-
export type DateTimeFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = DateTimeFieldProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
25
|
export interface DateTimeFieldSlots extends UseClearableFieldSlots {
|
|
26
26
|
/**
|
|
27
27
|
* Form control with an input to render the value.
|
|
28
|
-
* @default TextField from '@mui/material'
|
|
28
|
+
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
29
29
|
*/
|
|
30
30
|
textField?: React.ElementType;
|
|
31
31
|
}
|
|
32
|
-
export interface DateTimeFieldSlotProps
|
|
33
|
-
textField?:
|
|
32
|
+
export interface DateTimeFieldSlotProps extends UseClearableFieldSlotProps {
|
|
33
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DesktopDateTimePickerProps, DesktopDateTimePickerSlots, DesktopDateTimePickerSlotProps } from '../DesktopDateTimePicker';
|
|
2
|
-
import { BaseSingleInputFieldProps, DateOrTimeViewWithMeridiem } from '../internals/models';
|
|
2
|
+
import { BaseSingleInputFieldProps, DateOrTimeViewWithMeridiem, PickerValue } from '../internals/models';
|
|
3
3
|
import { MobileDateTimePickerProps, MobileDateTimePickerSlots, MobileDateTimePickerSlotProps } from '../MobileDateTimePicker';
|
|
4
|
-
import { DateTimeValidationError
|
|
4
|
+
import { DateTimeValidationError } from '../models';
|
|
5
5
|
import { ValidateDateTimeProps } from '../validation';
|
|
6
6
|
import { ExportedYearCalendarProps } from '../YearCalendar/YearCalendar.types';
|
|
7
7
|
export interface DateTimePickerSlots extends DesktopDateTimePickerSlots, MobileDateTimePickerSlots<DateOrTimeViewWithMeridiem> {
|
|
@@ -34,4 +34,4 @@ export interface DateTimePickerProps<TEnableAccessibleFieldDOMStructure extends
|
|
|
34
34
|
/**
|
|
35
35
|
* Props the field can receive when used inside a date time picker (<DateTimePicker />, <DesktopDateTimePicker /> or <MobileDateTimePicker /> component).
|
|
36
36
|
*/
|
|
37
|
-
export type DateTimePickerFieldProps = ValidateDateTimeProps & BaseSingleInputFieldProps<
|
|
37
|
+
export type DateTimePickerFieldProps = ValidateDateTimeProps & BaseSingleInputFieldProps<PickerValue, false, DateTimeValidationError>;
|
|
@@ -11,6 +11,7 @@ import { TimeIcon, DateRangeIcon } from "../icons/index.js";
|
|
|
11
11
|
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
12
|
import { getDateTimePickerTabsUtilityClass } from "./dateTimePickerTabsClasses.js";
|
|
13
13
|
import { isDatePickerView } from "../internals/utils/date-utils.js";
|
|
14
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
14
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const viewToTab = view => {
|
|
16
17
|
if (isDatePickerView(view)) {
|
|
@@ -24,10 +25,7 @@ const tabToView = tab => {
|
|
|
24
25
|
}
|
|
25
26
|
return 'hours';
|
|
26
27
|
};
|
|
27
|
-
const useUtilityClasses =
|
|
28
|
-
const {
|
|
29
|
-
classes
|
|
30
|
-
} = ownerState;
|
|
28
|
+
const useUtilityClasses = classes => {
|
|
31
29
|
const slots = {
|
|
32
30
|
root: ['root']
|
|
33
31
|
};
|
|
@@ -72,10 +70,14 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
72
70
|
view,
|
|
73
71
|
hidden = typeof window === 'undefined' || window.innerHeight < 667,
|
|
74
72
|
className,
|
|
73
|
+
classes: classesProp,
|
|
75
74
|
sx
|
|
76
75
|
} = props;
|
|
77
76
|
const translations = usePickerTranslations();
|
|
78
|
-
const
|
|
77
|
+
const {
|
|
78
|
+
ownerState
|
|
79
|
+
} = usePickerPrivateContext();
|
|
80
|
+
const classes = useUtilityClasses(classesProp);
|
|
79
81
|
const handleChange = (event, value) => {
|
|
80
82
|
onViewChange(tabToView(value));
|
|
81
83
|
};
|
|
@@ -83,7 +85,7 @@ const DateTimePickerTabs = function DateTimePickerTabs(inProps) {
|
|
|
83
85
|
return null;
|
|
84
86
|
}
|
|
85
87
|
return /*#__PURE__*/_jsxs(DateTimePickerTabsRoot, {
|
|
86
|
-
ownerState:
|
|
88
|
+
ownerState: ownerState,
|
|
87
89
|
variant: "fullWidth",
|
|
88
90
|
value: viewToTab(view),
|
|
89
91
|
onChange: handleChange,
|
|
@@ -2,15 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
3
|
import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
|
|
4
4
|
import { DateTimePickerToolbarClasses } from './dateTimePickerToolbarClasses';
|
|
5
|
-
import { DateOrTimeViewWithMeridiem, PickerVariant } from '../internals/models';
|
|
6
|
-
import { PickerValidDate } from '../models';
|
|
5
|
+
import { DateOrTimeViewWithMeridiem, PickerValue, PickerVariant } from '../internals/models';
|
|
7
6
|
export interface ExportedDateTimePickerToolbarProps extends ExportedBaseToolbarProps {
|
|
8
7
|
/**
|
|
9
8
|
* Override or extend the styles applied to the component.
|
|
10
9
|
*/
|
|
11
10
|
classes?: Partial<DateTimePickerToolbarClasses>;
|
|
12
11
|
}
|
|
13
|
-
export interface DateTimePickerToolbarProps extends ExportedDateTimePickerToolbarProps, MakeOptional<BaseToolbarProps<
|
|
12
|
+
export interface DateTimePickerToolbarProps extends ExportedDateTimePickerToolbarProps, MakeOptional<BaseToolbarProps<PickerValue, DateOrTimeViewWithMeridiem>, 'view'> {
|
|
14
13
|
toolbarVariant?: PickerVariant;
|
|
15
14
|
/**
|
|
16
15
|
* If provided, it will be used instead of `dateTimePickerToolbarTitle` from localization.
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
|
-
import { DateTimeValidationError
|
|
3
|
+
import { DateTimeValidationError } from '../models';
|
|
4
4
|
import { DateCalendarSlots, DateCalendarSlotProps, ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
|
|
5
5
|
import { TimeClockSlots, TimeClockSlotProps } from '../TimeClock/TimeClock.types';
|
|
6
6
|
import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
|
|
7
7
|
import { DateTimePickerTabsProps, ExportedDateTimePickerTabsProps } from './DateTimePickerTabs';
|
|
8
|
-
import { BaseDateValidationProps, BaseTimeValidationProps, DateTimeValidationProps } from '../internals/models/validation';
|
|
9
8
|
import { LocalizedComponent } from '../locales/utils/pickersLocaleTextApi';
|
|
10
9
|
import { DateTimePickerToolbarProps, ExportedDateTimePickerToolbarProps } from './DateTimePickerToolbar';
|
|
11
10
|
import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePickerViews';
|
|
12
11
|
import { DateViewRendererProps } from '../dateViewRenderers';
|
|
13
12
|
import { TimeViewRendererProps } from '../timeViewRenderers';
|
|
14
13
|
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/time';
|
|
15
|
-
import { DateOrTimeViewWithMeridiem, TimeViewWithMeridiem } from '../internals/models';
|
|
14
|
+
import { DateOrTimeViewWithMeridiem, PickerValue, TimeViewWithMeridiem } from '../internals/models';
|
|
15
|
+
import { ExportedValidateDateTimeProps, ValidateDateTimePropsToDefault } from '../validation/validateDateTime';
|
|
16
16
|
export interface BaseDateTimePickerSlots extends DateCalendarSlots, TimeClockSlots {
|
|
17
17
|
/**
|
|
18
18
|
* Tabs enabling toggling between date and time pickers.
|
|
@@ -35,8 +35,8 @@ export interface BaseDateTimePickerSlotProps extends DateCalendarSlotProps, Time
|
|
|
35
35
|
*/
|
|
36
36
|
toolbar?: ExportedDateTimePickerToolbarProps;
|
|
37
37
|
}
|
|
38
|
-
export type DateTimePickerViewRenderers<TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<
|
|
39
|
-
export interface BaseDateTimePickerProps<TView extends DateOrTimeViewWithMeridiem> extends BasePickerInputProps<
|
|
38
|
+
export type DateTimePickerViewRenderers<TView extends DateOrTimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValue, TView, Omit<DateViewRendererProps<TView>, 'slots' | 'slotProps'> & Omit<TimeViewRendererProps<TimeViewWithMeridiem, BaseClockProps<TimeViewWithMeridiem>>, 'slots' | 'slotProps'>, TAdditionalProps>;
|
|
39
|
+
export interface BaseDateTimePickerProps<TView extends DateOrTimeViewWithMeridiem> extends BasePickerInputProps<PickerValue, TView, DateTimeValidationError>, Omit<ExportedDateCalendarProps, 'onViewChange'>, ExportedBaseClockProps, ExportedValidateDateTimeProps {
|
|
40
40
|
/**
|
|
41
41
|
* Display ampm controls under the clock (instead of in the toolbar).
|
|
42
42
|
* @default true on desktop, false on mobile
|
|
@@ -59,6 +59,6 @@ export interface BaseDateTimePickerProps<TView extends DateOrTimeViewWithMeridie
|
|
|
59
59
|
*/
|
|
60
60
|
viewRenderers?: Partial<DateTimePickerViewRenderers<TView>>;
|
|
61
61
|
}
|
|
62
|
-
type UseDateTimePickerDefaultizedProps<TView extends DateOrTimeViewWithMeridiem, Props extends BaseDateTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'orientation' | 'ampm' |
|
|
62
|
+
type UseDateTimePickerDefaultizedProps<TView extends DateOrTimeViewWithMeridiem, Props extends BaseDateTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'orientation' | 'ampm' | ValidateDateTimePropsToDefault>>;
|
|
63
63
|
export declare function useDateTimePickerDefaultizedProps<TView extends DateOrTimeViewWithMeridiem, Props extends BaseDateTimePickerProps<TView>>(props: Props, name: string): UseDateTimePickerDefaultizedProps<TView, Props>;
|
|
64
64
|
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["className"];
|
|
5
|
+
const _excluded = ["className", "classes"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
@@ -12,10 +12,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
12
12
|
import { DAY_SIZE, DAY_MARGIN } from "../internals/constants/dimensions.js";
|
|
13
13
|
import { getDayCalendarSkeletonUtilityClass } from "./dayCalendarSkeletonClasses.js";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
-
const useUtilityClasses =
|
|
16
|
-
const {
|
|
17
|
-
classes
|
|
18
|
-
} = ownerState;
|
|
15
|
+
const useUtilityClasses = classes => {
|
|
19
16
|
const slots = {
|
|
20
17
|
root: ['root'],
|
|
21
18
|
week: ['week'],
|
|
@@ -45,14 +42,9 @@ const DayCalendarSkeletonDay = styled(Skeleton, {
|
|
|
45
42
|
overridesResolver: (props, styles) => styles.daySkeleton
|
|
46
43
|
})({
|
|
47
44
|
margin: `0 ${DAY_MARGIN}px`,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
},
|
|
52
|
-
style: {
|
|
53
|
-
visibility: 'hidden'
|
|
54
|
-
}
|
|
55
|
-
}]
|
|
45
|
+
'&[data-day-in-month="0"]': {
|
|
46
|
+
visibility: 'hidden'
|
|
47
|
+
}
|
|
56
48
|
});
|
|
57
49
|
const monthMap = [[0, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 0, 0]];
|
|
58
50
|
|
|
@@ -71,23 +63,22 @@ function DayCalendarSkeleton(inProps) {
|
|
|
71
63
|
name: 'MuiDayCalendarSkeleton'
|
|
72
64
|
});
|
|
73
65
|
const {
|
|
74
|
-
className
|
|
66
|
+
className,
|
|
67
|
+
classes: classesProp
|
|
75
68
|
} = props,
|
|
76
69
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
77
|
-
const classes = useUtilityClasses(
|
|
70
|
+
const classes = useUtilityClasses(classesProp);
|
|
78
71
|
return /*#__PURE__*/_jsx(DayCalendarSkeletonRoot, _extends({
|
|
79
72
|
className: clsx(classes.root, className)
|
|
80
73
|
}, other, {
|
|
81
74
|
children: monthMap.map((week, index) => /*#__PURE__*/_jsx(DayCalendarSkeletonWeek, {
|
|
82
75
|
className: classes.week,
|
|
83
|
-
children: week.map((
|
|
76
|
+
children: week.map((dayInMonth, index2) => /*#__PURE__*/_jsx(DayCalendarSkeletonDay, {
|
|
84
77
|
variant: "circular",
|
|
85
78
|
width: DAY_SIZE,
|
|
86
79
|
height: DAY_SIZE,
|
|
87
80
|
className: classes.daySkeleton,
|
|
88
|
-
|
|
89
|
-
day
|
|
90
|
-
}
|
|
81
|
+
"data-day-in-month": dayInMonth
|
|
91
82
|
}, index2))
|
|
92
83
|
}, index))
|
|
93
84
|
}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PickersLayoutProps } from '../PickersLayout';
|
|
3
3
|
import { DateOrTimeViewWithMeridiem } from '../internals/models/common';
|
|
4
|
-
|
|
4
|
+
import { PickerValidValue } from '../internals/models';
|
|
5
|
+
type DesktopDateTimePickerLayoutComponent = (<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
5
6
|
propTypes?: any;
|
|
6
7
|
};
|
|
7
8
|
/**
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
3
|
import clsx from 'clsx';
|
|
5
|
-
import { useRtl } from '@mui/system/RtlProvider';
|
|
6
4
|
import Divider from '@mui/material/Divider';
|
|
7
5
|
import { PickersLayoutContentWrapper, PickersLayoutRoot, pickersLayoutClasses, usePickerLayout } from "../PickersLayout/index.js";
|
|
6
|
+
import { usePickerContext } from "../hooks/usePickerContext.js";
|
|
8
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
8
|
/**
|
|
10
9
|
* @ignore - internal component.
|
|
11
10
|
*/
|
|
12
11
|
const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function DesktopDateTimePickerLayout(props, ref) {
|
|
13
|
-
const isRtl = useRtl();
|
|
14
12
|
const {
|
|
15
13
|
toolbar,
|
|
16
14
|
tabs,
|
|
17
15
|
content,
|
|
18
16
|
actionBar,
|
|
19
|
-
shortcuts
|
|
17
|
+
shortcuts,
|
|
18
|
+
ownerState
|
|
20
19
|
} = usePickerLayout(props);
|
|
20
|
+
const {
|
|
21
|
+
orientation
|
|
22
|
+
} = usePickerContext();
|
|
21
23
|
const {
|
|
22
24
|
sx,
|
|
23
25
|
className,
|
|
24
|
-
isLandscape,
|
|
25
26
|
classes
|
|
26
27
|
} = props;
|
|
27
28
|
const isActionBarVisible = actionBar && (actionBar.props.actions?.length ?? 0) > 0;
|
|
28
|
-
const ownerState = _extends({}, props, {
|
|
29
|
-
isRtl
|
|
30
|
-
});
|
|
31
29
|
return /*#__PURE__*/_jsxs(PickersLayoutRoot, {
|
|
32
30
|
ref: ref,
|
|
33
31
|
className: clsx(pickersLayoutClasses.root, classes?.root, className),
|
|
@@ -41,8 +39,9 @@ const DesktopDateTimePickerLayout = /*#__PURE__*/React.forwardRef(function Deskt
|
|
|
41
39
|
}
|
|
42
40
|
}, ...(Array.isArray(sx) ? sx : [sx])],
|
|
43
41
|
ownerState: ownerState,
|
|
44
|
-
children: [
|
|
42
|
+
children: [orientation === 'landscape' ? shortcuts : toolbar, orientation === 'landscape' ? toolbar : shortcuts, /*#__PURE__*/_jsxs(PickersLayoutContentWrapper, {
|
|
45
43
|
className: clsx(pickersLayoutClasses.contentWrapper, classes?.contentWrapper),
|
|
44
|
+
ownerState: ownerState,
|
|
46
45
|
sx: {
|
|
47
46
|
display: 'grid'
|
|
48
47
|
},
|
|
@@ -66,11 +65,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
66
65
|
*/
|
|
67
66
|
classes: PropTypes.object,
|
|
68
67
|
className: PropTypes.string,
|
|
69
|
-
isLandscape: PropTypes.bool.isRequired,
|
|
70
|
-
/**
|
|
71
|
-
* `true` if the application is in right-to-left direction.
|
|
72
|
-
*/
|
|
73
|
-
isRtl: PropTypes.bool.isRequired,
|
|
74
68
|
isValid: PropTypes.func.isRequired,
|
|
75
69
|
onAccept: PropTypes.func.isRequired,
|
|
76
70
|
onCancel: PropTypes.func.isRequired,
|
|
@@ -82,10 +76,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
82
76
|
onSelectShortcut: PropTypes.func.isRequired,
|
|
83
77
|
onSetToday: PropTypes.func.isRequired,
|
|
84
78
|
onViewChange: PropTypes.func.isRequired,
|
|
85
|
-
/**
|
|
86
|
-
* Force rendering in particular orientation.
|
|
87
|
-
*/
|
|
88
|
-
orientation: PropTypes.oneOf(['landscape', 'portrait']),
|
|
89
79
|
/**
|
|
90
80
|
* The props used for each component slot.
|
|
91
81
|
* @default {}
|
|
@@ -100,9 +90,8 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePickerLayout.propTypes =
|
|
|
100
90
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
101
91
|
*/
|
|
102
92
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
103
|
-
value: PropTypes.
|
|
93
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.object), PropTypes.object]),
|
|
104
94
|
view: PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']),
|
|
105
|
-
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
106
|
-
wrapperVariant: PropTypes.oneOf(['desktop', 'mobile'])
|
|
95
|
+
views: PropTypes.arrayOf(PropTypes.oneOf(['day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'year']).isRequired).isRequired
|
|
107
96
|
} : void 0;
|
|
108
97
|
export { DesktopDateTimePickerLayout };
|
|
@@ -5,17 +5,17 @@ import { MultiSectionDigitalClockClasses } from './multiSectionDigitalClockClass
|
|
|
5
5
|
import { BaseClockProps, ExportedBaseClockProps, MultiSectionDigitalClockOnlyProps } from '../internals/models/props/time';
|
|
6
6
|
import { MultiSectionDigitalClockSectionProps } from './MultiSectionDigitalClockSection';
|
|
7
7
|
import { TimeViewWithMeridiem } from '../internals/models';
|
|
8
|
-
export interface MultiSectionDigitalClockOption<
|
|
9
|
-
isDisabled?: (value:
|
|
10
|
-
isSelected: (value:
|
|
11
|
-
isFocused: (value:
|
|
8
|
+
export interface MultiSectionDigitalClockOption<TSectionValue extends number | string> {
|
|
9
|
+
isDisabled?: (value: TSectionValue) => boolean;
|
|
10
|
+
isSelected: (value: TSectionValue) => boolean;
|
|
11
|
+
isFocused: (value: TSectionValue) => boolean;
|
|
12
12
|
label: string;
|
|
13
|
-
value:
|
|
13
|
+
value: TSectionValue;
|
|
14
14
|
ariaLabel: string;
|
|
15
15
|
}
|
|
16
16
|
export interface ExportedMultiSectionDigitalClockProps extends ExportedBaseClockProps, MultiSectionDigitalClockOnlyProps {
|
|
17
17
|
}
|
|
18
|
-
export interface MultiSectionDigitalClockViewProps<
|
|
18
|
+
export interface MultiSectionDigitalClockViewProps<TSectionValue extends number | string> extends Pick<MultiSectionDigitalClockSectionProps<TSectionValue>, 'onChange' | 'items'> {
|
|
19
19
|
}
|
|
20
20
|
export interface MultiSectionDigitalClockSlots {
|
|
21
21
|
/**
|
|
@@ -8,15 +8,15 @@ export interface ExportedMultiSectionDigitalClockSectionProps {
|
|
|
8
8
|
slots?: MultiSectionDigitalClockSlots;
|
|
9
9
|
slotProps?: MultiSectionDigitalClockSlotProps;
|
|
10
10
|
}
|
|
11
|
-
export interface MultiSectionDigitalClockSectionProps<
|
|
11
|
+
export interface MultiSectionDigitalClockSectionProps<TSectionValue extends number | string> extends FormProps, ExportedMultiSectionDigitalClockSectionProps {
|
|
12
12
|
autoFocus?: boolean;
|
|
13
|
-
items: MultiSectionDigitalClockOption<
|
|
14
|
-
onChange: (value:
|
|
13
|
+
items: MultiSectionDigitalClockOption<TSectionValue>[];
|
|
14
|
+
onChange: (value: TSectionValue) => void;
|
|
15
15
|
active?: boolean;
|
|
16
16
|
skipDisabled?: boolean;
|
|
17
17
|
role?: string;
|
|
18
18
|
}
|
|
19
|
-
type MultiSectionDigitalClockSectionComponent = <
|
|
19
|
+
type MultiSectionDigitalClockSectionComponent = <TSectionValue extends number | string>(props: MultiSectionDigitalClockSectionProps<TSectionValue> & React.RefAttributes<HTMLUListElement>) => React.JSX.Element & {
|
|
20
20
|
propTypes?: any;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
@@ -5,10 +5,17 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["onAccept", "onClear", "onCancel", "onSetToday", "actions"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
8
9
|
import Button from '@mui/material/Button';
|
|
9
10
|
import DialogActions from '@mui/material/DialogActions';
|
|
10
11
|
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const PickersActionBarRoot = styled(DialogActions, {
|
|
14
|
+
name: 'MuiPickersLayout',
|
|
15
|
+
slot: 'ActionBar',
|
|
16
|
+
overridesResolver: (_, styles) => styles.actionBar
|
|
17
|
+
})({});
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
20
|
* Demos:
|
|
14
21
|
*
|
|
@@ -58,7 +65,7 @@ function PickersActionBar(props) {
|
|
|
58
65
|
return null;
|
|
59
66
|
}
|
|
60
67
|
});
|
|
61
|
-
return /*#__PURE__*/_jsx(
|
|
68
|
+
return /*#__PURE__*/_jsx(PickersActionBarRoot, _extends({}, other, {
|
|
62
69
|
children: buttons
|
|
63
70
|
}));
|
|
64
71
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "timezone", "format"],
|
|
5
|
+
const _excluded = ["slots", "slotProps", "currentMonth", "disabled", "disableFuture", "disablePast", "maxDate", "minDate", "onMonthChange", "onViewChange", "view", "reduceAnimations", "views", "labelId", "className", "classes", "timezone", "format"],
|
|
6
6
|
_excluded2 = ["ownerState"];
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -19,11 +19,9 @@ import { ArrowDropDownIcon } from "../icons/index.js";
|
|
|
19
19
|
import { PickersArrowSwitcher } from "../internals/components/PickersArrowSwitcher/index.js";
|
|
20
20
|
import { usePreviousMonthDisabled, useNextMonthDisabled } from "../internals/hooks/date-helpers-hooks.js";
|
|
21
21
|
import { getPickersCalendarHeaderUtilityClass, pickersCalendarHeaderClasses } from "./pickersCalendarHeaderClasses.js";
|
|
22
|
+
import { usePickerPrivateContext } from "../internals/hooks/usePickerPrivateContext.js";
|
|
22
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
-
const useUtilityClasses =
|
|
24
|
-
const {
|
|
25
|
-
classes
|
|
26
|
-
} = ownerState;
|
|
24
|
+
const useUtilityClasses = classes => {
|
|
27
25
|
const slots = {
|
|
28
26
|
root: ['root'],
|
|
29
27
|
labelContainer: ['labelContainer'],
|
|
@@ -132,12 +130,15 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
132
130
|
views,
|
|
133
131
|
labelId,
|
|
134
132
|
className,
|
|
133
|
+
classes: classesProp,
|
|
135
134
|
timezone,
|
|
136
135
|
format = `${utils.formats.month} ${utils.formats.year}`
|
|
137
136
|
} = props,
|
|
138
137
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
139
|
-
const
|
|
140
|
-
|
|
138
|
+
const {
|
|
139
|
+
ownerState
|
|
140
|
+
} = usePickerPrivateContext();
|
|
141
|
+
const classes = useUtilityClasses(classesProp);
|
|
141
142
|
const SwitchViewButton = slots?.switchViewButton ?? PickersCalendarHeaderSwitchViewButton;
|
|
142
143
|
const switchViewButtonProps = useSlotProps({
|
|
143
144
|
elementType: SwitchViewButton,
|
|
@@ -5,7 +5,7 @@ import SvgIcon from '@mui/material/SvgIcon';
|
|
|
5
5
|
import { SxProps, Theme } from '@mui/material/styles';
|
|
6
6
|
import { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps } from '../internals/components/PickersArrowSwitcher';
|
|
7
7
|
import { MonthValidationOptions } from '../internals/hooks/date-helpers-hooks';
|
|
8
|
-
import { PickerValidDate, DateView } from '../models';
|
|
8
|
+
import { PickerValidDate, DateView, PickerOwnerState } from '../models';
|
|
9
9
|
import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
|
|
10
10
|
import { PickersCalendarHeaderClasses } from './pickersCalendarHeaderClasses';
|
|
11
11
|
export interface PickersCalendarHeaderSlots extends PickersArrowSwitcherSlots {
|
|
@@ -22,10 +22,9 @@ export interface PickersCalendarHeaderSlots extends PickersArrowSwitcherSlots {
|
|
|
22
22
|
}
|
|
23
23
|
export interface PickersCalendarHeaderSlotPropsOverrides {
|
|
24
24
|
}
|
|
25
|
-
export type PickersCalendarHeaderOwnerState = PickersCalendarHeaderProps;
|
|
26
25
|
export interface PickersCalendarHeaderSlotProps extends PickersArrowSwitcherSlotProps {
|
|
27
|
-
switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderSlotPropsOverrides,
|
|
28
|
-
switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides,
|
|
26
|
+
switchViewButton?: SlotComponentProps<typeof IconButton, PickersCalendarHeaderSlotPropsOverrides, PickerOwnerState>;
|
|
27
|
+
switchViewIcon?: SlotComponentProps<typeof SvgIcon, PickersCalendarHeaderSlotPropsOverrides, PickerOwnerState>;
|
|
29
28
|
}
|
|
30
29
|
export interface PickersCalendarHeaderProps extends ExportedPickersArrowSwitcherProps, MonthValidationOptions {
|
|
31
30
|
/**
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { PickersLayoutProps } from './PickersLayout.types';
|
|
3
|
-
import { DateOrTimeViewWithMeridiem } from '../internals/models';
|
|
2
|
+
import { PickerLayoutOwnerState, PickersLayoutProps } from './PickersLayout.types';
|
|
3
|
+
import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../internals/models';
|
|
4
4
|
export declare const PickersLayoutRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
|
-
ownerState:
|
|
5
|
+
ownerState: PickerLayoutOwnerState;
|
|
6
6
|
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
7
|
-
export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme
|
|
8
|
-
|
|
7
|
+
export declare const PickersLayoutContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
8
|
+
ownerState: PickerLayoutOwnerState;
|
|
9
|
+
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
10
|
+
type PickersLayoutComponent = (<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: PickersLayoutProps<TValue, TView> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
9
11
|
propTypes?: any;
|
|
10
12
|
};
|
|
11
13
|
/**
|