From 42943d86c5c72c290e63257dc320916112364f15 Mon Sep 17 00:00:00 2001 From: Kyle Tsang <6854874+kyletsang@users.noreply.github.com> Date: Wed, 8 May 2024 13:37:17 -0700 Subject: [PATCH] fix(DropdownMenu): remove defaultProps (#103) --- src/DropdownMenu.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/DropdownMenu.tsx b/src/DropdownMenu.tsx index daff275..598e95e 100644 --- a/src/DropdownMenu.tsx +++ b/src/DropdownMenu.tsx @@ -176,10 +176,6 @@ export function useDropdownMenu(options: UseDropdownMenuOptions = {}) { return [menuProps, metadata] as const; } -const defaultProps = { - usePopper: true, -}; - export interface DropdownMenuProps extends UseDropdownMenuOptions { /** * A render prop that returns a Menu element. The `props` @@ -214,15 +210,20 @@ export interface DropdownMenuProps extends UseDropdownMenuOptions { * @displayName DropdownMenu * @memberOf Dropdown */ -function DropdownMenu({ children, ...options }: DropdownMenuProps) { - const [props, meta] = useDropdownMenu(options); +function DropdownMenu({ + children, + usePopper: usePopperProp = true, + ...options +}: DropdownMenuProps) { + const [props, meta] = useDropdownMenu({ + ...options, + usePopper: usePopperProp, + }); return <>{children(props, meta)}; } DropdownMenu.displayName = 'DropdownMenu'; -DropdownMenu.defaultProps = defaultProps; - /** @component */ export default DropdownMenu;