UNPKG

@ark-ui/vue

Version:

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

29 lines (26 loc) 1.17 kB
import { defineComponent, createBlock, createCommentVNode, unref, openBlock, mergeProps, withCtx, renderSlot } from 'vue'; import { ark } from '../factory.js'; import { useFileUploadContext } from './use-file-upload-context.js'; import { useFileUploadItemPropsContext } from './use-file-upload-item-props-context.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "file-upload-item-preview", props: { type: { default: ".*" }, asChild: { type: Boolean } }, setup(__props) { const fileUpload = useFileUploadContext(); const itemProps = useFileUploadItemPropsContext(); useForwardExpose(); return (_ctx, _cache) => { return unref(itemProps).file.type.match(__props.type ?? ".*") ? (openBlock(), createBlock(unref(ark).div, mergeProps({ key: 0 }, unref(fileUpload).getItemPreviewProps(unref(itemProps)), { "as-child": __props.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"])) : createCommentVNode("", true); }; } }); export { _sfc_main as default };