{"version":3,"names":["NAVIGATION_STICKYSLEVEL_MAIN","NAVIGATION_STICKYSLEVEL_TOOLBAR","NAVIGATION_STICKYSLEVEL_META","navigationCss","EonUiNavigationStyle0","Navigation","this","metaHeight","toolbarHeight","mainHeight","lastScrollTop","burgerPosition","NAVIGATION_MAIN_BURGERPOSITION_LEFT","mobileNavigationPadding","mobileNavigationPaddingSticky","updateNavigationHeight","navigationWrapper","getBoundingClientRect","height","openToolbarSub","rel","keyboard","clearTimeout","toolbarWrapperTimeout","deactivateToolbarLinks","closeMainSub","isMobileNavOpen","closeMobileNav","isMainSubOpen","activeToolbarSubContainer","hostElement","querySelector","isToolbarSubOpen","showToolbarSub","initSubKeyboardNav","closeToolbarSub","setTimeout","style","display","openMainSub","mainWrapperTimeout","deactivateMainLinks","deactivateMainIconLinks","activeMainSubContainer","isMainSubWrapperOpen","showMainSub","openMobileNav","closeMobileSub","mobileWrapper","classList","add","mainNavigation","burgerActive","remove","openMobileSub","activeMobileSubContainer","showMobileSub","openMobileSubImmediately","showMobileSubImmediately","mobileSubChilds","forEach","element","scrollTop","mobileMainNavigation","detectScrollDirection","sticky","scrollTimeout","isTouchDevice","st","window","pageYOffset","document","documentElement","currentScrollDirection","closeNavigationsOnResize","resizeTimeout","componentWillLoad","getNavigationStructure","calcMobileNavigationPadding","toolbarNavigation","toolbarChilds","querySelectorAll","toolbarLinks","mainChilds","mainStandardChilds","mainIconChilds","mainLinks","mainIconLinks","setParentNavTypeDataAttributeToFlyoutLink","setInnerBackgroundToSubs","componentDidLoad","mainSubWrapper","initMainSubFunctionality","createMainMobileNavigation","_a","setCssVariables","toolbarChild","link","dataset","parentNavigationType","mainChild","child","setAttribute","NAVIGATION_TOOLBAR_FLYOUT_INNER_BACKGROUND","NAVIGATION_MAIN_FLYOUT_INNER_BACKGROUND","setToolbarSubHeight","setMainSubHeight","activeSubContainer","subItems","Array","prototype","slice","call","firstFocusableItem","lastFocusableItem","hasAttribute","shadowRoot","focusableElement","focus","exitSecondaryNavViaKey","firstChild","lastChild","contains","addEventListener","e","key","KeyIds","TAB","shiftKey","preventDefault","relatedLink","getAttribute","hasMetaNavigation","hasToolbarNavigation","hasMainNavigation","hasExtension","stickyLevel","setCssVariable","toolbarSubHeight","mainSubHeight","item","removeActiveState","mouse","closestEdge","mouseLeaveTimeout","createMobileMain","mainNavigationChilds","toolbarNavigationChilds","_b","cloneNode","push","_d","_c","h","class","ref","el","innerHTML","map","outerHTML","join","createMobileSub","subNavi","relatedNavigation","subNavigationChilds","backLinkText","id","column","from","children","columnItem","onClick","name","createMobileSubWithGrid","subNaviClone","importNode","removeAttribute","spacing","elem","elemBounding","elementLeftEdge","left","elementTopEdge","top","elementRightEdge","right","elementBottomEdge","bottom","mouseX","pageX","mouseY","pageY","topEdgeDist","Math","abs","bottomEdgeDist","leftEdgeDist","rightEdgeDist","min","render","Host","pfx","overlay","act","onTouchEnd","Fragment","active","NAVIGATION_MOBILE_FLYOUT_INNER_BACKGROUND"],"sources":["src/components/navigation/constants/navigation-constants.ts","src/components/navigation/navigation.scss?tag=eon-ui-navigation&encapsulation=shadow","src/components/navigation/navigation.tsx"],"sourcesContent":["export const NAVIGATION_STICKYSLEVEL_MAIN = \"main\";\nexport const NAVIGATION_STICKYSLEVEL_TOOLBAR = \"toolbar\";\nexport const NAVIGATION_STICKYSLEVEL_META = \"meta\";\n\nexport const NAVIGATION_STICKYLEVELS = [\n NAVIGATION_STICKYSLEVEL_MAIN,\n NAVIGATION_STICKYSLEVEL_TOOLBAR,\n NAVIGATION_STICKYSLEVEL_META\n] as const;\n","$metaHeight: 48px;\n$toolbarHeight: 72px;\n$mainHeight: 68px;\n\n$mobile-nav-width: 305px;\n$mobile-nav-width-phone: 296px;\n\n:host {\n display: block;\n\n *,\n :after,\n :before {\n box-sizing: border-box;\n outline: 0 none;\n text-rendering: optimizelegibility;\n }\n}\n\n@mixin animation {\n transition-property: all;\n transition-duration: 400ms;\n transition-timing-function: ease;\n transition-delay: 0s;\n}\n\n.#{$prefix}navigation-wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n outline: 0 none;\n text-rendering: optimizelegibility;\n margin: 0;\n padding: 0;\n font-family: $font-family-base;\n z-index: 99;\n box-shadow: $navigation-box-shadow;\n @include animation;\n\n &.#{$prefix}sticky {\n position: fixed;\n left: 0;\n top: 0;\n }\n\n &.#{$prefix}collapsed {\n top: ($metaHeight + $toolbarHeight + $mainHeight) * -1;\n\n // act as if no toolbar navigation (toolbar hidden on mobile)\n @include for-size(tablet-or-smaller) {\n top: ($metaHeight + $mainHeight) * -1;\n }\n\n // if no toolbar navigation\n &.#{$prefix}nav-meta-main {\n top: ($metaHeight + $mainHeight) * -1;\n }\n\n // if no meta navigation\n &.#{$prefix}nav-toolbar-main {\n top: ($toolbarHeight + $mainHeight) * -1;\n\n // act as if no toolbar navigation (toolbar hidden on mobile)\n @include for-size(tablet-or-smaller) {\n top: ($mainHeight) * -1;\n }\n }\n\n // if no meta and no toolbar navigation\n &.#{$prefix}nav-main {\n top: ($mainHeight) * -1;\n }\n\n .#{$prefix}mobile-wrapper {\n height: calc(100vh - var(--mobileNavigationPaddingSticky));\n }\n }\n\n &.#{$prefix}sticky-level-main {\n &.#{$prefix}collapsed {\n top: ($metaHeight + $toolbarHeight) * -1;\n\n // act as if no toolbar navigation (toolbar hidden on mobile)\n @include for-size(tablet-or-smaller) {\n top: ($metaHeight) * -1;\n }\n\n // if no toolbar navigation\n &.#{$prefix}nav-meta-main {\n top: ($metaHeight) * -1;\n }\n\n // if no meta navigation\n &.#{$prefix}nav-toolbar-main {\n top: ($toolbarHeight) * -1;\n\n // act as if no toolbar navigation (toolbar hidden on mobile)\n @include for-size(tablet-or-smaller) {\n top: 0;\n }\n }\n\n // if no meta and no toolbar navigation\n &.#{$prefix}nav-main {\n top: 0;\n }\n }\n }\n\n &.#{$prefix}sticky-level-toolbar {\n &.#{$prefix}collapsed {\n top: ($metaHeight) * -1;\n\n // if no meta navigation\n &.#{$prefix}nav-toolbar-main {\n top: 0;\n\n // act as if no toolbar navigation (toolbar hidden on mobile)\n @include for-size(tablet-or-smaller) {\n top: 0;\n }\n }\n\n // if no meta and no toolbar navigation\n &.#{$prefix}nav-main {\n top: 0;\n }\n }\n }\n\n &.#{$prefix}sticky-level-meta {\n &.#{$prefix}collapsed {\n top: 0;\n }\n }\n\n .#{$prefix}toolbar-sub {\n position: relative;\n width: 100%;\n height: 0px;\n max-height: 70vh;\n background-color: $navigation-toolbar-sub-bg-color;\n overflow: auto;\n transition-property: height;\n transition-duration: 400ms;\n transition-timing-function: ease;\n transition-delay: 0s;\n\n .#{$prefix}toolbar-sub-inner {\n position: relative;\n width: 100%;\n max-width: calc($content-max-width-desktop-l + 16px);\n margin: 0px auto 0px auto;\n padding-top: 32px;\n padding-right: 24px;\n padding-bottom: 32px;\n padding-left: 24px;\n\n @include for-size(desktop-or-smaller) {\n max-width: $content-max-width-desktop;\n }\n\n @include for-size(desktop) {\n padding-right: 16px;\n padding-left: 16px;\n }\n\n @include for-size(tablet) {\n padding-left: 4px;\n padding-right: 4px;\n }\n\n @include for-size(phone) {\n padding-left: 8px;\n padding-right: 8px;\n }\n }\n }\n\n .#{$prefix}main-sub-wrapper {\n position: absolute;\n left: 0;\n width: 100%;\n height: 0;\n overflow: hidden;\n z-index: 89;\n\n .#{$prefix}main-sub {\n position: absolute;\n left: 0;\n top: 0;\n transform: translateY(-110%);\n transform-origin: top;\n width: 100%;\n height: auto;\n max-height: 70vh;\n background-color: $navigation-main-sub-bg-color;\n overflow: auto;\n box-shadow: $navigation-main-sub-box-shadow;\n transition-property: all;\n transition-duration: 400ms;\n transition-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);\n transition-delay: 0s;\n border-bottom: $navigation-main-sub-border-width $navigation-main-sub-border-style\n $navigation-main-sub-border-color;\n\n &.#{$prefix}active {\n transform: translateY(0px);\n transition-duration: 800ms;\n transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);\n }\n\n .#{$prefix}main-sub-inner {\n position: relative;\n width: 100%;\n max-width: calc($content-max-width-desktop-l + 16px);\n margin: 0px auto 0px auto;\n padding-top: 32px;\n padding-right: 24px;\n padding-bottom: 32px;\n padding-left: 24px;\n\n @include for-size(desktop-or-smaller) {\n max-width: $content-max-width-desktop;\n }\n\n @include for-size(desktop) {\n padding-right: 16px;\n padding-left: 16px;\n }\n\n @include for-size(tablet) {\n padding-right: 4px;\n padding-left: 4px;\n }\n\n @include for-size(phone) {\n padding-right: 8px;\n padding-left: 8px;\n }\n }\n }\n }\n\n .#{$prefix}overlay {\n position: fixed;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n z-index: 20;\n background-color: rgba(57, 57, 58, 0.4);\n visibility: hidden;\n opacity: 0;\n transition-property: all;\n transition-duration: 400ms;\n transition-timing-function: ease;\n transition-delay: 0s;\n\n &.#{$prefix}act {\n visibility: visible;\n opacity: 1;\n }\n }\n}\n\n.#{$prefix}mobile-wrapper {\n position: absolute;\n left: -400px;\n width: $mobile-nav-width;\n height: calc(100vh - var(--mobileNavigationPadding));\n background-color: $navigation-mobile-bg-color;\n z-index: 30;\n overflow: hidden;\n font-family: $font-family-base;\n display: none;\n box-sizing: border-box;\n\n &.from-left {\n left: -400px;\n right: unset;\n }\n\n &.from-right {\n right: -400px;\n left: unset;\n }\n\n transition-property: left, right;\n transition-duration: 400ms;\n transition-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715);\n transition-delay: 0s;\n\n &.act {\n transition-duration: 800ms;\n transition-timing-function: cubic-bezier(0.165, 0.84, 0.44, 1);\n\n &.from-left {\n left: 0;\n }\n\n &.from-right {\n right: 0;\n }\n }\n\n @include for-size(phone) {\n display: block;\n width: $mobile-nav-width-phone;\n }\n\n @include for-size(tablet) {\n display: block;\n }\n}\n\n.mobile-main-nav {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n background-color: $navigation-mobile-bg-color;\n\n transition-property: filter;\n transition-duration: 500ms;\n transition-timing-function: ease;\n transition-delay: 0s;\n\n .mobile-main-nav-inner {\n position: relative;\n padding: 24px 0px 140px 0px;\n transition-property: transform;\n transition-duration: 500ms;\n transition-timing-function: ease;\n transition-delay: 0s;\n\n .main-navigation-links {\n position: relative;\n margin-bottom: 46px;\n }\n\n .toolbar-navigation-links {\n position: relative;\n }\n }\n\n &.scale {\n filter: brightness(80%);\n\n .mobile-main-nav-inner {\n transform: scale(0.93);\n }\n }\n}\n\n.mobile-secondary-nav {\n position: absolute;\n right: -305px;\n top: 0;\n width: 100%;\n height: 100%;\n box-shadow: -1px 0px 0px 0px #{$navigation-mobile-bg-color};\n overflow: hidden;\n overflow-y: auto;\n background-color: $navigation-mobile-bg-color;\n display: flex;\n flex-direction: column;\n\n transition-property: right;\n transition-duration: 500ms;\n transition-timing-function: ease;\n transition-delay: 0s;\n\n &.no-animation {\n transition: unset;\n }\n\n &.act {\n right: 0;\n }\n\n .mobile-secondary-nav-backlink {\n position: relative;\n cursor: pointer;\n font-size: 24px;\n padding: 12px 24px 12px 64px;\n margin: 8px 0px 8px 0px;\n line-height: 24px;\n font-weight: 700;\n color: #{$navigation-mobile-link-font-color};\n\n @include for-size(phone) {\n font-size: 22px;\n line-height: 22px;\n padding-left: 56px;\n }\n\n eon-ui-icon {\n position: absolute;\n left: 34px;\n top: 50%;\n transform: translateY(-50%);\n color: #{$navigation-mobile-link-font-color};\n\n @include for-size(phone) {\n left: 26px;\n }\n }\n }\n\n .mobile-secondary-nav-inner {\n position: relative;\n width: 100%;\n height: 100%;\n overflow-x: hidden;\n overflow-y: auto;\n -webkit-overflow-scrolling: touch;\n padding-bottom: 140px;\n\n &.spacing {\n padding-left: 8px;\n padding-right: 8px;\n }\n\n &.spacing-top {\n padding-top: 24px;\n }\n }\n\n eon-ui-navigation-flyout-divider {\n display: none;\n }\n}\n\n::slotted(eon-ui-navigation-toolbar) {\n @include for-size(tablet-or-smaller) {\n display: none;\n }\n}\n","import { h, Component, Host, State, Element, Prop, Listen, Fragment, Method, Watch } from \"@stencil/core\";\nimport { StickyLevel } from \"./constants/navigation-types\";\nimport pfx from \"../../utils/style-class-prefix-helper\";\nimport { KeyIds } from \"../../constants/keys\";\nimport { BurgerPosition } from \"./navigation-components/navigation-main/constants/navigation-main-types\";\nimport { NAVIGATION_MAIN_BURGERPOSITION_LEFT } from \"./navigation-components/navigation-main/constants/navigation-main-constants\";\nimport { setCssVariable } from \"../../utils/css-variables\";\nimport { isTouchDevice } from \"../../utils/touch-helper\";\nimport {\n NAVIGATION_STICKYSLEVEL_MAIN,\n NAVIGATION_STICKYSLEVEL_META,\n NAVIGATION_STICKYSLEVEL_TOOLBAR\n} from \"./constants/navigation-constants\";\nimport {\n NAVIGATION_TOOLBAR_FLYOUT_INNER_BACKGROUND,\n NAVIGATION_MAIN_FLYOUT_INNER_BACKGROUND,\n NAVIGATION_MOBILE_FLYOUT_INNER_BACKGROUND\n} from \"../../constants/global-constants\";\n// import { InitLogging } from \"../../decorators/init-logging\";\n\n/**\n * @slot [meta] - holds eon-ui-meta-navigation.\n * @slot [toolbar] - holds eon-ui-toolbar-navigation.\n * @slot [main] - holds eon-ui-meta-navigation.\n * @slot [extension] - holds any further navigation and puts it to the bottom of the container.\n */\n@Component({\n tag: \"eon-ui-navigation\",\n styleUrl: \"navigation.scss\",\n shadow: true\n})\nexport class Navigation {\n // @InitLogging() sentryTransaction;\n metaHeight = 46;\n toolbarHeight = 72;\n mainHeight = 64;\n\n scrollTimeout;\n resizeTimeout;\n mainWrapperTimeout;\n toolbarWrapperTimeout;\n mouseLeaveTimeout;\n\n lastScrollTop = 0;\n\n hasMetaNavigation: boolean;\n hasToolbarNavigation: boolean;\n hasMainNavigation: boolean;\n hasExtension: boolean;\n\n toolbarNavigation;\n toolbarChilds;\n activeToolbarSubContainer;\n toolbarLinks;\n\n mainNavigation;\n mainChilds;\n mainStandardChilds;\n mainIconChilds;\n mainLinks;\n mainIconLinks;\n mainSubWrapper;\n activeMainSubContainer;\n\n burgerPosition: BurgerPosition = NAVIGATION_MAIN_BURGERPOSITION_LEFT;\n mobileSubChilds;\n activeMobileSubContainer;\n\n mobileNavigationPadding = 0;\n mobileNavigationPaddingSticky = 0;\n\n @State() currentScrollDirection: string = \"up\";\n @State() isToolbarSubOpen: boolean = false;\n @State() toolbarSubHeight: number;\n @State() isMainSubWrapperOpen: boolean = false;\n @State() isMainSubOpen: boolean = false;\n @State() mainSubHeight: number;\n @State() navigationWrapper: HTMLElement;\n @State() mobileNavigation: HTMLElement;\n @State() mobileSubNavigation: HTMLElement;\n @State() mobileWrapper: HTMLElement;\n @State() mobileMainNavigation: HTMLElement;\n @State() isMobileNavOpen: boolean = false;\n\n @Element() hostElement: HTMLEonUiNavigationElement;\n\n /**\n * Activate fixed positioning and sticky behaviour.\n */\n @Prop() sticky: boolean = true;\n\n /**\n * Defines which navigation sections should stay visible when scrolling down.\n */\n @Prop() stickyLevel: StickyLevel;\n\n /**\n * Method to evaluate the component height\n */\n @Method()\n async updateNavigationHeight() {\n // We could not use this.hostElement because if sticky-true, the height is 0\n // navigationWrapper delivers always the height, independent of sticky\n return await this.navigationWrapper.getBoundingClientRect().height;\n }\n\n /**\n * Open toolbar sub navigation wrapper and show related part\n */\n @Method()\n async openToolbarSub(rel: string, keyboard: boolean = false) {\n clearTimeout(this.toolbarWrapperTimeout);\n this.deactivateToolbarLinks();\n this.closeMainSub();\n this.isMobileNavOpen && this.closeMobileNav();\n this.isMainSubOpen && this.closeMainSub();\n this.activeToolbarSubContainer = this.hostElement.querySelector(`#${rel}`) as HTMLElement;\n\n if (this.activeToolbarSubContainer) {\n this.isToolbarSubOpen = true;\n this.showToolbarSub();\n if (!!keyboard) this.initSubKeyboardNav(this.activeToolbarSubContainer);\n }\n }\n\n /**\n * Close toolbar sub navigation wrapper\n */\n @Method()\n async closeToolbarSub() {\n clearTimeout(this.toolbarWrapperTimeout);\n this.deactivateToolbarLinks();\n this.isToolbarSubOpen = false;\n this.toolbarWrapperTimeout = setTimeout(() => {\n if (this.activeToolbarSubContainer) this.activeToolbarSubContainer.style.display = \"none\";\n }, 800);\n }\n\n /**\n * Open main sub navigation wrapper and show related part\n */\n @Method()\n async openMainSub(rel: string, keyboard: boolean = false) {\n clearTimeout(this.mainWrapperTimeout);\n this.deactivateMainLinks();\n this.deactivateMainIconLinks();\n this.isMobileNavOpen && this.closeMobileNav();\n this.isToolbarSubOpen && this.closeToolbarSub();\n this.activeMainSubContainer = this.hostElement.querySelector(`#${rel}`) as HTMLElement;\n\n if (this.activeMainSubContainer) {\n this.isMainSubOpen = true;\n this.isMainSubWrapperOpen = true;\n this.showMainSub();\n if (!!keyboard) this.initSubKeyboardNav(this.activeMainSubContainer);\n }\n }\n\n /**\n * Close main sub navigation wrapper\n */\n @Method()\n async closeMainSub() {\n clearTimeout(this.mainWrapperTimeout);\n this.deactivateMainLinks();\n this.deactivateMainIconLinks();\n this.isMainSubOpen = false;\n this.mainWrapperTimeout = setTimeout(() => {\n this.isMainSubWrapperOpen = false;\n if (this.activeMainSubContainer) this.activeMainSubContainer.style.display = \"none\";\n }, 400);\n }\n\n /**\n * Open mobile nav\n */\n @Method()\n async openMobileNav() {\n this.closeMobileSub();\n this.isMainSubOpen && this.closeMainSub();\n this.isToolbarSubOpen && this.closeToolbarSub();\n this.mobileWrapper.classList.add(\"act\");\n this.isMobileNavOpen = true;\n this.mainNavigation.burgerActive = true;\n }\n\n /**\n * Close mobile nav\n */\n @Method()\n async closeMobileNav() {\n this.deactivateMainIconLinks();\n this.mobileWrapper.classList.remove(\"act\");\n this.isMobileNavOpen = false;\n this.mainNavigation.burgerActive = false;\n setTimeout(() => {\n this.closeMobileSub();\n }, 400);\n }\n\n /**\n * Open mobile sub navigation wrapper and show related part\n */\n @Method()\n async openMobileSub(rel: string) {\n this.activeMobileSubContainer = this.mobileWrapper.querySelector(`#mobile-${rel}`) as HTMLElement;\n this.showMobileSub();\n }\n\n /**\n * Open mobile sub navigation wrapper and show related part\n */\n @Method()\n async openMobileSubImmediately(rel: string) {\n this.mainNavigation.burgerActive = false;\n this.closeMobileSub();\n this.activeMobileSubContainer = this.mobileWrapper.querySelector(`#mobile-${rel}`) as HTMLElement;\n this.isMainSubOpen && this.closeMainSub();\n this.isToolbarSubOpen && this.closeToolbarSub();\n this.mobileWrapper.classList.add(\"act\");\n this.isMobileNavOpen = true;\n this.showMobileSubImmediately();\n }\n\n /**\n * Close mobile sub navigation wrapper\n */\n @Method()\n async closeMobileSub() {\n this.deactivateMainIconLinks();\n this.mobileSubChilds.forEach((element: HTMLElement) => {\n element.classList.remove(\"act\");\n element.querySelector(\".mobile-secondary-nav-inner\").scrollTop = 0;\n });\n this.mobileMainNavigation.scrollTop = 0;\n this.mobileMainNavigation.classList.remove(\"scale\"); //why does this even work?\n }\n\n @Listen(\"scroll\", { target: \"window\" })\n detectScrollDirection() {\n if (this.sticky) {\n clearTimeout(this.scrollTimeout);\n this.scrollTimeout = setTimeout(() => {\n if (!isTouchDevice()) {\n let st = window.pageYOffset || document.documentElement.scrollTop;\n if (st > 128 && st > this.lastScrollTop) {\n this.currentScrollDirection = \"down\";\n } else {\n this.currentScrollDirection = \"up\";\n }\n\n this.lastScrollTop = st <= 0 ? 0 : st; // For Mobile or negative scrolling\n } else {\n if (document.documentElement.scrollTop > 128) {\n this.currentScrollDirection = \"down\";\n } else {\n setTimeout(() => {\n this.currentScrollDirection = \"up\";\n }, 500);\n }\n }\n }, 50);\n }\n }\n\n @Listen(\"resize\", { target: \"window\" })\n closeNavigationsOnResize() {\n if (this.isToolbarSubOpen || this.isMainSubOpen) {\n clearTimeout(this.resizeTimeout);\n this.resizeTimeout = setTimeout(() => {\n this.closeToolbarSub();\n this.closeMainSub();\n }, 100);\n }\n }\n\n componentWillLoad() {\n this.getNavigationStructure();\n this.calcMobileNavigationPadding();\n this.toolbarNavigation = this.hostElement.querySelector('[slot=\"toolbar\"]');\n this.toolbarChilds = this.hostElement.querySelectorAll('[slot=\"toolbar-sub\"]');\n this.toolbarLinks = this.hostElement.querySelectorAll(\"eon-ui-navigation-toolbar-icon-link\");\n this.mainNavigation = this.hostElement.querySelector('[slot=\"main\"]');\n this.mainChilds = this.hostElement.querySelectorAll('[slot=\"main-sub\"], [slot=\"main-icon-sub\"]');\n this.mainStandardChilds = this.hostElement.querySelectorAll('[slot=\"main-sub\"]');\n this.mainIconChilds = this.hostElement.querySelectorAll('[slot=\"main-icon-sub\"]');\n this.mainLinks = this.hostElement.querySelectorAll(\"eon-ui-navigation-main-link\");\n this.mainIconLinks = this.hostElement.querySelectorAll(\"eon-ui-navigation-main-icon-link\");\n this.setParentNavTypeDataAttributeToFlyoutLink();\n this.setInnerBackgroundToSubs();\n }\n\n componentDidLoad() {\n this.mainSubWrapper && this.initMainSubFunctionality();\n this.createMainMobileNavigation();\n this.mobileSubChilds = this.mobileWrapper?.querySelectorAll(\".mobile-secondary-nav\");\n this.setCssVariables();\n }\n\n /**\n * Adds type of parent navigation to flyout link. This is needed for tracking.\n */\n setParentNavTypeDataAttributeToFlyoutLink() {\n // set parent navigation type for toolbar flyout links\n this.toolbarChilds.forEach((toolbarChild) => {\n toolbarChild.querySelectorAll(\"eon-ui-navigation-flyout-link\").forEach((link) => {\n link.dataset.parentNavigationType = \"toolbar\";\n });\n });\n\n // set parent navigation type for main flyout links\n this.mainChilds.forEach((mainChild) => {\n mainChild.querySelectorAll(\"eon-ui-navigation-flyout-link\").forEach((link) => {\n link.dataset.parentNavigationType = \"main\";\n });\n });\n }\n\n setInnerBackgroundToSubs() {\n this.toolbarChilds.forEach((child: HTMLElement) => {\n child.setAttribute(\"inner-background\", NAVIGATION_TOOLBAR_FLYOUT_INNER_BACKGROUND);\n });\n\n this.mainChilds.forEach((child: HTMLElement) => {\n child.setAttribute(\"inner-background\", NAVIGATION_MAIN_FLYOUT_INNER_BACKGROUND);\n });\n }\n\n showToolbarSub() {\n this.toolbarChilds.forEach((element: HTMLElement) => {\n element.style.display = \"none\";\n });\n\n this.activeToolbarSubContainer.style.display = \"block\";\n this.setToolbarSubHeight();\n }\n\n showMainSub() {\n this.mainChilds.forEach((element: HTMLElement) => {\n element.style.display = \"none\";\n });\n\n this.activeMainSubContainer.style.display = \"block\";\n\n this.setMainSubHeight();\n }\n\n showMobileSub() {\n this.activeMobileSubContainer.classList.add(\"act\");\n this.mobileMainNavigation.classList.add(\"scale\");\n }\n\n showMobileSubImmediately() {\n this.activeMobileSubContainer.classList.add(\"no-animation\");\n this.activeMobileSubContainer.classList.add(\"act\");\n this.mobileMainNavigation.classList.add(\"scale\");\n }\n\n initSubKeyboardNav(activeSubContainer: HTMLElement) {\n let subItems = Array.prototype.slice.call(activeSubContainer.querySelectorAll(\"*\"));\n let firstFocusableItem: HTMLElement;\n let lastFocusableItem: HTMLElement;\n\n subItems.forEach((element) => {\n if (element.hasAttribute(\"tabindex\")) {\n if (!firstFocusableItem) firstFocusableItem = element;\n lastFocusableItem = element;\n } else {\n if (element.shadowRoot) {\n let focusableElement = element.shadowRoot.querySelector(\"[tabindex]\");\n if (!!focusableElement) {\n if (!firstFocusableItem) firstFocusableItem = focusableElement;\n lastFocusableItem = focusableElement;\n }\n }\n }\n });\n\n if (!!firstFocusableItem) firstFocusableItem.focus();\n if (!!firstFocusableItem && !!lastFocusableItem)\n this.exitSecondaryNavViaKey(firstFocusableItem, lastFocusableItem, activeSubContainer);\n }\n\n exitSecondaryNavViaKey(firstChild: HTMLElement, lastChild: HTMLElement, activeSubContainer: HTMLElement) {\n if (!firstChild.classList.contains(\"event-listener\")) {\n firstChild.classList.add(\"event-listener\");\n firstChild.addEventListener(\"keydown\", (e) => {\n switch (e.key) {\n case KeyIds.TAB:\n if (e.shiftKey) {\n e.preventDefault();\n this.closeMainSub();\n let relatedLink = document.querySelector(\n `[sub-nav-rel=\"${activeSubContainer.getAttribute(\"id\")}\"]`\n ) as HTMLElement;\n (relatedLink.shadowRoot.querySelector(\"[tabindex]\") as HTMLElement)?.focus();\n }\n break;\n default:\n break;\n }\n });\n }\n\n if (!lastChild.classList.contains(\"event-listener\")) {\n lastChild.classList.add(\"event-listener\");\n lastChild.addEventListener(\"keydown\", (e) => {\n switch (e.key) {\n case KeyIds.TAB:\n if (!e.shiftKey) {\n e.preventDefault();\n this.closeMainSub();\n let relatedLink = document.querySelector(\n `[sub-nav-rel=\"${this.activeMainSubContainer.getAttribute(\"id\")}\"]`\n ) as HTMLElement;\n (relatedLink.shadowRoot.querySelector(\"[tabindex]\") as HTMLElement)?.focus();\n }\n break;\n default:\n break;\n }\n });\n }\n }\n\n getNavigationStructure() {\n this.hasMetaNavigation = !!this.hostElement.querySelector('[slot=\"meta\"]');\n this.hasToolbarNavigation = !!this.hostElement.querySelector('[slot=\"toolbar\"]');\n this.hasMainNavigation = !!this.hostElement.querySelector('[slot=\"main\"]');\n this.hasExtension = !!this.hostElement.querySelector('[slot=\"extension\"]');\n }\n\n @Watch(\"sticky\")\n @Watch(\"stickyLevel\")\n calcMobileNavigationPadding() {\n this.hasMetaNavigation && (this.mobileNavigationPadding += this.metaHeight);\n // this.hasToolbarNavigation && (mobileNavigationPadding += this.toolbarHeight);\n this.hasMainNavigation && (this.mobileNavigationPadding += this.mainHeight);\n\n switch (this.stickyLevel) {\n case NAVIGATION_STICKYSLEVEL_META:\n this.mobileNavigationPaddingSticky = this.mobileNavigationPadding;\n break;\n case NAVIGATION_STICKYSLEVEL_TOOLBAR:\n this.mobileNavigationPaddingSticky =\n this.mobileNavigationPadding - (this.hasMetaNavigation ? this.metaHeight : 0);\n break;\n case NAVIGATION_STICKYSLEVEL_MAIN:\n this.mobileNavigationPaddingSticky =\n /* mobileNavigationPadding -\n (this.hasMetaNavigation ? this.metaHeight : 0) -\n (this.hasToolbarNavigation ? this.toolbarHeight : 0); */\n this.mobileNavigationPadding - (this.hasMetaNavigation ? this.metaHeight : 0);\n break;\n }\n }\n\n setCssVariables(): void {\n setCssVariable(this.hostElement, \"--mobileNavigationPadding\", `${this.mobileNavigationPadding}px`);\n setCssVariable(this.hostElement, \"--mobileNavigationPaddingSticky\", `${this.mobileNavigationPaddingSticky}px`);\n }\n\n setToolbarSubHeight() {\n this.toolbarSubHeight = this.activeToolbarSubContainer.getBoundingClientRect().height + 64; // 64: padding-top and -bottom of parent container + space\n }\n\n setMainSubHeight() {\n this.mainSubHeight = this.activeMainSubContainer.getBoundingClientRect().height + 64 + 10; // 64: padding-top and -bottom of parent container + space\n }\n\n deactivateMainLinks() {\n this.mainLinks.forEach((item: HTMLEonUiNavigationMainLinkElement) => {\n item.removeActiveState();\n });\n }\n\n deactivateMainIconLinks() {\n this.mainIconLinks.forEach((item: HTMLEonUiNavigationMainIconLinkElement) => {\n item.removeActiveState();\n });\n }\n\n deactivateToolbarLinks() {\n this.toolbarLinks.forEach((item: HTMLEonUiNavigationToolbarIconLinkElement) => {\n item.removeActiveState();\n });\n }\n\n initMainSubFunctionality() {\n /*\n * Init secondary navigation mouse leave function\n * Closes secondary navigation after mouse leave at the bottom (400ms)\n */\n this.mainSubWrapper.addEventListener(\"mouseleave\", (mouse) => {\n if (this.closestEdge(mouse, this.mainSubWrapper) !== \"top\") {\n this.mouseLeaveTimeout = setTimeout(() => {\n this.closeMainSub();\n }, 400);\n }\n });\n\n /*\n * Init secondary navigation mouse enter function\n * Interrupts mouse leave function if reentering navigation (400ms)\n */\n this.mainSubWrapper.addEventListener(\"mouseenter\", () => {\n if (this.mouseLeaveTimeout) {\n clearTimeout(this.mouseLeaveTimeout);\n }\n });\n }\n\n /**\n * Loop through the columns which should be available for mobile navigation\n * and append them to the mobile navigation div\n */\n private createMainMobileNavigation() {\n if (this.hasMainNavigation) {\n // this.mainNavigation = this.hostElement.querySelector('[slot=\"main\"]');\n\n if (this.mainNavigation.hasAttribute(\"burger-position\")) {\n this.burgerPosition = this.mainNavigation.getAttribute(\"burger-position\") as BurgerPosition;\n }\n\n this.mobileWrapper.classList.add(`from-${this.burgerPosition}`);\n }\n }\n\n private createMobileMain() {\n const mainNavigationChilds: HTMLElement[] = [];\n const toolbarNavigationChilds: HTMLElement[] = [];\n\n this.mainNavigation?.querySelectorAll(\"eon-ui-navigation-main-link\")?.forEach((element) => {\n const item = element.cloneNode(true) as HTMLElement;\n item.setAttribute(\"mobile\", \"true\");\n mainNavigationChilds.push(item);\n });\n\n this.toolbarNavigation?.querySelectorAll(\"eon-ui-navigation-toolbar-icon-link\")?.forEach((element) => {\n const item = element.cloneNode(true) as HTMLElement;\n item.setAttribute(\"mobile\", \"true\");\n toolbarNavigationChilds.push(item);\n });\n\n return (\n