From dd487dbb7b3e5ad406c8421968b0440119f88641 Mon Sep 17 00:00:00 2001 From: Muhammad Irtiza Date: Sun, 1 Oct 2023 15:00:08 +0500 Subject: [PATCH] Fix MuiPopper styleOverrides missing type issue --- .../mui-material/src/Popper/popperClasses.ts | 17 +++++++++++++++++ .../mui-material/src/styles/components.d.ts | 2 ++ packages/mui-material/src/styles/overrides.d.ts | 14 ++++++++------ 3 files changed, 27 insertions(+), 6 deletions(-) create mode 100644 packages/mui-material/src/Popper/popperClasses.ts diff --git a/packages/mui-material/src/Popper/popperClasses.ts b/packages/mui-material/src/Popper/popperClasses.ts new file mode 100644 index 00000000000000..ee656666b7a7fb --- /dev/null +++ b/packages/mui-material/src/Popper/popperClasses.ts @@ -0,0 +1,17 @@ +import { unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils'; +import generateUtilityClass from '../generateUtilityClass'; + +export interface PopperClasses { + /** Styles applied to the root element. */ + root: string; +} + +export type PopperClassKey = keyof PopperClasses; + +export function getPopperUtilityClass(slot: string): string { + return generateUtilityClass('MuiPopper', slot); +} + +const popperClasses: PopperClasses = generateUtilityClasses('MuiPopper', ['root']); + +export default popperClasses; diff --git a/packages/mui-material/src/styles/components.d.ts b/packages/mui-material/src/styles/components.d.ts index 7366d653178ac6..4944b7ee668cc6 100644 --- a/packages/mui-material/src/styles/components.d.ts +++ b/packages/mui-material/src/styles/components.d.ts @@ -380,6 +380,8 @@ export interface Components { }; MuiPopper?: { defaultProps?: ComponentsProps['MuiPopper']; + styleOverrides?: ComponentsOverrides['MuiPopper']; + variants?: ComponentsVariants['MuiPopper']; }; MuiPopover?: { defaultProps?: ComponentsProps['MuiPopover']; diff --git a/packages/mui-material/src/styles/overrides.d.ts b/packages/mui-material/src/styles/overrides.d.ts index 073f7d6728e9d0..abc19eddf87077 100644 --- a/packages/mui-material/src/styles/overrides.d.ts +++ b/packages/mui-material/src/styles/overrides.d.ts @@ -114,6 +114,7 @@ import { ToolbarClassKey } from '../Toolbar'; import { TooltipClassKey } from '../Tooltip'; import { TouchRippleClassKey } from '../ButtonBase/TouchRipple'; import { TypographyClassKey } from '../Typography'; +import { PopperClassKey } from '@mui/base'; export type OverridesStyleRules< ClassKey extends string = string, @@ -123,12 +124,12 @@ export type OverridesStyleRules< ClassKey, | CSSInterpolation | (( - // Record is for other props that the slot receive internally - // Documenting all ownerStates could be a huge work, let's wait until we have a real needs from developers. - props: (ComponentName extends keyof ComponentsPropsList - ? { ownerState: ComponentsPropsList[ComponentName] & Record } - : {}) & { theme: Theme } & Record, - ) => CSSInterpolation) + // Record is for other props that the slot receive internally + // Documenting all ownerStates could be a huge work, let's wait until we have a real needs from developers. + props: (ComponentName extends keyof ComponentsPropsList + ? { ownerState: ComponentsPropsList[ComponentName] & Record } + : {}) & { theme: Theme } & Record, + ) => CSSInterpolation) >; export type ComponentsOverrides = { @@ -214,6 +215,7 @@ export interface ComponentNameToClassKey { MuiPagination: PaginationClassKey; MuiPaginationItem: PaginationItemClassKey; MuiPaper: PaperClassKey; + MuiPopper: PopperClassKey; MuiPopover: PopoverClassKey; MuiRadio: RadioClassKey; MuiRating: RatingClassKey;