<script setup>
import { reactiveOmit } from "@vueuse/core";
import { ToggleGroupItem, useForwardProps } from "reka-ui";
import { computed, inject } from "vue";
import { cn } from "../../../utils/cn";
import { toggleVariants } from "../toggle";
import { toggleGroupContextKey } from ".";
defineOptions({ name: "UiToggleGroupItem" });
const props = defineProps({
  value: { type: null, required: true },
  disabled: { type: Boolean, required: false },
  asChild: { type: Boolean, required: false },
  as: { type: null, required: false },
  class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
  variant: { type: null, required: false },
  size: { type: null, required: false }
});
const ctx = inject(toggleGroupContextKey, { variant: "default", size: "default" });
const variant = computed(() => props.variant ?? ctx.variant ?? "default");
const size = computed(() => props.size ?? ctx.size ?? "default");
const delegatedProps = reactiveOmit(props, "class", "size", "variant");
const forwarded = useForwardProps(delegatedProps);
</script>

<template>
  <ToggleGroupItem
    data-slot="toggle-group-item"
    v-bind="forwarded"
    :class="cn(toggleVariants({ variant, size }), props.class)"
  >
    <slot />
  </ToggleGroupItem>
</template>
