@mui/x-date-pickers 7.0.0-alpha.4 → 7.0.0-alpha.6
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 +342 -0
- package/DateCalendar/DateCalendar.types.d.ts +6 -6
- package/DateCalendar/DayCalendar.d.ts +4 -4
- package/DateCalendar/index.d.ts +1 -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/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +3 -3
- package/MultiSectionDigitalClock/index.d.ts +1 -1
- 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/PickersSectionList/PickersSectionList.d.ts +11 -0
- package/PickersSectionList/PickersSectionList.js +223 -0
- package/PickersSectionList/PickersSectionList.types.d.ts +56 -0
- package/PickersSectionList/index.d.ts +4 -0
- package/PickersSectionList/index.js +2 -0
- package/PickersSectionList/package.json +6 -0
- package/PickersSectionList/pickersSectionListClasses.d.ts +11 -0
- package/PickersSectionList/pickersSectionListClasses.js +6 -0
- 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/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/hooks/index.d.ts +1 -0
- package/hooks/useClearableField.d.ts +32 -20
- package/hooks/useClearableField.js +32 -33
- package/index.d.ts +1 -0
- package/index.js +4 -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/{PickersTextField → PickersInput}/Outline.d.ts +1 -0
- package/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/internals/components/PickersInput/PickersFilledInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersFilledInput.js +166 -0
- package/internals/components/PickersInput/PickersInput.d.ts +15 -0
- package/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
- package/internals/components/PickersInput/PickersInput.types.d.ts +60 -0
- package/internals/components/PickersInput/PickersOutlinedInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
- package/internals/components/PickersInput/PickersStandardInput.d.ts +3 -0
- package/internals/components/PickersInput/PickersStandardInput.js +123 -0
- package/internals/components/PickersInput/index.d.ts +4 -0
- package/internals/components/PickersInput/index.js +3 -0
- package/internals/components/PickersInput/pickersInputClasses.d.ts +84 -0
- package/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/internals/components/PickersModalDialog.d.ts +4 -4
- package/internals/components/PickersPopper.d.ts +4 -4
- package/internals/components/PickersTextField/PickersTextField.d.ts +1 -2
- package/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/internals/components/PickersTextField/PickersTextField.types.d.ts +46 -3
- package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +0 -31
- package/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- 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 +11 -4
- package/internals/hooks/useField/useField.types.d.ts +4 -24
- package/internals/hooks/useField/useField.utils.js +24 -4
- 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/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/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/PickersSectionList/PickersSectionList.js +230 -0
- package/legacy/PickersSectionList/index.js +2 -0
- package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -1
- package/legacy/TimeField/TimeField.js +19 -47
- package/legacy/TimeField/useTimeField.js +1 -4
- package/legacy/TimePicker/TimePicker.js +5 -1
- package/legacy/hooks/useClearableField.js +30 -32
- package/legacy/index.js +4 -1
- package/legacy/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/legacy/internals/components/{PickersTextField → PickersInput}/Outline.js +40 -22
- package/legacy/internals/components/PickersInput/PickersFilledInput.js +161 -0
- package/legacy/internals/components/{PickersTextField → PickersInput}/PickersInput.js +75 -90
- package/legacy/internals/components/PickersInput/PickersInput.types.js +1 -0
- package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +110 -0
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +117 -0
- package/legacy/internals/components/PickersInput/index.js +3 -0
- package/legacy/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/legacy/internals/components/PickersTextField/PickersTextField.js +16 -7
- package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +12 -5
- package/legacy/internals/hooks/useField/useField.utils.js +26 -4
- package/legacy/internals/hooks/useField/useFieldState.js +7 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +24 -0
- package/legacy/locales/ruRU.js +1 -2
- package/locales/ruRU.js +1 -2
- package/models/fields.d.ts +2 -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/PickersSectionList/PickersSectionList.js +221 -0
- package/modern/PickersSectionList/PickersSectionList.types.js +1 -0
- package/modern/PickersSectionList/index.js +2 -0
- package/modern/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/TimeField/TimeField.js +17 -50
- package/modern/TimeField/useTimeField.js +1 -5
- package/modern/TimePicker/TimePicker.js +5 -1
- package/modern/hooks/useClearableField.js +32 -33
- package/modern/index.js +4 -1
- package/modern/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/modern/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/modern/internals/components/PickersInput/PickersFilledInput.js +165 -0
- package/modern/internals/components/{PickersTextField → PickersInput}/PickersInput.js +78 -106
- package/modern/internals/components/PickersInput/PickersInput.types.js +1 -0
- package/modern/internals/components/PickersInput/PickersOutlinedInput.js +117 -0
- package/modern/internals/components/PickersInput/PickersStandardInput.js +123 -0
- package/modern/internals/components/PickersInput/index.js +3 -0
- package/modern/internals/components/PickersInput/pickersInputClasses.js +18 -0
- package/modern/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +3 -6
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +11 -4
- package/modern/internals/hooks/useField/useField.utils.js +24 -4
- package/modern/internals/hooks/useField/useFieldState.js +7 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/modern/locales/ruRU.js +1 -2
- 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/PickersSectionList/PickersSectionList.js +228 -0
- package/node/PickersSectionList/index.js +49 -0
- package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
- package/node/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/TimeField/TimeField.js +18 -51
- package/node/TimeField/useTimeField.js +1 -5
- package/node/TimePicker/TimePicker.js +5 -1
- package/node/hooks/useClearableField.js +33 -34
- package/node/index.js +13 -1
- package/node/internals/components/PickersArrowSwitcher/index.js +14 -1
- package/node/internals/components/{PickersTextField → PickersInput}/Outline.js +35 -19
- package/node/internals/components/PickersInput/PickersFilledInput.js +174 -0
- package/node/internals/components/{PickersTextField → PickersInput}/PickersInput.js +80 -108
- package/node/internals/components/PickersInput/PickersInput.types.js +5 -0
- package/node/internals/components/PickersInput/PickersOutlinedInput.js +125 -0
- package/node/internals/components/PickersInput/PickersStandardInput.js +132 -0
- package/node/internals/components/PickersInput/index.js +32 -0
- package/node/internals/components/PickersInput/pickersInputClasses.js +29 -0
- package/node/internals/components/PickersTextField/PickersTextField.js +15 -6
- package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +6 -9
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +11 -4
- package/node/internals/hooks/useField/useField.utils.js +24 -4
- package/node/internals/hooks/useField/useFieldState.js +7 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +34 -0
- package/node/locales/ruRU.js +1 -2
- package/package.json +5 -5
- package/themeAugmentation/overrides.d.ts +5 -7
- package/themeAugmentation/props.d.ts +6 -8
- package/internals/components/PickersTextField/PickersInput.d.ts +0 -3
- package/internals/components/PickersTextField/PickersInput.types.d.ts +0 -45
- /package/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
- /package/{legacy/internals/components/PickersTextField → internals/components/PickersInput}/PickersInput.types.js +0 -0
- /package/{modern/internals/components/PickersTextField/PickersInput.types.js → legacy/PickersSectionList/PickersSectionList.types.js} +0 -0
- /package/node/{internals/components/PickersTextField/PickersInput.types.js → PickersSectionList/PickersSectionList.types.js} +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["label", "autoFocus", "ownerState"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { useFormControl } from '@mui/material/FormControl';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
|
+
import { pickersStandardInputClasses, getPickersStandardInputUtilityClass } from './pickersInputClasses';
|
|
9
|
+
import { PickersInputRoot, PickersInput } from './PickersInput';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const StandardInputRoot = styled(PickersInputRoot, {
|
|
12
|
+
name: 'MuiPickersStandardInput',
|
|
13
|
+
slot: 'Root',
|
|
14
|
+
overridesResolver: (props, styles) => styles.root
|
|
15
|
+
})(({
|
|
16
|
+
theme,
|
|
17
|
+
ownerState
|
|
18
|
+
}) => {
|
|
19
|
+
const light = theme.palette.mode === 'light';
|
|
20
|
+
let bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
|
21
|
+
if (theme.vars) {
|
|
22
|
+
bottomLineColor = `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})`;
|
|
23
|
+
}
|
|
24
|
+
return _extends({
|
|
25
|
+
'label + &': {
|
|
26
|
+
marginTop: 16
|
|
27
|
+
}
|
|
28
|
+
}, !ownerState.disableUnderline && {
|
|
29
|
+
'&:after': {
|
|
30
|
+
background: 'red',
|
|
31
|
+
borderBottom: `2px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
|
|
32
|
+
left: 0,
|
|
33
|
+
bottom: 0,
|
|
34
|
+
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
|
35
|
+
content: '""',
|
|
36
|
+
position: 'absolute',
|
|
37
|
+
right: 0,
|
|
38
|
+
transform: 'scaleX(0)',
|
|
39
|
+
transition: theme.transitions.create('transform', {
|
|
40
|
+
duration: theme.transitions.duration.shorter,
|
|
41
|
+
easing: theme.transitions.easing.easeOut
|
|
42
|
+
}),
|
|
43
|
+
pointerEvents: 'none' // Transparent to the hover style.
|
|
44
|
+
},
|
|
45
|
+
[`&.${pickersStandardInputClasses.focused}:after`]: {
|
|
46
|
+
// translateX(0) is a workaround for Safari transform scale bug
|
|
47
|
+
// See https://github.com/mui/material-ui/issues/31766
|
|
48
|
+
transform: 'scaleX(1) translateX(0)'
|
|
49
|
+
},
|
|
50
|
+
[`&.${pickersStandardInputClasses.error}`]: {
|
|
51
|
+
'&:before, &:after': {
|
|
52
|
+
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
'&:before': {
|
|
56
|
+
borderBottom: `1px solid ${bottomLineColor}`,
|
|
57
|
+
left: 0,
|
|
58
|
+
bottom: 0,
|
|
59
|
+
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
|
60
|
+
content: '"\\00a0"',
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
right: 0,
|
|
63
|
+
transition: theme.transitions.create('border-bottom-color', {
|
|
64
|
+
duration: theme.transitions.duration.shorter
|
|
65
|
+
}),
|
|
66
|
+
pointerEvents: 'none' // Transparent to the hover style.
|
|
67
|
+
},
|
|
68
|
+
[`&:hover:not(.${pickersStandardInputClasses.disabled}, .${pickersStandardInputClasses.error}):before`]: {
|
|
69
|
+
borderBottom: `2px solid ${(theme.vars || theme).palette.text.primary}`,
|
|
70
|
+
// Reset on touch devices, it doesn't add specificity
|
|
71
|
+
'@media (hover: none)': {
|
|
72
|
+
borderBottom: `1px solid ${bottomLineColor}`
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[`&.${pickersStandardInputClasses.disabled}:before`]: {
|
|
76
|
+
borderBottomStyle: 'dotted'
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
const useUtilityClasses = ownerState => {
|
|
81
|
+
const {
|
|
82
|
+
focused,
|
|
83
|
+
disabled,
|
|
84
|
+
error,
|
|
85
|
+
classes,
|
|
86
|
+
fullWidth,
|
|
87
|
+
color,
|
|
88
|
+
size,
|
|
89
|
+
endAdornment,
|
|
90
|
+
startAdornment
|
|
91
|
+
} = ownerState;
|
|
92
|
+
const slots = {
|
|
93
|
+
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${capitalize(color)}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
|
|
94
|
+
notchedOutline: ['notchedOutline'],
|
|
95
|
+
before: ['before'],
|
|
96
|
+
after: ['after'],
|
|
97
|
+
content: ['content'],
|
|
98
|
+
input: ['input']
|
|
99
|
+
};
|
|
100
|
+
return composeClasses(slots, getPickersStandardInputUtilityClass, classes);
|
|
101
|
+
};
|
|
102
|
+
export const PickersStandardInput = /*#__PURE__*/React.forwardRef(function PickersStandardInput(props, ref) {
|
|
103
|
+
const {
|
|
104
|
+
label,
|
|
105
|
+
ownerState: ownerStateProp
|
|
106
|
+
} = props,
|
|
107
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
108
|
+
const muiFormControl = useFormControl();
|
|
109
|
+
const ownerState = _extends({}, props, ownerStateProp, muiFormControl, {
|
|
110
|
+
color: muiFormControl?.color || 'primary'
|
|
111
|
+
});
|
|
112
|
+
const classes = useUtilityClasses(ownerState);
|
|
113
|
+
return /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
114
|
+
slots: {
|
|
115
|
+
root: StandardInputRoot
|
|
116
|
+
}
|
|
117
|
+
}, other, {
|
|
118
|
+
label: label,
|
|
119
|
+
classes: classes,
|
|
120
|
+
ref: ref
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
123
|
+
PickersInput.muiName = 'Input';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
3
|
+
export function getPickersInputUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiPickersInput', slot);
|
|
5
|
+
}
|
|
6
|
+
export function getPickersOutlinedInputUtilityClass(slot) {
|
|
7
|
+
return generateUtilityClass('MuiPickersOutlinedInput', slot);
|
|
8
|
+
}
|
|
9
|
+
export function getPickersFilledInputUtilityClass(slot) {
|
|
10
|
+
return generateUtilityClass('MuiPickersFilledInput', slot);
|
|
11
|
+
}
|
|
12
|
+
export function getPickersStandardInputUtilityClass(slot) {
|
|
13
|
+
return generateUtilityClass('MuiPickersStandardInput', slot);
|
|
14
|
+
}
|
|
15
|
+
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', 'sectionContent', 'sectionBefore', 'sectionAfter', 'adornedStart', 'adornedEnd', 'input']);
|
|
16
|
+
export const pickersOutlinedInputClasses = _extends({}, pickersInputClasses, generateUtilityClasses('MuiPickersOutlinedInput', ['root', 'notchedOutline', 'input']));
|
|
17
|
+
export const pickersFilledInputClasses = _extends({}, pickersInputClasses, generateUtilityClasses('MuiPickersFilledInput', ['root', 'underline', 'input']));
|
|
18
|
+
export const pickersStandardInputClasses = _extends({}, pickersInputClasses, generateUtilityClasses('MuiPickersStandardInput', ['root', 'underline', 'input']));
|
|
@@ -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 = ["onFocus", "onBlur", "className", "color", "disabled", "error", "
|
|
3
|
+
const _excluded = ["onFocus", "onBlur", "className", "color", "disabled", "error", "variant", "required", "InputProps", "inputProps", "inputRef", "sectionListRef", "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,9 +10,16 @@ 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 {
|
|
13
|
+
import { PickersOutlinedInput } from '../PickersInput/PickersOutlinedInput';
|
|
14
|
+
import { PickersFilledInput } from '../PickersInput/PickersFilledInput';
|
|
15
|
+
import { PickersStandardInput } from '../PickersInput/PickersStandardInput';
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
|
+
const VARIANT_COMPONENT = {
|
|
19
|
+
standard: PickersStandardInput,
|
|
20
|
+
filled: PickersFilledInput,
|
|
21
|
+
outlined: PickersOutlinedInput
|
|
22
|
+
};
|
|
16
23
|
const PickersTextFieldRoot = styled(FormControl, {
|
|
17
24
|
name: 'MuiPickersTextField',
|
|
18
25
|
slot: 'Root',
|
|
@@ -39,13 +46,13 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
39
46
|
color = 'primary',
|
|
40
47
|
disabled = false,
|
|
41
48
|
error = false,
|
|
42
|
-
required = false,
|
|
43
49
|
variant = 'outlined',
|
|
50
|
+
required = false,
|
|
44
51
|
// Props used by PickersInput
|
|
45
52
|
InputProps,
|
|
46
53
|
inputProps,
|
|
47
54
|
inputRef,
|
|
48
|
-
|
|
55
|
+
sectionListRef,
|
|
49
56
|
elements,
|
|
50
57
|
areAllSectionsEmpty,
|
|
51
58
|
onClick,
|
|
@@ -83,6 +90,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
83
90
|
variant
|
|
84
91
|
});
|
|
85
92
|
const classes = useUtilityClasses(ownerState);
|
|
93
|
+
const PickersInputComponent = VARIANT_COMPONENT[variant];
|
|
86
94
|
return /*#__PURE__*/_jsxs(PickersTextFieldRoot, _extends({
|
|
87
95
|
className: clsx(classes.root, className),
|
|
88
96
|
ref: handleRootRef,
|
|
@@ -93,6 +101,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
93
101
|
variant: variant,
|
|
94
102
|
error: error,
|
|
95
103
|
color: color,
|
|
104
|
+
fullWidth: fullWidth,
|
|
96
105
|
required: required,
|
|
97
106
|
ownerState: ownerState
|
|
98
107
|
}, other, {
|
|
@@ -101,7 +110,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
101
110
|
id: inputLabelId
|
|
102
111
|
}, InputLabelProps, {
|
|
103
112
|
children: label
|
|
104
|
-
})), /*#__PURE__*/_jsx(
|
|
113
|
+
})), /*#__PURE__*/_jsx(PickersInputComponent, _extends({
|
|
105
114
|
elements: elements,
|
|
106
115
|
areAllSectionsEmpty: areAllSectionsEmpty,
|
|
107
116
|
onClick: onClick,
|
|
@@ -118,7 +127,7 @@ export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTe
|
|
|
118
127
|
fullWidth: fullWidth,
|
|
119
128
|
inputProps: inputProps,
|
|
120
129
|
inputRef: inputRef,
|
|
121
|
-
|
|
130
|
+
sectionListRef: sectionListRef,
|
|
122
131
|
label: label
|
|
123
132
|
}, InputProps)), helperText && /*#__PURE__*/_jsx(FormHelperText, _extends({
|
|
124
133
|
id: helperTextId
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
2
3
|
export function getPickersTextFieldUtilityClass(slot) {
|
|
3
4
|
return generateUtilityClass('MuiPickersTextField', slot);
|
|
4
5
|
}
|
|
5
|
-
export const pickersTextFieldClasses = generateUtilityClasses('MuiPickersTextField', ['root', 'focused', 'disabled', 'error', 'required']);
|
|
6
|
-
export function getPickersInputUtilityClass(slot) {
|
|
7
|
-
return generateUtilityClass('MuiPickersInput', slot);
|
|
8
|
-
}
|
|
9
|
-
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', 'adornedStart', 'adornedEnd', 'input', 'sectionsContainer', 'sectionContent', 'sectionBefore', 'sectionAfter']);
|
|
6
|
+
export const pickersTextFieldClasses = generateUtilityClasses('MuiPickersTextField', ['root', 'focused', 'disabled', 'error', 'required']);
|
|
@@ -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,
|
|
@@ -142,7 +142,14 @@ export const useField = params => {
|
|
|
142
142
|
const digitsAndLetterOnly = /^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(pastedValue);
|
|
143
143
|
const isValidPastedValue = activeSection.contentType === 'letter' && lettersOnly || activeSection.contentType === 'digit' && digitsOnly || activeSection.contentType === 'digit-with-letter' && digitsAndLetterOnly;
|
|
144
144
|
if (isValidPastedValue) {
|
|
145
|
-
|
|
145
|
+
resetCharacterQuery();
|
|
146
|
+
updateSectionValue({
|
|
147
|
+
activeSection,
|
|
148
|
+
newSectionValue: pastedValue,
|
|
149
|
+
shouldGoToNextSection: true
|
|
150
|
+
});
|
|
151
|
+
// prevent default to avoid the input change handler being called
|
|
152
|
+
event.preventDefault();
|
|
146
153
|
return;
|
|
147
154
|
}
|
|
148
155
|
if (lettersOnly || digitsOnly) {
|
|
@@ -427,7 +434,7 @@ export const useField = params => {
|
|
|
427
434
|
onMouseUp: handleInputMouseUp,
|
|
428
435
|
onClear: handleClearValue,
|
|
429
436
|
error: inputError,
|
|
430
|
-
|
|
437
|
+
inputRef: handleRef,
|
|
431
438
|
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly && !disabled)
|
|
432
439
|
});
|
|
433
440
|
};
|
|
@@ -192,7 +192,7 @@ export const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
|
192
192
|
|
|
193
193
|
// The ...InInput values consider the unicode characters but do include them in their indexes
|
|
194
194
|
const cleanedValue = cleanString(renderedValue);
|
|
195
|
-
const startInInput = positionInInput + renderedValue.indexOf(cleanedValue[0]) + section.startSeparator.length;
|
|
195
|
+
const startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
|
|
196
196
|
const endInInput = startInInput + cleanedValue.length;
|
|
197
197
|
newSections.push(_extends({}, section, {
|
|
198
198
|
start: position,
|
|
@@ -425,6 +425,21 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
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
|
+
}
|
|
428
443
|
return sections.map(section => {
|
|
429
444
|
const cleanSeparator = separator => {
|
|
430
445
|
let cleanedSeparator = separator;
|
|
@@ -566,6 +581,10 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
566
581
|
meridiem: () => ({
|
|
567
582
|
minimum: 0,
|
|
568
583
|
maximum: 0
|
|
584
|
+
}),
|
|
585
|
+
empty: () => ({
|
|
586
|
+
minimum: 0,
|
|
587
|
+
maximum: 0
|
|
569
588
|
})
|
|
570
589
|
};
|
|
571
590
|
};
|
|
@@ -573,7 +592,7 @@ let warnedOnceInvalidSection = false;
|
|
|
573
592
|
export const validateSections = (sections, valueType) => {
|
|
574
593
|
if (process.env.NODE_ENV !== 'production') {
|
|
575
594
|
if (!warnedOnceInvalidSection) {
|
|
576
|
-
const supportedSections = [];
|
|
595
|
+
const supportedSections = ['empty'];
|
|
577
596
|
if (['date', 'date-time'].includes(valueType)) {
|
|
578
597
|
supportedSections.push('weekDay', 'day', 'month', 'year');
|
|
579
598
|
}
|
|
@@ -582,7 +601,7 @@ export const validateSections = (sections, valueType) => {
|
|
|
582
601
|
}
|
|
583
602
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
584
603
|
if (invalidSection) {
|
|
585
|
-
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('", "')}"]\`.`);
|
|
586
605
|
warnedOnceInvalidSection = true;
|
|
587
606
|
}
|
|
588
607
|
}
|
|
@@ -649,7 +668,8 @@ const reliableSectionModificationOrder = {
|
|
|
649
668
|
hours: 5,
|
|
650
669
|
minutes: 6,
|
|
651
670
|
seconds: 7,
|
|
652
|
-
meridiem: 8
|
|
671
|
+
meridiem: 8,
|
|
672
|
+
empty: 9
|
|
653
673
|
};
|
|
654
674
|
export const mergeDateIntoReferenceDate = (utils, timezone, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
|
|
655
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
|
});
|
|
@@ -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/ruRU.js
CHANGED
|
@@ -42,8 +42,7 @@ const ruRUPickers = {
|
|
|
42
42
|
// Open picker labels
|
|
43
43
|
openDatePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Выберите дату, выбрана дата ${utils.format(value, 'fullDate')}` : 'Выберите дату',
|
|
44
44
|
openTimePickerDialogue: (value, utils) => value !== null && utils.isValid(value) ? `Выберите время, выбрано время ${utils.format(value, 'fullTime')}` : 'Выберите время',
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
fieldClearLabel: 'Очистить значение',
|
|
47
46
|
// Table labels
|
|
48
47
|
timeTableLabel: 'выбрать время',
|
|
49
48
|
dateTableLabel: 'выбрать дату',
|
|
@@ -13,12 +13,11 @@ var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
|
13
13
|
var _styles = require("@mui/material/styles");
|
|
14
14
|
var _utils = require("@mui/base/utils");
|
|
15
15
|
var _utils2 = require("@mui/utils");
|
|
16
|
-
var
|
|
16
|
+
var _useDateField = require("./useDateField");
|
|
17
17
|
var _hooks = require("../hooks");
|
|
18
|
+
var _convertFieldResponseIntoMuiTextFieldProps = require("../internals/utils/convertFieldResponseIntoMuiTextFieldProps");
|
|
18
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"]
|
|
20
|
-
_excluded2 = ["inputRef"],
|
|
21
|
-
_excluded3 = ["ref", "onPaste", "onKeyDown", "inputMode", "readOnly", "clearable", "onClear"];
|
|
20
|
+
const _excluded = ["slots", "slotProps", "InputProps", "inputProps"];
|
|
22
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
23
|
/**
|
|
@@ -31,7 +30,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
31
30
|
*
|
|
32
31
|
* - [DateField API](https://mui.com/x/api/date-pickers/date-field/)
|
|
33
32
|
*/
|
|
34
|
-
const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps,
|
|
33
|
+
const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function DateField(inProps, inRef) {
|
|
35
34
|
const themeProps = (0, _styles.useThemeProps)({
|
|
36
35
|
props: inProps,
|
|
37
36
|
name: 'MuiDateField'
|
|
@@ -45,58 +44,26 @@ const DateField = exports.DateField = /*#__PURE__*/React.forwardRef(function Dat
|
|
|
45
44
|
other = (0, _objectWithoutPropertiesLoose2.default)(themeProps, _excluded);
|
|
46
45
|
const ownerState = themeProps;
|
|
47
46
|
const TextField = slots?.textField ?? _TextField.default;
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
textFieldProps = (0, _objectWithoutPropertiesLoose2.default)(_useSlotProps, _excluded2);
|
|
47
|
+
const textFieldProps = (0, _utils.useSlotProps)({
|
|
48
|
+
elementType: TextField,
|
|
49
|
+
externalSlotProps: slotProps?.textField,
|
|
50
|
+
externalForwardedProps: other,
|
|
51
|
+
additionalProps: {
|
|
52
|
+
ref: inRef
|
|
53
|
+
},
|
|
54
|
+
ownerState
|
|
55
|
+
});
|
|
58
56
|
|
|
59
57
|
// TODO: Remove when mui/material-ui#35088 will be merged
|
|
60
58
|
textFieldProps.inputProps = (0, _extends2.default)({}, inputProps, textFieldProps.inputProps);
|
|
61
59
|
textFieldProps.InputProps = (0, _extends2.default)({}, InputProps, textFieldProps.InputProps);
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}),
|
|
66
|
-
{
|
|
67
|
-
ref: inputRef,
|
|
68
|
-
onPaste,
|
|
69
|
-
onKeyDown,
|
|
70
|
-
inputMode,
|
|
71
|
-
readOnly,
|
|
72
|
-
clearable,
|
|
73
|
-
onClear
|
|
74
|
-
} = _useDateField,
|
|
75
|
-
fieldProps = (0, _objectWithoutPropertiesLoose2.default)(_useDateField, _excluded3);
|
|
76
|
-
const {
|
|
77
|
-
InputProps: ProcessedInputProps,
|
|
78
|
-
fieldProps: processedFieldProps
|
|
79
|
-
} = (0, _hooks.useClearableField)({
|
|
80
|
-
onClear,
|
|
81
|
-
clearable,
|
|
82
|
-
fieldProps,
|
|
83
|
-
InputProps: fieldProps.InputProps,
|
|
60
|
+
const fieldResponse = (0, _useDateField.useDateField)(textFieldProps);
|
|
61
|
+
const convertedFieldResponse = (0, _convertFieldResponseIntoMuiTextFieldProps.convertFieldResponseIntoMuiTextFieldProps)(fieldResponse);
|
|
62
|
+
const processedFieldProps = (0, _hooks.useClearableField)((0, _extends2.default)({}, convertedFieldResponse, {
|
|
84
63
|
slots,
|
|
85
64
|
slotProps
|
|
86
|
-
});
|
|
87
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({
|
|
88
|
-
ref: ref
|
|
89
|
-
}, processedFieldProps, {
|
|
90
|
-
InputProps: (0, _extends2.default)({}, ProcessedInputProps, {
|
|
91
|
-
readOnly
|
|
92
|
-
}),
|
|
93
|
-
inputProps: (0, _extends2.default)({}, fieldProps.inputProps, {
|
|
94
|
-
inputMode,
|
|
95
|
-
onPaste,
|
|
96
|
-
onKeyDown,
|
|
97
|
-
ref: inputRef
|
|
98
|
-
})
|
|
99
65
|
}));
|
|
66
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(TextField, (0, _extends2.default)({}, processedFieldProps));
|
|
100
67
|
});
|
|
101
68
|
process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
102
69
|
// ----------------------------- Warning --------------------------------
|
|
@@ -274,7 +241,7 @@ process.env.NODE_ENV !== "production" ? DateField.propTypes = {
|
|
|
274
241
|
* 4. If `null` is provided, no section will be selected
|
|
275
242
|
* If not provided, the selected sections will be handled internally.
|
|
276
243
|
*/
|
|
277
|
-
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number, _propTypes.default.shape({
|
|
244
|
+
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number, _propTypes.default.shape({
|
|
278
245
|
endIndex: _propTypes.default.number.isRequired,
|
|
279
246
|
startIndex: _propTypes.default.number.isRequired
|
|
280
247
|
})]),
|
|
@@ -23,17 +23,13 @@ const useDefaultizedDateField = props => {
|
|
|
23
23
|
maxDate: (0, _dateUtils.applyDefaultDate)(utils, props.maxDate, defaultDates.maxDate)
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
const useDateField =
|
|
27
|
-
props: inProps,
|
|
28
|
-
inputRef
|
|
29
|
-
}) => {
|
|
26
|
+
const useDateField = inProps => {
|
|
30
27
|
const props = useDefaultizedDateField(inProps);
|
|
31
28
|
const {
|
|
32
29
|
forwardedProps,
|
|
33
30
|
internalProps
|
|
34
31
|
} = (0, _fields.splitFieldInternalAndForwardedProps)(props, 'date');
|
|
35
32
|
return (0, _useField.useField)({
|
|
36
|
-
inputRef,
|
|
37
33
|
forwardedProps,
|
|
38
34
|
internalProps,
|
|
39
35
|
valueManager: _valueManagers.singleItemValueManager,
|
|
@@ -169,6 +169,10 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
169
169
|
* @default 3
|
|
170
170
|
*/
|
|
171
171
|
monthsPerRow: _propTypes.default.oneOf([3, 4]),
|
|
172
|
+
/**
|
|
173
|
+
* Name attribute used by the `input` element in the Field.
|
|
174
|
+
*/
|
|
175
|
+
name: _propTypes.default.string,
|
|
172
176
|
/**
|
|
173
177
|
* Callback fired when the value is accepted.
|
|
174
178
|
* @template TValue The value type. Will be either the same type as `value` or `null`. Can be in `[start, end]` format in case of range value.
|
|
@@ -267,7 +271,7 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
|
|
|
267
271
|
* 4. If `null` is provided, no section will be selected
|
|
268
272
|
* If not provided, the selected sections will be handled internally.
|
|
269
273
|
*/
|
|
270
|
-
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number, _propTypes.default.shape({
|
|
274
|
+
selectedSections: _propTypes.default.oneOfType([_propTypes.default.oneOf(['all', 'day', 'empty', 'hours', 'meridiem', 'minutes', 'month', 'seconds', 'weekDay', 'year']), _propTypes.default.number, _propTypes.default.shape({
|
|
271
275
|
endIndex: _propTypes.default.number.isRequired,
|
|
272
276
|
startIndex: _propTypes.default.number.isRequired
|
|
273
277
|
})]),
|