reka-ui
Version:
Vue port for Radix UI Primitives.
42 lines (38 loc) • 1.26 kB
JavaScript
;
const vue = require('vue');
const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
const Primitive_Primitive = require('../Primitive/Primitive.cjs');
const Combobox_ComboboxRoot = require('./ComboboxRoot.cjs');
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "ComboboxCancel",
props: {
asChild: { type: Boolean },
as: { default: "button" }
},
setup(__props) {
const props = __props;
shared_useForwardExpose.useForwardExpose();
const rootContext = Combobox_ComboboxRoot.injectComboboxRootContext();
function handleClick() {
if (rootContext.inputElement.value) {
rootContext.inputElement.value.value = "";
rootContext.inputElement.value.focus();
}
}
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.mergeProps({
type: _ctx.as === "button" ? "button" : void 0
}, props, {
tabindex: "-1",
onClick: handleClick
}), {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["type"]);
};
}
});
exports._sfc_main = _sfc_main;
//# sourceMappingURL=ComboboxCancel.cjs.map