UNPKG

@ark-ui/vue

Version:

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

34 lines (31 loc) 1.25 kB
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { ark } from '../factory.js'; import { useRadioGroupContext } from './use-radio-group-context.js'; import { RadioGroupItemProvider } from './use-radio-group-item-context.js'; import { RadioGroupItemPropsProvider } from './use-radio-group-item-props-context.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "radio-group-item", props: { value: {}, disabled: { type: Boolean }, invalid: { type: Boolean }, asChild: { type: Boolean } }, setup(__props) { const props = __props; const radioGroup = useRadioGroupContext(); RadioGroupItemPropsProvider(props); RadioGroupItemProvider(computed(() => radioGroup.value.getItemState(props))); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).label, mergeProps(unref(radioGroup).getItemProps(props), { "as-child": _ctx.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };