@mui/x-date-pickers 6.0.0-alpha.1 → 6.0.0-alpha.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 (117) hide show
  1. package/AdapterDateFns/index.js +4 -3
  2. package/AdapterDayjs/index.js +2 -2
  3. package/AdapterLuxon/index.js +1 -1
  4. package/AdapterMoment/index.js +2 -2
  5. package/CHANGELOG.md +76 -0
  6. package/CalendarPicker/CalendarPicker.d.ts +5 -5
  7. package/CalendarPicker/CalendarPicker.js +2 -12
  8. package/CalendarPicker/DayPicker.d.ts +17 -10
  9. package/CalendarPicker/DayPicker.js +74 -35
  10. package/DateField/useDateField.js +8 -7
  11. package/DatePicker/DatePicker.d.ts +4 -4
  12. package/DatePicker/DatePicker.js +0 -10
  13. package/DateTimeField/useDateTimeField.js +1 -1
  14. package/DateTimePicker/DateTimePicker.d.ts +4 -4
  15. package/DateTimePicker/DateTimePicker.js +0 -10
  16. package/DesktopDatePicker/DesktopDatePicker.d.ts +4 -4
  17. package/DesktopDatePicker/DesktopDatePicker.js +0 -10
  18. package/DesktopDateTimePicker/DesktopDateTimePicker.d.ts +4 -4
  19. package/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -10
  20. package/MobileDatePicker/MobileDatePicker.d.ts +4 -4
  21. package/MobileDatePicker/MobileDatePicker.js +0 -10
  22. package/MobileDateTimePicker/MobileDateTimePicker.d.ts +4 -4
  23. package/MobileDateTimePicker/MobileDateTimePicker.js +0 -10
  24. package/PickersDay/PickersDay.d.ts +4 -0
  25. package/PickersDay/PickersDay.js +7 -2
  26. package/StaticDatePicker/StaticDatePicker.d.ts +4 -4
  27. package/StaticDatePicker/StaticDatePicker.js +0 -10
  28. package/StaticDateTimePicker/StaticDateTimePicker.d.ts +4 -4
  29. package/StaticDateTimePicker/StaticDateTimePicker.js +0 -10
  30. package/TimeField/useTimeField.js +1 -1
  31. package/index.js +1 -1
  32. package/internals/components/CalendarOrClockPicker/CalendarOrClockPicker.d.ts +4 -4
  33. package/internals/hooks/useField/useField.interfaces.d.ts +8 -7
  34. package/internals/hooks/useField/useField.js +60 -25
  35. package/internals/hooks/useField/useField.utils.d.ts +9 -10
  36. package/internals/hooks/useField/useField.utils.js +129 -63
  37. package/internals/hooks/useField/useFieldState.d.ts +4 -4
  38. package/internals/hooks/useField/useFieldState.js +35 -21
  39. package/internals/index.d.ts +1 -1
  40. package/internals/models/muiPickersAdapter.d.ts +8 -1
  41. package/legacy/AdapterDateFns/index.js +4 -3
  42. package/legacy/AdapterDayjs/index.js +2 -2
  43. package/legacy/AdapterLuxon/index.js +1 -1
  44. package/legacy/AdapterMoment/index.js +2 -2
  45. package/legacy/CalendarPicker/CalendarPicker.js +2 -12
  46. package/legacy/CalendarPicker/DayPicker.js +69 -31
  47. package/legacy/DateField/useDateField.js +3 -6
  48. package/legacy/DatePicker/DatePicker.js +0 -10
  49. package/legacy/DateTimeField/useDateTimeField.js +1 -1
  50. package/legacy/DateTimePicker/DateTimePicker.js +0 -10
  51. package/legacy/DesktopDatePicker/DesktopDatePicker.js +0 -10
  52. package/legacy/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -10
  53. package/legacy/MobileDatePicker/MobileDatePicker.js +0 -10
  54. package/legacy/MobileDateTimePicker/MobileDateTimePicker.js +0 -10
  55. package/legacy/PickersDay/PickersDay.js +8 -2
  56. package/legacy/StaticDatePicker/StaticDatePicker.js +0 -10
  57. package/legacy/StaticDateTimePicker/StaticDateTimePicker.js +0 -10
  58. package/legacy/TimeField/useTimeField.js +1 -1
  59. package/legacy/index.js +1 -1
  60. package/legacy/internals/hooks/useField/useField.js +62 -27
  61. package/legacy/internals/hooks/useField/useField.utils.js +151 -67
  62. package/legacy/internals/hooks/useField/useFieldState.js +44 -23
  63. package/legacy/locales/index.js +1 -0
  64. package/legacy/locales/jaJP.js +65 -0
  65. package/locales/index.d.ts +1 -0
  66. package/locales/index.js +1 -0
  67. package/locales/jaJP.d.ts +35 -0
  68. package/locales/jaJP.js +51 -0
  69. package/modern/AdapterDateFns/index.js +4 -3
  70. package/modern/AdapterDayjs/index.js +2 -2
  71. package/modern/AdapterLuxon/index.js +1 -1
  72. package/modern/AdapterMoment/index.js +2 -2
  73. package/modern/CalendarPicker/CalendarPicker.js +2 -12
  74. package/modern/CalendarPicker/DayPicker.js +72 -35
  75. package/modern/DateField/useDateField.js +8 -7
  76. package/modern/DatePicker/DatePicker.js +0 -10
  77. package/modern/DateTimeField/useDateTimeField.js +1 -1
  78. package/modern/DateTimePicker/DateTimePicker.js +0 -10
  79. package/modern/DesktopDatePicker/DesktopDatePicker.js +0 -10
  80. package/modern/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -10
  81. package/modern/MobileDatePicker/MobileDatePicker.js +0 -10
  82. package/modern/MobileDateTimePicker/MobileDateTimePicker.js +0 -10
  83. package/modern/PickersDay/PickersDay.js +7 -2
  84. package/modern/StaticDatePicker/StaticDatePicker.js +0 -10
  85. package/modern/StaticDateTimePicker/StaticDateTimePicker.js +0 -10
  86. package/modern/TimeField/useTimeField.js +1 -1
  87. package/modern/index.js +1 -1
  88. package/modern/internals/hooks/useField/useField.js +60 -25
  89. package/modern/internals/hooks/useField/useField.utils.js +129 -63
  90. package/modern/internals/hooks/useField/useFieldState.js +35 -21
  91. package/modern/locales/index.js +1 -0
  92. package/modern/locales/jaJP.js +47 -0
  93. package/node/AdapterDateFns/index.js +4 -3
  94. package/node/AdapterDayjs/index.js +2 -2
  95. package/node/AdapterLuxon/index.js +1 -1
  96. package/node/AdapterMoment/index.js +2 -2
  97. package/node/CalendarPicker/CalendarPicker.js +2 -12
  98. package/node/CalendarPicker/DayPicker.js +75 -35
  99. package/node/DateField/useDateField.js +8 -7
  100. package/node/DatePicker/DatePicker.js +0 -10
  101. package/node/DateTimeField/useDateTimeField.js +1 -1
  102. package/node/DateTimePicker/DateTimePicker.js +0 -10
  103. package/node/DesktopDatePicker/DesktopDatePicker.js +0 -10
  104. package/node/DesktopDateTimePicker/DesktopDateTimePicker.js +0 -10
  105. package/node/MobileDatePicker/MobileDatePicker.js +0 -10
  106. package/node/MobileDateTimePicker/MobileDateTimePicker.js +0 -10
  107. package/node/PickersDay/PickersDay.js +7 -2
  108. package/node/StaticDatePicker/StaticDatePicker.js +0 -10
  109. package/node/StaticDateTimePicker/StaticDateTimePicker.js +0 -10
  110. package/node/TimeField/useTimeField.js +1 -1
  111. package/node/index.js +1 -1
  112. package/node/internals/hooks/useField/useField.js +59 -24
  113. package/node/internals/hooks/useField/useField.utils.js +137 -68
  114. package/node/internals/hooks/useField/useFieldState.js +34 -20
  115. package/node/locales/index.js +13 -0
  116. package/node/locales/jaJP.js +60 -0
  117. package/package.json +2 -2
@@ -7,6 +7,7 @@ const formatTokenMap = {
7
7
  yy: 'year',
8
8
  yyy: 'year',
9
9
  yyyy: 'year',
10
+ M: 'month',
10
11
  MM: 'month',
11
12
  MMMM: {
12
13
  sectionName: 'month',
@@ -33,9 +34,9 @@ const formatTokenMap = {
33
34
  hh: 'hour',
34
35
  mm: 'minute',
35
36
  ss: 'second',
36
- a: 'am-pm',
37
- aa: 'am-pm',
38
- aaa: 'am-pm'
37
+ a: 'meridiem',
38
+ aa: 'meridiem',
39
+ aaa: 'meridiem'
39
40
  };
40
41
  export class AdapterDateFns extends BaseAdapterDateFns {
41
42
  constructor(...args) {
@@ -22,8 +22,8 @@ const formatTokenMap = {
22
22
  mm: 'minute',
23
23
  s: 'second',
24
24
  ss: 'second',
25
- A: 'am-pm',
26
- a: 'am-pm'
25
+ A: 'meridiem',
26
+ a: 'meridiem'
27
27
  };
28
28
  export class AdapterDayjs extends BaseAdapterDayjs {
29
29
  constructor(...args) {
@@ -11,7 +11,7 @@ const formatTokenMap = {
11
11
  HH: 'hour',
12
12
  h: 'hour',
13
13
  hh: 'hour',
14
- a: 'am-pm',
14
+ a: 'meridiem',
15
15
  d: 'day',
16
16
  dd: 'day',
17
17
  L: 'month',
@@ -23,8 +23,8 @@ const formatTokenMap = {
23
23
  YYYY: 'year',
24
24
  YYYYYY: 'year',
25
25
  // AM / PM
26
- A: 'am-pm',
27
- a: 'am-pm',
26
+ A: 'meridiem',
27
+ a: 'meridiem',
28
28
  // Hour
29
29
  H: 'hour',
30
30
  HH: 'hour',
package/CHANGELOG.md CHANGED
@@ -3,6 +3,82 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## v6.0.0-alpha.2
7
+
8
+ _Oct 7, 2022_
9
+
10
+ We'd like to offer a big thanks to the 10 contributors who made this release possible. Here are some highlights ✨:
11
+
12
+ - 🚀 Further progress on stabilizing new date field components
13
+ - 🎁 Improve support for theme augmentation in the DataGrid (#6269) @cherniavskii
14
+ - 🌍 Add Japanese (ja-JP) locale to pickers (#6365) @sho918
15
+ - 📚 Documentation improvements
16
+ - 🐞 Bugfixes
17
+
18
+ ### `@mui/x-data-grid@v6.0.0-alpha.2` / `@mui/x-data-grid-pro@v6.0.0-alpha.2` / `@mui/x-data-grid-premium@v6.0.0-alpha.2`
19
+
20
+ #### Breaking changes
21
+
22
+ - 🎁 The aggregation is no longer experimental.
23
+
24
+ You can now use the aggregation without the `experimentalFeatures.aggregation` flag enabled.
25
+
26
+ ```diff
27
+ <DataGridPremium
28
+ - experimentalFeatures={{ aggregation: true }}
29
+ />
30
+ ```
31
+
32
+ The aggregation of the columns through the column menu is now enabled by default on `DataGridPremium`. You can set `disableAggregation={true}` to disable it.
33
+
34
+ #### Changes
35
+
36
+ - [DataGrid] Add filter item ID to `.MuiDataGrid-filterForm` (#6313) @m4theushw
37
+ - [DataGrid] Add missing `valueOptions` (#6401) @DanailH
38
+ - [DataGrid] Don't start edit mode when pressing Shift + Space (#6228) @m4theushw
39
+ - [DataGrid] Fix error when using column grouping with all columns hidden (#6405) @alexfauquette
40
+ - [DataGrid] Pass generics to the components in the theme augmentation (#6269) @cherniavskii
41
+ - [DataGridPremium] Remove the aggregation from the experimental features (#6372) @flaviendelangle
42
+
43
+ ### `@mui/x-date-pickers@v6.0.0-alpha.2` / `@mui/x-date-pickers-pro@v6.0.0-alpha.2`
44
+
45
+ #### Breaking changes
46
+
47
+ - The `renderDay` prop has been replaced by a `Day` component slot.
48
+ You can find more information about this pattern in the [MUI Base documentation](https://mui.com/base/getting-started/usage/#shared-props).
49
+
50
+ ```diff
51
+ // Same for any other date, date time or date range picker.
52
+ <DatePicker
53
+ - renderDay={(_, dayProps) => <CustomDay {...dayProps} />}
54
+ + components={{ Day: CustomDay }}
55
+ />
56
+ ```
57
+
58
+ #### Changes
59
+
60
+ - [DateRangePicker] Fix the shape of the first selected day when the start date has an hour set (#6403) @flaviendelangle
61
+ - [l10n] Add Japanese (ja-JP) locale to pickers (#6365) @sho918
62
+ - [DateRangePicker] Force focus to stay on inputs (#6324) @alexfauquette
63
+ - [pickers] Improve edition on field components (#6339) @flaviendelangle
64
+ - [pickers] Improve field selection behaviors (#6317) @flaviendelangle
65
+ - [pickers] Replace the `renderDay` prop with a `Day` component slot (#6293) @flaviendelangle
66
+
67
+ ### Docs
68
+
69
+ - [docs] Apply style guide to Data Grid Aggregation page (#5781) @samuelsycamore
70
+ - [docs] Fix code examples of editing cells (#6004) @TiagoPortfolio
71
+ - [docs] Fix customized day rendering demo style (#6342) (#6399) @Ambrish-git
72
+ - [docs] Implement Style Guide on "Advanced" Data Grid doc pages (#6331) @samuelsycamore
73
+ - [docs] Use components instead of demos for `SelectorsDocs` (#6103) @flaviendelangle
74
+ - [license] Add new license status 'Out of scope' (#5260) @flaviendelangle
75
+
76
+ ### Core
77
+
78
+ - [core] Speedup of yarn install in the CI (#6395) @oliviertassinari
79
+ - [test] Remove redundant test clean-ups (#6377) @oliviertassinari
80
+ - [test] Replace `React.render` with `React.createRoot` in e2e tests (#6393) @m4theushw
81
+
6
82
  ## 6.0.0-alpha.1
7
83
 
8
84
  _Sep 29, 2022_
@@ -1,16 +1,16 @@
1
1
  import * as React from 'react';
2
2
  import { Theme } from '@mui/material/styles';
3
3
  import { SxProps } from '@mui/system';
4
- import { ExportedDayPickerProps } from './DayPicker';
4
+ import { DayPickerSlotsComponent, DayPickerSlotsComponentsProps, ExportedDayPickerProps } from './DayPicker';
5
5
  import { PickerOnChangeFn } from '../internals/hooks/useViews';
6
6
  import { ExportedCalendarHeaderProps, PickersCalendarHeaderSlotsComponent, PickersCalendarHeaderSlotsComponentsProps } from './PickersCalendarHeader';
7
7
  import { CalendarPickerView } from '../internals/models';
8
8
  import { CalendarPickerClasses } from './calendarPickerClasses';
9
9
  import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from '../internals/hooks/validation/models';
10
10
  import { DefaultizedProps } from '../internals/models/helpers';
11
- export interface CalendarPickerSlotsComponent extends PickersCalendarHeaderSlotsComponent {
11
+ export interface CalendarPickerSlotsComponent<TDate> extends PickersCalendarHeaderSlotsComponent, DayPickerSlotsComponent<TDate> {
12
12
  }
13
- export interface CalendarPickerSlotsComponentsProps extends PickersCalendarHeaderSlotsComponentsProps {
13
+ export interface CalendarPickerSlotsComponentsProps<TDate> extends PickersCalendarHeaderSlotsComponentsProps, DayPickerSlotsComponentsProps<TDate> {
14
14
  }
15
15
  export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate>, BaseDateValidationProps<TDate>, DayValidationProps<TDate>, YearValidationProps<TDate>, MonthValidationProps<TDate>, ExportedCalendarHeaderProps<TDate> {
16
16
  autoFocus?: boolean;
@@ -24,12 +24,12 @@ export interface CalendarPickerProps<TDate> extends ExportedDayPickerProps<TDate
24
24
  * Overrideable components.
25
25
  * @default {}
26
26
  */
27
- components?: Partial<CalendarPickerSlotsComponent>;
27
+ components?: Partial<CalendarPickerSlotsComponent<TDate>>;
28
28
  /**
29
29
  * The props used for each component slot.
30
30
  * @default {}
31
31
  */
32
- componentsProps?: Partial<CalendarPickerSlotsComponentsProps>;
32
+ componentsProps?: Partial<CalendarPickerSlotsComponentsProps<TDate>>;
33
33
  value: TDate | null;
34
34
  /**
35
35
  * Default calendar month displayed when `value={null}`.
@@ -109,7 +109,6 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
109
109
  onFocusedViewChange,
110
110
  showDaysOutsideCurrentMonth,
111
111
  dayOfWeekFormatter,
112
- renderDay,
113
112
  components,
114
113
  componentsProps,
115
114
  loading,
@@ -312,7 +311,8 @@ export const CalendarPicker = /*#__PURE__*/React.forwardRef(function CalendarPic
312
311
  gridLabelId: gridLabelId,
313
312
  showDaysOutsideCurrentMonth: showDaysOutsideCurrentMonth,
314
313
  dayOfWeekFormatter: dayOfWeekFormatter,
315
- renderDay: renderDay,
314
+ components: components,
315
+ componentsProps: componentsProps,
316
316
  loading: loading,
317
317
  renderLoading: renderLoading
318
318
  }))]
@@ -441,16 +441,6 @@ process.env.NODE_ENV !== "production" ? CalendarPicker.propTypes = {
441
441
  */
442
442
  reduceAnimations: PropTypes.bool,
443
443
 
444
- /**
445
- * Custom renderer for day. Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
446
- * @template TDate
447
- * @param {TDate} day The day to render.
448
- * @param {Array<TDate | null>} selectedDays The days currently selected.
449
- * @param {PickersDayProps<TDate>} pickersDayProps The props of the day to render.
450
- * @returns {JSX.Element} The element representing the day.
451
- */
452
- renderDay: PropTypes.func,
453
-
454
444
  /**
455
445
  * Component displaying when passed `loading` true.
456
446
  * @returns {React.ReactNode} The node to render when loading.
@@ -1,9 +1,23 @@
1
1
  import * as React from 'react';
2
- import { PickersDayProps } from '../PickersDay/PickersDay';
2
+ import { SlotComponentProps } from '@mui/base';
3
+ import { PickersDay, PickersDayProps } from '../PickersDay/PickersDay';
3
4
  import { PickerOnChangeFn } from '../internals/hooks/useViews';
4
5
  import { SlideDirection, SlideTransitionProps } from './PickersSlideTransition';
5
6
  import { BaseDateValidationProps, DayValidationProps, MonthValidationProps, YearValidationProps } from '../internals/hooks/validation/models';
6
7
  import { DayPickerClasses } from './dayPickerClasses';
8
+ export interface DayPickerSlotsComponent<TDate> {
9
+ /**
10
+ * Custom component for day.
11
+ * Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
12
+ * @default PickersDay
13
+ */
14
+ Day?: React.ElementType<PickersDayProps<TDate>>;
15
+ }
16
+ export interface DayPickerSlotsComponentsProps<TDate> {
17
+ day?: SlotComponentProps<typeof PickersDay, {}, DayPickerProps<TDate> & {
18
+ day: TDate;
19
+ }>;
20
+ }
7
21
  export interface ExportedDayPickerProps<TDate> extends Pick<PickersDayProps<TDate>, 'disableHighlightToday' | 'showDaysOutsideCurrentMonth'> {
8
22
  /**
9
23
  * If `true` renders `LoadingComponent` in calendar instead of calendar view.
@@ -11,15 +25,6 @@ export interface ExportedDayPickerProps<TDate> extends Pick<PickersDayProps<TDat
11
25
  * @default false
12
26
  */
13
27
  loading?: boolean;
14
- /**
15
- * Custom renderer for day. Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
16
- * @template TDate
17
- * @param {TDate} day The day to render.
18
- * @param {Array<TDate | null>} selectedDays The days currently selected.
19
- * @param {PickersDayProps<TDate>} pickersDayProps The props of the day to render.
20
- * @returns {JSX.Element} The element representing the day.
21
- */
22
- renderDay?: (day: TDate, selectedDays: TDate[], pickersDayProps: PickersDayProps<TDate>) => JSX.Element;
23
28
  /**
24
29
  * Component displaying when passed `loading` true.
25
30
  * @returns {React.ReactNode} The node to render when loading.
@@ -53,6 +58,8 @@ export interface DayPickerProps<TDate> extends ExportedDayPickerProps<TDate>, Da
53
58
  onFocusedViewChange?: (newHasFocus: boolean) => void;
54
59
  gridLabelId?: string;
55
60
  classes?: Partial<DayPickerClasses>;
61
+ components?: DayPickerSlotsComponent<TDate>;
62
+ componentsProps?: DayPickerSlotsComponentsProps<TDate>;
56
63
  }
57
64
  /**
58
65
  * @ignore - do not document.
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import Typography from '@mui/material/Typography';
4
+ import { useSlotProps } from '@mui/base/utils';
4
5
  import { styled, useTheme, useThemeProps } from '@mui/material/styles';
5
6
  import { unstable_composeClasses as composeClasses } from '@mui/material';
6
7
  import clsx from 'clsx';
@@ -90,10 +91,71 @@ const PickersCalendarWeek = styled('div', {
90
91
  display: 'flex',
91
92
  justifyContent: 'center'
92
93
  });
94
+
95
+ const WrappedDay = ({
96
+ parentProps,
97
+ day,
98
+ focusableDay,
99
+ selectedDays,
100
+ onFocus,
101
+ onBlur,
102
+ onKeyDown,
103
+ onDaySelect,
104
+ isDateDisabled,
105
+ currentMonthNumber
106
+ }) => {
107
+ var _components$Day;
108
+
109
+ const utils = useUtils();
110
+ const now = useNow();
111
+ const {
112
+ disabled,
113
+ disableHighlightToday,
114
+ isMonthSwitchingAnimating,
115
+ showDaysOutsideCurrentMonth,
116
+ hasFocus,
117
+ components,
118
+ componentsProps
119
+ } = parentProps;
120
+ const isFocusableDay = focusableDay !== null && utils.isSameDay(day, focusableDay);
121
+ const isSelected = selectedDays.some(selectedDay => utils.isSameDay(selectedDay, day));
122
+ const isToday = utils.isSameDay(day, now);
123
+ const Day = (_components$Day = components == null ? void 0 : components.Day) != null ? _components$Day : PickersDay;
124
+ const dayProps = useSlotProps({
125
+ elementType: Day,
126
+ externalSlotProps: componentsProps == null ? void 0 : componentsProps.day,
127
+ additionalProps: {
128
+ disableHighlightToday,
129
+ onKeyDown,
130
+ onFocus,
131
+ onBlur,
132
+ onDaySelect,
133
+ showDaysOutsideCurrentMonth,
134
+ role: 'gridcell',
135
+ isAnimating: isMonthSwitchingAnimating,
136
+ selectedDays
137
+ },
138
+ ownerState: _extends({}, parentProps, {
139
+ day
140
+ })
141
+ });
142
+ return /*#__PURE__*/_jsx(Day, _extends({}, dayProps, {
143
+ day: day,
144
+ disabled: disabled || isDateDisabled(day),
145
+ autoFocus: hasFocus && isFocusableDay,
146
+ today: isToday,
147
+ outsideCurrentMonth: utils.getMonth(day) !== currentMonthNumber,
148
+ selected: isSelected,
149
+ tabIndex: isFocusableDay ? 0 : -1,
150
+ "aria-selected": isSelected,
151
+ "aria-current": isToday ? 'date' : undefined
152
+ }));
153
+ };
93
154
  /**
94
155
  * @ignore - do not document.
95
156
  */
96
157
 
158
+
97
159
  export function DayPicker(inProps) {
98
160
  const now = useNow();
99
161
  const utils = useUtils();
@@ -107,20 +169,15 @@ export function DayPicker(inProps) {
107
169
  className,
108
170
  currentMonth,
109
171
  selectedDays,
110
- disabled,
111
- disableHighlightToday,
112
172
  focusedDay,
113
- isMonthSwitchingAnimating,
114
173
  loading,
115
174
  onSelectedDaysChange,
116
175
  onMonthSwitchingAnimationEnd,
117
176
  readOnly,
118
177
  reduceAnimations,
119
- renderDay,
120
178
  renderLoading = () => /*#__PURE__*/_jsx("span", {
121
179
  children: "..."
122
180
  }),
123
- showDaysOutsideCurrentMonth,
124
181
  slideDirection,
125
182
  TransitionProps,
126
183
  disablePast,
@@ -305,36 +362,18 @@ export function DayPicker(inProps) {
305
362
  children: utils.getWeekArray(currentMonth).map(week => /*#__PURE__*/_jsx(PickersCalendarWeek, {
306
363
  role: "row",
307
364
  className: classes.weekContainer,
308
- children: week.map(day => {
309
- const isFocusableDay = focusableDay !== null && utils.isSameDay(day, focusableDay);
310
- const isSelected = validSelectedDays.some(selectedDay => utils.isSameDay(selectedDay, day));
311
- const isToday = utils.isSameDay(day, now);
312
- const pickersDayProps = {
313
- key: day == null ? void 0 : day.toString(),
314
- day,
315
- isAnimating: isMonthSwitchingAnimating,
316
- disabled: disabled || isDateDisabled(day),
317
- autoFocus: hasFocus && isFocusableDay,
318
- today: isToday,
319
- outsideCurrentMonth: utils.getMonth(day) !== currentMonthNumber,
320
- selected: isSelected,
321
- disableHighlightToday,
322
- showDaysOutsideCurrentMonth,
323
- onKeyDown: handleKeyDown,
324
- onFocus: handleFocus,
325
- onBlur: handleBlur,
326
- onDaySelect: handleDaySelect,
327
- tabIndex: isFocusableDay ? 0 : -1,
328
- role: 'gridcell',
329
- 'aria-selected': isSelected
330
- };
331
-
332
- if (isToday) {
333
- pickersDayProps['aria-current'] = 'date';
334
- }
335
-
336
- return renderDay ? renderDay(day, validSelectedDays, pickersDayProps) : /*#__PURE__*/_jsx(PickersDay, _extends({}, pickersDayProps), pickersDayProps.key);
337
- })
365
+ children: week.map(day => /*#__PURE__*/_jsx(WrappedDay, {
366
+ parentProps: props,
367
+ day: day,
368
+ selectedDays: validSelectedDays,
369
+ focusableDay: focusableDay,
370
+ onKeyDown: handleKeyDown,
371
+ onFocus: handleFocus,
372
+ onBlur: handleBlur,
373
+ onDaySelect: handleDaySelect,
374
+ isDateDisabled: isDateDisabled,
375
+ currentMonthNumber: currentMonthNumber
376
+ }, day.toString()))
338
377
  }, `week-${week[0]}`))
339
378
  })
340
379
  }))]
@@ -9,16 +9,17 @@ import { useUtils, useDefaultDates } from '../internals/hooks/useUtils';
9
9
  export const dateFieldValueManager = {
10
10
  updateReferenceValue: (utils, value, prevReferenceValue) => value == null || !utils.isValid(value) ? prevReferenceValue : value,
11
11
  getSectionsFromValue: (utils, prevSections, date, format) => addPositionPropertiesToSections(splitFormatIntoSections(utils, format, date)),
12
- getValueStrFromSections: sections => createDateStrFromSections(sections),
12
+ getValueStrFromSections: sections => createDateStrFromSections(sections, true),
13
13
  getActiveDateSections: sections => sections,
14
- getActiveDateManager: state => ({
14
+ getActiveDateManager: (utils, state) => ({
15
15
  activeDate: state.value,
16
16
  referenceActiveDate: state.referenceValue,
17
- getNewValueFromNewActiveDate: newActiveDate => ({
18
- value: newActiveDate,
19
- referenceValue: newActiveDate == null ? state.referenceValue : newActiveDate
20
- }),
21
- setActiveDateAsInvalid: () => null
17
+ getNewValueFromNewActiveDate: newActiveDate => {
18
+ return {
19
+ value: newActiveDate,
20
+ referenceValue: newActiveDate == null || !utils.isValid(newActiveDate) ? state.referenceValue : newActiveDate
21
+ };
22
+ }
22
23
  }),
23
24
  hasError: error => error != null,
24
25
  isSameError: isSameDateError
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { DesktopDatePickerProps, DesktopDatePickerSlotsComponent, DesktopDatePickerSlotsComponentsProps } from '../DesktopDatePicker';
3
3
  import { MobileDatePickerProps, MobileDatePickerSlotsComponent, MobileDatePickerSlotsComponentsProps } from '../MobileDatePicker';
4
- export interface DatePickerSlotsComponent extends MobileDatePickerSlotsComponent, DesktopDatePickerSlotsComponent {
4
+ export interface DatePickerSlotsComponent<TDate> extends MobileDatePickerSlotsComponent<TDate>, DesktopDatePickerSlotsComponent<TDate> {
5
5
  }
6
- export interface DatePickerSlotsComponentsProps extends MobileDatePickerSlotsComponentsProps, DesktopDatePickerSlotsComponentsProps {
6
+ export interface DatePickerSlotsComponentsProps<TDate> extends MobileDatePickerSlotsComponentsProps<TDate>, DesktopDatePickerSlotsComponentsProps<TDate> {
7
7
  }
8
8
  export interface DatePickerProps<TDate> extends Omit<DesktopDatePickerProps<TDate>, 'components' | 'componentsProps'>, Omit<MobileDatePickerProps<TDate>, 'components' | 'componentsProps'> {
9
9
  /**
@@ -16,12 +16,12 @@ export interface DatePickerProps<TDate> extends Omit<DesktopDatePickerProps<TDat
16
16
  * Overrideable components.
17
17
  * @default {}
18
18
  */
19
- components?: Partial<DatePickerSlotsComponent>;
19
+ components?: Partial<DatePickerSlotsComponent<TDate>>;
20
20
  /**
21
21
  * The props used for each component slot.
22
22
  * @default {}
23
23
  */
24
- componentsProps?: Partial<DatePickerSlotsComponentsProps>;
24
+ componentsProps?: Partial<DatePickerSlotsComponentsProps<TDate>>;
25
25
  }
26
26
  declare type DatePickerComponent = (<TDate>(props: DatePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
27
27
  propTypes?: any;
@@ -313,16 +313,6 @@ process.env.NODE_ENV !== "production" ? DatePicker.propTypes = {
313
313
  */
314
314
  reduceAnimations: PropTypes.bool,
315
315
 
316
- /**
317
- * Custom renderer for day. Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
318
- * @template TDate
319
- * @param {TDate} day The day to render.
320
- * @param {Array<TDate | null>} selectedDays The days currently selected.
321
- * @param {PickersDayProps<TDate>} pickersDayProps The props of the day to render.
322
- * @returns {JSX.Element} The element representing the day.
323
- */
324
- renderDay: PropTypes.func,
325
-
326
316
  /**
327
317
  * The `renderInput` prop allows you to customize the rendered input.
328
318
  * The `props` argument of this render prop contains props of [TextField](https://mui.com/material-ui/api/text-field/#props) that you need to forward.
@@ -85,6 +85,6 @@ export const useDateTimeField = ({
85
85
  valueManager: dateTimePickerValueManager,
86
86
  fieldValueManager: dateTimeFieldValueManager,
87
87
  validator: validateDateTime,
88
- supportedDateSections: ['year', 'month', 'day', 'hour', 'minute', 'second', 'am-pm']
88
+ supportedDateSections: ['year', 'month', 'day', 'hour', 'minute', 'second', 'meridiem']
89
89
  });
90
90
  };
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { DesktopDateTimePickerProps, DesktopDateTimePickerSlotsComponent, DesktopDateTimePickerSlotsComponentsProps } from '../DesktopDateTimePicker';
3
3
  import { MobileDateTimePickerProps, MobileDateTimePickerSlotsComponent, MobileDateTimePickerSlotsComponentsProps } from '../MobileDateTimePicker';
4
- export interface DateTimePickerSlotsComponent extends MobileDateTimePickerSlotsComponent, DesktopDateTimePickerSlotsComponent {
4
+ export interface DateTimePickerSlotsComponent<TDate> extends MobileDateTimePickerSlotsComponent<TDate>, DesktopDateTimePickerSlotsComponent<TDate> {
5
5
  }
6
- export interface DateTimePickerSlotsComponentsProps extends MobileDateTimePickerSlotsComponentsProps, DesktopDateTimePickerSlotsComponentsProps {
6
+ export interface DateTimePickerSlotsComponentsProps<TDate> extends MobileDateTimePickerSlotsComponentsProps<TDate>, DesktopDateTimePickerSlotsComponentsProps<TDate> {
7
7
  }
8
8
  export interface DateTimePickerProps<TDate> extends Omit<DesktopDateTimePickerProps<TDate>, 'components' | 'componentsProps'>, Omit<MobileDateTimePickerProps<TDate>, 'components' | 'componentsProps'> {
9
9
  /**
@@ -16,12 +16,12 @@ export interface DateTimePickerProps<TDate> extends Omit<DesktopDateTimePickerPr
16
16
  * Overrideable components.
17
17
  * @default {}
18
18
  */
19
- components?: Partial<DateTimePickerSlotsComponent>;
19
+ components?: Partial<DateTimePickerSlotsComponent<TDate>>;
20
20
  /**
21
21
  * The props used for each component slot.
22
22
  * @default {}
23
23
  */
24
- componentsProps?: Partial<DateTimePickerSlotsComponentsProps>;
24
+ componentsProps?: Partial<DateTimePickerSlotsComponentsProps<TDate>>;
25
25
  }
26
26
  declare type DateTimePickerComponent = (<TDate>(props: DateTimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
27
27
  propTypes?: any;
@@ -370,16 +370,6 @@ process.env.NODE_ENV !== "production" ? DateTimePicker.propTypes = {
370
370
  */
371
371
  reduceAnimations: PropTypes.bool,
372
372
 
373
- /**
374
- * Custom renderer for day. Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
375
- * @template TDate
376
- * @param {TDate} day The day to render.
377
- * @param {Array<TDate | null>} selectedDays The days currently selected.
378
- * @param {PickersDayProps<TDate>} pickersDayProps The props of the day to render.
379
- * @returns {JSX.Element} The element representing the day.
380
- */
381
- renderDay: PropTypes.func,
382
-
383
373
  /**
384
374
  * The `renderInput` prop allows you to customize the rendered input.
385
375
  * The `props` argument of this render prop contains props of [TextField](https://mui.com/material-ui/api/text-field/#props) that you need to forward.
@@ -2,21 +2,21 @@ import * as React from 'react';
2
2
  import { BaseDatePickerProps } from '../DatePicker/shared';
3
3
  import { DesktopWrapperProps, DesktopWrapperSlotsComponent, DesktopWrapperSlotsComponentsProps } from '../internals/components/wrappers/DesktopWrapper';
4
4
  import { CalendarPickerSlotsComponent, CalendarPickerSlotsComponentsProps } from '../CalendarPicker';
5
- export interface DesktopDatePickerSlotsComponent extends DesktopWrapperSlotsComponent, CalendarPickerSlotsComponent {
5
+ export interface DesktopDatePickerSlotsComponent<TDate> extends DesktopWrapperSlotsComponent, CalendarPickerSlotsComponent<TDate> {
6
6
  }
7
- export interface DesktopDatePickerSlotsComponentsProps extends DesktopWrapperSlotsComponentsProps, CalendarPickerSlotsComponentsProps {
7
+ export interface DesktopDatePickerSlotsComponentsProps<TDate> extends DesktopWrapperSlotsComponentsProps, CalendarPickerSlotsComponentsProps<TDate> {
8
8
  }
9
9
  export interface DesktopDatePickerProps<TDate> extends Omit<BaseDatePickerProps<TDate>, 'components' | 'componentsProps'>, DesktopWrapperProps<TDate> {
10
10
  /**
11
11
  * Overrideable components.
12
12
  * @default {}
13
13
  */
14
- components?: Partial<DesktopDatePickerSlotsComponent>;
14
+ components?: Partial<DesktopDatePickerSlotsComponent<TDate>>;
15
15
  /**
16
16
  * The props used for each component slot.
17
17
  * @default {}
18
18
  */
19
- componentsProps?: Partial<DesktopDatePickerSlotsComponentsProps>;
19
+ componentsProps?: Partial<DesktopDatePickerSlotsComponentsProps<TDate>>;
20
20
  }
21
21
  declare type DesktopDatePickerComponent = (<TDate>(props: DesktopDatePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
22
22
  propTypes?: any;
@@ -317,16 +317,6 @@ process.env.NODE_ENV !== "production" ? DesktopDatePicker.propTypes = {
317
317
  */
318
318
  reduceAnimations: PropTypes.bool,
319
319
 
320
- /**
321
- * Custom renderer for day. Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
322
- * @template TDate
323
- * @param {TDate} day The day to render.
324
- * @param {Array<TDate | null>} selectedDays The days currently selected.
325
- * @param {PickersDayProps<TDate>} pickersDayProps The props of the day to render.
326
- * @returns {JSX.Element} The element representing the day.
327
- */
328
- renderDay: PropTypes.func,
329
-
330
320
  /**
331
321
  * The `renderInput` prop allows you to customize the rendered input.
332
322
  * The `props` argument of this render prop contains props of [TextField](https://mui.com/material-ui/api/text-field/#props) that you need to forward.
@@ -3,21 +3,21 @@ import { BaseDateTimePickerProps } from '../DateTimePicker/shared';
3
3
  import { DesktopWrapperProps, DesktopWrapperSlotsComponent, DesktopWrapperSlotsComponentsProps } from '../internals/components/wrappers/DesktopWrapper';
4
4
  import { CalendarOrClockPickerSlotsComponent, CalendarOrClockPickerSlotsComponentsProps } from '../internals/components/CalendarOrClockPicker';
5
5
  import { DateInputSlotsComponent } from '../internals/components/PureDateInput';
6
- export interface DesktopDateTimePickerSlotsComponent extends DesktopWrapperSlotsComponent, CalendarOrClockPickerSlotsComponent, DateInputSlotsComponent {
6
+ export interface DesktopDateTimePickerSlotsComponent<TDate> extends DesktopWrapperSlotsComponent, CalendarOrClockPickerSlotsComponent<TDate>, DateInputSlotsComponent {
7
7
  }
8
- export interface DesktopDateTimePickerSlotsComponentsProps extends DesktopWrapperSlotsComponentsProps, CalendarOrClockPickerSlotsComponentsProps {
8
+ export interface DesktopDateTimePickerSlotsComponentsProps<TDate> extends DesktopWrapperSlotsComponentsProps, CalendarOrClockPickerSlotsComponentsProps<TDate> {
9
9
  }
10
10
  export interface DesktopDateTimePickerProps<TDate> extends BaseDateTimePickerProps<TDate>, DesktopWrapperProps<TDate> {
11
11
  /**
12
12
  * Overrideable components.
13
13
  * @default {}
14
14
  */
15
- components?: Partial<DesktopDateTimePickerSlotsComponent>;
15
+ components?: Partial<DesktopDateTimePickerSlotsComponent<TDate>>;
16
16
  /**
17
17
  * The props used for each component slot.
18
18
  * @default {}
19
19
  */
20
- componentsProps?: Partial<DesktopDateTimePickerSlotsComponentsProps>;
20
+ componentsProps?: Partial<DesktopDateTimePickerSlotsComponentsProps<TDate>>;
21
21
  }
22
22
  declare type DesktopDateTimePickerComponent = (<TDate>(props: DesktopDateTimePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
23
23
  propTypes?: any;
@@ -381,16 +381,6 @@ process.env.NODE_ENV !== "production" ? DesktopDateTimePicker.propTypes = {
381
381
  */
382
382
  reduceAnimations: PropTypes.bool,
383
383
 
384
- /**
385
- * Custom renderer for day. Check the [PickersDay](https://mui.com/x/api/date-pickers/pickers-day/) component.
386
- * @template TDate
387
- * @param {TDate} day The day to render.
388
- * @param {Array<TDate | null>} selectedDays The days currently selected.
389
- * @param {PickersDayProps<TDate>} pickersDayProps The props of the day to render.
390
- * @returns {JSX.Element} The element representing the day.
391
- */
392
- renderDay: PropTypes.func,
393
-
394
384
  /**
395
385
  * The `renderInput` prop allows you to customize the rendered input.
396
386
  * The `props` argument of this render prop contains props of [TextField](https://mui.com/material-ui/api/text-field/#props) that you need to forward.
@@ -2,21 +2,21 @@ import * as React from 'react';
2
2
  import { BaseDatePickerProps } from '../DatePicker/shared';
3
3
  import { MobileWrapperProps, MobileWrapperSlotsComponent, MobileWrapperSlotsComponentsProps } from '../internals/components/wrappers/MobileWrapper';
4
4
  import { CalendarPickerSlotsComponent, CalendarPickerSlotsComponentsProps } from '../CalendarPicker/CalendarPicker';
5
- export interface MobileDatePickerSlotsComponent extends MobileWrapperSlotsComponent, CalendarPickerSlotsComponent {
5
+ export interface MobileDatePickerSlotsComponent<TDate> extends MobileWrapperSlotsComponent, CalendarPickerSlotsComponent<TDate> {
6
6
  }
7
- export interface MobileDatePickerSlotsComponentsProps extends MobileWrapperSlotsComponentsProps, CalendarPickerSlotsComponentsProps {
7
+ export interface MobileDatePickerSlotsComponentsProps<TDate> extends MobileWrapperSlotsComponentsProps, CalendarPickerSlotsComponentsProps<TDate> {
8
8
  }
9
9
  export interface MobileDatePickerProps<TDate> extends BaseDatePickerProps<TDate>, MobileWrapperProps<TDate> {
10
10
  /**
11
11
  * Overrideable components.
12
12
  * @default {}
13
13
  */
14
- components?: Partial<MobileDatePickerSlotsComponent>;
14
+ components?: Partial<MobileDatePickerSlotsComponent<TDate>>;
15
15
  /**
16
16
  * The props used for each component slot.
17
17
  * @default {}
18
18
  */
19
- componentsProps?: Partial<MobileDatePickerSlotsComponentsProps>;
19
+ componentsProps?: Partial<MobileDatePickerSlotsComponentsProps<TDate>>;
20
20
  }
21
21
  declare type MobileDatePickerComponent = (<TDate>(props: MobileDatePickerProps<TDate> & React.RefAttributes<HTMLDivElement>) => JSX.Element) & {
22
22
  propTypes?: any;