@ons/design-system 65.0.0 → 65.2.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.
Files changed (77) hide show
  1. package/components/access-code/access-code.scss +3 -3
  2. package/components/address-input/autosuggest.address.error.js +1 -1
  3. package/components/address-input/autosuggest.address.js +2 -2
  4. package/components/address-input/autosuggest.address.spec.js +5 -5
  5. package/components/autosuggest/_autosuggest.scss +9 -9
  6. package/components/autosuggest/_macro.njk +30 -31
  7. package/components/autosuggest/_macro.spec.js +18 -18
  8. package/components/autosuggest/autosuggest.spec.js +31 -31
  9. package/components/autosuggest/autosuggest.ui.js +8 -9
  10. package/components/button/_button.scss +11 -14
  11. package/components/card/_card.scss +14 -0
  12. package/components/card/_macro.njk +7 -8
  13. package/components/checkboxes/_checkbox.scss +1 -4
  14. package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +88 -0
  15. package/components/checkboxes/example-checkboxes-with-revealed-radios-expanded.njk +70 -0
  16. package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +72 -0
  17. package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +60 -0
  18. package/components/content-pagination/_content-pagination.scss +1 -1
  19. package/components/document-list/_macro.njk +5 -7
  20. package/components/document-list/_macro.spec.js +2 -2
  21. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  22. package/components/document-list/example-document-list-search-results.njk +3 -3
  23. package/components/download-resources/_download-resources.scss +3 -5
  24. package/components/external-link/example-external-link.njk +1 -1
  25. package/components/fieldset/_fieldset.scss +1 -1
  26. package/components/header/_macro.njk +4 -4
  27. package/components/header/example-header-external-with-navigation.njk +5 -5
  28. package/components/header/example-header-external-with-service-links.njk +3 -3
  29. package/components/header/example-header-external-with-sub-navigation.njk +10 -10
  30. package/components/header/example-header-internal.njk +2 -2
  31. package/components/header/example-header-neutral-for-multicoloured-logo.njk +6 -6
  32. package/components/helpers/_grid.scss +6 -0
  33. package/components/helpers/grid.njk +19 -0
  34. package/components/input/_input-type.scss +2 -8
  35. package/components/input/_input.scss +4 -3
  36. package/components/list/_list.scss +5 -2
  37. package/components/list/_macro.njk +22 -10
  38. package/components/list/_macro.spec.js +42 -0
  39. package/components/modal/_modal.scss +3 -6
  40. package/components/navigation/_macro.njk +6 -6
  41. package/components/navigation/_macro.spec.js +4 -4
  42. package/components/navigation/navigation.js +6 -2
  43. package/components/pagination/_macro.njk +17 -2
  44. package/components/pagination/_pagination.scss +14 -0
  45. package/components/phase-banner/example-phase-banner-alpha.njk +13 -2
  46. package/components/phase-banner/example-phase-banner-beta.njk +13 -2
  47. package/components/question/example-question-interviewer-note.njk +1 -1
  48. package/components/radios/example-radios-with-clear-button-expanded.njk +98 -0
  49. package/components/radios/example-radios-with-revealed-checkboxes-expanded.njk +70 -0
  50. package/components/radios/example-radios-with-revealed-radios-expanded.njk +69 -0
  51. package/components/radios/example-radios-with-revealed-select-expanded.njk +70 -0
  52. package/components/radios/example-radios-with-revealed-text-input-expanded.njk +81 -0
  53. package/components/relationships/_macro.spec.js +9 -11
  54. package/components/relationships/example-relationships-error.njk +28 -28
  55. package/components/relationships/example-relationships-you.njk +29 -29
  56. package/components/relationships/example-relationships.njk +28 -28
  57. package/components/relationships/relationships.spec.js +13 -13
  58. package/components/reply/_macro.njk +5 -2
  59. package/components/reply/_macro.spec.js +7 -1
  60. package/components/section-navigation/_macro.njk +2 -1
  61. package/components/section-navigation/_macro.spec.js +2 -13
  62. package/components/table/_table.scss +7 -3
  63. package/components/tabs/_macro.njk +5 -5
  64. package/components/tabs/_macro.spec.js +1 -1
  65. package/components/tabs/example-tabs-details.njk +3 -0
  66. package/components/tabs/example-tabs.njk +0 -1
  67. package/components/textarea/example-textarea-error.njk +4 -4
  68. package/css/main.css +3 -3
  69. package/css/print.css +1 -1
  70. package/js/cookies-settings.js +1 -1
  71. package/package.json +27 -30
  72. package/scripts/main.es5.js +1 -1
  73. package/scripts/main.js +1 -1
  74. package/scss/base/_global.scss +3 -2
  75. package/scss/main.scss +1 -0
  76. package/scss/overrides/hcm.scss +14 -14
  77. package/scss/print.scss +1 -1
@@ -102,9 +102,9 @@
102
102
  href="{{ item.url }}"
103
103
  class="ons-header-service-nav__link"
104
104
  {% if item.id %} id="{{ item.id }}"{% endif %}
105
- >{{ item.title }}</a>
105
+ >{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
106
106
  {% else %}
107
- {{ item.title }}
107
+ {% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}
108
108
  {% endif %}
109
109
  </li>
110
110
  {% endfor %}
@@ -153,9 +153,9 @@
153
153
  href="{{ item.url }}"
154
154
  class="ons-header-service-nav__link"
155
155
  {% if item.id %} id="{{ item.id }}"{% endif %}
156
- >{{ item.title }}</a>
156
+ >{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
157
157
  {% else %}
158
- {{ item.title }}
158
+ {% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}
159
159
  {% endif %}
160
160
  </li>
161
161
  {% endfor %}
@@ -13,23 +13,23 @@
13
13
  "currentPath": '#home',
14
14
  "itemsList": [
15
15
  {
16
- "title": 'Home',
16
+ "text": 'Home',
17
17
  "url": '#home'
18
18
  },
19
19
  {
20
- "title": 'Guidance',
20
+ "text": 'Guidance',
21
21
  "url": '#0'
22
22
  },
23
23
  {
24
- "title": 'Foundations',
24
+ "text": 'Foundations',
25
25
  "url": '#0'
26
26
  },
27
27
  {
28
- "title": 'Components',
28
+ "text": 'Components',
29
29
  "url": '#0'
30
30
  },
31
31
  {
32
- "title": 'Patterns',
32
+ "text": 'Patterns',
33
33
  "url": '#0'
34
34
  }
35
35
  ],
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "itemsList": [
20
20
  {
21
- "title": "Help",
21
+ "text": "Help",
22
22
  "url": "#0"
23
23
  },
24
24
  {
25
- "title": "My Account",
25
+ "text": "My Account",
26
26
  "url": "#0"
27
27
  },
28
28
  {
29
- "title": "Sign out",
29
+ "text": "Sign out",
30
30
  "url": "#0"
31
31
  }
32
32
  ]
@@ -15,29 +15,29 @@
15
15
  "currentPageTitle": 'Design system',
16
16
  "itemsList": [
17
17
  {
18
- "title": 'Service standard',
18
+ "text": 'Service standard',
19
19
  "url": '#0'
20
20
  },
21
21
  {
22
- "title": 'Design system',
22
+ "text": 'Design system',
23
23
  "url": '#design-system'
24
24
  },
25
25
  {
26
- "title": 'Accessibility',
26
+ "text": 'Accessibility',
27
27
  "url": '#0'
28
28
  },
29
29
  {
30
- "title": 'Brand guidelines',
30
+ "text": 'Brand guidelines',
31
31
  "url": '#0'
32
32
  },
33
33
  {
34
- "title": 'Content style guide',
34
+ "text": 'Content style guide',
35
35
  "url": '#0'
36
36
  }
37
37
  ],
38
38
  "toggleNavigationButton": {
39
39
  "text": 'Menu',
40
- "ariaLabel": 'Toggle main menu'
40
+ "ariaLabel": 'Toggle menu'
41
41
  },
42
42
  "subNavigation": {
43
43
  "id": 'sub-nav',
@@ -46,19 +46,19 @@
46
46
  "ariaLabel": 'Section menu',
47
47
  "itemsList": [
48
48
  {
49
- "title": 'Guidance',
49
+ "text": 'Guidance',
50
50
  "url": '#0'
51
51
  },
52
52
  {
53
- "title": 'Foundations',
53
+ "text": 'Foundations',
54
54
  "url": '#0'
55
55
  },
56
56
  {
57
- "title": 'Components',
57
+ "text": 'Components',
58
58
  "url": '#0'
59
59
  },
60
60
  {
61
- "title": 'Patterns',
61
+ "text": 'Patterns',
62
62
  "url": '#patterns',
63
63
  "sections": [
64
64
  {
@@ -19,11 +19,11 @@
19
19
  },
20
20
  "itemsList": [
21
21
  {
22
- "title": "Jacky Turner",
22
+ "text": "Jacky Turner",
23
23
  "iconType": 'person'
24
24
  },
25
25
  {
26
- "title": "Sign out",
26
+ "text": "Sign out",
27
27
  "url": "#0"
28
28
  }
29
29
  ]
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "itemsList": [
20
20
  {
21
- "title": "Help",
21
+ "text": "Help",
22
22
  "url": "#0"
23
23
  },
24
24
  {
25
- "title": "My Account",
25
+ "text": "My Account",
26
26
  "url": "#0"
27
27
  },
28
28
  {
29
- "title": "Sign out",
29
+ "text": "Sign out",
30
30
  "url": "#0"
31
31
  }
32
32
  ]
@@ -38,15 +38,15 @@
38
38
  "currentPageTitle": 'Design system',
39
39
  "itemsList": [
40
40
  {
41
- "title": 'Menu item 1',
41
+ "text": 'Menu item 1',
42
42
  "url": '#0'
43
43
  },
44
44
  {
45
- "title": 'Menu item 2',
45
+ "text": 'Menu item 2',
46
46
  "url": '#menu-item-2'
47
47
  },
48
48
  {
49
- "title": 'Menu item 3',
49
+ "text": 'Menu item 3',
50
50
  "url": '#0'
51
51
  }
52
52
  ],
@@ -0,0 +1,6 @@
1
+ .ons-pl-grid-col {
2
+ background: var(--ons-color-grey-5);
3
+ font-size: 0.8rem;
4
+ margin: 0 0 1rem;
5
+ padding: 1rem;
6
+ }
@@ -0,0 +1,19 @@
1
+ {% macro patternLibExampleGrid(params) %}
2
+ {% if params.container -%}
3
+ <div class="ons-container">
4
+ {% endif -%}
5
+
6
+ <div class="ons-grid">
7
+ {% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) -%}
8
+ {% for i in range(0, item.repeat | default(1) ) -%}
9
+ <div class="ons-grid__col ons-col-{{ item.col }}@m {{ item.classes }}">
10
+ <div class="ons-pl-grid-col">{{ item.col }} col</div>
11
+ </div>
12
+ {%- endfor %}
13
+ {%- endfor %}
14
+ </div>
15
+
16
+ {% if params.container -%}
17
+ </div>
18
+ {% endif -%}
19
+ {% endmacro %}
@@ -57,13 +57,10 @@
57
57
  @extend %ons-input-focus;
58
58
 
59
59
  border-radius: $input-radius;
60
- bottom: 0;
60
+ inset: 0;
61
61
  content: '';
62
62
  display: block;
63
- left: 0;
64
63
  position: absolute;
65
- right: 0;
66
- top: 0;
67
64
  }
68
65
 
69
66
  &:not(&--prefix) & {
@@ -100,16 +97,13 @@
100
97
 
101
98
  & + .ons-input-type__type::after {
102
99
  border-radius: $input-radius;
103
- bottom: 0;
100
+ inset: 0;
104
101
 
105
102
  // Style input + prefix/suffix for errors
106
103
  box-shadow: 0 0 0 1px var(--ons-color-errors);
107
104
  content: '';
108
105
  display: block;
109
- left: 0;
110
106
  outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
111
107
  position: absolute;
112
- right: 0;
113
- top: 0;
114
108
  }
115
109
  }
@@ -1,5 +1,6 @@
1
1
  %ons-input-focus {
2
- box-shadow: 0 0 0 $input-border-width var(--ons-color-input-border), 0 0 0 4px var(--ons-color-focus);
2
+ box-shadow: 0 0 0 $input-border-width var(--ons-color-input-border),
3
+ 0 0 0 4px var(--ons-color-focus);
3
4
 
4
5
  // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
5
6
  outline: 3px solid transparent;
@@ -31,7 +32,7 @@
31
32
  @include mq(s) {
32
33
  &--text,
33
34
  &--select {
34
- &:not(.ons-input--block):not([class*='input--w-']) {
35
+ &:not(.ons-input--block, [class*='input--w-']) {
35
36
  width: $input-width;
36
37
  }
37
38
  }
@@ -131,7 +132,7 @@
131
132
  }
132
133
 
133
134
  .ons-input--ghost {
134
- border: 2px solid rgba(255, 255, 255, 0.6);
135
+ border: 2px solid rgb(255 255 255 / 60%);
135
136
  &:focus {
136
137
  border: 2px solid var(--ons-color-input-border);
137
138
  }
@@ -1,10 +1,13 @@
1
1
  .ons-list {
2
- margin: 0 0 1rem;
2
+ margin: 0;
3
3
  padding: 0 0 0 1.5rem;
4
4
 
5
5
  &__item {
6
+ &:first-child {
7
+ margin-top: 0.5rem;
8
+ }
6
9
  &:last-child {
7
- margin-bottom: 0;
10
+ margin-bottom: -0.5;
8
11
  }
9
12
  }
10
13
 
@@ -20,13 +20,20 @@
20
20
  {% else %}
21
21
  {% set listEl = 'ul' %}
22
22
  {% endif %}
23
- <{{listEl}} {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes %} {{ params.classes -}}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
24
- {%- for item in params.itemsList -%}
25
- {% if listLength > 1 or listEl == 'ul' %}
23
+ <{{ listEl }} {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes %} {{ params.classes -}}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
24
+ {%- for item in params.itemsList -%}
25
+ {% set sublistClasses = item.listClasses if item.listClasses else '' %}
26
+ {% set sublistParams = {
27
+ 'variants': variants,
28
+ 'itemsList': item.itemsList,
29
+ 'classes': sublistClasses
30
+ } %}
31
+ {% if listLength > 1 or listEl == 'ul' %}
26
32
  <li class="ons-list__item{% if item.listClasses %} {{ item.listClasses }}{% endif %}"{% if item.current %} aria-current="true"{% endif %}>
27
- {% endif %}
28
- {% set itemText = item.text %}
29
- {% set itemIconType = item.iconType if item.iconType else iconType %}
33
+ {% endif %}
34
+ {% set itemText = item.text %}
35
+ {% if item.text %}
36
+ {% set itemIconType = item.iconType if item.iconType else iconType %} {% endif %}
30
37
 
31
38
  {# For Craft support we also support title and navigation title #}
32
39
  {% if item.navigationTitle %}
@@ -84,9 +91,14 @@
84
91
  }}
85
92
  {%- endif -%} </span>
86
93
  {%- endif -%}
87
- {% if listLength > 1 or listEl == 'ul' %}
88
- </li>
94
+ {% if item.itemsList %}
95
+ {# Handle nested lists with recursive call for sub layer #}
96
+ {{ onsList(sublistParams) }}
89
97
  {% endif %}
90
- {%- endfor -%}
91
- </{{listEl}}>
98
+ {% if listLength > 1 or listEl == 'ul' %}
99
+ </li>
100
+ {% endif %}
101
+ {%- endfor -%}
102
+ </{{ listEl }}>
103
+
92
104
  {% endmacro %}
@@ -21,6 +21,13 @@ const EXAMPLE_ITEM_NAVIGATION_TITLE = {
21
21
  title: 'Long article title',
22
22
  navigationTitle: 'Nav friendly title',
23
23
  };
24
+ const EXAMPLE_NESTED_LIST_TEXT_ITEMS = {
25
+ itemsList: [
26
+ { text: 'First item' },
27
+ { text: 'Second item' },
28
+ { text: 'Third item', itemsList: [{ text: 'First item' }, { text: 'Second item' }] },
29
+ ],
30
+ };
24
31
 
25
32
  describe('macro: list', () => {
26
33
  describe('list element', () => {
@@ -615,4 +622,39 @@ describe('macro: list', () => {
615
622
  expect($('#first + .ons-list__suffix').length).toBe(1);
616
623
  });
617
624
  });
625
+
626
+ describe('nested list element', () => {
627
+ it('has provided variant style class when one variant is provided', () => {
628
+ const $ = cheerio.load(
629
+ renderComponent('list', {
630
+ ...EXAMPLE_NESTED_LIST_TEXT_ITEMS,
631
+ variants: 'dashed',
632
+ }),
633
+ );
634
+
635
+ expect($('.ons-list--dashed').length).toBe(2);
636
+ });
637
+
638
+ it('has provided variant style classes when multiple variants are provided', () => {
639
+ const $ = cheerio.load(
640
+ renderComponent('list', {
641
+ ...EXAMPLE_NESTED_LIST_TEXT_ITEMS,
642
+ variants: ['dashed', 'inline'],
643
+ }),
644
+ );
645
+
646
+ expect($('.ons-list').hasClass('ons-list--dashed')).toBe(true);
647
+ expect($('.ons-list').hasClass('ons-list--inline')).toBe(true);
648
+ });
649
+
650
+ it('has the expected quantity of <li> elements when a <ol> element is specified', () => {
651
+ const $ = cheerio.load(
652
+ renderComponent('list', {
653
+ ...EXAMPLE_NESTED_LIST_TEXT_ITEMS,
654
+ }),
655
+ );
656
+
657
+ expect($('.ons-list li').length).toBe(5);
658
+ });
659
+ });
618
660
  });
@@ -1,4 +1,4 @@
1
- $backdrop-colour: rgba(0, 0, 0, 0.8);
1
+ $backdrop-colour: rgb(0 0 0 / 80%);
2
2
 
3
3
  .ons-modal {
4
4
  border: none;
@@ -13,7 +13,7 @@ $backdrop-colour: rgba(0, 0, 0, 0.8);
13
13
  position: fixed;
14
14
  top: 0;
15
15
 
16
- @media screen and (min-width: 600px) {
16
+ @media screen and (width >= 600px) {
17
17
  margin-left: auto;
18
18
  margin-right: auto;
19
19
  max-width: 500px;
@@ -21,12 +21,9 @@ $backdrop-colour: rgba(0, 0, 0, 0.8);
21
21
 
22
22
  &-ie11 & {
23
23
  background: var(--ons-color-white);
24
- bottom: 0;
24
+ inset: 50% 0 0;
25
25
  height: 350px;
26
- left: 0;
27
26
  position: fixed;
28
- right: 0;
29
- top: 50%;
30
27
  transform: translate(0, -50%);
31
28
  }
32
29
 
@@ -14,7 +14,7 @@
14
14
  {% endif %}
15
15
  {{ onsAutosuggest({
16
16
  "id": "ons-site-search",
17
- "containerClasses": "ons-autosuggest-input--header",
17
+ "containerClasses": "ons-autosuggest--header",
18
18
  "classes": autosuggestClasses,
19
19
  "label": {
20
20
  "text": params.siteSearchAutosuggest.label,
@@ -42,7 +42,7 @@
42
42
  <ul class="ons-navigation__list">
43
43
  {% for item in params.navigation.itemsList %}
44
44
  <li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
45
- <a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{{ item.title }}</a>
45
+ <a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
46
46
  </li>
47
47
  {% endfor %}
48
48
  </ul>
@@ -55,7 +55,7 @@
55
55
  <ul class="ons-navigation__list ons-navigation__list">
56
56
  {% for item in params.navigation.subNavigation.itemsList %}
57
57
  <li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
58
- <a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
58
+ <a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
59
59
  </li>
60
60
  {% endfor %}
61
61
  </ul>
@@ -68,7 +68,7 @@
68
68
  "type": "button",
69
69
  "variants": ["mobile", "dropdown"],
70
70
  "attributes": {
71
- "aria-label": "Toggle section navigation",
71
+ "aria-label": "Toggle " + params.navigation.currentPageTitle + " menu" if params.navigation.currentPageTitle else "Toggle section menu",
72
72
  "aria-controls": params.navigation.subNavigation.id,
73
73
  "aria-expanded": "false"
74
74
  }
@@ -81,14 +81,14 @@
81
81
  </li>
82
82
  {% for item in params.navigation.subNavigation.itemsList %}
83
83
  <li class="ons-navigation__item {{ ' ons-navigation__item--active' if (item.url == params.navigation.subNavigation.currentPath) or (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
84
- <a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{{ item.title }}</a>
84
+ <a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{% if item.title %}{{ item.title }}{% elif item.text %}{{ item.text }}{% endif %}</a>
85
85
  {% if item.sections %}
86
86
  {% for section in item.sections %}
87
87
  {% if section.sectionTitle %}<h3 class="ons-navigation__list-header">{{ section.sectionTitle }}</h3>{% endif %}
88
88
  <ul class="ons-navigation__list ons-navigation__list--child ons-list--dashed ons-u-ml-s ons-u-mt-xs">
89
89
  {% for child in section.children %}
90
90
  <li class="ons-navigation__item ons-list__item {{ ' ons-navigation__item--active' if (child.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and child.url in params.navigation.currentPath) }}">
91
- <a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{{ child.title }}</a>
91
+ <a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{% if child.title %}{{ child.title }}{% elif child.text %}{{ child.text }}{% endif %}</a>
92
92
  </li>
93
93
  {% endfor %}
94
94
  </ul>
@@ -10,7 +10,7 @@ const PARAMS = {
10
10
  id: 'main-nav',
11
11
  ariaLabel: 'Main menu',
12
12
  currentPath: ['#1', '/sub-item-1', '/sub-item-2/child-item-1'],
13
- currentPageTitle: 'Main nav item 2',
13
+ currentPageTitle: 'main nav item 2',
14
14
  itemsList: [
15
15
  {
16
16
  title: 'Main nav item 1',
@@ -130,7 +130,7 @@ describe('macro: navigation', () => {
130
130
  accessiblePlaceholder: true,
131
131
  autocomplete: 'off',
132
132
  id: 'ons-site-search',
133
- containerClasses: 'ons-autosuggest-input--header',
133
+ containerClasses: 'ons-autosuggest--header',
134
134
  classes: 'ons-input-search ons-input-search--icon',
135
135
  label: {
136
136
  text: 'Search the design system',
@@ -210,12 +210,12 @@ describe('macro: navigation', () => {
210
210
  faker.renderComponent('navigation', { navigation: PARAMS });
211
211
 
212
212
  expect(buttonSpy.occurrences).toContainEqual({
213
- text: 'Main nav item 2',
213
+ text: 'main nav item 2',
214
214
  classes: 'ons-u-d-no ons-js-sub-navigation-button',
215
215
  variants: ['mobile', 'dropdown'],
216
216
  type: 'button',
217
217
  attributes: {
218
- 'aria-label': 'Toggle section navigation',
218
+ 'aria-label': 'Toggle main nav item 2 menu',
219
219
  'aria-controls': 'sub-nav',
220
220
  'aria-expanded': 'false',
221
221
  },
@@ -44,11 +44,15 @@ export default class NavigationToggle {
44
44
  this.navigation.classList.add(this.hideClass);
45
45
  }
46
46
 
47
+ isHidden(el) {
48
+ return el.offsetParent === null;
49
+ }
50
+
47
51
  setAria() {
48
- const viewportDetails = GetViewportDetails();
52
+ const isToggleHidden = this.isHidden(this.toggle);
49
53
  const hasAria = this.navigation.hasAttribute(attrHidden);
50
54
 
51
- if (viewportDetails.width < 980) {
55
+ if (!isToggleHidden) {
52
56
  if (!hasAria) {
53
57
  this.closeNav();
54
58
  }
@@ -1,4 +1,5 @@
1
1
  {% macro onsPagination(params) %}
2
+ {% from "components/icon/_macro.njk" import onsIcon %}
2
3
  {% set currentPageIndex = params.currentPageNumber|int %}
3
4
  {% set totalPages = params.pages | length|int %}
4
5
  {% set position = "Page " ~ currentPageIndex ~ " of " ~ totalPages %}
@@ -13,7 +14,14 @@
13
14
  {% if currentPageIndex != 1 %}
14
15
  {% set prevPageIndex = currentPageIndex - 2 %}
15
16
  <li class="ons-pagination__item ons-pagination__item--previous">
16
- <a href="{{ params.pages[prevPageIndex].url }}" class="ons-pagination__link" rel="prev" aria-label="Go to the previous page (Page {{ currentPageIndex - 1 }})">{{ params.previous | default("Previous") }}</a>
17
+ <a href="{{ params.pages[prevPageIndex].url }}" class="ons-pagination__link ons-pagination__link--no-underline" rel="prev" aria-label="Go to the previous page (Page {{ currentPageIndex - 1 }})">
18
+ {{ onsIcon({
19
+ "iconType": 'arrow-previous',
20
+ "classes": 'ons-u-mr-xs',
21
+ "iconSize": 'm'
22
+ }) }}
23
+ <span class="ons-pagination__link-text">{{ params.previous | default("Previous") }}</span>
24
+ </a>
17
25
  </li>
18
26
  {% endif %}
19
27
  {% if currentPageIndex > 2 %}
@@ -60,7 +68,14 @@
60
68
  {% endif %}
61
69
  {% if totalPages > 1 and totalPages != currentPageIndex %}
62
70
  <li class="ons-pagination__item ons-pagination__item--next">
63
- <a href="{{ params.pages[currentPageIndex].url }}" class="ons-pagination__link" rel="next" aria-label="Go to the next page (Page {{ currentPageIndex + 1 }})">{{ params.next | default("Next") }}</a>
71
+ <a href="{{ params.pages[currentPageIndex].url }}" class="ons-pagination__link ons-pagination__link--no-underline" rel="next" aria-label="Go to the next page (Page {{ currentPageIndex + 1 }})">
72
+ <span class="ons-pagination__link-text">{{ params.next | default("Next") }}</span>
73
+ {{ onsIcon({
74
+ "iconType": 'arrow-next',
75
+ "classes": 'ons-u-ml-xs',
76
+ "iconSize": 'm'
77
+ }) }}
78
+ </a>
64
79
  </li>
65
80
  {% endif %}
66
81
  </ul>
@@ -39,12 +39,26 @@ $pagination-item-width: 2.5rem;
39
39
  min-width: $pagination-item-width;
40
40
  }
41
41
 
42
+ &__link--no-underline {
43
+ text-decoration: none;
44
+ &:hover {
45
+ text-decoration: none;
46
+ }
47
+ }
48
+
42
49
  &__link {
43
50
  border-radius: 3px;
44
51
  box-shadow: none;
45
52
  display: block;
46
53
  padding: $pagination-item-padding;
47
54
 
55
+ &-text {
56
+ @extend .ons-u-fs-r--b;
57
+
58
+ display: inline-block;
59
+ vertical-align: middle;
60
+ }
61
+
48
62
  &:focus {
49
63
  border-radius: 0;
50
64
  }
@@ -2,9 +2,20 @@
2
2
  "fullWidth": true
3
3
  ---
4
4
  {% from "components/phase-banner/_macro.njk" import onsPhaseBanner %}
5
+ {% from "components/external-link/_macro.njk" import onsExternalLink %}
6
+
7
+ {% set feedbackLink %}
8
+ {{
9
+ onsExternalLink({
10
+ "url": "#0",
11
+ "linkText": "give feedback"
12
+ })
13
+ }}
14
+ {% endset %}
15
+
5
16
  {{
6
17
  onsPhaseBanner({
7
- "badge": 'Alpha',
8
- "html": 'This is a new service. To help us improve it, <a href="#0">give feedback</a>'
18
+ "badge": "Alpha",
19
+ "html": "This is a new service. To help us improve it, " + feedbackLink
9
20
  })
10
21
  }}
@@ -2,8 +2,19 @@
2
2
  "fullWidth": true
3
3
  ---
4
4
  {% from "components/phase-banner/_macro.njk" import onsPhaseBanner %}
5
+ {% from "components/external-link/_macro.njk" import onsExternalLink %}
6
+
7
+ {% set feedbackLink %}
8
+ {{
9
+ onsExternalLink({
10
+ "url": "#0",
11
+ "linkText": "give feedback"
12
+ })
13
+ }}
14
+ {% endset %}
15
+
5
16
  {{
6
17
  onsPhaseBanner({
7
- "html": 'This is a new service. To help us improve it, <a href="#0">give feedback</a>'
8
- })
18
+ "html": "This is a new service. To help us improve it, " + feedbackLink
19
+ })
9
20
  }}