@@ -85,11 +85,13 @@ export interface DrawerPopupProps
8585 // resizable
8686 /** Default size for uncontrolled resizable drawer */
8787 defaultSize ?: number | string ;
88- resizable ?: {
89- onResize ?: ( size : number ) => void ;
90- onResizeStart ?: ( ) => void ;
91- onResizeEnd ?: ( ) => void ;
92- } ;
88+ resizable ?:
89+ | boolean
90+ | {
91+ onResize ?: ( size : number ) => void ;
92+ onResizeStart ?: ( ) => void ;
93+ onResizeEnd ?: ( ) => void ;
94+ } ;
9395}
9496
9597const DrawerPopup : React . ForwardRefRenderFunction <
@@ -319,9 +321,14 @@ const DrawerPopup: React.ForwardRefRenderFunction<
319321 // =========================== Resize ===========================
320322 const wrapperRef = React . useRef < HTMLDivElement > ( null ) ;
321323
324+ const isResizable = typeof resizable === 'boolean' ? resizable : ! ! resizable ;
325+
326+ const resizeConfig =
327+ typeof resizable === 'object' && resizable !== null ? resizable : { } ;
328+
322329 const onInternalResize = useEvent ( ( size : number ) => {
323330 setCurrentSize ( size ) ;
324- resizable ? .onResize ?.( size ) ;
331+ resizeConfig . onResize ?.( size ) ;
325332 } ) ;
326333
327334 const { dragElementProps, isDragging } = useDrag ( {
@@ -333,8 +340,8 @@ const DrawerPopup: React.ForwardRefRenderFunction<
333340 containerRef : wrapperRef ,
334341 currentSize : mergedSize ,
335342 onResize : onInternalResize ,
336- onResizeStart : resizable ? .onResizeStart ,
337- onResizeEnd : resizable ? .onResizeEnd ,
343+ onResizeStart : resizeConfig . onResizeStart ,
344+ onResizeEnd : resizeConfig . onResizeEnd ,
338345 } ) ;
339346
340347 // =========================== Events ===========================
@@ -394,7 +401,7 @@ const DrawerPopup: React.ForwardRefRenderFunction<
394401 } }
395402 { ...pickAttrs ( props , { data : true } ) }
396403 >
397- { resizable && < div { ...dragElementProps } /> }
404+ { isResizable && < div { ...dragElementProps } /> }
398405 { drawerRender ? drawerRender ( content ) : content }
399406 </ div >
400407 ) ;
0 commit comments