import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import{useEffect}from"react";import{useFlag}from"../../hooks/useFlag";import{useKeysRef}from"../../hooks/useKeysRef";export var useCalendarVisible=function(a){var b=a.onDropdownOpen,c=a.dropdownOpen,d=a.disabled,e=a.startRef,f=a.endRef,g=useFlag(!1),h=_slicedToArray(g,2),i=h[0],j=h[1],k=function(a){a.preventDefault(),j.on()},l={ArrowUp:k,ArrowDown:k,PageUp:k,PageDown:k,Home:k,End:k,Enter:function Enter(){d||j.on()},Escape:function Escape(){j.off()},Tab:function Tab(a){i&&(a.preventDefault(),j.off())}},m=function(a){var b=a.key;"Tab"!==b&&"Escape"!==b&&j.on()};return useKeysRef({ref:e,keys:l,eventHandler:m,isActive:!d}),useKeysRef({ref:f,keys:l,eventHandler:m,isActive:!d}),useEffect(function(){d||(null===b||void 0===b?void 0:b(i))},[i]),useEffect(function(){d||j.set(null!==c&&void 0!==c&&c)},[c]),useEffect(function(){d&&j.off()},[d]),[i,j]};
//# sourceMappingURL=useCalendarVisible.js.map