Remove openOnHotKeyAction in favor of putting hotkey on the trigger button=

This commit is contained in:
Gregory Schier
2024-03-20 15:56:39 -07:00
parent e2220f771d
commit d2d5f2b957
4 changed files with 11 additions and 20 deletions

View File

@@ -55,7 +55,6 @@ export type DropdownItem = DropdownItemDefault | DropdownItemSeparator;
export interface DropdownProps {
children: ReactElement<HTMLAttributes<HTMLButtonElement>>;
items: DropdownItem[];
openOnHotKeyAction?: HotkeyAction;
onOpen?: () => void;
onClose?: () => void;
}
@@ -71,7 +70,7 @@ export interface DropdownRef {
}
export const Dropdown = forwardRef<DropdownRef, DropdownProps>(function Dropdown(
{ children, items, openOnHotKeyAction, onOpen, onClose }: DropdownProps,
{ children, items, onOpen, onClose }: DropdownProps,
ref,
) {
const [isOpen, _setIsOpen] = useState<boolean>(false);
@@ -88,11 +87,6 @@ export const Dropdown = forwardRef<DropdownRef, DropdownProps>(function Dropdown
[onClose, onOpen],
);
useHotKey(openOnHotKeyAction ?? null, () => {
setIsOpen(true);
menuRef.current?.next?.();
});
useImperativeHandle(ref, () => ({
...menuRef.current,
isOpen: isOpen,