@@ -25,22 +25,29 @@ export const popperPlacementPositions = [
2525
2626export default function withFloating ( Component ) {
2727 const WithFloating = ( props ) => {
28+ const alt_props = {
29+ ...props ,
30+ popperModifiers : props . popperModifiers || [ ] ,
31+ popperProps : props . popperProps || { } ,
32+ hidePopper :
33+ typeof props . hidePopper === "boolean" ? props . hidePopper : true ,
34+ } ;
2835 const arrowRef = React . useRef ( ) ;
2936 const floatingProps = useFloating ( {
30- open : ! props . hidePopper ,
37+ open : ! alt_props . hidePopper ,
3138 whileElementsMounted : autoUpdate ,
32- placement : props . popperPlacement ,
39+ placement : alt_props . popperPlacement ,
3340 middleware : [
3441 flip ( { padding : 15 } ) ,
3542 offset ( 10 ) ,
3643 arrow ( { element : arrowRef } ) ,
37- ...props . popperModifiers ,
44+ ...alt_props . popperModifiers ,
3845 ] ,
39- ...props . popperProps ,
46+ ...alt_props . popperProps ,
4047 } ) ;
4148
4249 return (
43- < Component { ...props } popperProps = { { ...floatingProps , arrowRef } } />
50+ < Component { ...alt_props } popperProps = { { ...floatingProps , arrowRef } } />
4451 ) ;
4552 } ;
4653
@@ -51,11 +58,5 @@ export default function withFloating(Component) {
5158 hidePopper : PropTypes . bool ,
5259 } ;
5360
54- WithFloating . defaultProps = {
55- popperModifiers : [ ] ,
56- popperProps : { } ,
57- hidePopper : true ,
58- } ;
59-
6061 return WithFloating ;
6162}
0 commit comments