UNPKG

@ark-ui/vue

Version:

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

40 lines (37 loc) 1.33 kB
import { defineComponent, useId, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { ark } from '../factory.js'; import { useMenuContext } from './use-menu-context.js'; import { MenuItemGroupProvider } from './use-menu-item-group-context.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "menu-radio-item-group", props: { id: {}, modelValue: {}, asChild: { type: Boolean } }, emits: ["update:modelValue"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const menu = useMenuContext(); const uid = useId(); const id = props.id ?? uid; const itemGroupProps = computed(() => ({ id, value: props.modelValue, onValueChange: (e) => emits("update:modelValue", e.value) })); MenuItemGroupProvider(itemGroupProps); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).div, mergeProps(unref(menu).getItemGroupProps(itemGroupProps.value), { "as-child": _ctx.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };