import { FocusScope } from '@react-aria/focus';
import { useRef, useEffect } from 'react';
import { jsx } from 'react/jsx-runtime';

const FocusBoundary = ({
  children
}) => {
  const wrapperReference = useRef(null);
  useEffect(() => {
    wrapperReference.current?.focus({
      preventScroll: true
    });
  }, []);
  return /*#__PURE__*/jsx(FocusScope, {
    contain: true,
    restoreFocus: true,
    children: /*#__PURE__*/jsx("div", {
      ref: wrapperReference,
      tabIndex: -1,
      children: children
    })
  });
};

export { FocusBoundary as default };
//# sourceMappingURL=FocusBoundary.mjs.map
