UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

117 lines (116 loc) 3.23 kB
import { SKELETON_TEXT_TYPES, SKELETON_HEADING_HEIGHTS } from "./skeleton_constants.js"; import SkeletonAnimation from "../../common/mixins/skeleton.js"; import { openBlock, createElementBlock, normalizeClass, normalizeStyle, createCommentVNode } from "vue"; import _export_sfc from "../../_virtual/_plugin-vue_export-helper.js"; const _sfc_main = { compatConfig: { MODE: 3 }, name: "DtSkeletonText", mixins: [SkeletonAnimation], props: { /** * Skeleton type * @values body, heading */ type: { type: String, default: "body", validator: (type) => SKELETON_TEXT_TYPES.includes(type) }, /** * Heading height * @values sm, md, lg */ headingHeight: { type: String, default: "md", validator: (headingHeight) => Object.keys(SKELETON_HEADING_HEIGHTS).includes(headingHeight) }, /** * Width of the skeleton */ width: { type: String, default: "100%" }, /** * 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: false }, /** * 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 content. */ contentClass: { type: String, default: "" } }, data() { return { SKELETON_HEADING_HEIGHTS }; } }; function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return $props.type === "body" ? (openBlock(), createElementBlock("div", { key: 0, ref: "skeleton", "data-qa": "skeleton-text-body", class: normalizeClass([ "d-skeleton-text", "d-skeleton-placeholder", { "d-skeleton-placeholder--animate": $props.animate }, $props.contentClass ]), style: normalizeStyle({ width: $props.width, ..._ctx.skeletonStyle }) }, null, 6)) : $props.type === "heading" ? (openBlock(), createElementBlock("div", { key: 1, ref: "skeleton", "data-qa": "skeleton-text-heading", class: normalizeClass([ $data.SKELETON_HEADING_HEIGHTS[$props.headingHeight], "d-skeleton-text--heading", "d-skeleton-placeholder", { "d-skeleton-placeholder--animate": $props.animate }, $props.contentClass ]), style: normalizeStyle({ width: $props.width, ..._ctx.skeletonStyle }) }, null, 6)) : createCommentVNode("", true); } const DtSkeletonText = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]); export { DtSkeletonText as default }; //# sourceMappingURL=skeleton-text.vue.js.map