Skip to content

Commit

Permalink
Fix #659
Browse files Browse the repository at this point in the history
  • Loading branch information
icflorescu committed Nov 26, 2024
1 parent f5dba68 commit 0d0bd0a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package/DataTableHeaderCellFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ActionIcon, Popover, PopoverDropdown, PopoverTarget } from '@mantine/core';
import { useDisclosure } from '@mantine/hooks';
import { useClickOutside, useDisclosure } from '@mantine/hooks';
import { IconFilter } from './icons/IconFilter';
import { IconFilterFilled } from './icons/IconFilterFilled';
import type { DataTableColumn } from './types';
Expand All @@ -12,6 +12,7 @@ type DataTableHeaderCellFilterProps<T> = {
export function DataTableHeaderCellFilter<T>({ children, isActive }: DataTableHeaderCellFilterProps<T>) {
const [isOpen, { close, toggle }] = useDisclosure(false);
const Icon = isActive ? IconFilterFilled : IconFilter;
const ref = useClickOutside(close);

return (
<Popover withArrow withinPortal shadow="md" opened={isOpen} onClose={close} trapFocus>
Expand All @@ -33,6 +34,7 @@ export function DataTableHeaderCellFilter<T>({ children, isActive }: DataTableHe
</ActionIcon>
</PopoverTarget>
<PopoverDropdown
ref={ref}
onClick={(e) => e.stopPropagation()}
onKeyDown={(e) => {
e.stopPropagation();
Expand Down

0 comments on commit 0d0bd0a

Please sign in to comment.