{ "version": 3, "sources": ["../../../Vettvangur.Heilsuvera/src/scripts/components/Sykurmagn/tabsMobile.ts"], "sourcesContent": ["import { gsap } from \"gsap/all\";\n\nconst tabsMobile = {\n\tproductsButton: document.querySelector(\n\t\t\".tabs__mobileProducts__button\",\n\t),\n\tdropdownBox: document.querySelector(\".tabs__mobileDropdown\"),\n\n\tinit: (): void => {\n\t\tif (tabsMobile.productsButton != null) {\n\t\t\ttabsMobile.openDropdown();\n\t\t\ttabsMobile.closeDropdown();\n\t\t}\n\t},\n\n\topenDropdown: (): void => {\n\t\tgsap.set(tabsMobile.dropdownBox, { opacity: 0, display: \"none\" });\n\n\t\ttabsMobile.productsButton?.addEventListener(\"click\", (event) => {\n\t\t\tconst opacityZero = tabsMobile.dropdownBox.style.opacity == \"0\";\n\t\t\tconst isClickInside = tabsMobile.dropdownBox?.contains(\n\t\t\t\tevent.target as Node,\n\t\t\t);\n\n\t\t\tif (opacityZero) {\n\t\t\t\ttabsMobile.productsButton.classList.add(\n\t\t\t\t\t\"tabs__mobileProducts__button--active\",\n\t\t\t\t);\n\t\t\t\tgsap.to(tabsMobile.dropdownBox, {\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t\tease: \"power3.inOut\",\n\t\t\t\t\topacity: 1,\n\t\t\t\t\tdisplay: \"flex\",\n\t\t\t\t});\n\t\t\t} else if (!isClickInside) {\n\t\t\t\ttabsMobile.productsButton.classList.remove(\n\t\t\t\t\t\"tabs__mobileProducts__button--active\",\n\t\t\t\t);\n\t\t\t\tgsap.to(tabsMobile.dropdownBox, {\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t\tease: \"power3.inOut\",\n\t\t\t\t\topacity: 0,\n\t\t\t\t\tdisplay: \"none\",\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t},\n\n\tcloseDropdown: (): void => {\n\t\tdocument.addEventListener(\"click\", (event) => {\n\t\t\tconst isClickOutside = !tabsMobile.dropdownBox?.contains(\n\t\t\t\tevent.target as Node,\n\t\t\t);\n\t\t\tconst isClickOnButton = !tabsMobile.productsButton?.contains(\n\t\t\t\tevent.target as Node,\n\t\t\t);\n\n\t\t\tif (isClickOutside && isClickOnButton) {\n\t\t\t\tgsap.to(tabsMobile.dropdownBox, {\n\t\t\t\t\tduration: 0.4,\n\t\t\t\t\tease: \"power3.inOut\",\n\t\t\t\t\topacity: 0,\n\t\t\t\t\tdisplay: \"none\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (isClickOnButton) {\n\t\t\t\ttabsMobile.productsButton.classList.remove(\n\t\t\t\t\t\"tabs__mobileProducts__button--active\",\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\t},\n};\n\nexport default tabsMobile;\n"], "mappings": "4GAEA,IAAMA,EAAa,CAClB,eAAgB,SAAS,cACxB,+BACD,EACA,YAAa,SAAS,cAA2B,uBAAuB,EAExE,KAAM,IAAY,CACbA,EAAW,gBAAkB,OAChCA,EAAW,aAAa,EACxBA,EAAW,cAAc,EAE3B,EAEA,aAAc,IAAY,CAf3B,IAAAC,EAgBEC,EAAK,IAAIF,EAAW,YAAa,CAAE,QAAS,EAAG,QAAS,MAAO,CAAC,GAEhEC,EAAAD,EAAW,iBAAX,MAAAC,EAA2B,iBAAiB,QAAUE,GAAU,CAlBlE,IAAAF,EAmBG,IAAMG,EAAcJ,EAAW,YAAY,MAAM,SAAW,IACtDK,GAAgBJ,EAAAD,EAAW,cAAX,YAAAC,EAAwB,SAC7CE,EAAM,QAGHC,GACHJ,EAAW,eAAe,UAAU,IACnC,sCACD,EACAE,EAAK,GAAGF,EAAW,YAAa,CAC/B,SAAU,GACV,KAAM,eACN,QAAS,EACT,QAAS,MACV,CAAC,GACUK,IACXL,EAAW,eAAe,UAAU,OACnC,sCACD,EACAE,EAAK,GAAGF,EAAW,YAAa,CAC/B,SAAU,GACV,KAAM,eACN,QAAS,EACT,QAAS,MACV,CAAC,EAEH,EACD,EAEA,cAAe,IAAY,CAC1B,SAAS,iBAAiB,QAAUG,GAAU,CAjDhD,IAAAF,EAAAK,EAkDG,IAAMC,EAAiB,GAACN,EAAAD,EAAW,cAAX,MAAAC,EAAwB,SAC/CE,EAAM,SAEDK,EAAkB,GAACF,EAAAN,EAAW,iBAAX,MAAAM,EAA2B,SACnDH,EAAM,SAGHI,GAAkBC,GACrBN,EAAK,GAAGF,EAAW,YAAa,CAC/B,SAAU,GACV,KAAM,eACN,QAAS,EACT,QAAS,MACV,CAAC,EAGEQ,GACHR,EAAW,eAAe,UAAU,OACnC,sCACD,CAEF,CAAC,CACF,CACD,EAEOS,EAAQT", "names": ["tabsMobile", "_a", "gsapWithCSS", "event", "opacityZero", "isClickInside", "_b", "isClickOutside", "isClickOnButton", "tabsMobile_default"] }