UNPKG

@dialpad/dialtone-vue

Version:

Vue component library for Dialpad's design system Dialtone

1 lines 1.61 kB
{"version":3,"file":"skeleton.cjs","sources":["../../../common/mixins/skeleton.js"],"sourcesContent":["import { SKELETON_RIPPLE_DURATION } from '@/components/skeleton/skeleton_constants';\n\n/**\n * @displayName Skeleton Animation Mixin\n */\nexport default {\n computed: {\n skeletonOffset () {\n const skeletonText = this.$refs.skeleton;\n if (!skeletonText) { return this.offset; }\n const { top, height } = skeletonText.getBoundingClientRect();\n return top + (height / 2);\n },\n\n skeletonStyle () {\n const style = {};\n\n if (this.skeletonOffset === -1 || (!this.animate && this.animationDuration === -1)) {\n return style;\n }\n const animationDelay = this.skeletonOffset * SKELETON_RIPPLE_DURATION / 1000;\n const animationDuration = this.animationDuration === -1 ? 1000 : this.animationDuration;\n style.animationDelay = `${animationDelay}ms`;\n style.animationDuration = `${animationDuration}ms`;\n return style;\n },\n },\n};\n"],"names":["SkeletonAnimation","skeletonText","top","height","style","animationDelay","SKELETON_RIPPLE_DURATION","animationDuration"],"mappings":"yKAKAA,EAAe,CACb,SAAU,CACR,gBAAkB,CAChB,MAAMC,EAAe,KAAK,MAAM,SAChC,GAAI,CAACA,EAAgB,OAAO,KAAK,OACjC,KAAM,CAAE,IAAAC,EAAK,OAAAC,GAAWF,EAAa,sBAAqB,EAC1D,OAAOC,EAAOC,EAAS,CACzB,EAEA,eAAiB,CACf,MAAMC,EAAQ,CAAA,EAEd,GAAI,KAAK,iBAAmB,IAAO,CAAC,KAAK,SAAW,KAAK,oBAAsB,GAC7E,OAAOA,EAET,MAAMC,EAAiB,KAAK,eAAiBC,EAAAA,yBAA2B,IAClEC,EAAoB,KAAK,oBAAsB,GAAK,IAAO,KAAK,kBACtE,OAAAH,EAAM,eAAiB,GAAGC,CAAc,KACxCD,EAAM,kBAAoB,GAAGG,CAAiB,KACvCH,CACT,CACJ,CACA"}