import { ActionIcon, type ActionIconProps, Tooltip } from '@mantine/core'; import { type HTMLPropsRef, type MRT_DensityState, type MRT_RowData, type MRT_TableInstance, } from '../../types'; interface Props extends ActionIconProps, HTMLPropsRef { table: MRT_TableInstance; } type TogglableDensityState = Exclude; const next: Record = { md: 'xs', xl: 'md', xs: 'xl', }; export const MRT_ToggleDensePaddingButton = ({ table: { getState, options: { icons: { IconBaselineDensityLarge, IconBaselineDensityMedium, IconBaselineDensitySmall, }, localization: { toggleDensity }, }, setDensity, }, title, ...rest }: Props) => { 'use no memo'; const { density } = getState(); return ( setDensity((current) => next[current as TogglableDensityState]) } size="lg" variant="subtle" {...rest} > {density === 'xs' ? ( ) : density === 'md' ? ( ) : ( )} ); };