@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
41 lines (38 loc) • 1.23 kB
JavaScript
import { defineComponent, mergeDefaults, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useTimer } from './use-timer.js';
import { TimerProvider } from './use-timer-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "timer-root",
props: /* @__PURE__ */ mergeDefaults({
autoStart: { type: Boolean },
countdown: { type: Boolean },
id: {},
ids: {},
interval: {},
startMs: {},
targetMs: {},
asChild: { type: Boolean }
}, {
autoStart: void 0,
countdown: void 0
}),
emits: ["complete", "tick"],
setup(__props, { emit: __emit }) {
const props = __props;
const emits = __emit;
const timer = useTimer(props, emits);
TimerProvider(timer);
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).div, mergeProps(unref(timer).getRootProps(), { "as-child": __props.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };