// This file is part of Shadcn Admin Kit (https://github.com/marmelab/shadcn-admin-kit) import type { ReactNode } from "react"; import type { RaRecord, UseListOptions, UseFieldValueOptions } from "ra-core"; import { ListContextProvider, useList, useFieldValue } from "ra-core"; export const ArrayField = ( props: ArrayFieldProps, ) => { const { children, resource, perPage, sort, filter } = props; const data = useFieldValue(props) || emptyArray; const listContext = useList({ data, resource, perPage, sort, filter }); return ( {children} ); }; export type ArrayFieldProps< RecordType extends RaRecord = RaRecord, ErrorType = Error, > = UseListOptions & UseFieldValueOptions & { children?: ReactNode; }; // eslint-disable-next-line @typescript-eslint/no-explicit-any const emptyArray: any[] = [];