Add hover change event to HierarchicalMenu items
This commit is contained in:
@@ -12,6 +12,7 @@ export type HierarchicalMenuItem =
|
|||||||
onSelect: () => void;
|
onSelect: () => void;
|
||||||
testId?: string;
|
testId?: string;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
onHoverChange?: (hovered: boolean) => void;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
kind: "group";
|
kind: "group";
|
||||||
@@ -76,6 +77,10 @@ function renderHierarchicalMenuItems(items: HierarchicalMenuItem[], onClose: ()
|
|||||||
item.onSelect();
|
item.onSelect();
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
|
onPointerEnter={() => item.onHoverChange?.(true)}
|
||||||
|
onPointerLeave={() => item.onHoverChange?.(false)}
|
||||||
|
onFocus={() => item.onHoverChange?.(true)}
|
||||||
|
onBlur={() => item.onHoverChange?.(false)}
|
||||||
>
|
>
|
||||||
<span className="hierarchical-menu__action-label">{item.label}</span>
|
<span className="hierarchical-menu__action-label">{item.label}</span>
|
||||||
<span className="hierarchical-menu__action-plus" aria-hidden="true">
|
<span className="hierarchical-menu__action-plus" aria-hidden="true">
|
||||||
|
|||||||
Reference in New Issue
Block a user