govuk_publishing_components 61.0.3 → 61.1.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +38 -19
- data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/pii-remover.js +0 -14
- data/app/assets/stylesheets/govuk_publishing_components/components/_action-link.scss +39 -32
- data/app/views/govuk_publishing_components/components/_action_link.html.erb +4 -2
- data/app/views/govuk_publishing_components/components/docs/action_link.yml +7 -0
- data/lib/govuk_publishing_components/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee652fec945b78a8ab3380d6c93010e71a7dde1e1abcde77c69996245f608b53
|
4
|
+
data.tar.gz: d3de57ce6e16dfaacff00e7d129c2c748d4043b825b76b04fd8087f794435104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f462ec25f4372596b7d914a9469aba1b5ee139b0da5dce07c00362373967ecb4fc5f2cfa9775d6bfa702ff23a971cb9cceccdbc4280d7ff982bfcd94779105ad
|
7
|
+
data.tar.gz: b585086d2a8d4a75a0a2769dd47051c701e7d6d3347664c56a659168ecc09b0871f611ee9ac2e6aa484a4b869a226787bf93d252228b4301a66af6db848fe3be
|
@@ -110,16 +110,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
110
110
|
|
111
111
|
var isTextField = inputTypes.indexOf(inputType) !== -1 || inputNodename === 'TEXTAREA'
|
112
112
|
var conditionalField = elem.closest('.govuk-checkboxes__conditional')
|
113
|
-
var conditionalCheckbox = conditionalField &&
|
113
|
+
var conditionalCheckbox = conditionalField && this.module.querySelector('[aria-controls="' + conditionalField.id + '"]')
|
114
114
|
var conditionalCheckboxChecked = conditionalCheckbox && conditionalCheckbox.checked
|
115
115
|
|
116
|
-
|
117
|
-
var conditionalCheckboxLabel = conditionalField.querySelector('[for="' + conditionalCheckbox.id + '"]')
|
118
|
-
|
119
|
-
if (conditionalCheckboxLabel) {
|
120
|
-
input.parentSection = conditionalCheckboxLabel.innerText
|
121
|
-
}
|
122
|
-
}
|
116
|
+
var isDateField = elem.closest('.govuk-date-input')
|
123
117
|
|
124
118
|
if (conditionalCheckbox && !conditionalCheckboxChecked) {
|
125
119
|
// don't include conditional field if condition not checked
|
@@ -141,10 +135,16 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
141
135
|
}
|
142
136
|
} else if (inputNodename === 'SELECT' && elem.querySelectorAll('option:checked')) {
|
143
137
|
var selectedOptions = Array.from(elem.querySelectorAll('option:checked')).map(function (element) { return element.text })
|
144
|
-
|
138
|
+
|
139
|
+
if (selectedOptions.length === 1 && !elem.value.length) {
|
140
|
+
// if placeholder value in select, do not include as not filled in
|
141
|
+
inputs.splice(i, 1)
|
142
|
+
} else {
|
143
|
+
input.answer = this.useSelectCount && selectedOptions.length > 1 ? selectedOptions.length : selectedOptions.join(',')
|
144
|
+
}
|
145
145
|
} else if (isTextField && elem.value) {
|
146
146
|
if (this.includeTextInputValues || elem.hasAttribute('data-ga4-form-include-input')) {
|
147
|
-
if (this.useTextCount) {
|
147
|
+
if (this.useTextCount && !isDateField) {
|
148
148
|
input.answer = elem.value.length
|
149
149
|
} else {
|
150
150
|
var PIIRemover = new window.GOVUK.analyticsGa4.PIIRemover()
|
@@ -163,6 +163,32 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
163
163
|
// remove the input from those gathered as it has no value
|
164
164
|
inputs.splice(i, 1)
|
165
165
|
}
|
166
|
+
|
167
|
+
var parentFieldset
|
168
|
+
var parentLegend
|
169
|
+
|
170
|
+
if (conditionalField && conditionalCheckboxChecked) {
|
171
|
+
parentFieldset = conditionalField.closest('fieldset')
|
172
|
+
parentLegend = parentFieldset && parentFieldset.querySelector('legend')
|
173
|
+
|
174
|
+
if (parentLegend) {
|
175
|
+
input.section = parentLegend.innerText + ' - ' + input.section
|
176
|
+
}
|
177
|
+
} else if (isDateField) {
|
178
|
+
var dateFieldset = elem.closest('.govuk-date-input').closest('fieldset')
|
179
|
+
var dateLegend = dateFieldset && dateFieldset.querySelector('legend')
|
180
|
+
|
181
|
+
parentFieldset = dateFieldset.parentNode.closest('fieldset')
|
182
|
+
|
183
|
+
if (dateLegend) {
|
184
|
+
input.section = dateLegend.innerText + ' - ' + input.section
|
185
|
+
}
|
186
|
+
|
187
|
+
if (parentFieldset) {
|
188
|
+
parentLegend = parentFieldset.querySelector('legend')
|
189
|
+
input.section = parentLegend.innerText + ' - ' + input.section
|
190
|
+
}
|
191
|
+
}
|
166
192
|
}
|
167
193
|
return inputs
|
168
194
|
}
|
@@ -176,17 +202,10 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
|
|
176
202
|
if (answer) {
|
177
203
|
if (this.recordJson) {
|
178
204
|
var fieldSection = data[i].section
|
179
|
-
var parentFieldSection = data[i].parentSection
|
180
205
|
|
181
206
|
if (fieldSection) {
|
182
|
-
|
183
|
-
|
184
|
-
answers[parentFieldSection][fieldSection] = answers[parentFieldSection][fieldSection] || ''
|
185
|
-
answers[parentFieldSection][fieldSection] += ((answers[parentFieldSection][fieldSection] ? ',' : '') + answer)
|
186
|
-
} else {
|
187
|
-
answers[fieldSection] = answers[fieldSection] || ''
|
188
|
-
answers[fieldSection] += ((answers[fieldSection] ? ',' : '') + answer)
|
189
|
-
}
|
207
|
+
answers[fieldSection] = answers[fieldSection] ? (answers[fieldSection] + ',') : ''
|
208
|
+
answers[fieldSection] += answer
|
190
209
|
}
|
191
210
|
} else {
|
192
211
|
answers.push(answer)
|
@@ -36,13 +36,6 @@
|
|
36
36
|
// e.g. 'AB123456A', 'AB 12 34 56 A', 'ab 123456 a', 'ab 12 34 56 a', 'AB+12+34+56+A'
|
37
37
|
var NATIONAL_INSURANCE_NUMBER = /[A-CEGHJ-OPR-TW-Z]{2}(\s+|\++)?(\d{2}(\s+|\++)?){3}[A-D]/gi
|
38
38
|
|
39
|
-
var UK_MOBILE_NUMBER = /07\d{3}[\s%20+]?\d{6,8}/g // 07123 123456 or 07123123456 or 07123+123456 or 07123%20123456
|
40
|
-
var UK_MOBILE_NUMBER_INTERNATIONAL = /(\+|%2B)?447\d{3}[\s%20+]?\d{6,8}/gi // +447123 123456 or +447123123456 or +447123%20123456 or +447123+123456 or %2B447123123456. Plus at start is optional.
|
41
|
-
var UK_LANDLINE_NUMBER = /0[1246]\d{1}[\s%20+]?\d{3,6}[\s%20+]?\d{4,6}/g // 020 123 1234 or 020 1234 1234 or 0201231234 or 02012341234 or 020+123+1234 or 020+1234+1234 or 020%20123%201234 or 020%201234%201234
|
42
|
-
var UK_LANDLINE_NUMBER_2 = /0[1246]\d{3}[\s%20+]\d{6,8}/g // 02123 123456 or 02123+123456 or 02123%20123456
|
43
|
-
var UK_LANDLINE_NUMBER_INTERNATIONAL = /(\+|%2B)?44[1246]\d{1}[\s%20+]?\d{3,6}[\s%20+]?\d{4,6}/g // // +4420 123 1234 or +4420 1234 1234 or +4420+123+1234 or +4420%20123%201234 or %2B4420 123 1234. Plus at start is optional.
|
44
|
-
var UK_LANDLINE_NUMBER_INTERNATIONAL_2 = /(\+|%2B)?44[1246]\d{3}[\s%20+]\d{6,8}/g // +442123 123456 or +442123%20123456 or +442123+123456 or %2B442123+123456. Plus at start is optional.
|
45
|
-
|
46
39
|
function shouldStripDates () {
|
47
40
|
var metas = document.querySelectorAll('meta[name="govuk:ga4-strip-dates"]')
|
48
41
|
return metas.length > 0
|
@@ -116,13 +109,6 @@
|
|
116
109
|
stripped = stripped.replace(VISA_PATTERN_GWF, '[gwf number]')
|
117
110
|
stripped = stripped.replace(VISA_PATTERN_GB, '[gb eori number]')
|
118
111
|
stripped = stripped.replace(NATIONAL_INSURANCE_NUMBER, '[ni number]')
|
119
|
-
stripped = stripped.replace(UK_LANDLINE_NUMBER, '[phone number]')
|
120
|
-
stripped = stripped.replace(UK_LANDLINE_NUMBER_2, '[phone number]')
|
121
|
-
stripped = stripped.replace(UK_LANDLINE_NUMBER_INTERNATIONAL, '[phone number]')
|
122
|
-
stripped = stripped.replace(UK_LANDLINE_NUMBER_INTERNATIONAL_2, '[phone number]')
|
123
|
-
stripped = stripped.replace(UK_MOBILE_NUMBER, '[phone number]')
|
124
|
-
stripped = stripped.replace(UK_MOBILE_NUMBER_INTERNATIONAL, '[phone number]')
|
125
|
-
|
126
112
|
stripped = this.stripQueryStringParameters(stripped)
|
127
113
|
|
128
114
|
if (this.stripDatePII === true) {
|
@@ -12,40 +12,37 @@
|
|
12
12
|
display: table-cell;
|
13
13
|
line-height: 1;
|
14
14
|
width: 36px;
|
15
|
+
vertical-align: middle;
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
@include govuk-media-query($from: tablet) {
|
18
|
+
width: 45px;
|
19
|
+
}
|
20
|
+
}
|
20
21
|
|
21
|
-
|
22
|
-
|
22
|
+
.gem-c-action-link__svg {
|
23
|
+
height: 28px;
|
24
|
+
vertical-align: middle;
|
25
|
+
width: 28px;
|
26
|
+
|
27
|
+
.gem-c-action-link__icon__circle {
|
28
|
+
fill: #eeefef;
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
fill: LinkText;
|
27
|
-
}
|
28
|
-
// stylelint-enable max-nesting-depth
|
30
|
+
@media (forced-colors: active) {
|
31
|
+
fill: LinkText;
|
29
32
|
}
|
33
|
+
}
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
.gem-c-action-link__icon__arrow {
|
36
|
+
fill: #000000;
|
33
37
|
|
34
|
-
|
35
|
-
|
36
|
-
fill: Canvas;
|
37
|
-
}
|
38
|
-
// stylelint-enable max-nesting-depth
|
38
|
+
@media (forced-colors: active) {
|
39
|
+
fill: Canvas;
|
39
40
|
}
|
40
41
|
}
|
41
42
|
|
42
43
|
@include govuk-media-query($from: tablet) {
|
43
|
-
|
44
|
-
|
45
|
-
svg {
|
46
|
-
height: 35px;
|
47
|
-
width: 35px;
|
48
|
-
}
|
44
|
+
height: 35px;
|
45
|
+
width: 35px;
|
49
46
|
}
|
50
47
|
}
|
51
48
|
|
@@ -53,18 +50,16 @@
|
|
53
50
|
padding-top: 2px;
|
54
51
|
width: 30px;
|
55
52
|
|
56
|
-
|
53
|
+
.gem-c-action-link__svg {
|
57
54
|
height: 25px;
|
58
55
|
width: 25px;
|
56
|
+
}
|
59
57
|
|
60
|
-
|
61
|
-
|
58
|
+
.gem-c-action-link__icon__arrow {
|
59
|
+
fill: #272828;
|
62
60
|
|
63
|
-
|
64
|
-
|
65
|
-
fill: currentcolor;
|
66
|
-
}
|
67
|
-
// stylelint-enable max-nesting-depth
|
61
|
+
@media (forced-colors: active) {
|
62
|
+
fill: currentcolor;
|
68
63
|
}
|
69
64
|
}
|
70
65
|
}
|
@@ -75,6 +70,18 @@
|
|
75
70
|
@include govuk-font(19, $weight: bold, $line-height: 1.3);
|
76
71
|
}
|
77
72
|
|
73
|
+
.gem-c-action-link--large {
|
74
|
+
.gem-c-action-link__icon {
|
75
|
+
height: 40px;
|
76
|
+
width: 56px;
|
77
|
+
}
|
78
|
+
|
79
|
+
.gem-c-action-link__svg {
|
80
|
+
height: 40px;
|
81
|
+
width: 40px;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
78
85
|
@include govuk-media-query($media-type: print) {
|
79
86
|
.gem-c-action-link {
|
80
87
|
* {
|
@@ -7,6 +7,7 @@
|
|
7
7
|
inverse ||= false
|
8
8
|
simple ||= false
|
9
9
|
simple_light ||= false
|
10
|
+
large ||= false
|
10
11
|
|
11
12
|
link_classes = %w(govuk-link gem-c-action-link__link gem-print-force-link-styles)
|
12
13
|
link_classes << "govuk-link--inverse" if inverse
|
@@ -15,12 +16,13 @@
|
|
15
16
|
component_helper.add_class("gem-c-action-link")
|
16
17
|
component_helper.add_class("gem-c-action-link--inverse") if inverse
|
17
18
|
component_helper.add_class("gem-c-action-link--simple") if simple
|
19
|
+
component_helper.add_class("gem-c-action-link--large") if large
|
18
20
|
%>
|
19
21
|
<% if text.present? %>
|
20
22
|
<%= tag.div(**component_helper.all_attributes) do %>
|
21
23
|
<% if simple || simple_light %>
|
22
24
|
<span class="gem-c-action-link__icon gem-c-action-link__icon--simple" hidden>
|
23
|
-
<svg xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" viewBox="0 0 23 23">
|
25
|
+
<svg xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" viewBox="0 0 23 23" class="gem-c-action-link__svg">
|
24
26
|
<g class="gem-c-action-link__icon__arrow">
|
25
27
|
<path d="M14.943 11.795 10.44 7.292 11.733 6l5.795 5.795-5.795 5.795-1.293-1.292 4.503-4.503Z" />
|
26
28
|
<path d="M3.956 10.881h11.485v1.828H3.956v-1.828Z" />
|
@@ -29,7 +31,7 @@
|
|
29
31
|
</span>
|
30
32
|
<% elsif %>
|
31
33
|
<span class="gem-c-action-link__icon" hidden>
|
32
|
-
<svg xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" viewBox="0 0 27 27">
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true" viewBox="0 0 27 27" class="gem-c-action-link__svg">
|
33
35
|
<circle class="gem-c-action-link__icon__circle" cx="13.5" cy="13.5" r="13.5" />
|
34
36
|
<g class="gem-c-action-link__icon__arrow">
|
35
37
|
<path d="m17.701 13.526-3.827-3.828L14.973 8.6l4.926 4.926-4.926 4.926-1.099-1.099 3.827-3.827Z" />
|
@@ -25,3 +25,10 @@ examples:
|
|
25
25
|
text: Getting financial help and keeping your business safe
|
26
26
|
href: "/financial-help"
|
27
27
|
simple: true
|
28
|
+
large:
|
29
|
+
description: For use on the GOV.UK homepage popular links.
|
30
|
+
data:
|
31
|
+
text: This way for cookies
|
32
|
+
href: "/cookies"
|
33
|
+
large: true
|
34
|
+
|