UNPKG

@ark-ui/vue

Version:

A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.

60 lines (57 loc) 1.89 kB
import { defineComponent, mergeDefaults, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { ark } from '../factory.js'; import { useEditable } from './use-editable.js'; import { EditableProvider } from './use-editable-context.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "editable-root", props: /* @__PURE__ */ mergeDefaults({ activationMode: {}, autoResize: { type: Boolean }, defaultEdit: { type: Boolean }, defaultValue: {}, disabled: { type: Boolean }, edit: { type: Boolean }, finalFocusEl: { type: Function }, form: {}, id: {}, ids: {}, invalid: { type: Boolean }, maxLength: {}, modelValue: {}, name: {}, placeholder: {}, readOnly: { type: Boolean }, required: { type: Boolean }, selectOnFocus: { type: Boolean }, submitMode: {}, translations: {}, asChild: { type: Boolean } }, { autoResize: void 0, defaultEdit: void 0, disabled: void 0, edit: void 0, invalid: void 0, readOnly: void 0, required: void 0, selectOnFocus: void 0 }), emits: ["editChange", "focusOutside", "interactOutside", "pointerDownOutside", "valueChange", "valueCommit", "valueRevert", "update:modelValue", "update:edit"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const editable = useEditable(props, emits); EditableProvider(editable); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).div, mergeProps(unref(editable).getRootProps(), { "as-child": __props.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };