import { useCallback } from "react";
import { jsx } from "react/jsx-runtime";
import ReactFocusLock from "react-focus-lock";

//#region src/focusLock/focusLock.tsx
/**
* Traps the focus within the provided content.
*
* Tabbing using the keyboard will only cycle through the children and won't leave the boundary of the FocusLock wrapper.
*/
const FocusLock = (props) => {
	const { autoFocus, children, crossFrame, finalFocusRef, initialFocusRef, isDisabled, persistentFocus, returnFocus: returnFocusProp } = props;
	return /* @__PURE__ */ jsx(ReactFocusLock, {
		autoFocus,
		crossFrame,
		disabled: isDisabled,
		onActivation: useCallback(() => {
			initialFocusRef?.current?.focus();
		}, [initialFocusRef]),
		onDeactivation: useCallback(() => {
			finalFocusRef?.current?.focus();
		}, [finalFocusRef]),
		persistentFocus,
		returnFocus: returnFocusProp && !finalFocusRef,
		children
	});
};
FocusLock.displayName = "FocusLock";
var focusLock_default = FocusLock;

//#endregion
export { FocusLock, focusLock_default as default };
globalThis.__vuiVersion__ = "4.0.0-beta.1"
//# sourceMappingURL=focusLock.js.map