import { ref, computed, createVNode, isVNode } from "vue";
import "./styles/menu.scss";
import { useProxiedModel } from "../../composables/proxied-model/index.mjs";
import { makeTransitionProps } from "../../composables/transition/index.mjs";
import { MenuTransition } from "../transition/menu-transition.mjs";
import { Overlay } from "../overlay/overlay.mjs";
import { genericComponent } from "../../utils/define-component.mjs";
import { getUid, useRender } from "../../utils/dist/index.mjs";
function _isSlot(s) {
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
}
const Menu = genericComponent()({
  name: "VeMenu",
  props: {
    modelValue: Boolean,
    id: String,
    ...makeTransitionProps({
      transition: {
        component: MenuTransition
      }
    })
  },
  emits: {
    "update:modelValue": (_modelValue) => true
  },
  setup(props, {
    slots
  }) {
    const isActive = useProxiedModel(props, "modelValue");
    const overlayRef = ref();
    const id = computed(() => props.id || `ve-menu-${getUid()}`);
    useRender(() => {
      return createVNode(Overlay, {
        "ref": overlayRef,
        "modelValue": isActive.value,
        "onUpdate:modelValue": ($event) => isActive.value = $event,
        "class": "ve-menu",
        "transition": props.transition,
        "absolute": true,
        "positionStrategy": "connected",
        "scrollStrategy": "reposition",
        "closeDelay": 100,
        "minWidth": 0,
        "offset": 4,
        "scrim": false,
        "activatorProps": {
          "aria-haspopup": "menu",
          "aria-expanded": String(isActive.value),
          "aria-owns": id.value
        }
      }, _isSlot(slots) ? slots : {
        default: () => [slots]
      });
    });
    return {
      overlayRef
    };
  }
});
export {
  Menu
};
//# sourceMappingURL=menu.mjs.map
