@mui/x-date-pickers 7.0.0-alpha.4 → 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/CHANGELOG.md +122 -0
- package/DateCalendar/DateCalendar.types.d.ts +6 -6
- package/DateCalendar/DayCalendar.d.ts +4 -4
- package/DateCalendar/index.d.ts +1 -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/MultiSectionDigitalClock/MultiSectionDigitalClock.types.d.ts +4 -4
- package/MultiSectionDigitalClock/MultiSectionDigitalClockSection.d.ts +3 -3
- package/MultiSectionDigitalClock/index.d.ts +1 -1
- 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/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/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/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 -4
- 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/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/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/StaticDatePicker/StaticDatePicker.js +1 -1
- package/legacy/TimeField/TimeField.js +19 -47
- package/legacy/TimeField/useTimeField.js +1 -4
- package/legacy/TimePicker/TimePicker.js +5 -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/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/legacy/internals/hooks/useField/useField.js +4 -4
- package/legacy/internals/hooks/useField/useField.utils.js +26 -4
- package/legacy/internals/hooks/useField/useFieldState.js +7 -3
- package/legacy/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/legacy/internals/index.js +1 -0
- package/legacy/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +24 -0
- package/models/fields.d.ts +2 -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/StaticDatePicker/StaticDatePicker.js +1 -1
- package/modern/TimeField/TimeField.js +17 -50
- package/modern/TimeField/useTimeField.js +1 -5
- package/modern/TimePicker/TimePicker.js +5 -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/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/modern/internals/hooks/useField/useField.js +3 -3
- package/modern/internals/hooks/useField/useField.utils.js +24 -4
- package/modern/internals/hooks/useField/useFieldState.js +7 -3
- package/modern/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/modern/internals/index.js +1 -0
- package/modern/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +26 -0
- 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/StaticDatePicker/StaticDatePicker.js +2 -2
- package/node/TimeField/TimeField.js +18 -51
- package/node/TimeField/useTimeField.js +1 -5
- package/node/TimePicker/TimePicker.js +5 -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/hooks/useDesktopPicker/useDesktopPicker.js +2 -0
- package/node/internals/hooks/useField/useField.js +3 -3
- package/node/internals/hooks/useField/useField.utils.js +24 -4
- package/node/internals/hooks/useField/useFieldState.js +7 -3
- package/node/internals/hooks/useMobilePicker/useMobilePicker.js +3 -1
- package/node/internals/index.js +7 -0
- package/node/internals/utils/convertFieldResponseIntoMuiTextFieldProps.js +34 -0
- package/package.json +2 -2
- package/themeAugmentation/overrides.d.ts +5 -7
- package/themeAugmentation/props.d.ts +6 -8
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["
|
|
3
|
+
const _excluded = ["clearable", "onClear", "InputProps", "sx", "slots", "slotProps"],
|
|
4
|
+
_excluded2 = ["ownerState"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { useSlotProps } from '@mui/base/utils';
|
|
6
7
|
import MuiIconButton from '@mui/material/IconButton';
|
|
7
8
|
import InputAdornment from '@mui/material/InputAdornment';
|
|
8
9
|
import { ClearIcon } from '../icons';
|
|
9
|
-
import { useLocaleText } from '../internals';
|
|
10
|
+
import { useLocaleText } from '../internals/hooks/useUtils';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
-
export const useClearableField =
|
|
13
|
-
clearable,
|
|
14
|
-
fieldProps: forwardedFieldProps,
|
|
15
|
-
InputProps: ForwardedInputProps,
|
|
16
|
-
onClear,
|
|
17
|
-
slots,
|
|
18
|
-
slotProps
|
|
19
|
-
}) => {
|
|
13
|
+
export const useClearableField = props => {
|
|
20
14
|
var _slots$clearButton, _slots$clearIcon;
|
|
21
15
|
const localeText = useLocaleText();
|
|
16
|
+
const {
|
|
17
|
+
clearable,
|
|
18
|
+
onClear,
|
|
19
|
+
InputProps,
|
|
20
|
+
sx,
|
|
21
|
+
slots,
|
|
22
|
+
slotProps
|
|
23
|
+
} = props,
|
|
24
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
25
|
const IconButton = (_slots$clearButton = slots == null ? void 0 : slots.clearButton) != null ? _slots$clearButton : MuiIconButton;
|
|
23
26
|
// The spread is here to avoid this bug mui/material-ui#34056
|
|
24
27
|
const _useSlotProps = useSlotProps({
|
|
@@ -30,30 +33,30 @@ export const useClearableField = ({
|
|
|
30
33
|
title: localeText.fieldClearLabel
|
|
31
34
|
}
|
|
32
35
|
}),
|
|
33
|
-
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps,
|
|
36
|
+
iconButtonProps = _objectWithoutPropertiesLoose(_useSlotProps, _excluded2);
|
|
34
37
|
const EndClearIcon = (_slots$clearIcon = slots == null ? void 0 : slots.clearIcon) != null ? _slots$clearIcon : ClearIcon;
|
|
35
38
|
const endClearIconProps = useSlotProps({
|
|
36
39
|
elementType: EndClearIcon,
|
|
37
40
|
externalSlotProps: slotProps == null ? void 0 : slotProps.clearIcon,
|
|
38
41
|
ownerState: {}
|
|
39
42
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
return _extends({}, other, {
|
|
44
|
+
InputProps: _extends({}, InputProps, {
|
|
45
|
+
endAdornment: clearable ? /*#__PURE__*/_jsxs(React.Fragment, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(InputAdornment, {
|
|
47
|
+
position: "end",
|
|
48
|
+
sx: {
|
|
49
|
+
marginRight: InputProps != null && InputProps.endAdornment ? -1 : -1.5
|
|
50
|
+
},
|
|
51
|
+
children: /*#__PURE__*/_jsx(IconButton, _extends({}, iconButtonProps, {
|
|
52
|
+
onClick: onClear,
|
|
53
|
+
children: /*#__PURE__*/_jsx(EndClearIcon, _extends({
|
|
54
|
+
fontSize: "small"
|
|
55
|
+
}, endClearIconProps))
|
|
56
|
+
}))
|
|
57
|
+
}), InputProps == null ? void 0 : InputProps.endAdornment]
|
|
58
|
+
}) : InputProps == null ? void 0 : InputProps.endAdornment
|
|
59
|
+
}),
|
|
57
60
|
sx: [{
|
|
58
61
|
'& .clearButton': {
|
|
59
62
|
opacity: 1
|
|
@@ -68,10 +71,6 @@ export const useClearableField = ({
|
|
|
68
71
|
}
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
|
-
}, ...(Array.isArray(
|
|
74
|
+
}, ...(Array.isArray(sx) ? sx : [sx])]
|
|
72
75
|
});
|
|
73
|
-
return {
|
|
74
|
-
InputProps,
|
|
75
|
-
fieldProps
|
|
76
|
-
};
|
|
77
76
|
};
|
package/index.js
CHANGED
|
@@ -8,12 +8,12 @@ export interface ExportedPickersArrowSwitcherProps {
|
|
|
8
8
|
* Overridable component slots.
|
|
9
9
|
* @default {}
|
|
10
10
|
*/
|
|
11
|
-
slots?:
|
|
11
|
+
slots?: PickersArrowSwitcherSlots;
|
|
12
12
|
/**
|
|
13
13
|
* The props used for each component slot.
|
|
14
14
|
* @default {}
|
|
15
15
|
*/
|
|
16
|
-
slotProps?:
|
|
16
|
+
slotProps?: PickersArrowSwitcherSlotProps;
|
|
17
17
|
classes?: Partial<PickersArrowSwitcherClasses>;
|
|
18
18
|
/**
|
|
19
19
|
* Format used to display the date.
|
|
@@ -33,9 +33,9 @@ export interface PickersArrowSwitcherProps extends ExportedPickersArrowSwitcherP
|
|
|
33
33
|
nextLabel: string;
|
|
34
34
|
}
|
|
35
35
|
export type PickersArrowSwitcherOwnerState = PickersArrowSwitcherProps;
|
|
36
|
-
export interface
|
|
36
|
+
export interface PickersArrowSwitcherSlotPropsOverrides {
|
|
37
37
|
}
|
|
38
|
-
export interface
|
|
38
|
+
export interface PickersArrowSwitcherSlots {
|
|
39
39
|
/**
|
|
40
40
|
* Button allowing to switch to the left view.
|
|
41
41
|
* @default IconButton
|
|
@@ -60,9 +60,9 @@ export interface PickersArrowSwitcherSlotsComponent {
|
|
|
60
60
|
export interface PickersArrowSwitcherButtonSlotOwnerState extends PickersArrowSwitcherOwnerState {
|
|
61
61
|
hidden?: boolean;
|
|
62
62
|
}
|
|
63
|
-
export interface
|
|
64
|
-
previousIconButton?: SlotComponentProps<typeof IconButton,
|
|
65
|
-
nextIconButton?: SlotComponentProps<typeof IconButton,
|
|
66
|
-
leftArrowIcon?: SlotComponentProps<typeof SvgIcon,
|
|
67
|
-
rightArrowIcon?: SlotComponentProps<typeof SvgIcon,
|
|
63
|
+
export interface PickersArrowSwitcherSlotProps {
|
|
64
|
+
previousIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
|
|
65
|
+
nextIconButton?: SlotComponentProps<typeof IconButton, PickersArrowSwitcherSlotPropsOverrides, PickersArrowSwitcherButtonSlotOwnerState>;
|
|
66
|
+
leftArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, undefined>;
|
|
67
|
+
rightArrowIcon?: SlotComponentProps<typeof SvgIcon, PickersArrowSwitcherSlotPropsOverrides, undefined>;
|
|
68
68
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { PickersArrowSwitcher } from './PickersArrowSwitcher';
|
|
2
|
-
export type {
|
|
2
|
+
export type { PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, ExportedPickersArrowSwitcherProps, } from './PickersArrowSwitcher.types';
|
|
3
|
+
export { pickersArrowSwitcherClasses, getPickersArrowSwitcherUtilityClass, } from './pickersArrowSwitcherClasses';
|
|
4
|
+
export type { PickersArrowSwitcherClassKey, PickersArrowSwitcherClasses, } from './pickersArrowSwitcherClasses';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { PickersArrowSwitcher } from './PickersArrowSwitcher';
|
|
1
|
+
export { PickersArrowSwitcher } from './PickersArrowSwitcher';
|
|
2
|
+
export { pickersArrowSwitcherClasses, getPickersArrowSwitcherUtilityClass } from './pickersArrowSwitcherClasses';
|
|
@@ -3,7 +3,7 @@ import { DialogProps as MuiDialogProps } from '@mui/material/Dialog';
|
|
|
3
3
|
import { PaperProps as MuiPaperProps } from '@mui/material/Paper/Paper';
|
|
4
4
|
import { TransitionProps as MuiTransitionProps } from '@mui/material/transitions/transition';
|
|
5
5
|
import { UsePickerValueActions } from '../hooks/usePicker/usePickerValue.types';
|
|
6
|
-
export interface
|
|
6
|
+
export interface PickersModalDialogSlots {
|
|
7
7
|
/**
|
|
8
8
|
* Custom component for the dialog inside which the views are rendered on mobile.
|
|
9
9
|
* @default PickersModalDialogRoot
|
|
@@ -20,7 +20,7 @@ export interface PickersModalDialogSlotsComponent {
|
|
|
20
20
|
*/
|
|
21
21
|
mobileTransition?: React.JSXElementConstructor<MuiTransitionProps>;
|
|
22
22
|
}
|
|
23
|
-
export interface
|
|
23
|
+
export interface PickersModalDialogSlotProps {
|
|
24
24
|
/**
|
|
25
25
|
* Props passed down to the [`Dialog`](https://mui.com/material-ui/api/dialog/) component.
|
|
26
26
|
*/
|
|
@@ -39,12 +39,12 @@ export interface PickersModalDialogProps extends UsePickerValueActions {
|
|
|
39
39
|
* Overridable component slots.
|
|
40
40
|
* @default {}
|
|
41
41
|
*/
|
|
42
|
-
slots?:
|
|
42
|
+
slots?: PickersModalDialogSlots;
|
|
43
43
|
/**
|
|
44
44
|
* The props used for each component slot.
|
|
45
45
|
* @default {}
|
|
46
46
|
*/
|
|
47
|
-
slotProps?:
|
|
47
|
+
slotProps?: PickersModalDialogSlotProps;
|
|
48
48
|
open: boolean;
|
|
49
49
|
}
|
|
50
50
|
export declare function PickersModalDialog(props: React.PropsWithChildren<PickersModalDialogProps>): React.JSX.Element;
|
|
@@ -9,7 +9,7 @@ import { UsePickerValueActions } from '../hooks/usePicker/usePickerValue.types';
|
|
|
9
9
|
interface PickersPopperOwnerState extends PickerPopperProps {
|
|
10
10
|
placement: PopperPlacementType;
|
|
11
11
|
}
|
|
12
|
-
export interface
|
|
12
|
+
export interface PickersPopperSlots {
|
|
13
13
|
/**
|
|
14
14
|
* Custom component for the paper rendered inside the desktop picker's Popper.
|
|
15
15
|
* @default PickersPopperPaper
|
|
@@ -31,7 +31,7 @@ export interface PickersPopperSlotsComponent {
|
|
|
31
31
|
*/
|
|
32
32
|
popper?: React.ElementType<MuiPopperProps>;
|
|
33
33
|
}
|
|
34
|
-
export interface
|
|
34
|
+
export interface PickersPopperSlotProps {
|
|
35
35
|
/**
|
|
36
36
|
* Props passed down to the desktop [Paper](https://mui.com/material-ui/api/paper/) component.
|
|
37
37
|
*/
|
|
@@ -57,8 +57,8 @@ export interface PickerPopperProps extends UsePickerValueActions {
|
|
|
57
57
|
containerRef?: React.Ref<HTMLDivElement>;
|
|
58
58
|
children?: React.ReactNode;
|
|
59
59
|
onBlur?: () => void;
|
|
60
|
-
slots?:
|
|
61
|
-
slotProps?:
|
|
60
|
+
slots?: PickersPopperSlots;
|
|
61
|
+
slotProps?: PickersPopperSlotProps;
|
|
62
62
|
classes?: Partial<PickersPopperClasses>;
|
|
63
63
|
shouldRestoreFocus?: () => boolean;
|
|
64
64
|
reduceAnimations?: boolean;
|
|
@@ -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 {};
|
|
@@ -192,7 +192,7 @@ export const addPositionPropertiesToSections = (sections, isRTL) => {
|
|
|
192
192
|
|
|
193
193
|
// The ...InInput values consider the unicode characters but do include them in their indexes
|
|
194
194
|
const cleanedValue = cleanString(renderedValue);
|
|
195
|
-
const startInInput = positionInInput + renderedValue.indexOf(cleanedValue[0]) + section.startSeparator.length;
|
|
195
|
+
const startInInput = positionInInput + (cleanedValue === '' ? 0 : renderedValue.indexOf(cleanedValue[0])) + section.startSeparator.length;
|
|
196
196
|
const endInInput = startInInput + cleanedValue.length;
|
|
197
197
|
newSections.push(_extends({}, section, {
|
|
198
198
|
start: position,
|
|
@@ -425,6 +425,21 @@ export const splitFormatIntoSections = (utils, timezone, localeText, format, dat
|
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
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
|
+
}
|
|
428
443
|
return sections.map(section => {
|
|
429
444
|
const cleanSeparator = separator => {
|
|
430
445
|
let cleanedSeparator = separator;
|
|
@@ -566,6 +581,10 @@ export const getSectionsBoundaries = (utils, timezone) => {
|
|
|
566
581
|
meridiem: () => ({
|
|
567
582
|
minimum: 0,
|
|
568
583
|
maximum: 0
|
|
584
|
+
}),
|
|
585
|
+
empty: () => ({
|
|
586
|
+
minimum: 0,
|
|
587
|
+
maximum: 0
|
|
569
588
|
})
|
|
570
589
|
};
|
|
571
590
|
};
|
|
@@ -573,7 +592,7 @@ let warnedOnceInvalidSection = false;
|
|
|
573
592
|
export const validateSections = (sections, valueType) => {
|
|
574
593
|
if (process.env.NODE_ENV !== 'production') {
|
|
575
594
|
if (!warnedOnceInvalidSection) {
|
|
576
|
-
const supportedSections = [];
|
|
595
|
+
const supportedSections = ['empty'];
|
|
577
596
|
if (['date', 'date-time'].includes(valueType)) {
|
|
578
597
|
supportedSections.push('weekDay', 'day', 'month', 'year');
|
|
579
598
|
}
|
|
@@ -582,7 +601,7 @@ export const validateSections = (sections, valueType) => {
|
|
|
582
601
|
}
|
|
583
602
|
const invalidSection = sections.find(section => !supportedSections.includes(section.type));
|
|
584
603
|
if (invalidSection) {
|
|
585
|
-
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('", "')}"]\`.`);
|
|
586
605
|
warnedOnceInvalidSection = true;
|
|
587
606
|
}
|
|
588
607
|
}
|
|
@@ -649,7 +668,8 @@ const reliableSectionModificationOrder = {
|
|
|
649
668
|
hours: 5,
|
|
650
669
|
minutes: 6,
|
|
651
670
|
seconds: 7,
|
|
652
|
-
meridiem: 8
|
|
671
|
+
meridiem: 8,
|
|
672
|
+
empty: 9
|
|
653
673
|
};
|
|
654
674
|
export const mergeDateIntoReferenceDate = (utils, timezone, dateToTransferFrom, sections, referenceDate, shouldLimitToEditedSections) =>
|
|
655
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;
|