@mui/x-date-pickers 7.0.0-alpha.5 → 7.0.0-alpha.7
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 +408 -6
- package/DateCalendar/DateCalendar.js +6 -4
- package/DateCalendar/DateCalendar.types.d.ts +0 -8
- package/DigitalClock/DigitalClock.js +3 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- 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/TimeClock/TimeClock.js +3 -2
- package/index.d.ts +1 -0
- package/index.js +4 -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/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/useField/useField.js +8 -1
- package/internals/hooks/useViews.d.ts +4 -4
- package/internals/hooks/useViews.js +13 -13
- package/internals/models/props/clock.d.ts +0 -9
- package/legacy/DateCalendar/DateCalendar.js +6 -4
- package/legacy/DigitalClock/DigitalClock.js +3 -2
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/legacy/PickersSectionList/PickersSectionList.js +230 -0
- package/legacy/PickersSectionList/index.js +2 -0
- package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
- package/legacy/TimeClock/TimeClock.js +3 -2
- package/legacy/index.js +4 -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/useField/useField.js +8 -1
- package/legacy/internals/hooks/useViews.js +13 -13
- package/legacy/locales/ruRU.js +1 -2
- package/locales/ruRU.js +1 -2
- package/modern/DateCalendar/DateCalendar.js +6 -4
- package/modern/DigitalClock/DigitalClock.js +3 -2
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- 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/TimeClock/TimeClock.js +3 -2
- package/modern/index.js +4 -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/useField/useField.js +8 -1
- package/modern/internals/hooks/useViews.js +13 -13
- package/modern/locales/ruRU.js +1 -2
- package/node/DateCalendar/DateCalendar.js +6 -4
- package/node/DigitalClock/DigitalClock.js +3 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +9 -13
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +4 -8
- package/node/PickersSectionList/PickersSectionList.js +228 -0
- package/node/PickersSectionList/index.js +49 -0
- package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
- package/node/TimeClock/TimeClock.js +3 -2
- package/node/index.js +13 -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/useField/useField.js +8 -1
- package/node/internals/hooks/useViews.js +13 -13
- package/node/locales/ruRU.js +1 -2
- package/package.json +5 -5
- 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
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "contentEditable", "tabIndex", "fullWidth", "inputProps", "inputRef", "
|
|
3
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "inputProps", "inputRef", "sectionListRef"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import clsx from 'clsx';
|
|
6
5
|
import Box from '@mui/material/Box';
|
|
7
6
|
import { useFormControl } from '@mui/material/FormControl';
|
|
8
7
|
import { styled } from '@mui/material/styles';
|
|
@@ -10,59 +9,33 @@ import useForkRef from '@mui/utils/useForkRef';
|
|
|
10
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
10
|
import capitalize from '@mui/utils/capitalize';
|
|
12
11
|
import visuallyHidden from '@mui/utils/visuallyHidden';
|
|
13
|
-
import { pickersInputClasses, getPickersInputUtilityClass } from './
|
|
14
|
-
import
|
|
12
|
+
import { pickersInputClasses, getPickersInputUtilityClass } from './pickersInputClasses';
|
|
13
|
+
import { Unstable_PickersSectionList as PickersSectionList, Unstable_PickersSectionListRoot as PickersSectionListRoot, Unstable_PickersSectionListSection as PickersSectionListSection, Unstable_PickersSectionListSectionSeparator as PickersSectionListSectionSeparator, Unstable_PickersSectionListSectionContent as PickersSectionListSectionContent } from '../../../PickersSectionList';
|
|
15
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
const
|
|
16
|
+
const round = value => Math.round(value * 1e5) / 1e5;
|
|
17
|
+
export const PickersInputRoot = styled(Box, {
|
|
18
18
|
name: 'MuiPickersInput',
|
|
19
19
|
slot: 'Root',
|
|
20
20
|
overridesResolver: (props, styles) => styles.root
|
|
21
21
|
})(({
|
|
22
22
|
theme,
|
|
23
23
|
ownerState
|
|
24
|
-
}) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Reset on touch devices, it doesn't add specificity
|
|
40
|
-
'@media (hover: none)': {
|
|
41
|
-
[`&:hover .${pickersInputClasses.notchedOutline}`]: {
|
|
42
|
-
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
[`&.${pickersInputClasses.focused} .${pickersInputClasses.notchedOutline}`]: {
|
|
46
|
-
borderStyle: 'solid',
|
|
47
|
-
borderColor: (theme.vars || theme).palette[ownerState.color].main,
|
|
48
|
-
borderWidth: 2
|
|
49
|
-
},
|
|
50
|
-
[`&.${pickersInputClasses.disabled}`]: {
|
|
51
|
-
[`& .${pickersInputClasses.notchedOutline}`]: {
|
|
52
|
-
borderColor: (theme.vars || theme).palette.action.disabled
|
|
53
|
-
},
|
|
54
|
-
'*': {
|
|
55
|
-
color: (theme.vars || theme).palette.action.disabled
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
[`&.${pickersInputClasses.error} .${pickersInputClasses.notchedOutline}`]: {
|
|
59
|
-
borderColor: (theme.vars || theme).palette.error.main
|
|
60
|
-
}
|
|
61
|
-
}, ownerState.size === 'small' && {
|
|
62
|
-
padding: '8.5px 14px'
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
const PickersInputSectionsContainer = styled('div', {
|
|
24
|
+
}) => _extends({}, theme.typography.body1, {
|
|
25
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
26
|
+
cursor: 'text',
|
|
27
|
+
padding: 0,
|
|
28
|
+
display: 'flex',
|
|
29
|
+
justifyContent: 'flex-start',
|
|
30
|
+
alignItems: 'center',
|
|
31
|
+
position: 'relative',
|
|
32
|
+
boxSizing: 'border-box',
|
|
33
|
+
// Prevent padding issue with fullWidth.
|
|
34
|
+
letterSpacing: `${round(0.15 / 16)}em`
|
|
35
|
+
}, ownerState.fullWidth && {
|
|
36
|
+
width: '100%'
|
|
37
|
+
}));
|
|
38
|
+
export const PickersInputSectionsContainer = styled(PickersSectionListRoot, {
|
|
66
39
|
name: 'MuiPickersInput',
|
|
67
40
|
slot: 'SectionsContainer',
|
|
68
41
|
overridesResolver: (props, styles) => styles.sectionsContainer
|
|
@@ -70,12 +43,23 @@ const PickersInputSectionsContainer = styled('div', {
|
|
|
70
43
|
theme,
|
|
71
44
|
ownerState
|
|
72
45
|
}) => _extends({
|
|
46
|
+
padding: '4px 0 5px',
|
|
73
47
|
fontFamily: theme.typography.fontFamily,
|
|
74
48
|
fontSize: 'inherit',
|
|
75
49
|
lineHeight: '1.4375em',
|
|
76
50
|
// 23px
|
|
77
51
|
flexGrow: 1,
|
|
78
|
-
outline: 'none'
|
|
52
|
+
outline: 'none',
|
|
53
|
+
display: 'flex',
|
|
54
|
+
flexWrap: 'nowrap',
|
|
55
|
+
overflow: 'hidden',
|
|
56
|
+
letterSpacing: 'inherit',
|
|
57
|
+
// Baseline behavior
|
|
58
|
+
width: '182px'
|
|
59
|
+
}, ownerState.size === 'small' && {
|
|
60
|
+
paddingTop: 1
|
|
61
|
+
}, theme.direction === 'rtl' && {
|
|
62
|
+
textAlign: 'right /*! @noflip */'
|
|
79
63
|
}, !(ownerState.adornedStart || ownerState.focused || ownerState.filled) && _extends({
|
|
80
64
|
color: 'currentColor'
|
|
81
65
|
}, ownerState.label == null && (theme.vars ? {
|
|
@@ -85,7 +69,7 @@ const PickersInputSectionsContainer = styled('div', {
|
|
|
85
69
|
}), ownerState.label != null && {
|
|
86
70
|
opacity: 0
|
|
87
71
|
})));
|
|
88
|
-
const PickersInputSection = styled(
|
|
72
|
+
const PickersInputSection = styled(PickersSectionListSection, {
|
|
89
73
|
name: 'MuiPickersInput',
|
|
90
74
|
slot: 'Section',
|
|
91
75
|
overridesResolver: (props, styles) => styles.section
|
|
@@ -94,11 +78,12 @@ const PickersInputSection = styled('span', {
|
|
|
94
78
|
}) => ({
|
|
95
79
|
fontFamily: theme.typography.fontFamily,
|
|
96
80
|
fontSize: 'inherit',
|
|
81
|
+
letterSpacing: 'inherit',
|
|
97
82
|
lineHeight: '1.4375em',
|
|
98
83
|
// 23px
|
|
99
|
-
|
|
84
|
+
display: 'flex'
|
|
100
85
|
}));
|
|
101
|
-
const
|
|
86
|
+
const PickersInputSectionContent = styled(PickersSectionListSectionContent, {
|
|
102
87
|
name: 'MuiPickersInput',
|
|
103
88
|
slot: 'SectionContent',
|
|
104
89
|
overridesResolver: (props, styles) => styles.content
|
|
@@ -109,32 +94,22 @@ const PickersInputContent = styled('span', {
|
|
|
109
94
|
lineHeight: '1.4375em',
|
|
110
95
|
// 23px
|
|
111
96
|
letterSpacing: 'inherit',
|
|
112
|
-
width: 'fit-content'
|
|
97
|
+
width: 'fit-content',
|
|
98
|
+
outline: 'none'
|
|
113
99
|
}));
|
|
114
|
-
const PickersInputSeparator = styled(
|
|
100
|
+
const PickersInputSeparator = styled(PickersSectionListSectionSeparator, {
|
|
115
101
|
name: 'MuiPickersInput',
|
|
116
102
|
slot: 'Separator',
|
|
117
103
|
overridesResolver: (props, styles) => styles.separator
|
|
118
104
|
})(() => ({
|
|
119
|
-
whiteSpace: 'pre'
|
|
105
|
+
whiteSpace: 'pre',
|
|
106
|
+
letterSpacing: 'inherit'
|
|
120
107
|
}));
|
|
121
108
|
const PickersInputInput = styled('input', {
|
|
122
109
|
name: 'MuiPickersInput',
|
|
123
110
|
slot: 'Input',
|
|
124
111
|
overridesResolver: (props, styles) => styles.hiddenInput
|
|
125
112
|
})(_extends({}, visuallyHidden));
|
|
126
|
-
const NotchedOutlineRoot = styled(Outline, {
|
|
127
|
-
name: 'MuiPickersInput',
|
|
128
|
-
slot: 'NotchedOutline',
|
|
129
|
-
overridesResolver: (props, styles) => styles.notchedOutline
|
|
130
|
-
})(({
|
|
131
|
-
theme
|
|
132
|
-
}) => {
|
|
133
|
-
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
134
|
-
return {
|
|
135
|
-
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
136
|
-
};
|
|
137
|
-
});
|
|
138
113
|
const useUtilityClasses = ownerState => {
|
|
139
114
|
const {
|
|
140
115
|
focused,
|
|
@@ -163,17 +138,21 @@ export const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(
|
|
|
163
138
|
const {
|
|
164
139
|
elements,
|
|
165
140
|
areAllSectionsEmpty,
|
|
166
|
-
label,
|
|
167
141
|
value,
|
|
168
142
|
onChange,
|
|
169
143
|
id,
|
|
170
144
|
endAdornment,
|
|
171
145
|
startAdornment,
|
|
146
|
+
renderSuffix,
|
|
147
|
+
slots,
|
|
172
148
|
contentEditable,
|
|
173
149
|
tabIndex,
|
|
150
|
+
onInput,
|
|
151
|
+
onPaste,
|
|
152
|
+
onKeyDown,
|
|
174
153
|
inputProps,
|
|
175
154
|
inputRef,
|
|
176
|
-
|
|
155
|
+
sectionListRef
|
|
177
156
|
} = props,
|
|
178
157
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
179
158
|
const rootRef = React.useRef(null);
|
|
@@ -210,51 +189,44 @@ export const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(
|
|
|
210
189
|
}, [muiFormControl, areAllSectionsEmpty]);
|
|
211
190
|
const ownerState = _extends({}, props, muiFormControl);
|
|
212
191
|
const classes = useUtilityClasses(ownerState);
|
|
213
|
-
|
|
192
|
+
const InputRoot = (slots == null ? void 0 : slots.root) || PickersInputRoot;
|
|
193
|
+
const InputSectionsContainer = (slots == null ? void 0 : slots.input) || PickersInputSectionsContainer;
|
|
194
|
+
return /*#__PURE__*/_jsxs(InputRoot, _extends({}, other, {
|
|
214
195
|
className: classes.root,
|
|
215
196
|
ownerState: ownerState,
|
|
216
197
|
"aria-invalid": muiFormControl.error,
|
|
217
198
|
ref: handleRootRef,
|
|
218
|
-
children: [startAdornment, /*#__PURE__*/_jsx(
|
|
219
|
-
|
|
220
|
-
|
|
199
|
+
children: [startAdornment, /*#__PURE__*/_jsx(PickersSectionList, {
|
|
200
|
+
sectionListRef: sectionListRef,
|
|
201
|
+
elements: elements,
|
|
221
202
|
contentEditable: contentEditable,
|
|
222
|
-
|
|
203
|
+
tabIndex: tabIndex,
|
|
204
|
+
className: classes.sectionsContainer,
|
|
223
205
|
onFocus: handleInputFocus,
|
|
224
206
|
onBlur: muiFormControl.onBlur,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
},
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
})
|
|
249
|
-
}), endAdornment, /*#__PURE__*/_jsx(NotchedOutlineRoot, {
|
|
250
|
-
shrink: muiFormControl.adornedStart || muiFormControl.focused || muiFormControl.filled,
|
|
251
|
-
notched: muiFormControl.adornedStart || muiFormControl.focused || muiFormControl.filled,
|
|
252
|
-
className: classes.notchedOutline,
|
|
253
|
-
label: label != null && label !== '' && muiFormControl.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
254
|
-
children: [label, "\u2009", '*']
|
|
255
|
-
}) : label,
|
|
256
|
-
ownerState: ownerState
|
|
257
|
-
}), /*#__PURE__*/_jsx(PickersInputInput, _extends({
|
|
207
|
+
onInput: onInput,
|
|
208
|
+
onPaste: onPaste,
|
|
209
|
+
onKeyDown: onKeyDown,
|
|
210
|
+
slots: {
|
|
211
|
+
root: InputSectionsContainer,
|
|
212
|
+
section: PickersInputSection,
|
|
213
|
+
sectionContent: PickersInputSectionContent,
|
|
214
|
+
sectionSeparator: PickersInputSeparator
|
|
215
|
+
},
|
|
216
|
+
slotProps: {
|
|
217
|
+
root: {
|
|
218
|
+
ownerState
|
|
219
|
+
},
|
|
220
|
+
sectionContent: {
|
|
221
|
+
className: pickersInputClasses.sectionContent
|
|
222
|
+
},
|
|
223
|
+
sectionSeparator: ({
|
|
224
|
+
position
|
|
225
|
+
}) => ({
|
|
226
|
+
className: position === 'before' ? pickersInputClasses.sectionBefore : pickersInputClasses.sectionAfter
|
|
227
|
+
})
|
|
228
|
+
}
|
|
229
|
+
}), endAdornment, renderSuffix ? renderSuffix(_extends({}, muiFormControl)) : null, /*#__PURE__*/_jsx(PickersInputInput, _extends({
|
|
258
230
|
className: classes.input,
|
|
259
231
|
value: value,
|
|
260
232
|
onChange: onChange,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BoxProps } from '@mui/material/Box';
|
|
3
|
+
import { PickersSectionListProps } from '../../../PickersSectionList';
|
|
4
|
+
export interface PickersInputPropsUsedByField extends Pick<PickersSectionListProps, 'elements' | 'sectionListRef' | 'contentEditable' | 'tabIndex'> {
|
|
5
|
+
/**
|
|
6
|
+
* Is `true` if the current values equals the empty value.
|
|
7
|
+
* For a single item value, it means that `value === null`
|
|
8
|
+
* For a range value, it means that `value === [null, null]`
|
|
9
|
+
*/
|
|
10
|
+
areAllSectionsEmpty: boolean;
|
|
11
|
+
onClick: React.MouseEventHandler<HTMLDivElement>;
|
|
12
|
+
onKeyDown: React.KeyboardEventHandler<HTMLDivElement>;
|
|
13
|
+
onInput: React.FormEventHandler<HTMLDivElement>;
|
|
14
|
+
onPaste: React.ClipboardEventHandler<HTMLDivElement>;
|
|
15
|
+
endAdornment?: React.ReactNode;
|
|
16
|
+
startAdornment?: React.ReactNode;
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
19
|
+
label?: React.ReactNode;
|
|
20
|
+
id?: string;
|
|
21
|
+
fullWidth?: boolean;
|
|
22
|
+
readOnly?: boolean;
|
|
23
|
+
inputProps?: React.HTMLAttributes<HTMLInputElement> & {
|
|
24
|
+
ref?: React.Ref<HTMLInputElement>;
|
|
25
|
+
};
|
|
26
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
27
|
+
}
|
|
28
|
+
export interface PickersInputProps extends Omit<BoxProps, keyof PickersInputPropsUsedByField>, PickersInputPropsUsedByField {
|
|
29
|
+
ownerState?: any;
|
|
30
|
+
margin?: 'dense' | 'none' | 'normal';
|
|
31
|
+
renderSuffix?: (state: {
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
error?: boolean;
|
|
34
|
+
filled?: boolean;
|
|
35
|
+
focused?: boolean;
|
|
36
|
+
margin?: 'dense' | 'none' | 'normal';
|
|
37
|
+
required?: boolean;
|
|
38
|
+
adornedStart?: boolean;
|
|
39
|
+
}) => React.ReactNode;
|
|
40
|
+
ref?: React.Ref<HTMLDivElement>;
|
|
41
|
+
/**
|
|
42
|
+
* The components used for each slot inside.
|
|
43
|
+
*
|
|
44
|
+
* @default {}
|
|
45
|
+
*/
|
|
46
|
+
slots?: {
|
|
47
|
+
root?: React.ElementType;
|
|
48
|
+
input?: React.ElementType;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface PickersOutlinedInputProps extends PickersInputProps {
|
|
52
|
+
notched?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export interface PickersStandardInputProps extends PickersInputProps {
|
|
55
|
+
disableUnderline?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface PickersFilledInputProps extends PickersInputProps {
|
|
58
|
+
disableUnderline?: boolean;
|
|
59
|
+
hiddenLabel?: boolean;
|
|
60
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["label", "autoFocus", "ownerState", "notched"];
|
|
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 { pickersOutlinedInputClasses, getPickersOutlinedInputUtilityClass } from './pickersInputClasses';
|
|
9
|
+
import Outline from './Outline';
|
|
10
|
+
import { PickersInputRoot, PickersInput, PickersInputSectionsContainer } from './PickersInput';
|
|
11
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
const OutlinedInputRoot = styled(PickersInputRoot, {
|
|
14
|
+
name: 'MuiPickersOutlinedInput',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})(({
|
|
18
|
+
theme,
|
|
19
|
+
ownerState
|
|
20
|
+
}) => {
|
|
21
|
+
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
22
|
+
return {
|
|
23
|
+
padding: '0 14px',
|
|
24
|
+
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
25
|
+
[`&:hover .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
26
|
+
borderColor: (theme.vars || theme).palette.text.primary
|
|
27
|
+
},
|
|
28
|
+
// Reset on touch devices, it doesn't add specificity
|
|
29
|
+
'@media (hover: none)': {
|
|
30
|
+
[`&:hover .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
31
|
+
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
[`&.${pickersOutlinedInputClasses.focused} .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
35
|
+
borderStyle: 'solid',
|
|
36
|
+
borderColor: (theme.vars || theme).palette[ownerState.color].main,
|
|
37
|
+
borderWidth: 2
|
|
38
|
+
},
|
|
39
|
+
[`&.${pickersOutlinedInputClasses.disabled}`]: {
|
|
40
|
+
[`& .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
41
|
+
borderColor: (theme.vars || theme).palette.action.disabled
|
|
42
|
+
},
|
|
43
|
+
'*': {
|
|
44
|
+
color: (theme.vars || theme).palette.action.disabled
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
[`&.${pickersOutlinedInputClasses.error} .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
48
|
+
borderColor: (theme.vars || theme).palette.error.main
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
const OutlinedPickersInputSectionsContainer = styled(PickersInputSectionsContainer, {
|
|
53
|
+
name: 'MuiPickersOutlinedInput',
|
|
54
|
+
slot: 'SectionsContainer',
|
|
55
|
+
overridesResolver: (props, styles) => styles.sectionsContainer
|
|
56
|
+
})(({
|
|
57
|
+
ownerState
|
|
58
|
+
}) => _extends({
|
|
59
|
+
padding: '16.5px 0'
|
|
60
|
+
}, ownerState.size === 'small' && {
|
|
61
|
+
padding: '8.5px 0'
|
|
62
|
+
}));
|
|
63
|
+
const useUtilityClasses = ownerState => {
|
|
64
|
+
const {
|
|
65
|
+
focused,
|
|
66
|
+
disabled,
|
|
67
|
+
error,
|
|
68
|
+
classes,
|
|
69
|
+
fullWidth,
|
|
70
|
+
color,
|
|
71
|
+
size,
|
|
72
|
+
endAdornment,
|
|
73
|
+
startAdornment
|
|
74
|
+
} = ownerState;
|
|
75
|
+
const slots = {
|
|
76
|
+
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${color ? capitalize(color) : ''}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
|
|
77
|
+
notchedOutline: ['notchedOutline'],
|
|
78
|
+
before: ['before'],
|
|
79
|
+
after: ['after'],
|
|
80
|
+
content: ['content'],
|
|
81
|
+
input: ['input']
|
|
82
|
+
};
|
|
83
|
+
return composeClasses(slots, getPickersOutlinedInputUtilityClass, classes);
|
|
84
|
+
};
|
|
85
|
+
export const PickersOutlinedInput = /*#__PURE__*/React.forwardRef(function PickersOutlinedInput(props, ref) {
|
|
86
|
+
const {
|
|
87
|
+
label,
|
|
88
|
+
ownerState: ownerStateProp,
|
|
89
|
+
notched
|
|
90
|
+
} = props,
|
|
91
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
92
|
+
const muiFormControl = useFormControl();
|
|
93
|
+
const ownerState = _extends({}, props, ownerStateProp, muiFormControl, {
|
|
94
|
+
color: (muiFormControl == null ? void 0 : muiFormControl.color) || 'primary'
|
|
95
|
+
});
|
|
96
|
+
const classes = useUtilityClasses(ownerState);
|
|
97
|
+
return /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
98
|
+
slots: {
|
|
99
|
+
root: OutlinedInputRoot,
|
|
100
|
+
input: OutlinedPickersInputSectionsContainer
|
|
101
|
+
},
|
|
102
|
+
renderSuffix: state => /*#__PURE__*/_jsx(Outline, {
|
|
103
|
+
shrink: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
104
|
+
notched: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
105
|
+
className: classes.notchedOutline,
|
|
106
|
+
label: label != null && label !== '' && muiFormControl != null && muiFormControl.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
107
|
+
children: [label, "\u2009", '*']
|
|
108
|
+
}) : label,
|
|
109
|
+
ownerState: ownerState
|
|
110
|
+
})
|
|
111
|
+
}, other, {
|
|
112
|
+
label: label,
|
|
113
|
+
classes: classes,
|
|
114
|
+
ref: ref
|
|
115
|
+
}));
|
|
116
|
+
});
|
|
117
|
+
PickersInput.muiName = 'Input';
|
|
@@ -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 == null ? void 0 : 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,4 @@
|
|
|
1
|
+
export { PickersInput } from './PickersInput';
|
|
2
|
+
export { PickersInputProps } from './PickersInput.types';
|
|
3
|
+
export { pickersInputClasses, getPickersInputUtilityClass } from './pickersInputClasses';
|
|
4
|
+
export type { PickersInputClasses, PickersInputClassKey } from './pickersInputClasses';
|