import * as React from 'react'; import { ReactNode } from 'react'; import { Record } from '../types'; /** * Context to store the current record. * * Use the useRecordContext() hook to read the context. That's what the Edit and Show components do in ../../app. * * @example * * import { useEditController, EditContext } from '../../core'; * * const Edit = props => { * const { record } = useEditController(props); * return ( * * ... * * ); * }; */ export declare const RecordContext: React.Context>; export declare const RecordContextProvider: = Record>({ children, value, }: RecordContextOptions) => JSX.Element; export interface RecordContextOptions { children: ReactNode; value?: RecordType; } /** * Hook to read the record from a RecordContext. * * Must be used within a such as provided by the * (e.g. as a descendent of or ) or within a * (e.g. as a descendent of or ) * * @example // basic usage * * import { useRecordContext } from '../../core'; * * const TitleField = () => { * const record = useRecordContext(); * return {record && record.title}; * }; * * @example // allow record override via props * * import { useRecordContext } from '../../core'; * * const TitleField = (props) => { * const record = useRecordContext(props); * return {record && record.title}; * }; * render(); * * @returns {Record} A record object */ export declare const useRecordContext: = Record>(props?: UseRecordContextParams) => RecordType; export interface UseRecordContextParams = Record> { record?: RecordType; [key: string]: any; }