@mui/x-date-pickers-pro 8.0.0-beta.1 → 8.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +94 -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/TimeRangePicker/shared.js +2 -3
  7. package/esm/DateRangeCalendar/DateRangeCalendar.js +3 -8
  8. package/esm/DateRangePicker/shared.js +3 -8
  9. package/esm/DateRangePickerDay/DateRangePickerDay.js +1 -1
  10. package/esm/DateTimeRangePicker/shared.js +3 -12
  11. package/esm/TimeRangePicker/shared.js +3 -4
  12. package/esm/index.js +1 -1
  13. package/esm/internals/utils/releaseInfo.js +1 -1
  14. package/esm/managers/useDateRangeManager.js +9 -10
  15. package/esm/managers/useDateTimeRangeManager.js +10 -10
  16. package/esm/managers/useTimeRangeManager.js +10 -8
  17. package/index.js +1 -1
  18. package/internals/utils/releaseInfo.js +1 -1
  19. package/managers/useDateRangeManager.js +8 -9
  20. package/managers/useDateTimeRangeManager.js +9 -9
  21. package/managers/useTimeRangeManager.js +9 -7
  22. package/modern/DateRangeCalendar/DateRangeCalendar.js +3 -8
  23. package/modern/DateRangePicker/shared.js +3 -8
  24. package/modern/DateRangePickerDay/DateRangePickerDay.js +1 -1
  25. package/modern/DateTimeRangePicker/shared.js +3 -12
  26. package/modern/TimeRangePicker/shared.js +3 -4
  27. package/modern/index.js +1 -1
  28. package/modern/internals/utils/releaseInfo.js +1 -1
  29. package/modern/managers/useDateRangeManager.js +9 -10
  30. package/modern/managers/useDateTimeRangeManager.js +10 -10
  31. package/modern/managers/useTimeRangeManager.js +10 -8
  32. package/package.json +4 -4
  33. package/tsconfig.build.tsbuildinfo +1 -1
@@ -15,7 +15,7 @@ import { styled, useThemeProps } from '@mui/material/styles';
15
15
  import composeClasses from '@mui/utils/composeClasses';
16
16
  import useId from '@mui/utils/useId';
17
17
  import { Watermark } from '@mui/x-license';
18
- import { applyDefaultDate, DayCalendar, useReduceAnimations, useCalendarState, useDefaultDates, useUtils, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, useControlledValue, useViews, usePickerPrivateContext, areDatesEqual } from '@mui/x-date-pickers/internals';
18
+ import { DayCalendar, useReduceAnimations, useCalendarState, useUtils, DEFAULT_DESKTOP_MODE_MEDIA_QUERY, useControlledValue, useViews, usePickerPrivateContext, areDatesEqual, useApplyDefaultValuesToDateValidationProps } from '@mui/x-date-pickers/internals';
19
19
  import { warnOnce } from '@mui/x-internals/warning';
20
20
  import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
21
21
  import { dateRangeCalendarClasses, getDateRangeCalendarUtilityClass } from "./dateRangeCalendarClasses.js";
@@ -74,25 +74,20 @@ const InnerDayCalendarForRange = styled(DayCalendar)(({
74
74
  }));
75
75
  const DayCalendarForRange = InnerDayCalendarForRange;
76
76
  function useDateRangeCalendarDefaultizedProps(props, name) {
77
- const utils = useUtils();
78
- const defaultDates = useDefaultDates();
79
77
  const themeProps = useThemeProps({
80
78
  props,
81
79
  name
82
80
  });
83
81
  const reduceAnimations = useReduceAnimations(themeProps.reduceAnimations);
84
- return _extends({}, themeProps, {
82
+ const validationProps = useApplyDefaultValuesToDateValidationProps(themeProps);
83
+ return _extends({}, themeProps, validationProps, {
85
84
  renderLoading: themeProps.renderLoading ?? (() => /*#__PURE__*/_jsx("span", {
86
85
  children: "..."
87
86
  })),
88
87
  reduceAnimations,
89
88
  loading: props.loading ?? false,
90
- disablePast: props.disablePast ?? false,
91
- disableFuture: props.disableFuture ?? false,
92
89
  openTo: themeProps.openTo ?? 'day',
93
90
  views: themeProps.views ?? ['day'],
94
- minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
95
- maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
96
91
  calendars: themeProps.calendars ?? 2,
97
92
  disableDragEditing: themeProps.disableDragEditing ?? false,
98
93
  availableRangePositions: themeProps.availableRangePositions ?? ['start', 'end']
@@ -1,15 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
- import { useDefaultDates, useUtils, applyDefaultDate } from '@mui/x-date-pickers/internals';
4
+ import { useApplyDefaultValuesToDateValidationProps } from '@mui/x-date-pickers/internals';
5
5
  import { DateRangePickerToolbar } from "./DateRangePickerToolbar.js";
6
6
  export function useDateRangePickerDefaultizedProps(props, name) {
7
- const utils = useUtils();
8
- const defaultDates = useDefaultDates();
9
7
  const themeProps = useThemeProps({
10
8
  props,
11
9
  name
12
10
  });
11
+ const validationProps = useApplyDefaultValuesToDateValidationProps(themeProps);
13
12
  const localeText = React.useMemo(() => {
14
13
  if (themeProps.localeText?.toolbarTitle == null) {
15
14
  return themeProps.localeText;
@@ -18,12 +17,8 @@ export function useDateRangePickerDefaultizedProps(props, name) {
18
17
  dateRangePickerToolbarTitle: themeProps.localeText.toolbarTitle
19
18
  });
20
19
  }, [themeProps.localeText]);
21
- return _extends({}, themeProps, {
20
+ return _extends({}, themeProps, validationProps, {
22
21
  localeText,
23
- disableFuture: themeProps.disableFuture ?? false,
24
- disablePast: themeProps.disablePast ?? false,
25
- minDate: applyDefaultDate(utils, themeProps.minDate, defaultDates.minDate),
26
- maxDate: applyDefaultDate(utils, themeProps.maxDate, defaultDates.maxDate),
27
22
  slots: _extends({
28
23
  toolbar: DateRangePickerToolbar
29
24
  }, themeProps.slots)
@@ -89,7 +89,7 @@ const DateRangePickerDayRoot = styled('div', {
89
89
  }, {
90
90
  props: {
91
91
  isDayFillerCell: false,
92
- isHighlighting: true
92
+ isDaySelected: true
93
93
  },
94
94
  style: {
95
95
  borderRadius: 0,
@@ -1,15 +1,15 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import { useThemeProps } from '@mui/material/styles';
3
- import { useDefaultDates, useUtils, applyDefaultDate, applyDefaultViewProps, resolveTimeViewsResponse } from '@mui/x-date-pickers/internals';
3
+ import { useUtils, applyDefaultViewProps, resolveTimeViewsResponse, useApplyDefaultValuesToDateTimeValidationProps } from '@mui/x-date-pickers/internals';
4
4
  import { DateTimeRangePickerToolbar } from "./DateTimeRangePickerToolbar.js";
5
5
  import { DateTimeRangePickerTabs } from "./DateTimeRangePickerTabs.js";
6
6
  export function useDateTimeRangePickerDefaultizedProps(props, name) {
7
7
  const utils = useUtils();
8
- const defaultDates = useDefaultDates();
9
8
  const themeProps = useThemeProps({
10
9
  props,
11
10
  name
12
11
  });
12
+ const validationProps = useApplyDefaultValuesToDateTimeValidationProps(themeProps);
13
13
  const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
14
14
  const {
15
15
  openTo,
@@ -31,22 +31,13 @@ export function useDateTimeRangePickerDefaultizedProps(props, name) {
31
31
  timeSteps: themeProps.timeSteps,
32
32
  views: defaultViews
33
33
  });
34
- return _extends({}, themeProps, {
34
+ return _extends({}, themeProps, validationProps, {
35
35
  timeSteps,
36
36
  openTo,
37
37
  shouldRenderTimeInASingleColumn,
38
38
  thresholdToRenderTimeInASingleColumn,
39
39
  views,
40
40
  ampm,
41
- disableFuture: themeProps.disableFuture ?? false,
42
- disablePast: themeProps.disablePast ?? false,
43
- minDate: applyDefaultDate(utils, themeProps.minDateTime ?? themeProps.minDate, defaultDates.minDate),
44
- maxDate: applyDefaultDate(utils, themeProps.maxDateTime ?? themeProps.maxDate, defaultDates.maxDate),
45
- minTime: themeProps.minDateTime ?? themeProps.minTime,
46
- maxTime: themeProps.maxDateTime ?? themeProps.maxTime,
47
- disableIgnoringDatePartForTimeValidation: themeProps.disableIgnoringDatePartForTimeValidation ?? Boolean(themeProps.minDateTime || themeProps.maxDateTime ||
48
- // allow digital clocks to correctly check time validity: https://github.com/mui/mui-x/issues/12048
49
- themeProps.disablePast || themeProps.disableFuture),
50
41
  slots: _extends({
51
42
  tabs: DateTimeRangePickerTabs,
52
43
  toolbar: DateTimeRangePickerToolbar
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import { useThemeProps } from '@mui/material/styles';
4
- import { useUtils, applyDefaultViewProps, resolveTimeViewsResponse } from '@mui/x-date-pickers/internals';
4
+ import { useUtils, applyDefaultViewProps, resolveTimeViewsResponse, useApplyDefaultValuesToTimeValidationProps } from '@mui/x-date-pickers/internals';
5
5
  import { TimeRangePickerToolbar } from "./TimeRangePickerToolbar.js";
6
6
  import { TimeRangePickerTabs } from "./TimeRangePickerTabs.js";
7
7
  export function useTimeRangePickerDefaultizedProps(props, name) {
@@ -10,6 +10,7 @@ export function useTimeRangePickerDefaultizedProps(props, name) {
10
10
  props,
11
11
  name
12
12
  });
13
+ const validationProps = useApplyDefaultValuesToTimeValidationProps(themeProps);
13
14
  const ampm = themeProps.ampm ?? utils.is12HourCycleInCurrentLocale();
14
15
  const {
15
16
  openTo,
@@ -39,7 +40,7 @@ export function useTimeRangePickerDefaultizedProps(props, name) {
39
40
  timeSteps: themeProps.timeSteps,
40
41
  views: defaultViews
41
42
  });
42
- return _extends({}, themeProps, {
43
+ return _extends({}, themeProps, validationProps, {
43
44
  localeText,
44
45
  timeSteps,
45
46
  openTo,
@@ -47,8 +48,6 @@ export function useTimeRangePickerDefaultizedProps(props, name) {
47
48
  thresholdToRenderTimeInASingleColumn,
48
49
  views,
49
50
  ampm,
50
- disableFuture: themeProps.disableFuture ?? false,
51
- disablePast: themeProps.disablePast ?? false,
52
51
  slots: _extends({
53
52
  tabs: TimeRangePickerTabs,
54
53
  toolbar: TimeRangePickerToolbar
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-date-pickers-pro v8.0.0-beta.1
2
+ * @mui/x-date-pickers-pro v8.0.0-beta.2
3
3
  *
4
4
  * @license MUI X Commercial
5
5
  * This source code is licensed under the commercial license found in the
@@ -1,6 +1,6 @@
1
1
  import { ponyfillGlobal } from '@mui/utils';
2
2
  export const getReleaseInfo = () => {
3
- const releaseInfo = "MTc0MjUxNTIwMDAwMA==";
3
+ const releaseInfo = "MTc0MzExMjgwMDAwMA==";
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.2",
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",
@@ -37,9 +37,9 @@
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-internals": "8.0.0-beta.2",
41
+ "@mui/x-license": "8.0.0-beta.2",
42
+ "@mui/x-date-pickers": "8.0.0-beta.2"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",