@mui/x-date-pickers 7.0.0-alpha.3 → 7.0.0-alpha.5
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 +27 -27
- package/AdapterLuxon/AdapterLuxon.js +0 -1
- package/CHANGELOG.md +245 -0
- package/DateCalendar/DateCalendar.types.d.ts +6 -6
- package/DateCalendar/DayCalendar.d.ts +4 -4
- package/DateCalendar/index.d.ts +1 -1
- package/DateCalendar/useCalendarState.js +0 -1
- package/DateField/DateField.js +17 -50
- package/DateField/DateField.types.d.ts +5 -9
- package/DateField/useDateField.d.ts +2 -2
- package/DateField/useDateField.js +1 -5
- package/DatePicker/DatePicker.js +5 -1
- package/DatePicker/DatePicker.types.d.ts +6 -6
- package/DatePicker/index.d.ts +1 -1
- package/DatePicker/shared.d.ts +6 -6
- package/DateTimeField/DateTimeField.js +17 -50
- package/DateTimeField/DateTimeField.types.d.ts +5 -9
- package/DateTimeField/useDateTimeField.d.ts +2 -2
- package/DateTimeField/useDateTimeField.js +1 -5
- package/DateTimePicker/DateTimePicker.js +5 -1
- package/DateTimePicker/DateTimePicker.types.d.ts +6 -6
- package/DateTimePicker/index.d.ts +1 -1
- package/DateTimePicker/shared.d.ts +6 -6
- package/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/DesktopDatePicker/DesktopDatePicker.types.d.ts +6 -6
- package/DesktopDatePicker/index.d.ts +1 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/DesktopDateTimePicker/DesktopDateTimePicker.types.d.ts +8 -8
- package/DesktopDateTimePicker/index.d.ts +1 -1
- package/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/DesktopTimePicker/DesktopTimePicker.types.d.ts +8 -8
- package/DesktopTimePicker/index.d.ts +1 -1
- package/DigitalClock/DigitalClock.types.d.ts +4 -4
- package/DigitalClock/index.d.ts +1 -1
- package/MobileDatePicker/MobileDatePicker.js +7 -2
- package/MobileDatePicker/MobileDatePicker.types.d.ts +6 -6
- package/MobileDatePicker/index.d.ts +1 -1
- package/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/MobileDateTimePicker/MobileDateTimePicker.types.d.ts +6 -6
- package/MobileDateTimePicker/index.d.ts +1 -1
- package/MobileTimePicker/MobileTimePicker.js +5 -1
- package/MobileTimePicker/MobileTimePicker.types.d.ts +6 -6
- package/MobileTimePicker/index.d.ts +1 -1
- package/MonthCalendar/MonthCalendar.js +0 -1
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +3 -3
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/MultiSectionDigitalClock/index.d.ts +1 -1
- package/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +8 -8
- package/PickersCalendarHeader/index.d.ts +1 -1
- package/PickersLayout/PickersLayout.types.d.ts +6 -6
- package/PickersLayout/index.d.ts +1 -1
- package/StaticDatePicker/StaticDatePicker.js +1 -1
- package/StaticDatePicker/StaticDatePicker.types.d.ts +7 -7
- package/StaticDatePicker/index.d.ts +1 -1
- package/StaticDateTimePicker/StaticDateTimePicker.types.d.ts +7 -7
- package/StaticDateTimePicker/index.d.ts +1 -1
- package/StaticTimePicker/StaticTimePicker.types.d.ts +7 -7
- package/StaticTimePicker/index.d.ts +1 -1
- package/TimeClock/Clock.js +0 -1
- package/TimeClock/ClockPointer.js +0 -1
- package/TimeClock/TimeClock.types.d.ts +5 -5
- package/TimeClock/index.d.ts +1 -1
- package/TimeField/TimeField.js +17 -50
- package/TimeField/TimeField.types.d.ts +5 -9
- package/TimeField/useTimeField.d.ts +2 -2
- package/TimeField/useTimeField.js +1 -5
- package/TimePicker/TimePicker.js +5 -1
- package/TimePicker/TimePicker.types.d.ts +6 -6
- package/TimePicker/index.d.ts +1 -1
- package/TimePicker/shared.d.ts +5 -5
- package/YearCalendar/YearCalendar.js +0 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/useClearableField.d.ts +32 -20
- package/hooks/useClearableField.js +32 -33
- package/index.js +1 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +9 -9
- package/internals/components/PickersArrowSwitcher/index.d.ts +3 -1
- package/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/internals/components/PickersModalDialog.d.ts +4 -4
- package/internals/components/PickersPopper.d.ts +4 -4
- package/internals/components/PickersTextField/Outline.d.ts +7 -1
- package/internals/components/PickersTextField/Outline.js +2 -4
- package/internals/components/PickersTextField/PickersInput.d.ts +1 -2
- package/internals/components/PickersTextField/PickersInput.js +117 -112
- package/internals/components/PickersTextField/PickersInput.types.d.ts +35 -20
- package/internals/components/PickersTextField/PickersTextField.js +57 -48
- package/internals/components/PickersTextField/PickersTextField.types.d.ts +19 -16
- package/internals/components/PickersTextField/pickersTextFieldClasses.d.ts +11 -7
- package/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/internals/constants/dimensions.d.ts +1 -1
- package/internals/constants/dimensions.js +1 -1
- package/internals/demo/DemoContainer.d.ts +4 -0
- package/internals/demo/DemoContainer.js +47 -19
- package/internals/hooks/useClockReferenceDate.js +0 -1
- package/internals/hooks/useDesktopPicker/index.d.ts +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +8 -8
- package/internals/hooks/useField/index.d.ts +1 -1
- package/internals/hooks/useField/useField.js +3 -3
- package/internals/hooks/useField/useField.types.d.ts +4 -24
- package/internals/hooks/useField/useField.utils.js +24 -6
- package/internals/hooks/useField/useFieldState.js +7 -3
- package/internals/hooks/useMobilePicker/index.d.ts +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +7 -7
- package/internals/hooks/useStaticPicker/index.d.ts +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -5
- package/internals/hooks/useViews.js +0 -1
- package/internals/index.d.ts +7 -6
- package/internals/index.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.d.ts +3 -0
- package/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/legacy/AdapterLuxon/AdapterLuxon.js +0 -1
- package/legacy/DateCalendar/useCalendarState.js +0 -1
- package/legacy/DateField/DateField.js +19 -47
- package/legacy/DateField/useDateField.js +1 -4
- package/legacy/DatePicker/DatePicker.js +5 -1
- package/legacy/DateTimeField/DateTimeField.js +19 -47
- package/legacy/DateTimeField/useDateTimeField.js +1 -4
- package/legacy/DateTimePicker/DateTimePicker.js +5 -1
- package/legacy/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/legacy/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/legacy/MobileDatePicker/MobileDatePicker.js +7 -2
- package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/legacy/MobileTimePicker/MobileTimePicker.js +5 -1
- package/legacy/MonthCalendar/MonthCalendar.js +0 -1
- package/legacy/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/legacy/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/legacy/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/legacy/StaticDatePicker/StaticDatePicker.js +1 -1
- package/legacy/TimeClock/Clock.js +0 -1
- package/legacy/TimeClock/ClockPointer.js +0 -1
- package/legacy/TimeField/TimeField.js +19 -47
- package/legacy/TimeField/useTimeField.js +1 -4
- package/legacy/TimePicker/TimePicker.js +5 -1
- package/legacy/YearCalendar/YearCalendar.js +0 -1
- package/legacy/hooks/useClearableField.js +30 -32
- package/legacy/index.js +1 -1
- package/legacy/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/legacy/internals/components/PickersTextField/Outline.js +1 -4
- package/legacy/internals/components/PickersTextField/PickersInput.js +119 -115
- package/legacy/internals/components/PickersTextField/PickersTextField.js +51 -51
- package/legacy/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/legacy/internals/constants/dimensions.js +1 -1
- package/legacy/internals/demo/DemoContainer.js +45 -19
- package/legacy/internals/hooks/useClockReferenceDate.js +0 -1
- package/legacy/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +4 -4
- package/legacy/internals/hooks/useField/useField.utils.js +26 -6
- package/legacy/internals/hooks/useField/useFieldState.js +7 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/legacy/internals/hooks/useViews.js +0 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +24 -0
- package/legacy/locales/plPL.js +0 -1
- package/legacy/locales/svSE.js +0 -1
- package/legacy/locales/urPK.js +0 -1
- package/locales/plPL.js +0 -1
- package/locales/svSE.js +0 -1
- package/locales/urPK.js +0 -1
- package/models/fields.d.ts +2 -1
- package/modern/AdapterLuxon/AdapterLuxon.js +0 -1
- package/modern/DateCalendar/useCalendarState.js +0 -1
- package/modern/DateField/DateField.js +17 -50
- package/modern/DateField/useDateField.js +1 -5
- package/modern/DatePicker/DatePicker.js +5 -1
- package/modern/DateTimeField/DateTimeField.js +17 -50
- package/modern/DateTimeField/useDateTimeField.js +1 -5
- package/modern/DateTimePicker/DateTimePicker.js +5 -1
- package/modern/DesktopDatePicker/DesktopDatePicker.js +7 -2
- package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/modern/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/modern/MobileDatePicker/MobileDatePicker.js +7 -2
- package/modern/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/modern/MobileTimePicker/MobileTimePicker.js +5 -1
- package/modern/MonthCalendar/MonthCalendar.js +0 -1
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/modern/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/modern/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/TimeClock/Clock.js +0 -1
- package/modern/TimeClock/ClockPointer.js +0 -1
- package/modern/TimeField/TimeField.js +17 -50
- package/modern/TimeField/useTimeField.js +1 -5
- package/modern/TimePicker/TimePicker.js +5 -1
- package/modern/YearCalendar/YearCalendar.js +0 -1
- package/modern/hooks/useClearableField.js +32 -33
- package/modern/index.js +1 -1
- package/modern/internals/components/PickersArrowSwitcher/index.js +2 -1
- package/modern/internals/components/PickersTextField/Outline.js +2 -4
- package/modern/internals/components/PickersTextField/PickersInput.js +116 -112
- package/modern/internals/components/PickersTextField/PickersTextField.js +57 -47
- package/modern/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/modern/internals/constants/dimensions.js +1 -1
- package/modern/internals/demo/DemoContainer.js +47 -19
- package/modern/internals/hooks/useClockReferenceDate.js +0 -1
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +3 -3
- package/modern/internals/hooks/useField/useField.utils.js +24 -6
- package/modern/internals/hooks/useField/useFieldState.js +7 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/modern/internals/hooks/useViews.js +0 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- package/modern/locales/plPL.js +0 -1
- package/modern/locales/svSE.js +0 -1
- package/modern/locales/urPK.js +0 -1
- package/node/AdapterLuxon/AdapterLuxon.js +0 -1
- package/node/DateCalendar/useCalendarState.js +0 -1
- package/node/DateField/DateField.js +18 -51
- package/node/DateField/useDateField.js +1 -5
- package/node/DatePicker/DatePicker.js +5 -1
- package/node/DateTimeField/DateTimeField.js +18 -51
- package/node/DateTimeField/useDateTimeField.js +1 -5
- package/node/DateTimePicker/DateTimePicker.js +5 -1
- package/node/DesktopDatePicker/DesktopDatePicker.js +10 -5
- package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +5 -1
- package/node/DesktopTimePicker/DesktopTimePicker.js +5 -1
- package/node/MobileDatePicker/MobileDatePicker.js +10 -5
- package/node/MobileDateTimePicker/MobileDateTimePicker.js +5 -1
- package/node/MobileTimePicker/MobileTimePicker.js +5 -1
- package/node/MonthCalendar/MonthCalendar.js +0 -1
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClockSection.js +8 -2
- package/node/MultiSectionDigitalClock/multiSectionDigitalClockSectionClasses.js +2 -2
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +4 -4
- package/node/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/TimeClock/Clock.js +0 -1
- package/node/TimeClock/ClockPointer.js +0 -1
- package/node/TimeField/TimeField.js +18 -51
- package/node/TimeField/useTimeField.js +1 -5
- package/node/TimePicker/TimePicker.js +5 -1
- package/node/YearCalendar/YearCalendar.js +0 -1
- package/node/hooks/useClearableField.js +33 -34
- package/node/index.js +1 -1
- package/node/internals/components/PickersArrowSwitcher/index.js +14 -1
- package/node/internals/components/PickersTextField/Outline.js +2 -4
- package/node/internals/components/PickersTextField/PickersInput.js +119 -115
- package/node/internals/components/PickersTextField/PickersTextField.js +58 -48
- package/node/internals/components/PickersTextField/pickersTextFieldClasses.js +1 -1
- package/node/internals/constants/dimensions.js +1 -1
- package/node/internals/demo/DemoContainer.js +47 -19
- package/node/internals/hooks/useClockReferenceDate.js +0 -1
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +3 -3
- package/node/internals/hooks/useField/useField.utils.js +24 -6
- package/node/internals/hooks/useField/useFieldState.js +7 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/node/internals/hooks/useViews.js +0 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +34 -0
- package/node/locales/plPL.js +0 -1
- package/node/locales/svSE.js +0 -1
- package/node/locales/urPK.js +0 -1
- package/package.json +6 -6
- package/themeAugmentation/overrides.d.ts +5 -7
- package/themeAugmentation/props.d.ts +6 -8
|
@@ -9,12 +9,16 @@ interface DemoItemProps {
|
|
|
9
9
|
label?: React.ReactNode;
|
|
10
10
|
component?: string;
|
|
11
11
|
children: React.ReactNode;
|
|
12
|
+
sx?: SxProps<Theme>;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* WARNING: This is an internal component used in documentation to achieve a desired layout.
|
|
15
16
|
* Please do not use it in your application.
|
|
16
17
|
*/
|
|
17
18
|
export declare function DemoItem(props: DemoItemProps): React.JSX.Element;
|
|
19
|
+
export declare namespace DemoItem {
|
|
20
|
+
var displayName: string;
|
|
21
|
+
}
|
|
18
22
|
/**
|
|
19
23
|
* WARNING: This is an internal component used in documentation to achieve a desired layout.
|
|
20
24
|
* Please do not use it in your application.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import Stack from '@mui/material/Stack';
|
|
3
|
+
import Stack, { stackClasses } from '@mui/material/Stack';
|
|
4
4
|
import Typography from '@mui/material/Typography';
|
|
5
5
|
import { textFieldClasses } from '@mui/material/TextField';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -40,20 +40,20 @@ export function DemoItem(props) {
|
|
|
40
40
|
const {
|
|
41
41
|
label,
|
|
42
42
|
children,
|
|
43
|
-
component
|
|
43
|
+
component,
|
|
44
|
+
sx: sxProp
|
|
44
45
|
} = props;
|
|
45
46
|
let spacing;
|
|
46
|
-
let sx;
|
|
47
|
+
let sx = sxProp;
|
|
47
48
|
if (component && getChildTypeFromChildName(component) === 'multi-input-range-field') {
|
|
48
49
|
spacing = 1.5;
|
|
49
|
-
sx = {
|
|
50
|
+
sx = _extends({}, sx, {
|
|
50
51
|
[`& .${textFieldClasses.root}`]: {
|
|
51
52
|
flexGrow: 1
|
|
52
53
|
}
|
|
53
|
-
};
|
|
54
|
+
});
|
|
54
55
|
} else {
|
|
55
56
|
spacing = 1;
|
|
56
|
-
sx = undefined;
|
|
57
57
|
}
|
|
58
58
|
return /*#__PURE__*/_jsxs(Stack, {
|
|
59
59
|
direction: "column",
|
|
@@ -66,7 +66,14 @@ export function DemoItem(props) {
|
|
|
66
66
|
}), children]
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
DemoItem.displayName = 'DemoItem';
|
|
70
|
+
const isDemoItem = child => {
|
|
71
|
+
if ( /*#__PURE__*/React.isValidElement(child) && typeof child.type !== 'string') {
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
return child.type.displayName === 'DemoItem';
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
};
|
|
70
77
|
/**
|
|
71
78
|
* WARNING: This is an internal component used in documentation to achieve a desired layout.
|
|
72
79
|
* Please do not use it in your application.
|
|
@@ -91,7 +98,9 @@ export function DemoContainer(props) {
|
|
|
91
98
|
};
|
|
92
99
|
let direction;
|
|
93
100
|
let spacing;
|
|
94
|
-
let
|
|
101
|
+
let extraSx = {};
|
|
102
|
+
let demoItemSx = {};
|
|
103
|
+
const sx = _extends({
|
|
95
104
|
overflow: 'auto',
|
|
96
105
|
// Add padding as overflow can hide the outline text field label.
|
|
97
106
|
pt: 1
|
|
@@ -113,38 +122,57 @@ export function DemoContainer(props) {
|
|
|
113
122
|
// noop
|
|
114
123
|
} else if (childrenTypes.has('single-input-range-field')) {
|
|
115
124
|
if (!childrenSupportedSections.has('date-time')) {
|
|
116
|
-
|
|
125
|
+
extraSx = {
|
|
117
126
|
[`& > .${textFieldClasses.root}`]: {
|
|
118
127
|
minWidth: 300
|
|
119
128
|
}
|
|
120
|
-
}
|
|
129
|
+
};
|
|
121
130
|
} else {
|
|
122
|
-
|
|
131
|
+
extraSx = {
|
|
123
132
|
[`& > .${textFieldClasses.root}`]: {
|
|
124
133
|
minWidth: {
|
|
125
134
|
xs: 300,
|
|
126
|
-
|
|
135
|
+
// If demo also contains MultiInputDateTimeRangeField, increase width to avoid cutting off the value.
|
|
136
|
+
md: childrenTypes.has('multi-input-range-field') ? 460 : 400
|
|
127
137
|
}
|
|
128
138
|
}
|
|
129
|
-
}
|
|
139
|
+
};
|
|
130
140
|
}
|
|
131
141
|
} else if (childrenSupportedSections.has('date-time')) {
|
|
132
|
-
|
|
142
|
+
extraSx = {
|
|
133
143
|
[`& > .${textFieldClasses.root}`]: {
|
|
134
144
|
minWidth: 270
|
|
135
145
|
}
|
|
136
|
-
}
|
|
146
|
+
};
|
|
147
|
+
if (childrenTypes.has('multi-input-range-field')) {
|
|
148
|
+
// increase width for the multi input date time range fields
|
|
149
|
+
demoItemSx = {
|
|
150
|
+
[`& > .${stackClasses.root} > .${textFieldClasses.root}`]: {
|
|
151
|
+
minWidth: 210
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
137
155
|
} else {
|
|
138
|
-
|
|
156
|
+
extraSx = {
|
|
139
157
|
[`& > .${textFieldClasses.root}`]: {
|
|
140
158
|
minWidth: 200
|
|
141
159
|
}
|
|
142
|
-
}
|
|
160
|
+
};
|
|
143
161
|
}
|
|
162
|
+
const finalSx = _extends({}, sx, extraSx);
|
|
144
163
|
return /*#__PURE__*/_jsx(Stack, {
|
|
145
164
|
direction: direction,
|
|
146
165
|
spacing: spacing,
|
|
147
|
-
sx:
|
|
148
|
-
children: children
|
|
166
|
+
sx: finalSx,
|
|
167
|
+
children: React.Children.map(children, child => {
|
|
168
|
+
if ( /*#__PURE__*/React.isValidElement(child) && isDemoItem(child)) {
|
|
169
|
+
// Inject sx styles to the `DemoItem` if it is a direct child of `DemoContainer`.
|
|
170
|
+
// @ts-ignore
|
|
171
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
|
172
|
+
sx: _extends({}, extraSx, demoItemSx)
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return child;
|
|
176
|
+
})
|
|
149
177
|
});
|
|
150
178
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useDesktopPicker } from './useDesktopPicker';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UseDesktopPickerSlots, UseDesktopPickerSlotProps, ExportedUseDesktopPickerSlotProps, DesktopOnlyPickerProps, } from './useDesktopPicker.types';
|
|
@@ -37,6 +37,7 @@ export const useDesktopPicker = _ref => {
|
|
|
37
37
|
format,
|
|
38
38
|
formatDensity,
|
|
39
39
|
timezone,
|
|
40
|
+
name,
|
|
40
41
|
label,
|
|
41
42
|
inputRef,
|
|
42
43
|
readOnly,
|
|
@@ -104,6 +105,7 @@ export const useDesktopPicker = _ref => {
|
|
|
104
105
|
formatDensity,
|
|
105
106
|
timezone,
|
|
106
107
|
label,
|
|
108
|
+
name,
|
|
107
109
|
autoFocus: autoFocus && !props.open,
|
|
108
110
|
focused: open ? true : undefined
|
|
109
111
|
}),
|
|
@@ -4,15 +4,15 @@ import { InputAdornmentProps } from '@mui/material/InputAdornment';
|
|
|
4
4
|
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
|
5
5
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
6
6
|
import { BaseNonStaticPickerProps, BasePickerProps, BaseNonRangeNonStaticPickerProps } from '../../models/props/basePickerProps';
|
|
7
|
-
import {
|
|
7
|
+
import { PickersPopperSlots, PickersPopperSlotProps } from '../../components/PickersPopper';
|
|
8
8
|
import { UsePickerParams, UsePickerProps } from '../usePicker';
|
|
9
9
|
import { BaseSingleInputFieldProps, FieldSection, MuiPickersAdapter } from '../../../models';
|
|
10
|
-
import {
|
|
10
|
+
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, PickersLayoutSlotProps } from '../../../PickersLayout/PickersLayout.types';
|
|
11
11
|
import { UsePickerValueNonStaticProps } from '../usePicker/usePickerValue.types';
|
|
12
12
|
import { UsePickerViewsNonStaticProps, UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
13
13
|
import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
14
|
-
import {
|
|
15
|
-
export interface
|
|
14
|
+
import { UseClearableFieldSlots, UseClearableFieldSlotProps } from '../../../hooks/useClearableField';
|
|
15
|
+
export interface UseDesktopPickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends Pick<PickersPopperSlots, 'desktopPaper' | 'desktopTransition' | 'desktopTrapFocus' | 'popper'>, ExportedPickersLayoutSlots<TDate | null, TDate, TView>, UseClearableFieldSlots {
|
|
16
16
|
/**
|
|
17
17
|
* Component used to enter the date with the keyboard.
|
|
18
18
|
*/
|
|
@@ -38,9 +38,9 @@ export interface UseDesktopPickerSlotsComponent<TDate, TView extends DateOrTimeV
|
|
|
38
38
|
*/
|
|
39
39
|
openPickerIcon: React.ElementType;
|
|
40
40
|
}
|
|
41
|
-
export interface
|
|
41
|
+
export interface UseDesktopPickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedUseDesktopPickerSlotProps<TDate, TView>, Pick<PickersLayoutSlotProps<TDate | null, TDate, TView>, 'toolbar'> {
|
|
42
42
|
}
|
|
43
|
-
export interface
|
|
43
|
+
export interface ExportedUseDesktopPickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersPopperSlotProps, ExportedPickersLayoutSlotProps<TDate | null, TDate, TView>, UseClearableFieldSlotProps {
|
|
44
44
|
field?: SlotComponentProps<React.ElementType<BaseSingleInputFieldProps<TDate | null, TDate, FieldSection, unknown>>, {}, UsePickerProps<TDate | null, TDate, any, FieldSection, any, any, any>>;
|
|
45
45
|
textField?: SlotComponentProps<typeof TextField, {}, Record<string, any>>;
|
|
46
46
|
inputAdornment?: Partial<InputAdornmentProps>;
|
|
@@ -58,12 +58,12 @@ export interface UseDesktopPickerProps<TDate, TView extends DateOrTimeViewWithMe
|
|
|
58
58
|
* Overridable component slots.
|
|
59
59
|
* @default {}
|
|
60
60
|
*/
|
|
61
|
-
slots:
|
|
61
|
+
slots: UseDesktopPickerSlots<TDate, TView>;
|
|
62
62
|
/**
|
|
63
63
|
* The props used for each component slot.
|
|
64
64
|
* @default {}
|
|
65
65
|
*/
|
|
66
|
-
slotProps?:
|
|
66
|
+
slotProps?: UseDesktopPickerSlotProps<TDate, TView>;
|
|
67
67
|
}
|
|
68
68
|
export interface UseDesktopPickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseDesktopPickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
|
|
69
69
|
props: TExternalProps;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { useField } from './useField';
|
|
2
|
-
export type { FieldValueManager, UseFieldInternalProps, UseFieldForwardedProps, UseFieldParams, UseFieldResponse, FieldChangeHandler, FieldChangeHandlerContext, FieldRef,
|
|
2
|
+
export type { FieldValueManager, UseFieldInternalProps, UseFieldForwardedProps, UseFieldParams, UseFieldResponse, FieldChangeHandler, FieldChangeHandlerContext, FieldRef, } from './useField.types';
|
|
3
3
|
export { splitFormatIntoSections, addPositionPropertiesToSections, createDateStrForInputFromSections, } from './useField.utils';
|
|
@@ -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", "disabled"];
|
|
3
|
+
const _excluded = ["inputRef", "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';
|
|
@@ -28,7 +28,6 @@ export const useField = params => {
|
|
|
28
28
|
timezone
|
|
29
29
|
} = useFieldState(params);
|
|
30
30
|
const {
|
|
31
|
-
inputRef: inputRefProp,
|
|
32
31
|
internalProps,
|
|
33
32
|
internalProps: {
|
|
34
33
|
readOnly = false,
|
|
@@ -36,6 +35,7 @@ export const useField = params => {
|
|
|
36
35
|
minutesStep
|
|
37
36
|
},
|
|
38
37
|
forwardedProps: {
|
|
38
|
+
inputRef: inputRefProp,
|
|
39
39
|
onClick,
|
|
40
40
|
onKeyDown,
|
|
41
41
|
onFocus,
|
|
@@ -433,7 +433,7 @@ export const useField = params => {
|
|
|
433
433
|
onMouseUp: handleInputMouseUp,
|
|
434
434
|
onClear: handleClearValue,
|
|
435
435
|
error: inputError,
|
|
436
|
-
|
|
436
|
+
inputRef: handleRef,
|
|
437
437
|
clearable: Boolean(clearable && !areAllSectionsEmpty && !readOnly && !disabled)
|
|
438
438
|
});
|
|
439
439
|
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
|
-
import IconButton from '@mui/material/IconButton';
|
|
4
|
-
import { ClearIcon } from '../../../icons';
|
|
5
2
|
import { FieldSectionType, FieldSection, FieldSelectedSections, MuiPickersAdapter, TimezoneProps, FieldSectionContentType, FieldValueType, PickersTimezone } from '../../../models';
|
|
6
3
|
import type { PickerValueManager } from '../usePicker';
|
|
7
4
|
import { InferError, Validator } from '../useValidation';
|
|
8
5
|
export interface UseFieldParams<TValue, TDate, TSection extends FieldSection, TForwardedProps extends UseFieldForwardedProps, TInternalProps extends UseFieldInternalProps<any, any, any, any>> {
|
|
9
|
-
inputRef?: React.Ref<HTMLInputElement>;
|
|
10
6
|
forwardedProps: TForwardedProps;
|
|
11
7
|
internalProps: TInternalProps;
|
|
12
8
|
valueManager: PickerValueManager<TValue, TDate, InferError<TInternalProps>>;
|
|
@@ -130,6 +126,7 @@ export interface FieldRef<TSection extends FieldSection> {
|
|
|
130
126
|
setSelectedSections: (selectedSections: FieldSelectedSections) => void;
|
|
131
127
|
}
|
|
132
128
|
export interface UseFieldForwardedProps {
|
|
129
|
+
inputRef?: React.Ref<HTMLInputElement>;
|
|
133
130
|
onKeyDown?: React.KeyboardEventHandler;
|
|
134
131
|
onMouseUp?: React.MouseEventHandler;
|
|
135
132
|
onPaste?: React.ClipboardEventHandler<HTMLInputElement>;
|
|
@@ -141,8 +138,8 @@ export interface UseFieldForwardedProps {
|
|
|
141
138
|
clearable?: boolean;
|
|
142
139
|
disabled?: boolean;
|
|
143
140
|
}
|
|
144
|
-
export type UseFieldResponse<TForwardedProps extends UseFieldForwardedProps> = Omit<TForwardedProps, keyof UseFieldForwardedProps> & Required<UseFieldForwardedProps> & Pick<React.
|
|
145
|
-
|
|
141
|
+
export type UseFieldResponse<TForwardedProps extends UseFieldForwardedProps> = Omit<TForwardedProps, keyof UseFieldForwardedProps> & Required<UseFieldForwardedProps> & Pick<React.InputHTMLAttributes<HTMLInputElement>, 'autoCorrect' | 'inputMode' | 'placeholder'> & {
|
|
142
|
+
inputRef: React.Ref<HTMLInputElement>;
|
|
146
143
|
value: string;
|
|
147
144
|
onChange: React.ChangeEventHandler<HTMLInputElement>;
|
|
148
145
|
error: boolean;
|
|
@@ -200,9 +197,8 @@ export type FieldSelectedSectionsIndexes = {
|
|
|
200
197
|
endIndex: number;
|
|
201
198
|
/**
|
|
202
199
|
* If `true`, the selectors at the very beginning and very end of the input will be selected.
|
|
203
|
-
* @default false
|
|
204
200
|
*/
|
|
205
|
-
shouldSelectBoundarySelectors
|
|
201
|
+
shouldSelectBoundarySelectors: boolean;
|
|
206
202
|
};
|
|
207
203
|
export interface FieldValueManager<TValue, TDate, TSection extends FieldSection> {
|
|
208
204
|
/**
|
|
@@ -318,20 +314,4 @@ export type SectionOrdering = {
|
|
|
318
314
|
*/
|
|
319
315
|
endIndex: number;
|
|
320
316
|
};
|
|
321
|
-
export interface FieldSlotsComponents {
|
|
322
|
-
/**
|
|
323
|
-
* Icon to display inside the clear button.
|
|
324
|
-
* @default ClearIcon
|
|
325
|
-
*/
|
|
326
|
-
clearIcon?: React.ElementType;
|
|
327
|
-
/**
|
|
328
|
-
* Button to clear the value.
|
|
329
|
-
* @default IconButton
|
|
330
|
-
*/
|
|
331
|
-
clearButton?: React.ElementType;
|
|
332
|
-
}
|
|
333
|
-
export interface FieldSlotsComponentsProps {
|
|
334
|
-
clearIcon?: SlotComponentProps<typeof ClearIcon, {}, {}>;
|
|
335
|
-
clearButton?: SlotComponentProps<typeof IconButton, {}, {}>;
|
|
336
|
-
}
|
|
337
317
|
export {};
|
|
@@ -125,7 +125,6 @@ export const adjustSectionValue = (utils, timezone, section, keyCode, sectionsVa
|
|
|
125
125
|
if (delta < 0 || isStart) {
|
|
126
126
|
newSectionValueNumber += step - (step + newSectionValueNumber) % step; // for JS -3 % 5 = -3 (should be 2)
|
|
127
127
|
}
|
|
128
|
-
|
|
129
128
|
if (delta > 0 || isEnd) {
|
|
130
129
|
newSectionValueNumber -= newSectionValueNumber % step;
|
|
131
130
|
}
|
|
@@ -193,7 +192,7 @@ export const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
|
193
192
|
|
|
194
193
|
// The ...InInput values consider the unicode characters but do include them in their indexes
|
|
195
194
|
const cleanedValue = cleanString(renderedValue);
|
|
196
|
-
const startInInput = positionInInput + renderedValue.indexOf(cleanedValue[0]) + section.startSeparator.length;
|
|
195
|
+
const startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
|
|
197
196
|
const endInInput = startInInput + cleanedValue.length;
|
|
198
197
|
newSections.push(_extends({}, section, {
|
|
199
198
|
start: position,
|
|
@@ -400,7 +399,6 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
400
399
|
const isTokenStartRegExp = new RegExp(`^(${Object.keys(utils.formatTokenMap).sort((a, b) => b.length - a.length) // Sort to put longest word first
|
|
401
400
|
.join('|')})`, 'g') // used to get access to lastIndex state
|
|
402
401
|
;
|
|
403
|
-
|
|
404
402
|
let currentTokenValue = '';
|
|
405
403
|
for (let i = 0; i < expandedFormat.length; i += 1) {
|
|
406
404
|
const escapedPartOfCurrentChar = escapedParts.find(escapeIndex => escapeIndex.start <= i && escapeIndex.end >= i);
|
|
@@ -427,6 +425,21 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
427
425
|
}
|
|
428
426
|
}
|
|
429
427
|
commitToken(currentTokenValue);
|
|
428
|
+
if (sections.length === 0 && startSeparator.length > 0) {
|
|
429
|
+
sections.push({
|
|
430
|
+
type: 'empty',
|
|
431
|
+
contentType: 'letter',
|
|
432
|
+
maxLength: null,
|
|
433
|
+
format: '',
|
|
434
|
+
value: '',
|
|
435
|
+
placeholder: '',
|
|
436
|
+
hasLeadingZerosInFormat: false,
|
|
437
|
+
hasLeadingZerosInInput: false,
|
|
438
|
+
startSeparator,
|
|
439
|
+
endSeparator: '',
|
|
440
|
+
modified: false
|
|
441
|
+
});
|
|
442
|
+
}
|
|
430
443
|
return sections.map(section => {
|
|
431
444
|
const cleanSeparator = separator => {
|
|
432
445
|
let cleanedSeparator = separator;
|
|
@@ -568,6 +581,10 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
568
581
|
meridiem: () => ({
|
|
569
582
|
minimum: 0,
|
|
570
583
|
maximum: 0
|
|
584
|
+
}),
|
|
585
|
+
empty: () => ({
|
|
586
|
+
minimum: 0,
|
|
587
|
+
maximum: 0
|
|
571
588
|
})
|
|
572
589
|
};
|
|
573
590
|
};
|
|
@@ -575,7 +592,7 @@ let warnedOnceInvalidSection = false;
|
|
|
575
592
|
export const validateSections = (sections, valueType) => {
|
|
576
593
|
if (process.env.NODE_ENV !== 'production') {
|
|
577
594
|
if (!warnedOnceInvalidSection) {
|
|
578
|
-
const supportedSections = [];
|
|
595
|
+
const supportedSections = ['empty'];
|
|
579
596
|
if (['date', 'date-time'].includes(valueType)) {
|
|
580
597
|
supportedSections.push('weekDay', 'day', 'month', 'year');
|
|
581
598
|
}
|
|
@@ -584,7 +601,7 @@ export const validateSections = (sections, valueType) => {
|
|
|
584
601
|
}
|
|
585
602
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
586
603
|
if (invalidSection) {
|
|
587
|
-
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type} date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
604
|
+
console.warn(`MUI: The field component you are using is not compatible with the "${invalidSection.type}" date section.`, `The supported date sections are ["${supportedSections.join('", "')}"]\`.`);
|
|
588
605
|
warnedOnceInvalidSection = true;
|
|
589
606
|
}
|
|
590
607
|
}
|
|
@@ -651,7 +668,8 @@ const reliableSectionModificationOrder = {
|
|
|
651
668
|
hours: 5,
|
|
652
669
|
minutes: 6,
|
|
653
670
|
seconds: 7,
|
|
654
|
-
meridiem: 8
|
|
671
|
+
meridiem: 8,
|
|
672
|
+
empty: 9
|
|
655
673
|
};
|
|
656
674
|
export const mergeDateIntoReferenceDate = (utils, timezone, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
|
|
657
675
|
// cloning sections before sort to avoid mutating it
|
|
@@ -94,17 +94,21 @@ export const useFieldState = params => {
|
|
|
94
94
|
if (typeof selectedSections === 'number') {
|
|
95
95
|
return {
|
|
96
96
|
startIndex: selectedSections,
|
|
97
|
-
endIndex: selectedSections
|
|
97
|
+
endIndex: selectedSections,
|
|
98
|
+
shouldSelectBoundarySelectors: state.sections[selectedSections].type === 'empty'
|
|
98
99
|
};
|
|
99
100
|
}
|
|
100
101
|
if (typeof selectedSections === 'string') {
|
|
101
102
|
const selectedSectionIndex = state.sections.findIndex(section => section.type === selectedSections);
|
|
102
103
|
return {
|
|
103
104
|
startIndex: selectedSectionIndex,
|
|
104
|
-
endIndex: selectedSectionIndex
|
|
105
|
+
endIndex: selectedSectionIndex,
|
|
106
|
+
shouldSelectBoundarySelectors: state.sections[selectedSectionIndex].type === 'empty'
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
|
-
return selectedSections
|
|
109
|
+
return _extends({}, selectedSections, {
|
|
110
|
+
shouldSelectBoundarySelectors: selectedSections.startIndex === selectedSections.endIndex && state.sections[selectedSections.startIndex].type === 'empty'
|
|
111
|
+
});
|
|
108
112
|
}, [selectedSections, state.sections]);
|
|
109
113
|
const publishValue = ({
|
|
110
114
|
value,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useMobilePicker } from './useMobilePicker';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UseMobilePickerSlots, UseMobilePickerSlotProps, ExportedUseMobilePickerSlotProps, MobileOnlyPickerProps, } from './useMobilePicker.types';
|
|
@@ -34,6 +34,7 @@ export const useMobilePicker = _ref => {
|
|
|
34
34
|
format,
|
|
35
35
|
formatDensity,
|
|
36
36
|
timezone,
|
|
37
|
+
name,
|
|
37
38
|
label,
|
|
38
39
|
inputRef,
|
|
39
40
|
readOnly,
|
|
@@ -74,7 +75,8 @@ export const useMobilePicker = _ref => {
|
|
|
74
75
|
format,
|
|
75
76
|
formatDensity,
|
|
76
77
|
timezone,
|
|
77
|
-
label
|
|
78
|
+
label,
|
|
79
|
+
name
|
|
78
80
|
}),
|
|
79
81
|
ownerState: props
|
|
80
82
|
});
|
|
@@ -2,14 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import TextField, { TextFieldProps } from '@mui/material/TextField';
|
|
3
3
|
import { SlotComponentProps } from '@mui/base/utils';
|
|
4
4
|
import { BaseNonStaticPickerProps, BasePickerProps, BaseNonRangeNonStaticPickerProps } from '../../models/props/basePickerProps';
|
|
5
|
-
import {
|
|
5
|
+
import { PickersModalDialogSlots, PickersModalDialogSlotProps } from '../../components/PickersModalDialog';
|
|
6
6
|
import { UsePickerParams, UsePickerProps } from '../usePicker';
|
|
7
7
|
import { BaseSingleInputFieldProps, FieldSection, MuiPickersAdapter } from '../../../models';
|
|
8
|
-
import {
|
|
8
|
+
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, PickersLayoutSlotProps } from '../../../PickersLayout/PickersLayout.types';
|
|
9
9
|
import { UsePickerValueNonStaticProps } from '../usePicker/usePickerValue.types';
|
|
10
10
|
import { UsePickerViewsNonStaticProps, UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
11
11
|
import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
12
|
-
export interface
|
|
12
|
+
export interface UseMobilePickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersModalDialogSlots, ExportedPickersLayoutSlots<TDate | null, TDate, TView> {
|
|
13
13
|
/**
|
|
14
14
|
* Component used to enter the date with the keyboard.
|
|
15
15
|
*/
|
|
@@ -21,11 +21,11 @@ export interface UseMobilePickerSlotsComponent<TDate, TView extends DateOrTimeVi
|
|
|
21
21
|
*/
|
|
22
22
|
textField?: React.ElementType<TextFieldProps>;
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
24
|
+
export interface ExportedUseMobilePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends PickersModalDialogSlotProps, ExportedPickersLayoutSlotProps<TDate | null, TDate, TView> {
|
|
25
25
|
field?: SlotComponentProps<React.ElementType<BaseSingleInputFieldProps<TDate | null, TDate, FieldSection, unknown>>, {}, UsePickerProps<TDate | null, TDate, any, FieldSection, any, any, any>>;
|
|
26
26
|
textField?: SlotComponentProps<typeof TextField, {}, Record<string, any>>;
|
|
27
27
|
}
|
|
28
|
-
export interface
|
|
28
|
+
export interface UseMobilePickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedUseMobilePickerSlotProps<TDate, TView>, Pick<PickersLayoutSlotProps<TDate | null, TDate, TView>, 'toolbar'> {
|
|
29
29
|
}
|
|
30
30
|
export interface MobileOnlyPickerProps<TDate> extends BaseNonStaticPickerProps, BaseNonRangeNonStaticPickerProps, UsePickerValueNonStaticProps<TDate | null, FieldSection>, UsePickerViewsNonStaticProps {
|
|
31
31
|
}
|
|
@@ -34,12 +34,12 @@ export interface UseMobilePickerProps<TDate, TView extends DateOrTimeViewWithMer
|
|
|
34
34
|
* Overridable component slots.
|
|
35
35
|
* @default {}
|
|
36
36
|
*/
|
|
37
|
-
slots:
|
|
37
|
+
slots: UseMobilePickerSlots<TDate, TView>;
|
|
38
38
|
/**
|
|
39
39
|
* The props used for each component slot.
|
|
40
40
|
* @default {}
|
|
41
41
|
*/
|
|
42
|
-
slotProps?:
|
|
42
|
+
slotProps?: UseMobilePickerSlotProps<TDate, TView>;
|
|
43
43
|
}
|
|
44
44
|
export interface UseMobilePickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseMobilePickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
|
|
45
45
|
props: TExternalProps;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { useStaticPicker } from './useStaticPicker';
|
|
2
|
-
export type {
|
|
2
|
+
export type { UseStaticPickerSlots, UseStaticPickerSlotProps, StaticOnlyPickerProps, } from './useStaticPicker.types';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps } from '../../../PickersLayout/PickersLayout.types';
|
|
3
3
|
import { BasePickerProps } from '../../models/props/basePickerProps';
|
|
4
4
|
import { UsePickerParams } from '../usePicker';
|
|
5
5
|
import { UsePickerViewsProps } from '../usePicker/usePickerViews';
|
|
6
6
|
import { FieldSection } from '../../../models';
|
|
7
7
|
import { DateOrTimeViewWithMeridiem } from '../../models';
|
|
8
|
-
export interface
|
|
8
|
+
export interface UseStaticPickerSlots<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlots<TDate | null, TDate, TView> {
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface UseStaticPickerSlotProps<TDate, TView extends DateOrTimeViewWithMeridiem> extends ExportedPickersLayoutSlotProps<TDate | null, TDate, TView> {
|
|
11
11
|
}
|
|
12
12
|
export interface StaticOnlyPickerProps {
|
|
13
13
|
/**
|
|
@@ -31,12 +31,12 @@ export interface UseStaticPickerProps<TDate, TView extends DateOrTimeViewWithMer
|
|
|
31
31
|
* Overridable component slots.
|
|
32
32
|
* @default {}
|
|
33
33
|
*/
|
|
34
|
-
slots?:
|
|
34
|
+
slots?: UseStaticPickerSlots<TDate | null, TView>;
|
|
35
35
|
/**
|
|
36
36
|
* The props used for each component slot.
|
|
37
37
|
* @default {}
|
|
38
38
|
*/
|
|
39
|
-
slotProps?:
|
|
39
|
+
slotProps?: UseStaticPickerSlotProps<TDate, TView>;
|
|
40
40
|
}
|
|
41
41
|
export interface UseStaticPickerParams<TDate, TView extends DateOrTimeViewWithMeridiem, TExternalProps extends UseStaticPickerProps<TDate, TView, any, TExternalProps>> extends Pick<UsePickerParams<TDate | null, TDate, TView, FieldSection, TExternalProps, {}>, 'valueManager' | 'valueType' | 'validator'> {
|
|
42
42
|
props: TExternalProps;
|
|
@@ -61,7 +61,6 @@ export function useViews({
|
|
|
61
61
|
setFocusedView(prevFocusedView => viewToFocus === prevFocusedView ? null : prevFocusedView // If false the blur is due to view switching
|
|
62
62
|
);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
64
|
onFocusedViewChange == null || onFocusedViewChange(viewToFocus, hasFocus);
|
|
66
65
|
});
|
|
67
66
|
const handleChangeView = useEventCallback(newView => {
|
package/internals/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from './components/PickersArrowSwitcher/PickersArrowSwitcher';
|
|
2
|
-
export type { ExportedPickersArrowSwitcherProps,
|
|
2
|
+
export type { ExportedPickersArrowSwitcherProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, } from './components/PickersArrowSwitcher';
|
|
3
3
|
export { PickersModalDialog } from './components/PickersModalDialog';
|
|
4
|
-
export type {
|
|
4
|
+
export type { PickersModalDialogSlots, PickersModalDialogSlotProps, } from './components/PickersModalDialog';
|
|
5
5
|
export { PickersPopper } from './components/PickersPopper';
|
|
6
|
-
export type {
|
|
6
|
+
export type { PickersPopperSlots, PickersPopperSlotProps } from './components/PickersPopper';
|
|
7
7
|
export { PickersToolbar } from './components/PickersToolbar';
|
|
8
8
|
export type { PickersToolbarProps } from './components/PickersToolbar';
|
|
9
9
|
export { pickersToolbarClasses } from './components/pickersToolbarClasses';
|
|
@@ -24,14 +24,14 @@ export { DAY_MARGIN, DIALOG_WIDTH } from './constants/dimensions';
|
|
|
24
24
|
export { useControlledValueWithTimezone } from './hooks/useValueWithTimezone';
|
|
25
25
|
export type { DesktopOnlyPickerProps } from './hooks/useDesktopPicker';
|
|
26
26
|
export { useField, createDateStrForInputFromSections, addPositionPropertiesToSections, } from './hooks/useField';
|
|
27
|
-
export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, UseFieldForwardedProps, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext,
|
|
27
|
+
export type { UseFieldInternalProps, UseFieldParams, UseFieldResponse, UseFieldForwardedProps, FieldValueManager, FieldChangeHandler, FieldChangeHandlerContext, } from './hooks/useField';
|
|
28
28
|
export type { MobileOnlyPickerProps } from './hooks/useMobilePicker';
|
|
29
29
|
export { usePicker } from './hooks/usePicker';
|
|
30
30
|
export type { UsePickerResponse, UsePickerParams, UsePickerProps } from './hooks/usePicker';
|
|
31
31
|
export type { UsePickerValueNonStaticProps, PickerValueManager, PickerSelectionState, } from './hooks/usePicker/usePickerValue.types';
|
|
32
32
|
export type { UsePickerViewsNonStaticProps, PickerViewRendererLookup, UsePickerViewsProps, } from './hooks/usePicker/usePickerViews';
|
|
33
33
|
export { useStaticPicker } from './hooks/useStaticPicker';
|
|
34
|
-
export type { StaticOnlyPickerProps,
|
|
34
|
+
export type { StaticOnlyPickerProps, UseStaticPickerSlots, UseStaticPickerSlotProps, } from './hooks/useStaticPicker';
|
|
35
35
|
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow, } from './hooks/useUtils';
|
|
36
36
|
export type { ExportedUseViewsOptions } from './hooks/useViews';
|
|
37
37
|
export { useValidation } from './hooks/useValidation';
|
|
@@ -43,6 +43,7 @@ export type { BaseToolbarProps, ExportedBaseToolbarProps } from './models/props/
|
|
|
43
43
|
export type { DefaultizedProps, MakeOptional } from './models/helpers';
|
|
44
44
|
export type { WrapperVariant } from './models/common';
|
|
45
45
|
export type { BaseDateValidationProps, BaseTimeValidationProps, TimeValidationProps, MonthValidationProps, YearValidationProps, DayValidationProps, DateTimeValidationProps, } from './models/validation';
|
|
46
|
+
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
46
47
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate, } from './utils/date-utils';
|
|
47
48
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
48
49
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
@@ -54,6 +55,6 @@ export { validateDateTime } from './utils/validation/validateDateTime';
|
|
|
54
55
|
export { validateTime } from './utils/validation/validateTime';
|
|
55
56
|
export { buildDeprecatedPropsWarning, buildWarning } from './utils/warning';
|
|
56
57
|
export { DayCalendar } from '../DateCalendar/DayCalendar';
|
|
57
|
-
export type { DayCalendarProps,
|
|
58
|
+
export type { DayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, ExportedDayCalendarProps, } from '../DateCalendar/DayCalendar';
|
|
58
59
|
export type { ExportedDateCalendarProps } from '../DateCalendar/DateCalendar.types';
|
|
59
60
|
export { useCalendarState } from '../DateCalendar/useCalendarState';
|
package/internals/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { useStaticPicker } from './hooks/useStaticPicker';
|
|
|
16
16
|
export { useLocalizationContext, useDefaultDates, useUtils, useLocaleText, useNow } from './hooks/useUtils';
|
|
17
17
|
export { useValidation } from './hooks/useValidation';
|
|
18
18
|
export { usePreviousMonthDisabled, useNextMonthDisabled } from './hooks/date-helpers-hooks';
|
|
19
|
+
export { convertFieldResponseIntoMuiTextFieldProps } from './utils/convertFieldResponseIntoMuiTextFieldProps';
|
|
19
20
|
export { applyDefaultDate, replaceInvalidDateByNull, areDatesEqual, getTodayDate } from './utils/date-utils';
|
|
20
21
|
export { splitFieldInternalAndForwardedProps } from './utils/fields';
|
|
21
22
|
export { getDefaultReferenceDate } from './utils/getDefaultReferenceDate';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material/TextField';
|
|
2
|
+
import { UseFieldResponse } from '../hooks/useField';
|
|
3
|
+
export declare const convertFieldResponseIntoMuiTextFieldProps: <TFieldResponse extends UseFieldResponse<any>>(fieldResponse: TFieldResponse) => TextFieldProps;
|