import * as React from 'react'; import { ClassValue } from 'clsx'; import { Simplify } from '@mui/types'; import { EventHandlers } from './types'; export type WithCommonProps = T & { className?: string; style?: React.CSSProperties; ref?: React.Ref; }; export interface MergeSlotPropsParameters { /** * A function that returns the internal props of the component. * It accepts the event handlers passed into the component by the user * and is responsible for calling them where appropriate. */ getSlotProps?: (other: EventHandlers) => WithCommonProps; /** * Props provided to the `slotProps.*` of the Base UI component. */ externalSlotProps?: WithCommonProps; /** * Extra props placed on the Base UI component that should be forwarded to the slot. * This should usually be used only for the root slot. */ externalForwardedProps?: WithCommonProps; /** * Additional props to be placed on the slot. */ additionalProps?: WithCommonProps; /** * Extra class name(s) to be placed on the slot. */ className?: ClassValue | ClassValue[]; } export type MergeSlotPropsResult = { props: Simplify; internalRef: React.Ref | undefined; }; /** * Merges the slot component internal props (usually coming from a hook) * with the externally provided ones. * * The merge order is (the latter overrides the former): * 1. The internal props (specified as a getter function to work with get*Props hook result) * 2. Additional props (specified internally on a Base UI component) * 3. External props specified on the owner component. These should only be used on a root slot. * 4. External props specified in the `slotProps.*` prop. * 5. The `className` prop - combined from all the above. * @param parameters * @returns */ export default function mergeSlotProps, ExternalSlotProps extends Record, AdditionalProps>(parameters: MergeSlotPropsParameters): MergeSlotPropsResult;