{"version":3,"file":"ToggleGroupItem.cjs","sources":["../../src/ToggleGroup/ToggleGroupItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleProps } from '@/Toggle'\nimport { isValueEqualOrExist, useForwardExpose } from '@/shared'\nimport type { AcceptableValue } from '@/shared/types'\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required' | 'modelValue' | 'defaultValue'> {\n  /**\n   * A string value for the toggle group item. All items within a toggle group should use a unique value.\n   */\n  value: AcceptableValue\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { injectToggleGroupRootContext } from './ToggleGroupRoot.vue'\nimport { Toggle } from '@/Toggle'\nimport { RovingFocusItem } from '@/RovingFocus'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleGroupItemProps>(), {\n  as: 'button',\n})\n\nconst rootContext = injectToggleGroupRootContext()\nconst disabled = computed(() => rootContext.disabled?.value || props.disabled)\nconst pressed = computed(() => isValueEqualOrExist(rootContext.modelValue.value, props.value))\n\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n  <component\n    :is=\"rootContext.rovingFocus.value ? RovingFocusItem : Primitive\"\n    as-child\n    :focusable=\"!disabled\"\n    :active=\"pressed\"\n  >\n    <Toggle\n      v-bind=\"props\"\n      :ref=\"forwardRef\"\n      v-slot=\"slotProps\"\n      :disabled=\"disabled\"\n      :model-value=\"pressed\"\n      @update:model-value=\"rootContext.changeModelValue(value)\"\n    >\n      <slot v-bind=\"slotProps\" />\n    </Toggle>\n  </component>\n</template>\n"],"names":["injectToggleGroupRootContext","computed","isValueEqualOrExist","useForwardExpose"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAcA,wDAA6B,EAAA;AACjD,IAAA,MAAM,WAAWC,YAAS,CAAA,MAAM,YAAY,QAAU,EAAA,KAAA,IAAS,MAAM,QAAQ,CAAA;AAC7E,IAAM,MAAA,OAAA,GAAUA,aAAS,MAAMC,8CAAA,CAAoB,YAAY,UAAW,CAAA,KAAA,EAAO,KAAM,CAAA,KAAK,CAAC,CAAA;AAE7F,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIC,wCAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}