@mui/x-date-pickers 7.0.0-alpha.3 → 7.0.0-alpha.5
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/AdapterLuxon/AdapterLuxon.d.ts +27 -27
- package/AdapterLuxon/AdapterLuxon.js +0 -1
- package/CHANGELOG.md +245 -0
- package/DateCalendar/DateCalendar.types.d.ts +6 -6
- package/DateCalendar/DayCalendar.d.ts +4 -4
- package/DateCalendar/index.d.ts +1 -1
- package/DateCalendar/useCalendarState.js +0 -1
- package/DateField/DateField.js +17 -50
- package/DateField/DateField.types.d.ts +5 -9
- package/DateField/useDateField.d.ts +2 -2
- package/DateField/useDateField.js +1 -5
- package/DatePicker/DatePicker.js +5 -1
- package/DatePicker/DatePicker.types.d.ts +6 -6
- package/DatePicker/index.d.ts +1 -1
- package/DatePicker/shared.d.ts +6 -6
- package/DateTimeField/DateTimeField.js +17 -50
- package/DateTimeField/DateTimeField.types.d.ts +5 -9
- package/DateTimeField/useDateTimeField.d.ts +2 -2
- package/DateTimeField/useDateTimeField.js +1 -5
- package/DateTimePicker/DateTimePicker.js +5 -1
- package/DateTimePicker/DateTimePicker.types.d.ts +6 -6
- package/DateTimePicker/index.d.ts +1 -1
- package/DateTimePicker/shared.d.ts +6 -6
- package/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +6 -6
- package/DesktopDatePicker/index.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
- package/DesktopDateTimePicker/index.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
- package/DesktopTimePicker/index.d.ts +1 -1
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/DigitalClock/index.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +7 -2
- package/MobileDatePicker/MobileDatePicker.types.d.ts +6 -6
- package/MobileDatePicker/index.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +6 -6
- package/MobileDateTimePicker/index.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +5 -1
- package/MobileTimePicker/MobileTimePicker.types.d.ts +6 -6
- package/MobileTimePicker/index.d.ts +1 -1
- package/MonthCalendar/MonthCalendar.js +0 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +3 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/MultiSectionDigitalClock/index.d.ts +1 -1
- package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +8 -8
- package/PickersCalendarHeader/index.d.ts +1 -1
- package/PickersLayout/PickersLayout.types.d.ts +6 -6
- package/PickersLayout/index.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
- package/StaticDatePicker/index.d.ts +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
- package/StaticDateTimePicker/index.d.ts +1 -1
- package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
- package/StaticTimePicker/index.d.ts +1 -1
- package/TimeClock/Clock.js +0 -1
- package/TimeClock/ClockPointer.js +0 -1
- package/TimeClock/TimeClock.types.d.ts +5 -5
- package/TimeClock/index.d.ts +1 -1
- package/TimeField/TimeField.js +17 -50
- package/TimeField/TimeField.types.d.ts +5 -9
- package/TimeField/useTimeField.d.ts +2 -2
- package/TimeField/useTimeField.js +1 -5
- package/TimePicker/TimePicker.js +5 -1
- package/TimePicker/TimePicker.types.d.ts +6 -6
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/shared.d.ts +5 -5
- package/YearCalendar/YearCalendar.js +0 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/useClearableField.d.ts +32 -20
- package/hooks/useClearableField.js +32 -33
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +9 -9
- package/internals/components/PickersArrowSwitcher/index.d.ts +3 -1
- package/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/internals/components/PickersModalDialog.d.ts +4 -4
- package/internals/components/PickersPopper.d.ts +4 -4
- package/internals/components/PickersTextField/Outline.d.ts +7 -1
- package/internals/components/PickersTextField/Outline.js +2 -4
- package/internals/components/PickersTextField/PickersInput.d.ts +1 -2
- package/internals/components/PickersTextField/PickersInput.js +117 -112
- package/internals/components/PickersTextField/PickersInput.types.d.ts +35 -20
- package/internals/components/PickersTextField/PickersTextField.js +57 -48
- package/internals/components/PickersTextField/PickersTextField.types.d.ts +19 -16
- package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +11 -7
- package/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/internals/constants/dimensions.d.ts +1 -1
- package/internals/constants/dimensions.js +1 -1
- package/internals/demo/DemoContainer.d.ts +4 -0
- package/internals/demo/DemoContainer.js +47 -19
- package/internals/hooks/useClockReferenceDate.js +0 -1
- package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +8 -8
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/useField.js +3 -3
- package/internals/hooks/useField/useField.types.d.ts +4 -24
- package/internals/hooks/useField/useField.utils.js +24 -6
- package/internals/hooks/useField/useFieldState.js +7 -3
- package/internals/hooks/useMobilePicker/index.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -7
- package/internals/hooks/useStaticPicker/index.d.ts +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -5
- package/internals/hooks/useViews.js +0 -1
- package/internals/index.d.ts +7 -6
- package/internals/index.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +3 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/legacy/AdapterLuxon/AdapterLuxon.js +0 -1
- package/legacy/DateCalendar/useCalendarState.js +0 -1
- package/legacy/DateField/DateField.js +19 -47
- package/legacy/DateField/useDateField.js +1 -4
- package/legacy/DatePicker/DatePicker.js +5 -1
- package/legacy/DateTimeField/DateTimeField.js +19 -47
- package/legacy/DateTimeField/useDateTimeField.js +1 -4
- package/legacy/DateTimePicker/DateTimePicker.js +5 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +7 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +5 -1
- package/legacy/MonthCalendar/MonthCalendar.js +0 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -1
- package/legacy/TimeClock/Clock.js +0 -1
- package/legacy/TimeClock/ClockPointer.js +0 -1
- package/legacy/TimeField/TimeField.js +19 -47
- package/legacy/TimeField/useTimeField.js +1 -4
- package/legacy/TimePicker/TimePicker.js +5 -1
- package/legacy/YearCalendar/YearCalendar.js +0 -1
- package/legacy/hooks/useClearableField.js +30 -32
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/legacy/internals/components/PickersTextField/Outline.js +1 -4
- package/legacy/internals/components/PickersTextField/PickersInput.js +119 -115
- package/legacy/internals/components/PickersTextField/PickersTextField.js +51 -51
- package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/legacy/internals/constants/dimensions.js +1 -1
- package/legacy/internals/demo/DemoContainer.js +45 -19
- package/legacy/internals/hooks/useClockReferenceDate.js +0 -1
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +4 -4
- package/legacy/internals/hooks/useField/useField.utils.js +26 -6
- package/legacy/internals/hooks/useField/useFieldState.js +7 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/legacy/internals/hooks/useViews.js +0 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +24 -0
- package/legacy/locales/plPL.js +0 -1
- package/legacy/locales/svSE.js +0 -1
- package/legacy/locales/urPK.js +0 -1
- package/locales/plPL.js +0 -1
- package/locales/svSE.js +0 -1
- package/locales/urPK.js +0 -1
- package/models/fields.d.ts +2 -1
- package/modern/AdapterLuxon/AdapterLuxon.js +0 -1
- package/modern/DateCalendar/useCalendarState.js +0 -1
- package/modern/DateField/DateField.js +17 -50
- package/modern/DateField/useDateField.js +1 -5
- package/modern/DatePicker/DatePicker.js +5 -1
- package/modern/DateTimeField/DateTimeField.js +17 -50
- package/modern/DateTimeField/useDateTimeField.js +1 -5
- package/modern/DateTimePicker/DateTimePicker.js +5 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +7 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +5 -1
- package/modern/MonthCalendar/MonthCalendar.js +0 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/TimeClock/Clock.js +0 -1
- package/modern/TimeClock/ClockPointer.js +0 -1
- package/modern/TimeField/TimeField.js +17 -50
- package/modern/TimeField/useTimeField.js +1 -5
- package/modern/TimePicker/TimePicker.js +5 -1
- package/modern/YearCalendar/YearCalendar.js +0 -1
- package/modern/hooks/useClearableField.js +32 -33
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/modern/internals/components/PickersTextField/Outline.js +2 -4
- package/modern/internals/components/PickersTextField/PickersInput.js +116 -112
- package/modern/internals/components/PickersTextField/PickersTextField.js +57 -47
- package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/modern/internals/constants/dimensions.js +1 -1
- package/modern/internals/demo/DemoContainer.js +47 -19
- package/modern/internals/hooks/useClockReferenceDate.js +0 -1
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +3 -3
- package/modern/internals/hooks/useField/useField.utils.js +24 -6
- package/modern/internals/hooks/useField/useFieldState.js +7 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/modern/internals/hooks/useViews.js +0 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/modern/locales/plPL.js +0 -1
- package/modern/locales/svSE.js +0 -1
- package/modern/locales/urPK.js +0 -1
- package/node/AdapterLuxon/AdapterLuxon.js +0 -1
- package/node/DateCalendar/useCalendarState.js +0 -1
- package/node/DateField/DateField.js +18 -51
- package/node/DateField/useDateField.js +1 -5
- package/node/DatePicker/DatePicker.js +5 -1
- package/node/DateTimeField/DateTimeField.js +18 -51
- package/node/DateTimeField/useDateTimeField.js +1 -5
- package/node/DateTimePicker/DateTimePicker.js +5 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +10 -5
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/node/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/node/MobileDatePicker/MobileDatePicker.js +10 -5
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/node/MobileTimePicker/MobileTimePicker.js +5 -1
- package/node/MonthCalendar/MonthCalendar.js +0 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/node/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/TimeClock/Clock.js +0 -1
- package/node/TimeClock/ClockPointer.js +0 -1
- package/node/TimeField/TimeField.js +18 -51
- package/node/TimeField/useTimeField.js +1 -5
- package/node/TimePicker/TimePicker.js +5 -1
- package/node/YearCalendar/YearCalendar.js +0 -1
- package/node/hooks/useClearableField.js +33 -34
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/index.js +14 -1
- package/node/internals/components/PickersTextField/Outline.js +2 -4
- package/node/internals/components/PickersTextField/PickersInput.js +119 -115
- package/node/internals/components/PickersTextField/PickersTextField.js +58 -48
- package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/node/internals/constants/dimensions.js +1 -1
- package/node/internals/demo/DemoContainer.js +47 -19
- package/node/internals/hooks/useClockReferenceDate.js +0 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +3 -3
- package/node/internals/hooks/useField/useField.utils.js +24 -6
- package/node/internals/hooks/useField/useFieldState.js +7 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/node/internals/hooks/useViews.js +0 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +34 -0
- package/node/locales/plPL.js +0 -1
- package/node/locales/svSE.js +0 -1
- package/node/locales/urPK.js +0 -1
- package/package.json +6 -6
- package/themeAugmentation/overrides.d.ts +5 -7
- package/themeAugmentation/props.d.ts +6 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["onFocus", "onBlur", "className", "color", "disabled", "error", "required", "variant", "InputProps", "inputProps", "inputRef", "sectionsContainerRef", "elements", "areAllSectionsEmpty", "onClick", "onKeyDown", "onKeyUp", "onPaste", "onInput", "endAdornment", "startAdornment", "tabIndex", "contentEditable", "focused", "value", "onChange", "fullWidth", "id", "helperText", "FormHelperTextProps", "label", "InputLabelProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
@@ -10,7 +10,7 @@ import InputLabel from '@mui/material/InputLabel';
|
|
|
10
10
|
import FormHelperText from '@mui/material/FormHelperText';
|
|
11
11
|
import FormControl from '@mui/material/FormControl';
|
|
12
12
|
import { getPickersTextFieldUtilityClass } from './pickersTextFieldClasses';
|
|
13
|
-
import PickersInput from './PickersInput';
|
|
13
|
+
import { PickersInput } from './PickersInput';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
const PickersTextFieldRoot = styled(FormControl, {
|
|
@@ -32,32 +32,46 @@ const useUtilityClasses = ownerState => {
|
|
|
32
32
|
};
|
|
33
33
|
export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField(props, ref) {
|
|
34
34
|
const {
|
|
35
|
-
|
|
35
|
+
// Props used by FormControl
|
|
36
|
+
onFocus,
|
|
37
|
+
onBlur,
|
|
36
38
|
className,
|
|
37
39
|
color = 'primary',
|
|
38
40
|
disabled = false,
|
|
39
41
|
error = false,
|
|
40
|
-
|
|
42
|
+
required = false,
|
|
41
43
|
variant = 'outlined',
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
// Props used by PickersInput
|
|
45
|
+
InputProps,
|
|
46
|
+
inputProps,
|
|
47
|
+
inputRef,
|
|
48
|
+
sectionsContainerRef,
|
|
49
|
+
elements,
|
|
50
|
+
areAllSectionsEmpty,
|
|
51
|
+
onClick,
|
|
52
|
+
onKeyDown,
|
|
53
|
+
onPaste,
|
|
54
|
+
onInput,
|
|
55
|
+
endAdornment,
|
|
56
|
+
startAdornment,
|
|
57
|
+
tabIndex,
|
|
58
|
+
contentEditable,
|
|
59
|
+
focused,
|
|
60
|
+
value,
|
|
61
|
+
onChange,
|
|
62
|
+
fullWidth,
|
|
63
|
+
id: idProp,
|
|
64
|
+
// Props used by FormHelperText
|
|
44
65
|
helperText,
|
|
45
|
-
valueType,
|
|
46
|
-
id: idOverride,
|
|
47
66
|
FormHelperTextProps,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
required = false,
|
|
52
|
-
focused: focusedProp
|
|
67
|
+
// Props used by InputLabel
|
|
68
|
+
label,
|
|
69
|
+
InputLabelProps
|
|
53
70
|
} = props,
|
|
54
71
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
55
|
-
const [focused, setFocused] = React.useState(focusedProp);
|
|
56
72
|
const rootRef = React.useRef(null);
|
|
57
73
|
const handleRootRef = useForkRef(ref, rootRef);
|
|
58
|
-
const
|
|
59
|
-
const handleInputRef = useForkRef(inputRef, InputProps?.ref);
|
|
60
|
-
const id = useId(idOverride);
|
|
74
|
+
const id = useId(idProp);
|
|
61
75
|
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
62
76
|
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
63
77
|
const ownerState = _extends({}, props, {
|
|
@@ -65,55 +79,51 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
65
79
|
disabled,
|
|
66
80
|
error,
|
|
67
81
|
focused,
|
|
82
|
+
required,
|
|
68
83
|
variant
|
|
69
84
|
});
|
|
70
85
|
const classes = useUtilityClasses(ownerState);
|
|
71
|
-
|
|
72
|
-
// TODO: delete after behavior implementation
|
|
73
|
-
const onWrapperClick = () => {
|
|
74
|
-
if (!focused) {
|
|
75
|
-
setFocused(true);
|
|
76
|
-
const container = rootRef.current;
|
|
77
|
-
|
|
78
|
-
// Find the first input element within the container
|
|
79
|
-
const firstInput = container?.querySelector('.content');
|
|
80
|
-
|
|
81
|
-
// Check if the input element exists before focusing it
|
|
82
|
-
if (firstInput) {
|
|
83
|
-
firstInput.focus();
|
|
84
|
-
}
|
|
85
|
-
inputRef.current?.focus();
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
return /*#__PURE__*/_jsxs(PickersTextFieldRoot, {
|
|
86
|
+
return /*#__PURE__*/_jsxs(PickersTextFieldRoot, _extends({
|
|
89
87
|
className: clsx(classes.root, className),
|
|
90
88
|
ref: handleRootRef,
|
|
91
89
|
focused: focused,
|
|
90
|
+
onFocus: onFocus,
|
|
91
|
+
onBlur: onBlur,
|
|
92
92
|
disabled: disabled,
|
|
93
93
|
variant: variant,
|
|
94
94
|
error: error,
|
|
95
95
|
color: color,
|
|
96
|
-
fullWidth: fullWidth,
|
|
97
96
|
required: required,
|
|
98
|
-
ownerState: ownerState
|
|
97
|
+
ownerState: ownerState
|
|
98
|
+
}, other, {
|
|
99
99
|
children: [/*#__PURE__*/_jsx(InputLabel, _extends({
|
|
100
100
|
htmlFor: id,
|
|
101
101
|
id: inputLabelId
|
|
102
102
|
}, InputLabelProps, {
|
|
103
103
|
children: label
|
|
104
104
|
})), /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
105
|
-
elements,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
105
|
+
elements: elements,
|
|
106
|
+
areAllSectionsEmpty: areAllSectionsEmpty,
|
|
107
|
+
onClick: onClick,
|
|
108
|
+
onKeyDown: onKeyDown,
|
|
109
|
+
onInput: onInput,
|
|
110
|
+
onPaste: onPaste,
|
|
111
|
+
endAdornment: endAdornment,
|
|
112
|
+
startAdornment: startAdornment,
|
|
113
|
+
tabIndex: tabIndex,
|
|
114
|
+
contentEditable: contentEditable,
|
|
115
|
+
value: value,
|
|
116
|
+
onChange: onChange,
|
|
117
|
+
id: id,
|
|
118
|
+
fullWidth: fullWidth,
|
|
119
|
+
inputProps: inputProps,
|
|
120
|
+
inputRef: inputRef,
|
|
121
|
+
sectionsContainerRef: sectionsContainerRef,
|
|
122
|
+
label: label
|
|
123
|
+
}, InputProps)), helperText && /*#__PURE__*/_jsx(FormHelperText, _extends({
|
|
114
124
|
id: helperTextId
|
|
115
125
|
}, FormHelperTextProps, {
|
|
116
126
|
children: helperText
|
|
117
127
|
}))]
|
|
118
|
-
});
|
|
128
|
+
}));
|
|
119
129
|
});
|
|
@@ -6,4 +6,4 @@ export const pickersTextFieldClasses = generateUtilityClasses('MuiPickersTextFie
|
|
|
6
6
|
export function getPickersInputUtilityClass(slot) {
|
|
7
7
|
return generateUtilityClass('MuiPickersInput', slot);
|
|
8
8
|
}
|
|
9
|
-
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', '
|
|
9
|
+
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', 'adornedStart', 'adornedEnd', 'input', 'sectionsContainer', 'sectionContent', 'sectionBefore', 'sectionAfter']);
|
|
@@ -2,6 +2,6 @@ export const DAY_SIZE = 36;
|
|
|
2
2
|
export const DAY_MARGIN = 2;
|
|
3
3
|
export const DIALOG_WIDTH = 320;
|
|
4
4
|
export const MAX_CALENDAR_HEIGHT = 280;
|
|
5
|
-
export const VIEW_HEIGHT =
|
|
5
|
+
export const VIEW_HEIGHT = 336;
|
|
6
6
|
export const DIGITAL_CLOCK_VIEW_HEIGHT = 232;
|
|
7
7
|
export const MULTI_SECTION_CLOCK_SECTION_WIDTH = 48;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import Stack from '@mui/material/Stack';
|
|
3
|
+
import Stack, { stackClasses } from '@mui/material/Stack';
|
|
4
4
|
import Typography from '@mui/material/Typography';
|
|
5
5
|
import { textFieldClasses } from '@mui/material/TextField';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -40,20 +40,20 @@ export function DemoItem(props) {
|
|
|
40
40
|
const {
|
|
41
41
|
label,
|
|
42
42
|
children,
|
|
43
|
-
component
|
|
43
|
+
component,
|
|
44
|
+
sx: sxProp
|
|
44
45
|
} = props;
|
|
45
46
|
let spacing;
|
|
46
|
-
let sx;
|
|
47
|
+
let sx = sxProp;
|
|
47
48
|
if (component && getChildTypeFromChildName(component) === 'multi-input-range-field') {
|
|
48
49
|
spacing = 1.5;
|
|
49
|
-
sx = {
|
|
50
|
+
sx = _extends({}, sx, {
|
|
50
51
|
[`& .${textFieldClasses.root}`]: {
|
|
51
52
|
flexGrow: 1
|
|
52
53
|
}
|
|
53
|
-
};
|
|
54
|
+
});
|
|
54
55
|
} else {
|
|
55
56
|
spacing = 1;
|
|
56
|
-
sx = undefined;
|
|
57
57
|
}
|
|
58
58
|
return /*#__PURE__*/_jsxs(Stack, {
|
|
59
59
|
direction: "column",
|
|
@@ -66,7 +66,14 @@ export function DemoItem(props) {
|
|
|
66
66
|
}), children]
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
DemoItem.displayName = 'DemoItem';
|
|
70
|
+
const isDemoItem = child => {
|
|
71
|
+
if ( /*#__PURE__*/React.isValidElement(child) && typeof child.type !== 'string') {
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
return child.type.displayName === 'DemoItem';
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
};
|
|
70
77
|
/**
|
|
71
78
|
* WARNING: This is an internal component used in documentation to achieve a desired layout.
|
|
72
79
|
* Please do not use it in your application.
|
|
@@ -91,7 +98,9 @@ export function DemoContainer(props) {
|
|
|
91
98
|
};
|
|
92
99
|
let direction;
|
|
93
100
|
let spacing;
|
|
94
|
-
let
|
|
101
|
+
let extraSx = {};
|
|
102
|
+
let demoItemSx = {};
|
|
103
|
+
const sx = _extends({
|
|
95
104
|
overflow: 'auto',
|
|
96
105
|
// Add padding as overflow can hide the outline text field label.
|
|
97
106
|
pt: 1
|
|
@@ -113,38 +122,57 @@ export function DemoContainer(props) {
|
|
|
113
122
|
// noop
|
|
114
123
|
} else if (childrenTypes.has('single-input-range-field')) {
|
|
115
124
|
if (!childrenSupportedSections.has('date-time')) {
|
|
116
|
-
|
|
125
|
+
extraSx = {
|
|
117
126
|
[`& > .${textFieldClasses.root}`]: {
|
|
118
127
|
minWidth: 300
|
|
119
128
|
}
|
|
120
|
-
}
|
|
129
|
+
};
|
|
121
130
|
} else {
|
|
122
|
-
|
|
131
|
+
extraSx = {
|
|
123
132
|
[`& > .${textFieldClasses.root}`]: {
|
|
124
133
|
minWidth: {
|
|
125
134
|
xs: 300,
|
|
126
|
-
|
|
135
|
+
// If demo also contains MultiInputDateTimeRangeField, increase width to avoid cutting off the value.
|
|
136
|
+
md: childrenTypes.has('multi-input-range-field') ? 460 : 400
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
|
-
}
|
|
139
|
+
};
|
|
130
140
|
}
|
|
131
141
|
} else if (childrenSupportedSections.has('date-time')) {
|
|
132
|
-
|
|
142
|
+
extraSx = {
|
|
133
143
|
[`& > .${textFieldClasses.root}`]: {
|
|
134
144
|
minWidth: 270
|
|
135
145
|
}
|
|
136
|
-
}
|
|
146
|
+
};
|
|
147
|
+
if (childrenTypes.has('multi-input-range-field')) {
|
|
148
|
+
// increase width for the multi input date time range fields
|
|
149
|
+
demoItemSx = {
|
|
150
|
+
[`& > .${stackClasses.root} > .${textFieldClasses.root}`]: {
|
|
151
|
+
minWidth: 210
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
137
155
|
} else {
|
|
138
|
-
|
|
156
|
+
extraSx = {
|
|
139
157
|
[`& > .${textFieldClasses.root}`]: {
|
|
140
158
|
minWidth: 200
|
|
141
159
|
}
|
|
142
|
-
}
|
|
160
|
+
};
|
|
143
161
|
}
|
|
162
|
+
const finalSx = _extends({}, sx, extraSx);
|
|
144
163
|
return /*#__PURE__*/_jsx(Stack, {
|
|
145
164
|
direction: direction,
|
|
146
165
|
spacing: spacing,
|
|
147
|
-
sx:
|
|
148
|
-
children: children
|
|
166
|
+
sx: finalSx,
|
|
167
|
+
children: React.Children.map(children, child => {
|
|
168
|
+
if ( /*#__PURE__*/React.isValidElement(child) && isDemoItem(child)) {
|
|
169
|
+
// Inject sx styles to the `DemoItem` if it is a direct child of `DemoContainer`.
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
172
|
+
sx: _extends({}, extraSx, demoItemSx)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return child;
|
|
176
|
+
})
|
|
149
177
|
});
|
|
150
178
|
}
|
|
@@ -36,6 +36,7 @@ export const useDesktopPicker = _ref => {
|
|
|
36
36
|
format,
|
|
37
37
|
formatDensity,
|
|
38
38
|
timezone,
|
|
39
|
+
name,
|
|
39
40
|
label,
|
|
40
41
|
inputRef,
|
|
41
42
|
readOnly,
|
|
@@ -103,6 +104,7 @@ export const useDesktopPicker = _ref => {
|
|
|
103
104
|
formatDensity,
|
|
104
105
|
timezone,
|
|
105
106
|
label,
|
|
107
|
+
name,
|
|
106
108
|
autoFocus: autoFocus && !props.open,
|
|
107
109
|
focused: open ? true : undefined
|
|
108
110
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["onClick", "onKeyDown", "onFocus", "onBlur", "onMouseUp", "onPaste", "error", "clearable", "onClear", "disabled"];
|
|
3
|
+
const _excluded = ["inputRef", "onClick", "onKeyDown", "onFocus", "onBlur", "onMouseUp", "onPaste", "error", "clearable", "onClear", "disabled"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
@@ -28,7 +28,6 @@ export const useField = params => {
|
|
|
28
28
|
timezone
|
|
29
29
|
} = useFieldState(params);
|
|
30
30
|
const {
|
|
31
|
-
inputRef: inputRefProp,
|
|
32
31
|
internalProps,
|
|
33
32
|
internalProps: {
|
|
34
33
|
readOnly = false,
|
|
@@ -36,6 +35,7 @@ export const useField = params => {
|
|
|
36
35
|
minutesStep
|
|
37
36
|
},
|
|
38
37
|
forwardedProps: {
|
|
38
|
+
inputRef: inputRefProp,
|
|
39
39
|
onClick,
|
|
40
40
|
onKeyDown,
|
|
41
41
|
onFocus,
|
|
@@ -427,7 +427,7 @@ export const useField = params => {
|
|
|
427
427
|
onMouseUp: handleInputMouseUp,
|
|
428
428
|
onClear: handleClearValue,
|
|
429
429
|
error: inputError,
|
|
430
|
-
|
|
430
|
+
inputRef: handleRef,
|
|
431
431
|
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly && !disabled)
|
|
432
432
|
});
|
|
433
433
|
};
|
|
@@ -125,7 +125,6 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
125
125
|
if (delta < 0 || isStart) {
|
|
126
126
|
newSectionValueNumber += step - (step + newSectionValueNumber) % step; // for JS -3 % 5 = -3 (should be 2)
|
|
127
127
|
}
|
|
128
|
-
|
|
129
128
|
if (delta > 0 || isEnd) {
|
|
130
129
|
newSectionValueNumber -= newSectionValueNumber % step;
|
|
131
130
|
}
|
|
@@ -193,7 +192,7 @@ export const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
|
193
192
|
|
|
194
193
|
// The ...InInput values consider the unicode characters but do include them in their indexes
|
|
195
194
|
const cleanedValue = cleanString(renderedValue);
|
|
196
|
-
const startInInput = positionInInput + renderedValue.indexOf(cleanedValue[0]) + section.startSeparator.length;
|
|
195
|
+
const startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
|
|
197
196
|
const endInInput = startInInput + cleanedValue.length;
|
|
198
197
|
newSections.push(_extends({}, section, {
|
|
199
198
|
start: position,
|
|
@@ -400,7 +399,6 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
400
399
|
const isTokenStartRegExp = new RegExp(`^(${Object.keys(utils.formatTokenMap).sort((a, b) => b.length - a.length) // Sort to put longest word first
|
|
401
400
|
.join('|')})`, 'g') // used to get access to lastIndex state
|
|
402
401
|
;
|
|
403
|
-
|
|
404
402
|
let currentTokenValue = '';
|
|
405
403
|
for (let i = 0; i < expandedFormat.length; i += 1) {
|
|
406
404
|
const escapedPartOfCurrentChar = escapedParts.find(escapeIndex => escapeIndex.start <= i && escapeIndex.end >= i);
|
|
@@ -427,6 +425,21 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
427
425
|
}
|
|
428
426
|
}
|
|
429
427
|
commitToken(currentTokenValue);
|
|
428
|
+
if (sections.length === 0 && startSeparator.length > 0) {
|
|
429
|
+
sections.push({
|
|
430
|
+
type: 'empty',
|
|
431
|
+
contentType: 'letter',
|
|
432
|
+
maxLength: null,
|
|
433
|
+
format: '',
|
|
434
|
+
value: '',
|
|
435
|
+
placeholder: '',
|
|
436
|
+
hasLeadingZerosInFormat: false,
|
|
437
|
+
hasLeadingZerosInInput: false,
|
|
438
|
+
startSeparator,
|
|
439
|
+
endSeparator: '',
|
|
440
|
+
modified: false
|
|
441
|
+
});
|
|
442
|
+
}
|
|
430
443
|
return sections.map(section => {
|
|
431
444
|
const cleanSeparator = separator => {
|
|
432
445
|
let cleanedSeparator = separator;
|
|
@@ -568,6 +581,10 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
568
581
|
meridiem: () => ({
|
|
569
582
|
minimum: 0,
|
|
570
583
|
maximum: 0
|
|
584
|
+
}),
|
|
585
|
+
empty: () => ({
|
|
586
|
+
minimum: 0,
|
|
587
|
+
maximum: 0
|
|
571
588
|
})
|
|
572
589
|
};
|
|
573
590
|
};
|
|
@@ -575,7 +592,7 @@ let warnedOnceInvalidSection = false;
|
|
|
575
592
|
export const validateSections = (sections, valueType) => {
|
|
576
593
|
if (process.env.NODE_ENV !== 'production') {
|
|
577
594
|
if (!warnedOnceInvalidSection) {
|
|
578
|
-
const supportedSections = [];
|
|
595
|
+
const supportedSections = ['empty'];
|
|
579
596
|
if (['date', 'date-time'].includes(valueType)) {
|
|
580
597
|
supportedSections.push('weekDay', 'day', 'month', 'year');
|
|
581
598
|
}
|
|
@@ -584,7 +601,7 @@ export const validateSections = (sections, valueType) => {
|
|
|
584
601
|
}
|
|
585
602
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
586
603
|
if (invalidSection) {
|
|
587
|
-
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type} date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
604
|
+
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
588
605
|
warnedOnceInvalidSection = true;
|
|
589
606
|
}
|
|
590
607
|
}
|
|
@@ -651,7 +668,8 @@ const reliableSectionModificationOrder = {
|
|
|
651
668
|
hours: 5,
|
|
652
669
|
minutes: 6,
|
|
653
670
|
seconds: 7,
|
|
654
|
-
meridiem: 8
|
|
671
|
+
meridiem: 8,
|
|
672
|
+
empty: 9
|
|
655
673
|
};
|
|
656
674
|
export const mergeDateIntoReferenceDate = (utils, timezone, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
|
|
657
675
|
// cloning sections before sort to avoid mutating it
|
|
@@ -94,17 +94,21 @@ export const useFieldState = params => {
|
|
|
94
94
|
if (typeof selectedSections === 'number') {
|
|
95
95
|
return {
|
|
96
96
|
startIndex: selectedSections,
|
|
97
|
-
endIndex: selectedSections
|
|
97
|
+
endIndex: selectedSections,
|
|
98
|
+
shouldSelectBoundarySelectors: state.sections[selectedSections].type === 'empty'
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
if (typeof selectedSections === 'string') {
|
|
101
102
|
const selectedSectionIndex = state.sections.findIndex(section => section.type === selectedSections);
|
|
102
103
|
return {
|
|
103
104
|
startIndex: selectedSectionIndex,
|
|
104
|
-
endIndex: selectedSectionIndex
|
|
105
|
+
endIndex: selectedSectionIndex,
|
|
106
|
+
shouldSelectBoundarySelectors: state.sections[selectedSectionIndex].type === 'empty'
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
|
-
return selectedSections
|
|
109
|
+
return _extends({}, selectedSections, {
|
|
110
|
+
shouldSelectBoundarySelectors: selectedSections.startIndex === selectedSections.endIndex && state.sections[selectedSections.startIndex].type === 'empty'
|
|
111
|
+
});
|
|
108
112
|
}, [selectedSections, state.sections]);
|
|
109
113
|
const publishValue = ({
|
|
110
114
|
value,
|
|
@@ -33,6 +33,7 @@ export const useMobilePicker = _ref => {
|
|
|
33
33
|
format,
|
|
34
34
|
formatDensity,
|
|
35
35
|
timezone,
|
|
36
|
+
name,
|
|
36
37
|
label,
|
|
37
38
|
inputRef,
|
|
38
39
|
readOnly,
|
|
@@ -73,7 +74,8 @@ export const useMobilePicker = _ref => {
|
|
|
73
74
|
format,
|
|
74
75
|
formatDensity,
|
|
75
76
|
timezone,
|
|
76
|
-
label
|
|
77
|
+
label,
|
|
78
|
+
name
|
|
77
79
|
}),
|
|
78
80
|
ownerState: props
|
|
79
81
|
});
|
|
@@ -60,7 +60,6 @@ export function useViews({
|
|
|
60
60
|
setFocusedView(prevFocusedView => viewToFocus === prevFocusedView ? null : prevFocusedView // If false the blur is due to view switching
|
|
61
61
|
);
|
|
62
62
|
}
|
|
63
|
-
|
|
64
63
|
onFocusedViewChange?.(viewToFocus, hasFocus);
|
|
65
64
|
});
|
|
66
65
|
const handleChangeView = useEventCallback(newView => {
|
|
@@ -16,6 +16,7 @@ export { useStaticPicker } from './hooks/useStaticPicker';
|
|
|
16
16
|
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow } from './hooks/useUtils';
|
|
17
17
|
export { useValidation } from './hooks/useValidation';
|
|
18
18
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
19
|
+
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
19
20
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate } from './utils/date-utils';
|
|
20
21
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
21
22
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["onPaste", "onKeyDown", "inputMode", "readOnly", "InputProps", "inputProps", "inputRef"];
|
|
4
|
+
export const convertFieldResponseIntoMuiTextFieldProps = fieldResponse => {
|
|
5
|
+
const {
|
|
6
|
+
onPaste,
|
|
7
|
+
onKeyDown,
|
|
8
|
+
inputMode,
|
|
9
|
+
readOnly,
|
|
10
|
+
InputProps,
|
|
11
|
+
inputProps,
|
|
12
|
+
inputRef
|
|
13
|
+
} = fieldResponse,
|
|
14
|
+
other = _objectWithoutPropertiesLoose(fieldResponse, _excluded);
|
|
15
|
+
return _extends({}, other, {
|
|
16
|
+
InputProps: _extends({}, InputProps ?? {}, {
|
|
17
|
+
readOnly
|
|
18
|
+
}),
|
|
19
|
+
inputProps: _extends({}, inputProps ?? {}, {
|
|
20
|
+
inputMode,
|
|
21
|
+
onPaste,
|
|
22
|
+
onKeyDown,
|
|
23
|
+
ref: inputRef
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
};
|
package/modern/locales/plPL.js
CHANGED
package/modern/locales/svSE.js
CHANGED
package/modern/locales/urPK.js
CHANGED
|
@@ -238,7 +238,6 @@ class AdapterLuxon {
|
|
|
238
238
|
if (typeof Intl === 'undefined' || typeof Intl.DateTimeFormat === 'undefined') {
|
|
239
239
|
return true; // Luxon defaults to en-US if Intl not found
|
|
240
240
|
}
|
|
241
|
-
|
|
242
241
|
return Boolean(new Intl.DateTimeFormat(this.locale, {
|
|
243
242
|
hour: 'numeric'
|
|
244
243
|
})?.resolvedOptions()?.hour12);
|