import { createVNode as _createVNode, isVNode as _isVNode } from "vue";
import "./styles/menu.css";
import { computed, ref } from "vue";
import { getUid, useRender } from "@veno-ui/utils";
import { genericComponent } from "../../utils";
import { useProxiedModel } from "../../composables/proxied-model";
import { makeTransitionProps } from "../../composables/transition";
import { Overlay } from "../overlay";
import { MenuTransition } from "../transition";
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
