@@ -11,7 +11,7 @@ import { useStyles } from './style';
1111import type { ActionItem , ChatInputActionsProps , CollapseItem , DividerItem } from './type' ;
1212
1313const ChatInputActions = memo < ChatInputActionsProps > (
14- ( { gap = 2 , disabled, items = [ ] , onActionClick, className, ...rest } ) => {
14+ ( { gap = 2 , disabled, items = [ ] , onActionClick, className, collapseOffset = 0 , ...rest } ) => {
1515 const { cx, styles } = useStyles ( ) ;
1616 const [ maxCount , setMaxCount ] = useState ( items . length ) ;
1717 const [ collapsed , setCollapsed ] = useState ( false ) ;
@@ -34,14 +34,14 @@ const ChatInputActions = memo<ChatInputActionsProps>(
3434 useEffect ( ( ) => {
3535 if ( ! size ?. width ) return ;
3636 const length = flatItems . length + 1 ;
37- const calcMaxCount = Math . floor ( size . width / 48 ) ;
37+ const calcMaxCount = Math . floor ( ( size . width - collapseOffset ) / 38 ) ;
3838 setMaxCount ( calcMaxCount ) ;
3939 if ( calcMaxCount < length ) {
4040 setCollapsed ( true ) ;
4141 } else {
4242 setCollapsed ( false ) ;
4343 }
44- } , [ size , flatItems . length ] ) ;
44+ } , [ size , flatItems . length , collapseOffset ] ) ;
4545
4646 const calcItem = useMemo ( ( ) => {
4747 if ( ! collapsed ) return items ;
0 commit comments