@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
30 lines (27 loc) • 1.02 kB
JavaScript
import { defineComponent, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useEditableContext } from './use-editable-context.js';
import { useFieldContext } from '../field/use-field-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "editable-input",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const editable = useEditableContext();
const field = useFieldContext();
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).input, mergeProps({
"aria-describedby": unref(field)?.ariaDescribedby
}, unref(editable).getInputProps(), { "as-child": _ctx.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["aria-describedby", "as-child"]);
};
}
});
export { _sfc_main as default };