reka-ui
Version:
Vue port for Radix UI Primitives.
1 lines • 1.35 kB
Source Map (JSON)
{"version":3,"file":"ComboboxCancel.cjs","sources":["../../src/Combobox/ComboboxCancel.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface ComboboxCancelProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxCancelProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst rootContext = injectComboboxRootContext()\n\nfunction handleClick() {\n if (rootContext.inputElement.value) {\n rootContext.inputElement.value.value = ''\n rootContext.inputElement.value.focus()\n }\n}\n</script>\n\n<template>\n <Primitive\n :type=\"as === 'button' ? 'button' : undefined\"\n v-bind=\"props\"\n tabindex=\"-1\"\n @click=\"handleClick\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":["useForwardExpose","injectComboboxRootContext"],"mappings":";;;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAiBA,wCAAA,EAAA;AACjB,IAAA,MAAM,cAAcC,+CAA0B,EAAA;AAE9C,IAAA,SAAS,WAAc,GAAA;AACrB,MAAI,IAAA,WAAA,CAAY,aAAa,KAAO,EAAA;AAClC,QAAY,WAAA,CAAA,YAAA,CAAa,MAAM,KAAQ,GAAA,EAAA;AACvC,QAAY,WAAA,CAAA,YAAA,CAAa,MAAM,KAAM,EAAA;AAAA;AACvC;;;;;;;;;;;;;;;;;;;"}