@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
package/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: 'выбрать дату',
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["slots", "slotProps", "elements", "sectionListRef"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import styled from '@mui/system/styled';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
8
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
10
|
+
import { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export const PickersSectionListRoot = styled('div', {
|
|
14
|
+
name: 'MuiPickersSectionList',
|
|
15
|
+
slot: 'Root',
|
|
16
|
+
overridesResolver: (props, styles) => styles.root
|
|
17
|
+
})({
|
|
18
|
+
direction: 'ltr /*! @noflip */',
|
|
19
|
+
outline: 'none'
|
|
20
|
+
});
|
|
21
|
+
export const PickersSectionListSection = styled('span', {
|
|
22
|
+
name: 'MuiPickersSectionList',
|
|
23
|
+
slot: 'Section',
|
|
24
|
+
overridesResolver: (props, styles) => styles.section
|
|
25
|
+
})({});
|
|
26
|
+
export const PickersSectionListSectionSeparator = styled('span', {
|
|
27
|
+
name: 'MuiPickersSectionList',
|
|
28
|
+
slot: 'SectionSeparator',
|
|
29
|
+
overridesResolver: (props, styles) => styles.sectionSeparator
|
|
30
|
+
})({
|
|
31
|
+
whiteSpace: 'pre'
|
|
32
|
+
});
|
|
33
|
+
export const PickersSectionListSectionContent = styled('span', {
|
|
34
|
+
name: 'MuiPickersSectionList',
|
|
35
|
+
slot: 'SectionContent',
|
|
36
|
+
overridesResolver: (props, styles) => styles.sectionContent
|
|
37
|
+
})({
|
|
38
|
+
outline: 'none'
|
|
39
|
+
});
|
|
40
|
+
const useUtilityClasses = ownerState => {
|
|
41
|
+
const {
|
|
42
|
+
classes
|
|
43
|
+
} = ownerState;
|
|
44
|
+
const slots = {
|
|
45
|
+
root: ['root'],
|
|
46
|
+
section: ['section'],
|
|
47
|
+
sectionContent: ['sectionContent']
|
|
48
|
+
};
|
|
49
|
+
return composeClasses(slots, getPickersSectionListUtilityClass, classes);
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Demos:
|
|
53
|
+
*
|
|
54
|
+
* - [Custom field](https://mui.com/x/react-date-pickers/custom-field/)
|
|
55
|
+
*
|
|
56
|
+
* API:
|
|
57
|
+
*
|
|
58
|
+
* - [PickersSectionList API](https://mui.com/x/api/date-pickers/pickers-section-list/)
|
|
59
|
+
*/
|
|
60
|
+
function PickersSection(props) {
|
|
61
|
+
const {
|
|
62
|
+
slots,
|
|
63
|
+
slotProps,
|
|
64
|
+
element,
|
|
65
|
+
classes
|
|
66
|
+
} = props;
|
|
67
|
+
const Section = slots?.section ?? PickersSectionListSection;
|
|
68
|
+
const sectionProps = useSlotProps({
|
|
69
|
+
elementType: Section,
|
|
70
|
+
externalSlotProps: slotProps?.section,
|
|
71
|
+
externalForwardedProps: element.container,
|
|
72
|
+
className: classes.section,
|
|
73
|
+
ownerState: {}
|
|
74
|
+
});
|
|
75
|
+
const SectionContent = slots?.sectionContent ?? PickersSectionListSectionContent;
|
|
76
|
+
const sectionContentProps = useSlotProps({
|
|
77
|
+
elementType: SectionContent,
|
|
78
|
+
externalSlotProps: slotProps?.sectionContent,
|
|
79
|
+
externalForwardedProps: element.content,
|
|
80
|
+
additionalProps: {
|
|
81
|
+
suppressContentEditableWarning: true
|
|
82
|
+
},
|
|
83
|
+
className: classes.sectionContent,
|
|
84
|
+
ownerState: {}
|
|
85
|
+
});
|
|
86
|
+
const SectionSeparator = slots?.sectionSeparator ?? PickersSectionListSectionSeparator;
|
|
87
|
+
const sectionSeparatorBeforeProps = useSlotProps({
|
|
88
|
+
elementType: SectionSeparator,
|
|
89
|
+
externalSlotProps: slotProps?.sectionSeparator,
|
|
90
|
+
externalForwardedProps: element.before,
|
|
91
|
+
ownerState: {
|
|
92
|
+
position: 'before'
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const sectionSeparatorAfterProps = useSlotProps({
|
|
96
|
+
elementType: SectionSeparator,
|
|
97
|
+
externalSlotProps: slotProps?.sectionSeparator,
|
|
98
|
+
externalForwardedProps: element.after,
|
|
99
|
+
ownerState: {
|
|
100
|
+
position: 'after'
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
return /*#__PURE__*/_jsxs(Section, _extends({}, sectionProps, {
|
|
104
|
+
children: [/*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorBeforeProps)), /*#__PURE__*/_jsx(SectionContent, _extends({}, sectionContentProps)), /*#__PURE__*/_jsx(SectionSeparator, _extends({}, sectionSeparatorAfterProps))]
|
|
105
|
+
}));
|
|
106
|
+
}
|
|
107
|
+
const PickersSectionList = /*#__PURE__*/React.forwardRef(function PickersSectionList(props, ref) {
|
|
108
|
+
const {
|
|
109
|
+
slots,
|
|
110
|
+
slotProps,
|
|
111
|
+
elements,
|
|
112
|
+
sectionListRef
|
|
113
|
+
} = props,
|
|
114
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
115
|
+
const classes = useUtilityClasses(props);
|
|
116
|
+
const rootRef = React.useRef(null);
|
|
117
|
+
const handleRootRef = useForkRef(ref, rootRef);
|
|
118
|
+
const getRoot = methodName => {
|
|
119
|
+
if (!rootRef.current) {
|
|
120
|
+
throw new Error(`MUI: Cannot call sectionListRef.${methodName} before the mount of the component`);
|
|
121
|
+
}
|
|
122
|
+
return rootRef.current;
|
|
123
|
+
};
|
|
124
|
+
React.useImperativeHandle(sectionListRef, () => ({
|
|
125
|
+
getRoot() {
|
|
126
|
+
return getRoot('getRoot');
|
|
127
|
+
},
|
|
128
|
+
getSectionContainer(index) {
|
|
129
|
+
const root = getRoot('getSectionContainer');
|
|
130
|
+
return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"]`);
|
|
131
|
+
},
|
|
132
|
+
getSectionContent(index) {
|
|
133
|
+
const root = getRoot('getSectionContent');
|
|
134
|
+
return root.querySelector(`.${pickersSectionListClasses.section}[data-sectionindex="${index}"] .${pickersSectionListClasses.sectionContent}`);
|
|
135
|
+
},
|
|
136
|
+
getSectionIndexFromDOMElement(element) {
|
|
137
|
+
const root = getRoot('getSectionIndexFromDOMElement');
|
|
138
|
+
if (element == null || !root.contains(element)) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
let sectionContainer = null;
|
|
142
|
+
if (element.classList.contains(pickersSectionListClasses.section)) {
|
|
143
|
+
sectionContainer = element;
|
|
144
|
+
} else if (element.classList.contains(pickersSectionListClasses.sectionContent)) {
|
|
145
|
+
sectionContainer = element.parentElement;
|
|
146
|
+
}
|
|
147
|
+
if (sectionContainer == null) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
return Number(sectionContainer.dataset.sectionindex);
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
const Root = slots?.root ?? PickersSectionListRoot;
|
|
154
|
+
const rootProps = useSlotProps({
|
|
155
|
+
elementType: Root,
|
|
156
|
+
externalSlotProps: slotProps?.root,
|
|
157
|
+
externalForwardedProps: other,
|
|
158
|
+
additionalProps: {
|
|
159
|
+
ref: handleRootRef,
|
|
160
|
+
suppressContentEditableWarning: true
|
|
161
|
+
},
|
|
162
|
+
className: classes.root,
|
|
163
|
+
ownerState: {}
|
|
164
|
+
});
|
|
165
|
+
return /*#__PURE__*/_jsx(Root, _extends({}, rootProps, {
|
|
166
|
+
children: rootProps.contentEditable ? elements.map(({
|
|
167
|
+
content,
|
|
168
|
+
before,
|
|
169
|
+
after
|
|
170
|
+
}) => `${before.children}${content.children}${after.children}`).join('') : /*#__PURE__*/_jsx(React.Fragment, {
|
|
171
|
+
children: elements.map((element, elementIndex) => /*#__PURE__*/_jsx(PickersSection, {
|
|
172
|
+
slots: slots,
|
|
173
|
+
slotProps: slotProps,
|
|
174
|
+
element: element,
|
|
175
|
+
classes: classes
|
|
176
|
+
}, elementIndex))
|
|
177
|
+
})
|
|
178
|
+
}));
|
|
179
|
+
});
|
|
180
|
+
process.env.NODE_ENV !== "production" ? PickersSectionList.propTypes = {
|
|
181
|
+
// ----------------------------- Warning --------------------------------
|
|
182
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
183
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
184
|
+
// ----------------------------------------------------------------------
|
|
185
|
+
/**
|
|
186
|
+
* Override or extend the styles applied to the component.
|
|
187
|
+
*/
|
|
188
|
+
classes: PropTypes.object,
|
|
189
|
+
/**
|
|
190
|
+
* If true, the whole element is editable.
|
|
191
|
+
* Useful when all the sections are selected.
|
|
192
|
+
*/
|
|
193
|
+
contentEditable: PropTypes.bool.isRequired,
|
|
194
|
+
/**
|
|
195
|
+
* The elements to render.
|
|
196
|
+
* Each element contains the prop to edit a section of the value.
|
|
197
|
+
*/
|
|
198
|
+
elements: PropTypes.arrayOf(PropTypes.shape({
|
|
199
|
+
after: PropTypes.object.isRequired,
|
|
200
|
+
before: PropTypes.object.isRequired,
|
|
201
|
+
container: PropTypes.object.isRequired,
|
|
202
|
+
content: PropTypes.object.isRequired
|
|
203
|
+
})).isRequired,
|
|
204
|
+
sectionListRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({
|
|
205
|
+
current: PropTypes.shape({
|
|
206
|
+
getRoot: PropTypes.func.isRequired,
|
|
207
|
+
getSectionContainer: PropTypes.func.isRequired,
|
|
208
|
+
getSectionContent: PropTypes.func.isRequired,
|
|
209
|
+
getSectionIndexFromDOMElement: PropTypes.func.isRequired
|
|
210
|
+
})
|
|
211
|
+
})]),
|
|
212
|
+
/**
|
|
213
|
+
* The props used for each component slot.
|
|
214
|
+
*/
|
|
215
|
+
slotProps: PropTypes.object,
|
|
216
|
+
/**
|
|
217
|
+
* Overridable component slots.
|
|
218
|
+
*/
|
|
219
|
+
slots: PropTypes.object
|
|
220
|
+
} : void 0;
|
|
221
|
+
export { PickersSectionList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { PickersSectionList as Unstable_PickersSectionList, PickersSectionListRoot as Unstable_PickersSectionListRoot, PickersSectionListSection as Unstable_PickersSectionListSection, PickersSectionListSectionSeparator as Unstable_PickersSectionListSectionSeparator, PickersSectionListSectionContent as Unstable_PickersSectionListSectionContent } from './PickersSectionList';
|
|
2
|
+
export { getPickersSectionListUtilityClass, pickersSectionListClasses } from './pickersSectionListClasses';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
export function getPickersSectionListUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiPickersSectionList', slot);
|
|
5
|
+
}
|
|
6
|
+
export const pickersSectionListClasses = generateUtilityClasses('MuiPickersSectionList', ['root', 'section', 'sectionContent']);
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-date-pickers v7.0.0-alpha.
|
|
2
|
+
* @mui/x-date-pickers v7.0.0-alpha.6
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -49,6 +49,9 @@ export * from './PickersShortcuts';
|
|
|
49
49
|
|
|
50
50
|
// Other slots
|
|
51
51
|
export * from './PickersCalendarHeader';
|
|
52
|
+
|
|
53
|
+
// Field utilities
|
|
54
|
+
export * from './PickersSectionList';
|
|
52
55
|
export { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from './internals/utils/utils';
|
|
53
56
|
export * from './models';
|
|
54
57
|
export * from './icons';
|
|
@@ -4,22 +4,38 @@ const _excluded = ["children", "className", "label"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { styled } from '@mui/material/styles';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const OutlineRoot = styled('fieldset'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
const OutlineRoot = styled('fieldset', {
|
|
8
|
+
name: 'MuiPickersOutlinedInput',
|
|
9
|
+
slot: 'NotchedOutline',
|
|
10
|
+
overridesResolver: (props, styles) => styles.notchedOutline
|
|
11
|
+
})(({
|
|
12
|
+
theme
|
|
13
|
+
}) => {
|
|
14
|
+
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
15
|
+
return {
|
|
16
|
+
textAlign: 'left',
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
bottom: 0,
|
|
19
|
+
right: 0,
|
|
20
|
+
top: -5,
|
|
21
|
+
left: 0,
|
|
22
|
+
margin: 0,
|
|
23
|
+
padding: '0 8px',
|
|
24
|
+
pointerEvents: 'none',
|
|
25
|
+
borderRadius: 'inherit',
|
|
26
|
+
borderStyle: 'solid',
|
|
27
|
+
borderWidth: 1,
|
|
28
|
+
overflow: 'hidden',
|
|
29
|
+
minWidth: '0%',
|
|
30
|
+
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
31
|
+
};
|
|
22
32
|
});
|
|
33
|
+
const OutlineLabel = styled('span')(({
|
|
34
|
+
theme
|
|
35
|
+
}) => ({
|
|
36
|
+
fontFamily: theme.typography.fontFamily,
|
|
37
|
+
fontSize: 'inherit'
|
|
38
|
+
}));
|
|
23
39
|
const OutlineLegend = styled('legend')(({
|
|
24
40
|
ownerState,
|
|
25
41
|
theme
|
|
@@ -78,17 +94,17 @@ export default function Outline(props) {
|
|
|
78
94
|
});
|
|
79
95
|
return /*#__PURE__*/_jsx(OutlineRoot, _extends({
|
|
80
96
|
"aria-hidden": true,
|
|
81
|
-
className: className
|
|
82
|
-
ownerState: ownerState
|
|
97
|
+
className: className
|
|
83
98
|
}, other, {
|
|
99
|
+
ownerState: ownerState,
|
|
84
100
|
children: /*#__PURE__*/_jsx(OutlineLegend, {
|
|
85
101
|
ownerState: ownerState,
|
|
86
|
-
children: withLabel ? /*#__PURE__*/_jsx(
|
|
102
|
+
children: withLabel ? /*#__PURE__*/_jsx(OutlineLabel, {
|
|
87
103
|
children: label
|
|
88
104
|
}) :
|
|
89
105
|
/*#__PURE__*/
|
|
90
106
|
// notranslate needed while Google Translate will not fix zero-width space issue
|
|
91
|
-
_jsx(
|
|
107
|
+
_jsx(OutlineLabel, {
|
|
92
108
|
className: "notranslate",
|
|
93
109
|
children: "\u200B"
|
|
94
110
|
})
|
|
@@ -0,0 +1,165 @@
|
|
|
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 { pickersFilledInputClasses, getPickersFilledInputUtilityClass } from './pickersInputClasses';
|
|
9
|
+
import { PickersInputRoot, PickersInput, PickersInputSectionsContainer } from './PickersInput';
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const FilledInputRoot = styled(PickersInputRoot, {
|
|
12
|
+
name: 'MuiPickersFilledInput',
|
|
13
|
+
slot: 'Root',
|
|
14
|
+
overridesResolver: (props, styles) => styles.root
|
|
15
|
+
})(({
|
|
16
|
+
theme,
|
|
17
|
+
ownerState
|
|
18
|
+
}) => {
|
|
19
|
+
const light = theme.palette.mode === 'light';
|
|
20
|
+
const bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
|
21
|
+
const backgroundColor = light ? 'rgba(0, 0, 0, 0.06)' : 'rgba(255, 255, 255, 0.09)';
|
|
22
|
+
const hoverBackground = light ? 'rgba(0, 0, 0, 0.09)' : 'rgba(255, 255, 255, 0.13)';
|
|
23
|
+
const disabledBackground = light ? 'rgba(0, 0, 0, 0.12)' : 'rgba(255, 255, 255, 0.12)';
|
|
24
|
+
return _extends({
|
|
25
|
+
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor,
|
|
26
|
+
borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
|
|
27
|
+
borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
|
|
28
|
+
transition: theme.transitions.create('background-color', {
|
|
29
|
+
duration: theme.transitions.duration.shorter,
|
|
30
|
+
easing: theme.transitions.easing.easeOut
|
|
31
|
+
}),
|
|
32
|
+
'&:hover': {
|
|
33
|
+
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.hoverBg : hoverBackground,
|
|
34
|
+
// Reset on touch devices, it doesn't add specificity
|
|
35
|
+
'@media (hover: none)': {
|
|
36
|
+
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
[`&.${pickersFilledInputClasses.focused}`]: {
|
|
40
|
+
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor
|
|
41
|
+
},
|
|
42
|
+
[`&.${pickersFilledInputClasses.disabled}`]: {
|
|
43
|
+
backgroundColor: theme.vars ? theme.vars.palette.FilledInput.disabledBg : disabledBackground
|
|
44
|
+
}
|
|
45
|
+
}, !ownerState.disableUnderline && {
|
|
46
|
+
'&:after': {
|
|
47
|
+
borderBottom: `2px solid ${(theme.vars || theme).palette[ownerState.color || 'primary']?.main}`,
|
|
48
|
+
left: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
|
51
|
+
content: '""',
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
right: 0,
|
|
54
|
+
transform: 'scaleX(0)',
|
|
55
|
+
transition: theme.transitions.create('transform', {
|
|
56
|
+
duration: theme.transitions.duration.shorter,
|
|
57
|
+
easing: theme.transitions.easing.easeOut
|
|
58
|
+
}),
|
|
59
|
+
pointerEvents: 'none' // Transparent to the hover style.
|
|
60
|
+
},
|
|
61
|
+
[`&.${pickersFilledInputClasses.focused}:after`]: {
|
|
62
|
+
// translateX(0) is a workaround for Safari transform scale bug
|
|
63
|
+
// See https://github.com/mui/material-ui/issues/31766
|
|
64
|
+
transform: 'scaleX(1) translateX(0)'
|
|
65
|
+
},
|
|
66
|
+
[`&.${pickersFilledInputClasses.error}`]: {
|
|
67
|
+
'&:before, &:after': {
|
|
68
|
+
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
'&:before': {
|
|
72
|
+
borderBottom: `1px solid ${theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})` : bottomLineColor}`,
|
|
73
|
+
left: 0,
|
|
74
|
+
bottom: 0,
|
|
75
|
+
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
|
76
|
+
content: '"\\00a0"',
|
|
77
|
+
position: 'absolute',
|
|
78
|
+
right: 0,
|
|
79
|
+
transition: theme.transitions.create('border-bottom-color', {
|
|
80
|
+
duration: theme.transitions.duration.shorter
|
|
81
|
+
}),
|
|
82
|
+
pointerEvents: 'none' // Transparent to the hover style.
|
|
83
|
+
},
|
|
84
|
+
[`&:hover:not(.${pickersFilledInputClasses.disabled}, .${pickersFilledInputClasses.error}):before`]: {
|
|
85
|
+
borderBottom: `1px solid ${(theme.vars || theme).palette.text.primary}`
|
|
86
|
+
},
|
|
87
|
+
[`&.${pickersFilledInputClasses.disabled}:before`]: {
|
|
88
|
+
borderBottomStyle: 'dotted'
|
|
89
|
+
}
|
|
90
|
+
}, ownerState.startAdornment && {
|
|
91
|
+
paddingLeft: 12
|
|
92
|
+
}, ownerState.endAdornment && {
|
|
93
|
+
paddingRight: 12
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
const FilledSectionsContainer = styled(PickersInputSectionsContainer, {
|
|
97
|
+
name: 'MuiPickersFilledInput',
|
|
98
|
+
slot: 'sectionsContainer',
|
|
99
|
+
overridesResolver: (props, styles) => styles.sectionsContainer
|
|
100
|
+
})(({
|
|
101
|
+
ownerState
|
|
102
|
+
}) => _extends({
|
|
103
|
+
paddingTop: 25,
|
|
104
|
+
paddingRight: 12,
|
|
105
|
+
paddingBottom: 8,
|
|
106
|
+
paddingLeft: 12
|
|
107
|
+
}, ownerState.size === 'small' && {
|
|
108
|
+
paddingTop: 21,
|
|
109
|
+
paddingBottom: 4
|
|
110
|
+
}, ownerState.startAdornment && {
|
|
111
|
+
paddingLeft: 0
|
|
112
|
+
}, ownerState.endAdornment && {
|
|
113
|
+
paddingRight: 0
|
|
114
|
+
}, ownerState.hiddenLabel && {
|
|
115
|
+
paddingTop: 16,
|
|
116
|
+
paddingBottom: 17
|
|
117
|
+
}, ownerState.hiddenLabel && ownerState.size === 'small' && {
|
|
118
|
+
paddingTop: 8,
|
|
119
|
+
paddingBottom: 9
|
|
120
|
+
}));
|
|
121
|
+
const useUtilityClasses = ownerState => {
|
|
122
|
+
const {
|
|
123
|
+
focused,
|
|
124
|
+
disabled,
|
|
125
|
+
error,
|
|
126
|
+
classes,
|
|
127
|
+
fullWidth,
|
|
128
|
+
color,
|
|
129
|
+
size,
|
|
130
|
+
endAdornment,
|
|
131
|
+
startAdornment
|
|
132
|
+
} = ownerState;
|
|
133
|
+
const slots = {
|
|
134
|
+
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${capitalize(color)}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
|
|
135
|
+
notchedOutline: ['notchedOutline'],
|
|
136
|
+
before: ['before'],
|
|
137
|
+
after: ['after'],
|
|
138
|
+
content: ['content'],
|
|
139
|
+
input: ['input']
|
|
140
|
+
};
|
|
141
|
+
return composeClasses(slots, getPickersFilledInputUtilityClass, classes);
|
|
142
|
+
};
|
|
143
|
+
export const PickersFilledInput = /*#__PURE__*/React.forwardRef(function PickersFilledInput(props, ref) {
|
|
144
|
+
const {
|
|
145
|
+
label,
|
|
146
|
+
ownerState: ownerStateProp
|
|
147
|
+
} = props,
|
|
148
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
149
|
+
const muiFormControl = useFormControl();
|
|
150
|
+
const ownerState = _extends({}, props, ownerStateProp, muiFormControl, {
|
|
151
|
+
color: muiFormControl?.color || 'primary'
|
|
152
|
+
});
|
|
153
|
+
const classes = useUtilityClasses(ownerState);
|
|
154
|
+
return /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
155
|
+
slots: {
|
|
156
|
+
root: FilledInputRoot,
|
|
157
|
+
input: FilledSectionsContainer
|
|
158
|
+
}
|
|
159
|
+
}, other, {
|
|
160
|
+
label: label,
|
|
161
|
+
classes: classes,
|
|
162
|
+
ref: ref
|
|
163
|
+
}));
|
|
164
|
+
});
|
|
165
|
+
PickersInput.muiName = 'Input';
|