import { type ReactElement, useMemo } from 'react'; import Grid2 from '@mui/material/Grid2'; import { getComponentFromMap } from '@pega/react-sdk-components/lib/bridge/helpers/sdk_component_map'; import type { PConnFieldProps } from '@pega/react-sdk-components/lib/types/PConnProps'; interface GroupProps extends PConnFieldProps { children: ReactElement[]; heading: string; showHeading: boolean; instructions?: string; collapsible: boolean; type: string; } export default function Group(props: GroupProps) { const FieldGroup = getComponentFromMap('FieldGroup'); const { children, heading, showHeading, instructions, collapsible, displayMode, type } = props; const isReadOnly = displayMode === 'DISPLAY_ONLY'; const content = useMemo(() => { return ( {children?.map(child => ( {child} ))} ); }, [children, type, isReadOnly]); if (!children) return null; return ( {content} ); }