<script setup lang="ts">
import { DropdownMenuSub as ShadcnDropdownMenuSub } from '@/components/core/dropdown-menu';
import type { UiDropdownMenuSubProps, UiDropdownMenuSubEmits } from './types';

defineOptions({
  name: 'UiDropdownMenuSub',
});

const props = withDefaults(defineProps<UiDropdownMenuSubProps>(), {
  open: undefined,
  defaultOpen: false,
});

const emit = defineEmits<UiDropdownMenuSubEmits>();
</script>

<template>
  <ShadcnDropdownMenuSub
    #default="slotProps"
    :open="props.open"
    :default-open="props.defaultOpen"
    @update:open="emit('update:open', $event)"
  >
    <slot v-bind="slotProps" />
  </ShadcnDropdownMenuSub>
</template>
