@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.
- package/components/button/_button.scss +38 -1
- package/components/header/_header.scss +32 -11
- package/components/header/_macro.njk +15 -54
- package/components/modal/_macro.njk +15 -13
- package/components/modal/_modal.scss +17 -0
- package/components/modal/modal.js +15 -2
- package/components/navigation/_macro.njk +98 -0
- package/components/navigation/_navigation.scss +127 -0
- package/components/navigation/navigation.dom.js +39 -0
- package/components/{header/header-nav.js → navigation/navigation.js} +13 -13
- package/components/section-navigation/_macro.njk +1 -1
- package/css/census.css +1 -1
- package/css/main.css +1 -1
- package/js/main.js +1 -1
- package/js/timeout.js +2 -2
- package/layout/_template.njk +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +2 -2
- package/scss/main.scss +1 -1
- package/components/header/_header-nav.scss +0 -108
- package/components/header/header-nav.dom.js +0 -31
|
@@ -379,7 +379,7 @@ $button-shadow-size: 3px;
|
|
|
379
379
|
transform: rotate(90deg);
|
|
380
380
|
}
|
|
381
381
|
|
|
382
|
-
@include mq(
|
|
382
|
+
@include mq(l) {
|
|
383
383
|
display: none;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
@@ -393,4 +393,41 @@ $button-shadow-size: 3px;
|
|
|
393
393
|
opacity: 0.4;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
+
|
|
397
|
+
&--dropdown {
|
|
398
|
+
@extend .ons-btn--ghost;
|
|
399
|
+
@extend .ons-btn--mobile;
|
|
400
|
+
|
|
401
|
+
width: 100%;
|
|
402
|
+
|
|
403
|
+
.ons-btn__inner {
|
|
404
|
+
background: $color-branded-tint;
|
|
405
|
+
border: none;
|
|
406
|
+
border-radius: 0;
|
|
407
|
+
box-shadow: none;
|
|
408
|
+
color: $color-text-link;
|
|
409
|
+
display: block;
|
|
410
|
+
font-size: 1rem;
|
|
411
|
+
font-weight: normal;
|
|
412
|
+
padding: 0.6rem 1rem;
|
|
413
|
+
text-align: left;
|
|
414
|
+
|
|
415
|
+
.ons-svg-icon {
|
|
416
|
+
fill: $color-text-link;
|
|
417
|
+
float: right;
|
|
418
|
+
margin-top: 3px;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
&:active,
|
|
423
|
+
&:active:focus {
|
|
424
|
+
.ons-btn__inner {
|
|
425
|
+
background: $color-branded-secondary;
|
|
426
|
+
color: $color-white;
|
|
427
|
+
.ons-svg-icon {
|
|
428
|
+
fill: $color-white;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
396
433
|
}
|
|
@@ -170,20 +170,41 @@
|
|
|
170
170
|
display: block;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
margin-top: -0.03rem;
|
|
176
|
-
}
|
|
173
|
+
&-service-nav {
|
|
174
|
+
display: inline-block;
|
|
177
175
|
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
&--mobile {
|
|
177
|
+
background: $color-branded-tint;
|
|
178
|
+
padding: 1rem;
|
|
179
|
+
width: 100%;
|
|
180
|
+
}
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
182
|
+
&__list {
|
|
183
|
+
list-style: none;
|
|
184
|
+
margin: 0;
|
|
183
185
|
padding: 0;
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&__item {
|
|
189
|
+
display: inline-block;
|
|
190
|
+
margin: 0 0 0 1rem;
|
|
191
|
+
&--mobile {
|
|
192
|
+
display: block;
|
|
193
|
+
margin: 0 0 0.5rem;
|
|
194
|
+
}
|
|
195
|
+
&:first-child {
|
|
196
|
+
margin-left: 0;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.ons-language-links {
|
|
201
|
+
border-top: 1px solid $color-branded;
|
|
202
|
+
margin: 1.5rem 0 0;
|
|
203
|
+
padding: 1rem 0 0;
|
|
204
|
+
|
|
205
|
+
&__item {
|
|
206
|
+
margin: 0 0 0.5rem;
|
|
207
|
+
}
|
|
187
208
|
}
|
|
188
209
|
}
|
|
189
210
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% macro onsHeader(params) %}
|
|
2
2
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
3
3
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
4
|
-
{% from "components/
|
|
4
|
+
{% from "components/navigation/_macro.njk" import onsNavigation %}
|
|
5
5
|
|
|
6
6
|
{% set title_tag = "h1" if params.tilteAsH1 else "div" %}
|
|
7
7
|
{% set currentLanguageISOCode = "en" %}
|
|
@@ -82,12 +82,13 @@
|
|
|
82
82
|
{% endif %}
|
|
83
83
|
<div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
|
|
84
84
|
{{ onsButton({
|
|
85
|
-
"text": params.serviceLinks.toggleServicesButton.text | default("Menu")
|
|
85
|
+
"text": params.serviceLinks.toggleServicesButton.text | default("Menu"),
|
|
86
86
|
"classes": "ons-u-d-no ons-js-toggle-services",
|
|
87
|
+
"type": "button",
|
|
87
88
|
"buttonStyle": "mobile",
|
|
88
89
|
"variants": buttonVariant,
|
|
89
90
|
"attributes": {
|
|
90
|
-
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu")
|
|
91
|
+
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
|
|
91
92
|
"aria-controls": params.serviceLinks.id,
|
|
92
93
|
"aria-haspopup": "true",
|
|
93
94
|
"aria-expanded": "false"
|
|
@@ -144,7 +145,7 @@
|
|
|
144
145
|
{% endif %}
|
|
145
146
|
</div>
|
|
146
147
|
{% if params.button is defined and params.button %}
|
|
147
|
-
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink
|
|
148
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
148
149
|
{{ onsButton({
|
|
149
150
|
"text": params.button.text,
|
|
150
151
|
"classes": "ons-u-d-no@xxs@m",
|
|
@@ -157,9 +158,9 @@
|
|
|
157
158
|
}) }}
|
|
158
159
|
</div>
|
|
159
160
|
{% endif %}
|
|
160
|
-
{% if params.navigation is defined
|
|
161
|
-
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink ons-u-d-no@
|
|
162
|
-
{% if
|
|
161
|
+
{% if params.navigation is defined %}
|
|
162
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink ons-u-d-no@l">
|
|
163
|
+
{% if isPatternLib and params.navigation.siteSearchAutosuggest %}
|
|
163
164
|
<span class="ons-grid ons-u-d-no@xxs@xs">
|
|
164
165
|
{{ onsButton({
|
|
165
166
|
"text": "Search",
|
|
@@ -168,22 +169,22 @@
|
|
|
168
169
|
"iconType": "search",
|
|
169
170
|
"iconPosition": "only",
|
|
170
171
|
"attributes": {
|
|
171
|
-
"aria-label":
|
|
172
|
-
"aria-controls":
|
|
172
|
+
"aria-label": "Toggle search" ,
|
|
173
|
+
"aria-controls": "ons-site-search",
|
|
173
174
|
"aria-haspopup": "true",
|
|
174
175
|
"aria-expanded": "false"
|
|
175
176
|
}
|
|
176
177
|
}) }}
|
|
177
178
|
</span>
|
|
178
179
|
{% endif %}
|
|
179
|
-
{% if params.navigation.
|
|
180
|
+
{% if params.navigation.toggleNavigationButton is defined and params.navigation.toggleNavigationButton %}
|
|
180
181
|
{{ onsButton({
|
|
181
|
-
"text": params.navigation.
|
|
182
|
-
"classes": "ons-u-ml-xs ons-u-d-no ons-js-
|
|
182
|
+
"text": params.navigation.toggleNavigationButton.text,
|
|
183
|
+
"classes": "ons-u-ml-xs ons-u-d-no ons-js-navigation-button",
|
|
183
184
|
"buttonStyle": "mobile",
|
|
184
185
|
"variants": ["mobile", "ghost"],
|
|
185
186
|
"attributes": {
|
|
186
|
-
"aria-label": params.navigation.
|
|
187
|
+
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
|
|
187
188
|
"aria-controls": params.navigation.id,
|
|
188
189
|
"aria-haspopup": "true",
|
|
189
190
|
"aria-expanded": "false"
|
|
@@ -196,47 +197,7 @@
|
|
|
196
197
|
</div>
|
|
197
198
|
</div>
|
|
198
199
|
{% if params.navigation is defined and params.navigation %}
|
|
199
|
-
|
|
200
|
-
<div class="ons-container ons-container--gutterless@xxs@m{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
201
|
-
{% if params.autosuggest is defined and params.autosuggest and isPatternLib is defined and isPatternLib %}
|
|
202
|
-
<div class="ons-header-search ons-js-header-search">
|
|
203
|
-
{{ onsAutosuggest({
|
|
204
|
-
"id": "ons-autosuggest-header-search",
|
|
205
|
-
"containerClasses": "ons-autosuggest-input--header",
|
|
206
|
-
"classes": "ons-input--ghost ons-input-search ons-input-search--icon",
|
|
207
|
-
"label": {
|
|
208
|
-
"text": params.autosuggest.label,
|
|
209
|
-
"id": "ons-autosuggest-header-search-label",
|
|
210
|
-
"classes": "ons-label--white ons-u-pl-m"
|
|
211
|
-
},
|
|
212
|
-
"accessiblePlaceholder": true,
|
|
213
|
-
"autocomplete": "off",
|
|
214
|
-
"instructions": params.autosuggest.instructions,
|
|
215
|
-
"ariaYouHaveSelected":params.autosuggest.ariaYouHaveSelected,
|
|
216
|
-
"ariaMinChars": params.autosuggest.ariaMinChars,
|
|
217
|
-
"ariaResultsLabel": params.autosuggest.ariaResultsLabel,
|
|
218
|
-
"ariaOneResult": params.autosuggest.ariaOneResult,
|
|
219
|
-
"ariaNResults": params.autosuggest.ariaNResults,
|
|
220
|
-
"ariaLimitedResults": params.autosuggest.ariaLimitedResults,
|
|
221
|
-
"moreResults": params.autosuggest.moreResults,
|
|
222
|
-
"resultsTitle": params.autosuggest.resultsTitle,
|
|
223
|
-
"autosuggestData": params.autosuggest.autosuggestData,
|
|
224
|
-
"noResults": params.autosuggest.noResults,
|
|
225
|
-
"typeMore": params.autosuggest.typeMore
|
|
226
|
-
}) }}
|
|
227
|
-
</div>
|
|
228
|
-
{% endif %}
|
|
229
|
-
<nav class="ons-header-nav ons-js-header-nav" id="{{ params.navigation.id }}" aria-label="{{ params.navigation.ariaLabel | default("Main menu") }}" data-analytics="header-navigation">
|
|
230
|
-
<ul class="ons-header-nav__list">
|
|
231
|
-
{% for item in (params.navigation.itemsList if params.navigation.itemsList is iterable else params.navigation.itemsList.items()) %}
|
|
232
|
-
<li class="ons-header-nav__item {{ item.classes }}{{ ' ons-header-nav__item--active' if (item.url == params.navigation.currentPath) or (item.url != (params.navigation.siteBasePath | default('/')) and item.url in params.navigation.currentPath) }}">
|
|
233
|
-
<a class="ons-header-nav__link" href="{{ item.url }}" {% if item.id is defined and item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
|
|
234
|
-
</li>
|
|
235
|
-
{% endfor %}
|
|
236
|
-
</ul>
|
|
237
|
-
</nav>
|
|
238
|
-
</div>
|
|
239
|
-
</div>
|
|
200
|
+
{{ onsNavigation(params.navigation) }}
|
|
240
201
|
{% endif %}
|
|
241
202
|
</header>
|
|
242
203
|
{% endmacro %}
|
|
@@ -5,19 +5,21 @@
|
|
|
5
5
|
role="dialog"
|
|
6
6
|
aria-labelledby="ons-modal-title"
|
|
7
7
|
{% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}
|
|
8
|
-
>
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
>
|
|
9
|
+
<div class="ons-modal__content">
|
|
10
|
+
<h1 id="ons-modal-title" class="ons-modal__title">
|
|
11
|
+
{{ params.title }}
|
|
12
|
+
</h1>
|
|
13
|
+
<div class="ons-modal__body">
|
|
14
|
+
{{ (params.body if params else "") | safe }}{{ caller() if caller }}
|
|
15
|
+
</div>
|
|
16
|
+
{% if params.btnText %}
|
|
17
|
+
{% from "components/button/_macro.njk" import onsButton %}
|
|
18
|
+
{{ onsButton({
|
|
19
|
+
"text": params.btnText,
|
|
20
|
+
"classes": "ons-js-modal-btn ons-u-mt-s"
|
|
21
|
+
}) }}
|
|
22
|
+
{% endif %}
|
|
14
23
|
</div>
|
|
15
|
-
{% if params.btnText %}
|
|
16
|
-
{% from "components/button/_macro.njk" import onsButton %}
|
|
17
|
-
{{ onsButton({
|
|
18
|
-
"text": params.btnText,
|
|
19
|
-
"classes": "ons-js-modal-btn ons-u-mt-s"
|
|
20
|
-
}) }}
|
|
21
|
-
{% endif %}
|
|
22
24
|
</dialog>
|
|
23
25
|
{% endmacro %}
|
|
@@ -9,8 +9,20 @@ $backdrop-colour: rgba(0, 0, 0, 0.8);
|
|
|
9
9
|
margin-right: 2rem;
|
|
10
10
|
max-width: 500px;
|
|
11
11
|
padding: 2rem;
|
|
12
|
+
position: relative;
|
|
12
13
|
width: auto;
|
|
13
14
|
|
|
15
|
+
&-ie11 & {
|
|
16
|
+
background: $color-white;
|
|
17
|
+
bottom: 0;
|
|
18
|
+
height: 350px;
|
|
19
|
+
left: 0;
|
|
20
|
+
position: fixed;
|
|
21
|
+
right: 0;
|
|
22
|
+
top: 50%;
|
|
23
|
+
transform: translate(0, -50%);
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
@media screen and (min-width: 600px) {
|
|
15
27
|
margin-left: auto;
|
|
16
28
|
margin-right: auto;
|
|
@@ -24,6 +36,11 @@ $backdrop-colour: rgba(0, 0, 0, 0.8);
|
|
|
24
36
|
|
|
25
37
|
& + .backdrop {
|
|
26
38
|
background: $backdrop-colour;
|
|
39
|
+
height: 100%;
|
|
40
|
+
left: 0;
|
|
41
|
+
position: absolute;
|
|
42
|
+
top: 0;
|
|
43
|
+
width: 100%;
|
|
27
44
|
}
|
|
28
45
|
}
|
|
29
46
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import dialogPolyfill from 'dialog-polyfill';
|
|
2
2
|
|
|
3
3
|
const overLayClass = 'ons-modal-overlay';
|
|
4
|
+
const ie11Class = 'ons-modal-ie11';
|
|
4
5
|
|
|
5
6
|
export default class Modal {
|
|
6
7
|
constructor(component) {
|
|
@@ -8,7 +9,7 @@ export default class Modal {
|
|
|
8
9
|
this.launcher = document.querySelector(`[data-modal-id=${component.id}]`);
|
|
9
10
|
this.closeButton = component.querySelector('.ons-js-modal-btn');
|
|
10
11
|
this.lastFocusedEl = null;
|
|
11
|
-
|
|
12
|
+
this.dialogCSSSupported = true;
|
|
12
13
|
this.initialise();
|
|
13
14
|
}
|
|
14
15
|
|
|
@@ -33,6 +34,7 @@ export default class Modal {
|
|
|
33
34
|
} else {
|
|
34
35
|
try {
|
|
35
36
|
dialogPolyfill.registerDialog(this.component);
|
|
37
|
+
this.dialogCSSSupported = false;
|
|
36
38
|
return true;
|
|
37
39
|
} catch (error) {
|
|
38
40
|
/* istanbul ignore next */
|
|
@@ -44,9 +46,15 @@ export default class Modal {
|
|
|
44
46
|
openDialog(event) {
|
|
45
47
|
if (!this.isDialogOpen()) {
|
|
46
48
|
this.component.classList.add('ons-u-db');
|
|
47
|
-
document.querySelector('body').
|
|
49
|
+
document.querySelector('body').classList.add(overLayClass);
|
|
50
|
+
|
|
51
|
+
if (!this.dialogCSSSupported) {
|
|
52
|
+
document.querySelector('body').classList.add(ie11Class);
|
|
53
|
+
}
|
|
54
|
+
|
|
48
55
|
this.makePageContentInert();
|
|
49
56
|
this.saveLastFocusedEl();
|
|
57
|
+
|
|
50
58
|
if (event) {
|
|
51
59
|
const modal = document.getElementById(event.target.getAttribute('data-modal-id'));
|
|
52
60
|
modal.showModal();
|
|
@@ -96,6 +104,11 @@ export default class Modal {
|
|
|
96
104
|
}
|
|
97
105
|
this.component.classList.remove('ons-u-db');
|
|
98
106
|
document.querySelector('body').classList.remove(overLayClass);
|
|
107
|
+
|
|
108
|
+
if (!this.dialogCSSSupported) {
|
|
109
|
+
document.querySelector('body').classList.remove(ie11Class);
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
this.component.close();
|
|
100
113
|
this.setFocusOnLastFocusedEl(this.lastFocusedEl);
|
|
101
114
|
this.removeInertFromPageContent();
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{% macro onsNavigation(params) %}
|
|
2
|
+
{% from "components/button/_macro.njk" import onsButton %}
|
|
3
|
+
{% from "components/autosuggest/_macro.njk" import onsAutosuggest %}
|
|
4
|
+
<div class="ons-navigation-wrapper">
|
|
5
|
+
<div class="ons-container ons-container--gutterless@xxs@l{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
6
|
+
{% if params.siteSearchAutosuggest is defined and params.siteSearchAutosuggest and isPatternLib is defined and isPatternLib %}
|
|
7
|
+
<div class="ons-navigation-search ons-js-navigation-search">
|
|
8
|
+
{{ onsAutosuggest({
|
|
9
|
+
"id": "ons-site-search",
|
|
10
|
+
"containerClasses": "ons-autosuggest-input--header",
|
|
11
|
+
"classes": "ons-input--ghost ons-input-search ons-input-search--icon",
|
|
12
|
+
"label": {
|
|
13
|
+
"text": params.siteSearchAutosuggest.label,
|
|
14
|
+
"id": "ons-site-search-label",
|
|
15
|
+
"classes": "ons-label--white ons-u-pl-m"
|
|
16
|
+
},
|
|
17
|
+
"accessiblePlaceholder": true,
|
|
18
|
+
"autocomplete": "off",
|
|
19
|
+
"instructions": params.siteSearchAutosuggest.instructions,
|
|
20
|
+
"ariaYouHaveSelected":params.siteSearchAutosuggest.ariaYouHaveSelected,
|
|
21
|
+
"ariaMinChars": params.siteSearchAutosuggest.ariaMinChars,
|
|
22
|
+
"ariaResultsLabel": params.siteSearchAutosuggest.ariaResultsLabel,
|
|
23
|
+
"ariaOneResult": params.siteSearchAutosuggest.ariaOneResult,
|
|
24
|
+
"ariaNResults": params.siteSearchAutosuggest.ariaNResults,
|
|
25
|
+
"ariaLimitedResults": params.siteSearchAutosuggest.ariaLimitedResults,
|
|
26
|
+
"moreResults": params.siteSearchAutosuggest.moreResults,
|
|
27
|
+
"resultsTitle": params.siteSearchAutosuggest.resultsTitle,
|
|
28
|
+
"autosuggestData": params.siteSearchAutosuggest.autosuggestData,
|
|
29
|
+
"noResults": params.siteSearchAutosuggest.noResults,
|
|
30
|
+
"typeMore": params.siteSearchAutosuggest.typeMore
|
|
31
|
+
}) }}
|
|
32
|
+
</div>
|
|
33
|
+
{% endif %}
|
|
34
|
+
<nav class="ons-navigation ons-js-navigation" id="{{ params.id }}" aria-label="{{ params.ariaLabel | default("Main menu") }}" data-analytics="header-navigation">
|
|
35
|
+
<ul class="ons-navigation__list">
|
|
36
|
+
{% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) %}
|
|
37
|
+
<li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.currentPath) or (item.url != (params.siteBasePath | default('/')) and item.url in params.currentPath) }}">
|
|
38
|
+
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.id is defined and item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
|
|
39
|
+
</li>
|
|
40
|
+
{% endfor %}
|
|
41
|
+
</ul>
|
|
42
|
+
</nav>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
{% if params.subNavigation is defined and params.subNavigation %}
|
|
46
|
+
<nav class="ons-navigation ons-navigation--sub ons-u-d-no@xxs@l{{ ' ' + params.subNavigation.classes if params.subNavigation.classes is defined and params.subNavigation.classes }}" id="{{ params.subNavigation.id }}" aria-label="{{ params.subNavigation.ariaLabel | default("Section menu") }}" data-analytics="header-section-navigation">
|
|
47
|
+
<div class="ons-container ons-container--gutterless@xxs@l{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
48
|
+
<ul class="ons-navigation__list ons-navigation__list">
|
|
49
|
+
{% for item in (params.subNavigation.itemsList if params.subNavigation.itemsList is iterable else params.subNavigation.itemsList.items()) %}
|
|
50
|
+
<li class="ons-navigation__item ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.subNavigation.currentPath) or (item.url != (params.subNavigation.siteBasePath | default('/')) and item.url in params.subNavigation.currentPath) }}">
|
|
51
|
+
<a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.id is defined and item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
|
|
52
|
+
</li>
|
|
53
|
+
{% endfor %}
|
|
54
|
+
</ul>
|
|
55
|
+
</div>
|
|
56
|
+
</nav>
|
|
57
|
+
<div class="ons-u-d-no@l{{ ' ' + params.subNavigation.classes if params.subNavigation.classes is defined and params.subNavigation.classes }}">
|
|
58
|
+
{{ onsButton({
|
|
59
|
+
"text": params.currentPageTitle,
|
|
60
|
+
"classes": "ons-u-d-no ons-js-sub-navigation-button ons-btn--dropdown",
|
|
61
|
+
"buttonStyle": "mobile",
|
|
62
|
+
"attributes": {
|
|
63
|
+
"aria-label": "Toggle section navigation",
|
|
64
|
+
"aria-controls": params.subNavigation.id,
|
|
65
|
+
"aria-haspopup": "true",
|
|
66
|
+
"aria-expanded": "false"
|
|
67
|
+
}
|
|
68
|
+
}) }}
|
|
69
|
+
<nav class="ons-navigation ons-navigation--sub-mobile ons-u-d-no proto-ons-js-secondary-nav ons-u-mt-xs" id="{{ params.subNavigation.id }}" aria-label="{{ params.subNavigation.ariaLabel | default("Section menu") }}" data-analytics="header-section-navigation">
|
|
70
|
+
<div class="ons-container ons-container--gutterless@xxs@l{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
71
|
+
<ul class="ons-navigation__list">
|
|
72
|
+
<li class="ons-navigation__item">
|
|
73
|
+
<a class="ons-navigation__link" href="{{ params.subNavigation.overviewURL }}">{{ params.subNavigation.overviewText | default('Overview') }}</a>
|
|
74
|
+
</li>
|
|
75
|
+
{% for item in (params.subNavigation.itemsList if params.subNavigation.itemsList is iterable else params.subNavigation.itemsList.items()) %}
|
|
76
|
+
<li class="ons-navigation__item {{ ' ons-navigation__item--active' if (item.url == params.subNavigation.currentPath) or (item.url != (params.subNavigation.siteBasePath | default('/')) and item.url in params.subNavigation.currentPath) }}">
|
|
77
|
+
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.id is defined and item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
|
|
78
|
+
{% if item.sections %}
|
|
79
|
+
{% for section in item.sections %}
|
|
80
|
+
{% if section.sectionTitle %}<h3 class="ons-navigation__list-header">{{ section.sectionTitle }}</h3>{% endif %}
|
|
81
|
+
<ul class="ons-navigation__list ons-list--dashed ons-u-ml-s ons-u-mt-xs">
|
|
82
|
+
{% for child in section.children %}
|
|
83
|
+
<li class="ons-navigation__item ons-list__item {{ ' ons-navigation__item--active' if (child.url == params.subNavigation.currentPath) or (child.url != (params.subNavigation.sitsiteBasePatheBasePath | default('/')) and child.url in params.subNavigation.currentPath) }}">
|
|
84
|
+
<a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.id is defined and child.id %}id="{{ child.id }}" {% endif %}>{{ child.title }}</a>
|
|
85
|
+
</li>
|
|
86
|
+
{% endfor %}
|
|
87
|
+
</ul>
|
|
88
|
+
{% endfor %}
|
|
89
|
+
{% endif %}
|
|
90
|
+
</li>
|
|
91
|
+
{% endfor %}
|
|
92
|
+
</ul>
|
|
93
|
+
</div>
|
|
94
|
+
</nav>
|
|
95
|
+
</div>
|
|
96
|
+
{% endif %}
|
|
97
|
+
|
|
98
|
+
{% endmacro %}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
.ons-navigation {
|
|
2
|
+
position: relative;
|
|
3
|
+
&-wrapper {
|
|
4
|
+
background: $color-header;
|
|
5
|
+
margin-top: -0.03rem;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
&--sub {
|
|
9
|
+
background: $color-branded-tint;
|
|
10
|
+
padding-top: 0.5rem;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
&--sub-mobile {
|
|
14
|
+
border-bottom: 4px solid $color-branded-tint;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-search {
|
|
18
|
+
padding: 1rem;
|
|
19
|
+
|
|
20
|
+
@include mq(l) {
|
|
21
|
+
bottom: 65px;
|
|
22
|
+
padding: 0;
|
|
23
|
+
position: absolute;
|
|
24
|
+
right: 1rem;
|
|
25
|
+
width: 20rem;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__list {
|
|
30
|
+
list-style: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
padding: 0 0 0.5rem;
|
|
33
|
+
|
|
34
|
+
@include mq(l) {
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&-header {
|
|
39
|
+
font-size: 1rem;
|
|
40
|
+
margin: 0.75rem 0 0.6rem;
|
|
41
|
+
padding: 0 0 0 1rem;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__item {
|
|
46
|
+
border-left: 4px solid transparent;
|
|
47
|
+
display: block;
|
|
48
|
+
margin: 0 0 0.2rem;
|
|
49
|
+
&--active {
|
|
50
|
+
border-color: $color-white;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ons-navigation--sub-mobile & {
|
|
54
|
+
&--active {
|
|
55
|
+
border-color: $color-branded;
|
|
56
|
+
li {
|
|
57
|
+
border: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@include mq(l) {
|
|
63
|
+
border-bottom: 4px solid transparent;
|
|
64
|
+
border-left: 0;
|
|
65
|
+
display: inline-block;
|
|
66
|
+
margin: 0 0 0 1rem;
|
|
67
|
+
padding: 0 0 0.3rem;
|
|
68
|
+
position: relative;
|
|
69
|
+
text-align: center;
|
|
70
|
+
|
|
71
|
+
&:first-child {
|
|
72
|
+
margin-left: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&--active,
|
|
76
|
+
&:hover {
|
|
77
|
+
border-color: $color-white;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ons-navigation--sub & {
|
|
81
|
+
&:hover,
|
|
82
|
+
&--active {
|
|
83
|
+
border-color: $color-text-link;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&__link {
|
|
90
|
+
color: $color-white;
|
|
91
|
+
display: block;
|
|
92
|
+
margin: 0 0.35rem;
|
|
93
|
+
padding: 0.1rem 0.55rem;
|
|
94
|
+
text-decoration: none;
|
|
95
|
+
|
|
96
|
+
&--section {
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&:hover,
|
|
102
|
+
&:focus {
|
|
103
|
+
color: $color-white;
|
|
104
|
+
text-decoration: none;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.ons-navigation--sub &,
|
|
108
|
+
.ons-navigation--sub-mobile & {
|
|
109
|
+
color: $color-text-link;
|
|
110
|
+
&:hover,
|
|
111
|
+
&:focus {
|
|
112
|
+
color: $color-text-link;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include mq(l) {
|
|
117
|
+
display: inline-block;
|
|
118
|
+
font-size: 1rem;
|
|
119
|
+
margin: 0;
|
|
120
|
+
padding: 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&__item--active > &__link {
|
|
125
|
+
font-weight: 700;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import domready from '../../js/domready';
|
|
2
|
+
|
|
3
|
+
domready(async () => {
|
|
4
|
+
const toggleNavigationBtn = document.querySelector('.ons-js-navigation-button');
|
|
5
|
+
const navigationEl = document.querySelector('.ons-js-navigation');
|
|
6
|
+
const navigationHideClass = 'ons-u-d-no@xxs@l';
|
|
7
|
+
const toggleSubNavigationBtn = document.querySelector('.ons-js-sub-navigation-button');
|
|
8
|
+
const subNavigationEl = document.querySelector('.proto-ons-js-secondary-nav');
|
|
9
|
+
const subNavigationHideClass = 'ons-u-d-no';
|
|
10
|
+
const toggleSearchBtn = document.querySelector('.ons-js-toggle-search');
|
|
11
|
+
const searchEl = document.querySelector('.ons-js-navigation-search');
|
|
12
|
+
const searchHideClass = 'ons-u-d-no@xs@l';
|
|
13
|
+
const toggleServicesBtn = document.querySelector('.ons-js-toggle-services');
|
|
14
|
+
const servicesEl = document.querySelector('.ons-js-services-mobile-nav');
|
|
15
|
+
const servicesHideClass = 'ons-u-d-no';
|
|
16
|
+
|
|
17
|
+
if (toggleNavigationBtn) {
|
|
18
|
+
const NavigationToggle = (await import('./navigation')).default;
|
|
19
|
+
|
|
20
|
+
new NavigationToggle(toggleNavigationBtn, navigationEl, navigationHideClass).registerEvents();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (toggleSubNavigationBtn) {
|
|
24
|
+
const SubNavigationToggle = (await import('./navigation')).default;
|
|
25
|
+
new SubNavigationToggle(toggleSubNavigationBtn, subNavigationEl, subNavigationHideClass).registerEvents();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (toggleSearchBtn) {
|
|
29
|
+
const searchToggle = (await import('./navigation')).default;
|
|
30
|
+
|
|
31
|
+
new searchToggle(toggleSearchBtn, searchEl, searchHideClass).registerEvents();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (toggleServicesBtn) {
|
|
35
|
+
const servicesToggle = (await import('./navigation')).default;
|
|
36
|
+
|
|
37
|
+
new servicesToggle(toggleServicesBtn, servicesEl, servicesHideClass).registerEvents();
|
|
38
|
+
}
|
|
39
|
+
});
|