{"version":3,"sources":["webpack:///./src/js/modules/CollapseNext.ts"],"names":["this","init","container_elements","document","querySelectorAll","i","length","setupCollapseItem","element","animation_container_element","querySelector","inner_element","toggle_element","addEventListener","event","handleToggleClicked","container","preventDefault","classList","toggle","contains","inner_height","clientHeight","to","duration","height","onComplete","style"],"mappings":";;;;;;;;8GAAA,qEAGA,aAEE,aAEEA,KAAKC,OAsDT,OAjDU,YAAAA,KAAR,WAGE,IADA,IAAMC,EAA8CC,SAASC,iBAAkB,oBACrEC,EAAY,EAAGA,EAAIH,EAAmBI,OAAQD,IAAML,KAAKO,kBAAmBL,EAAoBG,KAKpG,YAAAE,kBAAR,SAA2BC,GAA3B,WAEQC,EAA2CD,EAAQE,cAAe,yCAClEC,EAA6BH,EAAQE,cAAe,8BACpDE,EAA8BJ,EAAQE,cAAe,4BAEtDD,GAA+BE,GAAiBC,GAEnDA,EAAeC,iBAAkB,SAAS,SAAEC,GAAkB,SAAKC,oBAAqBD,EAAON,EAASC,EAA6BE,OAOjI,YAAAI,oBAAR,SAA6BD,EAAcN,EAAsBQ,EAAwBL,GAMvF,GAJAG,EAAMG,iBAENT,EAAQU,UAAUC,OAAQ,aAErBX,EAAQU,UAAUE,SAAU,aAAgB,CAE/C,IAAMC,EAAuBV,EAAcW,aAE3C,IAAKC,GAAIP,EAAW,CAAEQ,SAAU,GAAIC,OAAQJ,EAAcK,WAAY,WAEpEV,EAAUW,MAAMF,OAAS,eAM3B,IAAKF,GAAIP,EAAW,CAAEQ,SAAU,GAAIC,OAAQ,IAI9C,OAAO,GAIX,EA1DA","file":"js/collapseNext.d0455ee2a6aa08cfc41e.js","sourcesContent":["import '../../css/modules/collapse_next.css';\nimport gsap from \"gsap\";\n\nexport class CollapseNext {\n\n constructor() {\n\n this.init(); \n\n }\n\n\n private init() {\n\n const container_elements: NodeListOf = document.querySelectorAll( '.c-collapse-next' );\n for ( let i: number = 0; i < container_elements.length; i++ ) this.setupCollapseItem( container_elements[ i ] );\n\n }\n\n\n private setupCollapseItem( element: HTMLElement ) {\n\n const animation_container_element: HTMLElement = element.querySelector( '.c-collapse-next__animation-container' );\n const inner_element: HTMLElement = element.querySelector( '.c-collapse-next__elements' );\n const toggle_element: HTMLElement = element.querySelector( '.c-collapse-next__toggle' );\n\n if ( animation_container_element && inner_element && toggle_element ) {\n\n toggle_element.addEventListener( 'click', ( event: Event ) => this.handleToggleClicked( event, element, animation_container_element, inner_element ) );\n\n }\n\n }\n\n\n private handleToggleClicked( event: Event, element: HTMLElement, container: HTMLElement, inner_element: HTMLElement ) {\n\n event.preventDefault();\n\n element.classList.toggle( 's-toggled' );\n\n if ( element.classList.contains( 's-toggled' ) ) {\n\n const inner_height: number = inner_element.clientHeight;\n\n gsap.to( container, { duration: .6, height: inner_height, onComplete: () => {\n\n container.style.height = \"auto\";\n \n } } );\n\n } else {\n\n gsap.to( container, { duration: .6, height: 0 } );\n\n }\n\n return false;\n\n }\n\n}"],"sourceRoot":""}