import Box from '@mui/material/Box'; import { SxProps, Theme } from '@mui/material'; import { RefObject, useRef } from 'react'; import { useAutoScrollToBottom } from './useAutoScrollToBottom'; interface ScrollableProps { children?: React.ReactNode; sx?: SxProps; autoscroll?: boolean; textFieldRef?: RefObject; // Reference to the element that triggers auto-scroll fallbackThreshold?: number; contentUpdateTrigger?: any; className?: string; } const Scrollable = (props: ScrollableProps) => { const { sx, className, children, autoscroll, textFieldRef, fallbackThreshold = 0.33, contentUpdateTrigger } = props; // Create a default ref if textFieldRef is not provided const defaultTextFieldRef = useRef(null); const scrollRef = useAutoScrollToBottom(textFieldRef ?? defaultTextFieldRef, true, fallbackThreshold, contentUpdateTrigger); return ( {children} ); }; export { useAutoScrollToBottom, Scrollable };