@mui/x-date-pickers 7.0.0-alpha.1 → 7.0.0-alpha.3
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/AdapterDateFns/AdapterDateFns.d.ts +2 -2
- package/AdapterDateFns/AdapterDateFns.js +11 -17
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.d.ts +2 -2
- package/AdapterDateFnsJalali/AdapterDateFnsJalali.js +13 -19
- package/AdapterDayjs/AdapterDayjs.d.ts +2 -2
- package/AdapterDayjs/AdapterDayjs.js +13 -15
- package/AdapterLuxon/AdapterLuxon.d.ts +3 -3
- package/AdapterLuxon/AdapterLuxon.js +31 -39
- package/AdapterMoment/AdapterMoment.d.ts +3 -3
- package/AdapterMoment/AdapterMoment.js +16 -23
- package/AdapterMomentHijri/AdapterMomentHijri.d.ts +1 -3
- package/AdapterMomentHijri/AdapterMomentHijri.js +1 -27
- package/AdapterMomentJalaali/AdapterMomentJalaali.d.ts +1 -4
- package/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -29
- package/CHANGELOG.md +607 -188
- package/DateCalendar/DateCalendar.js +4 -10
- package/DateCalendar/DateCalendar.types.d.ts +0 -4
- package/DateCalendar/DayCalendar.d.ts +3 -3
- package/DateCalendar/dayCalendarClasses.d.ts +1 -1
- package/DateCalendar/dayCalendarClasses.js +1 -1
- package/DateCalendar/index.d.ts +1 -1
- package/DateCalendar/index.js +1 -1
- package/DateCalendar/useCalendarState.d.ts +1 -1
- package/DateCalendar/useCalendarState.js +1 -9
- package/DateField/DateField.js +1 -1
- package/DatePicker/DatePicker.js +3 -7
- package/DateTimeField/DateTimeField.js +1 -9
- package/DateTimePicker/DateTimePicker.js +3 -15
- package/DesktopDatePicker/DesktopDatePicker.js +3 -7
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -15
- package/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/DigitalClock/DigitalClock.js +3 -15
- package/MobileDatePicker/MobileDatePicker.js +3 -7
- package/MobileDateTimePicker/MobileDateTimePicker.js +3 -15
- package/MobileTimePicker/MobileTimePicker.js +1 -9
- package/MonthCalendar/MonthCalendar.js +1 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -15
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.d.ts +3 -2
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
- package/PickersDay/PickersDay.js +1 -1
- package/PickersShortcuts/PickersShortcuts.d.ts +1 -1
- package/PickersShortcuts/PickersShortcuts.js +1 -1
- package/README.md +0 -1
- package/StaticDatePicker/StaticDatePicker.js +3 -7
- package/StaticDateTimePicker/StaticDateTimePicker.js +3 -15
- package/StaticTimePicker/StaticTimePicker.js +1 -9
- package/TimeClock/Clock.js +1 -1
- package/TimeClock/TimeClock.js +3 -15
- package/TimeField/TimeField.js +1 -9
- package/TimePicker/TimePicker.js +1 -9
- package/YearCalendar/YearCalendar.js +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +1 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/dateViewRenderers/dateViewRenderers.d.ts +1 -1
- package/dateViewRenderers/dateViewRenderers.js +0 -2
- package/index.js +1 -1
- package/internals/components/PickersTextField/Outline.d.ts +2 -0
- package/internals/components/PickersTextField/Outline.js +99 -0
- package/internals/components/PickersTextField/PickersInput.d.ts +4 -0
- package/internals/components/PickersTextField/PickersInput.js +264 -0
- package/internals/components/PickersTextField/PickersInput.types.d.ts +30 -0
- package/internals/components/PickersTextField/PickersInput.types.js +1 -0
- package/internals/components/PickersTextField/PickersTextField.d.ts +3 -0
- package/internals/components/PickersTextField/PickersTextField.js +120 -0
- package/internals/components/PickersTextField/PickersTextField.types.d.ts +18 -0
- package/internals/components/PickersTextField/PickersTextField.types.js +1 -0
- package/internals/components/PickersTextField/index.d.ts +1 -0
- package/internals/components/PickersTextField/index.js +1 -0
- package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +42 -0
- package/internals/components/PickersTextField/pickersTextFieldClasses.js +9 -0
- package/internals/hooks/date-helpers-hooks.js +2 -2
- package/internals/hooks/useField/useField.utils.js +30 -17
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/usePicker/usePickerValue.js +2 -6
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +3 -3
- package/internals/hooks/useUtils.js +1 -1
- package/internals/hooks/useViews.js +2 -2
- package/internals/models/validation.d.ts +0 -8
- package/internals/utils/date-utils.js +2 -2
- package/internals/utils/validation/extractValidationProps.d.ts +1 -1
- package/internals/utils/validation/extractValidationProps.js +1 -1
- package/internals/utils/validation/validateDate.js +1 -1
- package/internals/utils/validation/validateTime.js +1 -8
- package/legacy/AdapterDateFns/AdapterDateFns.js +12 -16
- package/legacy/AdapterDateFnsJalali/AdapterDateFnsJalali.js +14 -18
- package/legacy/AdapterDayjs/AdapterDayjs.js +15 -14
- package/legacy/AdapterLuxon/AdapterLuxon.js +34 -39
- package/legacy/AdapterMoment/AdapterMoment.js +326 -324
- package/legacy/AdapterMomentHijri/AdapterMomentHijri.js +4 -28
- package/legacy/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -33
- package/legacy/DateCalendar/DateCalendar.js +4 -10
- package/legacy/DateCalendar/PickersSlideTransition.js +8 -9
- package/legacy/DateCalendar/dayCalendarClasses.js +1 -1
- package/legacy/DateCalendar/index.js +1 -1
- package/legacy/DateCalendar/useCalendarState.js +1 -9
- package/legacy/DateField/DateField.js +1 -1
- package/legacy/DatePicker/DatePicker.js +3 -7
- package/legacy/DateTimeField/DateTimeField.js +1 -9
- package/legacy/DateTimePicker/DateTimePicker.js +3 -15
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +3 -7
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -15
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/legacy/DigitalClock/DigitalClock.js +3 -15
- package/legacy/MobileDatePicker/MobileDatePicker.js +3 -7
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +3 -15
- package/legacy/MobileTimePicker/MobileTimePicker.js +1 -9
- package/legacy/MonthCalendar/MonthCalendar.js +1 -1
- package/legacy/MonthCalendar/PickersMonth.js +4 -5
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -15
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
- package/legacy/PickersDay/PickersDay.js +6 -7
- package/legacy/PickersLayout/PickersLayout.js +5 -6
- package/legacy/PickersShortcuts/PickersShortcuts.js +2 -1
- package/legacy/StaticDatePicker/StaticDatePicker.js +3 -7
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +3 -15
- package/legacy/StaticTimePicker/StaticTimePicker.js +1 -9
- package/legacy/TimeClock/Clock.js +1 -1
- package/legacy/TimeClock/ClockNumber.js +4 -5
- package/legacy/TimeClock/TimeClock.js +3 -15
- package/legacy/TimeField/TimeField.js +1 -9
- package/legacy/TimePicker/TimePicker.js +1 -9
- package/legacy/TimePicker/TimePickerToolbar.js +1 -2
- package/legacy/YearCalendar/PickersYear.js +4 -5
- package/legacy/YearCalendar/YearCalendar.js +1 -1
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/legacy/dateViewRenderers/dateViewRenderers.js +0 -2
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersModalDialog.js +3 -4
- package/legacy/internals/components/PickersTextField/Outline.js +100 -0
- package/legacy/internals/components/PickersTextField/PickersInput.js +273 -0
- package/legacy/internals/components/PickersTextField/PickersInput.types.js +1 -0
- package/legacy/internals/components/PickersTextField/PickersTextField.js +129 -0
- package/legacy/internals/components/PickersTextField/PickersTextField.types.js +1 -0
- package/legacy/internals/components/PickersTextField/index.js +1 -0
- package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +9 -0
- package/legacy/internals/hooks/date-helpers-hooks.js +2 -2
- package/legacy/internals/hooks/useField/useField.utils.js +30 -17
- package/legacy/internals/hooks/useField/useFieldState.js +1 -1
- package/legacy/internals/hooks/usePicker/usePickerValue.js +2 -6
- package/legacy/internals/hooks/useUtils.js +1 -1
- package/legacy/internals/hooks/useViews.js +2 -2
- package/legacy/internals/utils/date-utils.js +2 -2
- package/legacy/internals/utils/validation/extractValidationProps.js +1 -1
- package/legacy/internals/utils/validation/validateDate.js +1 -1
- package/legacy/internals/utils/validation/validateTime.js +1 -8
- package/legacy/locales/deDE.js +4 -3
- package/legacy/locales/index.js +1 -0
- package/legacy/locales/mk.js +91 -0
- package/legacy/timeViewRenderers/timeViewRenderers.js +0 -6
- package/locales/beBY.d.ts +18 -5
- package/locales/caES.d.ts +18 -5
- package/locales/csCZ.d.ts +18 -5
- package/locales/daDK.d.ts +18 -5
- package/locales/deDE.d.ts +18 -5
- package/locales/deDE.js +2 -3
- package/locales/elGR.d.ts +18 -5
- package/locales/enUS.d.ts +18 -5
- package/locales/esES.d.ts +18 -5
- package/locales/eu.d.ts +18 -5
- package/locales/faIR.d.ts +18 -5
- package/locales/fiFI.d.ts +18 -5
- package/locales/frFR.d.ts +18 -5
- package/locales/heIL.d.ts +18 -5
- package/locales/huHU.d.ts +18 -5
- package/locales/index.d.ts +1 -0
- package/locales/index.js +1 -0
- package/locales/isIS.d.ts +18 -5
- package/locales/itIT.d.ts +18 -5
- package/locales/jaJP.d.ts +18 -5
- package/locales/koKR.d.ts +18 -5
- package/locales/kzKZ.d.ts +18 -5
- package/locales/mk.d.ts +66 -0
- package/locales/mk.js +55 -0
- package/locales/nbNO.d.ts +18 -5
- package/locales/nlNL.d.ts +18 -5
- package/locales/plPL.d.ts +18 -5
- package/locales/ptBR.d.ts +18 -5
- package/locales/roRO.d.ts +18 -5
- package/locales/ruRU.d.ts +18 -5
- package/locales/skSK.d.ts +18 -5
- package/locales/svSE.d.ts +18 -5
- package/locales/trTR.d.ts +18 -5
- package/locales/ukUA.d.ts +18 -5
- package/locales/urPK.d.ts +18 -5
- package/locales/utils/getPickersLocalization.d.ts +18 -5
- package/locales/utils/pickersLocaleTextApi.d.ts +18 -5
- package/locales/viVN.d.ts +18 -5
- package/locales/zhCN.d.ts +18 -5
- package/locales/zhHK.d.ts +18 -5
- package/models/adapters.d.ts +6 -10
- package/models/timezone.d.ts +1 -1
- package/models/validation.d.ts +1 -1
- package/modern/AdapterDateFns/AdapterDateFns.js +11 -17
- package/modern/AdapterDateFnsJalali/AdapterDateFnsJalali.js +13 -19
- package/modern/AdapterDayjs/AdapterDayjs.js +13 -15
- package/modern/AdapterLuxon/AdapterLuxon.js +30 -39
- package/modern/AdapterMoment/AdapterMoment.js +16 -23
- package/modern/AdapterMomentHijri/AdapterMomentHijri.js +1 -27
- package/modern/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -29
- package/modern/DateCalendar/DateCalendar.js +4 -10
- package/modern/DateCalendar/dayCalendarClasses.js +1 -1
- package/modern/DateCalendar/index.js +1 -1
- package/modern/DateCalendar/useCalendarState.js +1 -9
- package/modern/DateField/DateField.js +1 -1
- package/modern/DatePicker/DatePicker.js +3 -7
- package/modern/DateTimeField/DateTimeField.js +1 -9
- package/modern/DateTimePicker/DateTimePicker.js +3 -15
- package/modern/DesktopDatePicker/DesktopDatePicker.js +3 -7
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -15
- package/modern/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/modern/DigitalClock/DigitalClock.js +3 -15
- package/modern/MobileDatePicker/MobileDatePicker.js +3 -7
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +3 -15
- package/modern/MobileTimePicker/MobileTimePicker.js +1 -9
- package/modern/MonthCalendar/MonthCalendar.js +1 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -15
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
- package/modern/PickersDay/PickersDay.js +1 -1
- package/modern/PickersShortcuts/PickersShortcuts.js +1 -1
- package/modern/StaticDatePicker/StaticDatePicker.js +3 -7
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +3 -15
- package/modern/StaticTimePicker/StaticTimePicker.js +1 -9
- package/modern/TimeClock/Clock.js +1 -1
- package/modern/TimeClock/TimeClock.js +3 -15
- package/modern/TimeField/TimeField.js +1 -9
- package/modern/TimePicker/TimePicker.js +1 -9
- package/modern/YearCalendar/YearCalendar.js +1 -1
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/modern/dateViewRenderers/dateViewRenderers.js +0 -2
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersTextField/Outline.js +99 -0
- package/modern/internals/components/PickersTextField/PickersInput.js +264 -0
- package/modern/internals/components/PickersTextField/PickersInput.types.js +1 -0
- package/modern/internals/components/PickersTextField/PickersTextField.js +119 -0
- package/modern/internals/components/PickersTextField/PickersTextField.types.js +1 -0
- package/modern/internals/components/PickersTextField/index.js +1 -0
- package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +9 -0
- package/modern/internals/hooks/date-helpers-hooks.js +2 -2
- package/modern/internals/hooks/useField/useField.utils.js +30 -17
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/hooks/usePicker/usePickerValue.js +2 -6
- package/modern/internals/hooks/useUtils.js +1 -1
- package/modern/internals/hooks/useViews.js +2 -2
- package/modern/internals/utils/date-utils.js +2 -2
- package/modern/internals/utils/validation/extractValidationProps.js +1 -1
- package/modern/internals/utils/validation/validateDate.js +1 -1
- package/modern/internals/utils/validation/validateTime.js +1 -8
- package/modern/locales/deDE.js +2 -3
- package/modern/locales/index.js +1 -0
- package/modern/locales/mk.js +55 -0
- package/modern/timeViewRenderers/timeViewRenderers.js +0 -6
- package/node/AdapterDateFns/AdapterDateFns.js +11 -17
- package/node/AdapterDateFnsJalali/AdapterDateFnsJalali.js +13 -19
- package/node/AdapterDayjs/AdapterDayjs.js +12 -14
- package/node/AdapterLuxon/AdapterLuxon.js +30 -39
- package/node/AdapterMoment/AdapterMoment.js +16 -23
- package/node/AdapterMomentHijri/AdapterMomentHijri.js +1 -27
- package/node/AdapterMomentJalaali/AdapterMomentJalaali.js +0 -29
- package/node/DateCalendar/DateCalendar.js +4 -10
- package/node/DateCalendar/dayCalendarClasses.js +2 -2
- package/node/DateCalendar/index.js +2 -2
- package/node/DateCalendar/useCalendarState.js +1 -9
- package/node/DateField/DateField.js +1 -1
- package/node/DatePicker/DatePicker.js +3 -7
- package/node/DateTimeField/DateTimeField.js +1 -9
- package/node/DateTimePicker/DateTimePicker.js +3 -15
- package/node/DesktopDatePicker/DesktopDatePicker.js +3 -7
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +3 -15
- package/node/DesktopTimePicker/DesktopTimePicker.js +1 -9
- package/node/DigitalClock/DigitalClock.js +3 -15
- package/node/MobileDatePicker/MobileDatePicker.js +3 -7
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +3 -15
- package/node/MobileTimePicker/MobileTimePicker.js +1 -9
- package/node/MonthCalendar/MonthCalendar.js +1 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +5 -15
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.utils.js +2 -1
- package/node/PickersDay/PickersDay.js +1 -1
- package/node/PickersShortcuts/PickersShortcuts.js +1 -1
- package/node/StaticDatePicker/StaticDatePicker.js +3 -7
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +3 -15
- package/node/StaticTimePicker/StaticTimePicker.js +1 -9
- package/node/TimeClock/Clock.js +1 -1
- package/node/TimeClock/TimeClock.js +3 -15
- package/node/TimeField/TimeField.js +1 -9
- package/node/TimePicker/TimePicker.js +1 -9
- package/node/YearCalendar/YearCalendar.js +1 -1
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +0 -4
- package/node/dateViewRenderers/dateViewRenderers.js +0 -2
- package/node/index.js +1 -1
- package/node/internals/components/PickersTextField/Outline.js +108 -0
- package/node/internals/components/PickersTextField/PickersInput.js +272 -0
- package/node/internals/components/PickersTextField/PickersInput.types.js +5 -0
- package/node/internals/components/PickersTextField/PickersTextField.js +127 -0
- package/node/internals/components/PickersTextField/PickersTextField.types.js +5 -0
- package/node/internals/components/PickersTextField/index.js +12 -0
- package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +17 -0
- package/node/internals/hooks/date-helpers-hooks.js +2 -2
- package/node/internals/hooks/useField/useField.utils.js +30 -17
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/hooks/usePicker/usePickerValue.js +2 -6
- package/node/internals/hooks/useUtils.js +1 -1
- package/node/internals/hooks/useViews.js +2 -2
- package/node/internals/utils/date-utils.js +2 -2
- package/node/internals/utils/validation/extractValidationProps.js +1 -1
- package/node/internals/utils/validation/validateDate.js +1 -1
- package/node/internals/utils/validation/validateTime.js +1 -8
- package/node/locales/deDE.js +2 -3
- package/node/locales/index.js +11 -0
- package/node/locales/mk.js +60 -0
- package/node/timeViewRenderers/timeViewRenderers.js +0 -6
- package/package.json +8 -7
- package/timeViewRenderers/timeViewRenderers.d.ts +3 -3
- package/timeViewRenderers/timeViewRenderers.js +0 -6
- package/internals/components/FakeTextField/FakeTextField.d.ts +0 -22
- package/internals/components/FakeTextField/FakeTextField.js +0 -44
- package/internals/components/FakeTextField/index.d.ts +0 -1
- package/internals/components/FakeTextField/index.js +0 -1
- package/legacy/internals/components/FakeTextField/FakeTextField.js +0 -49
- package/legacy/internals/components/FakeTextField/index.js +0 -1
- package/modern/internals/components/FakeTextField/FakeTextField.js +0 -44
- package/modern/internals/components/FakeTextField/index.js +0 -1
- package/node/internals/components/FakeTextField/FakeTextField.js +0 -52
- package/node/internals/components/FakeTextField/index.js +0 -12
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
const _excluded = ["elements", "defaultValue", "label", "onFocus", "onWrapperClick", "onBlur", "valueStr", "onValueStrChange", "id", "InputProps", "inputProps", "autoFocus", "ownerState", "endAdornment", "startAdornment"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import Box from '@mui/material/Box';
|
|
7
|
+
import { useFormControl } from '@mui/material/FormControl';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
10
|
+
import { unstable_composeClasses as composeClasses, unstable_capitalize as capitalize, visuallyHidden } from '@mui/utils';
|
|
11
|
+
import { pickersInputClasses, getPickersInputUtilityClass } from './pickersTextFieldClasses';
|
|
12
|
+
import Outline from './Outline';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
const SectionsWrapper = styled(Box, {
|
|
16
|
+
name: 'MuiPickersInput',
|
|
17
|
+
slot: 'Root',
|
|
18
|
+
overridesResolver: (props, styles) => styles.root
|
|
19
|
+
})(({
|
|
20
|
+
theme,
|
|
21
|
+
ownerState
|
|
22
|
+
}) => {
|
|
23
|
+
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
24
|
+
return _extends({
|
|
25
|
+
cursor: 'text',
|
|
26
|
+
padding: '16.5px 14px',
|
|
27
|
+
display: 'flex',
|
|
28
|
+
justifyContent: 'flex-start',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
width: ownerState.fullWidth ? '100%' : '25ch',
|
|
31
|
+
position: 'relative',
|
|
32
|
+
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
33
|
+
[`&:hover .${pickersInputClasses.notchedOutline}`]: {
|
|
34
|
+
borderColor: (theme.vars || theme).palette.text.primary
|
|
35
|
+
},
|
|
36
|
+
// Reset on touch devices, it doesn't add specificity
|
|
37
|
+
'@media (hover: none)': {
|
|
38
|
+
[`&:hover .${pickersInputClasses.notchedOutline}`]: {
|
|
39
|
+
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
[`&.${pickersInputClasses.focused} .${pickersInputClasses.notchedOutline}`]: {
|
|
43
|
+
borderStyle: 'solid',
|
|
44
|
+
borderColor: (theme.vars || theme).palette[ownerState.color].main,
|
|
45
|
+
borderWidth: 2
|
|
46
|
+
},
|
|
47
|
+
[`&.${pickersInputClasses.disabled}`]: {
|
|
48
|
+
[`& .${pickersInputClasses.notchedOutline}`]: {
|
|
49
|
+
borderColor: (theme.vars || theme).palette.action.disabled
|
|
50
|
+
},
|
|
51
|
+
'*': {
|
|
52
|
+
color: (theme.vars || theme).palette.action.disabled
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[`&.${pickersInputClasses.error} .${pickersInputClasses.notchedOutline}`]: {
|
|
56
|
+
borderColor: (theme.vars || theme).palette.error.main
|
|
57
|
+
}
|
|
58
|
+
}, ownerState.size === 'small' && {
|
|
59
|
+
padding: '8.5px 14px'
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
const SectionsContainer = styled('div', {
|
|
63
|
+
name: 'MuiPickersInput',
|
|
64
|
+
slot: 'Input',
|
|
65
|
+
overridesResolver: (props, styles) => styles.input
|
|
66
|
+
})(({
|
|
67
|
+
theme,
|
|
68
|
+
ownerState
|
|
69
|
+
}) => ({
|
|
70
|
+
fontFamily: theme.typography.fontFamily,
|
|
71
|
+
fontSize: 'inherit',
|
|
72
|
+
lineHeight: '1.4375em',
|
|
73
|
+
// 23px
|
|
74
|
+
flexGrow: 1,
|
|
75
|
+
visibility: ownerState.adornedStart || ownerState.focused ? 'visible' : 'hidden'
|
|
76
|
+
}));
|
|
77
|
+
const SectionContainer = styled('span', {
|
|
78
|
+
name: 'MuiPickersInput',
|
|
79
|
+
slot: 'Section',
|
|
80
|
+
overridesResolver: (props, styles) => styles.section
|
|
81
|
+
})(({
|
|
82
|
+
theme
|
|
83
|
+
}) => ({
|
|
84
|
+
fontFamily: theme.typography.fontFamily,
|
|
85
|
+
fontSize: 'inherit',
|
|
86
|
+
lineHeight: '1.4375em',
|
|
87
|
+
// 23px
|
|
88
|
+
flexGrow: 1
|
|
89
|
+
}));
|
|
90
|
+
const SectionInput = styled('span', {
|
|
91
|
+
name: 'MuiPickersInput',
|
|
92
|
+
slot: 'Content',
|
|
93
|
+
overridesResolver: (props, styles) => styles.content
|
|
94
|
+
})(({
|
|
95
|
+
theme
|
|
96
|
+
}) => ({
|
|
97
|
+
fontFamily: theme.typography.fontFamily,
|
|
98
|
+
lineHeight: '1.4375em',
|
|
99
|
+
// 23px
|
|
100
|
+
letterSpacing: 'inherit',
|
|
101
|
+
width: 'fit-content'
|
|
102
|
+
}));
|
|
103
|
+
const SectionSeparator = styled('span', {
|
|
104
|
+
name: 'MuiPickersInput',
|
|
105
|
+
slot: 'Separator',
|
|
106
|
+
overridesResolver: (props, styles) => styles.separator
|
|
107
|
+
})(() => ({
|
|
108
|
+
whiteSpace: 'pre'
|
|
109
|
+
}));
|
|
110
|
+
const FakeHiddenInput = styled('input', {
|
|
111
|
+
name: 'MuiPickersInput',
|
|
112
|
+
slot: 'HiddenInput',
|
|
113
|
+
overridesResolver: (props, styles) => styles.hiddenInput
|
|
114
|
+
})(_extends({}, visuallyHidden));
|
|
115
|
+
const NotchedOutlineRoot = styled(Outline, {
|
|
116
|
+
name: 'MuiPickersInput',
|
|
117
|
+
slot: 'NotchedOutline',
|
|
118
|
+
overridesResolver: (props, styles) => styles.notchedOutline
|
|
119
|
+
})(({
|
|
120
|
+
theme
|
|
121
|
+
}) => {
|
|
122
|
+
const borderColor = theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)';
|
|
123
|
+
return {
|
|
124
|
+
borderColor: theme.vars ? `rgba(${theme.vars.palette.common.onBackgroundChannel} / 0.23)` : borderColor
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
function InputContent({
|
|
128
|
+
elements,
|
|
129
|
+
contentEditable,
|
|
130
|
+
ownerState
|
|
131
|
+
}) {
|
|
132
|
+
if (contentEditable) {
|
|
133
|
+
return elements.map(({
|
|
134
|
+
content,
|
|
135
|
+
before,
|
|
136
|
+
after
|
|
137
|
+
}) => `${before.children}${content.children}${after.children}`).join('');
|
|
138
|
+
}
|
|
139
|
+
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
140
|
+
children: elements.map(({
|
|
141
|
+
container,
|
|
142
|
+
content,
|
|
143
|
+
before,
|
|
144
|
+
after
|
|
145
|
+
}, elementIndex) => /*#__PURE__*/_jsxs(SectionContainer, _extends({}, container, {
|
|
146
|
+
children: [/*#__PURE__*/_jsx(SectionSeparator, _extends({}, before, {
|
|
147
|
+
className: clsx(pickersInputClasses.before, before == null ? void 0 : before.className)
|
|
148
|
+
})), /*#__PURE__*/_jsx(SectionInput, _extends({}, content, {
|
|
149
|
+
className: clsx(pickersInputClasses.content, content == null ? void 0 : content.className),
|
|
150
|
+
ownerState
|
|
151
|
+
})), /*#__PURE__*/_jsx(SectionSeparator, _extends({}, after, {
|
|
152
|
+
className: clsx(pickersInputClasses.after, after == null ? void 0 : after.className)
|
|
153
|
+
}))]
|
|
154
|
+
}), elementIndex))
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
const useUtilityClasses = ownerState => {
|
|
158
|
+
const {
|
|
159
|
+
focused,
|
|
160
|
+
disabled,
|
|
161
|
+
error,
|
|
162
|
+
classes,
|
|
163
|
+
fullWidth,
|
|
164
|
+
color,
|
|
165
|
+
size,
|
|
166
|
+
endAdornment,
|
|
167
|
+
startAdornment
|
|
168
|
+
} = ownerState;
|
|
169
|
+
const slots = {
|
|
170
|
+
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', error && 'error', fullWidth && 'fullWidth', `color${capitalize(color)}`, size === 'small' && 'inputSizeSmall', Boolean(startAdornment) && 'adornedStart', Boolean(endAdornment) && 'adornedEnd'],
|
|
171
|
+
notchedOutline: ['notchedOutline'],
|
|
172
|
+
before: ['before'],
|
|
173
|
+
after: ['after'],
|
|
174
|
+
content: ['content'],
|
|
175
|
+
input: ['input']
|
|
176
|
+
};
|
|
177
|
+
return composeClasses(slots, getPickersInputUtilityClass, classes);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// TODO: move to utils
|
|
181
|
+
// Separates the state props from the form control
|
|
182
|
+
function formControlState({
|
|
183
|
+
props,
|
|
184
|
+
states,
|
|
185
|
+
muiFormControl
|
|
186
|
+
}) {
|
|
187
|
+
return states.reduce((acc, state) => {
|
|
188
|
+
acc[state] = props[state];
|
|
189
|
+
if (muiFormControl) {
|
|
190
|
+
if (typeof props[state] === 'undefined') {
|
|
191
|
+
acc[state] = muiFormControl[state];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return acc;
|
|
195
|
+
}, {});
|
|
196
|
+
}
|
|
197
|
+
const PickersInput = /*#__PURE__*/React.forwardRef(function PickersInput(props, ref) {
|
|
198
|
+
const {
|
|
199
|
+
elements,
|
|
200
|
+
label,
|
|
201
|
+
onWrapperClick,
|
|
202
|
+
valueStr,
|
|
203
|
+
onValueStrChange,
|
|
204
|
+
id,
|
|
205
|
+
ownerState: ownerStateProp,
|
|
206
|
+
endAdornment,
|
|
207
|
+
startAdornment
|
|
208
|
+
} = props,
|
|
209
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
210
|
+
const inputRef = React.useRef(null);
|
|
211
|
+
const handleInputRef = useForkRef(ref, inputRef);
|
|
212
|
+
const muiFormControl = useFormControl();
|
|
213
|
+
const fcs = formControlState({
|
|
214
|
+
props,
|
|
215
|
+
muiFormControl,
|
|
216
|
+
states: ['color', 'disabled', 'error', 'focused', 'size', 'required', 'fullWidth', 'adornedStart']
|
|
217
|
+
});
|
|
218
|
+
React.useEffect(() => {
|
|
219
|
+
if (muiFormControl) {
|
|
220
|
+
muiFormControl.setAdornedStart(Boolean(startAdornment));
|
|
221
|
+
}
|
|
222
|
+
}, [muiFormControl, startAdornment]);
|
|
223
|
+
const ownerState = _extends({}, props, ownerStateProp, {
|
|
224
|
+
color: fcs.color || 'primary',
|
|
225
|
+
disabled: fcs.disabled,
|
|
226
|
+
error: fcs.error,
|
|
227
|
+
focused: fcs.focused,
|
|
228
|
+
fullWidth: fcs.fullWidth,
|
|
229
|
+
size: fcs.size
|
|
230
|
+
});
|
|
231
|
+
const classes = useUtilityClasses(ownerState);
|
|
232
|
+
return /*#__PURE__*/_jsxs(SectionsWrapper, _extends({
|
|
233
|
+
ref: handleInputRef
|
|
234
|
+
}, other, {
|
|
235
|
+
className: classes.root,
|
|
236
|
+
onClick: onWrapperClick,
|
|
237
|
+
ownerState: ownerState,
|
|
238
|
+
"aria-invalid": fcs.error,
|
|
239
|
+
children: [startAdornment, /*#__PURE__*/_jsxs(SectionsContainer, {
|
|
240
|
+
ownerState: ownerState,
|
|
241
|
+
className: classes.input,
|
|
242
|
+
children: [/*#__PURE__*/_jsx(InputContent, {
|
|
243
|
+
elements: elements,
|
|
244
|
+
contentEditable: other.contentEditable,
|
|
245
|
+
ownerState: ownerState
|
|
246
|
+
}), /*#__PURE__*/_jsx(FakeHiddenInput, {
|
|
247
|
+
value: valueStr,
|
|
248
|
+
onChange: onValueStrChange,
|
|
249
|
+
id: id,
|
|
250
|
+
"aria-hidden": "true",
|
|
251
|
+
tabIndex: -1
|
|
252
|
+
})]
|
|
253
|
+
}), endAdornment, /*#__PURE__*/_jsx(NotchedOutlineRoot, {
|
|
254
|
+
shrink: fcs.adornedStart || fcs.focused,
|
|
255
|
+
notched: fcs.adornedStart || fcs.focused,
|
|
256
|
+
className: classes.notchedOutline,
|
|
257
|
+
label: label != null && label !== '' && fcs.required ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
258
|
+
children: [label, "\u2009", '*']
|
|
259
|
+
}) : label,
|
|
260
|
+
ownerState: ownerState
|
|
261
|
+
})]
|
|
262
|
+
}));
|
|
263
|
+
});
|
|
264
|
+
export default PickersInput;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OutlinedInputProps } from '@mui/material/OutlinedInput';
|
|
3
|
+
import { FieldsTextFieldProps } from '../../models';
|
|
4
|
+
export interface PickersInputElement {
|
|
5
|
+
container: React.HTMLAttributes<HTMLSpanElement>;
|
|
6
|
+
content: React.HTMLAttributes<HTMLSpanElement>;
|
|
7
|
+
before: React.HTMLAttributes<HTMLSpanElement>;
|
|
8
|
+
after: React.HTMLAttributes<HTMLSpanElement>;
|
|
9
|
+
}
|
|
10
|
+
export interface PickersInputProps extends FieldsTextFieldProps {
|
|
11
|
+
elements: PickersInputElement[];
|
|
12
|
+
areAllSectionsEmpty?: boolean;
|
|
13
|
+
valueStr: string;
|
|
14
|
+
onValueStrChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
15
|
+
id?: string;
|
|
16
|
+
InputProps?: Partial<OutlinedInputProps>;
|
|
17
|
+
inputProps: any;
|
|
18
|
+
autoFocus?: boolean;
|
|
19
|
+
ownerState?: any;
|
|
20
|
+
onWrapperClick: () => void;
|
|
21
|
+
defaultValue: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
endAdornment?: React.ReactNode;
|
|
24
|
+
startAdornment?: React.ReactNode;
|
|
25
|
+
onBlur?: React.FocusEventHandler;
|
|
26
|
+
onChange?: React.FormEventHandler;
|
|
27
|
+
onFocus?: React.FocusEventHandler;
|
|
28
|
+
onKeyDown?: React.KeyboardEventHandler;
|
|
29
|
+
onKeyUp?: React.KeyboardEventHandler;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["elements", "className", "color", "disabled", "error", "label", "variant", "fullWidth", "valueStr", "helperText", "valueType", "id", "FormHelperTextProps", "InputLabelProps", "inputProps", "InputProps", "required", "focused", "ownerState"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
8
|
+
import { unstable_composeClasses as composeClasses, unstable_useId as useId } from '@mui/utils';
|
|
9
|
+
import InputLabel from '@mui/material/InputLabel';
|
|
10
|
+
import FormHelperText from '@mui/material/FormHelperText';
|
|
11
|
+
import FormControl from '@mui/material/FormControl';
|
|
12
|
+
import { getPickersTextFieldUtilityClass } from './pickersTextFieldClasses';
|
|
13
|
+
import PickersInput from './PickersInput';
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
const PickersTextFieldRoot = styled(FormControl, {
|
|
17
|
+
name: 'MuiPickersTextField',
|
|
18
|
+
slot: 'Root',
|
|
19
|
+
overridesResolver: (props, styles) => styles.root
|
|
20
|
+
})({});
|
|
21
|
+
const useUtilityClasses = ownerState => {
|
|
22
|
+
const {
|
|
23
|
+
focused,
|
|
24
|
+
disabled,
|
|
25
|
+
classes,
|
|
26
|
+
required
|
|
27
|
+
} = ownerState;
|
|
28
|
+
const slots = {
|
|
29
|
+
root: ['root', focused && !disabled && 'focused', disabled && 'disabled', required && 'required']
|
|
30
|
+
};
|
|
31
|
+
return composeClasses(slots, getPickersTextFieldUtilityClass, classes);
|
|
32
|
+
};
|
|
33
|
+
export const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField(props, ref) {
|
|
34
|
+
const {
|
|
35
|
+
elements,
|
|
36
|
+
className,
|
|
37
|
+
color = 'primary',
|
|
38
|
+
disabled = false,
|
|
39
|
+
error = false,
|
|
40
|
+
label,
|
|
41
|
+
variant = 'outlined',
|
|
42
|
+
fullWidth = false,
|
|
43
|
+
valueStr,
|
|
44
|
+
helperText,
|
|
45
|
+
valueType,
|
|
46
|
+
id: idOverride,
|
|
47
|
+
FormHelperTextProps,
|
|
48
|
+
InputLabelProps,
|
|
49
|
+
inputProps,
|
|
50
|
+
InputProps,
|
|
51
|
+
required = false,
|
|
52
|
+
focused: focusedProp
|
|
53
|
+
} = props,
|
|
54
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
55
|
+
const [focused, setFocused] = React.useState(focusedProp);
|
|
56
|
+
const rootRef = React.useRef(null);
|
|
57
|
+
const handleRootRef = useForkRef(ref, rootRef);
|
|
58
|
+
const inputRef = React.useRef(null);
|
|
59
|
+
const handleInputRef = useForkRef(inputRef, InputProps == null ? void 0 : InputProps.ref);
|
|
60
|
+
const id = useId(idOverride);
|
|
61
|
+
const helperTextId = helperText && id ? `${id}-helper-text` : undefined;
|
|
62
|
+
const inputLabelId = label && id ? `${id}-label` : undefined;
|
|
63
|
+
const ownerState = _extends({}, props, {
|
|
64
|
+
color,
|
|
65
|
+
disabled,
|
|
66
|
+
error,
|
|
67
|
+
focused,
|
|
68
|
+
variant
|
|
69
|
+
});
|
|
70
|
+
const classes = useUtilityClasses(ownerState);
|
|
71
|
+
|
|
72
|
+
// TODO: delete after behavior implementation
|
|
73
|
+
const onWrapperClick = () => {
|
|
74
|
+
if (!focused) {
|
|
75
|
+
var _inputRef$current;
|
|
76
|
+
setFocused(true);
|
|
77
|
+
const container = rootRef.current;
|
|
78
|
+
|
|
79
|
+
// Find the first input element within the container
|
|
80
|
+
const firstInput = container == null ? void 0 : container.querySelector('.content');
|
|
81
|
+
|
|
82
|
+
// Check if the input element exists before focusing it
|
|
83
|
+
if (firstInput) {
|
|
84
|
+
firstInput.focus();
|
|
85
|
+
}
|
|
86
|
+
(_inputRef$current = inputRef.current) == null || _inputRef$current.focus();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
return /*#__PURE__*/_jsxs(PickersTextFieldRoot, {
|
|
90
|
+
className: clsx(classes.root, className),
|
|
91
|
+
ref: handleRootRef,
|
|
92
|
+
focused: focused,
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
variant: variant,
|
|
95
|
+
error: error,
|
|
96
|
+
color: color,
|
|
97
|
+
fullWidth: fullWidth,
|
|
98
|
+
required: required,
|
|
99
|
+
ownerState: ownerState,
|
|
100
|
+
children: [/*#__PURE__*/_jsx(InputLabel, _extends({
|
|
101
|
+
htmlFor: id,
|
|
102
|
+
id: inputLabelId
|
|
103
|
+
}, InputLabelProps, {
|
|
104
|
+
children: label
|
|
105
|
+
})), /*#__PURE__*/_jsx(PickersInput, _extends({
|
|
106
|
+
elements,
|
|
107
|
+
valueStr,
|
|
108
|
+
valueType,
|
|
109
|
+
onWrapperClick,
|
|
110
|
+
inputProps,
|
|
111
|
+
label
|
|
112
|
+
}, other, InputProps, {
|
|
113
|
+
ref: handleInputRef
|
|
114
|
+
})), helperText && /*#__PURE__*/_jsx(FormHelperText, _extends({
|
|
115
|
+
id: helperTextId
|
|
116
|
+
}, FormHelperTextProps, {
|
|
117
|
+
children: helperText
|
|
118
|
+
}))]
|
|
119
|
+
});
|
|
120
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextFieldClasses } from '@mui/material/TextField';
|
|
3
|
+
import { PickersInputProps } from './PickersInput.types';
|
|
4
|
+
export interface PickersTextFieldProps extends PickersInputProps {
|
|
5
|
+
classes?: Partial<TextFieldClasses>;
|
|
6
|
+
className?: string;
|
|
7
|
+
color?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
error?: boolean;
|
|
10
|
+
fullWidth?: boolean;
|
|
11
|
+
helperText?: React.ReactNode;
|
|
12
|
+
size?: 'small' | 'medium';
|
|
13
|
+
variant?: 'filled' | 'outlined' | 'standard';
|
|
14
|
+
valueStr: string;
|
|
15
|
+
InputProps: any;
|
|
16
|
+
valueType: 'value' | 'placeholder';
|
|
17
|
+
required?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PickersTextField } from './PickersTextField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PickersTextField } from './PickersTextField';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface PickersTextFieldClasses {
|
|
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 `error=true`. */
|
|
9
|
+
error: string;
|
|
10
|
+
/** State class applied to the root element id `required=true` */
|
|
11
|
+
required: string;
|
|
12
|
+
}
|
|
13
|
+
export type PickersTextFieldClassKey = keyof PickersTextFieldClasses;
|
|
14
|
+
export declare function getPickersTextFieldUtilityClass(slot: string): string;
|
|
15
|
+
export declare const pickersTextFieldClasses: Record<keyof PickersTextFieldClasses, string>;
|
|
16
|
+
export interface PickersInputClasses {
|
|
17
|
+
/** Styles applied to the root element. */
|
|
18
|
+
root: string;
|
|
19
|
+
/** Styles applied to the root element if focused. */
|
|
20
|
+
focused: string;
|
|
21
|
+
/** State class applied to the root element if `disabled=true`. */
|
|
22
|
+
disabled: string;
|
|
23
|
+
/** State class applied to the root element if `error=true`. */
|
|
24
|
+
error: string;
|
|
25
|
+
/** Styles applied to the NotchedOutline element. */
|
|
26
|
+
notchedOutline: string;
|
|
27
|
+
/** Styles applied to the fake input element. */
|
|
28
|
+
input: string;
|
|
29
|
+
/** Styles applied to the section of the picker. */
|
|
30
|
+
content: string;
|
|
31
|
+
/** Styles applied to the startSeparator */
|
|
32
|
+
before: string;
|
|
33
|
+
/** Styles applied to the endSeparator */
|
|
34
|
+
after: string;
|
|
35
|
+
/** Styles applied to the root if there is a startAdornment present */
|
|
36
|
+
adornedStart: string;
|
|
37
|
+
/** Styles applied to the root if there is an endAdornment present */
|
|
38
|
+
adornedEnd: string;
|
|
39
|
+
}
|
|
40
|
+
export type PickersInputClassKey = keyof PickersInputClasses;
|
|
41
|
+
export declare function getPickersInputUtilityClass(slot: string): string;
|
|
42
|
+
export declare const pickersInputClasses: Record<keyof PickersInputClasses, string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
+
export function getPickersTextFieldUtilityClass(slot) {
|
|
3
|
+
return generateUtilityClass('MuiPickersTextField', slot);
|
|
4
|
+
}
|
|
5
|
+
export const pickersTextFieldClasses = generateUtilityClasses('MuiPickersTextField', ['root', 'focused', 'disabled', 'error', 'required']);
|
|
6
|
+
export function getPickersInputUtilityClass(slot) {
|
|
7
|
+
return generateUtilityClass('MuiPickersInput', slot);
|
|
8
|
+
}
|
|
9
|
+
export const pickersInputClasses = generateUtilityClasses('MuiPickersInput', ['root', 'focused', 'disabled', 'error', 'notchedOutline', 'content', 'before', 'after', 'adornedStart', 'adornedEnd', 'input']);
|
|
@@ -8,7 +8,7 @@ export function useNextMonthDisabled(month, {
|
|
|
8
8
|
}) {
|
|
9
9
|
const utils = useUtils();
|
|
10
10
|
return React.useMemo(() => {
|
|
11
|
-
const now = utils.
|
|
11
|
+
const now = utils.date(undefined, timezone);
|
|
12
12
|
const lastEnabledMonth = utils.startOfMonth(disableFuture && utils.isBefore(now, maxDate) ? now : maxDate);
|
|
13
13
|
return !utils.isAfter(lastEnabledMonth, month);
|
|
14
14
|
}, [disableFuture, maxDate, month, utils, timezone]);
|
|
@@ -20,7 +20,7 @@ export function usePreviousMonthDisabled(month, {
|
|
|
20
20
|
}) {
|
|
21
21
|
const utils = useUtils();
|
|
22
22
|
return React.useMemo(() => {
|
|
23
|
-
const now = utils.
|
|
23
|
+
const now = utils.date(undefined, timezone);
|
|
24
24
|
const firstEnabledMonth = utils.startOfMonth(disablePast && utils.isAfter(now, minDate) ? now : minDate);
|
|
25
25
|
return !utils.isBefore(firstEnabledMonth, month);
|
|
26
26
|
}, [disablePast, minDate, month, utils, timezone]);
|
|
@@ -34,7 +34,7 @@ const getDeltaFromKeyCode = keyCode => {
|
|
|
34
34
|
};
|
|
35
35
|
export const getDaysInWeekStr = (utils, timezone, format) => {
|
|
36
36
|
const elements = [];
|
|
37
|
-
const now = utils.
|
|
37
|
+
const now = utils.date(undefined, timezone);
|
|
38
38
|
const startDate = utils.startOfWeek(now);
|
|
39
39
|
const endDate = utils.endOfWeek(now);
|
|
40
40
|
let current = startDate;
|
|
@@ -48,7 +48,7 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
|
|
|
48
48
|
switch (sectionType) {
|
|
49
49
|
case 'month':
|
|
50
50
|
{
|
|
51
|
-
return getMonthsInYear(utils, utils.
|
|
51
|
+
return getMonthsInYear(utils, utils.date(undefined, timezone)).map(month => utils.formatByString(month, format));
|
|
52
52
|
}
|
|
53
53
|
case 'weekDay':
|
|
54
54
|
{
|
|
@@ -56,7 +56,7 @@ export const getLetterEditingOptions = (utils, timezone, sectionType, format) =>
|
|
|
56
56
|
}
|
|
57
57
|
case 'meridiem':
|
|
58
58
|
{
|
|
59
|
-
const now = utils.
|
|
59
|
+
const now = utils.date(undefined, timezone);
|
|
60
60
|
return [utils.startOfDay(now), utils.endOfDay(now)].map(date => utils.formatByString(date, format));
|
|
61
61
|
}
|
|
62
62
|
default:
|
|
@@ -113,7 +113,7 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
113
113
|
let newSectionValueNumber = currentSectionValue + delta * step;
|
|
114
114
|
if (shouldSetAbsolute) {
|
|
115
115
|
if (section.type === 'year' && !isEnd && !isStart) {
|
|
116
|
-
return utils.formatByString(utils.
|
|
116
|
+
return utils.formatByString(utils.date(undefined, timezone), section.format);
|
|
117
117
|
}
|
|
118
118
|
if (delta > 0 || isStart) {
|
|
119
119
|
newSectionValueNumber = sectionBoundaries.minimum;
|
|
@@ -207,49 +207,62 @@ export const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
|
207
207
|
}
|
|
208
208
|
return newSections;
|
|
209
209
|
};
|
|
210
|
-
const getSectionPlaceholder = (utils, timezone, localeText, sectionConfig,
|
|
210
|
+
const getSectionPlaceholder = (utils, timezone, localeText, sectionConfig, sectionFormat) => {
|
|
211
211
|
switch (sectionConfig.type) {
|
|
212
212
|
case 'year':
|
|
213
213
|
{
|
|
214
214
|
return localeText.fieldYearPlaceholder({
|
|
215
|
-
digitAmount: utils.formatByString(utils.
|
|
215
|
+
digitAmount: utils.formatByString(utils.date(undefined, timezone), sectionFormat).length,
|
|
216
|
+
format: sectionFormat
|
|
216
217
|
});
|
|
217
218
|
}
|
|
218
219
|
case 'month':
|
|
219
220
|
{
|
|
220
221
|
return localeText.fieldMonthPlaceholder({
|
|
221
|
-
contentType: sectionConfig.contentType
|
|
222
|
+
contentType: sectionConfig.contentType,
|
|
223
|
+
format: sectionFormat
|
|
222
224
|
});
|
|
223
225
|
}
|
|
224
226
|
case 'day':
|
|
225
227
|
{
|
|
226
|
-
return localeText.fieldDayPlaceholder(
|
|
228
|
+
return localeText.fieldDayPlaceholder({
|
|
229
|
+
format: sectionFormat
|
|
230
|
+
});
|
|
227
231
|
}
|
|
228
232
|
case 'weekDay':
|
|
229
233
|
{
|
|
230
234
|
return localeText.fieldWeekDayPlaceholder({
|
|
231
|
-
contentType: sectionConfig.contentType
|
|
235
|
+
contentType: sectionConfig.contentType,
|
|
236
|
+
format: sectionFormat
|
|
232
237
|
});
|
|
233
238
|
}
|
|
234
239
|
case 'hours':
|
|
235
240
|
{
|
|
236
|
-
return localeText.fieldHoursPlaceholder(
|
|
241
|
+
return localeText.fieldHoursPlaceholder({
|
|
242
|
+
format: sectionFormat
|
|
243
|
+
});
|
|
237
244
|
}
|
|
238
245
|
case 'minutes':
|
|
239
246
|
{
|
|
240
|
-
return localeText.fieldMinutesPlaceholder(
|
|
247
|
+
return localeText.fieldMinutesPlaceholder({
|
|
248
|
+
format: sectionFormat
|
|
249
|
+
});
|
|
241
250
|
}
|
|
242
251
|
case 'seconds':
|
|
243
252
|
{
|
|
244
|
-
return localeText.fieldSecondsPlaceholder(
|
|
253
|
+
return localeText.fieldSecondsPlaceholder({
|
|
254
|
+
format: sectionFormat
|
|
255
|
+
});
|
|
245
256
|
}
|
|
246
257
|
case 'meridiem':
|
|
247
258
|
{
|
|
248
|
-
return localeText.fieldMeridiemPlaceholder(
|
|
259
|
+
return localeText.fieldMeridiemPlaceholder({
|
|
260
|
+
format: sectionFormat
|
|
261
|
+
});
|
|
249
262
|
}
|
|
250
263
|
default:
|
|
251
264
|
{
|
|
252
|
-
return
|
|
265
|
+
return sectionFormat;
|
|
253
266
|
}
|
|
254
267
|
}
|
|
255
268
|
};
|
|
@@ -261,12 +274,12 @@ export const changeSectionValueFormat = (utils, valueStr, currentFormat, newForm
|
|
|
261
274
|
}
|
|
262
275
|
return utils.formatByString(utils.parse(valueStr, currentFormat), newFormat);
|
|
263
276
|
};
|
|
264
|
-
const isFourDigitYearFormat = (utils, timezone, format) => utils.formatByString(utils.
|
|
277
|
+
const isFourDigitYearFormat = (utils, timezone, format) => utils.formatByString(utils.date(undefined, timezone), format).length === 4;
|
|
265
278
|
export const doesSectionFormatHaveLeadingZeros = (utils, timezone, contentType, sectionType, format) => {
|
|
266
279
|
if (contentType !== 'digit') {
|
|
267
280
|
return false;
|
|
268
281
|
}
|
|
269
|
-
const now = utils.
|
|
282
|
+
const now = utils.date(undefined, timezone);
|
|
270
283
|
switch (sectionType) {
|
|
271
284
|
// We can't use `changeSectionValueFormat`, because `utils.parse('1', 'YYYY')` returns `1971` instead of `1`.
|
|
272
285
|
case 'year':
|
|
@@ -472,7 +485,7 @@ export const createDateStrForInputFromSections = (sections, isRTL) => {
|
|
|
472
485
|
return `\u2066${dateStr}\u2069`;
|
|
473
486
|
};
|
|
474
487
|
export const getSectionsBoundaries = (utils, timezone) => {
|
|
475
|
-
const today = utils.
|
|
488
|
+
const today = utils.date(undefined, timezone);
|
|
476
489
|
const endOfYear = utils.endOfYear(today);
|
|
477
490
|
const endOfDay = utils.endOfDay(today);
|
|
478
491
|
const {
|
|
@@ -156,7 +156,7 @@ export const useFieldState = params => {
|
|
|
156
156
|
const nonEmptySectionCountBefore = activeDateManager.getSections(state.sections).filter(section => section.value !== '').length;
|
|
157
157
|
const hasNoOtherNonEmptySections = nonEmptySectionCountBefore === (activeSection.value === '' ? 0 : 1);
|
|
158
158
|
const newSections = setSectionValue(selectedSectionIndexes.startIndex, '');
|
|
159
|
-
const newActiveDate = hasNoOtherNonEmptySections ? null : utils.
|
|
159
|
+
const newActiveDate = hasNoOtherNonEmptySections ? null : utils.getInvalidDate();
|
|
160
160
|
const newValues = activeDateManager.getNewValuesFromNewActiveDate(newActiveDate);
|
|
161
161
|
if ((newActiveDate != null && !utils.isValid(newActiveDate)) !== (activeDateManager.date != null && !utils.isValid(activeDateManager.date))) {
|
|
162
162
|
publishValue(_extends({}, newValues, {
|