import { autoUpdate, useFloating } from '@floating-ui/react-dom';
import { getPlacement } from '../_utils/placement';
export function useOverlay(_ref) {
  var placement = _ref.placement,
    middleware = _ref.middleware;
  var _useFloating = useFloating({
      strategy: 'fixed',
      whileElementsMounted: autoUpdate,
      placement: getPlacement(placement),
      middleware: middleware
    }),
    isPositioned = _useFloating.isPositioned,
    middlewareData = _useFloating.middlewareData,
    currentPlacement = _useFloating.placement,
    _useFloating$refs = _useFloating.refs,
    referenceRef = _useFloating$refs.setReference,
    overlayRef = _useFloating$refs.setFloating,
    x = _useFloating.x,
    y = _useFloating.y,
    strategy = _useFloating.strategy;
  return {
    isPositioned: isPositioned,
    overlayStyle: {
      left: "".concat(x, "px"),
      top: "".concat(y, "px"),
      position: strategy,
      width: 'max-content'
    },
    overlayRef: overlayRef,
    referenceRef: referenceRef,
    middlewareData: middlewareData,
    placement: currentPlacement
  };
}
//# sourceMappingURL=useOverlay.js.map