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