import {ActionIcon, type ActionIconProps, Tooltip} from '@mantine/core'; import {type HTMLPropsRef, type MRT_TableInstance} from '../types'; interface Props = {}> extends ActionIconProps, HTMLPropsRef { table: MRT_TableInstance; } export const MRT_ToggleGlobalFilterButton = < TData extends Record = {}, >({table, ...rest }: Props) => { const { getState, options: { icons: {IconSearch, IconSearchOff}, localization, }, refs: {searchInputRef}, setShowGlobalFilter, } = table; const {globalFilter, showGlobalFilter} = getState(); const handleToggleSearch = () => { setShowGlobalFilter(!showGlobalFilter); setTimeout(() => searchInputRef.current?.focus(), 100); }; return ( {showGlobalFilter ? : } ); };