UNPKG

@ark-ui/vue

Version:

A collection of unstyled, accessible UI components for Vue, utilizing state machines for seamless interaction.

43 lines (40 loc) 1.56 kB
import { defineComponent, computed, createBlock, openBlock, unref, mergeProps, withCtx, renderSlot } from 'vue'; import { ark } from '../factory.js'; import { useDatePickerContext } from './use-date-picker-context.js'; import { DatePickerTableCellPropsProvider } from './use-date-picker-table-cell-props-context.js'; import { useDatePickerViewPropsContext } from './use-date-picker-view-props-context.js'; import { useForwardExpose } from '../../utils/use-forward-expose.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "date-picker-table-cell", props: { value: {}, disabled: { type: Boolean }, columns: {}, visibleRange: {}, asChild: { type: Boolean } }, setup(__props) { const props = __props; const datePicker = useDatePickerContext(); const viewProps = useDatePickerViewPropsContext(); DatePickerTableCellPropsProvider(props); const tableCellProps = computed(() => { return { day: datePicker.value.getDayTableCellProps, month: datePicker.value.getMonthTableCellProps, year: datePicker.value.getYearTableCellProps // @ts-expect-error use filter guard }[viewProps.view ?? "day"](props); }); useForwardExpose(); return (_ctx, _cache) => { return openBlock(), createBlock(unref(ark).td, mergeProps(tableCellProps.value, { "as-child": __props.asChild }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16, ["as-child"]); }; } }); export { _sfc_main as default };