@1024pix/pix-ui 55.31.2 → 55.32.0

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.
@@ -21,7 +21,7 @@
21
21
  </header>
22
22
  <nav
23
23
  class="pix-navigation__nav"
24
- {{on "click" this.handleNavigationClick}}
24
+ {{on "click" this.closeNavigation}}
25
25
  aria-label={{@navigationAriaLabel}}
26
26
  id={{this.navigationId}}
27
27
  >
@@ -1,10 +1,13 @@
1
1
  import { warn } from '@ember/debug';
2
2
  import { action } from '@ember/object';
3
3
  import { guidFor } from '@ember/object/internals';
4
+ import { inject as service } from '@ember/service';
4
5
  import Component from '@glimmer/component';
5
6
  import { tracked } from '@glimmer/tracking';
6
7
 
7
8
  export default class PixMNavigation extends Component {
9
+ @service router;
10
+
8
11
  constructor(...args) {
9
12
  super(...args);
10
13
  this._navigationId = 'navigation-' + guidFor(this);
@@ -23,11 +26,18 @@ export default class PixMNavigation extends Component {
23
26
  @action
24
27
  toggleNavigationMenu() {
25
28
  this.navigationMenuOpened = !this.navigationMenuOpened;
29
+
30
+ if (this.navigationMenuOpened) {
31
+ this.router.on('routeDidChange', this.closeNavigation);
32
+ } else {
33
+ this.router.off('routeDidChange', this.closeNavigation);
34
+ }
26
35
  }
27
36
 
28
37
  @action
29
- handleNavigationClick() {
38
+ closeNavigation() {
30
39
  this.navigationMenuOpened = false;
40
+ this.router.off('routeDidChange', this.closeNavigation);
31
41
  }
32
42
 
33
43
  get navigationId() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1024pix/pix-ui",
3
- "version": "55.31.2",
3
+ "version": "55.32.0",
4
4
  "description": "Pix-UI is the implementation of Pix design principles and guidelines for its products.",
5
5
  "keywords": [
6
6
  "ember-addon"