11import classNames from 'classnames' ;
2- import { useComposeRef } from 'rc-util' ;
32import * as React from 'react' ;
43import { RefContext } from './context' ;
54import pickAttrs from 'rc-util/lib/pickAttrs' ;
5+ import { useComposeRef } from 'rc-util/lib/ref' ;
66
77export interface DrawerPanelRef {
88 focus : VoidFunction ;
@@ -22,9 +22,7 @@ export type DrawerPanelAccessibility = Pick<
2222 keyof React . AriaAttributes
2323> ;
2424
25- export interface DrawerPanelProps
26- extends DrawerPanelEvents ,
27- DrawerPanelAccessibility {
25+ export interface DrawerPanelProps extends DrawerPanelEvents , DrawerPanelAccessibility {
2826 prefixCls : string ;
2927 className ?: string ;
3028 id ?: string ;
@@ -37,49 +35,24 @@ const DrawerPanel = (props: DrawerPanelProps) => {
3735 const {
3836 prefixCls,
3937 className,
40- style,
41- children,
4238 containerRef,
43- id,
44- onMouseEnter,
45- onMouseOver,
46- onMouseLeave,
47- onClick,
48- onKeyDown,
49- onKeyUp,
39+ ...restProps
5040 } = props ;
5141
52- const eventHandlers = {
53- onMouseEnter,
54- onMouseOver,
55- onMouseLeave,
56- onClick,
57- onKeyDown,
58- onKeyUp,
59- } ;
60-
6142 const { panel : panelRef } = React . useContext ( RefContext ) ;
6243 const mergedRef = useComposeRef ( panelRef , containerRef ) ;
6344
6445 // =============================== Render ===============================
6546
6647 return (
67- < >
68- < div
69- id = { id }
70- className = { classNames ( `${ prefixCls } -content` , className ) }
71- style = { {
72- ...style ,
73- } }
74- role = "dialog"
75- ref = { mergedRef }
76- { ...pickAttrs ( props , { aria : true } ) }
77- aria-modal = "true"
78- { ...eventHandlers }
79- >
80- { children }
81- </ div >
82- </ >
48+ < div
49+ className = { classNames ( `${ prefixCls } -content` , className ) }
50+ role = "dialog"
51+ ref = { mergedRef }
52+ { ...pickAttrs ( props , { aria : true } ) }
53+ aria-modal = "true"
54+ { ...restProps }
55+ />
8356 ) ;
8457} ;
8558
0 commit comments