@mui/x-date-pickers 6.16.0 → 6.16.2
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/AdapterDayjs/AdapterDayjs.js +6 -4
- package/AdapterMoment/AdapterMoment.js +2 -5
- package/CHANGELOG.md +165 -1
- package/DateCalendar/DateCalendar.js +3 -1
- package/DateCalendar/DayCalendar.js +2 -2
- package/DateCalendar/PickersFadeTransitionGroup.js +6 -6
- package/DateCalendar/PickersSlideTransition.d.ts +0 -1
- package/DateCalendar/PickersSlideTransition.js +5 -5
- package/DateField/DateField.d.ts +10 -0
- package/DateField/DateField.js +10 -0
- package/DateTimeField/DateTimeField.d.ts +10 -0
- package/DateTimeField/DateTimeField.js +10 -0
- package/DateTimePicker/DateTimePicker.d.ts +10 -0
- package/DateTimePicker/DateTimePicker.js +15 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +10 -0
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -7
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +4 -3
- package/DesktopTimePicker/DesktopTimePicker.d.ts +10 -0
- package/DesktopTimePicker/DesktopTimePicker.js +18 -9
- package/DigitalClock/DigitalClock.js +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.d.ts +10 -0
- package/MobileDateTimePicker/MobileDateTimePicker.js +10 -0
- package/MobileTimePicker/MobileTimePicker.d.ts +10 -0
- package/MobileTimePicker/MobileTimePicker.js +10 -0
- package/MonthCalendar/MonthCalendar.js +4 -1
- package/StaticDateTimePicker/StaticDateTimePicker.d.ts +10 -0
- package/StaticDateTimePicker/StaticDateTimePicker.js +10 -0
- package/StaticTimePicker/StaticTimePicker.d.ts +10 -0
- package/StaticTimePicker/StaticTimePicker.js +10 -0
- package/TimeField/TimeField.d.ts +10 -0
- package/TimeField/TimeField.js +10 -0
- package/TimePicker/TimePicker.d.ts +10 -0
- package/TimePicker/TimePicker.js +10 -0
- package/YearCalendar/PickersYear.js +1 -1
- package/YearCalendar/YearCalendar.js +6 -3
- package/dateTimeViewRenderers/dateTimeViewRenderers.d.ts +2 -1
- package/dateTimeViewRenderers/dateTimeViewRenderers.js +52 -33
- package/index.js +1 -1
- package/internals/components/FakeTextField/FakeTextField.d.ts +7 -0
- package/internals/components/FakeTextField/FakeTextField.js +19 -0
- package/internals/components/FakeTextField/index.d.ts +1 -0
- package/internals/components/FakeTextField/index.js +1 -0
- package/internals/constants/dimensions.d.ts +2 -1
- package/internals/constants/dimensions.js +2 -1
- package/internals/hooks/useField/useField.js +6 -4
- package/internals/hooks/useField/useField.types.d.ts +6 -0
- package/internals/utils/date-time-utils.d.ts +11 -0
- package/internals/utils/date-time-utils.js +32 -2
- package/legacy/AdapterDayjs/AdapterDayjs.js +6 -4
- package/legacy/AdapterMoment/AdapterMoment.js +2 -5
- package/legacy/DateCalendar/DateCalendar.js +3 -1
- package/legacy/DateCalendar/DayCalendar.js +2 -2
- package/legacy/DateCalendar/PickersFadeTransitionGroup.js +6 -6
- package/legacy/DateCalendar/PickersSlideTransition.js +5 -5
- package/legacy/DateField/DateField.js +10 -0
- package/legacy/DateTimeField/DateTimeField.js +10 -0
- package/legacy/DateTimePicker/DateTimePicker.js +15 -0
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +24 -8
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +19 -10
- package/legacy/DigitalClock/DigitalClock.js +1 -1
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +10 -0
- package/legacy/MobileTimePicker/MobileTimePicker.js +10 -0
- package/legacy/MonthCalendar/MonthCalendar.js +4 -1
- package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +10 -0
- package/legacy/StaticTimePicker/StaticTimePicker.js +10 -0
- package/legacy/TimeField/TimeField.js +10 -0
- package/legacy/TimePicker/TimePicker.js +10 -0
- package/legacy/YearCalendar/PickersYear.js +1 -1
- package/legacy/YearCalendar/YearCalendar.js +6 -4
- package/legacy/dateTimeViewRenderers/dateTimeViewRenderers.js +51 -33
- package/legacy/index.js +1 -1
- package/legacy/internals/components/FakeTextField/FakeTextField.js +19 -0
- package/legacy/internals/components/FakeTextField/index.js +1 -0
- package/legacy/internals/constants/dimensions.js +2 -1
- package/legacy/internals/hooks/useField/useField.js +5 -3
- package/legacy/internals/utils/date-time-utils.js +34 -2
- package/legacy/locales/esES.js +1 -1
- package/locales/esES.js +1 -1
- package/modern/AdapterDayjs/AdapterDayjs.js +6 -4
- package/modern/AdapterMoment/AdapterMoment.js +2 -5
- package/modern/DateCalendar/DateCalendar.js +3 -1
- package/modern/DateCalendar/DayCalendar.js +2 -2
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +6 -6
- package/modern/DateCalendar/PickersSlideTransition.js +5 -5
- package/modern/DateField/DateField.js +10 -0
- package/modern/DateTimeField/DateTimeField.js +10 -0
- package/modern/DateTimePicker/DateTimePicker.js +15 -0
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -7
- package/modern/DesktopTimePicker/DesktopTimePicker.js +17 -8
- package/modern/DigitalClock/DigitalClock.js +1 -1
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +10 -0
- package/modern/MobileTimePicker/MobileTimePicker.js +10 -0
- package/modern/MonthCalendar/MonthCalendar.js +4 -1
- package/modern/StaticDateTimePicker/StaticDateTimePicker.js +10 -0
- package/modern/StaticTimePicker/StaticTimePicker.js +10 -0
- package/modern/TimeField/TimeField.js +10 -0
- package/modern/TimePicker/TimePicker.js +10 -0
- package/modern/YearCalendar/PickersYear.js +1 -1
- package/modern/YearCalendar/YearCalendar.js +5 -3
- package/modern/dateTimeViewRenderers/dateTimeViewRenderers.js +52 -33
- package/modern/index.js +1 -1
- package/modern/internals/components/FakeTextField/FakeTextField.js +19 -0
- package/modern/internals/components/FakeTextField/index.js +1 -0
- package/modern/internals/constants/dimensions.js +2 -1
- package/modern/internals/hooks/useField/useField.js +6 -4
- package/modern/internals/utils/date-time-utils.js +29 -2
- package/modern/locales/esES.js +1 -1
- package/node/AdapterDayjs/AdapterDayjs.js +6 -4
- package/node/AdapterMoment/AdapterMoment.js +2 -5
- package/node/DateCalendar/DateCalendar.js +4 -3
- package/node/DateCalendar/DayCalendar.js +2 -2
- package/node/DateCalendar/PickersFadeTransitionGroup.js +6 -6
- package/node/DateCalendar/PickersSlideTransition.js +5 -7
- package/node/DateCalendar/dateCalendarClasses.js +1 -2
- package/node/DateCalendar/dayCalendarClasses.js +1 -2
- package/node/DateCalendar/pickersFadeTransitionGroupClasses.js +1 -2
- package/node/DateCalendar/pickersSlideTransitionClasses.js +1 -2
- package/node/DateField/DateField.js +11 -2
- package/node/DatePicker/DatePicker.js +1 -2
- package/node/DatePicker/DatePickerToolbar.js +1 -2
- package/node/DatePicker/datePickerToolbarClasses.js +1 -2
- package/node/DateTimeField/DateTimeField.js +11 -2
- package/node/DateTimePicker/DateTimePicker.js +16 -2
- package/node/DateTimePicker/DateTimePickerTabs.js +1 -2
- package/node/DateTimePicker/dateTimePickerTabsClasses.js +1 -2
- package/node/DateTimePicker/dateTimePickerToolbarClasses.js +1 -2
- package/node/DayCalendarSkeleton/dayCalendarSkeletonClasses.js +1 -2
- package/node/DesktopDatePicker/DesktopDatePicker.js +1 -2
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +25 -8
- package/node/DesktopTimePicker/DesktopTimePicker.js +18 -10
- package/node/DigitalClock/DigitalClock.js +2 -3
- package/node/DigitalClock/digitalClockClasses.js +1 -2
- package/node/LocalizationProvider/LocalizationProvider.js +2 -4
- package/node/MobileDatePicker/MobileDatePicker.js +1 -2
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +11 -2
- package/node/MobileTimePicker/MobileTimePicker.js +11 -2
- package/node/MonthCalendar/MonthCalendar.js +5 -3
- package/node/MonthCalendar/PickersMonth.js +2 -3
- package/node/MonthCalendar/monthCalendarClasses.js +1 -2
- package/node/MonthCalendar/pickersMonthClasses.js +1 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -2
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +2 -3
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockClasses.js +1 -2
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +1 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +1 -2
- package/node/PickersCalendarHeader/pickersCalendarHeaderClasses.js +1 -2
- package/node/PickersDay/PickersDay.js +1 -2
- package/node/PickersDay/pickersDayClasses.js +1 -2
- package/node/PickersLayout/PickersLayout.js +3 -6
- package/node/PickersLayout/pickersLayoutClasses.js +1 -2
- package/node/PickersLayout/usePickerLayout.js +1 -2
- package/node/StaticDatePicker/StaticDatePicker.js +1 -2
- package/node/StaticDateTimePicker/StaticDateTimePicker.js +11 -2
- package/node/StaticTimePicker/StaticTimePicker.js +11 -2
- package/node/TimeClock/TimeClock.js +1 -2
- package/node/TimeClock/clockClasses.js +1 -2
- package/node/TimeClock/clockNumberClasses.js +1 -2
- package/node/TimeClock/clockPointerClasses.js +1 -2
- package/node/TimeClock/shared.js +2 -4
- package/node/TimeClock/timeClockClasses.js +1 -2
- package/node/TimeField/TimeField.js +11 -2
- package/node/TimePicker/TimePicker.js +11 -2
- package/node/TimePicker/timePickerToolbarClasses.js +1 -2
- package/node/YearCalendar/PickersYear.js +3 -4
- package/node/YearCalendar/YearCalendar.js +6 -5
- package/node/YearCalendar/pickersYearClasses.js +1 -2
- package/node/YearCalendar/yearCalendarClasses.js +1 -2
- package/node/dateTimeViewRenderers/dateTimeViewRenderers.js +51 -32
- package/node/icons/index.js +9 -17
- package/node/index.js +1 -1
- package/node/internals/components/DateTimeViewWrapper/DateTimeViewWrapper.js +2 -3
- package/node/internals/components/FakeTextField/FakeTextField.js +27 -0
- package/node/internals/components/FakeTextField/index.js +12 -0
- package/node/internals/components/PickerViewRoot/PickerViewRoot.js +2 -3
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +2 -3
- package/node/internals/components/PickersArrowSwitcher/pickersArrowSwitcherClasses.js +1 -2
- package/node/internals/components/PickersToolbar.js +2 -3
- package/node/internals/components/PickersToolbarButton.js +2 -3
- package/node/internals/components/PickersToolbarText.js +2 -3
- package/node/internals/components/pickersPopperClasses.js +1 -2
- package/node/internals/components/pickersToolbarButtonClasses.js +1 -2
- package/node/internals/components/pickersToolbarClasses.js +1 -2
- package/node/internals/components/pickersToolbarTextClasses.js +1 -2
- package/node/internals/constants/dimensions.js +8 -13
- package/node/internals/hooks/useDefaultReduceAnimations.js +1 -2
- package/node/internals/hooks/useField/useField.js +6 -4
- package/node/internals/utils/date-time-utils.js +29 -1
- package/node/internals/utils/getDefaultReferenceDate.js +1 -2
- package/node/internals/utils/utils.js +1 -2
- package/node/internals/utils/validation/extractValidationProps.js +3 -6
- package/node/internals/utils/valueManagers.js +3 -5
- package/node/locales/beBY.js +1 -2
- package/node/locales/caES.js +1 -2
- package/node/locales/csCZ.js +1 -2
- package/node/locales/daDK.js +1 -2
- package/node/locales/deDE.js +1 -2
- package/node/locales/elGR.js +1 -2
- package/node/locales/enUS.js +2 -4
- package/node/locales/esES.js +2 -3
- package/node/locales/faIR.js +1 -2
- package/node/locales/fiFI.js +1 -2
- package/node/locales/frFR.js +1 -2
- package/node/locales/heIL.js +1 -2
- package/node/locales/huHU.js +1 -2
- package/node/locales/isIS.js +1 -2
- package/node/locales/itIT.js +1 -2
- package/node/locales/jaJP.js +1 -2
- package/node/locales/koKR.js +1 -2
- package/node/locales/kzKZ.js +1 -2
- package/node/locales/nbNO.js +1 -2
- package/node/locales/nlNL.js +1 -2
- package/node/locales/plPL.js +1 -2
- package/node/locales/ptBR.js +1 -2
- package/node/locales/roRO.js +1 -2
- package/node/locales/ruRU.js +1 -2
- package/node/locales/skSK.js +1 -2
- package/node/locales/svSE.js +1 -2
- package/node/locales/trTR.js +1 -2
- package/node/locales/ukUA.js +1 -2
- package/node/locales/urPK.js +1 -2
- package/node/locales/viVN.js +1 -2
- package/node/locales/zhCN.js +1 -2
- package/node/locales/zhHK.js +1 -2
- package/package.json +5 -5
|
@@ -13,6 +13,16 @@ import { extractValidationProps } from '../internals/utils/validation/extractVal
|
|
|
13
13
|
import { renderDateViewCalendar } from '../dateViewRenderers';
|
|
14
14
|
import { renderTimeViewClock } from '../timeViewRenderers';
|
|
15
15
|
import { resolveDateTimeFormat } from '../internals/utils/date-time-utils';
|
|
16
|
+
/**
|
|
17
|
+
* Demos:
|
|
18
|
+
*
|
|
19
|
+
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
|
20
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
21
|
+
*
|
|
22
|
+
* API:
|
|
23
|
+
*
|
|
24
|
+
* - [MobileDateTimePicker API](https://mui.com/x/api/date-pickers/mobile-date-time-picker/)
|
|
25
|
+
*/
|
|
16
26
|
const MobileDateTimePicker = /*#__PURE__*/React.forwardRef(function MobileDateTimePicker(inProps, ref) {
|
|
17
27
|
var _defaultizedProps$amp, _defaultizedProps$slo2, _defaultizedProps$slo3, _props$localeText$ope, _props$localeText;
|
|
18
28
|
const localeText = useLocaleText();
|
|
@@ -3,5 +3,15 @@ import { MobileTimePickerProps } from './MobileTimePicker.types';
|
|
|
3
3
|
type MobileTimePickerComponent = (<TDate>(props: MobileTimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
*
|
|
9
|
+
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
|
10
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
11
|
+
*
|
|
12
|
+
* API:
|
|
13
|
+
*
|
|
14
|
+
* - [MobileTimePicker API](https://mui.com/x/api/date-pickers/mobile-time-picker/)
|
|
15
|
+
*/
|
|
6
16
|
declare const MobileTimePicker: MobileTimePickerComponent;
|
|
7
17
|
export { MobileTimePicker };
|
|
@@ -12,6 +12,16 @@ import { useMobilePicker } from '../internals/hooks/useMobilePicker';
|
|
|
12
12
|
import { extractValidationProps } from '../internals/utils/validation/extractValidationProps';
|
|
13
13
|
import { renderTimeViewClock } from '../timeViewRenderers';
|
|
14
14
|
import { resolveTimeFormat } from '../internals/utils/time-utils';
|
|
15
|
+
/**
|
|
16
|
+
* Demos:
|
|
17
|
+
*
|
|
18
|
+
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
|
19
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
20
|
+
*
|
|
21
|
+
* API:
|
|
22
|
+
*
|
|
23
|
+
* - [MobileTimePicker API](https://mui.com/x/api/date-pickers/mobile-time-picker/)
|
|
24
|
+
*/
|
|
15
25
|
const MobileTimePicker = /*#__PURE__*/React.forwardRef(function MobileTimePicker(inProps, ref) {
|
|
16
26
|
var _defaultizedProps$amp, _defaultizedProps$slo2, _props$localeText$ope, _props$localeText;
|
|
17
27
|
const localeText = useLocaleText();
|
|
@@ -14,6 +14,7 @@ import { applyDefaultDate, getMonthsInYear } from '../internals/utils/date-utils
|
|
|
14
14
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
15
15
|
import { SECTION_TYPE_GRANULARITY } from '../internals/utils/getDefaultReferenceDate';
|
|
16
16
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
17
|
+
import { DIALOG_WIDTH } from '../internals/constants/dimensions';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
19
20
|
const {
|
|
@@ -48,7 +49,9 @@ const MonthCalendarRoot = styled('div', {
|
|
|
48
49
|
flexWrap: 'wrap',
|
|
49
50
|
alignContent: 'stretch',
|
|
50
51
|
padding: '0 4px',
|
|
51
|
-
width:
|
|
52
|
+
width: DIALOG_WIDTH,
|
|
53
|
+
// avoid padding increasing width over defined
|
|
54
|
+
boxSizing: 'border-box'
|
|
52
55
|
});
|
|
53
56
|
export const MonthCalendar = /*#__PURE__*/React.forwardRef(function MonthCalendar(inProps, ref) {
|
|
54
57
|
const props = useMonthCalendarDefaultizedProps(inProps, 'MuiMonthCalendar');
|
|
@@ -3,5 +3,15 @@ import { StaticDateTimePickerProps } from './StaticDateTimePicker.types';
|
|
|
3
3
|
type StaticDateTimePickerComponent = (<TDate>(props: StaticDateTimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
*
|
|
9
|
+
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
|
10
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
11
|
+
*
|
|
12
|
+
* API:
|
|
13
|
+
*
|
|
14
|
+
* - [StaticDateTimePicker API](https://mui.com/x/api/date-pickers/static-date-time-picker/)
|
|
15
|
+
*/
|
|
6
16
|
declare const StaticDateTimePicker: StaticDateTimePickerComponent;
|
|
7
17
|
export { StaticDateTimePicker };
|
|
@@ -7,6 +7,16 @@ import { renderDateViewCalendar } from '../dateViewRenderers';
|
|
|
7
7
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
8
8
|
import { useStaticPicker } from '../internals/hooks/useStaticPicker';
|
|
9
9
|
import { validateDateTime } from '../internals/utils/validation/validateDateTime';
|
|
10
|
+
/**
|
|
11
|
+
* Demos:
|
|
12
|
+
*
|
|
13
|
+
* - [DateTimePicker](https://mui.com/x/react-date-pickers/date-time-picker/)
|
|
14
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
15
|
+
*
|
|
16
|
+
* API:
|
|
17
|
+
*
|
|
18
|
+
* - [StaticDateTimePicker API](https://mui.com/x/api/date-pickers/static-date-time-picker/)
|
|
19
|
+
*/
|
|
10
20
|
const StaticDateTimePicker = /*#__PURE__*/React.forwardRef(function StaticDateTimePicker(inProps, ref) {
|
|
11
21
|
var _defaultizedProps$dis, _defaultizedProps$amp, _defaultizedProps$yea, _defaultizedProps$slo, _defaultizedProps$slo2;
|
|
12
22
|
const defaultizedProps = useDateTimePickerDefaultizedProps(inProps, 'MuiStaticDateTimePicker');
|
|
@@ -3,5 +3,15 @@ import { StaticTimePickerProps } from './StaticTimePicker.types';
|
|
|
3
3
|
type StaticTimePickerComponent = (<TDate>(props: StaticTimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
*
|
|
9
|
+
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
|
10
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
11
|
+
*
|
|
12
|
+
* API:
|
|
13
|
+
*
|
|
14
|
+
* - [StaticTimePicker API](https://mui.com/x/api/date-pickers/static-time-picker/)
|
|
15
|
+
*/
|
|
6
16
|
declare const StaticTimePicker: StaticTimePickerComponent;
|
|
7
17
|
export { StaticTimePicker };
|
|
@@ -6,6 +6,16 @@ import { renderTimeViewClock } from '../timeViewRenderers';
|
|
|
6
6
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
7
7
|
import { useStaticPicker } from '../internals/hooks/useStaticPicker';
|
|
8
8
|
import { validateTime } from '../internals/utils/validation/validateTime';
|
|
9
|
+
/**
|
|
10
|
+
* Demos:
|
|
11
|
+
*
|
|
12
|
+
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
|
13
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
14
|
+
*
|
|
15
|
+
* API:
|
|
16
|
+
*
|
|
17
|
+
* - [StaticTimePicker API](https://mui.com/x/api/date-pickers/static-time-picker/)
|
|
18
|
+
*/
|
|
9
19
|
const StaticTimePicker = /*#__PURE__*/React.forwardRef(function StaticTimePicker(inProps, ref) {
|
|
10
20
|
var _defaultizedProps$dis, _defaultizedProps$amp, _defaultizedProps$slo;
|
|
11
21
|
const defaultizedProps = useTimePickerDefaultizedProps(inProps, 'MuiStaticTimePicker');
|
package/TimeField/TimeField.d.ts
CHANGED
|
@@ -3,5 +3,15 @@ import { TimeFieldProps } from './TimeField.types';
|
|
|
3
3
|
type TimeFieldComponent = (<TDate>(props: TimeFieldProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
*
|
|
9
|
+
* - [TimeField](http://mui.com/x/react-date-pickers/time-field/)
|
|
10
|
+
* - [Fields](https://mui.com/x/react-date-pickers/fields/)
|
|
11
|
+
*
|
|
12
|
+
* API:
|
|
13
|
+
*
|
|
14
|
+
* - [TimeField API](https://mui.com/x/api/date-pickers/time-field/)
|
|
15
|
+
*/
|
|
6
16
|
declare const TimeField: TimeFieldComponent;
|
|
7
17
|
export { TimeField };
|
package/TimeField/TimeField.js
CHANGED
|
@@ -12,6 +12,16 @@ import { refType } from '@mui/utils';
|
|
|
12
12
|
import { useTimeField } from './useTimeField';
|
|
13
13
|
import { useClearableField } from '../hooks';
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
/**
|
|
16
|
+
* Demos:
|
|
17
|
+
*
|
|
18
|
+
* - [TimeField](http://mui.com/x/react-date-pickers/time-field/)
|
|
19
|
+
* - [Fields](https://mui.com/x/react-date-pickers/fields/)
|
|
20
|
+
*
|
|
21
|
+
* API:
|
|
22
|
+
*
|
|
23
|
+
* - [TimeField API](https://mui.com/x/api/date-pickers/time-field/)
|
|
24
|
+
*/
|
|
15
25
|
const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, ref) {
|
|
16
26
|
var _ref, _slots$textField, _slotProps$textField;
|
|
17
27
|
const themeProps = useThemeProps({
|
|
@@ -3,5 +3,15 @@ import { TimePickerProps } from './TimePicker.types';
|
|
|
3
3
|
type TimePickerComponent = (<TDate>(props: TimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
4
4
|
propTypes?: any;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Demos:
|
|
8
|
+
*
|
|
9
|
+
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
|
10
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
11
|
+
*
|
|
12
|
+
* API:
|
|
13
|
+
*
|
|
14
|
+
* - [TimePicker API](https://mui.com/x/api/date-pickers/time-picker/)
|
|
15
|
+
*/
|
|
6
16
|
declare const TimePicker: TimePickerComponent;
|
|
7
17
|
export { TimePicker };
|
package/TimePicker/TimePicker.js
CHANGED
|
@@ -10,6 +10,16 @@ import { DesktopTimePicker } from '../DesktopTimePicker';
|
|
|
10
10
|
import { MobileTimePicker } from '../MobileTimePicker';
|
|
11
11
|
import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '../internals/utils/utils';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Demos:
|
|
15
|
+
*
|
|
16
|
+
* - [TimePicker](https://mui.com/x/react-date-pickers/time-picker/)
|
|
17
|
+
* - [Validation](https://mui.com/x/react-date-pickers/validation/)
|
|
18
|
+
*
|
|
19
|
+
* API:
|
|
20
|
+
*
|
|
21
|
+
* - [TimePicker API](https://mui.com/x/api/date-pickers/time-picker/)
|
|
22
|
+
*/
|
|
13
23
|
const TimePicker = /*#__PURE__*/React.forwardRef(function TimePicker(inProps, ref) {
|
|
14
24
|
const props = useThemeProps({
|
|
15
25
|
props: inProps,
|
|
@@ -14,6 +14,7 @@ import { applyDefaultDate } from '../internals/utils/date-utils';
|
|
|
14
14
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
15
15
|
import { SECTION_TYPE_GRANULARITY } from '../internals/utils/getDefaultReferenceDate';
|
|
16
16
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
17
|
+
import { DIALOG_WIDTH, MAX_CALENDAR_HEIGHT } from '../internals/constants/dimensions';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
19
20
|
const {
|
|
@@ -25,6 +26,7 @@ const useUtilityClasses = ownerState => {
|
|
|
25
26
|
return composeClasses(slots, getYearCalendarUtilityClass, classes);
|
|
26
27
|
};
|
|
27
28
|
function useYearCalendarDefaultizedProps(props, name) {
|
|
29
|
+
var _themeProps$yearsPerR;
|
|
28
30
|
const utils = useUtils();
|
|
29
31
|
const defaultDates = useDefaultDates();
|
|
30
32
|
const themeProps = useThemeProps({
|
|
@@ -35,6 +37,7 @@ function useYearCalendarDefaultizedProps(props, name) {
|
|
|
35
37
|
disablePast: false,
|
|
36
38
|
disableFuture: false
|
|
37
39
|
}, themeProps, {
|
|
40
|
+
yearsPerRow: (_themeProps$yearsPerR = themeProps.yearsPerRow) != null ? _themeProps$yearsPerR : 3,
|
|
38
41
|
minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
|
|
39
42
|
maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate)
|
|
40
43
|
});
|
|
@@ -50,8 +53,8 @@ const YearCalendarRoot = styled('div', {
|
|
|
50
53
|
overflowY: 'auto',
|
|
51
54
|
height: '100%',
|
|
52
55
|
padding: '0 4px',
|
|
53
|
-
width:
|
|
54
|
-
maxHeight:
|
|
56
|
+
width: DIALOG_WIDTH,
|
|
57
|
+
maxHeight: MAX_CALENDAR_HEIGHT,
|
|
55
58
|
// avoid padding increasing width over defined
|
|
56
59
|
boxSizing: 'border-box',
|
|
57
60
|
position: 'relative'
|
|
@@ -76,7 +79,7 @@ export const YearCalendar = /*#__PURE__*/React.forwardRef(function YearCalendar(
|
|
|
76
79
|
onYearFocus,
|
|
77
80
|
hasFocus,
|
|
78
81
|
onFocusedViewChange,
|
|
79
|
-
yearsPerRow
|
|
82
|
+
yearsPerRow,
|
|
80
83
|
timezone: timezoneProp,
|
|
81
84
|
gridLabelId
|
|
82
85
|
} = props,
|
|
@@ -9,5 +9,6 @@ export interface DateTimeViewRendererProps<TDate> extends Omit<DateCalendarProps
|
|
|
9
9
|
views: readonly DateOrTimeViewWithMeridiem[];
|
|
10
10
|
focusedView: DateOrTimeViewWithMeridiem | null;
|
|
11
11
|
timeViewsCount: number;
|
|
12
|
+
shouldRenderTimeInASingleColumn: boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare const renderDesktopDateTimeView: <TDate extends unknown>({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, minTime, maxDate, maxTime, shouldDisableDate, shouldDisableMonth, shouldDisableYear, shouldDisableTime, shouldDisableClock, reduceAnimations, minutesStep, ampm, onMonthChange, monthsPerRow, onYearChange, yearsPerRow, defaultCalendarMonth, components, componentsProps, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timeViewsCount, }: DateTimeViewRendererProps<TDate>) => React.JSX.Element;
|
|
14
|
+
export declare const renderDesktopDateTimeView: <TDate extends unknown>({ view, onViewChange, views, focusedView, onFocusedViewChange, value, defaultValue, referenceDate, onChange, className, classes, disableFuture, disablePast, minDate, minTime, maxDate, maxTime, shouldDisableDate, shouldDisableMonth, shouldDisableYear, shouldDisableTime, shouldDisableClock, reduceAnimations, minutesStep, ampm, onMonthChange, monthsPerRow, onYearChange, yearsPerRow, defaultCalendarMonth, components, componentsProps, slots, slotProps, loading, renderLoading, disableHighlightToday, readOnly, disabled, showDaysOutsideCurrentMonth, dayOfWeekFormatter, sx, autoFocus, fixedWeekNumber, displayWeekNumber, timezone, disableIgnoringDatePartForTimeValidation, timeSteps, skipDisabled, timeViewsCount, shouldRenderTimeInASingleColumn, }: DateTimeViewRendererProps<TDate>) => React.JSX.Element;
|
|
@@ -3,10 +3,13 @@ import * as React from 'react';
|
|
|
3
3
|
import Divider from '@mui/material/Divider';
|
|
4
4
|
import { resolveComponentProps } from '@mui/base/utils';
|
|
5
5
|
import { DateCalendar } from '../DateCalendar';
|
|
6
|
-
import {
|
|
6
|
+
import { multiSectionDigitalClockSectionClasses } from '../MultiSectionDigitalClock';
|
|
7
7
|
import { DateTimeViewWrapper } from '../internals/components/DateTimeViewWrapper';
|
|
8
8
|
import { isInternalTimeView } from '../internals/utils/time-utils';
|
|
9
9
|
import { isDatePickerView } from '../internals/utils/date-utils';
|
|
10
|
+
import { renderDigitalClockTimeView, renderMultiSectionDigitalClockTimeView } from '../timeViewRenderers';
|
|
11
|
+
import { digitalClockClasses } from '../DigitalClock';
|
|
12
|
+
import { VIEW_HEIGHT } from '../internals/constants/dimensions';
|
|
10
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
15
|
export const renderDesktopDateTimeView = ({
|
|
@@ -59,10 +62,43 @@ export const renderDesktopDateTimeView = ({
|
|
|
59
62
|
disableIgnoringDatePartForTimeValidation,
|
|
60
63
|
timeSteps,
|
|
61
64
|
skipDisabled,
|
|
62
|
-
timeViewsCount
|
|
65
|
+
timeViewsCount,
|
|
66
|
+
shouldRenderTimeInASingleColumn
|
|
63
67
|
}) => {
|
|
64
68
|
var _resolveComponentProp, _slotProps$actionBar;
|
|
65
69
|
const isActionBarVisible = !!((_resolveComponentProp = resolveComponentProps((_slotProps$actionBar = slotProps == null ? void 0 : slotProps.actionBar) != null ? _slotProps$actionBar : componentsProps == null ? void 0 : componentsProps.actionBar, {})) != null && (_resolveComponentProp = _resolveComponentProp.actions) != null && _resolveComponentProp.length);
|
|
70
|
+
const commonTimeProps = {
|
|
71
|
+
view: isInternalTimeView(view) ? view : 'hours',
|
|
72
|
+
onViewChange,
|
|
73
|
+
focusedView: focusedView && isInternalTimeView(focusedView) ? focusedView : null,
|
|
74
|
+
onFocusedViewChange,
|
|
75
|
+
views: views.filter(isInternalTimeView),
|
|
76
|
+
value,
|
|
77
|
+
defaultValue,
|
|
78
|
+
referenceDate,
|
|
79
|
+
onChange,
|
|
80
|
+
className,
|
|
81
|
+
classes,
|
|
82
|
+
disableFuture,
|
|
83
|
+
disablePast,
|
|
84
|
+
minTime,
|
|
85
|
+
maxTime,
|
|
86
|
+
shouldDisableTime,
|
|
87
|
+
shouldDisableClock,
|
|
88
|
+
minutesStep,
|
|
89
|
+
ampm,
|
|
90
|
+
components,
|
|
91
|
+
componentsProps,
|
|
92
|
+
slots,
|
|
93
|
+
slotProps,
|
|
94
|
+
readOnly,
|
|
95
|
+
disabled,
|
|
96
|
+
autoFocus,
|
|
97
|
+
disableIgnoringDatePartForTimeValidation,
|
|
98
|
+
timeSteps,
|
|
99
|
+
skipDisabled,
|
|
100
|
+
timezone
|
|
101
|
+
};
|
|
66
102
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
67
103
|
children: [/*#__PURE__*/_jsxs(DateTimeViewWrapper, {
|
|
68
104
|
children: [/*#__PURE__*/_jsx(DateCalendar, {
|
|
@@ -109,45 +145,28 @@ export const renderDesktopDateTimeView = ({
|
|
|
109
145
|
}), timeViewsCount > 0 && /*#__PURE__*/_jsxs(React.Fragment, {
|
|
110
146
|
children: [/*#__PURE__*/_jsx(Divider, {
|
|
111
147
|
orientation: "vertical"
|
|
112
|
-
}),
|
|
148
|
+
}), shouldRenderTimeInASingleColumn ? renderDigitalClockTimeView(_extends({}, commonTimeProps, {
|
|
149
|
+
view: 'hours',
|
|
150
|
+
views: ['hours'],
|
|
151
|
+
focusedView: focusedView && isInternalTimeView(focusedView) ? 'hours' : null,
|
|
152
|
+
sx: _extends({
|
|
153
|
+
width: 'auto',
|
|
154
|
+
[`&.${digitalClockClasses.root}`]: {
|
|
155
|
+
maxHeight: VIEW_HEIGHT
|
|
156
|
+
}
|
|
157
|
+
}, Array.isArray(sx) ? sx : [sx])
|
|
158
|
+
})) : renderMultiSectionDigitalClockTimeView(_extends({}, commonTimeProps, {
|
|
113
159
|
view: isInternalTimeView(view) ? view : 'hours',
|
|
114
|
-
onViewChange: onViewChange,
|
|
115
|
-
focusedView: focusedView && isInternalTimeView(focusedView) ? focusedView : null,
|
|
116
|
-
onFocusedViewChange: onFocusedViewChange,
|
|
117
160
|
views: views.filter(isInternalTimeView),
|
|
118
|
-
|
|
119
|
-
defaultValue: defaultValue,
|
|
120
|
-
referenceDate: referenceDate,
|
|
121
|
-
onChange: onChange,
|
|
122
|
-
className: className,
|
|
123
|
-
classes: classes,
|
|
124
|
-
disableFuture: disableFuture,
|
|
125
|
-
disablePast: disablePast,
|
|
126
|
-
minTime: minTime,
|
|
127
|
-
maxTime: maxTime,
|
|
128
|
-
shouldDisableTime: shouldDisableTime,
|
|
129
|
-
shouldDisableClock: shouldDisableClock,
|
|
130
|
-
minutesStep: minutesStep,
|
|
131
|
-
ampm: ampm,
|
|
132
|
-
components: components,
|
|
133
|
-
componentsProps: componentsProps,
|
|
134
|
-
slots: slots,
|
|
135
|
-
slotProps: slotProps,
|
|
136
|
-
readOnly: readOnly,
|
|
137
|
-
disabled: disabled,
|
|
161
|
+
focusedView: focusedView && isInternalTimeView(focusedView) ? focusedView : null,
|
|
138
162
|
sx: _extends({
|
|
139
163
|
borderBottom: 0,
|
|
140
164
|
width: 'auto',
|
|
141
165
|
[`.${multiSectionDigitalClockSectionClasses.root}`]: {
|
|
142
166
|
maxHeight: '100%'
|
|
143
167
|
}
|
|
144
|
-
}, Array.isArray(sx) ? sx : [sx])
|
|
145
|
-
|
|
146
|
-
disableIgnoringDatePartForTimeValidation: disableIgnoringDatePartForTimeValidation,
|
|
147
|
-
timeSteps: timeSteps,
|
|
148
|
-
skipDisabled: skipDisabled,
|
|
149
|
-
timezone: timezone
|
|
150
|
-
})]
|
|
168
|
+
}, Array.isArray(sx) ? sx : [sx])
|
|
169
|
+
}))]
|
|
151
170
|
})]
|
|
152
171
|
}), isActionBarVisible && /*#__PURE__*/_jsx(Divider, {})]
|
|
153
172
|
});
|
package/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import Stack from '@mui/material/Stack';
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export function FakeTextField(props) {
|
|
6
|
+
const {
|
|
7
|
+
sections
|
|
8
|
+
} = props;
|
|
9
|
+
return /*#__PURE__*/_jsx(Stack, {
|
|
10
|
+
direction: "row",
|
|
11
|
+
spacing: 1,
|
|
12
|
+
children: sections.map(section => /*#__PURE__*/_jsxs(React.Fragment, {
|
|
13
|
+
children: [section.startSeparator, /*#__PURE__*/_jsx("input", {
|
|
14
|
+
value: section.value,
|
|
15
|
+
onChange: () => {}
|
|
16
|
+
}), section.endSeparator]
|
|
17
|
+
}))
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FakeTextField } from './FakeTextField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FakeTextField } from './FakeTextField';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const DAY_SIZE = 36;
|
|
2
2
|
export declare const DAY_MARGIN = 2;
|
|
3
3
|
export declare const DIALOG_WIDTH = 320;
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const MAX_CALENDAR_HEIGHT = 280;
|
|
5
|
+
export declare const VIEW_HEIGHT = 334;
|
|
5
6
|
export declare const DIGITAL_CLOCK_VIEW_HEIGHT = 232;
|
|
6
7
|
export declare const MULTI_SECTION_CLOCK_SECTION_WIDTH = 48;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const DAY_SIZE = 36;
|
|
2
2
|
export const DAY_MARGIN = 2;
|
|
3
3
|
export const DIALOG_WIDTH = 320;
|
|
4
|
-
export const
|
|
4
|
+
export const MAX_CALENDAR_HEIGHT = 280;
|
|
5
|
+
export const VIEW_HEIGHT = 334;
|
|
5
6
|
export const DIGITAL_CLOCK_VIEW_HEIGHT = 232;
|
|
6
7
|
export const MULTI_SECTION_CLOCK_SECTION_WIDTH = 48;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["onClick", "onKeyDown", "onFocus", "onBlur", "onMouseUp", "onPaste", "error", "clearable", "onClear"];
|
|
3
|
+
const _excluded = ["onClick", "onKeyDown", "onFocus", "onBlur", "onMouseUp", "onPaste", "error", "clearable", "onClear", "disabled"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
6
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
@@ -44,7 +44,8 @@ export const useField = params => {
|
|
|
44
44
|
onPaste,
|
|
45
45
|
error,
|
|
46
46
|
clearable,
|
|
47
|
-
onClear
|
|
47
|
+
onClear,
|
|
48
|
+
disabled
|
|
48
49
|
},
|
|
49
50
|
fieldValueManager,
|
|
50
51
|
valueManager,
|
|
@@ -407,7 +408,8 @@ export const useField = params => {
|
|
|
407
408
|
});
|
|
408
409
|
return _extends({
|
|
409
410
|
placeholder,
|
|
410
|
-
autoComplete: 'off'
|
|
411
|
+
autoComplete: 'off',
|
|
412
|
+
disabled: Boolean(disabled)
|
|
411
413
|
}, otherForwardedProps, {
|
|
412
414
|
value: shouldShowPlaceholder ? '' : valueStr,
|
|
413
415
|
inputMode,
|
|
@@ -422,6 +424,6 @@ export const useField = params => {
|
|
|
422
424
|
onClear: handleClearValue,
|
|
423
425
|
error: inputError,
|
|
424
426
|
ref: handleRef,
|
|
425
|
-
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly)
|
|
427
|
+
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly && !disabled)
|
|
426
428
|
});
|
|
427
429
|
};
|
|
@@ -105,6 +105,11 @@ export interface UseFieldInternalProps<TValue, TDate, TSection extends FieldSect
|
|
|
105
105
|
* @default false
|
|
106
106
|
*/
|
|
107
107
|
clearable?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* If `true`, the component is disabled.
|
|
110
|
+
* @default false
|
|
111
|
+
*/
|
|
112
|
+
disabled?: boolean;
|
|
108
113
|
}
|
|
109
114
|
export interface FieldRef<TSection extends FieldSection> {
|
|
110
115
|
/**
|
|
@@ -134,6 +139,7 @@ export interface UseFieldForwardedProps {
|
|
|
134
139
|
error?: boolean;
|
|
135
140
|
onClear?: React.MouseEventHandler;
|
|
136
141
|
clearable?: boolean;
|
|
142
|
+
disabled?: boolean;
|
|
137
143
|
}
|
|
138
144
|
export type UseFieldResponse<TForwardedProps extends UseFieldForwardedProps> = Omit<TForwardedProps, keyof UseFieldForwardedProps> & Required<UseFieldForwardedProps> & Pick<React.HTMLAttributes<HTMLInputElement>, 'autoCorrect' | 'inputMode' | 'placeholder'> & {
|
|
139
145
|
ref: React.Ref<HTMLInputElement>;
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { DateOrTimeView, MuiPickersAdapter } from '../../models';
|
|
2
|
+
import { DateOrTimeViewWithMeridiem } from '../models';
|
|
3
|
+
import { DesktopOnlyTimePickerProps } from '../models/props/clock';
|
|
4
|
+
import { DefaultizedProps } from '../models/helpers';
|
|
2
5
|
export declare const resolveDateTimeFormat: (utils: MuiPickersAdapter<any>, { views, format, ...other }: {
|
|
3
6
|
format?: string | undefined;
|
|
4
7
|
views: readonly DateOrTimeView[];
|
|
5
8
|
ampm: boolean;
|
|
6
9
|
}) => string;
|
|
10
|
+
interface DefaultizedTimeViewsProps<TDate, TView = DateOrTimeView> extends DefaultizedProps<DesktopOnlyTimePickerProps<TDate>, 'ampm'> {
|
|
11
|
+
views: readonly TView[];
|
|
12
|
+
}
|
|
13
|
+
interface DefaultizedTimeViewsResponse<TDate, TView = DateOrTimeViewWithMeridiem> extends Required<Pick<DefaultizedTimeViewsProps<TDate, TView>, 'thresholdToRenderTimeInASingleColumn' | 'timeSteps' | 'views'>> {
|
|
14
|
+
shouldRenderTimeInASingleColumn: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveTimeViewsResponse<TDate, InTView extends DateOrTimeView = DateOrTimeView, OutTView extends DateOrTimeViewWithMeridiem = DateOrTimeViewWithMeridiem>({ thresholdToRenderTimeInASingleColumn: inThreshold, ampm, timeSteps: inTimeSteps, views, }: DefaultizedTimeViewsProps<TDate, InTView>): DefaultizedTimeViewsResponse<TDate, OutTView>;
|
|
17
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["views", "format"];
|
|
4
|
-
import { resolveTimeFormat, isTimeView } from './time-utils';
|
|
4
|
+
import { resolveTimeFormat, isTimeView, isInternalTimeView } from './time-utils';
|
|
5
5
|
import { resolveDateFormat } from './date-utils';
|
|
6
6
|
export const resolveDateTimeFormat = (utils, _ref) => {
|
|
7
7
|
let {
|
|
@@ -38,4 +38,34 @@ export const resolveDateTimeFormat = (utils, _ref) => {
|
|
|
38
38
|
views: dateViews
|
|
39
39
|
}, other), false);
|
|
40
40
|
return `${dateFormat} ${timeFormat}`;
|
|
41
|
-
};
|
|
41
|
+
};
|
|
42
|
+
const resolveViews = (ampm, views, shouldUseSingleColumn) => {
|
|
43
|
+
if (shouldUseSingleColumn) {
|
|
44
|
+
return views.filter(view => !isInternalTimeView(view) || view === 'hours');
|
|
45
|
+
}
|
|
46
|
+
return ampm ? [...views, 'meridiem'] : views;
|
|
47
|
+
};
|
|
48
|
+
const resolveShouldRenderTimeInASingleColumn = (timeSteps, threshold) => {
|
|
49
|
+
var _timeSteps$hours, _timeSteps$minutes;
|
|
50
|
+
return 24 * 60 / (((_timeSteps$hours = timeSteps.hours) != null ? _timeSteps$hours : 1) * ((_timeSteps$minutes = timeSteps.minutes) != null ? _timeSteps$minutes : 5)) <= threshold;
|
|
51
|
+
};
|
|
52
|
+
export function resolveTimeViewsResponse({
|
|
53
|
+
thresholdToRenderTimeInASingleColumn: inThreshold,
|
|
54
|
+
ampm,
|
|
55
|
+
timeSteps: inTimeSteps,
|
|
56
|
+
views
|
|
57
|
+
}) {
|
|
58
|
+
const thresholdToRenderTimeInASingleColumn = inThreshold != null ? inThreshold : 24;
|
|
59
|
+
const timeSteps = _extends({
|
|
60
|
+
hours: 1,
|
|
61
|
+
minutes: 5,
|
|
62
|
+
seconds: 5
|
|
63
|
+
}, inTimeSteps);
|
|
64
|
+
const shouldRenderTimeInASingleColumn = resolveShouldRenderTimeInASingleColumn(timeSteps, thresholdToRenderTimeInASingleColumn);
|
|
65
|
+
return {
|
|
66
|
+
thresholdToRenderTimeInASingleColumn,
|
|
67
|
+
timeSteps,
|
|
68
|
+
shouldRenderTimeInASingleColumn,
|
|
69
|
+
views: resolveViews(ampm, views, shouldRenderTimeInASingleColumn)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
@@ -309,14 +309,16 @@ export var AdapterDayjs = /*#__PURE__*/_createClass(function AdapterDayjs() {
|
|
|
309
309
|
return parsedValue.locale(_this.locale);
|
|
310
310
|
};
|
|
311
311
|
this.getTimezone = function (value) {
|
|
312
|
-
if (_this.hasUTCPlugin() && value.isUTC()) {
|
|
313
|
-
return 'UTC';
|
|
314
|
-
}
|
|
315
312
|
if (_this.hasTimezonePlugin()) {
|
|
316
313
|
var _value$$x;
|
|
317
314
|
// @ts-ignore
|
|
318
315
|
var zone = (_value$$x = value.$x) == null ? void 0 : _value$$x.$timezone;
|
|
319
|
-
|
|
316
|
+
if (zone) {
|
|
317
|
+
return zone;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
if (_this.hasUTCPlugin() && value.isUTC()) {
|
|
321
|
+
return 'UTC';
|
|
320
322
|
}
|
|
321
323
|
return 'system';
|
|
322
324
|
};
|
|
@@ -247,16 +247,13 @@ export var AdapterMoment = /*#__PURE__*/_createClass(function AdapterMoment() {
|
|
|
247
247
|
};
|
|
248
248
|
this.getTimezone = function (value) {
|
|
249
249
|
var _value$_z, _ref2, _this$moment$defaultZ;
|
|
250
|
-
if (value.isUTC()) {
|
|
251
|
-
return 'UTC';
|
|
252
|
-
}
|
|
253
|
-
|
|
254
250
|
// @ts-ignore
|
|
255
251
|
// eslint-disable-next-line no-underscore-dangle
|
|
256
252
|
var zone = (_value$_z = value._z) == null ? void 0 : _value$_z.name;
|
|
253
|
+
var defaultZone = value.isUTC() ? 'UTC' : 'system';
|
|
257
254
|
|
|
258
255
|
// @ts-ignore
|
|
259
|
-
return (_ref2 = zone != null ? zone : (_this$moment$defaultZ = _this.moment.defaultZone) == null ? void 0 : _this$moment$defaultZ.name) != null ? _ref2 :
|
|
256
|
+
return (_ref2 = zone != null ? zone : (_this$moment$defaultZ = _this.moment.defaultZone) == null ? void 0 : _this$moment$defaultZ.name) != null ? _ref2 : defaultZone;
|
|
260
257
|
};
|
|
261
258
|
this.setTimezone = function (value, timezone) {
|
|
262
259
|
var _this$moment$defaultZ2, _this$moment$defaultZ3;
|
|
@@ -21,6 +21,7 @@ import { useDefaultReduceAnimations } from '../internals/hooks/useDefaultReduceA
|
|
|
21
21
|
import { getDateCalendarUtilityClass } from './dateCalendarClasses';
|
|
22
22
|
import { useControlledValueWithTimezone } from '../internals/hooks/useValueWithTimezone';
|
|
23
23
|
import { singleItemValueManager } from '../internals/utils/valueManagers';
|
|
24
|
+
import { VIEW_HEIGHT } from '../internals/constants/dimensions';
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
26
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
27
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -64,7 +65,8 @@ var DateCalendarRoot = styled(PickerViewRoot, {
|
|
|
64
65
|
}
|
|
65
66
|
})({
|
|
66
67
|
display: 'flex',
|
|
67
|
-
flexDirection: 'column'
|
|
68
|
+
flexDirection: 'column',
|
|
69
|
+
height: VIEW_HEIGHT
|
|
68
70
|
});
|
|
69
71
|
var DateCalendarViewTransitionContainer = styled(PickersFadeTransitionGroup, {
|
|
70
72
|
name: 'MuiDateCalendar',
|