diff --git a/src/components/ui/Dropdown/Dropdown.tsx b/src/components/ui/Dropdown/Dropdown.tsx index c272135..d0b75e1 100644 --- a/src/components/ui/Dropdown/Dropdown.tsx +++ b/src/components/ui/Dropdown/Dropdown.tsx @@ -14,6 +14,7 @@ export const Dropdown: React.FC = memo( trigger = ["click"], placement, maxHeight, + onOpenChange, }: DropdownProps) => { const [internalOpen, setInternalOpen] = useState(false); const [emptyMenu, setEmptyMenu] = useState(false); @@ -44,6 +45,7 @@ export const Dropdown: React.FC = memo( trigger={trigger} placement={placement} onOpenChange={(open) => { + onOpenChange?.(open); setInternalOpen(open); }} open={internalOpen} diff --git a/src/components/ui/Dropdown/Dropdown.types.ts b/src/components/ui/Dropdown/Dropdown.types.ts index bb4cdd6..04a00d5 100644 --- a/src/components/ui/Dropdown/Dropdown.types.ts +++ b/src/components/ui/Dropdown/Dropdown.types.ts @@ -24,6 +24,7 @@ export type DropdownProps = BaseDropdownProps & { disabled?: boolean; children?: ReactNode; placement?: Placement; + onOpenChange?: (open: boolean) => void; }; export type DropdownButtonProps = Omit & { diff --git a/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.tsx b/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.tsx index 264bfdd..1e200cc 100644 --- a/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.tsx +++ b/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.tsx @@ -5,6 +5,7 @@ import { Many2OneSuffixProps } from "./Many2OneSuffix.types"; export const Many2OneSuffix = ({ onRetrieveData, onItemClick, + onOpenChange, }: Many2OneSuffixProps) => { return ( diff --git a/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.types.tsx b/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.types.tsx index 1ec34b8..a08f712 100644 --- a/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.types.tsx +++ b/src/components/widgets/Many2One/Many2OneSuffix/Many2OneSuffix.types.tsx @@ -3,4 +3,5 @@ import { DropdownMenuGroup, DropdownMenuItem } from "@/components/ui"; export type Many2OneSuffixProps = { onRetrieveData: () => Promise; onItemClick?: (item: DropdownMenuItem) => void; + onOpenChange?: (open: boolean) => void; };