UNPKG

1.06 kBTypeScriptView Raw
1import { SxProps } from '@mui/system';
2import { SlotComponentProps } from '@mui/utils';
3import { Theme } from '../styles';
4export type { EventHandlers, WithOptionalOwnerState, SlotComponentProps, SlotComponentPropsWithSlotState, } from '@mui/utils';
5export type SlotCommonProps = {
6 component?: React.ElementType;
7 sx?: SxProps<Theme>;
8};
9export type SlotProps<TSlotComponent extends React.ElementType, TOverrides, TOwnerState> = SlotComponentProps<TSlotComponent, SlotCommonProps & TOverrides, TOwnerState>;
10/**
11 * Use the keys of `Slots` to make sure that K contains all of the keys
12 *
13 * @example CreateSlotsAndSlotProps<{ root: React.ElementType, decorator: React.ElementType }, { root: ..., decorator: ... }>
14 */
15export type CreateSlotsAndSlotProps<Slots, K extends Record<keyof Slots, any>> = {
16 /**
17 * The components used for each slot inside.
18 * @default {}
19 */
20 slots?: Partial<Slots>;
21 /**
22 * The props used for each slot inside.
23 * @default {}
24 */
25 slotProps?: {
26 [P in keyof K]?: K[P];
27 };
28};