<script setup lang="ts">
import type { CalendarPrevProps } from "reka-ui";
import type { HTMLAttributes } from "vue";
import { reactiveOmit } from "@vueuse/core";
import { CalendarPrev, useForwardProps } from "reka-ui";
import { ChevronLeft } from "lucide-vue-next";
import { buttonVariants } from "@/components/ui/Button.vue";
import { cn } from "@/lib/utils";

interface Props extends CalendarPrevProps {
  class?: HTMLAttributes["class"];
}

const props = defineProps<Props>();
const delegatedProps = reactiveOmit(props, "class");
const forwarded = useForwardProps(delegatedProps);
</script>

<template>
  <CalendarPrev
    data-slot="calendar-prev-button"
    v-bind="forwarded"
    :class="
      cn(
        buttonVariants({ variant: 'outline' }),
        'size-7 bg-transparent p-0 opacity-50 hover:opacity-100',
        props.class,
      )
    "
  >
    <slot>
      <ChevronLeft class="size-4" />
    </slot>
  </CalendarPrev>
</template>
