1
1
import { cloneElement , MouseEvent , ReactElement , useState } from 'react' ;
2
+
2
3
import {
3
4
useDismiss ,
4
5
useInteractions ,
@@ -7,14 +8,15 @@ import {
7
8
flip ,
8
9
shift ,
9
10
} from '@floating-ui/react' ;
10
- import MenuButton from './Primitive/MenuButton' ;
11
+
12
+ import { DataAttributes , DeprecatedIconNames } from '../../types' ;
13
+ import Clickable , { ClickableProps } from '../Clickable' ;
14
+ import { LinkableType } from '../Linkable' ;
15
+ import DropdownDivider from './Primitive/DropdownDivider' ;
11
16
import DropdownLink from './Primitive/DropdownLink' ;
12
17
import DropdownShell from './Primitive/DropdownShell' ;
13
18
import DropdownTitle from './Primitive/DropdownTitle' ;
14
- import DropdownDivider from './Primitive/DropdownDivider' ;
15
- import Clickable , { ClickableProps } from '../Clickable' ;
16
- import { LinkableType } from '../Linkable' ;
17
- import { DataAttributes , DeprecatedIconNames } from '../../types' ;
19
+ import MenuButton from './Primitive/MenuButton' ;
18
20
19
21
type DropdownButtonType = Omit < ClickableProps , 'children' > & {
20
22
label : string ;
@@ -59,9 +61,10 @@ const Dropdown = ({
59
61
const [ isOpen , setIsOpen ] = useState ( false ) ;
60
62
61
63
const floating = useFloating ( {
64
+ placement : 'bottom-start' ,
62
65
open : isOpen ,
63
66
onOpenChange : setIsOpen ,
64
- middleware : [ /*offset(10),*/ flip ( ) , shift ( ) ] ,
67
+ middleware : [ flip ( ) , shift ( ) ] ,
65
68
whileElementsMounted : autoUpdate ,
66
69
} ) ;
67
70
const dismiss = useDismiss ( floating . context , {
@@ -106,7 +109,6 @@ const Dropdown = ({
106
109
onClick = { ( event : MouseEvent < HTMLButtonElement > | KeyboardEvent ) => {
107
110
entry . onClick ( event ) ;
108
111
setIsOpen ( false ) ;
109
- console . log ( 'closed but sent' ) ;
110
112
} }
111
113
key = { id }
112
114
tabIndex = { 0 }
0 commit comments