{"version":3,"file":"lineClamp-BimAj8aM.js","sources":["../../../../Coloplast.UI/src/shared/components/lineClamp.vue"],"sourcesContent":["<template>\r\n    <div class=\"c-line-clamp\" :class=\"{ '-clamp-needed' : clampNeeded }\" :style=\"'--height:' + clampHeight + 'px'\">\r\n        <div class=\"c-line-clamp__text\" :class=\"{ '-expanded': expanded }\" ref=\"content\">\r\n            <div ref=\"contentContainer\" c-line-clamp=\"c-line-clamp__text-wrapper\">\r\n                <slot>\r\n\r\n                </slot>\r\n            </div>\r\n        </div>\r\n        <input type=\"checkbox\" :id=\"id\" v-model=\"expanded\" class=\"state\" />\r\n        <label :for=\"id\" class=\"e-link c-line-clamp__toggle\">\r\n            {{ text }}\r\n        </label>\r\n    </div>\r\n</template>\r\n\r\n<script>\r\n\r\nexport default {\r\n    name: 'line-clamp',\r\n    props: {\r\n        lines: {\r\n            type: Number,\r\n            default: 10,\r\n        },\r\n        lineHeight: {\r\n            type: Number,\r\n            default: 28,\r\n        },\r\n        readMore: {\r\n            type: String,\r\n        },\r\n        readLess: {\r\n            type: String,\r\n        },\r\n    },\r\n    data() {\r\n        const id = 'id-' + Math.floor(Math.random() * 10000);\r\n        return {\r\n            id: id,\r\n            expanded: false,\r\n            clampNeeded: false,\r\n        }\r\n    },\r\n    computed: {\r\n        text() {\r\n            if (this.expanded) {\r\n                return this.readLess;\r\n            }\r\n            return this.readMore;\r\n        },\r\n        maxHeight() {\r\n            return this.lines * this.lineHeight;\r\n        },\r\n        clampHeight() {\r\n            return this.expanded ? this.$refs.contentContainer.getBoundingClientRect().height : this.maxHeight;\r\n        },\r\n    },\r\n    mounted() {\r\n        this.$nextTick(() => {\r\n            const h = this.$refs.content.clientHeight;\r\n            if (h > this.maxHeight) {\r\n                this.clampNeeded = true;\r\n            }\r\n        });\r\n    },\r\n}\r\n</script>\r\n\r\n"],"names":["_sfc_main","_createElementBlock","_normalizeClass","$data","$options","_createElementVNode","_hoisted_1","_renderSlot","_ctx","$event","_hoisted_3"],"mappings":"sKAkBA,MAAKA,EAAU,CACX,KAAM,aACN,MAAO,CACH,MAAO,CACH,KAAM,OACN,QAAS,EACZ,EACD,WAAY,CACR,KAAM,OACN,QAAS,EACZ,EACD,SAAU,CACN,KAAM,MACT,EACD,SAAU,CACN,KAAM,MACT,CACJ,EACD,MAAO,CAEH,MAAO,CACH,GAFO,MAAQ,KAAK,MAAM,KAAK,OAAM,EAAK,GAAK,EAG/C,SAAU,GACV,YAAa,EACjB,CACH,EACD,SAAU,CACN,MAAO,CACH,OAAI,KAAK,SACE,KAAK,SAET,KAAK,QACf,EACD,WAAY,CACR,OAAO,KAAK,MAAQ,KAAK,UAC5B,EACD,aAAc,CACV,OAAO,KAAK,SAAW,KAAK,MAAM,iBAAiB,wBAAwB,OAAS,KAAK,SAC5F,CACJ,EACD,SAAU,CACN,KAAK,UAAU,IAAM,CACP,KAAK,MAAM,QAAQ,aACrB,KAAK,YACT,KAAK,YAAc,GAE3B,CAAC,CACJ,CACL,KA/DiB,IAAI,mBAAmB,eAAa,oFAFjDC,EAYM,MAAA,CAZD,MAAKC,EAAA,CAAC,eAAc,CAAA,gBAA6BC,EAAW,WAAA,CAAA,CAAA,EAAK,oBAAqBC,EAAW,YAAA,IAAA,IAClGC,EAMM,MAAA,CAND,MAAKH,EAAA,CAAC,qBAAoB,CAAA,YAAwBC,EAAQ,QAAA,CAAA,CAAA,EAAI,IAAI,YACnEE,EAIM,MAJNC,EAIM,CAHFC,EAEOC,EAAA,OAAA,SAAA,cAGfH,EAAmE,QAAA,CAA5D,KAAK,WAAY,GAAIF,EAAE,wCAAWA,EAAQ,SAAAM,GAAE,MAAM,uBAAhBN,EAAQ,QAAA,IACjDE,EAEQ,QAAA,CAFA,IAAKF,EAAE,GAAE,MAAM,iCAChBC,EAAI,IAAA,EAAA,EAAAM,CAAA"}