@mui/x-date-pickers-pro 8.0.0-beta.0 → 8.0.0-beta.1
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 +77 -0
- package/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
- package/DateRangePicker/DateRangePicker.js +3 -1
- package/DateRangePickerDay/DateRangePickerDay.d.ts +1 -41
- package/DateRangePickerDay/DateRangePickerDay.js +88 -56
- package/DateRangePickerDay/DateRangePickerDay.types.d.ts +91 -0
- package/DateRangePickerDay/DateRangePickerDay.types.js +5 -0
- package/DateRangePickerDay/index.d.ts +1 -1
- package/DateTimeRangePicker/DateTimeRangePicker.js +3 -1
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -0
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +1 -0
- package/DesktopTimeRangePicker/DesktopTimeRangePicker.js +1 -0
- package/MobileDateRangePicker/MobileDateRangePicker.js +1 -0
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +1 -0
- package/MobileTimeRangePicker/MobileTimeRangePicker.js +1 -0
- package/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/SingleInputDateRangeField/useSingleInputDateRangeField.js +2 -16
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +2 -16
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +2 -16
- package/TimeRangePicker/TimeRangePicker.js +3 -1
- package/esm/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
- package/esm/DateRangePicker/DateRangePicker.js +3 -1
- package/esm/DateRangePickerDay/DateRangePickerDay.d.ts +1 -41
- package/esm/DateRangePickerDay/DateRangePickerDay.js +89 -57
- package/esm/DateRangePickerDay/DateRangePickerDay.types.d.ts +91 -0
- package/esm/DateRangePickerDay/DateRangePickerDay.types.js +1 -0
- package/esm/DateRangePickerDay/index.d.ts +1 -1
- package/esm/DateTimeRangePicker/DateTimeRangePicker.js +3 -1
- package/esm/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -0
- package/esm/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +1 -0
- package/esm/DesktopTimeRangePicker/DesktopTimeRangePicker.js +1 -0
- package/esm/MobileDateRangePicker/MobileDateRangePicker.js +1 -0
- package/esm/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +1 -0
- package/esm/MobileTimeRangePicker/MobileTimeRangePicker.js +1 -0
- package/esm/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/esm/SingleInputDateRangeField/useSingleInputDateRangeField.js +3 -17
- package/esm/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/esm/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +3 -17
- package/esm/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/esm/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +3 -17
- package/esm/TimeRangePicker/TimeRangePicker.js +3 -1
- package/esm/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +2 -2
- package/esm/hooks/useMultiInputRangeField/useTextFieldProps.js +4 -16
- package/esm/index.js +1 -1
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/managers/useDateRangeManager.js +3 -3
- package/esm/managers/useDateTimeRangeManager.js +3 -3
- package/esm/managers/useTimeRangeManager.js +3 -3
- package/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +2 -2
- package/hooks/useMultiInputRangeField/useTextFieldProps.js +3 -15
- package/index.js +1 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/managers/useDateRangeManager.js +3 -3
- package/managers/useDateTimeRangeManager.js +3 -3
- package/managers/useTimeRangeManager.js +3 -3
- package/modern/DateRangeCalendar/DateRangeCalendar.types.d.ts +1 -1
- package/modern/DateRangePicker/DateRangePicker.js +3 -1
- package/modern/DateRangePickerDay/DateRangePickerDay.d.ts +1 -41
- package/modern/DateRangePickerDay/DateRangePickerDay.js +89 -57
- package/modern/DateRangePickerDay/DateRangePickerDay.types.d.ts +91 -0
- package/modern/DateRangePickerDay/DateRangePickerDay.types.js +1 -0
- package/modern/DateRangePickerDay/index.d.ts +1 -1
- package/modern/DateTimeRangePicker/DateTimeRangePicker.js +3 -1
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +1 -0
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +1 -0
- package/modern/DesktopTimeRangePicker/DesktopTimeRangePicker.js +1 -0
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +1 -0
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +1 -0
- package/modern/MobileTimeRangePicker/MobileTimeRangePicker.js +1 -0
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.d.ts +1 -1
- package/modern/SingleInputDateRangeField/useSingleInputDateRangeField.js +3 -17
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.d.ts +1 -1
- package/modern/SingleInputDateTimeRangeField/useSingleInputDateTimeRangeField.js +3 -17
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.d.ts +1 -1
- package/modern/SingleInputTimeRangeField/useSingleInputTimeRangeField.js +3 -17
- package/modern/TimeRangePicker/TimeRangePicker.js +3 -1
- package/modern/hooks/useMultiInputRangeField/useMultiInputRangeField.d.ts +2 -2
- package/modern/hooks/useMultiInputRangeField/useTextFieldProps.js +4 -16
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/managers/useDateRangeManager.js +3 -3
- package/modern/managers/useDateTimeRangeManager.js +3 -3
- package/modern/managers/useTimeRangeManager.js +3 -3
- package/package.json +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -6,26 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useSingleInputDateTimeRangeField = void 0;
|
|
8
8
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
9
|
-
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
10
9
|
var _managers = require("../managers");
|
|
11
10
|
const useSingleInputDateTimeRangeField = props => {
|
|
12
11
|
const manager = (0, _managers.useDateTimeRangeManager)(props);
|
|
13
|
-
const {
|
|
14
|
-
forwardedProps,
|
|
15
|
-
internalProps
|
|
16
|
-
} = (0, _hooks.useSplitFieldProps)(props, 'date-time');
|
|
17
|
-
const internalPropsWithDefaults = (0, _internals.useFieldInternalPropsWithDefaults)({
|
|
18
|
-
manager,
|
|
19
|
-
internalProps
|
|
20
|
-
});
|
|
21
12
|
return (0, _internals.useField)({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
valueManager: manager.internal_valueManager,
|
|
25
|
-
fieldValueManager: manager.internal_fieldValueManager,
|
|
26
|
-
validator: manager.validator,
|
|
27
|
-
valueType: manager.valueType,
|
|
28
|
-
getOpenPickerButtonAriaLabel: manager.internal_useOpenPickerButtonAriaLabel()
|
|
13
|
+
manager,
|
|
14
|
+
props
|
|
29
15
|
});
|
|
30
16
|
};
|
|
31
17
|
exports.useSingleInputDateTimeRangeField = useSingleInputDateTimeRangeField;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseSingleInputTimeRangeFieldProps } from "./SingleInputTimeRangeField.types.js";
|
|
2
|
-
export declare const useSingleInputTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean,
|
|
2
|
+
export declare const useSingleInputTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseSingleInputTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TProps) => import("@mui/x-date-pickers/internals").UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, TProps>;
|
|
@@ -6,26 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useSingleInputTimeRangeField = void 0;
|
|
8
8
|
var _internals = require("@mui/x-date-pickers/internals");
|
|
9
|
-
var _hooks = require("@mui/x-date-pickers/hooks");
|
|
10
9
|
var _managers = require("../managers");
|
|
11
10
|
const useSingleInputTimeRangeField = props => {
|
|
12
11
|
const manager = (0, _managers.useTimeRangeManager)(props);
|
|
13
|
-
const {
|
|
14
|
-
forwardedProps,
|
|
15
|
-
internalProps
|
|
16
|
-
} = (0, _hooks.useSplitFieldProps)(props, 'time');
|
|
17
|
-
const internalPropsWithDefaults = (0, _internals.useFieldInternalPropsWithDefaults)({
|
|
18
|
-
manager,
|
|
19
|
-
internalProps
|
|
20
|
-
});
|
|
21
12
|
return (0, _internals.useField)({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
valueManager: manager.internal_valueManager,
|
|
25
|
-
fieldValueManager: manager.internal_fieldValueManager,
|
|
26
|
-
validator: manager.validator,
|
|
27
|
-
valueType: manager.valueType,
|
|
28
|
-
getOpenPickerButtonAriaLabel: manager.internal_useOpenPickerButtonAriaLabel()
|
|
13
|
+
manager,
|
|
14
|
+
props
|
|
29
15
|
});
|
|
30
16
|
};
|
|
31
17
|
exports.useSingleInputTimeRangeField = useSingleInputTimeRangeField;
|
|
@@ -14,6 +14,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
14
14
|
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
|
15
15
|
var _styles = require("@mui/material/styles");
|
|
16
16
|
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
|
17
|
+
var _internals = require("@mui/x-date-pickers/internals");
|
|
17
18
|
var _DesktopTimeRangePicker = require("../DesktopTimeRangePicker");
|
|
18
19
|
var _MobileTimeRangePicker = require("../MobileTimeRangePicker");
|
|
19
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -34,7 +35,7 @@ const TimeRangePicker = exports.TimeRangePicker = /*#__PURE__*/React.forwardRef(
|
|
|
34
35
|
name: 'MuiTimeRangePicker'
|
|
35
36
|
});
|
|
36
37
|
const {
|
|
37
|
-
desktopModeMediaQuery =
|
|
38
|
+
desktopModeMediaQuery = _internals.DEFAULT_DESKTOP_MODE_MEDIA_QUERY
|
|
38
39
|
} = props,
|
|
39
40
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
40
41
|
|
|
@@ -109,6 +110,7 @@ process.env.NODE_ENV !== "production" ? TimeRangePicker.propTypes = {
|
|
|
109
110
|
disableIgnoringDatePartForTimeValidation: _propTypes.default.bool,
|
|
110
111
|
/**
|
|
111
112
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
113
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
112
114
|
* @default false
|
|
113
115
|
*/
|
|
114
116
|
disableOpenPicker: _propTypes.default.bool,
|
|
@@ -5,7 +5,7 @@ import { Theme } from '@mui/material/styles';
|
|
|
5
5
|
import { DefaultizedProps } from '@mui/x-internals/types';
|
|
6
6
|
import { PickerOwnerState, PickerValidDate, TimezoneProps } from '@mui/x-date-pickers/models';
|
|
7
7
|
import { PickersCalendarHeader, PickersCalendarHeaderSlots, PickersCalendarHeaderSlotProps } from '@mui/x-date-pickers/PickersCalendarHeader';
|
|
8
|
-
import { PickerDayOwnerState } from '@mui/x-date-pickers/
|
|
8
|
+
import { PickerDayOwnerState } from '@mui/x-date-pickers/PickersDay';
|
|
9
9
|
import { BaseDateValidationProps, ExportedDayCalendarProps, DayCalendarSlots, DayCalendarSlotProps, PickersArrowSwitcherSlots, PickersArrowSwitcherSlotProps, ExportedUseViewsOptions, PickerRangeValue, FormProps } from '@mui/x-date-pickers/internals';
|
|
10
10
|
import { RangePosition } from "../models/index.js";
|
|
11
11
|
import { DateRangeCalendarClasses } from "./dateRangeCalendarClasses.js";
|
|
@@ -7,6 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
9
9
|
import { useThemeProps } from '@mui/material/styles';
|
|
10
|
+
import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '@mui/x-date-pickers/internals';
|
|
10
11
|
import { refType } from '@mui/utils';
|
|
11
12
|
import { DesktopDateRangePicker } from "../DesktopDateRangePicker/index.js";
|
|
12
13
|
import { MobileDateRangePicker } from "../MobileDateRangePicker/index.js";
|
|
@@ -27,7 +28,7 @@ const DateRangePicker = /*#__PURE__*/React.forwardRef(function DateRangePicker(i
|
|
|
27
28
|
name: 'MuiDateRangePicker'
|
|
28
29
|
});
|
|
29
30
|
const {
|
|
30
|
-
desktopModeMediaQuery =
|
|
31
|
+
desktopModeMediaQuery = DEFAULT_DESKTOP_MODE_MEDIA_QUERY
|
|
31
32
|
} = props,
|
|
32
33
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
33
34
|
|
|
@@ -124,6 +125,7 @@ process.env.NODE_ENV !== "production" ? DateRangePicker.propTypes = {
|
|
|
124
125
|
disableHighlightToday: PropTypes.bool,
|
|
125
126
|
/**
|
|
126
127
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
128
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
127
129
|
* @default false
|
|
128
130
|
*/
|
|
129
131
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -1,45 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { DateRangePickerDayClasses } from "./dateRangePickerDayClasses.js";
|
|
4
|
-
export interface DateRangePickerDayProps extends Omit<PickersDayProps, 'classes' | 'onBlur' | 'onFocus' | 'onKeyDown'> {
|
|
5
|
-
/**
|
|
6
|
-
* Set to `true` if the `day` is in a highlighted date range.
|
|
7
|
-
*/
|
|
8
|
-
isHighlighting: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Set to `true` if the `day` is the end of a highlighted date range.
|
|
11
|
-
*/
|
|
12
|
-
isEndOfHighlighting: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Set to `true` if the `day` is the start of a highlighted date range.
|
|
15
|
-
*/
|
|
16
|
-
isStartOfHighlighting: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Set to `true` if the `day` is in a preview date range.
|
|
19
|
-
*/
|
|
20
|
-
isPreviewing: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Set to `true` if the `day` is the end of a previewing date range.
|
|
23
|
-
*/
|
|
24
|
-
isEndOfPreviewing: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Set to `true` if the `day` is the start of a previewing date range.
|
|
27
|
-
*/
|
|
28
|
-
isStartOfPreviewing: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Override or extend the styles applied to the component.
|
|
31
|
-
*/
|
|
32
|
-
classes?: Partial<DateRangePickerDayClasses>;
|
|
33
|
-
/**
|
|
34
|
-
* Indicates if the day should be visually selected.
|
|
35
|
-
*/
|
|
36
|
-
isVisuallySelected?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* If `true`, the day can be dragged to change the current date range.
|
|
39
|
-
* @default false
|
|
40
|
-
*/
|
|
41
|
-
draggable?: boolean;
|
|
42
|
-
}
|
|
2
|
+
import { DateRangePickerDayProps } from "./DateRangePickerDay.types.js";
|
|
43
3
|
type DateRangePickerDayComponent = (props: DateRangePickerDayProps & React.RefAttributes<HTMLButtonElement>) => React.JSX.Element;
|
|
44
4
|
/**
|
|
45
5
|
* Demos:
|
|
@@ -2,40 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["className", "
|
|
5
|
+
const _excluded = ["className", "classes", "isEndOfHighlighting", "isEndOfPreviewing", "isHighlighting", "isPreviewing", "isStartOfHighlighting", "isStartOfPreviewing", "isVisuallySelected", "sx", "draggable", "isFirstVisibleCell", "isLastVisibleCell", "day", "selected", "disabled", "today", "outsideCurrentMonth", "disableMargin", "disableHighlightToday", "showDaysOutsideCurrentMonth"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import { useLicenseVerifier } from '@mui/x-license';
|
|
10
10
|
import { alpha, styled, useThemeProps } from '@mui/material/styles';
|
|
11
11
|
import composeClasses from '@mui/utils/composeClasses';
|
|
12
|
-
import { useUtils } from '@mui/x-date-pickers/internals';
|
|
12
|
+
import { useUtils, usePickerDayOwnerState } from '@mui/x-date-pickers/internals';
|
|
13
13
|
import { PickersDay } from '@mui/x-date-pickers/PickersDay';
|
|
14
14
|
import { getDateRangePickerDayUtilityClass, dateRangePickerDayClasses } from "./dateRangePickerDayClasses.js";
|
|
15
15
|
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
const releaseInfo = getReleaseInfo();
|
|
18
|
-
const useUtilityClasses = ownerState => {
|
|
18
|
+
const useUtilityClasses = (classes, ownerState) => {
|
|
19
19
|
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
// Properties shared with PickersDay
|
|
21
|
+
isDaySelected,
|
|
22
|
+
isDayOutsideMonth,
|
|
23
|
+
// Range-specific properties (present in the Base UI implementation)
|
|
24
|
+
isDaySelectionStart,
|
|
25
|
+
isDaySelectionEnd,
|
|
26
|
+
isDayInsideSelection,
|
|
27
|
+
isDayPreviewStart,
|
|
28
|
+
isDayPreviewEnd,
|
|
29
|
+
isDayPreviewed,
|
|
30
|
+
// Range-specific properties (specific to the MUI implementation)
|
|
31
|
+
isDayStartOfMonth,
|
|
32
|
+
isDayEndOfMonth,
|
|
33
|
+
isDayFirstVisibleCell,
|
|
34
|
+
isDayLastVisibleCell,
|
|
35
|
+
isDayFillerCell
|
|
34
36
|
} = ownerState;
|
|
35
37
|
const slots = {
|
|
36
|
-
root: ['root',
|
|
37
|
-
rangeIntervalPreview: ['rangeIntervalPreview',
|
|
38
|
-
day: ['day', !
|
|
38
|
+
root: ['root', isDaySelected && 'rangeIntervalDayHighlight', isDaySelectionStart && 'rangeIntervalDayHighlightStart', isDaySelectionEnd && 'rangeIntervalDayHighlightEnd', isDayOutsideMonth && 'outsideCurrentMonth', isDayStartOfMonth && 'startOfMonth', isDayEndOfMonth && 'endOfMonth', isDayFirstVisibleCell && 'firstVisibleCell', isDayLastVisibleCell && 'lastVisibleCell', isDayFillerCell && 'hiddenDayFiller'],
|
|
39
|
+
rangeIntervalPreview: ['rangeIntervalPreview', isDayPreviewed && 'rangeIntervalDayPreview', (isDayPreviewStart || isDayStartOfMonth) && 'rangeIntervalDayPreviewStart', (isDayPreviewEnd || isDayEndOfMonth) && 'rangeIntervalDayPreviewEnd'],
|
|
40
|
+
day: ['day', !isDaySelected && 'notSelectedDate', !isDaySelected && 'dayOutsideRangeInterval', !isDayInsideSelection && 'dayInsideRangeInterval']
|
|
39
41
|
};
|
|
40
42
|
return composeClasses(slots, getDateRangePickerDayUtilityClass, classes);
|
|
41
43
|
};
|
|
@@ -74,7 +76,7 @@ const DateRangePickerDayRoot = styled('div', {
|
|
|
74
76
|
}) => ({
|
|
75
77
|
variants: [{
|
|
76
78
|
props: {
|
|
77
|
-
|
|
79
|
+
isDayFillerCell: false
|
|
78
80
|
},
|
|
79
81
|
style: {
|
|
80
82
|
[`&:first-of-type .${dateRangePickerDayClasses.rangeIntervalDayPreview}`]: _extends({}, startBorderStyle, {
|
|
@@ -86,7 +88,7 @@ const DateRangePickerDayRoot = styled('div', {
|
|
|
86
88
|
}
|
|
87
89
|
}, {
|
|
88
90
|
props: {
|
|
89
|
-
|
|
91
|
+
isDayFillerCell: false,
|
|
90
92
|
isHighlighting: true
|
|
91
93
|
},
|
|
92
94
|
style: {
|
|
@@ -99,22 +101,22 @@ const DateRangePickerDayRoot = styled('div', {
|
|
|
99
101
|
}, {
|
|
100
102
|
props: ({
|
|
101
103
|
ownerState: {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
isDayFillerCell,
|
|
105
|
+
isDaySelectionStart,
|
|
106
|
+
isDayFirstVisibleCell
|
|
105
107
|
}
|
|
106
|
-
}) => !
|
|
108
|
+
}) => !isDayFillerCell && (isDaySelectionStart || isDayFirstVisibleCell),
|
|
107
109
|
style: _extends({}, startBorderStyle, {
|
|
108
110
|
paddingLeft: 0
|
|
109
111
|
})
|
|
110
112
|
}, {
|
|
111
113
|
props: ({
|
|
112
114
|
ownerState: {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
isDayFillerCell,
|
|
116
|
+
isDaySelectionEnd,
|
|
117
|
+
isDayLastVisibleCell
|
|
116
118
|
}
|
|
117
|
-
}) => !
|
|
119
|
+
}) => !isDayFillerCell && (isDaySelectionEnd || isDayLastVisibleCell),
|
|
118
120
|
style: _extends({}, endBorderStyle, {
|
|
119
121
|
paddingRight: 0
|
|
120
122
|
})
|
|
@@ -137,8 +139,8 @@ const DateRangePickerDayRangeIntervalPreview = styled('div', {
|
|
|
137
139
|
border: '2px solid transparent',
|
|
138
140
|
variants: [{
|
|
139
141
|
props: {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
isDayPreviewed: true,
|
|
143
|
+
isDayFillerCell: false
|
|
142
144
|
},
|
|
143
145
|
style: {
|
|
144
146
|
borderRadius: 0,
|
|
@@ -149,24 +151,24 @@ const DateRangePickerDayRangeIntervalPreview = styled('div', {
|
|
|
149
151
|
}, {
|
|
150
152
|
props: ({
|
|
151
153
|
ownerState: {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
isDayPreviewed,
|
|
155
|
+
isDayFillerCell,
|
|
156
|
+
isDayPreviewStart,
|
|
157
|
+
isDayFirstVisibleCell
|
|
156
158
|
}
|
|
157
|
-
}) =>
|
|
159
|
+
}) => isDayPreviewed && !isDayFillerCell && (isDayPreviewStart || isDayFirstVisibleCell),
|
|
158
160
|
style: _extends({
|
|
159
161
|
borderLeftColor: (theme.vars || theme).palette.divider
|
|
160
162
|
}, startBorderStyle)
|
|
161
163
|
}, {
|
|
162
164
|
props: ({
|
|
163
165
|
ownerState: {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
isDayPreviewed,
|
|
167
|
+
isDayFillerCell,
|
|
168
|
+
isDayPreviewEnd,
|
|
169
|
+
isDayLastVisibleCell
|
|
168
170
|
}
|
|
169
|
-
}) =>
|
|
171
|
+
}) => isDayPreviewed && !isDayFillerCell && (isDayPreviewEnd || isDayLastVisibleCell),
|
|
170
172
|
style: _extends({
|
|
171
173
|
borderRightColor: (theme.vars || theme).palette.divider
|
|
172
174
|
}, endBorderStyle)
|
|
@@ -205,34 +207,60 @@ const DateRangePickerDayRaw = /*#__PURE__*/React.forwardRef(function DateRangePi
|
|
|
205
207
|
});
|
|
206
208
|
const {
|
|
207
209
|
className,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
classes: classesProp,
|
|
211
|
+
isEndOfHighlighting,
|
|
212
|
+
isEndOfPreviewing,
|
|
210
213
|
isHighlighting,
|
|
211
214
|
isPreviewing,
|
|
212
|
-
|
|
215
|
+
isStartOfHighlighting,
|
|
216
|
+
isStartOfPreviewing,
|
|
213
217
|
isVisuallySelected,
|
|
214
218
|
sx,
|
|
215
219
|
draggable,
|
|
216
220
|
isFirstVisibleCell,
|
|
217
|
-
isLastVisibleCell
|
|
221
|
+
isLastVisibleCell,
|
|
222
|
+
day,
|
|
223
|
+
selected,
|
|
224
|
+
disabled,
|
|
225
|
+
today,
|
|
226
|
+
outsideCurrentMonth,
|
|
227
|
+
disableMargin,
|
|
228
|
+
disableHighlightToday,
|
|
229
|
+
showDaysOutsideCurrentMonth
|
|
218
230
|
} = props,
|
|
219
231
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
220
232
|
useLicenseVerifier('x-date-pickers-pro', releaseInfo);
|
|
221
233
|
const utils = useUtils();
|
|
222
|
-
const isEndOfMonth = utils.isSameDay(day, utils.endOfMonth(day));
|
|
223
|
-
const isStartOfMonth = utils.isSameDay(day, utils.startOfMonth(day));
|
|
224
234
|
const shouldRenderHighlight = isHighlighting && !outsideCurrentMonth;
|
|
225
235
|
const shouldRenderPreview = isPreviewing && !outsideCurrentMonth;
|
|
226
|
-
const
|
|
236
|
+
const pickersDayOwnerState = usePickerDayOwnerState({
|
|
237
|
+
day,
|
|
227
238
|
selected,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
239
|
+
disabled,
|
|
240
|
+
today,
|
|
241
|
+
outsideCurrentMonth,
|
|
242
|
+
disableMargin,
|
|
243
|
+
disableHighlightToday,
|
|
244
|
+
showDaysOutsideCurrentMonth
|
|
245
|
+
});
|
|
246
|
+
const ownerState = _extends({}, pickersDayOwnerState, {
|
|
247
|
+
// Properties that the Base UI implementation will have
|
|
248
|
+
isDaySelectionStart: isStartOfHighlighting,
|
|
249
|
+
isDaySelectionEnd: isEndOfHighlighting,
|
|
250
|
+
isDayInsideSelection: isHighlighting && !isStartOfHighlighting && !isEndOfHighlighting,
|
|
251
|
+
isDaySelected: isHighlighting,
|
|
252
|
+
isDayPreviewed: isPreviewing,
|
|
253
|
+
isDayPreviewStart: isStartOfPreviewing,
|
|
254
|
+
isDayPreviewEnd: isEndOfPreviewing,
|
|
255
|
+
isDayInsidePreview: isPreviewing && !isStartOfPreviewing && !isEndOfPreviewing,
|
|
256
|
+
// Properties specific to the MUI implementation (some might be removed in the next major)
|
|
257
|
+
isDayStartOfMonth: utils.isSameDay(day, utils.startOfMonth(day)),
|
|
258
|
+
isDayEndOfMonth: utils.isSameDay(day, utils.endOfMonth(day)),
|
|
259
|
+
isDayFirstVisibleCell: isFirstVisibleCell,
|
|
260
|
+
isDayLastVisibleCell: isLastVisibleCell,
|
|
261
|
+
isDayFillerCell: outsideCurrentMonth && !showDaysOutsideCurrentMonth
|
|
234
262
|
});
|
|
235
|
-
const classes = useUtilityClasses(ownerState);
|
|
263
|
+
const classes = useUtilityClasses(classesProp, ownerState);
|
|
236
264
|
return /*#__PURE__*/_jsx(DateRangePickerDayRoot, {
|
|
237
265
|
className: clsx(classes.root, className),
|
|
238
266
|
ownerState: ownerState,
|
|
@@ -242,10 +270,14 @@ const DateRangePickerDayRaw = /*#__PURE__*/React.forwardRef(function DateRangePi
|
|
|
242
270
|
ownerState: ownerState,
|
|
243
271
|
children: /*#__PURE__*/_jsx(DateRangePickerDayDay, _extends({}, other, {
|
|
244
272
|
ref: ref,
|
|
245
|
-
disableMargin: true,
|
|
246
273
|
day: day,
|
|
247
274
|
selected: isVisuallySelected,
|
|
275
|
+
disabled: disabled,
|
|
276
|
+
today: today,
|
|
248
277
|
outsideCurrentMonth: outsideCurrentMonth,
|
|
278
|
+
disableMargin: true,
|
|
279
|
+
disableHighlightToday: disableHighlightToday,
|
|
280
|
+
showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
|
|
249
281
|
className: classes.day,
|
|
250
282
|
ownerState: ownerState,
|
|
251
283
|
draggable: draggable,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { PickerDayOwnerState, PickersDayProps } from '@mui/x-date-pickers/PickersDay';
|
|
2
|
+
import { DateRangePickerDayClasses } from "./dateRangePickerDayClasses.js";
|
|
3
|
+
export interface DateRangePickerDayProps extends Omit<PickersDayProps, 'classes' | 'onBlur' | 'onFocus' | 'onKeyDown'> {
|
|
4
|
+
/**
|
|
5
|
+
* Set to `true` if the `day` is in a highlighted date range.
|
|
6
|
+
*/
|
|
7
|
+
isHighlighting: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Set to `true` if the `day` is the end of a highlighted date range.
|
|
10
|
+
*/
|
|
11
|
+
isEndOfHighlighting: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Set to `true` if the `day` is the start of a highlighted date range.
|
|
14
|
+
*/
|
|
15
|
+
isStartOfHighlighting: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Set to `true` if the `day` is in a preview date range.
|
|
18
|
+
*/
|
|
19
|
+
isPreviewing: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Set to `true` if the `day` is the end of a previewing date range.
|
|
22
|
+
*/
|
|
23
|
+
isEndOfPreviewing: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Set to `true` if the `day` is the start of a previewing date range.
|
|
26
|
+
*/
|
|
27
|
+
isStartOfPreviewing: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Override or extend the styles applied to the component.
|
|
30
|
+
*/
|
|
31
|
+
classes?: Partial<DateRangePickerDayClasses>;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates if the day should be visually selected.
|
|
34
|
+
*/
|
|
35
|
+
isVisuallySelected?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* If `true`, the day can be dragged to change the current date range.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
draggable?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface DateRangePickerDayOwnerState extends PickerDayOwnerState {
|
|
43
|
+
/**
|
|
44
|
+
* Whether the day is the first day of the selected range.
|
|
45
|
+
*/
|
|
46
|
+
isDaySelectionStart: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Whether the day is the last day of the selected range.
|
|
49
|
+
*/
|
|
50
|
+
isDaySelectionEnd: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the day is within the selected range and is not its first or last day.
|
|
53
|
+
*/
|
|
54
|
+
isDayInsideSelection: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Whether the day is within the preview range.
|
|
57
|
+
*/
|
|
58
|
+
isDayPreviewed: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Whether the day is the first day of the preview range.
|
|
61
|
+
*/
|
|
62
|
+
isDayPreviewStart: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether the day is the last day of the preview range.
|
|
65
|
+
*/
|
|
66
|
+
isDayPreviewEnd: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the day is within the preview range and is not its first or last day.
|
|
69
|
+
*/
|
|
70
|
+
isDayInsidePreview: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the day is the first day of the month.
|
|
73
|
+
*/
|
|
74
|
+
isDayStartOfMonth: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Whether the day is the last day of the month.
|
|
77
|
+
*/
|
|
78
|
+
isDayEndOfMonth: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether the day is the first visible cell of the month it's being rendered in.
|
|
81
|
+
*/
|
|
82
|
+
isDayFirstVisibleCell: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the day is the last visible cell of the month it's being rendered in.
|
|
85
|
+
*/
|
|
86
|
+
isDayLastVisibleCell: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Whether the day is a filler day (its content is hidden).
|
|
89
|
+
*/
|
|
90
|
+
isDayFillerCell: boolean;
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { DateRangePickerDay } from "./DateRangePickerDay.js";
|
|
2
|
-
export type { DateRangePickerDayProps } from './DateRangePickerDay';
|
|
2
|
+
export type { DateRangePickerDayProps, DateRangePickerDayOwnerState } from './DateRangePickerDay.types';
|
|
3
3
|
export { getDateRangePickerDayUtilityClass, dateRangePickerDayClasses } from "./dateRangePickerDayClasses.js";
|
|
4
4
|
export type { DateRangePickerDayClasses, DateRangePickerDayClassKey } from './dateRangePickerDayClasses';
|
|
@@ -8,6 +8,7 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { refType } from '@mui/utils';
|
|
9
9
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
10
10
|
import { useThemeProps } from '@mui/material/styles';
|
|
11
|
+
import { DEFAULT_DESKTOP_MODE_MEDIA_QUERY } from '@mui/x-date-pickers/internals';
|
|
11
12
|
import { DesktopDateTimeRangePicker } from "../DesktopDateTimeRangePicker/index.js";
|
|
12
13
|
import { MobileDateTimeRangePicker } from "../MobileDateTimeRangePicker/index.js";
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -27,7 +28,7 @@ const DateTimeRangePicker = /*#__PURE__*/React.forwardRef(function DateTimeRange
|
|
|
27
28
|
name: 'MuiDateTimeRangePicker'
|
|
28
29
|
});
|
|
29
30
|
const {
|
|
30
|
-
desktopModeMediaQuery =
|
|
31
|
+
desktopModeMediaQuery = DEFAULT_DESKTOP_MODE_MEDIA_QUERY
|
|
31
32
|
} = props,
|
|
32
33
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
33
34
|
|
|
@@ -134,6 +135,7 @@ process.env.NODE_ENV !== "production" ? DateTimeRangePicker.propTypes = {
|
|
|
134
135
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
135
136
|
/**
|
|
136
137
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
138
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
137
139
|
* @default false
|
|
138
140
|
*/
|
|
139
141
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -138,6 +138,7 @@ DesktopDateRangePicker.propTypes = {
|
|
|
138
138
|
disableHighlightToday: PropTypes.bool,
|
|
139
139
|
/**
|
|
140
140
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
141
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
141
142
|
* @default false
|
|
142
143
|
*/
|
|
143
144
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -216,6 +216,7 @@ DesktopDateTimeRangePicker.propTypes = {
|
|
|
216
216
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
217
217
|
/**
|
|
218
218
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
219
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
219
220
|
* @default false
|
|
220
221
|
*/
|
|
221
222
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -157,6 +157,7 @@ DesktopTimeRangePicker.propTypes = {
|
|
|
157
157
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
158
158
|
/**
|
|
159
159
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
160
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
160
161
|
* @default false
|
|
161
162
|
*/
|
|
162
163
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -130,6 +130,7 @@ MobileDateRangePicker.propTypes = {
|
|
|
130
130
|
disableHighlightToday: PropTypes.bool,
|
|
131
131
|
/**
|
|
132
132
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
133
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
133
134
|
* @default false
|
|
134
135
|
*/
|
|
135
136
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -216,6 +216,7 @@ MobileDateTimeRangePicker.propTypes = {
|
|
|
216
216
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
217
217
|
/**
|
|
218
218
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
219
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
219
220
|
* @default false
|
|
220
221
|
*/
|
|
221
222
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -147,6 +147,7 @@ MobileTimeRangePicker.propTypes = {
|
|
|
147
147
|
disableIgnoringDatePartForTimeValidation: PropTypes.bool,
|
|
148
148
|
/**
|
|
149
149
|
* If `true`, the button to open the Picker will not be rendered (it will only render the field).
|
|
150
|
+
* @deprecated Use the [field component](https://next.mui.com/x/react-date-pickers/fields/) instead.
|
|
150
151
|
* @default false
|
|
151
152
|
*/
|
|
152
153
|
disableOpenPicker: PropTypes.bool,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseSingleInputDateRangeFieldProps } from "./SingleInputDateRangeField.types.js";
|
|
2
|
-
export declare const useSingleInputDateRangeField: <TEnableAccessibleFieldDOMStructure extends boolean,
|
|
2
|
+
export declare const useSingleInputDateRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseSingleInputDateRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TProps) => import("@mui/x-date-pickers/internals").UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, TProps>;
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { useField
|
|
4
|
-
import { useSplitFieldProps } from '@mui/x-date-pickers/hooks';
|
|
3
|
+
import { useField } from '@mui/x-date-pickers/internals';
|
|
5
4
|
import { useDateRangeManager } from "../managers/index.js";
|
|
6
5
|
export const useSingleInputDateRangeField = props => {
|
|
7
6
|
const manager = useDateRangeManager(props);
|
|
8
|
-
const {
|
|
9
|
-
forwardedProps,
|
|
10
|
-
internalProps
|
|
11
|
-
} = useSplitFieldProps(props, 'date');
|
|
12
|
-
const internalPropsWithDefaults = useFieldInternalPropsWithDefaults({
|
|
13
|
-
manager,
|
|
14
|
-
internalProps
|
|
15
|
-
});
|
|
16
7
|
return useField({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
valueManager: manager.internal_valueManager,
|
|
20
|
-
fieldValueManager: manager.internal_fieldValueManager,
|
|
21
|
-
validator: manager.validator,
|
|
22
|
-
valueType: manager.valueType,
|
|
23
|
-
getOpenPickerButtonAriaLabel: manager.internal_useOpenPickerButtonAriaLabel()
|
|
8
|
+
manager,
|
|
9
|
+
props
|
|
24
10
|
});
|
|
25
11
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { UseSingleInputDateTimeRangeFieldProps } from "./SingleInputDateTimeRangeField.types.js";
|
|
2
|
-
export declare const useSingleInputDateTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean,
|
|
2
|
+
export declare const useSingleInputDateTimeRangeField: <TEnableAccessibleFieldDOMStructure extends boolean, TProps extends UseSingleInputDateTimeRangeFieldProps<TEnableAccessibleFieldDOMStructure>>(props: TProps) => import("@mui/x-date-pickers/internals").UseFieldReturnValue<TEnableAccessibleFieldDOMStructure, TProps>;
|