import React from 'react'; import { ComponentWithProps, FactoryPayload } from './factory'; type DefaultProps = Record; type ElementType = keyof React.JSX.IntrinsicElements | React.JSXElementConstructor; type PropsOf = React.JSX.LibraryManagedAttributes>; type ComponentProp = { component?: C; }; type ExtendedProps = OverrideProps & Omit; type InheritedProps = ExtendedProps, Props>; export type PolymorphicRef = C extends React.ElementType ? React.ComponentPropsWithRef['ref'] : never; export type PolymorphicComponentProps = C extends React.ElementType ? InheritedProps> & { ref?: PolymorphicRef; } : Props & { component: React.ElementType; }; export interface PolymorphicFactoryPayload extends FactoryPayload { defaultComponent: any; defaultRef: any; } export interface PolymorphicComponent extends ComponentWithProps { (props: PolymorphicComponentProps): React.ReactElement; extend: any; displayName?: string; } export interface PolymorphicFactoryOptions { /** Optional display name applied to the resulting component */ displayName?: string; /** Enable or disable memoization. Defaults to `true`. */ memo?: boolean; /** Optional custom comparison used when memoization is enabled */ arePropsEqual?: (prevProps: Readonly, nextProps: Readonly) => boolean; } /** * Factory function for creating polymorphic PlatformBlocks components */ export declare function polymorphicFactory(ui: React.ForwardRefRenderFunction, options?: PolymorphicFactoryOptions): PolymorphicComponent; /** * Creates a polymorphic component from a regular component */ export declare function createPolymorphicComponent>(component: any): ((props: PolymorphicComponentProps) => React.ReactElement) & Omit & Omit, "component" | keyof Props> & { ref?: any; }) | (Props & { component: React.ElementType; })>, never> & StaticComponents; export type PolymorphicFactory = Payload; export {};