@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
54 lines (49 loc) • 1.62 kB
JavaScript
'use strict';
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
const vue = require('vue');
const factory = require('../factory.cjs');
const useSwitch = require('./use-switch.cjs');
const useSwitchContext = require('./use-switch-context.cjs');
const useForwardExpose = require('../../utils/use-forward-expose.cjs');
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
__name: "switch-root",
props: /* @__PURE__ */ vue.mergeDefaults({
checked: { type: Boolean },
defaultChecked: { type: Boolean },
disabled: { type: Boolean },
form: {},
id: {},
ids: {},
invalid: { type: Boolean },
label: {},
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 context = useSwitch.useSwitch(props, emits);
useSwitchContext.SwitchProvider(context);
useForwardExpose.useForwardExpose();
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(factory.ark).label, vue.mergeProps(vue.unref(context).getRootProps(), { "as-child": __props.asChild }), {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
exports.default = _sfc_main;