import React, { memo, useRef } from 'react' import { BorderLeft } from '../Border' import { useSizedSurfaceProps, useSurfaceHeight } from '../hooks/useSizedSurface' import { Icon, IconProps } from '../Icon' import { Menu, MenuProps } from '../Menu' import { getSize } from '../Sizes' import { Space } from '../Space' import { SimpleText } from '../text/SimpleText' import { View } from '../View/View' import { Button, ButtonProps } from './Button' export type MenuButtonProps = ButtonProps & Pick & { scrollable?: MenuProps['scrollable'] openIconProps?: IconProps } export const MenuButton = memo((props: MenuButtonProps) => { const { items, scrollable, children, openIconProps, open, openOnHover, size, ...rest } = props const sizedSurfaceProps = useSizedSurfaceProps(props) const sizePx = getSize(size) const height = useSurfaceHeight(sizePx) // using the same group ensures the tooltip closes when the menu opens const group = useRef(`${Math.random()}`).current const spaceElement = return ( ) }) const preventPropagation = (e: React.MouseEvent) => { e.preventDefault() e.stopPropagation() }