import {type MouseEvent} from 'react'; import {ActionIcon, Tooltip} from '@mantine/core'; import {type MRT_Row, type MRT_TableInstance} from '../types'; import {Icon} from "@iconify/react"; interface Props = {}> { row: MRT_Row; table: MRT_TableInstance; } export const MRT_ExpandButton = = {}>({row, table,}: Props) => { const { options: { localization, mantineExpandButtonProps, renderDetailPanel, }, } = table; const actionIconProps = mantineExpandButtonProps instanceof Function ? mantineExpandButtonProps({table, row}) : mantineExpandButtonProps; const canExpand = row.getCanExpand(); const isExpanded = row.getIsExpanded(); const handleToggleExpand = (event: MouseEvent) => { event.stopPropagation(); row.toggleExpanded(); actionIconProps?.onClick?.(event); }; return ( ({ opacity: 0.8, '&:disabled': { backgroundColor: 'transparent', border: 'none', }, '&:hover': { opacity: 1, }, ...(actionIconProps?.sx instanceof Function ? actionIconProps.sx(theme) : (actionIconProps?.sx as any)), })} title={undefined} > {actionIconProps?.children ?? ( )} ); };