nsw-design-system 3.9.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js/main.js
CHANGED
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
this.openSubNavButtons = document.querySelectorAll('.js-open-sub-nav');
|
|
148
148
|
this.closeSubNavButtons = document.querySelectorAll('.js-close-sub-nav');
|
|
149
149
|
this.mainNavElement = document.getElementById('main-nav');
|
|
150
|
+
this.mainNavIsOpen = false;
|
|
150
151
|
this.isMegaMenuElement = !!document.querySelector('.js-mega-menu');
|
|
151
152
|
this.transitionEvent = whichTransitionEvent();
|
|
152
153
|
this.mobileToggleMainNavEvent = e => this.mobileToggleMainNav(e);
|
|
@@ -180,11 +181,10 @@
|
|
|
180
181
|
document.removeEventListener('click', this.outsideClickEvent, false);
|
|
181
182
|
}
|
|
182
183
|
handleOutsideClick(event) {
|
|
184
|
+
if (!this.mainNavIsOpen) return;
|
|
183
185
|
const isOutsideNav = !this.mainNavElement.contains(event.target);
|
|
184
186
|
if (isOutsideNav) {
|
|
185
|
-
this.saveElements(event);
|
|
186
187
|
this.toggleSubNavDesktop(true);
|
|
187
|
-
event.preventDefault();
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
responsiveCheck(e) {
|
|
@@ -383,8 +383,10 @@
|
|
|
383
383
|
} = this.whichSubNavLatest();
|
|
384
384
|
const isExpanded = link.getAttribute('aria-expanded') === 'true';
|
|
385
385
|
if (isExpanded) {
|
|
386
|
+
this.mainNavIsOpen = false;
|
|
386
387
|
this.closeSubNav();
|
|
387
388
|
} else {
|
|
389
|
+
this.mainNavIsOpen = true;
|
|
388
390
|
this.openSubNav();
|
|
389
391
|
}
|
|
390
392
|
}
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ class Navigation {
|
|
|
9
9
|
this.openSubNavButtons = document.querySelectorAll('.js-open-sub-nav')
|
|
10
10
|
this.closeSubNavButtons = document.querySelectorAll('.js-close-sub-nav')
|
|
11
11
|
this.mainNavElement = document.getElementById('main-nav')
|
|
12
|
+
this.mainNavIsOpen = false
|
|
12
13
|
this.isMegaMenuElement = !!document.querySelector('.js-mega-menu')
|
|
13
14
|
this.transitionEvent = whichTransitionEvent()
|
|
14
15
|
this.mobileToggleMainNavEvent = (e) => this.mobileToggleMainNav(e)
|
|
@@ -46,12 +47,12 @@ class Navigation {
|
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
handleOutsideClick(event) {
|
|
50
|
+
if (!this.mainNavIsOpen) return
|
|
51
|
+
|
|
49
52
|
const isOutsideNav = !this.mainNavElement.contains(event.target)
|
|
50
53
|
|
|
51
54
|
if (isOutsideNav) {
|
|
52
|
-
this.saveElements(event)
|
|
53
55
|
this.toggleSubNavDesktop(true)
|
|
54
|
-
event.preventDefault()
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -243,8 +244,10 @@ class Navigation {
|
|
|
243
244
|
const { link } = this.whichSubNavLatest()
|
|
244
245
|
const isExpanded = link.getAttribute('aria-expanded') === 'true'
|
|
245
246
|
if (isExpanded) {
|
|
247
|
+
this.mainNavIsOpen = false
|
|
246
248
|
this.closeSubNav()
|
|
247
249
|
} else {
|
|
250
|
+
this.mainNavIsOpen = true
|
|
248
251
|
this.openSubNav()
|
|
249
252
|
}
|
|
250
253
|
}
|