import type { ArrayFieldItemTemplateProps, FormContextType, RJSFSchema, StrictRJSFSchema, } from "@rjsf/utils"; import { getTemplate, getUiOptions } from "@rjsf/utils"; /** * Custom ArrayFieldItemTemplate to ensure array item content uses full width * while keeping action buttons aligned to the right. */ export function ArrayFieldItemTemplate< T = unknown, S extends StrictRJSFSchema = RJSFSchema, F extends FormContextType = FormContextType, >(props: ArrayFieldItemTemplateProps) { const { children, buttonsProps, displayLabel, hasDescription, hasToolbar, uiSchema, registry, } = props; const uiOptions = getUiOptions(uiSchema); const ArrayFieldItemButtonsTemplate = getTemplate< "ArrayFieldItemButtonsTemplate", T, S, F >("ArrayFieldItemButtonsTemplate", registry, uiOptions); const margin = hasDescription ? -6 : 22; return (
{children}
{hasToolbar && (
)}
); } export default ArrayFieldItemTemplate;