@ons/design-system 70.0.17 → 72.0.1
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 +4 -4
- package/components/access-code/_macro.spec.js +8 -8
- package/components/access-code/example-access-code-error.njk +2 -2
- package/components/access-code/example-access-code.njk +2 -2
- package/components/accordion/_macro.njk +1 -1
- package/components/accordion/_macro.spec.js +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-input/_macro.spec.js +16 -15
- package/components/address-input/autosuggest.address.error.js +1 -1
- package/components/address-input/autosuggest.address.js +25 -25
- package/components/address-input/autosuggest.address.spec.js +6 -5
- package/components/address-input/example-address-input-editable.njk +5 -4
- package/components/address-input/example-address-input.njk +4 -5
- package/components/autosuggest/_autosuggest.scss +8 -8
- package/components/autosuggest/_macro.njk +5 -5
- package/components/autosuggest/autosuggest.spec.js +1 -1
- package/components/back-to-top/_back-to-top.scss +2 -2
- package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
- package/components/breadcrumbs/_breadcrumbs.scss +1 -1
- package/components/button/_button.scss +24 -16
- package/components/button/_macro.njk +3 -3
- package/components/button/example-button-custom.njk +1 -1
- package/components/card/_card.scss +0 -6
- package/components/card/_macro.njk +9 -9
- package/components/card/_macro.spec.js +57 -24
- package/components/card/example-card-set-with-images.njk +30 -18
- package/components/card/example-card-set-with-lists.njk +57 -45
- package/components/card/example-card-set.njk +27 -15
- package/components/card/example-card.njk +9 -5
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +4 -4
- package/components/checkboxes/_checkboxes.scss +1 -1
- package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
- package/components/cookies-banner/_cookies-banner.scss +5 -5
- package/components/cookies-banner/_macro.njk +15 -13
- package/components/cookies-banner/_macro.spec.js +1 -1
- package/components/details/_details.scss +5 -6
- package/components/details/_macro.njk +4 -4
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_document-list.scss +0 -2
- package/components/document-list/_macro.njk +18 -18
- package/components/document-list/_macro.spec.js +16 -14
- package/components/document-list/example-document-list-article-featured.njk +5 -3
- package/components/document-list/example-document-list-articles.njk +15 -9
- package/components/document-list/example-document-list-downloads.njk +15 -9
- package/components/document-list/example-document-list-search-result-featured.njk +5 -3
- package/components/document-list/example-document-list-search-results.njk +20 -12
- package/components/download-resources/_download-resources.scss +1 -2
- package/components/download-resources/download-resources.spec.js +12 -6
- package/components/external-link/_macro.njk +1 -1
- package/components/external-link/_macro.spec.js +1 -1
- package/components/external-link/example-external-link.njk +1 -1
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +3 -3
- package/components/feedback/example-feedback-call-to-action.njk +1 -1
- package/components/field/_field-group.scss +0 -2
- package/components/field/_field.scss +1 -2
- package/components/fieldset/_fieldset.scss +2 -2
- package/components/fieldset/_macro.njk +1 -1
- package/components/fieldset/_macro.spec.js +1 -1
- package/components/footer/_footer.scss +12 -7
- package/components/footer/_macro.njk +54 -34
- package/components/footer/_macro.spec.js +90 -28
- package/components/footer/example-footer-cymraeg.njk +1 -1
- package/components/footer/example-footer-transactional.njk +1 -1
- package/components/footer/example-footer-warning.njk +1 -1
- package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
- package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
- package/components/footer/example-footer-with-copyright.njk +1 -1
- package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
- package/components/footer/example-footer-with-multiple-logos.njk +172 -0
- package/components/footer/example-footer.njk +1 -1
- package/components/header/_header.scss +7 -14
- package/components/header/_macro.njk +19 -19
- package/components/header/_macro.spec.js +17 -17
- package/components/header/example-header-external-for-surveys.njk +2 -2
- package/components/header/example-header-external-welsh.njk +2 -2
- package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
- package/components/header/example-header-external-with-sub-navigation.njk +1 -1
- package/components/header/example-header-multiple-logos.njk +4 -4
- package/components/hero/_hero.scss +6 -8
- package/components/hero/_macro.njk +1 -1
- package/components/icon/_icon.scss +4 -4
- package/components/icon/_macro.njk +4 -4
- package/components/icon/_macro.spec.js +2 -2
- package/components/image/_image.scss +1 -1
- package/components/image/_macro.njk +1 -1
- package/components/image/_macro.spec.js +10 -10
- package/components/image/example-image-for-regular-screens.njk +1 -1
- package/components/input/_input-type.scss +0 -2
- package/components/input/_input.scss +10 -10
- package/components/input/_macro.njk +4 -2
- package/components/input/example-input-search-with-character-check.njk +1 -1
- package/components/input/example-input-search.njk +1 -1
- package/components/label/_label.scss +1 -3
- package/components/language-selector/_macro.njk +3 -3
- package/components/language-selector/_macro.spec.js +7 -7
- package/components/list/_list.scss +1 -5
- package/components/list/_macro.njk +9 -10
- package/components/list/_macro.spec.js +50 -9
- package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
- package/components/message/_macro.njk +3 -3
- package/components/message/_macro.spec.js +3 -3
- package/components/message-list/_macro.njk +2 -2
- package/components/message-list/_macro.spec.js +8 -4
- package/components/message-list/_message-list.scss +2 -2
- package/components/navigation/_macro.njk +9 -9
- package/components/navigation/_macro.spec.js +2 -2
- package/components/navigation/_navigation.scss +2 -6
- package/components/navigation/navigation.dom.js +1 -1
- package/components/navigation/navigation.spec.js +4 -4
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/_pagination.scss +1 -7
- package/components/panel/_macro.njk +5 -4
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/_panel.scss +12 -8
- package/components/password/_macro.njk +1 -1
- package/components/password/_macro.spec.js +2 -2
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +3 -4
- package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
- package/components/phase-banner/example-phase-banner-beta.njk +1 -1
- package/components/question/_macro.njk +8 -8
- package/components/question/_macro.spec.js +3 -3
- package/components/question/_question.scss +3 -3
- package/components/radios/_macro.njk +1 -1
- package/components/radios/_macro.spec.js +1 -1
- package/components/radios/_radios.scss +1 -1
- package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
- package/components/radios/example-radios-with-clear-button.njk +1 -1
- package/components/related-content/_macro.spec.js +2 -2
- package/components/related-content/_related-content.scss +1 -1
- package/components/related-content/example-related-content-general.njk +2 -2
- package/components/related-content/example-related-content-social-media.njk +1 -1
- package/components/reply/_macro.njk +3 -1
- package/components/reply/_macro.spec.js +1 -1
- package/components/reply/reply.spec.js +1 -1
- package/components/section-navigation/_macro.njk +10 -10
- package/components/section-navigation/_macro.spec.js +15 -15
- package/components/section-navigation/_section-navigation.scss +4 -10
- package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
- package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
- package/components/section-navigation/example-section-navigation.njk +3 -3
- package/components/select/example-select-with-inline-label.njk +1 -1
- package/components/share-page/_macro.njk +7 -7
- package/components/share-page/_macro.spec.js +2 -2
- package/components/share-page/example-share-page.njk +1 -1
- package/components/status/_status.scss +1 -1
- package/components/summary/_macro.njk +33 -33
- package/components/summary/_macro.spec.js +34 -34
- package/components/summary/_summary.scss +2 -4
- package/components/summary/example-summary-card-grouped.njk +34 -34
- package/components/summary/example-summary-grouped-total.njk +7 -7
- package/components/summary/example-summary-grouped-with-errors.njk +9 -9
- package/components/summary/example-summary-grouped.njk +34 -34
- package/components/summary/example-summary-household.njk +7 -7
- package/components/summary/example-summary-hub-minimal.njk +8 -8
- package/components/summary/example-summary-hub.njk +16 -16
- package/components/summary/example-summary-multiple.njk +7 -7
- package/components/summary/example-summary-no-action.njk +5 -5
- package/components/summary/example-summary.njk +9 -9
- package/components/table/_table.scss +2 -3
- package/components/table-of-contents/_macro.njk +3 -3
- package/components/table-of-contents/_macro.spec.js +3 -3
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
- package/components/tabs/_macro.njk +3 -3
- package/components/tabs/_macro.spec.js +3 -3
- package/components/tabs/_tabs.scss +3 -4
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/text-indent/_text-indent.scss +1 -1
- package/components/timeline/_macro.njk +4 -4
- package/components/timeline/_macro.spec.js +3 -3
- package/components/timeline/_timeline.scss +4 -3
- package/components/timeline/example-timeline.njk +1 -1
- package/components/upload/_upload.scss +2 -2
- package/components/video/_macro.njk +4 -4
- package/components/video/_macro.spec.js +2 -2
- package/components/video/_video.scss +1 -1
- package/components/video/example-video.njk +2 -2
- package/components/video/video.spec.js +2 -2
- package/css/main.css +1 -1
- package/layout/_dsTemplate.njk +1 -1
- package/layout/_template.njk +31 -31
- package/package.json +4 -5
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +2 -0
- package/scss/base/_typography.scss +0 -2
- package/scss/main.scss +0 -1
- package/scss/objects/_container.scss +1 -1
- package/scss/objects/_page.scss +2 -3
- package/scss/overrides/rtl.scss +1 -1
- package/scss/utilities/_grid.scss +103 -96
- package/scss/utilities/_margin.scss +11 -5
- package/scss/utilities/_padding.scss +12 -5
- package/scss/utilities/_typography.scss +2 -1
- package/scss/vars/_forms.scss +8 -10
- package/scss/vars/_grid.scss +4 -4
- package/scss/vars/_typography.scss +26 -19
- package/components/call-to-action/_call-to-action.scss +0 -8
- package/components/call-to-action/_macro.njk +0 -24
- package/components/call-to-action/_macro.spec.js +0 -48
- package/components/call-to-action/example-call-to-action-default.njk +0 -15
- package/components/metadata/_macro.njk +0 -14
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
{% macro onsAccessCode(params) %}
|
|
5
5
|
{% set groupSize = params.groupSize | default(4) %}
|
|
6
|
-
{% set extraSpaces = (params.
|
|
7
|
-
{% set
|
|
6
|
+
{% set extraSpaces = (params.maxLength | default(16) / groupSize) - 1 %}
|
|
7
|
+
{% set maxLength = params.maxLength | default(16) + extraSpaces %}
|
|
8
8
|
|
|
9
9
|
{% set content %}
|
|
10
10
|
{{
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
"id": params.id,
|
|
13
13
|
"type": params.type,
|
|
14
14
|
"name": params.name,
|
|
15
|
-
"classes": "ons-access-code__input ons-js-access-code" + (" ons-u-mb-
|
|
15
|
+
"classes": "ons-access-code__input ons-js-access-code" + (" ons-u-mb-2xs" if params.postTextboxLinkText else ""),
|
|
16
16
|
"label": params.label,
|
|
17
|
+
"maxLength": maxLength,
|
|
17
18
|
"attributes": {
|
|
18
|
-
"maxlength": maxlength,
|
|
19
19
|
"data-group-size": groupSize,
|
|
20
20
|
"autocomplete": "off",
|
|
21
21
|
"autocapitalize": "characters"
|
|
@@ -102,23 +102,23 @@ describe('FOR: Macro: Access-code', () => {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
describe('GIVEN: Params:
|
|
105
|
+
describe('GIVEN: Params: maxLength & groupSize', () => {
|
|
106
106
|
describe('WHEN: params are at default state', () => {
|
|
107
107
|
const $ = cheerio.load(renderComponent('access-code'));
|
|
108
|
-
test('THEN: renders input with total
|
|
108
|
+
test('THEN: renders input with total maxLength of 19', () => {
|
|
109
109
|
expect($('input').attr('maxlength')).toBe('19');
|
|
110
110
|
});
|
|
111
111
|
test('THEN: renders input with groupSize of 4', () => {
|
|
112
112
|
expect($('input').attr('data-group-size')).toBe('4');
|
|
113
113
|
});
|
|
114
114
|
});
|
|
115
|
-
describe('WHEN:
|
|
115
|
+
describe('WHEN: maxLength param is provided', () => {
|
|
116
116
|
const $ = cheerio.load(
|
|
117
117
|
renderComponent('access-code', {
|
|
118
|
-
|
|
118
|
+
maxLength: 8,
|
|
119
119
|
}),
|
|
120
120
|
);
|
|
121
|
-
test('THEN: renders input with provided
|
|
121
|
+
test('THEN: renders input with provided maxLength', () => {
|
|
122
122
|
expect($('input').attr('maxlength')).toBe('9');
|
|
123
123
|
});
|
|
124
124
|
});
|
|
@@ -132,14 +132,14 @@ describe('FOR: Macro: Access-code', () => {
|
|
|
132
132
|
expect($('input').attr('data-group-size')).toBe('2');
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
|
-
describe('WHEN:
|
|
135
|
+
describe('WHEN: maxLength and groupSize params are provided', () => {
|
|
136
136
|
const $ = cheerio.load(
|
|
137
137
|
renderComponent('access-code', {
|
|
138
|
-
|
|
138
|
+
maxLength: 6,
|
|
139
139
|
groupSize: 3,
|
|
140
140
|
}),
|
|
141
141
|
);
|
|
142
|
-
test('THEN: renders input with provided
|
|
142
|
+
test('THEN: renders input with provided maxLength accounting for provided groupSize', () => {
|
|
143
143
|
expect($('input').attr('maxlength')).toBe('7');
|
|
144
144
|
});
|
|
145
145
|
});
|
|
@@ -36,7 +36,7 @@ layout: ~
|
|
|
36
36
|
}}
|
|
37
37
|
{% endcall %}
|
|
38
38
|
|
|
39
|
-
<h1 class="ons-u-mt-
|
|
39
|
+
<h1 class="ons-u-mt-2xl">Start study</h1>
|
|
40
40
|
|
|
41
41
|
{{
|
|
42
42
|
onsAccessCode({
|
|
@@ -59,7 +59,7 @@ layout: ~
|
|
|
59
59
|
{{
|
|
60
60
|
onsButton({
|
|
61
61
|
"text": "Access study",
|
|
62
|
-
"classes": "ons-u-mb-
|
|
62
|
+
"classes": "ons-u-mb-2xl ons-u-mt-s"
|
|
63
63
|
})
|
|
64
64
|
}}
|
|
65
65
|
|
|
@@ -17,7 +17,7 @@ layout: ~
|
|
|
17
17
|
%}
|
|
18
18
|
|
|
19
19
|
{% block main %}
|
|
20
|
-
<h1 class="ons-u-mt-
|
|
20
|
+
<h1 class="ons-u-mt-2xl">Start study</h1>
|
|
21
21
|
|
|
22
22
|
{{
|
|
23
23
|
onsAccessCode({
|
|
@@ -36,7 +36,7 @@ layout: ~
|
|
|
36
36
|
{{
|
|
37
37
|
onsButton({
|
|
38
38
|
"text": "Access study",
|
|
39
|
-
"classes": "ons-u-mb-
|
|
39
|
+
"classes": "ons-u-mb-2xl ons-u-mt-s"
|
|
40
40
|
})
|
|
41
41
|
}}
|
|
42
42
|
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"headingAttributes": item.headingAttributes,
|
|
33
33
|
"contentAttributes": item.contentAttributes,
|
|
34
34
|
"title": item.title,
|
|
35
|
-
"
|
|
35
|
+
"headingLevel": item.headingLevel,
|
|
36
36
|
"content": item.content,
|
|
37
37
|
"group": params.id,
|
|
38
38
|
"saveState": params.saveState,
|
|
@@ -132,9 +132,9 @@
|
|
|
132
132
|
"mutuallyExclusive": params.mutuallyExclusive
|
|
133
133
|
},
|
|
134
134
|
"externalInitialiser": true,
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
135
|
+
"apiDomain": params.apiDomain,
|
|
136
|
+
"apiDomainBearerToken": params.apiDomainBearerToken,
|
|
137
|
+
"apiManualQueryParams": params.apiManualQueryParams,
|
|
138
138
|
"allowMultiple": params.allowMultiple,
|
|
139
139
|
"mandatory": params.mandatory,
|
|
140
140
|
"instructions": params.instructions,
|
|
@@ -157,15 +157,15 @@
|
|
|
157
157
|
"errorTitle": params.errorTitle,
|
|
158
158
|
"errorMessageEnter": params.errorMessageEnter,
|
|
159
159
|
"errorMessageSelect": params.errorMessageSelect,
|
|
160
|
-
"
|
|
161
|
-
"
|
|
160
|
+
"errorMessageApi": params.errorMessageApi,
|
|
161
|
+
"errorMessageApiLinkText": params.errorMessageApiLinkText,
|
|
162
162
|
"options": params.options,
|
|
163
|
-
"
|
|
163
|
+
"manualLinkUrl": params.manualLinkUrl,
|
|
164
164
|
"manualLinkText": params.manualLinkText
|
|
165
165
|
})
|
|
166
166
|
}}
|
|
167
167
|
{% if params.manualLinkText %}
|
|
168
|
-
<a href="{{ params.
|
|
168
|
+
<a href="{{ params.manualLinkUrl }}" class="ons-js-address-manual-btn ons-u-mt-s ons-u-dib"
|
|
169
169
|
>{{ params.manualLinkText }}</a
|
|
170
170
|
>
|
|
171
171
|
{% endif %}
|
|
@@ -312,9 +312,9 @@ describe('macro: address-input', () => {
|
|
|
312
312
|
error: '[params.error]',
|
|
313
313
|
name: '[params.name]',
|
|
314
314
|
mutuallyExclusive: '[params.mutuallyExclusive]',
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
apiDomain: '[params.apiDomain]',
|
|
316
|
+
apiDomainBearerToken: '[params.apiDomainBearerToken]',
|
|
317
|
+
apiManualQueryParams: '[params.apiManualQueryParams]',
|
|
318
318
|
allowMultiple: '[params.allowMultiple]',
|
|
319
319
|
mandatory: '[params.mandatory]',
|
|
320
320
|
instructions: '[params.instructions]',
|
|
@@ -338,10 +338,10 @@ describe('macro: address-input', () => {
|
|
|
338
338
|
errorTitle: '[params.errorTitle]',
|
|
339
339
|
errorMessageEnter: '[params.errorMessageEnter]',
|
|
340
340
|
errorMessageSelect: '[params.errorMessageSelect]',
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
errorMessageApi: '[params.errorMessageApi]',
|
|
342
|
+
errorMessageApiLinkText: '[params.errorMessageApiLinkText]',
|
|
343
343
|
options: '[params.options]',
|
|
344
|
-
|
|
344
|
+
manualLinkUrl: '[params.manualLinkUrl]',
|
|
345
345
|
manualLinkText: '[params.manualLinkText]',
|
|
346
346
|
});
|
|
347
347
|
|
|
@@ -362,9 +362,9 @@ describe('macro: address-input', () => {
|
|
|
362
362
|
mutuallyExclusive: '[params.mutuallyExclusive]',
|
|
363
363
|
},
|
|
364
364
|
externalInitialiser: true,
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
apiDomain: '[params.apiDomain]',
|
|
366
|
+
apiDomainBearerToken: '[params.apiDomainBearerToken]',
|
|
367
|
+
apiManualQueryParams: '[params.apiManualQueryParams]',
|
|
368
368
|
allowMultiple: '[params.allowMultiple]',
|
|
369
369
|
mandatory: '[params.mandatory]',
|
|
370
370
|
instructions: '[params.instructions]',
|
|
@@ -387,18 +387,19 @@ describe('macro: address-input', () => {
|
|
|
387
387
|
errorTitle: '[params.errorTitle]',
|
|
388
388
|
errorMessageEnter: '[params.errorMessageEnter]',
|
|
389
389
|
errorMessageSelect: '[params.errorMessageSelect]',
|
|
390
|
-
|
|
391
|
-
|
|
390
|
+
errorMessageApi: '[params.errorMessageApi]',
|
|
391
|
+
errorMessageApiLinkText: '[params.errorMessageApiLinkText]',
|
|
392
392
|
options: '[params.options]',
|
|
393
|
-
|
|
393
|
+
manualLinkUrl: '[params.manualLinkUrl]',
|
|
394
394
|
manualLinkText: '[params.manualLinkText]',
|
|
395
395
|
});
|
|
396
396
|
});
|
|
397
397
|
|
|
398
|
-
it('renders manualLinkText` when provided with a default value for `
|
|
398
|
+
it('renders manualLinkText` when provided with a default value for `manualLinkUrl`', () => {
|
|
399
399
|
const $ = cheerio.load(
|
|
400
400
|
renderComponent('address-input', {
|
|
401
401
|
...EXAMPLE_AUTOSUGGEST_ADDRESS_MINIMAL,
|
|
402
|
+
manualLinkUrl: '#0',
|
|
402
403
|
manualLinkText: 'Manually enter address',
|
|
403
404
|
}),
|
|
404
405
|
);
|
|
@@ -407,11 +408,11 @@ describe('macro: address-input', () => {
|
|
|
407
408
|
expect($('.ons-js-address-manual-btn').text().trim()).toBe('Manually enter address');
|
|
408
409
|
});
|
|
409
410
|
|
|
410
|
-
it('renders `manualLinkText` with `
|
|
411
|
+
it('renders `manualLinkText` with `manualLinkUrl` when provided', () => {
|
|
411
412
|
const $ = cheerio.load(
|
|
412
413
|
renderComponent('address-input', {
|
|
413
414
|
...EXAMPLE_AUTOSUGGEST_ADDRESS_MINIMAL,
|
|
414
|
-
|
|
415
|
+
manualLinkUrl: 'https://example.com/edit-address',
|
|
415
416
|
manualLinkText: 'Manually enter address',
|
|
416
417
|
}),
|
|
417
418
|
);
|
|
@@ -32,7 +32,7 @@ export default class AddressError {
|
|
|
32
32
|
const errorListElement = document.createElement('p');
|
|
33
33
|
const errorLinkElement = document.createElement('a');
|
|
34
34
|
|
|
35
|
-
errorElement.className = 'ons-panel ons-panel--error ons-u-mb-
|
|
35
|
+
errorElement.className = 'ons-panel ons-panel--error ons-u-mb-l ons-js-autosuggest-error-panel';
|
|
36
36
|
errorElementHeader.className = 'ons-panel__header';
|
|
37
37
|
errorElementTitle.className = 'ons-panel__title ons-u-fs-r--b';
|
|
38
38
|
errorBodyElement.className = 'ons-panel__body';
|
|
@@ -57,10 +57,10 @@ export default class AutosuggestAddress {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Set up AIMS api variables and auth
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
60
|
+
this.apiDomain = this.container.getAttribute('data-api-domain');
|
|
61
|
+
this.lookupUrl = `${this.apiDomain}/addresses/eq?input=`;
|
|
62
|
+
this.lookupGroupUrl = `${this.apiDomain}/addresses/eq/bucket?`;
|
|
63
|
+
this.retrieveUrl = `${this.apiDomain}/addresses/eq/uprn/`;
|
|
64
64
|
|
|
65
65
|
// Query string options
|
|
66
66
|
this.manualQueryParams = this.container.getAttribute('data-query-params');
|
|
@@ -77,7 +77,7 @@ export default class AutosuggestAddress {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
async checkAPIStatus() {
|
|
80
|
-
this.fetch = abortableFetch(this.
|
|
80
|
+
this.fetch = abortableFetch(this.lookupUrl + 'cf142&limit=10', {
|
|
81
81
|
method: 'GET',
|
|
82
82
|
headers: this.setAuthorization(this.authorizationToken),
|
|
83
83
|
});
|
|
@@ -109,24 +109,24 @@ export default class AutosuggestAddress {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
async findAddress(text, grouped) {
|
|
112
|
-
let
|
|
112
|
+
let queryUrl, fullQueryUrl;
|
|
113
113
|
|
|
114
114
|
if (this.manualQueryParams) {
|
|
115
115
|
const manualQueryParams = this.container.getAttribute('data-query-params');
|
|
116
|
-
|
|
116
|
+
fullQueryUrl = this.lookupUrl + text + manualQueryParams;
|
|
117
117
|
} else {
|
|
118
118
|
const fullPostcodeQuery = this.testFullPostcodeQuery(text);
|
|
119
119
|
let limit = fullPostcodeQuery ? 100 : 10;
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
queryUrl = grouped ? this.lookupGroupUrl + this.groupQuery : this.lookupUrl + text + '&limit=' + limit;
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
fullQueryUrl = this.generateUrlParams(queryUrl);
|
|
124
124
|
if (fullPostcodeQuery && grouped !== false) {
|
|
125
|
-
|
|
125
|
+
fullQueryUrl = fullQueryUrl + '&groupfullpostcodes=combo';
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
this.fetch = abortableFetch(
|
|
129
|
+
this.fetch = abortableFetch(fullQueryUrl, {
|
|
130
130
|
method: 'GET',
|
|
131
131
|
headers: this.setAuthorization(this.authorizationToken),
|
|
132
132
|
});
|
|
@@ -248,11 +248,11 @@ export default class AutosuggestAddress {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
async retrieveAddress(id, type = null) {
|
|
251
|
-
let retrieveUrl = this.
|
|
251
|
+
let retrieveUrl = this.retrieveUrl + id;
|
|
252
252
|
|
|
253
|
-
const
|
|
253
|
+
const fullUprnUrl = this.generateUrlParams(retrieveUrl, id, type);
|
|
254
254
|
|
|
255
|
-
this.fetch = abortableFetch(
|
|
255
|
+
this.fetch = abortableFetch(fullUprnUrl, {
|
|
256
256
|
method: 'GET',
|
|
257
257
|
headers: this.setAuthorization(this.authorizationToken),
|
|
258
258
|
});
|
|
@@ -315,8 +315,8 @@ export default class AutosuggestAddress {
|
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
|
|
319
|
-
let
|
|
318
|
+
generateUrlParams(baseUrl, uprn, type) {
|
|
319
|
+
let fullUrl = baseUrl,
|
|
320
320
|
addressType;
|
|
321
321
|
|
|
322
322
|
const classificationFilterParam = '&classificationfilter=',
|
|
@@ -336,37 +336,37 @@ export default class AutosuggestAddress {
|
|
|
336
336
|
|
|
337
337
|
if (!uprn) {
|
|
338
338
|
if (this.classificationFilter && this.classificationFilter !== 'residential') {
|
|
339
|
-
|
|
339
|
+
fullUrl = fullUrl + classificationFilterParam + this.classificationFilter;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
if (this.classificationFilter === 'workplace') {
|
|
343
343
|
if (this.regionCode === 'gb-eng') {
|
|
344
|
-
|
|
344
|
+
fullUrl = fullUrl + eboostParam;
|
|
345
345
|
} else if (this.regionCode === 'gb-wls') {
|
|
346
|
-
|
|
346
|
+
fullUrl = fullUrl + wboostParam;
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
if (this.regionCode === 'gb-nir') {
|
|
351
351
|
if (this.classificationFilter === 'educational') {
|
|
352
|
-
|
|
352
|
+
fullUrl = fullUrl + nionlyParam;
|
|
353
353
|
} else {
|
|
354
|
-
|
|
354
|
+
fullUrl = fullUrl + niboostParam;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
if (this.lang === 'cy') {
|
|
359
|
-
|
|
359
|
+
fullUrl = fullUrl + favourwelshParam;
|
|
360
360
|
}
|
|
361
361
|
} else if (uprn) {
|
|
362
|
-
|
|
362
|
+
fullUrl = baseUrl + addresstypeParam + addressType;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
if (this.epoch === 'true') {
|
|
366
|
-
|
|
366
|
+
fullUrl = fullUrl + epochParam;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
return
|
|
369
|
+
return fullUrl;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
handleAPIError() {
|
|
@@ -30,8 +30,8 @@ const EXAMPLE_ADDRESS_INPUT = {
|
|
|
30
30
|
errorTitle: 'There is a problem with your answer',
|
|
31
31
|
errorMessageEnter: 'Enter an address',
|
|
32
32
|
errorMessageSelect: 'Select an address',
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
errorMessageApi: 'Sorry, there is a problem loading addresses',
|
|
34
|
+
errorMessageApiLinkText: 'Enter address manually',
|
|
35
35
|
options: {
|
|
36
36
|
regionCode: 'gb-eng',
|
|
37
37
|
addressType: 'residential',
|
|
@@ -52,20 +52,21 @@ const EXAMPLE_ADDRESS_INPUT = {
|
|
|
52
52
|
label: 'Postcode',
|
|
53
53
|
},
|
|
54
54
|
searchButton: 'Search for an address',
|
|
55
|
+
manualLinkUrl: '#0',
|
|
55
56
|
manualLinkText: 'Manually enter address',
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
const EXAMPLE_ADDRESS_INPUT_WITH_API = {
|
|
59
60
|
...EXAMPLE_ADDRESS_INPUT,
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
apiDomain: '/fake/api',
|
|
62
|
+
apiDomainBearerToken: 'someToken',
|
|
62
63
|
externalInitialiser: true,
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
const { setTimeout } = require('node:timers/promises');
|
|
66
67
|
|
|
67
68
|
describe('script: address-input', () => {
|
|
68
|
-
const apiFaker = new PuppeteerEndpointFaker(EXAMPLE_ADDRESS_INPUT_WITH_API.
|
|
69
|
+
const apiFaker = new PuppeteerEndpointFaker(EXAMPLE_ADDRESS_INPUT_WITH_API.apiDomain);
|
|
69
70
|
|
|
70
71
|
apiFaker.setOverrides(
|
|
71
72
|
[
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"isEditable": true,
|
|
12
12
|
"mandatory": true,
|
|
13
|
-
"
|
|
14
|
-
'
|
|
13
|
+
"apiDomain": "https://mock-address-api.gcp.onsdigital.uk",
|
|
14
|
+
'apiDomainBearerToken': "some_token",
|
|
15
15
|
"instructions": "Use up and down keys to navigate suggestions once you\'ve typed more than two characters. Use the enter key to select a suggestion. Touch device users, explore by touch or with swipe gestures.",
|
|
16
16
|
"ariaYouHaveSelected": "You have selected",
|
|
17
17
|
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"errorTitle": "There is a problem with your answer",
|
|
31
31
|
"errorMessageEnter": "Enter an address",
|
|
32
32
|
"errorMessageSelect": "Select an address",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"errorMessageApi": "Sorry, there is a problem loading addresses.",
|
|
34
|
+
"errorMessageApiLinkText": "Enter address manually",
|
|
35
35
|
"options": {
|
|
36
36
|
"regionCode": "gb-eng",
|
|
37
37
|
"addressType": "residential"
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"label": "Postcode"
|
|
50
50
|
},
|
|
51
51
|
"searchButton": "Search for an address",
|
|
52
|
+
"manualLinkUrl": "#0",
|
|
52
53
|
"manualLinkText": "Manually enter address"
|
|
53
54
|
})
|
|
54
55
|
}}
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"mandatory": true,
|
|
13
13
|
"externalInitialiser": true,
|
|
14
14
|
"autocomplete": "off",
|
|
15
|
-
"
|
|
16
|
-
'
|
|
15
|
+
"apiDomain": "https://mock-address-api.gcp.onsdigital.uk",
|
|
16
|
+
'apiDomainBearerToken': "some_token",
|
|
17
17
|
"instructions": "Use up and down keys to navigate suggestions once you\'ve typed more than two characters. Use the enter key to select a suggestion. Touch device users, explore by touch or with swipe gestures.",
|
|
18
18
|
"ariaYouHaveSelected": "You have selected",
|
|
19
19
|
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
"errorTitle": "There is a problem with your answer",
|
|
32
32
|
"errorMessageEnter": "Enter an address",
|
|
33
33
|
"errorMessageSelect": "Select an address",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"errorMessageAPILink": "#0",
|
|
34
|
+
"errorMessageApi": "Sorry, there is a problem. We are working to fix it. Please try again later or",
|
|
35
|
+
"errorMessageApiLinkText": "contact us for more help",
|
|
37
36
|
"options": {
|
|
38
37
|
"regionCode": "gb-eng",
|
|
39
38
|
"addressType": "residential"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
border-radius: $input-radius;
|
|
6
6
|
display: inline-block;
|
|
7
7
|
|
|
8
|
-
@include mq(
|
|
8
|
+
@include mq('2xs', s) {
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
&__panel.ons-panel--warn {
|
|
95
95
|
background: none;
|
|
96
96
|
border: 0;
|
|
97
|
-
margin: 0;
|
|
97
|
+
margin: 0 !important;
|
|
98
98
|
.ons-panel__icon {
|
|
99
|
-
font-size:
|
|
100
|
-
line-height:
|
|
99
|
+
font-size: 1.3rem;
|
|
100
|
+
line-height: 1.5rem;
|
|
101
101
|
margin-top: 0;
|
|
102
|
-
min-height:
|
|
103
|
-
min-width:
|
|
104
|
-
top:
|
|
102
|
+
min-height: 1.5rem;
|
|
103
|
+
min-width: 1.5rem;
|
|
104
|
+
top: 1rem;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.ons-panel__body {
|
|
108
108
|
font-weight: $font-weight-bold;
|
|
109
|
-
padding: 0.
|
|
109
|
+
padding: 0.75rem 0.75rem 0.75rem 2rem;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
data-results-title="{{ params.resultsTitle }}"
|
|
16
16
|
data-no-results="{{ params.noResults }}"
|
|
17
17
|
data-type-more="{{ params.typeMore }}"
|
|
18
|
-
{% if params.
|
|
19
|
-
{% if params.
|
|
20
|
-
{% if params.
|
|
18
|
+
{% if params.apiDomain %}data-api-domain="{{ params.apiDomain }}"{% endif %}
|
|
19
|
+
{% if params.apiDomainBearerToken %}data-authorization-token="{{ params.apiDomainBearerToken }}"{% endif %}
|
|
20
|
+
{% if params.apiManualQueryParams == true %}data-query-params=""{% endif %}
|
|
21
21
|
{% if params.allowMultiple == true %}data-allow-multiple="true"{% endif %}
|
|
22
22
|
{% if params.autosuggestData %}data-autosuggest-data="{{ params.autosuggestData }}"{% endif %}
|
|
23
23
|
{% if params.errorTitle %}data-error-title="{{ params.errorTitle }}"{% endif %}
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
{% if params.ariaGroupedResults %}data-aria-grouped-results="{{ params.ariaGroupedResults }}"{% endif %}
|
|
27
27
|
{% if params.groupCount %}data-group-count="{{ params.groupCount }}"{% endif %}
|
|
28
28
|
{% if params.tooManyResults %}data-too-many-results="{{ params.tooManyResults }}"{% endif %}
|
|
29
|
-
{% if params.
|
|
30
|
-
{% if params.
|
|
29
|
+
{% if params.errorMessageApi %}data-error-api="{{ params.errorMessageApi }}"{% endif %}
|
|
30
|
+
{% if params.errorMessageApiLinkText %}data-error-api-link-text="{{ params.errorMessageApiLinkText }}"{% endif %}
|
|
31
31
|
{% if params.language %}data-lang="{{ params.language }}"{% endif %}
|
|
32
32
|
{% if params.options %}
|
|
33
33
|
{% if params.options.oneYearAgo %}data-options-one-year-ago="true"{% endif %}
|
|
@@ -597,7 +597,7 @@ describe('script: autosuggest', () => {
|
|
|
597
597
|
...EXAMPLE_AUTOSUGGEST,
|
|
598
598
|
errorTitle: 'There is a problem with your answer',
|
|
599
599
|
errorMessage: 'Enter an address ',
|
|
600
|
-
|
|
600
|
+
errorMessageApi: 'Sorry, there is a problem.',
|
|
601
601
|
}),
|
|
602
602
|
);
|
|
603
603
|
|
|
@@ -31,15 +31,15 @@ layout: ~
|
|
|
31
31
|
%}
|
|
32
32
|
|
|
33
33
|
{% block main %}
|
|
34
|
-
<h1 class="ons-u-fs-
|
|
35
|
-
<span class="ons-u-fs-m ons-u-db ons-u-mb-
|
|
34
|
+
<h1 class="ons-u-fs-2xl">
|
|
35
|
+
<span class="ons-u-fs-m ons-u-db ons-u-mb-2xs ons-u-lighter">Press releases</span>
|
|
36
36
|
<span class="ons-u-vh">: </span>
|
|
37
|
-
<span class="ons-u-fs-
|
|
37
|
+
<span class="ons-u-fs-2xl ons-u-db">ONS launches Integrated Data Service to boost government collaboration on data sharing</span>
|
|
38
38
|
</h1>
|
|
39
39
|
|
|
40
40
|
<div class="ons-grid">
|
|
41
41
|
<div class="ons-grid__col ons-col-7@m">
|
|
42
|
-
<div class="ons-page__body ons-u-mt-
|
|
42
|
+
<div class="ons-page__body ons-u-mt-l">
|
|
43
43
|
<p>
|
|
44
44
|
In a groundbreaking move, the Office for National Statistics (ONS) has embarked on a transformative journey with the
|
|
45
45
|
introduction of the Integrated Data Service (IDS). This sophisticated, cloud-based platform is meticulously crafted to
|
|
@@ -106,7 +106,7 @@ layout: ~
|
|
|
106
106
|
appropriately and making sure it is put to use for the public good."
|
|
107
107
|
</p>
|
|
108
108
|
|
|
109
|
-
<div class="ons-u-mt-
|
|
109
|
+
<div class="ons-u-mt-xl ons-u-mt-3xl@m">
|
|
110
110
|
{{
|
|
111
111
|
onsContentPagination({
|
|
112
112
|
"ariaLabel": 'Article pagination',
|
|
@@ -179,7 +179,7 @@ layout: ~
|
|
|
179
179
|
"id": 'share-this-article',
|
|
180
180
|
"title": 'Share this article',
|
|
181
181
|
"iconPosition": 'before',
|
|
182
|
-
"iconSize": '
|
|
182
|
+
"iconSize": '2xl',
|
|
183
183
|
"itemsList": [
|
|
184
184
|
{
|
|
185
185
|
"url": '#0',
|