@mui/x-date-pickers 7.0.0-alpha.8 → 7.0.0-alpha.9
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/AdapterLuxon/AdapterLuxon.d.ts +1 -1
- package/AdapterLuxon/AdapterLuxon.js +4 -12
- package/CHANGELOG.md +379 -2
- package/DatePicker/DatePicker.js +0 -3
- package/DatePicker/DatePickerToolbar.js +0 -3
- package/DateTimePicker/DateTimePicker.js +0 -3
- package/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/MobileDatePicker/MobileDatePicker.js +0 -3
- package/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/MobileTimePicker/MobileTimePicker.js +0 -3
- package/MonthCalendar/MonthCalendar.js +0 -3
- package/MonthCalendar/MonthCalendar.types.d.ts +0 -3
- package/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +0 -3
- package/PickersSectionList/PickersSectionList.js +6 -1
- package/PickersTextField/PickersFilledInput/PickersFilledInput.d.ts +11 -0
- package/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
- package/PickersTextField/PickersFilledInput/index.d.ts +4 -0
- package/PickersTextField/PickersFilledInput/index.js +2 -0
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.d.ts +23 -0
- package/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/PickersTextField/PickersInput/PickersInput.d.ts +10 -0
- package/PickersTextField/PickersInput/PickersInput.js +196 -0
- package/{internals/components → PickersTextField}/PickersInput/index.d.ts +2 -2
- package/PickersTextField/PickersInput/index.js +2 -0
- package/PickersTextField/PickersInput/pickersInputClasses.d.ts +22 -0
- package/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/PickersTextField/PickersInputBase/PickersInputBase.d.ts +16 -0
- package/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -27
- package/{internals/components/PickersInput/PickersInput.types.d.ts → PickersTextField/PickersInputBase/PickersInputBase.types.d.ts} +3 -13
- package/PickersTextField/PickersInputBase/index.d.ts +4 -0
- package/PickersTextField/PickersInputBase/index.js +2 -0
- package/PickersTextField/PickersInputBase/pickersInputBaseClasses.d.ts +31 -0
- package/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.d.ts +3 -0
- package/{modern/internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.d.ts +10 -0
- package/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
- package/PickersTextField/PickersOutlinedInput/index.d.ts +4 -0
- package/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.d.ts +22 -0
- package/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/PickersTextField/PickersTextField.d.ts +3 -0
- package/PickersTextField/PickersTextField.js +258 -0
- package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.d.ts +5 -2
- package/PickersTextField/index.d.ts +8 -0
- package/PickersTextField/index.js +6 -0
- package/PickersTextField/package.json +6 -0
- package/README.md +1 -1
- package/StaticDatePicker/StaticDatePicker.js +0 -3
- package/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/StaticTimePicker/StaticTimePicker.js +0 -3
- package/TimePicker/TimePicker.js +0 -3
- package/TimePicker/TimePickerToolbar.js +0 -3
- package/YearCalendar/YearCalendar.js +0 -3
- package/YearCalendar/YearCalendar.types.d.ts +0 -3
- package/index.d.ts +2 -1
- package/index.js +3 -2
- package/internals/hooks/useField/useField.js +6 -4
- package/internals/hooks/useField/useField.types.d.ts +4 -2
- package/internals/hooks/useField/useField.utils.d.ts +19 -9
- package/internals/hooks/useField/useField.utils.js +68 -21
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +2 -1
- package/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/internals/hooks/useField/useFieldState.d.ts +1 -0
- package/internals/hooks/useField/useFieldState.js +9 -7
- package/internals/models/props/basePickerProps.d.ts +0 -3
- package/internals/models/props/toolbar.d.ts +0 -3
- package/internals/utils/valueManagers.js +2 -2
- package/legacy/AdapterLuxon/AdapterLuxon.js +4 -12
- package/legacy/DatePicker/DatePicker.js +0 -3
- package/legacy/DatePicker/DatePickerToolbar.js +0 -3
- package/legacy/DateTimePicker/DateTimePicker.js +0 -3
- package/legacy/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/legacy/MobileDatePicker/MobileDatePicker.js +0 -3
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/legacy/MobileTimePicker/MobileTimePicker.js +0 -3
- package/legacy/MonthCalendar/MonthCalendar.js +0 -3
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/legacy/PickersSectionList/PickersSectionList.js +6 -1
- package/legacy/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +99 -26
- package/legacy/PickersTextField/PickersFilledInput/index.js +2 -0
- package/legacy/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/legacy/PickersTextField/PickersInput/PickersInput.js +190 -0
- package/legacy/PickersTextField/PickersInput/index.js +2 -0
- package/legacy/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/legacy/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -27
- package/legacy/PickersTextField/PickersInputBase/index.js +2 -0
- package/legacy/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/legacy/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +7 -1
- package/legacy/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +183 -0
- package/legacy/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/legacy/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -8
- package/legacy/PickersTextField/index.js +6 -0
- package/legacy/StaticDatePicker/StaticDatePicker.js +0 -3
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/legacy/StaticTimePicker/StaticTimePicker.js +0 -3
- package/legacy/TimePicker/TimePicker.js +0 -3
- package/legacy/TimePicker/TimePickerToolbar.js +0 -3
- package/legacy/YearCalendar/YearCalendar.js +0 -3
- package/legacy/index.js +3 -2
- package/legacy/internals/hooks/useField/useField.js +6 -4
- package/legacy/internals/hooks/useField/useField.utils.js +71 -20
- package/legacy/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/legacy/internals/hooks/useField/useFieldState.js +15 -11
- package/legacy/internals/utils/valueManagers.js +2 -2
- package/modern/AdapterLuxon/AdapterLuxon.js +3 -11
- package/modern/DatePicker/DatePicker.js +0 -3
- package/modern/DatePicker/DatePickerToolbar.js +0 -3
- package/modern/DateTimePicker/DateTimePicker.js +0 -3
- package/modern/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/modern/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/modern/MobileDatePicker/MobileDatePicker.js +0 -3
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/modern/MobileTimePicker/MobileTimePicker.js +0 -3
- package/modern/MonthCalendar/MonthCalendar.js +0 -3
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/modern/PickersSectionList/PickersSectionList.js +6 -1
- package/modern/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +98 -25
- package/modern/PickersTextField/PickersFilledInput/index.js +2 -0
- package/modern/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +8 -0
- package/modern/PickersTextField/PickersInput/PickersInput.js +196 -0
- package/modern/PickersTextField/PickersInput/index.js +2 -0
- package/modern/PickersTextField/PickersInput/pickersInputClasses.js +8 -0
- package/modern/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +106 -27
- package/modern/PickersTextField/PickersInputBase/index.js +2 -0
- package/modern/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +6 -0
- package/{internals/components/PickersInput → modern/PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/modern/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +190 -0
- package/modern/PickersTextField/PickersOutlinedInput/index.js +2 -0
- package/modern/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +8 -0
- package/modern/PickersTextField/PickersTextField.js +258 -0
- package/modern/PickersTextField/index.js +6 -0
- package/modern/StaticDatePicker/StaticDatePicker.js +0 -3
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/modern/StaticTimePicker/StaticTimePicker.js +0 -3
- package/modern/TimePicker/TimePicker.js +0 -3
- package/modern/TimePicker/TimePickerToolbar.js +0 -3
- package/modern/YearCalendar/YearCalendar.js +0 -3
- package/modern/index.js +3 -2
- package/modern/internals/hooks/useField/useField.js +5 -3
- package/modern/internals/hooks/useField/useField.utils.js +68 -21
- package/modern/internals/hooks/useField/useFieldCharacterEditing.js +12 -8
- package/modern/internals/hooks/useField/useFieldState.js +9 -7
- package/modern/internals/utils/valueManagers.js +2 -2
- package/node/AdapterLuxon/AdapterLuxon.js +3 -11
- package/node/DatePicker/DatePicker.js +0 -3
- package/node/DatePicker/DatePickerToolbar.js +0 -3
- package/node/DateTimePicker/DateTimePicker.js +0 -3
- package/node/DateTimePicker/DateTimePickerToolbar.js +0 -3
- package/node/DesktopDatePicker/DesktopDatePicker.js +0 -3
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -3
- package/node/DesktopTimePicker/DesktopTimePicker.js +0 -3
- package/node/MobileDatePicker/MobileDatePicker.js +0 -3
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -3
- package/node/MobileTimePicker/MobileTimePicker.js +0 -3
- package/node/MonthCalendar/MonthCalendar.js +0 -3
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +0 -3
- package/node/PickersSectionList/PickersSectionList.js +6 -1
- package/node/{internals/components/PickersInput → PickersTextField/PickersFilledInput}/PickersFilledInput.js +102 -30
- package/node/PickersTextField/PickersFilledInput/index.js +25 -0
- package/node/PickersTextField/PickersFilledInput/pickersFilledInputClasses.js +16 -0
- package/node/PickersTextField/PickersInput/PickersInput.js +204 -0
- package/node/{internals/components → PickersTextField}/PickersInput/index.js +0 -7
- package/node/PickersTextField/PickersInput/pickersInputClasses.js +16 -0
- package/node/{internals/components/PickersInput/PickersInput.js → PickersTextField/PickersInputBase/PickersInputBase.js} +105 -27
- package/node/PickersTextField/PickersInputBase/index.js +25 -0
- package/node/PickersTextField/PickersInputBase/pickersInputBaseClasses.js +14 -0
- package/node/{internals/components/PickersInput → PickersTextField/PickersOutlinedInput}/Outline.js +5 -1
- package/node/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.js +197 -0
- package/node/PickersTextField/PickersOutlinedInput/index.js +25 -0
- package/node/PickersTextField/PickersOutlinedInput/pickersOutlinedInputClasses.js +16 -0
- package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.js +128 -9
- package/node/PickersTextField/index.js +78 -0
- package/node/StaticDatePicker/StaticDatePicker.js +0 -3
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -3
- package/node/StaticTimePicker/StaticTimePicker.js +0 -3
- package/node/TimePicker/TimePicker.js +0 -3
- package/node/TimePicker/TimePickerToolbar.js +0 -3
- package/node/YearCalendar/YearCalendar.js +0 -3
- package/node/index.js +17 -5
- package/node/internals/hooks/useField/useField.js +5 -3
- package/node/internals/hooks/useField/useField.utils.js +73 -22
- package/node/internals/hooks/useField/useFieldCharacterEditing.js +11 -7
- package/node/internals/hooks/useField/useFieldState.js +8 -6
- package/node/internals/utils/valueManagers.js +2 -2
- package/package.json +7 -7
- package/themeAugmentation/components.d.ts +26 -0
- package/themeAugmentation/overrides.d.ts +16 -0
- package/themeAugmentation/props.d.ts +16 -0
- package/internals/components/PickersInput/PickersFilledInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersInput.d.ts +0 -13
- package/internals/components/PickersInput/PickersOutlinedInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
- package/internals/components/PickersInput/PickersStandardInput.d.ts +0 -3
- package/internals/components/PickersInput/PickersStandardInput.js +0 -123
- package/internals/components/PickersInput/index.js +0 -3
- package/internals/components/PickersInput/pickersInputClasses.d.ts +0 -84
- package/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/internals/components/PickersTextField/PickersTextField.d.ts +0 -2
- package/internals/components/PickersTextField/PickersTextField.js +0 -138
- package/internals/components/PickersTextField/index.d.ts +0 -1
- package/internals/components/PickersTextField/index.js +0 -1
- package/legacy/internals/components/PickersInput/PickersOutlinedInput.js +0 -110
- package/legacy/internals/components/PickersInput/PickersStandardInput.js +0 -117
- package/legacy/internals/components/PickersInput/index.js +0 -3
- package/legacy/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/legacy/internals/components/PickersTextField/index.js +0 -1
- package/modern/internals/components/PickersInput/PickersOutlinedInput.js +0 -117
- package/modern/internals/components/PickersInput/PickersStandardInput.js +0 -123
- package/modern/internals/components/PickersInput/index.js +0 -3
- package/modern/internals/components/PickersInput/pickersInputClasses.js +0 -18
- package/modern/internals/components/PickersTextField/PickersTextField.js +0 -138
- package/modern/internals/components/PickersTextField/index.js +0 -1
- package/node/internals/components/PickersInput/PickersOutlinedInput.js +0 -125
- package/node/internals/components/PickersInput/PickersStandardInput.js +0 -132
- package/node/internals/components/PickersInput/pickersInputClasses.js +0 -29
- package/node/internals/components/PickersTextField/index.js +0 -12
- /package/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.d.ts +0 -0
- /package/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/legacy/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/legacy/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/legacy/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/modern/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/modern/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/modern/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
- /package/node/{internals/components/PickersInput/PickersInput.types.js → PickersTextField/PickersInputBase/PickersInputBase.types.js} +0 -0
- /package/node/{internals/components/PickersTextField → PickersTextField}/PickersTextField.types.js +0 -0
- /package/node/{internals/components/PickersTextField → PickersTextField}/pickersTextFieldClasses.js +0 -0
|
@@ -48,6 +48,7 @@ const useFieldCharacterEditing = ({
|
|
|
48
48
|
sections,
|
|
49
49
|
updateSectionValue,
|
|
50
50
|
sectionsValueBoundaries,
|
|
51
|
+
localizedDigits,
|
|
51
52
|
setTempAndroidValueStr,
|
|
52
53
|
timezone
|
|
53
54
|
}) => {
|
|
@@ -76,7 +77,7 @@ const useFieldCharacterEditing = ({
|
|
|
76
77
|
const activeSection = sections[sectionIndex];
|
|
77
78
|
|
|
78
79
|
// The current query targets the section being editing
|
|
79
|
-
// We can try to
|
|
80
|
+
// We can try to concatenate the value
|
|
80
81
|
if (query != null && (!isValidQueryValue || isValidQueryValue(query.value)) && query.sectionIndex === sectionIndex) {
|
|
81
82
|
const concatenatedQueryValue = `${query.value}${cleanKeyPressed}`;
|
|
82
83
|
const queryResponse = getFirstSectionValueMatchingWithQuery(concatenatedQueryValue, activeSection);
|
|
@@ -170,7 +171,8 @@ const useFieldCharacterEditing = ({
|
|
|
170
171
|
};
|
|
171
172
|
const applyNumericEditing = params => {
|
|
172
173
|
const getNewSectionValue = (queryValue, section) => {
|
|
173
|
-
const
|
|
174
|
+
const cleanQueryValue = (0, _useField.removeLocalizedDigits)(queryValue, localizedDigits);
|
|
175
|
+
const queryValueNumber = Number(cleanQueryValue);
|
|
174
176
|
const sectionBoundaries = sectionsValueBoundaries[section.type]({
|
|
175
177
|
currentDate: null,
|
|
176
178
|
format: section.format,
|
|
@@ -190,8 +192,8 @@ const useFieldCharacterEditing = ({
|
|
|
190
192
|
saveQuery: true
|
|
191
193
|
};
|
|
192
194
|
}
|
|
193
|
-
const shouldGoToNextSection =
|
|
194
|
-
const newSectionValue = (0, _useField.cleanDigitSectionValue)(utils,
|
|
195
|
+
const shouldGoToNextSection = queryValueNumber * 10 > sectionBoundaries.maximum || cleanQueryValue.length === sectionBoundaries.maximum.toString().length;
|
|
196
|
+
const newSectionValue = (0, _useField.cleanDigitSectionValue)(utils, queryValueNumber, sectionBoundaries, localizedDigits, section);
|
|
195
197
|
return {
|
|
196
198
|
sectionValue: newSectionValue,
|
|
197
199
|
shouldGoToNextSection
|
|
@@ -239,12 +241,14 @@ const useFieldCharacterEditing = ({
|
|
|
239
241
|
saveQuery: false
|
|
240
242
|
};
|
|
241
243
|
};
|
|
242
|
-
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue =>
|
|
244
|
+
return applyQuery(params, getFirstSectionValueMatchingWithQuery, queryValue => (0, _useField.isStringNumber)(queryValue, localizedDigits));
|
|
243
245
|
};
|
|
244
246
|
const applyCharacterEditing = (0, _useEventCallback.default)(params => {
|
|
245
247
|
const activeSection = sections[params.sectionIndex];
|
|
246
|
-
const isNumericEditing =
|
|
247
|
-
const response = isNumericEditing ? applyNumericEditing(
|
|
248
|
+
const isNumericEditing = (0, _useField.isStringNumber)(params.keyPressed, localizedDigits);
|
|
249
|
+
const response = isNumericEditing ? applyNumericEditing((0, _extends2.default)({}, params, {
|
|
250
|
+
keyPressed: (0, _useField.applyLocalizedDigits)(params.keyPressed, localizedDigits)
|
|
251
|
+
})) : applyLetterEditing(params);
|
|
248
252
|
if (response == null) {
|
|
249
253
|
setTempAndroidValueStr(null);
|
|
250
254
|
} else {
|
|
@@ -51,9 +51,10 @@ const useFieldState = params => {
|
|
|
51
51
|
onChange,
|
|
52
52
|
valueManager
|
|
53
53
|
});
|
|
54
|
-
const
|
|
55
|
-
const
|
|
56
|
-
const
|
|
54
|
+
const localizedDigits = React.useMemo(() => (0, _useField.getLocalizedDigits)(utils), [utils]);
|
|
55
|
+
const sectionsValueBoundaries = React.useMemo(() => (0, _useField.getSectionsBoundaries)(utils, localizedDigits, timezone), [utils, localizedDigits, timezone]);
|
|
56
|
+
const getSectionsFromValue = React.useCallback((value, fallbackSections = null) => fieldValueManager.getSectionsFromValue(utils, value, fallbackSections, localizedDigits, isRTL, date => (0, _useField.splitFormatIntoSections)(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL)), [fieldValueManager, format, localeText, localizedDigits, isRTL, shouldRespectLeadingZeros, utils, formatDensity, timezone]);
|
|
57
|
+
const placeholder = React.useMemo(() => fieldValueManager.getValueStrFromSections(getSectionsFromValue(valueManager.emptyValue), localizedDigits, isRTL), [fieldValueManager, getSectionsFromValue, valueManager.emptyValue, localizedDigits, isRTL]);
|
|
57
58
|
const [state, setState] = React.useState(() => {
|
|
58
59
|
const sections = getSectionsFromValue(valueFromTheOutside);
|
|
59
60
|
(0, _useField.validateSections)(sections, valueType);
|
|
@@ -151,7 +152,7 @@ const useFieldState = params => {
|
|
|
151
152
|
value: newSectionValue,
|
|
152
153
|
modified: true
|
|
153
154
|
});
|
|
154
|
-
return (0, _useField.addPositionPropertiesToSections)(newSections, isRTL);
|
|
155
|
+
return (0, _useField.addPositionPropertiesToSections)(newSections, localizedDigits, isRTL);
|
|
155
156
|
};
|
|
156
157
|
const clearValue = () => {
|
|
157
158
|
publishValue({
|
|
@@ -188,7 +189,7 @@ const useFieldState = params => {
|
|
|
188
189
|
if (date == null || !utils.isValid(date)) {
|
|
189
190
|
return null;
|
|
190
191
|
}
|
|
191
|
-
const sections = (0, _useField.splitFormatIntoSections)(utils, timezone, localeText, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
192
|
+
const sections = (0, _useField.splitFormatIntoSections)(utils, timezone, localeText, localizedDigits, format, date, formatDensity, shouldRespectLeadingZeros, isRTL);
|
|
192
193
|
return (0, _useField.mergeDateIntoReferenceDate)(utils, timezone, date, sections, referenceDate, false);
|
|
193
194
|
};
|
|
194
195
|
const newValue = fieldValueManager.parseValueStr(valueStr, state.referenceValue, parseDateStr);
|
|
@@ -219,7 +220,7 @@ const useFieldState = params => {
|
|
|
219
220
|
const activeDateManager = fieldValueManager.getActiveDateManager(utils, state, activeSection);
|
|
220
221
|
const newSections = setSectionValue(selectedSectionIndexes.startIndex, newSectionValue);
|
|
221
222
|
const newActiveDateSections = activeDateManager.getSections(newSections);
|
|
222
|
-
const newActiveDate = (0, _useField.getDateFromDateSections)(utils, newActiveDateSections);
|
|
223
|
+
const newActiveDate = (0, _useField.getDateFromDateSections)(utils, newActiveDateSections, localizedDigits);
|
|
223
224
|
let values;
|
|
224
225
|
let shouldPublish;
|
|
225
226
|
|
|
@@ -287,6 +288,7 @@ const useFieldState = params => {
|
|
|
287
288
|
updateValueFromValueStr,
|
|
288
289
|
setTempAndroidValueStr,
|
|
289
290
|
sectionsValueBoundaries,
|
|
291
|
+
localizedDigits,
|
|
290
292
|
placeholder,
|
|
291
293
|
timezone
|
|
292
294
|
};
|
|
@@ -37,12 +37,12 @@ const singleItemValueManager = exports.singleItemValueManager = {
|
|
|
37
37
|
};
|
|
38
38
|
const singleItemFieldValueManager = exports.singleItemFieldValueManager = {
|
|
39
39
|
updateReferenceValue: (utils, value, prevReferenceValue) => value == null || !utils.isValid(value) ? prevReferenceValue : value,
|
|
40
|
-
getSectionsFromValue: (utils, date, prevSections, isRTL, getSectionsFromDate) => {
|
|
40
|
+
getSectionsFromValue: (utils, date, prevSections, localizedDigits, isRTL, getSectionsFromDate) => {
|
|
41
41
|
const shouldReUsePrevDateSections = !utils.isValid(date) && !!prevSections;
|
|
42
42
|
if (shouldReUsePrevDateSections) {
|
|
43
43
|
return prevSections;
|
|
44
44
|
}
|
|
45
|
-
return (0, _useField.addPositionPropertiesToSections)(getSectionsFromDate(date), isRTL);
|
|
45
|
+
return (0, _useField.addPositionPropertiesToSections)(getSectionsFromDate(date), localizedDigits, isRTL);
|
|
46
46
|
},
|
|
47
47
|
getValueStrFromSections: _useField.createDateStrForInputFromSections,
|
|
48
48
|
getActiveDateManager: (utils, state) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.9",
|
|
4
4
|
"description": "The community edition of the date picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./node/index.js",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"directory": "packages/x-date-pickers"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/runtime": "^7.23.
|
|
38
|
-
"@mui/base": "^5.0.0-beta.
|
|
39
|
-
"@mui/system": "^5.15.
|
|
40
|
-
"@mui/utils": "^5.15.
|
|
37
|
+
"@babel/runtime": "^7.23.8",
|
|
38
|
+
"@mui/base": "^5.0.0-beta.32",
|
|
39
|
+
"@mui/system": "^5.15.5",
|
|
40
|
+
"@mui/utils": "^5.15.5",
|
|
41
41
|
"@types/react-transition-group": "^4.4.10",
|
|
42
|
-
"clsx": "^2.
|
|
42
|
+
"clsx": "^2.1.0",
|
|
43
43
|
"prop-types": "^15.8.1",
|
|
44
44
|
"react-transition-group": "^4.4.5"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@emotion/react": "^11.9.0",
|
|
48
48
|
"@emotion/styled": "^11.8.1",
|
|
49
|
-
"@mui/material": "^5.
|
|
49
|
+
"@mui/material": "^5.15.0",
|
|
50
50
|
"date-fns": "^2.25.0 || ^3.2.0",
|
|
51
51
|
"date-fns-jalali": "^2.13.0-0",
|
|
52
52
|
"dayjs": "^1.10.7",
|
|
@@ -167,6 +167,32 @@ export interface PickerComponents<Theme = unknown> {
|
|
|
167
167
|
MuiStaticDateTimePicker?: {
|
|
168
168
|
defaultProps?: ComponentsProps['MuiStaticDateTimePicker'];
|
|
169
169
|
};
|
|
170
|
+
|
|
171
|
+
// PickersTextField
|
|
172
|
+
MuiPickersTextField?: {
|
|
173
|
+
defaultProps?: ComponentsProps['MuiPickersTextField'];
|
|
174
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersTextField'];
|
|
175
|
+
};
|
|
176
|
+
MuiPickersInputBase?: {
|
|
177
|
+
defaultProps?: ComponentsProps['MuiPickersInputBase'];
|
|
178
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersInputBase'];
|
|
179
|
+
};
|
|
180
|
+
MuiPickersInput?: {
|
|
181
|
+
defaultProps?: ComponentsProps['MuiPickersInput'];
|
|
182
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersInput'];
|
|
183
|
+
};
|
|
184
|
+
MuiPickersFilledInput?: {
|
|
185
|
+
defaultProps?: ComponentsProps['MuiPickersFilledInput'];
|
|
186
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersFilledInput'];
|
|
187
|
+
};
|
|
188
|
+
MuiPickersOutlinedInput?: {
|
|
189
|
+
defaultProps?: ComponentsProps['MuiPickersOutlinedInput'];
|
|
190
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersOutlinedInput'];
|
|
191
|
+
};
|
|
192
|
+
MuiPickersSectionList?: {
|
|
193
|
+
defaultProps?: ComponentsProps['MuiPickersSectionList'];
|
|
194
|
+
styleOverrides?: ComponentsOverrides<Theme>['MuiPickersSectionList'];
|
|
195
|
+
};
|
|
170
196
|
}
|
|
171
197
|
|
|
172
198
|
declare module '@mui/material/styles' {
|
|
@@ -29,6 +29,14 @@ import {
|
|
|
29
29
|
MultiSectionDigitalClockClassKey,
|
|
30
30
|
MultiSectionDigitalClockSectionClassKey,
|
|
31
31
|
} from '../MultiSectionDigitalClock';
|
|
32
|
+
import {
|
|
33
|
+
PickersTextFieldClassKey,
|
|
34
|
+
PickersInputClassKey,
|
|
35
|
+
PickersOutlinedInputClassKey,
|
|
36
|
+
PickersFilledInputClassKey,
|
|
37
|
+
PickersInputBaseClassKey,
|
|
38
|
+
} from '../PickersTextField';
|
|
39
|
+
import { PickersSectionListClassKey } from '../PickersSectionList';
|
|
32
40
|
|
|
33
41
|
// prettier-ignore
|
|
34
42
|
export interface PickersComponentNameToClassKey {
|
|
@@ -60,6 +68,14 @@ export interface PickersComponentNameToClassKey {
|
|
|
60
68
|
MuiTimeClock: TimeClockClassKey;
|
|
61
69
|
MuiTimePickerToolbar: TimePickerToolbarClassKey;
|
|
62
70
|
MuiYearCalendar: YearCalendarClassKey;
|
|
71
|
+
|
|
72
|
+
// V7 Picker's TextField
|
|
73
|
+
MuiPickersTextField: PickersTextFieldClassKey;
|
|
74
|
+
MuiPickersInputBase: PickersInputBaseClassKey
|
|
75
|
+
MuiPickersInput: PickersInputClassKey
|
|
76
|
+
MuiPickersFilledInput: PickersFilledInputClassKey
|
|
77
|
+
MuiPickersOutlinedInput: PickersOutlinedInputClassKey
|
|
78
|
+
MuiPickersSectionList: PickersSectionListClassKey
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
declare module '@mui/material/styles' {
|
|
@@ -45,6 +45,14 @@ import {
|
|
|
45
45
|
MultiSectionDigitalClockProps,
|
|
46
46
|
} from '../MultiSectionDigitalClock';
|
|
47
47
|
import { ExportedPickersCalendarHeaderProps } from '../PickersCalendarHeader';
|
|
48
|
+
import {
|
|
49
|
+
PickersTextFieldProps,
|
|
50
|
+
PickersInputBaseProps,
|
|
51
|
+
PickersOutlinedInputProps,
|
|
52
|
+
PickersInputProps,
|
|
53
|
+
PickersFilledInputProps,
|
|
54
|
+
} from '../PickersTextField';
|
|
55
|
+
import { PickersSectionListProps } from '../PickersSectionList';
|
|
48
56
|
|
|
49
57
|
export interface PickersComponentsPropsList {
|
|
50
58
|
MuiClock: ClockProps<unknown>;
|
|
@@ -97,6 +105,14 @@ export interface PickersComponentsPropsList {
|
|
|
97
105
|
MuiDesktopDateTimePicker: DesktopDateTimePickerProps<unknown>;
|
|
98
106
|
MuiMobileDateTimePicker: MobileDateTimePickerProps<unknown>;
|
|
99
107
|
MuiStaticDateTimePicker: StaticDateTimePickerProps<unknown>;
|
|
108
|
+
|
|
109
|
+
// V7 Picker's TextField
|
|
110
|
+
MuiPickersTextField: PickersTextFieldProps;
|
|
111
|
+
MuiPickersInputBase: PickersInputBaseProps;
|
|
112
|
+
MuiPickersInput: PickersInputProps;
|
|
113
|
+
MuiPickersFilledInput: PickersFilledInputProps;
|
|
114
|
+
MuiPickersOutlinedInput: PickersOutlinedInputProps;
|
|
115
|
+
MuiPickersSectionList: PickersSectionListProps;
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
declare module '@mui/material/styles' {
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { FormControlState } from '@mui/material/FormControl';
|
|
3
|
-
import { PickersInputProps } from './PickersInput.types';
|
|
4
|
-
export declare const PickersInputRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
5
|
-
ownerState: OwnerStateType;
|
|
6
|
-
}, Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, {}>;
|
|
7
|
-
export declare const PickersInputSectionsContainer: import("@emotion/styled").StyledComponent<Pick<import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme> & Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement>>, keyof React.ClassAttributes<HTMLDivElement> | keyof React.HTMLAttributes<HTMLDivElement> | keyof import("@mui/system").MUIStyledCommonProps<import("@mui/system").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
8
|
-
ownerState: OwnerStateType;
|
|
9
|
-
}, {}, {}>;
|
|
10
|
-
interface OwnerStateType extends FormControlState, Omit<PickersInputProps, keyof FormControlState> {
|
|
11
|
-
}
|
|
12
|
-
export declare const PickersInput: React.ForwardRefExoticComponent<Omit<PickersInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
13
|
-
export {};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["label", "autoFocus", "ownerState", "notched"];
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useFormControl } from '@mui/material/FormControl';
|
|
6
|
-
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
|
-
import { pickersOutlinedInputClasses, getPickersOutlinedInputUtilityClass } from './pickersInputClasses';
|
|
9
|
-
import Outline from './Outline';
|
|
10
|
-
import { PickersInputRoot, PickersInput, PickersInputSectionsContainer } from './PickersInput';
|
|
11
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
const OutlinedInputRoot = styled(PickersInputRoot, {
|
|
14
|
-
name: 'MuiPickersOutlinedInput',
|
|
15
|
-
slot: 'Root',
|
|
16
|
-
overridesResolver: (props, styles) => styles.root
|
|
17
|
-
})(({
|
|
18
|
-
theme,
|
|
19
|
-
ownerState
|
|
20
|
-
}) => {
|
|
21
|
-
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
22
|
-
return {
|
|
23
|
-
padding: '0 14px',
|
|
24
|
-
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
25
|
-
[`&:hover .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
26
|
-
borderColor: (theme.vars || theme).palette.text.primary
|
|
27
|
-
},
|
|
28
|
-
// Reset on touch devices, it doesn't add specificity
|
|
29
|
-
'@media (hover: none)': {
|
|
30
|
-
[`&:hover .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
31
|
-
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
[`&.${pickersOutlinedInputClasses.focused} .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
35
|
-
borderStyle: 'solid',
|
|
36
|
-
borderColor: (theme.vars || theme).palette[ownerState.color].main,
|
|
37
|
-
borderWidth: 2
|
|
38
|
-
},
|
|
39
|
-
[`&.${pickersOutlinedInputClasses.disabled}`]: {
|
|
40
|
-
[`& .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
41
|
-
borderColor: (theme.vars || theme).palette.action.disabled
|
|
42
|
-
},
|
|
43
|
-
'*': {
|
|
44
|
-
color: (theme.vars || theme).palette.action.disabled
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
[`&.${pickersOutlinedInputClasses.error} .${pickersOutlinedInputClasses.notchedOutline}`]: {
|
|
48
|
-
borderColor: (theme.vars || theme).palette.error.main
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
const OutlinedPickersInputSectionsContainer = styled(PickersInputSectionsContainer, {
|
|
53
|
-
name: 'MuiPickersOutlinedInput',
|
|
54
|
-
slot: 'SectionsContainer',
|
|
55
|
-
overridesResolver: (props, styles) => styles.sectionsContainer
|
|
56
|
-
})(({
|
|
57
|
-
ownerState
|
|
58
|
-
}) => _extends({
|
|
59
|
-
padding: '16.5px 0'
|
|
60
|
-
}, ownerState.size === 'small' && {
|
|
61
|
-
padding: '8.5px 0'
|
|
62
|
-
}));
|
|
63
|
-
const useUtilityClasses = ownerState => {
|
|
64
|
-
const {
|
|
65
|
-
focused,
|
|
66
|
-
disabled,
|
|
67
|
-
error,
|
|
68
|
-
classes,
|
|
69
|
-
fullWidth,
|
|
70
|
-
color,
|
|
71
|
-
size,
|
|
72
|
-
endAdornment,
|
|
73
|
-
startAdornment
|
|
74
|
-
} = ownerState;
|
|
75
|
-
const slots = {
|
|
76
|
-
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${color ? capitalize(color) : ''}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
|
|
77
|
-
notchedOutline: ['notchedOutline'],
|
|
78
|
-
before: ['before'],
|
|
79
|
-
after: ['after'],
|
|
80
|
-
content: ['content'],
|
|
81
|
-
input: ['input']
|
|
82
|
-
};
|
|
83
|
-
return composeClasses(slots, getPickersOutlinedInputUtilityClass, classes);
|
|
84
|
-
};
|
|
85
|
-
export const PickersOutlinedInput = /*#__PURE__*/React.forwardRef(function PickersOutlinedInput(props, ref) {
|
|
86
|
-
const {
|
|
87
|
-
label,
|
|
88
|
-
ownerState: ownerStateProp,
|
|
89
|
-
notched
|
|
90
|
-
} = props,
|
|
91
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
92
|
-
const muiFormControl = useFormControl();
|
|
93
|
-
const ownerState = _extends({}, props, ownerStateProp, muiFormControl, {
|
|
94
|
-
color: (muiFormControl == null ? void 0 : muiFormControl.color) || 'primary'
|
|
95
|
-
});
|
|
96
|
-
const classes = useUtilityClasses(ownerState);
|
|
97
|
-
return /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
98
|
-
slots: {
|
|
99
|
-
root: OutlinedInputRoot,
|
|
100
|
-
input: OutlinedPickersInputSectionsContainer
|
|
101
|
-
},
|
|
102
|
-
renderSuffix: state => /*#__PURE__*/_jsx(Outline, {
|
|
103
|
-
shrink: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
104
|
-
notched: Boolean(notched || state.adornedStart || state.focused || state.filled),
|
|
105
|
-
className: classes.notchedOutline,
|
|
106
|
-
label: label != null && label !== '' && muiFormControl != null && muiFormControl.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
107
|
-
children: [label, "\u2009", '*']
|
|
108
|
-
}) : label,
|
|
109
|
-
ownerState: ownerState
|
|
110
|
-
})
|
|
111
|
-
}, other, {
|
|
112
|
-
label: label,
|
|
113
|
-
classes: classes,
|
|
114
|
-
ref: ref
|
|
115
|
-
}));
|
|
116
|
-
});
|
|
117
|
-
PickersInput.muiName = 'Input';
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["label", "autoFocus", "ownerState"];
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { useFormControl } from '@mui/material/FormControl';
|
|
6
|
-
import { styled } from '@mui/material/styles';
|
|
7
|
-
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize } from '@mui/utils';
|
|
8
|
-
import { pickersStandardInputClasses, getPickersStandardInputUtilityClass } from './pickersInputClasses';
|
|
9
|
-
import { PickersInputRoot, PickersInput } from './PickersInput';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
const StandardInputRoot = styled(PickersInputRoot, {
|
|
12
|
-
name: 'MuiPickersStandardInput',
|
|
13
|
-
slot: 'Root',
|
|
14
|
-
overridesResolver: (props, styles) => styles.root
|
|
15
|
-
})(({
|
|
16
|
-
theme,
|
|
17
|
-
ownerState
|
|
18
|
-
}) => {
|
|
19
|
-
const light = theme.palette.mode === 'light';
|
|
20
|
-
let bottomLineColor = light ? 'rgba(0, 0, 0, 0.42)' : 'rgba(255, 255, 255, 0.7)';
|
|
21
|
-
if (theme.vars) {
|
|
22
|
-
bottomLineColor = `rgba(${theme.vars.palette.common.onBackgroundChannel} / ${theme.vars.opacity.inputUnderline})`;
|
|
23
|
-
}
|
|
24
|
-
return _extends({
|
|
25
|
-
'label + &': {
|
|
26
|
-
marginTop: 16
|
|
27
|
-
}
|
|
28
|
-
}, !ownerState.disableUnderline && {
|
|
29
|
-
'&::after': {
|
|
30
|
-
background: 'red',
|
|
31
|
-
borderBottom: `2px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
|
|
32
|
-
left: 0,
|
|
33
|
-
bottom: 0,
|
|
34
|
-
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
|
35
|
-
content: '""',
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
right: 0,
|
|
38
|
-
transform: 'scaleX(0)',
|
|
39
|
-
transition: theme.transitions.create('transform', {
|
|
40
|
-
duration: theme.transitions.duration.shorter,
|
|
41
|
-
easing: theme.transitions.easing.easeOut
|
|
42
|
-
}),
|
|
43
|
-
pointerEvents: 'none' // Transparent to the hover style.
|
|
44
|
-
},
|
|
45
|
-
[`&.${pickersStandardInputClasses.focused}:after`]: {
|
|
46
|
-
// translateX(0) is a workaround for Safari transform scale bug
|
|
47
|
-
// See https://github.com/mui/material-ui/issues/31766
|
|
48
|
-
transform: 'scaleX(1) translateX(0)'
|
|
49
|
-
},
|
|
50
|
-
[`&.${pickersStandardInputClasses.error}`]: {
|
|
51
|
-
'&:before, &:after': {
|
|
52
|
-
borderBottomColor: (theme.vars || theme).palette.error.main
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
'&::before': {
|
|
56
|
-
borderBottom: `1px solid ${bottomLineColor}`,
|
|
57
|
-
left: 0,
|
|
58
|
-
bottom: 0,
|
|
59
|
-
// Doing the other way around crash on IE11 "''" https://github.com/cssinjs/jss/issues/242
|
|
60
|
-
content: '"\\00a0"',
|
|
61
|
-
position: 'absolute',
|
|
62
|
-
right: 0,
|
|
63
|
-
transition: theme.transitions.create('border-bottom-color', {
|
|
64
|
-
duration: theme.transitions.duration.shorter
|
|
65
|
-
}),
|
|
66
|
-
pointerEvents: 'none' // Transparent to the hover style.
|
|
67
|
-
},
|
|
68
|
-
[`&:hover:not(.${pickersStandardInputClasses.disabled}, .${pickersStandardInputClasses.error}):before`]: {
|
|
69
|
-
borderBottom: `2px solid ${(theme.vars || theme).palette.text.primary}`,
|
|
70
|
-
// Reset on touch devices, it doesn't add specificity
|
|
71
|
-
'@media (hover: none)': {
|
|
72
|
-
borderBottom: `1px solid ${bottomLineColor}`
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
[`&.${pickersStandardInputClasses.disabled}:before`]: {
|
|
76
|
-
borderBottomStyle: 'dotted'
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
const useUtilityClasses = ownerState => {
|
|
81
|
-
const {
|
|
82
|
-
focused,
|
|
83
|
-
disabled,
|
|
84
|
-
error,
|
|
85
|
-
classes,
|
|
86
|
-
fullWidth,
|
|
87
|
-
color,
|
|
88
|
-
size,
|
|
89
|
-
endAdornment,
|
|
90
|
-
startAdornment
|
|
91
|
-
} = ownerState;
|
|
92
|
-
const slots = {
|
|
93
|
-
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${capitalize(color)}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
|
|
94
|
-
notchedOutline: ['notchedOutline'],
|
|
95
|
-
before: ['before'],
|
|
96
|
-
after: ['after'],
|
|
97
|
-
content: ['content'],
|
|
98
|
-
input: ['input']
|
|
99
|
-
};
|
|
100
|
-
return composeClasses(slots, getPickersStandardInputUtilityClass, classes);
|
|
101
|
-
};
|
|
102
|
-
export const PickersStandardInput = /*#__PURE__*/React.forwardRef(function PickersStandardInput(props, ref) {
|
|
103
|
-
const {
|
|
104
|
-
label,
|
|
105
|
-
ownerState: ownerStateProp
|
|
106
|
-
} = props,
|
|
107
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
108
|
-
const muiFormControl = useFormControl();
|
|
109
|
-
const ownerState = _extends({}, props, ownerStateProp, muiFormControl, {
|
|
110
|
-
color: (muiFormControl == null ? void 0 : muiFormControl.color) || 'primary'
|
|
111
|
-
});
|
|
112
|
-
const classes = useUtilityClasses(ownerState);
|
|
113
|
-
return /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
114
|
-
slots: {
|
|
115
|
-
root: StandardInputRoot
|
|
116
|
-
}
|
|
117
|
-
}, other, {
|
|
118
|
-
label: label,
|
|
119
|
-
classes: classes,
|
|
120
|
-
ref: ref
|
|
121
|
-
}));
|
|
122
|
-
});
|
|
123
|
-
PickersInput.muiName = 'Input';
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
export interface PickersInputClasses {
|
|
2
|
-
/** Styles applied to the root element. */
|
|
3
|
-
root: string;
|
|
4
|
-
/** Styles applied to the root element if focused. */
|
|
5
|
-
focused: string;
|
|
6
|
-
/** State class applied to the root element if `disabled=true`. */
|
|
7
|
-
disabled: string;
|
|
8
|
-
/** State class applied to the root element if `readOnly=true`. */
|
|
9
|
-
readOnly: string;
|
|
10
|
-
/** State class applied to the root element if `error=true`. */
|
|
11
|
-
error: string;
|
|
12
|
-
/** Styles applied to the NotchedOutline element. */
|
|
13
|
-
notchedOutline: string;
|
|
14
|
-
/** Styles applied to the real hidden input element. */
|
|
15
|
-
input: string;
|
|
16
|
-
/** Styles applied to the container of the sections. */
|
|
17
|
-
sectionsContainer: string;
|
|
18
|
-
/** Styles applied to the content of a section. */
|
|
19
|
-
sectionContent: string;
|
|
20
|
-
/** Styles applied to the separator before a section */
|
|
21
|
-
sectionBefore: string;
|
|
22
|
-
/** Styles applied to the separator after a section */
|
|
23
|
-
sectionAfter: string;
|
|
24
|
-
/** Styles applied to the root if there is a startAdornment present */
|
|
25
|
-
adornedStart: string;
|
|
26
|
-
/** Styles applied to the root if there is an endAdornment present */
|
|
27
|
-
adornedEnd: string;
|
|
28
|
-
/** Styles applied to the root element unless `disableUnderline={true}`. */
|
|
29
|
-
underline?: string;
|
|
30
|
-
}
|
|
31
|
-
export type PickersInputClassKey = keyof PickersInputClasses;
|
|
32
|
-
export declare function getPickersInputUtilityClass(slot: string): string;
|
|
33
|
-
export declare function getPickersOutlinedInputUtilityClass(slot: string): string;
|
|
34
|
-
export declare function getPickersFilledInputUtilityClass(slot: string): string;
|
|
35
|
-
export declare function getPickersStandardInputUtilityClass(slot: string): string;
|
|
36
|
-
export declare const pickersInputClasses: Record<keyof PickersInputClasses, string>;
|
|
37
|
-
export declare const pickersOutlinedInputClasses: {
|
|
38
|
-
underline: string;
|
|
39
|
-
disabled: string;
|
|
40
|
-
input: string;
|
|
41
|
-
readOnly: string;
|
|
42
|
-
error: string;
|
|
43
|
-
focused: string;
|
|
44
|
-
root: string;
|
|
45
|
-
adornedStart: string;
|
|
46
|
-
adornedEnd: string;
|
|
47
|
-
notchedOutline: string;
|
|
48
|
-
sectionContent: string;
|
|
49
|
-
sectionsContainer: string;
|
|
50
|
-
sectionBefore: string;
|
|
51
|
-
sectionAfter: string;
|
|
52
|
-
};
|
|
53
|
-
export declare const pickersFilledInputClasses: {
|
|
54
|
-
underline: string;
|
|
55
|
-
disabled: string;
|
|
56
|
-
input: string;
|
|
57
|
-
readOnly: string;
|
|
58
|
-
error: string;
|
|
59
|
-
focused: string;
|
|
60
|
-
root: string;
|
|
61
|
-
adornedStart: string;
|
|
62
|
-
adornedEnd: string;
|
|
63
|
-
notchedOutline: string;
|
|
64
|
-
sectionContent: string;
|
|
65
|
-
sectionsContainer: string;
|
|
66
|
-
sectionBefore: string;
|
|
67
|
-
sectionAfter: string;
|
|
68
|
-
};
|
|
69
|
-
export declare const pickersStandardInputClasses: {
|
|
70
|
-
underline: string;
|
|
71
|
-
disabled: string;
|
|
72
|
-
input: string;
|
|
73
|
-
readOnly: string;
|
|
74
|
-
error: string;
|
|
75
|
-
focused: string;
|
|
76
|
-
root: string;
|
|
77
|
-
adornedStart: string;
|
|
78
|
-
adornedEnd: string;
|
|
79
|
-
notchedOutline: string;
|
|
80
|
-
sectionContent: string;
|
|
81
|
-
sectionsContainer: string;
|
|
82
|
-
sectionBefore: string;
|
|
83
|
-
sectionAfter: string;
|
|
84
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
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,2 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export declare const PickersTextField: React.ForwardRefExoticComponent<(Omit<import("./PickersTextField.types").PickersStandardTextFieldProps, "ref"> | Omit<import("./PickersTextField.types").PickersOutlinedTextFieldProps, "ref"> | Omit<import("./PickersTextField.types").PickersFilledTextFieldProps, "ref">) & React.RefAttributes<HTMLDivElement>>;
|