UNPKG

@mui/internal-docs-infra

Version:

MUI Infra - internal documentation creation tools.

39 lines 1.31 kB
import * as React from 'react'; import type { ContentProps } from "../CodeHighlighter/types.js"; import { UseCopierOpts } from "../useCopier/index.js"; type UseCodeOpts = { defaultOpen?: boolean; copy?: UseCopierOpts; githubUrlPrefix?: string; initialVariant?: string; initialTransform?: string; }; type UserProps<T extends {} = {}> = T & { name?: string; slug?: string; }; export interface UseCodeResult<T extends {} = {}> { variants: string[]; selectedVariant: string; selectVariant: React.Dispatch<React.SetStateAction<string>>; files: Array<{ name: string; slug?: string; component: React.ReactNode; }>; selectedFile: React.ReactNode; selectedFileLines: number; selectedFileName: string | undefined; selectFileName: (fileName: string) => void; expanded: boolean; expand: () => void; setExpanded: React.Dispatch<React.SetStateAction<boolean>>; copy: (event: React.MouseEvent<HTMLButtonElement>) => Promise<void>; availableTransforms: string[]; selectedTransform: string | null | undefined; selectTransform: (transformName: string | null) => void; setSource?: (source: string) => void; userProps: UserProps<T>; } export declare function useCode<T extends {} = {}>(contentProps: ContentProps<T>, opts?: UseCodeOpts): UseCodeResult<T>; export {};