/// <reference types="react" />
declare type PickRequired<T, K extends keyof T> = Required<Pick<T, K>>;
export declare namespace Polymorphic {
    /** Maps our name to the HTMLElement ref type */
    export type Ref<Names extends Record<keyof Names, React.ElementType>, T extends keyof Names> = React.ComponentPropsWithRef<Names[T]>['ref'];
    type PolymorphicProp<M extends Record<keyof M, React.ElementType>, T extends keyof M> = {
        as?: (props: React.ComponentPropsWithRef<M[T]>) => React.ReactElement | null;
        role: T;
    };
    type CleanComponentProps<M extends Record<keyof M, React.ElementType>, T extends keyof M, Props> = Omit<React.ComponentPropsWithoutRef<M[T]>, keyof (PolymorphicProp<M, T> & Props)>;
    type RequiredComponentProps<M extends Record<keyof M, React.ElementType>, T extends keyof M, Require extends keyof React.ComponentPropsWithoutRef<M[T]>> = PickRequired<React.ComponentPropsWithoutRef<M[T]>, Require>;
    export type ComponentProps<Names extends Record<keyof Names, React.ElementType>, Role extends keyof Names, Require extends keyof React.ComponentPropsWithoutRef<Names[Role]>, Props = {}> = PolymorphicProp<Names, Role> & RequiredComponentProps<Names, Role, Require> & CleanComponentProps<Names, Role, Props> & Props;
    export type ComponentPropsWithRef<Names extends Record<keyof Names, React.ElementType>, Role extends keyof Names, Require extends keyof React.ComponentPropsWithoutRef<Names[Role]>, Props = {}> = ComponentProps<Names, Role, Require, Props> & {
        ref?: Ref<Names, Role>;
    };
    export {};
}
export declare namespace PolymorphicAs {
    type ComponentPropsWithRef<P extends {}, C extends React.ElementType> = P & Omit<React.ComponentPropsWithRef<C>, keyof P>;
    type ComponentPropsWithoutRef<P extends {}, C extends React.ElementType> = P & Omit<React.ComponentPropsWithoutRef<C>, keyof P>;
    interface ComponentWithForwardedRef<P extends {}, DC extends React.ElementType> {
        <C extends React.ElementType>(props: {
            as: C;
        } & ComponentPropsWithRef<P, C>): JSX.Element;
        (props: ComponentPropsWithRef<P, DC>): JSX.Element;
        displayName?: string;
    }
}
export {};
