@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
49 lines (46 loc) • 1.46 kB
JavaScript
import { defineComponent, mergeDefaults, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useCheckbox } from './use-checkbox.js';
import { CheckboxProvider } from './use-checkbox-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "checkbox-root",
props: /* @__PURE__ */ mergeDefaults({
checked: {},
defaultChecked: {},
disabled: { type: Boolean },
form: {},
id: {},
ids: {},
invalid: { type: Boolean },
name: {},
readOnly: { type: Boolean },
required: { type: Boolean },
value: {},
asChild: { type: Boolean }
}, {
checked: void 0,
defaultChecked: void 0,
disabled: void 0,
invalid: void 0,
readOnly: void 0,
required: void 0
}),
emits: ["checkedChange", "update:checked"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const checkbox = useCheckbox(props, emits);
CheckboxProvider(checkbox);
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).label, mergeProps(unref(checkbox).getRootProps(), { "as-child": __props.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };