UNPKG

@ark-ui/vue

Version:

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

33 lines (30 loc) 1.16 kB
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { ark } from '../factory.js'; import { useSelectContext } from './use-select-context.js'; import { SelectItemProvider } from './use-select-item-context.js'; import { SelectItemPropsProvider } from './use-select-item-props-context.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "select-item", props: { item: {}, persistFocus: { type: Boolean }, asChild: { type: Boolean } }, setup(__props) { const props = __props; const select = useSelectContext(); SelectItemPropsProvider(props); SelectItemProvider(computed(() => select.value.getItemState(props))); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).div, mergeProps(unref(select).getItemProps(props), { "as-child": _ctx.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };