govuk_publishing_components 35.18.0 → 35.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/govuk_publishing_components/icon-close.svg +1 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +7 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +2 -1
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +8 -2
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +14 -1
  7. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-print-intent-tracker.js +24 -0
  8. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-scroll-tracker.js +4 -5
  9. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
  10. data/app/assets/javascripts/govuk_publishing_components/components/accordion.js +1 -1
  11. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +3 -5
  12. data/app/assets/javascripts/govuk_publishing_components/vendor/lux/lux-reporter.js +21 -31
  13. data/app/assets/stylesheets/govuk_publishing_components/components/_attachment.scss +2 -2
  14. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +31 -8
  15. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +7 -0
  16. data/app/assets/stylesheets/govuk_publishing_components/components/_search.scss +13 -0
  17. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_attachment.scss +1 -0
  18. data/app/views/govuk_publishing_components/components/_accordion.html.erb +9 -13
  19. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +6 -9
  20. data/app/views/govuk_publishing_components/components/_govspeak.html.erb +1 -0
  21. data/app/views/govuk_publishing_components/components/_intervention.html.erb +1 -1
  22. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +6 -10
  23. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +14 -24
  24. data/app/views/govuk_publishing_components/components/_share_links.html.erb +2 -6
  25. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +2 -4
  26. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +10 -1
  27. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +4 -8
  28. data/app/views/govuk_publishing_components/components/_tabs.html.erb +2 -4
  29. data/app/views/govuk_publishing_components/components/contextual_sidebar/_ukraine_cta.html.erb +4 -6
  30. data/app/views/govuk_publishing_components/components/docs/image_card.yml +3 -3
  31. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +6 -8
  32. data/lib/govuk_publishing_components/presenters/breadcrumbs_helper.rb +1 -3
  33. data/lib/govuk_publishing_components/presenters/contents_list_helper.rb +3 -3
  34. data/lib/govuk_publishing_components/presenters/image_card_helper.rb +6 -2
  35. data/lib/govuk_publishing_components/presenters/layout_footer_helper.rb +3 -5
  36. data/lib/govuk_publishing_components/version.rb +1 -1
  37. data/node_modules/axe-core/axe.js +679 -11
  38. data/node_modules/axe-core/axe.min.js +2 -2
  39. data/node_modules/axe-core/locales/ja.json +12 -12
  40. data/node_modules/axe-core/package.json +1 -1
  41. data/node_modules/axe-core/sri-history.json +4 -0
  42. metadata +5 -3
@@ -96,11 +96,9 @@
96
96
  "external": "false",
97
97
  "text": "GOV.UK",
98
98
  "section": "Logo",
99
- "index": {
100
- "index_link": 1,
101
- "index_section": 0,
102
- "index_section_count": 2,
103
- },
99
+ "index_link": 1,
100
+ "index_section": 0,
101
+ "index_section_count": 2,
104
102
  "index_total": 1
105
103
  }.to_json
106
104
  },
@@ -117,7 +115,7 @@
117
115
  },
118
116
  class: logotype_classes,
119
117
  height: "30",
120
- width: "36",
118
+ width: "36",
121
119
  focusable: "false",
122
120
  viewBox: "0 0 132 97",
123
121
  xmlns: "http://www.w3.org/2000/svg",
@@ -198,10 +196,8 @@
198
196
  event_name: "select_content",
199
197
  type: "header menu bar",
200
198
  text: link[:label],
201
- index: {
202
- index_section: 1,
203
- index_section_count: 2,
204
- },
199
+ index_section: 1,
200
+ index_section_count: 2,
205
201
  section: link[:label]
206
202
  }
207
203
  },
@@ -232,10 +228,8 @@
232
228
  "event_name": "select_content",
233
229
  "type": "header menu bar",
234
230
  "text": "Search",
235
- "index": {
236
- "index_section": 2,
237
- "index_section_count": 2,
238
- },
231
+ "index_section": 2,
232
+ "index_section_count": 2,
239
233
  "section": "Search"
240
234
  }.to_json
241
235
  }"
@@ -320,11 +314,9 @@
320
314
  ga4_link: {
321
315
  "event_name": "navigation",
322
316
  "type": "header menu bar",
323
- "index": {
324
- "index_section": column_index + 1,
325
- "index_link": index + 1,
326
- "index_section_count": 4,
327
- },
317
+ "index_section": column_index + 1,
318
+ "index_link": index + 1,
319
+ "index_section_count": 4,
328
320
  "index_total": index_total,
329
321
  "section": column[:label],
330
322
  }
@@ -395,11 +387,9 @@
395
387
  ga4_link: {
396
388
  "event_name": "navigation",
397
389
  "type": "header menu bar",
398
- "index": {
399
- "index_section": 4,
400
- "index_link": index + 1,
401
- "index_section_count": 4,
402
- },
390
+ "index_section": 4,
391
+ "index_link": index + 1,
392
+ "index_section_count": 4,
403
393
  "index_total": index_total,
404
394
  "section": popular_links_heading,
405
395
  }
@@ -54,9 +54,7 @@
54
54
  ga4_link_data = {
55
55
  'event_name': 'navigation',
56
56
  'type': 'share page',
57
- 'index': {
58
- 'index_link': index + 1,
59
- },
57
+ 'index_link': index + 1,
60
58
  'index_total': links.length,
61
59
  'text': link[:icon],
62
60
  }
@@ -65,9 +63,7 @@
65
63
  ga4_link_data = {
66
64
  'event_name': 'navigation',
67
65
  'type': 'follow us',
68
- 'index': {
69
- 'index_link': index + 1,
70
- },
66
+ 'index_link': index + 1,
71
67
  'index_total': links.length
72
68
  }
73
69
  end
@@ -84,10 +84,8 @@
84
84
  "ga4-link": {
85
85
  "event_name": "navigation",
86
86
  "type": "step by step",
87
- "index": {
88
- "index_section": step_index + 1,
89
- "index_section_count": steps.length
90
- },
87
+ "index_section": step_index + 1,
88
+ "index_section_count": steps.length,
91
89
  "section": step[:title]
92
90
  }.to_json
93
91
  }
@@ -26,6 +26,15 @@
26
26
  tracking_options ||= ({ dimension96: tracking_id }).to_json
27
27
  end
28
28
 
29
+ if ga4_tracking
30
+ ga4_data = {
31
+ event_name: "navigation",
32
+ type: "super breadcrumb",
33
+ index_link: "1",
34
+ index_total: "1",
35
+ }.to_json
36
+ end
37
+
29
38
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
30
39
  classes = %w[gem-c-step-nav-header]
31
40
  classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
@@ -44,7 +53,7 @@
44
53
  data-track-action="<%= tracking_action %>"
45
54
  data-track-label="<%= tracking_label %>"
46
55
  <% if ga4_tracking %>
47
- data-ga4-link='{"event_name":"navigation", "type":"super breadcrumb", "index":{"index_link": "1"}, "index_total":"1"}'
56
+ data-ga4-link='<%= ga4_data %>'
48
57
  <% end %>
49
58
  <% if tracking_dimension_enabled %>
50
59
  data-track-dimension="<%= tracking_dimension %>"
@@ -23,13 +23,11 @@
23
23
  data-track-dimension="<%= links[0][:text] %>"
24
24
  data-track-dimension-index="29"
25
25
  data-track-options='{"dimension96" : "<%= links[0][:tracking_id] %>" }'
26
- <% if ga4_tracking
26
+ <% if ga4_tracking
27
27
  ga4_attributes = {
28
28
  event_name: "navigation",
29
29
  type: "part of",
30
- index:{
31
- "index_link": "1"
32
- },
30
+ "index_link": "1",
33
31
  index_total: "1",
34
32
  section: pretitle,
35
33
  }.to_json
@@ -53,13 +51,11 @@
53
51
  data-track-dimension="<%= link[:text] %>"
54
52
  data-track-dimension-index="29"
55
53
  data-track-options='{"dimension96" : "<%= link[:tracking_id] %>" }'
56
- <% if ga4_tracking
54
+ <% if ga4_tracking
57
55
  ga4_attributes = {
58
56
  event_name: "navigation",
59
57
  type: "part of",
60
- index:{
61
- "index_link": (index + 1).to_s
62
- },
58
+ index_link: (index + 1).to_s,
63
59
  index_total: (links.length).to_s,
64
60
  section: pretitle,
65
61
  }.to_json
@@ -34,10 +34,8 @@
34
34
  event_name: "select_content",
35
35
  type: "tabs",
36
36
  text: tab[:label],
37
- index: {
38
- index_section: index + 1,
39
- index_section_count: tabs.length,
40
- },
37
+ index_section: index + 1,
38
+ index_section_count: tabs.length,
41
39
  }
42
40
  ga4_attributes[:event_name] = "navigation" if as_links
43
41
  tab[:tab_data_attributes][:ga4_link] = ga4_attributes if as_links
@@ -1,4 +1,4 @@
1
- <%
1
+ <%
2
2
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
3
  title = t("components.related_navigation.ukraine.title")
4
4
  lang = shared_helper.t_locale("components.related_navigation.ukraine.title")
@@ -15,11 +15,9 @@
15
15
  ga4_attributes = {
16
16
  event_name: "navigation",
17
17
  type: "related content",
18
- index: {
19
- index_section: "#{ga4_tracking_counts.index_section_count}",
20
- index_link: "#{index + 1}",
21
- index_section_count: "#{ga4_tracking_counts.index_section_count}",
22
- },
18
+ index_section: "#{ga4_tracking_counts.index_section_count}",
19
+ index_link: "#{index + 1}",
20
+ index_section_count: "#{ga4_tracking_counts.index_section_count}",
23
21
  index_total: "#{index_total}",
24
22
  section: title,
25
23
  } if ga4_tracking
@@ -205,12 +205,12 @@ examples:
205
205
  <div class="govuk-!-width-full">
206
206
  <%= component %>
207
207
  </div>
208
- two_thirds_column:
209
- description: This variant is used for the featured section on the homepage.
208
+ two_thirds:
209
+ description: This variant is used for the featured section on the homepage. The aspect ratio used is 1:1 and the width of the image is constrained to 80px wide.
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."
@@ -24,7 +24,7 @@
24
24
  <% end %>
25
25
 
26
26
  <ul class="gem-c-related-navigation__link-list">
27
- <%
27
+ <%
28
28
  constructed_link_array = []
29
29
  section_link_limit = related_nav_helper.calculate_section_link_limit(links)
30
30
  index_total = links.length
@@ -35,11 +35,9 @@
35
35
  ga4_attributes = {
36
36
  event_name: "navigation",
37
37
  type: ga4_type,
38
- index: {
39
- index_section: "#{section_index}",
40
- index_link: "#{index}",
41
- index_section_count: "#{section_count}",
42
- },
38
+ index_section: "#{section_index}",
39
+ index_link: "#{index}",
40
+ index_section_count: "#{section_count}",
43
41
  index_total: "#{index_total}",
44
42
  section: ga4_heading_text,
45
43
  } if ga4_tracking
@@ -70,7 +68,7 @@
70
68
 
71
69
  <% if links.length > section_link_limit %>
72
70
  <%
73
- classes = "gem-c-related-navigation__link toggle-wrap"
71
+ classes = "gem-c-related-navigation__link toggle-wrap"
74
72
  data_attributes_li = { module: "ga4-event-tracker" } if ga4_tracking
75
73
  data_attributes_link = {
76
74
  controls: "toggle_#{section_title}",
@@ -83,7 +81,7 @@
83
81
  <%= link_to("#", class: "gem-c-related-navigation__toggle", data: data_attributes_link) do %>
84
82
  <%= t("common.toggle_more",
85
83
  show: t('common.show'),
86
- number: related_nav_helper.remaining_link_count(links)) %>
84
+ number: related_nav_helper.remaining_link_count(links)) %>
87
85
  <% end %>
88
86
  <% end %>
89
87
 
@@ -61,9 +61,7 @@ module GovukPublishingComponents
61
61
  ga4_link: {
62
62
  event_name: "navigation",
63
63
  type: "breadcrumb",
64
- index: {
65
- index_link: index.to_s,
66
- },
64
+ index_link: index.to_s,
67
65
  index_total: breadcrumbs_length.to_s,
68
66
  },
69
67
  }
@@ -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
@@ -23,11 +23,9 @@ module GovukPublishingComponents
23
23
  {
24
24
  "event_name": "navigation",
25
25
  "type": "footer",
26
- "index": {
27
- "index_link": (index_link + 1).to_s,
28
- "index_section": (index_section + 1).to_s,
29
- "index_section_count": @ga4_index_section_count.to_s,
30
- },
26
+ "index_link": (index_link + 1).to_s,
27
+ "index_section": (index_section + 1).to_s,
28
+ "index_section_count": @ga4_index_section_count.to_s,
31
29
  "index_total": index_total.to_s,
32
30
  "section": section,
33
31
  }
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = "35.18.0".freeze
2
+ VERSION = "35.20.0".freeze
3
3
  end