import React, { useRef, useState } from 'react'; import { MoreHorizontal } from 'lucide-react'; import { FloatingPopover } from './FloatingPopover'; export interface RowOverflowAction { id?: string; label: string; icon: React.ReactNode; onClick: () => void; danger?: boolean; disabled?: boolean; title?: string; } interface RowOverflowMenuProps { id?: string; actions: RowOverflowAction[]; triggerTitle?: string; buttonClassName?: string; iconClassName?: string; zIndexClass?: string; } export const RowOverflowMenu: React.FC = ({ id, actions, triggerTitle = 'Ещё действия', buttonClassName = 'p-1 rounded-md text-stone-500 dark:text-stone-400 hover:text-stone-900 dark:hover:text-stone-100 hover:bg-stone-100 dark:hover:bg-stone-800 transition-colors', iconClassName = 'w-3.5 h-3.5', zIndexClass = 'z-[100]', }) => { const [isOpen, setIsOpen] = useState(false); const triggerRef = useRef(null); if (actions.length === 0) return null; return ( <> setIsOpen(false)} triggerRef={triggerRef} align="right" direction="down" minWidth={195} maxWidth={260} zIndexClass={zIndexClass} className="text-xs" >
e.stopPropagation()} > {actions.map((action, idx) => ( ))}
); };