UNPKG

@navinc/base-react-components

Version:
19 lines (18 loc) 796 B
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 {};