11import React , { useState } from 'react'
22import produce , { Draft } from 'immer'
33import { usePopper } from 'react-popper'
4- import { Placement } from '@popperjs/core'
5- import { Options } from '@popperjs/core/lib/modifiers/offset'
4+ import { Placement , PositioningStrategy } from '@popperjs/core'
5+ import { Options as OffetOptions } from '@popperjs/core/lib/modifiers/offset'
66
77import getEventPath , { handleRefs , getDirection } from './utils'
88export interface MenuItem {
@@ -46,7 +46,6 @@ interface NestedMenuState {
4646 isOpen : boolean
4747 currentPath : string [ ]
4848 currentPathItems : MenuItem [ ]
49- placement ?: Placement
5049}
5150
5251/**
@@ -84,7 +83,8 @@ interface NestedMenuProps {
8483 isOpen ?: boolean
8584 defaultOpenPath ?: string [ ]
8685 placement ?: Placement
87- offset ?: Options [ 'offset' ]
86+ offset ?: OffetOptions [ 'offset' ]
87+ strategy ?: PositioningStrategy
8888}
8989
9090// interface HitAreaProps {
@@ -102,13 +102,13 @@ export const useNestedMenu = ({
102102 defaultOpenPath = [ ] ,
103103 placement,
104104 offset,
105+ strategy,
105106} : NestedMenuProps ) => {
106107 const [ state , dispatch ] = React . useReducer ( reducer , {
107108 items,
108109 isOpen,
109110 currentPath : defaultOpenPath ,
110111 currentPathItems : [ ] ,
111- placement,
112112 } )
113113
114114 const globalClickHandler = React . useCallback (
@@ -266,7 +266,8 @@ export const useNestedMenu = ({
266266 const menuRef = React . useRef < HTMLElement > ( )
267267
268268 const { styles, attributes } = usePopper ( toggleButtonRef . current , popperElement , {
269- placement : 'right-start' ,
269+ placement : placement ,
270+ strategy : strategy ,
270271 modifiers : [
271272 {
272273 name : 'offset' ,
0 commit comments