{"version":3,"file":"MenuItemIndicator.cjs","sources":["../../src/Menu/MenuItemIndicator.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { createContext } from '@/shared'\nimport type { CheckedState } from './utils'\n\ninterface MenuItemIndicatorContext {\n  modelValue: Ref<CheckedState>\n}\n\nexport interface MenuItemIndicatorProps extends PrimitiveProps {\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with Vue animation libraries.\n   */\n  forceMount?: boolean\n}\n\nexport const [injectMenuItemIndicatorContext, provideMenuItemIndicatorContext]\n  = createContext<MenuItemIndicatorContext>(\n    ['MenuCheckboxItem', 'MenuRadioItem'],\n    'MenuItemIndicatorContext',\n  )\n</script>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport { getCheckedState, isIndeterminate } from './utils'\nimport { Primitive } from '@/Primitive'\nimport { Presence } from '@/Presence'\n\nwithDefaults(defineProps<MenuItemIndicatorProps>(), {\n  as: 'span',\n})\n\nconst indicatorContext = injectMenuItemIndicatorContext({\n  modelValue: ref(false),\n})\n</script>\n\n<template>\n  <Presence\n    :present=\"\n      forceMount\n        || isIndeterminate(indicatorContext.modelValue.value)\n        || indicatorContext.modelValue.value === true\n    \"\n  >\n    <Primitive\n      :as=\"as\"\n      :as-child=\"asChild\"\n      :data-state=\"getCheckedState(indicatorContext.modelValue.value)\"\n    >\n      <slot />\n    </Primitive>\n  </Presence>\n</template>\n"],"names":["createContext","ref"],"mappings":";;;;;;;;AAkBa,MAAA,CAAC,8BAAgC,EAAA,+BAA+B,CACzE,GAAAA,kCAAA;AAAA,EACA,CAAC,oBAAoB,eAAe,CAAA;AAAA,EACpC;AACF;;;;;;;;;AAaF,IAAA,MAAM,mBAAmB,8BAA+B,CAAA;AAAA,MACtD,UAAA,EAAYC,QAAI,KAAK;AAAA,KACtB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;"}