@mui/x-date-pickers-pro 8.0.0-beta.1 → 8.0.0-beta.3
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 +235 -0
- package/DateRangeCalendar/DateRangeCalendar.js +2 -7
- package/DateRangePicker/shared.js +2 -7
- package/DateRangePickerDay/DateRangePickerDay.js +1 -1
- package/DateTimeRangePicker/shared.js +2 -11
- package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
- package/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
- package/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
- package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -1
- package/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
- package/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
- package/TimeRangePicker/shared.js +2 -3
- package/esm/DateRangeCalendar/DateRangeCalendar.js +3 -8
- package/esm/DateRangePicker/shared.js +3 -8
- package/esm/DateRangePickerDay/DateRangePickerDay.js +1 -1
- package/esm/DateTimeRangePicker/shared.js +3 -12
- package/esm/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/esm/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
- package/esm/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
- package/esm/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
- package/esm/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +16 -2
- package/esm/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
- package/esm/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/esm/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/esm/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/esm/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
- package/esm/TimeRangePicker/shared.js +3 -4
- package/esm/index.js +1 -1
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
- package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
- package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
- package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
- package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
- package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
- package/esm/internals/models/rangePickerProps.d.ts +14 -0
- package/esm/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
- package/esm/internals/utils/createRangePickerStepNavigation.js +31 -0
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/managers/useDateRangeManager.js +9 -10
- package/esm/managers/useDateTimeRangeManager.js +10 -10
- package/esm/managers/useTimeRangeManager.js +10 -8
- package/index.js +1 -1
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
- package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
- package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
- package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
- package/internals/models/rangePickerProps.d.ts +14 -0
- package/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
- package/internals/utils/createRangePickerStepNavigation.js +37 -0
- package/internals/utils/releaseInfo.js +1 -1
- package/managers/useDateRangeManager.js +8 -9
- package/managers/useDateTimeRangeManager.js +9 -9
- package/managers/useTimeRangeManager.js +9 -7
- package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -8
- package/modern/DateRangePicker/shared.js +3 -8
- package/modern/DateRangePickerDay/DateRangePickerDay.js +1 -1
- package/modern/DateTimeRangePicker/shared.js +3 -12
- package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
- package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
- package/modern/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
- package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
- package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +16 -2
- package/modern/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
- package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
- package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
- package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
- package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
- package/modern/TimeRangePicker/shared.js +3 -4
- package/modern/index.js +1 -1
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
- package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
- package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
- package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
- package/modern/internals/models/rangePickerProps.d.ts +14 -0
- package/modern/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
- package/modern/internals/utils/createRangePickerStepNavigation.js +31 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/managers/useDateRangeManager.js +9 -10
- package/modern/managers/useDateTimeRangeManager.js +10 -10
- package/modern/managers/useTimeRangeManager.js +10 -8
- package/package.json +8 -8
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/internals/hooks/models/index.d.ts +0 -1
- package/esm/internals/hooks/models/index.js +0 -1
- package/esm/internals/hooks/models/useRangePicker.d.ts +0 -8
- package/esm/internals/hooks/models/useRangePicker.js +0 -1
- package/internals/hooks/models/index.d.ts +0 -1
- package/internals/hooks/models/index.js +0 -5
- package/internals/hooks/models/useRangePicker.d.ts +0 -8
- package/internals/hooks/models/useRangePicker.js +0 -5
- package/modern/internals/hooks/models/index.d.ts +0 -1
- package/modern/internals/hooks/models/index.js +0 -1
- package/modern/internals/hooks/models/useRangePicker.d.ts +0 -8
- package/modern/internals/hooks/models/useRangePicker.js +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DateOrTimeViewWithMeridiem, RangePosition } from '@mui/x-date-pickers/internals';
|
|
2
|
+
import { UseRangePositionResponse } from "../hooks/useRangePosition.js";
|
|
3
|
+
export declare function createRangePickerStepNavigation(parameters: CreateRangePickerStepNavigationParameters): import("@mui/x-date-pickers/internals/utils/createStepNavigation").CreateStepNavigationReturnValue;
|
|
4
|
+
export interface PickerRangeStep {
|
|
5
|
+
/**
|
|
6
|
+
* The views that are handled inside this step.
|
|
7
|
+
* If null, all views are handled by this step.
|
|
8
|
+
*/
|
|
9
|
+
views: readonly DateOrTimeViewWithMeridiem[] | null;
|
|
10
|
+
rangePosition: RangePosition;
|
|
11
|
+
}
|
|
12
|
+
interface CreateRangePickerStepNavigationParameters {
|
|
13
|
+
steps: PickerRangeStep[] | null;
|
|
14
|
+
rangePositionResponse: UseRangePositionResponse;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createStepNavigation } from '@mui/x-date-pickers/internals';
|
|
2
|
+
export function createRangePickerStepNavigation(parameters) {
|
|
3
|
+
const {
|
|
4
|
+
steps,
|
|
5
|
+
rangePositionResponse
|
|
6
|
+
} = parameters;
|
|
7
|
+
return createStepNavigation({
|
|
8
|
+
steps,
|
|
9
|
+
isCurrentViewMatchingStep: (view, step) => {
|
|
10
|
+
if (step.rangePosition !== rangePositionResponse.rangePosition) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return step.views == null || step.views.includes(view);
|
|
14
|
+
},
|
|
15
|
+
onStepChange: ({
|
|
16
|
+
step,
|
|
17
|
+
initialView,
|
|
18
|
+
setView,
|
|
19
|
+
view,
|
|
20
|
+
views
|
|
21
|
+
}) => {
|
|
22
|
+
if (step.rangePosition !== rangePositionResponse.rangePosition) {
|
|
23
|
+
rangePositionResponse.setRangePosition(step.rangePosition);
|
|
24
|
+
}
|
|
25
|
+
const targetView = step.views == null ? initialView : step.views.find(viewBis => views.includes(viewBis));
|
|
26
|
+
if (targetView !== view) {
|
|
27
|
+
setView(targetView);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTc0MzYzMTIwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { useApplyDefaultValuesToDateValidationProps, useUtils } from '@mui/x-date-pickers/internals';
|
|
7
7
|
import { getRangeFieldValueManager, rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
8
8
|
import { validateDateRange } from "../validation/index.js";
|
|
9
9
|
import { formatRange } from "../internals/utils/date-utils.js";
|
|
@@ -20,15 +20,7 @@ export function useDateRangeManager(parameters = {}) {
|
|
|
20
20
|
dateSeparator
|
|
21
21
|
}),
|
|
22
22
|
internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
|
|
23
|
-
|
|
24
|
-
internalProps,
|
|
25
|
-
utils,
|
|
26
|
-
defaultDates
|
|
27
|
-
}) => _extends({}, internalProps, getDateFieldInternalPropsDefaults({
|
|
28
|
-
defaultDates,
|
|
29
|
-
utils,
|
|
30
|
-
internalProps
|
|
31
|
-
})),
|
|
23
|
+
internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToDateRangeFieldInternalProps,
|
|
32
24
|
internal_useOpenPickerButtonAriaLabel: useOpenPickerButtonAriaLabel
|
|
33
25
|
}), [enableAccessibleFieldDOMStructure, dateSeparator]);
|
|
34
26
|
}
|
|
@@ -38,4 +30,11 @@ function useOpenPickerButtonAriaLabel(value) {
|
|
|
38
30
|
return React.useMemo(() => {
|
|
39
31
|
return translations.openRangePickerDialogue(formatRange(utils, value, 'fullDate'));
|
|
40
32
|
}, [value, translations, utils]);
|
|
33
|
+
}
|
|
34
|
+
function useApplyDefaultValuesToDateRangeFieldInternalProps(internalProps) {
|
|
35
|
+
const utils = useUtils();
|
|
36
|
+
const validationProps = useApplyDefaultValuesToDateValidationProps(internalProps);
|
|
37
|
+
return React.useMemo(() => _extends({}, internalProps, validationProps, {
|
|
38
|
+
format: internalProps.format ?? utils.formats.keyboardDate
|
|
39
|
+
}), [internalProps, validationProps, utils]);
|
|
41
40
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { useApplyDefaultValuesToDateTimeValidationProps, useUtils } from '@mui/x-date-pickers/internals';
|
|
7
7
|
import { getRangeFieldValueManager, rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
8
8
|
import { validateDateTimeRange } from "../validation/index.js";
|
|
9
9
|
import { formatRange } from "../internals/utils/date-utils.js";
|
|
@@ -20,15 +20,7 @@ export function useDateTimeRangeManager(parameters = {}) {
|
|
|
20
20
|
dateSeparator
|
|
21
21
|
}),
|
|
22
22
|
internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
|
|
23
|
-
|
|
24
|
-
internalProps,
|
|
25
|
-
utils,
|
|
26
|
-
defaultDates
|
|
27
|
-
}) => _extends({}, internalProps, getDateTimeFieldInternalPropsDefaults({
|
|
28
|
-
internalProps,
|
|
29
|
-
utils,
|
|
30
|
-
defaultDates
|
|
31
|
-
})),
|
|
23
|
+
internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToDateTimeRangeFieldInternalProps,
|
|
32
24
|
internal_useOpenPickerButtonAriaLabel: useOpenPickerButtonAriaLabel
|
|
33
25
|
}), [enableAccessibleFieldDOMStructure, dateSeparator]);
|
|
34
26
|
}
|
|
@@ -38,4 +30,12 @@ function useOpenPickerButtonAriaLabel(value) {
|
|
|
38
30
|
return React.useMemo(() => {
|
|
39
31
|
return translations.openRangePickerDialogue(formatRange(utils, value, 'fullDate'));
|
|
40
32
|
}, [value, translations, utils]);
|
|
33
|
+
}
|
|
34
|
+
function useApplyDefaultValuesToDateTimeRangeFieldInternalProps(internalProps) {
|
|
35
|
+
const utils = useUtils();
|
|
36
|
+
const validationProps = useApplyDefaultValuesToDateTimeValidationProps(internalProps);
|
|
37
|
+
const ampm = React.useMemo(() => internalProps.ampm ?? utils.is12HourCycleInCurrentLocale(), [internalProps.ampm, utils]);
|
|
38
|
+
return React.useMemo(() => _extends({}, internalProps, validationProps, {
|
|
39
|
+
format: internalProps.format ?? (ampm ? utils.formats.keyboardDateTime12h : utils.formats.keyboardDateTime24h)
|
|
40
|
+
}), [internalProps, validationProps, ampm, utils]);
|
|
41
41
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { usePickerTranslations } from '@mui/x-date-pickers/hooks';
|
|
6
|
-
import {
|
|
6
|
+
import { useApplyDefaultValuesToTimeValidationProps, useUtils } from '@mui/x-date-pickers/internals';
|
|
7
7
|
import { getRangeFieldValueManager, rangeValueManager } from "../internals/utils/valueManagers.js";
|
|
8
8
|
import { validateTimeRange } from "../validation/index.js";
|
|
9
9
|
import { formatRange } from "../internals/utils/date-utils.js";
|
|
@@ -21,13 +21,7 @@ export function useTimeRangeManager(parameters = {}) {
|
|
|
21
21
|
dateSeparator
|
|
22
22
|
}),
|
|
23
23
|
internal_enableAccessibleFieldDOMStructure: enableAccessibleFieldDOMStructure,
|
|
24
|
-
|
|
25
|
-
internalProps,
|
|
26
|
-
utils
|
|
27
|
-
}) => _extends({}, internalProps, getTimeFieldInternalPropsDefaults({
|
|
28
|
-
utils,
|
|
29
|
-
internalProps
|
|
30
|
-
})),
|
|
24
|
+
internal_useApplyDefaultValuesToFieldInternalProps: useApplyDefaultValuesToTimeRangeFieldInternalProps,
|
|
31
25
|
internal_useOpenPickerButtonAriaLabel: createUseOpenPickerButtonAriaLabel(ampm)
|
|
32
26
|
}), [enableAccessibleFieldDOMStructure, dateSeparator, ampm]);
|
|
33
27
|
}
|
|
@@ -40,4 +34,12 @@ function createUseOpenPickerButtonAriaLabel(ampm) {
|
|
|
40
34
|
return translations.openRangePickerDialogue(formatRange(utils, value, formatKey));
|
|
41
35
|
}, [value, translations, utils]);
|
|
42
36
|
};
|
|
37
|
+
}
|
|
38
|
+
function useApplyDefaultValuesToTimeRangeFieldInternalProps(internalProps) {
|
|
39
|
+
const utils = useUtils();
|
|
40
|
+
const validationProps = useApplyDefaultValuesToTimeValidationProps(internalProps);
|
|
41
|
+
const ampm = React.useMemo(() => internalProps.ampm ?? utils.is12HourCycleInCurrentLocale(), [internalProps.ampm, utils]);
|
|
42
|
+
return React.useMemo(() => _extends({}, internalProps, validationProps, {
|
|
43
|
+
format: internalProps.format ?? (ampm ? utils.formats.fullTime12h : utils.formats.fullTime24h)
|
|
44
|
+
}), [internalProps, validationProps, ampm, utils]);
|
|
43
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-date-pickers-pro",
|
|
3
|
-
"version": "8.0.0-beta.
|
|
3
|
+
"version": "8.0.0-beta.3",
|
|
4
4
|
"description": "The Pro plan edition of the Date and Time Picker components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -32,20 +32,20 @@
|
|
|
32
32
|
"directory": "packages/x-date-pickers-pro"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@babel/runtime": "^7.
|
|
36
|
-
"@mui/utils": "^7.0.0
|
|
35
|
+
"@babel/runtime": "^7.27.0",
|
|
36
|
+
"@mui/utils": "^7.0.0",
|
|
37
37
|
"clsx": "^2.1.1",
|
|
38
38
|
"prop-types": "^15.8.1",
|
|
39
39
|
"react-transition-group": "^4.4.5",
|
|
40
|
-
"@mui/x-
|
|
41
|
-
"@mui/x-
|
|
42
|
-
"@mui/x-
|
|
40
|
+
"@mui/x-date-pickers": "8.0.0-beta.3",
|
|
41
|
+
"@mui/x-license": "8.0.0-beta.3",
|
|
42
|
+
"@mui/x-internals": "8.0.0-beta.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@emotion/react": "^11.9.0",
|
|
46
46
|
"@emotion/styled": "^11.8.1",
|
|
47
|
-
"@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0
|
|
48
|
-
"@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0
|
|
47
|
+
"@mui/material": "^5.15.14 || ^6.0.0 || ^7.0.0",
|
|
48
|
+
"@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0",
|
|
49
49
|
"date-fns": "^2.25.0 || ^3.2.0 || ^4.0.0",
|
|
50
50
|
"date-fns-jalali": "^2.13.0-0 || ^3.2.0-0 || ^4.0.0-0",
|
|
51
51
|
"dayjs": "^1.10.7",
|