UNPKG

@uiw/react-json-view

Version:
57 lines (56 loc) 2.25 kB
import { PropsWithChildren, ComponentPropsWithoutRef } from 'react'; export type TagType = React.ElementType | keyof JSX.IntrinsicElements; type TypesElementProps<T extends TagType = 'span'> = { as?: T; render?: (props: TypesElement<T>, result: { type: 'type' | 'value'; value?: unknown; keyName: string | number; }) => React.ReactNode; 'data-type'?: string; }; export type TypesElement<T extends TagType> = TypesElementProps<T> & ComponentPropsWithoutRef<T>; export type InitialTypesState<T extends TagType = 'span'> = { displayDataTypes?: boolean; Url?: TypesElement<T>; Str?: TypesElement<T>; Undefined?: TypesElement<T>; Null?: TypesElement<T>; True?: TypesElement<T>; False?: TypesElement<T>; Date?: TypesElement<T>; Float?: TypesElement<T>; Set?: TypesElement<T>; Int?: TypesElement<T>; Map?: TypesElement<T>; Nan?: TypesElement<T>; Bigint?: TypesElement<T>; }; type Dispatch<T extends TagType> = React.Dispatch<InitialTypesState<T>>; export declare const useTypesStore: () => InitialTypesState<TagType>; export declare function useTypes(): [{ displayDataTypes?: boolean; Url?: TypesElement<TagType> | undefined; Str?: TypesElement<TagType> | undefined; Undefined?: TypesElement<TagType> | undefined; Null?: TypesElement<TagType> | undefined; True?: TypesElement<TagType> | undefined; False?: TypesElement<TagType> | undefined; Date?: TypesElement<TagType> | undefined; Float?: TypesElement<TagType> | undefined; Set?: TypesElement<TagType> | undefined; Int?: TypesElement<TagType> | undefined; Map?: TypesElement<TagType> | undefined; Nan?: TypesElement<TagType> | undefined; Bigint?: TypesElement<TagType> | undefined; }, import("react").Dispatch<InitialTypesState<TagType>>]; export declare function useTypesDispatch(): Dispatch<TagType>; interface TypesProps<T extends TagType> { initial: InitialTypesState<T>; dispatch: Dispatch<TagType>; } export declare function Types<T extends TagType>({ initial, dispatch, children }: PropsWithChildren<TypesProps<T>>): import("react/jsx-runtime").JSX.Element; export declare namespace Types { var displayName: string; } export {};