import { ActionIcon, type ActionIconProps, Tooltip } from '@mantine/core'; import { type HTMLPropsRef, type MRT_TableInstance } from '../types'; interface Props = {}> extends ActionIconProps, HTMLPropsRef { table: MRT_TableInstance; } const sizes = ['xs', 'md', 'xl'] as const; export const MRT_ToggleDensePaddingButton = < TData extends Record = {}, >({ table, ...rest }: Props) => { const { getState, options: { icons: { IconBaselineDensityLarge, IconBaselineDensityMedium, IconBaselineDensitySmall, }, localization, }, setDensity, } = table; const { density } = getState(); const handleToggleDensePadding = () => { setDensity(sizes[(sizes.indexOf(density) - 1) % sizes.length] ?? 'xl'); }; return ( {density === 'xs' ? ( ) : density === 'md' ? ( ) : ( )} ); };