@project44-manifest/react
Version:
Manifest Design System react components
34 lines • 967 B
TypeScript
import type * as React from 'react';
/**
* The `as` prop.
*/
export declare type As<P = any> = React.ElementType<P>;
/**
* Component interface with support for `as` prop.
*/
export interface Component<O extends Options> {
<T extends As>(props: Omit<HTMLProps<Options<T>>, keyof O> & Omit<O, 'as'> & Required<Options<T>>): JSX.Element | null;
(props: Props<O>): JSX.Element | null;
displayName?: string;
id?: string;
propTypes?: any;
}
/**
* Props inferred from the as prop.
*/
export declare type HTMLProps<O extends Options> = Omit<React.ComponentPropsWithRef<NonNullable<O['as']>>, keyof O | 'children'> & {
[index: `data-${string}`]: unknown;
children?: React.ReactNode;
};
/**
* Options with the `as` and `css` options.
*/
export interface Options<T extends As = any> {
/** */
as?: T;
}
/**
* Options & HTMLProps
*/
export declare type Props<O extends Options> = HTMLProps<O> & O;
//# sourceMappingURL=types.d.ts.map