import {ActionIcon, Tooltip} from '@mantine/core'; import {type MRT_TableInstance} from '../types'; import {Icon} from "@iconify/react"; interface Props = {}> { table: MRT_TableInstance; } export const MRT_ExpandAllButton = = {}>({table,}: Props) => { const { getIsAllRowsExpanded, getIsSomeRowsExpanded, getCanSomeRowsExpand, getState, options: { localization, mantineExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table; const {density, isLoading} = getState(); const actionIconProps = mantineExpandAllButtonProps instanceof Function ? mantineExpandAllButtonProps({table}) : mantineExpandAllButtonProps; const isAllRowsExpanded = getIsAllRowsExpanded(); return ( toggleAllRowsExpanded(!isAllRowsExpanded)} {...actionIconProps} sx={(theme) => ({ marginLeft: density === 'xl' ? '-6px' : density === 'md' ? '0' : '6px', 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 ?? ( )} ); };