import type React from 'react'; import classNames from 'classnames'; import type { Merge } from 'type-fest'; import { Icon } from '../icon'; import type { IconProp } from '../icon'; import type { PopoverProps } from '../popover'; import { Popover } from '../popover'; import classes from './redesign.module.scss'; export const menuItemClass = classes.menuItem; export type DropdownProps = Merge< { as?: As; children: React.ReactNode; className?: string; elevation?: 1 | 2; maxWidth?: number | string; style?: React.CSSProperties; }, React.ComponentProps >; export const DropdownPopover = ({ isOpen, onClose, reference, popoverElement, container, placement, offset = 4, flip, strategy, matchReferenceWidth, closeOnClickOutside, children, ...props }: DropdownProps & Omit) => { const popoverProps = { isOpen, onClose, reference, popoverElement, container, placement, offset, flip, strategy, matchReferenceWidth, closeOnClickOutside, }; return ( {({ props: popoverChildProps }) => ( {children} )} ); }; export const Dropdown = ({ as: asComp, children, className, elevation = 1, maxWidth, style, ...props }: DropdownProps) => { const Component = asComp ?? 'div'; return ( {children} ); }; type DropdownItemProps = Merge< { as?: As; children?: React.ReactNode; className?: string; active?: boolean }, React.ComponentPropsWithoutRef >; export const DropdownItem = ({ active, as: AsComp, children, className, ...props }: DropdownItemProps) => { const Component = AsComp ?? 'div'; return ( {children} ); }; export const DropdownItemButton: React.FC< { icon?: IconProp } & React.ComponentProps<'button'> > = ({ icon, children, className, ...props }) => { return ( {icon && } {children} ); };