@mui/x-date-pickers 8.0.0-alpha.7 → 8.0.0-alpha.9
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/CHANGELOG.md +551 -3
- package/DateCalendar/DayCalendar.js +2 -0
- package/DateField/DateField.js +26 -31
- package/DateField/DateField.types.d.ts +6 -15
- package/DateField/useDateField.d.ts +1 -1
- package/DateField/useDateField.js +2 -1
- package/DateTimeField/DateTimeField.js +26 -31
- package/DateTimeField/DateTimeField.types.d.ts +6 -15
- package/DateTimeField/useDateTimeField.d.ts +1 -1
- package/DateTimeField/useDateTimeField.js +2 -1
- package/DesktopDatePicker/DesktopDatePicker.js +0 -11
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -12
- package/DesktopTimePicker/DesktopTimePicker.js +1 -12
- package/MobileDatePicker/MobileDatePicker.js +0 -9
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -9
- package/MobileTimePicker/MobileTimePicker.js +0 -9
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -0
- package/PickersCalendarHeader/PickersCalendarHeader.js +2 -0
- package/TimeClock/ClockPointer.js +2 -0
- package/TimeField/TimeField.js +25 -30
- package/TimeField/TimeField.types.d.ts +6 -15
- package/TimeField/useTimeField.d.ts +1 -1
- package/TimeField/useTimeField.js +2 -1
- package/hooks/useParsedFormat.d.ts +8 -6
- package/hooks/useParsedFormat.js +10 -12
- package/hooks/usePickerActionsContext.d.ts +1 -1
- package/hooks/usePickerContext.d.ts +4 -2
- package/hooks/usePickerContext.js +2 -1
- package/hooks/useSplitFieldProps.d.ts +12 -3
- package/hooks/useSplitFieldProps.js +8 -3
- package/index.js +1 -1
- package/internals/components/PickerFieldUI.d.ts +132 -0
- package/internals/components/PickerFieldUI.js +306 -0
- package/internals/components/PickerProvider.d.ts +25 -4
- package/internals/components/PickerProvider.js +11 -6
- package/internals/hooks/useDesktopPicker/useDesktopPicker.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -94
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +8 -31
- package/internals/hooks/useField/index.d.ts +3 -1
- package/internals/hooks/useField/index.js +3 -2
- package/internals/hooks/useField/useField.d.ts +1 -10
- package/internals/hooks/useField/useField.js +16 -19
- package/internals/hooks/useField/useField.types.d.ts +11 -4
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.d.ts +15 -0
- package/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/internals/hooks/useField/useFieldV6TextField.js +3 -0
- package/internals/hooks/useField/useFieldV7TextField.js +6 -3
- package/internals/hooks/useFieldOwnerState.d.ts +1 -2
- package/internals/hooks/useMobilePicker/useMobilePicker.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +20 -49
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +6 -14
- package/internals/hooks/useNullablePickerContext.d.ts +5 -0
- package/internals/hooks/useNullablePickerContext.js +10 -0
- package/internals/hooks/usePicker/usePicker.d.ts +1 -2
- package/internals/hooks/usePicker/usePicker.js +0 -3
- package/internals/hooks/usePicker/usePicker.types.d.ts +2 -3
- package/internals/hooks/usePicker/usePickerProvider.d.ts +8 -2
- package/internals/hooks/usePicker/usePickerProvider.js +22 -2
- package/internals/hooks/usePicker/usePickerValue.js +5 -11
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +5 -2
- package/internals/hooks/useUtils.d.ts +4 -3
- package/internals/index.d.ts +6 -3
- package/internals/index.js +1 -1
- package/internals/models/fields.d.ts +3 -16
- package/internals/models/manager.d.ts +3 -0
- package/internals/models/props/basePickerProps.d.ts +0 -12
- package/locales/utils/getPickersLocalization.d.ts +0 -7
- package/locales/utils/getPickersLocalization.js +0 -13
- package/managers/index.d.ts +3 -3
- package/managers/useDateManager.d.ts +1 -1
- package/managers/useDateManager.js +9 -1
- package/managers/useDateTimeManager.d.ts +1 -1
- package/managers/useDateTimeManager.js +9 -1
- package/managers/useTimeManager.d.ts +1 -1
- package/managers/useTimeManager.js +9 -1
- package/models/fields.d.ts +4 -4
- package/models/manager.d.ts +12 -3
- package/modern/DateCalendar/DayCalendar.js +2 -0
- package/modern/DateField/DateField.js +26 -31
- package/modern/DateField/useDateField.js +2 -1
- package/modern/DateTimeField/DateTimeField.js +26 -31
- package/modern/DateTimeField/useDateTimeField.js +2 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -11
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -12
- package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -12
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -9
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -9
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -9
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +2 -0
- package/modern/TimeClock/ClockPointer.js +2 -0
- package/modern/TimeField/TimeField.js +25 -30
- package/modern/TimeField/useTimeField.js +2 -1
- package/modern/hooks/useParsedFormat.js +10 -12
- package/modern/hooks/usePickerContext.js +2 -1
- package/modern/hooks/useSplitFieldProps.js +8 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerFieldUI.js +306 -0
- package/modern/internals/components/PickerProvider.js +11 -6
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +21 -94
- package/modern/internals/hooks/useField/index.js +3 -2
- package/modern/internals/hooks/useField/useField.js +16 -19
- package/modern/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +46 -0
- package/modern/internals/hooks/useField/useFieldV6TextField.js +3 -0
- package/modern/internals/hooks/useField/useFieldV7TextField.js +6 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +20 -49
- package/modern/internals/hooks/useNullablePickerContext.js +10 -0
- package/modern/internals/hooks/usePicker/usePicker.js +0 -3
- package/modern/internals/hooks/usePicker/usePickerProvider.js +22 -2
- package/modern/internals/hooks/usePicker/usePickerValue.js +5 -11
- package/modern/internals/index.js +1 -1
- package/modern/locales/utils/getPickersLocalization.js +0 -13
- package/modern/managers/useDateManager.js +9 -1
- package/modern/managers/useDateTimeManager.js +9 -1
- package/modern/managers/useTimeManager.js +9 -1
- package/node/DateCalendar/DayCalendar.js +1 -0
- package/node/DateField/DateField.js +26 -31
- package/node/DateField/useDateField.js +2 -1
- package/node/DateTimeField/DateTimeField.js +26 -31
- package/node/DateTimeField/useDateTimeField.js +2 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -11
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +1 -12
- package/node/DesktopTimePicker/DesktopTimePicker.js +1 -12
- package/node/MobileDatePicker/MobileDatePicker.js +0 -9
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -9
- package/node/MobileTimePicker/MobileTimePicker.js +0 -9
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +1 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +2 -0
- package/node/TimeClock/ClockPointer.js +1 -0
- package/node/TimeField/TimeField.js +25 -30
- package/node/TimeField/useTimeField.js +2 -1
- package/node/hooks/useParsedFormat.js +10 -12
- package/node/hooks/usePickerContext.js +4 -3
- package/node/hooks/useSplitFieldProps.js +7 -2
- package/node/index.js +1 -1
- package/node/internals/components/PickerFieldUI.js +318 -0
- package/node/internals/components/PickerProvider.js +13 -8
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +23 -96
- package/node/internals/hooks/useField/index.js +3 -2
- package/node/internals/hooks/useField/useField.js +17 -21
- package/node/internals/hooks/useField/useFieldInternalPropsWithDefaults.js +55 -0
- package/node/internals/hooks/useField/useFieldV6TextField.js +3 -0
- package/node/internals/hooks/useField/useFieldV7TextField.js +6 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +20 -49
- package/node/internals/hooks/useNullablePickerContext.js +16 -0
- package/node/internals/hooks/usePicker/usePicker.js +0 -3
- package/node/internals/hooks/usePicker/usePickerProvider.js +22 -2
- package/node/internals/hooks/usePicker/usePickerValue.js +5 -11
- package/node/internals/index.js +21 -3
- package/node/locales/utils/getPickersLocalization.js +2 -16
- package/node/managers/useDateManager.js +9 -1
- package/node/managers/useDateTimeManager.js +9 -1
- package/node/managers/useTimeManager.js +9 -1
- package/package.json +2 -2
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +0 -3
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -44
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +0 -52
|
@@ -23,7 +23,15 @@ export function useDateTimeManager(parameters = {}) {
|
|
|
23
23
|
internalProps,
|
|
24
24
|
utils,
|
|
25
25
|
defaultDates
|
|
26
|
-
}))
|
|
26
|
+
})),
|
|
27
|
+
internal_getOpenPickerButtonAriaLabel: ({
|
|
28
|
+
value,
|
|
29
|
+
utils,
|
|
30
|
+
localeText
|
|
31
|
+
}) => {
|
|
32
|
+
const formattedValue = utils.isValid(value) ? utils.format(value, 'fullDate') : null;
|
|
33
|
+
return localeText.openDatePickerDialogue(formattedValue);
|
|
34
|
+
}
|
|
27
35
|
}), [enableAccessibleFieldDOMStructure]);
|
|
28
36
|
}
|
|
29
37
|
|
|
@@ -15,7 +15,7 @@ export interface UseTimeManagerParameters<TEnableAccessibleFieldDOMStructure ext
|
|
|
15
15
|
enableAccessibleFieldDOMStructure?: TEnableAccessibleFieldDOMStructure;
|
|
16
16
|
}
|
|
17
17
|
export type UseTimeManagerReturnValue<TEnableAccessibleFieldDOMStructure extends boolean> = PickerManager<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError, TimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure>, TimeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure>>;
|
|
18
|
-
interface TimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, AmPmProps {
|
|
18
|
+
export interface TimeManagerFieldInternalProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, AmPmProps {
|
|
19
19
|
}
|
|
20
20
|
interface TimeManagerFieldInternalPropsWithDefaults<TEnableAccessibleFieldDOMStructure extends boolean> extends UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>, ValidateTimeProps {
|
|
21
21
|
}
|
|
@@ -20,7 +20,15 @@ export function useTimeManager(parameters = {}) {
|
|
|
20
20
|
}) => _extends({}, internalProps, getTimeFieldInternalPropsDefaults({
|
|
21
21
|
utils,
|
|
22
22
|
internalProps
|
|
23
|
-
}))
|
|
23
|
+
})),
|
|
24
|
+
internal_getOpenPickerButtonAriaLabel: ({
|
|
25
|
+
value,
|
|
26
|
+
utils,
|
|
27
|
+
localeText
|
|
28
|
+
}) => {
|
|
29
|
+
const formattedValue = utils.isValid(value) ? utils.format(value, 'fullTime') : null;
|
|
30
|
+
return localeText.openTimePickerDialogue(formattedValue);
|
|
31
|
+
}
|
|
24
32
|
}), [enableAccessibleFieldDOMStructure]);
|
|
25
33
|
}
|
|
26
34
|
|
package/models/fields.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
-
import type { ExportedUseClearableFieldProps, UseClearableFieldResponse } from '../hooks/useClearableField';
|
|
4
3
|
import type { ExportedPickersSectionListProps } from '../PickersSectionList';
|
|
5
4
|
import type { UseFieldInternalProps, UseFieldResponse } from '../internals/hooks/useField';
|
|
6
5
|
import type { PickersTextFieldProps } from '../PickersTextField';
|
|
7
6
|
import { BaseForwardedSingleInputFieldProps, FieldRangeSection, PickerRangeValue, PickerValidValue } from '../internals/models';
|
|
8
7
|
import { PickerOwnerState } from './pickers';
|
|
8
|
+
import type { ExportedPickerFieldUIProps } from '../internals/components/PickerFieldUI';
|
|
9
9
|
export type FieldSectionType = 'year' | 'month' | 'day' | 'weekDay' | 'hours' | 'minutes' | 'seconds' | 'meridiem' | 'empty';
|
|
10
10
|
export type FieldSectionContentType = 'digit' | 'digit-with-letter' | 'letter';
|
|
11
11
|
export interface FieldSection {
|
|
@@ -124,14 +124,14 @@ export interface FieldOwnerState extends PickerOwnerState {
|
|
|
124
124
|
/**
|
|
125
125
|
* Props the prop `slotProps.field` of a picker can receive.
|
|
126
126
|
*/
|
|
127
|
-
export type PickerFieldSlotProps<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean> =
|
|
127
|
+
export type PickerFieldSlotProps<TValue extends PickerValidValue, TEnableAccessibleFieldDOMStructure extends boolean> = ExportedPickerFieldUIProps & Pick<UseFieldInternalProps<TValue, TEnableAccessibleFieldDOMStructure, unknown>, 'shouldRespectLeadingZeros' | 'readOnly'> & React.HTMLAttributes<HTMLDivElement> & {
|
|
128
128
|
ref?: React.Ref<HTMLDivElement>;
|
|
129
129
|
};
|
|
130
130
|
/**
|
|
131
|
-
* Props the text field receives when used
|
|
131
|
+
* Props the text field receives when used inside a single input picker.
|
|
132
132
|
* Only contains what the MUI components are passing to the text field, not what users can pass using the `props.slotProps.field` and `props.slotProps.textField`.
|
|
133
133
|
*/
|
|
134
|
-
export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> =
|
|
134
|
+
export type BaseSingleInputPickersTextFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> = Omit<UseFieldResponse<TEnableAccessibleFieldDOMStructure, BaseForwardedSingleInputFieldProps>, 'slots' | 'slotProps' | 'clearable' | 'onClear' | 'openPickerButtonPosition' | 'clearButtonPosition' | 'openPickerAriaLabel'>;
|
|
135
135
|
/**
|
|
136
136
|
* Props the built-in text field component can receive.
|
|
137
137
|
*/
|
package/models/manager.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FieldValueManager, UseFieldInternalProps } from '../internals/hooks/useField';
|
|
2
2
|
import type { PickerValueManager } from '../internals/hooks/usePicker';
|
|
3
|
+
import type { UseLocalizationContextReturnValue } from '../internals/hooks/useUtils';
|
|
3
4
|
import type { PickerValidValue } from '../internals/models';
|
|
4
|
-
import type { MuiPickersAdapterContextValue } from '../LocalizationProvider/LocalizationProvider';
|
|
5
5
|
import type { Validator } from '../validation';
|
|
6
6
|
import type { PickerValueType } from './common';
|
|
7
7
|
/**
|
|
@@ -67,12 +67,21 @@ export interface PickerManager<TValue extends PickerValidValue, TEnableAccessibl
|
|
|
67
67
|
* - a default format to display the value in the field
|
|
68
68
|
* - some default validation props that are needed to validate the value (e.g: minDate, maxDate)
|
|
69
69
|
* This property is not part of the public API and should not be used directly.
|
|
70
|
-
* @param {ApplyDefaultsToFieldInternalPropsParameters} parameters The parameters to apply the defaults.
|
|
70
|
+
* @param {ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps>} parameters The parameters to apply the defaults.
|
|
71
71
|
* @returns {TFieldInternalPropsWithDefaults} The field internal props with the defaults applied.
|
|
72
72
|
*/
|
|
73
73
|
internal_applyDefaultsToFieldInternalProps: (parameters: ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps>) => TFieldInternalPropsWithDefaults;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the aria-label to apply on the button that opens the picker.
|
|
76
|
+
* @param {GetOpenPickerButtonAriaLabelParameters<TValue>} params The parameters to get the aria-label.
|
|
77
|
+
* @returns {string} The aria-label to apply on the button that opens the picker.
|
|
78
|
+
*/
|
|
79
|
+
internal_getOpenPickerButtonAriaLabel: (params: GetOpenPickerButtonAriaLabelParameters<TValue>) => string;
|
|
74
80
|
}
|
|
75
|
-
interface ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps extends {}> extends
|
|
81
|
+
interface ApplyDefaultsToFieldInternalPropsParameters<TFieldInternalProps extends {}> extends UseLocalizationContextReturnValue {
|
|
76
82
|
internalProps: TFieldInternalProps;
|
|
77
83
|
}
|
|
84
|
+
interface GetOpenPickerButtonAriaLabelParameters<TValue extends PickerValidValue> extends UseLocalizationContextReturnValue {
|
|
85
|
+
value: TValue;
|
|
86
|
+
}
|
|
78
87
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["parentProps", "day", "focusableDay", "selectedDays", "isDateDisabled", "currentMonthNumber", "isViewFocused"],
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["slots", "slotProps"
|
|
4
|
+
const _excluded = ["slots", "slotProps"];
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
|
-
import MuiTextField from '@mui/material/TextField';
|
|
9
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
|
-
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
8
|
import { refType } from '@mui/utils';
|
|
12
9
|
import { useDateField } from "./useDateField.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
-
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
10
|
+
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
|
+
import { CalendarIcon } from "../icons/index.js";
|
|
17
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
13
|
/**
|
|
19
14
|
* Demos:
|
|
@@ -32,33 +27,21 @@ const DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRe
|
|
|
32
27
|
});
|
|
33
28
|
const {
|
|
34
29
|
slots,
|
|
35
|
-
slotProps
|
|
36
|
-
InputProps,
|
|
37
|
-
inputProps
|
|
30
|
+
slotProps
|
|
38
31
|
} = themeProps,
|
|
39
32
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
externalSlotProps: slotProps?.textField,
|
|
45
|
-
externalForwardedProps: other,
|
|
46
|
-
additionalProps: {
|
|
47
|
-
ref: inRef
|
|
48
|
-
},
|
|
49
|
-
ownerState
|
|
33
|
+
const textFieldProps = useFieldTextFieldProps({
|
|
34
|
+
slotProps,
|
|
35
|
+
ref: inRef,
|
|
36
|
+
externalForwardedProps: other
|
|
50
37
|
});
|
|
51
|
-
|
|
52
|
-
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
53
|
-
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
54
|
-
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
55
38
|
const fieldResponse = useDateField(textFieldProps);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
40
|
+
slots: slots,
|
|
41
|
+
slotProps: slotProps,
|
|
42
|
+
fieldResponse: fieldResponse,
|
|
43
|
+
defaultOpenPickerIcon: CalendarIcon
|
|
44
|
+
});
|
|
62
45
|
});
|
|
63
46
|
process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
64
47
|
// ----------------------------- Warning --------------------------------
|
|
@@ -76,6 +59,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
76
59
|
* @default false
|
|
77
60
|
*/
|
|
78
61
|
clearable: PropTypes.bool,
|
|
62
|
+
/**
|
|
63
|
+
* The position at which the clear button is placed.
|
|
64
|
+
* If the field is not clearable, the button is not rendered.
|
|
65
|
+
* @default 'end'
|
|
66
|
+
*/
|
|
67
|
+
clearButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
79
68
|
/**
|
|
80
69
|
* The color of the component.
|
|
81
70
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -219,6 +208,12 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
219
208
|
* @param {FieldSelectedSections} newValue The new selected sections.
|
|
220
209
|
*/
|
|
221
210
|
onSelectedSectionsChange: PropTypes.func,
|
|
211
|
+
/**
|
|
212
|
+
* The position at which the opening button is placed.
|
|
213
|
+
* If there is no picker to open, the button is not rendered
|
|
214
|
+
* @default 'end'
|
|
215
|
+
*/
|
|
216
|
+
openPickerButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
222
217
|
/**
|
|
223
218
|
* If `true`, the component is read-only.
|
|
224
219
|
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
@@ -19,6 +19,7 @@ export const useDateField = props => {
|
|
|
19
19
|
valueManager: manager.internal_valueManager,
|
|
20
20
|
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
21
|
validator: manager.validator,
|
|
22
|
-
valueType: manager.valueType
|
|
22
|
+
valueType: manager.valueType,
|
|
23
|
+
getOpenPickerButtonAriaLabel: manager.internal_getOpenPickerButtonAriaLabel
|
|
23
24
|
});
|
|
24
25
|
};
|
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["slots", "slotProps"
|
|
4
|
+
const _excluded = ["slots", "slotProps"];
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import PropTypes from 'prop-types';
|
|
8
|
-
import MuiTextField from '@mui/material/TextField';
|
|
9
7
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
|
-
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
8
|
import { refType } from '@mui/utils';
|
|
12
9
|
import { useDateTimeField } from "./useDateTimeField.js";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
-
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
10
|
+
import { PickerFieldUI, useFieldTextFieldProps } from "../internals/components/PickerFieldUI.js";
|
|
11
|
+
import { CalendarIcon } from "../icons/index.js";
|
|
17
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
13
|
/**
|
|
19
14
|
* Demos:
|
|
@@ -32,33 +27,21 @@ const DateTimeField = /*#__PURE__*/React.forwardRef(function DateTimeField(inPro
|
|
|
32
27
|
});
|
|
33
28
|
const {
|
|
34
29
|
slots,
|
|
35
|
-
slotProps
|
|
36
|
-
InputProps,
|
|
37
|
-
inputProps
|
|
30
|
+
slotProps
|
|
38
31
|
} = themeProps,
|
|
39
32
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
externalSlotProps: slotProps?.textField,
|
|
45
|
-
externalForwardedProps: other,
|
|
46
|
-
ownerState,
|
|
47
|
-
additionalProps: {
|
|
48
|
-
ref: inRef
|
|
49
|
-
}
|
|
33
|
+
const textFieldProps = useFieldTextFieldProps({
|
|
34
|
+
slotProps,
|
|
35
|
+
ref: inRef,
|
|
36
|
+
externalForwardedProps: other
|
|
50
37
|
});
|
|
51
|
-
|
|
52
|
-
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
53
|
-
textFieldProps.inputProps = _extends({}, inputProps, textFieldProps.inputProps);
|
|
54
|
-
textFieldProps.InputProps = _extends({}, InputProps, textFieldProps.InputProps);
|
|
55
38
|
const fieldResponse = useDateTimeField(textFieldProps);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
return /*#__PURE__*/_jsx(PickerFieldUI, {
|
|
40
|
+
slots: slots,
|
|
41
|
+
slotProps: slotProps,
|
|
42
|
+
fieldResponse: fieldResponse,
|
|
43
|
+
defaultOpenPickerIcon: CalendarIcon
|
|
44
|
+
});
|
|
62
45
|
});
|
|
63
46
|
process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
64
47
|
// ----------------------------- Warning --------------------------------
|
|
@@ -81,6 +64,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
81
64
|
* @default false
|
|
82
65
|
*/
|
|
83
66
|
clearable: PropTypes.bool,
|
|
67
|
+
/**
|
|
68
|
+
* The position at which the clear button is placed.
|
|
69
|
+
* If the field is not clearable, the button is not rendered.
|
|
70
|
+
* @default 'end'
|
|
71
|
+
*/
|
|
72
|
+
clearButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
84
73
|
/**
|
|
85
74
|
* The color of the component.
|
|
86
75
|
* It supports both default and custom theme colors, which can be added as shown in the
|
|
@@ -252,6 +241,12 @@ process.env.NODE_ENV !== "production" ? DateTimeField.propTypes = {
|
|
|
252
241
|
* @param {FieldSelectedSections} newValue The new selected sections.
|
|
253
242
|
*/
|
|
254
243
|
onSelectedSectionsChange: PropTypes.func,
|
|
244
|
+
/**
|
|
245
|
+
* The position at which the opening button is placed.
|
|
246
|
+
* If there is no picker to open, the button is not rendered
|
|
247
|
+
* @default 'end'
|
|
248
|
+
*/
|
|
249
|
+
openPickerButtonPosition: PropTypes.oneOf(['end', 'start']),
|
|
255
250
|
/**
|
|
256
251
|
* If `true`, the component is read-only.
|
|
257
252
|
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
@@ -19,6 +19,7 @@ export const useDateTimeField = props => {
|
|
|
19
19
|
valueManager: manager.internal_valueManager,
|
|
20
20
|
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
21
|
validator: manager.validator,
|
|
22
|
-
valueType: manager.valueType
|
|
22
|
+
valueType: manager.valueType,
|
|
23
|
+
getOpenPickerButtonAriaLabel: manager.internal_getOpenPickerButtonAriaLabel
|
|
23
24
|
});
|
|
24
25
|
};
|
|
@@ -7,15 +7,12 @@ import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
|
7
7
|
import { refType } from '@mui/utils';
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { useDatePickerDefaultizedProps } from "../DatePicker/shared.js";
|
|
10
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
11
10
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
12
11
|
import { validateDate, extractValidationProps } from "../validation/index.js";
|
|
13
12
|
import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
|
|
14
|
-
import { CalendarIcon } from "../icons/index.js";
|
|
15
13
|
import { DateField } from "../DateField/index.js";
|
|
16
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
17
15
|
import { resolveDateFormat } from "../internals/utils/date-utils.js";
|
|
18
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
19
16
|
const emptyActions = [];
|
|
20
17
|
|
|
21
18
|
/**
|
|
@@ -29,7 +26,6 @@ const emptyActions = [];
|
|
|
29
26
|
* - [DesktopDatePicker API](https://mui.com/x/api/date-pickers/desktop-date-picker/)
|
|
30
27
|
*/
|
|
31
28
|
const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePicker(inProps, ref) {
|
|
32
|
-
const translations = usePickerTranslations();
|
|
33
29
|
const utils = useUtils();
|
|
34
30
|
|
|
35
31
|
// Props with the default values common to all date pickers
|
|
@@ -47,7 +43,6 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
47
43
|
format: resolveDateFormat(utils, defaultizedProps, false),
|
|
48
44
|
yearsPerRow: defaultizedProps.yearsPerRow ?? 4,
|
|
49
45
|
slots: _extends({
|
|
50
|
-
openPickerIcon: CalendarIcon,
|
|
51
46
|
field: DateField
|
|
52
47
|
}, defaultizedProps.slots),
|
|
53
48
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
@@ -68,12 +63,6 @@ const DesktopDatePicker = /*#__PURE__*/React.forwardRef(function DesktopDatePick
|
|
|
68
63
|
props,
|
|
69
64
|
valueManager: singleItemValueManager,
|
|
70
65
|
valueType: 'date',
|
|
71
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
72
|
-
utils,
|
|
73
|
-
formatKey: 'fullDate',
|
|
74
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
75
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
76
|
-
}),
|
|
77
66
|
validator: validateDate
|
|
78
67
|
});
|
|
79
68
|
return renderPicker();
|
|
@@ -12,10 +12,8 @@ import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
|
12
12
|
import { DateTimeField } from "../DateTimeField/index.js";
|
|
13
13
|
import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
|
|
14
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/dateViewRenderers.js";
|
|
15
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
16
15
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
17
16
|
import { validateDateTime, extractValidationProps } from "../validation/index.js";
|
|
18
|
-
import { CalendarIcon } from "../icons/index.js";
|
|
19
17
|
import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
|
|
20
18
|
import { resolveDateTimeFormat, resolveTimeViewsResponse } from "../internals/utils/date-time-utils.js";
|
|
21
19
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "../timeViewRenderers/index.js";
|
|
@@ -25,7 +23,6 @@ import { DesktopDateTimePickerLayout } from "./DesktopDateTimePickerLayout.js";
|
|
|
25
23
|
import { VIEW_HEIGHT } from "../internals/constants/dimensions.js";
|
|
26
24
|
import { isInternalTimeView } from "../internals/utils/time-utils.js";
|
|
27
25
|
import { isDatePickerView } from "../internals/utils/date-utils.js";
|
|
28
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
29
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
30
27
|
const rendererInterceptor = function RendererInterceptor(props) {
|
|
31
28
|
const {
|
|
@@ -90,7 +87,6 @@ const rendererInterceptor = function RendererInterceptor(props) {
|
|
|
90
87
|
* - [DesktopDateTimePicker API](https://mui.com/x/api/date-pickers/desktop-date-time-picker/)
|
|
91
88
|
*/
|
|
92
89
|
const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDateTimePicker(inProps, ref) {
|
|
93
|
-
const translations = usePickerTranslations();
|
|
94
90
|
const utils = useUtils();
|
|
95
91
|
|
|
96
92
|
// Props with the default values common to all date time pickers
|
|
@@ -128,8 +124,7 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
128
124
|
shouldRenderTimeInASingleColumn,
|
|
129
125
|
slots: _extends({
|
|
130
126
|
field: DateTimeField,
|
|
131
|
-
layout: DesktopDateTimePickerLayout
|
|
132
|
-
openPickerIcon: CalendarIcon
|
|
127
|
+
layout: DesktopDateTimePickerLayout
|
|
133
128
|
}, defaultizedProps.slots),
|
|
134
129
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
135
130
|
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
@@ -150,12 +145,6 @@ const DesktopDateTimePicker = /*#__PURE__*/React.forwardRef(function DesktopDate
|
|
|
150
145
|
props,
|
|
151
146
|
valueManager: singleItemValueManager,
|
|
152
147
|
valueType: 'date-time',
|
|
153
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
154
|
-
utils,
|
|
155
|
-
formatKey: 'fullDate',
|
|
156
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
157
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
158
|
-
}),
|
|
159
148
|
validator: validateDateTime,
|
|
160
149
|
rendererInterceptor
|
|
161
150
|
});
|
|
@@ -8,15 +8,12 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { TimeField } from "../TimeField/index.js";
|
|
10
10
|
import { useTimePickerDefaultizedProps } from "../TimePicker/shared.js";
|
|
11
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
11
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
12
|
import { extractValidationProps, validateTime } from "../validation/index.js";
|
|
14
|
-
import { ClockIcon } from "../icons/index.js";
|
|
15
13
|
import { useDesktopPicker } from "../internals/hooks/useDesktopPicker/index.js";
|
|
16
14
|
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from "../timeViewRenderers/index.js";
|
|
17
15
|
import { resolveTimeFormat } from "../internals/utils/time-utils.js";
|
|
18
16
|
import { resolveTimeViewsResponse } from "../internals/utils/date-time-utils.js";
|
|
19
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
20
17
|
/**
|
|
21
18
|
* Demos:
|
|
22
19
|
*
|
|
@@ -28,7 +25,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
28
25
|
* - [DesktopTimePicker API](https://mui.com/x/api/date-pickers/desktop-time-picker/)
|
|
29
26
|
*/
|
|
30
27
|
const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePicker(inProps, ref) {
|
|
31
|
-
const translations = usePickerTranslations();
|
|
32
28
|
const utils = useUtils();
|
|
33
29
|
|
|
34
30
|
// Props with the default values common to all time pickers
|
|
@@ -60,8 +56,7 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
|
|
|
60
56
|
// Allows for easy view lifecycle management
|
|
61
57
|
views: shouldRenderTimeInASingleColumn ? ['hours'] : views,
|
|
62
58
|
slots: _extends({
|
|
63
|
-
field: TimeField
|
|
64
|
-
openPickerIcon: ClockIcon
|
|
59
|
+
field: TimeField
|
|
65
60
|
}, defaultizedProps.slots),
|
|
66
61
|
slotProps: _extends({}, defaultizedProps.slotProps, {
|
|
67
62
|
field: ownerState => _extends({}, resolveComponentProps(defaultizedProps.slotProps?.field, ownerState), extractValidationProps(defaultizedProps), {
|
|
@@ -79,12 +74,6 @@ const DesktopTimePicker = /*#__PURE__*/React.forwardRef(function DesktopTimePick
|
|
|
79
74
|
props,
|
|
80
75
|
valueManager: singleItemValueManager,
|
|
81
76
|
valueType: 'time',
|
|
82
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
83
|
-
utils,
|
|
84
|
-
formatKey: 'fullTime',
|
|
85
|
-
contextTranslation: translations.openTimePickerDialogue,
|
|
86
|
-
propsTranslation: props.localeText?.openTimePickerDialogue
|
|
87
|
-
}),
|
|
88
77
|
validator: validateTime
|
|
89
78
|
});
|
|
90
79
|
return renderPicker();
|
|
@@ -7,14 +7,12 @@ import resolveComponentProps from '@mui/utils/resolveComponentProps';
|
|
|
7
7
|
import { refType } from '@mui/utils';
|
|
8
8
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
9
9
|
import { useDatePickerDefaultizedProps } from "../DatePicker/shared.js";
|
|
10
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
11
10
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
12
11
|
import { extractValidationProps, validateDate } from "../validation/index.js";
|
|
13
12
|
import { DateField } from "../DateField/index.js";
|
|
14
13
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
15
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
16
15
|
import { resolveDateFormat } from "../internals/utils/date-utils.js";
|
|
17
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
18
16
|
/**
|
|
19
17
|
* Demos:
|
|
20
18
|
*
|
|
@@ -26,7 +24,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
26
24
|
* - [MobileDatePicker API](https://mui.com/x/api/date-pickers/mobile-date-picker/)
|
|
27
25
|
*/
|
|
28
26
|
const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker(inProps, ref) {
|
|
29
|
-
const translations = usePickerTranslations();
|
|
30
27
|
const utils = useUtils();
|
|
31
28
|
|
|
32
29
|
// Props with the default values common to all date pickers
|
|
@@ -59,12 +56,6 @@ const MobileDatePicker = /*#__PURE__*/React.forwardRef(function MobileDatePicker
|
|
|
59
56
|
props,
|
|
60
57
|
valueManager: singleItemValueManager,
|
|
61
58
|
valueType: 'date',
|
|
62
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
63
|
-
utils,
|
|
64
|
-
formatKey: 'fullDate',
|
|
65
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
66
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
67
|
-
}),
|
|
68
59
|
validator: validateDate
|
|
69
60
|
});
|
|
70
61
|
return renderPicker();
|
|
@@ -8,14 +8,12 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { DateTimeField } from "../DateTimeField/index.js";
|
|
10
10
|
import { useDateTimePickerDefaultizedProps } from "../DateTimePicker/shared.js";
|
|
11
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
11
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
12
|
import { extractValidationProps, validateDateTime } from "../validation/index.js";
|
|
14
13
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
15
14
|
import { renderDateViewCalendar } from "../dateViewRenderers/index.js";
|
|
16
15
|
import { renderTimeViewClock } from "../timeViewRenderers/index.js";
|
|
17
16
|
import { resolveDateTimeFormat } from "../internals/utils/date-time-utils.js";
|
|
18
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
19
17
|
/**
|
|
20
18
|
* Demos:
|
|
21
19
|
*
|
|
@@ -27,7 +25,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
27
25
|
* - [MobileDateTimePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-picker/)
|
|
28
26
|
*/
|
|
29
27
|
const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(inProps, ref) {
|
|
30
|
-
const translations = usePickerTranslations();
|
|
31
28
|
const utils = useUtils();
|
|
32
29
|
|
|
33
30
|
// Props with the default values common to all date time pickers
|
|
@@ -69,12 +66,6 @@ const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTi
|
|
|
69
66
|
props,
|
|
70
67
|
valueManager: singleItemValueManager,
|
|
71
68
|
valueType: 'date-time',
|
|
72
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
73
|
-
utils,
|
|
74
|
-
formatKey: 'fullDate',
|
|
75
|
-
contextTranslation: translations.openDatePickerDialogue,
|
|
76
|
-
propsTranslation: props.localeText?.openDatePickerDialogue
|
|
77
|
-
}),
|
|
78
69
|
validator: validateDateTime
|
|
79
70
|
});
|
|
80
71
|
return renderPicker();
|
|
@@ -8,13 +8,11 @@ import { refType } from '@mui/utils';
|
|
|
8
8
|
import { singleItemValueManager } from "../internals/utils/valueManagers.js";
|
|
9
9
|
import { TimeField } from "../TimeField/index.js";
|
|
10
10
|
import { useTimePickerDefaultizedProps } from "../TimePicker/shared.js";
|
|
11
|
-
import { usePickerTranslations } from "../hooks/usePickerTranslations.js";
|
|
12
11
|
import { useUtils } from "../internals/hooks/useUtils.js";
|
|
13
12
|
import { extractValidationProps, validateTime } from "../validation/index.js";
|
|
14
13
|
import { useMobilePicker } from "../internals/hooks/useMobilePicker/index.js";
|
|
15
14
|
import { renderTimeViewClock } from "../timeViewRenderers/index.js";
|
|
16
15
|
import { resolveTimeFormat } from "../internals/utils/time-utils.js";
|
|
17
|
-
import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalization.js";
|
|
18
16
|
/**
|
|
19
17
|
* Demos:
|
|
20
18
|
*
|
|
@@ -26,7 +24,6 @@ import { buildGetOpenDialogAriaText } from "../locales/utils/getPickersLocalizat
|
|
|
26
24
|
* - [MobileTimePicker API](https://mui.com/x/api/date-pickers/mobile-time-picker/)
|
|
27
25
|
*/
|
|
28
26
|
const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker(inProps, ref) {
|
|
29
|
-
const translations = usePickerTranslations();
|
|
30
27
|
const utils = useUtils();
|
|
31
28
|
|
|
32
29
|
// Props with the default values common to all time pickers
|
|
@@ -62,12 +59,6 @@ const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker
|
|
|
62
59
|
props,
|
|
63
60
|
valueManager: singleItemValueManager,
|
|
64
61
|
valueType: 'time',
|
|
65
|
-
getOpenDialogAriaText: buildGetOpenDialogAriaText({
|
|
66
|
-
utils,
|
|
67
|
-
formatKey: 'fullTime',
|
|
68
|
-
contextTranslation: translations.openTimePickerDialogue,
|
|
69
|
-
propsTranslation: props.localeText?.openTimePickerDialogue
|
|
70
|
-
}),
|
|
71
62
|
validator: validateTime
|
|
72
63
|
});
|
|
73
64
|
return renderPicker();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["autoFocus", "onChange", "className", "classes", "disabled", "readOnly", "items", "active", "slots", "slotProps", "skipDisabled"];
|
|
@@ -215,6 +215,8 @@ const PickersCalendarHeader = /*#__PURE__*/React.forwardRef(function PickersCale
|
|
|
215
215
|
}))]
|
|
216
216
|
}), /*#__PURE__*/_jsx(Fade, {
|
|
217
217
|
in: view === 'day',
|
|
218
|
+
appear: !reduceAnimations,
|
|
219
|
+
enter: !reduceAnimations,
|
|
218
220
|
children: /*#__PURE__*/_jsx(PickersArrowSwitcher, {
|
|
219
221
|
slots: slots,
|
|
220
222
|
slotProps: slotProps,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["className", "classes", "isBetweenTwoClockValues", "isInner", "type", "viewValue"];
|