@helpwave/hightide
Version:
helpwave's component and theming library
36 lines (33 loc) • 1.41 kB
text/typescript
import * as react_jsx_runtime from 'react/jsx-runtime';
import { RefObject, ReactNode, PropsWithChildren } from 'react';
import { PropsWithBagFunctionOrChildren } from '../../util/PropsWithFunctionChildren.mjs';
import { PopoverHorizontalAlignment, PopoverVerticalAlignment } from '../../hooks/usePopoverPosition.mjs';
type MenuItemProps = {
onClick?: () => void;
alignment?: 'left' | 'right';
isDisabled?: boolean;
className?: string;
};
declare const MenuItem: ({ children, onClick, alignment, isDisabled, className }: PropsWithChildren<MenuItemProps>) => react_jsx_runtime.JSX.Element;
type MenuBag = {
isOpen: boolean;
disabled: boolean;
toggleOpen: () => void;
close: () => void;
};
type MenuProps<T> = PropsWithBagFunctionOrChildren<MenuBag> & {
trigger: (bag: MenuBag, ref: RefObject<T>) => ReactNode;
/**
* @default 'l'
*/
alignmentHorizontal?: PopoverHorizontalAlignment;
alignmentVertical?: PopoverVerticalAlignment;
showOnHover?: boolean;
menuClassName?: string;
disabled?: boolean;
};
/**
* A Menu Component to allow the user to see different functions
*/
declare const Menu: <T extends HTMLElement>({ trigger, children, alignmentHorizontal, alignmentVertical, showOnHover, disabled, menuClassName, }: MenuProps<T>) => react_jsx_runtime.JSX.Element;
export { Menu, type MenuBag, MenuItem, type MenuItemProps, type MenuProps };