@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
package/layout/_template.njk
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
{% set currentLanguageISOCode = "en" %}
|
|
6
6
|
|
|
7
|
-
{% if pageConfig
|
|
7
|
+
{% if pageConfig and pageConfig.language and pageConfig.language.languages %}
|
|
8
8
|
{% set currentLanguage = pageConfig.language.languages | selectattr("current") | first %}
|
|
9
9
|
{% set currentLanguageISOCode = currentLanguage.ISOCode %}
|
|
10
10
|
{% set otherLanguage = pageConfig.language.languages | rejectattr("current") | first %}
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
{% endif %}
|
|
13
13
|
|
|
14
14
|
{# Meta icons #}
|
|
15
|
-
{% if pageConfig
|
|
15
|
+
{% if pageConfig and pageConfig.theme %}
|
|
16
16
|
{% set metaicons = pageConfig.theme + "/" + currentLanguageISOCode + "/" %}
|
|
17
17
|
{% else %}
|
|
18
18
|
{% set metaicons = "" %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
|
|
21
|
-
{% if pageConfig.cdn
|
|
21
|
+
{% if pageConfig.cdn or release_version %}
|
|
22
22
|
{# Production #}
|
|
23
|
-
{% set cdn_url = (pageConfig.cdn.url if pageConfig.cdn
|
|
23
|
+
{% set cdn_url = (pageConfig.cdn.url if pageConfig.cdn and pageConfig.cdn.url) or "https://cdn.ons.gov.uk/sdc/design-system" %}
|
|
24
24
|
{% set slash = "" if cdn_url | last == "/" else "/" %}
|
|
25
|
-
{% set assetsURL = cdn_url + slash + ((pageConfig.cdn.version if pageConfig.cdn
|
|
26
|
-
{% elif pageInfo
|
|
25
|
+
{% set assetsURL = cdn_url + slash + ((pageConfig.cdn.version if pageConfig.cdn and pageConfig.cdn.version) or release_version) %}
|
|
26
|
+
{% elif pageInfo and pageInfo.version %}
|
|
27
27
|
{# Prototype kits #}
|
|
28
28
|
{% set assetsURL = "/" + pageInfo.version %}
|
|
29
|
-
{% elif pageConfig.assetsURL
|
|
29
|
+
{% elif pageConfig.assetsURL %}
|
|
30
30
|
{# Runner Dev #}
|
|
31
31
|
{% set assetsURL = pageConfig.assetsURL %}
|
|
32
32
|
{% else %}
|
|
@@ -34,27 +34,36 @@
|
|
|
34
34
|
{% set assetsURL = "" %}
|
|
35
35
|
{% endif %}
|
|
36
36
|
|
|
37
|
-
{% if pageConfig
|
|
37
|
+
{% if pageConfig and pageConfig.title %}
|
|
38
38
|
{% set page_title = pageConfig.title %}
|
|
39
|
-
{% elif pageInfo
|
|
39
|
+
{% elif pageInfo and pageInfo.title %}
|
|
40
40
|
{% set page_title = pageInfo.title %}
|
|
41
41
|
{% else %}
|
|
42
42
|
{% set page_title = "ONS Design System" %}
|
|
43
43
|
{% endif %}
|
|
44
44
|
|
|
45
|
+
{# Page container #}
|
|
46
|
+
{% if pageConfig.fullWidth %}
|
|
47
|
+
{% set containerClasses = ' ' + 'ons-container--full-width' %}
|
|
48
|
+
{% elif pageConfig.wide %}
|
|
49
|
+
{% set containerClasses = ' ' + 'ons-container--wide' %}
|
|
50
|
+
{% elif pageConfig.containerClasses %}
|
|
51
|
+
{% set containerClasses = ' ' + pageConfig.containerClasses %}
|
|
52
|
+
{% endif %}
|
|
53
|
+
|
|
45
54
|
{# Page columns #}
|
|
46
55
|
{% set mainColNumber = "8" %}
|
|
47
56
|
|
|
48
|
-
{% if pageConfig.mainCol
|
|
49
|
-
{% set mainColNumber = pageConfig.mainCol.columns if pageConfig.mainCol.columns
|
|
50
|
-
{% set mainColClasses = (' ' + pageConfig.mainCol.colClasses) if pageConfig.mainCol.colClasses
|
|
51
|
-
{% set mainClasses = (' ' + pageConfig.mainCol.classes) if pageConfig.mainCol.classes
|
|
57
|
+
{% if pageConfig.mainCol %}
|
|
58
|
+
{% set mainColNumber = pageConfig.mainCol.columns if pageConfig.mainCol.columns %}
|
|
59
|
+
{% set mainColClasses = (' ' + pageConfig.mainCol.colClasses) if pageConfig.mainCol.colClasses %}
|
|
60
|
+
{% set mainClasses = (' ' + pageConfig.mainCol.classes) if pageConfig.mainCol.classes %}
|
|
52
61
|
{% endif %}
|
|
53
62
|
|
|
54
|
-
{% if pageConfig.asideCol
|
|
55
|
-
{% set asideColNumber = 12 - mainColNumber if pageConfig.asideCol.position
|
|
56
|
-
{% set asideColClasses = (' ' + pageConfig.asideCol.colClasses) if pageConfig.asideCol.colClasses
|
|
57
|
-
{% set asideClasses = (' ' + pageConfig.asideCol.classes) if pageConfig.asideCol.classes
|
|
63
|
+
{% if pageConfig.asideCol %}
|
|
64
|
+
{% set asideColNumber = 12 - mainColNumber if pageConfig.asideCol.position %}
|
|
65
|
+
{% set asideColClasses = (' ' + pageConfig.asideCol.colClasses) if pageConfig.asideCol.colClasses %}
|
|
66
|
+
{% set asideClasses = (' ' + pageConfig.asideCol.classes) if pageConfig.asideCol.classes %}
|
|
58
67
|
{% endif %}
|
|
59
68
|
|
|
60
69
|
<!doctype html>
|
|
@@ -68,9 +77,9 @@
|
|
|
68
77
|
<link rel="stylesheet" media="print" href="{{ assetsURL }}/css/print.css">
|
|
69
78
|
<meta name="theme-color" content="{% if pageConfig.theme == 'census' %}#902082{% else %}#206095{% endif %}"/>
|
|
70
79
|
|
|
71
|
-
{% if pageConfig.headMeta
|
|
80
|
+
{% if pageConfig.headMeta %}
|
|
72
81
|
|
|
73
|
-
{% if pageConfig.headMeta.description
|
|
82
|
+
{% if pageConfig.headMeta.description or pageConfig.description %}
|
|
74
83
|
<meta name="description" content="{{ pageConfig.headMeta.description | default(pageConfig.description) }}">
|
|
75
84
|
{% endif %}
|
|
76
85
|
|
|
@@ -85,7 +94,7 @@
|
|
|
85
94
|
<meta property="og:description" content="{{ pageConfig.headMeta.description | default(pageConfig.description) }}">
|
|
86
95
|
<meta property="og:site_name" content="{{ pageConfig.header.title | default(pageConfig.title) }}">
|
|
87
96
|
<meta property="og:locale" content="{{ currentLanguageISOCode }}">
|
|
88
|
-
{% if otherLanguageISOCode
|
|
97
|
+
{% if otherLanguageISOCode %}
|
|
89
98
|
<meta property="og:locale:alternate" content="{{ otherLanguageISOCode }}">
|
|
90
99
|
{% endif %}
|
|
91
100
|
|
|
@@ -100,7 +109,7 @@
|
|
|
100
109
|
<!-- Canonical -->
|
|
101
110
|
<link rel="canonical" href="{{ pageConfig.headMeta.canonicalUrl | default(pageConfig.absoluteUrl) }}">
|
|
102
111
|
|
|
103
|
-
{% if pageConfig.headMeta.hrefLangs
|
|
112
|
+
{% if pageConfig.headMeta.hrefLangs %}
|
|
104
113
|
{% for item in pageConfig.headMeta.hrefLangs %}
|
|
105
114
|
<link rel="alternate" href="{{ item.url }}" hreflang="{{ item.lang }}">
|
|
106
115
|
{% endfor %}
|
|
@@ -122,12 +131,20 @@
|
|
|
122
131
|
{% block head %}{% endblock %}
|
|
123
132
|
|
|
124
133
|
</head>
|
|
125
|
-
<body{% if pageConfig.bodyClasses
|
|
126
|
-
<script{% if pageConfig.cspNonce
|
|
134
|
+
<body{% if pageConfig.bodyClasses %} class="{{ pageConfig.bodyClasses }}"{% endif %}>
|
|
135
|
+
<script{% if pageConfig.cspNonce %} nonce="{{ pageConfig.cspNonce }}"{% elif pageConfig.cspNonce is not defined and csp_nonce %} nonce="{{ csp_nonce() }}"{% endif %}>document.body.className = ((document.body.className) ? document.body.className + ' ons-js-enabled' : 'ons-js-enabled');</script>
|
|
127
136
|
{% block bodyStart %}{% endblock %}
|
|
128
137
|
{% block body %}
|
|
129
138
|
<div class="ons-page">
|
|
130
139
|
<div class="ons-page__content">
|
|
140
|
+
{% if form and form.attributes %}
|
|
141
|
+
<form
|
|
142
|
+
{% if form.classes %}class="{{ form.classes }}"{% endif %}
|
|
143
|
+
method="{{ form.method | default('POST') }}"
|
|
144
|
+
{% if form.attributes %}{% for attribute, value in (form.attributes.items() if form.attributes is mapping and form.attributes.items else form.attributes) %}{{ attribute }}{% if value %}="{{value}}" {% endif %}{% endfor %}{% endif %}
|
|
145
|
+
>
|
|
146
|
+
{% endif %}
|
|
147
|
+
{% block preHeader %}{% endblock %}
|
|
131
148
|
{% block skipLink %}
|
|
132
149
|
{{
|
|
133
150
|
onsSkipToContent({
|
|
@@ -136,21 +153,11 @@
|
|
|
136
153
|
})
|
|
137
154
|
}}
|
|
138
155
|
{% endblock %}
|
|
139
|
-
{% if form is defined and form and form.attributes is defined and form.attributes %}
|
|
140
|
-
<form
|
|
141
|
-
{% if form.classes is defined and form.classes %}class="{{ form.classes }}"{% endif %}
|
|
142
|
-
method="{{ form.method | default('POST') }}"
|
|
143
|
-
{% if form.attributes is defined and form.attributes %}{% for attribute, value in (form.attributes.items() if form.attributes is mapping and form.attributes.items else form.attributes) %}{{ attribute }}{% if value is defined and value %}="{{value}}" {% endif %}{% endfor %}{% endif %}
|
|
144
|
-
>
|
|
145
|
-
{% endif %}
|
|
146
|
-
{% block preHeader %}{% endblock %}
|
|
147
156
|
{% block header %}
|
|
148
157
|
{{
|
|
149
158
|
onsHeader({
|
|
150
|
-
"title": pageConfig.header.title | default(pageConfig.title),
|
|
151
|
-
"classes": pageConfig.header.classes,
|
|
152
|
-
"variants": pageConfig.header.variants,
|
|
153
159
|
"wide": pageConfig.wide,
|
|
160
|
+
"fullWidth": pageConfig.fullWidth,
|
|
154
161
|
"language": pageConfig.language,
|
|
155
162
|
"button": pageConfig.signoutButton,
|
|
156
163
|
"toggleNavigationButton": pageConfig.toggleNavigationButton,
|
|
@@ -159,11 +166,16 @@
|
|
|
159
166
|
"phase": pageConfig.phase,
|
|
160
167
|
"assetsURL": assetsURL,
|
|
161
168
|
"serviceLinks": pageConfig.serviceLinks,
|
|
169
|
+
"variants": pageConfig.header.variants,
|
|
170
|
+
"classes": pageConfig.header.classes,
|
|
162
171
|
"noMasthead": pageConfig.header.noMasthead,
|
|
163
172
|
"orgLogo": pageConfig.header.orgLogo,
|
|
164
173
|
"orgMobileLogo": pageConfig.header.orgMobileLogo,
|
|
165
174
|
"orgLogoAlt": pageConfig.header.orgLogoAlt,
|
|
166
175
|
"orgLogoHref": pageConfig.header.orgLogoHref,
|
|
176
|
+
"title": pageConfig.header.title | default(pageConfig.title),
|
|
177
|
+
"description": pageConfig.header.description,
|
|
178
|
+
"titleAsH1": pageConfig.header.titleAshH1,
|
|
167
179
|
"titleLogo": pageConfig.header.titleLogo,
|
|
168
180
|
"titleLogoClasses": pageConfig.header.titleLogoClasses,
|
|
169
181
|
"titleLogoMobile": pageConfig.header.titleLogoMobile,
|
|
@@ -175,8 +187,8 @@
|
|
|
175
187
|
}}
|
|
176
188
|
{% endblock %}
|
|
177
189
|
{% block pageContent %}
|
|
178
|
-
<div class="ons-page__container ons-container
|
|
179
|
-
{% if pageConfig.breadcrumbs
|
|
190
|
+
<div class="ons-page__container ons-container{{ containerClasses }}">
|
|
191
|
+
{% if pageConfig.breadcrumbs %}
|
|
180
192
|
{% from "components/breadcrumbs/_macro.njk" import onsBreadcrumbs %}
|
|
181
193
|
{{
|
|
182
194
|
onsBreadcrumbs({
|
|
@@ -188,16 +200,16 @@
|
|
|
188
200
|
{% endif %}
|
|
189
201
|
{% block preMain %}{% endblock %}
|
|
190
202
|
<div class="ons-grid">
|
|
191
|
-
{% if pageConfig.asideCol
|
|
203
|
+
{% if pageConfig.asideCol %}
|
|
192
204
|
{% set aside %}
|
|
193
205
|
<div class="ons-grid__col ons-col-{{ asideColNumber }}@m{{ asideColClasses }}">
|
|
194
|
-
<aside {% if pageConfig.asideCol.id
|
|
206
|
+
<aside {% if pageConfig.asideCol.id %}id="{{ asideId }}" {% endif %}class="ons-page__aside{{ asideClasses }}">
|
|
195
207
|
{% block aside %}{% endblock %}
|
|
196
208
|
</aside>
|
|
197
209
|
</div>
|
|
198
210
|
{% endset %}
|
|
199
211
|
{% endif %}
|
|
200
|
-
{% if pageConfig.asideCol
|
|
212
|
+
{% if pageConfig.asideCol and pageConfig.asideCol.position == "before" %}
|
|
201
213
|
{{ aside | safe }}
|
|
202
214
|
{% endif %}
|
|
203
215
|
<div class="ons-grid__col ons-col-{{ mainColNumber }}@m{{ mainColClasses }}">
|
|
@@ -205,24 +217,25 @@
|
|
|
205
217
|
{% block main %}{% endblock %}
|
|
206
218
|
</main>
|
|
207
219
|
</div>
|
|
208
|
-
{% if pageConfig.asideCol
|
|
220
|
+
{% if pageConfig.asideCol and pageConfig.asideCol.position == "after" %}
|
|
209
221
|
{{ aside | safe }}
|
|
210
222
|
{% endif %}
|
|
211
223
|
</div>
|
|
212
224
|
</div>
|
|
213
225
|
{% endblock %}
|
|
214
226
|
|
|
215
|
-
{% if form
|
|
227
|
+
{% if form and form.attributes %}
|
|
216
228
|
</form>
|
|
217
229
|
{% endif %}
|
|
218
230
|
</div>
|
|
219
231
|
{% block preFooter %}{% endblock %}
|
|
220
232
|
{% block footer %}
|
|
221
|
-
{% if pageConfig.footer
|
|
233
|
+
{% if pageConfig.footer %}
|
|
222
234
|
{{
|
|
223
235
|
onsFooter({
|
|
224
236
|
"assetsURL": assetsURL,
|
|
225
237
|
"wide": pageConfig.wide,
|
|
238
|
+
"fullWidth": pageConfig.fullWidth,
|
|
226
239
|
"classes": "ons-page__footer",
|
|
227
240
|
"language": pageConfig.language,
|
|
228
241
|
"lang": currentLanguageISOCode,
|
|
@@ -244,13 +257,13 @@
|
|
|
244
257
|
{% block bodyEnd %}{% endblock %}
|
|
245
258
|
{% endblock %}
|
|
246
259
|
|
|
247
|
-
{% if isPatternLib
|
|
260
|
+
{% if isPatternLib %}
|
|
248
261
|
{% set scripts = assetsURL + "/scripts/main.js," + assetsURL + "/scripts/patternlib.js" %}
|
|
249
262
|
{% else %}
|
|
250
263
|
{% set scripts = assetsURL + "/scripts/main.js" %}
|
|
251
264
|
{% endif %}
|
|
252
265
|
|
|
253
|
-
<script{% if pageConfig.cspNonce
|
|
266
|
+
<script{% if pageConfig.cspNonce %} nonce="{{ pageConfig.cspNonce }}"{% elif pageConfig.cspNonce is not defined and csp_nonce %} nonce="{{ csp_nonce() }}"{% endif %}>
|
|
254
267
|
(function() {
|
|
255
268
|
var s = '{{ scripts | safe }}'.split(','),
|
|
256
269
|
c = document.createElement('script');
|