import * as React from 'react'; import { IStyleSetBase } from '@fluentui/style-utilities'; import { IComponentOptions as IOldComponentOptions } from '../IComponent'; import { ISlots, ISlotDefinition, ISlottableProps } from '../ISlots'; /** * Defines the contract for view components. */ export type IViewComponent = (props: React.PropsWithChildren, slots: ISlots>) => ReturnType; /** * Defines the contract for slot components. */ export type ISlotComponent, TComponentSlots> = ISlotDefinition> | ((props: TComponentProps) => ISlotDefinition>); /** * Defines the contract for partial slot components used in recomposition. */ export type IPartialSlotComponent, TComponentSlots> = ISlotDefinition | ((props: TComponentProps) => ISlotDefinition); /** * Component options used by foundation to tie elements together. * * * TComponentProps: A styleable props interface for the created component. * * TTokens: The type for tokens props. * * TStyleSet: The type for styles properties. * * TViewProps: The props specific to the view, including processed properties outputted by optional state component. * If state component is not provided, TComponentProps is the same as TViewProps. * * TComponentSlots: The slottable components used to build the HOC. * * TStatics: Static type for statics applied to created component object. */ export interface IComponentOptions, TTokens, TStyleSet extends IStyleSetBase, TViewProps = TComponentProps, TComponentSlots = {}, TStatics = {}> extends IOldComponentOptions { /** * Slot definition object defining the slot component for each slot. */ slots?: ISlotComponent; /** * Stateless pure function that receives props to render the output of the component. */ view?: IViewComponent; } export interface IRecompositionComponentOptions, TTokens, TStyleSet extends IStyleSetBase, TViewProps = TComponentProps, TComponentSlots = {}, TStatics = {}> extends IOldComponentOptions { /** * Slot definition object defining the slot component for each slot. */ slots?: IPartialSlotComponent; /** * Stateless pure function that receives props to render the output of the component. */ view?: IViewComponent; } /** * Component helper that defines options as required for ease of use by component consumers. */ export type IComponent, TTokens, TStyleSet extends IStyleSetBase, TViewProps = TComponentProps, TComponentSlots = {}, TStatics = {}> = Required>;