import clsx from 'clsx'; import classes from './MRT_ExpandAllButton.module.css'; import { ActionIcon, type ActionIconProps, Tooltip } from '@mantine/core'; import { type MRT_RowData, type MRT_TableInstance } from '../../types'; import { parseFromValuesOrFunc } from '../../utils/utils'; interface Props extends ActionIconProps { table: MRT_TableInstance; } export const MRT_ExpandAllButton = ({ table, ...rest }: Props) => { 'use no memo'; const { getCanSomeRowsExpand, getIsAllRowsExpanded, getIsSomeRowsExpanded, getState, options: { icons: { IconChevronsDown }, localization, mantineExpandAllButtonProps, renderDetailPanel, }, toggleAllRowsExpanded, } = table; const { density, isLoading } = getState(); const actionIconProps = { ...parseFromValuesOrFunc(mantineExpandAllButtonProps, { table, }), ...rest, }; const isAllRowsExpanded = getIsAllRowsExpanded(); return ( toggleAllRowsExpanded(!isAllRowsExpanded)} title={undefined} > {actionIconProps?.children ?? ( )} ); };