UNPKG

@dialpad/dialtone

Version:

Dialpad's Dialtone design system monorepo

3 lines (2 loc) 1.89 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./skeleton-text.cjs"),e=require("vue"),c=require("../../_plugin-vue_export-helper-BRilXfQE.cjs"),o=a=>a!==""&&!Number.isNaN(Number(a)),m={compatConfig:{MODE:3},name:"DtSkeletonParagraph",components:{DtSkeletonText:d.default},props:{rows:{type:[Number,String],default:3,validator:o},animate:{type:Boolean,default:!0},minWidth:{type:[Number,String],default:30,validator:o},maxWidth:{type:[Number,String],default:100,validator:o},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 a=Math.min(this.minWidth,this.maxWidth),t=Math.max(this.minWidth,this.maxWidth);return`${Math.round(Math.random()*(t-a))+a}%`},getSizeParagraphRow(a){const t=this.width,n=Array.isArray(t),r=t==null?void 0:t[a-1],i=a===this.rows;return this.randomWidth?this.randomWidthPercentage():t&&!n?t:t&&n&&r?r:i?"38%":"100%"}}};function h(a,t,n,r,i,s){const u=e.resolveComponent("dt-skeleton-text");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["d-skeleton-paragraph",n.contentClass]),contentClass:"","data-qa":"skeleton-paragraph"},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.integerRows,l=>(e.openBlock(),e.createBlock(u,{key:l,"data-qa":"skeleton-paragraph-row","content-class":n.rowClass,animate:n.animate,offset:n.offset,"animation-duration":n.animationDuration,width:s.getSizeParagraphRow(l)},null,8,["content-class","animate","offset","animation-duration","width"]))),128))],2)}const f=c._(m,[["render",h]]);exports.default=f; //# sourceMappingURL=skeleton-paragraph.cjs.map