@mui/x-date-pickers 8.0.0-alpha.0 → 8.0.0-alpha.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/AdapterMoment/AdapterMoment.js +10 -0
- package/CHANGELOG.md +651 -6
- package/DateCalendar/DateCalendar.js +1 -0
- package/DateCalendar/DateCalendar.types.d.ts +2 -1
- package/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/DateCalendar/PickersSlideTransition.js +12 -5
- package/DateCalendar/useCalendarState.d.ts +6 -4
- package/DateField/DateField.js +5 -4
- package/DateField/DateField.types.d.ts +10 -9
- package/DatePicker/DatePicker.types.d.ts +3 -3
- package/DatePicker/DatePickerToolbar.d.ts +3 -2
- package/DatePicker/DatePickerToolbar.js +0 -12
- package/DatePicker/shared.d.ts +6 -5
- package/DateTimeField/DateTimeField.js +5 -4
- package/DateTimeField/DateTimeField.types.d.ts +10 -10
- package/DateTimePicker/DateTimePicker.types.d.ts +3 -3
- package/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/DateTimePicker/DateTimePickerToolbar.d.ts +3 -4
- package/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/DateTimePicker/shared.d.ts +6 -6
- package/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.d.ts +2 -1
- package/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
- package/DigitalClock/DigitalClock.js +1 -0
- package/MonthCalendar/MonthCalendar.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +6 -6
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +4 -4
- package/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/PickersCalendarHeader/PickersCalendarHeader.types.d.ts +3 -4
- package/PickersLayout/PickersLayout.d.ts +7 -5
- package/PickersLayout/PickersLayout.js +22 -39
- package/PickersLayout/PickersLayout.types.d.ts +14 -15
- package/PickersLayout/usePickerLayout.d.ts +5 -4
- package/PickersLayout/usePickerLayout.js +20 -17
- package/PickersShortcuts/PickersShortcuts.d.ts +7 -6
- package/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/PickersTextField/PickersTextField.js +2 -2
- package/README.md +9 -6
- package/TimeClock/Clock.js +1 -0
- package/TimeClock/TimeClock.js +1 -0
- package/TimeField/TimeField.js +5 -4
- package/TimeField/TimeField.types.d.ts +10 -10
- package/TimePicker/TimePicker.types.d.ts +3 -3
- package/TimePicker/TimePickerToolbar.d.ts +2 -3
- package/TimePicker/TimePickerToolbar.js +6 -15
- package/TimePicker/shared.d.ts +6 -6
- package/YearCalendar/YearCalendar.js +1 -0
- package/hooks/useParsedFormat.d.ts +2 -2
- package/hooks/useParsedFormat.js +1 -1
- package/hooks/useSplitFieldProps.d.ts +3 -3
- package/index.js +1 -1
- package/internals/components/PickerProvider.d.ts +26 -0
- package/internals/components/PickerProvider.js +3 -1
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.types.d.ts +11 -8
- package/internals/components/PickersToolbar.d.ts +3 -3
- package/internals/components/PickersToolbar.js +2 -4
- package/internals/hooks/useClockReferenceDate.d.ts +2 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/internals/hooks/useDesktopPicker/useDesktopPicker.types.d.ts +14 -14
- package/internals/hooks/useField/useField.d.ts +3 -3
- package/internals/hooks/useField/useField.types.d.ts +46 -46
- package/internals/hooks/useField/useField.utils.d.ts +4 -3
- package/internals/hooks/useField/useFieldCharacterEditing.d.ts +6 -5
- package/internals/hooks/useField/useFieldState.d.ts +9 -8
- package/internals/hooks/useField/useFieldState.js +1 -1
- package/internals/hooks/useField/useFieldV6TextField.d.ts +4 -3
- package/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/internals/hooks/useFieldOwnerState.d.ts +6 -0
- package/internals/hooks/useFieldOwnerState.js +12 -0
- package/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/internals/hooks/useMobilePicker/useMobilePicker.types.d.ts +11 -11
- package/internals/hooks/usePicker/usePicker.d.ts +3 -3
- package/internals/hooks/usePicker/usePicker.js +10 -19
- package/internals/hooks/usePicker/usePicker.types.d.ts +8 -8
- package/internals/hooks/usePicker/usePickerProvider.d.ts +21 -6
- package/internals/hooks/usePicker/usePickerProvider.js +61 -5
- package/internals/hooks/usePicker/usePickerValue.d.ts +3 -2
- package/internals/hooks/usePicker/usePickerValue.js +18 -7
- package/internals/hooks/usePicker/usePickerValue.types.d.ts +32 -30
- package/internals/hooks/usePicker/usePickerViews.d.ts +11 -10
- package/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/internals/hooks/useStaticPicker/useStaticPicker.types.d.ts +5 -6
- package/internals/hooks/useValueWithTimezone.d.ts +20 -15
- package/internals/hooks/useValueWithTimezone.js +13 -1
- package/internals/hooks/useViews.d.ts +5 -5
- package/internals/index.d.ts +5 -3
- package/internals/index.js +1 -0
- package/internals/models/common.d.ts +2 -1
- package/internals/models/fields.d.ts +6 -1
- package/internals/models/pickers.d.ts +1 -0
- package/internals/models/pickers.js +1 -0
- package/internals/models/props/basePickerProps.d.ts +4 -3
- package/internals/models/props/time.d.ts +2 -1
- package/internals/models/props/toolbar.d.ts +2 -2
- package/internals/models/value.d.ts +9 -0
- package/internals/utils/date-utils.d.ts +3 -3
- package/internals/utils/valueManagers.d.ts +4 -3
- package/locales/nlNL.js +7 -7
- package/models/adapters.d.ts +4 -4
- package/models/common.d.ts +1 -0
- package/models/fields.d.ts +19 -6
- package/models/pickers.d.ts +18 -0
- package/models/validation.d.ts +2 -1
- package/modern/AdapterMoment/AdapterMoment.js +10 -0
- package/modern/DateCalendar/DateCalendar.js +1 -0
- package/modern/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/modern/DateCalendar/PickersSlideTransition.js +12 -5
- package/modern/DateField/DateField.js +5 -4
- package/modern/DatePicker/DatePickerToolbar.js +0 -12
- package/modern/DateTimeField/DateTimeField.js +5 -4
- package/modern/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/modern/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/modern/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/modern/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +10 -33
- package/modern/DigitalClock/DigitalClock.js +1 -0
- package/modern/MonthCalendar/MonthCalendar.js +1 -0
- package/modern/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/modern/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/modern/PickersLayout/PickersLayout.js +22 -39
- package/modern/PickersLayout/usePickerLayout.js +20 -17
- package/modern/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/modern/PickersTextField/PickersTextField.js +2 -2
- package/modern/TimeClock/Clock.js +1 -0
- package/modern/TimeClock/TimeClock.js +1 -0
- package/modern/TimeField/TimeField.js +5 -4
- package/modern/TimePicker/TimePickerToolbar.js +6 -15
- package/modern/YearCalendar/YearCalendar.js +1 -0
- package/modern/hooks/useParsedFormat.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/PickerProvider.js +3 -1
- package/modern/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/modern/internals/components/PickersToolbar.js +2 -4
- package/modern/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/modern/internals/hooks/useField/useFieldState.js +1 -1
- package/modern/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/modern/internals/hooks/useFieldOwnerState.js +12 -0
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/modern/internals/hooks/usePicker/usePicker.js +10 -19
- package/modern/internals/hooks/usePicker/usePickerProvider.js +61 -5
- package/modern/internals/hooks/usePicker/usePickerValue.js +18 -7
- package/modern/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/modern/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/modern/internals/hooks/useValueWithTimezone.js +13 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/models/pickers.js +1 -0
- package/modern/locales/nlNL.js +7 -7
- package/modern/validation/useValidation.js +1 -1
- package/modern/validation/validateDate.js +8 -0
- package/modern/validation/validateDateTime.js +8 -0
- package/modern/validation/validateTime.js +8 -0
- package/node/AdapterMoment/AdapterMoment.js +10 -0
- package/node/DateCalendar/DateCalendar.js +1 -0
- package/node/DateCalendar/PickersFadeTransitionGroup.js +4 -6
- package/node/DateCalendar/PickersSlideTransition.js +12 -5
- package/node/DateField/DateField.js +5 -4
- package/node/DatePicker/DatePickerToolbar.js +0 -12
- package/node/DateTimeField/DateTimeField.js +5 -4
- package/node/DateTimePicker/DateTimePickerTabs.js +8 -6
- package/node/DateTimePicker/DateTimePickerToolbar.js +6 -15
- package/node/DayCalendarSkeleton/DayCalendarSkeleton.js +10 -19
- package/node/DesktopDateTimePicker/DesktopDateTimePickerLayout.js +11 -34
- package/node/DigitalClock/DigitalClock.js +1 -0
- package/node/MonthCalendar/MonthCalendar.js +1 -0
- package/node/MultiSectionDigitalClock/MultiSectionDigitalClock.js +1 -0
- package/node/PickersCalendarHeader/PickersCalendarHeader.js +8 -7
- package/node/PickersLayout/PickersLayout.js +22 -39
- package/node/PickersLayout/usePickerLayout.js +20 -17
- package/node/PickersTextField/PickersInputBase/PickersInputBase.js +10 -9
- package/node/PickersTextField/PickersTextField.js +2 -2
- package/node/TimeClock/Clock.js +1 -0
- package/node/TimeClock/TimeClock.js +1 -0
- package/node/TimeField/TimeField.js +5 -4
- package/node/TimePicker/TimePickerToolbar.js +6 -15
- package/node/YearCalendar/YearCalendar.js +1 -0
- package/node/hooks/useParsedFormat.js +1 -1
- package/node/index.js +1 -1
- package/node/internals/components/PickerProvider.js +3 -1
- package/node/internals/components/PickersArrowSwitcher/PickersArrowSwitcher.js +11 -10
- package/node/internals/components/PickersToolbar.js +2 -4
- package/node/internals/hooks/useDesktopPicker/useDesktopPicker.js +1 -1
- package/node/internals/hooks/useField/useFieldState.js +1 -1
- package/node/internals/hooks/useField/useFieldV7TextField.js +2 -1
- package/node/internals/hooks/useFieldOwnerState.js +20 -0
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +1 -1
- package/node/internals/hooks/usePicker/usePicker.js +11 -19
- package/node/internals/hooks/usePicker/usePickerProvider.js +64 -5
- package/node/internals/hooks/usePicker/usePickerValue.js +18 -6
- package/node/internals/hooks/usePicker/usePickerViews.js +1 -0
- package/node/internals/hooks/useStaticPicker/useStaticPicker.js +1 -1
- package/node/internals/hooks/useValueWithTimezone.js +13 -1
- package/node/internals/index.js +7 -0
- package/node/internals/models/pickers.js +5 -0
- package/node/locales/nlNL.js +7 -7
- package/node/validation/useValidation.js +1 -1
- package/node/validation/validateDate.js +8 -0
- package/node/validation/validateDateTime.js +8 -0
- package/node/validation/validateTime.js +8 -0
- package/package.json +4 -4
- package/themeAugmentation/overrides.d.ts +1 -1
- package/themeAugmentation/props.d.ts +3 -2
- package/validation/useValidation.d.ts +7 -6
- package/validation/useValidation.js +1 -1
- package/validation/validateDate.d.ts +12 -3
- package/validation/validateDate.js +8 -0
- package/validation/validateDateTime.d.ts +12 -4
- package/validation/validateDateTime.js +8 -0
- package/validation/validateTime.d.ts +12 -3
- package/validation/validateTime.js +8 -0
- package/internals/hooks/useIsLandscape.d.ts +0 -4
- package/internals/hooks/useIsLandscape.js +0 -35
- package/internals/hooks/usePicker/usePickerLayoutProps.d.ts +0 -33
- package/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
- package/internals/hooks/usePicker/usePickerOwnerState.d.ts +0 -10
- package/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
- package/modern/internals/hooks/useIsLandscape.js +0 -35
- package/modern/internals/hooks/usePicker/usePickerLayoutProps.js +0 -34
- package/modern/internals/hooks/usePicker/usePickerOwnerState.js +0 -16
- package/node/internals/hooks/useIsLandscape.js +0 -43
- package/node/internals/hooks/usePicker/usePickerLayoutProps.js +0 -41
- package/node/internals/hooks/usePicker/usePickerOwnerState.js +0 -23
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef"];
|
|
3
|
+
const _excluded = ["elements", "areAllSectionsEmpty", "defaultValue", "label", "value", "onChange", "id", "autoFocus", "endAdornment", "startAdornment", "renderSuffix", "slots", "slotProps", "contentEditable", "tabIndex", "onInput", "onPaste", "onKeyDown", "fullWidth", "name", "readOnly", "inputProps", "inputRef", "sectionListRef", "onFocus", "onBlur"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useFormControl } from '@mui/material/FormControl';
|
|
@@ -194,7 +194,9 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
194
194
|
readOnly,
|
|
195
195
|
inputProps,
|
|
196
196
|
inputRef,
|
|
197
|
-
sectionListRef
|
|
197
|
+
sectionListRef,
|
|
198
|
+
onFocus,
|
|
199
|
+
onBlur
|
|
198
200
|
} = props,
|
|
199
201
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
200
202
|
const rootRef = React.useRef(null);
|
|
@@ -206,13 +208,12 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
206
208
|
throw new Error('MUI X: PickersInputBase should always be used inside a PickersTextField component');
|
|
207
209
|
}
|
|
208
210
|
const handleInputFocus = event => {
|
|
209
|
-
// Fix a bug with IE11 where the focus/blur events are triggered
|
|
210
|
-
// while the component is disabled.
|
|
211
|
-
if (muiFormControl.disabled) {
|
|
212
|
-
event.stopPropagation();
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
211
|
muiFormControl.onFocus?.(event);
|
|
212
|
+
onFocus?.(event);
|
|
213
|
+
};
|
|
214
|
+
const handleInputBlur = event => {
|
|
215
|
+
muiFormControl.onBlur?.(event);
|
|
216
|
+
onBlur?.(event);
|
|
216
217
|
};
|
|
217
218
|
React.useEffect(() => {
|
|
218
219
|
if (muiFormControl) {
|
|
@@ -254,7 +255,7 @@ const PickersInputBase = /*#__PURE__*/React.forwardRef(function PickersInputBase
|
|
|
254
255
|
tabIndex: tabIndex,
|
|
255
256
|
className: classes.sectionsContainer,
|
|
256
257
|
onFocus: handleInputFocus,
|
|
257
|
-
onBlur:
|
|
258
|
+
onBlur: handleInputBlur,
|
|
258
259
|
onInput: onInput,
|
|
259
260
|
onPaste: onPaste,
|
|
260
261
|
onKeyDown: onKeyDown,
|
|
@@ -105,8 +105,6 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
|
|
|
105
105
|
className: clsx(classes.root, className),
|
|
106
106
|
ref: handleRootRef,
|
|
107
107
|
focused: focused,
|
|
108
|
-
onFocus: onFocus,
|
|
109
|
-
onBlur: onBlur,
|
|
110
108
|
disabled: disabled,
|
|
111
109
|
variant: variant,
|
|
112
110
|
error: error,
|
|
@@ -128,6 +126,8 @@ const PickersTextField = /*#__PURE__*/React.forwardRef(function PickersTextField
|
|
|
128
126
|
onKeyUp: onKeyUp,
|
|
129
127
|
onInput: onInput,
|
|
130
128
|
onPaste: onPaste,
|
|
129
|
+
onFocus: onFocus,
|
|
130
|
+
onBlur: onBlur,
|
|
131
131
|
endAdornment: endAdornment,
|
|
132
132
|
startAdornment: startAdornment,
|
|
133
133
|
tabIndex: tabIndex,
|
package/README.md
CHANGED
|
@@ -20,13 +20,16 @@ The pickers currently support the following date libraries:
|
|
|
20
20
|
- [Moment.js](https://momentjs.com/)
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
|
|
23
|
+
# date-fns
|
|
24
24
|
npm install date-fns
|
|
25
|
-
|
|
25
|
+
|
|
26
|
+
# or dayjs
|
|
26
27
|
npm install dayjs
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
# or luxon
|
|
28
30
|
npm install luxon
|
|
29
|
-
|
|
31
|
+
|
|
32
|
+
# or moment
|
|
30
33
|
npm install moment
|
|
31
34
|
```
|
|
32
35
|
|
|
@@ -35,8 +38,8 @@ This component has the following peer dependencies that you need to install as w
|
|
|
35
38
|
```json
|
|
36
39
|
"peerDependencies": {
|
|
37
40
|
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
38
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
39
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
41
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
42
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
40
43
|
},
|
|
41
44
|
```
|
|
42
45
|
|
package/TimeClock/Clock.js
CHANGED
package/TimeClock/TimeClock.js
CHANGED
package/TimeField/TimeField.js
CHANGED
|
@@ -13,6 +13,7 @@ import { useTimeField } from "./useTimeField.js";
|
|
|
13
13
|
import { useClearableField } from "../hooks/index.js";
|
|
14
14
|
import { PickersTextField } from "../PickersTextField/index.js";
|
|
15
15
|
import { convertFieldResponseIntoMuiTextFieldProps } from "../internals/utils/convertFieldResponseIntoMuiTextFieldProps.js";
|
|
16
|
+
import { useFieldOwnerState } from "../internals/hooks/useFieldOwnerState.js";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
18
|
/**
|
|
18
19
|
* Demos:
|
|
@@ -36,7 +37,7 @@ const TimeField = /*#__PURE__*/React.forwardRef(function TimeField(inProps, inRe
|
|
|
36
37
|
inputProps
|
|
37
38
|
} = themeProps,
|
|
38
39
|
other = _objectWithoutPropertiesLoose(themeProps, _excluded);
|
|
39
|
-
const ownerState = themeProps;
|
|
40
|
+
const ownerState = useFieldOwnerState(themeProps);
|
|
40
41
|
const TextField = slots?.textField ?? (inProps.enableAccessibleFieldDOMStructure === false ? MuiTextField : PickersTextField);
|
|
41
42
|
const textFieldProps = useSlotProps({
|
|
42
43
|
elementType: TextField,
|
|
@@ -268,10 +269,10 @@ process.env.NODE_ENV !== "production" ? TimeField.propTypes = {
|
|
|
268
269
|
*/
|
|
269
270
|
shouldDisableTime: PropTypes.func,
|
|
270
271
|
/**
|
|
271
|
-
* If `true`, the format will respect the leading zeroes (
|
|
272
|
-
* If `false`, the format will always add leading zeroes (
|
|
272
|
+
* If `true`, the format will respect the leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `8/16/2018`)
|
|
273
|
+
* If `false`, the format will always add leading zeroes (for example on dayjs, the format `M/D/YYYY` will render `08/16/2018`)
|
|
273
274
|
*
|
|
274
|
-
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (
|
|
275
|
+
* Warning n°1: Luxon is not able to respect the leading zeroes when using macro tokens (for example "DD"), so `shouldRespectLeadingZeros={true}` might lead to inconsistencies when using `AdapterLuxon`.
|
|
275
276
|
*
|
|
276
277
|
* Warning n°2: When `shouldRespectLeadingZeros={true}`, the field will add an invisible character on the sections containing a single digit to make sure `onChange` is fired.
|
|
277
278
|
* If you need to get the clean value from the input, you can remove this character using `input.value.replace(/\u200e/g, '')`.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { MakeOptional } from '@mui/x-internals/types';
|
|
4
|
-
import TextField from '@mui/material/TextField';
|
|
2
|
+
import type { TextFieldProps } from '@mui/material/TextField';
|
|
3
|
+
import { MakeOptional, SlotComponentPropsFromProps } from '@mui/x-internals/types';
|
|
5
4
|
import { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
6
|
-
import {
|
|
5
|
+
import { TimeValidationError, BuiltInFieldTextFieldProps, FieldOwnerState } from '../models';
|
|
7
6
|
import { ExportedUseClearableFieldProps, UseClearableFieldSlots, UseClearableFieldSlotProps } from '../hooks/useClearableField';
|
|
8
7
|
import { ExportedValidateTimeProps } from '../validation/validateTime';
|
|
9
8
|
import { AmPmProps } from '../internals/models/props/time';
|
|
10
|
-
|
|
9
|
+
import { PickerValue } from '../internals/models';
|
|
10
|
+
import { PickersTextFieldProps } from '../PickersTextField';
|
|
11
|
+
export interface UseTimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean> extends MakeOptional<UseFieldInternalProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>, 'format'>, ExportedValidateTimeProps, ExportedUseClearableFieldProps, AmPmProps {
|
|
11
12
|
}
|
|
12
13
|
export type TimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = UseTimeFieldProps<TEnableAccessibleFieldDOMStructure> & Omit<BuiltInFieldTextFieldProps<TEnableAccessibleFieldDOMStructure>, keyof UseTimeFieldProps<TEnableAccessibleFieldDOMStructure>> & {
|
|
13
14
|
/**
|
|
@@ -19,16 +20,15 @@ export type TimeFieldProps<TEnableAccessibleFieldDOMStructure extends boolean =
|
|
|
19
20
|
* The props used for each component slot.
|
|
20
21
|
* @default {}
|
|
21
22
|
*/
|
|
22
|
-
slotProps?: TimeFieldSlotProps
|
|
23
|
+
slotProps?: TimeFieldSlotProps;
|
|
23
24
|
};
|
|
24
|
-
export type TimeFieldOwnerState<TEnableAccessibleFieldDOMStructure extends boolean> = TimeFieldProps<TEnableAccessibleFieldDOMStructure>;
|
|
25
25
|
export interface TimeFieldSlots extends UseClearableFieldSlots {
|
|
26
26
|
/**
|
|
27
27
|
* Form control with an input to render the value.
|
|
28
|
-
* @default TextField from '@mui/material'
|
|
28
|
+
* @default <PickersTextField />, or <TextField /> from '@mui/material' if `enableAccessibleFieldDOMStructure` is `false`.
|
|
29
29
|
*/
|
|
30
30
|
textField?: React.ElementType;
|
|
31
31
|
}
|
|
32
|
-
export interface TimeFieldSlotProps
|
|
33
|
-
textField?:
|
|
32
|
+
export interface TimeFieldSlotProps extends UseClearableFieldSlotProps {
|
|
33
|
+
textField?: SlotComponentPropsFromProps<PickersTextFieldProps | TextFieldProps, {}, FieldOwnerState>;
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DesktopTimePickerProps, DesktopTimePickerSlots, DesktopTimePickerSlotProps } from '../DesktopTimePicker';
|
|
2
|
-
import { BaseSingleInputFieldProps, TimeViewWithMeridiem } from '../internals/models';
|
|
2
|
+
import { BaseSingleInputFieldProps, PickerValue, TimeViewWithMeridiem } from '../internals/models';
|
|
3
3
|
import { MobileTimePickerProps, MobileTimePickerSlots, MobileTimePickerSlotProps } from '../MobileTimePicker';
|
|
4
|
-
import {
|
|
4
|
+
import { TimeValidationError } from '../models';
|
|
5
5
|
import { ValidateTimeProps } from '../validation/validateTime';
|
|
6
6
|
export interface TimePickerSlots extends DesktopTimePickerSlots, MobileTimePickerSlots<TimeViewWithMeridiem> {
|
|
7
7
|
}
|
|
@@ -28,4 +28,4 @@ export interface TimePickerProps<TEnableAccessibleFieldDOMStructure extends bool
|
|
|
28
28
|
/**
|
|
29
29
|
* Props the field can receive when used inside a time picker (<TimePicker />, <DesktopTimePicker /> or <MobileTimePicker /> component).
|
|
30
30
|
*/
|
|
31
|
-
export type TimePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateTimeProps & BaseSingleInputFieldProps<
|
|
31
|
+
export type TimePickerFieldProps<TEnableAccessibleFieldDOMStructure extends boolean = true> = ValidateTimeProps & BaseSingleInputFieldProps<PickerValue, TEnableAccessibleFieldDOMStructure, TimeValidationError>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BaseToolbarProps, ExportedBaseToolbarProps } from '../internals/models/props/toolbar';
|
|
3
3
|
import { TimePickerToolbarClasses } from './timePickerToolbarClasses';
|
|
4
|
-
import { TimeViewWithMeridiem } from '../internals/models';
|
|
5
|
-
|
|
6
|
-
export interface TimePickerToolbarProps extends BaseToolbarProps<PickerValidDate | null, TimeViewWithMeridiem>, ExportedTimePickerToolbarProps {
|
|
4
|
+
import { PickerValue, TimeViewWithMeridiem } from '../internals/models';
|
|
5
|
+
export interface TimePickerToolbarProps extends BaseToolbarProps<PickerValue, TimeViewWithMeridiem>, ExportedTimePickerToolbarProps {
|
|
7
6
|
ampm?: boolean;
|
|
8
7
|
ampmInClock?: boolean;
|
|
9
8
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "
|
|
5
|
+
const _excluded = ["ampm", "ampmInClock", "value", "isLandscape", "onChange", "view", "onViewChange", "views", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -18,6 +18,7 @@ import { useUtils } from "../internals/hooks/useUtils.js";
|
|
|
18
18
|
import { useMeridiemMode } from "../internals/hooks/date-helpers-hooks.js";
|
|
19
19
|
import { getTimePickerToolbarUtilityClass, timePickerToolbarClasses } from "./timePickerToolbarClasses.js";
|
|
20
20
|
import { formatMeridiem } from "../internals/utils/date-utils.js";
|
|
21
|
+
import { usePickerContext } from "../hooks/index.js";
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
const useUtilityClasses = ownerState => {
|
|
23
24
|
const {
|
|
@@ -128,14 +129,16 @@ function TimePickerToolbar(inProps) {
|
|
|
128
129
|
view,
|
|
129
130
|
onViewChange,
|
|
130
131
|
views,
|
|
131
|
-
disabled,
|
|
132
|
-
readOnly,
|
|
133
132
|
className
|
|
134
133
|
} = props,
|
|
135
134
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
136
135
|
const utils = useUtils();
|
|
137
136
|
const translations = usePickerTranslations();
|
|
138
137
|
const isRtl = useRtl();
|
|
138
|
+
const {
|
|
139
|
+
disabled,
|
|
140
|
+
readOnly
|
|
141
|
+
} = usePickerContext();
|
|
139
142
|
const showAmPmControl = Boolean(ampm && !ampmInClock && views.includes('hours'));
|
|
140
143
|
const {
|
|
141
144
|
meridiemMode,
|
|
@@ -216,12 +219,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
216
219
|
*/
|
|
217
220
|
classes: PropTypes.object,
|
|
218
221
|
className: PropTypes.string,
|
|
219
|
-
/**
|
|
220
|
-
* If `true`, the component is disabled.
|
|
221
|
-
* When disabled, the value cannot be changed and no interaction is possible.
|
|
222
|
-
* @default false
|
|
223
|
-
*/
|
|
224
|
-
disabled: PropTypes.bool,
|
|
225
222
|
/**
|
|
226
223
|
* If `true`, show the toolbar even in desktop mode.
|
|
227
224
|
* @default `true` for Desktop, `false` for Mobile.
|
|
@@ -235,12 +232,6 @@ process.env.NODE_ENV !== "production" ? TimePickerToolbar.propTypes = {
|
|
|
235
232
|
* @param {TView} view The view to open
|
|
236
233
|
*/
|
|
237
234
|
onViewChange: PropTypes.func.isRequired,
|
|
238
|
-
/**
|
|
239
|
-
* If `true`, the component is read-only.
|
|
240
|
-
* When read-only, the value cannot be changed but the user can interact with the interface.
|
|
241
|
-
* @default false
|
|
242
|
-
*/
|
|
243
|
-
readOnly: PropTypes.bool,
|
|
244
235
|
/**
|
|
245
236
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
246
237
|
*/
|
package/TimePicker/shared.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
3
3
|
import { TimeClockSlots, TimeClockSlotProps } from '../TimeClock/TimeClock.types';
|
|
4
4
|
import { BasePickerInputProps } from '../internals/models/props/basePickerProps';
|
|
5
|
-
import { BaseTimeValidationProps } from '../internals/models/validation';
|
|
6
5
|
import { LocalizedComponent } from '../locales/utils/pickersLocaleTextApi';
|
|
7
6
|
import { TimePickerToolbarProps, ExportedTimePickerToolbarProps } from './TimePickerToolbar';
|
|
8
|
-
import {
|
|
7
|
+
import { TimeValidationError } from '../models';
|
|
9
8
|
import { PickerViewRendererLookup } from '../internals/hooks/usePicker/usePickerViews';
|
|
10
9
|
import { TimeViewRendererProps } from '../timeViewRenderers';
|
|
11
10
|
import { BaseClockProps, ExportedBaseClockProps } from '../internals/models/props/time';
|
|
12
|
-
import { TimeViewWithMeridiem } from '../internals/models';
|
|
11
|
+
import { PickerValue, TimeViewWithMeridiem } from '../internals/models';
|
|
12
|
+
import { ValidateTimePropsToDefault } from '../validation/validateTime';
|
|
13
13
|
export interface BaseTimePickerSlots extends TimeClockSlots {
|
|
14
14
|
/**
|
|
15
15
|
* Custom component for the toolbar rendered above the views.
|
|
@@ -20,8 +20,8 @@ export interface BaseTimePickerSlots extends TimeClockSlots {
|
|
|
20
20
|
export interface BaseTimePickerSlotProps extends TimeClockSlotProps {
|
|
21
21
|
toolbar?: ExportedTimePickerToolbarProps;
|
|
22
22
|
}
|
|
23
|
-
export type TimePickerViewRenderers<TView extends TimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<
|
|
24
|
-
export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends BasePickerInputProps<
|
|
23
|
+
export type TimePickerViewRenderers<TView extends TimeViewWithMeridiem, TAdditionalProps extends {} = {}> = PickerViewRendererLookup<PickerValue, TView, TimeViewRendererProps<TView, BaseClockProps<TView>>, TAdditionalProps>;
|
|
24
|
+
export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends BasePickerInputProps<PickerValue, TView, TimeValidationError>, ExportedBaseClockProps {
|
|
25
25
|
/**
|
|
26
26
|
* Display ampm controls under the clock (instead of in the toolbar).
|
|
27
27
|
* @default true on desktop, false on mobile
|
|
@@ -44,6 +44,6 @@ export interface BaseTimePickerProps<TView extends TimeViewWithMeridiem> extends
|
|
|
44
44
|
*/
|
|
45
45
|
viewRenderers?: Partial<TimePickerViewRenderers<TView>>;
|
|
46
46
|
}
|
|
47
|
-
type UseTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' |
|
|
47
|
+
type UseTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>> = LocalizedComponent<DefaultizedProps<Props, 'views' | 'openTo' | 'ampm' | ValidateTimePropsToDefault>>;
|
|
48
48
|
export declare function useTimePickerDefaultizedProps<TView extends TimeViewWithMeridiem, Props extends BaseTimePickerProps<TView>>(props: Props, name: string): UseTimePickerDefaultizedProps<TView, Props>;
|
|
49
49
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { UseFieldInternalProps } from '../internals/hooks/useField';
|
|
2
|
-
interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any, any
|
|
2
|
+
interface UseParsedFormatParameters extends Pick<UseFieldInternalProps<any, any, any>, 'format' | 'formatDensity' | 'shouldRespectLeadingZeros'> {
|
|
3
3
|
}
|
|
4
4
|
/**
|
|
5
5
|
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
|
|
6
|
-
* This format is localized (
|
|
6
|
+
* This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
|
|
7
7
|
* @param {object} The parameters needed to build the placeholder.
|
|
8
8
|
* @param {string} params.format Format of the date to use.
|
|
9
9
|
* @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
|
package/hooks/useParsedFormat.js
CHANGED
|
@@ -8,7 +8,7 @@ import { getLocalizedDigits } from "../internals/hooks/useField/useField.utils.j
|
|
|
8
8
|
import { usePickerTranslations } from "./usePickerTranslations.js";
|
|
9
9
|
/**
|
|
10
10
|
* Returns the parsed format to be rendered in the field when there is no value or in other parts of the Picker.
|
|
11
|
-
* This format is localized (
|
|
11
|
+
* This format is localized (for example `AAAA` for the year with the French locale) and cannot be parsed by your date library.
|
|
12
12
|
* @param {object} The parameters needed to build the placeholder.
|
|
13
13
|
* @param {string} params.format Format of the date to use.
|
|
14
14
|
* @param {'dense' | 'spacious'} params.formatDensity Density of the format (setting `formatDensity` to `"spacious"` will add a space before and after each `/`, `-` and `.` character).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FieldValueType } from '../models';
|
|
2
1
|
import { DATE_TIME_VALIDATION_PROP_NAMES, DATE_VALIDATION_PROP_NAMES, TIME_VALIDATION_PROP_NAMES } from '../validation/extractValidationProps';
|
|
2
|
+
import { PickerValueType } from '../models/common';
|
|
3
3
|
declare const SHARED_FIELD_INTERNAL_PROP_NAMES: readonly ["value", "defaultValue", "referenceDate", "format", "formatDensity", "onChange", "timezone", "onError", "shouldRespectLeadingZeros", "selectedSections", "onSelectedSectionsChange", "unstableFieldRef", "enableAccessibleFieldDOMStructure", "disabled", "readOnly", "dateSeparator"];
|
|
4
|
-
type InternalPropNames<TValueType extends
|
|
4
|
+
type InternalPropNames<TValueType extends PickerValueType> = (typeof SHARED_FIELD_INTERNAL_PROP_NAMES)[number] | (TValueType extends 'date' | 'date-time' ? (typeof DATE_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'time' | 'date-time' ? (typeof TIME_VALIDATION_PROP_NAMES)[number] : never) | (TValueType extends 'date-time' ? (typeof DATE_TIME_VALIDATION_PROP_NAMES)[number] : never);
|
|
5
5
|
/**
|
|
6
6
|
* Split the props received by the field component into:
|
|
7
7
|
* - `internalProps` which are used by the various hooks called by the field component.
|
|
@@ -12,7 +12,7 @@ type InternalPropNames<TValueType extends FieldValueType> = (typeof SHARED_FIELD
|
|
|
12
12
|
* @param {TProps} props The props received by the field component.
|
|
13
13
|
* @param {TValueType} valueType The type of the field value ('date', 'time', or 'date-time').
|
|
14
14
|
*/
|
|
15
|
-
export declare const useSplitFieldProps: <TValueType extends
|
|
15
|
+
export declare const useSplitFieldProps: <TValueType extends PickerValueType, TProps extends { [key in InternalPropNames<TValueType>]?: any; }>(props: TProps, valueType: TValueType) => {
|
|
16
16
|
forwardedProps: Omit<TProps, InternalPropNames<TValueType>>;
|
|
17
17
|
internalProps: Pick<TProps, InternalPropNames<TValueType>>;
|
|
18
18
|
};
|
package/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PickerOwnerState } from '../../models';
|
|
3
3
|
import { PickersInputLocaleText } from '../../locales';
|
|
4
|
+
import { PickerOrientation, PickerVariant } from '../models';
|
|
4
5
|
export declare const PickerContext: React.Context<PickerContextValue | null>;
|
|
5
6
|
export declare const PickerPrivateContext: React.Context<PickerPrivateContextValue>;
|
|
6
7
|
/**
|
|
@@ -32,6 +33,31 @@ export interface PickerContextValue {
|
|
|
32
33
|
* `true` if the picker is open, `false` otherwise.
|
|
33
34
|
*/
|
|
34
35
|
open: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* `true` if the picker is disabled, `false` otherwise.
|
|
38
|
+
*/
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* `true` if the picker is read-only, `false` otherwise.
|
|
42
|
+
*/
|
|
43
|
+
readOnly: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The responsive variant of the picker.
|
|
46
|
+
* Is equal to "desktop" when using a desktop picker (like <DesktopDatePicker />).
|
|
47
|
+
* Is equal to "mobile" when using a mobile picker (like <MobileDatePicker />).
|
|
48
|
+
* Is equal to "mobile" or "desktop" when using a responsive picker (like <DatePicker />) depending on the `desktopModeMediaQuery` prop.
|
|
49
|
+
* Is equal to "mobile" or "desktop" when using a static picker (like <StaticDatePicker />) depending on the `displayStaticWrapperAs` prop.
|
|
50
|
+
* Is always equal to "desktop" if the component you are accessing the ownerState from is not wrapped by a picker.
|
|
51
|
+
*/
|
|
52
|
+
variant: PickerVariant;
|
|
53
|
+
/**
|
|
54
|
+
* The orientation of the picker.
|
|
55
|
+
* Is equal to "landscape" when the picker is in landscape orientation.
|
|
56
|
+
* Is equal to "portrait" when the picker is in portrait orientation.
|
|
57
|
+
* You can use the "orientation" on any picker component to force the orientation.
|
|
58
|
+
* Is always equal to "portrait" if the component you are accessing the ownerState from is not wrapped by a picker.
|
|
59
|
+
*/
|
|
60
|
+
orientation: PickerOrientation;
|
|
35
61
|
}
|
|
36
62
|
export interface PickerPrivateContextValue {
|
|
37
63
|
/**
|
|
@@ -7,7 +7,9 @@ export const PickerPrivateContext = /*#__PURE__*/React.createContext({
|
|
|
7
7
|
isPickerDisabled: false,
|
|
8
8
|
isPickerReadOnly: false,
|
|
9
9
|
isPickerValueEmpty: false,
|
|
10
|
-
isPickerOpen: false
|
|
10
|
+
isPickerOpen: false,
|
|
11
|
+
pickerVariant: 'desktop',
|
|
12
|
+
pickerOrientation: 'portrait'
|
|
11
13
|
}
|
|
12
14
|
});
|
|
13
15
|
|
|
@@ -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 = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId"],
|
|
3
|
+
const _excluded = ["children", "className", "slots", "slotProps", "isNextDisabled", "isNextHidden", "onGoToNext", "nextLabel", "isPreviousDisabled", "isPreviousHidden", "onGoToPrevious", "previousLabel", "labelId", "classes"],
|
|
4
4
|
_excluded2 = ["ownerState"],
|
|
5
5
|
_excluded3 = ["ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
@@ -13,6 +13,7 @@ import useSlotProps from '@mui/utils/useSlotProps';
|
|
|
13
13
|
import IconButton from '@mui/material/IconButton';
|
|
14
14
|
import { ArrowLeftIcon, ArrowRightIcon } from "../../../icons/index.js";
|
|
15
15
|
import { getPickersArrowSwitcherUtilityClass } from "./pickersArrowSwitcherClasses.js";
|
|
16
|
+
import { usePickerPrivateContext } from "../../hooks/usePickerPrivateContext.js";
|
|
16
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
const PickersArrowSwitcherRoot = styled('div', {
|
|
18
19
|
name: 'MuiPickersArrowSwitcher',
|
|
@@ -44,10 +45,7 @@ const PickersArrowSwitcherButton = styled(IconButton, {
|
|
|
44
45
|
}
|
|
45
46
|
}]
|
|
46
47
|
});
|
|
47
|
-
const useUtilityClasses =
|
|
48
|
-
const {
|
|
49
|
-
classes
|
|
50
|
-
} = ownerState;
|
|
48
|
+
const useUtilityClasses = classes => {
|
|
51
49
|
const slots = {
|
|
52
50
|
root: ['root'],
|
|
53
51
|
spacer: ['spacer'],
|
|
@@ -78,11 +76,14 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
78
76
|
isPreviousHidden,
|
|
79
77
|
onGoToPrevious,
|
|
80
78
|
previousLabel,
|
|
81
|
-
labelId
|
|
79
|
+
labelId,
|
|
80
|
+
classes: classesProp
|
|
82
81
|
} = props,
|
|
83
82
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
84
|
-
const
|
|
85
|
-
|
|
83
|
+
const {
|
|
84
|
+
ownerState
|
|
85
|
+
} = usePickerPrivateContext();
|
|
86
|
+
const classes = useUtilityClasses(classesProp);
|
|
86
87
|
const nextProps = {
|
|
87
88
|
isDisabled: isNextDisabled,
|
|
88
89
|
isHidden: isNextHidden,
|
|
@@ -108,7 +109,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
108
109
|
onClick: previousProps.goTo
|
|
109
110
|
},
|
|
110
111
|
ownerState: _extends({}, ownerState, {
|
|
111
|
-
hidden: previousProps.isHidden
|
|
112
|
+
hidden: previousProps.isHidden ?? false
|
|
112
113
|
}),
|
|
113
114
|
className: clsx(classes.button, classes.previousIconButton)
|
|
114
115
|
});
|
|
@@ -125,7 +126,7 @@ export const PickersArrowSwitcher = /*#__PURE__*/React.forwardRef(function Picke
|
|
|
125
126
|
onClick: nextProps.goTo
|
|
126
127
|
},
|
|
127
128
|
ownerState: _extends({}, ownerState, {
|
|
128
|
-
hidden: nextProps.isHidden
|
|
129
|
+
hidden: nextProps.isHidden ?? false
|
|
129
130
|
}),
|
|
130
131
|
className: clsx(classes.button, classes.nextIconButton)
|
|
131
132
|
});
|
|
@@ -3,6 +3,7 @@ import { SlotComponentProps } from '@mui/utils';
|
|
|
3
3
|
import IconButton from '@mui/material/IconButton';
|
|
4
4
|
import SvgIcon from '@mui/material/SvgIcon';
|
|
5
5
|
import { PickersArrowSwitcherClasses } from './pickersArrowSwitcherClasses';
|
|
6
|
+
import { PickerOwnerState } from '../../../models';
|
|
6
7
|
export interface ExportedPickersArrowSwitcherProps {
|
|
7
8
|
/**
|
|
8
9
|
* Overridable component slots.
|
|
@@ -36,7 +37,12 @@ export interface PickersArrowSwitcherProps extends ExportedPickersArrowSwitcherP
|
|
|
36
37
|
nextLabel: string;
|
|
37
38
|
labelId?: string;
|
|
38
39
|
}
|
|
39
|
-
export
|
|
40
|
+
export interface PickersArrowSwitcherOwnerState extends PickerOwnerState {
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, this button should be hidden.
|
|
43
|
+
*/
|
|
44
|
+
hidden: boolean;
|
|
45
|
+
}
|
|
40
46
|
export interface PickersArrowSwitcherSlotPropsOverrides {
|
|
41
47
|
}
|
|
42
48
|
export interface PickersArrowSwitcherSlots {
|
|
@@ -61,12 +67,9 @@ export interface PickersArrowSwitcherSlots {
|
|
|
61
67
|
*/
|
|
62
68
|
rightArrowIcon?: React.ElementType;
|
|
63
69
|
}
|
|
64
|
-
export interface PickersArrowSwitcherButtonSlotOwnerState extends PickersArrowSwitcherOwnerState {
|
|
65
|
-
hidden?: boolean;
|
|
66
|
-
}
|
|
67
70
|
export interface PickersArrowSwitcherSlotProps {
|
|
68
|
-
previousIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides,
|
|
69
|
-
nextIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides,
|
|
70
|
-
leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides,
|
|
71
|
-
rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides,
|
|
71
|
+
previousIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherOwnerState>;
|
|
72
|
+
nextIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherOwnerState>;
|
|
73
|
+
leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickerOwnerState>;
|
|
74
|
+
rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, PickerOwnerState>;
|
|
72
75
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { BaseToolbarProps } from '../models/props/toolbar';
|
|
3
3
|
import { PickersToolbarClasses } from './pickersToolbarClasses';
|
|
4
|
-
import { DateOrTimeViewWithMeridiem } from '../models';
|
|
5
|
-
export interface PickersToolbarProps<TValue, TView extends DateOrTimeViewWithMeridiem> extends Pick<BaseToolbarProps<TValue, TView>, 'isLandscape' | 'hidden' | 'titleId'> {
|
|
4
|
+
import { DateOrTimeViewWithMeridiem, PickerValidValue } from '../models';
|
|
5
|
+
export interface PickersToolbarProps<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem> extends Pick<BaseToolbarProps<TValue, TView>, 'isLandscape' | 'hidden' | 'titleId'> {
|
|
6
6
|
className?: string;
|
|
7
7
|
landscapeDirection?: 'row' | 'column';
|
|
8
8
|
toolbarTitle: React.ReactNode;
|
|
9
9
|
classes?: Partial<PickersToolbarClasses>;
|
|
10
10
|
}
|
|
11
|
-
type PickersToolbarComponent = (<TValue, TView extends DateOrTimeViewWithMeridiem>(props: React.PropsWithChildren<PickersToolbarProps<TValue, TView>> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
11
|
+
type PickersToolbarComponent = (<TValue extends PickerValidValue, TView extends DateOrTimeViewWithMeridiem>(props: React.PropsWithChildren<PickersToolbarProps<TValue, TView>> & React.RefAttributes<HTMLDivElement>) => React.JSX.Element) & {
|
|
12
12
|
propTypes?: any;
|
|
13
13
|
};
|
|
14
14
|
export declare const PickersToolbar: PickersToolbarComponent;
|
|
@@ -10,13 +10,11 @@ import { getPickersToolbarUtilityClass } from "./pickersToolbarClasses.js";
|
|
|
10
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
11
|
const useUtilityClasses = ownerState => {
|
|
12
12
|
const {
|
|
13
|
-
classes
|
|
14
|
-
isLandscape
|
|
13
|
+
classes
|
|
15
14
|
} = ownerState;
|
|
16
15
|
const slots = {
|
|
17
16
|
root: ['root'],
|
|
18
|
-
content: ['content']
|
|
19
|
-
penIconButton: ['penIconButton', isLandscape && 'penIconButtonLandscape']
|
|
17
|
+
content: ['content']
|
|
20
18
|
};
|
|
21
19
|
return composeClasses(slots, getPickersToolbarUtilityClass, classes);
|
|
22
20
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MuiPickersAdapter, PickersTimezone, PickerValidDate } from '../../models';
|
|
2
|
+
import { PickerValue } from '../models';
|
|
2
3
|
export declare const useClockReferenceDate: <TProps extends {}>({ value, referenceDate: referenceDateProp, utils, props, timezone, }: {
|
|
3
|
-
value:
|
|
4
|
+
value: PickerValue;
|
|
4
5
|
referenceDate: PickerValidDate | undefined;
|
|
5
6
|
utils: MuiPickersAdapter;
|
|
6
7
|
props: TProps;
|
|
@@ -67,7 +67,7 @@ export const useDesktopPicker = _ref => {
|
|
|
67
67
|
localeText,
|
|
68
68
|
autoFocusView: true,
|
|
69
69
|
additionalViewProps: {},
|
|
70
|
-
|
|
70
|
+
variant: 'desktop'
|
|
71
71
|
}));
|
|
72
72
|
const InputAdornment = slots.inputAdornment ?? MuiInputAdornment;
|
|
73
73
|
const _useSlotProps = useSlotProps({
|