UNPKG

vuetify

Version:

Vue Material Component Framework

79 lines (77 loc) 2.64 kB
import { resolveDirective as _resolveDirective, createVNode as _createVNode } from "vue"; // Components import { VTimelineDivider } from "./VTimelineDivider.mjs"; // Composables import { IconValue } from "../../composables/icons.mjs"; import { makeElevationProps } from "../../composables/elevation.mjs"; import { makeRoundedProps } from "../../composables/rounded.mjs"; import { makeSizeProps } from "../../composables/size.mjs"; import { makeTagProps } from "../../composables/tag.mjs"; // Utilities import { convertToUnit, genericComponent, useRender } from "../../util/index.mjs"; import { makeDimensionProps, useDimension } from "../../composables/dimensions.mjs"; import { ref, watch } from 'vue'; // Types export const VTimelineItem = genericComponent()({ name: 'VTimelineItem', props: { density: String, dotColor: String, fillDot: Boolean, hideDot: Boolean, hideOpposite: { type: Boolean, default: undefined }, icon: IconValue, iconColor: String, lineInset: [Number, String], ...makeRoundedProps(), ...makeElevationProps(), ...makeSizeProps(), ...makeTagProps(), ...makeDimensionProps() }, setup(props, _ref) { let { slots } = _ref; const { dimensionStyles } = useDimension(props); const dotSize = ref(0); const dotRef = ref(); watch(dotRef, newValue => { if (!newValue) return; dotSize.value = newValue.$el.querySelector('.v-timeline-divider__dot')?.getBoundingClientRect().width ?? 0; }, { flush: 'post' }); useRender(() => _createVNode("div", { "class": ['v-timeline-item', { 'v-timeline-item--fill-dot': props.fillDot }], "style": { '--v-timeline-dot-size': convertToUnit(dotSize.value), '--v-timeline-line-inset': props.lineInset ? `calc(var(--v-timeline-dot-size) / 2 + ${convertToUnit(props.lineInset)})` : convertToUnit(0) } }, [_createVNode("div", { "class": "v-timeline-item__body", "style": dimensionStyles.value }, [slots.default?.()]), _createVNode(VTimelineDivider, { "ref": dotRef, "hideDot": props.hideDot, "icon": props.icon, "iconColor": props.iconColor, "size": props.size, "elevation": props.elevation, "dotColor": props.dotColor, "fillDot": props.fillDot, "rounded": props.rounded }, { default: slots.icon }), props.density !== 'compact' && _createVNode("div", { "class": "v-timeline-item__opposite" }, [!props.hideOpposite && slots.opposite?.()])])); return {}; } }); //# sourceMappingURL=VTimelineItem.mjs.map