@ark-ui/vue
Version:
A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.
37 lines (34 loc) • 1.37 kB
JavaScript
import { defineComponent, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue';
import { ark } from '../factory.js';
import { useTimePickerContext } from './use-time-picker-context.js';
import { useForwardExpose } from '../../utils/use-forward-expose.js';
import { useTimePickerColumnPropsContext } from './use-time-picker-column-props-context.js';
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "time-picker-cell",
props: {
value: {},
asChild: { type: Boolean }
},
setup(__props) {
const props = __props;
const timePicker = useTimePickerContext();
const columnProps = useTimePickerColumnPropsContext();
const unitToPropsMap = {
hour: () => timePicker.value.getHourCellProps(props),
minute: () => timePicker.value.getMinuteCellProps(props),
second: () => timePicker.value.getSecondCellProps(props),
period: () => timePicker.value.getPeriodCellProps(props)
};
const cellProps = unitToPropsMap[columnProps.unit]();
useForwardExpose();
return (_ctx, _cache) => {
return openBlock(), createBlock(unref(ark).button, mergeProps(unref(cellProps), { "as-child": _ctx.asChild }), {
default: withCtx(() => [
renderSlot(_ctx.$slots, "default")
]),
_: 3
}, 16, ["as-child"]);
};
}
});
export { _sfc_main as default };