@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
39 lines (36 loc) • 1.49 kB
JavaScript
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { SegmentGroupItemPropsProvider } from './use-segment-group-item-props-context.js';
import { SegmentGroupItemProvider } from './use-segment-group-item-context.js';
import { ark } from '../factory.js';
import { useSegmentGroupContext } from './use-segment-group-context.js';
import { parts } from './segment-group.anatomy.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "segment-group-item",
props: {
value: {},
disabled: { type: Boolean },
invalid: { type: Boolean },
asChild: { type: Boolean }
},
setup(__props) {
const props = __props;
const segmentGroup = useSegmentGroupContext();
SegmentGroupItemPropsProvider(props);
SegmentGroupItemProvider(computed(() => segmentGroup.value.getItemState(props)));
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).label, mergeProps(unref(segmentGroup).getItemProps(props), {
"data-scope": unref(parts).item.attrs["data-scope"],
"data-part": unref(parts).item.attrs["data-part"],
"as-child": _ctx.asChild
}), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["data-scope", "data-part", "as-child"]);
};
}
});
export { _sfc_main as default };