<script setup lang="ts">
import type { ToggleEmits, ToggleProps } from 'reka-ui';
import { Toggle, useForwardPropsEmits } from 'reka-ui';
import { cn } from '@/lib/utils';
import { type ToggleVariants, toggleVariants } from '.';

const props = withDefaults(
  defineProps<
    ToggleProps & {
      variant?: ToggleVariants['variant'];
      size?: ToggleVariants['size'];
    }
  >(),
  {
    variant: 'default',
    size: 'default',
    disabled: false,
  },
);

const emits = defineEmits<ToggleEmits>();

const forwarded = useForwardPropsEmits(props, emits);
</script>

<template>
  <Toggle
    data-slot="toggle"
    v-bind="forwarded"
    :class="
      cn(
        toggleVariants({ variant: props.variant, size: props.size }),
        $attrs.class ?? '',
      )
    "
  >
    <slot />
  </Toggle>
</template>
