diff --git a/packages/mui-core/src/BackdropUnstyled/BackdropUnstyled.d.ts b/packages/mui-core/src/BackdropUnstyled/BackdropUnstyled.d.ts index a6c91e3d6e5d8d..19d6d737a7a4d1 100644 --- a/packages/mui-core/src/BackdropUnstyled/BackdropUnstyled.d.ts +++ b/packages/mui-core/src/BackdropUnstyled/BackdropUnstyled.d.ts @@ -2,6 +2,8 @@ import * as React from 'react'; import { OverridableComponent, OverridableTypeMap, OverrideProps } from '@mui/types'; import { BackdropUnstyledClasses } from './backdropUnstyledClasses'; +export interface BackdropUnstyledComponentsPropsOverrides {} + export interface BackdropUnstyledTypeMap

{ props: P & { /** @@ -21,10 +23,7 @@ export interface BackdropUnstyledTypeMap

; - }; + root?: React.HTMLAttributes & BackdropUnstyledComponentsPropsOverrides; }; /** * Override or extend the styles applied to the component. diff --git a/packages/mui-core/src/BadgeUnstyled/BadgeUnstyled.d.ts b/packages/mui-core/src/BadgeUnstyled/BadgeUnstyled.d.ts index 404a5f80961fa8..7806a57ed55b5a 100644 --- a/packages/mui-core/src/BadgeUnstyled/BadgeUnstyled.d.ts +++ b/packages/mui-core/src/BadgeUnstyled/BadgeUnstyled.d.ts @@ -7,7 +7,9 @@ export interface BadgeOrigin { horizontal: 'left' | 'right'; } -export interface BadgeUnstyledTypeMap

{ +export interface BadgeUnstyledComponentsPropsOverrides {} + +export interface BadgeUnstyledTypeMap

{ props: P & { /** * The anchor of the badge. @@ -31,14 +33,8 @@ export interface BadgeUnstyledTypeMap

; - }; - badge?: { - as?: React.ElementType; - ownerState?: Omit['props'], 'components' | 'componentsProps'>; - }; + root?: React.HTMLAttributes & BadgeUnstyledComponentsPropsOverrides; + badge?: React.HTMLAttributes & BadgeUnstyledComponentsPropsOverrides; }; /** * Wrapped shape the badge should overlap. diff --git a/packages/mui-core/src/ButtonUnstyled/ButtonUnstyledProps.ts b/packages/mui-core/src/ButtonUnstyled/ButtonUnstyledProps.ts index 3b464984d4716c..962c034fa25b3b 100644 --- a/packages/mui-core/src/ButtonUnstyled/ButtonUnstyledProps.ts +++ b/packages/mui-core/src/ButtonUnstyled/ButtonUnstyledProps.ts @@ -1,10 +1,13 @@ import { OverrideProps } from '@mui/types'; +import React from 'react'; import UseButtonProps from './UseButtonProps'; export interface ButtonUnstyledActions { focusVisible(): void; } +export interface ButtonUnstyledComponentsPropsOverrides {} + export interface ButtonUnstyledOwnProps extends Omit { /** * A ref for imperative actions. It currently only supports `focusVisible()` action. @@ -13,7 +16,7 @@ export interface ButtonUnstyledOwnProps extends Omit { children?: React.ReactNode; className?: string; componentsProps?: { - root?: Record; + root?: React.ButtonHTMLAttributes & ButtonUnstyledComponentsPropsOverrides; }; } diff --git a/packages/mui-core/src/FormControlUnstyled/FormControlUnstyledProps.ts b/packages/mui-core/src/FormControlUnstyled/FormControlUnstyledProps.ts index b72709ed9e735a..71c6ab47d804d7 100644 --- a/packages/mui-core/src/FormControlUnstyled/FormControlUnstyledProps.ts +++ b/packages/mui-core/src/FormControlUnstyled/FormControlUnstyledProps.ts @@ -3,6 +3,8 @@ import * as React from 'react'; export type NativeFormControlElement = HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement; +export interface FormControlUnstyledComponentsPropsOverrides {} + export interface FormControlUnstyledOwnProps { /** * The content of the component. @@ -21,7 +23,7 @@ export interface FormControlUnstyledOwnProps { Root?: React.ElementType; }; componentsProps?: { - root?: object; + root?: React.HTMLAttributes & FormControlUnstyledComponentsPropsOverrides; }; defaultValue?: unknown; /** diff --git a/packages/mui-core/src/ModalUnstyled/ModalUnstyled.d.ts b/packages/mui-core/src/ModalUnstyled/ModalUnstyled.d.ts index 637007bd12d2ef..d911937053f4c6 100644 --- a/packages/mui-core/src/ModalUnstyled/ModalUnstyled.d.ts +++ b/packages/mui-core/src/ModalUnstyled/ModalUnstyled.d.ts @@ -4,6 +4,8 @@ import { BackdropUnstyledProps } from '../BackdropUnstyled'; import { PortalProps } from '../Portal'; import { ModalUnstyledClasses } from './modalUnstyledClasses'; +export interface ModalUnstyledComponentsPropsOverrides {} + export interface ModalUnstyledTypeMap

{ props: P & { /** @@ -40,10 +42,7 @@ export interface ModalUnstyledTypeMap

; - }; + root?: React.HTMLAttributes & ModalUnstyledComponentsPropsOverrides; }; /** * An HTML element or function that returns one. diff --git a/packages/mui-core/src/SliderUnstyled/SliderUnstyled.d.ts b/packages/mui-core/src/SliderUnstyled/SliderUnstyled.d.ts index 401158531bb3ef..2af925cd55c67f 100644 --- a/packages/mui-core/src/SliderUnstyled/SliderUnstyled.d.ts +++ b/packages/mui-core/src/SliderUnstyled/SliderUnstyled.d.ts @@ -1,5 +1,6 @@ import { OverridableComponent, OverridableTypeMap, OverrideProps } from '@mui/types'; import { SliderUnstyledClasses } from './sliderUnstyledClasses'; +import SliderValueLabelUnstyled from './SliderValueLabelUnstyled'; export interface SliderOwnerStateOverrides {} @@ -15,6 +16,8 @@ export interface ValueLabelProps extends React.HTMLAttributes { value: number; } +export interface SliderUnstyledComponentsPropsOverrides {} + export interface SliderUnstyledTypeMap

{ props: P & { /** @@ -52,45 +55,14 @@ export interface SliderUnstyledTypeMap

& - SliderOwnerStateOverrides; - }; - track?: { - as?: React.ElementType; - ownerState?: Omit['props'], 'components' | 'componentsProps'> & - SliderOwnerStateOverrides; - }; - rail?: { - as?: React.ElementType; - ownerState?: Omit['props'], 'components' | 'componentsProps'> & - SliderOwnerStateOverrides; - }; - thumb?: { - as?: React.ElementType; - ownerState?: Omit['props'], 'components' | 'componentsProps'> & - SliderOwnerStateOverrides; - }; - mark?: { - as?: React.ElementType; - ownerState?: Omit< - SliderUnstyledTypeMap['props'], - 'components' | 'componentsProps' - > & { markActive?: boolean } & SliderOwnerStateOverrides; - }; - markLabel?: { - as?: React.ElementType; - ownerState?: Omit< - SliderUnstyledTypeMap['props'], - 'components' | 'componentsProps' - > & { markLabelActive?: boolean } & SliderOwnerStateOverrides; - }; - valueLabel?: { - as?: React.ElementType; - ownerState?: Omit['props'], 'components' | 'componentsProps'> & - SliderOwnerStateOverrides; - }; + root?: React.HTMLAttributes & SliderUnstyledComponentsPropsOverrides; + track?: React.HTMLAttributes & SliderUnstyledComponentsPropsOverrides; + rail?: React.HTMLAttributes & SliderUnstyledComponentsPropsOverrides; + thumb?: React.HTMLAttributes & SliderUnstyledComponentsPropsOverrides; + mark?: React.HTMLAttributes & SliderUnstyledComponentsPropsOverrides; + markLabel?: React.HTMLAttributes & SliderUnstyledComponentsPropsOverrides; + valueLabel?: React.ComponentPropsWithRef & + SliderUnstyledComponentsPropsOverrides; }; /** * The default value. Use when the component is not controlled. diff --git a/packages/mui-core/src/SliderUnstyled/SliderValueLabelUnstyled.d.ts b/packages/mui-core/src/SliderUnstyled/SliderValueLabelUnstyled.d.ts index 931495f006b9fa..fd2564b0eb2cf8 100644 --- a/packages/mui-core/src/SliderUnstyled/SliderValueLabelUnstyled.d.ts +++ b/packages/mui-core/src/SliderUnstyled/SliderValueLabelUnstyled.d.ts @@ -27,4 +27,4 @@ export interface ValueLabelUnstyledProps { valueLabelDisplay?: 'on' | 'auto' | 'off'; } -export default function ValueLabel(props: ValueLabelUnstyledProps): JSX.Element; +export default function SliderValueLabelUnstyled(props: ValueLabelUnstyledProps): JSX.Element; diff --git a/packages/mui-core/src/SwitchUnstyled/SwitchUnstyled.tsx b/packages/mui-core/src/SwitchUnstyled/SwitchUnstyled.tsx index 6e4c5b7ce0137f..2325d2ccd95140 100644 --- a/packages/mui-core/src/SwitchUnstyled/SwitchUnstyled.tsx +++ b/packages/mui-core/src/SwitchUnstyled/SwitchUnstyled.tsx @@ -5,6 +5,8 @@ import useSwitch, { SwitchState, UseSwitchProps } from './useSwitch'; import classes from './switchUnstyledClasses'; import appendOwnerState from '../utils/appendOwnerState'; +export interface SwitchUnstyledComponentsPropsOverrides {} + export interface SwitchUnstyledProps extends UseSwitchProps { /** * Class name applied to the root element. @@ -33,10 +35,10 @@ export interface SwitchUnstyledProps extends UseSwitchProps { * @default {} */ componentsProps?: { - root?: {}; - thumb?: {}; - input?: {}; - track?: {}; + root?: React.HTMLAttributes & SwitchUnstyledComponentsPropsOverrides; + thumb?: React.HTMLAttributes & SwitchUnstyledComponentsPropsOverrides; + input?: React.InputHTMLAttributes & SwitchUnstyledComponentsPropsOverrides; + track?: React.HTMLAttributes & SwitchUnstyledComponentsPropsOverrides; }; } diff --git a/packages/mui-core/test/typescript/moduleAugmentation/sliderComponentsProps.spec.tsx b/packages/mui-core/test/typescript/moduleAugmentation/sliderComponentsProps.spec.tsx new file mode 100644 index 00000000000000..f418f7515228fe --- /dev/null +++ b/packages/mui-core/test/typescript/moduleAugmentation/sliderComponentsProps.spec.tsx @@ -0,0 +1,13 @@ +import * as React from 'react'; +import { SliderUnstyled } from '@mui/core'; + +declare module '@mui/core' { + interface SliderUnstyledComponentsPropsOverrides { + variant?: 'one' | 'two'; + } +} + +; + +// @ts-expect-error unknown color +; diff --git a/packages/mui-core/test/typescript/moduleAugmentation/sliderComponentsProps.tsconfig.json b/packages/mui-core/test/typescript/moduleAugmentation/sliderComponentsProps.tsconfig.json new file mode 100644 index 00000000000000..6e5da6ffd868e1 --- /dev/null +++ b/packages/mui-core/test/typescript/moduleAugmentation/sliderComponentsProps.tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "../../../../../tsconfig", + "files": ["sliderComponentsProps.spec.tsx"] +} diff --git a/packages/mui-core/test/typescript/moduleAugmentation/sliderOwnerState.spec.tsx b/packages/mui-core/test/typescript/moduleAugmentation/sliderOwnerState.spec.tsx deleted file mode 100644 index cb6961c9a36d7b..00000000000000 --- a/packages/mui-core/test/typescript/moduleAugmentation/sliderOwnerState.spec.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import * as React from 'react'; -import { SliderUnstyled } from '@mui/core'; - -declare module '@mui/core' { - interface SliderOwnerStateOverrides { - color?: 'primary' | 'secondary'; - } -} - -; - -// @ts-expect-error unknown color -; diff --git a/packages/mui-core/test/typescript/moduleAugmentation/sliderOwnerState.tsconfig.json b/packages/mui-core/test/typescript/moduleAugmentation/sliderOwnerState.tsconfig.json deleted file mode 100644 index 7566f7a214d718..00000000000000 --- a/packages/mui-core/test/typescript/moduleAugmentation/sliderOwnerState.tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../../../../tsconfig", - "files": ["sliderOwnerState.spec.tsx"] -} diff --git a/packages/mui-lab/src/CalendarPicker/PickersCalendarHeader.tsx b/packages/mui-lab/src/CalendarPicker/PickersCalendarHeader.tsx index 88a64b5aa5b1b0..176566eb56f69b 100644 --- a/packages/mui-lab/src/CalendarPicker/PickersCalendarHeader.tsx +++ b/packages/mui-lab/src/CalendarPicker/PickersCalendarHeader.tsx @@ -26,6 +26,8 @@ export type ExportedCalendarHeaderProps = Pick< | 'rightArrowButtonText' >; +export interface PickersCalendarHeaderComponentsPropsOverides {} + export interface PickersCalendarHeaderProps extends ExportedArrowSwitcherProps, Omit, 'shouldDisableDate'> { @@ -43,7 +45,8 @@ export interface PickersCalendarHeaderProps * @default {} */ componentsProps?: ExportedArrowSwitcherProps['componentsProps'] & { - switchViewButton?: any; + switchViewButton?: React.ComponentPropsWithRef & + PickersCalendarHeaderComponentsPropsOverides; }; currentMonth: TDate; views: readonly CalendarPickerView[]; @@ -201,7 +204,6 @@ function PickersCalendarHeader(props: PickersCalendarHeaderProps) as={components.SwitchViewButton} aria-label={getViewSwitchingButtonText(currentView)} {...switchViewButtonProps} - ownerState={{ ...ownerState, ...switchViewButtonProps }} > extends ExportedClockPickerProps * The props used for each slot inside. */ componentsProps?: { - leftArrowButton?: any; - rightArrowButton?: any; + leftArrowButton?: React.SVGAttributes & ClockPickerComponentsPropsOverrides; + rightArrowButton?: React.SVGAttributes & ClockPickerComponentsPropsOverrides; }; /** diff --git a/packages/mui-lab/src/internal/pickers/PickersArrowSwitcher.tsx b/packages/mui-lab/src/internal/pickers/PickersArrowSwitcher.tsx index 400b31f5aed1f7..a6e47d35e9af14 100644 --- a/packages/mui-lab/src/internal/pickers/PickersArrowSwitcher.tsx +++ b/packages/mui-lab/src/internal/pickers/PickersArrowSwitcher.tsx @@ -22,8 +22,8 @@ export interface ExportedArrowSwitcherProps { * @default {} */ componentsProps?: { - leftArrowButton?: any; - rightArrowButton?: any; + leftArrowButton?: Record; + rightArrowButton?: Record; }; /** * Left arrow icon aria-label text. @@ -58,7 +58,7 @@ const PickersArrowSwitcherSpacer = styled('div', { skipSx: true })<{ })); const PickersArrowSwitcherButton = styled(IconButton, { skipSx: true })<{ - ownerState: ArrowSwitcherProps & { hidden: boolean }; + ownerState: ArrowSwitcherProps; }>(({ ownerState }) => ({ ...(ownerState.hidden && { visibility: 'hidden', diff --git a/packages/mui-material/src/InputBase/InputBase.d.ts b/packages/mui-material/src/InputBase/InputBase.d.ts index 76078cf557fabe..f319f68b718a7a 100644 --- a/packages/mui-material/src/InputBase/InputBase.d.ts +++ b/packages/mui-material/src/InputBase/InputBase.d.ts @@ -9,6 +9,8 @@ export interface InputBasePropsSizeOverrides {} export interface InputBasePropsColorOverrides {} +export interface InputBaseComponentsPropsOverrides {} + export interface InputBaseProps extends StandardProps< React.HTMLAttributes, @@ -51,26 +53,13 @@ export interface InputBaseProps Root?: React.ElementType; Input?: React.ElementType; }; - /** * The props used for each slot inside the Input. * @default {} */ componentsProps?: { - root?: { - as: React.ElementType; - ownerState?: Omit & { - hiddenLabel?: boolean; - focused?: boolean; - }; - }; - input?: { - as?: React.ElementType; - ownerState?: Omit & { - hiddenLabel?: boolean; - focused?: boolean; - }; - }; + root?: React.HTMLAttributes & InputBaseComponentsPropsOverrides; + input?: React.InputHTMLAttributes & InputBaseComponentsPropsOverrides; }; /** * The default value. Use when the component is not controlled. diff --git a/packages/mui-material/src/ListItem/ListItem.d.ts b/packages/mui-material/src/ListItem/ListItem.d.ts index 8533a22e1e455e..f53cdff67e088b 100644 --- a/packages/mui-material/src/ListItem/ListItem.d.ts +++ b/packages/mui-material/src/ListItem/ListItem.d.ts @@ -5,6 +5,8 @@ import { ExtendButtonBase } from '../ButtonBase'; import { OverridableComponent, OverrideProps } from '../OverridableComponent'; import { ListItemClasses } from './listItemClasses'; +export interface ListItemComponentsPropsOverrides {} + interface ListItemBaseProps { /** * Defines the `align-items` style property. @@ -98,12 +100,7 @@ export interface ListItemTypeMap { * @default {} */ componentsProps?: { - root?: { - as: React.ElementType; - ownerState?: Omit & { - dense?: boolean; - }; - }; + root?: React.HTMLAttributes & ListItemComponentsPropsOverrides; }; }; defaultComponent: D;