UNPKG

@ark-ui/vue

Version:

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

28 lines (25 loc) 1.03 kB
import { defineComponent, createBlock, renderSlot, unref, openBlock, mergeProps, withCtx, createTextVNode } 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-required-indicator", props: { asChild: { type: Boolean } }, setup(__props) { const field = useFieldContext(); useForwardExpose(); return (_ctx, _cache) => { return unref(field).required ? (openBlock(), createBlock(unref(ark).span, mergeProps({ key: 0 }, unref(field).getRequiredIndicatorProps(), { "as-child": _ctx.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default", {}, () => [ _cache[0] || (_cache[0] = createTextVNode("*", -1)) ]) ]), _: 3 }, 16, ["as-child"])) : renderSlot(_ctx.$slots, "fallback", { key: 1 }); }; } }); export { _sfc_main as default };