UNPKG

2.36 kBTypeScriptView Raw
1import * as React from 'react';
2import { AppendOwnerStateReturnType } from './appendOwnerState';
3import { MergeSlotPropsParameters, MergeSlotPropsResult, WithCommonProps } from './mergeSlotProps';
4export type UseSlotPropsParameters<ElementType extends React.ElementType, SlotProps, ExternalForwardedProps, ExternalSlotProps, AdditionalProps, OwnerState> = Omit<MergeSlotPropsParameters<SlotProps, ExternalForwardedProps, ExternalSlotProps, AdditionalProps>, 'externalSlotProps'> & {
5 /**
6 * The type of the component used in the slot.
7 */
8 elementType: ElementType | undefined;
9 /**
10 * The `slotProps.*` of the Base UI component.
11 */
12 externalSlotProps: ExternalSlotProps | ((ownerState: OwnerState) => ExternalSlotProps) | undefined;
13 /**
14 * The ownerState of the Base UI component.
15 */
16 ownerState: OwnerState;
17 /**
18 * Set to true if the slotProps callback should receive more props.
19 */
20 skipResolvingSlotProps?: boolean;
21};
22export type UseSlotPropsResult<ElementType extends React.ElementType, SlotProps, AdditionalProps, OwnerState> = AppendOwnerStateReturnType<ElementType, MergeSlotPropsResult<SlotProps, object, object, AdditionalProps>['props'] & {
23 ref: ((instance: any | null) => void) | null;
24}, OwnerState>;
25/**
26 * @ignore - do not document.
27 * Builds the props to be passed into the slot of an unstyled component.
28 * It merges the internal props of the component with the ones supplied by the user, allowing to customize the behavior.
29 * If the slot component is not a host component, it also merges in the `ownerState`.
30 *
31 * @param parameters.getSlotProps - A function that returns the props to be passed to the slot component.
32 */
33export declare function useSlotProps<ElementType extends React.ElementType, SlotProps, AdditionalProps, OwnerState>(parameters: UseSlotPropsParameters<ElementType, SlotProps, object, WithCommonProps<Record<string, any>>, AdditionalProps, OwnerState>): import("@mui/types").Simplify<import("@mui/types").Simplify<SlotProps & object & AdditionalProps & {
34 className?: string | undefined;
35 style?: React.CSSProperties | undefined;
36}> & {
37 ref: ((instance: any) => void) | null;
38} & {
39 ownerState: ElementType extends React.ComponentType<any> ? OwnerState : ElementType extends keyof JSX.IntrinsicElements ? undefined : OwnerState | undefined;
40}>;
41
\No newline at end of file