import { createVNode as _createVNode } from "vue";
import "./styles/dialog.css";
import { computed } from "vue";
import { getUid } from "@veno-ui/utils";
import { genericComponent } from "../../utils";
import { useProxiedModel } from "../../composables/proxied-model";
import { makeTransitionProps } from "../../composables/transition";
import { DialogTransition } from "../transition";
import { Overlay } from "../overlay";
const Dialog = genericComponent()({
  name: "VeDialog",
  props: {
    /**
     * @zh 全屏
     */
    fullscreen: Boolean,
    /**
     * @zh ID
     */
    id: String,
    /**
     * @zh 是否显示
     */
    modelValue: Boolean,
    /**
     * @zh 是否可以滚动
     */
    scrollable: Boolean,
    /**
     * @zh 可以拖拽的
     */
    draggable: Boolean,
    ...makeTransitionProps({
      transition: {
        component: DialogTransition
      }
    })
  },
  emits: {
    "update:modelValue": (_) => true
  },
  setup(props, {
    slots
  }) {
    const isActive = useProxiedModel(props, "modelValue");
    const id = computed(() => props.id || `ve-dialog-${getUid()}`);
    return () => _createVNode(Overlay, {
      "aria-role": "dialog",
      "aria-modal": "true",
      "activator-props": {
        "aria-haspopup": "dialog",
        "aria-expanded": String(isActive.value),
        "aria-describedby": id.value
      },
      "class": ["ve-dialog", {
        "ve-dialog--fullscreen": props.fullscreen,
        "ve-dialog--scrollable": props.scrollable
      }],
      "contentClass": "ve-dialog__wrapper",
      "id": id.value,
      "transition": props.transition,
      "modelValue": isActive.value,
      "onUpdate:modelValue": ($event) => isActive.value = $event
    }, {
      ...slots,
      default: slots.default
    });
  }
});
export {
  Dialog
};
//# sourceMappingURL=dialog.mjs.map
