( alignEnd: boolean, dropDirection?: DropDirection, isRTL?: boolean, )
| 89 | }; |
| 90 | |
| 91 | export function getDropdownMenuPlacement( |
| 92 | alignEnd: boolean, |
| 93 | dropDirection?: DropDirection, |
| 94 | isRTL?: boolean, |
| 95 | ) { |
| 96 | const topStart = isRTL ? 'top-end' : 'top-start'; |
| 97 | const topEnd = isRTL ? 'top-start' : 'top-end'; |
| 98 | const bottomStart = isRTL ? 'bottom-end' : 'bottom-start'; |
| 99 | const bottomEnd = isRTL ? 'bottom-start' : 'bottom-end'; |
| 100 | const leftStart = isRTL ? 'right-start' : 'left-start'; |
| 101 | const leftEnd = isRTL ? 'right-end' : 'left-end'; |
| 102 | const rightStart = isRTL ? 'left-start' : 'right-start'; |
| 103 | const rightEnd = isRTL ? 'left-end' : 'right-end'; |
| 104 | |
| 105 | let placement: Placement = alignEnd ? bottomEnd : bottomStart; |
| 106 | if (dropDirection === 'up') placement = alignEnd ? topEnd : topStart; |
| 107 | else if (dropDirection === 'end') |
| 108 | placement = alignEnd ? rightEnd : rightStart; |
| 109 | else if (dropDirection === 'start') |
| 110 | placement = alignEnd ? leftEnd : leftStart; |
| 111 | else if (dropDirection === 'down-centered') placement = 'bottom'; |
| 112 | else if (dropDirection === 'up-centered') placement = 'top'; |
| 113 | return placement; |
| 114 | } |
| 115 | |
| 116 | const DropdownMenu: BsPrefixRefForwardingComponent<'div', DropdownMenuProps> = |
| 117 | React.forwardRef<HTMLElement, DropdownMenuProps>( |
no outgoing calls
no test coverage detected
searching dependent graphs…