@ons/design-system 45.2.2 → 46.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/address-input/autosuggest.address.js +93 -118
- package/components/autosuggest/autosuggest.js +3 -11
- package/components/autosuggest/autosuggest.ui.js +3 -10
- package/components/footer/_footer.scss +6 -0
- package/components/footer/_macro.njk +2 -1
- package/components/lists/_macro.njk +8 -12
- package/css/census.css +1 -1
- package/css/main.css +1 -1
- package/js/abortable-fetch.js +13 -38
- package/layout/_template.njk +32 -4
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +2 -2
package/js/abortable-fetch.js
CHANGED
|
@@ -6,28 +6,20 @@ class AbortableFetch {
|
|
|
6
6
|
this.status = 'UNSENT';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
send() {
|
|
9
|
+
async send() {
|
|
10
10
|
this.status = 'LOADING';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
reject(response);
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
.catch(error => {
|
|
27
|
-
this.status = 'undefined';
|
|
28
|
-
reject(error);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
11
|
+
try {
|
|
12
|
+
const response = await window.fetch(this.url, { signal: this.controller.signal, ...this.options });
|
|
13
|
+
const isResponseOK = (response.status >= 200 && response.status < 300) || response.status >= 400;
|
|
14
|
+
if (!isResponseOK) {
|
|
15
|
+
const error = new Error(`HTTP error! status: ${response.status}`);
|
|
16
|
+
error.response = response;
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
return response;
|
|
20
|
+
} finally {
|
|
21
|
+
this.status = 'DONE';
|
|
22
|
+
}
|
|
31
23
|
}
|
|
32
24
|
|
|
33
25
|
abort() {
|
|
@@ -35,21 +27,4 @@ class AbortableFetch {
|
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
29
|
|
|
38
|
-
function abortableFetch(url, options) {
|
|
39
|
-
return window
|
|
40
|
-
.fetch(url, options)
|
|
41
|
-
.then(response => {
|
|
42
|
-
if (response) {
|
|
43
|
-
return response;
|
|
44
|
-
} else {
|
|
45
|
-
const error = new Error(response.status);
|
|
46
|
-
error.response = response;
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
})
|
|
50
|
-
.catch(error => {
|
|
51
|
-
throw error;
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
30
|
export default (url, options) => new AbortableFetch(url, options);
|
package/layout/_template.njk
CHANGED
|
@@ -18,8 +18,6 @@
|
|
|
18
18
|
{% set metaicons = "" %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
|
|
21
|
-
{% set pageColNumber = pageConfig.pageColNumber | default("8") %}
|
|
22
|
-
|
|
23
21
|
{% if pageConfig.cdn is defined and pageConfig.cdn or release_version is defined and release_version %}
|
|
24
22
|
{# Production #}
|
|
25
23
|
{% set cdn_url = (pageConfig.cdn.url if pageConfig.cdn is defined and pageConfig.cdn and pageConfig.cdn.url is defined and pageConfig.cdn.url) or "https://cdn.ons.gov.uk/sdc/design-system" %}
|
|
@@ -44,6 +42,21 @@
|
|
|
44
42
|
{% set page_title = "ONS Design System" %}
|
|
45
43
|
{% endif %}
|
|
46
44
|
|
|
45
|
+
{# Page columns #}
|
|
46
|
+
{% set mainColNumber = "8" %}
|
|
47
|
+
|
|
48
|
+
{% if pageConfig.mainCol is defined and pageConfig.mainCol %}
|
|
49
|
+
{% set mainColNumber = pageConfig.mainCol.columns if pageConfig.mainCol.columns is defined and pageConfig.mainCol.columns %}
|
|
50
|
+
{% set mainColClasses = (' ' + pageConfig.mainCol.colClasses) if pageConfig.mainCol.colClasses is defined and pageConfig.mainCol.colClasses %}
|
|
51
|
+
{% set mainClasses = (' ' + pageConfig.mainCol.classes) if pageConfig.mainCol.classes is defined and pageConfig.mainCol.classes %}
|
|
52
|
+
{% endif %}
|
|
53
|
+
|
|
54
|
+
{% if pageConfig.asideCol is defined and pageConfig.asideCol %}
|
|
55
|
+
{% set asideColNumber = 12 - mainColNumber if pageConfig.asideCol.position is defined and pageConfig.asideCol.position %}
|
|
56
|
+
{% set asideColClasses = (' ' + pageConfig.asideCol.colClasses) if pageConfig.asideCol.colClasses is defined and pageConfig.asideCol.colClasses %}
|
|
57
|
+
{% set asideClasses = (' ' + pageConfig.asideCol.classes) if pageConfig.asideCol.classes is defined and pageConfig.asideCol.classes %}
|
|
58
|
+
{% endif %}
|
|
59
|
+
|
|
47
60
|
<!doctype html>
|
|
48
61
|
<html lang="{{ currentLanguageISOCode }}">
|
|
49
62
|
<head>
|
|
@@ -169,11 +182,26 @@
|
|
|
169
182
|
{% endif %}
|
|
170
183
|
{% block preMain %}{% endblock %}
|
|
171
184
|
<div class="ons-grid">
|
|
172
|
-
|
|
173
|
-
|
|
185
|
+
{% if pageConfig.asideCol is defined and pageConfig.asideCol %}
|
|
186
|
+
{% set aside %}
|
|
187
|
+
<div class="ons-grid__col ons-col-{{ asideColNumber }}@m{{ asideColClasses }}">
|
|
188
|
+
<aside {% if pageConfig.asideCol.id is defined and pageConfig.asideCol.id %}id="{{ asideId }}" {% endif %}class="ons-page__aside{{ asideClasses }}">
|
|
189
|
+
{% block aside %}{% endblock %}
|
|
190
|
+
</aside>
|
|
191
|
+
</div>
|
|
192
|
+
{% endset %}
|
|
193
|
+
{% endif %}
|
|
194
|
+
{% if pageConfig.asideCol.position is defined and pageConfig.asideCol.position == "before" %}
|
|
195
|
+
{{ aside | safe }}
|
|
196
|
+
{% endif %}
|
|
197
|
+
<div class="ons-grid__col ons-col-{{ mainColNumber }}@m{{ mainColClasses }}">
|
|
198
|
+
<main id="main-content" class="ons-page__main{{ mainClasses }}">
|
|
174
199
|
{% block main %}{% endblock %}
|
|
175
200
|
</main>
|
|
176
201
|
</div>
|
|
202
|
+
{% if pageConfig.asideCol.position is defined and pageConfig.asideCol.position == "after" %}
|
|
203
|
+
{{ aside | safe }}
|
|
204
|
+
{% endif %}
|
|
177
205
|
</div>
|
|
178
206
|
</div>
|
|
179
207
|
{% endblock %}
|