import type { RaRecord } from '../types'; import type { LinkToType } from './types'; /** * Get a path for a record, based on the current resource and the link type. * * Accepted link types are 'edit', 'show', a route string, false, or a function returning one of these types. * * @example * // basic usage (leverages RecordContext, ResourceContext and ResourceDefinitionContext) * const EditLink = () => { * const path = useGetPathForRecord(); * return path ? Edit : null; * }; * * // controlled mode * const EditLink = ({ record, resource }) => { * const path = useGetPathForRecord({ record, resource, link: 'edit' }); * return path ? Edit : null; * }; * * // the link option can be a function * const EditLink = ({ record, resource }) => { * const path = useGetPathForRecord({ record, resource, link: (record, resource) => record.canEdit ? 'edit' : false }); * return path ? Edit : null; * }; * * // the link option can be a function returning a promise * const EditLink = ({ record, resource }) => { * const path = useGetPathForRecord({ record, resource, link: async (record, resource) => { * const canEdit = await canEditRecord(record, resource); * return canEdit ? 'edit' : false; * }}); * return path ? Edit : null; * }; */ export declare const useGetPathForRecord: (options?: UseGetPathForRecordOptions) => string | false | undefined; export interface UseGetPathForRecordOptions { resource?: string; record?: RecordType; link?: LinkToType; } export type UseGetRouteForRecordOptions = UseGetPathForRecordOptions; //# sourceMappingURL=useGetPathForRecord.d.ts.map