@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
33 lines (30 loc) • 1.07 kB
JavaScript
import { defineComponent, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useFieldContext } from './use-field-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "field-select",
props: {
modelValue: {},
asChild: { type: Boolean }
},
emits: ["update:modelValue"],
setup(__props, { emit: __emit }) {
const field = useFieldContext();
const emit = __emit;
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).select, mergeProps(unref(field).getSelectProps(), {
value: _ctx.modelValue,
onChange: _cache[0] || (_cache[0] = (event) => emit("update:modelValue", event.target.value)),
"as-child": _ctx.asChild
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["value", "as-child"]);
};
}
});
export { _sfc_main as default };