UNPKG

@ark-ui/vue

Version:

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

42 lines (39 loc) 1.7 kB
import { defineComponent, createBlock, openBlock, unref, mergeProps, withCtx, createElementBlock, createCommentVNode, Fragment, renderList, toDisplayString } from 'vue'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; import { ark } from '../factory.js'; import { useFieldContext } from '../field/use-field-context.js'; import { useSelectContext } from './use-select-context.js'; const _hoisted_1 = { key: 0, value: "" }; const _hoisted_2 = ["value", "disabled"]; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "select-hidden-select", props: { asChild: { type: Boolean } }, setup(__props) { const select = useSelectContext(); const field = useFieldContext(); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).select, mergeProps({ "aria-describedby": unref(field)?.ariaDescribedby }, unref(select).getHiddenSelectProps()), { default: withCtx(() => [ unref(select).value.length === 0 ? (openBlock(), createElementBlock("option", _hoisted_1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(select).collection.items, (item) => { return openBlock(), createElementBlock("option", { key: item.value, value: unref(select).collection.getItemValue(item), disabled: unref(select).collection.getItemDisabled(item) }, toDisplayString(unref(select).collection.stringifyItem(item)) + " > ", 9, _hoisted_2); }), 128)) ]), _: 1 }, 16, ["aria-describedby"]); }; } }); export { _sfc_main as default };