<script setup lang="ts">
import type { SplitterGroupEmits, SplitterGroupProps } from 'reka-ui';
import type { HTMLAttributes } from 'vue';
import { reactiveOmit } from '@vueuse/core';
import { SplitterGroup, useForwardExpose, useForwardPropsEmits } from 'reka-ui';
import { cn } from '@/lib/utils';

const props = defineProps<
  SplitterGroupProps & { class?: HTMLAttributes['class'] }
>();
const emits = defineEmits<SplitterGroupEmits>();

const delegatedProps = reactiveOmit(props, 'class');

const forwarded = useForwardPropsEmits(delegatedProps, emits);
const { forwardRef } = useForwardExpose();
</script>

<template>
  <SplitterGroup
    :ref="forwardRef"
    v-slot="slotProps"
    data-slot="resizable-panel-group"
    v-bind="forwarded"
    :class="
      cn('flex h-full w-full data-[orientation=vertical]:flex-col', props.class)
    "
  >
    <slot v-bind="slotProps" />
  </SplitterGroup>
</template>
