slots
."
+ },
+ "componentsProps": {
+ "type": { "name": "object" },
+ "default": "{}",
+ "deprecated": true,
+ "deprecationInfo": "Please use slotProps
."
+ },
"slotProps": { "type": { "name": "object" }, "default": "{}" },
"slots": { "type": { "name": "object" }, "default": "{}" },
"sx": {
@@ -12,7 +24,44 @@
"additionalInfo": { "sx": true }
}
},
- "slots": [],
+ "slots": [
+ {
+ "class": null,
+ "name": "leftArrowIcon",
+ "description": "Icon displayed in the left view switch button.",
+ "default": "ArrowLeft"
+ },
+ {
+ "class": null,
+ "name": "nextIconButton",
+ "description": "Button allowing to switch to the right view.",
+ "default": "IconButton"
+ },
+ {
+ "class": null,
+ "name": "previousIconButton",
+ "description": "Button allowing to switch to the left view.",
+ "default": "IconButton"
+ },
+ {
+ "class": null,
+ "name": "rightArrowIcon",
+ "description": "Icon displayed in the right view switch button.",
+ "default": "ArrowRight"
+ },
+ {
+ "class": null,
+ "name": "switchViewButton",
+ "description": "Button displayed to switch between different calendar views.",
+ "default": "IconButton"
+ },
+ {
+ "class": null,
+ "name": "switchViewIcon",
+ "description": "Icon displayed in the SwitchViewButton. Rotated by 180° when the open view is 'year'.",
+ "default": "ArrowDropDown"
+ }
+ ],
"name": "PickersCalendarHeader",
"imports": [
"import { PickersCalendarHeader } from '@mui/x-date-pickers/PickersCalendarHeader';",
diff --git a/docs/scripts/api/buildComponentsDocumentation.ts b/docs/scripts/api/buildComponentsDocumentation.ts
index 82a855aee980..e6f1ccae5604 100644
--- a/docs/scripts/api/buildComponentsDocumentation.ts
+++ b/docs/scripts/api/buildComponentsDocumentation.ts
@@ -83,11 +83,13 @@ function extractSlots(options: {
project,
checkDeclarations: true,
shouldResolveObject: ({ name }) => {
- return name === 'components';
+ // TODO v7: Remove the `components` fallback once `slots` is used everywhere
+ return name === 'slots' || name === 'components';
},
shouldInclude: ({ name, depth }) => {
// The keys allowed in the `components` prop have depth=2
- return name === 'components' || depth === 2;
+ // TODO v7: Remove the `components` fallback once `slots` is used everywhere
+ return name === 'slots' || name === 'components' || depth === 2;
},
});
@@ -96,7 +98,10 @@ function extractSlots(options: {
throw new Error(`No proptypes found for \`${displayName}\``);
}
- const componentsProps = props.types.find((type) => type.name === 'components')!;
+ const componentsProps = props.types.find(
+ // TODO v7: Remove the `components` fallback once `slots` is used everywhere
+ (type) => type.name === 'slots' || type.name === 'components',
+ )!;
if (!componentsProps) {
return slots;
}
@@ -481,7 +486,8 @@ const buildComponentDocumentation = async (options: {
/**
* Slot descriptions.
*/
- if (componentApi.propDescriptions.components) {
+ // TODO v7: Remove the `components` fallback once `slots` is used everywhere
+ if (componentApi.propDescriptions.slots || componentApi.propDescriptions.components) {
const slots = extractSlots({
filename,
name: reactApi.name, // e.g. DataGrid
diff --git a/docs/translations/api-docs/charts/area-element.json b/docs/translations/api-docs/charts/area-element.json
index fec8833da4ee..5d077363ea78 100644
--- a/docs/translations/api-docs/charts/area-element.json
+++ b/docs/translations/api-docs/charts/area-element.json
@@ -25,5 +25,5 @@
"conditions": "faded"
}
},
- "slotDescriptions": {}
+ "slotDescriptions": { "area": "The component that renders the root." }
}
diff --git a/docs/translations/api-docs/charts/area-plot.json b/docs/translations/api-docs/charts/area-plot.json
index 193abb7bf3a9..c045ac6d34fd 100644
--- a/docs/translations/api-docs/charts/area-plot.json
+++ b/docs/translations/api-docs/charts/area-plot.json
@@ -13,5 +13,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "area": "The component that renders the root." }
}
diff --git a/docs/translations/api-docs/charts/bar-chart.json b/docs/translations/api-docs/charts/bar-chart.json
index d2438d2ddb04..bee22b81e0d3 100644
--- a/docs/translations/api-docs/charts/bar-chart.json
+++ b/docs/translations/api-docs/charts/bar-chart.json
@@ -43,5 +43,15 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": {
+ "axisContent": "",
+ "axisLabel": "",
+ "axisLine": "",
+ "axisTick": "",
+ "axisTickLabel": "",
+ "bar": "",
+ "itemContent": "",
+ "legend": "",
+ "popper": ""
+ }
}
diff --git a/docs/translations/api-docs/charts/bar-plot.json b/docs/translations/api-docs/charts/bar-plot.json
index 27268d44f0ee..0df4fa1114fe 100644
--- a/docs/translations/api-docs/charts/bar-plot.json
+++ b/docs/translations/api-docs/charts/bar-plot.json
@@ -18,5 +18,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "bar": "The component that renders the root." }
}
diff --git a/docs/translations/api-docs/charts/charts-axis.json b/docs/translations/api-docs/charts/charts-axis.json
index 036b1002dee3..e3e74d103228 100644
--- a/docs/translations/api-docs/charts/charts-axis.json
+++ b/docs/translations/api-docs/charts/charts-axis.json
@@ -55,5 +55,5 @@
"left": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the left axis" },
"right": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the right axis" }
},
- "slotDescriptions": {}
+ "slotDescriptions": { "axisLabel": "", "axisLine": "", "axisTick": "", "axisTickLabel": "" }
}
diff --git a/docs/translations/api-docs/charts/charts-tooltip.json b/docs/translations/api-docs/charts/charts-tooltip.json
index e35af3b98a3d..a35867dfa135 100644
--- a/docs/translations/api-docs/charts/charts-tooltip.json
+++ b/docs/translations/api-docs/charts/charts-tooltip.json
@@ -47,5 +47,5 @@
"nodeName": "the valueCell element"
}
},
- "slotDescriptions": {}
+ "slotDescriptions": { "axisContent": "", "itemContent": "", "popper": "" }
}
diff --git a/docs/translations/api-docs/charts/charts-x-axis.json b/docs/translations/api-docs/charts/charts-x-axis.json
index 68c29dd7f5f0..d7bff24d1bb9 100644
--- a/docs/translations/api-docs/charts/charts-x-axis.json
+++ b/docs/translations/api-docs/charts/charts-x-axis.json
@@ -121,5 +121,5 @@
"left": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the left axis" },
"right": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the right axis" }
},
- "slotDescriptions": {}
+ "slotDescriptions": { "axisLabel": "", "axisLine": "", "axisTick": "", "axisTickLabel": "" }
}
diff --git a/docs/translations/api-docs/charts/charts-y-axis.json b/docs/translations/api-docs/charts/charts-y-axis.json
index 68c29dd7f5f0..d7bff24d1bb9 100644
--- a/docs/translations/api-docs/charts/charts-y-axis.json
+++ b/docs/translations/api-docs/charts/charts-y-axis.json
@@ -121,5 +121,5 @@
"left": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the left axis" },
"right": { "description": "Styles applied to {{nodeName}}.", "nodeName": "the right axis" }
},
- "slotDescriptions": {}
+ "slotDescriptions": { "axisLabel": "", "axisLine": "", "axisTick": "", "axisTickLabel": "" }
}
diff --git a/docs/translations/api-docs/charts/line-chart.json b/docs/translations/api-docs/charts/line-chart.json
index 76819e02e47e..67d7f050b9cb 100644
--- a/docs/translations/api-docs/charts/line-chart.json
+++ b/docs/translations/api-docs/charts/line-chart.json
@@ -43,5 +43,18 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": {
+ "area": "",
+ "axisContent": "",
+ "axisLabel": "",
+ "axisLine": "",
+ "axisTick": "",
+ "axisTickLabel": "",
+ "itemContent": "",
+ "legend": "",
+ "line": "",
+ "lineHighlight": "",
+ "mark": "",
+ "popper": ""
+ }
}
diff --git a/docs/translations/api-docs/charts/line-element.json b/docs/translations/api-docs/charts/line-element.json
index fec8833da4ee..9ef25541e1e5 100644
--- a/docs/translations/api-docs/charts/line-element.json
+++ b/docs/translations/api-docs/charts/line-element.json
@@ -25,5 +25,5 @@
"conditions": "faded"
}
},
- "slotDescriptions": {}
+ "slotDescriptions": { "line": "The component that renders the root." }
}
diff --git a/docs/translations/api-docs/charts/line-highlight-plot.json b/docs/translations/api-docs/charts/line-highlight-plot.json
index 193abb7bf3a9..852747b8f3b1 100644
--- a/docs/translations/api-docs/charts/line-highlight-plot.json
+++ b/docs/translations/api-docs/charts/line-highlight-plot.json
@@ -13,5 +13,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "lineHighlight": "" }
}
diff --git a/docs/translations/api-docs/charts/line-plot.json b/docs/translations/api-docs/charts/line-plot.json
index 193abb7bf3a9..1d035d210533 100644
--- a/docs/translations/api-docs/charts/line-plot.json
+++ b/docs/translations/api-docs/charts/line-plot.json
@@ -13,5 +13,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "line": "The component that renders the root." }
}
diff --git a/docs/translations/api-docs/charts/mark-plot.json b/docs/translations/api-docs/charts/mark-plot.json
index 193abb7bf3a9..04790a6a5575 100644
--- a/docs/translations/api-docs/charts/mark-plot.json
+++ b/docs/translations/api-docs/charts/mark-plot.json
@@ -13,5 +13,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "mark": "" }
}
diff --git a/docs/translations/api-docs/charts/pie-plot.json b/docs/translations/api-docs/charts/pie-plot.json
index 74758708869a..326efd758310 100644
--- a/docs/translations/api-docs/charts/pie-plot.json
+++ b/docs/translations/api-docs/charts/pie-plot.json
@@ -27,5 +27,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "pieArc": "", "pieArcLabel": "" }
}
diff --git a/docs/translations/api-docs/charts/scatter-chart.json b/docs/translations/api-docs/charts/scatter-chart.json
index e785806eeef7..03154c1e5ef1 100644
--- a/docs/translations/api-docs/charts/scatter-chart.json
+++ b/docs/translations/api-docs/charts/scatter-chart.json
@@ -38,5 +38,15 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": {
+ "axisContent": "",
+ "axisLabel": "",
+ "axisLine": "",
+ "axisTick": "",
+ "axisTickLabel": "",
+ "itemContent": "",
+ "legend": "",
+ "popper": "",
+ "scatter": ""
+ }
}
diff --git a/docs/translations/api-docs/charts/scatter-plot.json b/docs/translations/api-docs/charts/scatter-plot.json
index 193abb7bf3a9..67c937d9f281 100644
--- a/docs/translations/api-docs/charts/scatter-plot.json
+++ b/docs/translations/api-docs/charts/scatter-plot.json
@@ -13,5 +13,5 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": { "scatter": "" }
}
diff --git a/docs/translations/api-docs/charts/spark-line-chart.json b/docs/translations/api-docs/charts/spark-line-chart.json
index f07c45c29efb..6c1257c5611a 100644
--- a/docs/translations/api-docs/charts/spark-line-chart.json
+++ b/docs/translations/api-docs/charts/spark-line-chart.json
@@ -45,5 +45,14 @@
}
},
"classDescriptions": {},
- "slotDescriptions": {}
+ "slotDescriptions": {
+ "area": "",
+ "axisContent": "",
+ "bar": "",
+ "itemContent": "",
+ "line": "",
+ "lineHighlight": "",
+ "mark": "",
+ "popper": ""
+ }
}
diff --git a/docs/translations/api-docs/date-pickers/pickers-calendar-header.json b/docs/translations/api-docs/date-pickers/pickers-calendar-header.json
index fa256e342ed4..19ae10c1e8b1 100644
--- a/docs/translations/api-docs/date-pickers/pickers-calendar-header.json
+++ b/docs/translations/api-docs/date-pickers/pickers-calendar-header.json
@@ -11,6 +11,16 @@
"deprecated": "",
"typeDescriptions": {}
},
+ "components": {
+ "description": "Overridable components.",
+ "deprecated": "",
+ "typeDescriptions": {}
+ },
+ "componentsProps": {
+ "description": "The props used for each component slot.",
+ "deprecated": "",
+ "typeDescriptions": {}
+ },
"slotProps": {
"description": "The props used for each component slot.",
"deprecated": "",
@@ -43,5 +53,12 @@
"nodeName": "the switch view icon element"
}
},
- "slotDescriptions": {}
+ "slotDescriptions": {
+ "leftArrowIcon": "Icon displayed in the left view switch button.",
+ "nextIconButton": "Button allowing to switch to the right view.",
+ "previousIconButton": "Button allowing to switch to the left view.",
+ "rightArrowIcon": "Icon displayed in the right view switch button.",
+ "switchViewButton": "Button displayed to switch between different calendar views.",
+ "switchViewIcon": "Icon displayed in the SwitchViewButton. Rotated by 180° when the open view is 'year'."
+ }
}
diff --git a/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx b/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx
index 0ec2ca240771..0594e71c820c 100644
--- a/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx
+++ b/packages/x-date-pickers/src/PickersCalendarHeader/PickersCalendarHeader.tsx
@@ -2,106 +2,26 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import Fade from '@mui/material/Fade';
-import { styled, SxProps, Theme, useThemeProps } from '@mui/material/styles';
-import { SlotComponentProps, useSlotProps } from '@mui/base/utils';
+import { styled, useThemeProps } from '@mui/material/styles';
+import { useSlotProps } from '@mui/base/utils';
import { unstable_composeClasses as composeClasses } from '@mui/utils';
import IconButton from '@mui/material/IconButton';
-import SvgIcon from '@mui/material/SvgIcon';
-import { SlideDirection } from '../DateCalendar/PickersSlideTransition';
import { useLocaleText, useUtils } from '../internals/hooks/useUtils';
import { PickersFadeTransitionGroup } from '../DateCalendar/PickersFadeTransitionGroup';
import { ArrowDropDownIcon } from '../icons';
-import {
- PickersArrowSwitcher,
- ExportedPickersArrowSwitcherProps,
- PickersArrowSwitcherSlotsComponent,
- PickersArrowSwitcherSlotsComponentsProps,
-} from '../internals/components/PickersArrowSwitcher';
+import { PickersArrowSwitcher } from '../internals/components/PickersArrowSwitcher';
import {
usePreviousMonthDisabled,
useNextMonthDisabled,
- MonthValidationOptions,
} from '../internals/hooks/date-helpers-hooks';
-import { DateView } from '../models';
import {
getPickersCalendarHeaderUtilityClass,
pickersCalendarHeaderClasses,
- PickersCalendarHeaderClasses,
} from './pickersCalendarHeaderClasses';
-import { UncapitalizeObjectKeys } from '../internals/utils/slots-migration';
-
-export type ExportedPickersCalendarHeaderProps