@dialpad/dialtone
Version:
Dialpad's Dialtone design system monorepo
119 lines (118 loc) • 3.7 kB
JavaScript
import { SKELETON_SHAPES } from "./skeleton_constants.js";
import DtSkeletonShape from "./skeleton-shape.vue.js";
import DtSkeletonParagraph from "./skeleton-paragraph.vue.js";
import { resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, createElementVNode, mergeProps } from "vue";
import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js";
const _sfc_main = {
compatConfig: { MODE: 3 },
name: "DtSkeletonListItem",
components: {
DtSkeletonShape,
DtSkeletonParagraph
},
props: {
/**
* Defines the shape of the skeleton, accepts circle or square.
* @values circle, square
*/
shape: {
type: String,
default: "circle",
validator: (shape) => Object.keys(SKELETON_SHAPES).includes(shape)
},
/**
* Size of the shape
* @values xs, sm, md, lg, xl
*/
shapeSize: {
type: String,
default: "md"
},
/**
* Object containing quantity of paragraphs to display
* and a randomWidth boolean.
*/
paragraphs: {
type: Object,
default: () => ({ rows: 3, randomWidth: true })
},
/**
* Duration time of the animation (ms), set -1 for an infinite animation.
*/
animationDuration: {
type: Number,
default: -1
},
/**
* This property has higher priority than "option.animate"
* @values true, false
*/
animate: {
type: Boolean,
default: true
},
/**
* RippleDuration controls how long the delay is for the animation of a
* placeholder 1000 pixels from the top of the page. Each placeholder
* from the top down will have a delay duration from 0 to this offset.
* The delay of each placeholder animation is based on how far down the page
* the placeholder is rendered. This is a linear relationship. The unit
* is milliseconds.
*/
offset: {
type: Number,
default: 1
},
/**
* Additional class name for the shape.
*/
shapeClass: {
type: String,
default: ""
},
/**
* Additional class name for the content.
*/
contentClass: {
type: String,
default: ""
}
}
};
const _hoisted_1 = { class: "d-skeleton-list-item__paragraph-container" };
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
const _component_dt_skeleton_shape = resolveComponent("dt-skeleton-shape");
const _component_dt_skeleton_paragraph = resolveComponent("dt-skeleton-paragraph");
return openBlock(), createElementBlock("div", {
"data-qa": "skeleton-list-item",
class: normalizeClass([
"d-skeleton-list-item",
{
"d-skeleton-list-item--single": $props.paragraphs.rows === 1
},
$props.contentClass
])
}, [
createVNode(_component_dt_skeleton_shape, {
class: "d-skeleton-list-item__shape",
size: $props.shapeSize,
shape: $props.shape,
"animation-duration": $props.animationDuration,
animate: $props.animate,
offset: $props.offset,
"content-class": $props.shapeClass
}, null, 8, ["size", "shape", "animation-duration", "animate", "offset", "content-class"]),
createElementVNode("div", _hoisted_1, [
createVNode(_component_dt_skeleton_paragraph, mergeProps($props.paragraphs, {
"animation-duration": $props.animationDuration,
animate: $props.animate,
offset: $props.offset
}), null, 16, ["animation-duration", "animate", "offset"])
])
], 2);
}
const DtSkeletonListItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
export {
DtSkeletonListItem as default
};
//# sourceMappingURL=skeleton-list-item.vue.js.map