/** @license MIT | @cube-dev/ui-kit v0.0.0-canary-b04eed0 | Cube Dev Team */
import { useState } from "react";
import { useFocus, useFocusVisible } from "react-aria";

//#region src/utils/react/interactions.ts
function useFocus$1({ isDisabled }, onlyVisible = false) {
	let [isFocused, setIsFocused] = useState(false);
	if (isDisabled && isFocused) setIsFocused(false);
	let { isFocusVisible } = useFocusVisible({});
	let { focusProps } = useFocus({
		isDisabled,
		onFocusChange: setIsFocused
	});
	return {
		focusProps,
		isFocused: isFocused && (onlyVisible ? isFocusVisible : true)
	};
}

//#endregion
export { useFocus$1 as useFocus };
//# sourceMappingURL=interactions.js.map