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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae1a49b64074fcbbbce599826af44bc090b1ab98005a920e153dc3a4183fd53e
4
- data.tar.gz: 1b7aabf01fdae6e731872d5a20367b97a42851178053a574482b38fcd9b5f7a6
3
+ metadata.gz: ee652fec945b78a8ab3380d6c93010e71a7dde1e1abcde77c69996245f608b53
4
+ data.tar.gz: d3de57ce6e16dfaacff00e7d129c2c748d4043b825b76b04fd8087f794435104
5
5
  SHA512:
6
- metadata.gz: 0fbfb1567a35a512306336c930433917e12b259a32ba7d68f69469f03cca0c4ec5620f45f5e0c4c9f27e6458becefdcde31c86fd0a4ad43e7156f6b36dab33d2
7
- data.tar.gz: a8b632a21e87b0cf177bbe0cd0beb39766c9f5443dbb99f7087417e075b9a5d95959fa416deb53017046ac4584faf1b1b829e8793161bf546760be086f04ca0d
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 && conditionalField.querySelector('[aria-controls="' + conditionalField.id + '"]')
113
+ var conditionalCheckbox = conditionalField && this.module.querySelector('[aria-controls="' + conditionalField.id + '"]')
114
114
  var conditionalCheckboxChecked = conditionalCheckbox && conditionalCheckbox.checked
115
115
 
116
- if (conditionalField && conditionalCheckboxChecked) {
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
- input.answer = this.useSelectCount ? selectedOptions.length : selectedOptions.join(',')
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
- if (parentFieldSection) {
183
- answers[parentFieldSection] = answers[parentFieldSection] || {}
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
- svg {
17
- height: 28px;
18
- vertical-align: middle;
19
- width: 28px;
17
+ @include govuk-media-query($from: tablet) {
18
+ width: 45px;
19
+ }
20
+ }
20
21
 
21
- .gem-c-action-link__icon__circle {
22
- fill: #eeefef;
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
- // stylelint-disable max-nesting-depth
25
- @media (forced-colors: active) {
26
- fill: LinkText;
27
- }
28
- // stylelint-enable max-nesting-depth
30
+ @media (forced-colors: active) {
31
+ fill: LinkText;
29
32
  }
33
+ }
30
34
 
31
- .gem-c-action-link__icon__arrow {
32
- fill: #000000;
35
+ .gem-c-action-link__icon__arrow {
36
+ fill: #000000;
33
37
 
34
- // stylelint-disable max-nesting-depth
35
- @media (forced-colors: active) {
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
- width: 45px;
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
- svg {
53
+ .gem-c-action-link__svg {
57
54
  height: 25px;
58
55
  width: 25px;
56
+ }
59
57
 
60
- .gem-c-action-link__icon__arrow {
61
- fill: #272828;
58
+ .gem-c-action-link__icon__arrow {
59
+ fill: #272828;
62
60
 
63
- // stylelint-disable max-nesting-depth
64
- @media (forced-colors: active) {
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
+
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "61.0.3".freeze
2
+ VERSION = "61.1.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 61.0.3
4
+ version: 61.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev