{"version":3,"file":"vue-auto-height.component.1caa9378.js","sources":["../../src/core/vue-auto-height.component.ts"],"sourcesContent":["import { h, ref, onMounted, onUpdated, onBeforeUnmount } from \"vue\";\r\n\r\nconst VueAutoHeight = {\r\n name: \"VueAutoHeight\",\r\n props: {\r\n expanded: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n },\r\n setup(props: any, _ref: any) {\r\n const { slots } = _ref;\r\n const containerElRef = ref(null);\r\n\r\n const UpdateHeight = () => {\r\n containerElRef.value.style.maxHeight = props.expanded ? containerElRef.value.scrollHeight + \"px\" : 0;\r\n };\r\n const onResize = () => {\r\n UpdateHeight();\r\n };\r\n\r\n onUpdated(() => {\r\n UpdateHeight();\r\n });\r\n onMounted(() => {\r\n containerElRef.value.style.overflow = \"hidden\";\r\n UpdateHeight();\r\n window.addEventListener(\"resize\", onResize);\r\n });\r\n onBeforeUnmount(() => {\r\n window.removeEventListener(\"resize\", onResize);\r\n });\r\n\r\n return () => {\r\n return h(\r\n \"div\",\r\n {\r\n class: \"auto-height\",\r\n ref: containerElRef,\r\n },\r\n slots.default && slots.default()\r\n );\r\n };\r\n },\r\n};\r\nexport { VueAutoHeight };\r\n"],"names":["VueAutoHeight","props","_ref","slots","containerElRef","ref","UpdateHeight","onResize","onUpdated","onMounted","onBeforeUnmount","h"],"mappings":"qXAEA,MAAMA,EAAgB,CACpB,KAAM,gBACN,MAAO,CACL,SAAU,CACR,KAAM,QACN,QAAS,EACX,CACF,EACA,MAAMC,EAAYC,EAAW,CACrB,KAAA,CAAE,MAAAC,CAAU,EAAAD,EACZE,EAAiBC,EAAI,IAAI,EAEzBC,EAAe,IAAM,CACVF,EAAA,MAAM,MAAM,UAAYH,EAAM,SAAWG,EAAe,MAAM,aAAe,KAAO,CAAA,EAE/FG,EAAW,IAAM,CACRD,GAAA,EAGf,OAAAE,EAAU,IAAM,CACDF,GAAA,CACd,EACDG,EAAU,IAAM,CACCL,EAAA,MAAM,MAAM,SAAW,SACzBE,IACN,OAAA,iBAAiB,SAAUC,CAAQ,CAAA,CAC3C,EACDG,EAAgB,IAAM,CACb,OAAA,oBAAoB,SAAUH,CAAQ,CAAA,CAC9C,EAEM,IACEI,EACL,MACA,CACE,MAAO,cACP,IAAKP,CACP,EACAD,EAAM,SAAWA,EAAM,QAAQ,CAAA,CAGrC,CACF"}