@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
27 lines (24 loc) • 977 B
JavaScript
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 { useToggleContext } from './use-toggle-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "toggle-indicator",
props: {
asChild: { type: Boolean }
},
setup(__props) {
const toggle = useToggleContext();
const fallback = computed(() => !toggle.value.pressed);
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).span, mergeProps(unref(toggle).getIndicatorProps(), { "as-child": _ctx.asChild }), {
default: withCtx(() => [
!fallback.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : renderSlot(_ctx.$slots, "fallback", { key: 1 })
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };