@navinc/base-react-components
Version:
Nav's Pattern Library
19 lines (18 loc) • 796 B
TypeScript
import { ReactNode, ComponentType, ComponentProps, AllHTMLAttributes, JSX } from 'react';
export type AllTags = keyof JSX.IntrinsicElements;
type HTMLTransform = {
[tag in AllTags]: AllTags | ComponentType<Omit<ComponentProps<tag>, 'ref'>>;
};
type DefaultTransform = {
_: <Props extends AllHTMLAttributes<any>>(element: string | AllTags, props?: Props, children?: ReactNode) => ReactNode;
};
type CustomElementTransform = {
[key in `${string}-${string}`]: AllTags | ComponentType<unknown>;
};
export type HtmrOptions = {
transform: Partial<HTMLTransform & DefaultTransform & CustomElementTransform>;
preserveAttributes: Array<string | RegExp>;
/** An array of tags in which their children should be set as raw html */
dangerouslySetChildren: AllTags[];
};
export {};