@ons/design-system 70.0.8 → 70.0.10
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 +31 -25
- package/components/access-code/example-access-code-error.njk +49 -37
- package/components/access-code/example-access-code.njk +40 -30
- package/components/accordion/_macro.njk +7 -6
- package/components/accordion/example-accordion-open.njk +0 -1
- package/components/address-input/_macro.njk +23 -11
- package/components/address-input/autosuggest.address.js +0 -5
- package/components/address-input/example-address-input-editable.njk +52 -50
- package/components/address-input/example-address-input-manual.njk +23 -21
- package/components/address-input/example-address-input.njk +40 -38
- package/components/address-output/_macro.njk +6 -6
- package/components/autosuggest/_macro.njk +57 -37
- package/components/autosuggest/example-autosuggest-country-multiple.njk +26 -26
- package/components/autosuggest/example-autosuggest-country.njk +24 -24
- package/components/back-to-top/example-back-to-top.njk +183 -6
- package/components/back-to-top/example-full-page-back-to-top.njk +135 -123
- package/components/breadcrumbs/_macro.njk +12 -4
- package/components/browser-banner/_macro.njk +6 -3
- package/components/button/_button.scss +36 -1
- package/components/button/_macro.njk +63 -62
- package/components/button/example-button-ghost.njk +1 -0
- package/components/call-to-action/_macro.njk +7 -5
- package/components/call-to-action/example-call-to-action-default.njk +3 -2
- package/components/card/_macro.njk +26 -10
- package/components/card/example-card-set-with-images.njk +31 -29
- package/components/card/example-card-set-with-lists.njk +58 -56
- package/components/card/example-card-set.njk +28 -26
- package/components/card/example-card.njk +9 -7
- package/components/char-check-limit/_macro.njk +1 -3
- package/components/checkboxes/_checkbox-macro.njk +19 -15
- package/components/checkboxes/_macro.njk +81 -72
- package/components/checkboxes/example-checkboxes-disabled.njk +30 -30
- package/components/checkboxes/example-checkboxes-error.njk +0 -1
- package/components/checkboxes/example-checkboxes-with-descriptions.njk +7 -5
- package/components/checkboxes/example-checkboxes-with-hidden-label.njk +162 -170
- package/components/checkboxes/example-checkboxes-with-revealed-checkboxes-expanded.njk +81 -81
- package/components/checkboxes/example-checkboxes-with-revealed-checkboxes.njk +79 -79
- package/components/checkboxes/example-checkboxes-with-revealed-select-expanded.njk +7 -5
- package/components/checkboxes/example-checkboxes-with-revealed-select.njk +7 -5
- package/components/checkboxes/example-checkboxes-with-revealed-text-input-expanded.njk +7 -5
- package/components/checkboxes/example-checkboxes-with-revealed-text-input.njk +7 -5
- package/components/checkboxes/example-checkboxes-with-select-all-button.njk +7 -5
- package/components/checkboxes/example-checkboxes-with-visible-text-input.njk +7 -5
- package/components/checkboxes/example-checkboxes.njk +7 -5
- package/components/content-pagination/_macro.njk +34 -32
- package/components/content-pagination/example-content-pagination.njk +17 -17
- package/components/cookies-banner/_macro.njk +19 -6
- package/components/cookies-banner/example-cookies-banner-cymraeg.njk +2 -1
- package/components/cookies-banner/example-cookies-banner.njk +3 -4
- package/components/date-input/_macro.njk +71 -63
- package/components/date-input/example-date-input-error-for-single-field.njk +0 -1
- package/components/date-input/example-date-input-error.njk +0 -1
- package/components/description-list/_macro.njk +20 -11
- package/components/details/_macro.njk +18 -11
- package/components/details/example-details-with-warning.njk +15 -10
- package/components/document-list/_macro.njk +102 -93
- package/components/document-list/example-document-list-article-featured.njk +27 -25
- package/components/document-list/example-document-list-articles.njk +55 -53
- package/components/document-list/example-document-list-downloads.njk +49 -47
- package/components/document-list/example-document-list-search-result-featured.njk +19 -17
- package/components/document-list/example-document-list-search-results.njk +60 -58
- package/components/duration/_macro.njk +61 -55
- package/components/duration/example-duration-error-for-single-field.njk +28 -26
- package/components/duration/example-duration-single-field.njk +23 -19
- package/components/duration/example-duration.njk +33 -29
- package/components/error/_macro.njk +8 -6
- package/components/external-link/_macro.njk +7 -5
- package/components/external-link/example-external-link.njk +9 -6
- package/components/feedback/_macro.njk +7 -5
- package/components/field/_macro.njk +2 -2
- package/components/fieldset/_macro.njk +23 -16
- package/components/footer/_macro.njk +28 -21
- package/components/footer/_macro.spec.js +1 -1
- package/components/footer/example-footer-cymraeg.njk +2 -1
- package/components/footer/example-footer-default.njk +3 -4
- package/components/footer/example-footer-transactional.njk +2 -1
- package/components/footer/example-footer-warning.njk +2 -1
- package/components/footer/example-footer-with-alternative-organisation.njk +2 -1
- package/components/footer/example-footer-with-coat-of-arms.njk +2 -1
- package/components/footer/example-footer-with-copyright.njk +2 -1
- package/components/footer/example-footer.njk +2 -1
- package/components/header/_header.scss +24 -19
- package/components/header/_macro.njk +183 -141
- package/components/header/example-header-default.njk +2 -1
- package/components/header/example-header-external-for-survey-with-description.njk +2 -1
- package/components/header/example-header-external-for-surveys.njk +2 -1
- package/components/header/example-header-external-welsh.njk +7 -7
- package/components/header/example-header-external-with-navigation-and-search.njk +3 -2
- package/components/header/example-header-external-with-navigation.njk +2 -1
- package/components/header/example-header-external-with-service-links.njk +2 -1
- package/components/header/example-header-external-with-sub-navigation-removed.njk +2 -1
- package/components/header/example-header-external-with-sub-navigation.njk +3 -2
- package/components/header/example-header-internal.njk +2 -1
- package/components/header/example-header-multiple-logos.njk +2 -1
- package/components/header/{example-header-neutral-for-multicoloured-logo.njk → example-header-neutral.njk} +2 -1
- package/components/helpers/grid.njk +17 -16
- package/components/hero/_macro.njk +6 -11
- package/components/hero/example-hero-dark.njk +2 -1
- package/components/hero/example-hero-default.njk +2 -1
- package/components/icon/_macro.njk +601 -168
- package/components/image/_macro.njk +7 -5
- package/components/input/_macro.njk +114 -95
- package/components/input/example-input-search-with-character-check.njk +1 -1
- package/components/input/example-input-search-with-placeholder.njk +1 -1
- package/components/input/example-input-search.njk +1 -1
- package/components/label/_macro.njk +32 -26
- package/components/language-selector/_macro.njk +11 -2
- package/components/list/_list.scss +13 -0
- package/components/list/_macro.njk +93 -73
- package/components/message/_macro.njk +20 -7
- package/components/message-list/_macro.njk +26 -20
- package/components/modal/_macro.njk +11 -12
- package/components/multiple-input-fields/_macro.njk +30 -28
- package/components/mutually-exclusive/_macro.njk +20 -13
- package/components/mutually-exclusive/example-mutually-exclusive-checkboxes.njk +6 -4
- package/components/mutually-exclusive/example-mutually-exclusive-date.njk +7 -5
- package/components/mutually-exclusive/example-mutually-exclusive-duration.njk +44 -40
- package/components/mutually-exclusive/example-mutually-exclusive-email.njk +7 -5
- package/components/mutually-exclusive/example-mutually-exclusive-multiple-options.njk +6 -4
- package/components/mutually-exclusive/example-mutually-exclusive-number.njk +6 -4
- package/components/mutually-exclusive/example-mutually-exclusive-textarea.njk +6 -4
- package/components/navigation/_macro.njk +133 -67
- package/components/navigation/_navigation.scss +0 -9
- package/components/pagination/_macro.njk +42 -20
- package/components/panel/_macro.njk +27 -16
- package/components/panel/example-panel-bare.njk +6 -4
- package/components/panel/example-panel-with-announcement.njk +7 -4
- package/components/panel/example-panel-with-error-summary.njk +6 -4
- package/components/panel/example-panel-with-warning.njk +5 -3
- package/components/password/_macro.njk +7 -5
- package/components/phase-banner/_macro.njk +3 -3
- package/components/phase-banner/example-phase-banner-alpha.njk +2 -1
- package/components/phase-banner/example-phase-banner-beta.njk +4 -3
- package/components/question/_macro.njk +62 -47
- package/components/question/example-question-ccs.njk +40 -35
- package/components/question/example-question-fieldset.njk +84 -80
- package/components/question/example-question-interviewer-note.njk +27 -24
- package/components/question/example-question-no-fieldset.njk +39 -33
- package/components/quote/_macro.njk +3 -1
- package/components/radios/_macro.njk +54 -36
- package/components/radios/_macro.spec.js +21 -0
- package/components/radios/example-radios-with-clear-button-expanded.njk +6 -4
- package/components/radios/example-radios-with-clear-button.njk +6 -4
- package/components/radios/example-radios-with-descriptions.njk +7 -5
- package/components/radios/example-radios-with-revealed-select-expanded.njk +6 -4
- package/components/radios/example-radios-with-revealed-select.njk +6 -4
- package/components/radios/example-radios-with-revealed-text-area-expanded.njk +7 -5
- package/components/radios/example-radios-with-revealed-text-area.njk +7 -5
- package/components/radios/example-radios-with-revealed-text-input-expanded.njk +7 -5
- package/components/radios/example-radios-with-revealed-text-input.njk +7 -5
- package/components/radios/example-radios-with-separator.njk +6 -4
- package/components/radios/example-radios-with-visible-text-input.njk +7 -5
- package/components/radios/example-radios-without-border.njk +0 -1
- package/components/radios/example-radios.njk +7 -5
- package/components/related-content/_macro.njk +10 -11
- package/components/related-content/_section-macro.njk +7 -7
- package/components/related-content/example-related-content-general.njk +5 -3
- package/components/related-content/example-related-content-multiple-rows-of-links.njk +51 -49
- package/components/related-content/example-related-content-social-media.njk +40 -38
- package/components/relationships/_macro.njk +10 -8
- package/components/relationships/example-relationships-error.njk +176 -168
- package/components/relationships/example-relationships-you.njk +169 -163
- package/components/relationships/example-relationships.njk +167 -161
- package/components/section-navigation/_macro.njk +34 -12
- package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +23 -0
- package/components/select/_macro.njk +21 -18
- package/components/share-page/_macro.njk +10 -5
- package/components/skip-to-content/_macro.njk +1 -1
- package/components/skip-to-content/example-skip-to-content.njk +1 -0
- package/components/status/_macro.njk +1 -1
- package/components/summary/_macro.njk +53 -23
- package/components/summary/example-summary-household-no-rows.njk +18 -16
- package/components/summary/example-summary-household.njk +75 -73
- package/components/summary/example-summary-hub-minimal.njk +74 -72
- package/components/summary/example-summary-hub.njk +169 -167
- package/components/table/_macro.njk +72 -45
- package/components/table-of-contents/_macro.njk +34 -32
- package/components/table-of-contents/example-table-of-contents-grouped.njk +1 -1
- package/components/table-of-contents/example-table-of-contents-single.njk +1 -1
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +79 -38
- package/components/table-of-contents/example-table-of-contents-sticky.njk +50 -13
- package/components/tabs/_macro.njk +12 -6
- package/components/tabs/example-tabs-details.njk +5 -6
- package/components/text-indent/_macro.njk +1 -3
- package/components/textarea/_macro.njk +49 -46
- package/components/textarea/_macro.spec.js +0 -11
- package/components/timeline/_macro.njk +4 -6
- package/components/timeout-modal/_macro.njk +21 -19
- package/components/timeout-modal/example-timeout-modal.njk +16 -14
- package/components/timeout-panel/_macro.njk +19 -17
- package/components/timeout-panel/example-panel-with-timeout-warning.njk +13 -11
- package/components/upload/_macro.njk +20 -16
- package/components/video/_macro.njk +16 -2
- package/components/video/example-video.njk +2 -2
- package/css/main.css +1 -1
- package/layout/_dsTemplate.njk +22 -20
- package/layout/_template.njk +63 -49
- package/package.json +4 -3
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/overrides/hcm.scss +1 -1
- package/scss/vars/_colors.scss +1 -1
|
@@ -7,29 +7,33 @@
|
|
|
7
7
|
{% set maxlength = params.maxlength | default(16) + extraSpaces %}
|
|
8
8
|
|
|
9
9
|
{% set content %}
|
|
10
|
-
{{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
10
|
+
{{
|
|
11
|
+
onsInput({
|
|
12
|
+
"id": params.id,
|
|
13
|
+
"type": params.type,
|
|
14
|
+
"name": params.name,
|
|
15
|
+
"classes": "ons-access-code__input ons-js-access-code" + (" ons-u-mb-xs" if params.postTextboxLinkText else ""),
|
|
16
|
+
"label": params.label,
|
|
17
|
+
"attributes": {
|
|
18
|
+
"maxlength": maxlength,
|
|
19
|
+
"data-group-size": groupSize,
|
|
20
|
+
"autocomplete": "off",
|
|
21
|
+
"autocapitalize": "characters"
|
|
22
|
+
},
|
|
23
|
+
"fieldClasses": "ons-question__answer",
|
|
24
|
+
"error": params.error,
|
|
25
|
+
"postTextboxLinkText": params.postTextboxLinkText,
|
|
26
|
+
"postTextboxLinkUrl": params.postTextboxLinkUrl
|
|
27
|
+
})
|
|
28
|
+
}}
|
|
27
29
|
{% endset %}
|
|
28
30
|
|
|
29
31
|
{% if not params.error %}
|
|
30
|
-
{%
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
{%
|
|
33
|
+
call onsPanel({
|
|
34
|
+
"classes": "ons-u-mb-s" + (" " + params.classes if params.classes else "")
|
|
35
|
+
})
|
|
36
|
+
%}
|
|
33
37
|
{{ content | safe }}
|
|
34
38
|
{% endcall %}
|
|
35
39
|
{% else %}
|
|
@@ -37,11 +41,13 @@
|
|
|
37
41
|
{% endif %}
|
|
38
42
|
|
|
39
43
|
{% if params.securityMessage %}
|
|
40
|
-
{%
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
{%
|
|
45
|
+
call onsPanel({
|
|
46
|
+
"variant": "bare",
|
|
47
|
+
"iconType": "lock",
|
|
48
|
+
"classes": "ons-u-mb-s"
|
|
49
|
+
})
|
|
50
|
+
%}
|
|
45
51
|
{{ params.securityMessage }}
|
|
46
52
|
{% endcall %}
|
|
47
53
|
{% endif %}
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: 'Example: Access code error'
|
|
3
3
|
layout: ~
|
|
4
4
|
---
|
|
5
|
+
|
|
5
6
|
{% extends "layout/_template.njk" %}
|
|
6
7
|
{% from "components/access-code/_macro.njk" import onsAccessCode %}
|
|
7
8
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
8
9
|
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
9
10
|
{% from "components/details/_macro.njk" import onsDetails %}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
11
|
+
{%
|
|
12
|
+
set pageConfig = {
|
|
13
|
+
"title": "Study title"
|
|
14
|
+
}
|
|
15
|
+
%}
|
|
14
16
|
|
|
15
17
|
{% block main %}
|
|
16
|
-
{%
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
{%
|
|
19
|
+
call onsPanel({
|
|
20
|
+
"title": "There is a problem with this page",
|
|
21
|
+
"variant": "error"
|
|
22
|
+
})
|
|
23
|
+
%}
|
|
20
24
|
{% from "components/list/_macro.njk" import onsList %}
|
|
21
25
|
{{
|
|
22
26
|
onsList({
|
|
@@ -34,46 +38,54 @@ layout: ~
|
|
|
34
38
|
|
|
35
39
|
<h1 class="ons-u-mt-l">Start study</h1>
|
|
36
40
|
|
|
37
|
-
{{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
{{
|
|
42
|
+
onsAccessCode({
|
|
43
|
+
"id": "access-code",
|
|
44
|
+
"name": "access-code",
|
|
45
|
+
"postTextboxLinkText": "Where to find your access code",
|
|
46
|
+
"postTextboxLinkUrl": "#0",
|
|
47
|
+
"label": {
|
|
48
|
+
"text": "Enter your 16-character access code",
|
|
49
|
+
"description": "Keep this code safe. You will need to enter it every time you access your survey"
|
|
50
|
+
},
|
|
51
|
+
"securityMessage": "Your personal information is protected by law and will be kept confidential",
|
|
52
|
+
"error": {
|
|
53
|
+
"id": "access-code-error",
|
|
54
|
+
"text": "Enter an access code"
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}}
|
|
52
58
|
|
|
53
|
-
{{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
{{
|
|
60
|
+
onsButton({
|
|
61
|
+
"text": "Access study",
|
|
62
|
+
"classes": "ons-u-mb-xl"
|
|
63
|
+
})
|
|
64
|
+
}}
|
|
57
65
|
|
|
58
66
|
<h2>If you do not have an access code</h2>
|
|
59
67
|
<p>
|
|
60
|
-
If you have lost or not received an access code, you can <a href="#0">request a new access code</a>.
|
|
61
|
-
|
|
68
|
+
If you have lost or not received an access code, you can <a href="#0">request a new access code</a>. This can be sent to you by text
|
|
69
|
+
or post.
|
|
62
70
|
</p>
|
|
63
71
|
|
|
64
72
|
{% set content %}
|
|
65
73
|
<p>If you need to answer separately from the people you live with, you can <a href="#0">request an individual access code</a>.</p>
|
|
66
|
-
{%
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
{%
|
|
75
|
+
call onsPanel({
|
|
76
|
+
"variant": "warn"
|
|
77
|
+
})
|
|
78
|
+
%}
|
|
69
79
|
Someone in your household must still complete a study using this household access code
|
|
70
80
|
{% endcall %}
|
|
71
81
|
{% endset %}
|
|
72
82
|
|
|
73
|
-
{%
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
{%
|
|
84
|
+
call onsDetails({
|
|
85
|
+
"id": "details-access-code-error",
|
|
86
|
+
"title": "Need to answer separately from your household?"
|
|
87
|
+
})
|
|
88
|
+
%}
|
|
77
89
|
{{ content | safe }}
|
|
78
90
|
{% endcall %}
|
|
79
91
|
{% endblock %}
|
|
@@ -1,58 +1,68 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: 'Example: Access code'
|
|
3
3
|
layout: ~
|
|
4
4
|
---
|
|
5
|
+
|
|
5
6
|
{% extends "layout/_template.njk" %}
|
|
6
7
|
{% from "components/access-code/_macro.njk" import onsAccessCode %}
|
|
7
8
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
8
9
|
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
9
10
|
{% from "components/details/_macro.njk" import onsDetails %}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
{%
|
|
12
|
+
set pageConfig = {
|
|
13
|
+
"header": {
|
|
14
|
+
"title": "Study title"
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
%}
|
|
16
18
|
|
|
17
19
|
{% block main %}
|
|
18
20
|
<h1 class="ons-u-mt-l">Start study</h1>
|
|
19
21
|
|
|
20
|
-
{{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
{{
|
|
23
|
+
onsAccessCode({
|
|
24
|
+
"id": "access-code-example",
|
|
25
|
+
"name": "access-code",
|
|
26
|
+
"postTextboxLinkText": "Where to find your access code",
|
|
27
|
+
"postTextboxLinkUrl": "#0",
|
|
28
|
+
"label": {
|
|
29
|
+
"text": "Enter your 16-character access code",
|
|
30
|
+
"description": "Keep this code safe. You will need to enter it every time you access your study"
|
|
31
|
+
},
|
|
32
|
+
"securityMessage": "Your personal information is protected by law and will be kept confidential"
|
|
33
|
+
})
|
|
34
|
+
}}
|
|
31
35
|
|
|
32
|
-
{{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
{{
|
|
37
|
+
onsButton({
|
|
38
|
+
"text": "Access study",
|
|
39
|
+
"classes": "ons-u-mb-xl"
|
|
40
|
+
})
|
|
41
|
+
}}
|
|
36
42
|
|
|
37
43
|
<h2>If you do not have an access code</h2>
|
|
38
44
|
<p>
|
|
39
|
-
If you have lost or not received an access code, you can <a href="#0">request a new access code</a>.
|
|
40
|
-
|
|
45
|
+
If you have lost or not received an access code, you can <a href="#0">request a new access code</a>. This can be sent to you by text
|
|
46
|
+
or post.
|
|
41
47
|
</p>
|
|
42
48
|
|
|
43
49
|
{% set content %}
|
|
44
50
|
<p>If you need to answer separately from the people you live with, you can <a href="#0">request an individual access code</a>.</p>
|
|
45
|
-
{%
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
{%
|
|
52
|
+
call onsPanel({
|
|
53
|
+
"variant": "warn"
|
|
54
|
+
})
|
|
55
|
+
%}
|
|
48
56
|
Someone in your household must still complete a study using this household access code
|
|
49
57
|
{% endcall %}
|
|
50
58
|
{% endset %}
|
|
51
59
|
|
|
52
|
-
{%
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
{%
|
|
61
|
+
call onsDetails({
|
|
62
|
+
"id": "details",
|
|
63
|
+
"title": "Need to answer separately from your household?"
|
|
64
|
+
})
|
|
65
|
+
%}
|
|
56
66
|
{{ content | safe }}
|
|
57
67
|
{% endcall %}
|
|
58
68
|
{% endblock %}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{% macro onsAccordion(params) %}
|
|
2
2
|
{% from "components/details/_macro.njk" import onsDetails %}
|
|
3
3
|
|
|
4
|
-
<div id="{{params.id}}" class="ons-accordion{{ ' ' + params.classes if params.classes }}">
|
|
4
|
+
<div id="{{ params.id }}" class="ons-accordion{{ ' ' + params.classes if params.classes else '' }}">
|
|
5
5
|
{% if params.allButton %}
|
|
6
6
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
7
7
|
{% set attributes = params.allButton.attributes | default({}) %}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
{%
|
|
9
|
+
set attributes = attributes | setAttributes({
|
|
10
|
+
"data-close-all": params.allButton.close,
|
|
11
|
+
"data-group": params.id
|
|
12
|
+
})
|
|
13
|
+
%}
|
|
13
14
|
|
|
14
15
|
{{
|
|
15
16
|
onsButton({
|
|
@@ -3,10 +3,13 @@
|
|
|
3
3
|
{% from "components/input/_macro.njk" import onsInput %}
|
|
4
4
|
|
|
5
5
|
{% macro onsAddressInput(params) %}
|
|
6
|
-
|
|
7
|
-
<div
|
|
6
|
+
{% set fields %}
|
|
7
|
+
<div
|
|
8
|
+
id="address"
|
|
9
|
+
class="ons-field ons-address-input{{ ' ons-address-input--search ons-js-address-autosuggest' if not params.manualEntry }}"
|
|
10
|
+
>
|
|
8
11
|
{% if params.isEditable == true or params.manualEntry %}
|
|
9
|
-
{%
|
|
12
|
+
{% set addressInputs %}
|
|
10
13
|
{% if params.organisation %}
|
|
11
14
|
{{
|
|
12
15
|
onsInput({
|
|
@@ -81,11 +84,16 @@
|
|
|
81
84
|
})
|
|
82
85
|
}}
|
|
83
86
|
{% endif %}
|
|
87
|
+
{% endset %}
|
|
84
88
|
{% if not params.manualEntry %}
|
|
89
|
+
<div class="ons-js-address-input__manual ons-u-db-no-js_enabled">
|
|
90
|
+
{{ addressInputs | safe }}
|
|
85
91
|
<div class="ons-u-mt-s">
|
|
86
92
|
<a href="#0" class="ons-js-address-search-btn ons-u-db-no-js_disabled">{{ params.searchButton }}</a>
|
|
87
93
|
</div>
|
|
88
94
|
</div>
|
|
95
|
+
{% else %}
|
|
96
|
+
{{ addressInputs | safe }}
|
|
89
97
|
{% endif %}
|
|
90
98
|
{% endif %}
|
|
91
99
|
|
|
@@ -105,7 +113,7 @@
|
|
|
105
113
|
})
|
|
106
114
|
}}
|
|
107
115
|
{% if not params.manualEntry %}
|
|
108
|
-
<div class="ons-js-address-input__search{
|
|
116
|
+
<div class="ons-js-address-input__search{{ ' ons-u-db-no-js_disabled' if params.isEditable == true }}">
|
|
109
117
|
{{
|
|
110
118
|
onsAutosuggest({
|
|
111
119
|
"id": params.id + "-autosuggest",
|
|
@@ -157,7 +165,9 @@
|
|
|
157
165
|
})
|
|
158
166
|
}}
|
|
159
167
|
{% if params.manualLinkText %}
|
|
160
|
-
<a href="{{ params.manualLink | default('#0') }}" class="ons-js-address-manual-btn ons-u-mt-s ons-u-dib"
|
|
168
|
+
<a href="{{ params.manualLink | default('#0') }}" class="ons-js-address-manual-btn ons-u-mt-s ons-u-dib"
|
|
169
|
+
>{{ params.manualLinkText }}</a
|
|
170
|
+
>
|
|
161
171
|
{% endif %}
|
|
162
172
|
</div>
|
|
163
173
|
{% endif %}
|
|
@@ -167,12 +177,14 @@
|
|
|
167
177
|
{% if params.dontWrap %}
|
|
168
178
|
{{ fields | safe }}
|
|
169
179
|
{% else %}
|
|
170
|
-
{%
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
180
|
+
{%
|
|
181
|
+
call onsFieldset({
|
|
182
|
+
"id": params.id,
|
|
183
|
+
"classes": params.classes,
|
|
184
|
+
"legend": params.legend,
|
|
185
|
+
"legendClasses": params.legendClasses
|
|
186
|
+
})
|
|
187
|
+
%}
|
|
176
188
|
{{ fields | safe }}
|
|
177
189
|
{% endcall %}
|
|
178
190
|
{% endif %}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import abortableFetch from '../../js/abortable-fetch';
|
|
2
|
-
import { sanitiseAutosuggestText } from '../autosuggest/autosuggest.helpers';
|
|
3
2
|
import AutosuggestUI from '../autosuggest/autosuggest.ui';
|
|
4
3
|
import AddressError from './autosuggest.address.error';
|
|
5
4
|
import AddressSetter from './autosuggest.address.setter';
|
|
@@ -180,10 +179,8 @@ export default class AutosuggestAddress {
|
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
results = updatedResults.map(({ uprn, address, type }) => {
|
|
183
|
-
const sanitisedText = sanitiseAutosuggestText(address, this.addressReplaceChars);
|
|
184
182
|
return {
|
|
185
183
|
[this.lang]: address,
|
|
186
|
-
sanitisedText,
|
|
187
184
|
uprn,
|
|
188
185
|
type,
|
|
189
186
|
};
|
|
@@ -235,10 +232,8 @@ export default class AutosuggestAddress {
|
|
|
235
232
|
const data = await this.retrieveAddress(id);
|
|
236
233
|
const address = data.response.address.formattedAddress;
|
|
237
234
|
const uprn = data.response.address.uprn;
|
|
238
|
-
const sanitisedText = sanitiseAutosuggestText(address, this.addressReplaceChars);
|
|
239
235
|
return {
|
|
240
236
|
[this.lang]: address,
|
|
241
|
-
sanitisedText,
|
|
242
237
|
uprn,
|
|
243
238
|
};
|
|
244
239
|
}
|
|
@@ -1,52 +1,54 @@
|
|
|
1
1
|
{% from "components/address-input/_macro.njk" import onsAddressInput %}
|
|
2
2
|
|
|
3
|
-
{{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
3
|
+
{{
|
|
4
|
+
onsAddressInput({
|
|
5
|
+
"id": "address-input-editable",
|
|
6
|
+
"dontWrap": true,
|
|
7
|
+
"label": {
|
|
8
|
+
"text": "Enter address or postcode and select from results",
|
|
9
|
+
"id": "address-label-input-editable"
|
|
10
|
+
},
|
|
11
|
+
"isEditable": true,
|
|
12
|
+
"mandatory": true,
|
|
13
|
+
"APIDomain": "https://mock-address-api.gcp.onsdigital.uk",
|
|
14
|
+
'APIDomainBearerToken': "some_token",
|
|
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
|
+
"ariaYouHaveSelected": "You have selected",
|
|
17
|
+
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
18
|
+
"ariaOneResult": "There is one suggestion available.",
|
|
19
|
+
"ariaNResults": "There are {n} suggestions available.",
|
|
20
|
+
"ariaLimitedResults": "Results have been limited to 10 suggestions. Type more characters to improve your search",
|
|
21
|
+
"ariaGroupedResults": "There are {n} for {x}",
|
|
22
|
+
"groupCount": "{n} addresses",
|
|
23
|
+
"moreResults": "Enter more of the address to improve results",
|
|
24
|
+
"resultsTitle": "Select an address",
|
|
25
|
+
"resultsTitleId": "address-results",
|
|
26
|
+
"noResults": "No results found. Try entering a different part of the address",
|
|
27
|
+
"tooManyResults": "{n} results found. Enter more of the address to improve results",
|
|
28
|
+
"typeMore": "Enter more of the address to get results",
|
|
29
|
+
"autocomplete": "off",
|
|
30
|
+
"errorTitle": "There is a problem with your answer",
|
|
31
|
+
"errorMessageEnter": "Enter an address",
|
|
32
|
+
"errorMessageSelect": "Select an address",
|
|
33
|
+
"errorMessageAPI": "Sorry, there is a problem loading addresses.",
|
|
34
|
+
"errorMessageAPILinkText": "Enter address manually",
|
|
35
|
+
"options": {
|
|
36
|
+
"regionCode": "gb-eng",
|
|
37
|
+
"addressType": "residential"
|
|
38
|
+
},
|
|
39
|
+
"line1": {
|
|
40
|
+
"label": "Address line 1"
|
|
41
|
+
},
|
|
42
|
+
"line2": {
|
|
43
|
+
"label": "Address line 2"
|
|
44
|
+
},
|
|
45
|
+
"town": {
|
|
46
|
+
"label": "Town or city"
|
|
47
|
+
},
|
|
48
|
+
"postcode": {
|
|
49
|
+
"label": "Postcode"
|
|
50
|
+
},
|
|
51
|
+
"searchButton": "Search for an address",
|
|
52
|
+
"manualLinkText": "Manually enter address"
|
|
53
|
+
})
|
|
54
|
+
}}
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
{% from "components/address-input/_macro.njk" import onsAddressInput %}
|
|
2
2
|
|
|
3
|
-
{{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
}
|
|
3
|
+
{{
|
|
4
|
+
onsAddressInput({
|
|
5
|
+
"id": "address-input-manual",
|
|
6
|
+
"dontWrap": true,
|
|
7
|
+
"manualEntry": true,
|
|
8
|
+
"label": {
|
|
9
|
+
"text": "Enter address or postcode and select from results",
|
|
10
|
+
"id": "address-label-input-manual"
|
|
11
|
+
},
|
|
12
|
+
"line1": {
|
|
13
|
+
"label": "Address line 1"
|
|
14
|
+
},
|
|
15
|
+
"line2": {
|
|
16
|
+
"label": "Address line 2"
|
|
17
|
+
},
|
|
18
|
+
"town": {
|
|
19
|
+
"label": "Town or city"
|
|
20
|
+
},
|
|
21
|
+
"postcode": {
|
|
22
|
+
"label": "Postcode"
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
}}
|