import type { CSSProperties, FC, ReactNode } from "react" import { ErrorBoundary } from "../error-boundary/index.ts" export type Dict = Record export type WrapperComponent = Dict> = FC< T & { children: ReactNode; testid?: string | undefined } > export type WC = Dict> = WrapperComponent export type JsonEditorComponents = { ErrorBoundary: WC Button: WC<{ onClick?: () => void disabled?: boolean }> DeleteIcon: FC AddIcon: FC EditorWrapper: WC<{ style?: CSSProperties | undefined className?: string | undefined testid?: string | undefined }> ArrayWrapper: WC ObjectWrapper: WC StringWrapper: WC NumberWrapper: WC BooleanWrapper: WC Null: FC<{ testid?: string | undefined }> MissingPropertyWrapper: WC KeyWrapper: WC } export const DEFAULT_JSON_EDITOR_COMPONENTS: JsonEditorComponents = { ErrorBoundary: ({ children }) => {children}, Button: ({ onClick, children, disabled, testid }) => ( ), EditorWrapper: ({ children, className, testid }) => (
{children}
), ArrayWrapper: ({ children, testid }) => (
{children}
), ObjectWrapper: ({ children, testid }) => (
{children}
), StringWrapper: ({ children, testid }) => ( {children} ), NumberWrapper: ({ children, testid }) => ( {children} ), BooleanWrapper: ({ children, testid }) => ( {children} ), Null: ({ testid }) => ( ), DeleteIcon: () => ( × ), // big plus AddIcon: () => , MissingPropertyWrapper: ({ children, testid }) => ( {children} ), KeyWrapper: ({ children, testid }) => ( {children} ), }