@ons/design-system 54.0.1 → 55.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.
- package/components/access-code/_macro.njk +3 -3
- package/components/accordion/_macro.njk +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-output/_macro.njk +7 -7
- package/components/autosuggest/_macro.njk +19 -19
- package/components/breadcrumbs/_macro.njk +3 -3
- package/components/browser-banner/_macro.njk +1 -1
- package/components/browser-banner/_macro.spec.js +31 -0
- package/components/button/_button.scss +21 -7
- package/components/button/_macro.njk +25 -25
- package/components/button/_macro.spec.js +2 -2
- package/components/call-to-action/_macro.njk +1 -1
- package/components/card/_macro.njk +10 -10
- package/components/checkboxes/_checkbox-macro.njk +9 -9
- package/components/checkboxes/_checkbox.scss +43 -10
- package/components/checkboxes/_macro.njk +10 -10
- package/components/checkboxes/checkbox-with-fieldset.js +6 -5
- package/components/checkboxes/checkboxes.dom.js +6 -9
- package/components/code-highlight/_macro.njk +1 -1
- package/components/collapsible/_collapsible.scss +2 -1
- package/components/collapsible/_macro.njk +7 -7
- package/components/date-input/_macro.njk +5 -5
- package/components/document-list/_macro.njk +29 -29
- package/components/document-list/document-list.scss +2 -0
- package/components/download-resources/download-resources.js +19 -0
- package/components/download-resources/download-resources.spec.js +95 -0
- package/components/duration/_macro.njk +9 -9
- package/components/duration/_macro.spec.js +0 -3
- package/components/error/_macro.njk +1 -1
- package/components/external-link/_macro.njk +2 -2
- package/components/external-link/_macro.spec.js +2 -2
- package/components/feedback/_macro.njk +2 -2
- package/components/field/_macro.njk +5 -5
- package/components/fieldset/_fieldset.scss +11 -1
- package/components/fieldset/_macro.njk +15 -14
- package/components/fieldset/_macro.spec.js +27 -5
- package/components/footer/_footer.scss +1 -0
- package/components/footer/_macro.njk +18 -18
- package/components/footer/_macro.spec.js +18 -0
- package/components/header/_header.scss +7 -2
- package/components/header/_macro.njk +63 -37
- package/components/header/_macro.spec.js +82 -14
- package/components/hero/_macro.njk +16 -16
- package/components/hero/_macro.spec.js +1 -1
- package/components/icons/_macro.njk +2 -2
- package/components/images/_macro.njk +3 -3
- package/components/input/_input-type.scss +7 -0
- package/components/input/_input.scss +13 -2
- package/components/input/_macro.njk +40 -34
- package/components/input/_macro.spec.js +64 -59
- package/components/label/_label.scss +1 -1
- package/components/label/_macro.njk +27 -15
- package/components/label/_macro.spec.js +31 -0
- package/components/language-selector/_macro.njk +1 -1
- package/components/lists/_macro.njk +22 -22
- package/components/lists/_macro.spec.js +2 -2
- package/components/message/_macro.njk +6 -6
- package/components/message/_message.scss +1 -0
- package/components/message-list/_macro.njk +1 -1
- package/components/metadata/_macro.njk +2 -2
- package/components/modal/_macro.njk +6 -6
- package/components/modal/_modal.scss +10 -9
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +9 -10
- package/components/navigation/_macro.spec.js +0 -1
- package/components/pagination/_macro.njk +3 -3
- package/components/pagination/_pagination.scss +1 -0
- package/components/panel/_macro.njk +38 -43
- package/components/panel/_macro.spec.js +24 -33
- package/components/panel/_panel.scss +13 -5
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_macro.spec.js +31 -0
- package/components/phase-banner/_phase-banner.scss +1 -0
- package/components/promotional-banner/_macro.njk +2 -2
- package/components/question/_macro.njk +18 -18
- package/components/quote/_macro.njk +2 -2
- package/components/radios/_macro.njk +8 -8
- package/components/radios/_radio.scss +15 -3
- package/components/radios/check-radios.js +5 -1
- package/components/related-content/_macro.njk +2 -2
- package/components/relationships/_macro.njk +2 -2
- package/components/reply/_macro.njk +2 -2
- package/components/section-navigation/_macro.njk +2 -2
- package/components/select/_macro.njk +8 -8
- package/components/share-page/_macro.njk +2 -2
- package/components/skip-to-content/_skip.scss +2 -1
- package/components/status/_macro.njk +2 -2
- package/components/summary/_macro.njk +25 -25
- package/components/table/_macro.njk +13 -12
- package/components/table/_macro.spec.js +0 -27
- package/components/table/_table.scss +13 -6
- package/components/table/sortable-table.js +1 -0
- package/components/table-of-contents/_macro.njk +4 -4
- package/components/tabs/_tabs.scss +5 -3
- package/components/textarea/_macro.njk +8 -8
- package/components/timeline/_macro.njk +1 -1
- package/components/video/_macro.njk +1 -1
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/layout/_template.njk +57 -44
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +1 -0
- package/scss/overrides/hcm.scss +205 -46
- package/scss/patternlib.scss +1 -0
|
@@ -7,28 +7,35 @@
|
|
|
7
7
|
{% set title_tag = "h1" if params.titleAsH1 else "div" %}
|
|
8
8
|
{% set currentLanguageISOCode = "en" %}
|
|
9
9
|
|
|
10
|
-
{% if params.language
|
|
10
|
+
{% if params.language and params.language.languages %}
|
|
11
11
|
{% set currentLanguage = params.language.languages | selectattr("current") | first %}
|
|
12
12
|
{% set currentLanguageISOCode = currentLanguage.ISOCode %}
|
|
13
13
|
{% endif %}
|
|
14
14
|
|
|
15
|
-
<header class="ons-header {% if params.classes
|
|
15
|
+
<header class="ons-header {% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
|
|
16
16
|
{{
|
|
17
17
|
onsBrowserBanner({
|
|
18
18
|
"lang": currentLanguageISOCode,
|
|
19
|
-
"wide": params.wide
|
|
19
|
+
"wide": params.wide,
|
|
20
|
+
"fullWidth": params.fullWidth
|
|
20
21
|
})
|
|
21
22
|
}}
|
|
22
|
-
{% if params.phase
|
|
23
|
+
{% if params.phase %}
|
|
23
24
|
{% from "components/phase-banner/_macro.njk" import onsPhaseBanner %}
|
|
24
|
-
{{ onsPhaseBanner(
|
|
25
|
+
{{ onsPhaseBanner({
|
|
26
|
+
"fullWidth": params.fullWidth,
|
|
27
|
+
"wide": params.wide,
|
|
28
|
+
"hideBadge": params.phase.hideBadge,
|
|
29
|
+
"badge": params.phase.badge,
|
|
30
|
+
"html": params.phase.html
|
|
31
|
+
}) }}
|
|
25
32
|
{% endif %}
|
|
26
33
|
{% if params.noMasthead != true %}
|
|
27
34
|
<div class="ons-header__top">
|
|
28
35
|
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
29
|
-
<div class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap{{ ' ons-header__grid-top-tall' if params.customHeaderLogo
|
|
36
|
+
<div class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap{{ ' ons-header__grid-top-tall' if params.customHeaderLogo }}">
|
|
30
37
|
<div class="ons-grid__col ons-col-auto">
|
|
31
|
-
{%-if params.orgLogoHref
|
|
38
|
+
{%-if params.orgLogoHref %}
|
|
32
39
|
<a class="ons-header__org-logo-link" href="{{ params.orgLogoHref }}">
|
|
33
40
|
{% endif -%}
|
|
34
41
|
<div class="ons-header__org-logo ons-header__org-logo--large">
|
|
@@ -48,20 +55,20 @@
|
|
|
48
55
|
})
|
|
49
56
|
}}
|
|
50
57
|
</div>
|
|
51
|
-
{% if params.orgLogoHref
|
|
58
|
+
{% if params.orgLogoHref %}
|
|
52
59
|
</a>
|
|
53
60
|
{% endif %}
|
|
54
61
|
</div>
|
|
55
|
-
{% if params.language
|
|
62
|
+
{% if params.language or params.serviceLinks %}
|
|
56
63
|
<div class="ons-header__links ons-grid__col ons-col-auto">
|
|
57
|
-
{% if params.language
|
|
58
|
-
<div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks
|
|
64
|
+
{% if params.language %}
|
|
65
|
+
<div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks else '' }}">
|
|
59
66
|
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
60
67
|
{{ onsLanguageSelector(params.language) }}
|
|
61
68
|
</div>
|
|
62
69
|
{% endif %}
|
|
63
|
-
{% if params.serviceLinks
|
|
64
|
-
{% if params.serviceLinks.itemsList | length == 1 and params.language
|
|
70
|
+
{% if params.serviceLinks %}
|
|
71
|
+
{% if params.serviceLinks.itemsList | length == 1 and params.language %}
|
|
65
72
|
{% set breakpoint = 'xs' %}
|
|
66
73
|
{% set controlVisibility = true %}
|
|
67
74
|
{% elif params.serviceLinks.itemsList | length > 1 %}
|
|
@@ -72,20 +79,31 @@
|
|
|
72
79
|
{% endif %}
|
|
73
80
|
<div class="ons-grid__col ons-col-auto{% if controlVisibility == true %} ons-u-d-no@xxs@{{ breakpoint }}{% endif %}">
|
|
74
81
|
<nav class="ons-header-service-nav ons-header-service-nav--main {{ params.serviceLinks.classes }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
75
|
-
<ul class="ons-header-service-nav__list"
|
|
82
|
+
<ul class="ons-header-service-nav__list">
|
|
76
83
|
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
77
84
|
<li class="ons-header-service-nav__item">
|
|
85
|
+
{% if item.iconType %}
|
|
86
|
+
{{
|
|
87
|
+
onsIcon({
|
|
88
|
+
"iconType": item.iconType
|
|
89
|
+
})
|
|
90
|
+
}}
|
|
91
|
+
{% endif %}
|
|
92
|
+
{% if item.url %}
|
|
78
93
|
<a
|
|
79
94
|
href="{{ item.url }}"
|
|
80
95
|
class="ons-header-service-nav__link"
|
|
81
|
-
{% if item.id
|
|
96
|
+
{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
82
97
|
>{{ item.title }}</a>
|
|
98
|
+
{% else %}
|
|
99
|
+
{{ item.title }}
|
|
100
|
+
{% endif %}
|
|
83
101
|
</li>
|
|
84
102
|
{% endfor %}
|
|
85
103
|
</ul>
|
|
86
104
|
</nav>
|
|
87
105
|
</div>
|
|
88
|
-
{% if params.serviceLinks.itemsList | length > 1
|
|
106
|
+
{% if params.serviceLinks.itemsList | length > 1 or params.language %}
|
|
89
107
|
{% if params.variants == 'internal' or params.variants == 'neutral' %}
|
|
90
108
|
{% set buttonVariant = ["text-link", "text-link-inverse"] %}
|
|
91
109
|
{% else %}
|
|
@@ -101,7 +119,6 @@
|
|
|
101
119
|
"attributes": {
|
|
102
120
|
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
|
|
103
121
|
"aria-controls": params.serviceLinks.id,
|
|
104
|
-
"aria-haspopup": "true",
|
|
105
122
|
"aria-expanded": "false"
|
|
106
123
|
}
|
|
107
124
|
}) }}
|
|
@@ -112,19 +129,30 @@
|
|
|
112
129
|
{% endif %}
|
|
113
130
|
</div>
|
|
114
131
|
</div>
|
|
115
|
-
{% if params.serviceLinks
|
|
132
|
+
{% if params.serviceLinks %}
|
|
116
133
|
<nav class="ons-header-service-nav ons-header-service-nav--mobile ons-u-d-no ons-js-services-mobile-nav" id="{{ params.serviceLinks.id }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
117
|
-
<ul class="ons-header-service-nav__list"
|
|
134
|
+
<ul class="ons-header-service-nav__list">
|
|
118
135
|
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
119
136
|
<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
|
|
137
|
+
{% if item.iconType %}
|
|
138
|
+
{{
|
|
139
|
+
onsIcon({
|
|
140
|
+
"iconType": item.iconType
|
|
141
|
+
})
|
|
142
|
+
}}
|
|
143
|
+
{% endif %}
|
|
144
|
+
{% if item.url %}
|
|
120
145
|
<a
|
|
121
146
|
href="{{ item.url }}"
|
|
122
147
|
class="ons-header-service-nav__link"
|
|
123
|
-
{% if item.id
|
|
148
|
+
{% if item.id %} id="{{ item.id }}"{% endif %}
|
|
124
149
|
>{{ item.title }}</a>
|
|
150
|
+
{% else %}
|
|
151
|
+
{{ item.title }}
|
|
152
|
+
{% endif %}
|
|
125
153
|
</li>
|
|
126
154
|
{% endfor %}
|
|
127
|
-
{% if params.language
|
|
155
|
+
{% if params.language %}
|
|
128
156
|
<div class="ons-u-d-no@xs">
|
|
129
157
|
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
130
158
|
{{ onsLanguageSelector(params.language) }}
|
|
@@ -139,11 +167,11 @@
|
|
|
139
167
|
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
140
168
|
<div class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap">
|
|
141
169
|
<div class="ons-grid__col ons-col-auto ons-u-flex-shrink">
|
|
142
|
-
{% if params.titleLogo
|
|
143
|
-
{% if params.titleLogoHref
|
|
170
|
+
{% if params.titleLogo and params.titleLogoAlt %}
|
|
171
|
+
{% if params.titleLogoHref %}
|
|
144
172
|
<a class="ons-header__title-logo-link" href="{{ params.titleLogoHref }}">
|
|
145
173
|
{% endif %}
|
|
146
|
-
<div class="ons-header__title-logo ons-header__title-logo--large {% if params.titleLogoClasses %} {{ params.titleLogoClasses }} {% endif %}{% if params.titleLogoMobile
|
|
174
|
+
<div class="ons-header__title-logo ons-header__title-logo--large {% if params.titleLogoClasses %} {{ params.titleLogoClasses }} {% endif %}{% if params.titleLogoMobile %}ons-u-d-no@xxs@s{% endif %}">
|
|
147
175
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
148
176
|
{{
|
|
149
177
|
onsIcon({
|
|
@@ -152,7 +180,7 @@
|
|
|
152
180
|
})
|
|
153
181
|
}}
|
|
154
182
|
</div>
|
|
155
|
-
{% if params.titleLogoMobile
|
|
183
|
+
{% if params.titleLogoMobile %}
|
|
156
184
|
<div class="ons-header__title-logo ons-header__title-logo--mobile ons-u-d-no@s{% if params.titleLogoMobileClasses %} {{ params.titleLogoMobileClasses }}{% endif %}">
|
|
157
185
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
158
186
|
{{
|
|
@@ -163,24 +191,24 @@
|
|
|
163
191
|
}}
|
|
164
192
|
</div>
|
|
165
193
|
{% endif %}
|
|
166
|
-
{% if params.titleLogoHref
|
|
194
|
+
{% if params.titleLogoHref %}
|
|
167
195
|
</a>
|
|
168
196
|
{% endif %}
|
|
169
197
|
{% else %}
|
|
170
|
-
{% if params.titleLogoHref
|
|
198
|
+
{% if params.titleLogoHref %}
|
|
171
199
|
<a class="ons-header__title-link" href="{{ params.titleLogoHref }}">
|
|
172
200
|
{% endif %}
|
|
173
201
|
<{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
|
|
174
|
-
{% if params.titleLogoHref
|
|
202
|
+
{% if params.titleLogoHref %}
|
|
175
203
|
</a>
|
|
176
204
|
{% endif %}
|
|
177
205
|
{% endif %}
|
|
178
|
-
{% if params.description
|
|
206
|
+
{% if params.description %}
|
|
179
207
|
<p class="ons-header__description">{{ params.description }}</p>
|
|
180
208
|
{% endif %}
|
|
181
209
|
</div>
|
|
182
|
-
|
|
183
|
-
{% if params.button
|
|
210
|
+
|
|
211
|
+
{% if params.button %}
|
|
184
212
|
{% if params.variants == 'neutral' %}
|
|
185
213
|
{% set buttonVariant = ["ghost", "ghost-dark"] %}
|
|
186
214
|
{% else %}
|
|
@@ -199,10 +227,10 @@
|
|
|
199
227
|
}) }}
|
|
200
228
|
</div>
|
|
201
229
|
{% endif %}
|
|
202
|
-
{% if params.navigation
|
|
230
|
+
{% if params.navigation %}
|
|
203
231
|
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
204
232
|
{% if params.noMasthead == true %}
|
|
205
|
-
{% if params.language
|
|
233
|
+
{% if params.language %}
|
|
206
234
|
<div class="ons-grid__col ons-col-auto ons-u-mt-xxs@xxs@l ons-u-mr-xs@xxs@s {% if params.navigation.siteSearchAutosuggest %}ons-header__lang-adjustment{% endif %}">
|
|
207
235
|
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
208
236
|
{{ onsLanguageSelector(params.language) }}
|
|
@@ -225,13 +253,12 @@
|
|
|
225
253
|
"attributes": {
|
|
226
254
|
"aria-label": "Toggle search" ,
|
|
227
255
|
"aria-controls": "ons-site-search",
|
|
228
|
-
"aria-haspopup": "true",
|
|
229
256
|
"aria-expanded": "false"
|
|
230
257
|
}
|
|
231
258
|
}) }}
|
|
232
259
|
</span>
|
|
233
260
|
{% endif %}
|
|
234
|
-
{% if params.navigation.toggleNavigationButton
|
|
261
|
+
{% if params.navigation.toggleNavigationButton %}
|
|
235
262
|
{% if params.variants == 'neutral' %}
|
|
236
263
|
{% set buttonVariant = ["mobile", "ghost-dark"] %}
|
|
237
264
|
{% else %}
|
|
@@ -245,7 +272,6 @@
|
|
|
245
272
|
"attributes": {
|
|
246
273
|
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
|
|
247
274
|
"aria-controls": params.navigation.id,
|
|
248
|
-
"aria-haspopup": "true",
|
|
249
275
|
"aria-expanded": "false"
|
|
250
276
|
}
|
|
251
277
|
}) }}
|
|
@@ -255,7 +281,7 @@
|
|
|
255
281
|
</div>
|
|
256
282
|
</div>
|
|
257
283
|
</div>
|
|
258
|
-
{% if params.navigation
|
|
284
|
+
{% if params.navigation %}
|
|
259
285
|
{{ onsNavigation(params) }}
|
|
260
286
|
{% endif %}
|
|
261
287
|
</header>
|
|
@@ -13,7 +13,6 @@ const EXAMPLE_HEADER_BASIC = {
|
|
|
13
13
|
const EXAMPLE_SERVICE_LINKS_CONFIG = {
|
|
14
14
|
id: 'service-links',
|
|
15
15
|
ariaLabel: 'Services menu',
|
|
16
|
-
ariaListLabel: 'Menu',
|
|
17
16
|
classes: 'custom-class',
|
|
18
17
|
toggleServicesButton: {
|
|
19
18
|
text: 'Menu',
|
|
@@ -21,6 +20,24 @@ const EXAMPLE_SERVICE_LINKS_CONFIG = {
|
|
|
21
20
|
},
|
|
22
21
|
};
|
|
23
22
|
|
|
23
|
+
const EXAMPLE_HEADER_SERVICE_LIST_ITEMS = {
|
|
24
|
+
...EXAMPLE_HEADER_BASIC,
|
|
25
|
+
serviceLinks: {
|
|
26
|
+
...EXAMPLE_SERVICE_LINKS_CONFIG,
|
|
27
|
+
itemsList: [
|
|
28
|
+
{
|
|
29
|
+
title: 'Title 1',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
title: 'Title 2',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
title: 'Title 3',
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
24
41
|
const EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE = {
|
|
25
42
|
...EXAMPLE_HEADER_BASIC,
|
|
26
43
|
serviceLinks: {
|
|
@@ -339,12 +356,51 @@ describe('macro: header', () => {
|
|
|
339
356
|
const faker = templateFaker();
|
|
340
357
|
const phaseSpy = faker.spy('phase-banner');
|
|
341
358
|
|
|
342
|
-
faker.renderComponent('header', {
|
|
359
|
+
faker.renderComponent('header', {
|
|
360
|
+
...EXAMPLE_HEADER_BASIC,
|
|
361
|
+
phase: {
|
|
362
|
+
badge: 'Example',
|
|
363
|
+
html: 'Example content with a <a href="#">link</a>',
|
|
364
|
+
},
|
|
365
|
+
});
|
|
343
366
|
|
|
344
367
|
expect(phaseSpy.occurrences).toContainEqual({
|
|
368
|
+
badge: 'Example',
|
|
345
369
|
html: 'Example content with a <a href="#">link</a>',
|
|
346
370
|
});
|
|
347
371
|
});
|
|
372
|
+
|
|
373
|
+
it('renders the phase banner in the correct container if `wide`', () => {
|
|
374
|
+
const $ = cheerio.load(
|
|
375
|
+
renderComponent('header', {
|
|
376
|
+
...EXAMPLE_HEADER_BASIC,
|
|
377
|
+
wide: true,
|
|
378
|
+
phase: {
|
|
379
|
+
badge: 'Example',
|
|
380
|
+
html: 'Example content with a <a href="#">link</a>',
|
|
381
|
+
},
|
|
382
|
+
}),
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
const phaseContainer = $('.ons-phase-banner .ons-container');
|
|
386
|
+
expect($(phaseContainer).hasClass('ons-container--wide')).toBe(true);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
it('renders the phase banner in the correct container if `fullWidth`', () => {
|
|
390
|
+
const $ = cheerio.load(
|
|
391
|
+
renderComponent('header', {
|
|
392
|
+
...EXAMPLE_HEADER_BASIC,
|
|
393
|
+
fullWidth: true,
|
|
394
|
+
phase: {
|
|
395
|
+
badge: 'Example',
|
|
396
|
+
html: 'Example content with a <a href="#">link</a>',
|
|
397
|
+
},
|
|
398
|
+
}),
|
|
399
|
+
);
|
|
400
|
+
|
|
401
|
+
const phaseContainer = $('.ons-phase-banner .ons-container');
|
|
402
|
+
expect($(phaseContainer).hasClass('ons-container--full-width')).toBe(true);
|
|
403
|
+
});
|
|
348
404
|
});
|
|
349
405
|
|
|
350
406
|
describe('mode: with service links', () => {
|
|
@@ -378,10 +434,11 @@ describe('macro: header', () => {
|
|
|
378
434
|
expect($('.ons-header-service-nav--main').attr('aria-label')).toBe('Services menu');
|
|
379
435
|
});
|
|
380
436
|
|
|
381
|
-
it('has the
|
|
382
|
-
const $ = cheerio.load(renderComponent('header',
|
|
437
|
+
it('has the text for each list item', () => {
|
|
438
|
+
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LIST_ITEMS));
|
|
383
439
|
|
|
384
|
-
|
|
440
|
+
const values = mapAll($('.ons-header-service-nav--main .ons-header-service-nav__item'), node => node.text().trim());
|
|
441
|
+
expect(values).toEqual(['Title 1', 'Title 2', 'Title 3']);
|
|
385
442
|
});
|
|
386
443
|
|
|
387
444
|
it('has the link text for each list item', () => {
|
|
@@ -410,12 +467,6 @@ describe('macro: header', () => {
|
|
|
410
467
|
expect($('.ons-header-service-nav--mobile').attr('aria-label')).toBe('Services menu');
|
|
411
468
|
});
|
|
412
469
|
|
|
413
|
-
it('has the provided `aria-label` for the list for mobile', () => {
|
|
414
|
-
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LINKS_SINGLE));
|
|
415
|
-
|
|
416
|
-
expect($('.ons-header-service-nav--mobile .ons-header-service-nav__list').attr('aria-label')).toBe('Menu');
|
|
417
|
-
});
|
|
418
|
-
|
|
419
470
|
it('has the link text for each list item for mobile', () => {
|
|
420
471
|
const $ = cheerio.load(renderComponent('header', EXAMPLE_HEADER_SERVICE_LINKS_MULTIPLE));
|
|
421
472
|
|
|
@@ -445,7 +496,6 @@ describe('macro: header', () => {
|
|
|
445
496
|
attributes: {
|
|
446
497
|
'aria-label': 'Toggle services menu',
|
|
447
498
|
'aria-controls': 'service-links',
|
|
448
|
-
'aria-haspopup': 'true',
|
|
449
499
|
'aria-expanded': 'false',
|
|
450
500
|
},
|
|
451
501
|
});
|
|
@@ -481,6 +531,26 @@ describe('macro: header', () => {
|
|
|
481
531
|
|
|
482
532
|
expect($('.ons-js-toggle-services').length).toBe(0);
|
|
483
533
|
});
|
|
534
|
+
|
|
535
|
+
it('has the correct list item icon', () => {
|
|
536
|
+
const faker = templateFaker();
|
|
537
|
+
const iconsSpy = faker.spy('icons');
|
|
538
|
+
|
|
539
|
+
faker.renderComponent('header', {
|
|
540
|
+
...EXAMPLE_HEADER_BASIC,
|
|
541
|
+
serviceLinks: {
|
|
542
|
+
...EXAMPLE_SERVICE_LINKS_CONFIG,
|
|
543
|
+
itemsList: [
|
|
544
|
+
{
|
|
545
|
+
title: 'Title 1',
|
|
546
|
+
iconType: 'check',
|
|
547
|
+
},
|
|
548
|
+
],
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
|
|
552
|
+
expect(iconsSpy.occurrences[2].iconType).toBe('check');
|
|
553
|
+
});
|
|
484
554
|
});
|
|
485
555
|
|
|
486
556
|
describe('mode: with language selector', () => {
|
|
@@ -558,7 +628,6 @@ describe('macro: header', () => {
|
|
|
558
628
|
attributes: {
|
|
559
629
|
'aria-label': 'Toggle main menu',
|
|
560
630
|
'aria-controls': 'main-nav',
|
|
561
|
-
'aria-haspopup': 'true',
|
|
562
631
|
'aria-expanded': 'false',
|
|
563
632
|
},
|
|
564
633
|
});
|
|
@@ -601,7 +670,6 @@ describe('macro: header', () => {
|
|
|
601
670
|
attributes: {
|
|
602
671
|
'aria-label': 'Toggle search',
|
|
603
672
|
'aria-controls': 'ons-site-search',
|
|
604
|
-
'aria-haspopup': 'true',
|
|
605
673
|
'aria-expanded': 'false',
|
|
606
674
|
},
|
|
607
675
|
});
|
|
@@ -3,46 +3,46 @@
|
|
|
3
3
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
4
4
|
|
|
5
5
|
{# style adjustments if dark or light skin #}
|
|
6
|
-
{% if params.variants
|
|
6
|
+
{% if params.variants and 'dark' in params.variants %}
|
|
7
7
|
{% set skinName = "dark" %}
|
|
8
8
|
{% else %}
|
|
9
9
|
{% set skinName = "light" %}
|
|
10
10
|
{% endif %}
|
|
11
11
|
|
|
12
12
|
{# If hero contains a collapsible, style it differently #}
|
|
13
|
-
{% if params.collapsible
|
|
13
|
+
{% if params.collapsible %}
|
|
14
14
|
{% set containerClasses = " ons-hero__container--has-collapsible" %}
|
|
15
15
|
{% endif %}
|
|
16
16
|
|
|
17
17
|
{# Set number of columns used for hero content after medium breakpoint #}
|
|
18
18
|
{% set detailsColumns = params.detailsColumns | default ('8') %}
|
|
19
19
|
|
|
20
|
-
<section class="ons-hero ons-grid--gutterless{% if params.variants
|
|
20
|
+
<section class="ons-hero ons-grid--gutterless{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-hero--{{ variant }}{% endfor %}{% else %} ons-hero--{{ params.variants }}{% endif %}{% endif %}">
|
|
21
21
|
|
|
22
22
|
<div class="ons-hero__container ons-container{{ ' ons-container--wide' if params.wide }}{{ containerClasses }}">
|
|
23
23
|
|
|
24
24
|
<div class="ons-hero__details{{ detailsClasses }} ons-grid__col ons-col-{{ detailsColumns }}@m ons-col-10@s@m">
|
|
25
25
|
|
|
26
26
|
<header>
|
|
27
|
-
{% if params.preTitleImage
|
|
28
|
-
{% set preTitleImageWithModifier = params.preTitleImage.name
|
|
27
|
+
{% if params.preTitleImage %}
|
|
28
|
+
{% set preTitleImageWithModifier = params.preTitleImage.name ~ "--" ~ skinName ~ ".svg" %}
|
|
29
29
|
<img class="ons-hero__pre-title" src="{{ params.placeholderURL }}/img/{{ preTitleImageWithModifier }}" alt="{{ params.preTitleImage.alt }}">
|
|
30
30
|
{% endif %}
|
|
31
|
-
{% if params.title
|
|
31
|
+
{% if params.title %}
|
|
32
32
|
<h1 class="ons-hero__title ons-u-fs-xxxl">{{ params.title }}</h1>
|
|
33
33
|
{% endif %}
|
|
34
|
-
{% if params.subtitle
|
|
34
|
+
{% if params.subtitle %}
|
|
35
35
|
<h2 class="ons-hero__subtitle ons-u-fs-r--b">{{ params.subtitle }}</h2>
|
|
36
36
|
{% endif %}
|
|
37
37
|
</header>
|
|
38
38
|
|
|
39
|
-
{% if params.text
|
|
39
|
+
{% if params.text %}
|
|
40
40
|
<p class="ons-hero__text">{{ params.text | safe }}</p>
|
|
41
41
|
{% endif %}
|
|
42
42
|
|
|
43
|
-
{% if params.button
|
|
43
|
+
{% if params.button %}
|
|
44
44
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
45
|
-
{% set btnClasses = params.button.classes if params.button.classes
|
|
45
|
+
{% set btnClasses = params.button.classes if params.button.classes else '' %}
|
|
46
46
|
{% if skinName == 'dark' %}
|
|
47
47
|
{% set btnClasses = btnClasses + ' ons-btn--ghost' %}
|
|
48
48
|
{% endif %}
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
}}
|
|
57
57
|
{% endif %}
|
|
58
58
|
|
|
59
|
-
{% if params.collapsible
|
|
59
|
+
{% if params.collapsible %}
|
|
60
60
|
{% from "components/collapsible/_macro.njk" import onsCollapsible %}
|
|
61
61
|
{{
|
|
62
62
|
onsCollapsible({
|
|
@@ -73,16 +73,16 @@
|
|
|
73
73
|
}}
|
|
74
74
|
{% endif %}
|
|
75
75
|
|
|
76
|
-
{% if params.suffixText
|
|
76
|
+
{% if params.suffixText %}
|
|
77
77
|
<p class="ons-hero__suffixText ons-u-fs-s ons-u-mt-m ons-u-mb-no">{{ params.suffixText | safe }}</p>
|
|
78
78
|
{% endif %}
|
|
79
79
|
|
|
80
80
|
</div>
|
|
81
|
-
{% if params.variants
|
|
81
|
+
{% if params.variants and 'census' in params.variants %}
|
|
82
82
|
|
|
83
|
-
{% if params.image
|
|
83
|
+
{% if params.image %}
|
|
84
84
|
<div class="ons-hero__circle-image">
|
|
85
|
-
<img height="558" width="558" {% if params.image.largeSrc
|
|
85
|
+
<img height="558" width="558" {% if params.image.largeSrc %}srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x" {% endif %}src="{{ params.image.smallSrc }}" alt="">
|
|
86
86
|
</div>
|
|
87
87
|
{% endif %}
|
|
88
88
|
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
|
|
95
95
|
<div class="ons-hero__circle-gradient"></div>
|
|
96
96
|
|
|
97
|
-
{% if (params.variants
|
|
97
|
+
{% if (params.variants and 'census' in params.variants) and ('dark' not in params.variants) %}
|
|
98
98
|
<div class="ons-hero__circle"></div>
|
|
99
99
|
{% endif %}
|
|
100
100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% macro onsIcon(params) %}
|
|
2
2
|
|
|
3
|
-
{% if params.classes
|
|
3
|
+
{% if params.classes %}
|
|
4
4
|
{% set iconClasses = ' ' + params.classes %}
|
|
5
5
|
{% endif %}
|
|
6
6
|
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
<path d="M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z"/>
|
|
63
63
|
</svg>
|
|
64
64
|
{% elif params.iconType == "sort-sprite" %}
|
|
65
|
-
<svg id="sort-sprite{% if params.id
|
|
65
|
+
<svg id="sort-sprite{% if params.id %}-{{ params.id | lower }}{% endif %}" class="ons-svg-icon{{ iconClasses }}" viewBox="0 0 12 19" xmlns="http://www.w3.org/2000/svg" focusable="false" fill="currentColor">
|
|
66
66
|
<path class="ons-topTriangle" d="M6 0l6 7.2H0L6 0zm0 18.6l6-7.2H0l6 7.2zm0 3.6l6 7.2H0l6-7.2z"/>
|
|
67
67
|
<path class="ons-bottomTriangle" d="M6 18.6l6-7.2H0l6 7.2zm0 3.6l6 7.2H0l6-7.2z"/>
|
|
68
68
|
</svg>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{%- macro onsImage(params) -%}
|
|
2
2
|
<figure class="ons-figure">
|
|
3
3
|
|
|
4
|
-
{% if params.image
|
|
5
|
-
<img class="ons-figure__image" {% if params.image.largeSrc
|
|
4
|
+
{% if params.image %}
|
|
5
|
+
<img class="ons-figure__image" {% if params.image.largeSrc %}srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %}src="{{ params.image.smallSrc }}" alt="{{ params.alt if params.alt else '' }}">
|
|
6
6
|
{% else %}
|
|
7
7
|
<img class="ons-figure__image" src="{{ params.url }}" alt="{{ params.alt }}">
|
|
8
8
|
{% endif %}
|
|
9
9
|
|
|
10
|
-
{% if params.caption
|
|
10
|
+
{% if params.caption %}
|
|
11
11
|
<figcaption class="ons-figure__caption">
|
|
12
12
|
{{ params.caption }}
|
|
13
13
|
</figcaption>
|
|
@@ -16,12 +16,14 @@
|
|
|
16
16
|
&:focus {
|
|
17
17
|
// Overide default input focus so it can wrap prefix/suffix too
|
|
18
18
|
box-shadow: none;
|
|
19
|
+
outline: none;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
// Overide default input error style so it can wrap prefix/suffix too
|
|
22
23
|
&.ons-input--error:not(:focus) {
|
|
23
24
|
border-right: $input-border-width solid $color-input-border;
|
|
24
25
|
box-shadow: none;
|
|
26
|
+
outline: none;
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
|
|
@@ -46,6 +48,10 @@
|
|
|
46
48
|
border: 1px solid $color-input-border;
|
|
47
49
|
}
|
|
48
50
|
|
|
51
|
+
&__type[title] {
|
|
52
|
+
cursor: help;
|
|
53
|
+
}
|
|
54
|
+
|
|
49
55
|
&__input:focus + &__type::after {
|
|
50
56
|
// Style input + prefix/suffix on focus
|
|
51
57
|
@extend %ons-input-focus;
|
|
@@ -101,6 +107,7 @@
|
|
|
101
107
|
content: '';
|
|
102
108
|
display: block;
|
|
103
109
|
left: 0;
|
|
110
|
+
outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
104
111
|
position: absolute;
|
|
105
112
|
right: 0;
|
|
106
113
|
top: 0;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
%ons-input-focus {
|
|
2
2
|
box-shadow: 0 0 0 $input-border-width $color-input-border, 0 0 0 4px $color-focus;
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
// Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
5
|
+
outline: 3px solid transparent;
|
|
6
|
+
outline-offset: 1px;
|
|
7
|
+
|
|
8
|
+
@media screen and (forced-colors: active) {
|
|
9
|
+
// To better match the focus states of native controls
|
|
10
|
+
outline-color: Highlight;
|
|
11
|
+
}
|
|
4
12
|
}
|
|
5
13
|
|
|
6
14
|
.ons-input {
|
|
@@ -47,6 +55,7 @@
|
|
|
47
55
|
&--error:not(:focus) {
|
|
48
56
|
border: $input-border-width solid $color-errors;
|
|
49
57
|
box-shadow: 0 0 0 $input-border-width $color-errors;
|
|
58
|
+
outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show box-shadows
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
&--with-description {
|
|
@@ -73,7 +82,9 @@
|
|
|
73
82
|
|
|
74
83
|
.ons-input--select {
|
|
75
84
|
appearance: none;
|
|
76
|
-
background: $color-input-bg
|
|
85
|
+
background: $color-input-bg
|
|
86
|
+
url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 11.75 7.7'%3E%3Cpath fill='currentColor' d='m1.37.15 4.5 5.1 4.5-5.1a.37.37 0 0 1 .6 0l.7.7a.45.45 0 0 1 0 .5l-5.5 6.2a.37.37 0 0 1-.6 0l-5.5-6.1a.64.64 0 0 1 0-.6l.7-.7a.64.64 0 0 1 .6 0Z'/%3E%3C/svg%3E")
|
|
87
|
+
no-repeat center right 10px;
|
|
77
88
|
background-size: 1rem;
|
|
78
89
|
line-height: 1.3rem;
|
|
79
90
|
padding: 0.39rem 2rem 0.39rem $input-padding-horizontal;
|