UNPKG

@ark-ui/vue

Version:

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

35 lines (32 loc) 1.23 kB
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; import { ark } from '../factory.js'; import { useFloatingPanelContext } from './use-floating-panel-context.js'; import { usePresenceContext } from '../presence/use-presence-context.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "floating-panel-trigger", props: { asChild: { type: Boolean } }, setup(__props) { const floatingPanel = useFloatingPanelContext(); const presence = usePresenceContext(); const triggerProps = computed(() => { const localProps = floatingPanel.value.getTriggerProps(); return { ...localProps, "aria-controls": presence.value.unmounted ? void 0 : localProps["aria-controls"] }; }); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).button, mergeProps(triggerProps.value, { "as-child": _ctx.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };