@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
48 lines (45 loc) • 1.56 kB
JavaScript
import { defineComponent, mergeDefaults, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useSegmentGroup } from './use-segment-group.js';
import { SegmentGroupProvider } 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-root",
props: /* @__PURE__ */ mergeDefaults({
defaultValue: {},
disabled: { type: Boolean },
form: {},
id: {},
ids: {},
modelValue: {},
name: {},
orientation: {},
readOnly: { type: Boolean },
asChild: { type: Boolean }
}, {
disabled: void 0,
readOnly: void 0
}),
emits: ["valueChange", "update:modelValue"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const segmentGroup = useSegmentGroup(props, emits);
SegmentGroupProvider(segmentGroup);
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).div, mergeProps(unref(segmentGroup).getRootProps(), {
"data-scope": unref(parts).root.attrs["data-scope"],
"data-part": unref(parts).root.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 };