import e from"../useEventListener/index.js";import{useRef as n,useCallback as o}from"react";function r(r){var c=r.ref,t=r.onFocusByKeyboard,u=r.onFocusByMouse,a=n(!1),f=o((function(){a.current=!0}),[a]),m=o((function(e){a.current?null==u||u(e):t&&t(e)}),[t,u]),s=o((function(){a.current=!1}),[a]);e({eventName:"mousedown",ref:c,callback:f}),e({eventName:"focus",ref:c,callback:m}),e({eventName:"mouseup",ref:c,callback:s})}export{r as useListenFocusTriggers};
