Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DataGrid] Refactor: create tooltip props #16086

Merged
merged 2 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/x-data-grid/src/models/gridBaseSlots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@ export type SkeletonProps = {
width?: number | string;
height?: number | string;
};

export type TooltipProps = {
children: React.ReactElement<any, any>;
enterDelay?: number;
title: React.ReactNode;
};
12 changes: 4 additions & 8 deletions packages/x-data-grid/src/models/gridSlotsComponentsProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { SelectProps } from '@mui/material/Select';
import type { SwitchProps } from '@mui/material/Switch';
import type { IconButtonProps as MUIIconButtonProps } from '@mui/material/IconButton';
import type { InputAdornmentProps } from '@mui/material/InputAdornment';
import type { TooltipProps } from '@mui/material/Tooltip';
import type { TooltipProps as MUITooltipProps } from '@mui/material/Tooltip';
import type { InputLabelProps } from '@mui/material/InputLabel';
import type { PopperProps } from '@mui/material/Popper';
import type { TablePaginationProps } from '@mui/material/TablePagination';
Expand Down Expand Up @@ -44,6 +44,7 @@ import type {
LinearProgressProps,
MenuItemProps,
SkeletonProps,
TooltipProps,
} from './gridBaseSlots';

type RootProps = React.HTMLAttributes<HTMLDivElement> & Record<`data-${string}`, string>;
Expand Down Expand Up @@ -125,6 +126,7 @@ interface MaterialSlotProps {
baseLinearProgress: MUILinearProgressProps;
baseCircularProgress: MUICircularProgressProps;
baseMenuItem: MUIMenuItemProps;
baseTooltip: MUITooltipProps;
}

interface ElementSlotProps {
Expand Down Expand Up @@ -161,13 +163,7 @@ interface ElementSlotProps {

// Merge MUI types into base types to keep slotProps working.
type Merge<A, B> = {
[K in keyof A | keyof B]: K extends keyof A & keyof B
? A[K] & B[K]
: K extends keyof B
? B[K]
: K extends keyof A
? A[K]
: never;
[K in keyof A | keyof B]: K extends keyof A ? A[K] : K extends keyof B ? B[K] : never;
};
export type GridSlotProps = Merge<BaseSlotProps, MaterialSlotProps> & ElementSlotProps;

Expand Down
Loading