@ons/design-system 50.0.1 → 53.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.
Files changed (182) hide show
  1. package/README.md +35 -15
  2. package/components/access-code/_macro.njk +1 -1
  3. package/components/access-code/_macro.spec.js +162 -0
  4. package/components/access-code/uac.spec.js +26 -0
  5. package/components/accordion/_macro.spec.js +224 -0
  6. package/components/accordion/accordion.spec.js +134 -0
  7. package/components/address-input/_macro.njk +1 -1
  8. package/components/address-input/_macro.spec.js +465 -0
  9. package/components/address-input/autosuggest.address.js +5 -4
  10. package/components/address-input/autosuggest.address.setter.js +9 -3
  11. package/components/address-input/autosuggest.address.spec.js +733 -0
  12. package/components/address-output/_macro.njk +6 -6
  13. package/components/address-output/_macro.spec.js +122 -0
  14. package/components/autosuggest/_macro.njk +1 -1
  15. package/components/autosuggest/_macro.spec.js +229 -0
  16. package/components/autosuggest/autosuggest.helpers.js +2 -3
  17. package/components/autosuggest/autosuggest.helpers.spec.js +85 -0
  18. package/components/autosuggest/autosuggest.js +4 -2
  19. package/components/autosuggest/autosuggest.spec.js +625 -0
  20. package/components/autosuggest/autosuggest.ui.js +6 -2
  21. package/components/breadcrumbs/_macro.spec.js +129 -0
  22. package/components/button/_button.scss +75 -33
  23. package/components/button/_macro.njk +6 -6
  24. package/components/button/_macro.spec.js +446 -0
  25. package/components/button/button.spec.js +290 -0
  26. package/components/call-to-action/_macro.njk +3 -1
  27. package/components/call-to-action/_macro.spec.js +52 -0
  28. package/components/card/_macro.njk +26 -19
  29. package/components/card/_macro.spec.js +261 -0
  30. package/components/char-check-limit/_macro.spec.js +73 -0
  31. package/components/char-check-limit/character-check.spec.js +196 -0
  32. package/components/char-check-limit/character-limit.js +1 -1
  33. package/components/checkboxes/_checkbox-macro.spec.js +419 -0
  34. package/components/checkboxes/_macro.njk +1 -3
  35. package/components/checkboxes/_macro.spec.js +306 -0
  36. package/components/checkboxes/checkbox-with-autoselect.js +2 -1
  37. package/components/checkboxes/checkboxes.spec.js +208 -0
  38. package/components/code-highlight/_macro.spec.js +56 -0
  39. package/components/code-highlight/code-highlight.spec.js +18 -0
  40. package/components/collapsible/_macro.spec.js +204 -0
  41. package/components/collapsible/collapsible.js +2 -1
  42. package/components/collapsible/collapsible.spec.js +236 -0
  43. package/components/content-pagination/_macro.spec.js +199 -0
  44. package/components/cookies-banner/_macro.njk +1 -1
  45. package/components/cookies-banner/_macro.spec.js +171 -0
  46. package/components/cookies-banner/cookies-banner.spec.js +90 -0
  47. package/components/date-input/_macro.njk +6 -3
  48. package/components/date-input/_macro.spec.js +286 -0
  49. package/components/document-list/_macro.njk +3 -5
  50. package/components/document-list/_macro.spec.js +491 -0
  51. package/components/download-resources/download-resources.spec.js +540 -0
  52. package/components/duration/_macro.njk +7 -6
  53. package/components/duration/_macro.spec.js +251 -0
  54. package/components/error/_macro.spec.js +97 -0
  55. package/components/external-link/_macro.njk +5 -2
  56. package/components/external-link/_macro.spec.js +77 -0
  57. package/components/feedback/_macro.njk +5 -3
  58. package/components/feedback/_macro.spec.js +122 -0
  59. package/components/field/_macro.njk +2 -2
  60. package/components/field/_macro.spec.js +97 -0
  61. package/components/fieldset/_macro.njk +3 -3
  62. package/components/fieldset/_macro.spec.js +173 -0
  63. package/components/footer/_footer.scss +19 -4
  64. package/components/footer/_macro.njk +106 -137
  65. package/components/footer/_macro.spec.js +678 -0
  66. package/components/header/_header.scss +65 -46
  67. package/components/header/_macro.njk +173 -121
  68. package/components/header/_macro.spec.js +618 -0
  69. package/components/hero/_hero.scss +30 -143
  70. package/components/hero/_macro.njk +12 -23
  71. package/components/hero/_macro.spec.js +218 -0
  72. package/components/icons/_macro.njk +258 -30
  73. package/components/icons/_macro.spec.js +140 -0
  74. package/components/images/_macro.njk +1 -1
  75. package/components/images/_macro.spec.js +121 -0
  76. package/components/input/_input-type.scss +12 -5
  77. package/components/input/_input.scss +8 -0
  78. package/components/input/_macro.njk +4 -5
  79. package/components/input/_macro.spec.js +658 -0
  80. package/components/label/_macro.spec.js +189 -0
  81. package/components/language-selector/_macro.njk +1 -1
  82. package/components/language-selector/_macro.spec.js +137 -0
  83. package/components/lists/_list.scss +4 -0
  84. package/components/lists/_macro.njk +4 -7
  85. package/components/lists/_macro.spec.js +618 -0
  86. package/components/message/_macro.spec.js +137 -0
  87. package/components/message-list/_macro.njk +7 -7
  88. package/components/message-list/_macro.spec.js +159 -0
  89. package/components/metadata/_macro.spec.js +167 -0
  90. package/components/modal/_macro.njk +6 -6
  91. package/components/modal/_macro.spec.js +87 -0
  92. package/components/modal/modal.spec.js +59 -0
  93. package/components/mutually-exclusive/_macro.njk +2 -2
  94. package/components/mutually-exclusive/_macro.spec.js +184 -0
  95. package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +203 -0
  96. package/components/mutually-exclusive/mutually-exclusive.date.spec.js +142 -0
  97. package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +141 -0
  98. package/components/mutually-exclusive/mutually-exclusive.email.spec.js +117 -0
  99. package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +213 -0
  100. package/components/mutually-exclusive/mutually-exclusive.number.spec.js +125 -0
  101. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +131 -0
  102. package/components/navigation/_macro.njk +45 -38
  103. package/components/navigation/_macro.spec.js +329 -0
  104. package/components/navigation/_navigation.scss +20 -4
  105. package/components/navigation/navigation.dom.js +1 -1
  106. package/components/navigation/navigation.spec.js +232 -0
  107. package/components/pagination/_macro.njk +1 -1
  108. package/components/pagination/_macro.spec.js +411 -0
  109. package/components/panel/_macro.njk +6 -6
  110. package/components/panel/_macro.spec.js +423 -0
  111. package/components/password/_macro.spec.js +137 -0
  112. package/components/password/password.spec.js +40 -0
  113. package/components/phase-banner/_macro.spec.js +73 -0
  114. package/components/promotional-banner/_macro.spec.js +97 -0
  115. package/components/question/_macro.njk +16 -22
  116. package/components/question/_macro.spec.js +309 -0
  117. package/components/quote/_macro.spec.js +81 -0
  118. package/components/radios/_macro.njk +3 -6
  119. package/components/radios/_macro.spec.js +575 -0
  120. package/components/radios/radios.spec.js +180 -0
  121. package/components/related-content/_macro.njk +14 -21
  122. package/components/related-content/_macro.spec.js +133 -0
  123. package/components/related-content/_section-macro.njk +10 -0
  124. package/components/related-content/_section-macro.spec.js +43 -0
  125. package/components/relationships/_macro.spec.js +108 -0
  126. package/components/relationships/relationships.spec.js +84 -0
  127. package/components/reply/_macro.njk +2 -2
  128. package/components/reply/_macro.spec.js +69 -0
  129. package/components/reply/reply.spec.js +78 -0
  130. package/components/search/_macro.njk +14 -12
  131. package/components/search/_macro.spec.js +44 -0
  132. package/components/search/_search.scss +7 -7
  133. package/components/section-navigation/_macro.njk +7 -2
  134. package/components/section-navigation/_macro.spec.js +206 -0
  135. package/components/select/_macro.njk +3 -3
  136. package/components/select/_macro.spec.js +203 -0
  137. package/components/select/select.spec.js +56 -0
  138. package/components/share-page/_macro.njk +6 -4
  139. package/components/share-page/_macro.spec.js +110 -0
  140. package/components/skip-to-content/_macro.spec.js +57 -0
  141. package/components/skip-to-content/skip-to-content.spec.js +44 -0
  142. package/components/status/_macro.spec.js +77 -0
  143. package/components/summary/_macro.njk +5 -5
  144. package/components/summary/_macro.spec.js +472 -0
  145. package/components/table/_macro.njk +2 -2
  146. package/components/table/_macro.spec.js +557 -0
  147. package/components/table/table.spec.js +155 -0
  148. package/components/table-of-contents/_macro.njk +35 -35
  149. package/components/table-of-contents/_macro.spec.js +178 -0
  150. package/components/table-of-contents/toc.js +29 -25
  151. package/components/table-of-contents/toc.spec.js +61 -0
  152. package/components/tabs/_macro.njk +1 -1
  153. package/components/tabs/_macro.spec.js +79 -0
  154. package/components/tabs/tabs.spec.js +162 -0
  155. package/components/text-indent/_macro.spec.js +52 -0
  156. package/components/textarea/_macro.njk +5 -3
  157. package/components/textarea/_macro.spec.js +300 -0
  158. package/components/textarea/textarea.spec.js +98 -0
  159. package/components/timeline/_macro.njk +3 -3
  160. package/components/timeline/_macro.spec.js +81 -0
  161. package/components/timeout-modal/_macro.spec.js +68 -0
  162. package/components/timeout-modal/timeout-modal.spec.js +226 -0
  163. package/components/timeout-panel/_macro.njk +0 -1
  164. package/components/timeout-panel/_macro.spec.js +54 -0
  165. package/components/timeout-panel/timeout-panel.dom.js +1 -2
  166. package/components/timeout-panel/timeout-panel.spec.js +161 -0
  167. package/components/upload/_macro.spec.js +75 -0
  168. package/components/video/_macro.spec.js +34 -0
  169. package/css/census.css +3 -1
  170. package/css/ids.css +2 -0
  171. package/css/main.css +1 -1
  172. package/img/dummy-brand-logo.svg +1 -0
  173. package/js/cookies-settings.spec.js +154 -0
  174. package/layout/_template.njk +7 -4
  175. package/package.json +10 -23
  176. package/scripts/main.es5.js +2 -2
  177. package/scripts/main.js +1 -1
  178. package/scss/ids.scss +2 -0
  179. package/scss/settings/_census.scss +141 -0
  180. package/scss/settings/_ids.scss +48 -0
  181. package/scss/utilities/_margin.scss +1 -0
  182. package/scss/vars/_colors.scss +5 -2
@@ -6,21 +6,9 @@
6
6
  margin: 0;
7
7
  position: relative;
8
8
 
9
- & &__title--svg-logo {
10
- display: block;
11
- fill: $color-white;
12
-
13
- @include mq(m) {
14
- margin: 0.84rem 0;
15
- }
16
-
17
- @include mq(xxs, 399px) {
18
- max-width: 160px;
19
- }
20
- }
21
9
  // Elements
22
10
  &__top {
23
- background: $color-header-top;
11
+ background: $color-header-masthead;
24
12
  width: 100%;
25
13
  }
26
14
  &__grid-top {
@@ -56,20 +44,10 @@
56
44
  margin-top: 0.8rem;
57
45
  }
58
46
 
59
- //to allow for differences in size between welsh and english logos
60
- &-census-logo-en {
61
- @include mq(xxs) {
62
- margin: 0.19rem 0 0.2rem;
63
- padding: 0.25rem 0;
64
- }
65
- }
66
47
  &-link {
67
48
  display: block;
68
49
  text-decoration: none;
69
50
  &:focus {
70
- .ons-header__title--svg-logo {
71
- fill: $color-text-link-focus;
72
- }
73
51
  .ons-header__title {
74
52
  color: $color-text-link-focus;
75
53
  }
@@ -78,11 +56,6 @@
78
56
  text-decoration: underline solid $color-text-inverse-link 2px;
79
57
  }
80
58
  }
81
- &--nav-adj {
82
- @include mq(399px) {
83
- padding-top: 0.2rem;
84
- }
85
- }
86
59
  }
87
60
  &__description {
88
61
  @extend .ons-u-fs-s;
@@ -106,9 +79,11 @@
106
79
  }
107
80
  }
108
81
  }
109
- &--internal & {
82
+
83
+ &--internal &,
84
+ &--neutral & {
110
85
  &__top {
111
- background: $color-header-top-internal;
86
+ background: $color-header-masthead-internal;
112
87
  .ons-svg-logo {
113
88
  display: block;
114
89
  .ons-svg-logo__group--text,
@@ -117,7 +92,7 @@
117
92
  }
118
93
  }
119
94
  }
120
- &__logo-link:focus {
95
+ &__org-logo-link:focus {
121
96
  background-color: transparent;
122
97
  box-shadow: none;
123
98
  outline: 3px solid $color-focus;
@@ -136,40 +111,72 @@
136
111
  }
137
112
  }
138
113
 
114
+ &--neutral & {
115
+ &__top {
116
+ background: $color-header-masthead-dark;
117
+ }
118
+
119
+ &__main {
120
+ background: $color-header-light;
121
+
122
+ &--border {
123
+ border-bottom: 3px solid $color-header-light;
124
+ border-top: 3px solid $color-header-light;
125
+ }
126
+ }
127
+
128
+ &__title {
129
+ color: $color-branded-text;
130
+ &-link {
131
+ &:hover {
132
+ text-decoration: underline solid $color-branded-text 2px;
133
+ }
134
+ }
135
+ }
136
+ }
137
+
139
138
  .ons-svg-logo {
140
139
  display: block;
141
140
  }
142
141
 
143
- &__logo-link:focus {
144
- .ons-svg-logo {
145
- .ons-svg-logo__group {
142
+ &__org-logo-link,
143
+ &__title-logo-link {
144
+ display: block;
145
+ &:focus {
146
+ .ons-svg-logo {
146
147
  fill: $color-black !important;
148
+ .ons-svg-logo__group {
149
+ fill: $color-black !important;
150
+ }
151
+ }
152
+ }
153
+ &:hover {
154
+ font-size: 0;
155
+ text-decoration: none;
156
+ }
157
+ }
158
+
159
+ &__title-logo--large {
160
+ .ons-svg-logo {
161
+ @include mq(xxs, 399px) {
162
+ height: auto;
163
+ max-width: 160px;
147
164
  }
148
165
  }
149
166
  }
150
167
 
151
- .ons-header__logo--large {
168
+ &__org-logo--large {
152
169
  @include mq(xxs, 454px) {
153
170
  display: none;
154
171
  }
155
172
  }
156
173
 
157
- .ons-header__logo--small {
174
+ &__org-logo--small {
158
175
  @include mq(455px) {
159
176
  display: none;
160
177
  }
161
178
  }
162
179
 
163
- &__logo-link,
164
- &__logo-link:hover {
165
- font-size: 0;
166
- text-decoration: none;
167
- }
168
-
169
- &__logo-link {
170
- display: block;
171
- }
172
-
173
180
  &-service-nav {
174
181
  display: inline-block;
175
182
 
@@ -179,6 +186,12 @@
179
186
  width: 100%;
180
187
  }
181
188
 
189
+ .ons-header--neutral & {
190
+ &--mobile {
191
+ background: $color-grey-5;
192
+ }
193
+ }
194
+
182
195
  &__list {
183
196
  list-style: none;
184
197
  margin: 0;
@@ -207,4 +220,10 @@
207
220
  }
208
221
  }
209
222
  }
223
+ &__lang-adjustment {
224
+ @include mq(l) {
225
+ margin-right: 21rem;
226
+ margin-top: -5px !important;
227
+ }
228
+ }
210
229
  }
@@ -3,7 +3,7 @@
3
3
  {% from "components/icons/_macro.njk" import onsIcon %}
4
4
  {% from "components/navigation/_macro.njk" import onsNavigation %}
5
5
 
6
- {% set title_tag = "h1" if params.tilteAsH1 else "div" %}
6
+ {% set title_tag = "h1" if params.titleAsH1 else "div" %}
7
7
  {% set currentLanguageISOCode = "en" %}
8
8
 
9
9
  {% if params.language is defined and params.language and params.language.languages is defined and params.language.languages %}
@@ -11,145 +11,179 @@
11
11
  {% set currentLanguageISOCode = currentLanguage.ISOCode %}
12
12
  {% endif %}
13
13
 
14
- <header class="ons-header {% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
14
+ <header class="ons-header {% if params.classes is defined and 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">
15
15
  {% if params.phase is defined and params.phase %}
16
16
  {% from "components/phase-banner/_macro.njk" import onsPhaseBanner %}
17
17
  {{ onsPhaseBanner(params.phase) }}
18
18
  {% endif %}
19
- <div class="ons-header__top">
20
- <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
21
- <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 is defined and params.customHeaderLogo }}">
22
- <div class="ons-grid__col ons-col-auto">
23
- <div class="ons-header__logo--large">
24
- {%-if params.logoHref is defined and params.logoHref %}<a class="ons-header__logo-link" href="{{ params.logoHref }}">{% endif -%}
25
- {{
26
- onsIcon({
27
- "iconType": params.logo | default('ons-logo-' + currentLanguageISOCode),
28
- "altText": params.logoAlt | default('Office for National Statistics logo')
29
- })
30
- }}
31
- {%- if params.logoHref is defined and params.logoHref %}</a>{% endif -%}
32
- </div>
33
- <div class="ons-header__logo--small">
34
- {% if params.logoHref is defined and params.logoHref %}<a class="ons-header__logo-link" href="{{ params.logoHref }}">{% endif %}
35
- {{
36
- onsIcon({
37
- "iconType": params.mobileLogo | default('ons-logo-stacked-' + currentLanguageISOCode),
38
- "altText": params.logoAlt | default('Office for National Statistics logo')
39
- })
40
- }}
41
- {% if params.logoHref is defined and params.logoHref %}</a>{% endif %}
42
- </div>
43
- </div>
44
- {% if params.language is defined and params.language or params.serviceLinks is defined and params.serviceLinks %}
45
- <div class="ons-header__links ons-grid__col ons-col-auto">
46
- {% if params.language is defined and params.language %}
47
- <div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks is defined and params.serviceLinks else '' }}">
48
- {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
49
- {{ onsLanguageSelector(params.language) }}
50
- </div>
19
+ {% if params.noMasthead != true %}
20
+ <div class="ons-header__top">
21
+ <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
22
+ <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 is defined and params.customHeaderLogo }}">
23
+ <div class="ons-grid__col ons-col-auto">
24
+ {%-if params.orgLogoHref is defined and params.orgLogoHref %}
25
+ <a class="ons-header__org-logo-link" href="{{ params.orgLogoHref }}">
26
+ {% endif -%}
27
+ <div class="ons-header__org-logo ons-header__org-logo--large">
28
+
29
+ {{
30
+ onsIcon({
31
+ "iconType": params.orgLogo | default('ons-logo-' + currentLanguageISOCode),
32
+ "altText": params.orgLogoAlt | default('Office for National Statistics logo')
33
+ })
34
+ }}
35
+ </div>
36
+ <div class="ons-header__org-logo ons-header__org-logo--small">
37
+ {{
38
+ onsIcon({
39
+ "iconType": params.orgMobileLogo | default('ons-logo-stacked-' + currentLanguageISOCode),
40
+ "altText": params.orgLogoAlt | default('Office for National Statistics logo')
41
+ })
42
+ }}
43
+ </div>
44
+ {% if params.orgLogoHref is defined and params.orgLogoHref %}
45
+ </a>
51
46
  {% endif %}
52
- {% if params.serviceLinks is defined and params.serviceLinks %}
53
- {% if params.serviceLinks.itemsList | length == 1 and params.language is defined and params.language %}
54
- {% set breakpoint = 'xs' %}
55
- {% set controlVisibility = true %}
56
- {% elif params.serviceLinks.itemsList | length > 1 %}
57
- {% set breakpoint = 'm' %}
58
- {% set controlVisibility = true %}
59
- {% else %}
60
- {% set controlVisibility = false %}
47
+ </div>
48
+ {% if params.language is defined and params.language or params.serviceLinks is defined and params.serviceLinks %}
49
+ <div class="ons-header__links ons-grid__col ons-col-auto">
50
+ {% if params.language is defined and params.language %}
51
+ <div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks is defined and params.serviceLinks else '' }}">
52
+ {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
53
+ {{ onsLanguageSelector(params.language) }}
54
+ </div>
61
55
  {% endif %}
62
- <div class="ons-grid__col ons-col-auto{% if controlVisibility == true %} ons-u-d-no@xxs@{{ breakpoint }}{% endif %}">
63
- <nav class="ons-header-service-nav ons{{ params.serviceLinks.classes }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
64
- <ul class="ons-header-service-nav__list" aria-label="{{ params.serviceLinks.ariaListLabel | default("Service Links") }}">
65
- {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
66
- <li class="ons-header-service-nav__item">
67
- <a
68
- href="{{ item.url }}"
69
- class="ons-header-service-nav__link"
70
- {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
71
- >{{ item.title }}</a>
72
- </li>
73
- {% endfor %}
74
- </ul>
75
- </nav>
76
- </div>
77
- {% if params.serviceLinks.itemsList | length > 1 or params.language is defined and params.language %}
78
- {% if params.variants == 'internal' %}
79
- {% set buttonVariant = ["text-link", "text-link-inverse"] %}
56
+ {% if params.serviceLinks is defined and params.serviceLinks %}
57
+ {% if params.serviceLinks.itemsList | length == 1 and params.language is defined and params.language %}
58
+ {% set breakpoint = 'xs' %}
59
+ {% set controlVisibility = true %}
60
+ {% elif params.serviceLinks.itemsList | length > 1 %}
61
+ {% set breakpoint = 'm' %}
62
+ {% set controlVisibility = true %}
80
63
  {% else %}
81
- {% set buttonVariant = "text-link" %}
64
+ {% set controlVisibility = false %}
82
65
  {% endif %}
83
- <div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
84
- {{ onsButton({
85
- "text": params.serviceLinks.toggleServicesButton.text | default("Menu"),
86
- "classes": "ons-u-d-no ons-js-toggle-services",
87
- "type": "button",
88
- "buttonStyle": "mobile",
89
- "variants": buttonVariant,
90
- "attributes": {
91
- "aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
92
- "aria-controls": params.serviceLinks.id,
93
- "aria-haspopup": "true",
94
- "aria-expanded": "false"
95
- }
96
- }) }}
66
+ <div class="ons-grid__col ons-col-auto{% if controlVisibility == true %} ons-u-d-no@xxs@{{ breakpoint }}{% endif %}">
67
+ <nav class="ons-header-service-nav ons-header-service-nav--main {{ params.serviceLinks.classes }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
68
+ <ul class="ons-header-service-nav__list" aria-label="{{ params.serviceLinks.ariaListLabel | default("Service Links") }}">
69
+ {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
70
+ <li class="ons-header-service-nav__item">
71
+ <a
72
+ href="{{ item.url }}"
73
+ class="ons-header-service-nav__link"
74
+ {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
75
+ >{{ item.title }}</a>
76
+ </li>
77
+ {% endfor %}
78
+ </ul>
79
+ </nav>
97
80
  </div>
81
+ {% if params.serviceLinks.itemsList | length > 1 or params.language is defined and params.language %}
82
+ {% if params.variants == 'internal' or params.variants == 'neutral' %}
83
+ {% set buttonVariant = ["text-link", "text-link-inverse"] %}
84
+ {% else %}
85
+ {% set buttonVariant = "text-link" %}
86
+ {% endif %}
87
+ <div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
88
+ {{ onsButton({
89
+ "text": params.serviceLinks.toggleServicesButton.text | default("Account"),
90
+ "classes": "ons-u-d-no ons-js-toggle-services",
91
+ "type": "button",
92
+ "buttonStyle": "mobile",
93
+ "variants": buttonVariant,
94
+ "attributes": {
95
+ "aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
96
+ "aria-controls": params.serviceLinks.id,
97
+ "aria-haspopup": "true",
98
+ "aria-expanded": "false"
99
+ }
100
+ }) }}
101
+ </div>
102
+ {% endif %}
98
103
  {% endif %}
99
- {% endif %}
100
- </div>
101
- {% endif %}
102
- </div>
103
- </div>
104
- {% if params.serviceLinks is defined and params.serviceLinks %}
105
- <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") }}">
106
- <ul class="ons-header-service-nav__list" aria-label="{{ params.serviceLinks.ariaListLabel | default("Service Links") }}">
107
- {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
108
- <li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
109
- <a
110
- href="{{ item.url }}"
111
- class="ons-header-service-nav__link"
112
- {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
113
- >{{ item.title }}</a>
114
- </li>
115
- {% endfor %}
116
- {% if params.language is defined and params.language %}
117
- <div class="ons-u-d-no@xs">
118
- {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
119
- {{ onsLanguageSelector(params.language) }}
120
104
  </div>
121
105
  {% endif %}
122
- </ul>
123
- </nav>
124
- {% endif %}
125
- </div>
106
+ </div>
107
+ </div>
108
+ {% if params.serviceLinks is defined and params.serviceLinks %}
109
+ <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") }}">
110
+ <ul class="ons-header-service-nav__list" aria-label="{{ params.serviceLinks.ariaListLabel | default("Service Links") }}">
111
+ {% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
112
+ <li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
113
+ <a
114
+ href="{{ item.url }}"
115
+ class="ons-header-service-nav__link"
116
+ {% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
117
+ >{{ item.title }}</a>
118
+ </li>
119
+ {% endfor %}
120
+ {% if params.language is defined and params.language %}
121
+ <div class="ons-u-d-no@xs">
122
+ {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
123
+ {{ onsLanguageSelector(params.language) }}
124
+ </div>
125
+ {% endif %}
126
+ </ul>
127
+ </nav>
128
+ {% endif %}
129
+ </div>
130
+ {% endif %}
126
131
  <div class="ons-header__main">
127
132
  <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
128
133
  <div class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap">
129
- <div class="ons-grid__col ons-col-auto ons-u-flex-shrink{% if params.titleLogo == 'census-logo-en' %} ons-header__title-census-logo-en{% endif %}">
130
- {% if params.titleLogoHref is defined and params.titleLogoHref %}<a class="ons-header__title-link" href="{{ params.titleLogoHref }}">{% endif %}
134
+ <div class="ons-grid__col ons-col-auto ons-u-flex-shrink">
131
135
  {% if params.titleLogo is defined and params.titleLogo and params.titleLogoAlt is defined and params.titleLogoAlt %}
132
- {% from "components/icons/_macro.njk" import onsIcon %}
133
- {{
134
- onsIcon({
135
- "iconType": params.titleLogo,
136
- "altText": params.titleLogoAlt
137
- })
138
- }}
136
+ {% if params.titleLogoHref is defined and params.titleLogoHref %}
137
+ <a class="ons-header__title-logo-link" href="{{ params.titleLogoHref }}">
138
+ {% endif %}
139
+ <div class="ons-header__title-logo ons-header__title-logo--large {% if params.titleLogoClasses %} {{ params.titleLogoClasses }} {% endif %}{% if params.titleLogoMobile is defined and params.titleLogoMobile %}ons-u-d-no@xxs@s{% endif %}">
140
+ {% from "components/icons/_macro.njk" import onsIcon %}
141
+ {{
142
+ onsIcon({
143
+ "iconType": params.titleLogo,
144
+ "altText": params.titleLogoAlt
145
+ })
146
+ }}
147
+ </div>
148
+ {% if params.titleLogoMobile is defined and params.titleLogoMobile %}
149
+ <div class="ons-header__title-logo ons-header__title-logo--mobile ons-u-d-no@s{% if params.titleLogoMobileClasses %} {{ params.titleLogoMobileClasses }}{% endif %}">
150
+ {% from "components/icons/_macro.njk" import onsIcon %}
151
+ {{
152
+ onsIcon({
153
+ "iconType": params.titleLogoMobile,
154
+ "altText": params.titleLogoAlt
155
+ })
156
+ }}
157
+ </div>
158
+ {% endif %}
159
+ {% if params.titleLogoHref is defined and params.titleLogoHref %}
160
+ </a>
161
+ {% endif %}
139
162
  {% else %}
140
- <{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
163
+ {% if params.titleLogoHref is defined and params.titleLogoHref %}
164
+ <a class="ons-header__title-link" href="{{ params.titleLogoHref }}">
165
+ {% endif %}
166
+ <{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
167
+ {% if params.titleLogoHref is defined and params.titleLogoHref %}
168
+ </a>
169
+ {% endif %}
141
170
  {% endif %}
142
- {% if params.titleLogoHref is defined and params.titleLogoHref %}</a>{% endif %}
143
171
  {% if params.description is defined and params.description %}
144
172
  <p class="ons-header__description">{{ params.description }}</p>
145
173
  {% endif %}
146
174
  </div>
175
+
147
176
  {% if params.button is defined and params.button %}
177
+ {% if params.variants == 'neutral' %}
178
+ {% set buttonVariant = ["ghost", "ghost-dark"] %}
179
+ {% else %}
180
+ {% set buttonVariant = "ghost" %}
181
+ {% endif %}
148
182
  <div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
149
183
  {{ onsButton({
150
184
  "text": params.button.text,
151
- "classes": "ons-u-d-no@xxs@m",
152
- "variants": "ghost",
185
+ "classes": "ons-u-d-no@xxs@l" if params.navigation else "ons-u-d-no@xxs@m",
186
+ "variants": buttonVariant,
153
187
  "name": params.button.name,
154
188
  "attributes": params.button.attributes,
155
189
  "url": params.button.url,
@@ -159,13 +193,26 @@
159
193
  </div>
160
194
  {% endif %}
161
195
  {% 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 %}
164
- <span class="ons-grid ons-u-d-no@xxs@xs">
196
+ <div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
197
+ {% if params.noMasthead == true %}
198
+ {% if params.language is defined and params.language %}
199
+ <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 %}">
200
+ {% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
201
+ {{ onsLanguageSelector(params.language) }}
202
+ </div>
203
+ {% endif %}
204
+ {% endif %}
205
+ {% if params.navigation.siteSearchAutosuggest %}
206
+ {% if params.variants == 'neutral' %}
207
+ {% set buttonVariant = ["small", "ghost", "ghost-dark"] %}
208
+ {% else %}
209
+ {% set buttonVariant = ["small", "ghost"] %}
210
+ {% endif %}
211
+ <span class="ons-grid ons-u-d-no@xxs@xs ons-u-ml-no ons-u-d-no@l">
165
212
  {{ onsButton({
166
213
  "text": "Search",
167
214
  "classes": "ons-btn--search ons-u-ml-xs ons-u-d-no ons-js-toggle-search",
168
- "variants": ["ghost", "small"],
215
+ "variants": buttonVariant,
169
216
  "iconType": "search",
170
217
  "iconPosition": "only",
171
218
  "attributes": {
@@ -178,11 +225,16 @@
178
225
  </span>
179
226
  {% endif %}
180
227
  {% if params.navigation.toggleNavigationButton is defined and params.navigation.toggleNavigationButton %}
228
+ {% if params.variants == 'neutral' %}
229
+ {% set buttonVariant = ["mobile", "ghost-dark"] %}
230
+ {% else %}
231
+ {% set buttonVariant = ["mobile", "ghost"] %}
232
+ {% endif %}
181
233
  {{ onsButton({
182
234
  "text": params.navigation.toggleNavigationButton.text,
183
- "classes": "ons-u-ml-xs ons-u-d-no ons-js-navigation-button",
235
+ "classes": "ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
184
236
  "buttonStyle": "mobile",
185
- "variants": ["mobile", "ghost"],
237
+ "variants": buttonVariant,
186
238
  "attributes": {
187
239
  "aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
188
240
  "aria-controls": params.navigation.id,
@@ -197,7 +249,7 @@
197
249
  </div>
198
250
  </div>
199
251
  {% if params.navigation is defined and params.navigation %}
200
- {{ onsNavigation(params.navigation) }}
252
+ {{ onsNavigation(params) }}
201
253
  {% endif %}
202
254
  </header>
203
255
  {% endmacro %}