@ons/design-system 48.0.1 → 49.0.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.
@@ -5,10 +5,10 @@ import onViewportChange from '../../js/utils/viewport-change';
5
5
  const attrExpanded = 'aria-expanded';
6
6
  const attrHidden = 'aria-hidden';
7
7
 
8
- export default class NavToggle {
9
- constructor(toggle, nav, hideClass) {
8
+ export default class NavigationToggle {
9
+ constructor(toggle, navigation, hideClass) {
10
10
  this.toggle = toggle;
11
- this.nav = nav;
11
+ this.navigation = navigation;
12
12
  this.hideClass = hideClass;
13
13
  this.toggle.classList.remove('ons-u-d-no');
14
14
  this.setAria();
@@ -20,17 +20,17 @@ export default class NavToggle {
20
20
  }
21
21
 
22
22
  toggleNav() {
23
- const isHidden = this.nav.getAttribute(attrHidden);
23
+ const isHidden = this.navigation.getAttribute(attrHidden);
24
24
  isHidden === 'false' ? this.closeNav() : this.openNav();
25
25
  }
26
26
 
27
27
  openNav() {
28
- const input = [...this.nav.getElementsByTagName('INPUT')][0];
28
+ const input = [...this.navigation.getElementsByTagName('INPUT')][0];
29
29
 
30
30
  this.toggle.setAttribute(attrExpanded, 'true');
31
31
  this.toggle.classList.add('active');
32
- this.nav.setAttribute(attrHidden, 'false');
33
- this.nav.classList.remove(this.hideClass);
32
+ this.navigation.setAttribute(attrHidden, 'false');
33
+ this.navigation.classList.remove(this.hideClass);
34
34
 
35
35
  if (input) {
36
36
  input.focus();
@@ -40,23 +40,23 @@ export default class NavToggle {
40
40
  closeNav() {
41
41
  this.toggle.setAttribute(attrExpanded, 'false');
42
42
  this.toggle.classList.remove('active');
43
- this.nav.setAttribute(attrHidden, 'true');
44
- this.nav.classList.add(this.hideClass);
43
+ this.navigation.setAttribute(attrHidden, 'true');
44
+ this.navigation.classList.add(this.hideClass);
45
45
  }
46
46
 
47
47
  setAria() {
48
48
  const viewportDetails = GetViewportDetails();
49
- const hasAria = this.nav.hasAttribute(attrHidden);
49
+ const hasAria = this.navigation.hasAttribute(attrHidden);
50
50
 
51
- if (viewportDetails.width < 740) {
51
+ if (viewportDetails.width < 980) {
52
52
  if (!hasAria) {
53
53
  this.closeNav();
54
54
  }
55
55
  } else if (hasAria) {
56
56
  this.toggle.removeAttribute(attrExpanded);
57
- this.nav.removeAttribute(attrHidden);
57
+ this.navigation.removeAttribute(attrHidden);
58
58
  if (this.hideClass !== 'ons-u-d-no') {
59
- this.nav.classList.remove(this.hideClass);
59
+ this.navigation.classList.remove(this.hideClass);
60
60
  } else {
61
61
  this.closeNav();
62
62
  }
@@ -1,6 +1,6 @@
1
1
  {% macro onsSectionNavigation(params) %}
2
2
  <nav class="ons-section-nav{% if params.variants is defined and params.variants == 'vertical' %} ons-section-nav--vertical{% endif %}" id="{{ params.id }}" aria-label="{{ params.ariaLabel | default("Section menu") }}">
3
- <ul class="ons-section-nav__list" aria-label="{{ params.ariaListLabel | default("Section menu links") }}">
3
+ <ul class="ons-section-nav__list">
4
4
  {% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) %}
5
5
  <li class="ons-section-nav__item {{ item.classes }}{{ ' ons-section-nav__item--active' if (item.url == params.currentPath) or (item.url in params.currentPath) or (params.tabQuery == item.title|lower) }}">
6
6
  <a class="ons-section-nav__link" href="{{ item.url }}" {% if (item.url == params.currentPath) or (item.url in params.currentPath) or (params.tabQuery == item.title|lower) %} aria-current="location" {% endif %}>{{ item.title }}</a>