import { ComponentPropsWithRef, ForwardedRef, PropsWithoutRef, ReactElement, RefAttributes, WeakValidationMap, } from 'react'; import { RowData } from '@tanstack/react-table'; import { VirtualItem } from '@tanstack/react-virtual'; import { LeafyGreenTableRow } from '../useLeafyGreenTable'; export interface ExpandedContentProps extends ComponentPropsWithRef<'tr'> { row: LeafyGreenTableRow; /** * Virtual row object passed from the `useLeafyGreenVirtualTable` hook */ virtualRow?: VirtualItem; } // https://stackoverflow.com/a/58473012 // React.forwardRef can only work with plain function types. // This is an interface that restores the original function signature to work with generics. /** * The HeaderCellComponentType that restores the original function signature to work with generics. * */ export interface ExpandedContentComponentType { ( props: ExpandedContentProps, ref: ForwardedRef, ): ReactElement | null; displayName?: string; propTypes?: | WeakValidationMap< PropsWithoutRef & RefAttributes> > | undefined; }