UNPKG

@dialpad/dialtone-vue

Version:

Vue component library for Dialpad's design system Dialtone

3 lines (2 loc) 1.66 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("./skeleton-text.cjs"),o=require("../../_plugin-vue2_normalizer-e_CkxkSV.cjs"),n=e=>e!==""&&!Number.isNaN(Number(e)),d={name:"DtSkeletonParagraph",components:{DtSkeletonText:s.default},props:{rows:{type:[Number,String],default:3,validator:n},animate:{type:Boolean,default:!0},minWidth:{type:[Number,String],default:30,validator:n},maxWidth:{type:[Number,String],default:100,validator:n},width:{type:[String,Array],default:null},randomWidth:{type:Boolean,default:!1},offset:{type:Number,default:1},animationDuration:{type:Number,default:-1},contentClass:{type:String,default:""},rowClass:{type:String,default:""}},computed:{integerRows(){return Number(this.rows)}},methods:{randomWidthPercentage(){const e=Math.min(this.minWidth,this.maxWidth),t=Math.max(this.minWidth,this.maxWidth);return`${Math.round(Math.random()*(t-e))+e}%`},getSizeParagraphRow(e){const t=this.width,a=Array.isArray(t),r=t==null?void 0:t[e-1],i=e===this.rows;return this.randomWidth?this.randomWidthPercentage():t&&!a?t:t&&a&&r?r:i?"38%":"100%"}}};var u=function(){var t=this,a=t._self._c;return a("div",{class:["d-skeleton-paragraph",t.contentClass],attrs:{contentClass:"","data-qa":"skeleton-paragraph"}},t._l(t.integerRows,function(r){return a("dt-skeleton-text",{key:r,attrs:{"data-qa":"skeleton-paragraph-row","content-class":t.rowClass,animate:t.animate,offset:t.offset,"animation-duration":t.animationDuration,width:t.getSizeParagraphRow(r)}})}),1)},l=[],m=o.n(d,u,l);const h=m.exports;exports.default=h; //# sourceMappingURL=skeleton-paragraph.cjs.map