@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.
Files changed (111) hide show
  1. package/CHANGELOG.md +235 -0
  2. package/DateRangeCalendar/DateRangeCalendar.js +2 -7
  3. package/DateRangePicker/shared.js +2 -7
  4. package/DateRangePickerDay/DateRangePickerDay.js +1 -1
  5. package/DateTimeRangePicker/shared.js +2 -11
  6. package/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
  7. package/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
  8. package/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
  9. package/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
  10. package/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +15 -1
  11. package/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
  12. package/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
  13. package/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
  14. package/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
  15. package/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
  16. package/TimeRangePicker/shared.js +2 -3
  17. package/esm/DateRangeCalendar/DateRangeCalendar.js +3 -8
  18. package/esm/DateRangePicker/shared.js +3 -8
  19. package/esm/DateRangePickerDay/DateRangePickerDay.js +1 -1
  20. package/esm/DateTimeRangePicker/shared.js +3 -12
  21. package/esm/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
  22. package/esm/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
  23. package/esm/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
  24. package/esm/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
  25. package/esm/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +16 -2
  26. package/esm/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
  27. package/esm/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
  28. package/esm/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
  29. package/esm/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
  30. package/esm/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
  31. package/esm/TimeRangePicker/shared.js +3 -4
  32. package/esm/index.js +1 -1
  33. package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
  34. package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
  35. package/esm/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
  36. package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
  37. package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
  38. package/esm/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
  39. package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
  40. package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
  41. package/esm/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
  42. package/esm/internals/models/rangePickerProps.d.ts +14 -0
  43. package/esm/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
  44. package/esm/internals/utils/createRangePickerStepNavigation.js +31 -0
  45. package/esm/internals/utils/releaseInfo.js +1 -1
  46. package/esm/managers/useDateRangeManager.js +9 -10
  47. package/esm/managers/useDateTimeRangeManager.js +10 -10
  48. package/esm/managers/useTimeRangeManager.js +10 -8
  49. package/index.js +1 -1
  50. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
  51. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
  52. package/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
  53. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
  54. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
  55. package/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
  56. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
  57. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
  58. package/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
  59. package/internals/models/rangePickerProps.d.ts +14 -0
  60. package/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
  61. package/internals/utils/createRangePickerStepNavigation.js +37 -0
  62. package/internals/utils/releaseInfo.js +1 -1
  63. package/managers/useDateRangeManager.js +8 -9
  64. package/managers/useDateTimeRangeManager.js +9 -9
  65. package/managers/useTimeRangeManager.js +9 -7
  66. package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -8
  67. package/modern/DateRangePicker/shared.js +3 -8
  68. package/modern/DateRangePickerDay/DateRangePickerDay.js +1 -1
  69. package/modern/DateTimeRangePicker/shared.js +3 -12
  70. package/modern/DesktopDateRangePicker/DesktopDateRangePicker.js +2 -1
  71. package/modern/DesktopDateTimeRangePicker/DesktopDateTimeRangePicker.js +9 -1
  72. package/modern/DesktopTimeRangePicker/DesktopTimeRangePicker.js +9 -1
  73. package/modern/MobileDateRangePicker/MobileDateRangePicker.js +2 -1
  74. package/modern/MobileDateTimeRangePicker/MobileDateTimeRangePicker.js +16 -2
  75. package/modern/MobileTimeRangePicker/MobileTimeRangePicker.js +9 -1
  76. package/modern/SingleInputDateRangeField/SingleInputDateRangeField.js +4 -4
  77. package/modern/SingleInputDateTimeRangeField/SingleInputDateTimeRangeField.js +4 -4
  78. package/modern/SingleInputTimeRangeField/SingleInputTimeRangeField.js +4 -4
  79. package/modern/StaticDateRangePicker/StaticDateRangePicker.js +2 -1
  80. package/modern/TimeRangePicker/shared.js +3 -4
  81. package/modern/index.js +1 -1
  82. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.d.ts +1 -0
  83. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.js +10 -3
  84. package/modern/internals/hooks/useDesktopRangePicker/useDesktopRangePicker.types.d.ts +3 -3
  85. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.d.ts +1 -0
  86. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.js +10 -3
  87. package/modern/internals/hooks/useMobileRangePicker/useMobileRangePicker.types.d.ts +3 -3
  88. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.d.ts +1 -0
  89. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.js +10 -3
  90. package/modern/internals/hooks/useStaticRangePicker/useStaticRangePicker.types.d.ts +7 -0
  91. package/modern/internals/models/rangePickerProps.d.ts +14 -0
  92. package/modern/internals/utils/createRangePickerStepNavigation.d.ts +16 -0
  93. package/modern/internals/utils/createRangePickerStepNavigation.js +31 -0
  94. package/modern/internals/utils/releaseInfo.js +1 -1
  95. package/modern/managers/useDateRangeManager.js +9 -10
  96. package/modern/managers/useDateTimeRangeManager.js +10 -10
  97. package/modern/managers/useTimeRangeManager.js +10 -8
  98. package/package.json +8 -8
  99. package/tsconfig.build.tsbuildinfo +1 -1
  100. package/esm/internals/hooks/models/index.d.ts +0 -1
  101. package/esm/internals/hooks/models/index.js +0 -1
  102. package/esm/internals/hooks/models/useRangePicker.d.ts +0 -8
  103. package/esm/internals/hooks/models/useRangePicker.js +0 -1
  104. package/internals/hooks/models/index.d.ts +0 -1
  105. package/internals/hooks/models/index.js +0 -5
  106. package/internals/hooks/models/useRangePicker.d.ts +0 -8
  107. package/internals/hooks/models/useRangePicker.js +0 -5
  108. package/modern/internals/hooks/models/index.d.ts +0 -1
  109. package/modern/internals/hooks/models/index.js +0 -1
  110. package/modern/internals/hooks/models/useRangePicker.d.ts +0 -8
  111. 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 = "MTc0MjUxNTIwMDAwMA==";
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 { getDateFieldInternalPropsDefaults, useUtils } from '@mui/x-date-pickers/internals';
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
- internal_applyDefaultsToFieldInternalProps: ({
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 { getDateTimeFieldInternalPropsDefaults, useUtils } from '@mui/x-date-pickers/internals';
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
- internal_applyDefaultsToFieldInternalProps: ({
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 { getTimeFieldInternalPropsDefaults, useUtils } from '@mui/x-date-pickers/internals';
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
- internal_applyDefaultsToFieldInternalProps: ({
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.1",
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.26.10",
36
- "@mui/utils": "^7.0.0 || ^7.0.0-beta",
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-internals": "8.0.0-beta.0",
41
- "@mui/x-date-pickers": "8.0.0-beta.1",
42
- "@mui/x-license": "8.0.0-beta.0"
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 || ^7.0.0-beta",
48
- "@mui/system": "^5.15.14 || ^6.0.0 || ^7.0.0 || ^7.0.0-beta",
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",