import { ReactNode, JSX } from 'react'; import { BundledLanguage } from 'shiki'; import { RichTextNode, RichTextTocNode } from '@basehub/mutation-api-helpers'; export { RichTextNode, RichTextTocNode } from '@basehub/mutation-api-helpers'; declare const SUFFIX_CUSTOM_MARK = "_mark"; type SUFFIX_CUSTOM_BLOCK_MARK = typeof SUFFIX_CUSTOM_MARK; type BaseCustomBlock = { __typename: string; _id?: string; _sys?: { id: string; }; }; type CommonLinkProps = { children: ReactNode; href: string; target?: string; rel?: string; }; type InternalLinkProps = CommonLinkProps & { internal: Omit, "_id" | "_sys">; }; type ExternalLinkProps = CommonLinkProps & { internal: undefined; }; type Handlers = { p: (props: { children: ReactNode; }) => ReactNode; b: (props: { children: ReactNode; }) => ReactNode; highlight: (props: { children: ReactNode; }) => ReactNode; em: (props: { children: ReactNode; }) => ReactNode; s: (props: { children: ReactNode; }) => ReactNode; kbd: (props: { children: ReactNode; }) => ReactNode; code: (props: { children: ReactNode; }) => ReactNode; a: (props: ExternalLinkProps & { internal: undefined | InternalLinkProps; }) => ReactNode; ol: (props: { children: ReactNode; start: number; }) => ReactNode; ul: (props: { children: ReactNode; ["data-is-task-list"]?: boolean; }) => ReactNode; li: (props: { children: ReactNode; } & ({ ["data-is-task-list"]?: false; } | { ["data-is-task-list"]: true; ["data-checked"]: boolean; })) => ReactNode; h1: (props: { children: ReactNode; id: string; }) => ReactNode; h2: (props: { children: ReactNode; id: string; }) => ReactNode; h3: (props: { children: ReactNode; id: string; }) => ReactNode; h4: (props: { children: ReactNode; id: string; }) => ReactNode; h5: (props: { children: ReactNode; id: string; }) => ReactNode; h6: (props: { children: ReactNode; id: string; }) => ReactNode; hr: () => ReactNode; img: (props: { src: string; alt?: string; width?: number; height?: number; caption?: string; }) => ReactNode; video: (props: { children: ReactNode; src: string; width?: number; height?: number; caption?: string; }) => ReactNode; blockquote: (props: { children: ReactNode; }) => ReactNode; pre: (props: { children: ReactNode; language: BundledLanguage; code: string; }) => ReactNode; table: (props: { children: ReactNode; }) => ReactNode; tr: (props: { children: ReactNode; }) => ReactNode; td: (props: { children: ReactNode; colspan: number; rowspan: number; colwidth?: number[]; }) => ReactNode; th: (props: { children: ReactNode; colspan: number; rowspan: number; colwidth?: number[]; }) => ReactNode; thead: (props: { children: ReactNode; }) => ReactNode; tbody: (props: { children: ReactNode; }) => ReactNode; tfoot: (props: { children: ReactNode; }) => ReactNode; br: () => ReactNode; u: (props: { children: ReactNode; }) => ReactNode; superscript: (props: { children: ReactNode; }) => ReactNode; subscript: (props: { children: ReactNode; }) => ReactNode; }; type ExtractPropsForHandler ReactNode> = Parameters[0]; type HandlerProps = ExtractPropsForHandler; type CustomBlockBase = { readonly __typename: string; }; type CustomBlocksBase = readonly CustomBlockBase[]; type HandlerMapping = { [K in Blocks[number]["__typename"]]: (props: Extract) => ReactNode; }; type MarkHandlerMapping = { [K in Blocks[number]["__typename"] as `${K}${SUFFIX_CUSTOM_BLOCK_MARK}`]: (props: Extract & { children: ReactNode; }) => ReactNode; }; type HandlerLinkMapping = { [K in Blocks[number]["__typename"]]: CommonLinkProps & { internal: Extract; }; }; type LinkHandlerMapping = { a: (props: ExternalLinkProps | HandlerLinkMapping[keyof HandlerLinkMapping]) => ReactNode; }; type RichTextProps = { content?: RichTextNode[]; /** * @deprecated Use `content` instead. */ children?: unknown; blocks?: CustomBlocks; components?: Partial & MarkHandlerMapping & LinkHandlerMapping>; disableDefaultComponents?: boolean; }; declare const RichText: (props: RichTextProps) => JSX.Element; declare function createRichTextWithDefaultComponents(defaultComponents: RichTextProps["components"]): (props: RichTextProps) => JSX.Element; type TocHandlers = Pick; type TOCProps = { content?: RichTextTocNode[]; /** * @deprecated Use `content` instead. */ children?: unknown; components?: Partial; disableDefaultComponents?: boolean; }; declare const TOC: (props: TOCProps) => JSX.Element; export { type CustomBlocksBase, type HandlerProps, RichText, type RichTextProps, TOC, type TOCProps, createRichTextWithDefaultComponents };