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iBAAiBd,EACxB,GAAG,GACL,GAEJ,GAEA,+BACA,WAAoB,WAClBH,EAAEoB,QAAQb,GAAG,UAAU,WAErB,EAAKU,iBAAiBjB,EAAE,EAAKP,UAAUI,eAEzC,GACF,GAEA,4BACA,WACE,IAAMwB,EAAQ,IAAIC,gBAAgBC,SAASC,SAASC,QAAQC,IAAI,OAElD,OAAVL,GAGArB,EAAER,KAAKC,UAAUE,WAAWgC,GAAG,IAAD,OAAKN,KACrCrB,EAAE,IAAD,OAAKqB,IAASO,QAAQ,QAE3B,GAAC,kBAED,WAAO,WACLpC,KAAKqC,qBACLV,YAAW,WACT,EAAKF,iBAAiBjB,EAAE,EAAKP,UAAUI,eACzC,GAAG,KACHL,KAAK0B,kBAAkBlB,EAAER,KAAKC,UAAUI,gBACxCL,KAAKsC,gBACLtC,KAAKuC,oBACLvC,KAAKwC,gBACP,M,8EAAC,EA9FO,G","sources":["webpack://t2u/./src/js/components/Tabs.js"],"sourcesContent":["class Tabs {\r\n constructor() {\r\n this.selectors = {\r\n component: '.tab-list',\r\n tabButton: '.tab-list__toggle',\r\n tabItem: '.tab-list__item',\r\n tabItemActive: '.tab-list__item--active',\r\n tabContent: '.tab-list__content',\r\n tabContentInactive: '.tab-list__item:not(.tab-list__item--active) .tab-list__content',\r\n };\r\n }\r\n\r\n // accessibility: apply styling on page load\r\n // if JS is disabled, content will still show\r\n handleStylesOnLoad() {\r\n $(this.selectors.component).addClass('js-loaded');\r\n $(this.selectors.tabContentInactive).hide();\r\n }\r\n\r\n setTabItemHeight(activeItem) {\r\n const buttonHeight = activeItem.find(this.selectors.tabButton).height();\r\n const contentHeight = activeItem.find(this.selectors.tabContent).height();\r\n\r\n const itemHeight = buttonHeight + contentHeight;\r\n\r\n activeItem.height(itemHeight);\r\n }\r\n\r\n tabItemToggle() {\r\n $(this.selectors.tabButton).on('click', (event) => {\r\n $(event.currentTarget).closest(this.selectors.tabItem).addClass('tab-list__item--active')\r\n .siblings('.tab-list__item--active').removeClass('tab-list__item--active')\r\n .find(this.selectors.tabContent).fadeOut(100);\r\n\r\n $(event.currentTarget)\r\n .closest(this.selectors.tabItem)\r\n .find(this.selectors.tabContent).fadeIn(100);\r\n\r\n $(event.currentTarget).attr('aria-selected', 'true')\r\n .closest(this.selectors.tabItem)\r\n .siblings()\r\n .find(this.selectors.tabButton).attr('aria-selected', 'false');\r\n\r\n $(event.currentTarget).closest(this.selectors.tabItem)\r\n .siblings().css('height', 'fit-content');\r\n\r\n this.setTabItemHeight($(event.currentTarget).closest(this.selectors.tabItem));\r\n this.submitResetHeight($(event.currentTarget).closest(this.selectors.tabItem));\r\n });\r\n }\r\n\r\n // if a tab conteins a form\r\n // re-set height if errors on submit\r\n // See T-MYT-INT-UPD\r\n submitResetHeight(activeItem) {\r\n if (activeItem.find('button[type=\"submit\"]') !== null) {\r\n activeItem.find('button[type=\"submit\"]').on('click', () => {\r\n setTimeout(() => {\r\n this.setTabItemHeight(activeItem);\r\n }, 40);\r\n });\r\n }\r\n }\r\n\r\n // if it affects performance, remove\r\n resizeResetHeight() {\r\n $(window).on('resize', () => {\r\n // if ($(window).innerWidth() >= 767) {\r\n this.setTabItemHeight($(this.selectors.tabItemActive));\r\n // }\r\n });\r\n }\r\n\r\n // checks if tab is opened via url and toggle\r\n tabItemCurrent() {\r\n const tabId = new URLSearchParams(document.location.search).get('tab');\r\n\r\n if (tabId === null) return;\r\n\r\n // if tab matches an ID in the page, trigger click\r\n if ($(this.selectors.tabButton).is(`#${tabId}`)) {\r\n $(`#${tabId}`).trigger('click');\r\n }\r\n }\r\n\r\n init() {\r\n this.handleStylesOnLoad();\r\n setTimeout(() => {\r\n this.setTabItemHeight($(this.selectors.tabItemActive));\r\n }, 150);\r\n this.submitResetHeight($(this.selectors.tabItemActive));\r\n this.tabItemToggle();\r\n this.resizeResetHeight();\r\n this.tabItemCurrent();\r\n }\r\n}\r\n\r\nexport default new Tabs();\r\n"],"names":["this","selectors","component","tabButton","tabItem","tabItemActive","tabContent","tabContentInactive","$","addClass","hide","activeItem","itemHeight","find","height","on","event","currentTarget","closest","siblings","removeClass","fadeOut","fadeIn","attr","css","setTabItemHeight","submitResetHeight","setTimeout","window","tabId","URLSearchParams","document","location","search","get","is","trigger","handleStylesOnLoad","tabItemToggle","resizeResetHeight","tabItemCurrent"],"sourceRoot":""}