govuk_publishing_components 46.3.1 → 47.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +5 -0
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +10 -1
  4. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +0 -1
  5. data/app/assets/stylesheets/govuk_publishing_components/components/_heading.scss +6 -14
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_organisation-logo.scss +4 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_highlight-answer.scss +4 -4
  8. data/app/models/govuk_publishing_components/component_doc.rb +1 -1
  9. data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +1 -0
  10. data/app/views/govuk_publishing_components/component_guide/show.html.erb +2 -2
  11. data/app/views/govuk_publishing_components/components/_accordion.html.erb +0 -2
  12. data/app/views/govuk_publishing_components/components/_action_link.html.erb +0 -3
  13. data/app/views/govuk_publishing_components/components/_contents_list.html.erb +0 -2
  14. data/app/views/govuk_publishing_components/components/_contextual_guidance.html.erb +0 -2
  15. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +0 -1
  16. data/app/views/govuk_publishing_components/components/_details.html.erb +1 -4
  17. data/app/views/govuk_publishing_components/components/_document_list.html.erb +0 -2
  18. data/app/views/govuk_publishing_components/components/_govspeak.html.erb +0 -2
  19. data/app/views/govuk_publishing_components/components/_heading.html.erb +24 -10
  20. data/app/views/govuk_publishing_components/components/_hint.html.erb +0 -3
  21. data/app/views/govuk_publishing_components/components/_inset_text.html.erb +1 -3
  22. data/app/views/govuk_publishing_components/components/_lead_paragraph.html.erb +0 -2
  23. data/app/views/govuk_publishing_components/components/_metadata.html.erb +0 -3
  24. data/app/views/govuk_publishing_components/components/_notice.html.erb +0 -2
  25. data/app/views/govuk_publishing_components/components/_password_input.html.erb +1 -3
  26. data/app/views/govuk_publishing_components/components/_radio.html.erb +0 -2
  27. data/app/views/govuk_publishing_components/components/_signup_link.html.erb +0 -1
  28. data/app/views/govuk_publishing_components/components/_single_page_notification_button.html.erb +3 -4
  29. data/app/views/govuk_publishing_components/components/_skip_link.html.erb +6 -1
  30. data/app/views/govuk_publishing_components/components/_step_by_step_nav.html.erb +17 -12
  31. data/app/views/govuk_publishing_components/components/_step_by_step_nav_header.html.erb +4 -7
  32. data/app/views/govuk_publishing_components/components/_step_by_step_nav_related.html.erb +6 -5
  33. data/app/views/govuk_publishing_components/components/docs/heading.yml +34 -10
  34. data/app/views/govuk_publishing_components/components/docs/inverse_header.yml +1 -1
  35. data/app/views/govuk_publishing_components/components/docs/organisation_logo.yml +9 -0
  36. data/app/views/govuk_publishing_components/components/docs/skip_link.yml +1 -0
  37. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav.yml +1 -0
  38. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_header.yml +1 -0
  39. data/app/views/govuk_publishing_components/components/docs/step_by_step_nav_related.yml +1 -0
  40. data/config/locales/ar.yml +0 -8
  41. data/config/locales/az.yml +0 -8
  42. data/config/locales/be.yml +0 -8
  43. data/config/locales/bg.yml +0 -8
  44. data/config/locales/bn.yml +0 -8
  45. data/config/locales/cs.yml +0 -8
  46. data/config/locales/cy.yml +0 -8
  47. data/config/locales/da.yml +0 -8
  48. data/config/locales/de.yml +0 -8
  49. data/config/locales/dr.yml +0 -8
  50. data/config/locales/el.yml +0 -8
  51. data/config/locales/en.yml +0 -8
  52. data/config/locales/es-419.yml +0 -8
  53. data/config/locales/es.yml +0 -8
  54. data/config/locales/et.yml +0 -8
  55. data/config/locales/fa.yml +0 -8
  56. data/config/locales/fi.yml +0 -8
  57. data/config/locales/fr.yml +0 -8
  58. data/config/locales/gd.yml +0 -8
  59. data/config/locales/gu.yml +0 -8
  60. data/config/locales/he.yml +0 -8
  61. data/config/locales/hi.yml +0 -8
  62. data/config/locales/hr.yml +0 -8
  63. data/config/locales/hu.yml +0 -8
  64. data/config/locales/hy.yml +0 -8
  65. data/config/locales/id.yml +0 -8
  66. data/config/locales/is.yml +0 -8
  67. data/config/locales/it.yml +0 -8
  68. data/config/locales/ja.yml +0 -8
  69. data/config/locales/ka.yml +0 -8
  70. data/config/locales/kk.yml +0 -8
  71. data/config/locales/ko.yml +0 -8
  72. data/config/locales/lt.yml +0 -8
  73. data/config/locales/lv.yml +0 -8
  74. data/config/locales/ms.yml +0 -8
  75. data/config/locales/mt.yml +0 -8
  76. data/config/locales/nl.yml +0 -8
  77. data/config/locales/no.yml +0 -8
  78. data/config/locales/pa-pk.yml +0 -8
  79. data/config/locales/pa.yml +0 -8
  80. data/config/locales/pl.yml +0 -8
  81. data/config/locales/ps.yml +0 -8
  82. data/config/locales/pt.yml +0 -8
  83. data/config/locales/ro.yml +0 -8
  84. data/config/locales/ru.yml +0 -8
  85. data/config/locales/si.yml +0 -8
  86. data/config/locales/sk.yml +0 -8
  87. data/config/locales/sl.yml +0 -8
  88. data/config/locales/so.yml +0 -8
  89. data/config/locales/sq.yml +0 -8
  90. data/config/locales/sr.yml +0 -8
  91. data/config/locales/sv.yml +0 -8
  92. data/config/locales/sw.yml +0 -8
  93. data/config/locales/ta.yml +0 -8
  94. data/config/locales/th.yml +0 -8
  95. data/config/locales/tk.yml +0 -8
  96. data/config/locales/tr.yml +0 -8
  97. data/config/locales/uk.yml +0 -8
  98. data/config/locales/ur.yml +0 -8
  99. data/config/locales/uz.yml +0 -8
  100. data/config/locales/vi.yml +0 -8
  101. data/config/locales/zh-hk.yml +0 -8
  102. data/config/locales/zh-tw.yml +0 -8
  103. data/config/locales/zh.yml +0 -8
  104. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +13 -0
  105. data/lib/govuk_publishing_components/presenters/heading_helper.rb +3 -3
  106. data/lib/govuk_publishing_components/presenters/organisation_logo_helper.rb +3 -1
  107. data/lib/govuk_publishing_components/version.rb +1 -1
  108. data/lib/govuk_publishing_components.rb +0 -1
  109. metadata +3 -38
  110. data/app/assets/javascripts/govuk_publishing_components/components/chart.js +0 -1
  111. data/app/assets/stylesheets/govuk_publishing_components/components/_chart.scss +0 -57
  112. data/app/assets/stylesheets/govuk_publishing_components/components/_chat-entry.scss +0 -39
  113. data/app/views/govuk_publishing_components/components/_chart.html.erb +0 -147
  114. data/app/views/govuk_publishing_components/components/_chat_entry.html.erb +0 -55
  115. data/app/views/govuk_publishing_components/components/docs/chart.yml +0 -576
  116. data/app/views/govuk_publishing_components/components/docs/chat_entry.yml +0 -45
  117. data/lib/govuk_publishing_components/presenters/chart_helper.rb +0 -112
  118. data/node_modules/chartkick/LICENSE.txt +0 -22
  119. data/node_modules/chartkick/README.md +0 -593
  120. data/node_modules/chartkick/chart.js/chart.esm.js +0 -5
  121. data/node_modules/chartkick/chart.js/package.json +0 -6
  122. data/node_modules/chartkick/dist/chartkick.esm.js +0 -2562
  123. data/node_modules/chartkick/dist/chartkick.js +0 -2570
  124. data/node_modules/chartkick/dist/chartkick.min.js +0 -2
  125. data/node_modules/chartkick/highcharts/highcharts.esm.js +0 -4
  126. data/node_modules/chartkick/highcharts/package.json +0 -6
  127. data/node_modules/chartkick/package.json +0 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 36483f22d5d78ac563f819c7638cd059053b38a5df71a48b6ae6d8eef6e21a2c
4
- data.tar.gz: 60063513c4f84e2107e77a4b670f2dabcd95efc6650a72dda3097deb1caf4ed9
3
+ metadata.gz: fd401f42bccab58df5ab5fb8d73e8faca9662f68038087b3fe103f0fd383bd21
4
+ data.tar.gz: 14202a57ad52922b57252c5484bfe7540dbc0d1e2c83690881bf4aed17cc185b
5
5
  SHA512:
6
- metadata.gz: c9932de97294ccc4e51ce64fc07cfffd11b39d882f0ed69690e0f0e19a4e7fb57af59b10932a80c8a7bd0d23a87abc8486e7f072ab7fc34c0da25f8f11b5d26a
7
- data.tar.gz: 2ded4ab1c925b4af9171cbe11412e38b9fc56dff8de8428254413115b06d370a8d29621c62c0e8d76e603c82c4042c229e41b27962d52076c8ddfe8fc9c23336
6
+ metadata.gz: ef6d0b85a5a028746ca5df2d9dd301cae0401b22d3b9aac4bad2beeeba292ba128940284539b68c1ccc9d6ecd175ab9173bb4e7e49e411f2d252b3a53dda17e9
7
+ data.tar.gz: 9692404de6256b99bd839ab47e7dd26b52d3641cf51c503caa7d530a7c5a98cf826e47af9deb3f26701805ff8048e9ba2bb2824d69988388cce1ae3412bb294c
@@ -340,6 +340,11 @@ window.GOVUK.analyticsGa4 = window.GOVUK.analyticsGa4 || {};
340
340
 
341
341
  if (isSearchResult) {
342
342
  var searchQuery = window.GOVUK.analyticsGa4.core.trackFunctions.standardiseSearchTerm(element.getAttribute('data-ga4-search-query'))
343
+
344
+ // Limit tracked search term to 500 characters
345
+ if (searchQuery) {
346
+ searchQuery = searchQuery.substring(0, 500)
347
+ }
343
348
  var variant = element.getAttribute('data-ga4-ecommerce-variant')
344
349
  DEFAULT_LIST_TITLE = 'Site search results'
345
350
  }
@@ -66,7 +66,8 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
66
66
  search_term: this.getSearchTerm(),
67
67
  tool_name: this.getToolName(),
68
68
  spelling_suggestion: this.getMetaContent('spelling-suggestion'),
69
- discovery_engine_attribution_token: this.getMetaContent('discovery-engine-attribution-token')
69
+ discovery_engine_attribution_token: this.getMetaContent('discovery-engine-attribution-token'),
70
+ canonical_url: this.getCanonicalHref()
70
71
  }
71
72
  }
72
73
  window.GOVUK.analyticsGa4.core.sendData(data)
@@ -79,6 +80,14 @@ window.GOVUK.analyticsGa4.analyticsModules = window.GOVUK.analyticsGa4.analytics
79
80
  }
80
81
  },
81
82
 
83
+ getCanonicalHref: function () {
84
+ var link = document.querySelector('link[rel=canonical]')
85
+
86
+ if (link) {
87
+ return link.href
88
+ }
89
+ },
90
+
82
91
  getLocation: function () {
83
92
  // We don't want to remove dates on search pages.
84
93
  return this.PIIRemover.stripPIIWithOverride(this.stripGaParam(document.location.href), this.stripDates, true)
@@ -19,7 +19,6 @@
19
19
  @import "components/button";
20
20
  @import "components/cards";
21
21
  @import "components/character-count";
22
- @import "components/chat-entry";
23
22
  @import "components/checkboxes";
24
23
  @import "components/contents-list";
25
24
  @import "components/contextual-guidance";
@@ -1,6 +1,7 @@
1
1
  @import "govuk_publishing_components/individual_component_support";
2
2
 
3
- .gem-c-heading {
3
+ .gem-c-heading,
4
+ .gem-c-heading__text {
4
5
  margin: 0;
5
6
  }
6
7
 
@@ -9,18 +10,6 @@
9
10
  @include govuk-font(27, $weight: bold);
10
11
  }
11
12
 
12
- // special case for publications and consultations pages
13
- // separated to allow normalisation of the component for wider use
14
- .gem-c-heading--mobile-top-margin {
15
- margin-top: govuk-spacing(6);
16
- margin-bottom: govuk-spacing(3);
17
-
18
- @include govuk-media-query($from: tablet) {
19
- margin-top: 0;
20
- margin-bottom: govuk-spacing(6);
21
- }
22
- }
23
-
24
13
  .gem-c-heading--padding {
25
14
  padding: govuk-spacing(3) 0;
26
15
  }
@@ -43,7 +32,10 @@
43
32
  }
44
33
 
45
34
  .gem-c-heading--inverse {
46
- color: govuk-colour("white");
35
+ .gem-c-heading__context,
36
+ .gem-c-heading__text {
37
+ color: govuk-colour("white");
38
+ }
47
39
  }
48
40
 
49
41
  // stylelint-disable declaration-no-important
@@ -82,6 +82,10 @@
82
82
  }
83
83
  }
84
84
 
85
+ .gem-c-organisation-logo__link-hide-underline:link:not(:hover) {
86
+ text-decoration: none;
87
+ }
88
+
85
89
  .gem-c-organisation-logo--inverse {
86
90
  .gem-c-organisation-logo__container {
87
91
  border-color: govuk-colour("white");
@@ -9,8 +9,8 @@ $highlight-answer-color: govuk-colour("white");
9
9
  background-color: $highlight-answer-bg-color;
10
10
  color: $highlight-answer-color;
11
11
  text-align: center;
12
- padding: 1.75em .75em 1.25em;
13
- margin: 0 0 1em;
12
+ padding: govuk-spacing(5) govuk-spacing(2) govuk-spacing(4);
13
+ margin: 0 0 govuk-spacing(2);
14
14
 
15
15
  p {
16
16
  color: $highlight-answer-color;
@@ -18,7 +18,7 @@ $highlight-answer-color: govuk-colour("white");
18
18
 
19
19
  em {
20
20
  display: block;
21
- padding-top: .1em;
21
+ padding-top: govuk-spacing(2);
22
22
  color: $highlight-answer-color;
23
23
  @include govuk-font($size: 80, $weight: bold);
24
24
  }
@@ -29,7 +29,7 @@ $highlight-answer-color: govuk-colour("white");
29
29
  }
30
30
 
31
31
  @include govuk-media-query($until: tablet) {
32
- margin: 0 0 1em;
32
+ margin: 0 0 govuk-spacing(2);
33
33
  @include govuk-font($size: 48);
34
34
 
35
35
  p {
@@ -83,7 +83,7 @@ module GovukPublishingComponents
83
83
  end
84
84
 
85
85
  def github_search_url
86
- params = { q: "org:alphagov components/components/#{id}", type: "Code" }
86
+ params = { q: "org:alphagov #{partial_path}", type: "Code" }
87
87
  "https://github.com/search?#{params.to_query}"
88
88
  end
89
89
 
@@ -8,6 +8,7 @@ This component uses the component wrapper helper. It accepts the following optio
8
8
  - `data_attributes` - accepts a hash of data attributes
9
9
  - `aria` - accepts a hash of aria attributes
10
10
  - `classes` - accepts a space separated string of classes, these should not be used for styling and must be prefixed with `js-`
11
+ - `margin_bottom` - accepts a number from `0` to `9` (`0px` to `60px`) using the [GOV.UK Frontend spacing scale](https://design-system.service.gov.uk/styles/spacing/#the-responsive-spacing-scale) (defaults to no margin)
11
12
  - `role` - accepts a space separated string of roles
12
13
  - `lang` - accepts a language attribute value
13
14
  - `open` - accepts an open attribute value (true or false)
@@ -50,7 +50,7 @@
50
50
  href: "#other-examples",
51
51
  text: "Other examples",
52
52
  items: other_examples_links
53
- } if @component_doc.other_examples.any?),
53
+ } if @component_doc.other_examples.any? or @component_doc.uses_component_wrapper_helper?),
54
54
  ].compact
55
55
  %>
56
56
  <%= render "govuk_publishing_components/components/contents_list", {
@@ -92,7 +92,7 @@
92
92
  </div>
93
93
  <% end %>
94
94
 
95
- <% if @component_doc.other_examples.any? %>
95
+ <% if @component_doc.other_examples.any? or @component_doc.uses_component_wrapper_helper? %>
96
96
  <div class="examples">
97
97
  <h2 class="component-doc-h2" id="other-examples">Other examples</h2>
98
98
 
@@ -13,8 +13,6 @@
13
13
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
14
  component_helper.set_id(id)
15
15
  component_helper.add_class("gem-c-accordion govuk-accordion")
16
- component_helper.add_class(shared_helper.get_margin_bottom)
17
-
18
16
  component_helper.add_data_attribute({ module: "govuk-accordion gem-accordion" })
19
17
  component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless disable_ga4
20
18
  component_helper.add_data_attribute({ ga4_expandable: "" }) unless disable_ga4
@@ -2,8 +2,6 @@
2
2
  add_gem_component_stylesheet("action-link")
3
3
 
4
4
  local_assigns[:margin_bottom] ||= 0
5
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
6
-
7
5
  text ||= false
8
6
  nowrap_text ||= false
9
7
  href ||= false
@@ -26,7 +24,6 @@
26
24
  css_classes << "gem-c-action-link--simple-light" if simple_light
27
25
  css_classes << "gem-c-action-link--with-subtext" if subtext
28
26
  css_classes << "gem-c-action-link--mobile-subtext" if mobile_subtext
29
- css_classes << shared_helper.get_margin_bottom
30
27
 
31
28
  link_classes = %w(govuk-link gem-c-action-link__link gem-c-force-print-link-styles)
32
29
  link_classes << "govuk-link--inverse" if inverse
@@ -9,7 +9,6 @@
9
9
  local_assigns[:aria] ||= {}
10
10
  local_assigns[:margin_bottom] ||= 4
11
11
 
12
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
13
12
  cl_helper = GovukPublishingComponents::Presenters::ContentsListHelper.new(local_assigns)
14
13
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
15
14
 
@@ -29,7 +28,6 @@
29
28
  component_helper.add_class("gem-c-contents-list #{brand_helper.brand_class}")
30
29
  component_helper.add_class("gem-c-contents-list--alternative-line-style") if alternative_line_style
31
30
  component_helper.add_class("gem-c-contents-list--custom-title") if title
32
- component_helper.add_class(shared_helper.get_margin_bottom)
33
31
  component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
34
32
  component_helper.add_aria_attribute({ label: t("components.contents_list.contents") }) unless local_assigns[:aria][:label]
35
33
  component_helper.add_role("navigation")
@@ -10,9 +10,7 @@
10
10
  component_helper.set_id(id)
11
11
  component_helper.add_class("gem-c-contextual-guidance")
12
12
  component_helper.add_data_attribute({ module: "contextual-guidance" })
13
-
14
13
  %>
15
-
16
14
  <%= tag.div(**component_helper.all_attributes) do %>
17
15
  <%= tag.div class: "govuk-grid-row" do %>
18
16
  <%= tag.div class: "govuk-grid-column-two-thirds" do %>
@@ -4,7 +4,6 @@
4
4
  disable_ga4 ||= false
5
5
  request.query_parameters[:disable_ga4] = disable_ga4
6
6
  navigation = GovukPublishingComponents::Presenters::ContextualNavigation.new(content_item, request)
7
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
8
7
  show_ukraine_cta = navigation.show_ukraine_cta?
9
8
  ga4_tracking_counts = OpenStruct.new(index_section_count: 0)
10
9
  ga4_tracking_counts.index_section_count = 1 if show_ukraine_cta
@@ -1,14 +1,12 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("details")
3
3
 
4
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
5
4
  open ||= nil
6
5
  disable_ga4 ||= false
7
6
  @ga4 ||= OpenStruct.new(index_section: 0) unless disable_ga4
8
7
  @ga4[:index_section] += 1 unless disable_ga4
9
8
  ga4_attributes ||= {}
10
-
11
- margin_bottom ||= 3
9
+ local_assigns[:margin_bottom] ||= 3
12
10
 
13
11
  unless disable_ga4
14
12
  ga4_event = {
@@ -25,7 +23,6 @@
25
23
 
26
24
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
27
25
  component_helper.add_class("gem-c-details govuk-details")
28
- component_helper.add_class(shared_helper.get_margin_bottom)
29
26
  component_helper.add_data_attribute({ module: "ga4-event-tracker" }) unless disable_ga4
30
27
  component_helper.add_data_attribute({ ga4_event: ga4_event }) unless disable_ga4
31
28
  component_helper.set_open(open)
@@ -2,7 +2,6 @@
2
2
  add_gem_component_stylesheet("document-list")
3
3
 
4
4
  local_assigns[:margin_bottom] ||= 5
5
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
6
5
  items ||= []
7
6
 
8
7
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
@@ -10,7 +9,6 @@
10
9
  component_helper.add_class("gem-c-document-list--no-top-border") if local_assigns[:remove_top_border]
11
10
  component_helper.add_class("gem-c-document-list--no-top-border-first-child") if local_assigns[:remove_top_border_from_first_child]
12
11
  component_helper.add_class("gem-c-document-list--equal-item-spacing") if local_assigns[:equal_item_spacing]
13
- component_helper.add_class(shared_helper.get_margin_bottom)
14
12
 
15
13
  extra_link_classes = "govuk-link--no-underline" if local_assigns[:remove_underline]
16
14
  title_with_context_class = " gem-c-document-list__item-title--context"
@@ -6,13 +6,11 @@
6
6
  direction_class = "gem-c-govspeak--direction-#{direction}" if local_assigns.include?(:direction)
7
7
  disable_youtube_expansions = local_assigns.fetch(:disable_youtube_expansions) if local_assigns.include?(:disable_youtube_expansions)
8
8
 
9
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
10
9
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
11
10
  component_helper.add_class("gem-c-govspeak govuk-govspeak")
12
11
  component_helper.add_class(direction_class) if direction_class
13
12
  component_helper.add_class("js-disable-youtube") if disable_youtube_expansions
14
13
  component_helper.add_class("gem-c-govspeak--inverse") if inverse
15
- component_helper.add_class(shared_helper.get_margin_bottom)
16
14
  component_helper.add_data_attribute({ module: "govspeak" })
17
15
  %>
18
16
  <%= tag.div(**component_helper.all_attributes) do %>
@@ -3,22 +3,36 @@
3
3
 
4
4
  brand ||= false
5
5
  lang = local_assigns[:lang].presence
6
+ context ||= false
7
+ context_locale ||= false
8
+ context_inside ||= false
6
9
 
7
10
  brand_helper = GovukPublishingComponents::AppHelpers::BrandHelper.new(brand)
8
11
  heading_helper = GovukPublishingComponents::Presenters::HeadingHelper.new(local_assigns)
9
12
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
10
13
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
11
14
 
12
- classes = %w(gem-c-heading)
13
- classes << heading_helper.classes
14
- classes << brand_helper.brand_class
15
- classes << brand_helper.border_color_class
16
- classes << shared_helper.get_margin_bottom if [*0..9].include?(local_assigns[:margin_bottom])
17
-
18
- component_helper.add_class(classes.join(" "))
15
+ component_helper.add_class("gem-c-heading")
16
+ component_helper.add_class(heading_helper.classes)
17
+ component_helper.add_class(brand_helper.brand_class)
18
+ component_helper.add_class(brand_helper.border_color_class)
19
19
  component_helper.set_id(heading_helper.id)
20
- element = shared_helper.get_heading_level
21
20
  %>
22
- <%= content_tag(element, component_helper.all_attributes) do %>
23
- <%= text %>
21
+ <% context_block = capture do %>
22
+ <span class="govuk-caption-xl gem-c-heading__context" <%= "lang=#{context_locale}" if context_locale.present? %>>
23
+ <%= context %>
24
+ </span>
25
+ <% end %>
26
+
27
+ <%= tag.div(**component_helper.all_attributes) do %>
28
+ <% if context && !context_inside %>
29
+ <%= context_block %>
30
+ <% end %>
31
+
32
+ <%= content_tag(shared_helper.get_heading_level, class: heading_helper.heading_classes) do %>
33
+ <% if context && context_inside %>
34
+ <%= context_block %>
35
+ <% end %>
36
+ <%= text %>
37
+ <% end %>
24
38
  <% end %>
@@ -4,14 +4,11 @@
4
4
  local_assigns[:id] ||= "hint-#{SecureRandom.hex(4)}"
5
5
  is_radio_label_hint ||= false
6
6
  right_to_left ||= false
7
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
8
7
 
9
8
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
10
9
  component_helper.add_class("gem-c-hint govuk-hint")
11
10
  component_helper.add_class("govuk-radios__hint") if is_radio_label_hint
12
- component_helper.add_class(shared_helper.get_margin_bottom) if [*0..9].include?(local_assigns[:margin_bottom])
13
11
  %>
14
-
15
12
  <%= tag.div(**component_helper.all_attributes, dir: right_to_left ? "rtl" : nil) do %>
16
13
  <%= text %>
17
14
  <% end %>
@@ -3,17 +3,15 @@
3
3
 
4
4
  id ||= "inset-text-#{SecureRandom.hex(4)}"
5
5
  margin_top ||= 6
6
- margin_bottom ||= 6
6
+ local_assigns[:margin_bottom] ||= 6
7
7
 
8
8
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new({
9
9
  margin_top: margin_top,
10
- margin_bottom: margin_bottom
11
10
  })
12
11
 
13
12
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
13
  component_helper.add_class("gem-c-inset-text govuk-inset-text gem-c-force-print-link-styles-within")
15
14
  component_helper.add_class(shared_helper.get_margin_top)
16
- component_helper.add_class(shared_helper.get_margin_bottom)
17
15
  component_helper.set_id(id)
18
16
  %>
19
17
  <%= tag.div(**component_helper.all_attributes) do %>
@@ -3,12 +3,10 @@
3
3
 
4
4
  text ||= ""
5
5
  inverse ||= false
6
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
7
6
 
8
7
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
9
8
  component_helper.add_class("gem-c-lead-paragraph")
10
9
  component_helper.add_class("gem-c-lead-paragraph--inverse") if inverse
11
- component_helper.add_class(shared_helper.get_margin_bottom) if [*0..9].include?(local_assigns[:margin_bottom])
12
10
  %>
13
11
  <% if text.present? %>
14
12
  <%= tag.p(**component_helper.all_attributes) do %>
@@ -16,8 +16,6 @@
16
16
  direction_class = ""
17
17
  direction_class = " direction-#{direction}" if local_assigns.include?(:direction)
18
18
 
19
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
20
-
21
19
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
22
20
  component_helper.add_class("gem-c-metadata")
23
21
  component_helper.add_class("direction-#{direction}") if local_assigns.include?(:direction)
@@ -27,7 +25,6 @@
27
25
  component_helper.add_class("gem-c-metadata--inverse-padded") unless inverse_compress
28
26
  end
29
27
 
30
- component_helper.add_class(shared_helper.get_margin_bottom) if local_assigns[:margin_bottom]
31
28
  component_helper.add_data_attribute({ module: "metadata" })
32
29
 
33
30
  disable_ga4 ||= false
@@ -15,10 +15,8 @@
15
15
  show_banner_title ||= false
16
16
  heading_level = show_banner_title ? "h3" : "h2"
17
17
 
18
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
19
18
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
20
19
  component_helper.add_class("govuk-notification-banner gem-c-notice")
21
- component_helper.add_class(shared_helper.get_margin_bottom)
22
20
 
23
21
  component_helper.add_aria_attribute({ label: "Notice" })
24
22
  component_helper.add_aria_attribute({ live: "polite" }) if aria_live
@@ -2,7 +2,7 @@
2
2
  add_gem_component_stylesheet("password-input")
3
3
 
4
4
  label_text ||= t("components.password_input.label")
5
-
5
+ local_assigns[:margin_bottom] ||= 3
6
6
  error_text ||= nil
7
7
  error_text_prefix ||= t("components.password_input.error_text_prefix")
8
8
 
@@ -15,7 +15,6 @@
15
15
 
16
16
  name ||= "password"
17
17
 
18
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
19
18
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
20
19
  component_helper.add_data_attribute({
21
20
  module: "govuk-password-input",
@@ -30,7 +29,6 @@
30
29
  component_helper.add_class('govuk-form-group--error') if error_text
31
30
  component_helper.add_class('govuk-password-input')
32
31
  component_helper.add_class('gem-c-password-input')
33
- component_helper.add_class(shared_helper.get_margin_bottom)
34
32
 
35
33
  uid = SecureRandom.hex(4)
36
34
 
@@ -31,7 +31,6 @@
31
31
  hint ||= nil
32
32
  error_message ||= nil
33
33
  error_items ||= []
34
- margin_bottom = margin_bottom ||= 6
35
34
 
36
35
  has_error = error_message || error_items.any?
37
36
  hint_id = "hint-#{SecureRandom.hex(4)}" if hint
@@ -40,7 +39,6 @@
40
39
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
41
40
  component_helper.add_class("govuk-form-group")
42
41
  component_helper.add_class("govuk-form-group--error") if has_error
43
- component_helper.add_class(shared_helper.get_margin_bottom)
44
42
  component_helper.set_id(id)
45
43
 
46
44
  radio_classes = %w(govuk-radios)
@@ -12,7 +12,6 @@
12
12
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
13
13
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
14
  component_helper.add_class("gem-c-signup-link govuk-!-display-none-print")
15
- component_helper.add_class(shared_helper.get_margin_bottom)
16
15
  component_helper.add_class("gem-c-signup-link--link-only") unless heading
17
16
  component_helper.add_class("gem-c-signup-link--with-background-and-border") if background
18
17
  %>
@@ -1,18 +1,17 @@
1
1
  <%
2
2
  add_gem_component_stylesheet("single-page-notification-button")
3
3
 
4
+ local_assigns[:margin_bottom] ||= 3
5
+
4
6
  spnb_helper = GovukPublishingComponents::Presenters::SinglePageNotificationButtonHelper.new(local_assigns)
5
7
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
6
8
  component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
7
9
 
8
- wrapper_classes = %w(govuk-!-display-none-print)
9
- wrapper_classes << shared_helper.get_margin_bottom
10
-
11
10
  ga4_data_attributes = ga4_data_attributes ||= nil
12
11
  ga4_link_data_attributes = ga4_data_attributes[:ga4_link] if ga4_data_attributes
13
12
  ga4_link_data_attributes[:url] = spnb_helper.form_action if ga4_link_data_attributes
14
13
 
15
- component_helper.add_class(wrapper_classes.join(" "))
14
+ component_helper.add_class("govuk-!-display-none-print")
16
15
  component_helper.add_data_attribute({ module: ga4_data_attributes[:module] }) if ga4_data_attributes
17
16
  %>
18
17
  <% button_text = capture do %>
@@ -3,5 +3,10 @@
3
3
 
4
4
  href ||= '#main-content'
5
5
  text ||= t('components.skip_link.text')
6
+
7
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
8
+ component_helper.add_class("gem-c-skip-link govuk-skip-link govuk-!-display-none-print")
9
+ component_helper.add_data_attribute({ module: "govuk-skip-link" })
10
+
6
11
  %>
7
- <%= link_to(text, href, class: "gem-c-skip-link govuk-skip-link govuk-!-display-none-print", data: { module: "govuk-skip-link" }) %>
12
+ <%= link_to(text, href, **component_helper.all_attributes) %>
@@ -19,19 +19,24 @@
19
19
  step_nav_helper = GovukPublishingComponents::Presenters::StepByStepNavHelper.new
20
20
 
21
21
  disable_ga4 ||= false
22
+
23
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
24
+ component_helper.add_data_attribute({
25
+ module: "gemstepnav",
26
+ show_text: t("components.step_by_step_nav.show"),
27
+ hide_text: t("components.step_by_step_nav.hide"),
28
+ show_all_text: t("components.step_by_step_nav.show_all"),
29
+ hide_all_text: t("components.step_by_step_nav.hide_all")
30
+ })
31
+ component_helper.add_data_attribute({ module: "ga4-event-tracker", ga4_expandable: "", }) unless disable_ga4
32
+ component_helper.add_data_attribute({ remember: "" }) if remember_last_step
33
+ component_helper.add_data_attribute({ id: tracking_id }) if tracking_id
34
+ component_helper.add_class("gem-c-step-nav js-hidden")
35
+ component_helper.add_class("govuk-!-display-none-print") if small
36
+ component_helper.add_class("gem-c-step-nav--large") unless small
22
37
  %>
23
38
  <% if steps %>
24
- <div
25
- data-module="gemstepnav<% unless disable_ga4 %> ga4-event-tracker<% end %>"
26
- <%= "data-ga4-expandable" unless disable_ga4 %>
27
- class="gem-c-step-nav js-hidden <% if small %>govuk-!-display-none-print<% end %> <% unless small %>gem-c-step-nav--large<% end %>"
28
- <%= "data-remember" if remember_last_step %>
29
- <%= "data-id=#{tracking_id}" if tracking_id %>
30
- data-show-text="<%= t("components.step_by_step_nav.show") %>"
31
- data-hide-text="<%= t("components.step_by_step_nav.hide") %>"
32
- data-show-all-text="<%= t("components.step_by_step_nav.show_all") %>"
33
- data-hide-all-text="<%= t("components.step_by_step_nav.hide_all") %>"
34
- >
39
+ <%= tag.div(**component_helper.all_attributes) do %>
35
40
  <ol class="gem-c-step-nav__steps">
36
41
  <% steps.each_with_index do |step, step_index| %>
37
42
  <%
@@ -115,5 +120,5 @@
115
120
  </li>
116
121
  <% end %>
117
122
  </ol>
118
- </div>
123
+ <% end %>
119
124
  <% end %>
@@ -10,10 +10,11 @@
10
10
  ]
11
11
  breadcrumb_presenter = GovukPublishingComponents::Presenters::Breadcrumbs.new(breadcrumbs)
12
12
 
13
- data = {}
14
- data[:module] = "ga4-link-tracker" unless disable_ga4
13
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
14
+ component_helper.add_class("gem-c-step-nav-header")
15
15
 
16
16
  unless disable_ga4
17
+ component_helper.add_data_attribute({ module: "ga4-link-tracker" })
17
18
  ga4_data = {
18
19
  event_name: "navigation",
19
20
  type: "super breadcrumb",
@@ -21,17 +22,13 @@
21
22
  index_total: "1",
22
23
  }.to_json
23
24
  end
24
-
25
- shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
26
- classes = %w[gem-c-step-nav-header]
27
- classes << shared_helper.get_margin_bottom if local_assigns[:margin_bottom]
28
25
  %>
29
26
  <% if title %>
30
27
  <script type="application/ld+json">
31
28
  <%= raw JSON.pretty_generate(breadcrumb_presenter.structured_data) %>
32
29
  </script>
33
30
 
34
- <%= tag.div(class: classes, data: data) do %>
31
+ <%= tag.div(**component_helper.all_attributes) do %>
35
32
  <strong class="gem-c-step-nav-header__part-of">Part of</strong>
36
33
  <% if path %>
37
34
  <a href="<%= path %>"
@@ -4,13 +4,14 @@
4
4
  links ||= []
5
5
  pretitle ||= t("components.step_by_step_nav_related.part_of")
6
6
  always_display_as_list ||= false
7
- classes = %w(gem-c-step-nav-related)
8
- classes << "gem-c-step-nav-related--singular" if links.length == 1
9
- data = {}
10
- data[:module] = "ga4-link-tracker" unless disable_ga4
7
+
8
+ component_helper = GovukPublishingComponents::Presenters::ComponentWrapperHelper.new(local_assigns)
9
+ component_helper.add_class("gem-c-step-nav-related")
10
+ component_helper.add_class("gem-c-step-nav-related--singular") if links.length == 1
11
+ component_helper.add_data_attribute({ module: "ga4-link-tracker" }) unless disable_ga4
11
12
  %>
12
13
  <% if links.any? %>
13
- <%= tag.div(class: classes, data: data) do %>
14
+ <%= tag.div(**component_helper.all_attributes) do %>
14
15
  <h2 class="gem-c-step-nav-related__heading">
15
16
  <span class="gem-c-step-nav-related__pretitle"><%= pretitle %></span>
16
17
  <% if links.length == 1 && !always_display_as_list %>