@mui/x-date-pickers 7.0.0-alpha.5 → 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 +226 -6
- 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/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/legacy/PickersSectionList/PickersSectionList.js +230 -0
- package/legacy/PickersSectionList/index.js +2 -0
- package/legacy/PickersSectionList/pickersSectionListClasses.js +6 -0
- 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/locales/ruRU.js +1 -2
- package/locales/ruRU.js +1 -2
- 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/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/locales/ruRU.js +1 -2
- package/node/PickersSectionList/PickersSectionList.js +228 -0
- package/node/PickersSectionList/index.js +49 -0
- package/node/PickersSectionList/pickersSectionListClasses.js +14 -0
- 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/locales/ruRU.js +1 -2
- package/package.json +4 -4
- 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);
|
|
@@ -209,51 +188,44 @@ export const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(
|
|
|
209
188
|
}, [muiFormControl, areAllSectionsEmpty]);
|
|
210
189
|
const ownerState = _extends({}, props, muiFormControl);
|
|
211
190
|
const classes = useUtilityClasses(ownerState);
|
|
212
|
-
|
|
191
|
+
const InputRoot = slots?.root || PickersInputRoot;
|
|
192
|
+
const InputSectionsContainer = slots?.input || PickersInputSectionsContainer;
|
|
193
|
+
return /*#__PURE__*/_jsxs(InputRoot, _extends({}, other, {
|
|
213
194
|
className: classes.root,
|
|
214
195
|
ownerState: ownerState,
|
|
215
196
|
"aria-invalid": muiFormControl.error,
|
|
216
197
|
ref: handleRootRef,
|
|
217
|
-
children: [startAdornment, /*#__PURE__*/_jsx(
|
|
218
|
-
|
|
219
|
-
|
|
198
|
+
children: [startAdornment, /*#__PURE__*/_jsx(PickersSectionList, {
|
|
199
|
+
sectionListRef: sectionListRef,
|
|
200
|
+
elements: elements,
|
|
220
201
|
contentEditable: contentEditable,
|
|
221
|
-
|
|
202
|
+
tabIndex: tabIndex,
|
|
203
|
+
className: classes.sectionsContainer,
|
|
222
204
|
onFocus: handleInputFocus,
|
|
223
205
|
onBlur: muiFormControl.onBlur,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
})
|
|
248
|
-
}), endAdornment, /*#__PURE__*/_jsx(NotchedOutlineRoot, {
|
|
249
|
-
shrink: muiFormControl.adornedStart || muiFormControl.focused || muiFormControl.filled,
|
|
250
|
-
notched: muiFormControl.adornedStart || muiFormControl.focused || muiFormControl.filled,
|
|
251
|
-
className: classes.notchedOutline,
|
|
252
|
-
label: label != null && label !== '' && muiFormControl.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
253
|
-
children: [label, "\u2009", '*']
|
|
254
|
-
}) : label,
|
|
255
|
-
ownerState: ownerState
|
|
256
|
-
}), /*#__PURE__*/_jsx(PickersInputInput, _extends({
|
|
206
|
+
onInput: onInput,
|
|
207
|
+
onPaste: onPaste,
|
|
208
|
+
onKeyDown: onKeyDown,
|
|
209
|
+
slots: {
|
|
210
|
+
root: InputSectionsContainer,
|
|
211
|
+
section: PickersInputSection,
|
|
212
|
+
sectionContent: PickersInputSectionContent,
|
|
213
|
+
sectionSeparator: PickersInputSeparator
|
|
214
|
+
},
|
|
215
|
+
slotProps: {
|
|
216
|
+
root: {
|
|
217
|
+
ownerState
|
|
218
|
+
},
|
|
219
|
+
sectionContent: {
|
|
220
|
+
className: pickersInputClasses.sectionContent
|
|
221
|
+
},
|
|
222
|
+
sectionSeparator: ({
|
|
223
|
+
position
|
|
224
|
+
}) => ({
|
|
225
|
+
className: position === 'before' ? pickersInputClasses.sectionBefore : pickersInputClasses.sectionAfter
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
}), endAdornment, renderSuffix ? renderSuffix(_extends({}, muiFormControl)) : null, /*#__PURE__*/_jsx(PickersInputInput, _extends({
|
|
257
229
|
className: classes.input,
|
|
258
230
|
value: value,
|
|
259
231
|
onChange: onChange,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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?.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?.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?.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']);
|
|
@@ -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) {
|