govuk_publishing_components 35.18.0 → 35.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ce473a1a45f47ae5cf925f4de375968f8ad75223ef70a38d442be0160a66172
4
- data.tar.gz: 71574933e54084b2ecff4bce0fe09eda6e34003f55fcb7d470300580e35eb54f
3
+ metadata.gz: b6d8b36d61c9301cb5d969679a14c93b6b43914a3a734d05e4ae5702b0fb0f79
4
+ data.tar.gz: 49e458e28c81c1368445b4e9948aa31614ec2a506f9f989083780a0ce6de885d
5
5
  SHA512:
6
- metadata.gz: d663be268de23349809eeec83badafb7c24298221b29168df805b332bd757f4fa70d4addc4cbb197f07af00e1ed5bd501060a5c00f918a6f77ddacd7273149f0
7
- data.tar.gz: 2b7437b0e9e25cd57b04ffe2e014ce182649fabeb5eaf10d73110f782eb255c7420bd7814273f361e4373687aff2a82fe1049ea3f7d688b05f4b9009dff46673
6
+ metadata.gz: 107aa5aee8b2c2c8268342683df0405cc071ada39032d723fd21299a0af1abc6bec4bb5fb7d89879775780bccc32d27b1ac9eb375e28cda218d0016b8cb843d1
7
+ data.tar.gz: 994233cc78dcaa2ce4a604f3cb2d3be54582bfcfa40b6df323929a808d8d7d56e30e6c1403422a71968d399e27dc6141534f49af06f5713198db721b91d461a1
@@ -335,6 +335,11 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
335
335
  }
336
336
  } else {
337
337
  for (var i = 0; i < items.length; i++) {
338
+ // GA4 limits us to 200 items, so we should limit the array to this size.
339
+ if (i === 200) {
340
+ break
341
+ }
342
+
338
343
  var item = items[i]
339
344
  var path = item.getAttribute('data-ga4-ecommerce-path')
340
345
 
@@ -9,6 +9,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
9
9
  this.trackingTrigger = 'data-ga4-form' // elements with this attribute get tracked
10
10
  this.includeTextInputValues = this.module.hasAttribute('data-ga4-form-include-text')
11
11
  this.redacted = false
12
+ this.useFallbackValue = this.module.hasAttribute('data-ga4-form-no-answer-undefined') ? undefined : 'No answer given'
12
13
  }
13
14
 
14
15
  Ga4FormTracker.prototype.init = function () {
@@ -43,7 +44,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {};
43
44
 
44
45
  var formInputs = this.getFormInputs()
45
46
  var formData = this.getInputValues(formInputs)
46
- data.text = data.text || (this.combineGivenAnswers(formData) || 'No answer given')
47
+ data.text = data.text || this.combineGivenAnswers(formData) || this.useFallbackValue
47
48
 
48
49
  if (data.action === 'search') {
49
50
  data.text = data.text.toLowerCase()
@@ -20,6 +20,7 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
20
20
  referrer: this.getReferrer(referrer),
21
21
  title: this.getTitle(),
22
22
  status_code: this.getStatusCode(),
23
+ viewport_size: this.getViewPort(),
23
24
 
24
25
  ab_test: this.getMetaContent('ab-test'),
25
26
  document_type: this.getMetaContent('format'),
@@ -89,6 +90,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
89
90
  }
90
91
 
91
92
  searchTerm = searchTerm[0].replace('keywords=', '')
93
+ searchTerm = searchTerm.replace(/\++/g, ' ')
94
+ searchTerm = window.GOVUK.analyticsGa4.core.trackFunctions.removeLinesAndExtraSpaces(searchTerm)
92
95
  searchTerm = this.PIIRemover.stripPIIWithOverride(searchTerm, true, true)
93
96
  return searchTerm
94
97
  },
@@ -129,10 +132,20 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
129
132
  }
130
133
  },
131
134
 
135
+ getViewPort: function () {
136
+ var vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0)
137
+ var vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
138
+ return vw + 'x' + vh
139
+ },
140
+
132
141
  getMetaContent: function (name) {
133
142
  var tag = document.querySelector('meta[name="govuk:' + name + '"]')
134
143
  if (tag) {
135
- return tag.getAttribute('content')
144
+ var contentAttribute = tag.getAttribute('content')
145
+ if (contentAttribute === '') {
146
+ return undefined
147
+ }
148
+ return contentAttribute
136
149
  } else {
137
150
  return this.nullValue
138
151
  }
@@ -14,8 +14,8 @@ $thumbnail-icon-border-colour: govuk-colour("mid-grey", $legacy: "grey-3");
14
14
  @include govuk-clearfix;
15
15
  position: relative;
16
16
 
17
- .govuk-details__summary {
18
- @include govuk-font($size: 14);
17
+ .govuk-details {
18
+ margin: govuk-spacing(3) 0;
19
19
  }
20
20
  }
21
21
 
@@ -877,6 +877,13 @@ $after-button-padding-left: govuk-spacing(4);
877
877
  }
878
878
  }
879
879
 
880
+ // Ensure the total space to the left of the logo for mobile screen sizes is 24px (margin is 15px)
881
+ @include govuk-media-query($until: tablet) {
882
+ .gem-c-layout-super-navigation-header__header-logo--large-navbar {
883
+ padding-left: 9px;
884
+ }
885
+ }
886
+
880
887
  @include govuk-media-query($from: desktop) {
881
888
  // can't use govuk-spacing here because the navbar height
882
889
  // isn't a multiple of 5 :(
@@ -12,6 +12,7 @@
12
12
  // Scope attachment and attachment-link component styles to gem-c-govspeak
13
13
  @import "../attachment-link";
14
14
  @import "../attachment";
15
+ @import "../details";
15
16
 
16
17
  // This block is duplicated from Whitehall as a transitional step, see the
17
18
  // commit message for 2d893c10ee3f2cab27162b9aba38b12379a71d07 before making
@@ -16,7 +16,8 @@
16
16
  ga4_data = {
17
17
  event_name: "navigation",
18
18
  section: t("components.contents_list.contents", locale: :en) || "",
19
- index_total: cl_helper.get_index_total
19
+ type: "contents list",
20
+ index_total: cl_helper.get_index_total,
20
21
  } if ga4_tracking
21
22
  local_assigns[:aria] ||= {}
22
23
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
@@ -42,10 +43,10 @@
42
43
  <li class="<%= cl_helper.list_item_classes(contents_item, false) %>" <%= "aria-current=true" if contents_item[:active] %>>
43
44
  <% link_text = format_numbers ? cl_helper.wrap_numbers_with_spans(contents_item[:text]) : contents_item[:text]
44
45
  if ga4_tracking
46
+ ga4_data[:event_name] = cl_helper.get_ga4_event_name(contents_item[:href]) if contents_item[:href]
45
47
  ga4_data[:index] = {
46
48
  "index_link": index_link,
47
49
  }
48
- ga4_data[:type] = cl_helper.get_ga4_type(contents_item[:href]) if contents_item[:href]
49
50
  end
50
51
  %>
51
52
  <%= link_to_if !contents_item[:active], link_text, contents_item[:href],
@@ -67,10 +68,10 @@
67
68
  <li class="<%= cl_helper.list_item_classes(nested_contents_item, true) %>" <%= "aria-current=true" if nested_contents_item[:active] %>>
68
69
  <%
69
70
  if ga4_tracking
71
+ ga4_data[:event_name] = cl_helper.get_ga4_event_name(nested_contents_item[:href]) if nested_contents_item[:href]
70
72
  ga4_data[:index] = {
71
73
  "index_link": index_link,
72
74
  }
73
- ga4_data[:type] = cl_helper.get_ga4_type(nested_contents_item[:href]) if nested_contents_item[:href]
74
75
  end
75
76
  %>
76
77
  <%= link_to_if !nested_contents_item[:active], nested_contents_item[:text], nested_contents_item[:href],
@@ -1,5 +1,6 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("govspeak")
3
+
3
4
  inverse ||= false
4
5
  direction_class = "direction-#{direction}" if local_assigns.include?(:direction)
5
6
  disable_youtube_expansions = local_assigns.fetch(:disable_youtube_expansions) if local_assigns.include?(:disable_youtube_expansions)
@@ -206,11 +206,11 @@ examples:
206
206
  <%= component %>
207
207
  </div>
208
208
  two_thirds_column:
209
- description: This variant is used for the featured section on the homepage.
209
+ description: This variant is used for the featured section on the homepage, the aspect ratio used is 1:1
210
210
  data:
211
211
  two_thirds: true
212
212
  href: "/still-not-a-page"
213
- image_src: "https://assets.publishing.service.gov.uk/government/uploads/system/uploads/feature/image/91397/s712_SG_Swear_in_1_.jpg"
213
+ image_src: "https://www.gov.uk/assets/static/govuk-apple-touch-icon-180x180-026deaa34fa328ae5f1f519a37dbd15e6555c5086e1ba83986cd0827a7209902.png"
214
214
  image_alt: "some meaningful alt text please"
215
215
  heading_text: "Something has happened nearby possibly"
216
216
  description: "Following a news report that something has happened, further details are emerging of the thing that has happened and what that means for you."
@@ -48,10 +48,10 @@ module GovukPublishingComponents
48
48
  total
49
49
  end
50
50
 
51
- def get_ga4_type(link)
52
- return "select content" if link.start_with?("#")
51
+ def get_ga4_event_name(link)
52
+ return "select_content" if link.start_with?("#")
53
53
 
54
- "contents list"
54
+ "navigation"
55
55
  end
56
56
 
57
57
  private
@@ -63,6 +63,10 @@ module GovukPublishingComponents
63
63
  def image
64
64
  classes = %w[gem-c-image-card__image-wrapper]
65
65
  classes << "gem-c-image-card__image-wrapper--one-third" if @two_thirds
66
+ height = 200
67
+ width = 300
68
+ height = 90 if @two_thirds
69
+ width = 90 if @two_thirds
66
70
 
67
71
  if @image_src
68
72
  content_tag(:figure, class: classes) do
@@ -73,8 +77,8 @@ module GovukPublishingComponents
73
77
  loading: @image_loading,
74
78
  sizes: @sizes,
75
79
  srcset: @srcset,
76
- height: 200,
77
- width: 300,
80
+ height:,
81
+ width:,
78
82
  )
79
83
  end
80
84
  end
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.18.0".freeze
2
+ VERSION = "35.19.0".freeze
3
3
  end