@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
32 lines (29 loc) • 1.09 kB
JavaScript
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useCheckboxContext } from './use-checkbox-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "checkbox-indicator",
props: {
indeterminate: { type: Boolean },
asChild: { type: Boolean }
},
setup(__props) {
const props = __props;
const checkbox = useCheckboxContext();
const isHidden = computed(() => props.indeterminate ? checkbox.value.indeterminate : checkbox.value.checked);
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).div, mergeProps(unref(checkbox).getIndicatorProps(), {
hidden: !isHidden.value,
"as-child": __props.asChild
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["hidden", "as-child"]);
};
}
});
export { _sfc_main as default };